1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="6b4682cd-c59a-c7a1-a1e5-77cb50f817d1")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,800626,e=>{"use strict";let t;var r=e.i(247167);let a={chatdiagram:{id:"chatdiagram",displayName:"ChatDiagram",domain:"chatdiagram.com",plausibleDomain:"chatdiagram.com",supportEmail:"[email protected]",companyName:"IMFIT PTE LTD",stripe:{accountId:"acct_1PN6qRRv6Axp3QKc",apiVersion:"2025-02-24.acacia",monthlyPriceId:"price_1T8mSRRv6Axp3QKcZ52JgZBb",annualPriceId:"price_1TarLwRv6Axp3QKcSEwyKrqO",maxMonthlyPriceId:"price_1Taqn6Rv6Axp3QKcaqCi89Dt",maxAnnualPriceId:"price_1TarLxRv6Axp3QKcKTBQykec",legacyPriceIds:["price_1RHaeNRv6Axp3QKcgbt2diKN","price_1RHao3Rv6Axp3QKc40H9kEuP","price_1RHaohRv6Axp3QKcydCnH7rl","price_1T8mTARv6Axp3QKcaoQkQ6KW","price_1TaqAlRv6Axp3QKcgMuiwNwo"]},defaultChatModel:"deepseek/deepseek-v4-pro",freeChatModel:"deepseek/deepseek-v4-flash",aiStepBudget:8,promptModule:{allowedEngines:[],blockedEngines:["markmap"],defaultEngine:"schematex-mindmap",appContext:void 0},features:{presentationAsShareDefault:!1,hasTemplateGallery:!0,hasExampleGallery:!1},starterExamples:[{id:"flowchart",label:"Flowchart",prompt:"Create a flowchart for an e-commerce order fulfillment process, including payment, inventory, and shipping decisions."},{id:"circuit",label:"Circuit",prompt:"Draw a circuit schematic for an NPN common-emitter amplifier."},{id:"blockdiagram",label:"Block diagram",prompt:"Create a block diagram of a PID control loop."},{id:"genogram",label:"Genogram",prompt:"Create a three-generation family genogram showing relationships and medical history."},{id:"sld",label:"Single-line diagram",prompt:"Draw a single-line electrical diagram for a backup generator with an automatic transfer switch."},{id:"orgchart",label:"Org chart",prompt:"Build an org chart for a Series-A tech startup."},{id:"matrix",label:"Matrix",prompt:"Create an Eisenhower priority matrix to organize my weekly tasks."},{id:"timeline",label:"Timeline",prompt:"Create a timeline for a product launch over the next quarter."}],locales:["en","ja","zh-Hant","es","fr","de","it","pt","ko","he","ar"],seo:{titleTemplate:"%s | ChatDiagram",defaultDescription:"AI diagram generator â describe your diagram in plain language and ChatDiagram produces it.",ogColors:{background:"#0E0F12",text:"#FFFFFF"}},tokens:{cssPrefix:"cd",primaryColor:"hsl(220 13% 9%)",sans:"var(--cd-sans)"}},conceptmap:{id:"conceptmap",displayName:"ConceptMap",domain:"conceptmap.ai",plausibleDomain:"conceptmap.ai",supportEmail:"[email protected]",companyName:"IMFIT PTE LTD",stripe:{accountId:"acct_1QRwDeEN2MaRV4AX",apiVersion:"2025-02-24.acacia",monthlyPriceId:"price_1T8vaJEN2MaRV4AXE8bEmjio",annualPriceId:"price_1TarLxEN2MaRV4AXwZgfGEEw",maxMonthlyPriceId:"price_1Taqn8EN2MaRV4AXTaZ4sYTl",maxAnnualPriceId:"price_1TarLxEN2MaRV4AXyNQQP6GV",legacyPriceIds:["price_1RGBgIEN2MaRV4AXRDHJVmNU","price_1QSr8yEN2MaRV4AXbaLHSznL","price_1RGDq8EN2MaRV4AXH0T4in0e","price_1RGDpYEN2MaRV4AXk9N1RAys","price_1QSr8aEN2MaRV4AXl6UQqS3P","price_1QSr9nEN2MaRV4AXTzTQps8X","price_1T8vajEN2MaRV4AXgxrR8Fas","price_1TaqAmEN2MaRV4AXO5w1yjlu"]},defaultChatModel:"deepseek/deepseek-v4-pro",freeChatModel:"deepseek/deepseek-v4-flash",aiStepBudget:5,promptModule:{allowedEngines:["markmap"],defaultEngine:"markmap",appContext:` 3## ConceptMap-Specific Guidance 4 5You are a concept mapping assistant. Your ONLY output format is **markmap** (markdown-based mind maps / concept maps). Do not generate mermaid, echarts, or svg artifacts. 6 7### Default Behavior 8- Every diagram artifact must be \`engine="markmap"\` 9- Concept maps should have 3 levels: root â main concepts (2-4) â supporting details (2-3 each) 10- Use clear, concise labels (3-7 words per node); for text-rich educational use cases (teachers), allow full-sentence node content 11 12### Suggestion Bias 13- "deepen" suggestions should expand specific branches 14- "transform" suggestions should restructure the map (reorganize hierarchy, regroup topics) â never switch engines 15- "branch" suggestions should explore related concepts 16`},features:{presentationAsShareDefault:!0,hasTemplateGallery:!1,hasExampleGallery:!0},locales:["en","es","fr","de","it","pt","zh-Hant","ar","he"],seo:{titleTemplate:"%s | ConceptMap",defaultDescription:"AI concept map generator â turn any topic into an interactive concept map you can present and share.",ogColors:{background:"#FAF6EE",text:"#1A1A1A"}},tokens:{cssPrefix:"cm",primaryColor:"hsl(38 60% 95%)",serif:"var(--cm-serif)"}}},n=(t=r.default.env.NEXT_PUBLIC_PRODUCT)&&t in a?a[t]:"chat diagram".includes("concept")?(console.warn("[brand] NEXT_PUBLIC_PRODUCT missing; inferred conceptmap from NEXT_PUBLIC_BRAND."),a.conceptmap):(console.warn("[brand] NEXT_PUBLIC_PRODUCT missing; defaulting to chatdiagram."),a.chatdiagram);e.s(["brand",0,n],800626)},824244,e=>{"use strict";let t=(0,e.i(527269).createClient)(),r=async()=>{let{data:{user:e}}=await t.auth.getUser();if(!e)return console.log("No authenticated user for subscription query"),null;let{data:r,error:a}=await t.from("subscriptions").select("*, prices(*, products(*))").eq("user_id",e.id).in("status",["trialing","active"]).maybeSingle();return a?(console.error("ð° Error getting subscription:",a),null):r||(console.log("No active subscription found"),null)},a=async e=>{let{data:r,error:a}=await t.from("chats").select("*").eq("id",e).maybeSingle();return a&&console.error("ð¬ Error getting chat:",e,a),r};
16e.s(["getChatById",0,a,"getSubscription",0,r])},95187,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var a={callServer:function(){return i.callServer},createServerReference:function(){return s.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}};for(var n in a)Object.defineProperty(r,n,{enumerable:!0,get:a[n]});let i=e.r(132120),o=e.r(92245),s=e.r(235326)},643531,e=>{"use strict";let t=(0,e.i(475254).default)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",0,t],643531)},618528,959411,e=>{"use strict";let t,r,a;var n=e.i(843476),i=e.i(271645),o=e.i(981140),s=e.i(820783),l=e.i(30030),c=e.i(610772),d=e.i(369340),u=e.i(726330),p=e.i(765491),m=e.i(774606),h=e.i(296626),f=e.i(248425),g=e.i(303536),y=e.i(985369),x=e.i(186312),v=Symbol("radix.slottable");function b(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===v}var w="Dialog",[j,C]=(0,l.createContextScope)(w),[P,S]=j(w),N=e=>{let{__scopeDialog:t,children:r,open:a,defaultOpen:o,onOpenChange:s,modal:l=!0}=e,u=i.useRef(null),p=i.useRef(null),[m,h]=(0,d.useControllableState)({prop:a,defaultProp:o??!1,onChange:s,caller:w});return(0,n.jsx)(P,{scope:t,triggerRef:u,contentRef:p,contentId:(0,c.useId)(),titleId:(0,c.useId)(),descriptionId:(0,c.useId)(),open:m,onOpenChange:h,onOpenToggle:i.useCallback(()=>h(e=>!e),[h]),modal:l,children:r})};N.displayName=w;var E="DialogTrigger";i.forwardRef((e,t)=>{let{__scopeDialog:r,...a}=e,i=S(E,r),l=(0,s.useComposedRefs)(t,i.triggerRef);return(0,n.jsx)(f.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Y(i.open),...a,ref:l,onClick:(0,o.composeEventHandlers)(e.onClick,i.onOpenToggle)})}).displayName=E;var k="DialogPortal",[R,D]=j(k,{forceMount:void 0}),A=e=>{let{__scopeDialog:t,forceMount:r,children:a,container:o}=e,s=S(k,t);return(0,n.jsx)(R,{scope:t,forceMount:r,children:i.Children.map(a,e=>(0,n.jsx)(h.Presence,{present:r||s.open,children:(0,n.jsx)(m.Portal,{asChild:!0,container:o,children:e})}))})};A.displayName=k;var _="DialogOverlay",I=i.forwardRef((e,t)=>{let r=D(_,e.__scopeDialog),{forceMount:a=r.forceMount,...i}=e,o=S(_,e.__scopeDialog);return o.modal?(0,n.jsx)(h.Presence,{present:a||o.open,children:(0,n.jsx)(M,{...i,ref:t})}):null});I.displayName=_;var T=((a=i.forwardRef((e,t)=>{let{children:r,...a}=e;if(i.isValidElement(r)){var n;let e,o,l=(n=r,(o=(e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?n.ref:(o=(e=Object.getOwnPropertyDescriptor(n,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?n.props.ref:n.props.ref||n.ref),c=function(e,t){let r={...t};for(let a in t){let n=e[a],i=t[a];/^on[A-Z]/.test(a)?n&&i?r[a]=(...e)=>{let t=i(...e);return n(...e),t}:n&&(r[a]=n):"style"===a?r[a]={...n,...i}:"className"===a&&(r[a]=[n,i].filter(Boolean).join(" "))}return{...e,...r}}(a,r.props);return r.type!==i.Fragment&&(c.ref=t?(0,s.composeRefs)(t,l):l),i.cloneElement(r,c)}return i.Children.count(r)>1?i.Children.only(null):null})).displayName="DialogOverlay.RemoveScroll.SlotClone",t=a,(r=i.forwardRef((e,r)=>{let{children:a,...o}=e,s=i.Children.toArray(a),l=s.find(b);if(l){let e=l.props.children,a=s.map(t=>t!==l?t:i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null);return(0,n.jsx)(t,{...o,ref:r,children:i.isValidElement(e)?i.cloneElement(e,void 0,a):null})}return(0,n.jsx)(t,{...o,ref:r,children:a})})).displayName="DialogOverlay.RemoveScroll.Slot",r),M=i.forwardRef((e,t)=>{let{__scopeDialog:r,...a}=e,i=S(_,r);return(0,n.jsx)(y.RemoveScroll,{as:T,allowPinchZoom:!0,shards:[i.contentRef],children:(0,n.jsx)(f.Primitive.div,{"data-state":Y(i.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),F="DialogContent",O=i.forwardRef((e,t)=>{let r=D(F,e.__scopeDialog),{forceMount:a=r.forceMount,...i}=e,o=S(F,e.__scopeDialog);return(0,n.jsx)(h.Presence,{present:a||o.open,children:o.modal?(0,n.jsx)(U,{...i,ref:t}):(0,n.jsx)(L,{...i,ref:t})})});O.displayName=F;var U=i.forwardRef((e,t)=>{let r=S(F,e.__scopeDialog),a=i.useRef(null),l=(0,s.useComposedRefs)(t,r.contentRef,a);return i.useEffect(()=>{let e=a.current;if(e)return(0,x.hideOthers)(e)},[]),(0,n.jsx)(V,{...e,ref:l,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,o.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:(0,o.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;(2===t.button||r)&&e.preventDefault()}),onFocusOutside:(0,o.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault())})}),L=i.forwardRef((e,t)=>
16{let r=S(F,e.__scopeDialog),a=i.useRef(!1),o=i.useRef(!1);return(0,n.jsx)(V,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(a.current||r.triggerRef.current?.focus(),t.preventDefault()),a.current=!1,o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(a.current=!0,"pointerdown"===t.detail.originalEvent.type&&(o.current=!0));let n=t.target;r.triggerRef.current?.contains(n)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&o.current&&t.preventDefault()}})}),V=i.forwardRef((e,t)=>{let{__scopeDialog:r,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:l,...c}=e,d=S(F,r),m=i.useRef(null),h=(0,s.useComposedRefs)(t,m);return(0,g.useFocusGuards)(),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p.FocusScope,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:l,children:(0,n.jsx)(u.DismissableLayer,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":Y(d.open),...c,ref:h,onDismiss:()=>d.onOpenChange(!1)})}),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(z,{titleId:d.titleId}),(0,n.jsx)(Z,{contentRef:m,descriptionId:d.descriptionId})]})]})}),B="DialogTitle",$=i.forwardRef((e,t)=>{let{__scopeDialog:r,...a}=e,i=S(B,r);return(0,n.jsx)(f.Primitive.h2,{id:i.titleId,...a,ref:t})});$.displayName=B;var H="DialogDescription",q=i.forwardRef((e,t)=>{let{__scopeDialog:r,...a}=e,i=S(H,r);return(0,n.jsx)(f.Primitive.p,{id:i.descriptionId,...a,ref:t})});q.displayName=H;var Q="DialogClose",K=i.forwardRef((e,t)=>{let{__scopeDialog:r,...a}=e,i=S(Q,r);return(0,n.jsx)(f.Primitive.button,{type:"button",...a,ref:t,onClick:(0,o.composeEventHandlers)(e.onClick,()=>i.onOpenChange(!1))})});function Y(e){return e?"open":"closed"}K.displayName=Q;var G="DialogTitleWarning",[W,X]=(0,l.createContext)(G,{contentName:F,titleName:B,docsSlug:"dialog"}),z=({titleId:e})=>{let t=X(G),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. 17 18If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. 19 20For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Z=({contentRef:e,descriptionId:t})=>{let r=X("DialogDescriptionWarning"),a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${r.contentName}}.`;return i.useEffect(()=>{let r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},J=e.i(632137),ee=e.i(572226);let et=i.forwardRef(({className:e,...t},r)=>(0,n.jsx)(I,{ref:r,className:(0,J.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));et.displayName=I.displayName;let er=i.forwardRef(({className:e,children:t,...r},a)=>(0,n.jsxs)(A,{children:[(0,n.jsx)(et,{}),(0,n.jsxs)(O,{ref:a,className:(0,J.cn)("fixed left-[50%] top-[50%] z-50 grid w-fit min-w-[320px] max-w-[90vw] translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg overflow-y-auto max-h-[90vh]",e),...r,children:[t,(0,n.jsxs)(K,{className:"absolute right-4 top-4 roun
20ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,n.jsx)(ee.Cross2Icon,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));er.displayName=O.displayName;let ea=({className:e,...t})=>(0,n.jsx)("div",{className:(0,J.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});ea.displayName="DialogHeader";let en=({className:e,...t})=>(0,n.jsx)("div",{className:(0,J.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});en.displayName="DialogFooter";let ei=i.forwardRef(({className:e,...t},r)=>(0,n.jsx)($,{ref:r,className:(0,J.cn)("text-lg font-semibold leading-none tracking-tight",e),...t}));ei.displayName=$.displayName;let eo=i.forwardRef(({className:e,...t},r)=>(0,n.jsx)(q,{ref:r,className:(0,J.cn)("text-sm text-muted-foreground",e),...t}));eo.displayName=q.displayName,e.s(["Dialog",0,N,"DialogContent",0,er,"DialogDescription",0,eo,"DialogFooter",0,en,"DialogHeader",0,ea,"DialogTitle",0,ei],618528);var es=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),el=i.forwardRef((e,t)=>(0,n.jsx)(f.Primitive.span,{...e,ref:t,style:{...es,...e.style}}));el.displayName="VisuallyHidden",e.s(["Root",0,el,"VISUALLY_HIDDEN_STYLES",0,es],959411)},575712,871456,e=>{"use strict";e.i(247167);var t=e.i(843476),r=e.i(271645),a=e.i(527269),n=e.i(618528),i=e.i(959411);function o({isOpen:e,onOpenChange:a,modalContent:s,onContentChange:l}){let c=r.default.isValidElement(s)?s.props.dialogTitle??"Options":"Options";return(0,t.jsx)(n.Dialog,{open:e,onOpenChange:a,children:(0,t.jsxs)(n.DialogContent,{className:"grid-cols-1 max-w-[95vw] w-full sm:w-auto min-w-[320px] max-h-[90dvh] overflow-auto",children:[(0,t.jsxs)(i.Root,{children:[(0,t.jsx)(n.DialogTitle,{children:c}),(0,t.jsx)(n.DialogDescription,{children:"Choose an option or close this dialog to return to your drawing."})]}),r.default.isValidElement(s)?r.default.cloneElement(s,{onCloseModal:a,onContentChange:l}):s]})})}function s(){return(0,t.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:(0,t.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-white"})})}e.s(["FloatingModal",0,o],871456);var l=e.i(824244),c=e.i(846696),d=e.i(800626),u=e.i(455924);let p=(0,r.createContext)({user:null,loading:!0,setUser:()=>{},subscription:null,setSubscription:()=>{},modalContent:null,setModalContent:()=>{},destroyModal:()=>{}});e.s(["PreviewModalProvider",0,function({children:e}){let[a,n]=(0,r.useState)(null);return(0,t.jsxs)(p.Provider,{value:{user:null,loading:!1,setUser:()=>{},subscription:null,setSubscription:()=>{},modalContent:a,setModalContent:n,destroyModal:()=>n(null)},children:[e,(0,t.jsx)(o,{isOpen:!!a,onOpenChange:e=>{e||n(null)},modalContent:a,onContentChange:n})]})},"UserProvider",0,function({children:e}){let[n,i]=(0,r.useState)(null),[m,h]=(0,r.useState)(null),[f,g]=(0,r.useState)(!0),[y,x]=(0,r.useState)(!1),[v,b]=(0,r.useState)(null),w=(0,a.createClient)();(0,r.useEffect)(()=>{if(!n)return void(0,u.setAnonymousClarityContext)(d.brand.id);let e=m?.status??null,t="active"===e||"trialing"===e,r=n.user_metadata?.full_name??n.user_metadata?.name??void 0,a="u">typeof document?document.cookie.split("; ").find(e=>e.startsWith("x-country="))?.split("=")[1]:void 0;window.UserSay?.identify({uid:n.id,email:n.email,name:r,signupAt:n.created_at,subscribed:t,trialing:"trialing"===e,plan:t?"pro":"free",country:a,traits:{stripeStatus:e,productName:m?.prices?.products?.name??null,priceId:m?.price_id??null,currentPeriodEnd:m?.current_period_end??null,cancelAtPeriodEnd:m?.cancel_at_period_end??null,provider:"stripe"}}),(0,u.identifyClarityUser)({userId:n.id,email:n.email,createdAt:n.created_at,product:d.brand.id,plan:t?"paid":"free",subscriptionStatus:e??"none"})},[n,m]),(0,r.useEffect)(()=>
20{if(!n)return;let e=!1;return async function(){try{let t=await fetch("/api/referral/status",{cache:"no-store"});if(!t.ok)return;let r=(await t.json()).unseenRewards??[];if(e||0===r.length)return;r.forEach(e=>{let t="conceptmap"===d.brand.id?"concept map":"diagram";c.toast.success(`${e.name} created their first ${t} â +${e.credits} credits added ð`)}),await fetch("/api/referral/status",{method:"POST"})}catch{}}(),()=>{e=!0}},[n]),(0,r.useEffect)(()=>{let e=!1;return(async()=>{if(!n)return h(null);let t=await (0,l.getSubscription)();e||h(t)})(),()=>{e=!0}},[n]),(0,r.useEffect)(()=>{let e=async()=>{try{let{data:{user:e},error:t}=await w.auth.getUser();if(t){"AuthSessionMissingError"!==t.name&&console.error("Error fetching user:",t),i(null);return}i(e)}finally{g(!1)}},{data:{subscription:t}}=w.auth.onAuthStateChange((e,t)=>{"INITIAL_SESSION"!==e&&(i(t?.user??null),"SIGNED_IN"===e&&t?.user&&fetch("/api/user/country",{method:"POST"}).catch(()=>{}))});return e(),()=>{t.unsubscribe()}},[w.auth]);let j=(0,r.useCallback)(e=>{b(e),x(!!e)},[]),C=(0,r.useCallback)(()=>{x(!1),setTimeout(()=>{b(null)},300)},[]);return(0,t.jsxs)(p.Provider,{value:{user:n,loading:f,setUser:i,subscription:m,setSubscription:h,modalContent:v,setModalContent:j,destroyModal:C},children:[f&&(0,t.jsx)(s,{}),e,(0,t.jsx)(o,{isOpen:y,onOpenChange:e=>{e||C()},modalContent:v,onContentChange:j})]})},"useUser",0,function(){let e=(0,r.useContext)(p);if(void 0===e)throw Error("useUser must be used within a UserProvider");return e}],575712)},315821,549176,e=>{"use strict";let t;var r,a=e.i(95187);let n=(0,a.createServerReference)("781ffca732cceef0dc53cb77200c8544af3ee8920f",a.callServer,void 0,a.findSourceMapURL,"checkoutWithStripe");e.s(["checkoutWithStripe",0,n],315821),e.i(247167);var i="https://js.stripe.com",o="".concat(i,"/v3"),s=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,l=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,c=function(){for(var e=document.querySelectorAll('script[src^="'.concat(i,'"]')),t=0;t<e.length;t++){var r,a=e[t];if(r=a.src,s.test(r)||l.test(r))return a}return null},d=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src="".concat(o).concat(t);var a=document.head||document.body;if(!a)throw Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return a.appendChild(r),r},u=function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"5.10.0",startTime:t})},p=null,m=null,h=null,f=function(e,t,r){if(null===e)return null;var a,n=t[0].match(/^pk_test/),i=3===(a=e.version)?"v3":a;n&&"v3"!==i&&console.warn("Stripe.js@".concat(i," was loaded on the page, but @stripe/stripe-js@").concat("5.10.0"," expected Stripe.js@").concat("v3",". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var o=e.apply(void 0,t);return u(o,r),o},g=!1,y=function(){return r||(r=(null!==p?p:(p=new Promise(function(e,t){if("u"<typeof window||"u"<typeof document)return void e(null);if(window.Stripe,window.Stripe)return void e(window.Stripe);try{var r,a=c();a?a&&null!==h&&null!==m&&(a.removeEventListener("load",h),a.removeEventListener("error",m),null==(r=a.parentNode)||r.removeChild(a),a=d(null)):a=d(null),h=function(){window.Stripe?e(window.Stripe):t(Error("Stripe.js not available"))},m=function(e){t(Error("Failed to load Stripe.js",{cause:e}))},a.addEventListener("load",h),a.addEventListener("error",m)}catch(e){t(e);return}})).catch(function(e){return p=null,Promise.reject(e)})).catch(function(e){return r=null,Promise.reject(e)}))};Promise.resolve().then(function(){return y()}).catch(function(e){g||console.warn(e)});var x=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];g=!0;var a=Date.now();return y().then(function(e){return f(e,t,a)})};e.s(["getStripe",0,()=>(t||(t=x("pk_live_51PN6qRRv6Axp3QKct53yRpGnDuoaCD1DiRn80q6qJVwdalnVnlkgEg5ywOCrKyrY7eO0BJfcmzD0TwljA50UHrOw00CwLjdniU")),t)],549176)},391731,e=>{"use strict";let t={plans:[{name:"Free",description:"Start free with basic models and monthly credits",features:["Up to 10 AI credits per month","Access to basic chat models","Credit refreshes monthly"]},{name:"Pro",description:"More credits, premium models, and advanced generation",features:["500 AI credits per month","Unlock premium chat models","Roughly 500 messages with standard models","Priority support"],additionalInfo:""}],pricingOptions:[{priceId:"price_1TarLwRv6Axp3QKcSEwyKrqO",title:"Annual",shortTitle:"Annually",price:"9.90",priceDetail:"USD per month",billing:"Billed annually",discount:"Save 38%",anchorMonthlyPrice:"15.90",savingsLine:"Save $72/year · like 4 months free",guarantee:"7-day free trial · 14-day money-back guarantee",bestValue:!0,trialDays:7},{priceId:"price_1T8mSRRv6Axp3QKcZ52JgZBb",title:"Monthly",shortTitle:"Monthly",price:"15.90",priceDetail:"USD per month",billing:"Billed monthly",trialDays:0}],additionalFeatures:[{icon:e.i(643531).Check,title:"Free trial + money-back guarantee",description:"Start annual with a 7-day free trial â no charge until it ends. Monthly starts right away. Plus a 14-day money-back guarantee on annual plans."}]};e.s(["pricingConfig",0,t])},550724,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(618566),n=e.i(304712),i=e.i(846696),o=e.i(575712),s=e.i(522016),l=e.i(734328);function c({tiers:e,onCheckout:a,onFreeStart:n,loadingPriceId:i,annualSavingsLabel:o}){let[s,d]=(0,r.useState)(!1),[u,p]=(0,r.useState)({monthlyOnly:!0,eligible:!1});(0,r.useEffect)(()=>{d("annual"===new URLSearchParams(window.location.search).get("billing"));let e=!0;return fetch("/api/credits/balance",{cache:"no-store"}).then(e=>e.ok?e.json():null).then(t=>{e&&t&&p({monthlyOnly:"monthly_intro"===t.geoBucket,eligible:!1!==t.introEligible})}).catch(()=>{}),()=>{e=!1}},[]);
20let m=!u.monthlyOnly&&s,h=e=>Number(e.toFixed(2)).toString();return(0,t.jsxs)("section",{className:"sec center wrap pricing-plans","aria-label":"Choose your plan",children:[!u.monthlyOnly&&(0,t.jsxs)("div",{className:"seg",role:"group","aria-label":"Billing period",children:[(0,t.jsx)("button",{type:"button",className:s?"":"on","aria-pressed":!s,onClick:()=>d(!1),children:"Monthly"}),(0,t.jsxs)("button",{type:"button",className:s?"on":"","aria-pressed":s,onClick:()=>d(!0),children:["Annual ",(0,t.jsx)("span",{className:"sv",children:o})]})]}),(0,t.jsx)("div",{className:"plans",children:e.map(e=>{let r=0===e.monthlyPrice,o=!r&&u.monthlyOnly&&u.eligible,s=!r&&m&&u.eligible&&(e.annualTrialDays??0)>0,c=o?Math.max(0,e.monthlyPrice-10):m?e.annualPricePerMonth:e.monthlyPrice,d=m?e.annualPriceId:e.monthlyPriceId;return(0,t.jsxs)("div",{className:`plan ${e.highlight?"pro":""}`,children:[e.highlight&&(0,t.jsx)("span",{className:"rec",children:"Recommended"}),(0,t.jsx)("div",{className:"pname",children:e.name}),(0,t.jsx)("div",{className:"tag",children:e.tagline}),(0,t.jsx)("div",{className:"cap",children:e.headline}),(0,t.jsxs)("div",{className:"pr",children:["$",h(c),(0,t.jsx)("small",{children:r?"forever":o?"/ first month":"/ month"})]}),(0,t.jsx)("div",{className:"bill",children:r?"No card needed":o?`Then $${h(e.monthlyPrice)} / month`:m?`Billed yearly${s?` \xb7 ${e.annualTrialDays}-day free trial`:""}`:"Billed monthly"}),(0,t.jsx)("button",{type:"button",className:`btn ${e.highlight?"btn-primary":"btn-secondary"}`,disabled:void 0!==i||!r&&!d,onClick:()=>r?n?.(e.freeTierHref):d&&a?.(d),children:d&&i===d?"Loadingâ¦":o?`First month $${h(c)}`:s?`Start ${e.annualTrialDays}-day free trial`:e.cta}),(0,t.jsx)("ul",{children:e.features.map(e=>(0,t.jsxs)("li",{children:[(0,t.jsx)(l.Glyph,{name:"check"}),e.text]},e.text))})]},e.name)})}),(0,t.jsx)("p",{className:"pfine",children:"Credits depend on the model you choose. Cancel any time from Settings."})]})}var d=e.i(315821),u=e.i(549176),p=e.i(455924),m=e.i(391731),h=e.i(800626);let f=m.pricingConfig.pricingOptions.find(e=>"Monthly"===e.title)?.priceId??"",g=m.pricingConfig.pricingOptions.find(e=>"Annual"===e.title)?.priceId??"",y=Number(m.pricingConfig.pricingOptions.find(e=>"Monthly"===e.title)?.price??"15.90"),x=Number(m.pricingConfig.pricingOptions.find(e=>"Annual"===e.title)?.price??"9.99"),v=Math.round(12*y-12*x),b=Math.floor(v/y),w=h.brand.stripe.maxMonthlyPriceId??"",j=h.brand.stripe.maxAnnualPriceId??"",C=Math.round(240),P=Math.floor(C/49.9),S=[{name:"Free",tagline:"Kick the tires.",headline:"10 AI credits each month",monthlyPrice:0,annualPricePerMonth:0,cta:"Start free",freeTierHref:"/chat",features:[{text:"Up to 10 AI credits per month"},{text:"Fast models for everyday drawing"},{text:"All supported diagram types"},{text:"Start from a photo or a PDF"},{text:"Export SVG, PNG and PDF"}]},{name:"Pro",tagline:"For engineers, PMs and analysts.",headline:"500 AI credits each month",monthlyPrice:y,annualPricePerMonth:x,annualBillingLine:`Save $${v}/yr â like ${b} months free`,cta:"Start Pro",monthlyPriceId:f,annualPriceId:g,annualTrialDays:7,monthlyTrialDays:0,highlight:!0,features:[{text:"500 AI credits per month"},{text:"Premium AI models"},{text:"Unlimited exports, SVG · PNG · PDF"},{text:"Start from a photo or a PDF"},{text:"Priority support"},{text:"Early access to new engines"}]},{name:"Max",tagline:"For power users and teams.",headline:"5,000 AI credits each month",monthlyPrice:49.9,annualPricePerMonth:29.9,annualBillingLine:`Save $${C}/yr â like ${P} months free`,cta:"Start Max",monthlyPriceId:w,annualPriceId:j,annualTrialDays:7,monthlyTrialDays:0,features:[{text:"5,000 AI credits per month (10à Pro)"},{text:"Everything in Pro"},{text:"Highest-volume generation & exports"},{text:"Fastest-priority support"},{text:"Early access to new engines"}]}];function N(){let e=(0,a.useRouter)(),m=(0,n.usePlausible)(),{user:h}=(0,o.useUser)(),[f,y]=r.useState(void 0);r.useEffect(()=>{m("x_pricing_viewed")},[m]);let x=async t=>{if(y(t),!h){let r=[g,j].includes(t)?"annual":"monthly";e.push(`/login?next=${encodeURIComponent(`/pricing?billing=${r}`)}`),y(void 0);return}let r=(0,p.getEntryPage)(),{error:a,sessionId:n}=await (0,d.checkoutWithStripe)(t,r,"pricing");if(a||!n){let e=a??"no_session_id";console.error("Checkout error:",e),m("x_checkout_failed",{props:{priceId:t,reason:e}}),(0,p.trackEvent)("CheckoutFailed",{priceId:t,reason:e}),i.toast.error(a||"Could not start checkout. Please try again or c
20ontact support."),y(void 0);return}m("x_checkout_viewed",{props:{priceId:t}}),(0,p.trackEvent)("CheckoutStarted",r?{priceId:t,entry_page:r}:{priceId:t});let o=await (0,u.getStripe)();if(!o){let e="stripe_js_load_failed";console.error("Checkout error:",e),m("x_checkout_failed",{props:{priceId:t,reason:e}}),(0,p.trackEvent)("CheckoutFailed",{priceId:t,reason:e}),i.toast.error("Payment system failed to load. Please disable ad blockers and try again."),y(void 0);return}let s=await o.redirectToCheckout({sessionId:n});if(s?.error){let e=s.error.message??"redirect_failed";console.error("Checkout redirect error:",e),m("x_checkout_failed",{props:{priceId:t,reason:e}}),(0,p.trackEvent)("CheckoutFailed",{priceId:t,reason:e}),i.toast.error(`Could not open Stripe checkout: ${e}`)}y(void 0)};return(0,t.jsx)(l.SiteShell,{children:(0,t.jsxs)("main",{className:"pricing-page",children:[(0,t.jsxs)("section",{className:"wrap pricing-intro",children:[(0,t.jsxs)("div",{className:"crumb",children:[(0,t.jsx)(s.default,{href:"/",children:"Home"}),(0,t.jsx)("span",{className:"sep",children:"/"}),(0,t.jsx)("b",{children:"Pricing"})]}),(0,t.jsxs)("div",{className:"lede",children:[(0,t.jsx)("span",{className:"kick",children:"Pricing"}),(0,t.jsx)("h1",{children:"Priced per credit, not per seat."}),(0,t.jsx)("p",{children:"A free tier with the full engine catalogue. Pro for the diagrams you actually ship. No per-user maths, no annual contract to sign."})]})]}),(0,t.jsx)(c,{tiers:S,onCheckout:x,onFreeStart:t=>{m("x_pricing_free_clicked"),e.push(t??"/chat")},loadingPriceId:f,annualSavingsLabel:"Save 38%"}),(0,t.jsxs)("section",{className:"sec wrap",children:[(0,t.jsx)(l.SectionHeading,{kicker:"Side by side",title:"What each plan includes."}),(0,t.jsx)("p",{className:"pricing-swipe-hint",children:"Swipe to compare all plans â"}),(0,t.jsx)("div",{className:"pricing-comparison",role:"region","aria-label":"Plan comparison",tabIndex:0,children:(0,t.jsxs)("table",{className:"cmp",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{scope:"col",children:"What you get"}),(0,t.jsx)("th",{scope:"col",children:"Free"}),(0,t.jsx)("th",{scope:"col",className:"ours",children:"Pro"}),(0,t.jsx)("th",{scope:"col",children:"Max"})]})}),(0,t.jsx)("tbody",{children:[["AI credits a month","10","500","5,000"],["Diagram types","All diagram engines","All diagram engines","All diagram engines"],["Models","Fast models","Premium AI models","Premium AI models"],["Start from a photo or PDF","Yes","Yes","Yes"],["Export SVG · PNG · PDF","All formats","All formats","All formats"],["Share links and embeds","Yes","Yes","Yes"],["Version history","Yes","Yes","Yes"],["Support","Community","Priority","Fastest priority"],["Early access to new engines","â","Yes","Yes"]].map(([e,r,a,n])=>(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{scope:"row",children:e}),(0,t.jsx)("td",{className:"part",children:r}),(0,t.jsx)("td",{className:"yes ours",children:a}),(0,t.jsx)("td",{className:"part",children:n})]},e))})]})})]}),(0,t.jsxs)("section",{className:"sec center wrap",children:[(0,t.jsx)(l.SectionHeading,{kicker:"FAQ",title:"Billing questions"}),(0,t.jsx)(l.SiteFAQ,{items:[{question:"What is a credit?",answer:"Credits are used when you generate a diagram or ask for an edit. The amount depends on the model you choose; your available balance is shown in the editor."},{question:"What happens when I run out?",answer:"Nothing you made disappears. You can still open, export and share your saved diagrams. To generate again, wait for your credits to refresh or upgrade your plan."},{question:"Can I cancel?",answer:"Any time, from Settings. You keep the plan until the end of the period you already paid for."},{question:"Is there a free trial?",answer:"Eligible annual plans start with a 7-day free trial. In some regions, eligible monthly plans offer a discounted first month instead. Your offer and billing schedule are shown at checkout before you confirm."},{question:"Do you take international cards?",answer:"Yes. Payment is handled by Stripe, which supports cards issued outside the US. Available payment methods are shown at checkout."}]})]}),(0,t.jsx)(l.ClosingCTA,{title:"Start free, upgrade when you draw every week.",text:"Ten credits a month, no card. The full engine catalogue either way.",buttonLabel:"Start free"})]})})}e.s(["default",0,function(){return(0,t.jsx)(o.UserProvider,{children:(0,t.jsx)(N,{})})}],550724)}]); 21 22//# debugId=6b4682cd-c59a-c7a1-a1e5-77cb50f817d1
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.