1import{j as t}from"./ui-vendor-BFigXnWF.js";import{u as ue,a as o}from"./i18n-vendor-Dmcwjm_H.js";import{u as le,F as de,r as Q,m as _e,f as me}from"./index-D0pE_Y6X.js";import{s as L}from"./stripeService-hsvS47cR.js";import{L as D,P as U}from"./index-CA762ETj.js";import{P as fe}from"./index-C97mr1xx.js";import{T as z}from"./index-BPZt0P22.js";import{b as he,u as be}from"./react-vendor-C6lNvrSH.js";import{k as ge,g as W,h as we,X as xe,i as Ce,j as qe}from"./icons-vendor-CTJkznu-.js";import"./utils-vendor-Dob3nYDb.js";import"./oauth-vendor-DVDdqKCp.js";import"./index-5SQ7z2WV.js";import"./index-B_d5bH1f.js";import"./index-PNcMiiqp.js";const je="_pageWrapper_1nwa6_1",ye="_pricingPage_1nwa6_7",Ne="_footer_1nwa6_12",Se="_backHeader_1nwa6_18",ve="_backButton_1nwa6_32",Be="_hero_1nwa6_56",ke="_plansSection_1nwa6_105",Te="_plansGrid_1nwa6_115",Ie="_planCard_1nwa6_130",Pe="_popular_1nwa6_144",Le="_featuresList_1nwa6_152",$e="_excluded_1nwa6_155",Ee="_checkIcon_1nwa6_158",Ae="_popularBadge_1nwa6_166",Me="_planHeader_1nwa6_179",Re="_planTitleRow_1nwa6_188",Oe="_recommendedBadge_1nwa6_194",Fe="_planDescription_1nwa6_203",He="_priceBlock_1nwa6_215",Qe="_priceMain_1nwa6_220",De="_amount_1nwa6_224",Ue="_period_1nwa6_230",ze="_priceCny_1nwa6_235",We="_actionButton_1nwa6_241",Ge="_popularButton_1nwa6_265",Ve="_enterpriseButton_1nwa6_274",Ke="_spinner_1nwa6_283",Ye="_included_1nwa6_361",Xe="_xIcon_1nwa6_374",Je="_faqSection_1nwa6_382",Ze="_faqContent_1nwa6_392",et="_faqHeader_1nwa6_399",tt="_faqTitle_1nwa6_402",nt="_faqList_1nwa6_420",st="_faqItem_1nwa6_425",it="_open_1nwa6_436",at="_faqQuestion_1nwa6_440",ot="_questionText_1nwa6_461",rt="_faqIcon_1nwa6_473",ct="_faqAnswer_1nwa6_491",pt="_answerContent_1nwa6_511",ut="_ctaSection_1nwa6_524",lt="_ctaButton_1nwa6_547",dt="_topupOverlay_1nwa6_564",_t="_topupModal_1nwa6_575",mt="_topupDesc_1nwa6_604",ft="_topupControls_1nwa6_608",ht="_topupQuantityRow_1nwa6_613",bt="_topupQuantityLabel_1nwa6_618",gt="_topupStepper_1nwa6_623",wt="_stepperBtn_1nwa6_631",xt="_stepperInput_1nwa6_651",Ct="_topupTotalRow_1nwa6_676",qt="_topupTotalLabel_1nwa6_681",jt="_topupTotalValue_1nwa6_686",yt="_topupError_1nwa6_692",Nt="_topupActions_1nwa6_697",St="_topupBuyBtn_1nwa6_702",vt="_topupCancelBtn_1nwa6_725",n={pageWrapper:je,pricingPage:ye,footer:Ne,backHeader:Se,backButton:ve,hero:Be,plansSection:ke,plansGrid:Te,planCard:Ie,popular:Pe,featuresList:Le,excluded:$e,checkIcon:Ee,popularBadge:Ae,planHeader:Me,planTitleRow:Re,recommendedBadge:Oe,planDescription:Fe,priceBlock:He,priceMain:Qe,amount:De,period:Ue,priceCny:ze,actionButton:We,popularButton:Ge,enterpriseButton:Ve,spinner:Ke,included:Ye,xIcon:Xe,faqSection:Je,faqContent:Ze,faqHeader:et,faqTitle:tt,faqList:nt,faqItem:st,open:it,faqQuestion:at,questionText:ot,faqIcon:rt,faqAnswer:ct,answerContent:pt,ctaSection:ut,ctaButton:lt,topupOverlay:dt,topupModal:_t,topupDesc:mt,topupControls:ft,topupQuantityRow:ht,topupQuantityLabel:bt,topupStepper:gt,stepperBtn:wt,stepperInput:xt,topupTotalRow:Ct,topupTotalLabel:qt,topupTotalValue:jt,topupError:yt,topupActions:Nt,topupBuyBtn:St,topupCancelBtn:vt},G={free:0,pro:1,premium:2,enterprise:3},Qt=()=>{const{t:e}=ue(),q=he(),V=be(),{user:$,isAuthenticated:r}=le(),[K,Y]=o.useState(!1),X=K&&V.state?.from==="app";o.useEffect(()=>{Y(!0)},[]);const[j,y]=o.useState(null),[E,m]=o.useState(!1),[b,J]=o.useState(null),[g,N]=o.useState(null),[w,A]=o.useState(null),[Z,u]=o.useState(null),[x,S]=o.useState(null),[ee,v]=o.useState(!1),[c,f]=o.useState(1),[_,B]=o.useState(!1),[k,l]=o.useState(null),[te,M]=o.useState(!1),ne=$?.tier?.toLowerCase()||"free",T=x?x.is_active?x.tier.toLowerCase():"free":ne,C=s=>{switch(s?.toLowerCase()){case"free":return e("subscription.free");case"pro":return e("subscription.pro");case"premium":return e("subscription.premium");case"enterprise":return e("subscription.enterprise");default:return s?.toUpperCase()||""}};o.useEffect(()=>{try{sessionStorage.getItem("billing_cancel")==="true"&&(sessionStorage.removeItem("billing_cancel"),N(e("billing.cancel.toast")))}catch{}},[e]),o.useEffect(()=>{let s=!1;if(!r){S(null);return}return L.getSubscriptionStatus().then(i=>{s||S(i)}).catch(i=>{console.error("Failed to fetch subscription status:",i),s||S(null)}),()=>{s=!0}},[r,$?.id]);const se=async(s,i="card")=>{if(!r){m(!0);return}try{u(null),y(s),Q("begin_checkout",{currency:i==="alipay"?"CNY":"USD",payment_method:i,items:s});const a=await L.createCheckoutSession({plan:s,payment_method:i,success_url:`${window.location.origin}/billing/success?session_id={CHECKOUT_SESSION_ID}`,cancel_url:`${window.location.origin}/billing/cancel`});a.checkout_url?window.location.href=a.checkout_url:(u(e("subscription.checkoutFailed")),y(null))}catch(a){if(console.error("Failed to create checkout session:",a),a instanceof _e&&a.code===me.SUBSCRIPTION_CONFLICT){const{current_tier:p,requested_tier:h,has_auto_renew:I}=a.details||{};u(p===h&&I?e("subscription.conflict.sameTierAutoRenew",{tier:C(p)}):p===h?e("subscription.conflict.sameTier",{tier:C(p)}):e("subscription.conflict.cannotDowngrade",{current:C(p),requested:C(h)}))}else u(e("subscription.checkoutFailed"));y(null)}},ie=async s=>{const i=c;if(!Number.isInteger(i)||i<1||i>50){l(e("subscription.topup.invalidQuantity"));return}try{l(null),B(!0),Q("begin_checkout",{currency:s==="alipay"?"CNY":"USD",payment_method:s,items:"topup",quantity:i});const a=await L.createTopupCheckout({quantity:i,payment_method:s,success_url:`${window.location.origin}/billing/success?session_id={CHECKOUT_SESSION_ID}`,cancel_url:`${window.location.origin}/billing/cancel`});a.checkout_url?window.location.href=a.checkout_url:(l(e("subscription.checkoutFailed")),B(!1))}catch(a){console.error("Failed to create topup checkout:",a),l(e("subscription.checkoutFailed")),B(!1)}},ae=[{id:"free",name:e("subscription.free"),price:"$0",priceCny:"",period:e("subscription.month"),description:e("pricing.plans.free.description"),credits:50,devices:1,features:[{name:e("subscription.features.basicAccess"),included:!0},{name:e("subscription.features.dailyRefreshCredits",{count:50}),included:!0},{name:e("subscription.features.devices",{count:1}),included:!0},{name:e("subscription.features.communitySupport"),included:!0},{name:e("subscription.features.advancedModels"),included:!1}],isAvailable:!0,isEnterprise:!1},{id:"pro",name:e("subscription.pro"),price:"$9.9",priceCny:"â Â¥69",period:e("subscription.month"),description:e("pricing.plans.pro.description"),credits:1500,devices:2,features:[{name:e("subscription.features.fullAccess"),included:!0},{name:e("subscription.features.monthlyCredits",{count:1500}),included:!0},{name:e("subscription.features.dailyRefreshCredits",{count:50}),included:!0}
1,{name:e("subscription.features.devices_plural",{count:2}),included:!0},{name:e("subscription.features.prioritySupport"),included:!0},{name:e("subscription.features.advancedModels"),included:!0}],isAvailable:!0,isEnterprise:!1},{id:"premium",name:e("subscription.premium"),price:"$29.9",priceCny:"â Â¥199",period:e("subscription.month"),description:e("pricing.plans.premium.description"),credits:6e3,devices:-1,features:[{name:e("subscription.features.fullAccess"),included:!0},{name:e("subscription.features.monthlyCredits",{count:6e3}),included:!0},{name:e("subscription.features.dailyRefreshCredits",{count:50}),included:!0},{name:e("subscription.features.unlimitedDevices"),included:!0},{name:e("subscription.features.prioritySupport"),included:!0},{name:e("subscription.features.advancedModels"),included:!0},{name:e("subscription.features.earlyAccess"),included:!0}],popular:!0,isAvailable:!0,isEnterprise:!1},{id:"topup",name:e("subscription.topup.title"),price:"$1.90",priceCny:"â Â¥13",period:e("subscription.topup.perPack"),description:e("pricing.plans.topup.description"),credits:300,devices:0,features:[{name:e("subscription.features.topupCredits"),included:!0},{name:e("subscription.features.topupExpiry"),included:!0},{name:e("subscription.features.topupRequires"),included:!0},{name:e("subscription.features.topupStackable"),included:!0}],isAvailable:!0,isEnterprise:!1,isTopup:!0}],oe=[{q:e("pricing.faq.q1"),a:e("pricing.faq.a1")},{q:e("pricing.faq.q2"),a:e("pricing.faq.a2")},{q:e("pricing.faq.q3"),a:e("pricing.faq.a3")},{q:e("pricing.faq.q4"),a:e("pricing.faq.a4")},{q:e("pricing.faq.q5"),a:e("pricing.faq.a5")},{q:e("pricing.faq.q6"),a:e("pricing.faq.a6")},{q:e("pricing.faq.q7"),a:e("pricing.faq.a7")}];if(X)return t.jsxs("div",{className:n.pricingPage,children:[t.jsx("div",{className:n.backHeader,children:t.jsxs("button",{className:n.backButton,onClick:()=>q("/app"),"aria-label":e("common.back"),children:[t.jsx(ge,{size:20}),t.jsx("span",{children:e("common.back")})]})}),t.jsxs("section",{className:n.hero,children:[t.jsx("h1",{children:e("pricing.hero.title")}),t.jsx("p",{children:e("pricing.hero.subtitle")})]}),R(),t.jsx(D,{isOpen:E,onClose:()=>m(!1)}),g&&t.jsx(z,{message:g,onClose:()=>N(null),duration:3e3})]});return t.jsxs("div",{className:n.pageWrapper,children:[t.jsx(fe,{title:e("pricing.hero.title"),subtitle:e("pricing.hero.subtitle"),fullWidthContent:!0,children:R()}),t.jsx("div",{className:n.footer,children:t.jsx(de,{})}),t.jsx(D,{isOpen:E,onClose:()=>m(!1)}),g&&t.jsx(z,{message:g,onClose:()=>N(null),duration:3e3})]});function R(){return t.jsxs(t.Fragment,{children:[t.jsx("section",{className:n.plansSection,children:t.jsx("div",{className:n.plansGrid,children:ae.map(s=>{const i=r&&T===s.id,a=j===s.id,p=s.isAvailable!==!1,h=G[s.id||""]??0,I=G[T]??0,P=r&&h<I,re=i||P||!!j&&!a,ce=()=>p?i?e("pricing.currentPlan"):P?e("pricing.included"):!r&&s.id==="free"?e("pricing.signUp"):e("pricing.getStarted"):e("common.comingSoon"),O=!r&&s.popular,F=r&&s.popular&&!i,H=O||F;return t.jsxs("div",{className:`${n.planCard} ${i?n.current:""} ${H?n.popular:""}`,children:[t.jsxs("div",{className:n.planHeader,children:[t.jsxs("div",{className:n.planTitleRow,children:[t.jsx("h2",{children:s.name}),O&&t.jsx("span",{className:n.popularBadge,children:e("pricing.popular")}),F&&t.jsx("span",{className:n.recommendedBadge,children:e("pricing.recommended")})]}),s.description&&t.jsx("p",{className:n.planDescription,children:s.description})]}),t.jsxs("div",{className:n.priceBlock,children:[t.jsxs("div",{className:n.priceMain,children:[t.jsx("span",{className:n.amount,children:s.price}),s.period&&t.jsx("span",{className:n.period,children:s.period})]}),s.priceCny&&t.jsx("span",{className:n.priceCny,children:s.priceCny})]}),s.isEnterprise?t.jsx("button",{type:"button",className:`${n.actionButton} ${n.enterpriseButton}`,onClick:()=>q("/contact"),children:e("pricing.contactSales")}):s.isTopup?(()=>{const d=r&&x?.is_active===!0&&["pro","premium"].includes(T);return t.jsx("button",{type:"button",className:`${n.actionButton} ${d?n.popularButton:""}`,disabled:r&&!d,onClick:()=>
1{if(!r){m(!0);return}d&&(v(!0),f(1),l(null))},children:e(r&&!d?"pricing.plans.topup.requiresPro":"pricing.getStarted")})})():t.jsx("button",{type:"button",className:`${n.actionButton} ${i?n.currentButton:""} ${H?n.popularButton:""}`,disabled:re||!p,onClick:()=>{if(p){if(!r){m(!0);return}!i&&!P&&s.id!=="free"&&(A(s.id),u(null))}},children:a?t.jsx(W,{className:n.spinner,size:18}):ce()}),t.jsx("ul",{className:n.featuresList,children:s.features.map((d,pe)=>t.jsxs("li",{className:d.included?n.included:n.excluded,children:[d.included?t.jsx(we,{size:16,className:n.checkIcon}):t.jsx(xe,{size:16,className:n.xIcon}),t.jsx("span",{children:d.name})]},pe))})]},s.id)})})}),t.jsx("section",{className:n.faqSection,children:t.jsxs("div",{className:n.faqContent,children:[t.jsx("div",{className:n.faqHeader,children:t.jsx("h2",{className:n.faqTitle,children:e("pricing.faq.title")})}),t.jsx("div",{className:n.faqList,children:oe.map((s,i)=>t.jsxs("div",{className:`${n.faqItem} ${b===i?n.open:""}`,children:[t.jsxs("button",{className:n.faqQuestion,onClick:()=>J(b===i?null:i),"aria-expanded":b===i,children:[t.jsx("span",{className:n.questionText,children:s.q}),t.jsx("span",{className:n.faqIcon,children:b===i?"â":"+"})]}),t.jsx("div",{className:n.faqAnswer,children:t.jsx("div",{className:n.answerContent,children:s.a})})]},i))})]})}),t.jsxs("section",{className:n.ctaSection,children:[t.jsx("h2",{children:e("pricing.cta.title")}),t.jsx("p",{children:e("pricing.cta.subtitle")}),t.jsx("button",{className:n.ctaButton,onClick:()=>q("/app"),children:e("pricing.cta.button")})]}),t.jsx(U,{isOpen:!!w,analyticsSource:"pricing_page",analyticsItemId:w||void 0,onClose:()=>{A(null),u(null)},onConfirm:s=>{w&&se(w,s)},loading:!!j,error:Z}),ee&&t.jsx("div",{className:n.topupOverlay,onClick:()=>v(!1),children:t.jsxs("div",{className:n.topupModal,onClick:s=>s.stopPropagation(),children:[t.jsx("h3",{children:e("subscription.topup.title")}),t.jsx("span",{className:n.topupDesc,children:e("subscription.topup.description")}),t.jsxs("div",{className:n.topupControls,children:[t.jsxs("div",{className:n.topupQuantityRow,children:[t.jsx("span",{className:n.topupQuantityLabel,children:e("subscription.topup.quantity")}),t.jsxs("div",{className:n.topupStepper,children:[t.jsx("button",{type:"button",className:n.stepperBtn,onClick:()=>f(s=>Math.max(1,s-1)),disabled:c<=1||_,children:t.jsx(Ce,{size:14})}),t.jsx("input",{type:"number",className:n.stepperInput,value:c,min:1,max:50,onChange:s=>{const i=s.target.value;if(i===""){f(1);return}const a=parseInt(i,10);isNaN(a)||f(Math.min(50,Math.max(1,a)))},disabled:_}),t.jsx("button",{type:"button",className:n.stepperBtn,onClick:()=>f(s=>Math.min(50,s+1)),disabled:c>=50||_,children:t.jsx(qe,{size:14})})]})]}),t.jsxs("div",{className:n.topupTotalRow,children:[t.jsx("span",{className:n.topupTotalLabel,children:e("subscription.topup.total")}),t.jsxs("span",{className:n.topupTotalValue,children:["$",(c*1.9).toFixed(2)," (â Â¥",c*13,") · ",c*300," ",e("subscription.topup.credits")]})]})]}),k&&t.jsx("p",{className:n.topupError,children:k}),t.jsxs("div",{className:n.topupActions,children:[t.jsx("button",{type:"button",className:n.topupBuyBtn,disabled:_,onClick:()=>{l(null);const s=c;if(!Number.isInteger(s)||s<1||s>50){l(e("subscription.topup.invalidQuantity"));return}M(!0)},children:_?t.jsx(W,{className:n.spinner,size:15}):e("subscription.topup.buy")}),t.jsx("button",{type:"button",className:n.topupCancelBtn,onClick:()=>v(!1),children:e("common.close")})]})]})}),t.jsx(U,{isOpen:te,analyticsSource:"pricing_page",analyticsItemId:"topup",onClose:()=>{M(!1),l(null)},onConfirm:s=>ie(s),loading:_,error:k,oneTime:!0,summary:`${c} ${e("subscription.topup.packUnit")} · $${(c*1.9).toFixed(2)} (â Â¥${c*13}) · ${c*300} ${e("subscription.topup.credits")}`})]})}};export{Qt 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.