PageSourceSearch

https://www.buyforbaby.ca/_next/static/chunks/78561-513169b594828141.js

js buyforbaby.ca collected 2026-09-24 14:36:58 UTC 12,784 bytes, 1 lines download raw bytes

1!function(){try{var 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]="c166c64a-22f4-48f9-b71b-aa1a48e271be",e._sentryDebugIdIdentifier="sentry-dbid-c166c64a-22f4-48f9-b71b-aa1a48e271be")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[78561],{32867:(e,t,r)=>{r.d(t,{D:()=>c,N:()=>i});var o=r(95155),a=r(12115),n=r(8525),l=r(78479);let s=(0,a.createContext)(void 0),u={id:"default",name:"Default",colors:{background:"0 0% 100%",foreground:"222.2 84% 4.9%",card:"0 0% 100%",card_foreground:"222.2 84% 4.9%",popover:"0 0% 100%",popover_foreground:"222.2 84% 4.9%",primary:"322 39% 28%",primary_foreground:"210 40% 98%",secondary:"210 40% 96%",secondary_foreground:"222.2 84% 4.9%",muted:"210 40% 96%",muted_foreground:"215.4 16.3% 46.9%",accent:"210 40% 96%",accent_foreground:"222.2 84% 4.9%",destructive:"0 84.2% 60.2%",destructive_foreground:"210 40% 98%",border:"214.3 31.8% 91.4%",input:"214.3 31.8% 91.4%",ring:"222.2 84% 4.9%"},radius:"0.5rem",is_active:!0};function i(e){let{children:t}=e,[r,i]=(0,a.useState)(u),[c,d]=(0,a.useState)([]),[f,g]=(0,a.useState)(!0),{enableDynamicTheming:y}=(0,l.E)(),m=(0,n.U)(),h=e=>{if(!y)return;let t=document.documentElement;Object.entries(e.colors).forEach(e=>{let[r,o]=e,a="--".concat(r.replace("_","-"));t.style.setProperty(a,o)}),t.style.setProperty("--radius",e.radius)},C=async()=>{if(y)try{let{data:e,error:t}=await m.from("themes").select("*").order("created_at",{ascending:!1});if(t)throw t;if(e&&e.length>0){d(e);let t=e.find(e=>e.is_active)||e[0];i(t),h(t)}}catch(e){console.error("Error fetching themes:",e)}},b=async e=>{try{let{error:t}=await m.from("themes").upsert({id:"default"===e.id?void 0:e.id,name:e.name,colors:e.colors,radius:e.radius,is_active:e.is_active,updated_at:new Date().toISOString()});if(t)throw t;await C()}catch(e){throw console.error("Error saving theme:",e),e}},p=async(e,t)=>{try{let{error:r}=await m.from("themes").insert({name:e,colors:t.colors,radius:t.radius,is_active:!1});if(r)throw r;await C()}catch(e){throw console.error("Error creating theme:",e),e}};return(0,a.useEffect)(()=>{y&&C()},[y]),(0,a.useEffect)(()=>{y&&r&&h(r)},[r,y]),(0,o.jsx)(s.Provider,{value:{currentTheme:r,setTheme:i,availableThemes:c,useGradients:f,toggleGradients:e=>{g(t=>"boolean"==typeof e?e:!t)},refreshThemes:C,applyTheme:h,saveTheme:b,createNewTheme:p},children:t})}function c(){let e=(0,a.useContext)(s);if(void 0===e)throw Error("useTheme must be used within a ThemeProvider");return e}},69007:(e,t,r)=>{r.d(t,{J_:()=>u,Nl:()=>l,PA:()=>i,cd:()=>o,v2:()=>s});let o={IN:{code:"IN",name:"India",currency:"INR",defaultLocale:"en-IN"},US:{code:"US",name:"United States",currency:"USD",defaultLocale:"en-US"},CA:{code:"CA",name:"Canada",currency:"CAD",defaultLocale:"en-CA"},UK:{code:"UK",name:"United Kingdom",currency:"GBP",defaultLocale:"en-GB"}};async function a(e){try{var t;if("unknown"===e||e.startsWith("127.")||e.startsWith("192.168.")||e.startsWith("10."))return null;let r=new AbortController,o=setTimeout(()=>r.abort(),3e3),a=await fetch("https://ipapi.co/".concat(e,"/json/"),{signal:r.signal,headers:{"User-Agent":"BuyForBaby/1.0"}});if(clearTimeout(o),!a.ok)throw Error("Geolocation service unavailable");switch(null==(t=(await a.json()).country_code)?void 0:t.toUpperCase()){case"IN":return"IN";case"US":return"US";case"CA":return"CA";case"GB":case"UK":return"UK";default:return null}}catch(e){return console.warn("IP geolocation failed:",e),null}}async function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{ip:t,acceptLanguage:r,timezone:n,fallback:l="US"}=e;for(let e of[()=>n?n.startsWith("Asia/Kolkata")||n.startsWith("Asia/Calcutta")?"IN":n.startsWith("America/Ne
1w_York")||n.startsWith("America/Chicago")||n.startsWith("America/Denver")||n.startsWith("America/Los_Angeles")?"US":n.startsWith("America/Toronto")||n.startsWith("America/Vancouver")||n.startsWith("America/Montreal")?"CA":n.startsWith("Europe/London")?"UK":null:null,()=>(function(e){if(!e)return null;let t=e.split(",").map(e=>{let[t,r]=e.trim().split(";q=");return{code:t.toLowerCase(),quality:r?parseFloat(r):1}}).sort((e,t)=>t.quality-e.quality);for(let e of t){let[t,r]=e.code.split("-");if(r)switch(r.toLowerCase()){case"in":return"IN";case"us":return"US";case"ca":return"CA";case"gb":case"uk":return"UK"}}for(let e of t){let[t]=e.code.split("-");switch(t){case"hi":case"bn":case"te":case"mr":case"ta":case"gu":case"kn":case"ml":case"or":case"pa":return"IN";case"fr":return"CA"}}return null})(r),()=>t?a(t):Promise.resolve(null)])try{let t=await e();if(t&&t in o)return t}catch(e){console.warn("Country detection method failed:",e);continue}return l}async function l(){let e=Intl.DateTimeFormat().resolvedOptions().timeZone;return n({acceptLanguage:navigator.language,timezone:e,fallback:"CA"})}function s(e){return o[e]}function u(e){return e in o}function i(e){return({"United States":"US",Canada:"CA",India:"IN",IN:"IN",US:"US",CA:"CA",UK:"UK","United Kingdom":"UK"})[e]||"US"}},78479:(e,t,r)=>{r.d(t,{E:()=>y,i:()=>g});var o=r(95155),a=r(12115),n=r(8525),l=r(58219),s=r(81712);let u={usePhotoCollage:!1,useCompactMobileCards:!1,useThankYouNotes:!1,useBuyForBabyEvents:!1,enableDynamicTheming:!1},i={usePhotoCollage:"photo-collage-enabled",useCompactMobileCards:"compact-mobile-cards-enabled",useThankYouNotes:"thank-you-notes-enabled",useBuyForBabyEvents:"buyfor-baby-events-enabled",enableDynamicTheming:"dynamic-theming-enabled"},c="feature_toggles",d="feature-toggles-cache-v1",f=(0,a.createContext)(void 0);function g(e){let{children:t}=e,[r,g]=(0,a.useState)(!1),[y,m]=(0,a.useState)(u),h=(0,a.useRef)(y),C=(0,a.useMemo)(()=>(0,n.U)(),[]),{resolveFlag:b}=(0,s.p)(),p=(0,a.useMemo)(()=>{let e={...y};for(let t of Object.keys(e))e[t]=b(t,y[t]);return e},[y,b]);(0,a.useEffect)(()=>{h.current=y},[y]);let v=(0,a.useCallback)(e=>{localStorage.setItem("photo-collage-enabled",e.usePhotoCollage.toString()),localStorage.setItem("usePhotoCollage",e.usePhotoCollage.toString()),localStorage.setItem("compact-mobile-cards-enabled",e.useCompactMobileCards.toString()),localStorage.setItem("useCompactMobileCards",e.useCompactMobileCards.toString()),localStorage.setItem("thank-you-notes-enabled",e.useThankYouNotes.toString()),localStorage.setItem("buyfor-baby-events-enabled",e.useBuyForBabyEvents.toString()),localStorage.setItem("dynamic-theming-enabled",e.enableDynamicTheming.toString())},[]),w=(0,a.useCallback)((e,t)=>{h.current=e,m(e),(0,l.zi)(d,e,t),v(e)},[v]),S=(0,a.useCallback)(async()=>{try{let{data:t,error:r}=await C.from("system_settings").select("value, updated_at").eq("setting_key",c).maybeSingle();if(r)throw r;if(null==t?void 0:t.value){var e;let r=(0,l.YB)(u,t.value);w(r,null!=(e=t.updated_at)?e:null)}}catch(e){console.error("Failed to load feature toggles:",e)}},[w,C]),I=(0,a.useCallback)(async e=>{try{let{error:t}=await C.from("system_settings").upsert({setting_key:c,value:e,updated_at:new Date().toISOString()});if(t)throw t;return!0}catch(e){return console.error("Failed to persist feature toggles:",e),!1}},[C]),U=(0,a.useCallback)(async(e,t)=>{let r={...h.current,[e]:t};w(r,new Date().toISOString()),await I(r)||await S()},[w,S,I]);return(0,a.useEffect)(()=>{let e=(0,l.y$)(d,u);if(e){var t;w(e.flags,null!=(t=e.updatedAt)?t:null)}else{let e=(0,l.Ji)(i,u),t=e.flags,r=e.migrated;if(!r){let e=localStorage.getItem("usePhotoCollage");("true"===e||"false"===e)&&(t={...t,usePhotoCollage:"true"===e},r=!0);let o=localStorage.getItem("useCompactMobileCards");("true"===o||"false"===o)&&(t={...t,useCompactMobileCards:"true"===o},r=!0)}r&&w(t,null)}S()},[w,S]),(0,a.useEffect)(()=>{let e="feature_toggles_settings-".concat(Math.random().toString(36).slice(2),"-").concat(Date.now()),t=C.channel(e).on("postgres_changes",{event:"*",schema:"public",table:"system_settings",filter:"setting_key=eq.".concat(c)},e=>{var t,r;w((0,l.YB)(u,null==(t=e.new)?void 0:t.value),"string"==typeof(null==(r=e.new)?void 0:r.updated_at)?e.new.updated_at:null)}).subscribe();return()=>{C.removeChannel(t)}},[w,C]),(0,a.useEffect)(()=>{let e=setInterval(()=>{S()},6e4);return()=>clearInterval(e)},[S]),(0,a.useEffect)(()=>{let e=e=>{if(e.key===d&&e.newValue)try{var t;let r=JSON.parse(e.newValue);if(!(null==r?void 0:r.flags))return;let o=(0,l.YB)(u,r.flags);w(o,null!=(t=r.updatedAt)?t:null)}catch(e){console.error("Failed to sync feature toggles from storage:",e)}};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[w]),(0,o.jsx)(f.Provider,{value:{usePhotoCollage:p.usePhotoCollage,setUsePhotoCollage:e=>{U("usePhotoCollage",e)},togglePhotoCollage:e=>{let t=h.current.usePhotoCollage;U("usePhotoCollage",null!=e?e:!t)},useModernLook:r,setUseModernLook:e=>{g(e)},toggleModernLook:e=>{g("boolean"==typeof e?e:!r)},useCompactMobileCards:p.useCompactMobileCards,setUseCompactMobileCards:e=>{U("useCompactMobileCards",e)},toggleCompactMobileCards:e=>{let t=h.current.useCompactMobileCards;U("useCompactMobileCards",null!=e?e:!t)},useThankYouNotes:p.useThankYouNotes,setUseThankYouNotes:e=>{U("useThankYouNotes",e)},toggleThankYouNotes:e=>{let t=h.current.useThankYouNotes;U("useThankYouNotes",null!=e?e:!t)},useBuyForBabyEvents:p.useBuyForBabyEvents,setUseBuyForBabyEvents:e=>{U("useBuyForBabyEvents",e)},toggleBuyForBabyEvents:e=>{let t=h.current.useBuyForBabyEvents;U("useBuyForBabyEvents",null!=e?e:!t)},enableDynamicTheming:p.enableDynamicTheming,setEnableDynamicTheming:e=>{U("enableDynamicTheming",e)},toggleDynamicTheming:e=>{let t=h.current.enableDynamicTheming;U("enableDynamicTheming",null!=e?e:!t)}},children:t})}function y(){let e=(0,a.useContext)(f);if(void 0===e)throw Error("useFeatureToggle must be used within a FeatureToggleProvider");return e}},96834:(e,t,r)=>{r.d(t,{S:()=>d,y:()=>c});var o=r(95155),a=r(12115),n=r(69007),l=r(8525),s=r(32734);let u=(0,a.createContext)(void 0),i="bfb_selected_country";function c(e){let{children:t}=e,[r,c]=(0,a.useState)(null),[d,f]=(0,a.useState)(!0),{user:g}=(0,s.A)(),y=(0,l.U)();(0,a.useEffect)(()=>{(async()=>{f(!0);try{var e,t;let r="CA",o=localStorage.getItem(i);if(o&&["US","CA","IN","UK"].includes(o))r=o;else if(g){let{data:t}=await y.from("user_profiles").select("user_country").eq("user_id",g.id).single();if(null==t?void 0:t.user_country)r=t.user_country,localStorage.setItem(i,r);
1else{let t=null==(e=document.cookie.split("; ").find(e=>e.startsWith("effective_country=")))?void 0:e.split("=")[1];t&&["US","CA","IN","UK"].includes(t)?r=t:o||(r=await (0,n.Nl)()),await m(r)}}else if(!o){let e=null==(t=document.cookie.split("; ").find(e=>e.startsWith("effective_country=")))?void 0:t.split("=")[1];r=e&&["US","CA","IN","UK"].includes(e)?e:await (0,n.Nl)(),localStorage.setItem(i,r)}c(r)}catch(e){console.error("Country detection failed:",e),c("IN")}finally{f(!1)}})()},[g,y]);let m=async e=>{if(g)try{await y.from("user_profiles").upsert({user_id:g.id,user_country:e,updated_at:new Date().toISOString()},{onConflict:"user_id"})}catch(e){console.error("Failed to update user profile country:",e)}},h=async e=>{if(g)try{if(!(await fetch("/api/v1/auth/update-country",{method:"POST",headers:{"Content-Type":"application/json","X-API-Version":"v1"},body:JSON.stringify({country:e})})).ok)throw Error("Failed to update country preference")}catch(e){throw console.error("Error updating country via API:",e),e}},C=async e=>{if(c(e),localStorage.setItem(i,e),g)try{await h(e),await m(e)}catch(e){console.error("Failed to update user country preference:",e)}};return(0,o.jsx)(u.Provider,{value:{selectedCountry:r,setSelectedCountry:C,isLoading:d,updateUserCountry:h},children:t})}function d(){let e=(0,a.useContext)(u);if(void 0===e)throw Error("useCountry must be used within a CountryProvider");return e}},99190:(e,t,r)=>{r.d(t,{JC:()=>n,Qn:()=>a,rp:()=>l,up:()=>s});let o={IN:"INR",IND:"INR",INDIA:"INR",CA:"CAD",CAN:"CAD",CANADA:"CAD",US:"USD",USA:"USD",UK:"GBP",GB:"GBP",GBR:"GBP"},a=e=>{var t;return({INR:"₹",USD:"$",CAD:"$",EUR:"€",GBP:"\xa3",JPY:"\xa5"})[(null==e||null==(t=e.toUpperCase)?void 0:t.call(e))||""]||(e?e+" ":"")};function n(e){if(e)return o[e.trim().toUpperCase()]}function l(e,t){var r;let o=n(e.country);if(o)return o;let a=null==(r=e.currency)?void 0:r.trim();return a?a.toUpperCase():n(t)||"CAD"}function s(e,t){let r=(t||"CAD").toUpperCase();try{var o;return new Intl.NumberFormat({INR:"en-IN",USD:"en-US",CAD:"en-CA",EUR:"en-IE",GBP:"en-GB",JPY:"ja-JP"}[null==r||null==(o=r.toUpperCase)?void 0:o.call(r)]||"en-US",{style:"currency",currency:r}).format(Number.isFinite(e)?e:0)}catch(t){return"".concat(a(r)).concat((Number.isFinite(e)?e:0).toFixed(2))}}}}]);

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.