PageSourceSearch

https://picenhancer.ai/_next/static/chunks/1kjr37x6tzpmd.js

js picenhancer.ai collected 2026-10-05 12:26:20 UTC 18,286 bytes, 4 lines download raw bytes

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]="d00e8af6-9558-8fcd-182f-6229b30966a5")}catch(e){}}();
2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,544992,e=>{"use strict";var t=e.i(668025),r=e.i(62870),n=e.i(542044);let o=(0,n.createContext)(null);function a(){return(0,n.useContext)(o)}let i=new Map;e.s(["CurrencyProvider",0,function({defaultCurrency:e,currencies:r,children:a}){let[i,s]=(0,n.useState)(e);return(0,t.jsx)(o.Provider,{value:{currency:i,defaultCurrency:e,currencies:r,setCurrency:s},children:a})},"CurrencySelector",0,function({label:e}){let n=a();return!n||n.currencies.length<2?null:(0,t.jsxs)(r.Select,{value:n.currency,onValueChange:n.setCurrency,children:[(0,t.jsx)(r.SelectTrigger,{className:"w-[120px]","aria-label":e,children:(0,t.jsx)(r.SelectValue,{})}),(0,t.jsx)(r.SelectContent,{children:n.currencies.map(e=>(0,t.jsxs)(r.SelectItem,{value:e,children:[e.toUpperCase()," ",function(e){let t=i.get(e);if(void 0!==t)return t;let r="";try{r=new Intl.NumberFormat("en",{style:"currency",currency:e.toUpperCase(),currencyDisplay:"narrowSymbol"}).formatToParts(0).find(e=>"currency"===e.type)?.value??""}catch{r=""}return i.set(e,r),r}(e)]},e))})]})},"useCurrency",0,a])},325585,e=>{"use strict";var t=e.i(668025),r=e.i(544992),n=e.i(647163);e.s(["default",0,function({displayPrice:e,originalPrice:o,priceSuffix:a,priceNote:i,currencyPrices:s}){let c=(0,r.useCurrency)(),u=c&&c.currency!==c.defaultCurrency?s?.[c.currency]:void 0,l=u?.displayPrice||e,d=u?u.originalPrice:o,p=u?u.priceNote:i;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,n.cn)("text-4xl",p?"mb-1":"mb-6"),children:[d?(0,t.jsx)("span",{className:"text-sm line-through decoration-2 text-muted-foreground mr-1",children:d}):null,l,a?(0,t.jsxs)("span",{className:"text-sm text-muted-foreground",children:["/",a]}):null]}),p?(0,t.jsx)("p",{className:"text-xs text-muted-foreground mb-6",children:p}):null]})}])},617888,e=>{"use strict";var t,r,n,o,a,i,s=e.i(668025),c=e.i(544992),u=e.i(167881),l=e.i(634689),d=e.i(843076),p=e.i(716714),f=e.i(189306),f=f,m=e.i(765532),y=e.i(764123),h=e.i(542044),v=e.i(516266);function g(e){return{clientId:"your_paypal_client_id",currency:"USD",components:"buttons",disableFunding:"card",...e}}g(),(t=o||(o={})).INITIAL="initial",t.PENDING="pending",t.REJECTED="rejected",t.RESOLVED="resolved",(r=a||(a={})).LOADING_STATUS="setLoadingStatus",r.RESET_OPTIONS="resetOptions",r.SET_BRAINTREE_INSTANCE="braintreeInstance",(n=i||(i={})).NUMBER="number",n.CVV="cvv",n.EXPIRATION_DATE="expirationDate",n.EXPIRATION_MONTH="expirationMonth",n.EXPIRATION_YEAR="expirationYear",n.POSTAL_CODE="postalCode";var b=function(){return(b=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 E(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 P(e,t,r){if(r||2==arguments.length)for(var n,o=0,a=t.length;o<a;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;var S="data-react-paypal-script-id",N="react-paypal-js",C="dataNamespace",w="dataSdkIntegrationSource",x="paypal";function I(e){return void 0===e&&(e=x),window[e]}function T(e){var t=e.reactComponentName,r=e.sdkComponentKey,n=e.sdkRequestedComponents,o=void 0===n?"":n,a=e.sdkDataNamespace,i=r.charAt(0).toUpperCase().concat(r.substring(1)),s="Unable to render <".concat(t," /> because window.").concat(void 0===a?x:a,".").concat(i," is undefined."),c="string"==typeof o?o:o.join(",");
2if(!c.includes(r)){var u=[c,r].filter(Boolean).join();s+="\nTo fix the issue, add '".concat(r,"' to the list of components passed to the parent PayPalScriptProvider:")+"\n`<PayPalScriptProvider options={{ components: '".concat(u,"'}}>`.")}return s}function j(e){e[S];var t=E(e,[S+""]);return"react-paypal-js-".concat(function(e){for(var t="",r=0;r<e.length;r++){var n=e[r].charCodeAt(0)*r;e[r+1]&&(n+=e[r+1].charCodeAt(0)*(r-1)),t+=String.fromCharCode(97+Math.abs(n)%26)}return t}(JSON.stringify(t)))}function O(e,t){var r,n,i,s;switch(t.type){case a.LOADING_STATUS:if("object"==typeof t.value)return b(b({},e),{loadingStatus:t.value.state,loadingStatusErrorMessage:t.value.message});return b(b({},e),{loadingStatus:t.value});case a.RESET_OPTIONS:return i=e.options[S],(null==(s=self.document.querySelector("script[".concat(S,'="').concat(i,'"]')))?void 0:s.parentNode)&&s.parentNode.removeChild(s),b(b({},e),{loadingStatus:o.PENDING,options:b(b(((r={})[w]=N,r),t.value),((n={})[S]="".concat(j(t.value)),n))});case a.SET_BRAINTREE_INSTANCE:return b(b({},e),{braintreePayPalCheckoutInstance:t.value});default:return e}}var k=(0,h.createContext)(null);function R(){var e=function(e){if("function"==typeof(null==e?void 0:e.dispatch)&&0!==e.dispatch.length)return e;throw Error("usePayPalScriptReducer must be used within a PayPalScriptProvider")}((0,h.useContext)(k));return[b(b({},e),{isInitial:e.loadingStatus===o.INITIAL,isPending:e.loadingStatus===o.PENDING,isResolved:e.loadingStatus===o.RESOLVED,isRejected:e.loadingStatus===o.REJECTED}),e.dispatch]}(0,h.createContext)({});var A=function(e){var t,r,n=e.className,o=e.disabled,a=void 0!==o&&o,i=e.children,s=e.forceReRender,c=E(e,["className","disabled","children","forceReRender"]),u="".concat(void 0===n?"":n," ").concat(a?"paypal-buttons-disabled":"").trim(),l=(0,h.useRef)(null),d=(0,h.useRef)(null),p=((t=(0,h.useRef)(new Proxy({},{get:function(e,t,r){return"function"==typeof e[t]?function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return e[t].apply(e,r)}:Reflect.get(e,t,r)}}))).current=Object.assign(t.current,c),t.current),f=R()[0],m=f.isResolved,y=f.options,v=(0,h.useState)(null),g=v[0],S=v[1],N=(0,h.useState)(!0),w=N[0],x=N[1],j=(0,h.useState)(null)[1];function O(){null!==d.current&&d.current.close().catch(function(){})}return(null==(r=d.current)?void 0:r.updateProps)&&d.current.updateProps({message:c.message}),(0,h.useEffect)(function(){if(!1===m)return O;var e=I(y.dataNamespace);if(void 0===e||void 0===e.Buttons)return j(function(){throw Error(T({reactComponentName:A.displayName,sdkComponentKey:"buttons",sdkRequestedComponents:y.components,sdkDataNamespace:y[C]}))}),O;try{d.current=e.Buttons(b(b({},p),{onInit:function(e,t){S(t),"function"==typeof c.onInit&&c.onInit(e,t)}}))}catch(e){return j(function(){throw Error("Failed to render <PayPalButtons /> component. Failed to initialize:  ".concat(e))})}return!1===d.current.isEligible()?x(!1):l.current&&d.current.render(l.current).catch(function(e){null!==l.current&&0!==l.current.children.length&&j(function(){throw Error("Failed to render <PayPalButtons /> component. ".concat(e))})}),O},P(P([m],void 0===s?[]:s,!0),[c.fundingSource],!1)),(0,h.useEffect)(function(){null!==g&&(!0===a?g.disable().catch(function(){}):g.enable().catch(function(){}))},[a,g]),h.default.createElement(h.default.Fragment,null,w?h.default.createElement("div",{ref:l,style:a?{opacity:.38}:{},className:u}):i)};function D(e,t){void 0===t&&(t={});var r=document.createElement("script");return r.src=e,Object.keys(t).forEach(function(e){r.setAttribute(e,t[e]),"data-csp-nonce"===e&&r.setAttribute("nonce",t["data-csp-nonce"])}),r}A.displayName="PayPalButtons","function"==typeof SuppressedError&&SuppressedError;function L(e,t){if("object"!=typeof e||null===e)throw Error("Expected an options object.");var r=e.environment;if(r&&"production"!==r&&"sandbox"!==r)throw Error('The `environment` option must be either "production" or "sandbox".');if(void 0!==t&&"function"!=typeof t)throw Error("Expected PromisePonyfill to be a function.")}var _=function(e){var t=e.className,r=e.children,n=E(e,["className","children"]),o=R()[0],a=o.isResolved,i=o.options,s=(0,h.useRef)(null),c=(0,h.useState)(!0),u=c[0],l=c[1],d=(0,h.useState)(null)[1],p=function(e){var t=s.current;if(!t||!e.isEligible())return l(!1);t.firstChild&&t.removeChild(t.firstChild),e.render(t).catch(function(e){null!==t&&0!==t.children.length&&d(function(){throw Error("Failed to render <PayPalMarks /> component. ".concat(e))})})};return(0,h.useEffect)(function(){if(!1!==a){var e=I(i[C]);if(void 0===e||void 0===e.Marks)return d(function(){throw Error(T({reactComponentName:_.displayName,sdkComponentKey:"marks",sdkRequestedComponents:i.components,sdkDataNamespace:i[C]}))});p(e.Marks(b({},n)))}},[a,n.fundingSource]),h.default.createElement(h.default.Fragment,null,u?h.default.createElement("div",{ref:s,className:void 0===t?"":t}):r)};_.displayName="PayPalMarks";var F=function(e){var t=e.className,r=e.forceReRender,n=E(e,["className","forceReRender"]),o=R()[0],a=o.isResolved,i=o.options,s=(0,h.useRef)(null),c=(0,h.useRef)(null),u=(0,h.useState)(null)[1];return(0,h.useEffect)(function(){if(!1!==a){var e=I(i[C]);if(void 0===e||void 0===e.Messages)return u(function(){throw Error(T({reactComponentName:F.displayName,sdkComponentKey:"messages",sdkRequestedComponents:i.components,sdkDataNamespace:i[C]}))});c.current=e.Messages(b({},n)),c.current.render(s.current).catch(function(e){null!==s.current&&0!==s.current.children.length&&u(function(){throw Error("Failed to render <PayPalMessages /> component. ".concat(e))})})}},P([a],void 0===r?[]:r,!0)),h.default.createElement("div",{ref:s,className:void 0===t?"":t})};F.displayName="PayPalMessages";var U=function(e){var t,r=e.options,n=void 0===r?{clientId:"test"}:r,i=e.children,s=e.deferLoading,c=void 0!==s&&s,u=(0,h.useReducer)(O,{options:b(b({},n),((t={}).dataJsSdkLibrary=N,t[w]=N,t[S]="".concat(j(n)),t)),loadingStatus:c?o.INITIAL:o.PEND
2ING}),l=u[0],d=u[1];return(0,h.useEffect)(function(){if(!1===c&&l.loadingStatus===o.INITIAL)return d({type:a.LOADING_STATUS,value:o.PENDING});if(l.loadingStatus===o.PENDING){var e=!0;return(function(e,t){if(void 0===t&&(t=Promise),L(e,t),"u"<typeof document)return t.resolve(null);var r,n,o,a,i,s,c,u,l,d,p=(a=e.sdkBaseUrl,i=e.environment,s=function(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}(e,["sdkBaseUrl","environment"]),c=a||("sandbox"===i?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js"),l=(u=Object.keys(s).filter(function(e){return void 0!==s[e]&&null!==s[e]&&""!==s[e]}).reduce(function(e,t){var r=s[t].toString();return"data"===(t=t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,function(e,t){return(t?"-":"")+e.toLowerCase()})).substring(0,4)||"crossorigin"===t?e.attributes[t]=r:e.queryParams[t]=r,e},{queryParams:{},attributes:{}})).queryParams,d=u.attributes,l["merchant-id"]&&-1!==l["merchant-id"].indexOf(",")&&(d["data-merchant-id"]=l["merchant-id"],l["merchant-id"]="*"),{url:"".concat(c,"?").concat((n="",Object.keys(r=l).forEach(function(e){0!==n.length&&(n+="&"),n+=e+"="+r[e]}),n)),attributes:d}),f=p.url,m=p.attributes,y=m["data-namespace"]||"paypal",h=(o=y,window[o]);return(m["data-js-sdk-library"]||(m["data-js-sdk-library"]="paypal-js"),function(e,t){var r=document.querySelector('script[src="'.concat(e,'"]'));if(null===r)return null;var n=D(e,t),o=r.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(n.dataset).length)return null;var a=!0;return Object.keys(o.dataset).forEach(function(e){o.dataset[e]!==n.dataset[e]&&(a=!1)}),a?r:null}(f,m)&&h)?t.resolve(h):(function(e,t){void 0===t&&(t=Promise),L(e,t);var r=e.url,n=e.attributes;if("string"!=typeof r||0===r.length)throw Error("Invalid url.");if(void 0!==n&&"object"!=typeof n)throw Error("Expected attributes to be an object.");return new t(function(e,t){var o,a,i,s,c,u;if("u"<typeof document)return e();a=(o={url:r,attributes:n,onSuccess:function(){return e()},onError:function(){return t(Error('The script "'.concat(r,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.')))}}).url,i=o.attributes,s=o.onSuccess,c=o.onError,(u=D(a,i)).onerror=c,u.onload=s,document.head.insertBefore(u,document.head.firstElementChild)})})({url:f,attributes:m},t).then(function(){var e,t=(e=y,window[e]);if(t)return t;throw Error("The window.".concat(y," global variable is not available."))})})(l.options).then(function(){e&&d({type:a.LOADING_STATUS,value:o.RESOLVED})}).catch(function(t){console.error("".concat("Failed to load the PayPal JS SDK script."," ").concat(t)),e&&d({type:a.LOADING_STATUS,value:{state:o.REJECTED,message:String(t)}})}),function(){e=!1}}},[l.options,c,l.loadingStatus]),h.default.createElement(k.Provider,{value:b(b({},l),{dispatch:d})},i)};function B(){}(0,h.createContext)({cardFieldsForm:null,fields:{},registerField:B,unregisterField:B});function M({plan:e,onSuccess:t}){let r=(0,l.useRouter)(),n=g({currency:e.currency||"USD",intent:"capture"});async function o(){try{let t=await fetch("/api/paypal/create-order",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({planId:e.id})}),n=await t.json();if(!t.ok||!n.success){if(401===t.status)throw r.push("/login"),v.toast.error("You must be logged in to purchase a plan."),Error(n.error||"Unauthorized");throw Error(n.error||"Failed to create PayPal order")}return n.data.orderId}catch(t){console.error("[PayPal] Create order error:",t);let e=t instanceof Error?t.message:"Failed to create order";throw v.toast.error(e),t}}async function a(e){try{let n=await fetch("/api/paypal/capture-order",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({orderId:e.orderID})}),o=await n.json();if(!n.ok||!o.success){if(401===n.status)throw r.push("/login"),v.toast.error("You must be logged in to purchase a plan."),Error(o.error||"Unauthorized");throw Error(o.error||"Failed to capture payment")}if(o.data?.pending){v.toast.info(o.data.message||"Your payment is being processed. Please check back in a moment.",{duration:5e3}),t?.(o.data);return}t?.(o.data)}catch(t){console.error("[PayPal] Capture error:",t);let e=t instanceof Error?t.message:"Payment failed";throw v.toast.error(e),t}}return(0,s.jsx)(U,{options:n,children:(0,s.jsx)(A,{style:{layout:"vertical",label:"pay"},createOrder:o,onApprove:a,onError:function(e){console.error("[PayPal] Button error:",e)},onCancel:function(){}})})}e.s(["default",0,function({plan:e,localizedPlan:t,currencyPrices:r}){let[n,o]=(0,h.useState)(!1),a=(0,l.useRouter)(),i=(0,m.useLocale)(),g=(0,c.useCurrency)(),b=e.provider,E="creem"===b,P="stripe"===b,S="paypal"===b,N=async(t=!0)=>{let n=e.stripePriceId??null;if(P&&!n)return void v.toast.error("Stripe price ID is missing for this plan.");let s=e.creemProductId??null;if(E&&!s)return void v.toast.error("Creem product ID is missing for this plan.");if(S&&"one_time"===e.paymentType)return void v.toast.error("PayPal one-time payments should use PayPalCheckoutButton.");if(S&&"recurring"===e.paymentType&&!e.paypalPlanId)return void v.toast.error("PayPal Plan ID is missing for this subscription plan.");if(S&&!e.paymentType)return void v.toast.error("This plan is not configured for PayPal payments.");o(!0);try{let c={provider:b||"stripe"};P&&(c.stripePriceId=n,c.couponCode=t&&e.stripeCouponId?e.stripeCouponId:void 0,c.referral=window.tolt_referral??void 0,g&&g.currency!==g.defaultCurrency&&r?.[g.currency]&&(c.currency=g.currency)),E&&(c.creemProductId=s,c.couponCode=t&&e.creemDiscountCode?e.creemDiscountCode:void 0),S&&(c.planId=e.id);let u=await fetch("/api/payment/checkout-session",{method:"POST",headers:{"Content-Type":"application/json","Accept-Language":i||d.DEFAULT_LOCALE},body:JSON.stringify(c)}),l=await u.json();if(!u.ok){if(401===u.status){a.push("/login"),v.toast.error("You must be logged in to purchase a plan.");return}throw Error(l.error||"HTTP error! status: "+u.status)}if(!l.success)throw Error(l.error||"Failed to create checkout session.");let p=l.data;if(p.url)a.push(p.url),o(!1);else throw Error("Checkout URL not received.")}catch(e){console.error("Checkout Error:",e),v.toast.error(e instanceof Error?e.message:"An unexpected error occurred."),o(!1)}},C=null;E?C=e.creemDiscountCode:P&&(C=e.stripeCouponId);let w=!!C&&e.enableManualInputCoupon;return S&&"one_time"===e.paymentType?(0,s.jsx)("div",{className:"mb-6",children:(0,s.jsx)(M,{plan:e,onSuccess:e=>{let t=new URLSearchParams;t.set("provider","paypal"),t.set("order_id",e.orderId),e.pending&&t.set("pending","true"),a.push(`/payment/success?${t.toString()}`)}})}):S&&!e.paymentType?(0,s.jsx)(u.Button,{disabled:!0,className:"w-full py-5 mb-6",children:"Not Available"}):(0,s.jsxs)("div",{children:[(0,s.jsx)(u.Button,{asChild:!!e.buttonLink,disabled:n,className:`w-full flex items-center justify-center gap-2 py-5 font-medium ${e.
2isHighlighted?"":"bg-gray-900 text-white dark:bg-white dark:text-gray-900 hover:bg-gray-800 dark:hover:bg-gray-100"} ${w?"mb-2":"mb-6"}`,...!e.buttonLink&&{onClick:()=>N()},children:e.buttonLink?(0,s.jsxs)(y.default,{href:e.buttonLink,title:t.buttonText||e.buttonText,rel:"noopener noreferrer nofollow",target:"_blank",prefetch:!1,children:[t.buttonText||e.buttonText,e.isHighlighted&&(0,s.jsx)(f.default,{className:"w-5 h-5"})]}):(0,s.jsxs)(s.Fragment,{children:[n?(0,s.jsx)(p.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):t.buttonText||e.buttonText,e.isHighlighted&&!n&&(0,s.jsx)(f.default,{className:"w-5 h-5 ml-2"})]})}),w&&(0,s.jsx)("div",{className:"text-center mb-2",children:(0,s.jsx)("button",{onClick:()=>N(!1),disabled:n,className:"text-sm text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50 underline underline-offset-2",children:"I have a different coupon code"})})]})}],617888)}]);
3
4//# debugId=d00e8af6-9558-8fcd-182f-6229b30966a5

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.