(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6023],{35023:function(e,t,r){Promise.resolve().then(r.bind(r,86829))},86829:function(e,t,r){"use strict";r.d(t,{default:function(){return d}});var n=r(81549),o=r(76799),i=r(7699);let a=o.forwardRef(function(e,t){let{title:r,titleId:n,...i}=e;return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":n},i),r?o.createElement("title",{id:n},r):null,o.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z",clipRule:"evenodd"}))});var s=r(43073),c=r(38045),l=r(52269),u=r(24504);function d(){let e=(0,u.useTranslations)("pricing"),t=[{name:e("onetime"),id:"basic",href:"#",price:"$3",unit:"",plan:"one-time",amount:300,currency:"usd",credits:30,description:"Including",tag:e("starter"),tip:e("basically_tip"),features:["one-time payment","30 credits","30 try-on times","try-on cost: $0.1 / once","valid for a month"],featured:!0},{name:e("monthly"),id:"pro",href:"#",price:"$18",unit:"/ mo",plan:"monthly",amount:1800,currency:"usd",credits:300,description:"Including",tag:e("popular"),tip:e("monthly_tip"),features:["auto renew every month","300 credits","300 try-on times","try-on cost: $0.06 / once","valid for a month"],featured:!0},{name:e("annually"),id:"pro-plus",href:"#",price:"$12",unit:"/ mo",plan:"yearly",amount:14400,currency:"usd",credits:3600,description:"Including",tag:e("save"),tip:e("annually_tip"),features:["auto renew every year","3600 credits","3600 try-on times","try-on cost: $0.04 / once","valid for a year"],featured:!0},{name:e("onetime"),id:"buy-credits",href:"#",price:"$36",unit:"",plan:"one-time",amount:3600,currency:"usd",credits:720,description:"Including",tag:"Pay as use",tip:e("basically_tip"),features:["one-time payment","720 credits","720 try-on times","try-on cost: $0.05 / once","valid for a year"],featured:!0}],[r,d]=(0,o.useState)(!1),[p,f]=(0,o.useState)(""),m=async(e,t,r,n,o)=>{try{d(!0),f(e);let i=await fetch("/api/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:t,credits:o,amount:r,currency:n})});if(401===i.status){d(!1),f(""),l.toast.error("need login"),(0,c.zB)("google");return}let{code:a,message:u,data:p}=await i.json();if(!p){d(!1),f(""),l.toast.error(u);return}let{public_key:m,session_id:h}=p,y=await (0,s.J)(m);if(!y){d(!1),f(""),l.toast.error("checkout failed");return}let g=await y.redirectToCheckout({sessionId:h});console.log("result",g),g.error&&(d(!1),f(""),l.toast.error(g.error.message))}catch(e){d(!1),f(""),console.log("checkout failed: ",e),l.toast.error("checkout failed")}};return(0,o.useEffect)(()=>{d(!1),f("")},[]),(0,n.jsx)("div",{className:"py-24 sm:py-32",children:(0,n.jsxs)("div",{className:"mx-auto max-w-7xl px-6 lg:px-8",children:[(0,n.jsx)("div",{className:"mx-auto max-w-4xl sm:text-center",children:(0,n.jsx)("h2",{className:"mt-2 text-4xl font-bold tracking-tight text-base-content sm:text-5xl",children:e("title")})}),(0,n.jsx)("p",{className:"mx-auto mt-6 max-w-2xl text-lg leading-8 text-base-content sm:text-center",children:e("tip")}),(0,n.jsx)("div",{className:"mt-20 flow-root",children:(0,n.jsx)("div",{className:"isolate -mt-16 grid max-w-sm grid-cols-1 gap-y-16 divide-y divide-base-300 sm:mx-auto lg:-mx-8 lg:mt-0 lg:max-w-none lg:grid-cols-4 lg:divide-x lg:divide-y-0 xl:-mx-4 gap-x-4",children:t.map(t=>(0,n.jsxs)("div",{className:"px-8 py-8 bg-base-100 rounded-md",children:[(0,n.jsxs)("h3",{id:t.id,className:"text-base font-semibold leading-7 text-base-content",children:[t.name,t.tag?(0,n.jsx)("p",{className:"float-right rounded-full bg-primary/10 px-2.5 py-1 text-xs font-semibold leading-5 text-primary",children:t.tag}):null]}),(0,n.jsxs)("p",{className:"mt-6 flex items-baseline gap-x-1",children:[(0,n.jsx)("span",{className:"text-5xl font-bold tracking-tight text-base-content",children:t.price}),t.unit&&(0,n.jsx)("span",{className:"text-sm font-semibold leading-6 text-base-content",children:t.unit})]}),(0,n.jsx)("p",{className:"hidden mt-3 text-sm leading-6 text-base-content",children:t.tip}),t.amount>0?(0,n.jsx)(i.z,{className:"mt-8 w-full",disabled:r,onClick:()=>{m(t.id,t.plan,t.amount,t.currency,t.credits)},children:r&&p===t.id?e("processing"):e("upgrade")}):(0,n.jsx)(i.z,{className:"mt-8 w-full",disabled:!0,children:e("current")}),(0,n.jsx)("p",{className:"mt-10 text-sm font-semibold leading-6 text-base-content",children:t.description}),(0,n.jsx)("ul",{role:"list",className:"mt-6 space-y-3 text-sm leading-6 text-base-content",children:t.features.map(e=>(0,n.jsxs)("li",{className:"flex gap-x-3",children:[(0,n.jsx)(a,{className:"h-6 w-5 flex-none text-primary","aria-hidden":"true"}),e]},e))})]},t.id))})})]})})}},7699:function(e,t,r){"use strict";r.d(t,{z:function(){return l}});var n=r(81549),o=r(76799),i=r(12045),a=r(97948),s=r(88445);let c=(0,a.j)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),l=o.forwardRef((e,t)=>{let{className:r,variant:o,size:a,asChild:l=!1,...u}=e,d=l?i.g7:"button";return(0,n.jsx)(d,{className:(0,s.cn)(c({variant:o,size:a,className:r})),ref:t,...u})});l.displayName="Button"},88445:function(e,t,r){"use strict";r.d(t,{cn:function(){return i}});var n=r(19956),o=r(29734);function i(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,o.m6)((0,n.W)(t))}},37616:function(e,t,r){"use strict";r.r(t);var n=r(33808),o={};for(var i in n)"default"!==i&&(o[i]=(function(e){return n[e]}).bind(0,i));r.d(t,o)},43073:function(e,t,r){"use strict";r.d(t,{J:function(){return h}});var n,o="https://js.stripe.com/v3",i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,a=function(){for(var e=document.querySelectorAll('script[src^="'.concat(o,'"]')),t=0;t<e.length;t++){var r=e[t];if(i.test(r.src))return r}return null},s=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src="".concat(o).concat(t);var n=document.head||document.body;if(!n)throw Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return n.appendChild(r),r},c=function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"3.3.0",startTime:t})},l=null,u=null,d=null,p=function(e,t,r){if(null===e)return null;var n=e.apply(void 0,t);return c(n,r),n},f=!1,m=function(){return n||(n=(null!==l?l:(l=new Promise(function(e,t){if("undefined"==typeof window||"undefined"==typeof document){e(null);return}if(window.Stripe,window.Stripe){e(window.Stripe);return}try{var r,n=a();n?n&&null!==d&&null!==u&&(n.removeEventListener("load",d),n.removeEventListener("error",u),null===(r=n.parentNode)||void 0===r||r.removeChild(n),n=s(null)):n=s(null),d=function(){window.Stripe?e(window.Stripe):t(Error("Stripe.js not available"))},u=function(){t(Error("Failed to load Stripe.js"))},n.addEventListener("load",d),n.addEventListener("error",u)}catch(e){t(e);return}})).catch(function(e){return l=null,Promise.reject(e)})).catch(function(e){return n=null,Promise.reject(e)}))};Promise.resolve().then(function(){return m()}).catch(function(e){f||console.warn(e)});var h=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];f=!0;var n=Date.now();return m().then(function(e){return p(e,t,n)})}},5346:function(e,t,r){"use strict";r.d(t,{ZT:function(){return o},_T:function(){return a},ev:function(){return s},pi:function(){return i}});var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>t.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function s(e,t,r){if(r||2==arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError}},function(e){e.O(0,[2269,4886,8045,4504,4058,5309,1744],function(){return e(e.s=35023)}),_N_E=e.O()}]);