PageSourceSearch

https://www.magicstyle.ai/_next/static/chunks/987-db45c6bcbbdbba23.js

js magicstyle.ai collected 2026-10-05 15:38:24 UTC 10,708 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[987],{2987:(e,t,r)=>{r.d(t,{A:()=>p});var a=r(5155),s=r(9137),o=r.n(s),n=r(2115),l=r(1978),i=r(5196),c=r(1154),d=r(3274),u=r(3568),m=r(5168),x=r(8436);let f=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return["".concat(e," Credits (").concat(e," Images)"),t?"High Quality Images (With Watermark)":"Ultra High Quality Images (No Watermark)","All Resolutions & Ratio Options: 1024x1024, 1:1, 9:16, 16:9, 4:3, 3:4, 3:2, 2:3, 4:5, 5:4, 5:12, 12:5","Full access to your Gallery to see and filter all your images","More Styles Coming Soon!","Transform Your Images into Stunning Videos: Convert any image to a dynamic video (coming soon!)","24/7 Customer Support: We're here to help anytime, day or night!"]};function p(){let{user:e}=(0,d.A)(),[t,r]=(0,n.useState)(!1),[s,p]=(0,n.useState)(null),[b,h]=(0,n.useState)(!1),[g,v]=(0,n.useState)("signup"),w=[{value:3,price:0,label:"3",free:!0},{value:10,price:1.99,label:"10"},{value:25,price:4.99,label:"25"},{value:50,price:7.99,label:"50"},{value:100,price:11.99,label:"100"},{value:200,price:18.99,label:"200"},{value:500,price:39.99,label:"500"},{value:1e3,price:69.99,label:"1000"}],y=e?w.filter(e=>!e.free):w,[j,N]=(0,n.useState)(0),[k,C]=(0,n.useState)(f(w[0].value,w[0].free));(0,n.useEffect)(()=>{let e=y.findIndex(e=>100===e.value),t=e>=0?e:0;N(t),C(f(y[t].value,y[t].free))},[e]),(0,n.useEffect)(()=>{if(j>=0&&j<y.length){let e=y[j];C(f(e.value,e.free))}},[j]),(0,n.useEffect)(()=>{console.log("Auth status:",e?"Logged in":"Not logged in"),e&&console.log("User ID:",e.i
1d)},[e]);let F=j<y.length?y[j]:y[0],S=F.free?"Free":(F.price/F.value).toFixed(3),z=async(t,a)=>{if(!e){v("signup"),h(!0);return}r(!0),p(t);try{let r;console.log("User before making request:",e.id);let s=(0,m.S)(),{data:{session:o}}=await s.auth.getSession();if(!o)throw Error("No active session. Please sign in again.");console.log("Session found with token:",o.access_token?"present":"missing");let n=await fetch("/api/create-checkout",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(o.access_token)},credentials:"include",body:JSON.stringify({creditAmount:t,price:a})}),l=await n.text();console.log("Response text:",l);try{r=JSON.parse(l)}catch(e){throw Error("Invalid response format")}if(!n.ok)throw Error(r.error||"Server error: ".concat(n.status));if(console.log("Checkout created:",r),!r.url)throw Error("No checkout URL returned");window.location.href=r.url}catch(e){console.error("Error creating checkout:",e),u.oR.error("Checkout error: ".concat(e.message||"Something went wrong"))}finally{r(!1),p(null)}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("section",{id:"pricing",className:"py-24 bg-[#f0f0ec]",children:(0,a.jsx)("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8",children:(0,a.jsxs)("div",{className:"text-center mb-12",children:[(0,a.jsx)(l.P.h2,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},className:"hero-text text-3xl md:text-4xl font-bold text-foreground mb-4",children:"Choose Your Credit Pack"}),(0,a.jsx)("p",{className:"text-lg text-foreground/80 max-w-3xl mx-auto mb-6",children:"Select the perfect amount of credits for your needs. The more you buy, the more you save!"}),(0,a.jsxs)("div",{className:"relative mb-14 pt-10 pb-6 px-8",children:[(0,a.jsxs)("div",{className:"absolute -top-2 bg-primary text-white text-sm py-1 px-3 rounded-full font-medium transform -translate-x-1/2 shadow-md z-10 whitespace-nowrap",style:{left:"".concat(j/(y.length-1)*100,"%"),transition:"left 0.3s ease",backgroundColor:F.free?"#8B5CF6":"#dbb258"},children:[F.value," credits",F.free?" (Free)":""]}),(0,a.jsxs)("div",{className:o().dynamic([["1a8e5dfbee5f0f82",[F.free?"#8B5CF6":"#dbb258",F.free?"#8B5CF6":"#dbb258",F.free?"#7c4dff":"#c9a04b"]]])+" relative w-full",children:[(0,a.jsx)("input",{type:"range",min:"0",max:y.length-1,step:"1",value:j,onChange:e=>{N(parseInt(e.target.value,10))},style:{WebkitAppearance:"none",outline:"none",background:(()=>{let e=j/Math.max(1,y.length-1)*100;return"linear-gradient(to right, #dbb258 0%, #dbb258 ".concat(e,"%, #e2e8f0 ").concat(e,"%, #e2e8f0 100%)")})(),transition:"background 0.3s ease"},className:o().dynamic([["1a8e5dfbee5f0f82",[F.free?"#8B5CF6":"#dbb258",F.free?"#8B5CF6":"#dbb258",F.free?"#7c4dff":"#c9a04b"]]])+" w-full h-2 appearance-none rounded-full cursor-pointer bg-slate-200 z-0"}),(0,a.jsx)(o(),{id:"1a8e5dfbee5f0f82",dynamic:[F.free?"#8B5CF6":"#dbb258",F.free?"#8B5CF6":"#dbb258",F.free?"#7c4dff":"#c9a04b"],children:'input[type="range"].__jsx-style-dynamic-selector::-webkit-slider-thumb{-webkit-appearance:none;width:22px;height:22px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;background:'.concat(F.free?"#8B5CF6":"#dbb258",';border:2px solid white;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.2);-moz-box-shadow:0 1px 3px rgba(0,0,0,.2);box-shadow:0 1px 3px rgba(0,0,0,.2);cursor:pointer;-webkit-transition:all.15s ease;-moz-transition:all.15s ease;-o-transition:all.15s ease;transition:all.15s ease}input[type="range"].__jsx-style-dynamic-selector::-moz-range-thumb{width:22px;height:22px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;background:').concat(F.free?"#8B5CF6":"#dbb258",';border:2px solid white;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.2);-moz-box-shadow:0 1px 3px rgba(0,0,0,.2);box-shadow:0 1px 3px rgba(0,0,0,.2);cursor:pointer;-webkit-transition:all.15s ease;-moz-transition:all.15s ease;-o-transition:all.15s ease;transition:all.15s ease}input[type="range"].__jsx-style-dynamic-selector::-webkit-slider-thumb:hover,input[type="range"].__jsx-style-dynamic-selector::-moz-range-thumb:hover{-webkit-transform:scale(1.1);-moz-transform:scale(1.1);-ms-transform:scale(1.1);-o-transform:scale(1.1);transform:scale(1.1);-webkit-box-shadow:0 2px 6px rgba(0,0,0,.15);-moz-box-shadow:0 2px 6px rgba(0,0,0,.15);box-shadow:0 2px 6px rgba(0,0,0,.15)}input[type="range"].__jsx-style-dynamic-selector::-webkit-slider-thumb:active,input[type="range"].__jsx-style-dynamic-selector::-moz-range-thumb:active{-webkit-transform:scale(1.15);-moz-transform:scale(1.15);-ms-transform:scale(1.15);-o-transform:scale(1.15);transform:scale(1.15);background:').concat(F.free?"#7c4dff":"#c9a04b","}")})]})]}),(0,a.jsx)("div",{className:"bg-white p-8 rounded-2xl shadow-sm mb-10",children:(0,a.jsxs)(l.P.div,{className:"".concat(F.free?"bg-accent/5 border-accent/20":"bg-primary/5 border-primary/20"," border p-6 rounded-xl"),initial:{opacity:0,y:10}
1,animate:{opacity:1,y:0},transition:{duration:.3},children:[(0,a.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h3",{className:"text-2xl font-bold text-foreground flex items-center",children:[(0,a.jsx)("span",{className:"".concat(F.free?"bg-accent/10 text-accent":"bg-primary/10 text-primary"," rounded-full w-10 h-10 flex items-center justify-center mr-3"),children:(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5",children:[(0,a.jsx)("path",{d:"M10.464 8.746c.227-.18.497-.311.786-.394v2.795a2.252 2.252 0 01-.786-.393c-.394-.313-.546-.681-.546-1.004 0-.323.152-.691.546-1.004zM12.75 15.662v-2.824c.347.085.664.228.921.421.427.32.579.686.579.991 0 .305-.152.671-.579.991a2.534 2.534 0 01-.921.42z"}),(0,a.jsx)("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25zM12.75 6a.75.75 0 00-1.5 0v.816a3.836 3.836 0 00-1.72.756c-.712.566-1.112 1.35-1.112 2.178 0 .829.4 1.612 1.113 2.178.502.4 1.102.647 1.719.756v2.978a2.536 2.536 0 01-.921-.421l-.879-.66a.75.75 0 00-.9 1.2l.879.66c.533.4 1.169.645 1.821.75V18a.75.75 0 001.5 0v-.81a4.124 4.124 0 001.821-.749c.745-.559 1.179-1.344 1.179-2.191 0-.847-.434-1.632-1.179-2.191a4.122 4.122 0 00-1.821-.75V8.354c.29.082.559.213.786.393l.415.33a.75.75 0 00.933-1.175l-.415-.33a3.836 3.836 0 00-1.719-.755V6z",clipRule:"evenodd"})]})}),F.value," Credits ",F.free&&(0,a.jsx)("span",{className:"ml-2 text-sm font-normal bg-accent/20 text-accent px-2 py-0.5 rounded-full",children:"Free"})]}),(0,a.jsx)("p",{className:"text-sm text-foreground/70 mt-1 ml-1",children:F.free?"Perfect for new users to try the service":F.value<=25?"Starter pack":F.value<=100?"Perfect for occasional use":F.value<=200?"Ideal for creative enthusiasts":F.value<=500?"For the dedicated creator":"For professionals and power users"})]}),(0,a.jsxs)("div",{className:"mt-4 md:mt-0 text-right",children:[(0,a.jsx)("div",{className:"text-3xl font-bold ".concat(F.free?"text-accent":"text-primary"),children:F.free?"Free":"$".concat(F.price)}),!F.free&&F.value>w[1].value&&(0,a.jsxs)("div",{className:"text-sm text-foreground/70",children:[(0,a.jsxs)("span",{className:"text-green-600",children:["$",(()=>{if(F.free||F.value<=10)return"0.00";let e=w.find(e=>!e.free);if(!e)return"0.00";let t=F.value*(e.price/e.value)-F.price;return t>0?t.toFixed(2):"0.00"})()]})," savings"]})]})]}),!F.free&&(0,a.jsxs)("div",{className:"flex items-center justify-between py-3 px-4 bg-white rounded-lg mb-6",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Price per credit"}),(0,a.jsxs)("span",{className:"font-semibold text-primary",children:["$",S,(0,a.jsxs)("span",{className:"ml-1 text-xs text-foreground/50",children:[1e3===F.value&&"(Best value!)",500===F.value&&"(Great value!)",200===F.value&&"(Good value!)"]})]})]}),(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("h4",{className:"text-sm font-semibold text-foreground mb-3",children:"Included Features:"}),(0,a.jsx)("ul",{className:"space-y-2",children:k.map(e=>(0,a.jsxs)("li",{className:"flex items-start gap-2 text-sm",children:[(0,a.jsx)(i.A,{className:"h-5 w-5 text-green-500 shrink-0 mt-0.5"}),(0,a.jsx)("span",{className:"text-foreground/80",children:e})]},e))})]}),(0,a.jsx)("button",{className:"w-full py-3 px-6 rounded-full font-medium transition-colors ".concat(F.free?"bg-accent text-white hover:bg-[#333333] transition-colors":"bg-primary text-white hover:bg-[#333333] transition-colors"," ").concat(t?"opacity-70 cursor-not-allowed":""),onClick:()=>{F.free?window.location.href="/dashboard/create":e?z(F.value,F.price):(v("signup"),h(!0))},disabled:t,children:t&&s===F.value?(0,a.jsxs)("span",{className:"flex items-center justify-center",children:[(0,a.jsx)(c.A,{className:"animate-spin -ml-1 mr-3 h-5 w-5"}),"Processing..."]}):F.free?"Try for Free":"Get ".concat(F.value," Credits for $").concat(F.price)})]},F.value)})]})})}),(0,a.jsx)(x.U,{isOpen:b,onClose:()=>h(!1),initialView:g})]})}}}]);

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.