1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a8489665-876c-4986-92d3-116685f11344",e._sentryDebugIdIdentifier="sentry-dbid-a8489665-876c-4986-92d3-116685f11344")}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6555],{58689:function(e,t,o){o.d(t,{Z:function(){return c}});var n=o(33527),r=o(83713),a=o(66040),c={fetchQuiz:async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=n.go?n.bV.LOCAL_QUIZ:n.bV.QUIZ(e);console.log("Fetching quiz data from: ".concat(c," (cached: ").concat(t,")"));let s={"Cache-Control":"no-cache",Pragma:"no-cache",...o};t&&(s={"Cache-Control":"max-age=3600",...o});try{let e=await fetch(c,{headers:s});if(!e.ok)throw await (0,r.zm)(e);return await e.json(),console.log("Quiz response received"),function(e){var t;let o;if(null===(t=e.data)||void 0===t?void 0:t.questions){if((o=e.data.questions)&&o.length>0&&"landing"===o[0].type){let t=o[0];e.data.landingText&&(t.description=e.data.landingText),e.data.title&&!t.title&&(t.title=e.data.title)}}else if(Array.isArray(e))o=e;else if(e.questions)o=e.questions;else if(e.data)o=Array.isArray(e.data)?e.data:[e.data];else throw Error("API response format is not as expected");return o}(a)}catch(e){if(e instanceof TypeError&&e.message.includes("network"))throw new r.F7("Unable to connect to the quiz API");throw e}},fetchGeolocation:async()=>{let e=n.bV.GEOLOCATION;console.log("Fetching geolocation data from: ".concat(e));try{let t=await fetch(e);if(!t.ok)throw await (0,r.zm)(t);let o=await t.json();return console.log("Geolocation data received"),o.data||o}catch(e){if((0,r.Tq)(e,"Geolocation API"),e instanceof TypeError&&e.message.includes("network"))throw new r.F7("Unable to connect to the geolocation API");return{country:"United States",iso_country:"US",city:"New York",state:"New York",iso_state:"NY",belongs_to_eu:!1}}},fetchLead:async e=>{if(!e)return console.log("No code provided, skipping user fetch"),null;if(32!==e.length)return console.warn("Invalid code format: ".concat(e,". Expected 32 characters.")),null;let t=n.bV.LEAD(e);console.log("Fetching user data from: ".concat(t));try{let e=await fetch(t);if(!e.ok)throw await (0,r.zm)(e);let o=await e.json();return console.log("User data received"),o.data||o}catch(e){if((0,r.Tq)(e,"User API"),e instanceof TypeError&&e.message.includes("network"))throw new r.F7("Unable to connect to the user API");throw e}},updateLead:async(e,t)=>{let o=n.bV.LEAD(e);console.log("Updating user data from: ".concat(o));try{let e=await fetch(o,{method:"PATCH",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}}),n=await e.json();return n.data||n}catch(e){if((0,r.Tq)(e,"User API"),e instanceof TypeError&&e.message.includes("network"))throw new r.F7("Unable to connect to the user API")}},fetchStaticContent:async e=>{let t=n.bV.STATIC_CONTENT(e);console.log("Fetching static content from: ".concat(t));try{let e=await fetch(t);if(!e.ok)throw await (0,r.zm)(e);let o=await e.json();return console.log("User data received"),o.data||o}catch(e){if((0,r.Tq)(e,"User API"),e instanceof TypeError&&e.message.includes("network"))throw new r.F7("Unable to connect to the user API");throw e}},fetchProducts:async()=>{let e=n.bV.PRODUCTS;console.log("Fetching products from: ".concat(e));try{let t=await fetch(e);if(!t.ok)throw await (0,r.zm)(t);let o=await t.json();return console.log("User data received"),o.data||o}catch(e){if((0,r.Tq)(e,"User API"),e instanceof TypeError&&e.message.includes("network"))throw new r.F7("Unable to connect to the user API");throw e}},fetchPaymentConfig:async e=>{let t=n.bV.PROJECT(e);console.log("fetchPaymentConfig!!!!!!",t),console.log("Fetching products from: ".concat(t));try{let e=await fetch(t);if(!e.ok)throw await (0,r.zm)(e);let o=await e.json();return console.log("User data received"),o.data||o}catch(e){if((0,r.Tq)(e,"User API"),e instanceof TypeError&&e.message.includes("network"))throw new r.F7("Unable to connect to the user API");throw e}}}},62285:function(e,t,o){o.r(t),o.d(t,{default:function(){return d}});var n=o(48860),r=o(67294),a=o(11163),c=o(7490),s=o(58689),i=o(33934),l=o(26218),u=()=>{let e=(0,a.useRouter)(),{setCode:t,setUser:o,setUserIp:n,setUserBoughtProducts:u}=(0,c.LM)(),[d,f]=(0,r.useState)(!1),[h,w]=(0,r.useState)(null),[g,y]=(0,r.useState)(null),[p,m]=(0,r.useState)(null),[E,b]=(0,r.useState)(null),T="string"==typeof e.query.code?e.query.code:null;(0,r.useEffect)(()=>{T&&32===T.length&&t(T)},[T,t]),(0,r.useEffect)(()=>{fetch("/api/ip").then(e=>e.json()).then(e=>{let{ip:t}=e;return m(t)}).catch(()=>m(null))},[]),(0,r.useEffect)(()=>{p&&n(p)},[p,n]);let{data:A,isLoading:v,error:I}=(0,i.a)({queryKey:["user",T],queryFn:async()=>T?await s.Z.fetchLead(T):null,staleTime:1/0,gcTime:1/0,refetchOnWindowFocus:!1,refetchOnMount:!1,retry:3,enabled:!!T&&32===T.length&&e.isReady}),{data:P,isLoading:k}=(0,i.a)({queryKey:["products"],queryFn:()=>(0,l.t2)(),enabled:!!E&&E.length>0});return(0,r.useEffect)(()=>
1{if(f(v),I?w(I instanceof Error?I.message:"Failed to fetch user data"):w(null),A){var e;y(A),o(A),(null==A?void 0:null===(e=A.client)||void 0===e?void 0:e.orders)&&b(A.client.orders)}},[A,v,I,o]),(0,r.useEffect)(()=>{!k&&P&&E&&u(P,E)},[P,k,E]),{isLoading:d,error:h,userData:g}},d=()=>{(0,n.Z)();let{code:e}=(0,c.LM)(),{userData:t,isLoading:o,error:r}=u();return null}},48860:function(e,t,o){var n=o(67294);t.Z=()=>{let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{t(!0)},[]),e}},83713:function(e,t,o){o.d(t,{F7:function(){return a},S3:function(){return c},Tq:function(){return i},zm:function(){return s}});class n extends Error{constructor(e,t,o){super(t),this.statusCode=e,this.data=o,this.name="ApiError",Object.setPrototypeOf(this,n.prototype)}}class r extends Error{constructor(e,t="Validation failed"){super(t),this.validationErrors=e,this.name="ValidationError",Object.setPrototypeOf(this,r.prototype)}}class a extends Error{constructor(e="Network error occurred"){super(e),this.name="NetworkError",Object.setPrototypeOf(this,a.prototype)}}function c(e){if(console.error("Error caught by error handler:",e),e instanceof n)return"API Error (".concat(e.statusCode,"): ").concat(e.message);if(e instanceof r){var t;return(null===(t=Object.values(e.validationErrors)[0])||void 0===t?void 0:t[0])||e.message}return e instanceof a?"Network Error: ".concat(e.message):e instanceof Error?e.message:"string"==typeof e?e:"An unknown error occurred"}async function s(e){let t;try{t=await e.json()}catch(e){t=null}return new n(e.status,(null==t?void 0:t.message)||e.statusText||"API error occurred",t)}function i(e,t){let o=c(e);return console.error("".concat(t?"[".concat(t,"] "):"","Error:"),e),o}},29204:function(e,t,o){o.d(t,{IZ:function(){return d}});let{Axios:n,AxiosError:r,CanceledError:a,isCancel:c,CancelToken:s,VERSION:i,all:l,Cancel:u,isAxiosError:d,spread:f,toFormData:h,AxiosHeaders:w,HttpStatusCode:g,formToJSON:y,getAdapter:p,mergeConfig:m,create:E}=o(29061).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.