(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3185],{76750:function(e,t,r){Promise.resolve().then(r.t.bind(r,58877,23)),Promise.resolve().then(r.bind(r,19082)),Promise.resolve().then(r.bind(r,89286)),Promise.resolve().then(r.bind(r,60556)),Promise.resolve().then(r.bind(r,85153)),Promise.resolve().then(r.bind(r,27273)),Promise.resolve().then(r.bind(r,73513)),Promise.resolve().then(r.bind(r,27744)),Promise.resolve().then(r.t.bind(r,231,23)),Promise.resolve().then(r.t.bind(r,84080,23)),Promise.resolve().then(r.bind(r,10912)),Promise.resolve().then(r.bind(r,61481)),Promise.resolve().then(r.t.bind(r,4338,23)),Promise.resolve().then(r.bind(r,49503))},19082:function(e,t,r){"use strict";r.d(t,{NextAuthProvider:function(){return a}});var n=r(57437),s=r(30998);let a=e=>{let{children:t,session:r}=e;return(0,n.jsx)(s.SessionProvider,{session:r,children:t})}},37126:function(e,t,r){"use strict";function n(e){return new Promise((t,r)=>{let n=document.createElement("video");n.onloadeddata=()=>t(n),n.onerror=e=>{console.error(e),r(Error("Could not load video"))},n.crossOrigin="anonymous",n.src=e})}async function s(e){let t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=Object.assign(new Promise((e,n)=>{t=e,r=n}),{resolve:t,reject:r}),a=!1,o=()=>{if(!a){if(!(e.readyState>=e.HAVE_METADATA))return;a=!0,e.currentTime=n}if(e.readyState>=e.HAVE_CURRENT_DATA){let t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;let r=t.getContext("2d");if(!r)throw Error("Could not get 2d context");r.drawImage(e,0,0),s.resolve(t.toDataURL())}},i=e=>{console.error(e),s.reject(Error("Could not get video frame"))};e.addEventListener("loadedmetadata",o),e.addEventListener("loadeddata",o),e.addEventListener("canplay",o),e.addEventListener("seeked",o),e.addEventListener("error",i),e.addEventListener("stalled",i),o();try{return await s}finally{e.removeEventListener("loadedmetadata",o),e.removeEventListener("loadeddata",o),e.removeEventListener("canplay",o),e.removeEventListener("seeked",o),e.removeEventListener("error",i),e.removeEventListener("stalled",i)}}function a(e){let t=[...e];for(let e=t.length-1;e>0;e--){let r=Math.floor(Math.random()*(e+1));[t[e],t[r]]=[t[r],t[e]]}return t}function o(e){let[t,r]=e.split(" ");return r?"".concat(t[0]).concat(r[0]):t.slice(0,2)}function i(e){return"https://corsproxy.io/?"+encodeURIComponent(e)}function l(e){let t=e.getAttribute("src");if(t){if(t.startsWith("data:image/")){console.log("Base64 image detected, no proxying.");return}let r=i(t);e.setAttribute("src",r)}}function d(e){let t=window.getComputedStyle(e).getPropertyValue("background-image").match(/url\("(.*?)"\)/);if(t&&t[1]){let r=i(t[1]);console.log(r),e.style.backgroundImage="url(".concat(r,")")}}function c(e){e.querySelectorAll('[data-shape-type="ai-pdf"], [data-shape-type="ai-audio"], [data-shape-type="custom-embed"], [data-shape-type="video"], [data-type-shape="ai-lexical-editor"]').forEach(e=>{e.remove()}),e.querySelectorAll("img").forEach(l),e.querySelectorAll('[class^="tl-image"]').forEach(d)}r.d(t,{EK:function(){return c},G$:function(){return m},Sy:function(){return a},TT:function(){return s},Zh:function(){return o},o2:function(){return n},zG:function(){return u}});let u=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return e=>t.reduce((e,t)=>t(e),e)};function m(){let e=navigator.userAgent.toLowerCase(),t=e.indexOf("chrome")>-1,r=e.indexOf("safari")>-1&&!t,n=/mac/.test(e),s=["iphone","ipad","ipod"].some(t=>e.indexOf(t)>-1),a=/win/.test(e),o=/android/.test(e);return{isChrome:t,isSafari:r,isOSX:n,isIOS:s,isApple:n||s,isWindows:a,isAndroid:o,isLinux:/linux/.test(e),isMobile:s||o}}},89286:function(e,t,r){"use strict";r.d(t,{N:function(){return l},default:function(){return i}});var n=r(57437),s=r(31877),a=r(16463),o=r(2265);function i(e){let{GA_MEASUREMENT_ID:t,DEBUG:r=!1,userId:i}=e,l=(0,a.usePathname)(),d=(0,a.useSearchParams)();return(0,o.useEffect)(()=>{let e="".concat(l,"?").concat(d.toString());window.gtag&&window.gtag("config",t,{page_path:e,debug_mode:r}),i&&window.gtag("set","user_properties",{user_id:i})},[l,d,t,r,i]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.default,{strategy:"afterInteractive",src:"https://www.googletagmanager.com/gtag/js?id=".concat(t)}),(0,n.jsx)(s.default,{id:"google-analytics",strategy:"afterInteractive",dangerouslySetInnerHTML:{__html:"\n                window.dataLayer = window.dataLayer || [];\n                function gtag(){dataLayer.push(arguments);}\n                gtag('js', new Date());\n\n                "}})]})}function l(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];window.dataLayer?window.dataLayer.push(arguments):console.warn("GA dataLayer does not exist")}},60556:function(e,t,r){"use strict";r.d(t,{HeaderIcon:function(){return a}});var n=r(57437),s=r(87138);let a=()=>(0,n.jsx)("div",{className:"self-center  text-center  absolute left-1/2 transform -translate-x-1/2",children:(0,n.jsxs)(s.default,{className:"self-center ",href:"/",children:[(0,n.jsx)("span",{className:"relative whitespace-nowrap text-3xl font-bold bg-clip-text ",children:(0,n.jsx)("span",{className:"relative text-orange-700 text-3xl font-black",children:"mix"})}),(0,n.jsx)("span",{className:"text-3xl font-black text-[#1A2C33] dark:text-[#DAD1C1] transition-colors duration-0 cursor-pointer",children:"flow.ai"})]})})},85153:function(e,t,r){"use strict";r.d(t,{HeaderLeftSide:function(){return v}});var n=r(57437),s=r(2265),a=r(30998),o=r(87138),i=r(73513),l=r(50495),d=r(46910),c=r(16356),u=r(37126);function m(e){var t;let{user:r}=e;return(0,n.jsx)("div",{className:"flex items-center justify-between",children:(0,n.jsxs)(d.h_,{children:[(0,n.jsx)(d.$F,{asChild:!0,children:(0,n.jsxs)(l.z,{variant:"ghost",size:"sm",className:"px-0",children:[(null==r?void 0:r.image)?(0,n.jsx)("img",{referrerPolicy:"no-referrer",className:"w-6 h-6 transition-opacity duration-300 rounded-full select-none ring-1 ring-zinc-100/10 hover:opacity-80",src:(null==r?void 0:r.image)?"".concat(r.image):"",alt:null!==(t=r.name)&&void 0!==t?t:"Avatar"}):(0,n.jsx)("div",{className:"flex items-center justify-center text-xs font-medium uppercase rounded-full select-none h-7 w-7 shrink-0 bg-muted/50 ",children:(null==r?void 0:r.name)?(0,u.Zh)(null==r?void 0:r.name):null}),(0,n.jsx)(c.gwH,{className:"ml-1"})]})}),(0,n.jsxs)(d.AW,{sideOffset:8,align:"start",className:"w-[220px]  z-[500]",children:[(0,n.jsx)(d.Xi,{className:"flex-col items-start",children:(0,n.jsxs)("a",{href:"/profile/".concat(null==r?void 0:r.username),children:[(0,n.jsx)("div",{className:"text-xs font-medium",children:null==r?void 0:r.name}),(0,n.jsx)("div",{className:"text-xs text-secondary-foreground",children:null==r?void 0:r.email})]})}),(0,n.jsx)(d.VD,{}),(0,n.jsx)(d.Xi,{asChild:!0,children:(0,n.jsx)("a",{href:"/",rel:"noopener noreferrer",className:"inline-flex items-center justify-between w-full text-xs",children:"Feed"})}),(0,n.jsx)(d.Xi,{asChild:!0,children:(0,n.jsx)("a",{href:"/boards",rel:"noopener noreferrer",className:"inline-flex items-center justify-between w-full text-xs",children:"My Boards"})}),(0,n.jsx)(d.VD,{}),(0,n.jsx)(d.Xi,{asChild:!0,children:(0,n.jsx)("a",{href:"/settings/billing",rel:"noopener noreferrer",className:"inline-flex items-center justify-between w-full text-xs",children:"Billing"})}),(0,n.jsx)(d.Xi,{asChild:!0,children:(0,n.jsx)("a",{href:"/settings",rel:"noopener noreferrer",className:"inline-flex items-center justify-between w-full text-xs",children:"Settings"})}),(0,n.jsx)(d.Xi,{asChild:!0,children:(0,n.jsx)("a",{href:"/settings/preferences",rel:"noopener noreferrer",className:"inline-flex items-center justify-between w-full text-xs",children:"Preferences"})}),(0,n.jsx)(d.VD,{}),(0,n.jsx)(d.Xi,{onClick:()=>(0,a.signOut)({callbackUrl:"/"}),className:"text-xs",children:"Log Out"})]})]})})}var f=r(16463),h=r(92857),p=r(41942);let x=e=>{(0,a.signIn)(e)},v=e=>{let{user:t}=e,{id:r}=(0,f.useParams)(),a=(0,f.usePathname)(),[d,c]=s.useState();return s.useEffect(()=>{r?fetch("/api/boards/board:".concat(r)).then(e=>e.json()).then(e=>{c(e)}):c(void 0)},[r]),(0,n.jsx)(n.Fragment,{children:t?(0,n.jsxs)("section",{className:"flex items-center",children:[(0,n.jsx)(i.Op,{className:"w-6 h-6 text-primary"}),(0,n.jsx)(m,{user:t}),d?(0,n.jsxs)("div",{className:"lg:flex hidden items-center ",children:[(0,n.jsx)(i.Op,{className:"w-6 h-6 text-primary"}),(0,n.jsx)("span",{className:"text-sm font-medium sm:block hidden",children:null==d?void 0:d.name}),(0,n.jsx)(i.Op,{className:"w-6 h-6 text-primary"}),(0,n.jsx)(l.z,{variant:"default",asChild:!0,className:"items-center text-center justify-center cursor-pointer sm:block hidden uppercase border border-input rounded-full",children:(0,n.jsx)(o.default,{href:"/boards",children:(0,n.jsxs)("span",{className:"flex items-center",children:[(0,n.jsx)(p.ymq,{className:"mr-1"}),"Create New Workspace"]})})})]}):null]}):"/sign-in"!==a?(0,n.jsx)(l.z,{variant:"link",asChild:!0,onClick:()=>x("google"),className:" w-full   flex items-center justify-center border text-foreground dark:text-primary rounded-md hover:bg-muted cursor-pointer",children:(0,n.jsxs)("span",{children:[(0,n.jsx)(h.JM8,{className:"mr-2"}),"Sign in"]})}):null})}},27273:function(e,t,r){"use strict";r.d(t,{HeaderRightSide:function(){return u}});var n=r(57437),s=r(63872),a=r(50495),o=r(19666),i=r(85169),l=r(91431),d=r(2265),c=r(73513);let u=()=>{let{setTheme:e,theme:t}=(0,i.F)(),{tlDrawEditorRef:r}=(0,l.f)(),[u,m]=(0,d.useTransition)();return(0,n.jsxs)("div",{className:"flex align-middle justify-end",children:[(0,n.jsx)(o.pn,{children:(0,n.jsxs)(o.u,{children:[(0,n.jsx)(o.aJ,{asChild:!0,children:(0,n.jsx)(a.z,{asChild:!0,variant:"ghost",children:(0,n.jsx)("a",{href:"https://x.com/i/communities/1830451196126982222/",target:"_blank",className:"hidden md:inline-flex",children:(0,n.jsx)(s.lcJ,{})})})}),(0,n.jsx)(o._v,{children:(0,n.jsx)("p",{children:"Follow us on X"})})]})}),(0,n.jsx)(o.pn,{children:(0,n.jsxs)(o.u,{children:[(0,n.jsx)(o.aJ,{asChild:!0,children:(0,n.jsx)(a.z,{asChild:!0,variant:"ghost",children:(0,n.jsx)("a",{href:"https://www.facebook.com/groups/1653877962063282",target:"_blank",className:"hidden md:inline-flex",children:(0,n.jsx)(s.Am9,{})})})}),(0,n.jsx)(o._v,{children:(0,n.jsx)("p",{children:"Follow us on Facebook"})})]})}),(0,n.jsx)(o.pn,{children:(0,n.jsxs)(o.u,{children:[(0,n.jsx)(o.aJ,{asChild:!0,children:(0,n.jsx)(a.z,{asChild:!0,variant:"ghost",children:(0,n.jsx)("a",{href:"https://discord.com/invite/HVEARXuApH",target:"_blank",className:"hidden md:inline-flex",children:(0,n.jsx)(s.j2d,{})})})}),(0,n.jsx)(o._v,{children:(0,n.jsx)("p",{children:"Join us on Discord"})})]})}),(0,n.jsx)(o.pn,{children:(0,n.jsxs)(o.u,{children:[(0,n.jsx)(o.aJ,{asChild:!0,children:(0,n.jsx)(a.z,{asChild:!0,variant:"ghost",children:(0,n.jsx)("a",{href:"https://mixflow.ai/how-to",target:"_blank",children:"?"})})}),(0,n.jsx)(o._v,{children:(0,n.jsx)("p",{children:"How to"})})]})}),(0,n.jsx)(o.pn,{children:(0,n.jsxs)(o.u,{children:[(0,n.jsx)(o.aJ,{asChild:!0,children:(0,n.jsxs)(a.z,{variant:"ghost",size:"icon",className:"text-black dark:text-white",onClick:()=>{m(()=>{var n;let s="light"===t?"dark":"light";e(s),null===(n=r.current)||void 0===n||n.user.updateUserPreferences({isDarkMode:"dark"===s})})},children:[t?"dark"===t?(0,n.jsx)(c.C9,{className:"transition-all"}):(0,n.jsx)(c.O3,{className:"transition-all"}):null,(0,n.jsx)("span",{className:"sr-only",children:"Toggle theme"})]})}),(0,n.jsx)(o._v,{children:(0,n.jsx)("p",{children:"Toggle Theme"})})]})})]})}},46910:function(e,t,r){"use strict";r.d(t,{$F:function(){return u},AW:function(){return f},Ju:function(){return x},VD:function(){return v},Xi:function(){return h},_x:function(){return m},h_:function(){return c},qB:function(){return p}});var n=r(57437),s=r(2265),a=r(79219),o=r(49346),i=r(64374),l=r(56144),d=r(37440);let c=a.fC,u=a.xz;a.ZA,a.Uv,a.Tr;let m=a.Ee;s.forwardRef((e,t)=>{let{className:r,inset:s,children:i,...l}=e;return(0,n.jsxs)(a.fF,{ref:t,className:(0,d.cn)("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",s&&"pl-8",r),...l,children:[i,(0,n.jsx)(o.Z,{className:"ml-auto h-4 w-4"})]})}).displayName=a.fF.displayName,s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,n.jsx)(a.tu,{ref:t,className:(0,d.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...s})}).displayName=a.tu.displayName;let f=s.forwardRef((e,t)=>{let{className:r,sideOffset:s=4,...o}=e;return(0,n.jsx)(a.Uv,{children:(0,n.jsx)(a.VY,{ref:t,sideOffset:s,className:(0,d.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...o})})});f.displayName=a.VY.displayName;let h=s.forwardRef((e,t)=>{let{className:r,inset:s,...o}=e;return(0,n.jsx)(a.ck,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",r),...o})});h.displayName=a.ck.displayName,s.forwardRef((e,t)=>{let{className:r,children:s,checked:o,...l}=e;return(0,n.jsxs)(a.oC,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),checked:o,...l,children:[(0,n.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,n.jsx)(a.wU,{children:(0,n.jsx)(i.Z,{className:"h-4 w-4"})})}),s]})}).displayName=a.oC.displayName;let p=s.forwardRef((e,t)=>{let{className:r,children:s,...o}=e;return(0,n.jsxs)(a.Rk,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...o,children:[(0,n.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,n.jsx)(a.wU,{children:(0,n.jsx)(l.Z,{className:"h-2 w-2 fill-current"})})}),s]})});p.displayName=a.Rk.displayName;let x=s.forwardRef((e,t)=>{let{className:r,inset:s,...o}=e;return(0,n.jsx)(a.__,{ref:t,className:(0,d.cn)("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",r),...o})});x.displayName=a.__.displayName;let v=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,n.jsx)(a.Z0,{ref:t,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",r),...s})});v.displayName=a.Z0.displayName},27744:function(e,t,r){"use strict";r.d(t,{Toaster:function(){return v}});var n=r(57437),s=r(2265),a=r(44504),o=r(12218),i=r(870),l=r(37440);let d=a.zt,c=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,n.jsx)(a.l_,{ref:t,className:(0,l.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",r),...s})});c.displayName=a.l_.displayName;let u=(0,o.j)("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),m=s.forwardRef((e,t)=>{let{className:r,variant:s,...o}=e;return(0,n.jsx)(a.fC,{ref:t,className:(0,l.cn)(u({variant:s}),r),...o})});m.displayName=a.fC.displayName,s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,n.jsx)(a.aU,{ref:t,className:(0,l.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",r),...s})}).displayName=a.aU.displayName;let f=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,n.jsx)(a.x8,{ref:t,className:(0,l.cn)("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",r),"toast-close":"",...s,children:(0,n.jsx)(i.Z,{className:"h-4 w-4"})})});f.displayName=a.x8.displayName;let h=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,n.jsx)(a.Dx,{ref:t,className:(0,l.cn)("text-sm font-semibold",r),...s})});h.displayName=a.Dx.displayName;let p=s.forwardRef((e,t)=>{let{className:r,...s}=e;return(0,n.jsx)(a.dk,{ref:t,className:(0,l.cn)("text-sm opacity-90",r),...s})});p.displayName=a.dk.displayName;var x=r(35657);function v(){let{toasts:e}=(0,x.pm)();return(0,n.jsxs)(d,{children:[e.map(function(e){let{id:t,title:r,description:s,action:a,...o}=e;return(0,n.jsxs)(m,{...o,children:[(0,n.jsxs)("div",{className:"grid gap-1",children:[r&&(0,n.jsx)(h,{children:r}),s&&(0,n.jsx)(p,{children:s})]}),a,(0,n.jsx)(f,{})]},t)}),(0,n.jsx)(c,{})]})}},19666:function(e,t,r){"use strict";r.d(t,{_v:function(){return c},aJ:function(){return d},pn:function(){return i},u:function(){return l}});var n=r(57437),s=r(2265),a=r(60364),o=r(37440);let i=a.zt,l=a.fC,d=a.xz,c=s.forwardRef((e,t)=>{let{className:r,sideOffset:s=4,...i}=e;return(0,n.jsx)(a.VY,{ref:t,sideOffset:s,className:(0,o.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...i})});c.displayName=a.VY.displayName},35657:function(e,t,r){"use strict";r.d(t,{Am:function(){return u},pm:function(){return m}});var n=r(2265);let s=0,a=new Map,o=e=>{if(a.has(e))return;let t=setTimeout(()=>{a.delete(e),c({type:"REMOVE_TOAST",toastId:e})},1e6);a.set(e,t)},i=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:r}=t;return r?o(r):e.toasts.forEach(e=>{o(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},l=[],d={toasts:[]};function c(e){d=i(d,e),l.forEach(e=>{e(d)})}function u(e){let{...t}=e,r=(s=(s+1)%Number.MAX_VALUE).toString(),n=()=>c({type:"DISMISS_TOAST",toastId:r});return c({type:"ADD_TOAST",toast:{...t,id:r,open:!0,onOpenChange:e=>{e||n()}}}),{id:r,dismiss:n,update:e=>c({type:"UPDATE_TOAST",toast:{...e,id:r}})}}function m(){let[e,t]=n.useState(d);return n.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>c({type:"DISMISS_TOAST",toastId:e})}}},85169:function(e,t,r){"use strict";r.d(t,{F:function(){return d},f:function(){return c}});var n=r(2265);let s=["light","dark"],a="(prefers-color-scheme: dark)",o="undefined"==typeof window,i=(0,n.createContext)(void 0),l={setTheme:e=>{},themes:[]},d=()=>{var e;return null!==(e=(0,n.useContext)(i))&&void 0!==e?e:l},c=e=>(0,n.useContext)(i)?n.createElement(n.Fragment,null,e.children):n.createElement(m,e),u=["light","dark"],m=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:o=!0,storageKey:l="theme",themes:d=u,defaultTheme:c=r?"system":"light",attribute:m="data-theme",value:v,children:g,nonce:y})=>{let[j,b]=(0,n.useState)(()=>h(l,c)),[w,N]=(0,n.useState)(()=>h(l)),k=v?Object.values(v):d,C=(0,n.useCallback)(e=>{let n=e;if(!n)return;"system"===e&&r&&(n=x());let a=v?v[n]:n,i=t?p():null,l=document.documentElement;if("class"===m?(l.classList.remove(...k),a&&l.classList.add(a)):a?l.setAttribute(m,a):l.removeAttribute(m),o){let e=s.includes(c)?c:null,t=s.includes(n)?n:e;l.style.colorScheme=t}null==i||i()},[]),E=(0,n.useCallback)(e=>{b(e);try{localStorage.setItem(l,e)}catch(e){}},[e]),T=(0,n.useCallback)(t=>{N(x(t)),"system"===j&&r&&!e&&C("system")},[j,e]);(0,n.useEffect)(()=>{let e=window.matchMedia(a);return e.addListener(T),T(e),()=>e.removeListener(T)},[T]),(0,n.useEffect)(()=>{let e=e=>{e.key===l&&E(e.newValue||c)};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[E]),(0,n.useEffect)(()=>{C(null!=e?e:j)},[e,j]);let S=(0,n.useMemo)(()=>({theme:j,setTheme:E,forcedTheme:e,resolvedTheme:"system"===j?w:j,themes:r?[...d,"system"]:d,systemTheme:r?w:void 0}),[j,E,e,w,r,d]);return n.createElement(i.Provider,{value:S},n.createElement(f,{forcedTheme:e,disableTransitionOnChange:t,enableSystem:r,enableColorScheme:o,storageKey:l,themes:d,defaultTheme:c,attribute:m,value:v,children:g,attrs:k,nonce:y}),g)},f=(0,n.memo)(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:o,enableColorScheme:i,defaultTheme:l,value:d,attrs:c,nonce:u})=>{let m="system"===l,f="class"===r?`var d=document.documentElement,c=d.classList;c.remove(${c.map(e=>`'${e}'`).join(",")});`:`var d=document.documentElement,n='${r}',s='setAttribute';`,h=i?s.includes(l)&&l?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${l}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",p=(e,t=!1,n=!0)=>{let a=d?d[e]:e,o=t?e+"|| ''":`'${a}'`,l="";return i&&n&&!t&&s.includes(e)&&(l+=`d.style.colorScheme = '${e}';`),"class"===r?l+=t||a?`c.add(${o})`:"null":a&&(l+=`d[s](n,${o})`),l},x=e?`!function(){${f}${p(e)}}()`:o?`!function(){try{${f}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${m})){var t='${a}',m=window.matchMedia(t);if(m.media!==t||m.matches){${p("dark")}}else{${p("light")}}}else if(e){${d?`var x=${JSON.stringify(d)};`:""}${p(d?"x[e]":"e",!0)}}${m?"":"else{"+p(l,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${f}var e=localStorage.getItem('${t}');if(e){${d?`var x=${JSON.stringify(d)};`:""}${p(d?"x[e]":"e",!0)}}else{${p(l,!1,!1)};}${h}}catch(t){}}();`;return n.createElement("script",{nonce:u,dangerouslySetInnerHTML:{__html:x}})},()=>!0),h=(e,t)=>{let r;if(!o){try{r=localStorage.getItem(e)||void 0}catch(e){}return r||t}},p=()=>{let e=document.createElement("style");return e.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(e),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(e)},1)}},x=e=>(e||(e=window.matchMedia(a)),e.matches?"dark":"light")},87138:function(e,t,r){"use strict";r.d(t,{default:function(){return s.a}});var n=r(231),s=r.n(n)},10912:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return s}});let n=r(55592);function s(e){let{reason:t,children:r}=e;if("undefined"==typeof window)throw new n.BailoutToCSRError(t);return r}},61481:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadCss",{enumerable:!0,get:function(){return a}});let n=r(57437),s=r(58512);function a(e){let{moduleIds:t}=e;if("undefined"!=typeof window)return null;let r=(0,s.getExpectedRequestStore)("next/dynamic css"),a=[];if(r.reactLoadableManifest&&t){let e=r.reactLoadableManifest;for(let r of t){if(!e[r])continue;let t=e[r].files.filter(e=>e.endsWith(".css"));a.push(...t)}}return 0===a.length?null:(0,n.jsx)(n.Fragment,{children:a.map(e=>(0,n.jsx)("link",{precedence:"dynamic",rel:"stylesheet",href:r.assetPrefix+"/_next/"+encodeURI(e),as:"style"},e))})}},91431:function(e,t,r){"use strict";r.d(t,{MixflowProvider:function(){return f},f:function(){return m}});var n=r(57437),s=r(2959),a=r(50495),o=r(37440),i=r(30998),l=r(16463),d=r(1109),c=r(2265);let u=(0,c.createContext)({tlDrawEditorRef:{current:void 0},boardId:{current:void 0},board:void 0,shortTermTokenForYPartyKit:"",saveBoardToR2:async()=>{},uploadToAzureBlob:async()=>new Response,uploadToR2:async()=>({r2Response:new Response,key:""}),setOpenAiDialog:()=>{},openAiDialog:!1,askAiButton:()=>(0,n.jsx)(n.Fragment,{}),userId:void 0,userName:void 0}),m=()=>(0,c.useContext)(u),f=e=>{var t,r;let{children:m,board:f,token:h}=e,{data:p}=(0,i.useSession)(),x=null==p?void 0:null===(t=p.user)||void 0===t?void 0:t.id,v=null==p?void 0:null===(r=p.user)||void 0===r?void 0:r.name,[g,y]=(0,c.useState)(!1),{id:j}=(0,l.useParams)();if(!j)throw Error("Board is expected");let b=(0,c.useRef)(void 0),w=(0,c.useRef)("board:".concat(j)),N=(0,c.useCallback)(async e=>{let{file:t,key:r}=e;try{if(!t)throw Error("Expecting a file type but received [".concat(t,"]"));if(!x)throw Error("User id is empty!");let{sasUrl:e}=await (0,s.Vi)("/api/ingest",{method:"POST",body:{boardId:w.current,key:r}}),n=await fetch(e,{method:"PUT",body:t,headers:{"content-type":t.type,"x-ms-blob-type":"BlockBlob","x-ms-meta-Owner":x}});if(!n.ok)throw Error("Error uploading file to Azure Blob Storage");return n}catch(e){throw console.error("[Error on upload]: ".concat(e)),e}},[x,w.current]),k=(0,c.useCallback)(async e=>{let t,{body:r,headers:n,fileName:a,awaitUploading:o=!1,onR2UploadSuccess:i,onR2UploadError:l}=e;if(!r)throw Error("Expecting a body type but received [".concat(r,"]"));if(!x)throw Error("Session user is empty!");r instanceof File?t=r.size:r&&(t=new Blob([r]).size);let{url:d,key:c}=await (0,s.Vi)("/api/upload",{method:"POST",body:{boardId:w.current,fileName:a,size:t}}),u=fetch(d,{method:"PUT",headers:{...n,"x-amz-meta-owner":x},body:r}).then(e=>{e.ok&&i&&i()}).catch(e=>{console.error("[Error on CF upload]: ".concat(e)),l&&l(e)});return o&&await u,{key:c}},[x,w.current]),C=(0,c.useCallback)(async e=>{var t;let r,n,{boardImage:a,boardSnapshot:i,onR2UploadSuccess:l,onR2UploadError:d}=e;if(!x)throw Error("Session user is empty!");a instanceof File&&(r=a.size),n=new Blob([i]).size;let{boardImageSignedUrl:c,boardStateSignedUrl:u}=await (0,s.Vi)("/api/save",{method:"POST",body:{boardId:w.current,boardSnapshotSize:n,boardImageSize:r,currentViewPort:(0,o.Or)(null===(t=b.current)||void 0===t?void 0:t.getViewportPageBounds().clone())}});fetch(u,{method:"PUT",headers:{"Content-Type":"application/json","x-amz-meta-owner":x},body:i}).then(e=>{e.ok&&l&&l()}).catch(e=>{console.error("[Error on CF upload]: ".concat(e)),d&&d(e)}),fetch(c,{method:"PUT",headers:{"Content-Type":"application/image","x-amz-meta-owner":x},body:a}).then(e=>{e.ok&&l&&l()}).catch(e=>{console.error("[Error on CF upload]: ".concat(e)),d&&d(e)})},[x,w.current]),E=(0,c.useMemo)(()=>()=>{let e=e=>{y(e=>!e),e.stopPropagation()};return(0,n.jsxs)(a.z,{className:" rounded-xl subline",onPointerDown:e,onClick:e,children:[(0,n.jsx)(d.Moc,{className:"mr-1"}),"Ask AI"]})},[]),T=(0,c.useMemo)(()=>({tlDrawEditorRef:b,boardId:w,board:f,shortTermTokenForYPartyKit:h,uploadToR2:k,uploadToAzureBlob:N,openAiDialog:g,setOpenAiDialog:y,saveBoardToR2:C,askAiButton:E,userId:x,userName:v}),[g,y]);return(0,n.jsx)(u.Provider,{value:T,children:m})}},49503:function(e,t,r){"use strict";r.r(t);var n=r(57437),s=r(19666),a=r(85169);t.default=e=>{let{children:t,...r}=e;return(0,n.jsx)(a.f,{...r,children:(0,n.jsx)(s.pn,{children:t})})}},58877:function(){},4338:function(e){e.exports={style:{fontFamily:"'__Inter_d65c78', '__Inter_Fallback_d65c78'",fontStyle:"normal"},className:"__className_d65c78",variable:"__variable_d65c78"}},64374:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(17934).Z)("Check",[["polyline",{points:"20 6 9 17 4 12",key:"10jjfj"}]])},49346:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(17934).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},56144:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(17934).Z)("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]])}},function(e){e.O(0,[345,8155,7240,6051,2516,7699,680,7655,3138,231,364,1877,8655,2971,7023,1744],function(){return e(e.s=76750)}),_N_E=e.O()}]);