1import{m as R,r,s as c,j as e,W as d,L as n,bo as A,O as m,l as o,f2 as x,bg as O}from"./index-D4tGXnjJ.js";import{i as U,s as j}from"./freeTierAck-iFqFQ41I.js";function B(){const l=R(),[b,y]=r.useState(!0),[i,f]=r.useState(null),[E,v]=r.useState(void 0),[g,k]=r.useState(null),[w,P]=r.useState(!1),[u,p]=r.useState(!1);r.useEffect(()=>{let s=!1;return(async()=>{const{data:t}=await c.auth.getUser(),a=t.user;if(!a){l("/login",{replace:!0});return}v(a.email),k(a.id);try{const{data:h}=await c.functions.invoke("check-subscription");s||P(!!(h!=null&&h.payment_update_required))}catch{}const S=await U(a.id);if(!s){if(!S){l("/discover",{replace:!0});return}y(!1)}})(),()=>{s=!0}},[l]);const N=async s=>{if(i)return;f(s),await O(s,"1")||f(null)},C=async()=>{if(!u){p(!0);try{const{data:{session:s}}=await c.auth.getSession();if(!s)return;const{data:t,error:a}=await c.functions.invoke("customer-portal",{headers:{Authorization:`Bearer ${s.access_token}`},body:{returnUrl:`${window.location.origin}/choose-plan`}});if(a)throw a;if(t!=null&&t.url){window.location.href=t.url;return}}catch{}p(!1)}};return b?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx(d,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.jsxs("div",{className:"min-h-screen bg-background px-6 py-10 flex flex-col items-center",children:[e.jsx(n,{to:"/",className:"mb-8",children:e.jsx("img",{src:A,alt:"Production Online",className:"h-6 dark:invert"})}),e.jsxs("div",{className:"w-full max-w-3xl space-y-8",children:[e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Choose your plan"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Pick a plan for access to courses, community, and the Shop."})]}),w&&e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-5 flex flex-col sm:flex-row sm:items-center gap-4",children:[e.jsx("p",{className:"text-sm flex-1",children:"Your first payment didn't go through. Update your payment method to start your membership."}),e.jsx(m,{onClick:C,disabled:u,className:"rounded-xl font-semibold",children:u?e.jsxs(e.Fragment,{children:[e.jsx(d,{className:"mr-2 h-4 w-4 animate-spin"}),"Redirectingâ¦"]}):"Update payment method"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-6 flex flex-col",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Pro Monthly"}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-1",children:[e.jsx("span",{className:"text-4xl font-bold tracking-tight",children:"$49"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"/mo"})]}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"7-day free trial"})]}),e.jsxs("ul",{className:"space-y-2 text-sm mb-6 flex-1",children:[e.jsxs("li",{className:"flex gap-2",children:[e.jsx(o,{className:"h-4 w-4 mt-0.5 shrink-0"})," Everything in Free, plusâ¦"]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx(o,{className:"h-4 w-4 mt-0.5 shrink-0"})," Full access to every course and learning path"]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx(o,{className:"h-4 w-4 mt-0.5 shrink-0"})," Share your work and connect in the community"]})]}),e.jsx(m,{onClick:()=>N(x.PRO_MONTHLY),disabled:!!i,className:"w-full h-12 rounded-xl font-semibold",variant:"outline",children:i===x.PRO_MONTHLY?e.jsxs(e.Fragment,{children:[e.jsx(d,{className:"mr-2 h-4 w-4 animate-spin"}),"Redirectingâ¦"]}):"Start free trial"}),e.jsx("p",{className:"mt-3 text-center text-sm text-muted-foreground",children:"Cancel anytime."}),e.jsxs("p",{className:"mt-3 text-xs text-center text-muted-foreground leading-relaxed",children:["Free for 7 days, then $49/mo until you cancel. Cancel anytime. By subscribing, you agree to our"," ",e.jsx(n,{to:"/legal/terms",className:"underline hover:text-foreground",children:"Terms"})," &"," ",e.jsx(n,{to:"/legal/refunds",className:"underline hover:text-foreground",children:"Refund Policy"}),"."]})]}),e.jsxs("div",{className:"rounded-2xl border-2 border-foreground bg-card p-6 flex flex-col relative",children:[e.jsx("span",{className:"absolute -top-3 left-1/2 -translate-x-1/2 bg-foreground text-background text-xs font-semibold px-3 py-1 rounded-full",children:"Best value"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Pro Annual"}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-1",children:[e.jsx("span",{className:"text-4xl font-bold tracking-tight",children:"$499"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"/yr"})]}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Best value â Save $89 vs monthly · billed annually"})]}),e.jsxs("ul",{className:"space-y-2 text-sm mb-6 flex-1",children:[e.jsxs("li",{className:"flex gap-2",children:[e.jsx(o,{className:"h-4 w-4 mt-0.5 shrink-0"})," All Shop downloads included â templates, presets, and sample packs at no extra cost"]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx(o,{className:"h-4 w-4 mt-0.5 shrink-0"})," Everything in Pro Monthly"]})]}),e.jsx(m,{onClick:()=>N(x.PRO_ANNUAL),disabled:!!i,className:"w-full h-12 rounded-xl font-semibold",children:i===x.PRO_ANNUAL?e.jsxs(e.Fragment,{children:[e.jsx(d,{className:"mr-2 h-4 w-4 animate-spin"}),"Redirectingâ¦"]}):"Get Pro Annual"}),e.jsxs("p",{className:"mt-3 text-xs text-center text-muted-foreground leading-relaxed",children:["$499 billed today, then $499/yr until you cancel. Non-refundable. By subscribing, you agree to our"," ",e.jsx(n,{to:"/legal/terms",className:"underline hover:text-foreground",children:"Terms"})," &"," ",e.jsx(n,{to:"/legal/refunds",className:"underline hover:text-foreground",children:"Refund Policy"}),"."]})]})]}),e.jsxs("div",{className:"rounded-xl bg-muted/50 border border-border px-4 py-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-center",children:[e.jsx("span",{className:"text-sm font-semibold",children:"Continue with a free account"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Post, comment and like in the community. Classes, downloads and learning paths are Pro."}),e.jsx(m,{variant:"ghost",size:"sm",className:"text-sm underline",onClick:()=>{j(g),l("/discover",{replace:!0})},children:"Continue free"})]}),e.jsxs("div",{className:"text-center space-y-4 pt-2",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Need seats for your team?"," ",e.jsx(n,{to:"/pricing",className:"underline font-medium text-foreground hover:opacity-80",children:"See Team pricing â"})]}),e.jsx("button",{type:"button",onClick:()=>{j(g),l("/discover",{replace:!0})},className:"text-base font-medium text-foreground hover:opacity-80 underline",children:"Continue without a plan"})]})]})]})}export{B as default};
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.