@tagadapay/plugin-sdk 3.1.22 → 3.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-cdn.js +274 -6
- package/dist/external-tracker.js +476 -6774
- package/dist/external-tracker.min.js +2 -25
- package/dist/external-tracker.min.js.map +4 -4
- package/dist/react/config/payment.d.ts +14 -4
- package/dist/react/config/payment.js +47 -9
- package/dist/react/hooks/useCheckout.d.ts +3 -0
- package/dist/react/hooks/useCheckout.js +11 -3
- package/dist/react/hooks/usePluginConfig.js +9 -10
- package/dist/react/providers/TagadaProvider.js +1 -1
- package/dist/tagada-react-sdk-minimal.min.js +36 -0
- package/dist/tagada-react-sdk-minimal.min.js.map +7 -0
- package/dist/tagada-react-sdk.js +37988 -0
- package/dist/tagada-react-sdk.min.js +78 -0
- package/dist/tagada-react-sdk.min.js.map +7 -0
- package/dist/tagada-sdk.js +7847 -6420
- package/dist/tagada-sdk.min.js +4 -22
- package/dist/tagada-sdk.min.js.map +4 -4
- package/dist/v2/cdn-react-minimal.d.ts +23 -0
- package/dist/v2/cdn-react-minimal.js +26 -0
- package/dist/v2/core/client.js +2 -1
- package/dist/v2/core/config/environment.js +2 -1
- package/dist/v2/core/funnelClient.d.ts +106 -10
- package/dist/v2/core/funnelClient.js +122 -28
- package/dist/v2/core/index.d.ts +0 -1
- package/dist/v2/core/index.js +0 -2
- package/dist/v2/core/isoData.d.ts +4 -4
- package/dist/v2/core/isoData.js +7 -7
- package/dist/v2/core/pixelMapping.js +64 -26
- package/dist/v2/core/resources/apiClient.d.ts +18 -14
- package/dist/v2/core/resources/apiClient.js +151 -109
- package/dist/v2/core/resources/checkout.d.ts +10 -0
- package/dist/v2/core/resources/checkout.js +6 -0
- package/dist/v2/core/resources/expressPaymentMethods.d.ts +1 -0
- package/dist/v2/core/resources/index.d.ts +1 -1
- package/dist/v2/core/resources/index.js +1 -1
- package/dist/v2/core/resources/offers.js +4 -4
- package/dist/v2/core/resources/payments.d.ts +8 -2
- package/dist/v2/core/resources/payments.js +1 -0
- package/dist/v2/core/resources/postPurchases.d.ts +17 -0
- package/dist/v2/core/resources/postPurchases.js +20 -0
- package/dist/v2/core/utils/currency.d.ts +3 -0
- package/dist/v2/core/utils/currency.js +40 -2
- package/dist/v2/core/utils/deviceInfo.d.ts +1 -10
- package/dist/v2/core/utils/deviceInfo.js +153 -76
- package/dist/v2/core/utils/order.d.ts +2 -0
- package/dist/v2/core/utils/pluginConfig.js +18 -22
- package/dist/v2/core/utils/previewMode.js +12 -0
- package/dist/v2/index.d.ts +4 -3
- package/dist/v2/index.js +4 -2
- package/dist/v2/react/components/ApplePayButton.js +39 -16
- package/dist/v2/react/components/FunnelScriptInjector.js +145 -77
- package/dist/v2/react/components/StripeExpressButton.d.ts +13 -0
- package/dist/v2/react/components/StripeExpressButton.js +170 -0
- package/dist/v2/react/components/WhopCheckout.js +7 -1
- package/dist/v2/react/hooks/payment-actions/useAirwallexRadarAction.js +1 -0
- package/dist/v2/react/hooks/payment-actions/useProcessorAuthAction.js +21 -3
- package/dist/v2/react/hooks/useApiQuery.d.ts +1 -1
- package/dist/v2/react/hooks/useApiQuery.js +1 -1
- package/dist/v2/react/hooks/useApplePayCheckout.js +8 -8
- package/dist/v2/react/hooks/useCheckoutQuery.d.ts +10 -0
- package/dist/v2/react/hooks/useCheckoutQuery.js +27 -15
- package/dist/v2/react/hooks/useFunnel.d.ts +15 -4
- package/dist/v2/react/hooks/useFunnel.js +8 -4
- package/dist/v2/react/hooks/useGoogleAutocomplete.d.ts +2 -0
- package/dist/v2/react/hooks/useGoogleAutocomplete.js +29 -15
- package/dist/v2/react/hooks/useISOData.d.ts +2 -5
- package/dist/v2/react/hooks/useISOData.js +25 -26
- package/dist/v2/react/hooks/usePaymentPolling.d.ts +2 -2
- package/dist/v2/react/hooks/usePixelTracking.js +151 -70
- package/dist/v2/react/hooks/usePostPurchasesQuery.js +34 -2
- package/dist/v2/react/hooks/usePreviewOffer.js +1 -1
- package/dist/v2/react/hooks/useRemappableParams.d.ts +2 -6
- package/dist/v2/react/hooks/useRemappableParams.js +23 -23
- package/dist/v2/react/hooks/useSetPaymentMethod.d.ts +16 -0
- package/dist/v2/react/hooks/useSetPaymentMethod.js +33 -0
- package/dist/v2/react/hooks/useStepConfig.d.ts +23 -6
- package/dist/v2/react/hooks/useStepConfig.js +14 -7
- package/dist/v2/react/hooks/useTranslation.js +23 -8
- package/dist/v2/react/index.d.ts +8 -1
- package/dist/v2/react/index.js +3 -0
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.d.ts +8 -0
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.js +106 -10
- package/dist/v2/react/providers/TagadaProvider.js +5 -5
- package/dist/v2/standalone/index.d.ts +21 -3
- package/dist/v2/standalone/index.js +25 -3
- package/dist/v2/standalone/payment-service.d.ts +134 -0
- package/dist/v2/standalone/payment-service.js +929 -0
- package/package.json +4 -2
package/dist/tagada-sdk.min.js
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TagadaPay SDK v3.1.
|
|
2
|
+
* TagadaPay SDK v3.1.25
|
|
3
3
|
* CDN Bundle - Full standalone SDK for external/vanilla pages
|
|
4
4
|
* Usage: window.tgd.createTagadaClient(), window.tgd.formatMoney(), etc.
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var TagadaSDKBundle=(()=>{var js=Object.create;var St=Object.defineProperty,qs=Object.defineProperties,Xs=Object.getOwnPropertyDescriptor,Js=Object.getOwnPropertyDescriptors,Zs=Object.getOwnPropertyNames,Di=Object.getOwnPropertySymbols,Qs=Object.getPrototypeOf,Mi=Object.prototype.hasOwnProperty,ea=Object.prototype.propertyIsEnumerable;var $e=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),ta=n=>{throw TypeError(n)};var Bi=(n,e,t)=>e in n?St(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,C=(n,e)=>{for(var t in e||(e={}))Mi.call(e,t)&&Bi(n,t,e[t]);if(Di)for(var t of Di(e))ea.call(e,t)&&Bi(n,t,e[t]);return n},D=(n,e)=>qs(n,Js(e));var Oe=(n,e)=>()=>(n&&(e=n(n=0)),e);var na=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),ir=(n,e)=>{for(var t in e)St(n,t,{get:e[t],enumerable:!0})},Ui=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Zs(e))!Mi.call(n,i)&&i!==t&&St(n,i,{get:()=>e[i],enumerable:!(r=Xs(e,i))||r.enumerable});return n};var ra=(n,e,t)=>(t=n!=null?js(Qs(n)):{},Ui(e||!n||!n.__esModule?St(t,"default",{value:n,enumerable:!0}):t,n)),ia=n=>Ui(St({},"__esModule",{value:!0}),n);var De=function(n,e){this[0]=n,this[1]=e},or=(n,e,t)=>{var r=(s,a,l,c)=>{try{var u=t[s](a),p=(a=u.value)instanceof De,w=u.done;Promise.resolve(p?a[0]:a).then(b=>p?r(s==="return"?s:"next",a[1]?{done:b.done,value:b.value}:b,l,c):l({value:b,done:w})).catch(b=>r("throw",b,l,c))}catch(b){c(b)}},i=s=>o[s]=a=>new Promise((l,c)=>r(s,a,l,c)),o={};return t=t.apply(n,e),o[$e("asyncIterator")]=()=>o,i("next"),i("throw"),i("return"),o},ze=n=>{var e=n[$e("asyncIterator")],t=!1,r,i={};return e==null?(e=n[$e("iterator")](),r=o=>i[o]=s=>e[o](s)):(e=e.call(n),r=o=>i[o]=s=>{if(t){if(t=!1,o==="throw")throw s;return s}return t=!0,{done:!1,value:new De(new Promise(a=>{var l=e[o](s);l instanceof Object||ta("Object expected"),a(l)}),1)}}),i[$e("iterator")]=()=>i,r("next"),"throw"in e?r("throw"):i.throw=o=>{throw o},"return"in e&&r("return"),i},Fi=(n,e,t)=>(e=n[$e("asyncIterator")])?e.call(n):(n=n[$e("iterator")](),e={},t=(r,i)=>(i=n[r])&&(e[r]=o=>new Promise((s,a,l)=>(o=i.call(n,o),l=o.done,Promise.resolve(o.value).then(c=>s({value:c,done:l}),a)))),t("next"),t("return"),e);function Hi(n){var r;if(typeof document=="undefined")return null;let t="; ".concat(document.cookie).split("; ".concat(n,"="));return t.length===2&&((r=t.pop())==null?void 0:r.split(";").shift())||null}function Ki(n="local"){let e=Gi[n];if(!e)return console.warn("Unknown environment: ".concat(n,". Falling back to local.")),{environment:"local",apiConfig:Gi.local};let t=null;if(typeof window!="undefined"&&(t=new URLSearchParams(window.location.search).get("tagadaClientBaseUrl"),!t))try{t=localStorage.getItem("tgd_client_base_url")||Hi("tgd_client_base_url")}catch(i){}return t?(console.log("[SDK] Using custom API base URL override: ".concat(t)),{environment:n,apiConfig:D(C({},e),{baseUrl:t})}):{environment:n,apiConfig:e}}function It(){var i;if(console.log("[SDK] detectEnvironment() called"),typeof window=="undefined")return"local";let e=new URLSearchParams(window.location.search).get("tagadaClientEnv");if(e&&(e==="production"||e==="development"||e==="local"))return console.log("[SDK] Using explicit environment override: ".concat(e)),e;try{let o=localStorage.getItem("tgd_client_env")||Hi("tgd_client_env");if(o&&(o==="production"||o==="development"||o==="local"))return console.log("[SDK] Using persisted environment override: ".concat(o)),o}catch(o){}let t=window.location.hostname,r=window.location.href;if(console.log('[SDK] detectEnvironment() - hostname: "'.concat(t,'"')),t==="localhost"||t.startsWith("127.")||t.startsWith("192.168.")||t.startsWith("10.")||t.includes(".local")||t===""||t==="0.0.0.0"||t.includes("ngrok-free.dev")||t.includes("ngrok-free.app")||t.includes("ngrok.io")||t.includes("ngrok.app")){if(console.log("[SDK] detectEnvironment() - returning LOCAL"),typeof window!="undefined"&&((i=window==null?void 0:window.__TAGADA_ENV__)!=null&&i.TAGADA_ENVIRONMENT)){let o=window.__TAGADA_ENV__.TAGADA_ENVIRONMENT.toLowerCase();if(o==="production"||o==="development"||o==="local")return console.log("[SDK] Local override detected: ".concat(o)),o}return"local"}return t==="app.tagadapay.com"||t.includes("tagadapay.com")||t.includes("yourproductiondomain.com")?"production":t==="app.tagadapay.dev"||t.includes("tagadapay.dev")||t.includes("vercel.app")||t.includes("netlify.app")||t.includes("surge.sh")||t.includes("github.io")||t.includes("herokuapp.com")||t.includes("railway.app")||r.includes("?env=dev")||r.includes("?dev=true")||r.includes("#dev")?"development":(console.warn("[SDK] Unknown domain: ".concat(t,", defaulting to production")),"production")}function Ct(n=!1){return It()!=="local"?!1:n&&typeof window!="undefined"?!window.location.hostname.includes(".cdn."):!0}var Gi,dn=Oe(()=>{"use strict";Gi={production:{baseUrl:"https://app.tagadapay.com",endpoints:{checkout:{sessionInit:"/api/v1/checkout/session/init",sessionInitAsync:"/api/v1/checkout/session/init-async",sessionStatus:"/api/v1/checkout/session/status",asyncStatus:"/api/public/v1/checkout/async-status"},customer:{profile:"/api/v1/customer/profile",session:"/api/v1/customer/session"},store:{config:"/api/v1/store/config"}}},development:{baseUrl:"https://app.tagadapay.dev",endpoints:{checkout:{sessionInit:"/api/v1/checkout/session/init",sessionInitAsync:"/api/v1/checkout/session/init-async",sessionStatus:"/api/v1/checkout/session/status",asyncStatus:"/api/public/v1/checkout/async-status"},customer:{profile:"/api/v1/customer/profile",session:"/api/v1/customer/session"},store:{config:"/api/v1/store/config"}}},local:{baseUrl:"http://app.localhost:3000",endpoints:{checkout:{sessionInit:"/api/v1/checkout/session/init",sessionInitAsync:"/api/v1/checkout/session/init-async",sessionStatus:"/api/v1/checkout/session/status",asyncStatus:"/api/public/v1/checkout/async-status"},customer:{profile:"/api/v1/customer/profile",session:"/api/v1/customer/session"},store:{config:"/api/v1/store/config"}}}}});var fn,pn,sr=Oe(()=>{"use strict";fn=(w=>(w.DIRECT_NAVIGATION="direct_navigation",w.BACK_NAVIGATION="back_navigation",w.CONTINUE_CLICKED="continue_clicked",w.BUTTON_CLICK="button_click",w.FORM_SUBMIT="form_submit",w.PAYMENT_SUCCESS="payment_success",w.PAYMENT_FAILED="payment_failed",w.OFFER_ACCEPTED="offer_accepted",w.OFFER_DECLINED="offer_declined",w.CART_UPDATED="cart_updated",w.CART_ITEM_ADDED="cart_item_added",w.CUSTOM="custom",w))(fn||{}),pn=class{constructor(e){this.apiClient=e}async initialize(e){return this.apiClient.post("/api/v1/funnel/initialize",e)}async navigate(e){return this.apiClient.post("/api/v1/funnel/navigate",e)}async updateContext(e,t){return this.apiClient.patch("/api/v1/funnel/context/".concat(e),t)}async endSession(e){return this.apiClient.delete("/api/v1/funnel/session/".concat(e))}async getSession(e,t,r){let i=new URLSearchParams;t&&i.append("currentUrl",t),r&&i.append("includeDebugData","true");let o="/api/v1/funnel/session/".concat(e).concat(i.toString()?"?".concat(i):"");return this.apiClient.get(o)}}});var Ye,ar=Oe(()=>{"use strict";Ye=class{constructor(){this.listeners=new Set}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(e){this.listeners.forEach(t=>{try{t(e)}catch(r){console.error("Error in event listener:",r)}})}clear(){this.listeners.clear()}}});function oe(n){if(typeof window!="undefined")try{let t=localStorage.getItem(gn)!==n;localStorage.setItem(gn,n),t&&window.dispatchEvent(new Event("storage"))}catch(e){console.error("Failed to save token to localStorage:",e)}}function Tt(){if(typeof window!="undefined")try{return localStorage.getItem(gn)}catch(n){return console.error("Failed to get token from localStorage:",n),null}return null}function je(){if(typeof window!="undefined")try{localStorage.removeItem(gn)}catch(n){console.error("Failed to clear token from localStorage:",n)}}var gn,qe=Oe(()=>{"use strict";gn="cms_token"});function lr(n){typeof document!="undefined"&&(document.cookie="".concat(cr,"=").concat(n,"; path=/; max-age=2592000; SameSite=Lax"))}function mn(){if(typeof document=="undefined")return;let n=document.cookie.split("; ").find(e=>e.startsWith("".concat(cr,"=")));return n?n.split("=")[1]:void 0}function Rt(){typeof document!="undefined"&&(document.cookie="".concat(cr,"=; path=/; max-age=0"))}function sa(){return!!mn()}function aa(){var n;if(typeof document!="undefined")try{let e=document.cookie.split("; ").find(r=>r.startsWith("".concat(oa,"=")));if(!e)return;let t=JSON.parse(decodeURIComponent(e.split("=")[1]));return(n=t==null?void 0:t.metadata)==null?void 0:n.funnelVariantId}catch(e){console.warn("Failed to parse sticky session for variant ID:",e);return}}var cr,oa,Ot=Oe(()=>{"use strict";cr="tgd-funnel-session-id",oa="tgd-session-id"});function Xe(n){if(typeof window=="undefined")return null;try{return localStorage.getItem(n)}catch(e){return null}}function hn(n,e){if(typeof window!="undefined")try{localStorage.setItem(n,e)}catch(t){}}function Pt(n){var r;if(typeof document=="undefined")return null;let t=document.cookie.split(";").find(i=>i.trim().startsWith("".concat(n,"=")));return t?(r=t.split("=")[1])==null?void 0:r.trim():null}function ur(n,e,t=86400){if(typeof document!="undefined"){if(n==="tgd_draft"||n==="tgd-draft"){console.warn("\u{1F6E1}\uFE0F [SDK] Blocked attempt to set ".concat(n," as cookie - this should only be in localStorage"));return}document.cookie="".concat(n,"=").concat(e,"; path=/; max-age=").concat(t)}}function Wi(n){typeof document!="undefined"&&(document.cookie="".concat(n,"=; path=/; max-age=0"))}function Be(){if(typeof window=="undefined")return{};let n=new URLSearchParams(window.location.search),e,t=n.get("draft");if(t!==null)e=t==="true";else{let T=Xe(M.DRAFT);T!==null&&(e=T==="true")}let r,i=n.get("funnelTracking");if(i!==null)r=i!=="false";else{let T=Xe(M.FUNNEL_TRACKING)||Pt(M.FUNNEL_TRACKING);T!==null&&(r=T!=="false")}let o=n.get("token")||Tt()||null,s=n.get("funnelSessionId")||null,a=n.get("funnelId")||null,l,c=n.get("funnelEnv");c&&(c==="staging"||c==="production")&&(l=c);let u=n.get("forceReset")==="true",p,w=n.get("tagadaClientEnv");if(w&&(w==="production"||w==="development"||w==="local"))p=w;else{let T=Xe(M.CLIENT_ENV)||Pt(M.CLIENT_ENV);T&&(T==="production"||T==="development"||T==="local")&&(p=T)}let b,f=n.get("tagadaClientBaseUrl");if(f)b=f;else{let T=Xe(M.CLIENT_BASE_URL)||Pt(M.CLIENT_BASE_URL);T&&(b=T)}let I,h=n.get("currency");if(h)I=h;else{let T=Xe(M.CURRENCY)||Pt(M.CURRENCY);T&&(I=T)}let O,x=n.get("locale");if(x)O=x;else{let T=Xe(M.LOCALE)||Pt(M.LOCALE);T&&(O=T)}return{forceReset:u,token:o,funnelSessionId:s,funnelId:a,draft:e,funnelTracking:r,funnelEnv:l,tagadaClientEnv:p,tagadaClientBaseUrl:b,currency:I,locale:O}}function vt(){var e;return(e=Be().draft)!=null?e:!1}function dr(n){if(typeof window!="undefined")if(n)hn(M.DRAFT,"true");else try{localStorage.removeItem(M.DRAFT)}catch(e){}}function $i(n=!1){let e=null;typeof window!="undefined"&&(e=new URLSearchParams(window.location.search).get("token"));let t=Be(),r=t.forceReset||!1;if(!r&&!t.token)return Vi(),!1;n&&(console.log("[SDK] Detected params:",t),console.log("[SDK] URL token (direct read):",e?e.substring(0,20)+"...":"none")),r&&(n&&console.log("[SDK] Force reset: Clearing all stored state"),je(),Rt(),typeof window!="undefined"&&window.localStorage&&Object.keys(localStorage).forEach(s=>{(s.startsWith("tagadapay_")||s.startsWith("tgd_"))&&(n&&console.log("[SDK] Clearing localStorage: ".concat(s)),localStorage.removeItem(s))}));let i=e||t.token;return i!=null?(n&&console.log("[SDK] Setting token from URL:",i.substring(0,20)+"..."),i===""||i==="null"?je():(oe(i),n&&console.log("[SDK] \u2705 Token set in localStorage immediately after clear"))):r&&(n&&console.log("[SDK] Force reset mode (no token in URL)"),je()),Vi(),t.funnelSessionId&&n&&console.log("[SDK] Using funnelSessionId from URL:",t.funnelSessionId),r}function Vi(){if(typeof window=="undefined")return;let n=new URLSearchParams(window.location.search),e=n.get("draft");e!==null&&dr(e==="true");let t=n.get("funnelTracking");t!==null&&ca(t!=="false");let r=n.get("tagadaClientEnv");r&&(r==="production"||r==="development"||r==="local")&&la(r);let i=n.get("tagadaClientBaseUrl");i&&ua(i)}function ca(n){if(typeof window=="undefined")return;let e=n?"true":"false";hn(M.FUNNEL_TRACKING,e),ur(M.FUNNEL_TRACKING,e,86400)}function la(n){typeof window!="undefined"&&(hn(M.CLIENT_ENV,n),ur(M.CLIENT_ENV,n,86400))}function zi(){if(typeof window!="undefined")try{localStorage.removeItem(M.CLIENT_ENV),Wi(M.CLIENT_ENV)}catch(n){}}function ua(n){typeof window!="undefined"&&(hn(M.CLIENT_BASE_URL,n),ur(M.CLIENT_BASE_URL,n,86400))}function Yi(){if(typeof window!="undefined")try{localStorage.removeItem(M.CLIENT_BASE_URL),Wi(M.CLIENT_BASE_URL)}catch(n){}}function ji(){var e;return(e=Be().funnelTracking)!=null?e:!0}var M,En=Oe(()=>{"use strict";qe();Ot();M={DRAFT:"tgd_draft",FUNNEL_TRACKING:"tgd_funnel_tracking",FORCE_RESET:"tgd_force_reset",CLIENT_ENV:"tgd_client_env",CLIENT_BASE_URL:"tgd_client_base_url",CURRENCY:"tgd_currency",LOCALE:"tgd_locale"}});function pr(n){if(typeof window=="undefined"||typeof document=="undefined")return;let e=window.location.hostname,t=e.split("."),r=["",e,"."+e];for(let a=1;a<t.length;a++){let l=t.slice(a).join(".");r.push(l),r.push("."+l)}let i=window.location.pathname.split("/").filter(a=>a),o=["/"],s="";i.forEach(a=>{s+="/"+a,o.push(s)}),r.forEach(a=>{o.forEach(l=>{let c="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=").concat(l),u=a?"; domain=".concat(a):"";document.cookie=c+u,document.cookie=c+u+"; secure",document.cookie=c+u+"; SameSite=None; secure",document.cookie=c+u+"; SameSite=Lax",document.cookie=c+u+"; SameSite=Strict"})})}function pa(){if(typeof window=="undefined"||!confirm("\u{1F6AA} Leave Preview Mode?\n\nThis will clear ALL cookies and localStorage (including Shopify session, cart, and preview settings) and reload the page.\n\nAre you sure?"))return;let e=new URL(window.location.href);["draft","funnelEnv","funnelTracking","tagadaClientEnv","tagadaClientBaseUrl","forceReset","funnelId","funnelSessionId","token"].forEach(o=>e.searchParams.delete(o)),window.history.replaceState({},"",e.href);try{let o=Object.getOwnPropertyDescriptor(Document.prototype,"cookie")||Object.getOwnPropertyDescriptor(HTMLDocument.prototype,"cookie");o&&o.set&&Object.defineProperty(document,"cookie",{configurable:!0,enumerable:!0,get:function(){return o.get?o.get.call(this):""},set:function(s){if(typeof s=="string"){let a=s.toLowerCase();if(a.includes("tgd_draft")||a.includes("tgd-draft")||a.includes("tgd.draft")||a.includes("tgddraft")){if(a.includes("max-age=0")||a.includes("expires=thu, 01 jan 1970")){o.set&&o.set.call(this,s);return}console.warn("\u{1F6E1}\uFE0F [TagadaPay] BLOCKED: tgd_draft should never be a cookie");return}}o.set&&o.set.call(this,s)}})}catch(o){console.warn("[TagadaPay] Could not install cookie blocker:",o)}if(window.localStorage)try{localStorage.removeItem("tgd_draft"),localStorage.removeItem("tgd_funnel_tracking"),localStorage.removeItem("tgd_client_env"),localStorage.removeItem("tgd_client_base_url"),localStorage.removeItem("cms_token")}catch(o){console.warn("[TagadaPay] Failed to clear some localStorage keys:",o)}je(),Rt(),zi(),Yi(),window.localStorage&&localStorage.clear(),window.sessionStorage&&sessionStorage.clear(),["tgd-funnel-session-id","tgd_draft","tgd_funnel_tracking","tgd_client_env","tgd_client_base_url","cms_token","tagadapay_session"].forEach(o=>pr(o)),["tgd-draft","tgd_draft","tgd.draft","tgddraft"].forEach(o=>pr(o)),document.cookie&&document.cookie.split(";").forEach(s=>{let a=s.split("=")[0].trim();if(!a)return;let l=window.location.hostname,c=l.split("."),u=["",l,"."+l];for(let f=1;f<c.length;f++){let I=c.slice(f).join(".");u.push(I),u.push("."+I)}let p=window.location.pathname.split("/").filter(f=>f),w=["/"],b="";p.forEach(f=>{b+="/"+f,w.push(b)}),u.forEach(f=>{w.forEach(I=>{let h="".concat(a,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=").concat(I),O=f?"; domain=".concat(f):"";document.cookie=h+O,document.cookie=h+O+"; secure",document.cookie=h+O+"; SameSite=None; secure",document.cookie=h+O+"; SameSite=Lax",document.cookie=h+O+"; SameSite=Strict",document.cookie=h+O+"; secure; SameSite=None",document.cookie=h+O+"; secure; SameSite=Lax",document.cookie=h+O+"; secure; SameSite=Strict"})})}),setTimeout(()=>{window.localStorage&&localStorage.length>0&&localStorage.clear(),pr("tgd_draft"),typeof window.stop=="function"&&window.stop(),window.location.replace(e.href)},10)}function fr(){if(qi||typeof window=="undefined"||typeof document=="undefined")return;let n=Be(),e=vt(),t=!ji(),r=!!(n.tagadaClientEnv||n.tagadaClientBaseUrl);if(!e&&!t&&!r)return;let i=document.createElement("div");i.id="tgd-preview-indicator",i.style.cssText='\n position: fixed;\n bottom: 16px;\n right: 16px;\n z-index: 999999;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n ';let o=document.createElement("div");o.style.cssText="\n background: ".concat(e?"#ff9500":"#007aff",";\n color: white;\n padding: 8px 12px;\n border-radius: 8px;\n font-size: 13px;\n font-weight: 600;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n cursor: pointer;\n transition: all 0.2s ease;\n display: flex;\n align-items: center;\n gap: 6px;\n "),o.innerHTML='\n <span style="font-size: 16px;">\u{1F50D}</span>\n <span>'.concat(e?"Preview Mode":"Dev Mode","</span>\n ");let s=document.createElement("div");s.style.cssText="\n position: absolute;\n bottom: calc(100% + 8px);\n right: 0;\n background: white;\n border: 1px solid #e5e5e5;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n padding: 12px;\n min-width: 250px;\n font-size: 12px;\n line-height: 1.5;\n display: none;\n ",s.style.paddingTop="20px";let a=document.createElement("div");a.style.cssText="\n position: absolute;\n bottom: 100%;\n left: 0;\n right: 0;\n height: 8px;\n display: none;\n ";let l='<div style="margin-bottom: 8px; font-weight: 600; color: #1d1d1f;">Current Environment</div>';l+='<div style="display: flex; flex-direction: column; gap: 6px;">',e&&(l+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>Draft Mode:</span>\n <span style="color: #ff9500; font-weight: 600;">ON</span>\n </div>\n '),t&&(l+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>Tracking:</span>\n <span style="color: #ff3b30; font-weight: 600;">DISABLED</span>\n </div>\n '),n.funnelEnv&&(l+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>Funnel Env:</span>\n <span style="color: #1d1d1f; font-weight: 600; font-family: monospace; font-size: 11px;">\n '.concat(n.funnelEnv,"\n </span>\n </div>\n ")),n.tagadaClientEnv&&(l+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>API Env:</span>\n <span style="color: #1d1d1f; font-weight: 600; font-family: monospace; font-size: 11px;">\n '.concat(n.tagadaClientEnv,"\n </span>\n </div>\n ")),n.tagadaClientBaseUrl&&(l+='\n <div style="color: #86868b;">\n <div style="margin-bottom: 4px;">API URL:</div>\n <div style="color: #1d1d1f; font-weight: 600; font-family: monospace; font-size: 10px; word-break: break-all; background: #f5f5f7; padding: 4px 6px; border-radius: 4px;">\n '.concat(n.tagadaClientBaseUrl,"\n </div>\n </div>\n ")),n.funnelId&&(l+='\n <div style="color: #86868b; margin-top: 4px; padding-top: 8px; border-top: 1px solid #e5e5e5;">\n <div style="margin-bottom: 4px;">Funnel ID:</div>\n <div style="color: #1d1d1f; font-family: monospace; font-size: 10px; word-break: break-all; background: #f5f5f7; padding: 4px 6px; border-radius: 4px;">\n '.concat(n.funnelId,"\n </div>\n </div>\n ")),l+="</div>",l+='\n <div style="margin-top: 12px; padding-top: 8px; border-top: 1px solid #e5e5e5; font-size: 11px; color: #86868b; text-align: center;">\n Add <code style="background: #f5f5f7; padding: 2px 4px; border-radius: 3px;">?forceReset=true</code> to reset\n </div>\n ',l+='\n <div style="margin-top: 12px; padding-top: 8px; border-top: 1px solid #e5e5e5;">\n <button id="tgd-leave-preview" style="\n background: #ff3b30;\n color: white;\n border: none;\n border-radius: 6px;\n padding: 10px 12px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n transition: opacity 0.2s;\n width: 100%;\n ">\n \u{1F6AA} Leave Preview Mode\n </button>\n </div>\n ',s.innerHTML=l;let c=!1,u=()=>{c=!0,s.style.display="block",a.style.display="block"},p=()=>{c=!1,setTimeout(()=>{c||(s.style.display="none",a.style.display="none")},100)};o.addEventListener("mouseenter",u),o.addEventListener("mouseleave",p),a.addEventListener("mouseenter",u),a.addEventListener("mouseleave",p),s.addEventListener("mouseenter",u),s.addEventListener("mouseleave",p);let w=s.querySelector("#tgd-leave-preview");w&&(w.addEventListener("mouseenter",()=>{w.style.opacity="0.8"}),w.addEventListener("mouseleave",()=>{w.style.opacity="1"}),w.addEventListener("click",b=>{b.stopPropagation(),pa()})),i.appendChild(o),i.appendChild(a),i.appendChild(s),document.body.appendChild(i),da=i,qi=!0}var da,qi,Xi=Oe(()=>{"use strict";En();qe();Ot();da=null,qi=!1});var eo={};ir(eo,{FunnelClient:()=>Nt,TrackingProvider:()=>Zi,getAssignedPaymentFlowId:()=>Ea,getAssignedPixels:()=>wa,getAssignedScripts:()=>Aa,getAssignedStaticResources:()=>ya,getAssignedStepConfig:()=>Me,getLocalFunnelConfig:()=>Qi,loadLocalFunnelConfig:()=>ma});function fa(){if(typeof window!="undefined"){if(window.__TGD_FUNNEL_ID__)return window.__TGD_FUNNEL_ID__;if(typeof document!="undefined"){let n=document.querySelector('meta[name="x-funnel-id"]');return(n==null?void 0:n.getAttribute("content"))||void 0}}}function yn(){if(typeof window!="undefined"){if(window.__TGD_FUNNEL_VARIANT_ID__)return window.__TGD_FUNNEL_VARIANT_ID__;if(typeof document!="undefined"){let n=document.querySelector('meta[name="x-funnel-variant-id"]');return(n==null?void 0:n.getAttribute("content"))||void 0}}}function xt(){if(typeof window!="undefined"){if(window.__TGD_FUNNEL_STEP_ID__)return window.__TGD_FUNNEL_STEP_ID__;if(typeof document!="undefined"){let n=document.querySelector('meta[name="x-funnel-step-id"]');return(n==null?void 0:n.getAttribute("content"))||void 0}}}function Ji(n){if(!n||typeof n!="string")return;let e=n.trim();if(!e)return;let t=[()=>JSON.parse(e),()=>JSON.parse(decodeURIComponent(e)),()=>JSON.parse(decodeURIComponent(decodeURIComponent(e)))];for(let r of t)try{let i=r();if(i&&typeof i=="object")return i}catch(i){}typeof console!="undefined"&&console.warn("[SDK] Failed to parse stepConfig:",e.substring(0,100))}function ga(){if(typeof window=="undefined")return!1;let n=window.location.hostname;return n==="localhost"||n==="127.0.0.1"||n.endsWith(".localhost")&&!n.includes(".cdn.")}async function ma(){if(!ga())return null;if(se!==void 0)return se;if(gr)return await new Promise(n=>setTimeout(n,100)),se!=null?se:null;gr=!0;try{console.log("\u{1F6E0}\uFE0F [SDK] Loading local funnel config from /config/funnel.local.json...");let n=await fetch("/config/funnel.local.json");if(!n.ok)return console.log("\u{1F6E0}\uFE0F [SDK] funnel.local.json not found (this is fine in production)"),se=null,null;let e=await n.json();return console.log("\u{1F6E0}\uFE0F [SDK] \u2705 Loaded local funnel config:",e),se=e,e}catch(n){return console.log("\u{1F6E0}\uFE0F [SDK] funnel.local.json not available:",n),se=null,null}finally{gr=!1}}function Qi(){return se!=null?se:null}function ha(n){return{payment:n.paymentFlowId?{paymentFlowId:n.paymentFlowId}:void 0,staticResources:n.staticResources,scripts:n.scripts,pixels:n.pixels}}function Me(){if(typeof window=="undefined")return;let n=Qi();if(n)return console.log("\u{1F6E0}\uFE0F [SDK] Using local funnel.local.json (overrides injected)"),ha(n);let e=window.__TGD_STEP_CONFIG__;if(e){let t=Ji(e);if(t)return t}if(typeof document!="undefined"){let t=document.querySelector('meta[name="x-step-config"]'),r=t==null?void 0:t.getAttribute("content");if(r){let i=Ji(r);if(i)return i}}}function Ea(){var e;let n=Me();if((e=n==null?void 0:n.payment)!=null&&e.paymentFlowId)return n.payment.paymentFlowId;if(typeof window!="undefined"){if(window.__TGD_PAYMENT_FLOW_ID__)return window.__TGD_PAYMENT_FLOW_ID__;if(typeof document!="undefined"){let t=document.querySelector('meta[name="x-payment-flow-id"]');return(t==null?void 0:t.getAttribute("content"))||void 0}}}function ya(){let n=Me();return n==null?void 0:n.staticResources}function Aa(n){let e=Me();if(!(e!=null&&e.scripts))return;let t=e.scripts.filter(r=>r.enabled);return n&&(t=t.filter(r=>r.position===n||!r.position&&n==="head-end")),t.length>0?t:void 0}function wa(){let n=Me(),e=n==null?void 0:n.pixels;if(!e||typeof e!="object")return;let t={};for(let[r,i]of Object.entries(e))i&&(Array.isArray(i)?t[r]=i:typeof i=="object"&&(t[r]=[i]));return Object.keys(t).length>0?t:void 0}var Zi,se,gr,Nt,An=Oe(()=>{"use strict";dn();sr();ar();En();Xi();Ot();Zi=(o=>(o.FACEBOOK="facebook",o.TIKTOK="tiktok",o.SNAPCHAT="snapchat",o.PINTEREST="pinterest",o.GTM="gtm",o))(Zi||{});gr=!1;Nt=class{constructor(e){this.eventDispatcher=new Ye;this.isInitializing=!1;this.initializationAttempted=!1;this.config=e,this.resource=new pn(e.apiClient),this.state={context:null,isLoading:!1,isInitialized:!1,isNavigating:!1,error:null,sessionError:null}}setConfig(e){this.config=C(C({},this.config),e)}subscribe(e){return this.eventDispatcher.subscribe(e)}getState(){return this.state}getDetectedSessionId(){var r;if((r=this.state.context)!=null&&r.sessionId)return this.state.context.sessionId;if(typeof window=="undefined")return null;let t=new URLSearchParams(window.location.search).get("funnelSessionId");return t||mn()||null}resetInitialization(){this.initializationAttempted=!1,this.isInitializing=!1,this.updateState({context:null,isInitialized:!1})}async autoInitialize(e,t,r){if(this.state.context)return this.state.context;if(this.isInitializing||this.initializationAttempted)return null;this.initializationAttempted=!0,this.isInitializing=!0,this.updateState({isLoading:!0,error:null});try{let i=this.getDetectedSessionId(),a=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("funnelId")||r,l=fa(),c=yn(),u=xt(),p=Be(),w=this.config.funnelId||l||a,b=this.config.stepId||u,f=typeof window!="undefined"?new URLSearchParams(window.location.search):null,I=f==null?void 0:f.get("funnelEnv");this.config.debugMode&&console.log("\u{1F680} [FunnelClient] Auto-initializing...",{existingSessionId:i,effectiveFunnelId:w,funnelVariantId:c,funnelStepId:b,draft:p.draft,funnelTracking:p.funnelTracking,funnelEnv:I,tagadaClientEnv:p.tagadaClientEnv,tagadaClientBaseUrl:p.tagadaClientBaseUrl,source:{funnelId:this.config.funnelId?"config":l?"injected":a?"url/prop":"none",stepId:this.config.stepId?"config":u?"injected":"none"}});let h=await this.resource.initialize({cmsSession:{customerId:e.customerId,sessionId:e.sessionId,storeId:t.id,accountId:t.accountId},funnelId:w,existingSessionId:i||void 0,currentUrl:typeof window!="undefined"?window.location.href:void 0,funnelVariantId:c,funnelStepId:b,draft:p.draft,funnelTracking:p.funnelTracking,funnelEnv:I||void 0,tagadaClientEnv:p.tagadaClientEnv,tagadaClientBaseUrl:p.tagadaClientBaseUrl,currency:p.currency,locale:p.locale});if(h.success&&h.context){let O=this.enrichContext(h.context);return this.handleSessionSuccess(O),fr(),O}else throw new Error(h.error||"Failed to initialize funnel session")}catch(i){let o=i instanceof Error?i:new Error(String(i));throw this.updateState({error:o,isLoading:!1}),this.config.debugMode&&console.error("\u274C [FunnelClient] Init failed:",o),o}finally{this.isInitializing=!1}}async initialize(e,t,r,i){this.updateState({isLoading:!0,error:null});try{let o=yn(),s=xt();this.config.debugMode&&(o&&console.log("\u{1F3AF} [FunnelClient] Detected A/B test variant:",o),s&&console.log("\u{1F3AF} [FunnelClient] Detected step ID:",s));let a=await this.resource.initialize({cmsSession:{customerId:e.customerId,sessionId:e.sessionId,storeId:t.id,accountId:t.accountId},funnelId:r,entryStepId:i,currentUrl:typeof window!="undefined"?window.location.href:void 0,funnelVariantId:o,funnelStepId:s});if(a.success&&a.context){let l=this.enrichContext(a.context);return this.handleSessionSuccess(l),fr(),l}else throw new Error(a.error||"Failed to initialize")}catch(o){let s=o instanceof Error?o:new Error(String(o));throw this.updateState({error:s,isLoading:!1}),s}}async navigate(e,t){var r,i,o,s,a,l;if(t!=null&&t.waitForSession&&!((r=this.state.context)!=null&&r.sessionId)){this.config.debugMode&&console.log("\u23F3 [FunnelClient] Waiting for session before navigation...");let c=5e3,u=Date.now();for(;!((i=this.state.context)!=null&&i.sessionId)&&Date.now()-u<c;)await new Promise(p=>setTimeout(p,100));(o=this.state.context)!=null&&o.sessionId&&this.config.debugMode&&console.log("\u2705 [FunnelClient] Session ready, proceeding with navigation")}if(!((s=this.state.context)!=null&&s.sessionId))throw new Error("No active session");this.updateState({isNavigating:!0,isLoading:!0});try{let c=yn(),u=xt(),p=typeof window!="undefined"?window.location.href:void 0;!u&&this.config.stepId&&(u=this.config.stepId,this.config.debugMode&&console.log("\u{1F50D} [FunnelClient.navigate] Using stepId from config (no injection):",u)),!c&&this.config.variantId&&(c=this.config.variantId,this.config.debugMode&&console.log("\u{1F50D} [FunnelClient.navigate] Using variantId from config (no injection):",c)),this.config.debugMode&&console.log("\u{1F50D} [FunnelClient.navigate] Sending to backend:",{sessionId:this.state.context.sessionId,currentUrl:p,funnelStepId:u||"(not found)",funnelVariantId:c||"(not found)",hasInjectedStepId:!!xt(),hasInjectedVariantId:!!yn(),usedConfigFallback:!xt()&&!!this.config.stepId,customerTags:(t==null?void 0:t.customerTags)||"(none)",deviceId:(t==null?void 0:t.deviceId)||"(none)"});let w=(t==null?void 0:t.fireAndForget)||!1,b=await this.resource.navigate({sessionId:this.state.context.sessionId,event:e,currentUrl:p,funnelStepId:u,funnelVariantId:c,fireAndForget:w,customerTags:t==null?void 0:t.customerTags,deviceId:t==null?void 0:t.deviceId});if(!b.success||!b.result)throw new Error(b.error||"Navigation failed");let f=b.result;if(f.queued)return this.updateState({isNavigating:!1,isLoading:!1}),f.sessionId&&f.sessionId!==((a=this.state.context)==null?void 0:a.sessionId)&&(this.config.debugMode&&console.log("\u{1F525} [FunnelClient] Session ID updated: ".concat((l=this.state.context)==null?void 0:l.sessionId," \u2192 ").concat(f.sessionId)),this.state.context&&(this.state.context.sessionId=f.sessionId)),this.config.debugMode&&console.log("\u{1F525} [FunnelClient] Navigation queued (fire-and-forget mode)"),f;let I=(t==null?void 0:t.autoRedirect)!==void 0?t.autoRedirect:this.config.autoRedirect!==!1;return I||(this.config.debugMode&&console.log("\u{1F504} [FunnelClient] Refreshing session (no auto-redirect)"),await this.refreshSession()),this.updateState({isNavigating:!1,isLoading:!1}),I&&(f!=null&&f.url)&&typeof window!="undefined"&&(this.config.debugMode&&console.log("\u{1F680} [FunnelClient] Auto-redirecting to:",f.url,"(skipped session refresh - next page will initialize)"),window.location.href=f.url),f}catch(c){let u=c instanceof Error?c:new Error(String(c));throw this.updateState({error:u,isNavigating:!1,isLoading:!1}),u}}async goToStep(e,t){return this.navigate({type:"direct_navigation",data:{targetStepId:e}},t)}async refreshSession(){var e;if((e=this.state.context)!=null&&e.sessionId)try{let t=await this.resource.getSession(this.state.context.sessionId);if(t.success&&t.context){let r=this.enrichContext(t.context);return this.updateState({context:r,sessionError:null}),r}}catch(t){this.updateState({sessionError:t instanceof Error?t:new Error(String(t))})}}async updateContext(e){var t;if(!((t=this.state.context)!=null&&t.sessionId))throw new Error("No active session");this.updateState({isLoading:!0});try{let r=await this.resource.updateContext(this.state.context.sessionId,{contextUpdates:e});if(r.success)await this.refreshSession();else throw new Error(r.error||"Failed to update context")}finally{this.updateState({isLoading:!1})}}async endSession(){var e;if((e=this.state.context)!=null&&e.sessionId)try{await this.resource.endSession(this.state.context.sessionId)}finally{this.state.context=null,this.updateState({context:null,isInitialized:!1})}}updateState(e){this.state=C(C({},this.state),e),this.eventDispatcher.notify(this.state)}handleSessionSuccess(e){lr(e.sessionId),this.updateState({context:e,isLoading:!1,isInitialized:!0,error:null,sessionError:null})}enrichContext(e){var s,a;if((((s=this.config.environment)==null?void 0:s.environment)||It())!=="local")return e;let r=((a=this.config.pluginConfig)==null?void 0:a.staticResources)||{};if(Object.keys(r).length===0)return e;let i=e.static||{};return Object.keys(r).every(l=>i[l]===r[l])&&Object.keys(i).length===Object.keys(r).length?e:D(C({},e),{static:C(C({},r),i)})}}});var Us=na(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.PathError=de.TokenData=void 0;de.parse=Ai;de.compile=wl;de.match=Sl;de.pathToRegexp=Ds;de.stringify=Tl;var hi="/",Ei=n=>n,ks=new RegExp("^[$_\\p{ID_Start}]$","u"),yi=new RegExp("^[$\\u200c\\u200d\\p{ID_Continue}]$","u"),yl={"{":"{","}":"}","(":"(",")":")","[":"[","]":"]","+":"+","?":"?","!":"!"};function Al(n){return n.replace(/[{}()\[\]+?!:*\\]/g,"\\$&")}function Ae(n){return n.replace(/[.+*?^${}()[\]|/\\]/g,"\\$&")}var Qn=class{constructor(e,t){this.tokens=e,this.originalPath=t}};de.TokenData=Qn;var Ke=class extends TypeError{constructor(e,t){let r=e;t&&(r+=": ".concat(t)),r+="; visit https://git.new/pathToRegexpError for info",super(r),this.originalPath=t}};de.PathError=Ke;function Ai(n,e={}){let{encodePath:t=Ei}=e,r=[...n],i=[],o=0,s=0;function a(){let c="";if(ks.test(r[o]))do c+=r[o++];while(yi.test(r[o]));else if(r[o]==='"'){let u=o;for(;o++<r.length;){if(r[o]==='"'){o++,u=0;break}r[o]==="\\"&&o++,c+=r[o]}if(u)throw new Ke("Unterminated quote at index ".concat(u),n)}if(!c)throw new Ke("Missing parameter name at index ".concat(o),n);return c}for(;o<r.length;){let c=r[o],u=yl[c];u?i.push({type:u,index:o++,value:c}):c==="\\"?i.push({type:"escape",index:o++,value:r[o++]}):c===":"?i.push({type:"param",index:o++,value:a()}):c==="*"?i.push({type:"wildcard",index:o++,value:a()}):i.push({type:"char",index:o++,value:c})}i.push({type:"end",index:o,value:""});function l(c){let u=[];for(;;){let p=i[s++];if(p.type===c)break;if(p.type==="char"||p.type==="escape"){let w=p.value,b=i[s];for(;b.type==="char"||b.type==="escape";)w+=b.value,b=i[++s];u.push({type:"text",value:t(w)});continue}if(p.type==="param"||p.type==="wildcard"){u.push({type:p.type,name:p.value});continue}if(p.type==="{"){u.push({type:"group",tokens:l("}")});continue}throw new Ke("Unexpected ".concat(p.type," at index ").concat(p.index,", expected ").concat(c),n)}return u}return new Qn(l("end"),n)}function wl(n,e={}){let{encode:t=encodeURIComponent,delimiter:r=hi}=e,i=typeof n=="object"?n:Ai(n,e),o=Ls(i.tokens,r,t);return function(a={}){let[l,...c]=o(a);if(c.length)throw new TypeError("Missing parameters: ".concat(c.join(", ")));return l}}function Ls(n,e,t){let r=n.map(i=>bl(i,e,t));return i=>{let o=[""];for(let s of r){let[a,...l]=s(i);o[0]+=a,o.push(...l)}return o}}function bl(n,e,t){if(n.type==="text")return()=>[n.value];if(n.type==="group"){let i=Ls(n.tokens,e,t);return o=>{let[s,...a]=i(o);return a.length?[""]:[s]}}let r=t||Ei;return n.type==="wildcard"&&t!==!1?i=>{let o=i[n.name];if(o==null)return["",n.name];if(!Array.isArray(o)||o.length===0)throw new TypeError('Expected "'.concat(n.name,'" to be a non-empty array'));return[o.map((s,a)=>{if(typeof s!="string")throw new TypeError('Expected "'.concat(n.name,"/").concat(a,'" to be a string'));return r(s)}).join(e)]}:i=>{let o=i[n.name];if(o==null)return["",n.name];if(typeof o!="string")throw new TypeError('Expected "'.concat(n.name,'" to be a string'));return[r(o)]}}function Sl(n,e={}){let{decode:t=decodeURIComponent,delimiter:r=hi}=e,{regexp:i,keys:o}=Ds(n,e),s=o.map(a=>t===!1?Ei:a.type==="param"?t:l=>l.split(r).map(t));return function(l){let c=i.exec(l);if(!c)return!1;let u=c[0],p=Object.create(null);for(let w=1;w<c.length;w++){if(c[w]===void 0)continue;let b=o[w-1],f=s[w-1];p[b.name]=f(c[w])}return{path:u,params:p}}}function Ds(n,e={}){let{delimiter:t=hi,end:r=!0,sensitive:i=!1,trailing:o=!0}=e,s=[],a=i?"":"i",l=[];for(let p of Bs(n,[])){let w=typeof p=="object"?p:Ai(p,e);for(let b of Zn(w.tokens,0,[]))l.push(Il(b,t,s,w.originalPath))}let c="^(?:".concat(l.join("|"),")");return o&&(c+="(?:".concat(Ae(t),"$)?")),c+=r?"$":"(?=".concat(Ae(t),"|$)"),{regexp:new RegExp(c,a),keys:s}}function Bs(n,e){if(Array.isArray(n))for(let t of n)Bs(t,e);else e.push(n);return e}function*Zn(n,e,t){if(e===n.length)return yield t;let r=n[e];if(r.type==="group")for(let i of Zn(r.tokens,0,t.slice()))yield*ze(Zn(n,e+1,i));else t.push(r);yield*ze(Zn(n,e+1,t))}function Il(n,e,t,r){let i="",o="",s=!0;for(let a of n){if(a.type==="text"){i+=Ae(a.value),o+=a.value,s||(s=a.value.includes(e));continue}if(a.type==="param"||a.type==="wildcard"){if(!s&&!o)throw new Ke('Missing text before "'.concat(a.name,'" ').concat(a.type),r);a.type==="param"?i+="(".concat(Cl(e,s?"":o),"+)"):i+="([\\s\\S]+)",t.push(a),o="",s=!1;continue}}return i}function Cl(n,e){return e.length<2?n.length<2?"[^".concat(Ae(n+e),"]"):"(?:(?!".concat(Ae(n),")[^").concat(Ae(e),"])"):n.length<2?"(?:(?!".concat(Ae(e),")[^").concat(Ae(n),"])"):"(?:(?!".concat(Ae(e),"|").concat(Ae(n),")[\\s\\S])")}function Ms(n){let e="",t=0;function r(i){return Rl(i)&&Ol(n[t])?i:JSON.stringify(i)}for(;t<n.length;){let i=n[t++];if(i.type==="text"){e+=Al(i.value);continue}if(i.type==="group"){e+="{".concat(Ms(i.tokens),"}");continue}if(i.type==="param"){e+=":".concat(r(i.name));continue}if(i.type==="wildcard"){e+="*".concat(r(i.name));continue}throw new TypeError("Unknown token type: ".concat(i.type))}return e}function Tl(n){return Ms(n.tokens)}function Rl(n){let[e,...t]=n;return ks.test(e)&&t.every(r=>yi.test(r))}function Ol(n){return n&&n.type==="text"?!yi.test(n.value[0]):!0}});var Wl={};ir(Wl,{ApiClient:()=>at,CheckoutResource:()=>zn,CheckoutUtils:()=>pi,CurrencyUtils:()=>sn,FunnelActionType:()=>fn,GoogleAutocompleteCore:()=>yt,ISODataCore:()=>Jn,OrderBumpUtils:()=>mi,OrderUtils:()=>di,OrdersResource:()=>qn,PaymentsResource:()=>jn,PluginConfigUtils:()=>ii,PostPurchasesUtils:()=>gi,ProductsUtils:()=>ui,PromotionsUtils:()=>fi,ShippingRatesResource:()=>Yn,TagadaApiError:()=>we,TagadaAuthError:()=>ot,TagadaCircuitBreakerError:()=>st,TagadaClient:()=>on,TagadaError:()=>le,TagadaErrorCode:()=>ne,TagadaExternalTracker:()=>ln,TagadaNetworkError:()=>it,TagadaTracker:()=>Pi,TagadaValidationError:()=>Dn,applyGoogleAdsConversion:()=>Oi,broadcastConfigUpdate:()=>ml,clearFunnelSessionCookie:()=>Rt,createRawPluginConfig:()=>Ss,createTagadaClient:()=>vi,debounceConfigUpdate:()=>El,formatMoney:()=>fl,funnelQueryKeys:()=>gl,getEligiblePixels:()=>Ve,getFunnelSessionCookie:()=>mn,getFunnelVariantId:()=>aa,getInternalPath:()=>an,getPathInfo:()=>Hs,getPluginConfig:()=>ol,hasFunnelSessionCookie:()=>sa,injectStepConfigScripts:()=>xi,isEventEnabled:()=>bi,isPathRemapped:()=>Gs,loadLocalConfig:()=>bs,loadPluginConfig:()=>oi,mapGTMEvent:()=>Ri,mapMetaEvent:()=>Si,mapPinterestEvent:()=>Ti,mapSnapchatEvent:()=>Ci,mapTikTokEvent:()=>Ii,matchRoute:()=>Ks,onConfigUpdate:()=>hl,resolvePixelEvents:()=>Vs,sendConfigUpdate:()=>_s,setFunnelSessionCookie:()=>lr});dn();An();function _t(n,e){return function(){return n.apply(e,arguments)}}var{toString:ba}=Object.prototype,{getPrototypeOf:hr}=Object,{iterator:bn,toStringTag:no}=Symbol,Sn=(n=>e=>{let t=ba.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),ae=n=>(n=n.toLowerCase(),e=>Sn(e)===n),In=n=>e=>typeof e===n,{isArray:Ze}=Array,Je=In("undefined");function kt(n){return n!==null&&!Je(n)&&n.constructor!==null&&!Je(n.constructor)&&J(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}var ro=ae("ArrayBuffer");function Sa(n){let e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&ro(n.buffer),e}var Ia=In("string"),J=In("function"),io=In("number"),Lt=n=>n!==null&&typeof n=="object",Ca=n=>n===!0||n===!1,wn=n=>{if(Sn(n)!=="object")return!1;let e=hr(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(no in n)&&!(bn in n)},Ta=n=>{if(!Lt(n)||kt(n))return!1;try{return Object.keys(n).length===0&&Object.getPrototypeOf(n)===Object.prototype}catch(e){return!1}},Ra=ae("Date"),Oa=ae("File"),Pa=ae("Blob"),va=ae("FileList"),xa=n=>Lt(n)&&J(n.pipe),Na=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||J(n.append)&&((e=Sn(n))==="formdata"||e==="object"&&J(n.toString)&&n.toString()==="[object FormData]"))},_a=ae("URLSearchParams"),[ka,La,Da,Ba]=["ReadableStream","Request","Response","Headers"].map(ae),Ma=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Dt(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n=="undefined")return;let r,i;if(typeof n!="object"&&(n=[n]),Ze(n))for(r=0,i=n.length;r<i;r++)e.call(null,n[r],r,n);else{if(kt(n))return;let o=t?Object.getOwnPropertyNames(n):Object.keys(n),s=o.length,a;for(r=0;r<s;r++)a=o[r],e.call(null,n[a],a,n)}}function oo(n,e){if(kt(n))return null;e=e.toLowerCase();let t=Object.keys(n),r=t.length,i;for(;r-- >0;)if(i=t[r],e===i.toLowerCase())return i;return null}var Ue=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,so=n=>!Je(n)&&n!==Ue;function mr(){let{caseless:n,skipUndefined:e}=so(this)&&this||{},t={},r=(i,o)=>{let s=n&&oo(t,o)||o;wn(t[s])&&wn(i)?t[s]=mr(t[s],i):wn(i)?t[s]=mr({},i):Ze(i)?t[s]=i.slice():(!e||!Je(i))&&(t[s]=i)};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&Dt(arguments[i],r);return t}var Ua=(n,e,t,{allOwnKeys:r}={})=>(Dt(e,(i,o)=>{t&&J(i)?n[o]=_t(i,t):n[o]=i},{allOwnKeys:r}),n),Fa=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Ga=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},Ha=(n,e,t,r)=>{let i,o,s,a={};if(e=e||{},n==null)return e;do{for(i=Object.getOwnPropertyNames(n),o=i.length;o-- >0;)s=i[o],(!r||r(s,n,e))&&!a[s]&&(e[s]=n[s],a[s]=!0);n=t!==!1&&hr(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},Ka=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;let r=n.indexOf(e,t);return r!==-1&&r===t},Va=n=>{if(!n)return null;if(Ze(n))return n;let e=n.length;if(!io(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},Wa=(n=>e=>n&&e instanceof n)(typeof Uint8Array!="undefined"&&hr(Uint8Array)),$a=(n,e)=>{let r=(n&&n[bn]).call(n),i;for(;(i=r.next())&&!i.done;){let o=i.value;e.call(n,o[0],o[1])}},za=(n,e)=>{let t,r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},Ya=ae("HTMLFormElement"),ja=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),to=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),qa=ae("RegExp"),ao=(n,e)=>{let t=Object.getOwnPropertyDescriptors(n),r={};Dt(t,(i,o)=>{let s;(s=e(i,o,n))!==!1&&(r[o]=s||i)}),Object.defineProperties(n,r)},Xa=n=>{ao(n,(e,t)=>{if(J(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let r=n[t];if(J(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Ja=(n,e)=>{let t={},r=i=>{i.forEach(o=>{t[o]=!0})};return Ze(n)?r(n):r(String(n).split(e)),t},Za=()=>{},Qa=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e;function ec(n){return!!(n&&J(n.append)&&n[no]==="FormData"&&n[bn])}var tc=n=>{let e=new Array(10),t=(r,i)=>{if(Lt(r)){if(e.indexOf(r)>=0)return;if(kt(r))return r;if(!("toJSON"in r)){e[i]=r;let o=Ze(r)?[]:{};return Dt(r,(s,a)=>{let l=t(s,i+1);!Je(l)&&(o[a]=l)}),e[i]=void 0,o}}return r};return t(n,0)},nc=ae("AsyncFunction"),rc=n=>n&&(Lt(n)||J(n))&&J(n.then)&&J(n.catch),co=((n,e)=>n?setImmediate:e?((t,r)=>(Ue.addEventListener("message",({source:i,data:o})=>{i===Ue&&o===t&&r.length&&r.shift()()},!1),i=>{r.push(i),Ue.postMessage(t,"*")}))("axios@".concat(Math.random()),[]):t=>setTimeout(t))(typeof setImmediate=="function",J(Ue.postMessage)),ic=typeof queueMicrotask!="undefined"?queueMicrotask.bind(Ue):typeof process!="undefined"&&process.nextTick||co,oc=n=>n!=null&&J(n[bn]),d={isArray:Ze,isArrayBuffer:ro,isBuffer:kt,isFormData:Na,isArrayBufferView:Sa,isString:Ia,isNumber:io,isBoolean:Ca,isObject:Lt,isPlainObject:wn,isEmptyObject:Ta,isReadableStream:ka,isRequest:La,isResponse:Da,isHeaders:Ba,isUndefined:Je,isDate:Ra,isFile:Oa,isBlob:Pa,isRegExp:qa,isFunction:J,isStream:xa,isURLSearchParams:_a,isTypedArray:Wa,isFileList:va,forEach:Dt,merge:mr,extend:Ua,trim:Ma,stripBOM:Fa,inherits:Ga,toFlatObject:Ha,kindOf:Sn,kindOfTest:ae,endsWith:Ka,toArray:Va,forEachEntry:$a,matchAll:za,isHTMLForm:Ya,hasOwnProperty:to,hasOwnProp:to,reduceDescriptors:ao,freezeMethods:Xa,toObjectSet:Ja,toCamelCase:ja,noop:Za,toFiniteNumber:Qa,findKey:oo,global:Ue,isContextDefined:so,isSpecCompliantForm:ec,toJSONObject:tc,isAsyncFn:nc,isThenable:rc,setImmediate:co,asap:ic,isIterable:oc};function Qe(n,e,t,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}d.inherits(Qe,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:d.toJSONObject(this.config),code:this.code,status:this.status}}});var lo=Qe.prototype,uo={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{uo[n]={value:n}});Object.defineProperties(Qe,uo);Object.defineProperty(lo,"isAxiosError",{value:!0});Qe.from=(n,e,t,r,i,o)=>{let s=Object.create(lo);d.toFlatObject(n,s,function(u){return u!==Error.prototype},c=>c!=="isAxiosError");let a=n&&n.message?n.message:"Error",l=e==null&&n?n.code:e;return Qe.call(s,a,l,t,r,i),n&&s.cause==null&&Object.defineProperty(s,"cause",{value:n,configurable:!0}),s.name=n&&n.name||"Error",o&&Object.assign(s,o),s};var R=Qe;var Cn=null;function Er(n){return d.isPlainObject(n)||d.isArray(n)}function fo(n){return d.endsWith(n,"[]")?n.slice(0,-2):n}function po(n,e,t){return n?n.concat(e).map(function(i,o){return i=fo(i),!t&&o?"["+i+"]":i}).join(t?".":""):e}function sc(n){return d.isArray(n)&&!n.some(Er)}var ac=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function cc(n,e,t){if(!d.isObject(n))throw new TypeError("target must be an object");e=e||new(Cn||FormData),t=d.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(I,h){return!d.isUndefined(h[I])});let r=t.metaTokens,i=t.visitor||u,o=t.dots,s=t.indexes,l=(t.Blob||typeof Blob!="undefined"&&Blob)&&d.isSpecCompliantForm(e);if(!d.isFunction(i))throw new TypeError("visitor must be a function");function c(f){if(f===null)return"";if(d.isDate(f))return f.toISOString();if(d.isBoolean(f))return f.toString();if(!l&&d.isBlob(f))throw new R("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(f)||d.isTypedArray(f)?l&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,I,h){let O=f;if(f&&!h&&typeof f=="object"){if(d.endsWith(I,"{}"))I=r?I:I.slice(0,-2),f=JSON.stringify(f);else if(d.isArray(f)&&sc(f)||(d.isFileList(f)||d.endsWith(I,"[]"))&&(O=d.toArray(f)))return I=fo(I),O.forEach(function(T,N){!(d.isUndefined(T)||T===null)&&e.append(s===!0?po([I],N,o):s===null?I:I+"[]",c(T))}),!1}return Er(f)?!0:(e.append(po(h,I,o),c(f)),!1)}let p=[],w=Object.assign(ac,{defaultVisitor:u,convertValue:c,isVisitable:Er});function b(f,I){if(!d.isUndefined(f)){if(p.indexOf(f)!==-1)throw Error("Circular reference detected in "+I.join("."));p.push(f),d.forEach(f,function(O,x){(!(d.isUndefined(O)||O===null)&&i.call(e,O,d.isString(x)?x.trim():x,I,w))===!0&&b(O,I?I.concat(x):[x])}),p.pop()}}if(!d.isObject(n))throw new TypeError("data must be an object");return b(n),e}var Pe=cc;function go(n){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function mo(n,e){this._pairs=[],n&&Pe(n,this,e)}var ho=mo.prototype;ho.append=function(e,t){this._pairs.push([e,t])};ho.toString=function(e){let t=e?function(r){return e.call(this,r,go)}:go;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};var Tn=mo;function lc(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Bt(n,e,t){if(!e)return n;let r=t&&t.encode||lc;d.isFunction(t)&&(t={serialize:t});let i=t&&t.serialize,o;if(i?o=i(e,t):o=d.isURLSearchParams(e)?e.toString():new Tn(e,t).toString(r),o){let s=n.indexOf("#");s!==-1&&(n=n.slice(0,s)),n+=(n.indexOf("?")===-1?"?":"&")+o}return n}var yr=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){d.forEach(this.handlers,function(r){r!==null&&e(r)})}},Ar=yr;var Rn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Eo=typeof URLSearchParams!="undefined"?URLSearchParams:Tn;var yo=typeof FormData!="undefined"?FormData:null;var Ao=typeof Blob!="undefined"?Blob:null;var wo={isBrowser:!0,classes:{URLSearchParams:Eo,FormData:yo,Blob:Ao},protocols:["http","https","file","blob","url","data"]};var Sr={};ir(Sr,{hasBrowserEnv:()=>br,hasStandardBrowserEnv:()=>uc,hasStandardBrowserWebWorkerEnv:()=>dc,navigator:()=>wr,origin:()=>pc});var br=typeof window!="undefined"&&typeof document!="undefined",wr=typeof navigator=="object"&&navigator||void 0,uc=br&&(!wr||["ReactNative","NativeScript","NS"].indexOf(wr.product)<0),dc=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",pc=br&&window.location.href||"http://localhost";var U=C(C({},Sr),wo);function Ir(n,e){return Pe(n,new U.classes.URLSearchParams,C({visitor:function(t,r,i,o){return U.isNode&&d.isBuffer(t)?(this.append(r,t.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}function fc(n){return d.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function gc(n){let e={},t=Object.keys(n),r,i=t.length,o;for(r=0;r<i;r++)o=t[r],e[o]=n[o];return e}function mc(n){function e(t,r,i,o){let s=t[o++];if(s==="__proto__")return!0;let a=Number.isFinite(+s),l=o>=t.length;return s=!s&&d.isArray(i)?i.length:s,l?(d.hasOwnProp(i,s)?i[s]=[i[s],r]:i[s]=r,!a):((!i[s]||!d.isObject(i[s]))&&(i[s]=[]),e(t,r,i[s],o)&&d.isArray(i[s])&&(i[s]=gc(i[s])),!a)}if(d.isFormData(n)&&d.isFunction(n.entries)){let t={};return d.forEachEntry(n,(r,i)=>{e(fc(r),i,t,0)}),t}return null}var On=mc;function hc(n,e,t){if(d.isString(n))try{return(e||JSON.parse)(n),d.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}var Cr={transitional:Rn,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){let r=t.getContentType()||"",i=r.indexOf("application/json")>-1,o=d.isObject(e);if(o&&d.isHTMLForm(e)&&(e=new FormData(e)),d.isFormData(e))return i?JSON.stringify(On(e)):e;if(d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e)||d.isReadableStream(e))return e;if(d.isArrayBufferView(e))return e.buffer;if(d.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Ir(e,this.formSerializer).toString();if((a=d.isFileList(e))||r.indexOf("multipart/form-data")>-1){let l=this.env&&this.env.FormData;return Pe(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return o||i?(t.setContentType("application/json",!1),hc(e)):e}],transformResponse:[function(e){let t=this.transitional||Cr.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(d.isResponse(e)||d.isReadableStream(e))return e;if(e&&d.isString(e)&&(r&&!this.responseType||i)){let s=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(a){if(s)throw a.name==="SyntaxError"?R.from(a,R.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:U.classes.FormData,Blob:U.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],n=>{Cr.headers[n]={}});var et=Cr;var Ec=d.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),bo=n=>{let e={},t,r,i;return n&&n.split("\n").forEach(function(s){i=s.indexOf(":"),t=s.substring(0,i).trim().toLowerCase(),r=s.substring(i+1).trim(),!(!t||e[t]&&Ec[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e};var So=Symbol("internals");function Mt(n){return n&&String(n).trim().toLowerCase()}function Pn(n){return n===!1||n==null?n:d.isArray(n)?n.map(Pn):String(n)}function yc(n){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}var Ac=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function Tr(n,e,t,r,i){if(d.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!d.isString(e)){if(d.isString(r))return e.indexOf(r)!==-1;if(d.isRegExp(r))return r.test(e)}}function wc(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function bc(n,e){let t=d.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(i,o,s){return this[r].call(this,e,i,o,s)},configurable:!0})})}var tt=class{constructor(e){e&&this.set(e)}set(e,t,r){let i=this;function o(a,l,c){let u=Mt(l);if(!u)throw new Error("header name must be a non-empty string");let p=d.findKey(i,u);(!p||i[p]===void 0||c===!0||c===void 0&&i[p]!==!1)&&(i[p||l]=Pn(a))}let s=(a,l)=>d.forEach(a,(c,u)=>o(c,u,l));if(d.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(d.isString(e)&&(e=e.trim())&&!Ac(e))s(bo(e),t);else if(d.isObject(e)&&d.isIterable(e)){let a={},l,c;for(let u of e){if(!d.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(l=a[c])?d.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}s(a,t)}else e!=null&&o(t,e,r);return this}get(e,t){if(e=Mt(e),e){let r=d.findKey(this,e);if(r){let i=this[r];if(!t)return i;if(t===!0)return yc(i);if(d.isFunction(t))return t.call(this,i,r);if(d.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Mt(e),e){let r=d.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||Tr(this,this[r],r,t)))}return!1}delete(e,t){let r=this,i=!1;function o(s){if(s=Mt(s),s){let a=d.findKey(r,s);a&&(!t||Tr(r,r[a],a,t))&&(delete r[a],i=!0)}}return d.isArray(e)?e.forEach(o):o(e),i}clear(e){let t=Object.keys(this),r=t.length,i=!1;for(;r--;){let o=t[r];(!e||Tr(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){let t=this,r={};return d.forEach(this,(i,o)=>{let s=d.findKey(r,o);if(s){t[s]=Pn(i),delete t[o];return}let a=e?wc(o):String(o).trim();a!==o&&delete t[o],t[a]=Pn(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return d.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&d.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let r=new this(e);return t.forEach(i=>r.set(i)),r}static accessor(e){let r=(this[So]=this[So]={accessors:{}}).accessors,i=this.prototype;function o(s){let a=Mt(s);r[a]||(bc(i,s),r[a]=!0)}return d.isArray(e)?e.forEach(o):o(e),this}};tt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);d.reduceDescriptors(tt.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});d.freezeMethods(tt);var V=tt;function Ut(n,e){let t=this||et,r=e||t,i=V.from(r.headers),o=r.data;return d.forEach(n,function(a){o=a.call(t,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function Ft(n){return!!(n&&n.__CANCEL__)}function Io(n,e,t){R.call(this,n==null?"canceled":n,R.ERR_CANCELED,e,t),this.name="CanceledError"}d.inherits(Io,R,{__CANCEL__:!0});var ge=Io;function Gt(n,e,t){let r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new R("Request failed with status code "+t.status,[R.ERR_BAD_REQUEST,R.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Rr(n){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function Sc(n,e){n=n||10;let t=new Array(n),r=new Array(n),i=0,o=0,s;return e=e!==void 0?e:1e3,function(l){let c=Date.now(),u=r[o];s||(s=c),t[i]=l,r[i]=c;let p=o,w=0;for(;p!==i;)w+=t[p++],p=p%n;if(i=(i+1)%n,i===o&&(o=(o+1)%n),c-s<e)return;let b=u&&c-u;return b?Math.round(w*1e3/b):void 0}}var Co=Sc;function Ic(n,e){let t=0,r=1e3/e,i,o,s=(c,u=Date.now())=>{t=u,i=null,o&&(clearTimeout(o),o=null),n(...c)};return[(...c)=>{let u=Date.now(),p=u-t;p>=r?s(c,u):(i=c,o||(o=setTimeout(()=>{o=null,s(i)},r-p)))},()=>i&&s(i)]}var To=Ic;var nt=(n,e,t=3)=>{let r=0,i=Co(50,250);return To(o=>{let s=o.loaded,a=o.lengthComputable?o.total:void 0,l=s-r,c=i(l),u=s<=a;r=s;let p={loaded:s,total:a,progress:a?s/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-s)/c:void 0,event:o,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(p)},t)},Or=(n,e)=>{let t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},Pr=n=>(...e)=>d.asap(()=>n(...e));var Ro=U.hasStandardBrowserEnv?((n,e)=>t=>(t=new URL(t,U.origin),n.protocol===t.protocol&&n.host===t.host&&(e||n.port===t.port)))(new URL(U.origin),U.navigator&&/(msie|trident)/i.test(U.navigator.userAgent)):()=>!0;var Oo=U.hasStandardBrowserEnv?{write(n,e,t,r,i,o,s){if(typeof document=="undefined")return;let a=["".concat(n,"=").concat(encodeURIComponent(e))];d.isNumber(t)&&a.push("expires=".concat(new Date(t).toUTCString())),d.isString(r)&&a.push("path=".concat(r)),d.isString(i)&&a.push("domain=".concat(i)),o===!0&&a.push("secure"),d.isString(s)&&a.push("SameSite=".concat(s)),document.cookie=a.join("; ")},read(n){if(typeof document=="undefined")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+n+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(n){this.write(n,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function vr(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function xr(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function Ht(n,e,t){let r=!vr(e);return n&&(r||t==!1)?xr(n,e):e}var Po=n=>n instanceof V?C({},n):n;function ce(n,e){e=e||{};let t={};function r(c,u,p,w){return d.isPlainObject(c)&&d.isPlainObject(u)?d.merge.call({caseless:w},c,u):d.isPlainObject(u)?d.merge({},u):d.isArray(u)?u.slice():u}function i(c,u,p,w){if(d.isUndefined(u)){if(!d.isUndefined(c))return r(void 0,c,p,w)}else return r(c,u,p,w)}function o(c,u){if(!d.isUndefined(u))return r(void 0,u)}function s(c,u){if(d.isUndefined(u)){if(!d.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,p){if(p in e)return r(c,u);if(p in n)return r(void 0,c)}let l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(c,u,p)=>i(Po(c),Po(u),p,!0)};return d.forEach(Object.keys(C(C({},n),e)),function(u){let p=l[u]||i,w=p(n[u],e[u],u);d.isUndefined(w)&&p!==a||(t[u]=w)}),t}var vn=n=>{let e=ce({},n),{data:t,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=e;if(e.headers=s=V.from(s),e.url=Bt(Ht(e.baseURL,e.url,e.allowAbsoluteUrls),n.params,n.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),d.isFormData(t)){if(U.hasStandardBrowserEnv||U.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(d.isFunction(t.getHeaders)){let l=t.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,p])=>{c.includes(u.toLowerCase())&&s.set(u,p)})}}if(U.hasStandardBrowserEnv&&(r&&d.isFunction(r)&&(r=r(e)),r||r!==!1&&Ro(e.url))){let l=i&&o&&Oo.read(o);l&&s.set(i,l)}return e};var Cc=typeof XMLHttpRequest!="undefined",vo=Cc&&function(n){return new Promise(function(t,r){let i=vn(n),o=i.data,s=V.from(i.headers).normalize(),{responseType:a,onUploadProgress:l,onDownloadProgress:c}=i,u,p,w,b,f;function I(){b&&b(),f&&f(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(i.method.toUpperCase(),i.url,!0),h.timeout=i.timeout;function O(){if(!h)return;let T=V.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),W={data:!a||a==="text"||a==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:T,config:n,request:h};Gt(function($){t($),I()},function($){r($),I()},W),h=null}"onloadend"in h?h.onloadend=O:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(O)},h.onabort=function(){h&&(r(new R("Request aborted",R.ECONNABORTED,n,h)),h=null)},h.onerror=function(N){let W=N&&N.message?N.message:"Network Error",L=new R(W,R.ERR_NETWORK,n,h);L.event=N||null,r(L),h=null},h.ontimeout=function(){let N=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",W=i.transitional||Rn;i.timeoutErrorMessage&&(N=i.timeoutErrorMessage),r(new R(N,W.clarifyTimeoutError?R.ETIMEDOUT:R.ECONNABORTED,n,h)),h=null},o===void 0&&s.setContentType(null),"setRequestHeader"in h&&d.forEach(s.toJSON(),function(N,W){h.setRequestHeader(W,N)}),d.isUndefined(i.withCredentials)||(h.withCredentials=!!i.withCredentials),a&&a!=="json"&&(h.responseType=i.responseType),c&&([w,f]=nt(c,!0),h.addEventListener("progress",w)),l&&h.upload&&([p,b]=nt(l),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",b)),(i.cancelToken||i.signal)&&(u=T=>{h&&(r(!T||T.type?new ge(null,n,h):T),h.abort(),h=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));let x=Rr(i.url);if(x&&U.protocols.indexOf(x)===-1){r(new R("Unsupported protocol "+x+":",R.ERR_BAD_REQUEST,n));return}h.send(o||null)})};var Tc=(n,e)=>{let{length:t}=n=n?n.filter(Boolean):[];if(e||t){let r=new AbortController,i,o=function(c){if(!i){i=!0,a();let u=c instanceof Error?c:this.reason;r.abort(u instanceof R?u:new ge(u instanceof Error?u.message:u))}},s=e&&setTimeout(()=>{s=null,o(new R("timeout ".concat(e," of ms exceeded"),R.ETIMEDOUT))},e),a=()=>{n&&(s&&clearTimeout(s),s=null,n.forEach(c=>{c.unsubscribe?c.unsubscribe(o):c.removeEventListener("abort",o)}),n=null)};n.forEach(c=>c.addEventListener("abort",o));let{signal:l}=r;return l.unsubscribe=()=>d.asap(a),l}},xo=Tc;var Rc=function*(n,e){let t=n.byteLength;if(!e||t<e){yield n;return}let r=0,i;for(;r<t;)i=r+e,yield n.slice(r,i),r=i},Oc=function(n,e){return or(this,null,function*(){try{for(var t=Fi(Pc(n)),r,i,o;r=!(i=yield new De(t.next())).done;r=!1){let s=i.value;yield*ze(Rc(s,e))}}catch(i){o=[i]}finally{try{r&&(i=t.return)&&(yield new De(i.call(t)))}finally{if(o)throw o[0]}}})},Pc=function(n){return or(this,null,function*(){if(n[Symbol.asyncIterator]){yield*ze(n);return}let e=n.getReader();try{for(;;){let{done:t,value:r}=yield new De(e.read());if(t)break;yield r}}finally{yield new De(e.cancel())}})},Nr=(n,e,t,r)=>{let i=Oc(n,e),o=0,s,a=l=>{s||(s=!0,r&&r(l))};return new ReadableStream({async pull(l){try{let{done:c,value:u}=await i.next();if(c){a(),l.close();return}let p=u.byteLength;if(t){let w=o+=p;t(w)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),i.return()}},{highWaterMark:2})};var No=64*1024,{isFunction:xn}=d,vc=(({Request:n,Response:e})=>({Request:n,Response:e}))(d.global),{ReadableStream:_o,TextEncoder:ko}=d.global,Lo=(n,...e)=>{try{return!!n(...e)}catch(t){return!1}},xc=n=>{n=d.merge.call({skipUndefined:!0},vc,n);let{fetch:e,Request:t,Response:r}=n,i=e?xn(e):typeof fetch=="function",o=xn(t),s=xn(r);if(!i)return!1;let a=i&&xn(_o),l=i&&(typeof ko=="function"?(f=>I=>f.encode(I))(new ko):async f=>new Uint8Array(await new t(f).arrayBuffer())),c=o&&a&&Lo(()=>{let f=!1,I=new t(U.origin,{body:new _o,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!I}),u=s&&a&&Lo(()=>d.isReadableStream(new r("").body)),p={stream:u&&(f=>f.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!p[f]&&(p[f]=(I,h)=>{let O=I&&I[f];if(O)return O.call(I);throw new R("Response type '".concat(f,"' is not supported"),R.ERR_NOT_SUPPORT,h)})});let w=async f=>{if(f==null)return 0;if(d.isBlob(f))return f.size;if(d.isSpecCompliantForm(f))return(await new t(U.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(d.isArrayBufferView(f)||d.isArrayBuffer(f))return f.byteLength;if(d.isURLSearchParams(f)&&(f=f+""),d.isString(f))return(await l(f)).byteLength},b=async(f,I)=>{let h=d.toFiniteNumber(f.getContentLength());return h==null?w(I):h};return async f=>{let{url:I,method:h,data:O,signal:x,cancelToken:T,timeout:N,onDownloadProgress:W,onUploadProgress:L,responseType:$,headers:pe,withCredentials:wt="same-origin",fetchOptions:ie}=vn(f),Ce=e||fetch;$=$?($+"").toLowerCase():"text";let j=xo([x,T&&T.toAbortSignal()],N),bt=null,Le=j&&j.unsubscribe&&(()=>{j.unsubscribe()}),Ni;try{if(L&&c&&h!=="get"&&h!=="head"&&(Ni=await b(pe,O))!==0){let Re=new t(I,{method:"POST",body:O,duplex:"half"}),We;if(d.isFormData(O)&&(We=Re.headers.get("content-type"))&&pe.setContentType(We),Re.body){let[rr,un]=Or(Ni,nt(Pr(L)));O=Nr(Re.body,No,rr,un)}}d.isString(wt)||(wt=wt?"include":"omit");let fe=o&&"credentials"in t.prototype,_i=D(C({},ie),{signal:j,method:h.toUpperCase(),headers:pe.normalize().toJSON(),body:O,duplex:"half",credentials:fe?wt:void 0});bt=o&&new t(I,_i);let Te=await(o?Ce(bt,ie):Ce(I,_i)),ki=u&&($==="stream"||$==="response");if(u&&(W||ki&&Le)){let Re={};["status","statusText","headers"].forEach(Li=>{Re[Li]=Te[Li]});let We=d.toFiniteNumber(Te.headers.get("content-length")),[rr,un]=W&&Or(We,nt(Pr(W),!0))||[];Te=new r(Nr(Te.body,No,rr,()=>{un&&un(),Le&&Le()}),Re)}$=$||"text";let Ys=await p[d.findKey(p,$)||"text"](Te,f);return!ki&&Le&&Le(),await new Promise((Re,We)=>{Gt(Re,We,{data:Ys,headers:V.from(Te.headers),status:Te.status,statusText:Te.statusText,config:f,request:bt})})}catch(fe){throw Le&&Le(),fe&&fe.name==="TypeError"&&/Load failed|fetch/i.test(fe.message)?Object.assign(new R("Network Error",R.ERR_NETWORK,f,bt),{cause:fe.cause||fe}):R.from(fe,fe&&fe.code,f,bt)}}},Nc=new Map,_r=n=>{let e=n&&n.env||{},{fetch:t,Request:r,Response:i}=e,o=[r,i,t],s=o.length,a=s,l,c,u=Nc;for(;a--;)l=o[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:xc(e)),u=c;return c},Cp=_r();var kr={http:Cn,xhr:vo,fetch:{get:_r}};d.forEach(kr,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch(t){}Object.defineProperty(n,"adapterName",{value:e})}});var Do=n=>"- ".concat(n),kc=n=>d.isFunction(n)||n===null||n===!1;function Lc(n,e){n=d.isArray(n)?n:[n];let{length:t}=n,r,i,o={};for(let s=0;s<t;s++){r=n[s];let a;if(i=r,!kc(r)&&(i=kr[(a=String(r)).toLowerCase()],i===void 0))throw new R("Unknown adapter '".concat(a,"'"));if(i&&(d.isFunction(i)||(i=i.get(e))))break;o[a||"#"+s]=i}if(!i){let s=Object.entries(o).map(([l,c])=>"adapter ".concat(l," ")+(c===!1?"is not supported by the environment":"is not available in the build")),a=t?s.length>1?"since :\n"+s.map(Do).join("\n"):" "+Do(s[0]):"as no adapter specified";throw new R("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i}var Nn={getAdapter:Lc,adapters:kr};function Lr(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new ge(null,n)}function _n(n){return Lr(n),n.headers=V.from(n.headers),n.data=Ut.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),Nn.getAdapter(n.adapter||et.adapter,n)(n).then(function(r){return Lr(n),r.data=Ut.call(n,n.transformResponse,r),r.headers=V.from(r.headers),r},function(r){return Ft(r)||(Lr(n),r&&r.response&&(r.response.data=Ut.call(n,n.transformResponse,r.response),r.response.headers=V.from(r.response.headers))),Promise.reject(r)})}var kn="1.13.2";var Ln={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{Ln[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});var Bo={};Ln.transitional=function(e,t,r){function i(o,s){return"[Axios v"+kn+"] Transitional option '"+o+"'"+s+(r?". "+r:"")}return(o,s,a)=>{if(e===!1)throw new R(i(s," has been removed"+(t?" in "+t:"")),R.ERR_DEPRECATED);return t&&!Bo[s]&&(Bo[s]=!0,console.warn(i(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(o,s,a):!0}};Ln.spelling=function(e){return(t,r)=>(console.warn("".concat(r," is likely a misspelling of ").concat(e)),!0)};function Dc(n,e,t){if(typeof n!="object")throw new R("options must be an object",R.ERR_BAD_OPTION_VALUE);let r=Object.keys(n),i=r.length;for(;i-- >0;){let o=r[i],s=e[o];if(s){let a=n[o],l=a===void 0||s(a,o,n);if(l!==!0)throw new R("option "+o+" must be "+l,R.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new R("Unknown option "+o,R.ERR_BAD_OPTION)}}var Kt={assertOptions:Dc,validators:Ln};var me=Kt.validators,rt=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ar,response:new Ar}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;let o=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+="\n"+o):r.stack=o}catch(s){}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=ce(this.defaults,t);let{transitional:r,paramsSerializer:i,headers:o}=t;r!==void 0&&Kt.assertOptions(r,{silentJSONParsing:me.transitional(me.boolean),forcedJSONParsing:me.transitional(me.boolean),clarifyTimeoutError:me.transitional(me.boolean)},!1),i!=null&&(d.isFunction(i)?t.paramsSerializer={serialize:i}:Kt.assertOptions(i,{encode:me.function,serialize:me.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Kt.assertOptions(t,{baseUrl:me.spelling("baseURL"),withXsrfToken:me.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&d.merge(o.common,o[t.method]);o&&d.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),t.headers=V.concat(s,o);let a=[],l=!0;this.interceptors.request.forEach(function(I){typeof I.runWhen=="function"&&I.runWhen(t)===!1||(l=l&&I.synchronous,a.unshift(I.fulfilled,I.rejected))});let c=[];this.interceptors.response.forEach(function(I){c.push(I.fulfilled,I.rejected)});let u,p=0,w;if(!l){let f=[_n.bind(this),void 0];for(f.unshift(...a),f.push(...c),w=f.length,u=Promise.resolve(t);p<w;)u=u.then(f[p++],f[p++]);return u}w=a.length;let b=t;for(;p<w;){let f=a[p++],I=a[p++];try{b=f(b)}catch(h){I.call(this,h);break}}try{u=_n.call(this,b)}catch(f){return Promise.reject(f)}for(p=0,w=c.length;p<w;)u=u.then(c[p++],c[p++]);return u}getUri(e){e=ce(this.defaults,e);let t=Ht(e.baseURL,e.url,e.allowAbsoluteUrls);return Bt(t,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){rt.prototype[e]=function(t,r){return this.request(ce(r||{},{method:e,url:t,data:(r||{}).data}))}});d.forEach(["post","put","patch"],function(e){function t(r){return function(o,s,a){return this.request(ce(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}rt.prototype[e]=t(),rt.prototype[e+"Form"]=t(!0)});var Vt=rt;var Dr=class n{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(o){t=o});let r=this;this.promise.then(i=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o,s=new Promise(a=>{r.subscribe(a),o=a}).then(i);return s.cancel=function(){r.unsubscribe(o)},s},e(function(o,s,a){r.reason||(r.reason=new ge(o,s,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new n(function(i){e=i}),cancel:e}}},Mo=Dr;function Br(n){return function(t){return n.apply(null,t)}}function Mr(n){return d.isObject(n)&&n.isAxiosError===!0}var Ur={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ur).forEach(([n,e])=>{Ur[e]=n});var Uo=Ur;function Fo(n){let e=new Vt(n),t=_t(Vt.prototype.request,e);return d.extend(t,Vt.prototype,e,{allOwnKeys:!0}),d.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return Fo(ce(n,i))},t}var H=Fo(et);H.Axios=Vt;H.CanceledError=ge;H.CancelToken=Mo;H.isCancel=Ft;H.VERSION=kn;H.toFormData=Pe;H.AxiosError=R;H.Cancel=H.CanceledError;H.all=function(e){return Promise.all(e)};H.spread=Br;H.isAxiosError=Mr;H.mergeConfig=ce;H.AxiosHeaders=V;H.formToJSON=n=>On(d.isHTMLForm(n)?new FormData(n):n);H.getAdapter=Nn.getAdapter;H.HttpStatusCode=Uo;H.default=H;var Wt=H;var{Axios:If,AxiosError:Cf,CanceledError:Tf,isCancel:Rf,CancelToken:Of,VERSION:Pf,all:vf,Cancel:xf,isAxiosError:Nf,spread:_f,toFormData:kf,AxiosHeaders:Lf,HttpStatusCode:Df,formToJSON:Bf,getAdapter:Mf,mergeConfig:Uf}=Wt;var ne={NETWORK_ERROR:"network_error",API_ERROR:"api_error",AUTH_REQUIRED:"auth_required",TOKEN_EXPIRED:"token_expired",NOT_FOUND:"not_found",VALIDATION_ERROR:"validation_error",CIRCUIT_BREAKER:"circuit_breaker",PAYMENT_FAILED:"payment_failed",CARD_DECLINED:"card_declined",SESSION_EXPIRED:"session_expired",RATE_LIMITED:"rate_limited",TIMEOUT:"timeout",UNKNOWN:"unknown"},le=class extends Error{constructor(e,t){var r;super(e),this.name="TagadaError",this.code=t.code,this.statusCode=t.statusCode,this.retryable=(r=t.retryable)!=null?r:!1,this.details=t.details,Object.setPrototypeOf(this,new.target.prototype)}},we=class extends le{constructor(e,t,r){var i,o;super(e,{code:(i=r==null?void 0:r.code)!=null?i:ne.API_ERROR,statusCode:t,retryable:(o=r==null?void 0:r.retryable)!=null?o:t>=500,details:r==null?void 0:r.details}),this.name="TagadaApiError"}},it=class extends le{constructor(e="Network request failed"){super(e,{code:ne.NETWORK_ERROR,retryable:!0}),this.name="TagadaNetworkError"}},ot=class extends le{constructor(e="Authentication required",t=401){super(e,{code:ne.AUTH_REQUIRED,statusCode:t,retryable:!1}),this.name="TagadaAuthError"}},Dn=class extends le{constructor(e,t){super(e,{code:ne.VALIDATION_ERROR,statusCode:400,retryable:!1,details:t}),this.name="TagadaValidationError"}},st=class extends le{constructor(e){super(e,{code:ne.CIRCUIT_BREAKER,retryable:!1}),this.name="TagadaCircuitBreakerError"}};var at=class{constructor(e){this.currentToken=null;this.tokenProvider=null;this.requestHistory=new Map;this.WINDOW_MS=5e3;this.MAX_REQUESTS=30;this.axios=Wt.create({baseURL:e.baseURL,timeout:e.timeout||6e4,headers:C({"Content-Type":"application/json"},e.headers)}),typeof setInterval!="undefined"&&setInterval(()=>this.cleanupHistory(),1e4),this.axios.interceptors.request.use(async t=>{var r,i;if(t.url)try{this.checkRequestLimit("".concat((r=t.method)==null?void 0:r.toUpperCase(),":").concat(t.url))}catch(o){return console.error("[SDK] \u{1F6D1} Request blocked by Circuit Breaker:",o),Promise.reject(o)}if(!t.skipAuth&&!this.currentToken&&this.tokenProvider)try{console.log("[SDK] Waiting for token...");let o=await this.tokenProvider();o&&(this.updateToken(o),t.headers["x-cms-token"]=o)}catch(o){console.error("[SDK] Failed to get token from provider:",o)}return!t.skipAuth&&this.currentToken&&(t.headers["x-cms-token"]=this.currentToken),console.log("[SDK] Making ".concat((i=t.method)==null?void 0:i.toUpperCase()," request to: ").concat(t.baseURL||"").concat(t.url)),t},t=>(console.error("[SDK] Request error:",t),Promise.reject(t instanceof Error?t:new Error(String(t))))),this.axios.interceptors.response.use(t=>t,t=>(console.error("[SDK] Response error:",t.message),t instanceof le?Promise.reject(t):Wt.isAxiosError(t)?Promise.reject(this.toTagadaError(t)):Promise.reject(t instanceof Error?t:new Error(String(t)))))}setTokenProvider(e){this.tokenProvider=e}async get(e,t){return(await this.axios.get(e,t)).data}async post(e,t,r){return(await this.axios.post(e,t,r)).data}async put(e,t,r){return(await this.axios.put(e,t,r)).data}async patch(e,t,r){return(await this.axios.patch(e,t,r)).data}async delete(e,t){return(await this.axios.delete(e,t)).data}setHeader(e,t){this.axios.defaults.headers.common[e]=t}removeHeader(e){delete this.axios.defaults.headers.common[e]}updateToken(e){this.currentToken=e,e?this.setHeader("x-cms-token",e):(this.removeHeader("x-cms-token"),console.log("[SDK] Token removed from ApiClient"))}getCurrentToken(){return this.currentToken}updateConfig(e){e.baseURL&&(this.axios.defaults.baseURL=e.baseURL),e.timeout&&(this.axios.defaults.timeout=e.timeout),e.headers&&Object.assign(this.axios.defaults.headers.common,e.headers),console.log("[SDK] ApiClient configuration updated")}checkRequestLimit(e){let t=Date.now(),r=this.requestHistory.get(e);if(!r){this.requestHistory.set(e,{count:1,firstRequestTime:t});return}if(t-r.firstRequestTime>this.WINDOW_MS){this.requestHistory.set(e,{count:1,firstRequestTime:t});return}if(r.count++,r.count>this.MAX_REQUESTS)throw new st("Circuit Breaker: Too many requests to ".concat(e," (").concat(r.count," in ").concat(this.WINDOW_MS,"ms)"))}cleanupHistory(){let e=Date.now();for(let[t,r]of this.requestHistory.entries())e-r.firstRequestTime>this.WINDOW_MS&&this.requestHistory.delete(t)}toTagadaError(e){var o,s,a,l,c;let t=(o=e.response)==null?void 0:o.status,r=(s=e.response)==null?void 0:s.data,i=(l=(a=r==null?void 0:r.message)!=null?a:r==null?void 0:r.error)!=null?l:e.message;return e.response?t===401||t===403?new ot(i,t):t===429?new we(i,429,{code:ne.RATE_LIMITED,retryable:!0}):t===404?new we(i,404,{code:ne.NOT_FOUND,retryable:!1}):new we(i,t!=null?t:0,{code:(c=r==null?void 0:r.code)!=null?c:ne.API_ERROR,details:r,retryable:(t!=null?t:0)>=500}):e.code==="ECONNABORTED"?new we("Request timed out",0,{code:ne.TIMEOUT,retryable:!0}):new it(i)}};var Bc="2.0.6",Mc=500,Go="user-agent",ft="",Ho="?",F={FUNCTION:"function",OBJECT:"object",STRING:"string",UNDEFINED:"undefined"},Z="browser",be="cpu",ye="device",ue="engine",te="os",dt="result",E="name",g="type",y="vendor",A="version",q="architecture",Qt="major",m="model",Jt="console",P="mobile",_="tablet",K="smarttv",he="wearable",Bn="xr",Zt="embedded",ct="inapp",Zr="brands",Ge="formFactors",Qr="fullVersionList",pt="platform",ei="platformVersion",Vn="bitness",_e="sec-ch-ua",Uc=_e+"-full-version-list",Fc=_e+"-arch",Gc=_e+"-"+Vn,Hc=_e+"-form-factors",Kc=_e+"-"+P,Vc=_e+"-"+m,ts=_e+"-"+pt,Wc=ts+"-version",ns=[Zr,Qr,P,m,pt,ei,q,Ge,Vn],Mn="Amazon",lt="Apple",Ko="ASUS",Vo="BlackBerry",Fe="Google",Wo="Huawei",Fr="Lenovo",$o="Honor",Un="LG",Gr="Microsoft",Hr="Motorola",Kr="Nvidia",zo="OnePlus",Vr="OPPO",$t="Samsung",Yo="Sharp",zt="Sony",Wr="Xiaomi",$r="Zebra",jo="Chrome",qo="Chromium",ve="Chromecast",Gn="Edge",Yt="Firefox",jt="Opera",zr="Facebook",Xo="Sogou",ut="Mobile ",qt=" Browser",Xr="Windows",$c=typeof window!==F.UNDEFINED,Q=$c&&window.navigator?window.navigator:void 0,xe=Q&&Q.userAgentData?Q.userAgentData:void 0,zc=function(n,e){var t={},r=e;if(!Hn(e)){r={};for(var i in e)for(var o in e[i])r[o]=e[i][o].concat(r[o]?r[o]:[])}for(var s in n)t[s]=r[s]&&r[s].length%2===0?r[s].concat(n[s]):n[s];return t},Wn=function(n){for(var e={},t=0;t<n.length;t++)e[n[t].toUpperCase()]=n[t];return e},Jr=function(n,e){if(typeof n===F.OBJECT&&n.length>0){for(var t in n)if(Ne(e)==Ne(n[t]))return!0;return!1}return en(n)?Ne(e)==Ne(n):!1},Hn=function(n,e){for(var t in n)return/^(browser|cpu|device|engine|os)$/.test(t)||(e?Hn(n[t]):!1)},en=function(n){return typeof n===F.STRING},Yr=function(n){if(n){for(var e=[],t=gt(/\\?\"/g,n).split(","),r=0;r<t.length;r++)if(t[r].indexOf(";")>-1){var i=Kn(t[r]).split(";v=");e[r]={brand:i[0],version:i[1]}}else e[r]=Kn(t[r]);return e}},Ne=function(n){return en(n)?n.toLowerCase():n},jr=function(n){return en(n)?gt(/[^\d\.]/g,n).split(".")[0]:void 0},Se=function(n){for(var e in n)if(n.hasOwnProperty(e)){var t=n[e];typeof t==F.OBJECT&&t.length==2?this[t[0]]=t[1]:this[t]=void 0}return this},gt=function(n,e){return en(e)?e.replace(n,ft):e},Xt=function(n){return gt(/\\?\"/g,n)},Kn=function(n,e){return n=gt(/^\s\s*/,String(n)),typeof e===F.UNDEFINED?n:n.substring(0,e)},qr=function(n,e){if(!(!n||!e))for(var t=0,r,i,o,s,a,l;t<e.length&&!a;){var c=e[t],u=e[t+1];for(r=i=0;r<c.length&&!a&&c[r];)if(a=c[r++].exec(n),a)for(o=0;o<u.length;o++)l=a[++i],s=u[o],typeof s===F.OBJECT&&s.length>0?s.length===2?typeof s[1]==F.FUNCTION?this[s[0]]=s[1].call(this,l):this[s[0]]=s[1]:s.length>=3&&(typeof s[1]===F.FUNCTION&&!(s[1].exec&&s[1].test)?s.length>3?this[s[0]]=l?s[1].apply(this,s.slice(2)):void 0:this[s[0]]=l?s[1].call(this,l,s[2]):void 0:s.length==3?this[s[0]]=l?l.replace(s[1],s[2]):void 0:s.length==4?this[s[0]]=l?s[3].call(this,l.replace(s[1],s[2])):void 0:s.length>4&&(this[s[0]]=l?s[3].apply(this,[l.replace(s[1],s[2])].concat(s.slice(4))):void 0)):this[s]=l||void 0;t+=2}},Ee=function(n,e){for(var t in e)if(typeof e[t]===F.OBJECT&&e[t].length>0){for(var r=0;r<e[t].length;r++)if(Jr(e[t][r],n))return t===Ho?void 0:t}else if(Jr(e[t],n))return t===Ho?void 0:t;return e.hasOwnProperty("*")?e["*"]:n},Jo={ME:"4.90","NT 3.51":"3.51","NT 4.0":"4.0",2e3:["5.0","5.01"],XP:["5.1","5.2"],Vista:"6.0",7:"6.1",8:"6.2","8.1":"6.3",10:["6.4","10.0"],NT:""},Zo={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},Yc={Chrome:"Google Chrome",Edge:"Microsoft Edge","Edge WebView2":"Microsoft Edge WebView2","Chrome WebView":"Android WebView","Chrome Headless":"HeadlessChrome","Huawei Browser":"HuaweiBrowser","MIUI Browser":"Miui Browser","Opera Mobi":"OperaMobile",Yandex:"YaBrowser"},Qo={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[A,[E,ut+"Chrome"]],[/webview.+edge\/([\w\.]+)/i],[A,[E,Gn+" WebView"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[A,[E,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[E,A],[/opios[\/ ]+([\w\.]+)/i],[A,[E,jt+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[A,[E,jt+" GX"]],[/\bopr\/([\w\.]+)/i],[A,[E,jt]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[A,[E,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[A,[E,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser|palemoon)\/([-\w\.]+)/i,/(heytap|ovi|115|surf|qwant)browser\/([\d\.]+)/i,/(qwant)(?:ios|mobile)\/([\d\.]+)/i,/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i],[E,A],[/quark(?:pc)?\/([-\w\.]+)/i],[A,[E,"Quark"]],[/\bddg\/([\w\.]+)/i],[A,[E,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[A,[E,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[A,[E,"WeChat"]],[/konqueror\/([\w\.]+)/i],[A,[E,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[A,[E,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[A,[E,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[A,[E,"Smart "+Fr+qt]],[/(avast|avg)\/([\w\.]+)/i],[[E,/(.+)/,"$1 Secure"+qt],A],[/\bfocus\/([\w\.]+)/i],[A,[E,Yt+" Focus"]],[/\bopt\/([\w\.]+)/i],[A,[E,jt+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[A,[E,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[A,[E,"Dolphin"]],[/coast\/([\w\.]+)/i],[A,[E,jt+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[A,[E,"MIUI"+qt]],[/fxios\/([\w\.-]+)/i],[A,[E,ut+Yt]],[/\bqihoobrowser\/?([\w\.]*)/i],[A,[E,"360"]],[/\b(qq)\/([\w\.]+)/i],[[E,/(.+)/,"$1Browser"],A],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[E,/(.+)/,"$1"+qt],A],[/samsungbrowser\/([\w\.]+)/i],[A,[E,$t+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[A,[E,Xo+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[E,Xo+" Mobile"],A],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[E,A],[/(lbbrowser|rekonq)/i],[E],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[A,E],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[E,zr],A,[g,ct]],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(bing)(?:web|sapphire)\/([\w\.]+)/i,/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i],[E,A,[g,ct]],[/\bgsa\/([\w\.]+) .*safari\//i],[A,[E,"GSA"],[g,ct]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[A,[E,"TikTok"],[g,ct]],[/\[(linkedin)app\]/i],[E,[g,ct]],[/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i],[[E,/(.+)/,"Zalo"],A,[g,ct]],[/(chromium)[\/ ]([-\w\.]+)/i],[E,A],[/headlesschrome(?:\/([\w\.]+)| )/i],[A,[E,jo+" Headless"]],[/wv\).+chrome\/([\w\.]+).+edgw\//i],[A,[E,Gn+" WebView2"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[E,jo+" WebView"],A],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[A,[E,"Android"+qt]],[/chrome\/([\w\.]+) mobile/i],[A,[E,ut+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[E,A],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[A,[E,ut+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[E,ut+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[A,E],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[E,[A,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[E,A],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[E,ut+Yt],A],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[E,"Netscape"],A],[/(wolvic|librewolf)\/([\w\.]+)/i],[E,A],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[A,[E,Yt+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+(?= .+rv\:.+gecko\/\d+)|[0-4][\w\.]+(?!.+compatible))/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[E,[A,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[E,[A,/[^\d\.]+./,ft]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[q,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[q,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[q,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[q,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[q,"arm"]],[/ sun4\w[;\)]/i],[[q,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i,/((ppc|powerpc)(64)?)( mac|;|\))/i,/(?:osf1|[freopnt]{3,4}bsd) (alpha)/i],[[q,/ower/,ft,Ne]],[/mc680.0/i],[[q,"68k"]],[/winnt.+\[axp/i],[[q,"alpha"]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[m,[y,$t],[g,_]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,/sec-(sgh\w+)/i],[m,[y,$t],[g,P]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)[\/\);]/i],[m,[y,lt],[g,P]],[/\b(?:ios|apple\w+)\/.+[\(\/](ipad)/i,/\b(ipad)[\d,]*[;\] ].+(mac |i(pad)?)os/i],[m,[y,lt],[g,_]],[/(macintosh);/i],[m,[y,lt]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[m,[y,Yo],[g,P]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[m,[y,$o],[g,_]],[/honor([-\w ]+)[;\)]/i],[m,[y,$o],[g,P]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[m,[y,Wo],[g,_]],[/(?:huawei) ?([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i],[m,[y,Wo],[g,P]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b(?:xiao)?((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[m,/_/g," "],[y,Wr],[g,_]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note|max|cc)?[_ ]?(?:\d{0,2}\w?)[_ ]?(?:plus|se|lite|pro)?( 5g|lte)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[m,/_/g," "],[y,Wr],[g,P]],[/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[m,[y,zo],[g,P]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[m,[y,Vr],[g,P]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[m,[y,Ee,{OnePlus:["203","304","403","404","413","415"],"*":Vr}],[g,_]],[/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i],[m,[y,"BLU"],[g,P]],[/; vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[m,[y,"Vivo"],[g,P]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[m,[y,"Realme"],[g,P]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[m,[y,Fr],[g,_]],[/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i],[m,[y,Fr],[g,P]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i],[m,[y,Hr],[g,P]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[m,[y,Hr],[g,_]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[m,[y,Un],[g,_]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,/\blg-?([\d\w]+) bui/i],[m,[y,Un],[g,P]],[/(nokia) (t[12][01])/i],[y,m,[g,_]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*?))( bui|\)|;|\/)/i],[[m,/_/g," "],[g,P],[y,"Nokia"]],[/(pixel (c|tablet))\b/i],[m,[y,Fe],[g,_]],[/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i],[m,[y,Fe],[g,P]],[/(google) (pixelbook( go)?)/i],[y,m],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[m,[y,zt],[g,P]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[m,"Xperia Tablet"],[y,zt],[g,_]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[m,[y,Mn],[g,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[m,/(.+)/g,"Fire Phone $1"],[y,Mn],[g,P]],[/(playbook);[-\w\),; ]+(rim)/i],[m,y,[g,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/(?:blackberry|\(bb10;) (\w+)/i],[m,[y,Vo],[g,P]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[m,[y,Ko],[g,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[m,[y,Ko],[g,P]],[/(nexus 9)/i],[m,[y,"HTC"],[g,_]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[y,[m,/_/g," "],[g,P]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[m,[y,"TCL"],[g,_]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[m,[y,"TCL"],[g,P]],[/(itel) ((\w+))/i],[[y,Ne],m,[g,Ee,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[m,[y,"Acer"],[g,_]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[m,[y,"Meizu"],[g,P]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[m,[y,"Ulefone"],[g,P]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[m,[y,"Energizer"],[g,P]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[m,[y,"Cat"],[g,P]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[m,[y,"Smartfren"],[g,P]],[/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i],[m,[y,"Nothing"],[g,P]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[m,[y,"Archos"],[g,_]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[m,[y,"Archos"],[g,P]],[/; (n159v)/i],[m,[y,"HMD"],[g,P]],[/(imo) (tab \w+)/i,/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i],[y,m,[g,_]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (blu|hmd|imo|infinix|lava|oneplus|tcl|wiko)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(oppo) ?([\w ]+) bui/i,/(hisense) ([ehv][\w ]+)\)/i,/droid[^;]+; (philips)[_ ]([sv-x][\d]{3,4}[xz]?)/i],[y,m,[g,P]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[y,m,[g,_]],[/(surface duo)/i],[m,[y,Gr],[g,_]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[m,[y,"Fairphone"],[g,P]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[m,[y,Kr],[g,_]],[/(sprint) (\w+)/i],[y,m,[g,P]],[/(kin\.[onetw]{3})/i],[[m,/\./g," "],[y,Gr],[g,P]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[m,[y,$r],[g,_]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[m,[y,$r],[g,P]],[/(philips)[\w ]+tv/i,/smart-tv.+(samsung)/i],[y,[g,K]],[/hbbtv.+maple;(\d+)/i],[[m,/^/,"SmartTV"],[y,$t],[g,K]],[/(vizio)(?: |.+model\/)(\w+-\w+)/i,/tcast.+(lg)e?. ([-\w]+)/i],[y,m,[g,K]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[y,Un],[g,K]],[/(apple) ?tv/i],[y,[m,lt+" TV"],[g,K]],[/crkey.*devicetype\/chromecast/i],[[m,ve+" Third Generation"],[y,Fe],[g,K]],[/crkey.*devicetype\/([^/]*)/i],[[m,/^/,"Chromecast "],[y,Fe],[g,K]],[/fuchsia.*crkey/i],[[m,ve+" Nest Hub"],[y,Fe],[g,K]],[/crkey/i],[[m,ve],[y,Fe],[g,K]],[/(portaltv)/i],[m,[y,zr],[g,K]],[/droid.+aft(\w+)( bui|\))/i],[m,[y,Mn],[g,K]],[/(shield \w+ tv)/i],[m,[y,Kr],[g,K]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[m,[y,Yo],[g,K]],[/(bravia[\w ]+)( bui|\))/i],[m,[y,zt],[g,K]],[/(mi(tv|box)-?\w+) bui/i],[m,[y,Wr],[g,K]],[/Hbbtv.*(technisat) (.*);/i],[y,m,[g,K]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[y,/.+\/(\w+)/,"$1",Ee,{LG:"lge"}],[m,Kn],[g,K]],[/(playstation \w+)/i],[m,[y,zt],[g,Jt]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[m,[y,Gr],[g,Jt]],[/(ouya)/i,/(nintendo) (\w+)/i,/(retroid) (pocket ([^\)]+))/i],[y,m,[g,Jt]],[/droid.+; (shield)( bui|\))/i],[m,[y,Kr],[g,Jt]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[m,[y,$t],[g,he]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[y,m,[g,he]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[m,[y,Vr],[g,he]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[m,[y,lt],[g,he]],[/(opwwe\d{3})/i],[m,[y,zo],[g,he]],[/(moto 360)/i],[m,[y,Hr],[g,he]],[/(smartwatch 3)/i],[m,[y,zt],[g,he]],[/(g watch r)/i],[m,[y,Un],[g,he]],[/droid.+; (wt63?0{2,3})\)/i],[m,[y,$r],[g,he]],[/droid.+; (glass) \d/i],[m,[y,Fe],[g,Bn]],[/(pico) ([\w ]+) os\d/i],[y,m,[g,Bn]],[/(quest( \d| pro)?s?).+vr/i],[m,[y,zr],[g,Bn]],[/mobile vr; rv.+firefox/i],[[g,Bn]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[y,[g,Zt]],[/(aeobc)\b/i],[m,[y,Mn],[g,Zt]],[/(homepod).+mac os/i],[m,[y,lt],[g,Zt]],[/windows iot/i],[[g,Zt]],[/droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i],[m,[g,K]],[/\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i],[[g,K]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew|; hmsc).+?(mobile|vr|\d) safari/i],[m,[g,Ee,{mobile:"Mobile",xr:"VR","*":_}]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[g,_]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[g,P]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[m,[y,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[A,[E,Gn+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[E,A],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[A,[E,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[E,A],[/ladybird\//i],[[E,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[A,E]],os:[[/(windows nt) (6\.[23]); arm/i],[[E,/N/,"R"],[A,Ee,Jo]],[/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i],[E,A],[/windows nt ?([\d\.\)]*)(?!.+xbox)/i,/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i],[[A,/(;|\))/g,"",Ee,Jo],[E,Xr]],[/(windows ce)\/?([\d\.]*)/i],[E,A],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv|ios(?=.+ip(?:ad|hone))|ip(?:ad|hone)(?: |.+i(?:pad)?)os)[\/ ]([\w\.]+)/i,/cfnetwork\/.+darwin/i],[[A,/_/g,"."],[E,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i],[[E,"macOS"],[A,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[A,[E,ve+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[A,[E,ve+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[A,[E,ve+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[A,[E,ve+" Linux"]],[/crkey\/([\d\.]+)/i],[A,[E,ve]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[A,E],[/(ubuntu) ([\w\.]+) like android/i],[[E,/(.+)/,"$1 Touch"],A],[/(harmonyos)[\/ ]?([\d\.]*)/i,/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i],[E,A],[/\(bb(10);/i],[A,[E,Vo]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[A,[E,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[A,[E,Yt+" OS"]],[/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i],[A,[E,"webOS"]],[/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i],[[A,Ee,{25:"120",24:"108",23:"94",22:"87",6:"79",5:"68",4:"53",3:"38",2:"538",1:"537","*":"TV"}],[E,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[A,[E,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[E,"Chrome OS"],A],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/\b(aix)[; ]([1-9\.]{0,4})/i,/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) ?(r\d)?/i],[E,A],[/(sunos) ?([\d\.]*)/i],[[E,"Solaris"],A],[/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[E,A]]},Fn=function(){var n={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return Se.call(n.init,[[Z,[E,A,Qt,g]],[be,[q]],[ye,[g,m,y]],[ue,[E,A]],[te,[E,A]]]),Se.call(n.isIgnore,[[Z,[A,Qt]],[ue,[A]],[te,[A]]]),Se.call(n.isIgnoreRgx,[[Z,/ ?browser$/i],[te,/ ?os$/i]]),Se.call(n.toString,[[Z,[E,A]],[be,[q]],[ye,[y,m]],[ue,[E,A]],[te,[E,A]]]),n}(),jc=function(n,e){var t=Fn.init[e],r=Fn.isIgnore[e]||0,i=Fn.isIgnoreRgx[e]||0,o=Fn.toString[e]||0;function s(){Se.call(this,t)}return s.prototype.getItem=function(){return n},s.prototype.withClientHints=function(){return xe?xe.getHighEntropyValues(ns).then(function(a){return n.setCH(new rs(a,!1)).parseCH().get()}):n.parseCH().get()},s.prototype.withFeatureCheck=function(){return n.detectFeature().get()},e!=dt&&(s.prototype.is=function(a){var l=!1;for(var c in this)if(this.hasOwnProperty(c)&&!Jr(r,c)&&Ne(i?gt(i,this[c]):this[c])==Ne(i?gt(i,a):a)){if(l=!0,a!=F.UNDEFINED)break}else if(a==F.UNDEFINED&&l){l=!l;break}return l},s.prototype.toString=function(){var a=ft;for(var l in o)typeof this[o[l]]!==F.UNDEFINED&&(a+=(a?" ":ft)+this[o[l]]);return a||F.UNDEFINED}),xe||(s.prototype.then=function(a){var l=this,c=function(){for(var p in l)l.hasOwnProperty(p)&&(this[p]=l[p])};c.prototype={is:s.prototype.is,toString:s.prototype.toString};var u=new c;return a(u),u}),new s};function rs(n,e){if(n=n||{},Se.call(this,ns),e)Se.call(this,[[Zr,Yr(n[_e])],[Qr,Yr(n[Uc])],[P,/\?1/.test(n[Kc])],[m,Xt(n[Vc])],[pt,Xt(n[ts])],[ei,Xt(n[Wc])],[q,Xt(n[Fc])],[Ge,Yr(n[Hc])],[Vn,Xt(n[Gc])]]);else for(var t in n)this.hasOwnProperty(t)&&typeof n[t]!==F.UNDEFINED&&(this[t]=n[t])}function es(n,e,t,r){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(Q&&Q.userAgent==this.ua)switch(this.itemType){case Z:Q.brave&&typeof Q.brave.isBrave==F.FUNCTION&&this.set(E,"Brave");break;case ye:!this.get(g)&&xe&&xe[P]&&this.set(g,P),this.get(m)=="Macintosh"&&Q&&typeof Q.standalone!==F.UNDEFINED&&Q.maxTouchPoints&&Q.maxTouchPoints>2&&this.set(m,"iPad").set(g,_);break;case te:!this.get(E)&&xe&&xe[pt]&&this.set(E,xe[pt]);break;case dt:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set(Z,o(Z)).set(be,o(be)).set(ye,o(ye)).set(ue,o(ue)).set(te,o(te))}return this},this.parseUA=function(){switch(this.itemType!=dt&&qr.call(this.data,this.ua,this.rgxMap),this.itemType){case Z:this.set(Qt,jr(this.get(A)));break;case te:if(this.get(E)=="iOS"&&this.get(A)=="18.6"){var i=/\) Version\/([\d\.]+)/.exec(this.ua);i&&parseInt(i[1].substring(0,2),10)>=26&&this.set(A,i[1])}break}return this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case Z:case ue:var s=i[Qr]||i[Zr],a;if(s)for(var l=0;l<s.length;l++){var c=s[l].brand||s[l],u=s[l].version;this.itemType==Z&&!/not.a.brand/i.test(c)&&(!a||/Chrom/.test(a)&&c!=qo||a==Gn&&/WebView2/.test(c))&&(c=Ee(c,Yc),a=this.get(E),a&&!/Chrom/.test(a)&&/Chrom/.test(c)||this.set(E,c).set(A,u).set(Qt,jr(u)),a=c),this.itemType==ue&&c==qo&&this.set(A,u)}break;case be:var p=i[q];p&&(p&&i[Vn]=="64"&&(p+="64"),qr.call(this.data,p+";",o));break;case ye:if(i[P]&&this.set(g,P),i[m]&&(this.set(m,i[m]),!this.get(g)||!this.get(y))){var w={};qr.call(w,"droid 9; "+i[m]+")",o),!this.get(g)&&w.type&&this.set(g,w.type),!this.get(y)&&w.vendor&&this.set(y,w.vendor)}if(i[Ge]){var b;if(typeof i[Ge]!="string")for(var f=0;!b&&f<i[Ge].length;)b=Ee(i[Ge][f++],Zo);else b=Ee(i[Ge],Zo);this.set(g,b)}break;case te:var I=i[pt];if(I){var h=i[ei];I==Xr&&(h=parseInt(jr(h),10)>=13?"11":"10"),this.set(E,I).set(A,h)}this.get(E)==Xr&&i[m]=="Xbox"&&this.set(E,"Xbox").set(A,void 0);break;case dt:var O=this.data,x=function(T){return O[T].getItem().setCH(i).parseCH().get()};this.set(Z,x(Z)).set(be,x(be)).set(ye,x(ye)).set(ue,x(ue)).set(te,x(te))}return this},Se.call(this,[["itemType",n],["ua",e],["uaCH",r],["rgxMap",t],["data",jc(this,n)]]),this}function re(n,e,t){if(typeof n===F.OBJECT?(Hn(n,!0)?(typeof e===F.OBJECT&&(t=e),e=n):(t=n,e=void 0),n=void 0):typeof n===F.STRING&&!Hn(e,!0)&&(t=e,e=void 0),t)if(typeof t.append===F.FUNCTION){var r={};t.forEach(function(u,p){r[String(p).toLowerCase()]=u}),t=r}else{var i={};for(var o in t)t.hasOwnProperty(o)&&(i[String(o).toLowerCase()]=t[o]);t=i}if(!(this instanceof re))return new re(n,e,t).getResult();var s=typeof n===F.STRING?n:t&&t[Go]?t[Go]:Q&&Q.userAgent?Q.userAgent:ft,a=new rs(t,!0),l=e?zc(Qo,e):Qo,c=function(u){return u==dt?function(){return new es(u,s,l,a).set("ua",s).set(Z,this.getBrowser()).set(be,this.getCPU()).set(ye,this.getDevice()).set(ue,this.getEngine()).set(te,this.getOS()).get()}:function(){return new es(u,s,l[u],a).parseUA().get()}};return Se.call(this,[["getBrowser",c(Z)],["getCPU",c(be)],["getDevice",c(ye)],["getEngine",c(ue)],["getOS",c(te)],["getResult",c(dt)],["getUA",function(){return s}],["setUA",function(u){return en(u)&&(s=Kn(u,Mc)),this}]]).setUA(s),this}re.VERSION=Bc;re.BROWSER=Wn([E,A,Qt,g]);re.CPU=Wn([q]);re.DEVICE=Wn([m,y,g,Jt,P,K,_,he,Zt]);re.ENGINE=re.OS=Wn([E,A]);var Xf=Object.freeze({115:"115",2345:"2345",360:"360",ALIPAY:"Alipay",AMAYA:"Amaya",ANDROID:"Android Browser",ARORA:"Arora",AVANT:"Avant",AVAST:"Avast Secure Browser",AVG:"AVG Secure Browser",BAIDU:"Baidu Browser",BASILISK:"Basilisk",BING:"Bing",BLAZER:"Blazer",BOLT:"Bolt",BOWSER:"Bowser",BRAVE:"Brave",CAMINO:"Camino",CHIMERA:"Chimera",CHROME:"Chrome",CHROME_HEADLESS:"Chrome Headless",CHROME_MOBILE:"Mobile Chrome",CHROME_WEBVIEW:"Chrome WebView",CHROMIUM:"Chromium",COBALT:"Cobalt",COC_COC:"Coc Coc",CONKEROR:"Conkeror",DAUM:"Daum",DILLO:"Dillo",DOLPHIN:"Dolphin",DOOBLE:"Dooble",DORIS:"Doris",DRAGON:"Dragon",DUCKDUCKGO:"DuckDuckGo",ECOSIA:"Ecosia",EDGE:"Edge",EDGE_WEBVIEW:"Edge WebView",EDGE_WEBVIEW2:"Edge WebView2",EPIPHANY:"Epiphany",FACEBOOK:"Facebook",FALKON:"Falkon",FIREBIRD:"Firebird",FIREFOX:"Firefox",FIREFOX_FOCUS:"Firefox Focus",FIREFOX_MOBILE:"Mobile Firefox",FIREFOX_REALITY:"Firefox Reality",FENNEC:"Fennec",FLOCK:"Flock",FLOW:"Flow",GO:"GoBrowser",GOOGLE_SEARCH:"GSA",HELIO:"Helio",HEYTAP:"HeyTap",HONOR:"Honor",HUAWEI:"Huawei Browser",ICAB:"iCab",ICE:"ICE Browser",ICEAPE:"IceApe",ICECAT:"IceCat",ICEDRAGON:"IceDragon",ICEWEASEL:"IceWeasel",IE:"IE",INSTAGRAM:"Instagram",IRIDIUM:"Iridium",IRON:"Iron",JASMINE:"Jasmine",KONQUEROR:"Konqueror",KAKAO:"KakaoTalk",KHTML:"KHTML",K_MELEON:"K-Meleon",KLAR:"Klar",KLARNA:"Klarna",KINDLE:"Kindle",LENOVO:"Smart Lenovo Browser",LADYBIRD:"Ladybird",LG:"LG Browser",LIBREWOLF:"LibreWolf",LIEBAO:"LBBROWSER",LINE:"Line",LINKEDIN:"LinkedIn",LINKS:"Links",LUNASCAPE:"Lunascape",LYNX:"Lynx",MAEMO:"Maemo Browser",MAXTHON:"Maxthon",MIDORI:"Midori",MINIMO:"Minimo",MIUI:"MIUI Browser",MOZILLA:"Mozilla",MOSAIC:"Mosaic",NAVER:"Naver",NETFRONT:"NetFront",NETSCAPE:"Netscape",NETSURF:"Netsurf",NOKIA:"Nokia Browser",OBIGO:"Obigo",OCULUS:"Oculus Browser",OMNIWEB:"OmniWeb",OPERA:"Opera",OPERA_COAST:"Opera Coast",OPERA_GX:"Opera GX",OPERA_MINI:"Opera Mini",OPERA_MOBI:"Opera Mobi",OPERA_TABLET:"Opera Tablet",OPERA_TOUCH:"Opera Touch",OTTER:"Otter",OVI:"OviBrowser",PALEMOON:"PaleMoon",PHANTOMJS:"PhantomJS",PHOENIX:"Phoenix",PICOBROWSER:"Pico Browser",POLARIS:"Polaris",PUFFIN:"Puffin",QQ:"QQBrowser",QQ_LITE:"QQBrowserLite",QUARK:"Quark",QUPZILLA:"QupZilla",QUTEBROWSER:"qutebrowser",QWANT:"Qwant",REKONQ:"rekonq",ROCKMELT:"Rockmelt",SAFARI:"Safari",SAFARI_MOBILE:"Mobile Safari",SAILFISH:"Sailfish Browser",SAMSUNG:"Samsung Internet",SEAMONKEY:"SeaMonkey",SILK:"Silk",SKYFIRE:"Skyfire",SLEIPNIR:"Sleipnir",SLIMBOAT:"SlimBoat",SLIMBROWSER:"SlimBrowser",SLIMJET:"Slimjet",SNAPCHAT:"Snapchat",SOGOU_EXPLORER:"Sogou Explorer",SOGOU_MOBILE:"Sogou Mobile",SURF:"Surf",SWIFTFOX:"Swiftfox",TESLA:"Tesla",TIKTOK:"TikTok",TIZEN:"Tizen Browser",TWITTER:"Twitter",UC:"UCBrowser",UP:"UP.Browser",VIVALDI:"Vivaldi",VIVO:"Vivo Browser",W3M:"w3m",WATERFOX:"Waterfox",WEBKIT:"WebKit",WECHAT:"WeChat",WEIBO:"Weibo",WHALE:"Whale",WOLVIC:"Wolvic",YANDEX:"Yandex",ZALO:"Zalo"});var tn=Object.freeze({CRAWLER:"crawler",CLI:"cli",EMAIL:"email",FETCHER:"fetcher",INAPP:"inapp",MEDIAPLAYER:"mediaplayer",LIBRARY:"library"}),is=Object.freeze({"68K":"68k",ALPHA:"alpha",ARM:"arm",ARM_64:"arm64",ARM_HF:"armhf",AVR:"avr",AVR_32:"avr32",IA64:"ia64",IRIX:"irix",IRIX_64:"irix64",MIPS:"mips",MIPS_64:"mips64",PA_RISC:"pa-risc",PPC:"ppc",SPARC:"sparc",SPARC_64:"sparc64",X86:"ia32",X86_64:"amd64"});var Jf=Object.freeze({CONSOLE:"console",DESKTOP:"desktop",EMBEDDED:"embedded",MOBILE:"mobile",SMARTTV:"smarttv",TABLET:"tablet",WEARABLE:"wearable",XR:"xr"});var Zf=Object.freeze({ACER:"Acer",ADVAN:"Advan",ALCATEL:"Alcatel",APPLE:"Apple",AMAZON:"Amazon",ARCHOS:"Archos",ASUS:"ASUS",ATT:"AT&T",BENQ:"BenQ",BLACKBERRY:"BlackBerry",BLU:"BLU",CAT:"Cat",DELL:"Dell",ENERGIZER:"Energizer",ESSENTIAL:"Essential",FACEBOOK:"Facebook",FAIRPHONE:"Fairphone",GEEKSPHONE:"GeeksPhone",GENERIC:"Generic",GOOGLE:"Google",HISENSE:"Hisense",HMD:"HMD",HP:"HP",HTC:"HTC",HUAWEI:"Huawei",IMO:"IMO",INFINIX:"Infinix",ITEL:"itel",JOLLA:"Jolla",KOBO:"Kobo",LAVA:"Lava",LENOVO:"Lenovo",LG:"LG",MEIZU:"Meizu",MICROMAX:"Micromax",MICROSOFT:"Microsoft",MOTOROLA:"Motorola",NEXIAN:"Nexian",NINTENDO:"Nintendo",NOKIA:"Nokia",NOTHING:"Nothing",NVIDIA:"Nvidia",ONEPLUS:"OnePlus",OPPO:"OPPO",OUYA:"Ouya",PALM:"Palm",PANASONIC:"Panasonic",PEBBLE:"Pebble",PHILIPS:"Philips",PICO:"Pico",POLYTRON:"Polytron",REALME:"Realme",RETROID:"Retroid",RIM:"RIM",ROKU:"Roku",SAMSUNG:"Samsung",SHARP:"Sharp",SIEMENS:"Siemens",SMARTFREN:"Smartfren",SONY:"Sony",SPRINT:"Sprint",TCL:"TCL",TECHNISAT:"TechniSAT",TECNO:"TECNO",TESLA:"Tesla",ULEFONE:"Ulefone",VIVO:"Vivo",VIZIO:"Vizio",VODAFONE:"Vodafone",WIKO:"Wiko",XBOX:"Xbox",XIAOMI:"Xiaomi",ZEBRA:"Zebra",ZTE:"ZTE"});var os=Object.freeze({AMAYA:"Amaya",ARKWEB:"ArkWeb",BLINK:"Blink",EDGEHTML:"EdgeHTML",FLOW:"Flow",GECKO:"Gecko",GOANNA:"Goanna",ICAB:"iCab",KHTML:"KHTML",LIBWEB:"LibWeb",LINKS:"Links",LYNX:"Lynx",NETFRONT:"NetFront",NETSURF:"NetSurf",PRESTO:"Presto",SERVO:"Servo",TASMAN:"Tasman",TRIDENT:"Trident",W3M:"w3m",WEBKIT:"WebKit"});var ss=Object.freeze({AIX:"AIX",AMIGA_OS:"Amiga OS",ANDROID:"Android",ANDROID_X86:"Android-x86",ARCAOS:"ArcaOS",ARCH:"Arch",BADA:"Bada",BEOS:"BeOS",BLACKBERRY:"BlackBerry",CENTOS:"CentOS",CHROME_OS:"Chrome OS",CHROMECAST:"Chromecast",CHROMECAST_ANDROID:"Chromecast Android",CHROMECAST_FUCHSIA:"Chromecast Fuchsia",CHROMECAST_LINUX:"Chromecast Linux",CHROMECAST_SMARTSPEAKER:"Chromecast SmartSpeaker",CONTIKI:"Contiki",DEBIAN:"Debian",DEEPIN:"Deepin",DRAGONFLY:"DragonFly",ELEMENTARY_OS:"elementary OS",FEDORA:"Fedora",FIREFOX_OS:"Firefox OS",FREEBSD:"FreeBSD",FUCHSIA:"Fuchsia",GENTOO:"Gentoo",GHOSTBSD:"GhostBSD",GNU:"GNU",HAIKU:"Haiku",HARMONYOS:"HarmonyOS",HP_UX:"HP-UX",HURD:"Hurd",IOS:"iOS",JOLI:"Joli",KAIOS:"KaiOS",KNOPPIX:"Knoppix",KUBUNTU:"Kubuntu",LINPUS:"Linpus",LINSPIRE:"Linspire",LINUX:"Linux",MACOS:"macOS",MAEMO:"Maemo",MAGEIA:"Mageia",MANDRIVA:"Mandriva",MANJARO:"Manjaro",MEEGO:"MeeGo",MINIX:"Minix",MINT:"Mint",MORPH_OS:"Morph OS",NETBSD:"NetBSD",NETRANGE:"NetRange",NETTV:"NetTV",NINTENDO:"Nintendo",OPENHARMONY:"OpenHarmony",OPENBSD:"OpenBSD",OPENVMS:"OpenVMS",OS2:"OS/2",PALM:"Palm",PC_BSD:"PC-BSD",PCLINUXOS:"PCLinuxOS",PICO:"Pico",PLAN9:"Plan9",PLAYSTATION:"PlayStation",QNX:"QNX",RASPBIAN:"Raspbian",REDHAT:"RedHat",RIM_TABLET_OS:"RIM Tablet OS",RISC_OS:"RISC OS",SABAYON:"Sabayon",SAILFISH:"Sailfish",SERENITYOS:"SerenityOS",SERIES40:"Series40",SLACKWARE:"Slackware",SOLARIS:"Solaris",SUSE:"SUSE",SYMBIAN:"Symbian",TIZEN:"Tizen",UBUNTU:"Ubuntu",UBUNTU_TOUCH:"Ubuntu Touch",UNIX:"Unix",VECTORLINUX:"VectorLinux",WATCHOS:"watchOS",WEBOS:"WebOS",WINDOWS:"Windows",WINDOWS_CE:"Windows CE",WINDOWS_IOT:"Windows IoT",WINDOWS_MOBILE:"Windows Mobile",WINDOWS_PHONE:"Windows Phone",WINDOWS_RT:"Windows RT",XBOX:"Xbox",XUBUNTU:"Xubuntu",ZENWALK:"Zenwalk"});var as=Object.freeze({BrowserName:{CLI:{CURL:"curl",ELINKS:"ELinks",HTTPIE:"HTTPie",LYNX:"Lynx",WGET:"Wget"},Crawler:{AHREFS_BOT:"AhrefsBot",AI2_BOT:"AI2Bot",AIHIT_BOT:"aiHitBot",ALGOLIA_CRAWLER:"Algolia Crawler",APPLE_BOT:"Applebot",APPLE_BOT_EXTENDED:"Applebot-Extended",ASK_TEOMA:"Teoma",AMAZON_BOT:"Amazonbot",AMAZON_CONTXBOT:"contxbot",ANTHROPIC_AI:"anthropic-ai",ANTHROPIC_CLAUDE_BOT:"ClaudeBot",ANTHROPIC_CLAUDE_SEARCHBOT:"Claude-SearchBot",ANTHROPIC_CLAUDE_WEB:"Claude-Web",ARCHIVEORG_BOT:"archive.org_bot",BAIDU_ADS:"Baidu-ADS",BAIDU_SPIDER:"Baiduspider",BAIDU_SPIDER_ADS:"Baiduspider-ads",BAIDU_SPIDER_CPRO:"Baiduspider-cpro",BAIDU_SPIDER_FAVO:"Baiduspider-favo",BAIDU_SPIDER_IMAGE:"Baiduspider-image",BAIDU_SPIDER_NEWS:"Baiduspider-news",BAIDU_SPIDER_RENDER:"Baiduspider-render",BAIDU_SPIDER_VIDEO:"Baiduspider-video",BLEX_BOT:"BLEXBot",BOTIFY:"botify",BRAVE_BOT:"Bravebot",BYTEDANCE_BYTESPIDER:"Bytespider",BYTEDANCE_TIKTOKSPIDER:"TikTokSpider",COMMON_CRAWL_CCBOT:"CCBot",COCCOC_BOT_WEB:"coccocbot-web",COCCOC_BOT_IMAGE:"coccocbot-image",COHERE_TRAINING_DATA_CRAWLER:"cohere-training-data-crawler",COTOYOGI:"Cotoyogi",COVEO_BOT:"Coveobot",CRITEO_BOT:"CriteoBot",DATAFORSEO_BOT:"DataForSeoBot",DAUM:"Daum",DAUM_DAUMOA:"Daumoa",DAUM_DAUMOA_IMAGE:"Daumoa-image",DEEPSEEK_BOT:"DeepSeekBot",DIFFBOT:"Diffbot",DUCKDUCKGO_BOT:"DuckDuckBot",DUCKDUCKGO_FAVICONS_BOT:"DuckDuckGo-Favicons-Bot",ELASTIC:"Elastic",ELASTIC_SWIFTYPE_BOT:"Swiftbot",EXALEAD_EXABOT:"Exabot",FIRECRAWL_AGENT:"FirecrawlAgent",FREESPOKE:"Freespoke",GOOGLE_ADSBOT:"AdsBot-Google",GOOGLE_ADSBOT_MOBILE:"Adsbot-Google-Mobile",GOOGLE_ADSENSE:"AdSense",GOOGLE_APIS:"APIs-Google",GOOGLE_BOT:"Googlebot",GOOGLE_BOT_IMAGE:"Googlebot-Image",GOOGLE_BOT_NEWS:"Googlebot-News",GOOGLE_BOT_VIDEO:"Googlebot-Video",GOOGLE_CLOUDVERTEXBOT:"Google-CloudVertexBot",GOOGLE_EXTENDED:"Google-Extended",GOOGLE_INSPECTIONTOOL:"Google-InspectionTool",GOOGLE_OTHER:"GoogleOther",GOOGLE_OTHER_IMAGE:"GoogleOther-Image",GOOGLE_OTHER_VIDEO:"GoogleOther-Video",GOOGLE_SAFETY:"Google-Safety",GOOGLE_STOREBOT:"Storebot-Google",HIVE_IMAGESIFTBOT:"ImagesiftBot",HUAWEI_PANGUBOT:"PanguBot",HUAWEI_PETALBOT:"PetalBot",HUGGINGFACE_BOT:"HuggingFace-Bot",HUNTER_VELENPUBLICWEBCRAWLER:"VelenPublicWebCrawler",IA_ARCHIVER:"ia_archiver",IASK_BOT:"iAskBot",KAGI_BOT:"Kagibot",KANGAROO_BOT:"Kangaroo Bot",LINE_SPIDER:"Linespider",LINKEDIN_BOT:"LinkedInBot",MAGPIE_CRAWLER:"magpie-crawler",MARGINALIA:"marginalia",META_EXTERNALAGENT:"meta-externalagent",META_FACEBOOKBOT:"FacebookBot",META_FACEBOOKCATALOG:"facebookcatalog",META_FACEBOOKEXTERNALHIT:"facebookexternalhit",MAJESTIC_MJ12BOT:"MJ12bot",MICROSOFT_BINGBOT:"Bingbot",MICROSOFT_MSNBOT:"msnbot",MICROSOFT_ADIDXBOT:"adidxbot",MOJEEK_BOT:"MojeekBot",MOZ_DOTBOT:"DotBot",ONCRAWL:"OnCrawl",ONESPOT_SCRAPERBOT:"Onespot-ScraperBot",OPENAI_GPTBOT:"GPTBot",OPENAI_SEARCH_BOT:"OAI-SearchBot",PERPLEXITY_BOT:"PerplexityBot",QIHOO_360_SPIDER:"360Spider",QWANT_BOT:"Qwantbot",QWANT_BOT_NEWS:"Qwantbot-news",REPLICATE_BOT:"Replicate-Bot",RUNPOD_BOT:"RunPod-Bot",SB_INTUITIONS_BOT:"SBIntuitionsBot",SEEKPORT_BOT:"SeekportBot",SEMRUSH_BOT:"SemrushBot",SEMRUSH_BOT_BACKLINK:"SemrushBot-BA",SEMRUSH_BOT_CONTENTSHAKE:"SemrushBot-OCOB",SEMRUSH_BOT_SEO_CHECKER:"SemrushBot-SI",SEZNAM_BOT:"SeznamBot",SITEIMPROVE:"Siteimprove",SOGOU_PIC_SPIDER:"Sogou Pic Spider",SOGOU_WEB_SPIDER:"Sogou web spider",STARTPAGE:"Startpage",SURLY_BOT:"SurdotlyBot",TIMPI_BOT:"Timpibot",TOGETHER_BOT:"Together-Bot",TURNITIN_BOT:"TurnitinBot",TWIN_AGENT:"TwinAgent",VERCEL_V0BOT:"v0bot",WEBZIO:"webzio",WEBZIO_EXTENDED:"Webzio-Extended",WEBZIO_OMGILI:"omgili",WEBZIO_OMGILI_BOT:"omgilibot",XAI_BOT:"xAI-Bot",YAHOO_JAPAN:"Y!J-BRW",YAHOO_SLURP:"Yahoo! Slurp",YANDEX_ACCESSIBILITY_BOT:"YandexAccessibilityBot",YANDEX_ADDITIONAL_BOT:"YandexAdditionalBot",YANDEX_ADNET:"YandexAdNet",YANDEX_BLOGS:"YandexBlogs",YANDEX_BOT:"YandexBot",YANDEX_BOT_MIRRORDETECTOR:"YandexBot MirrorDetector",YANDEX_COMBOT:"YandexComBot",YANDEX_FAVICONS:"YandexFavicons",YANDEX_IMAGE_RESIZER:"YandexImageResizer",YANDEX_IMAGES:"YandexImages",YANDEX_MARKET:"YandexMarket",YANDEX_MEDIA:"YandexMedia",YANDEX_METRIKA:"YandexMetrika",YANDEX_MOBILE_BOT:"YandexMobileBot",YANDEX_MOBILE_SCREENSHOT_BOT:"YandexMobileScreenShotBot",YANDEX_NEWS:"YandexNews",YANDEX_ONTODB:"YandexOntoDB",YANDEX_ONTODB_API:"YandexOntoDBAPI",YANDEX_PARTNER:"YandexPartner",YANDEX_RCA:"YandexRCA",YANDEX_RENDERRESOURCES_BOT:"YandexRenderResourcesBot",YANDEX_SCREENSHOT_BOT:"YandexScreenshotBot",YANDEX_SPRAV_BOT:"YandexSpravBot",YANDEX_TRACKER:"YandexTracker",YANDEX_VERTICALS:"YandexVerticals",YANDEX_VERTIS:"YandexVertis",YANDEX_VIDEO:"YandexVideo",YANDEX_VIDEO_PARSER:"YandexVideoParser",YANDEX_WEBMASTER:"YandexWebmaster",YEP_BOT:"YepBot",YETI:"Yeti",YISOU_SPIDER:"YisouSpider",YOU_BOT:"YouBot",ZHIPU_CHATGLM_SPIDER:"ChatGLM-Spider",ZUM_BOT:"ZumBot"},Email:{AIRMAIL:"Airmail",APPLE_MAIL:"Mail",BLUEMAIL:"BlueMail",DAUM_MAIL:"DaumMail",EVOLUTION:"Evolution",EM_CLIENT:"eM Client",FOXMAIL:"Foxmail",KMAIL:"KMail",KMAIL2:"kmail2",KONTACT:"Kontact",MICROSOFT_OUTLOOK:"Microsoft Outlook",MICROSOFT_OUTLOOK_MAC:"MacOutlook",NAVER_MAILAPP:"NaverMailApp",POLYMAIL:"Polymail",PROTON_MAIL:"ProtonMail",SPARK_MAIL:"SparkDesktop",SPARROW:"Sparrow",THUNDERBIRD:"Thunderbird",YAHOO_MAIL:"Yahoo",ZIMBRA:"Zimbra",ZOHO_MAIL:"ZohoMail-Desktop"},Fetcher:{AHREFS_SITEAUDIT:"AhrefsSiteAudit",ANTHROPIC_CLAUDE_USER:"Claude-User",ASANA:"Asana",BETTER_UPTIME_BOT:"Better Uptime Bot",BITLY_BOT:"bitlybot",BLUESKY:"Bluesky",BUFFER_LINKPREVIEWBOT:"BufferLinkPreviewBot",COHERE_AI:"Cohere-AI",DISCORD_BOT:"Discordbot",DUCKDUCKGO_ASSISTBOT:"DuckAssistBot",GOOGLE_CHROME_LIGHTHOUSE:"Chrome-Lighthouse",GOOGLE_FEEDFETCHER:"FeedFetcher-Google",GOOGLE_GEMINI_DEEP_RESEARCH:"Gemini-Deep-Research",GOOGLE_IMAGEPROXY:"GoogleImageProxy",GOOGLE_PAGERENDERER:"Google-PageRenderer",GOOGLE_READ_ALOUD:"Google-Read-Aloud",GOOGLE_PRODUCER:"GoogleProducer",GOOGLE_SITE_VERIFICATION:"Google-Site-Verification",HUBSPOT_PAGE_FETCHER:"HubSpot Page Fetcher",IFRAMELY:"Iframely",KAKAOTALK_SCRAP:"kakaotalk-scrap",KEYBASE_BOT:"KeybaseBot",META_EXTERNALFETCHER:"meta-externalfetcher",META_WHATSAPP:"WhatsApp",MICROSOFT_BINGPREVIEW:"BingPreview",MICROSOFT_PREVIEW:"MicrosoftPreview",MISTRALAI_USER:"MistralAI-User",NAVER_BLUENO:"Blueno",ONCRAWL_ROGERBOT:"rogerbot",OPENAI_CHATGPT_USER:"ChatGPT-User",PERPLEXITY_USER:"Perplexity-User",PINTEREST_BOT:"Pinterestbot",SEMRUSH_SITEAUDITBOT:"SiteAuditBot",SLACK_BOT:"Slackbot",SLACK_BOT_LINKEXPANDING:"Slackbot-LinkExpanding",SLACK_IMGPROXY:"Slack-ImgProxy",SNAP_URL_PREVIEW:"Snap URL Preview",SKYPE_URIPREVIEW:"SkypeUriPreview",TELEGRAM_BOT:"TelegramBot",UPTIMEROBOT:"UptimeRobot",VERCEL_FAVICON_BOT:"vercel-favicon-bot",VERCEL_SCREENSHOT_BOT:"vercel-screenshot-bot",VERCEL_BOT:"Vercelbot",VERCEL_FLAGS:"vercelflags",VERCEL_TRACING:"verceltracing",X_TWITTERBOT:"Twitterbot",YANDEX_CALENDAR:"YandexCalendar",YANDEX_DIRECT:"YandexDirect",YANDEX_DIRECTDYN:"YandexDirectDyn",YANDEX_DIRECTFETCHER:"YaDirectFetcher",YANDEX_FORDOMAIN:"YandexForDomain",YANDEX_PAGECHECKER:"YandexPagechecker",YANDEX_SEARCHSHOP:"YandexSearchShop",YANDEX_SITELINKS:"YandexSitelinks",YANDEX_USERPROXY:"YandexUserproxy",ZOOMINFO_BOT:"Zoombot"},InApp:{DISCORD:"Discord",EVERNOTE:"Evernote",FIGMA:"Figma",FLIPBOARD:"Flipboard",MATTERMOST:"Mattermost",TEAMS:"Teams",NOTION:"Notion",POSTMAN:"Postman",RAMBOX:"Rambox",ROCKETCHAT:"Rocket.Chat",SLACK:"Slack",TIKTOK_LITE:"TikTok Lite",VSCODE:"VS Code",YAHOO_JAPAN:"Yahoo! Japan"},Library:{ADOBE_AIR:"AdobeAIR",AIOHTTP:"aiohttp",APACHE_HTTPCLIENT:"Apache-HttpClient",AXIOS:"axios",GO_HTTP_CLIENT:"go-http-client",GOT:"got",GUZZLEHTTP:"GuzzleHttp",JAVA:"Java",JAVA_HTTPCLIENT:"Java-http-client",JSDOM:"jsdom",LIBWWW_PERL:"libwww-perl",LUA_RESTY_HTTP:"lua-resty-http",NEEDLE:"Needle",NUTCH:"Nutch",OKHTTP:"OkHttp",NODE_FETCH:"node-fetch",NODE_SUPERAGENT:"node-superagent",PHP_SOAP:"PHP-SOAP",POSTMAN_RUNTIME:"PostmanRuntime",PYTHON_HTTPX:"python-httpx",PYTHON_URLLIB:"python-urllib",PYTHON_URLLIB3:"python-urllib3",PYTHON_REQUESTS:"python-requests",SCRAPY:"Scrapy"}},DeviceVendor:{Vehicle:{BMW:"BMW",BYD:"BYD",JEEP:"Jeep",RIVIAN:"Rivian",TESLA:"Tesla",VOLVO:"Volvo"}}});var B="model",G="name",v="type",k="vendor",z="version",He="mobile",X="tablet",ti="crawler",qc="cli",cs="email",ls="fetcher",mt="inapp",nn="mediaplayer",Xc="library",Jc=Object.freeze({browser:[[/(wget|curl|lynx|elinks|httpie)[\/ ]\(?([\w\.-]+)/i],[G,z,[v,qc]]]}),ds=Object.freeze({browser:[[/((?:adidx|ahrefs|amazon|bing|brave|cc|contx|coveo|criteo|dot|duckduck(?:go-favicons-)?|exa|facebook|gpt|iask|kagi|kangaroo |linkedin|mj12|mojeek|oai-search|onespot-scraper|perplexity|sbintuitions|semrush|seznam|surdotly|swift|yep)bot)\/([\w\.-]+)/i,/(algolia crawler(?: renderscript)?)\/?([\w\.]*)/i,/(applebot(?:-extended)?)\/?([\w\.]*)/i,/(baiduspider[-imagevdonwsfcpr]{0,7})\/?([\w\.]*)/i,/(claude(?:bot|-searchbot|-web)|anthropic-ai)\/?([\w\.]*)/i,/(coccocbot-(?:image|web))\/([\w\.]+)/i,/(daum(?:oa)?(?:-image)?)[ \/]([\w\.]+)/i,/(facebook(?:externalhit|catalog)|meta-externalagent)\/([\w\.]+)/i,/(google(?:bot|other|-inspectiontool)(?:-image|-video|-news)?|storebot-google)\/?([\w\.]*)/i,/(ia_archiver|archive\.org_bot)\/?([\w\.]*)/i,/(oncrawl) mobile\/([\w\.]+)/i,/(qwantbot(?:-news)?)[-\w]*\/?([\w\.]*)/i,/((?:semrush|splitsignal)bot[-abcfimostw]*)\/?([\w\.-]*)/i,/(sogou (?:pic|head|web|orion|news) spider)\/([\w\.]+)/i,/(y!?j-(?:asr|br[uw]|dscv|mmp|vsidx|wsc))\/([\w\.]+)/i,/(yandex(?:(?:mobile)?(?:accessibility|additional|com|renderresources|screenshot|sprav)?bot(?!.+mirror)|image(?:s|resizer)|adnet|blogs|favicons|market|media|metrika|news|ontodb(?:api)?|partner|rca|tracker|turbo|verti(?:cal)?s|webmaster|video(?:parser)?))\/([\w\.]+)/i,/(yeti)\/([\w\.]+)/i,/((?:aihit|blex|diff|huggingface-|msn|pangu|replicate-|runpod-|timpi|together-|xai-|you|zum)bot|(?:magpie-|velenpublicweb)crawler|(?:chatglm-|line|screaming frog seo |yisou)spider|cotoyogi|firecrawlagent|freespoke|omgili(?:bot)?|openai image downloader|startpageprivateimageproxy|twinagent|webzio-extended)\/?([\w\.]*)/i],[G,z,[v,ti]],[/(yandexbot\/([\w\.]+); mirrordetector)/i],[[G,/\/.+;/ig,""],z,[v,ti]],[/((?:adsbot|apis|mediapartners)-google(?:-mobile)?|google-?(?:other|cloudvertexbot|extended|safety))/i,/\b((ai2|aspiegel|dataforseo|deepseek|imagesift|petal|seekport|turnitin|v0)bot|360spider-?(image|video)?|baidu-ads|botify|(byte|tiktok)spider|cohere-training-data-crawler|elastic(?=\/s)|marginalia|siteimprove(?=bot|\.com)|teoma|webzio|yahoo! slurp)/i],[G,[v,ti]]]}),eg=Object.freeze({device:[[/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[k,B,[v,X]],[/(u304aa)/i],[B,[k,"AT&T"],[v,He]],[/\bsie-(\w*)/i],[B,[k,"Siemens"],[v,He]],[/\b(rct\w+) b/i],[B,[k,"RCA"],[v,X]],[/\b(venue[\d ]{2,7}) b/i],[B,[k,"Dell"],[v,X]],[/\b(q(?:mv|ta)\w+) b/i],[B,[k,"Verizon"],[v,X]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[B,[k,"Barnes & Noble"],[v,X]],[/\b(tm\d{3}\w+) b/i],[B,[k,"NuVision"],[v,X]],[/\b(k88) b/i],[B,[k,"ZTE"],[v,X]],[/\b(nx\d{3}j) b/i],[B,[k,"ZTE"],[v,He]],[/\b(gen\d{3}) b.+49h/i],[B,[k,"Swiss"],[v,He]],[/\b(zur\d{3}) b/i],[B,[k,"Swiss"],[v,X]],[/^((zeki)?tb.*\b) b/i],[B,[k,"Zeki"],[v,X]],[/\b([yr]\d{2}) b/i,/\b(?:dragon[- ]+touch |dt)(\w{5}) b/i],[B,[k,"Dragon Touch"],[v,X]],[/\b(ns-?\w{0,9}) b/i],[B,[k,"Insignia"],[v,X]],[/\b((nxa|next)-?\w{0,9}) b/i],[B,[k,"NextBook"],[v,X]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[k,"Voice"],B,[v,He]],[/\b(lvtel\-)?(v1[12]) b/i],[[k,"LvTel"],B,[v,He]],[/\b(ph-1) /i],[B,[k,"Essential"],[v,He]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[B,[k,"Envizen"],[v,X]],[/\b(trio[-\w\. ]+) b/i],[B,[k,"MachSpeed"],[v,X]],[/\btu_(1491) b/i],[B,[k,"Rotor"],[v,X]]]}),tg=Object.freeze({browser:[[/((?:air|blue|daum|fox|poly|proton)mail|emclient|evolution|kmail2?|kontact|(?:microsoft |mac)?outlook(?:-express)?|navermailapp|(?!chrom.+)sparrow|sparkdesktop|thunderbird|yahoo|zohomail-desktop)(?:m.+ail; |[\/ ])([\w\.]+)/i,/(mail)\/([\w\.]+) cf/i],[G,z,[v,cs]],[/zdesktop\/([\w\.]+)/i],[z,[G,"Zimbra"],[v,cs]]]}),us=Object.freeze({browser:[[/(asana|ahrefssiteaudit|(?:bing|microsoft)preview|blueno|(?:chatgpt|claude|mistralai|perplexity)-user|cohere-ai|hubspot page fetcher|mastodon|(?:bitly|bufferlinkpreview|discord|duckassist|linkedin|pinterest|reddit|roger|siteaudit|twitter|uptimero|zoom)bot|google-site-verification|iframely|kakaotalk-scrap|meta-externalfetcher|y!?j-dlc|yandex(?:calendar|direct(?:dyn)?|fordomain|pagechecker|searchshop)|yadirectfetcher)\/([\w\.]+)/i,/(bluesky) cardyb\/([\w\.]+)/i,/(skypeuripreview) preview\/([\w\.]+)/i,/(slack(?:bot)?(?:-imgproxy|-linkexpanding)?) ([\w\.]+)/i,/(whatsapp)\/([\w\.]+)/i],[G,z,[v,ls]],[/((?:better uptime |keybase|telegram|vercel)bot|chrome-lighthouse|feedfetcher-google|gemini-deep-research|google(?:imageproxy|-read-aloud|-pagerenderer|producer)|snap url preview|vercel(flags|tracing|-(favicon|screenshot)-bot)|yandex(?:sitelinks|userproxy))/i],[G,[v,ls]]],os:[[/whatsapp\/[\d\.]+ (a|i)/i],[[G,n=>n=="A"?"Android":"iOS"]]]}),ng=Object.freeze({browser:[[/\b(discord|figma|mattermost|notion|postman|rambox|rocket.chat|slack|teams)\/([\w\.]+).+(electron\/|; ios)/i,/(flipboard)\/([\w\.]+)/i],[G,z,[v,mt]],[/(evernote) win/i,/(teams)mobile-(ios|and)/i],[G,[v,mt]],[/chatlyio\/([\d\.]+)/i],[z,[G,"Slack"],[v,mt]],[/ultralite app_version\/([\w\.]+)/i],[z,[G,"TikTok Lite"],[v,mt]],[/\) code\/([\d\.]+).+electron\//i],[z,[G,"VS Code"],[v,mt]],[/jp\.co\.yahoo\.(?:android\.yjtop|ipn\.appli)\/([\d\.]+)/i],[z,[G,"Yahoo! Japan"],[v,mt]]]}),rg=Object.freeze({browser:[[/(apple(?:coremedia|tv))\/([\w\._]+)/i,/(coremedia) v([\w\._]+)/i,/(ares|clementine|music player daemon|nexplayer|ossproxy) ([\w\.-]+)/i,/^(aqualung|audacious|audimusicstream|amarok|bass|bsplayer|core|gnomemplayer|gvfs|irapp|lyssna|music on console|nero (?:home|scout)|nokia\d+|nsplayer|psp-internetradioplayer|quicktime|rma|radioapp|radioclientapplication|soundtap|stagefright|streamium|totem|videos|xbmc|xine|xmms)\/([\w\.-]+)/i,/(lg player|nexplayer) ([\d\.]+)/i,/player\/(nexplayer|lg player) ([\w\.-]+)/i,/(gstreamer) souphttpsrc.+libsoup\/([\w\.-]+)/i,/(htc streaming player) [\w_]+ \/ ([\d\.]+)/i,/(lavf)([\d\.]+)/i,/(mplayer)(?: |\/)(?:(?:sherpya-){0,1}svn)(?:-| )(r\d+(?:-\d+[\w\.-]+))/i,/ (songbird)\/([\w\.-]+)/i,/(winamp)(?:3 version|mpeg| ) ([\w\.-]+)/i,/(vlc)(?:\/| media player - version )([\w\.-]+)/i,/^(foobar2000|itunes|smp)\/([\d\.]+)/i,/com\.(riseupradioalarm)\/([\d\.]*)/i,/(mplayer)(?:\s|\/| unknown-)([\w\.\-]+)/i,/(windows)\/([\w\.-]+) upnp\/[\d\.]+ dlnadoc\/[\d\.]+ home media server/i],[G,z,[v,nn]],[/(flrp)\/([\w\.-]+)/i],[[G,"Flip Player"],z,[v,nn]],[/(fstream|media player classic|inlight radio|mplayer|nativehost|nero showtime|ocms-bot|queryseekspider|tapinradio|tunein radio|winamp|yourmuze)/i],[G,[v,nn]],[/(htc_one_s|windows-media-player|wmplayer)\/([\w\.-]+)/i],[[G,/[_-]/g," "],z,[v,nn]],[/(rad.io|radio.(?:de|at|fr)) ([\d\.]+)/i],[[G,"rad.io"],z,[v,nn]]]}),Zc=Object.freeze({browser:[[/^(apache-httpclient|axios|(?:go|java)-http-client|got|guzzlehttp|java|libwww-perl|lua-resty-http|needle|node-(?:fetch|superagent)|okhttp|php-soap|postmanruntime|python-(?:httpx|urllib[23]?|requests)|scrapy)\/([\w\.]+)/i,/(adobeair|aiohttp|jsdom)\/([\w\.]+)/i,/(nutch)-([\w\.-]+)(\(|$)/i,/\((java)\/([\w\.]+)/i],[G,z,[v,Xc]]]}),ig=Object.freeze({device:[[/aftlbt962e2/i],[[k,"BMW"]],[/dilink.+(byd) auto/i],[k],[/aftlft962x3/i],[[k,"Jeep"],[B,"Wagooner"]],[/(rivian) (r1t)/i],[k,B],[/vcc.+netfront/i],[[k,"Volvo"]]]}),ps=Object.freeze({browser:[...Jc.browser,...us.browser,...ds.browser,...Zc.browser],os:[...us.os]});var S={ANDORRA:{ANDORRA:"Europe/Andorra"},AUSTRIA:{VIENNA:"Europe/Vienna"},BELGIUM:{BRUSSELS:"Europe/Brussels"},BULGARIA:{SOFIA:"Europe/Sofia"},CROATIA:{ZAGREB:"Europe/Zagreb"},CYPRUS:{NICOSIA_EUROPE:"Europe/Nicosia",NICOSIA_ASIA:"Asia/Nicosia",FAMAGUSTA:"Asia/Famagusta"},CZECHIA:{PRAGUE:"Europe/Prague"},DENMARK:{COPENHAGEN:"Europe/Copenhagen",FAROE:"Atlantic/Faroe"},ESTONIA:{TALLINN:"Europe/Tallinn"},FINLAND:{HELSINKI:"Europe/Helsinki",MARIEHAMN:"Europe/Mariehamn"},FRANCE:{PARIS:"Europe/Paris",CAYENNE:"America/Cayenne",GUADELOUPE:"America/Guadeloupe",MARIGOT:"America/Marigot",MARTINIQUE:"America/Martinique",MAYOTTE:"Indian/Mayotte",REUNION:"Indian/Reunion"},GERMANY:{BERLIN:"Europe/Berlin",BUSINGEN:"Europe/Busingen"},GREECE:{ATHENS:"Europe/Athens"},HUNGARY:{BUDAPEST:"Europe/Budapest"},ICELAND:{REYKJAVIK:"Atlantic/Reykjavik"},IRELAND:{DUBLIN:"Europe/Dublin"},ITALY:{ROME:"Europe/Rome"},LATVIA:{RIGA:"Europe/Riga"},LIECHTENSTEIN:{VADUZ:"Europe/Vaduz"},LITHUANIA:{VILNIUS:"Europe/Vilnius"},LUXEMBOURG:{LUXEMBOURG:"Europe/Luxembourg"},MALTA:{MALTA:"Europe/Malta"},MONACO:{MONACO:"Europe/Monaco"},NETHERLANDS:{AMSTERDAM:"Europe/Amsterdam",ARUBA:"America/Aruba",CURACAO:"America/Curacao",KRALENDIJK:"America/Kralendijk",LOWER_PRINCES:"America/Lower_Princes"},NORWAY:{OSLO:"Europe/Oslo",JAN_MAYEN:"Atlantic/Jan_Mayen",LONGYEARBYEN:"Arctic/Longyearbyen"},POLAND:{WARSAW:"Europe/Warsaw"},PORTUGAL:{LISBON:"Europe/Lisbon",AZORES:"Atlantic/Azores",MADEIRA:"Atlantic/Madeira"},ROMANIA:{BUCHAREST:"Europe/Bucharest"},SAN_MARINO:{SAN_MARINO:"Europe/San_Marino"},SLOVAKIA:{BRATISLAVA:"Europe/Bratislava"},SLOVENIA:{LJUBLJANA:"Europe/Ljubljana"},SPAIN:{MADRID:"Europe/Madrid",CANARY:"Atlantic/Canary",CEUTA:"Africa/Ceuta"},SWEDEN:{STOCKHOLM:"Europe/Stockholm"},SWITZERLAND:{ZURICH:"Europe/Zurich"},VATICAN:{VATICAN:"Europe/Vatican"}},Qc=[S.AUSTRIA.VIENNA,S.BELGIUM.BRUSSELS,S.BULGARIA.SOFIA,S.CROATIA.ZAGREB,S.CYPRUS.NICOSIA_EUROPE,S.CYPRUS.NICOSIA_ASIA,S.CYPRUS.FAMAGUSTA,S.CZECHIA.PRAGUE,S.DENMARK.COPENHAGEN,S.ESTONIA.TALLINN,S.FINLAND.HELSINKI,S.FINLAND.MARIEHAMN,S.FRANCE.PARIS,S.GERMANY.BERLIN,S.GREECE.ATHENS,S.HUNGARY.BUDAPEST,S.IRELAND.DUBLIN,S.ITALY.ROME,S.LATVIA.RIGA,S.LITHUANIA.VILNIUS,S.LUXEMBOURG.LUXEMBOURG,S.MALTA.MALTA,S.NETHERLANDS.AMSTERDAM,S.POLAND.WARSAW,S.PORTUGAL.LISBON,S.ROMANIA.BUCHAREST,S.SLOVAKIA.BRATISLAVA,S.SLOVENIA.LJUBLJANA,S.SPAIN.MADRID,S.SWEDEN.STOCKHOLM,S.FRANCE.CAYENNE,S.FRANCE.GUADELOUPE,S.FRANCE.MARIGOT,S.FRANCE.MARTINIQUE,S.FRANCE.MAYOTTE,S.FRANCE.REUNION,S.PORTUGAL.AZORES,S.PORTUGAL.MADEIRA,S.SPAIN.CANARY],fs=[S.ICELAND.REYKJAVIK,S.LIECHTENSTEIN.VADUZ,S.NORWAY.OSLO,S.NORWAY.JAN_MAYEN],sg=[...Qc,...fs],ag=[S.SWITZERLAND.ZURICH,...fs],cg=[S.AUSTRIA.VIENNA,S.BELGIUM.BRUSSELS,S.BULGARIA.SOFIA,S.CROATIA.ZAGREB,S.CZECHIA.PRAGUE,S.DENMARK.COPENHAGEN,S.ESTONIA.TALLINN,S.FINLAND.HELSINKI,S.FINLAND.MARIEHAMN,S.FRANCE.PARIS,S.GERMANY.BERLIN,S.GREECE.ATHENS,S.HUNGARY.BUDAPEST,S.ITALY.ROME,S.LATVIA.RIGA,S.LITHUANIA.VILNIUS,S.LUXEMBOURG.LUXEMBOURG,S.MALTA.MALTA,S.NETHERLANDS.AMSTERDAM,S.POLAND.WARSAW,S.PORTUGAL.LISBON,S.PORTUGAL.AZORES,S.PORTUGAL.MADEIRA,S.ROMANIA.BUCHAREST,S.SLOVAKIA.BRATISLAVA,S.SLOVENIA.LJUBLJANA,S.SPAIN.MADRID,S.SPAIN.CANARY,S.SWEDEN.STOCKHOLM,S.ANDORRA.ANDORRA,S.GERMANY.BUSINGEN,S.ICELAND.REYKJAVIK,S.LIECHTENSTEIN.VADUZ,S.MONACO.MONACO,S.NORWAY.OSLO,S.SAN_MARINO.SAN_MARINO,S.SPAIN.CEUTA,S.SWITZERLAND.ZURICH,S.VATICAN.VATICAN];function ni(){var n;return typeof window!="undefined"&&((window==null?void 0:window.matchMedia("(display-mode: standalone)").matches)||((n=window.navigator)===null||n===void 0?void 0:n.standalone)||document.referrer.startsWith("android-app://")||(window==null?void 0:window.Windows)||/trident.+(msapphost|webview)\//i.test(navigator.userAgent)||document.referrer.startsWith("app-info://platform/microsoft-store"))}var{Crawler:wg}=as.BrowserName,ri=(n,e,t)=>typeof n=="string"?re(n,e,t):n;var gs=n=>{let e=ri(n);if(e.os.is(ss.MACOS)){if(e.cpu.is(is.ARM))return!0;if(typeof n!="string"&&typeof window!="undefined")try{let t=document.createElement("canvas"),r=t.getContext("webgl2")||t.getContext("webgl")||t.getContext("experimental-webgl"),i=r.getExtension("WEBGL_debug_renderer_info");if(r.getParameter(i.UNMASKED_RENDERER_WEBGL).match(/apple m\d/i))return!0}catch(t){return!1}}return!1};var ms=n=>[tn.CLI,tn.CRAWLER,tn.FETCHER,tn.LIBRARY].includes(ri(n,ps).browser.type),hs=n=>ri(n).engine.is(os.BLINK);function el(){return{width:window.screen.width,height:window.screen.height}}function tl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(n){return console.error("Failed to get timezone:",n),"UTC"}}function Es(){try{return navigator.language||"en-US"}catch(n){return console.error("Failed to get browser locale:",n),"en-US"}}function ys(){if(typeof window=="undefined")return{userAgent:{name:"",browser:{major:"",name:"",version:""},os:{name:"",version:""},device:void 0,engine:{name:"",version:""},cpu:{architecture:""}},screenResolution:{width:0,height:0},timeZone:"UTC",flags:{isBot:!1,isChromeFamily:!1,isStandalonePWA:!1,isAppleSilicon:!1}};let e=new re().getResult(),t;try{t={isBot:ms(e),isChromeFamily:hs(e),isStandalonePWA:ni(),isAppleSilicon:gs(e)}}catch(r){console.error("Failed to compute device flags:",r),t={isBot:!1,isChromeFamily:!1,isStandalonePWA:!1,isAppleSilicon:!1}}return{userAgent:{name:e.ua,browser:{major:e.browser.major||"",name:e.browser.name||"",version:e.browser.version||"",type:e.browser.type},os:{name:e.os.name||"",version:e.os.version||""},device:e.device.model||e.device.type||e.device.vendor?{model:e.device.model,type:e.device.type,vendor:e.device.vendor}:void 0,engine:{name:e.engine.name||"",version:e.engine.version||""},cpu:{architecture:e.cpu.architecture||""}},screenResolution:el(),timeZone:tl(),flags:t}}function As(){if(typeof window=="undefined")return{};let n=new URLSearchParams(window.location.search);return{locale:n.get("locale")||void 0,currency:n.get("currency")||void 0,utmSource:n.get("utm_source")||void 0,utmMedium:n.get("utm_medium")||void 0,utmCampaign:n.get("utm_campaign")||void 0}}var $n=class{constructor(){this.listeners=new Map}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>this.off(e,t)}off(e,t){this.listeners.has(e)&&this.listeners.get(e).delete(t)}async emit(e,t){if(this.listeners.has(e)){let r=Array.from(this.listeners.get(e));await Promise.all(r.map(i=>{try{return Promise.resolve(i(t))}catch(o){return console.error('[EventBus] Error in listener for event "'.concat(e,'":'),o),Promise.resolve()}}))}}clear(){this.listeners.clear()}};ar();function rn(n){try{let e=n.split(".");if(e.length!==3)return console.error("Invalid JWT token format"),null;let t=e[1],r=t+"=".repeat((4-t.length%4)%4),i=atob(r),o=JSON.parse(i);return o.exp&&Date.now()>=o.exp*1e3?(console.warn("JWT token is expired"),null):{sessionId:o.sessionId,storeId:o.storeId,accountId:o.accountId,customerId:o.customerId,role:o.role,isValid:!0,isLoading:!1}}catch(e){return console.error("Failed to decode JWT token:",e),null}}function ws(n){try{let e=n.split(".");if(e.length!==3)return!0;let t=e[1],r=t+"=".repeat((4-t.length%4)%4),i=atob(r),o=JSON.parse(i);return o.exp?Date.now()>=o.exp*1e3:!1}catch(e){return console.error("Failed to check token expiration:",e),!0}}dn();var ht={},nl=["","VITE_","REACT_APP_","NEXT_PUBLIC_"];function Ie(n,e=nl){var t,r,i;for(let o of e){let s=o?"".concat(o).concat(n):n;if(typeof process!="undefined"&&((t=process==null?void 0:process.env)!=null&&t[s]))return console.log("process.env[".concat(s,"]"),process.env[s]),process.env[s];if(typeof ht!="undefined"&&((r=ht==null?void 0:ht.env)!=null&&r[s]))return console.log("import.meta.env[".concat(s,"]"),ht.env[s]),ht.env[s];if(typeof window!="undefined"&&((i=window==null?void 0:window.__TAGADA_ENV__)!=null&&i[s]))return console.log("window.__TAGADA_ENV__[".concat(s,"]"),window.__TAGADA_ENV__[s]),window.__TAGADA_ENV__[s]}}var rl=async(n="default")=>{try{if((Ie("TAGADA_ENV")||Ie("TAGADA_ENVIRONMENT"))==="production"||!Ct(!0))return null;let t=await fetch("/.local.json");if(!t.ok)return null;let r=await t.json(),i={},o=!1;try{let a=await fetch("/config/".concat(n,".tgd.json"));a.ok||(a=await fetch("/config/".concat(n,".json"))),a.ok&&(i=await a.json(),o=!0)}catch(a){}if(!o&&n!=="default"){console.warn("\u26A0\uFE0F Config variant '".concat(n,"' not found, falling back to 'default'"));try{let a=await fetch("/config/default.tgd.json");a.ok||(a=await fetch("/config/default.json")),a.ok&&(i=await a.json(),o=!0,console.log("\u2705 Fallback to 'default' config successful"))}catch(a){}}o||console.warn(n==="default"?"\u26A0\uFE0F No 'default' config found. Create /config/default.tgd.json":"\u26A0\uFE0F Neither '".concat(n,"' nor 'default' config found. Create /config/default.tgd.json"));let s={storeId:r.storeId,accountId:r.accountId,basePath:r.basePath,config:i};return console.log("\u{1F6E0}\uFE0F Using local development plugin config:",s),s}catch(e){return null}},il=async()=>{try{if((Ie("TAGADA_ENV")||Ie("TAGADA_ENVIRONMENT"))==="production"||!Ct(!0))return null;try{console.log("\u{1F6E0}\uFE0F [V2] Attempting to load /config/funnel.local.json...");let r=await fetch("/config/funnel.local.json");if(r.ok){let i=await r.json();console.log("\u{1F6E0}\uFE0F [V2] \u2705 Loaded local funnel config (NEW format):",i);let{loadLocalFunnelConfig:o}=await Promise.resolve().then(()=>(An(),eo));if(await o(),i.staticResources){let s={};for(let[a,l]of Object.entries(i.staticResources))s[a]={id:l};return s}return null}}catch(r){console.log("\u{1F6E0}\uFE0F [V2] funnel.local.json not found, trying legacy format...")}console.log("\u{1F6E0}\uFE0F [V2] Attempting to load /config/resources.static.json (legacy)...");let e=await fetch("/config/resources.static.json");if(!e.ok)return console.log("\u{1F6E0}\uFE0F [V2] No local static resources found"),null;let t=await e.json();return console.log("\u{1F6E0}\uFE0F [V2] \u2705 Loaded legacy static resources:",t),t}catch(n){return console.error("\u{1F6E0}\uFE0F [V2] \u274C Error loading static resources:",n),null}},ke=n=>{if(typeof document=="undefined")return;let e=document.querySelector('meta[name="'.concat(n,'"]'));return(e==null?void 0:e.getAttribute("content"))||void 0};function ol(){if(typeof document=="undefined")return{basePath:"/",config:{}};let n=ke("x-plugin-store-id"),e=ke("x-plugin-account-id"),t=ke("x-plugin-base-path")||"/",r={};try{let i=ke("x-plugin-config");i&&(r=JSON.parse(decodeURIComponent(i)))}catch(i){console.warn("[TagadaSDK] Failed to parse plugin config from meta tag:",i)}return{storeId:n,accountId:e,basePath:t,config:r}}var sl=async()=>{try{if(typeof document=="undefined")return null;let n=ke("x-plugin-store-id"),e=ke("x-plugin-account-id");if(!n)return null;let t=ke("x-plugin-base-path")||"/",r={};try{let o=ke("x-plugin-config");if(o){let s=decodeURIComponent(o);r=JSON.parse(s)}}catch(o){console.warn("\u26A0\uFE0F Failed to parse plugin config from meta tag:",o)}e||console.warn("\u26A0\uFE0F Plugin config: Account ID not found in meta tags");let i={storeId:n,accountId:e,basePath:t,config:r};return console.log("\u{1F680} [HIGHEST PRIORITY] Plugin config loaded from meta tags (runtime injected config):",{storeId:n,accountId:e,basePath:t,configKeys:Object.keys(r),configSize:JSON.stringify(r).length}),i}catch(n){return console.warn("\u26A0\uFE0F Error loading production config from meta tags:",n),null}},oi=async(n="default",e)=>{var s,a;console.log("\u{1F527} [V2] loadPluginConfig called with variant:",n);let t=await il(),r=await sl();if(r){let l=D(C({},r),{staticResources:t!=null?t:void 0});return console.log("\u2705 [V2] Using INJECTED config from meta tags (HIGHEST PRIORITY)"),l}if(e){let l={storeId:e.storeId,accountId:e.accountId,basePath:(s=e.basePath)!=null?s:"/",config:(a=e.config)!=null?a:{},staticResources:t!=null?t:void 0};return console.log("\u2705 [V2] Using raw config parameter (PRIORITY 2)"),l}let i=await Ss();if(i){let l=D(C({},i),{staticResources:t!=null?t:void 0});return console.log("\u2705 [V2] Using environment variables config (PRIORITY 3 - build time)"),l}let o=await rl(n);if(o){let l=D(C({},o),{staticResources:t!=null?t:void 0});return console.log("\u2705 [V2] Using local dev config files (PRIORITY 4)"),l}return console.warn("\u26A0\uFE0F [V2] No plugin config found - using defaults"),{basePath:"/",config:{},staticResources:t!=null?t:void 0}};async function bs(n="default",e){try{if(!Ct())return null;if(e)return e;let t=["/config/".concat(n,".config.json"),"/config/".concat(n,".tgd.json"),"/config/".concat(n,".json")];for(let r of t)try{let i=await fetch(r);if(i.ok)return await i.json()}catch(i){continue}return console.warn("\u26A0\uFE0F [loadLocalConfig] No config found for '".concat(n,"'")),null}catch(t){return console.error("[loadLocalConfig] Error loading config:",t),null}}async function Ss(){try{if(!Ct())return;let n=Ie("TAGADA_STORE_ID"),e=Ie("TAGADA_ACCOUNT_ID"),t=Ie("TAGADA_BASE_PATH"),r=Ie("TAGADA_CONFIG_NAME");if(!n||!e)return;let i=await bs(r);if(!i)return;let o={storeId:n,accountId:e,basePath:t||"/",config:i};return console.log("\u{1F6E0}\uFE0F [createRawPluginConfig] Using environment variables (build-time config):",{hasStoreId:!!o.storeId,hasAccountId:!!o.accountId,basePath:o.basePath,hasConfig:!!o.config}),o}catch(n){console.error("[createRawPluginConfig] Error creating config:",n);return}}var ii=class{static getPluginConfig(e,t){return{storeId:(e==null?void 0:e.storeId)||(t==null?void 0:t.storeId),accountId:(e==null?void 0:e.accountId)||(t==null?void 0:t.accountId),basePath:(e==null?void 0:e.basePath)||(t==null?void 0:t.basePath)||"/",config:(e==null?void 0:e.config)||{}}}static validateConfig(e){return!!(e.storeId&&e.accountId)}};En();qe();qe();var si=new Map,ai=new Set;function al(){return typeof window=="undefined"?null:new URLSearchParams(window.location.search).get("authCode")}async function Is(n,e,t,r=!1){if(ai.has(n))throw r&&console.log("[AuthHandoff] Code already resolved, skipping duplicate request"),new Error("Auth code already resolved");let i=si.get(n);if(i)return r&&console.log("[AuthHandoff] Resolution already in progress, waiting for existing request"),i;r&&console.log("[AuthHandoff] Resolving authCode:",n.substring(0,15)+"...");let o=(async()=>{try{let s=await fetch("".concat(t,"/api/v1/cms/auth/resolve-handoff"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:n,storeId:e})});if(!s.ok){let l=await s.json().catch(()=>({message:"Unknown error"}));throw new Error(l.message||"Failed to resolve auth handoff: ".concat(s.status))}let a=await s.json();return r&&console.log("[AuthHandoff] \u2705 Resolved successfully:",{customerId:a.customer.id,role:a.customer.role,hasContext:Object.keys(a.context).length>0}),r&&console.log("[AuthHandoff] Storing new token (overriding existing)"),oe(a.token),cl(r),ai.add(n),a}catch(s){throw console.error("[AuthHandoff] \u274C Failed to resolve:",s),s}finally{si.delete(n)}})();return si.set(n,o),o}function cl(n=!1){if(typeof window=="undefined")return;let e=new URL(window.location.href);e.searchParams.has("authCode")&&(e.searchParams.delete("authCode"),window.history.replaceState({},"",e.pathname+e.search+e.hash),n&&console.log("[AuthHandoff] Cleaned authCode from URL"))}function Cs(){let n=al();return!(!n||!n.startsWith("ah_")||ai.has(n))}var on=class{constructor(e={}){this.bus=new $n;this.eventDispatcher=new Ye;this.tokenPromise=null;this.tokenResolver=null;this.isInitializingSession=!1;this.lastSessionInitError=null;this.sessionInitRetryCount=0;this.MAX_SESSION_INIT_RETRIES=3;var a,l,c,u;this.config=e,this.instanceId=Math.random().toString(36).substr(2,9),this.boundHandleStorageChange=this.handleStorageChange.bind(this),this.boundHandlePageshow=p=>{if(p.persisted)if(this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Page restored from BFcache (back button), re-initializing funnel...")),this.funnel&&this.state.session&&this.state.store){this.funnel.resetInitialization();let w=this.getAccountId(),f=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("funnelId")||void 0;this.funnel.autoInitialize({customerId:this.state.session.customerId,sessionId:this.state.session.sessionId},{id:this.state.store.id,accountId:w},f).catch(I=>{console.error("[TagadaClient] Funnel re-initialization failed:",I)})}else this.sessionInitRetryCount=0,this.initialize()},console.log("[TagadaClient ".concat(this.instanceId,"] Initializing...")),console.log("[TagadaClient ".concat(this.instanceId,"] Config:"),{debugMode:e.debugMode,hasRawPluginConfig:!!e.rawPluginConfig,rawPluginConfig:e.rawPluginConfig,features:e.features}),$i(this.config.debugMode)&&this.config.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Preview mode active - state cleared"));let r=this.resolveEnvironment(),i=Ki(r);e.customApiConfig&&(i=D(C(C({},i),e.customApiConfig),{apiConfig:C(C({},i.apiConfig),e.customApiConfig.apiConfig)}),this.config.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Applied custom API config:"),i.apiConfig.baseUrl)),this.state={auth:{isAuthenticated:!1,isLoading:!1,customer:null,session:null},session:null,customer:null,locale:{locale:"en-US",language:"en",region:"US",messages:{}},currency:{code:"USD",symbol:"$",name:"US Dollar"},store:null,environment:i,isLoading:!0,isInitialized:!1,isSessionInitialized:!1,pluginConfig:{basePath:"/",config:{}},pluginConfigLoading:!0,debugMode:(a=e.debugMode)!=null?a:r!=="production",token:null},console.log("[TagadaClient ".concat(this.instanceId,"] Initial state:"),{pluginConfigLoading:this.state.pluginConfigLoading,hasRawPluginConfig:!!e.rawPluginConfig}),this.apiClient=new at({baseURL:i.apiConfig.baseUrl});let o=(l=e.features)==null?void 0:l.funnel;if(o!==!1){let p=typeof o=="object"?o:{};this.funnel=new Nt({apiClient:this.apiClient,debugMode:this.state.debugMode,pluginConfig:this.state.pluginConfig,environment:this.state.environment,autoRedirect:p.autoRedirect,funnelId:(c=e.rawPluginConfig)==null?void 0:c.funnelId,stepId:(u=e.rawPluginConfig)==null?void 0:u.stepId})}this.apiClient.setTokenProvider(this.waitForToken.bind(this)),typeof window!="undefined"&&(window.addEventListener("storage",this.boundHandleStorageChange),window.addEventListener("pageshow",this.boundHandlePageshow)),this.setupConfigHotReload(),this.initialize()}destroy(){typeof window!="undefined"&&(window.removeEventListener("storage",this.boundHandleStorageChange),window.removeEventListener("pageshow",this.boundHandlePageshow)),this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Destroyed")),this.eventDispatcher.clear(),this.bus.clear()}handleStorageChange(){if(Tt()===this.state.token){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Token unchanged (ignoring event)"));return}if(this.isInitializingSession){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Session initialization in progress, skipping storage change"));return}if(this.sessionInitRetryCount>=this.MAX_SESSION_INIT_RETRIES&&this.lastSessionInitError){this.state.debugMode&&console.error("[TagadaClient ".concat(this.instanceId,"] Max session init retries reached, giving up"),this.lastSessionInitError);return}this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Storage changed, re-initializing token...")),this.initializeToken()}subscribe(e){return this.eventDispatcher.subscribe(e)}getState(){return this.state}updateState(e){this.state=C(C({},this.state),e),this.eventDispatcher.notify(this.state)}resolveEnvironment(){return this.config.environment?this.config.environment:It()}async initialize(){try{await this.initializePluginConfig(),this.state.pluginConfig.storeId?await this.initializeToken():(console.warn("[TagadaClient] No store ID found in plugin config. Skipping token initialization."),this.updateState({isLoading:!1,isInitialized:!0}))}catch(e){console.error("[TagadaClient] Initialization failed:",e),this.updateState({isLoading:!1,isInitialized:!0})}}async initializePluginConfig(){if(console.log("[TagadaClient ".concat(this.instanceId,"] initializePluginConfig called"),{pluginConfigLoading:this.state.pluginConfigLoading,hasRawPluginConfig:!!this.config.rawPluginConfig}),!this.state.pluginConfigLoading){console.log("[TagadaClient ".concat(this.instanceId,"] Plugin config already loading or loaded, skipping..."));return}try{let e=this.config.localConfig||"default";console.log("[TagadaClient ".concat(this.instanceId,"] Loading plugin config with variant: ").concat(e));let t=await oi(e,this.config.rawPluginConfig);console.log("[TagadaClient ".concat(this.instanceId,"] Plugin config loaded:"),t),this.updateState({pluginConfig:t,pluginConfigLoading:!1}),this.funnel&&this.funnel.setConfig({pluginConfig:t,environment:this.state.environment})}catch(e){console.error("[TagadaClient] Failed to load plugin config:",e),this.updateState({pluginConfig:{basePath:"/",config:{}},pluginConfigLoading:!1})}}async initializeToken(){var e;if(Cs()){let t=this.state.pluginConfig.storeId;if(!t)return console.error("[TagadaClient] Cannot resolve authCode: storeId not found in config"),this.fallbackToNormalFlow();console.log("[TagadaClient ".concat(this.instanceId,"] \u{1F510} Cross-domain auth detected, resolving..."));try{let r=new URLSearchParams(window.location.search).get("authCode");if(!r)return this.fallbackToNormalFlow();let i=await Is(r,t,this.state.environment.apiConfig.baseUrl,this.state.debugMode);console.log("[TagadaClient ".concat(this.instanceId,"] \u2705 Auth handoff resolved:"),{customerId:i.customer.id,role:i.customer.role,hasContext:Object.keys(i.context).length>0}),this.setToken(i.token);let o=rn(i.token);o?(this.updateState({session:o}),await this.initializeSession(o),(e=i.context)!=null&&e.funnelSessionId&&this.funnel&&this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Restoring funnel session from handoff context:"),i.context.funnelSessionId)):(console.error("[TagadaClient] Failed to decode token from handoff"),this.updateState({isInitialized:!0,isLoading:!1}));return}catch(r){console.error("[TagadaClient ".concat(this.instanceId,"] \u274C Auth handoff failed, falling back to normal flow:"),r)}}await this.fallbackToNormalFlow()}async fallbackToNormalFlow(){let t=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("token");t&&(this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] \u{1F512} URL token detected, setting immediately to prevent race condition")),this.apiClient.updateToken(t),oe(t));let r=Tt();console.log("[TagadaClient ".concat(this.instanceId,"] Initializing token (normal flow)..."),{hasExistingToken:!!r,hasQueryToken:!!t,storeId:this.state.pluginConfig.storeId});let i=null,o=!1;if(t?(i=t,o=!0):r&&!ws(r)&&(i=r),i){this.setToken(i),o&&(this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Persisting query token to storage...")),oe(i));let s=rn(i);s?(this.updateState({session:s}),await this.initializeSession(s)):(console.error("[TagadaClient] Failed to decode token"),this.updateState({isInitialized:!0,isLoading:!1}))}else{let s=this.state.pluginConfig.storeId;console.log("[TagadaClient ".concat(this.instanceId,"] No existing token, creating anonymous token..."),{hasStoreId:!!s,storeId:s}),s?await this.createAnonymousToken(s):(console.warn("[TagadaClient ".concat(this.instanceId,"] No storeId in plugin config, skipping anonymous token creation")),this.updateState({isInitialized:!0,isLoading:!1}))}}setToken(e){this.apiClient.updateToken(e),this.updateState({token:e}),this.tokenResolver&&(this.tokenResolver(e),this.tokenPromise=null,this.tokenResolver=null)}waitForToken(){return this.apiClient.getCurrentToken()?Promise.resolve(this.apiClient.getCurrentToken()):(this.tokenPromise||(this.tokenPromise=new Promise(e=>{this.tokenResolver=e})),this.tokenPromise)}async createAnonymousToken(e){if(typeof window!="undefined"){let r=new URLSearchParams(window.location.search).get("token");if(r){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] \u{1F512} URL has token, skipping anonymous token creation")),this.setToken(r),oe(r);let i=rn(r);i&&(this.updateState({session:i}),await this.initializeSession(i));return}}if(this.isInitializingSession){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Session initialization in progress, skipping anonymous token creation"));return}try{let t=vt();this.state.debugMode&&console.log("[TagadaClient] Creating anonymous token for store:",e,{draft:t});let r=await this.apiClient.post("/api/v1/cms/session/anonymous",{storeId:e,role:"anonymous",draft:t},{skipAuth:!0});this.setToken(r.token),oe(r.token);let i=rn(r.token);i&&(this.updateState({session:i}),await this.initializeSession(i)),this.updateState({isSessionInitialized:!0})}catch(t){console.error("[TagadaClient] Failed to create anonymous token:",t),this.updateState({isInitialized:!0,isLoading:!1})}}async initializeSession(e){var t,r,i,o,s,a,l,c,u,p,w;if(this.isInitializingSession){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Session initialization already in progress, skipping"));return}this.isInitializingSession=!0;try{this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Initializing session..."),{sessionId:e.sessionId});let b=ys(),f=As(),I=Es(),h=vt(),O=new URLSearchParams(window.location.search).get("draft");O!==null&&dr(O==="true");let x={storeId:e.storeId,accountId:e.accountId,customerId:e.customerId,role:e.role,browserLocale:I,queryLocale:f.locale,queryCurrency:f.currency,utmSource:f.utmSource,utmMedium:f.utmMedium,utmCampaign:f.utmCampaign,browser:b.userAgent.browser.name,browserVersion:b.userAgent.browser.version,os:b.userAgent.os.name,osVersion:b.userAgent.os.version,deviceType:(t=b.userAgent.device)==null?void 0:t.type,deviceModel:(r=b.userAgent.device)==null?void 0:r.model,deviceVendor:(i=b.userAgent.device)==null?void 0:i.vendor,userAgent:b.userAgent.name,engineName:b.userAgent.engine.name,engineVersion:b.userAgent.engine.version,cpuArchitecture:b.userAgent.cpu.architecture,isBot:(s=(o=b.flags)==null?void 0:o.isBot)!=null?s:!1,isChromeFamily:(l=(a=b.flags)==null?void 0:a.isChromeFamily)!=null?l:!1,isStandalonePWA:(u=(c=b.flags)==null?void 0:c.isStandalonePWA)!=null?u:!1,isAppleSilicon:(w=(p=b.flags)==null?void 0:p.isAppleSilicon)!=null?w:!1,screenWidth:b.screenResolution.width,screenHeight:b.screenResolution.height,timeZone:b.timeZone,draft:h,fetchMessages:!1},T=await this.apiClient.post("/api/v1/cms/session/v2/init",x);this.lastSessionInitError=null,this.sessionInitRetryCount=0,this.updateSessionState(T,e),this.updateState({isInitialized:!0,isSessionInitialized:!0,isLoading:!1}),this.state.debugMode&&console.log("[TagadaClient] Session initialized successfully")}catch(b){this.lastSessionInitError=b,this.sessionInitRetryCount++,console.error("[TagadaClient] Error initializing session (attempt ".concat(this.sessionInitRetryCount,"/").concat(this.MAX_SESSION_INIT_RETRIES,"):"),b),this.updateState({isInitialized:!0,isLoading:!1})}finally{this.isInitializingSession=!1}}updateSessionState(e,t){var s,a,l,c,u,p,w,b,f,I;if(e.store){let h=e.store,O=D(C({},e.store),{accountId:h.accountId||((s=this.state.pluginConfig)==null?void 0:s.accountId)||t.accountId||"",presentmentCurrencies:h.presentmentCurrencies||[e.store.currency||"USD"],chargeCurrencies:h.chargeCurrencies||[e.store.currency||"USD"]});this.updateState({store:O})}if(e.locale){let h={locale:e.locale,language:e.locale.split("-")[0],region:(a=e.locale.split("-")[1])!=null?a:"US",messages:(l=e.messages)!=null?l:{}};this.updateState({locale:h})}if(e.store){let h={code:e.store.currency,symbol:this.getCurrencySymbol(e.store.currency),name:this.getCurrencyName(e.store.currency)};this.updateState({currency:h})}let r={isAuthenticated:(u=(c=e.customer)==null?void 0:c.isAuthenticated)!=null?u:!1,isLoading:!1,customer:(p=e.customer)!=null?p:null,session:t};this.updateState({customer:(w=e.customer)!=null?w:null,auth:r});let i=(b=this.config.features)==null?void 0:b.funnel,o=typeof i=="object"&&i.skipAutoInit;if(this.funnel&&!o&&t.customerId&&((f=e.store)!=null&&f.id)){let h=e.store.accountId||((I=this.state.pluginConfig)==null?void 0:I.accountId)||t.accountId||"";if(h){let x=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("funnelId")||void 0;this.state.debugMode&&console.log("[TagadaClient] Auto-initializing funnel...",{customerId:t.customerId,storeId:e.store.id,accountId:h,funnelId:x||"auto-detect"}),this.funnel.autoInitialize({customerId:t.customerId,sessionId:t.sessionId},{id:e.store.id,accountId:h},x).catch(T=>{console.error("[TagadaClient] Funnel auto-initialization failed:",T)})}else console.warn("[TagadaClient] Cannot auto-initialize funnel: accountId is missing")}}getCurrencySymbol(e){return{USD:"$",EUR:"\u20AC",GBP:"\xA3",JPY:"\xA5",CAD:"C$",AUD:"A$"}[e]||e}getCurrencyName(e){return{USD:"US Dollar",EUR:"Euro",GBP:"British Pound",JPY:"Japanese Yen",CAD:"Canadian Dollar",AUD:"Australian Dollar"}[e]||e}getAccountId(){var e,t,r;return((e=this.state.store)==null?void 0:e.accountId)||((t=this.state.pluginConfig)==null?void 0:t.accountId)||((r=this.state.session)==null?void 0:r.accountId)||""}updatePluginConfig(e){this.state.debugMode&&console.log("[TagadaClient] Hot-reloading config:",e);let t=C(C({},this.state.pluginConfig.config),e);this.updateState({pluginConfig:D(C({},this.state.pluginConfig),{config:t})}),this.bus.emit("CONFIG_UPDATED",t),this.state.debugMode&&console.log("[TagadaClient] Config updated successfully")}setupConfigHotReload(){if(typeof window=="undefined")return;let e=t=>{var r,i;if(((r=t.data)==null?void 0:r.type)==="TAGADAPAY_CONFIG_UPDATE"){let{config:o}=t.data;this.state.debugMode&&console.log("[TagadaClient] Received config update from parent:",o),this.updatePluginConfig(o)}else if(((i=t.data)==null?void 0:i.type)==="APPLY_STYLES_TO_ELEMENT"){let{elementId:o,styles:s}=t.data;this.state.debugMode&&console.log("[TagadaClient] Received style application request:",{elementId:o,styles:s}),this.applyStylesToElement(o,s)}};window.addEventListener("message",e),this.state.debugMode&&console.log("[TagadaClient] Config hot-reload and style manipulation listeners enabled")}applyStylesToElement(e,t){if(typeof document=="undefined")return;let r="tagada-editor-highlight",i=document.getElementById(r);i&&i.remove();let o=p=>{var T;let b=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]).has(p.tagName.toLowerCase()),f=p;if(b){let N=p.parentElement;if((N==null?void 0:N.getAttribute("data-tagada-highlight-wrapper"))==="true"&&N instanceof HTMLElement)f=N;else{let L=document.createElement("div");L.setAttribute("data-tagada-highlight-wrapper","true");let $=window.getComputedStyle(p),pe=$.display;if(pe==="inline"?L.style.display="inline-block":L.style.display=pe,L.style.position="relative",pe==="inline"||pe.includes("inline")){let ie=$.verticalAlign;ie&&ie!=="baseline"&&(L.style.verticalAlign=ie)}["width","height","minWidth","minHeight","maxWidth","maxHeight","flex","flexGrow","flexShrink","flexBasis","gridColumn","gridRow","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","gridArea","alignSelf","justifySelf","boxSizing","gap","rowGap","columnGap","order","aspectRatio"].forEach(ie=>{let Ce=ie.replace(/([A-Z])/g,"-$1").toLowerCase(),j=$.getPropertyValue(Ce);j&&j.trim()!==""&&(ie==="flex"&&j!=="none"&&j!=="0 1 auto"?L.style.flex=j:ie==="boxSizing"?L.style.boxSizing=j:L.style.setProperty(Ce,j))}),p.style&&["width","height","min-width","min-height","max-width","max-height","flex","flex-grow","flex-shrink","flex-basis","grid-column","grid-row","grid-column-start","grid-column-end","grid-row-start","grid-row-end","grid-area","align-self","justify-self","box-sizing","gap","row-gap","column-gap","order","aspect-ratio"].forEach(Ce=>{let j=p.style.getPropertyValue(Ce);j&&L.style.setProperty(Ce,j)}),(T=p.parentNode)==null||T.insertBefore(L,p),L.appendChild(p),f=L}}let I=getComputedStyle(b?p:f);(f.style.position==="static"||!f.style.position)&&(f.style.position="relative");let h=document.createElement("div");h.id=r,h.style.position="absolute",h.style.inset="0",h.style.pointerEvents="none",h.style.zIndex="9999",h.style.boxSizing="border-box",h.style.background="none",h.style.border="none",h.style.outline="none",h.style.margin="0",h.style.padding="0";let O=I.borderRadius;O&&(h.style.borderRadius=O),f.appendChild(h);let x=t||{boxShadow:"0 0 0 2px rgb(239 68 68)"};if(Object.entries(x).forEach(([N,W])=>{let L=N.includes("-")?N.replace(/-([a-z])/g,($,pe)=>pe.toUpperCase()):N;N.includes("-")?h.style.setProperty(N,W):h.style[L]=W}),p.scrollIntoView({behavior:"smooth",block:"center"}),this.state.debugMode){let N=Object.entries(x).map(([W,L])=>"".concat(W,": ").concat(L)).join("; ");console.log("[TagadaClient] Applied styles to highlight div of element #".concat(e,":"),N)}},s=5,a=1e3,l=0,c=p=>{let w=window.getComputedStyle(p);return w.display==="none"||w.visibility==="hidden"||w.opacity==="0"||p.hidden||p.offsetWidth===0||p.offsetHeight===0},u=()=>{let p=document.querySelectorAll('[editor-id~="'.concat(e,'"]'));if(p.length===0){if(l+=1,l>=s){this.state.debugMode&&console.warn('[TagadaClient] Element with editor-id containing "'.concat(e,'" not found after ').concat(s," attempts"));return}this.state.debugMode&&console.warn('[TagadaClient] Element with editor-id containing "'.concat(e,'" not found (attempt ').concat(l,"/").concat(s,"), retrying in ").concat(a/1e3,"s")),setTimeout(u,a);return}let w=null;if(p.length===1)w=p[0];else{for(let b=0;b<p.length;b++)if(!c(p[b])){w=p[b];break}w||(w=p[0])}w&&o(w)};u()}};var zn=class{constructor(e){this.apiClient=e}async initCheckout(e){return this.apiClient.post("/api/v1/checkout/session/init",e)}async initCheckoutAsync(e){return this.apiClient.post("/api/v1/checkout/session/init-async",e)}async preloadCheckout(e,t){let r=e.funnelSessionId;!r&&t&&(r=t()||void 0);let i=typeof e.navigationEvent=="string"?{type:e.navigationEvent}:e.navigationEvent,o=D(C(C(C({},e),r&&{funnelSessionId:r}),i&&{navigationEvent:i}),{currentUrl:e.currentUrl||(typeof window!="undefined"?window.location.href:void 0)});return this.apiClient.post("/api/v1/checkout/session/preload",o)}async checkAsyncStatus(e){return this.apiClient.get("/api/public/v1/checkout/async-status/".concat(e))}async getCheckout(e,t){let r=new URLSearchParams;t&&r.set("currency",t),r.set("skipAsyncWait","false");let i="/api/v1/checkout-sessions/".concat(e,"/v2").concat(r.toString()?"?".concat(r.toString()):"");return this.apiClient.get(i)}async getCheckoutRaw(e,t){let r=new URLSearchParams;t&&r.set("currency",t),r.set("skipAsyncWait","true");let i="/api/v1/checkout-sessions/".concat(e,"/v2").concat(r.toString()?"?".concat(r.toString()):"");return this.apiClient.get(i)}async updateAddress(e,t){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/address"),{data:t})}async setCheckoutInfo(e,t){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/checkout-info"),{shippingAddress:t.shippingAddress,billingAddress:t.differentBillingAddress?t.billingAddress:t.shippingAddress,differentBillingAddress:t.differentBillingAddress||!1})}async applyPromotionCode(e,t){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/promotions/apply"),{code:t})}async removePromotion(e,t){return this.apiClient.delete("/api/v1/checkout-sessions/".concat(e,"/promotions/").concat(t))}async getAppliedPromotions(e){return this.apiClient.get("/api/v1/checkout-sessions/".concat(e,"/promotions"))}async replaceSessionLineItems(e,t){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/line-items"),{lineItems:t})}async updateLineItems(e,t){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/line-items"),{lineItems:t})}async addLineItems(e,t){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/line-items/add"),{lineItems:t})}async removeLineItems(e,t){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/line-items/remove"),{lineItems:t})}async setItemQuantity(e,t,r,i){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/line-items/set-quantity"),{variantId:t,quantity:r,priceId:i})}async toggleOrderBump(e,t,r){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/toggle-order-bump"),{orderBumpOfferId:t,selected:r})}async updateCustomer(e,t){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/customer"),t)}async updateCustomerAndSessionInfo(e,t){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/customer-and-session-info"),t)}async previewCheckoutSession(e){return this.apiClient.post("/api/v1/checkout-sessions/preview",e)}};An();var Yn=class{constructor(e){this.apiClient=e}async getShippingRates(e){return this.apiClient.get("/api/v1/checkout-sessions/".concat(e,"/shipping-rates"))}async setShippingRate(e,t){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/shipping-rate"),{shippingRateId:t})}async previewShippingRates(e,t){let r=new URLSearchParams({countryCode:t.countryCode});return t.stateCode&&r.set("stateCode",t.stateCode),this.apiClient.get("/api/v1/checkout-sessions/".concat(e,"/shipping-rates/preview?").concat(r.toString()))}};var jn=class{constructor(e){this.apiClient=e}async createPaymentInstrument(e){return this.apiClient.post("/api/v1/payment/create-payment-instrument",{paymentInstrumentData:e})}async createCardPaymentInstrument(e,t){var l,c;if(!e)throw new Error("Payment processor not initialized");console.log("Creating card payment instrument");let r=await e.tokens.create({type:"card",data:C({cvc:t.cvc,number:Number(t.cardNumber.replace(/\s+/g,""))},this.getCardMonthAndYear(t.expiryDate)),metadata:{nonSensitiveField:"nonSensitiveValue"}}),{expiration_month:i,expiration_year:o}=this.getCardMonthAndYear(t.expiryDate),s={type:r.type,card:{maskedCardNumber:(c=(l=r.enrichments)==null?void 0:l.cardDetails)!=null&&c.bin?"".concat(r.enrichments.cardDetails.bin,"****").concat(r.enrichments.cardDetails.last4):t.cardNumber.replace(/\d(?=\d{4})/g,"*"),expirationMonth:i,expirationYear:o},token:r.id},a=await this.apiClient.post("/api/v1/payment/create-payment-instrument",{paymentInstrumentData:s});return console.log("Payment instrument created:",a),a}async createApplePayPaymentInstrument(e,t){if(!e)throw new Error("Payment processor not initialized");if(!t.id)throw new Error("Apple Pay token is missing");let r={type:"apple_pay",token:t.id,dpanType:t.type,card:{bin:t.card.bin,last4:t.card.last4,expirationMonth:t.card.expiration_month,expirationYear:t.card.expiration_year,brand:t.card.brand}};return await this.apiClient.post("/api/v1/payment/create-payment-instrument",{paymentInstrumentData:r})}async createGooglePayPaymentInstrument(e,t){var o;if(!e)throw new Error("Payment processor not initialized");if(!t.id)throw new Error("Google Pay token is missing");let r={type:"google_pay",token:t.id,dpanType:t.type,card:{bin:t.card.bin,last4:t.card.last4,expirationMonth:t.card.expiration_month,expirationYear:t.card.expiration_year,brand:t.card.brand},authMethod:(o=t==null?void 0:t.details)==null?void 0:o.auth_method};return await this.apiClient.post("/api/v1/payment/create-payment-instrument",{paymentInstrumentData:r})}async createApmPaymentInstrument(e){console.log("Creating APM payment instrument:",e);let t={type:"apm",provider:e.provider,paymentMethod:e.paymentMethod,processorId:e.processorId},r=await this.apiClient.post("/api/v1/payment/create-payment-instrument",{paymentInstrumentData:t});return console.log("APM payment instrument created:",r),r}getCardMonthAndYear(e){let[t,r]=e.split("/"),i=new Date().getFullYear(),o=Math.floor(i/100)*100,s=Number(r)+o;return{expiration_month:Number(t),expiration_year:s}}async processPaymentDirect(e,t,r,i={}){console.log("[PaymentsResource] processPaymentDirect START",i.paymentFlowId?"(flow: ".concat(i.paymentFlowId,")"):""),console.log("[PaymentsResource] Full options object:",JSON.stringify(i,null,2)),console.log("[PaymentsResource] processorId:",i.processorId,"paymentMethod:",i.paymentMethod);try{let o=C(C(C(C(C(C({checkoutSessionId:e,paymentInstrumentId:t},r&&{threedsSessionId:r}),i.initiatedBy&&{initiatedBy:i.initiatedBy}),i.source&&{source:i.source}),i.paymentFlowId&&{paymentFlowId:i.paymentFlowId}),i.processorId&&{processorId:i.processorId}),i.paymentMethod&&{paymentMethod:i.paymentMethod});console.log("[PaymentsResource] Request body being sent:",JSON.stringify(o,null,2));let s=await this.apiClient.post("/api/public/v1/checkout/pay-v2",o);return console.log("[PaymentsResource] processPaymentDirect SUCCESS:",s),s}catch(o){throw console.error("[PaymentsResource] processPaymentDirect ERROR:",o),o}}async getCardPaymentInstruments(){return this.apiClient.get("/api/v1/payment-instruments/customer")}async markPaymentActionProcessed(e){return this.apiClient.post("/api/v1/payments/require-action/processed",{paymentId:e})}async getPaymentStatus(e){return this.apiClient.get("/api/v1/payments/".concat(e))}async retrievePayment(e){return this.apiClient.post("/api/v1/payments/retrieve",{paymentId:e})}async saveRadarSession(e){return this.apiClient.post("/api/v1/radar-sessions",e)}async completePaymentAfterAction(e){return this.apiClient.post("/api/v1/payments/complete-after-3ds",{paymentId:e})}async updateThreedsStatus(e){return this.apiClient.post("/api/v1/threeds/status",e)}};var qn=class{constructor(e){this.apiClient=e}async getOrder(e){let t=await this.apiClient.get("/api/v1/orders/".concat(e));if(typeof t=="object"&&t!==null&&"success"in t&&t.success===!1)throw new Error(t.error||"Failed to fetch order");let r=typeof t=="object"&&t!==null&&"order"in t?t.order:t;if(!r)throw new Error("Order not found");return r}async createOrder(e){return this.apiClient.post("/api/v1/orders",{checkoutSessionId:e})}async updateOrderStatus(e,t){return this.apiClient.patch("/api/v1/orders/".concat(e,"/status"),{status:t})}async addOrderItems(e,t){return this.apiClient.post("/api/v1/orders/".concat(e,"/items"),{items:t})}async getOrderLineItems(e){return(await this.getOrder(e)).items||[]}};var Ts="https://cvwnizdbugpz6jwk.public.blob.vercel-storage.com/geodata/v1";var Et=new Map,Xn=new Map,ci=new Map,li=new Map;async function ll(n){let e=Et.get(n);if(e)return e;let t=ci.get(n);return t||(t=(async()=>{let r="".concat(Ts,"/").concat(n,"/countries.json"),i=await fetch(r);if(!i.ok)throw new Error("Geodata fetch failed: ".concat(r," (").concat(i.status,")"));let o=await i.json();return Et.set(n,o),ci.delete(n),o})(),ci.set(n,t),t)}async function ul(n){let e=Xn.get(n);if(e)return e;let t=li.get(n);return t||(t=(async()=>{let r="".concat(Ts,"/").concat(n,"/regions.json"),i=await fetch(r);if(!i.ok)throw new Error("Geodata fetch failed: ".concat(r," (").concat(i.status,")"));let o=await i.json();return Xn.set(n,o),li.delete(n),o})(),li.set(n,t),t)}function dl(n){return Et.get(n)||Et.get("en")||{}}function pl(n){return Xn.get(n)||Xn.get("en")||{}}async function Rs(n="en"){await Promise.all([ll(n),ul(n)])}var Os=(n="en")=>{let e=dl(n);return Object.entries(e).map(([t,r])=>({code:t,name:r.n,iso3:r.i3,numeric:r.nu,uniqueKey:"country-".concat(t)})).sort((t,r)=>t.name.localeCompare(r.name))},Ps=(n,e="en")=>{let r=pl(e)[n];return r?r.map(([i,o],s)=>({code:i,name:o,countryCode:n,uniqueKey:"state-".concat(n,"-").concat(i,"-").concat(s)})).sort((i,o)=>i.name.localeCompare(o.name)):[]};function vs(n){return Et.has(n)}function xs(){return[...Et.keys()]}async function Ns(n){await Rs(n)}typeof globalThis!="undefined"&&typeof fetch!="undefined"&&Rs("en").catch(()=>{});var Jn=class{static getCountriesData(e="en"){try{let t=Os(e),r={};return t.forEach(i=>{r[i.code]={iso:i.code,iso3:i.iso3||"",numeric:i.numeric||0,name:i.name}}),r}catch(t){return console.error("Failed to load ISO data for language: ".concat(e),t),{}}}static getRegions(e,t="en"){try{return Ps(e,t).map(i=>({iso:i.code,name:i.name}))}catch(r){return[]}}static findRegion(e,t,r="en"){var o;return(o=this.getRegions(e,r).find(s=>s.iso===t))!=null?o:null}static mapGoogleToISO(e,t,r,i="en"){let o=this.getRegions(r,i);if(o.length===0)return null;let s=o.find(a=>a.iso===e);return s||(s=o.find(a=>a.name.toLowerCase()===e.toLowerCase()),s)||(s=o.find(a=>a.name.toLowerCase()===t.toLowerCase()),s)?s:(s=o.find(a=>a.name.toLowerCase().includes(t.toLowerCase())||t.toLowerCase().includes(a.name.toLowerCase())),s!=null?s:null)}static isLanguageRegistered(e){return vs(e)}static getRegisteredLanguages(){return xs()}static async importLanguage(e){return Ns(e)}static getAvailableLanguages(){return["en","ru","de","fr","es","zh","hi","pt","ja","ar","it","he"]}};var yt=class{static initialize(e){var t,r;this.apiKey=e,typeof window!="undefined"&&((r=(t=window.google)==null?void 0:t.maps)!=null&&r.places)&&(this.service=new window.google.maps.places.AutocompleteService)}static async searchPlaces(e,t={}){return!this.service||!e.trim()?[]:new Promise((r,i)=>{this.service.getPlacePredictions({input:e,types:t.types||["address"],componentRestrictions:t.componentRestrictions},(o,s)=>{var a,l,c;s===((c=(l=(a=window.google)==null?void 0:a.maps)==null?void 0:l.places)==null?void 0:c.PlacesServiceStatus.OK)&&o?r(o):r([])})})}static async getPlaceDetails(e){var t,r;return typeof window=="undefined"||!((r=(t=window.google)==null?void 0:t.maps)!=null&&r.places)?null:new Promise((i,o)=>{new window.google.maps.places.PlacesService(document.createElement("div")).getDetails({placeId:e,fields:["place_id","formatted_address","address_components","geometry"]},(a,l)=>{var c,u,p;l===((p=(u=(c=window.google)==null?void 0:c.maps)==null?void 0:u.places)==null?void 0:p.PlacesServiceStatus.OK)&&a?i(a):i(null)})})}static extractAddressComponents(e){let t={};for(let r of e.address_components){let i=r.types;i.includes("street_number")?t.streetNumber=r.long_name:i.includes("route")?t.route=r.long_name:i.includes("locality")?(t.city=r.long_name,t.locality=r.long_name):i.includes("administrative_area_level_2")?(t.administrativeAreaLevel2=r.short_name,t.administrativeAreaLevel2Long=r.long_name,t.city||(t.city=r.long_name,t.locality=r.long_name)):i.includes("administrative_area_level_1")?(t.state=r.long_name,t.administrativeAreaLevel1=r.short_name,t.administrativeAreaLevel1Long=r.long_name):i.includes("postal_code")?t.postalCode=r.long_name:i.includes("country")&&(t.country=r.long_name,t.countryCode=r.short_name,t.iso=r.short_name)}return!t.administrativeAreaLevel1&&t.administrativeAreaLevel2&&(t.state=t.administrativeAreaLevel2Long||t.administrativeAreaLevel2,t.administrativeAreaLevel1=t.administrativeAreaLevel2,t.administrativeAreaLevel1Long=t.administrativeAreaLevel2Long),t}};yt.apiKey=null,yt.service=null;sr();var ui=class{static findVariant(e,t){for(let r of e){let i=r.variants.find(o=>o.id===t);if(i)return i}return null}static getVariantPrice(e,t="USD"){let r=e.prices.find(o=>o.currency===t);if(r)return r;let i=e.prices.find(o=>o.default);return i||e.prices[0]||null}static getAllVariants(e){let t=[];for(let r of e)if(r.variants)for(let i of r.variants)t.push({product:r,variant:i});return t}static filterVariants(e,t){let r=[];for(let i of e)if(i.variants)for(let o of i.variants)t(o,i)&&r.push({product:i,variant:o});return r}};var di=class{static getOrderLineItems(e){return e.items||[]}static getOrderTotal(e){return e.paidAmount||0}static getOrderStatus(e){return e.status||"unknown"}static isOrderCompleted(e){return e.status==="completed"||e.status==="fulfilled"}static isOrderPending(e){return e.status==="pending"||e.status==="processing"}static isOrderCancelled(e){return e.status==="cancelled"||e.status==="refunded"}};function fl(n,e="USD",t="en-US"){let r=sn.getDecimalPlaces(e),i;r===0?i=n/100:i=n/Math.pow(10,r);try{return new Intl.NumberFormat(t,{style:"currency",currency:e,minimumFractionDigits:r,maximumFractionDigits:r}).format(i)}catch(o){let s=sn.getCurrencySymbol(e);return"".concat(s).concat(i.toFixed(r))}}var sn=class{static getCurrency(e,t="USD"){var i,o,s;let r;return typeof(e==null?void 0:e.currency)=="string"?r=e.currency:(i=e==null?void 0:e.currency)!=null&&i.code?r=e.currency.code:(s=(o=e==null?void 0:e.store)==null?void 0:o.presentmentCurrencies)!=null&&s[0]?r=e.store.presentmentCurrencies[0]:r=t,{code:r,symbol:this.getCurrencySymbol(r),name:this.getCurrencyName(r),decimalPlaces:this.getDecimalPlaces(r)}}static getCurrencySymbol(e){return{USD:"$",EUR:"\u20AC",GBP:"\xA3",JPY:"\xA5",CAD:"C$",AUD:"A$",CHF:"CHF",CNY:"\xA5",SEK:"kr",NOK:"kr",DKK:"kr",PLN:"z\u0142",CZK:"K\u010D",HUF:"Ft",RON:"lei",BGN:"\u043B\u0432",HRK:"kn",RUB:"\u20BD",UAH:"\u20B4",TRY:"\u20BA",BRL:"R$",ARS:"$",CLP:"$",COP:"$",MXN:"$",PEN:"S/",UYU:"$U",VEF:"Bs",ZAR:"R",EGP:"\xA3",MAD:"\u062F.\u0645.",TND:"\u062F.\u062A",DZD:"\u062F.\u062C",LYD:"\u0644.\u062F",NGN:"\u20A6",GHS:"\u20B5",KES:"KSh",UGX:"USh",TZS:"TSh",ETB:"Br",ZMW:"ZK",BWP:"P",SZL:"L",LSL:"L",NAD:"N$",MUR:"\u20A8",SCR:"\u20A8",KWD:"\u062F.\u0643",BHD:"\u062F.\u0628",QAR:"\u0631.\u0642",AED:"\u062F.\u0625",OMR:"\u0631.\u0639.",YER:"\uFDFC",SAR:"\u0631.\u0633",JOD:"\u062F.\u0627",LBP:"\u0644.\u0644",ILS:"\u20AA",INR:"\u20B9",PKR:"\u20A8",BDT:"\u09F3",LKR:"\u20A8",NPR:"\u20A8",AFN:"\u060B",KZT:"\u20B8",UZS:"\u043B\u0432",KGS:"\u043B\u0432",TJS:"SM",TMT:"T",AZN:"\u20BC",GEL:"\u20BE",AMD:"\u058F",KRW:"\u20A9",THB:"\u0E3F",VND:"\u20AB",IDR:"Rp",MYR:"RM",SGD:"S$",PHP:"\u20B1",TWD:"NT$",HKD:"HK$",MOP:"MOP$",BND:"B$",LAK:"\u20AD",KHR:"\u17DB",MMK:"K",BOB:"Bs",PYG:"\u20B2",GTQ:"Q",HNL:"L",NIO:"C$",CRC:"\u20A1",PAB:"B/.",DOP:"RD$",JMD:"J$",TTD:"TT$",BBD:"Bds$",XCD:"EC$",AWG:"\u0192",ANG:"\u0192",SRD:"$",GYD:"G$",VES:"Bs.S",VED:"Bs.D"}[e]||e}static getCurrencyName(e){return{USD:"US Dollar",EUR:"Euro",GBP:"British Pound",JPY:"Japanese Yen",CAD:"Canadian Dollar",AUD:"Australian Dollar",CHF:"Swiss Franc",CNY:"Chinese Yuan",SEK:"Swedish Krona",NOK:"Norwegian Krone",DKK:"Danish Krone",PLN:"Polish Zloty",CZK:"Czech Koruna",HUF:"Hungarian Forint",RON:"Romanian Leu",BGN:"Bulgarian Lev",HRK:"Croatian Kuna",RUB:"Russian Ruble",UAH:"Ukrainian Hryvnia",TRY:"Turkish Lira",BRL:"Brazilian Real",ARS:"Argentine Peso",CLP:"Chilean Peso",COP:"Colombian Peso",MXN:"Mexican Peso",PEN:"Peruvian Sol",UYU:"Uruguayan Peso",VEF:"Venezuelan Bolivar",ZAR:"South African Rand",EGP:"Egyptian Pound",MAD:"Moroccan Dirham",TND:"Tunisian Dinar",DZD:"Algerian Dinar",LYD:"Libyan Dinar",NGN:"Nigerian Naira",GHS:"Ghanaian Cedi",KES:"Kenyan Shilling",UGX:"Ugandan Shilling",TZS:"Tanzanian Shilling",ETB:"Ethiopian Birr",ZMW:"Zambian Kwacha",BWP:"Botswana Pula",SZL:"Swazi Lilangeni",LSL:"Lesotho Loti",NAD:"Namibian Dollar",MUR:"Mauritian Rupee",SCR:"Seychellois Rupee",KWD:"Kuwaiti Dinar",BHD:"Bahraini Dinar",QAR:"Qatari Riyal",AED:"UAE Dirham",OMR:"Omani Rial",YER:"Yemeni Rial",SAR:"Saudi Riyal",JOD:"Jordanian Dinar",LBP:"Lebanese Pound",ILS:"Israeli Shekel",INR:"Indian Rupee",PKR:"Pakistani Rupee",BDT:"Bangladeshi Taka",LKR:"Sri Lankan Rupee",NPR:"Nepalese Rupee",AFN:"Afghan Afghani",KZT:"Kazakhstani Tenge",UZS:"Uzbekistani Som",KGS:"Kyrgyzstani Som",TJS:"Tajikistani Somoni",TMT:"Turkmenistani Manat",AZN:"Azerbaijani Manat",GEL:"Georgian Lari",AMD:"Armenian Dram",KRW:"South Korean Won",THB:"Thai Baht",VND:"Vietnamese Dong",IDR:"Indonesian Rupiah",MYR:"Malaysian Ringgit",SGD:"Singapore Dollar",PHP:"Philippine Peso",TWD:"Taiwan Dollar",HKD:"Hong Kong Dollar",MOP:"Macanese Pataca",BND:"Brunei Dollar",LAK:"Lao Kip",KHR:"Cambodian Riel",MMK:"Myanmar Kyat",BOB:"Bolivian Boliviano",PYG:"Paraguayan Guarani",GTQ:"Guatemalan Quetzal",HNL:"Honduran Lempira",NIO:"Nicaraguan Cordoba",CRC:"Costa Rican Colon",PAB:"Panamanian Balboa",DOP:"Dominican Peso",JMD:"Jamaican Dollar",TTD:"Trinidad and Tobago Dollar",BBD:"Barbadian Dollar",XCD:"East Caribbean Dollar",AWG:"Aruban Florin",ANG:"Netherlands Antillean Guilder",SRD:"Surinamese Dollar",GYD:"Guyanese Dollar",VES:"Venezuelan Bolivar Soberano",VED:"Venezuelan Bolivar Digital"}[e]||e}static getDecimalPlaces(e){var r;return(r={JPY:0,KRW:0,VND:0,IDR:0,LAK:0,KHR:0,MMK:0,PYG:0,VEF:0,VES:0,VED:0}[e])!=null?r:2}};var pi=class{static getCheckoutSessionId(e){var t;return((t=e.checkoutSession)==null?void 0:t.id)||""}static getLineItems(e){var r;let t=(r=e.checkoutSession)==null?void 0:r.lineItems;return Array.isArray(t)?t:[]}static getTotal(e){var r;let t=(r=e.checkoutSession)==null?void 0:r.totalPrice;return typeof t=="number"?t:0}static isClubMember(e){return e.customerIsClubMember||!1}};var fi=class{static isValidPromotion(e){return!!(e.id&&e.name)}static getPromotionType(e){return e.type||"unknown"}static hasRules(e){return!!(e.rules&&e.rules.length>0)}static hasActions(e){return!!(e.actions&&e.actions.length>0)}};var gi=class{static isValidOffer(e){return!!(e.id&&e.summaries&&e.summaries.length>0)}static getOfferTotal(e){var t,r;return((r=(t=e.summaries)==null?void 0:t[0])==null?void 0:r.totalAmount)||0}static getOfferAdjustedTotal(e){var t,r;return((r=(t=e.summaries)==null?void 0:t[0])==null?void 0:r.totalAdjustedAmount)||0}static hasItems(e){return!!(e.offerLineItems&&e.offerLineItems.length>0)}static getOfferCurrency(e){var t,r;return((r=(t=e.summaries)==null?void 0:t[0])==null?void 0:r.currency)||"USD"}static getOfferTitle(e,t="en"){var r,i;return((r=e.titleTrans)==null?void 0:r[t])||((i=e.titleTrans)==null?void 0:i.en)||"Offer ".concat(e.id)}};var mi=class{static isValidOffer(e){return!!(e.id&&e.name&&e.price>0)}static toggleSelection(e){return D(C({},e),{isSelected:!e.isSelected})}static calculatePreview(e,t=0){let r=t+e.price,i=e.isSelected?r:t;return{offer:e,totalAmount:r,adjustedAmount:i}}static getSelectedOffers(e){return e.filter(t=>t.isSelected)}static getSelectedTotal(e){return e.filter(t=>t.isSelected).reduce((t,r)=>t+r.price,0)}};Ot();var gl={session:n=>["funnel","session",n],allSessions:()=>["funnel","sessions"],funnelMeta:n=>["funnel","meta",n]};function _s(n,e,t="*"){let r={type:"TAGADAPAY_CONFIG_UPDATE",config:e,timestamp:Date.now()};n.postMessage(r,t)}function ml(n,e="iframe"){if(typeof document=="undefined")return;let t=document.querySelectorAll(e);t.forEach(r=>{r.contentWindow&&_s(r.contentWindow,n)}),console.log("[ConfigHotReload] Broadcasted config update to ".concat(t.length," iframe(s)"))}function hl(n){if(typeof window=="undefined")return()=>{};let e=t=>{var r;((r=t.data)==null?void 0:r.type)==="TAGADAPAY_CONFIG_UPDATE"&&n(t.data.config)};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}}function El(n,e=150){let t=null;return r=>{t&&clearTimeout(t),t=setTimeout(()=>{n(r),t=null},e)}}var wi=ra(Us()),ee,At=typeof window!="undefined"&&typeof document!="undefined",Pl=At?history.pushState.bind(history):null,vl=At?history.replaceState.bind(history):null;function er(){ee=void 0}At&&(window.addEventListener("popstate",er),window.addEventListener("hashchange",er),history.pushState=function(...n){return er(),Pl.apply(this,n)},history.replaceState=function(...n){return er(),vl.apply(this,n)});function an(){if(!At)return null;if(ee!==void 0)return console.log("[TagadaPay SDK] \u{1F4E6} Returning cached internal path:",ee),ee;console.log("[TagadaPay SDK] \u{1F50D} getInternalPath() called for:",window.location.pathname);try{let n=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.endsWith(".localhost");if(console.log("[TagadaPay SDK] \u{1F3E0} isLocalhost:",n),n){let s=new URLSearchParams(window.location.search).get("__remap");if(console.log("[TagadaPay SDK] \u{1F50D} Query parameter __remap:",s),s)return ee=s,s;try{let a=localStorage.getItem("tagadapay-remap");if(console.log("[TagadaPay SDK] \u{1F50D} localStorage tagadapay-remap:",a),a)try{let l=JSON.parse(a);if(console.log("[TagadaPay SDK] \u{1F4DD} Parsed remap config:",l),l.externalPath&&l.internalPath){let c=window.location.pathname;console.log("[TagadaPay SDK] \u{1F50D} Checking if",c,"matches pattern",l.externalPath);let p=(0,wi.match)(l.externalPath,{decode:decodeURIComponent,end:!0})(c);return console.log("[TagadaPay SDK] \u{1F3AF} Match result:",p),p!==!1?(ee=l.internalPath,console.log("[TagadaPay SDK] \u2705 Path remap: ".concat(l.externalPath," \u2192 ").concat(l.internalPath)),console.log("[TagadaPay SDK] \u2705 Current URL ".concat(c," matches external pattern")),console.log("[TagadaPay SDK] \u{1F4E6} Caching and returning:",l.internalPath),l.internalPath):(console.log("[TagadaPay SDK] \u274C Current URL ".concat(c," does NOT match external pattern ").concat(l.externalPath)),ee=null,null)}else console.log("[TagadaPay SDK] \u26A0\uFE0F Parsed config missing externalPath or internalPath")}catch(l){return console.log("[TagadaPay SDK] \u26A0\uFE0F Failed to parse as JSON, using legacy format:",l),ee=a,a}else console.log("[TagadaPay SDK] \u{1F4ED} No localStorage tagadapay-remap found")}catch(a){console.log("[TagadaPay SDK] \u274C localStorage error:",a)}}let e=document.querySelector('meta[name="tagadapay-path-remap"]');if(e)try{let o=e.getAttribute("content");if(o){let s=decodeURIComponent(o),a=JSON.parse(s);if(a.internal)return console.log("[TagadaPay SDK] \u2705 Got internal path from full remap config:",a.internal),ee=a.internal,a.internal}}catch(o){console.error("[TagadaPay SDK] Error parsing full remap config:",o)}let t=document.querySelector('meta[name="x-plugin-internal-path"]');if(!t)return console.log("[TagadaPay SDK] \u2139\uFE0F No path remap meta tags found"),ee=null,null;let r=t.getAttribute("content");if(!r||r.trim()==="")return ee=null,null;let i=r.trim();return i.startsWith("/")?(console.log("[TagadaPay SDK] \u2705 Got internal path from legacy meta tag:",i),ee=i,i):(ee=null,null)}catch(n){return ee=null,null}}function Gs(){return an()!==null}function Hs(){if(!At)throw new Error("[TagadaPay SDK] getPathInfo() cannot be called in SSR context");try{let n=window.location.pathname,e=an(),t=new URLSearchParams(window.location.search),r=window.location.hash.replace(/^#/,"");return{externalPath:n,internalPath:e,isRemapped:e!==null,fullUrl:window.location.href,query:t,hash:r}}catch(n){return{externalPath:"/",internalPath:null,isRemapped:!1,fullUrl:"",query:new URLSearchParams,hash:""}}}function tr(n,e){try{if(n===e)return{matched:!0,params:{}};if(!(e.includes(":")||e.includes("*")||e.includes("{")))return{matched:n===e,params:{}};let i=(0,wi.match)(e,{decode:decodeURIComponent,end:!0})(n);if(i===!1)return{matched:!1,params:{}};let o={};return typeof i=="object"&&i.params&&Object.keys(i.params).forEach(s=>{let a=i.params[s];o[s]=Array.isArray(a)?a.join("/"):String(a)}),{matched:!0,params:o}}catch(t){return{matched:n===e,params:{}}}}function xl(n,e,t){let r=Fs(e),i=Fs(t);if(r.length===0||r.length!==i.length)return n;let o={};return r.forEach((s,a)=>{let l=i[a],c=n[s];c!==void 0&&(o[l]=c)}),o}function Fs(n){let e=n.match(/:([a-zA-Z0-9_]+)/g);return e?e.map(t=>t.substring(1)):[]}function Ks(n){if(typeof n!="string")throw new Error("[TagadaPay SDK] internalPath must be a string, got ".concat(typeof n));if(n.trim()==="")throw new Error("[TagadaPay SDK] internalPath cannot be empty");if(!n.startsWith("/"))throw new Error('[TagadaPay SDK] internalPath must start with /, got "'.concat(n,'"'));if(!At)return{matched:!1,params:{}};try{let e=window.location.pathname,t=an();if(t){if(!tr(t,n).matched)return{matched:!1,params:{}};let i=null;if(typeof localStorage!="undefined")try{let s=localStorage.getItem("tagadapay-remap");if(s){let a=JSON.parse(s);a.externalPath&&a.internalPath===t&&(i=a.externalPath)}}catch(s){}if(!i&&typeof document!="undefined"){console.log("[TagadaPay SDK] \u{1F50D} Checking for production path remap meta tag...");let s=document.querySelector('meta[name="tagadapay-path-remap"]');if(s)try{let a=s.getAttribute("content");if(console.log("[TagadaPay SDK] \u{1F4C4} Found meta tag content (encoded):",(a==null?void 0:a.substring(0,100))+"..."),a){let l=decodeURIComponent(a);console.log("[TagadaPay SDK] \u{1F4C4} Decoded content:",l);let c=JSON.parse(l);console.log("[TagadaPay SDK] \u{1F4E6} Parsed remap config:",c),console.log("[TagadaPay SDK] \u{1F50D} Checking if internal path matches:",{parsedInternal:c.internal,remappedInternalPath:t}),c.external&&c.internal===t?(i=c.external,console.log("[TagadaPay SDK] \u2705 Using external pattern from meta tag:",i)):console.log("[TagadaPay SDK] \u26A0\uFE0F Internal path mismatch - not using meta tag config")}}catch(a){console.error("[TagadaPay SDK] \u274C Error parsing path remap meta tag:",a)}else console.log("[TagadaPay SDK] \u274C No tagadapay-path-remap meta tag found")}if(i){let s=tr(e,i);if(s.matched){console.log("[TagadaPay SDK] \u{1F504} Mapping params from external to internal pattern"),console.log("[TagadaPay SDK] External params:",s.params),console.log("[TagadaPay SDK] External pattern:",i),console.log("[TagadaPay SDK] Internal pattern:",n);let a=xl(s.params,i,n);return console.log("[TagadaPay SDK] Mapped params:",a),{matched:!0,params:a}}}return{matched:!0,params:tr(e,n).params}}return tr(e,n)}catch(e){return{matched:!1,params:{}}}}var Nl=new Set(["BIF","CLP","DJF","GNF","ISK","JPY","KMF","KRW","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"]),_l=new Set(["BHD","IQD","JOD","KWD","LYD","OMR","TND"]);function nr(n,e){let t=e.toUpperCase();return Nl.has(t)?n:_l.has(t)?n/1e3:n/100}function bi(n,e){if(!("events"in n)||!n.events)return!0;let t=n.events;return e in t?t[e]===!0:!0}function Ve(n,e){return n?n.filter(t=>t.enabled&&bi(t,e)):[]}function kl(n){return n.currency&&typeof n.currency=="string"?D(C({},n),{currency:n.currency.toUpperCase()}):C({},n)}function Ll(n){if(n.currency&&n.value!=null){let e=String(n.currency),t=nr(Number(n.value),e);return D(C({},n),{value:t})}return n}function cn(n){let e=kl(n);return e=Ll(e),e}var Dl={PageView:"PageView",ViewContent:"ViewContent",AddToCart:"AddToCart",AddToWishlist:"AddToWishlist",Search:"Search",InitiateCheckout:"InitiateCheckout",AddPaymentInfo:"AddPaymentInfo",Purchase:"Purchase",Lead:"Lead",CompleteRegistration:"CompleteRegistration"};function Si(n,e){var i,o;let t=(i=Dl[n])!=null?i:n,r=cn(e);return r.contents&&Array.isArray(r.contents)&&(r.content_ids=r.contents.map(s=>s.content_id).filter(Boolean),r.content_type=(o=r.content_type)!=null?o:"product"),{name:t,params:r}}var Bl={PageView:"Pageview",ViewContent:"ViewContent",AddToCart:"AddToCart",AddToWishlist:"AddToWishlist",Search:"Search",InitiateCheckout:"InitiateCheckout",AddPaymentInfo:"AddPaymentInfo",Purchase:"Purchase",Lead:"SubmitForm",CompleteRegistration:"CompleteRegistration"};function Ii(n,e){var o,s;let t=(o=Bl[n])!=null?o:n,r=cn(e),i=r.currency?String(r.currency):null;if(i)for(let a of["shipping","tax","subtotal","total_discount"])r[a]!=null&&(r[a]=nr(Number(r[a]),i));return r.contents&&Array.isArray(r.contents)&&(r.content_ids||(r.content_ids=r.contents.map(a=>a.content_id).filter(Boolean)),r.contents=r.contents.map(a=>{var c;let l=a.currency?String(a.currency):i;return{content_id:a.content_id,content_name:a.content_name,content_type:(c=a.content_type)!=null?c:"product",content_category:a.content_category,price:a.price!=null&&l?nr(Number(a.price),l):a.price!=null?Number(a.price):void 0,original_price:a.original_price!=null&&l?nr(Number(a.original_price),l):a.original_price!=null?Number(a.original_price):void 0,quantity:a.quantity!=null?Number(a.quantity):void 0,description:a.description}})),n==="InitiateCheckout"&&(r.content_type=(s=r.content_type)!=null?s:"product",r.delivery_category||(r.delivery_category="home_delivery")),{name:t,params:r}}var Ml={PageView:"PAGE_VIEW",ViewContent:"VIEW_CONTENT",AddToCart:"ADD_CART",AddToWishlist:"ADD_TO_WISHLIST",Search:"SEARCH",InitiateCheckout:"START_CHECKOUT",AddPaymentInfo:"ADD_BILLING",Purchase:"PURCHASE",Lead:"LEAD",CompleteRegistration:"SIGN_UP"};function Ci(n,e){var i;let t=(i=Ml[n])!=null?i:n,r=cn(e);return"value"in r&&(r=D(C({},r),{price:r.value}),delete r.value),"num_items"in r&&(r=D(C({},r),{number_items:r.num_items}),delete r.num_items),r.contents&&Array.isArray(r.contents)&&(r.item_ids=r.contents.map(o=>o.content_id).filter(Boolean)),{name:t,params:r}}var Ul={PageView:"pagevisit",ViewContent:"viewcontent",AddToCart:"addtocart",AddToWishlist:"addtowishlist",Search:"search",InitiateCheckout:"initiatecheckout",AddPaymentInfo:"addpaymentinfo",Purchase:"checkout",Lead:"lead",CompleteRegistration:"signup"};function Ti(n,e){var i;let t=(i=Ul[n])!=null?i:n.toLowerCase(),r=cn(e);return r.order_quantity!==void 0&&(r.order_quantity=Number(r.order_quantity)),r.contents&&Array.isArray(r.contents)&&(r.line_items=r.contents.map(o=>({product_id:o.content_id,product_name:o.content_name,product_category:o.content_category,product_price:o.price!=null?Number(o.price):void 0,product_quantity:o.quantity!=null?Number(o.quantity):void 0}))),{name:t,params:r}}var Fl={PageView:"page_view",ViewContent:"view_item",AddToCart:"add_to_cart",AddToWishlist:"add_to_wishlist",Search:"search",InitiateCheckout:"begin_checkout",AddPaymentInfo:"add_payment_info",Purchase:"purchase",Lead:"generate_lead",CompleteRegistration:"sign_up",Conversion:"conversion"};function Ri(n,e){var i;let t=(i=Fl[n])!=null?i:n.toLowerCase(),r=cn(e);return r.num_items!==void 0&&(r.num_items=Number(r.num_items)),r.contents&&Array.isArray(r.contents)&&(r.items=r.contents.map(o=>({item_id:o.content_id,item_name:o.content_name,item_category:o.content_category,price:o.price!=null?Number(o.price):void 0,quantity:o.quantity!=null?Number(o.quantity):void 0})),r.contents=r.contents.map(o=>({id:o.content_id,name:o.content_name,category:o.content_category,price:o.price!=null?Number(o.price):void 0,quantity:o.quantity!=null?Number(o.quantity):void 0}))),{name:t,params:r}}function Oi(n,e,t){return(e==="Purchase"||e==="Conversion")&&t.googleAdsConversionId&&t.googleAdsConversionLabel?D(C({},n),{send_to:"".concat(t.googleAdsConversionId,"/").concat(t.googleAdsConversionLabel)}):n}function Vs(n,e,t){let r=[],i=Ve(n.facebook,e);if(i.length>0){let c=Si(e,t);i.forEach(u=>r.push({provider:"facebook",mapped:c,pixel:u}))}let o=Ve(n.tiktok,e);if(o.length>0){let c=Ii(e,t);o.forEach(u=>r.push({provider:"tiktok",mapped:c,pixel:u}))}let s=Ve(n.snapchat,e);if(s.length>0){let c=Ci(e,t);s.forEach(u=>r.push({provider:"snapchat",mapped:c,pixel:u}))}let a=Ve(n.pinterest,e);if(a.length>0){let c=Ti(e,t);a.forEach(u=>r.push({provider:"pinterest",mapped:c,pixel:u}))}let l=Ve(n.gtm,e);if(l.length>0){let c=Ri(e,t);l.forEach(u=>{let p=Oi(c.params,e,u);r.push({provider:"gtm",mapped:{name:c.name,params:p},pixel:u})})}return r}qe();var Ws="1.0.0";function $s(n){return typeof window=="undefined"?null:new URLSearchParams(window.location.search).get(n)}function Y(n,...e){n&&console.log("[TagadaTracker]",...e)}function zs(...n){console.warn("[TagadaTracker]",...n)}function Gl(n){if(!n.storeId||typeof n.storeId!="string")throw new Error("TagadaTracker: storeId is required and must be a non-empty string.");if(!n.accountId||typeof n.accountId!="string")throw new Error("TagadaTracker: accountId is required and must be a non-empty string.");if(!n.stepId||typeof n.stepId!="string")throw new Error("TagadaTracker: stepId is required and must be a non-empty string.");if(n.apiBaseUrl)try{new URL(n.apiBaseUrl)}catch(e){throw new Error('TagadaTracker: apiBaseUrl is not a valid URL: "'.concat(n.apiBaseUrl,'"'))}}async function Hl(n,e,t){let r;for(let i=0;i<=e;i++)try{return await n()}catch(o){if(r=o instanceof Error?o:new Error(String(o)),i<e){let s=Math.min(1e3*2**i,8e3);Y(t,"Retry ".concat(i+1,"/").concat(e," in ").concat(s,"ms...")),await new Promise(a=>setTimeout(a,s))}}throw r}var ln=class{constructor(){this.config=null;this.client=null;this.initialized=!1;this.initializing=!1;this.unsubscribe=null;this.version=Ws}async init(e){var r,i;if(this.initialized)return Y(e.debug||!1,"Already initialized \u2014 returning existing session."),this.getSession();if(this.initializing)return Y(e.debug||!1,"Initialization in progress \u2014 skipping duplicate call."),null;this.initializing=!0,this.config=C({debug:!1},e);let t=this.config.debug;try{Gl(this.config)}catch(o){this.initializing=!1;let s=o instanceof Error?o:new Error(String(o));if(this.config.onError)return this.config.onError(s),null;throw s}Y(t,"\u{1F680} Initializing external tracker v".concat(Ws),{storeId:e.storeId,accountId:e.accountId,stepId:e.stepId,funnelId:e.funnelId});try{let o=$s("token");o&&(oe(o),Y(t,"\u{1F511} Bootstrapped token from URL")),this.client=vi({debugMode:t,features:{funnel:{skipAutoInit:!0}},rawPluginConfig:{storeId:this.config.storeId,accountId:this.config.accountId},customApiConfig:this.config.apiBaseUrl?{apiConfig:{baseUrl:this.config.apiBaseUrl.trim()}}:void 0}),await this.waitForClientReady();let s=await Hl(()=>this.initializeFunnel(),2,t);Y(t,"\u2705 Session initialized:",s),this.initialized=!0;let a=this.getSession();return a&&((i=(r=this.config).onReady)==null||i.call(r,a)),a}catch(o){let s=o instanceof Error?o:new Error(String(o));if(Y(t,"\u274C Initialization failed:",s),this.config.onError)return this.config.onError(s),null;throw s}finally{this.initializing=!1}}getSession(){var t,r;if(!((r=(t=this.client)==null?void 0:t.funnel)!=null&&r.state.context))return null;let e=this.client.funnel.state.context;return{sessionId:e.sessionId,customerId:e.customerId,storeId:e.storeId,funnelId:e.funnelId,currentStepId:e.currentStepId,cmsToken:this.client.state.token||void 0}}isReady(){var e,t;return this.initialized&&!!((t=(e=this.client)==null?void 0:e.funnel)!=null&&t.state.context)}async navigate(e){if(!this.isReady())throw new Error("TagadaTracker: not initialized. Call init() first.");Y(this.config.debug,"\u{1F680} Navigating:",e);let t=e.autoRedirect!==!1;try{let r=await this.client.funnel.navigate({type:e.eventType,data:e.eventData||{}},{autoRedirect:!1});return r!=null&&r.url?(Y(this.config.debug,"\u2705 Navigation result:",r.url),t&&typeof window!="undefined"&&(window.location.href=e.returnUrl||r.url),{url:r.url}):null}catch(r){throw Y(this.config.debug,"\u274C Navigation failed:",r),r}}async trackEvent(e){if(!this.isReady()){zs("trackEvent called before init \u2014 event dropped:",e.name);return}Y(this.config.debug,"\u{1F4CA} Tracking event:",e.name,e.data);try{await this.client.funnel.navigate({type:e.name,data:e.data||{}},{autoRedirect:!1})}catch(t){Y(this.config.debug,"\u26A0\uFE0F Event tracking failed (non-critical):",e.name)}}getCustomerId(){var e,t,r,i,o;return((t=(e=this.client)==null?void 0:e.state.auth.customer)==null?void 0:t.id)||((o=(i=(r=this.client)==null?void 0:r.funnel)==null?void 0:i.state.context)==null?void 0:o.customerId)||null}getFunnelSessionId(){var e,t,r;return((r=(t=(e=this.client)==null?void 0:e.funnel)==null?void 0:t.state.context)==null?void 0:r.sessionId)||null}buildUrl(e,t){let r=this.getSession();if(!r)return e;let i=new URL(e,typeof window!="undefined"?window.location.origin:void 0);return i.searchParams.set("funnelSessionId",r.sessionId),r.cmsToken&&i.searchParams.set("token",r.cmsToken),r.funnelId&&i.searchParams.set("funnelId",r.funnelId),i.searchParams.set("storeId",r.storeId),t&&Object.entries(t).forEach(([o,s])=>{i.searchParams.set(o,s)}),i.toString()}getClient(){return this.client}async reset(e){var i,o;if(!this.client||!this.config)throw new Error("TagadaTracker: not initialized. Call init() first.");Y(this.config.debug,"\u{1F504} Resetting to step:",e),this.config.stepId=e;let t=await this.initializeFunnel(),r=this.getSession();return r&&((o=(i=this.config).onReady)==null||o.call(i,r)),r}destroy(){var e,t;this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null),this.client&&((t=(e=this.client).destroy)==null||t.call(e)),this.client=null,this.config=null,this.initialized=!1,this.initializing=!1,Y(!1,"\u{1F5D1}\uFE0F Tracker destroyed")}async waitForClientReady(){if(this.client)return new Promise(e=>{var i;if((i=this.client)!=null&&i.state.isInitialized){e();return}let t=!1,r=setTimeout(()=>{var o;t||(t=!0,Y(((o=this.config)==null?void 0:o.debug)||!1,"\u23F1\uFE0F Client ready timeout \u2014 proceeding"),e())},1e4);this.unsubscribe=this.client.subscribe(()=>{var o;!t&&((o=this.client)!=null&&o.state.isInitialized)&&(t=!0,clearTimeout(r),e())})})}async initializeFunnel(){var s,a,l;if(!((s=this.client)!=null&&s.funnel))return null;let e=(a=this.client.state.auth.customer)==null?void 0:a.id,t=(l=this.client.state.auth.session)==null?void 0:l.sessionId;!e&&!t&&zs("No auth session available \u2014 funnel init may fail.");let r={customerId:e||"anon_placeholder",sessionId:t||"sess_placeholder"},i={id:this.config.storeId,accountId:this.config.accountId},o=this.config.stepId;return Y(this.config.debug,"\u{1F50D} Initializing funnel at step:",o),this.client.funnel.initialize(r,i,this.config.funnelId||$s("funnelId")||void 0,o)}},Pi=new ln;typeof window!="undefined"&&(window.TagadaTracker=Pi);function Kl(){if(typeof window=="undefined"||typeof document=="undefined")return[];let n=Me();return n!=null&&n.scripts?n.scripts.filter(e=>e.enabled):[]}function Vl(n,e){let t=n.position||"body-end",r="tagada-stepconfig-script-".concat(e);if(document.getElementById(r))return;let i=n.content.trim(),o=i.match(/^<script[^>]*>([\s\S]*)<\/script>$/i);if(o&&(i=o[1].trim()),!i)return;let s="(function() {\n try {\n // Script: "+n.name+"\n"+i+'\n } catch (error) {\n console.error("[TagadaPay] StepConfig script error:", error);\n }\n})();',a=document.createElement("script");switch(a.id=r,a.setAttribute("data-tagada-stepconfig-script","true"),a.setAttribute("data-script-name",n.name),a.textContent=s,t){case"head-start":document.head.firstChild?document.head.insertBefore(a,document.head.firstChild):document.head.appendChild(a);break;case"head-end":document.head.appendChild(a);break;case"body-start":document.body.firstChild?document.body.insertBefore(a,document.body.firstChild):document.body.appendChild(a);break;case"body-end":default:document.body.appendChild(a);break}}function xi(){let n=Kl();n.length!==0&&n.forEach((e,t)=>{Vl(e,t)})}if(typeof window!="undefined"&&typeof document!="undefined"){let n=()=>{document.body?xi():document.addEventListener("DOMContentLoaded",xi,{once:!0})};"requestIdleCallback"in window?window.requestIdleCallback(n,{timeout:100}):setTimeout(n,0)}function vi(n={}){return new on(n)}return ia(Wl);})();
|
|
7
|
+
"use strict";var TagadaSDKBundle=(()=>{var $l=Object.create;var wt=Object.defineProperty,Fl=Object.defineProperties,ql=Object.getOwnPropertyDescriptor,jl=Object.getOwnPropertyDescriptors,Kl=Object.getOwnPropertyNames,Ii=Object.getOwnPropertySymbols,Hl=Object.getPrototypeOf,xi=Object.prototype.hasOwnProperty,zl=Object.prototype.propertyIsEnumerable;var je=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Vl=t=>{throw TypeError(t)};var Ai=(t,e,n)=>e in t?wt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,b=(t,e)=>{for(var n in e||(e={}))xi.call(e,n)&&Ai(t,n,e[n]);if(Ii)for(var n of Ii(e))zl.call(e,n)&&Ai(t,n,e[n]);return t},O=(t,e)=>Fl(t,jl(e));var be=(t,e)=>()=>(t&&(e=t(t=0)),e);var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),St=(t,e)=>{for(var n in e)wt(t,n,{get:e[n],enumerable:!0})},ki=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Kl(e))!xi.call(t,s)&&s!==n&&wt(t,s,{get:()=>e[s],enumerable:!(r=ql(e,s))||r.enumerable});return t};var Oi=(t,e,n)=>(n=t!=null?$l(Hl(t)):{},ki(e||!t||!t.__esModule?wt(n,"default",{value:t,enumerable:!0}):n,t)),Pr=t=>ki(wt({},"__esModule",{value:!0}),t);var Ne=function(t,e){this[0]=t,this[1]=e},Rr=(t,e,n)=>{var r=(o,a,l,c)=>{try{var d=n[o](a),u=(a=d.value)instanceof Ne,p=d.done;Promise.resolve(u?a[0]:a).then(m=>u?r(o==="return"?o:"next",a[1]?{done:m.done,value:m.value}:m,l,c):l({value:m,done:p})).catch(m=>r("throw",m,l,c))}catch(m){c(m)}},s=o=>i[o]=a=>new Promise((l,c)=>r(o,a,l,c)),i={};return n=n.apply(t,e),i[je("asyncIterator")]=()=>i,s("next"),s("throw"),s("return"),i},Ke=t=>{var e=t[je("asyncIterator")],n=!1,r,s={};return e==null?(e=t[je("iterator")](),r=i=>s[i]=o=>e[i](o)):(e=e.call(t),r=i=>s[i]=o=>{if(n){if(n=!1,i==="throw")throw o;return o}return n=!0,{done:!1,value:new Ne(new Promise(a=>{var l=e[i](o);l instanceof Object||Vl("Object expected"),a(l)}),1)}}),s[je("iterator")]=()=>s,r("next"),"throw"in e?r("throw"):s.throw=i=>{throw i},"return"in e&&r("return"),s},Di=(t,e,n)=>(e=t[je("asyncIterator")])?e.call(t):(t=t[je("iterator")](),e={},n=(r,s)=>(s=t[r])&&(e[r]=i=>new Promise((o,a,l)=>(i=s.call(t,i),l=i.done,Promise.resolve(i.value).then(c=>o({value:c,done:l}),a)))),n("next"),n("return"),e);function Li(t){var r;if(typeof document=="undefined")return null;let n="; ".concat(document.cookie).split("; ".concat(t,"="));return n.length===2&&((r=n.pop())==null?void 0:r.split(";").shift())||null}function Bi(t="local"){let e=Ni[t];if(!e)return console.warn("Unknown environment: ".concat(t,". Falling back to local.")),{environment:"local",apiConfig:Ni.local};let n=null;if(typeof window!="undefined"&&(n=new URLSearchParams(window.location.search).get("tagadaClientBaseUrl"),!n))try{n=localStorage.getItem("tgd_client_base_url")||Li("tgd_client_base_url")}catch(s){}return n?(console.log("[SDK] Using custom API base URL override: ".concat(n)),{environment:t,apiConfig:O(b({},e),{baseUrl:n})}):{environment:t,apiConfig:e}}function Et(){var s;if(console.log("[SDK] detectEnvironment() called"),typeof window=="undefined")return"local";let e=new URLSearchParams(window.location.search).get("tagadaClientEnv");if(e&&(e==="production"||e==="development"||e==="local"))return console.log("[SDK] Using explicit environment override: ".concat(e)),e;try{let i=localStorage.getItem("tgd_client_env")||Li("tgd_client_env");if(i&&(i==="production"||i==="development"||i==="local"))return console.log("[SDK] Using persisted environment override: ".concat(i)),i}catch(i){}let n=window.location.hostname,r=window.location.href;if(console.log('[SDK] detectEnvironment() - hostname: "'.concat(n,'"')),n==="localhost"||n.startsWith("127.")||n.startsWith("192.168.")||n.startsWith("10.")||n.includes(".local")||n===""||n==="0.0.0.0"||n.includes("ngrok-free.dev")||n.includes("ngrok-free.app")||n.includes("ngrok.io")||n.includes("ngrok.app")||n.includes(".loclx.io")){if(console.log("[SDK] detectEnvironment() - returning LOCAL"),typeof window!="undefined"&&((s=window==null?void 0:window.__TAGADA_ENV__)!=null&&s.TAGADA_ENVIRONMENT)){let i=window.__TAGADA_ENV__.TAGADA_ENVIRONMENT.toLowerCase();if(i==="production"||i==="development"||i==="local")return console.log("[SDK] Local override detected: ".concat(i)),i}return"local"}return n==="app.tagadapay.com"||n.includes("tagadapay.com")||n.includes("yourproductiondomain.com")?"production":n==="app.tagadapay.dev"||n.includes("tagadapay.dev")||n.includes("vercel.app")||n.includes("netlify.app")||n.includes("surge.sh")||n.includes("github.io")||n.includes("herokuapp.com")||n.includes("railway.app")||r.includes("?env=dev")||r.includes("?dev=true")||r.includes("#dev")?"development":(console.warn("[SDK] Unknown domain: ".concat(n,", defaulting to production")),"production")}function vt(t=!1){return Et()!=="local"?!1:t&&typeof window!="undefined"?!window.location.hostname.includes(".cdn."):!0}var Ni,Yt=be(()=>{"use strict";Ni={production:{baseUrl:"https://app.tagadapay.com",endpoints:{checkout:{sessionInit:"/api/v1/checkout/session/init",sessionInitAsync:"/api/v1/checkout/session/init-async",sessionStatus:"/api/v1/checkout/session/status",asyncStatus:"/api/public/v1/checkout/async-status"},customer:{profile:"/api/v1/customer/profile",session:"/api/v1/customer/session"},store:{config:"/api/v1/store/config"}}},development:{baseUrl:"https://app.tagadapay.dev",endpoints:{checkout:{sessionInit:"/api/v1/checkout/session/init",sessionInitAsync:"/api/v1/checkout/session/init-async",sessionStatus:"/api/v1/checkout/session/status",asyncStatus:"/api/public/v1/checkout/async-status"},customer:{profile:"/api/v1/customer/profile",session:"/api/v1/customer/session"},store:{config:"/api/v1/store/config"}}},local:{baseUrl:"http://app.localhost:3000",endpoints:{checkout:{sessionInit:"/api/v1/checkout/session/init",sessionInitAsync:"/api/v1/checkout/session/init-async",sessionStatus:"/api/v1/checkout/session/status",asyncStatus:"/api/public/v1/checkout/async-status"},customer:{profile:"/api/v1/customer/profile",session:"/api/v1/customer/session"},store:{config:"/api/v1/store/config"}}}}});var Zt,Jt,_r=be(()=>{"use strict";Zt=(p=>(p.DIRECT_NAVIGATION="direct_navigation",p.BACK_NAVIGATION="back_navigation",p.CONTINUE_CLICKED="continue_clicked",p.BUTTON_CLICK="button_click",p.FORM_SUBMIT="form_submit",p.PAYMENT_SUCCESS="payment_success",p.PAYMENT_FAILED="payment_failed",p.OFFER_ACCEPTED="offer_accepted",p.OFFER_DECLINED="offer_declined",p.CART_UPDATED="cart_updated",p.CART_ITEM_ADDED="cart_item_added",p.CUSTOM="custom",p))(Zt||{}),Jt=class{constructor(e){this.apiClient=e}async initialize(e){return this.apiClient.post("/api/v1/funnel/initialize",e)}async navigate(e){return this.apiClient.post("/api/v1/funnel/navigate",e)}async updateContext(e,n){return this.apiClient.patch("/api/v1/funnel/context/".concat(e),n)}async endSession(e){return this.apiClient.delete("/api/v1/funnel/session/".concat(e))}async getSession(e,n,r){let s=new URLSearchParams;n&&s.append("currentUrl",n),r&&s.append("includeDebugData","true");let i="/api/v1/funnel/session/".concat(e).concat(s.toString()?"?".concat(s):"");return this.apiClient.get(i)}}});var He,Ir=be(()=>{"use strict";He=class{constructor(){this.listeners=new Set}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(e){this.listeners.forEach(n=>{try{n(e)}catch(r){console.error("Error in event listener:",r)}})}clear(){this.listeners.clear()}}});function re(t){if(typeof window!="undefined")try{let n=localStorage.getItem(Xt)!==t;localStorage.setItem(Xt,t),n&&window.dispatchEvent(new Event("storage"))}catch(e){console.error("Failed to save token to localStorage:",e)}}function Ct(){if(typeof window!="undefined")try{return localStorage.getItem(Xt)}catch(t){return console.error("Failed to get token from localStorage:",t),null}return null}function ze(){if(typeof window!="undefined")try{localStorage.removeItem(Xt)}catch(t){console.error("Failed to clear token from localStorage:",t)}}var Xt,Ve=be(()=>{"use strict";Xt="cms_token"});function xr(t){typeof document!="undefined"&&(document.cookie="".concat(Ar,"=").concat(t,"; path=/; max-age=2592000; SameSite=Lax"))}function Qt(){if(typeof document=="undefined")return;let t=document.cookie.split("; ").find(e=>e.startsWith("".concat(Ar,"=")));return t?t.split("=")[1]:void 0}function Tt(){typeof document!="undefined"&&(document.cookie="".concat(Ar,"=; path=/; max-age=0"))}function Wl(){return!!Qt()}function Yl(){var t;if(typeof document!="undefined")try{let e=document.cookie.split("; ").find(r=>r.startsWith("".concat(Gl,"=")));if(!e)return;let n=JSON.parse(decodeURIComponent(e.split("=")[1]));return(t=n==null?void 0:n.metadata)==null?void 0:t.funnelVariantId}catch(e){console.warn("Failed to parse sticky session for variant ID:",e);return}}var Ar,Gl,en=be(()=>{"use strict";Ar="tgd-funnel-session-id",Gl="tgd-session-id"});function Ge(t){if(typeof window=="undefined")return null;try{return localStorage.getItem(t)}catch(e){return null}}function We(t,e){if(typeof window!="undefined")try{localStorage.setItem(t,e)}catch(n){}}function Pt(t){var r;if(typeof document=="undefined")return null;let n=document.cookie.split(";").find(s=>s.trim().startsWith("".concat(t,"=")));return n?(r=n.split("=")[1])==null?void 0:r.trim():null}function Rt(t,e,n=86400){if(typeof document!="undefined"){if(t==="tgd_draft"||t==="tgd-draft"){console.warn("\u{1F6E1}\uFE0F [SDK] Blocked attempt to set ".concat(t," as cookie - this should only be in localStorage"));return}document.cookie="".concat(t,"=").concat(e,"; path=/; max-age=").concat(n)}}function Ui(t){typeof document!="undefined"&&(document.cookie="".concat(t,"=; path=/; max-age=0"))}function Le(){if(typeof window=="undefined")return{};let t=new URLSearchParams(window.location.search),e,n=t.get("draft");if(n!==null)e=n==="true";else{let S=Ge(D.DRAFT);S!==null&&(e=S==="true")}let r,s=t.get("funnelTracking");if(s!==null)r=s!=="false";else{let S=Ge(D.FUNNEL_TRACKING)||Pt(D.FUNNEL_TRACKING);S!==null&&(r=S!=="false")}let i=t.get("token")||Ct()||null,o=t.get("funnelSessionId")||null,a=t.get("funnelId")||null,l,c=t.get("funnelEnv");c&&(c==="staging"||c==="production")&&(l=c);let d=t.get("forceReset")==="true",u,p=t.get("tagadaClientEnv");if(p&&(p==="production"||p==="development"||p==="local"))u=p;else{let S=Ge(D.CLIENT_ENV)||Pt(D.CLIENT_ENV);S&&(S==="production"||S==="development"||S==="local")&&(u=S)}let m,f=t.get("tagadaClientBaseUrl");if(f)m=f;else{let S=Ge(D.CLIENT_BASE_URL)||Pt(D.CLIENT_BASE_URL);S&&(m=S)}let y,g=t.get("currency");if(g)y=g;else{let S=Ge(D.CURRENCY)||Pt(D.CURRENCY);S&&(y=S)}let w,v=t.get("locale");if(v)w=v;else{let S=Ge(D.LOCALE)||Pt(D.LOCALE);S&&(w=S)}return{forceReset:d,token:i,funnelSessionId:o,funnelId:a,draft:e,funnelTracking:r,funnelEnv:l,tagadaClientEnv:u,tagadaClientBaseUrl:m,currency:y,locale:w}}function _t(){var e;return(e=Le().draft)!=null?e:!1}function kr(t){if(typeof window!="undefined")if(t)We(D.DRAFT,"true");else try{localStorage.removeItem(D.DRAFT)}catch(e){}}function $i(t=!1){let e=null;typeof window!="undefined"&&(e=new URLSearchParams(window.location.search).get("token"));let n=Le(),r=n.forceReset||!1;if(!r&&!n.token)return Mi(),!1;t&&(console.log("[SDK] Detected params:",n),console.log("[SDK] URL token (direct read):",e?e.substring(0,20)+"...":"none")),r&&(t&&console.log("[SDK] Force reset: Clearing all stored state"),ze(),Tt(),typeof window!="undefined"&&window.localStorage&&Object.keys(localStorage).forEach(o=>{(o.startsWith("tagadapay_")||o.startsWith("tgd_"))&&(t&&console.log("[SDK] Clearing localStorage: ".concat(o)),localStorage.removeItem(o))}));let s=e||n.token;return s!=null?(t&&console.log("[SDK] Setting token from URL:",s.substring(0,20)+"..."),s===""||s==="null"?ze():(re(s),t&&console.log("[SDK] \u2705 Token set in localStorage immediately after clear"))):r&&(t&&console.log("[SDK] Force reset mode (no token in URL)"),ze()),Mi(),n.funnelSessionId&&t&&console.log("[SDK] Using funnelSessionId from URL:",n.funnelSessionId),r}function Mi(){if(typeof window=="undefined")return;let t=new URLSearchParams(window.location.search),e=t.get("draft");e!==null&&kr(e==="true");let n=t.get("funnelTracking");n!==null&&Jl(n!=="false");let r=t.get("tagadaClientEnv");r&&(r==="production"||r==="development"||r==="local")&&Zl(r);let s=t.get("tagadaClientBaseUrl");s&&Xl(s);let i=t.get("currency");i&&(We(D.CURRENCY,i.toUpperCase()),Rt(D.CURRENCY,i.toUpperCase(),86400));let o=t.get("locale");o&&(We(D.LOCALE,o),Rt(D.LOCALE,o,86400))}function Jl(t){if(typeof window=="undefined")return;let e=t?"true":"false";We(D.FUNNEL_TRACKING,e),Rt(D.FUNNEL_TRACKING,e,86400)}function Zl(t){typeof window!="undefined"&&(We(D.CLIENT_ENV,t),Rt(D.CLIENT_ENV,t,86400))}function Fi(){if(typeof window!="undefined")try{localStorage.removeItem(D.CLIENT_ENV),Ui(D.CLIENT_ENV)}catch(t){}}function Xl(t){typeof window!="undefined"&&(We(D.CLIENT_BASE_URL,t),Rt(D.CLIENT_BASE_URL,t,86400))}function qi(){if(typeof window!="undefined")try{localStorage.removeItem(D.CLIENT_BASE_URL),Ui(D.CLIENT_BASE_URL)}catch(t){}}function ji(){var e;return(e=Le().funnelTracking)!=null?e:!0}var D,tn=be(()=>{"use strict";Ve();en();D={DRAFT:"tgd_draft",FUNNEL_TRACKING:"tgd_funnel_tracking",FORCE_RESET:"tgd_force_reset",CLIENT_ENV:"tgd_client_env",CLIENT_BASE_URL:"tgd_client_base_url",CURRENCY:"tgd_currency",LOCALE:"tgd_locale"}});var Ki={};St(Ki,{injectPreviewModeIndicator:()=>eu,isIndicatorInjected:()=>nu,removePreviewModeIndicator:()=>tu});function Or(t){if(typeof window=="undefined"||typeof document=="undefined")return;let e=window.location.hostname,n=e.split("."),r=["",e,"."+e];for(let a=1;a<n.length;a++){let l=n.slice(a).join(".");r.push(l),r.push("."+l)}let s=window.location.pathname.split("/").filter(a=>a),i=["/"],o="";s.forEach(a=>{o+="/"+a,i.push(o)}),r.forEach(a=>{i.forEach(l=>{let c="".concat(t,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=").concat(l),d=a?"; domain=".concat(a):"";document.cookie=c+d,document.cookie=c+d+"; secure",document.cookie=c+d+"; SameSite=None; secure",document.cookie=c+d+"; SameSite=Lax",document.cookie=c+d+"; SameSite=Strict"})})}function Ql(){if(typeof window=="undefined"||!confirm("\u{1F6AA} Leave Preview Mode?\n\nThis will clear ALL cookies and localStorage (including Shopify session, cart, and preview settings) and reload the page.\n\nAre you sure?"))return;let e=new URL(window.location.href);["draft","funnelEnv","funnelTracking","tagadaClientEnv","tagadaClientBaseUrl","forceReset","funnelId","funnelSessionId","token"].forEach(i=>e.searchParams.delete(i)),window.history.replaceState({},"",e.href);try{let i=Object.getOwnPropertyDescriptor(Document.prototype,"cookie")||Object.getOwnPropertyDescriptor(HTMLDocument.prototype,"cookie");i&&i.set&&Object.defineProperty(document,"cookie",{configurable:!0,enumerable:!0,get:function(){return i.get?i.get.call(this):""},set:function(o){if(typeof o=="string"){let a=o.toLowerCase();if(a.includes("tgd_draft")||a.includes("tgd-draft")||a.includes("tgd.draft")||a.includes("tgddraft")){if(a.includes("max-age=0")||a.includes("expires=thu, 01 jan 1970")){i.set&&i.set.call(this,o);return}console.warn("\u{1F6E1}\uFE0F [TagadaPay] BLOCKED: tgd_draft should never be a cookie");return}}i.set&&i.set.call(this,o)}})}catch(i){console.warn("[TagadaPay] Could not install cookie blocker:",i)}if(window.localStorage)try{localStorage.removeItem("tgd_draft"),localStorage.removeItem("tgd_funnel_tracking"),localStorage.removeItem("tgd_client_env"),localStorage.removeItem("tgd_client_base_url"),localStorage.removeItem("cms_token")}catch(i){console.warn("[TagadaPay] Failed to clear some localStorage keys:",i)}ze(),Tt(),Fi(),qi(),window.localStorage&&localStorage.clear(),window.sessionStorage&&sessionStorage.clear(),["tgd-funnel-session-id","tgd_draft","tgd_funnel_tracking","tgd_client_env","tgd_client_base_url","cms_token","tagadapay_session"].forEach(i=>Or(i)),["tgd-draft","tgd_draft","tgd.draft","tgddraft"].forEach(i=>Or(i)),document.cookie&&document.cookie.split(";").forEach(o=>{let a=o.split("=")[0].trim();if(!a)return;let l=window.location.hostname,c=l.split("."),d=["",l,"."+l];for(let f=1;f<c.length;f++){let y=c.slice(f).join(".");d.push(y),d.push("."+y)}let u=window.location.pathname.split("/").filter(f=>f),p=["/"],m="";u.forEach(f=>{m+="/"+f,p.push(m)}),d.forEach(f=>{p.forEach(y=>{let g="".concat(a,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=").concat(y),w=f?"; domain=".concat(f):"";document.cookie=g+w,document.cookie=g+w+"; secure",document.cookie=g+w+"; SameSite=None; secure",document.cookie=g+w+"; SameSite=Lax",document.cookie=g+w+"; SameSite=Strict",document.cookie=g+w+"; secure; SameSite=None",document.cookie=g+w+"; secure; SameSite=Lax",document.cookie=g+w+"; secure; SameSite=Strict"})})}),setTimeout(()=>{window.localStorage&&localStorage.length>0&&localStorage.clear(),Or("tgd_draft"),typeof window.stop=="function"&&window.stop(),window.location.replace(e.href)},10)}function eu(){if(nn||typeof window=="undefined"||typeof document=="undefined")return;let t=Le(),e=_t(),n=!ji(),r=!!(t.tagadaClientEnv||t.tagadaClientBaseUrl);if(!e&&!n&&!r)return;let s=document.createElement("div");s.id="tgd-preview-indicator",s.style.cssText='\n position: fixed;\n bottom: 16px;\n right: 16px;\n z-index: 999999;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n ';let i=document.createElement("div");i.style.cssText="\n background: ".concat(e?"#ff9500":"#007aff",";\n color: white;\n padding: 8px 12px;\n border-radius: 8px;\n font-size: 13px;\n font-weight: 600;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n cursor: pointer;\n transition: all 0.2s ease;\n display: flex;\n align-items: center;\n gap: 6px;\n "),i.innerHTML='\n <span style="font-size: 16px;">\u{1F50D}</span>\n <span>'.concat(e?"Preview Mode":"Dev Mode","</span>\n ");let o=document.createElement("div");o.style.cssText="\n position: absolute;\n bottom: calc(100% + 8px);\n right: 0;\n background: white;\n border: 1px solid #e5e5e5;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n padding: 12px;\n min-width: 250px;\n font-size: 12px;\n line-height: 1.5;\n display: none;\n ",o.style.paddingTop="20px";let a=document.createElement("div");a.style.cssText="\n position: absolute;\n bottom: 100%;\n left: 0;\n right: 0;\n height: 8px;\n display: none;\n ";let l='<div style="margin-bottom: 8px; font-weight: 600; color: #1d1d1f;">Current Environment</div>';l+='<div style="display: flex; flex-direction: column; gap: 6px;">',e&&(l+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>Draft Mode:</span>\n <span style="color: #ff9500; font-weight: 600;">ON</span>\n </div>\n '),n&&(l+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>Tracking:</span>\n <span style="color: #ff3b30; font-weight: 600;">DISABLED</span>\n </div>\n '),t.funnelEnv&&(l+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>Funnel Env:</span>\n <span style="color: #1d1d1f; font-weight: 600; font-family: monospace; font-size: 11px;">\n '.concat(t.funnelEnv,"\n </span>\n </div>\n ")),t.tagadaClientEnv&&(l+='\n <div style="display: flex; justify-content: space-between; color: #86868b;">\n <span>API Env:</span>\n <span style="color: #1d1d1f; font-weight: 600; font-family: monospace; font-size: 11px;">\n '.concat(t.tagadaClientEnv,"\n </span>\n </div>\n ")),t.tagadaClientBaseUrl&&(l+='\n <div style="color: #86868b;">\n <div style="margin-bottom: 4px;">API URL:</div>\n <div style="color: #1d1d1f; font-weight: 600; font-family: monospace; font-size: 10px; word-break: break-all; background: #f5f5f7; padding: 4px 6px; border-radius: 4px;">\n '.concat(t.tagadaClientBaseUrl,"\n </div>\n </div>\n ")),t.funnelId&&(l+='\n <div style="color: #86868b; margin-top: 4px; padding-top: 8px; border-top: 1px solid #e5e5e5;">\n <div style="margin-bottom: 4px;">Funnel ID:</div>\n <div style="color: #1d1d1f; font-family: monospace; font-size: 10px; word-break: break-all; background: #f5f5f7; padding: 4px 6px; border-radius: 4px;">\n '.concat(t.funnelId,"\n </div>\n </div>\n ")),l+="</div>",l+='\n <div style="margin-top: 12px; padding-top: 8px; border-top: 1px solid #e5e5e5; font-size: 11px; color: #86868b; text-align: center;">\n Add <code style="background: #f5f5f7; padding: 2px 4px; border-radius: 3px;">?forceReset=true</code> to reset\n </div>\n ',l+='\n <div style="margin-top: 12px; padding-top: 8px; border-top: 1px solid #e5e5e5;">\n <button id="tgd-leave-preview" style="\n background: #ff3b30;\n color: white;\n border: none;\n border-radius: 6px;\n padding: 10px 12px;\n font-size: 13px;\n font-weight: 600;\n cursor: pointer;\n transition: opacity 0.2s;\n width: 100%;\n ">\n \u{1F6AA} Leave Preview Mode\n </button>\n </div>\n ',o.innerHTML=l;let c=!1,d=()=>{c=!0,o.style.display="block",a.style.display="block"},u=()=>{c=!1,setTimeout(()=>{c||(o.style.display="none",a.style.display="none")},100)};i.addEventListener("mouseenter",d),i.addEventListener("mouseleave",u),a.addEventListener("mouseenter",d),a.addEventListener("mouseleave",u),o.addEventListener("mouseenter",d),o.addEventListener("mouseleave",u);let p=o.querySelector("#tgd-leave-preview");p&&(p.addEventListener("mouseenter",()=>{p.style.opacity="0.8"}),p.addEventListener("mouseleave",()=>{p.style.opacity="1"}),p.addEventListener("click",m=>{m.stopPropagation(),Ql()})),s.appendChild(i),s.appendChild(a),s.appendChild(o),document.body.appendChild(s),Ye=s,nn=!0}function tu(){Ye&&Ye.parentNode&&(Ye.parentNode.removeChild(Ye),Ye=null,nn=!1)}function nu(){return nn}var Ye,nn,Hi=be(()=>{"use strict";tn();Ve();en();Ye=null,nn=!1});var eo={};St(eo,{FunnelClient:()=>At,TrackingProvider:()=>Wi,findMethod:()=>Zi,getAssignedOrderBumpOfferIds:()=>fu,getAssignedPaymentFlowId:()=>xt,getAssignedPixels:()=>du,getAssignedResources:()=>Qi,getAssignedScripts:()=>uu,getAssignedStaticResources:()=>lu,getAssignedStepConfig:()=>ie,getAssignedUpsellOfferIds:()=>pu,getEnabledMethods:()=>Yi,getExpressMethods:()=>Ji,getExpressMethodsByProcessor:()=>ru,getLocalFunnelConfig:()=>Xi,isMethodEnabled:()=>su,loadLocalFunnelConfig:()=>au});function Yi(t){return t?Object.values(t).filter(e=>e.enabled):[]}function Ji(t){return Yi(t).filter(e=>e.express)}function ru(t){let e={};for(let n of Ji(t)){let r=n.processorId||n.integrationId||n.provider;e[r]||(e[r]=[]),e[r].push(n)}return e}function Zi(t,e){if(t){for(let n of Object.values(t))if(n.method===e&&n.enabled)return n}}function su(t,e){return!!Zi(t,e)}function iu(){if(typeof window!="undefined"){if(window.__TGD_FUNNEL_ID__)return window.__TGD_FUNNEL_ID__;if(typeof document!="undefined"){let t=document.querySelector('meta[name="x-funnel-id"]');return(t==null?void 0:t.getAttribute("content"))||void 0}}}function rn(){if(typeof window!="undefined"){if(window.__TGD_FUNNEL_VARIANT_ID__)return window.__TGD_FUNNEL_VARIANT_ID__;if(typeof document!="undefined"){let t=document.querySelector('meta[name="x-funnel-variant-id"]');return(t==null?void 0:t.getAttribute("content"))||void 0}}}function It(){if(typeof window!="undefined"){if(window.__TGD_FUNNEL_STEP_ID__)return window.__TGD_FUNNEL_STEP_ID__;if(typeof document!="undefined"){let t=document.querySelector('meta[name="x-funnel-step-id"]');return(t==null?void 0:t.getAttribute("content"))||void 0}}}function Vi(t){if(!t||typeof t!="string")return;let e=t.trim();if(!e)return;let n=[()=>JSON.parse(e),()=>JSON.parse(decodeURIComponent(e)),()=>JSON.parse(decodeURIComponent(decodeURIComponent(e)))];for(let r of n)try{let s=r();if(s&&typeof s=="object")return s}catch(s){}typeof console!="undefined"&&console.warn("[SDK] Failed to parse stepConfig:",e.substring(0,100))}function ou(){if(typeof window=="undefined")return!1;let t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t.endsWith(".localhost")&&!t.includes(".cdn.")}async function au(){if(!ou())return null;if(se!==void 0)return se;if(Dr)return await new Promise(t=>setTimeout(t,100)),se!=null?se:null;Dr=!0;try{console.log("\u{1F6E0}\uFE0F [SDK] Loading local funnel config from /config/funnel.local.json...");let t=await fetch("/config/funnel.local.json");if(!t.ok)return console.log("\u{1F6E0}\uFE0F [SDK] funnel.local.json not found (this is fine in production)"),se=null,null;let e=await t.json();return console.log("\u{1F6E0}\uFE0F [SDK] \u2705 Loaded local funnel config:",e),se=e,e}catch(t){return console.log("\u{1F6E0}\uFE0F [SDK] funnel.local.json not available:",t),se=null,null}finally{Dr=!1}}function Xi(){return se!=null?se:null}function cu(t){let e=b(b({},t.staticResources),t.resources);return{payment:t.paymentFlowId?{paymentFlowId:t.paymentFlowId}:void 0,resources:Object.keys(e).length>0?e:void 0,scripts:t.scripts,pixels:t.pixels,orderBumps:t.orderBumps,upsellOffers:t.upsellOffers}}function ie(){if(typeof window=="undefined")return;let t=Xi();if(t)return console.log("\u{1F6E0}\uFE0F [SDK] Using local funnel.local.json (overrides injected)"),cu(t);let e=window.__TGD_STEP_CONFIG__;if(e){let n=Vi(e);if(n)return n}if(typeof document!="undefined"){let n=document.querySelector('meta[name="x-step-config"]'),r=n==null?void 0:n.getAttribute("content");if(r){let s=Vi(r);if(s)return s}}}function xt(){var n,r;let t=ie(),e=(n=t==null?void 0:t.paymentSetupConfig)==null?void 0:n.card;if(e!=null&&e.paymentFlowId)return e.paymentFlowId;if((r=t==null?void 0:t.payment)!=null&&r.paymentFlowId)return t.payment.paymentFlowId;if(typeof window!="undefined"){if(window.__TGD_PAYMENT_FLOW_ID__)return window.__TGD_PAYMENT_FLOW_ID__;if(typeof document!="undefined"){let s=document.querySelector('meta[name="x-payment-flow-id"]');return(s==null?void 0:s.getAttribute("content"))||void 0}}}function Qi(){let t=ie(),e=t==null?void 0:t.staticResources,n=t==null?void 0:t.resources;if(!(!e&&!n))return b(b({},e),n)}function lu(){return Qi()}function uu(t){let e=ie();if(!(e!=null&&e.scripts))return;let n=e.scripts.filter(r=>r.enabled);return t&&(n=n.filter(r=>r.position===t||!r.position&&t==="head-end")),n.length>0?n:void 0}function Gi(t){let e="containerId"in t?"containerId":"pixelId",n=t[e];if(!n||!n.includes(";")&&!n.includes(","))return[t];let r=n.split(/[;,]/).map(s=>s.trim()).filter(s=>s.length>0);return r.length<=1?[t]:r.map(s=>O(b({},t),{[e]:s}))}function du(){let t=ie(),e=t==null?void 0:t.pixels;if(!e||typeof e!="object")return;let n={};for(let[r,s]of Object.entries(e))s&&(Array.isArray(s)?n[r]=s.flatMap(i=>Gi(i)):typeof s=="object"&&(n[r]=Gi(s)));return Object.keys(n).length>0?n:void 0}function fu(){let t=ie();if(t!=null&&t.orderBumps&&t.orderBumps.mode==="custom")return t.orderBumps.enabledOfferIds}function pu(){let t=ie();if(t!=null&&t.upsellOffers&&t.upsellOffers.mode==="custom")return t.upsellOffers.enabledUpsellIds}var zi,Wi,se,Dr,At,Je=be(()=>{"use strict";Yt();_r();Ir();tn();en();zi=()=>Promise.resolve().then(()=>(Hi(),Ki)).then(t=>t.injectPreviewModeIndicator()),Wi=(i=>(i.FACEBOOK="facebook",i.TIKTOK="tiktok",i.SNAPCHAT="snapchat",i.PINTEREST="pinterest",i.GTM="gtm",i))(Wi||{});Dr=!1;At=class{constructor(e){this.eventDispatcher=new He;this.isInitializing=!1;this.initializationAttempted=!1;this.config=e,this.resource=new Jt(e.apiClient),this.state={context:null,isLoading:!1,isInitialized:!1,isNavigating:!1,error:null,sessionError:null}}setConfig(e){this.config=b(b({},this.config),e)}subscribe(e){return this.eventDispatcher.subscribe(e)}getState(){return this.state}getDetectedSessionId(){var r;if((r=this.state.context)!=null&&r.sessionId)return this.state.context.sessionId;if(typeof window=="undefined")return null;let n=new URLSearchParams(window.location.search).get("funnelSessionId");return n||Qt()||null}resetInitialization(){this.initializationAttempted=!1,this.isInitializing=!1,this.updateState({context:null,isInitialized:!1})}async autoInitialize(e,n,r){if(this.state.context)return this.state.context;if(this.isInitializing||this.initializationAttempted)return null;this.initializationAttempted=!0,this.isInitializing=!0,this.updateState({isLoading:!0,error:null});try{let s=this.getDetectedSessionId(),a=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("funnelId")||r,l=iu(),c=rn(),d=It(),u=Le(),p=this.config.funnelId||l||a,m=this.config.stepId||d,f=typeof window!="undefined"?new URLSearchParams(window.location.search):null,y=f==null?void 0:f.get("funnelEnv");this.config.debugMode&&console.log("\u{1F680} [FunnelClient] Auto-initializing...",{existingSessionId:s,effectiveFunnelId:p,funnelVariantId:c,funnelStepId:m,draft:u.draft,funnelTracking:u.funnelTracking,funnelEnv:y,tagadaClientEnv:u.tagadaClientEnv,tagadaClientBaseUrl:u.tagadaClientBaseUrl,source:{funnelId:this.config.funnelId?"config":l?"injected":a?"url/prop":"none",stepId:this.config.stepId?"config":d?"injected":"none"}});let g=await this.resource.initialize({cmsSession:{customerId:e.customerId,sessionId:e.sessionId,storeId:n.id,accountId:n.accountId},funnelId:p,existingSessionId:s||void 0,currentUrl:typeof window!="undefined"?window.location.href:void 0,funnelVariantId:c,funnelStepId:m,draft:u.draft,funnelTracking:u.funnelTracking,funnelEnv:y||void 0,tagadaClientEnv:u.tagadaClientEnv,tagadaClientBaseUrl:u.tagadaClientBaseUrl,currency:u.currency,locale:u.locale});if(g.success&&g.context){let w=this.enrichContext(g.context);return this.handleSessionSuccess(w),zi(),w}else throw new Error(g.error||"Failed to initialize funnel session")}catch(s){let i=s instanceof Error?s:new Error(String(s));throw this.updateState({error:i,isLoading:!1}),this.config.debugMode&&console.error("\u274C [FunnelClient] Init failed:",i),i}finally{this.isInitializing=!1}}async initialize(e,n,r,s){this.updateState({isLoading:!0,error:null});try{let i=rn(),o=It();this.config.debugMode&&(i&&console.log("\u{1F3AF} [FunnelClient] Detected A/B test variant:",i),o&&console.log("\u{1F3AF} [FunnelClient] Detected step ID:",o));let a=await this.resource.initialize({cmsSession:{customerId:e.customerId,sessionId:e.sessionId,storeId:n.id,accountId:n.accountId},funnelId:r,entryStepId:s,currentUrl:typeof window!="undefined"?window.location.href:void 0,funnelVariantId:i,funnelStepId:o});if(a.success&&a.context){let l=this.enrichContext(a.context);return this.handleSessionSuccess(l),zi(),l}else throw new Error(a.error||"Failed to initialize")}catch(i){let o=i instanceof Error?i:new Error(String(i));throw this.updateState({error:o,isLoading:!1}),o}}async navigate(e,n){var r,s,i,o,a,l;if(n!=null&&n.waitForSession&&!((r=this.state.context)!=null&&r.sessionId)){this.config.debugMode&&console.log("\u23F3 [FunnelClient] Waiting for session before navigation...");let c=5e3,d=Date.now();for(;!((s=this.state.context)!=null&&s.sessionId)&&Date.now()-d<c;)await new Promise(u=>setTimeout(u,100));(i=this.state.context)!=null&&i.sessionId&&this.config.debugMode&&console.log("\u2705 [FunnelClient] Session ready, proceeding with navigation")}if(!((o=this.state.context)!=null&&o.sessionId))throw new Error("No active session");this.updateState({isNavigating:!0,isLoading:!0});try{let c=rn(),d=It(),u=typeof window!="undefined"?window.location.href:void 0;!d&&this.config.stepId&&(d=this.config.stepId,this.config.debugMode&&console.log("\u{1F50D} [FunnelClient.navigate] Using stepId from config (no injection):",d)),!c&&this.config.variantId&&(c=this.config.variantId,this.config.debugMode&&console.log("\u{1F50D} [FunnelClient.navigate] Using variantId from config (no injection):",c)),this.config.debugMode&&console.log("\u{1F50D} [FunnelClient.navigate] Sending to backend:",{sessionId:this.state.context.sessionId,currentUrl:u,funnelStepId:d||"(not found)",funnelVariantId:c||"(not found)",hasInjectedStepId:!!It(),hasInjectedVariantId:!!rn(),usedConfigFallback:!It()&&!!this.config.stepId,customerTags:(n==null?void 0:n.customerTags)||"(none)",deviceId:(n==null?void 0:n.deviceId)||"(none)"});let p=(n==null?void 0:n.fireAndForget)||!1,m=await this.resource.navigate({sessionId:this.state.context.sessionId,event:e,currentUrl:u,funnelStepId:d,funnelVariantId:c,fireAndForget:p,customerTags:n==null?void 0:n.customerTags,deviceId:n==null?void 0:n.deviceId});if(!m.success||!m.result)throw new Error(m.error||"Navigation failed");let f=m.result;if(f.queued)return this.updateState({isNavigating:!1,isLoading:!1}),f.sessionId&&f.sessionId!==((a=this.state.context)==null?void 0:a.sessionId)&&(this.config.debugMode&&console.log("\u{1F525} [FunnelClient] Session ID updated: ".concat((l=this.state.context)==null?void 0:l.sessionId," \u2192 ").concat(f.sessionId)),this.state.context&&(this.state.context.sessionId=f.sessionId)),this.config.debugMode&&console.log("\u{1F525} [FunnelClient] Navigation queued (fire-and-forget mode)"),f;let y=(n==null?void 0:n.autoRedirect)!==void 0?n.autoRedirect:this.config.autoRedirect!==!1;return this.updateState({isNavigating:!1,isLoading:!1}),y&&(f!=null&&f.url)&&typeof window!="undefined"&&(this.config.debugMode&&console.log("\u{1F680} [FunnelClient] Auto-redirecting to:",f.url,"(skipped session refresh - next page will initialize)"),window.location.replace(f.url)),f}catch(c){let d=c instanceof Error?c:new Error(String(c));throw this.updateState({error:d,isNavigating:!1,isLoading:!1}),d}}async goToStep(e,n){return this.navigate({type:"direct_navigation",data:{targetStepId:e}},n)}async refreshSession(){var e;if((e=this.state.context)!=null&&e.sessionId)try{let n=await this.resource.getSession(this.state.context.sessionId);if(n.success&&n.context){let r=this.enrichContext(n.context);return this.updateState({context:r,sessionError:null}),r}}catch(n){this.updateState({sessionError:n instanceof Error?n:new Error(String(n))})}}async updateContext(e){var n;if(!((n=this.state.context)!=null&&n.sessionId))throw new Error("No active session");this.updateState({isLoading:!0});try{let r=await this.resource.updateContext(this.state.context.sessionId,{contextUpdates:e});if(r.success)await this.refreshSession();else throw new Error(r.error||"Failed to update context")}finally{this.updateState({isLoading:!1})}}async endSession(){var e;if((e=this.state.context)!=null&&e.sessionId)try{await this.resource.endSession(this.state.context.sessionId)}finally{this.state.context=null,this.updateState({context:null,isInitialized:!1})}}updateState(e){this.state=b(b({},this.state),e),this.eventDispatcher.notify(this.state)}handleSessionSuccess(e){xr(e.sessionId),this.updateState({context:e,isLoading:!1,isInitialized:!0,error:null,sessionError:null})}enrichContext(e){var o,a;if((((o=this.config.environment)==null?void 0:o.environment)||Et())!=="local")return e;let r=((a=this.config.pluginConfig)==null?void 0:a.staticResources)||{};if(Object.keys(r).length===0)return e;let s=e.static||{};return Object.keys(r).every(l=>s[l]===r[l])&&Object.keys(s).length===Object.keys(r).length?e:O(b({},e),{static:b(b({},r),s)})}}});var Ro=E(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.PathError=ce.TokenData=void 0;ce.parse=Jr;ce.compile=Hu;ce.match=Vu;ce.pathToRegexp=Co;ce.stringify=Yu;var Gr="/",Wr=t=>t,Eo=new RegExp("^[$_\\p{ID_Start}]$","u"),Yr=new RegExp("^[$\\u200c\\u200d\\p{ID_Continue}]$","u"),ju={"{":"{","}":"}","(":"(",")":")","[":"[","]":"]","+":"+","?":"?","!":"!"};function Ku(t){return t.replace(/[{}()\[\]+?!:*\\]/g,"\\$&")}function we(t){return t.replace(/[.+*?^${}()[\]|/\\]/g,"\\$&")}var mn=class{constructor(e,n){this.tokens=e,this.originalPath=n}};ce.TokenData=mn;var Ue=class extends TypeError{constructor(e,n){let r=e;n&&(r+=": ".concat(n)),r+="; visit https://git.new/pathToRegexpError for info",super(r),this.originalPath=n}};ce.PathError=Ue;function Jr(t,e={}){let{encodePath:n=Wr}=e,r=[...t],s=[],i=0,o=0;function a(){let c="";if(Eo.test(r[i]))do c+=r[i++];while(Yr.test(r[i]));else if(r[i]==='"'){let d=i;for(;i++<r.length;){if(r[i]==='"'){i++,d=0;break}r[i]==="\\"&&i++,c+=r[i]}if(d)throw new Ue("Unterminated quote at index ".concat(d),t)}if(!c)throw new Ue("Missing parameter name at index ".concat(i),t);return c}for(;i<r.length;){let c=r[i],d=ju[c];d?s.push({type:d,index:i++,value:c}):c==="\\"?s.push({type:"escape",index:i++,value:r[i++]}):c===":"?s.push({type:"param",index:i++,value:a()}):c==="*"?s.push({type:"wildcard",index:i++,value:a()}):s.push({type:"char",index:i++,value:c})}s.push({type:"end",index:i,value:""});function l(c){let d=[];for(;;){let u=s[o++];if(u.type===c)break;if(u.type==="char"||u.type==="escape"){let p=u.value,m=s[o];for(;m.type==="char"||m.type==="escape";)p+=m.value,m=s[++o];d.push({type:"text",value:n(p)});continue}if(u.type==="param"||u.type==="wildcard"){d.push({type:u.type,name:u.value});continue}if(u.type==="{"){d.push({type:"group",tokens:l("}")});continue}throw new Ue("Unexpected ".concat(u.type," at index ").concat(u.index,", expected ").concat(c),t)}return d}return new mn(l("end"),t)}function Hu(t,e={}){let{encode:n=encodeURIComponent,delimiter:r=Gr}=e,s=typeof t=="object"?t:Jr(t,e),i=vo(s.tokens,r,n);return function(a={}){let[l,...c]=i(a);if(c.length)throw new TypeError("Missing parameters: ".concat(c.join(", ")));return l}}function vo(t,e,n){let r=t.map(s=>zu(s,e,n));return s=>{let i=[""];for(let o of r){let[a,...l]=o(s);i[0]+=a,i.push(...l)}return i}}function zu(t,e,n){if(t.type==="text")return()=>[t.value];if(t.type==="group"){let s=vo(t.tokens,e,n);return i=>{let[o,...a]=s(i);return a.length?[""]:[o]}}let r=n||Wr;return t.type==="wildcard"&&n!==!1?s=>{let i=s[t.name];if(i==null)return["",t.name];if(!Array.isArray(i)||i.length===0)throw new TypeError('Expected "'.concat(t.name,'" to be a non-empty array'));return[i.map((o,a)=>{if(typeof o!="string")throw new TypeError('Expected "'.concat(t.name,"/").concat(a,'" to be a string'));return r(o)}).join(e)]}:s=>{let i=s[t.name];if(i==null)return["",t.name];if(typeof i!="string")throw new TypeError('Expected "'.concat(t.name,'" to be a string'));return[r(i)]}}function Vu(t,e={}){let{decode:n=decodeURIComponent,delimiter:r=Gr}=e,{regexp:s,keys:i}=Co(t,e),o=i.map(a=>n===!1?Wr:a.type==="param"?n:l=>l.split(r).map(n));return function(l){let c=s.exec(l);if(!c)return!1;let d=c[0],u=Object.create(null);for(let p=1;p<c.length;p++){if(c[p]===void 0)continue;let m=i[p-1],f=o[p-1];u[m.name]=f(c[p])}return{path:d,params:u}}}function Co(t,e={}){let{delimiter:n=Gr,end:r=!0,sensitive:s=!1,trailing:i=!0}=e,o=[],a=s?"":"i",l=[];for(let u of To(t,[])){let p=typeof u=="object"?u:Jr(u,e);for(let m of gn(p.tokens,0,[]))l.push(Gu(m,n,o,p.originalPath))}let c="^(?:".concat(l.join("|"),")");return i&&(c+="(?:".concat(we(n),"$)?")),c+=r?"$":"(?=".concat(we(n),"|$)"),{regexp:new RegExp(c,a),keys:o}}function To(t,e){if(Array.isArray(t))for(let n of t)To(n,e);else e.push(t);return e}function*gn(t,e,n){if(e===t.length)return yield n;let r=t[e];if(r.type==="group")for(let s of gn(r.tokens,0,n.slice()))yield*Ke(gn(t,e+1,s));else n.push(r);yield*Ke(gn(t,e+1,n))}function Gu(t,e,n,r){let s="",i="",o=!0;for(let a of t){if(a.type==="text"){s+=we(a.value),i+=a.value,o||(o=a.value.includes(e));continue}if(a.type==="param"||a.type==="wildcard"){if(!o&&!i)throw new Ue('Missing text before "'.concat(a.name,'" ').concat(a.type),r);a.type==="param"?s+="(".concat(Wu(e,o?"":i),"+)"):s+="([\\s\\S]+)",n.push(a),i="",o=!1;continue}}return s}function Wu(t,e){return e.length<2?t.length<2?"[^".concat(we(t+e),"]"):"(?:(?!".concat(we(t),")[^").concat(we(e),"])"):t.length<2?"(?:(?!".concat(we(e),")[^").concat(we(t),"])"):"(?:(?!".concat(we(e),"|").concat(we(t),")[\\s\\S])")}function Po(t){let e="",n=0;function r(s){return Ju(s)&&Zu(t[n])?s:JSON.stringify(s)}for(;n<t.length;){let s=t[n++];if(s.type==="text"){e+=Ku(s.value);continue}if(s.type==="group"){e+="{".concat(Po(s.tokens),"}");continue}if(s.type==="param"){e+=":".concat(r(s.name));continue}if(s.type==="wildcard"){e+="*".concat(r(s.name));continue}throw new TypeError("Unknown token type: ".concat(s.type))}return e}function Yu(t){return Po(t.tokens)}function Ju(t){let[e,...n]=t;return Eo.test(e)&&n.every(r=>Yr.test(r))}function Zu(t){return t&&t.type==="text"?!Yr.test(t.value[0]):!0}});var bn=E(I=>{"use strict";Object.defineProperty(I,"__esModule",{value:!0});I.WEB_ELEMENTS_VERSION=I.USER_AGENT_HEADER=I.USER_AGENT_CLIENT=I.MERGE_CONTENT_TYPE=I.DEFAULT_ELEMENTS_BASE_URL=I.DEFAULT_BASE_URL=I.DD_TOKEN=I.DD_GIT_SHA=I.CONTENT_TYPE_HEADER=I.CLIENT_USER_AGENT_HEADER=I.CLIENT_BASE_PATHS=I.CF_RAY_HEADER=I.BT_TRACE_ID_HEADER=I.BT_IDEMPOTENCY_KEY_HEADER=I.BT_EXPOSE_PROXY_RESPONSE_HEADER=I.BROWSER_LIST=I.API_KEY_HEADER=void 0;var td="1.7.2";I.WEB_ELEMENTS_VERSION=td;var nd="BT-API-KEY";I.API_KEY_HEADER=nd;var rd="bt-trace-id";I.BT_TRACE_ID_HEADER=rd;var sd="cf-ray";I.CF_RAY_HEADER=sd;var id="bt-idempotency-key";I.BT_IDEMPOTENCY_KEY_HEADER=id;var od="BT-EXPOSE-RAW-PROXY-RESPONSE";I.BT_EXPOSE_PROXY_RESPONSE_HEADER=od;var ad="Content-Type";I.CONTENT_TYPE_HEADER=ad;var cd="application/merge-patch+json";I.MERGE_CONTENT_TYPE=cd;var ld="User-Agent";I.USER_AGENT_HEADER=ld;var ud="BT-CLIENT-USER-AGENT";I.CLIENT_USER_AGENT_HEADER=ud;var dd="BasisTheoryJS";I.USER_AGENT_CLIENT=dd;var fd="https://api.basistheory.com";I.DEFAULT_BASE_URL=fd;var pd="https://js.basistheory.com/hosted-elements";I.DEFAULT_ELEMENTS_BASE_URL=pd;var gd="pub5f53501515584007899577554c4aeda6";I.DD_TOKEN=gd;var md="b862d8e634020f77c61023ffeee4f0e01c36e871";I.DD_GIT_SHA=md;var hd={tokens:"tokens",tokenize:"tokenize",applications:"applications",applicationKeys:"applications",applicationTemplates:"application-templates",tenants:"tenants/self",logs:"logs",reactorFormulas:"reactor-formulas",reactors:"reactors",permissions:"permissions",proxies:"proxies",proxy:"proxy",sessions:"sessions",threeds:"3ds",tokenIntents:"token-intents"};I.CLIENT_BASE_PATHS=hd;var yd=[{browserName:"Firefox",browserUA:"Firefox"},{browserName:"SamsungBrowser",browserUA:"SamsungBrowser"},{browserName:"Opera",browserUA:"Opera"},{browserName:"Opera",browserUA:"OPR"},{browserName:"Microsoft Internet Explorer",browserUA:"Trident"},{browserName:"Microsoft Edge (Legacy)",browserUA:"Edge"},{browserName:"Microsoft Edge (Chromium)",browserUA:"Edg"},{browserName:"Google Chrome/Chromium",browserUA:"Chrome"},{browserName:"Safari",browserUA:"Safari"}];I.BROWSER_LIST=yd});var ps=E((Gy,ha)=>{"use strict";function Go(t,e){return function(){return t.apply(e,arguments)}}var{toString:bd}=Object.prototype,{getPrototypeOf:as}=Object,{iterator:Pn,toStringTag:Wo}=Symbol,Rn=(t=>e=>{let n=bd.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ue=t=>(t=t.toLowerCase(),e=>Rn(e)===t),_n=t=>e=>typeof e===t,{isArray:dt}=Array,ct=_n("undefined");function Mt(t){return t!==null&&!ct(t)&&t.constructor!==null&&!ct(t.constructor)&&J(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var Yo=ue("ArrayBuffer");function wd(t){let e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Yo(t.buffer),e}var Sd=_n("string"),J=_n("function"),Jo=_n("number"),Ut=t=>t!==null&&typeof t=="object",Ed=t=>t===!0||t===!1,Sn=t=>{if(Rn(t)!=="object")return!1;let e=as(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Wo in t)&&!(Pn in t)},vd=t=>{if(!Ut(t)||Mt(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch(e){return!1}},Cd=ue("Date"),Td=ue("File"),Pd=ue("Blob"),Rd=ue("FileList"),_d=t=>Ut(t)&&J(t.pipe),Id=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||J(t.append)&&((e=Rn(t))==="formdata"||e==="object"&&J(t.toString)&&t.toString()==="[object FormData]"))},Ad=ue("URLSearchParams"),[xd,kd,Od,Dd]=["ReadableStream","Request","Response","Headers"].map(ue),Nd=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function $t(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t=="undefined")return;let r,s;if(typeof t!="object"&&(t=[t]),dt(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{if(Mt(t))return;let i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length,a;for(r=0;r<o;r++)a=i[r],e.call(null,t[a],a,t)}}function Zo(t,e){if(Mt(t))return null;e=e.toLowerCase();let n=Object.keys(t),r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}var $e=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,Xo=t=>!ct(t)&&t!==$e;function ts(){let{caseless:t,skipUndefined:e}=Xo(this)&&this||{},n={},r=(s,i)=>{let o=t&&Zo(n,i)||i;Sn(n[o])&&Sn(s)?n[o]=ts(n[o],s):Sn(s)?n[o]=ts({},s):dt(s)?n[o]=s.slice():(!e||!ct(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&$t(arguments[s],r);return n}var Ld=(t,e,n,{allOwnKeys:r}={})=>($t(e,(s,i)=>{n&&J(s)?t[i]=Go(s,n):t[i]=s},{allOwnKeys:r}),t),Bd=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Md=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Ud=(t,e,n,r)=>{let s,i,o,a={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)o=s[i],(!r||r(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=n!==!1&&as(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},$d=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;let r=t.indexOf(e,n);return r!==-1&&r===n},Fd=t=>{if(!t)return null;if(dt(t))return t;let e=t.length;if(!Jo(e))return null;let n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},qd=(t=>e=>t&&e instanceof t)(typeof Uint8Array!="undefined"&&as(Uint8Array)),jd=(t,e)=>{let r=(t&&t[Pn]).call(t),s;for(;(s=r.next())&&!s.done;){let i=s.value;e.call(t,i[0],i[1])}},Kd=(t,e)=>{let n,r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},Hd=ue("HTMLFormElement"),zd=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),ko=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Vd=ue("RegExp"),Qo=(t,e)=>{let n=Object.getOwnPropertyDescriptors(t),r={};$t(n,(s,i)=>{let o;(o=e(s,i,t))!==!1&&(r[i]=o||s)}),Object.defineProperties(t,r)},Gd=t=>{Qo(t,(e,n)=>{if(J(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let r=t[n];if(J(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Wd=(t,e)=>{let n={},r=s=>{s.forEach(i=>{n[i]=!0})};return dt(t)?r(t):r(String(t).split(e)),n},Yd=()=>{},Jd=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Zd(t){return!!(t&&J(t.append)&&t[Wo]==="FormData"&&t[Pn])}var Xd=t=>{let e=new Array(10),n=(r,s)=>{if(Ut(r)){if(e.indexOf(r)>=0)return;if(Mt(r))return r;if(!("toJSON"in r)){e[s]=r;let i=dt(r)?[]:{};return $t(r,(o,a)=>{let l=n(o,s+1);!ct(l)&&(i[a]=l)}),e[s]=void 0,i}}return r};return n(t,0)},Qd=ue("AsyncFunction"),ef=t=>t&&(Ut(t)||J(t))&&J(t.then)&&J(t.catch),ea=((t,e)=>t?setImmediate:e?((n,r)=>($e.addEventListener("message",({source:s,data:i})=>{s===$e&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),$e.postMessage(n,"*")}))("axios@".concat(Math.random()),[]):n=>setTimeout(n))(typeof setImmediate=="function",J($e.postMessage)),tf=typeof queueMicrotask!="undefined"?queueMicrotask.bind($e):typeof process!="undefined"&&process.nextTick||ea,nf=t=>t!=null&&J(t[Pn]),h={isArray:dt,isArrayBuffer:Yo,isBuffer:Mt,isFormData:Id,isArrayBufferView:wd,isString:Sd,isNumber:Jo,isBoolean:Ed,isObject:Ut,isPlainObject:Sn,isEmptyObject:vd,isReadableStream:xd,isRequest:kd,isResponse:Od,isHeaders:Dd,isUndefined:ct,isDate:Cd,isFile:Td,isBlob:Pd,isRegExp:Vd,isFunction:J,isStream:_d,isURLSearchParams:Ad,isTypedArray:qd,isFileList:Rd,forEach:$t,merge:ts,extend:Ld,trim:Nd,stripBOM:Bd,inherits:Md,toFlatObject:Ud,kindOf:Rn,kindOfTest:ue,endsWith:$d,toArray:Fd,forEachEntry:jd,matchAll:Kd,isHTMLForm:Hd,hasOwnProperty:ko,hasOwnProp:ko,reduceDescriptors:Qo,freezeMethods:Gd,toObjectSet:Wd,toCamelCase:zd,noop:Yd,toFiniteNumber:Jd,findKey:Zo,global:$e,isContextDefined:Xo,isSpecCompliantForm:Zd,toJSONObject:Xd,isAsyncFn:Qd,isThenable:ef,setImmediate:ea,asap:tf,isIterable:nf};function P(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}h.inherits(P,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:h.toJSONObject(this.config),code:this.code,status:this.status}}});var ta=P.prototype,na={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{na[t]={value:t}});Object.defineProperties(P,na);Object.defineProperty(ta,"isAxiosError",{value:!0});P.from=(t,e,n,r,s,i)=>{let o=Object.create(ta);h.toFlatObject(t,o,function(d){return d!==Error.prototype},c=>c!=="isAxiosError");let a=t&&t.message?t.message:"Error",l=e==null&&t?t.code:e;return P.call(o,a,l,n,r,s),t&&o.cause==null&&Object.defineProperty(o,"cause",{value:t,configurable:!0}),o.name=t&&t.name||"Error",i&&Object.assign(o,i),o};var rf=null;function ns(t){return h.isPlainObject(t)||h.isArray(t)}function ra(t){return h.endsWith(t,"[]")?t.slice(0,-2):t}function Oo(t,e,n){return t?t.concat(e).map(function(s,i){return s=ra(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function sf(t){return h.isArray(t)&&!t.some(ns)}var of=h.toFlatObject(h,{},null,function(e){return/^is[A-Z]/.test(e)});function In(t,e,n){if(!h.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=h.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,g){return!h.isUndefined(g[y])});let r=n.metaTokens,s=n.visitor||d,i=n.dots,o=n.indexes,l=(n.Blob||typeof Blob!="undefined"&&Blob)&&h.isSpecCompliantForm(e);if(!h.isFunction(s))throw new TypeError("visitor must be a function");function c(f){if(f===null)return"";if(h.isDate(f))return f.toISOString();if(h.isBoolean(f))return f.toString();if(!l&&h.isBlob(f))throw new P("Blob is not supported. Use a Buffer instead.");return h.isArrayBuffer(f)||h.isTypedArray(f)?l&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function d(f,y,g){let w=f;if(f&&!g&&typeof f=="object"){if(h.endsWith(y,"{}"))y=r?y:y.slice(0,-2),f=JSON.stringify(f);else if(h.isArray(f)&&sf(f)||(h.isFileList(f)||h.endsWith(y,"[]"))&&(w=h.toArray(f)))return y=ra(y),w.forEach(function(S,C){!(h.isUndefined(S)||S===null)&&e.append(o===!0?Oo([y],C,i):o===null?y:y+"[]",c(S))}),!1}return ns(f)?!0:(e.append(Oo(g,y,i),c(f)),!1)}let u=[],p=Object.assign(of,{defaultVisitor:d,convertValue:c,isVisitable:ns});function m(f,y){if(!h.isUndefined(f)){if(u.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));u.push(f),h.forEach(f,function(w,v){(!(h.isUndefined(w)||w===null)&&s.call(e,w,h.isString(v)?v.trim():v,y,p))===!0&&m(w,y?y.concat(v):[v])}),u.pop()}}if(!h.isObject(t))throw new TypeError("data must be an object");return m(t),e}function Do(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function cs(t,e){this._pairs=[],t&&In(t,this,e)}var sa=cs.prototype;sa.append=function(e,n){this._pairs.push([e,n])};sa.toString=function(e){let n=e?function(r){return e.call(this,r,Do)}:Do;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function af(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ia(t,e,n){if(!e)return t;let r=n&&n.encode||af;h.isFunction(n)&&(n={serialize:n});let s=n&&n.serialize,i;if(s?i=s(e,n):i=h.isURLSearchParams(e)?e.toString():new cs(e,n).toString(r),i){let o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}var rs=class{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){h.forEach(this.handlers,function(r){r!==null&&e(r)})}},No=rs,oa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},cf=typeof URLSearchParams!="undefined"?URLSearchParams:cs,lf=typeof FormData!="undefined"?FormData:null,uf=typeof Blob!="undefined"?Blob:null,df={isBrowser:!0,classes:{URLSearchParams:cf,FormData:lf,Blob:uf},protocols:["http","https","file","blob","url","data"]},ls=typeof window!="undefined"&&typeof document!="undefined",ss=typeof navigator=="object"&&navigator||void 0,ff=ls&&(!ss||["ReactNative","NativeScript","NS"].indexOf(ss.product)<0),pf=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",gf=ls&&window.location.href||"http://localhost",mf=Object.freeze({__proto__:null,hasBrowserEnv:ls,hasStandardBrowserWebWorkerEnv:pf,hasStandardBrowserEnv:ff,navigator:ss,origin:gf}),K=b(b({},mf),df);function hf(t,e){return In(t,new K.classes.URLSearchParams,b({visitor:function(n,r,s,i){return K.isNode&&h.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function yf(t){return h.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function bf(t){let e={},n=Object.keys(t),r,s=n.length,i;for(r=0;r<s;r++)i=n[r],e[i]=t[i];return e}function aa(t){function e(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;let a=Number.isFinite(+o),l=i>=n.length;return o=!o&&h.isArray(s)?s.length:o,l?(h.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!h.isObject(s[o]))&&(s[o]=[]),e(n,r,s[o],i)&&h.isArray(s[o])&&(s[o]=bf(s[o])),!a)}if(h.isFormData(t)&&h.isFunction(t.entries)){let n={};return h.forEachEntry(t,(r,s)=>{e(yf(r),s,n,0)}),n}return null}function wf(t,e,n){if(h.isString(t))try{return(e||JSON.parse)(t),h.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}var us={transitional:oa,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){let r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=h.isObject(e);if(i&&h.isHTMLForm(e)&&(e=new FormData(e)),h.isFormData(e))return s?JSON.stringify(aa(e)):e;if(h.isArrayBuffer(e)||h.isBuffer(e)||h.isStream(e)||h.isFile(e)||h.isBlob(e)||h.isReadableStream(e))return e;if(h.isArrayBufferView(e))return e.buffer;if(h.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return hf(e,this.formSerializer).toString();if((a=h.isFileList(e))||r.indexOf("multipart/form-data")>-1){let l=this.env&&this.env.FormData;return In(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),wf(e)):e}],transformResponse:[function(e){let n=this.transitional||us.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(h.isResponse(e)||h.isReadableStream(e))return e;if(e&&h.isString(e)&&(r&&!this.responseType||s)){let o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?P.from(a,P.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:K.classes.FormData,Blob:K.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};h.forEach(["delete","get","head","post","put","patch"],t=>{us.headers[t]={}});var ds=us,Sf=h.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ef=t=>{let e={},n,r,s;return t&&t.split("\n").forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||e[n]&&Sf[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},Lo=Symbol("internals");function Bt(t){return t&&String(t).trim().toLowerCase()}function En(t){return t===!1||t==null?t:h.isArray(t)?t.map(En):String(t)}function vf(t){let e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}var Cf=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Xr(t,e,n,r,s){if(h.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!h.isString(e)){if(h.isString(r))return e.indexOf(r)!==-1;if(h.isRegExp(r))return r.test(e)}}function Tf(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function Pf(t,e){let n=h.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,o){return this[r].call(this,e,s,i,o)},configurable:!0})})}var lt=class{constructor(e){e&&this.set(e)}set(e,n,r){let s=this;function i(a,l,c){let d=Bt(l);if(!d)throw new Error("header name must be a non-empty string");let u=h.findKey(s,d);(!u||s[u]===void 0||c===!0||c===void 0&&s[u]!==!1)&&(s[u||l]=En(a))}let o=(a,l)=>h.forEach(a,(c,d)=>i(c,d,l));if(h.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(h.isString(e)&&(e=e.trim())&&!Cf(e))o(Ef(e),n);else if(h.isObject(e)&&h.isIterable(e)){let a={},l,c;for(let d of e){if(!h.isArray(d))throw TypeError("Object iterator must return a key-value pair");a[c=d[0]]=(l=a[c])?h.isArray(l)?[...l,d[1]]:[l,d[1]]:d[1]}o(a,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Bt(e),e){let r=h.findKey(this,e);if(r){let s=this[r];if(!n)return s;if(n===!0)return vf(s);if(h.isFunction(n))return n.call(this,s,r);if(h.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Bt(e),e){let r=h.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Xr(this,this[r],r,n)))}return!1}delete(e,n){let r=this,s=!1;function i(o){if(o=Bt(o),o){let a=h.findKey(r,o);a&&(!n||Xr(r,r[a],a,n))&&(delete r[a],s=!0)}}return h.isArray(e)?e.forEach(i):i(e),s}clear(e){let n=Object.keys(this),r=n.length,s=!1;for(;r--;){let i=n[r];(!e||Xr(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){let n=this,r={};return h.forEach(this,(s,i)=>{let o=h.findKey(r,i);if(o){n[o]=En(s),delete n[i];return}let a=e?Tf(i):String(i).trim();a!==i&&delete n[i],n[a]=En(s),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let n=Object.create(null);return h.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&h.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){let r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){let r=(this[Lo]=this[Lo]={accessors:{}}).accessors,s=this.prototype;function i(o){let a=Bt(o);r[a]||(Pf(s,o),r[a]=!0)}return h.isArray(e)?e.forEach(i):i(e),this}};lt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);h.reduceDescriptors(lt.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});h.freezeMethods(lt);var le=lt;function Qr(t,e){let n=this||ds,r=e||n,s=le.from(r.headers),i=r.data;return h.forEach(t,function(a){i=a.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function ca(t){return!!(t&&t.__CANCEL__)}function ft(t,e,n){P.call(this,t==null?"canceled":t,P.ERR_CANCELED,e,n),this.name="CanceledError"}h.inherits(ft,P,{__CANCEL__:!0});function la(t,e,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new P("Request failed with status code "+n.status,[P.ERR_BAD_REQUEST,P.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Rf(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function _f(t,e){t=t||10;let n=new Array(t),r=new Array(t),s=0,i=0,o;return e=e!==void 0?e:1e3,function(l){let c=Date.now(),d=r[i];o||(o=c),n[s]=l,r[s]=c;let u=i,p=0;for(;u!==s;)p+=n[u++],u=u%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),c-o<e)return;let m=d&&c-d;return m?Math.round(p*1e3/m):void 0}}function If(t,e){let n=0,r=1e3/e,s,i,o=(c,d=Date.now())=>{n=d,s=null,i&&(clearTimeout(i),i=null),t(...c)};return[(...c)=>{let d=Date.now(),u=d-n;u>=r?o(c,d):(s=c,i||(i=setTimeout(()=>{i=null,o(s)},r-u)))},()=>s&&o(s)]}var Tn=(t,e,n=3)=>{let r=0,s=_f(50,250);return If(i=>{let o=i.loaded,a=i.lengthComputable?i.total:void 0,l=o-r,c=s(l),d=o<=a;r=o;let u={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&d?(a-o)/c:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(u)},n)},Bo=(t,e)=>{let n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Mo=t=>(...e)=>h.asap(()=>t(...e)),Af=K.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,K.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(K.origin),K.navigator&&/(msie|trident)/i.test(K.navigator.userAgent)):()=>!0,xf=K.hasStandardBrowserEnv?{write(t,e,n,r,s,i,o){if(typeof document=="undefined")return;let a=["".concat(t,"=").concat(encodeURIComponent(e))];h.isNumber(n)&&a.push("expires=".concat(new Date(n).toUTCString())),h.isString(r)&&a.push("path=".concat(r)),h.isString(s)&&a.push("domain=".concat(s)),i===!0&&a.push("secure"),h.isString(o)&&a.push("SameSite=".concat(o)),document.cookie=a.join("; ")},read(t){if(typeof document=="undefined")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function kf(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Of(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function ua(t,e,n){let r=!kf(e);return t&&(r||n==!1)?Of(t,e):e}var Uo=t=>t instanceof le?b({},t):t;function Fe(t,e){e=e||{};let n={};function r(c,d,u,p){return h.isPlainObject(c)&&h.isPlainObject(d)?h.merge.call({caseless:p},c,d):h.isPlainObject(d)?h.merge({},d):h.isArray(d)?d.slice():d}function s(c,d,u,p){if(h.isUndefined(d)){if(!h.isUndefined(c))return r(void 0,c,u,p)}else return r(c,d,u,p)}function i(c,d){if(!h.isUndefined(d))return r(void 0,d)}function o(c,d){if(h.isUndefined(d)){if(!h.isUndefined(c))return r(void 0,c)}else return r(void 0,d)}function a(c,d,u){if(u in e)return r(c,d);if(u in t)return r(void 0,c)}let l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,d,u)=>s(Uo(c),Uo(d),u,!0)};return h.forEach(Object.keys(b(b({},t),e)),function(d){let u=l[d]||s,p=u(t[d],e[d],d);h.isUndefined(p)&&u!==a||(n[d]=p)}),n}var da=t=>{let e=Fe({},t),{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=e;if(e.headers=o=le.from(o),e.url=ia(ua(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),h.isFormData(n)){if(K.hasStandardBrowserEnv||K.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(h.isFunction(n.getHeaders)){let l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([d,u])=>{c.includes(d.toLowerCase())&&o.set(d,u)})}}if(K.hasStandardBrowserEnv&&(r&&h.isFunction(r)&&(r=r(e)),r||r!==!1&&Af(e.url))){let l=s&&i&&xf.read(i);l&&o.set(s,l)}return e},Df=typeof XMLHttpRequest!="undefined",Nf=Df&&function(t){return new Promise(function(n,r){let s=da(t),i=s.data,o=le.from(s.headers).normalize(),{responseType:a,onUploadProgress:l,onDownloadProgress:c}=s,d,u,p,m,f;function y(){m&&m(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let g=new XMLHttpRequest;g.open(s.method.toUpperCase(),s.url,!0),g.timeout=s.timeout;function w(){if(!g)return;let S=le.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),R={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:S,config:t,request:g};la(function(A){n(A),y()},function(A){r(A),y()},R),g=null}"onloadend"in g?g.onloadend=w:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(w)},g.onabort=function(){g&&(r(new P("Request aborted",P.ECONNABORTED,t,g)),g=null)},g.onerror=function(C){let R=C&&C.message?C.message:"Network Error",_=new P(R,P.ERR_NETWORK,t,g);_.event=C||null,r(_),g=null},g.ontimeout=function(){let C=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded",R=s.transitional||oa;s.timeoutErrorMessage&&(C=s.timeoutErrorMessage),r(new P(C,R.clarifyTimeoutError?P.ETIMEDOUT:P.ECONNABORTED,t,g)),g=null},i===void 0&&o.setContentType(null),"setRequestHeader"in g&&h.forEach(o.toJSON(),function(C,R){g.setRequestHeader(R,C)}),h.isUndefined(s.withCredentials)||(g.withCredentials=!!s.withCredentials),a&&a!=="json"&&(g.responseType=s.responseType),c&&([p,f]=Tn(c,!0),g.addEventListener("progress",p)),l&&g.upload&&([u,m]=Tn(l),g.upload.addEventListener("progress",u),g.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(d=S=>{g&&(r(!S||S.type?new ft(null,t,g):S),g.abort(),g=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));let v=Rf(s.url);if(v&&K.protocols.indexOf(v)===-1){r(new P("Unsupported protocol "+v+":",P.ERR_BAD_REQUEST,t));return}g.send(i||null)})},Lf=(t,e)=>{let{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s,i=function(c){if(!s){s=!0,a();let d=c instanceof Error?c:this.reason;r.abort(d instanceof P?d:new ft(d instanceof Error?d.message:d))}},o=e&&setTimeout(()=>{o=null,i(new P("timeout ".concat(e," of ms exceeded"),P.ETIMEDOUT))},e),a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),t=null)};t.forEach(c=>c.addEventListener("abort",i));let{signal:l}=r;return l.unsubscribe=()=>h.asap(a),l}},Bf=Lf,Mf=function*(t,e){let n=t.byteLength;if(!e||n<e){yield t;return}let r=0,s;for(;r<n;)s=r+e,yield t.slice(r,s),r=s},Uf=function(t,e){return Rr(this,null,function*(){try{for(var n=Di($f(t)),r,s,i;r=!(s=yield new Ne(n.next())).done;r=!1){let o=s.value;yield*Ke(Mf(o,e))}}catch(s){i=[s]}finally{try{r&&(s=n.return)&&(yield new Ne(s.call(n)))}finally{if(i)throw i[0]}}})},$f=function(t){return Rr(this,null,function*(){if(t[Symbol.asyncIterator]){yield*Ke(t);return}let e=t.getReader();try{for(;;){let{done:n,value:r}=yield new Ne(e.read());if(n)break;yield r}}finally{yield new Ne(e.cancel())}})},$o=(t,e,n,r)=>{let s=Uf(t,e),i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{let{done:c,value:d}=await s.next();if(c){a(),l.close();return}let u=d.byteLength;if(n){let p=i+=u;n(p)}l.enqueue(new Uint8Array(d))}catch(c){throw a(c),c}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},Fo=64*1024,{isFunction:wn}=h,Ff=(({Request:t,Response:e})=>({Request:t,Response:e}))(h.global),{ReadableStream:qo,TextEncoder:jo}=h.global,Ko=(t,...e)=>{try{return!!t(...e)}catch(n){return!1}},qf=t=>{t=h.merge.call({skipUndefined:!0},Ff,t);let{fetch:e,Request:n,Response:r}=t,s=e?wn(e):typeof fetch=="function",i=wn(n),o=wn(r);if(!s)return!1;let a=s&&wn(qo),l=s&&(typeof jo=="function"?(f=>y=>f.encode(y))(new jo):async f=>new Uint8Array(await new n(f).arrayBuffer())),c=i&&a&&Ko(()=>{let f=!1,y=new n(K.origin,{body:new qo,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!y}),d=o&&a&&Ko(()=>h.isReadableStream(new r("").body)),u={stream:d&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!u[f]&&(u[f]=(y,g)=>{let w=y&&y[f];if(w)return w.call(y);throw new P("Response type '".concat(f,"' is not supported"),P.ERR_NOT_SUPPORT,g)})});let p=async f=>{if(f==null)return 0;if(h.isBlob(f))return f.size;if(h.isSpecCompliantForm(f))return(await new n(K.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(h.isArrayBufferView(f)||h.isArrayBuffer(f))return f.byteLength;if(h.isURLSearchParams(f)&&(f=f+""),h.isString(f))return(await l(f)).byteLength},m=async(f,y)=>{let g=h.toFiniteNumber(f.getContentLength());return g==null?p(y):g};return async f=>{let{url:y,method:g,data:w,signal:v,cancelToken:S,timeout:C,onDownloadProgress:R,onUploadProgress:_,responseType:A,headers:N,withCredentials:W="same-origin",fetchOptions:U}=da(f),q=e||fetch;A=A?(A+"").toLowerCase():"text";let $=Bf([v,S&&S.toAbortSignal()],C),Ae=null,he=$&&$.unsubscribe&&(()=>{$.unsubscribe()}),yt;try{if(_&&c&&g!=="get"&&g!=="head"&&(yt=await m(N,w))!==0){let j=new n(y,{method:"POST",body:w,duplex:"half"}),te;if(h.isFormData(w)&&(te=j.headers.get("content-type"))&&N.setContentType(te),j.body){let[Ce,ye]=Bo(yt,Tn(Mo(_)));w=$o(j.body,Fo,Ce,ye)}}h.isString(W)||(W=W?"include":"omit");let Q=i&&"credentials"in n.prototype,bt=O(b({},U),{signal:$,method:g.toUpperCase(),headers:N.normalize().toJSON(),body:w,duplex:"half",credentials:Q?W:void 0});Ae=i&&new n(y,bt);let k=await(i?q(Ae,U):q(y,bt)),xe=d&&(A==="stream"||A==="response");if(d&&(R||xe&&he)){let j={};["status","statusText","headers"].forEach(ke=>{j[ke]=k[ke]});let te=h.toFiniteNumber(k.headers.get("content-length")),[Ce,ye]=R&&Bo(te,Tn(Mo(R),!0))||[];k=new r($o(k.body,Fo,Ce,()=>{ye&&ye(),he&&he()}),j)}A=A||"text";let B=await u[h.findKey(u,A)||"text"](k,f);return!xe&&he&&he(),await new Promise((j,te)=>{la(j,te,{data:B,headers:le.from(k.headers),status:k.status,statusText:k.statusText,config:f,request:Ae})})}catch(Q){throw he&&he(),Q&&Q.name==="TypeError"&&/Load failed|fetch/i.test(Q.message)?Object.assign(new P("Network Error",P.ERR_NETWORK,f,Ae),{cause:Q.cause||Q}):P.from(Q,Q&&Q.code,f,Ae)}}},jf=new Map,fa=t=>{let e=t&&t.env||{},{fetch:n,Request:r,Response:s}=e,i=[r,s,n],o=i.length,a=o,l,c,d=jf;for(;a--;)l=i[a],c=d.get(l),c===void 0&&d.set(l,c=a?new Map:qf(e)),d=c;return c};fa();var fs={http:rf,xhr:Nf,fetch:{get:fa}};h.forEach(fs,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(n){}Object.defineProperty(t,"adapterName",{value:e})}});var Ho=t=>"- ".concat(t),Kf=t=>h.isFunction(t)||t===null||t===!1;function Hf(t,e){t=h.isArray(t)?t:[t];let{length:n}=t,r,s,i={};for(let o=0;o<n;o++){r=t[o];let a;if(s=r,!Kf(r)&&(s=fs[(a=String(r)).toLowerCase()],s===void 0))throw new P("Unknown adapter '".concat(a,"'"));if(s&&(h.isFunction(s)||(s=s.get(e))))break;i[a||"#"+o]=s}if(!s){let o=Object.entries(i).map(([l,c])=>"adapter ".concat(l," ")+(c===!1?"is not supported by the environment":"is not available in the build")),a=n?o.length>1?"since :\n"+o.map(Ho).join("\n"):" "+Ho(o[0]):"as no adapter specified";throw new P("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}var pa={getAdapter:Hf,adapters:fs};function es(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ft(null,t)}function zo(t){return es(t),t.headers=le.from(t.headers),t.data=Qr.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),pa.getAdapter(t.adapter||ds.adapter,t)(t).then(function(r){return es(t),r.data=Qr.call(t,t.transformResponse,r),r.headers=le.from(r.headers),r},function(r){return ca(r)||(es(t),r&&r.response&&(r.response.data=Qr.call(t,t.transformResponse,r.response),r.response.headers=le.from(r.response.headers))),Promise.reject(r)})}var ga="1.13.2",An={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{An[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});var Vo={};An.transitional=function(e,n,r){function s(i,o){return"[Axios v"+ga+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(e===!1)throw new P(s(o," has been removed"+(n?" in "+n:"")),P.ERR_DEPRECATED);return n&&!Vo[o]&&(Vo[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,o,a):!0}};An.spelling=function(e){return(n,r)=>(console.warn("".concat(r," is likely a misspelling of ").concat(e)),!0)};function zf(t,e,n){if(typeof t!="object")throw new P("options must be an object",P.ERR_BAD_OPTION_VALUE);let r=Object.keys(t),s=r.length;for(;s-- >0;){let i=r[s],o=e[i];if(o){let a=t[i],l=a===void 0||o(a,i,t);if(l!==!0)throw new P("option "+i+" must be "+l,P.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new P("Unknown option "+i,P.ERR_BAD_OPTION)}}var vn={assertOptions:zf,validators:An},Se=vn.validators,ut=class{constructor(e){this.defaults=e||{},this.interceptors={request:new No,response:new No}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;let i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+="\n"+i):r.stack=i}catch(o){}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Fe(this.defaults,n);let{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&vn.assertOptions(r,{silentJSONParsing:Se.transitional(Se.boolean),forcedJSONParsing:Se.transitional(Se.boolean),clarifyTimeoutError:Se.transitional(Se.boolean)},!1),s!=null&&(h.isFunction(s)?n.paramsSerializer={serialize:s}:vn.assertOptions(s,{encode:Se.function,serialize:Se.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),vn.assertOptions(n,{baseUrl:Se.spelling("baseURL"),withXsrfToken:Se.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&h.merge(i.common,i[n.method]);i&&h.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=le.concat(o,i);let a=[],l=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(l=l&&y.synchronous,a.unshift(y.fulfilled,y.rejected))});let c=[];this.interceptors.response.forEach(function(y){c.push(y.fulfilled,y.rejected)});let d,u=0,p;if(!l){let f=[zo.bind(this),void 0];for(f.unshift(...a),f.push(...c),p=f.length,d=Promise.resolve(n);u<p;)d=d.then(f[u++],f[u++]);return d}p=a.length;let m=n;for(;u<p;){let f=a[u++],y=a[u++];try{m=f(m)}catch(g){y.call(this,g);break}}try{d=zo.call(this,m)}catch(f){return Promise.reject(f)}for(u=0,p=c.length;u<p;)d=d.then(c[u++],c[u++]);return d}getUri(e){e=Fe(this.defaults,e);let n=ua(e.baseURL,e.url,e.allowAbsoluteUrls);return ia(n,e.params,e.paramsSerializer)}};h.forEach(["delete","get","head","options"],function(e){ut.prototype[e]=function(n,r){return this.request(Fe(r||{},{method:e,url:n,data:(r||{}).data}))}});h.forEach(["post","put","patch"],function(e){function n(r){return function(i,o,a){return this.request(Fe(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}ut.prototype[e]=n(),ut.prototype[e+"Form"]=n(!0)});var Cn=ut,is=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});let r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i,o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},e(function(i,o,a){r.reason||(r.reason=new ft(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){let e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new t(function(s){e=s}),cancel:e}}},Vf=is;function Gf(t){return function(n){return t.apply(null,n)}}function Wf(t){return h.isObject(t)&&t.isAxiosError===!0}var os={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(os).forEach(([t,e])=>{os[e]=t});var Yf=os;function ma(t){let e=new Cn(t),n=Go(Cn.prototype.request,e);return h.extend(n,Cn.prototype,e,{allOwnKeys:!0}),h.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return ma(Fe(t,s))},n}var M=ma(ds);M.Axios=Cn;M.CanceledError=ft;M.CancelToken=Vf;M.isCancel=ca;M.VERSION=ga;M.toFormData=In;M.AxiosError=P;M.Cancel=M.CanceledError;M.all=function(e){return Promise.all(e)};M.spread=Gf;M.isAxiosError=Wf;M.mergeConfig=Fe;M.AxiosHeaders=le;M.formToJSON=t=>aa(h.isHTMLForm(t)?new FormData(t):t);M.getAdapter=pa.getAdapter;M.HttpStatusCode=Yf;M.default=M;ha.exports=M});var hs=E((Yy,ms)=>{"use strict";var ba=t=>typeof t=="object"&&t!==null,wa=Symbol("skip"),ya=t=>ba(t)&&!(t instanceof RegExp)&&!(t instanceof Error)&&!(t instanceof Date),gs=(t,e,n,r=new WeakMap)=>{if(n=b({deep:!1,target:{}},n),r.has(t))return r.get(t);r.set(t,n.target);let{target:s}=n;delete n.target;let i=o=>o.map(a=>ya(a)?gs(a,e,n,r):a);if(Array.isArray(t))return i(t);for(let[o,a]of Object.entries(t)){let l=e(o,a,t);if(l===wa)continue;let[c,d,{shouldRecurse:u=!0}={}]=l;c!=="__proto__"&&(n.deep&&u&&ya(d)&&(d=Array.isArray(d)?i(d):gs(d,e,n,r)),s[c]=d)}return s};ms.exports=(t,e,n)=>{if(!ba(t))throw new TypeError("Expected an object, got `".concat(t,"` (").concat(typeof t,")"));return gs(t,e,n)};ms.exports.mapObjectSkip=wa});var Ea=E((Zy,ys)=>{"use strict";var Jf=t=>{let e=!1,n=!1,r=!1;for(let s=0;s<t.length;s++){let i=t[s];e&&/[a-zA-Z]/.test(i)&&i.toUpperCase()===i?(t=t.slice(0,s)+"-"+t.slice(s),e=!1,r=n,n=!0,s++):n&&r&&/[a-zA-Z]/.test(i)&&i.toLowerCase()===i?(t=t.slice(0,s-1)+"-"+t.slice(s-1),r=n,n=!1,e=!0):(e=i.toLowerCase()===i&&i.toUpperCase()!==i,r=n,n=i.toUpperCase()===i&&i.toLowerCase()!==i)}return t},Sa=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");e=Object.assign({pascalCase:!1},e);let n=s=>e.pascalCase?s.charAt(0).toUpperCase()+s.slice(1):s;return Array.isArray(t)?t=t.map(s=>s.trim()).filter(s=>s.length).join("-"):t=t.trim(),t.length===0?"":t.length===1?e.pascalCase?t.toUpperCase():t.toLowerCase():(t!==t.toLowerCase()&&(t=Jf(t)),t=t.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(s,i)=>i.toUpperCase()).replace(/\d+(\w|$)/g,s=>s.toUpperCase()),n(t))};ys.exports=Sa;ys.exports.default=Sa});var Ca=E((Xy,va)=>{"use strict";var bs=class{constructor(e={}){if(!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=e.maxSize,this.cache=new Map,this.oldCache=new Map,this._size=0}_set(e,n){this.cache.set(e,n),this._size++,this._size>=this.maxSize&&(this._size=0,this.oldCache=this.cache,this.cache=new Map)}get(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e)){let n=this.oldCache.get(e);return this.oldCache.delete(e),this._set(e,n),n}}set(e,n){return this.cache.has(e)?this.cache.set(e,n):this._set(e,n),this}has(e){return this.cache.has(e)||this.oldCache.has(e)}peek(e){if(this.cache.has(e))return this.cache.get(e);if(this.oldCache.has(e))return this.oldCache.get(e)}delete(e){let n=this.cache.delete(e);return n&&this._size--,this.oldCache.delete(e)||n}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}*[Symbol.iterator](){for(let e of this.cache)yield e;for(let e of this.oldCache){let[n]=e;this.cache.has(n)||(yield e)}}get size(){let e=0;for(let n of this.oldCache.keys())this.cache.has(n)||e++;return this._size+e}};va.exports=bs});var Ia=E((Qy,_a)=>{"use strict";var Ta=hs(),Zf=Ea(),Xf=Ca(),Qf=(t,e)=>t.some(n=>typeof n=="string"?n===e:(n.lastIndex=0,n.test(e))),ws=new Xf({maxSize:1e5}),Pa=t=>typeof t=="object"&&t!==null&&!(t instanceof RegExp)&&!(t instanceof Error)&&!(t instanceof Date),Ra=(t,e)=>{if(!Pa(t))return t;e=b({deep:!1,pascalCase:!1},e);let{exclude:n,pascalCase:r,stopPaths:s,deep:i}=e,o=new Set(s),a=l=>(c,d)=>{if(i&&Pa(d)){let u=l===void 0?c:"".concat(l,".").concat(c);o.has(u)||(d=Ta(d,a(u)))}if(!(n&&Qf(n,c))){let u=r?"".concat(c,"_"):c;if(ws.has(u))c=ws.get(u);else{let p=Zf(c,{pascalCase:r});c.length<100&&ws.set(u,p),c=p}}return[c,d]};return Ta(t,a(void 0))};_a.exports=(t,e)=>Array.isArray(t)?Object.keys(t).map(n=>Ra(t[n],e)):Ra(t,e)});var Ss=E((tb,Aa)=>{Aa.exports=Ss()});var Ts={};St(Ts,{__addDisposableResource:()=>ec,__assign:()=>xn,__asyncDelegator:()=>Va,__asyncGenerator:()=>za,__asyncValues:()=>Ga,__await:()=>pt,__awaiter:()=>$a,__classPrivateFieldGet:()=>Za,__classPrivateFieldIn:()=>Qa,__classPrivateFieldSet:()=>Xa,__createBinding:()=>On,__decorate:()=>Oa,__disposeResources:()=>tc,__esDecorate:()=>Na,__exportStar:()=>qa,__extends:()=>xa,__generator:()=>Fa,__importDefault:()=>Ja,__importStar:()=>Ya,__makeTemplateObject:()=>Wa,__metadata:()=>Ua,__param:()=>Da,__propKey:()=>Ba,__read:()=>Cs,__rest:()=>ka,__rewriteRelativeImportExtension:()=>nc,__runInitializers:()=>La,__setFunctionName:()=>Ma,__spread:()=>ja,__spreadArray:()=>Ha,__spreadArrays:()=>Ka,__values:()=>kn,default:()=>np});function xa(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Es(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function ka(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function Oa(t,e,n,r){var s=arguments.length,i=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i}function Da(t,e){return function(n,r){e(n,r,t)}}function Na(t,e,n,r,s,i){function o(w){if(w!==void 0&&typeof w!="function")throw new TypeError("Function expected");return w}for(var a=r.kind,l=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?r.static?t:t.prototype:null,d=e||(c?Object.getOwnPropertyDescriptor(c,r.name):{}),u,p=!1,m=n.length-1;m>=0;m--){var f={};for(var y in r)f[y]=y==="access"?{}:r[y];for(var y in r.access)f.access[y]=r.access[y];f.addInitializer=function(w){if(p)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(w||null))};var g=(0,n[m])(a==="accessor"?{get:d.get,set:d.set}:d[l],f);if(a==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(u=o(g.get))&&(d.get=u),(u=o(g.set))&&(d.set=u),(u=o(g.init))&&s.unshift(u)}else(u=o(g))&&(a==="field"?s.unshift(u):d[l]=u)}c&&Object.defineProperty(c,r.name,d),p=!0}function La(t,e,n){for(var r=arguments.length>2,s=0;s<e.length;s++)n=r?e[s].call(t,n):e[s].call(t);return r?n:void 0}function Ba(t){return typeof t=="symbol"?t:"".concat(t)}function Ma(t,e,n){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:n?"".concat(n," ",e):e})}function Ua(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function $a(t,e,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(d){try{c(r.next(d))}catch(u){o(u)}}function l(d){try{c(r.throw(d))}catch(u){o(u)}}function c(d){d.done?i(d.value):s(d.value).then(a,l)}c((r=r.apply(t,e||[])).next())})}function Fa(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(d){return l([c,d])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(n=0)),n;)try{if(r=1,s&&(i=c[0]&2?s.return:c[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;switch(s=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,s=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1],i=c;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(c);break}i[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(d){c=[6,d],s=0}finally{r=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function qa(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&On(e,t,n)}function kn(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Cs(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return i}function ja(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Cs(arguments[e]));return t}function Ka(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),s=0,e=0;e<n;e++)for(var i=arguments[e],o=0,a=i.length;o<a;o++,s++)r[s]=i[o];return r}function Ha(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}function pt(t){return this instanceof pt?(this.v=t,this):new pt(t)}function za(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(m){return function(f){return Promise.resolve(f).then(m,u)}}function a(m,f){r[m]&&(s[m]=function(y){return new Promise(function(g,w){i.push([m,y,g,w])>1||l(m,y)})},f&&(s[m]=f(s[m])))}function l(m,f){try{c(r[m](f))}catch(y){p(i[0][3],y)}}function c(m){m.value instanceof pt?Promise.resolve(m.value.v).then(d,u):p(i[0][2],m)}function d(m){l("next",m)}function u(m){l("throw",m)}function p(m,f){m(f),i.shift(),i.length&&l(i[0][0],i[0][1])}}function Va(t){var e,n;return e={},r("next"),r("throw",function(s){throw s}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(s,i){e[s]=t[s]?function(o){return(n=!n)?{value:pt(t[s](o)),done:!1}:i?i(o):o}:i}}function Ga(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof kn=="function"?kn(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(o){return new Promise(function(a,l){o=t[i](o),s(a,l,o.done,o.value)})}}function s(i,o,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},o)}}function Wa(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Ya(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=vs(t),r=0;r<n.length;r++)n[r]!=="default"&&On(e,t,n[r]);return ep(e,t),e}function Ja(t){return t&&t.__esModule?t:{default:t}}function Za(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)}function Xa(t,e,n,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(t,n):s?s.value=n:e.set(t,n),n}function Qa(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function ec(t,e,n){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,s;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],n&&(s=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");s&&(r=function(){try{s.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:r,async:n})}else n&&t.stack.push({async:!0});return e}function tc(t){function e(i){t.error=t.hasError?new tp(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var n,r=0;function s(){for(;n=t.stack.pop();)try{if(!n.async&&r===1)return r=0,t.stack.push(n),Promise.resolve().then(s);if(n.dispose){var i=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(i).then(s,function(o){return e(o),s()})}else r|=1}catch(o){e(o)}if(r===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return s()}function nc(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(n,r,s,i,o){return r?e?".jsx":".js":s&&(!i||!o)?n:s+i+"."+o.toLowerCase()+"js"}):t}var Es,xn,On,ep,vs,tp,np,Ps=be(()=>{Es=function(t,e){return Es=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},Es(t,e)};xn=function(){return xn=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},xn.apply(this,arguments)};On=Object.create?function(t,e,n,r){r===void 0&&(r=n);var s=Object.getOwnPropertyDescriptor(e,n);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,s)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]};ep=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},vs=function(t){return vs=Object.getOwnPropertyNames||function(e){var n=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[n.length]=r);return n},vs(t)};tp=typeof SuppressedError=="function"?SuppressedError:function(t,e,n){var r=new Error(n);return r.name="SuppressedError",r.error=t,r.suppressed=e,r};np={__extends:xa,__assign:xn,__rest:ka,__decorate:Oa,__param:Da,__esDecorate:Na,__runInitializers:La,__propKey:Ba,__setFunctionName:Ma,__metadata:Ua,__awaiter:$a,__generator:Fa,__createBinding:On,__exportStar:qa,__values:kn,__read:Cs,__spread:ja,__spreadArrays:Ka,__spreadArray:Ha,__await:pt,__asyncGenerator:za,__asyncDelegator:Va,__asyncValues:Ga,__makeTemplateObject:Wa,__importStar:Ya,__importDefault:Ja,__classPrivateFieldGet:Za,__classPrivateFieldSet:Xa,__classPrivateFieldIn:Qa,__addDisposableResource:ec,__disposeResources:tc,__rewriteRelativeImportExtension:nc}});var rc=E(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.lowerCase=gt.localeLowerCase=void 0;var rp={tr:{regexp:/\u0130|\u0049|\u0049\u0307/g,map:{\u0130:"i",I:"\u0131",I\u0307:"i"}},az:{regexp:/\u0130/g,map:{\u0130:"i",I:"\u0131",I\u0307:"i"}},lt:{regexp:/\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,map:{I:"i\u0307",J:"j\u0307",\u012E:"\u012F\u0307",\u00CC:"i\u0307\u0300",\u00CD:"i\u0307\u0301",\u0128:"i\u0307\u0303"}}};function sp(t,e){var n=rp[e.toLowerCase()];return Rs(n?t.replace(n.regexp,function(r){return n.map[r]}):t)}gt.localeLowerCase=sp;function Rs(t){return t.toLowerCase()}gt.lowerCase=Rs});var ic=E(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.noCase=void 0;var ip=rc(),op=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],ap=/[^A-Z0-9]+/gi;function cp(t,e){e===void 0&&(e={});for(var n=e.splitRegexp,r=n===void 0?op:n,s=e.stripRegexp,i=s===void 0?ap:s,o=e.transform,a=o===void 0?ip.lowerCase:o,l=e.delimiter,c=l===void 0?" ":l,d=sc(sc(t,r,"$1\0$2"),i,"\0"),u=0,p=d.length;d.charAt(u)==="\0";)u++;for(;d.charAt(p-1)==="\0";)p--;return d.slice(u,p).split("\0").map(a).join(c)}Dn.noCase=cp;function sc(t,e,n){return e instanceof RegExp?t.replace(e,n):e.reduce(function(r,s){return r.replace(s,n)},t)}});var oc=E(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.dotCase=void 0;var lp=(Ps(),Pr(Ts)),up=ic();function dp(t,e){return e===void 0&&(e={}),up.noCase(t,lp.__assign({delimiter:"."},e))}Nn.dotCase=dp});var ac=E(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.snakeCase=void 0;var fp=(Ps(),Pr(Ts)),pp=oc();function gp(t,e){return e===void 0&&(e={}),pp.dotCase(t,fp.__assign({delimiter:"_"},e))}Ln.snakeCase=gp});var lc=E((ob,cc)=>{cc.exports=bp;var mp=/\s/,hp=/(_|-|\.|:)/,yp=/([a-z][A-Z]|[A-Z][a-z])/;function bp(t){return mp.test(t)?t.toLowerCase():hp.test(t)?(Sp(t)||t).toLowerCase():yp.test(t)?vp(t).toLowerCase():t.toLowerCase()}var wp=/[\W_]+(.|$)/g;function Sp(t){return t.replace(wp,function(e,n){return n?" "+n:""})}var Ep=/(.)([A-Z]+)/g;function vp(t){return t.replace(Ep,function(e,n,r){return n+" "+r.toLowerCase().split("").join(" ")})}});var dc=E((ab,uc)=>{var Cp=lc();uc.exports=Tp;function Tp(t){return Cp(t).replace(/[\W_]+(.|$)/g,function(e,n){return n?" "+n:""}).trim()}});var pc=E((cb,fc)=>{var Pp=dc();fc.exports=Rp;function Rp(t){return Pp(t).replace(/\s/g,"_")}});var mc=E((lb,gc)=>{"use strict";var _p=hs(),Ip=pc();gc.exports=function(t,e){return e=Object.assign({deep:!0,exclude:[]},e),_p(t,function(n,r){return[Ap(e.exclude,n)?n:Ip(n),r]},e)};function Ap(t,e){return t.some(function(n){return typeof n=="string"?n===e:n.test(e)})}});var Is=E(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.BasisTheoryApiError=void 0;function xp(t){function e(){var n=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(n,Object.getPrototypeOf(this)),n}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var _s=class t extends xp(Error){constructor(e,n,r,s){super(e),this.status=n,this.data=r,this._debug=s,this.name="BasisTheoryApiError",Object.setPrototypeOf(this,t.prototype)}};Bn.BasisTheoryApiError=_s});var Un=E(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.logger=void 0;var hc=bn(),kp=(()=>{let t="pubb96b84a13912504f4354f2d794ea4fab",e=!0,n=async(s,i,o={})=>{if(e)try{var a,l,c,d,u,p;let m;hc.DEFAULT_BASE_URL.includes("localhost")?m="local":hc.DEFAULT_BASE_URL.includes("dev")?m="dev":m="prod";let f=b({level:i,message:s,service:"js-sdk",env:m,referrer:(a=document)===null||a===void 0?void 0:a.referrer,origin:(l=window)===null||l===void 0||(c=l.location)===null||c===void 0?void 0:c.origin,url:(d=window)===null||d===void 0||(u=d.location)===null||u===void 0?void 0:u.href,userAgent:(p=navigator)===null||p===void 0?void 0:p.userAgent},o);await fetch("https://http-intake.logs.datadoghq.com/v1/input/".concat(t),{method:"POST",body:JSON.stringify(f),headers:{"Content-Type":"application/json"}})}catch(m){console.warn("There was an error sending telemetry.")}};return{setTelemetryEnabled:s=>{e=s},log:{error:(s,i={})=>n(s,"error",i),info:(s,i={})=>n(s,"info",i),warn:(s,i={})=>n(s,"warn",i)}}})();Mn.logger=kp});var mt=E(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.transformTokenResponseCamelCase=T.transformTokenRequestSnakeCase=T.transformResponseCamelCase=T.transformRequestSnakeCase=T.transformReactorResponseCamelCase=T.transformReactorRequestSnakeCase=T.transformProxyResponseCamelCase=T.transformProxyRequestSnakeCase=T.proxyRaw=T.getRuntime=T.getQueryParams=T.getOSVersion=T.getBrowser=T.errorInterceptorDebug=T.errorInterceptor=T.debugTransform=T.dataExtractor=T.dataAndHeadersExtractor=T.createRequestConfig=T.concatResponseTransformerWithDefault=T.concatRequestTransformerWithDefault=T.buildUserAgentString=T.buildClientUserAgentString=T.assertInit=void 0;var bc=$n(ps()),Ee=$n(Ia()),yc=$n(Ss()),Op=ac(),Ft=$n(mc()),Dp=Is(),de=bn(),Np=Un();function $n(t){return t&&t.__esModule?t:{default:t}}var Lp=t=>{if(t==null)throw new Error("BasisTheory has not yet been properly initialized.");return t};T.assertInit=Lp;var Bp=t=>{if(typeof t!="undefined")return(0,Ft.default)(t,{deep:!0})};T.transformRequestSnakeCase=Bp;var Mp=t=>t;T.proxyRaw=Mp;var Up=t=>{if(typeof t!="undefined")return b(b({},(0,Ft.default)(t,{deep:!0})),t.configuration!==void 0?{configuration:t.configuration}:{})};T.transformReactorRequestSnakeCase=Up;var $p=t=>{if(typeof t!="undefined")return b(b({},(0,Ft.default)(t,{deep:!0})),t.configuration!==void 0?{configuration:t.configuration}:{})};T.transformProxyRequestSnakeCase=$p;var Fp=t=>{if(typeof t!="undefined")return b(b(b({},(0,Ft.default)(t,{deep:!0})),t.data!==void 0?{data:t.data}:{}),t.metadata!==void 0?{metadata:t.metadata}:{})};T.transformTokenRequestSnakeCase=Fp;var ks=t=>t&&(t==null?void 0:t.pagination)!==void 0&&(t==null?void 0:t.data)!==void 0,qp=t=>{if(typeof t!="undefined")return ks(t)?{data:t.data.map(r=>b(b(b({},(0,Ee.default)(r,{deep:!0})),r.data!==void 0?{data:r.data}:{}),r.metadata!==void 0?{metadata:r.metadata}:{})),pagination:(0,Ee.default)(t.pagination,{deep:!0})}:b(b(b({},(0,Ee.default)(t,{deep:!0})),t.data!==void 0?{data:t.data}:{}),t.metadata!==void 0?{metadata:t.metadata}:{})};T.transformTokenResponseCamelCase=qp;var jp=t=>{if(typeof t!="undefined")return ks(t)?{data:t.data.map(r=>b(b({},(0,Ee.default)(r,{deep:!0})),r.configuration!==void 0?{configuration:r.configuration}:{})),pagination:(0,Ee.default)(t.pagination,{deep:!0})}:b(b({},(0,Ee.default)(t,{deep:!0})),t.configuration!==void 0?{configuration:t.configuration}:{})};T.transformReactorResponseCamelCase=jp;var Kp=t=>{if(typeof t!="undefined")return ks(t)?{data:t.data.map(r=>b(b({},(0,Ee.default)(r,{deep:!0})),r.configuration!==void 0?{configuration:r.configuration}:{})),pagination:(0,Ee.default)(t.pagination,{deep:!0})}:b(b({},(0,Ee.default)(t,{deep:!0})),t.configuration!==void 0?{configuration:t.configuration}:{})};T.transformProxyResponseCamelCase=Kp;var Hp=t=>{if(typeof t!="undefined")return(0,Ee.default)(t,{deep:!0})};T.transformResponseCamelCase=Hp;var zp=t=>t==null?void 0:t.data;T.dataExtractor=zp;var Vp=t=>({data:t==null?void 0:t.data,headers:t==null?void 0:t.headers});T.dataAndHeadersExtractor=Vp;var As=t=>[t,...bc.default.defaults.transformRequest];T.concatRequestTransformerWithDefault=As;var xs=t=>[...bc.default.defaults.transformResponse,t];T.concatResponseTransformerWithDefault=xs;var Gp=(t,e)=>{if(!t)return e?b(b({},e.transformRequest!==void 0?{transformRequest:As(e.transformRequest)}:{}),e.transformResponse!==void 0?{transformResponse:xs(e.transformResponse)}:{}):void 0;let{apiKey:n,correlationId:r,idempotencyKey:s,query:i,headers:o}=t,a=n?{[de.API_KEY_HEADER]:n}:{},l=r?{[de.BT_TRACE_ID_HEADER]:r}:{},c=s?{[de.BT_IDEMPOTENCY_KEY_HEADER]:s}:{};return b(b(b({headers:b(b(b(b({},a),l),c),typeof o!="undefined"&&b({},o))},typeof i!="undefined"&&{params:i}),(e==null?void 0:e.transformRequest)!==void 0?{transformRequest:As(e.transformRequest)}:{}),(e==null?void 0:e.transformResponse)!==void 0?{transformResponse:xs(e.transformResponse)}:{})};T.createRequestConfig=Gp;var wc=(t,e)=>{var n,r,s,i,o,a,l,c,d,u,p,m,f,y,g;let w=(n=t==null||(r=t.response)===null||r===void 0?void 0:r.status)!==null&&n!==void 0?n:-1,v=t==null||(s=t.response)===null||s===void 0?void 0:s.data,S;if(e){var C,R,_,A;S={cfRay:t==null||(C=t.response)===null||C===void 0||(R=C.headers)===null||R===void 0?void 0:R[de.CF_RAY_HEADER],btTraceId:t==null||(_=t.response)===null||_===void 0||(A=_.headers)===null||A===void 0?void 0:A[de.BT_TRACE_ID_HEADER]}}let N=w>-1&&w<499?"warn":"error";throw Np.logger.log[N]("Error when making ".concat(t==null||(i=t.config)===null||i===void 0||(o=i.method)===null||o===void 0?void 0:o.toUpperCase()," request to ").concat(t==null||(a=t.config)===null||a===void 0?void 0:a.baseURL," from the JS SDK"),{apiStatus:w,logType:"axiosError",logOrigin:"axiosErrorInterceptor",requestDetails:{url:t==null||(l=t.config)===null||l===void 0?void 0:l.baseURL,method:t==null||(c=t.config)===null||c===void 0||(d=c.method)===null||d===void 0?void 0:d.toUpperCase(),btUserAgent:t==null||(u=t.config)===null||u===void 0||(p=u.headers)===null||p===void 0?void 0:p[de.CLIENT_USER_AGENT_HEADER]},errorDetails:{code:t==null?void 0:t.code,name:t==null?void 0:t.name,stack:t==null?void 0:t.stack,headers:t==null||(m=t.response)===null||m===void 0?void 0:m.headers,message:t==null?void 0:t.message,status:t==null||(f=t.response)===null||f===void 0?void 0:f.status,statusText:t==null||(y=t.response)===null||y===void 0?void 0:y.statusText,data:t==null||(g=t.response)===null||g===void 0?void 0:g.data}}),new Dp.BasisTheoryApiError(t.message,w,v,S)},Wp=t=>wc(t,!1);T.errorInterceptor=Wp;var Yp=t=>wc(t,!0);T.errorInterceptorDebug=Yp;var Jp=(t={})=>{let e=Object.keys(t);if(e.length){let n=new URLSearchParams,r=(s,i,o=!1)=>{let a=typeof i,l=o?s:(0,Op.snakeCase)(s);(i===null||["boolean","number","string"].includes(a))&&n.append(l,i)};return e.forEach(s=>{let i=t[s];Array.isArray(i)?i.forEach(o=>{r(String(s),o)}):i&&typeof i=="object"?Object.keys(i).forEach(a=>{r("".concat(String(s),".").concat(a),i[a],!0)}):r(String(s),i)}),"?".concat(n.toString())}return""};T.getQueryParams=Jp;var Zp=t=>"(".concat(t.name||"","; ").concat(t.version||"","; ").concat(t.url||"",")"),Xp=t=>{let e="".concat(de.USER_AGENT_CLIENT,"/unknown");return t&&Object.keys(t||{}).length&&(e+=" ".concat(Zp(t))),e};T.buildUserAgentString=Xp;var Sc=()=>{let{userAgent:t}=window.navigator,e="unknown",n=de.BROWSER_LIST.find(r=>t.includes(r.browserUA));if(n)try{e=t.split("".concat(n.browserUA,"/"))[1]}catch(r){e="unknown"}return"".concat((n==null?void 0:n.browserName)||"unknown","/").concat(e)};T.getBrowser=Sc;var Ec=()=>typeof window=="object"&&window.navigator.product==="ReactNative",vc=()=>{if(Ec())return"ReactNative";if(typeof window=="undefined")try{return"".concat(yc.default.type(),"/").concat(yc.default.version())}catch(t){return"unknown"}try{let e=window.navigator.appVersion.match(new RegExp("\\(([^)]+)\\)","u"));return e&&e.length>1?e[1]:"unknown"}catch(t){return"unknown"}};T.getOSVersion=vc;var Cc=()=>Ec()?"ReactNative":typeof window=="undefined"?"NodeJS/".concat(process.version):Sc();T.getRuntime=Cc;var Qp=t=>{let e={client:de.USER_AGENT_CLIENT,clientVersion:"unknown",osVersion:vc(),runtimeVersion:Cc(),application:{}};return t&&(e.application=t),JSON.stringify((0,Ft.default)(e))};T.buildClientUserAgentString=Qp;var eg=(t,e)=>(e&&typeof t=="object"&&t!==void 0&&(t._debug=O(b({},t._debug),{cfRay:e[de.CF_RAY_HEADER],btTraceId:e[de.BT_TRACE_ID_HEADER]})),t);T.debugTransform=eg});var Tc=E(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.BasisTheoryValidationError=void 0;function tg(t){function e(){var n=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(n,Object.getPrototypeOf(this)),n}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var Os=class t extends tg(Error){constructor(e,n,r){super(e),this.details=n,this.validation=r,this.name="BasisTheoryValidationError",Object.setPrototypeOf(this,t.prototype)}};Fn.BasisTheoryValidationError=Os});var Pc=E(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.HttpClientError=void 0;function ng(t){function e(){var n=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(n,Object.getPrototypeOf(this)),n}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var Ds=class t extends ng(Error){constructor(e,n,r,s){super(e),this.name="HttpClientError",this.status=n,this.data=r,this.headers=s,Object.setPrototypeOf(this,t.prototype)}};qn.HttpClientError=Ds});var H=E(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});var Rc={BasisTheoryApiError:!0,BasisTheoryValidationError:!0,HttpClientError:!0};Object.defineProperty(fe,"BasisTheoryApiError",{enumerable:!0,get:function(){return rg.BasisTheoryApiError}});Object.defineProperty(fe,"BasisTheoryValidationError",{enumerable:!0,get:function(){return sg.BasisTheoryValidationError}});Object.defineProperty(fe,"HttpClientError",{enumerable:!0,get:function(){return ig.HttpClientError}});var Ns=bn();Object.keys(Ns).forEach(function(t){t==="default"||t==="__esModule"||Object.prototype.hasOwnProperty.call(Rc,t)||t in fe&&fe[t]===Ns[t]||Object.defineProperty(fe,t,{enumerable:!0,get:function(){return Ns[t]}})});var Ls=mt();Object.keys(Ls).forEach(function(t){t==="default"||t==="__esModule"||Object.prototype.hasOwnProperty.call(Rc,t)||t in fe&&fe[t]===Ls[t]||Object.defineProperty(fe,t,{enumerable:!0,get:function(){return Ls[t]}})});var rg=Is(),sg=Tc(),ig=Pc()});var _c=E(()=>{"use strict"});var Ic=E(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.BasisTheoryService=void 0;var jn=og(ps()),ve=H();function og(t){return t&&t.__esModule?t:{default:t}}var Bs=class{constructor(e){let{apiKey:n,baseURL:r,transformRequest:s,transformResponse:i,appInfo:o,debug:a}=e;if(typeof jn.default=="string")throw new Error("basis-theory-js@1.77.0+ and basis-theory-react@1.12.1+ are not supported with CRA 5, go to https://github.com/Basis-Theory/basis-theory-js/issues/365#issuecomment-1662883062 for workarounds.");this.client=jn.default.create({baseURL:r,headers:b({[ve.API_KEY_HEADER]:n,[ve.CLIENT_USER_AGENT_HEADER]:(0,ve.buildClientUserAgentString)(o)},typeof window=="undefined"&&{[ve.USER_AGENT_HEADER]:(0,ve.buildUserAgentString)(o)}),transformRequest:[].concat(s||ve.transformRequestSnakeCase,jn.default.defaults.transformRequest),transformResponse:jn.default.defaults.transformResponse.concat(i||ve.transformResponseCamelCase,a?ve.debugTransform:[])}),this.client.interceptors.response.use(void 0,a?ve.errorInterceptorDebug:ve.errorInterceptor)}};Kn.BasisTheoryService=Bs});var z=E(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});var Ms=_c();Object.keys(Ms).forEach(function(t){t==="default"||t==="__esModule"||t in Oe&&Oe[t]===Ms[t]||Object.defineProperty(Oe,t,{enumerable:!0,get:function(){return Ms[t]}})});var Us=Ic();Object.keys(Us).forEach(function(t){t==="default"||t==="__esModule"||t in Oe&&Oe[t]===Us[t]||Object.defineProperty(Oe,t,{enumerable:!0,get:function(){return Us[t]}})})});var pe=E(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.CrudBuilder=void 0;var Z=H(),ag=t=>class extends t{create(n,r){return this.client.post("/",n,(0,Z.createRequestConfig)(r)).then(Z.dataExtractor)}},cg=t=>class extends t{retrieve(n,r){return this.client.get(n,(0,Z.createRequestConfig)(r)).then(Z.dataExtractor)}},lg=t=>class extends t{update(n,r,s){return this.client.put(n,r,(0,Z.createRequestConfig)(s)).then(Z.dataExtractor)}},ug=t=>class extends t{patch(n,r,s){let i=(0,Z.createRequestConfig)(s);return this.client.patch(n,r,O(b({},i),{headers:O(b({},(i==null?void 0:i.headers)||{}),{[Z.CONTENT_TYPE_HEADER]:Z.MERGE_CONTENT_TYPE})})).then(Z.dataExtractor)}},dg=t=>class extends t{async delete(n,r){await this.client.delete(n,(0,Z.createRequestConfig)(r))}},fg=t=>class extends t{list(n={},r={}){let s="/".concat((0,Z.getQueryParams)(n));return this.client.get(s,(0,Z.createRequestConfig)(r)).then(Z.dataExtractor)}},$s=class{constructor(e){this.BaseService=e}create(){return this.BaseService=ag(this.BaseService),this}retrieve(){return this.BaseService=cg(this.BaseService),this}update(){return this.BaseService=lg(this.BaseService),this}patch(){return this.BaseService=ug(this.BaseService),this}delete(){return this.BaseService=dg(this.BaseService),this}list(){return this.BaseService=fg(this.BaseService),this}build(){return this.BaseService}};Hn.CrudBuilder=$s});var xc=E(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.BasisTheoryApplicationTemplates=void 0;var Ac=H(),pg=z(),gg=pe(),mg=new gg.CrudBuilder(class extends pg.BasisTheoryService{list(e){return this.client.get("/",(0,Ac.createRequestConfig)(e)).then(Ac.dataExtractor)}}).retrieve().build();zn.BasisTheoryApplicationTemplates=mg});var kc=E(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});Object.defineProperty(Fs,"BasisTheoryApplicationTemplates",{enumerable:!0,get:function(){return hg.BasisTheoryApplicationTemplates}});var hg=xc()});var Oc=E(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.BasisTheoryApplicationKeys=void 0;var Vn=H(),yg=z(),bg=pe(),wg=new bg.CrudBuilder(class extends yg.BasisTheoryService{create(e){return this.client.post("".concat(e,"/keys")).then(Vn.dataExtractor)}get(e){return this.client.get("".concat(e,"/keys")).then(Vn.dataExtractor)}getById(e,n){return this.client.get("".concat(e,"/keys/").concat(n)).then(Vn.dataExtractor)}delete(e,n){return this.client.delete("".concat(e,"/keys/").concat(n)).then(Vn.dataExtractor)}}).build();Gn.BasisTheoryApplicationKeys=wg});var Dc=E(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});Object.defineProperty(qs,"BasisTheoryApplicationKeys",{enumerable:!0,get:function(){return Sg.BasisTheoryApplicationKeys}});var Sg=Oc()});var Nc=E(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.BasisTheoryApplications=void 0;var Wn=H(),Eg=z(),vg=pe(),Cg=new vg.CrudBuilder(class extends Eg.BasisTheoryService{getApplicationByKey(){return this.retrieveByKey()}retrieveByKey(e){return this.client.get("/key",(0,Wn.createRequestConfig)(e)).then(Wn.dataExtractor)}regenerateKey(e,n){return this.client.post("".concat(e,"/regenerate"),void 0,(0,Wn.createRequestConfig)(n)).then(Wn.dataExtractor)}}).create().retrieve().update().delete().list().build();Yn.BasisTheoryApplications=Cg});var Ks=E(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});Object.defineProperty(js,"BasisTheoryApplications",{enumerable:!0,get:function(){return Tg.BasisTheoryApplications}});var Tg=Nc()});var Lc=E(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.BasisTheoryTokenize=void 0;var Jn=H(),Pg=z(),Hs=class extends Pg.BasisTheoryService{tokenize(e,n={}){return this.client.post("/",e,(0,Jn.createRequestConfig)(n,{transformRequest:Jn.proxyRaw,transformResponse:Jn.proxyRaw})).then(Jn.dataExtractor)}};Zn.BasisTheoryTokenize=Hs});var Bc=E(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});Object.defineProperty(zs,"BasisTheoryTokenize",{enumerable:!0,get:function(){return Rg.BasisTheoryTokenize}});var Rg=Lc()});var Mc=E(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.delegateTokenize=void 0;var _g=Bc(),Ig=t=>class extends _g.BasisTheoryTokenize{tokenize(n,r){return t!=null&&t.hasElement(n)?t.tokenize(n,r):super.tokenize(n,r)}};Xn.delegateTokenize=Ig});var Uc=E(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.BasisTheoryTokens=void 0;var qt=H(),jt=mt(),Ag=z(),xg=pe(),kg=new xg.CrudBuilder(class extends Ag.BasisTheoryService{constructor(e){let n=e;n.transformRequest=[].concat(jt.transformTokenRequestSnakeCase,e.transformRequest||[]),n.transformResponse=[].concat(jt.transformTokenResponseCamelCase,e.transformResponse||[]),super(n)}retrieve(e,n={}){let r="/".concat(e);return this.client.get(r,(0,qt.createRequestConfig)(n)).then(jt.dataExtractor)}update(e,n,r={}){let s="/".concat(e),i=(0,qt.createRequestConfig)(r);return this.client.patch(s,n,O(b({},i),{headers:O(b({},(i==null?void 0:i.headers)||{}),{[qt.CONTENT_TYPE_HEADER]:qt.MERGE_CONTENT_TYPE})})).then(jt.dataExtractor)}search(e,n){return this.client.post("/search",e,(0,qt.createRequestConfig)(n)).then(jt.dataExtractor)}}).create().delete().list().build();Qn.BasisTheoryTokens=kg});var Gs=E(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Object.defineProperty(Vs,"BasisTheoryTokens",{enumerable:!0,get:function(){return Og.BasisTheoryTokens}});var Og=Uc()});var $c=E(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.delegateTokens=void 0;var Dg=Gs(),Ng=t=>class extends Dg.BasisTheoryTokens{create(n,r){return t!=null&&t.hasElement(n)?t.tokens.create(n,r):super.create(n,r)}update(n,r,s){return t!=null&&t.hasElement(r)?t.tokens.update(n,r,s):super.update(n,r,s)}retrieve(n,r){return t!==void 0?t.tokens.retrieve(n,r):super.retrieve(n,r)}};er.delegateTokens=Ng});var Fc=E(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.BasisTheoryProxy=void 0;var Re=H(),Lg=z(),Ws=class extends Lg.BasisTheoryService{get(e){return this.proxyRequest("get",e)}post(e){return this.proxyRequest("post",e)}put(e){return this.proxyRequest("put",e)}patch(e){return this.proxyRequest("patch",e)}delete(e){return this.proxyRequest("delete",e)}proxyRequest(e,n){var r;if(e==="post"||e==="put"||e==="patch"){var s,i;let o=n!=null&&n.includeResponseHeaders&&e==="post"?Re.dataAndHeadersExtractor:Re.dataExtractor;return this.client[e]((s=n==null?void 0:n.path)!==null&&s!==void 0?s:"",(i=n==null?void 0:n.body)!==null&&i!==void 0?i:void 0,(0,Re.createRequestConfig)(n,{transformRequest:Re.proxyRaw,transformResponse:Re.proxyRaw})).then(o)}return this.client[e]((r=n==null?void 0:n.path)!==null&&r!==void 0?r:"/",(0,Re.createRequestConfig)(n,{transformRequest:Re.proxyRaw,transformResponse:Re.proxyRaw})).then(Re.dataExtractor)}};tr.BasisTheoryProxy=Ws});var qc=E(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});var Ys=Fc();Object.keys(Ys).forEach(function(t){t==="default"||t==="__esModule"||t in Kt&&Kt[t]===Ys[t]||Object.defineProperty(Kt,t,{enumerable:!0,get:function(){return Ys[t]}})})});var jc=E(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.delegateProxy=void 0;var Bg=qc(),Mg=t=>class extends Bg.BasisTheoryProxy{get(n){return t!==void 0?t.proxy.get(n):super.get(n)}post(n){return t!==void 0?t.proxy.post(n):super.post(n)}put(n){return t!==void 0?t.proxy.put(n):super.put(n)}patch(n){return t!==void 0?t.proxy.patch(n):super.patch(n)}delete(n){return t!==void 0?t.proxy.delete(n):super.delete(n)}};nr.delegateProxy=Mg});var Hc=E(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.BasisTheoryTokenIntents=void 0;var Kc=H(),Ug=z(),$g=pe(),Fg=new $g.CrudBuilder(class extends Ug.BasisTheoryService{constructor(e){let n=e;n.transformRequest=[].concat(Kc.transformTokenRequestSnakeCase,e.transformRequest||[]),n.transformResponse=[].concat(Kc.transformTokenResponseCamelCase,e.transformResponse||[]),super(n)}}).create().delete().build();rr.BasisTheoryTokenIntents=Fg});var zc=E(Js=>{"use strict";Object.defineProperty(Js,"__esModule",{value:!0});Object.defineProperty(Js,"BasisTheoryTokenIntents",{enumerable:!0,get:function(){return qg.BasisTheoryTokenIntents}});var qg=Hc()});var Vc=E(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.delegateTokenIntents=void 0;var jg=zc(),Kg=t=>class extends jg.BasisTheoryTokenIntents{create(n,r){return t!=null&&t.hasElement(n)?t.tokenIntents.create(n,r):super.create(n,r)}};sr.delegateTokenIntents=Kg});var Gc=E(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});var Zs=Mc();Object.keys(Zs).forEach(function(t){t==="default"||t==="__esModule"||t in X&&X[t]===Zs[t]||Object.defineProperty(X,t,{enumerable:!0,get:function(){return Zs[t]}})});var Xs=$c();Object.keys(Xs).forEach(function(t){t==="default"||t==="__esModule"||t in X&&X[t]===Xs[t]||Object.defineProperty(X,t,{enumerable:!0,get:function(){return Xs[t]}})});var Qs=jc();Object.keys(Qs).forEach(function(t){t==="default"||t==="__esModule"||t in X&&X[t]===Qs[t]||Object.defineProperty(X,t,{enumerable:!0,get:function(){return Qs[t]}})});var ei=Vc();Object.keys(ei).forEach(function(t){t==="default"||t==="__esModule"||t in X&&X[t]===ei[t]||Object.defineProperty(X,t,{enumerable:!0,get:function(){return ei[t]}})})});var ti=E(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.injectScript=ht.findScript=void 0;var Hg=t=>document.querySelector('script[src^="'.concat(t,'"]'));ht.findScript=Hg;var zg=t=>{let e=document.createElement("script");e.src=t;let n=document.head||document.body;if(!n)throw new Error("No <head> or <body> elements found in document.");return n.append(e),e};ht.injectScript=zg});var ni=E(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE=F.ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE=F.ELEMENTS_SCRIPT_FAILED_TO_DELIVER=F.ELEMENTS_NOM_DOM_ERROR_MESSAGE=F.ELEMENTS_INIT_ERROR_MESSAGE=F.CARD_ICON_POSITIONS=F.CARD_BRANDS=F.AUTOCOMPLETE_VALUES=void 0;var Vg="BasisTheory Elements was not properly initialized.";F.ELEMENTS_INIT_ERROR_MESSAGE=Vg;var Gg="Tried to load BasisTheoryElements in a non-DOM environment.";F.ELEMENTS_NOM_DOM_ERROR_MESSAGE=Gg;var Wg="Basis Theory Elements did not load properly. Check network tab for more details.";F.ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE=Wg;var Yg="Unable to load the Elements script. This may be due to network restrictions or browser extensions like ad blockers interfering with script loading. Check browser settings or network connection and try again.";F.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE=Yg;var Jg="Failed to deliver Elements script from Basis Theory. Check your network connection and try again or contact support@basistheory.com";F.ELEMENTS_SCRIPT_FAILED_TO_DELIVER=Jg;var Zg=["visa","mastercard","american-express","discover","diners-club","jcb","unionpay","maestro","elo","hiper","hipercard","mir","unknown"];F.CARD_BRANDS=Zg;var Xg=["left","right","none"];F.CARD_ICON_POSITIONS=Xg;var Qg=["additional-name","address-level1","address-level2","address-level3","address-level4","address-line1","address-line2","address-line3","bday-day","bday-month","bday-year","bday","billing","cc-additional-name","cc-csc","cc-exp-month","cc-exp-year","cc-exp","cc-family-name","cc-given-name","cc-name","cc-number","cc-type","country-name","country","current-password","email","family-name","fax","given-name","home","honorific-prefix","honorific-suffix","language","mobile","name","new-password","nickname","off","on","one-time-code","organization-title","organization","page","postal-code","sex","shipping","street-address","tel-area-code","tel-country-code","tel-extension","tel-local-prefix","tel-local-suffix","tel-local","tel-national","tel","transaction-amount","transaction-currency","url","username","work"];F.AUTOCOMPLETE_VALUES=Qg});var Yc=E(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.loadElements=void 0;var De=Un(),qe=ni(),ri=ti(),si,Wc=(t,e)=>new Promise((n,r)=>{let s=(0,ri.findScript)(t);if(!s)s=(0,ri.injectScript)(t);else{if(window.BasisTheoryElements){n(window.BasisTheoryElements);return}if(e>0){try{var i;(i=s)===null||i===void 0||i.remove()}catch(o){(async()=>await De.logger.log.error("Error removing script from DOM on retry attempt ".concat(e),{logType:"scriptRemovalError",logOrigin:"loadScript",retryCount:e,removalError:o}))(),r(new Error(qe.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE));return}s=(0,ri.injectScript)(t)}}s.addEventListener("load",()=>{if(window.BasisTheoryElements){n(window.BasisTheoryElements);return}(async()=>await De.logger.log.error("Elements not found on window on load",{logType:"elementsNotFoundOnWindow",logOrigin:"loadScript",retryCount:e}))(),r(new Error(qe.ELEMENTS_SCRIPT_LOAD_ERROR_MESSAGE))}),s.addEventListener("error",async o=>{if(await De.logger.log.error("Elements script onError event",{logType:"elementsScriptOnError",logOrigin:"loadScript",retryCount:e,event:{message:o==null?void 0:o.message,source:o==null?void 0:o.filename,lineno:o==null?void 0:o.lineno,colno:o==null?void 0:o.colno,error:o==null?void 0:o.error,target:o==null?void 0:o.target}}),e===0){Wc(t,e+1).then(n).catch(r);return}try{let l=await fetch(t),c,d;try{d=await l.text(),c=JSON.parse(d)}catch(u){var a;c=(a=d)!==null&&a!==void 0?a:""}if(!l.ok){await De.logger.log.error("Second attempt to load elements script failed, fetch failed with status: ".concat(l.status,"."),{logType:"elementsScriptFetchFailure",logOrigin:"loadScript",retryCount:e,fetchResult:"error",fetchResponse:c,fetchHeaders:l.headers,fetchStatusText:l.statusText}),r(new Error(qe.ELEMENTS_SCRIPT_FAILED_TO_DELIVER));return}await De.logger.log.error("Second attempt to load elements script failed, fetch success",{logType:"elementsScriptFetchFailure",logOrigin:"loadScript",retryCount:e,fetchResult:"success",fetchResponse:c,fetchHeaders:l.headers,fetchStatusText:l.statusText}),r(new Error(qe.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE));return}catch(l){await De.logger.log.error("Second attempt failed to load elements script failed, fetch network error.",{logType:"elementsScriptFetchError",logOrigin:"loadScript",retryCount:e,fetchResult:"error",fetchError:JSON.stringify(l!=null?l:"Unknown Error")}),r(new Error(qe.ELEMENTS_SCRIPT_UNKNOWN_ERROR_MESSAGE));return}})}),em=t=>(si||(si=new Promise((e,n)=>{if(typeof window!="object"){(async()=>(await De.logger.log.warn(qe.ELEMENTS_NOM_DOM_ERROR_MESSAGE,{logType:"elementsNonDomError",logOrigin:"loadElements"}),n(new Error(qe.ELEMENTS_NOM_DOM_ERROR_MESSAGE))))();return}if(window.BasisTheoryElements){e(window.BasisTheoryElements);return}let r="https://js.basistheory.com/web-elements/1.5.0/client/index.js";if(typeof t!="undefined")try{r=new URL(t).toString().replace(new RegExp("\\/$","u"),"")}catch(s){throw(async()=>await De.logger.log.warn("Invalid format for the given Elements client url.",{logType:"invalidClientUrlError",logOrigin:"loadElements"}))(),new Error("Invalid format for the given Elements client url.")}Wc(r,0).then(e).catch(s=>{n(s)})})),si);ir.loadElements=em});var Jc=E(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});var ii=Gc();Object.keys(ii).forEach(function(t){t==="default"||t==="__esModule"||t in ge&&ge[t]===ii[t]||Object.defineProperty(ge,t,{enumerable:!0,get:function(){return ii[t]}})});var oi=ti();Object.keys(oi).forEach(function(t){t==="default"||t==="__esModule"||t in ge&&ge[t]===oi[t]||Object.defineProperty(ge,t,{enumerable:!0,get:function(){return oi[t]}})});var ai=Yc();Object.keys(ai).forEach(function(t){t==="default"||t==="__esModule"||t in ge&&ge[t]===ai[t]||Object.defineProperty(ge,t,{enumerable:!0,get:function(){return ai[t]}})})});var Zc=E(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.BasisTheoryLogs=void 0;var tm=z(),nm=pe(),rm=new nm.CrudBuilder(class extends tm.BasisTheoryService{}).list().build();or.BasisTheoryLogs=rm});var Xc=E(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});Object.defineProperty(ci,"BasisTheoryLogs",{enumerable:!0,get:function(){return sm.BasisTheoryLogs}});var sm=Zc()});var Qc=E(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.BasisTheoryPermissions=void 0;var li=H(),im=z(),ui=class extends im.BasisTheoryService{list(e,n){let r="/".concat((0,li.getQueryParams)(e));return this.client.get(r,(0,li.createRequestConfig)(n)).then(li.dataExtractor)}};ar.BasisTheoryPermissions=ui});var el=E(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});Object.defineProperty(di,"BasisTheoryPermissions",{enumerable:!0,get:function(){return om.BasisTheoryPermissions}});var om=Qc()});var nl=E(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.BasisTheoryProxies=void 0;var tl=mt(),am=z(),cm=pe(),lm=new cm.CrudBuilder(class extends am.BasisTheoryService{constructor(e){let n=b({},e);n.transformRequest=[].concat(tl.transformProxyRequestSnakeCase,e.transformRequest||[]),n.transformResponse=[].concat(tl.transformProxyResponseCamelCase,e.transformResponse||[]),super(n)}}).create().retrieve().update().patch().delete().list().build();cr.BasisTheoryProxies=lm});var rl=E(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});var fi=nl();Object.keys(fi).forEach(function(t){t==="default"||t==="__esModule"||t in Ht&&Ht[t]===fi[t]||Object.defineProperty(Ht,t,{enumerable:!0,get:function(){return fi[t]}})})});var sl=E(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.BasisTheoryReactorFormulas=void 0;var um=z(),dm=pe(),fm=new dm.CrudBuilder(class extends um.BasisTheoryService{}).create().retrieve().update().delete().list().build();lr.BasisTheoryReactorFormulas=fm});var il=E(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});Object.defineProperty(pi,"BasisTheoryReactorFormulas",{enumerable:!0,get:function(){return pm.BasisTheoryReactorFormulas}});var pm=sl()});var al=E(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.BasisTheoryReactors=void 0;var ur=H(),ol=mt(),gm=z(),mm=pe(),hm=new mm.CrudBuilder(class extends gm.BasisTheoryService{constructor(e){let n=b({},e);n.transformRequest=[].concat(ol.transformReactorRequestSnakeCase,e.transformRequest||[]),n.transformResponse=[].concat(ol.transformReactorResponseCamelCase,e.transformResponse||[]),super(n)}react(e,n,r){return this.client.post("/".concat(e,"/react"),n,(0,ur.createRequestConfig)(r,{transformRequest:ur.proxyRaw,transformResponse:ur.proxyRaw})).then(ur.dataExtractor)}}).create().retrieve().update().patch().delete().list().build();dr.BasisTheoryReactors=hm});var cl=E(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});Object.defineProperty(gi,"BasisTheoryReactors",{enumerable:!0,get:function(){return ym.BasisTheoryReactors}});var ym=al()});var ul=E(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.BasisTheorySessions=void 0;var ll=H(),fr=mt(),bm=z(),mi=class extends bm.BasisTheoryService{constructor(e){let n=b({},e);n.transformRequest=[].concat(fr.transformProxyRequestSnakeCase,e.transformRequest||[]),n.transformResponse=[].concat(fr.transformProxyResponseCamelCase,e.transformResponse||[]),super(n)}create(e={}){return this.client.post("/",void 0,(0,ll.createRequestConfig)(e)).then(fr.dataExtractor)}authorize(e,n={}){return this.client.post("/authorize",e,(0,ll.createRequestConfig)(n)).then(fr.dataExtractor)}};pr.BasisTheorySessions=mi});var dl=E(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});Object.defineProperty(hi,"BasisTheorySessions",{enumerable:!0,get:function(){return wm.BasisTheorySessions}});var wm=ul()});var fl=E(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.BasisTheoryTenants=void 0;var L=H(),Sm=z(),Em=pe(),vm=new Em.CrudBuilder(class extends Sm.BasisTheoryService{retrieve(e){return this.client.get("/",(0,L.createRequestConfig)(e)).then(L.dataExtractor)}update(e,n){return this.client.put("/",e,(0,L.createRequestConfig)(n)).then(L.dataExtractor)}async delete(e){await this.client.delete("/",(0,L.createRequestConfig)(e))}retrieveUsageReport(e){return this.client.get("/reports/usage",(0,L.createRequestConfig)(e)).then(L.dataExtractor)}createInvitation(e,n){return this.client.post("/invitations",e,(0,L.createRequestConfig)(n)).then(L.dataExtractor)}resendInvitation(e,n){return this.client.post("/invitations/".concat(e,"/resend"),{},(0,L.createRequestConfig)(n)).then(L.dataExtractor)}listInvitations(e,n){let r="/invitations".concat((0,L.getQueryParams)(e));return this.client.get(r,(0,L.createRequestConfig)(n)).then(L.dataExtractor)}retrieveInvitation(e,n){return this.client.get("/invitations/".concat(e),(0,L.createRequestConfig)(n)).then(L.dataExtractor)}async deleteInvitation(e,n){await this.client.delete("/invitations/".concat(e),(0,L.createRequestConfig)(n))}listMembers(e,n){let r="/members".concat((0,L.getQueryParams)(e));return this.client.get(r,(0,L.createRequestConfig)(n)).then(L.dataExtractor)}async deleteMember(e,n){await this.client.delete("/members/".concat(e),(0,L.createRequestConfig)(n))}}).build();gr.BasisTheoryTenants=vm});var pl=E(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});Object.defineProperty(yi,"BasisTheoryTenants",{enumerable:!0,get:function(){return Cm.BasisTheoryTenants}});var Cm=fl()});var gl=E(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.BasisTheoryThreeDS=void 0;var mr=H(),Tm=z(),bi=class extends Tm.BasisTheoryService{createSession(e){return this.client.post("/sessions",e).then(mr.dataExtractor)}getSessionById(e){return this.client.get("/sessions/".concat(e)).then(mr.dataExtractor)}authenticateSession(e,n){return this.client.post("/sessions/".concat(e,"/authenticate"),n).then(mr.dataExtractor)}getChallengeResult(e){return this.client.get("/sessions/".concat(e,"/challenge-result")).then(mr.dataExtractor)}};hr.BasisTheoryThreeDS=bi});var ml=E(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});var wi=gl();Object.keys(wi).forEach(function(t){t==="default"||t==="__esModule"||t in zt&&zt[t]===wi[t]||Object.defineProperty(zt,t,{enumerable:!0,get:function(){return wi[t]}})})});var hl=E(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.BasisTheory=void 0;var Pm=kc(),Rm=Dc(),_m=Ks(),x=H(),Im=Un(),Vt=Jc(),Am=ni(),xm=Xc(),km=el(),Om=rl(),Dm=il(),Nm=cl(),Lm=dl(),Bm=pl(),Mm=ml();function Um(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var $m={apiBaseUrl:x.DEFAULT_BASE_URL,elements:!1,disableTelemetry:!1,debug:!1,appInfo:{}},Si=class{constructor(){Um(this,"_initStatus","not-started")}async init(e,n={}){if(this._initStatus!=="not-started"&&this._initStatus!=="error")throw new Error("This BasisTheory instance has been already initialized.");this._initStatus="in-progress";try{this._initOptions=Object.freeze(b(b({},$m),n));let r=this._initOptions.apiBaseUrl;try{let i=new URL(this.initOptions.apiBaseUrl);i.hostname==="localhost"?i.protocol="http":i.protocol="https",r="".concat(i.toString().replace(new RegExp("\\/$","u"),""),"/")}catch(i){throw new Error("Invalid format for the given API base url.")}let s=this._initOptions.appInfo;this._initOptions.elements&&await this.loadElements(e),this._tokens=new((0,Vt.delegateTokens)(this._elements))({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.tokens,r).toString(),appInfo:s,debug:this._initOptions.debug}),this._tokenize=new((0,Vt.delegateTokenize)(this._elements))({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.tokenize,r).toString(),appInfo:s,debug:this._initOptions.debug}),this._applications=new _m.BasisTheoryApplications({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.applications,r).toString(),appInfo:s}),this._applicationKeys=new Rm.BasisTheoryApplicationKeys({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.applicationKeys,r).toString(),appInfo:s}),this._applicationTemplates=new Pm.BasisTheoryApplicationTemplates({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.applicationTemplates,r).toString(),appInfo:s}),this._tenants=new Bm.BasisTheoryTenants({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.tenants,r).toString(),appInfo:s}),this._logs=new xm.BasisTheoryLogs({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.logs,r).toString(),appInfo:s}),this._reactorFormulas=new Dm.BasisTheoryReactorFormulas({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.reactorFormulas,r).toString(),appInfo:s}),this._reactors=new Nm.BasisTheoryReactors({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.reactors,r).toString(),appInfo:s}),this._permissions=new km.BasisTheoryPermissions({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.permissions,r).toString(),appInfo:s}),this._proxies=new Om.BasisTheoryProxies({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.proxies,r).toString(),appInfo:s}),this._proxy=new((0,Vt.delegateProxy)(this._elements))({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.proxy,r).toString(),appInfo:s,debug:this._initOptions.debug}),this._sessions=new Lm.BasisTheorySessions({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.sessions,r).toString(),appInfo:s,debug:this._initOptions.debug}),this._threeds=new Mm.BasisTheoryThreeDS({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.threeds,r).toString(),appInfo:s}),this._tokenIntents=new((0,Vt.delegateTokenIntents)(this._elements))({apiKey:e,baseURL:new URL(x.CLIENT_BASE_PATHS.tokenIntents,r).toString(),appInfo:s,debug:this._initOptions.debug}),n.disableTelemetry&&Im.logger.setTelemetryEnabled(!1),this._initStatus="done"}catch(r){throw this._initStatus="error",r}return this}createElement(e,n){if(!this._elements)throw new Error(Am.ELEMENTS_INIT_ERROR_MESSAGE);return this._elements.createElement(e,n)}tokenize(e,n){return(0,x.assertInit)(this._tokenize).tokenize(e,n)}async loadElements(e){let n;try{n=new URL(this.initOptions.elementsBaseUrl||x.DEFAULT_ELEMENTS_BASE_URL)}catch(l){throw new Error("Invalid format for the given Elements base url.")}let r=await(0,Vt.loadElements)(this.initOptions.elementsClientUrl),s=this.initOptions.elementsUseNgApi||!1,i=this.initOptions.elementsUseSameOriginApi||!1,o=this.initOptions.disableTelemetry||!1,a=this.initOptions.debug||!1;await r.init(e,n.toString().replace(new RegExp("\\/$","u"),""),s,i,o,a),this.elements=r}get initOptions(){return(0,x.assertInit)(this._initOptions)}get tokens(){return(0,x.assertInit)(this._tokens)}get applications(){return(0,x.assertInit)(this._applications)}get applicationKeys(){return(0,x.assertInit)(this._applicationKeys)}get applicationTemplates(){return(0,x.assertInit)(this._applicationTemplates)}get client(){if(this._elements){var e;return(e=this._elements)===null||e===void 0?void 0:e.client}console.error("Elements are not initialized. Either initialize elements or use a regular HTTP client if no elements are needed.")}get tenants(){return(0,x.assertInit)(this._tenants)}get logs(){return(0,x.assertInit)(this._logs)}get reactorFormulas(){return(0,x.assertInit)(this._reactorFormulas)}get reactors(){return(0,x.assertInit)(this._reactors)}get permissions(){return(0,x.assertInit)(this._permissions)}get proxies(){return(0,x.assertInit)(this._proxies)}get proxy(){return(0,x.assertInit)(this._proxy)}get sessions(){return(0,x.assertInit)(this._sessions)}get threeds(){return(0,x.assertInit)(this._threeds)}get tokenIntents(){return(0,x.assertInit)(this._tokenIntents)}get elements(){return(0,x.assertInit)(this._elements)}set elements(e){this._elements=e}};yr.BasisTheory=Si});var yl=E(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});var Ci={_instance:!0};ee._instance=void 0;var br=hl();Object.keys(br).forEach(function(t){t==="default"||t==="__esModule"||Object.prototype.hasOwnProperty.call(Ci,t)||t in ee&&ee[t]===br[t]||Object.defineProperty(ee,t,{enumerable:!0,get:function(){return br[t]}})});var Ei=Ks();Object.keys(Ei).forEach(function(t){t==="default"||t==="__esModule"||Object.prototype.hasOwnProperty.call(Ci,t)||t in ee&&ee[t]===Ei[t]||Object.defineProperty(ee,t,{enumerable:!0,get:function(){return Ei[t]}})});var vi=Gs();Object.keys(vi).forEach(function(t){t==="default"||t==="__esModule"||Object.prototype.hasOwnProperty.call(Ci,t)||t in ee&&ee[t]===vi[t]||Object.defineProperty(ee,t,{enumerable:!0,get:function(){return vi[t]}})});var Fm=new br.BasisTheory;ee._instance=Fm});var Nl={};St(Nl,{BasisTheory3ds:()=>Dl,sdkBaseUrl:()=>Cr});function oh(t){let{messageType:e,messageVersion:n,threeDSServerTransID:r,acsTransID:s,challengeWindowSize:i}=t;return typeof t=="object"&&t!==null&&typeof e=="string"&&typeof n=="string"&&typeof r=="string"&&typeof s=="string"&&Object.values(Er).includes(i)}var _e,Ie,Sr,qm,vl,jm,Cl,Km,Hm,Tl,zm,me,Er,wr,Vm,Gm,Wm,Pl,Ym,Rl,_l,Il,bl,Gt,Al,Jm,xl,vr,kl,V,Ti,Ol,wl,Zm,Sl,El,Xm,Qm,eh,th,nh,rh,sh,ih,ah,ch,lh,uh,Cr,Dl,Ll=be(()=>{_e={FRAME_CONTAINER_ID:"methodFrameContainer",IFRAME_NAME:"methodIframe",FORM_NAME:"threeDSMethodForm",INPUT_NAME:"threeDSMethodData"},Ie={FRAME_CONTAINER_ID:"challengeFrameContainer",IFRAME_NAME:"challengeIframe",FORM_NAME:"threeDSCReqForm"},Sr={IFRAME:"iframe",REDIRECT:"redirect"},qm="BT-API-KEY",vl="BT-TRACE-ID",jm="https://api.basistheory.com",Cl="https://3ds.basistheory.com",Km="pages/method.html",Hm="pages/challenge.html",Tl=!1,zm=({disableTelemetry:t})=>{Tl=t},me=(()=>{let t="pubb96b84a13912504f4354f2d794ea4fab",e=async(n,r,s,i={})=>{if(Tl)return;let o=O(b({application:"3ds-web",ddsource:"3ds-web",service:"3ds-web"},i),{level:r,message:r==="error"&&s?"".concat(n,": ").concat(s.message):n});try{if(!(await fetch("https://http-intake.logs.datadoghq.com/v1/input/".concat(t),{method:"POST",body:JSON.stringify(o),headers:{"Content-Type":"application/json"}})).ok)throw new Error("Network response was not ok")}catch(a){}};return{log:{error:(n,r,s)=>e(n,"error",r,s),info:(n,r)=>e(n,"info",void 0,r),warn:(n,r)=>e(n,"warn",void 0,r)}}})();(function(t){t.ONE="01",t.TWO="02",t.THREE="03",t.FOUR="04",t.FIVE="05"})(Er||(Er={}));wr=t=>t==null?"":JSON.stringify(t),Vm=()=>{let t=[1,4,8,15,16,24,32,48],e=window.screen.colorDepth,n=t.filter(r=>r<=e);return n.length===0?t[0]:Math.max(...n)},Gm=t=>t==null?void 0:t.split("-").slice(0,2).join("-"),Wm=()=>({browserColorDepth:wr(Vm()),browserJavascriptEnabled:!0,browserJavaEnabled:window.navigator.javaEnabled(),browserLanguage:Gm(window.navigator.language),browserScreenHeight:wr(window.screen.height),browserScreenWidth:wr(window.screen.width),browserTZ:wr(new Date().getTimezoneOffset()),browserUserAgent:window.navigator.userAgent}),Pl=(t="05")=>{let n={"01":["250px","400px"],"02":["390px","400px"],"03":["500px","600px"],"04":["600px","400px"],"05":["100%","100%"]}[t];if(n)return n;{let r=new Error("Window size ".concat(t," is not supported"));throw me.log.error("Unsupported window size",r),r}},Ym=t=>!t||t instanceof HTMLElement,Rl=(t,e,n,r="0",s="0",i)=>{if(!Ym(t)||!e||!n){let a="Unable to create iframe. Container must be a HTML element ".concat(JSON.stringify(t)," ").concat(e," ").concat(n);throw me.log.error("Unable to create iframe",new Error),Error(a)}let o=document.createElement("iframe");return o.name=e,o.width=r,o.height=s,o.setAttribute("id",n),o.setAttribute("frameborder","0"),o.setAttribute("border","0"),i&&typeof i=="function"&&o.addEventListener("onload",i),t.appendChild(o),o},_l=(t,e,n)=>{let r=document.createElement("form");return r.name=t,r.action=e,r.method="POST",r.target=n,r},Il=(t,e)=>{let n=document.createElement("input");return n.name=t,n.value=e,n},bl=(t,e=!1)=>{let n;if(n=document.getElementById(t),n){n.innerHTML="",e&&n.setAttribute("style","display:none;");return}n=document.createElement("div"),n.id=t,e&&n.setAttribute("style","display:none;"),document.body.appendChild(n)},Gt=t=>t==null?void 0:t.map(e=>{var n;return(n=document.getElementById(e))==null?void 0:n.remove()}),Al=(t,e)=>{let n=r=>typeof r=="string"?e(r):typeof r!="object"||r===null?r:Array.isArray(r)?r.map(n):Object.fromEntries(Object.entries(r).map(([s,i])=>[e(s),typeof i=="object"||Array.isArray(i)?n(i):i]));return n(t)},Jm=t=>Al(t,e=>e.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase()),xl=t=>Al(t,e=>e.replace(/_./g,n=>n[1].toUpperCase())),vr=t=>btoa(JSON.stringify(t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),kl=(()=>{let t,e;return{client:async(s,i,o,a)=>{if(!t)throw Error("Missing api key");e&&me.log.info("Using custom api base url in 3DS SDK ".concat(e));let l={};return a&&(l[vl]=a),await fetch("".concat(e!=null?e:jm,"/3ds").concat(i),{method:s,body:JSON.stringify(o),headers:b({[qm]:t,"Content-Type":"application/json"},l)})},init:(s,i)=>{t=s,e=i}}})();(function(t){t.METHOD="method",t.CHALLENGE="challenge",t.METHOD_TIME_OUT="methodTimeout",t.START_METHOD_TIME_OUT="startMethodTimeout",t.ERROR="error"})(V||(V={}));Ti=t=>window.postMessage(t,"*"),Ol=t=>typeof t=="object"&&t!==null&&"isCompleted"in t&&typeof t.isCompleted=="boolean"&&"id"in t&&typeof t.id=="string"&&"type"in t&&Object.values(V).includes(t.type),wl=t=>{var e;return(e={[V.CHALLENGE]:Ie.IFRAME_NAME,[V.METHOD]:_e.IFRAME_NAME,[V.METHOD_TIME_OUT]:_e.IFRAME_NAME,[V.ERROR]:"".concat(_e.IFRAME_NAME,",").concat(Ie.IFRAME_NAME),[V.START_METHOD_TIME_OUT]:""}[t])==null?void 0:e.split(",")},Zm=t=>{let e;return new Promise((n,r)=>{let s=i=>{var o,a,l,c;if(Ol(i.data)){if(i.data.type===V.ERROR)me.log.error("Error occurred during session creation: ".concat((o=i==null?void 0:i.data)==null?void 0:o.details)),r(new Error("An error occurred during session creation: ".concat((a=i==null?void 0:i.data)==null?void 0:a.details))),Gt(wl((l=i.data)==null?void 0:l.type)),clearTimeout(e);else if(i.data.type===V.START_METHOD_TIME_OUT)e=setTimeout(()=>{Ti({id:i.data.id,type:V.METHOD_TIME_OUT,isCompleted:!1})},1e4);else if(i.data.type!==V.CHALLENGE){if(i.isTrusted){window.removeEventListener("message",s);let u=(p=>{let m=xl(t),f={id:p.data.id,cardBrand:m.cardBrand,correlationId:m.correlationId};return m.additionalCardBrands&&(f.additionalCardBrands=m.additionalCardBrands),f})(i);n(u),Gt(wl((c=i.data)==null?void 0:c.type)),clearTimeout(e)}}}};window.addEventListener("message",s)})},Sl={},El={"The card was not supported by any card schemes":"3DS is not supported for the provided card"},Xm=t=>"errors"in t&&t.errors!==void 0&&typeof t.errors=="object"&&t.errors!==null,Qm=t=>typeof t=="object"&&t!==null&&("title"in t||"status"in t||"detail"in t),eh=t=>{if(Xm(t)){for(let e of Object.keys(t.errors))if(El[e])throw new Error(El[e])}else if(t.status===424&&t.error){let e=[];t.error.message&&e.push(t.error.message),t.error.details&&e.push("details: "+t.error.details);let n=e.length>0?e.join(" - "):t.title||"An unknown 3DS service error occurred";throw new Error(n)}else if(t.title&&Sl[t.title])throw new Error(Sl[t.title]);throw new Error(t.title||"An unknown error occurred")},th=(t,e,n)=>{let r=vr({threeDSServerTransID:e,threeDSMethodNotificationURL:"".concat(n,"?mode=redirect")}),s=window.open("","threeDSMethodForm");if(!s){console.error("Popup blocked or unable to open the window.");return}let i=_l(_e.FORM_NAME,t,"threeDSMethodForm");i.appendChild(Il(_e.INPUT_NAME,r)),document.body.appendChild(i),i.submit();let o=window.setInterval(()=>{s.closed&&(clearInterval(o),Ti({isCompleted:!0,id:e,type:V.METHOD}))},500)},nh=(t,e,n)=>{let r=vr({threeDSServerTransID:e,threeDSMethodNotificationURL:n}),s=document.getElementById(_e.FRAME_CONTAINER_ID),i=Rl(s,_e.IFRAME_NAME,_e.IFRAME_NAME,"0","0");i.src="".concat(Cr,"/").concat(Km),i.onload=()=>{var o;(o=i.contentWindow)==null||o.postMessage({type:"startMethod",threeDSMethodURL:t,threeDSMethodData:r},"*")}},rh=async({tokenId:t,tokenIntentId:e,pan:n,skipMethodRequest:r=!1,methodRequestMode:s,challengeMode:i,correlationId:o})=>{var m;let a=[n,t,e].filter(f=>f!==void 0);if(a.length===0)throw new Error("One of pan, tokenId, or tokenIntentId is required.");if(a.length>1)throw new Error("Only one of pan, tokenId, or tokenIntentId should be provided.");let l=n?"pan":t?"tokenId":"tokenIntentId",c=n||t||e,d=Wm(),u=await kl.client("POST","/sessions",Jm({[l]:c,device:"browser",deviceInfo:d,webChallengeMode:i}),o);if(!u.ok){let f;try{f=await u.json()}catch(y){let g="Failed to parse error response. HTTP Status: ".concat(u.status);throw me.log.error(g),new Error(g)}if(Qm(f))eh(f);else{let y="An unknown error occurred while creating session. Status: ".concat(u.status,".");throw me.log.error("".concat(y," Response: ").concat(JSON.stringify(f,null,2))),new Error(y)}}let p=xl(await u.json());return p.correlationId=((m=u.headers)==null?void 0:m.get(vl))||"",me.log.info("3DS session response received with ID ".concat(p.id)),p.methodUrl&&!r&&(Ti({isCompleted:!1,id:p.id,type:V.START_METHOD_TIME_OUT}),s===Sr.REDIRECT?th(p.methodUrl,p.id,p.methodNotificationUrl):nh(p.methodUrl,p.id,p.methodNotificationUrl)),p},sh=async({tokenId:t,tokenIntentId:e,pan:n,skipMethodRequest:r=!1,methodRequestMode:s=Sr.IFRAME,challengeMode:i=Sr.IFRAME,correlationId:o=""})=>{let a=await rh({tokenId:t,tokenIntentId:e,pan:n,skipMethodRequest:r,methodRequestMode:s,challengeMode:i,correlationId:o}).catch(l=>Promise.reject(l.message));if(!a.methodUrl||r){let l={id:a.id,cardBrand:a.cardBrand};return a.additionalCardBrands&&(l.additionalCardBrands=a.additionalCardBrands),l}return await Zm(a)},ih=(t=6e4)=>{let e;return new Promise((n,r)=>{let s=i=>{var o,a;if(Ol(i.data))if(i.data.type===V.ERROR)me.log.error("Error occurred during challenge: ".concat((o=i==null?void 0:i.data)==null?void 0:o.details)),r(new Error("An error occurred during challenge: ".concat((a=i==null?void 0:i.data)==null?void 0:a.details))),Gt([Ie.IFRAME_NAME]),clearTimeout(t);else if(i.data.type===V.CHALLENGE){clearTimeout(e),window.removeEventListener("message",s);let c=(d=>({id:d.data.id,isCompleted:d.data.isCompleted,authenticationStatus:d.data.authenticationStatus}))(i);me.log.info("".concat(i.data.type," notification received for session: ").concat(c.id)),n(c),Gt([Ie.IFRAME_NAME])}else i.isTrusted};window.addEventListener("message",s),e=setTimeout(()=>{window.removeEventListener("message",s),r(new Error("Timed out waiting for a challenge response. Please try again.")),Gt([Ie.IFRAME_NAME])},t)})};ah=(t,e,n)=>{let r=document.getElementById(n!=null?n:Ie.FRAME_CONTAINER_ID),s=Pl(e.challengeWindowSize),i=vr(e),o=Ie.IFRAME_NAME,a=Rl(r,o,o,s[0],s[1]);a.src="".concat(Cr,"/").concat(Hm),a.onload=()=>{var l;(l=a.contentWindow)==null||l.postMessage({type:"startChallenge",acsURL:t,creq:i},"*")}},ch=(t,e)=>{let n=Pl(e.challengeWindowSize);if(!window.open("","threeDSChallenge","width=".concat(n[0],",height=").concat(n[1])))throw new Error("Popup blocked or unable to open the window.");let s=vr(e),i=_l(Ie.FORM_NAME,t,"threeDSChallenge"),o=Il("creq",s);i.appendChild(o),document.body.appendChild(i),i.submit()},lh=({sessionId:t,acsTransactionId:e,acsChallengeUrl:n,threeDSVersion:r,windowSize:s,mode:i,containerId:o})=>{if(!t)throw new Error("Session ID is required");let a={messageType:"CReq",messageVersion:r,threeDSServerTransID:t,acsTransID:e,challengeWindowSize:s!=null?s:Er.THREE};if(oh(a))i===Sr.REDIRECT?ch(n,a):ah(n,a,o);else{let l="Invalid challenge request payload for session: ".concat(t);return me.log.error(l),Promise.reject(new Error(l))}return Promise.resolve({id:t})},uh=async({sessionId:t,acsTransactionId:e,acsChallengeUrl:n,threeDSVersion:r,windowSize:s,mode:i="iframe",timeout:o=6e4,containerId:a})=>(await lh({sessionId:t,acsTransactionId:e,acsChallengeUrl:n,threeDSVersion:r,windowSize:s,mode:i,containerId:a}).catch(l=>Promise.reject(l.message)),ih(o)),Cr=Cl,Dl=(t,e)=>{var n,r;try{zm({disableTelemetry:(n=e==null?void 0:e.disableTelemetry)!=null?n:!1}),bl(_e.FRAME_CONTAINER_ID,!0),bl(Ie.FRAME_CONTAINER_ID)}catch(s){me.log.error("Unable to create iframe container",s)}return Cr=(r=e==null?void 0:e.sdkBaseUrl)!=null?r:Cl,kl.init(t,e==null?void 0:e.apiBaseUrl),{createSession:sh,startChallenge:uh}};window.BasisTheory3ds=Dl});var yh={};St(yh,{ApiClient:()=>et,CheckoutResource:()=>an,CheckoutUtils:()=>Kr,CurrencyUtils:()=>Nt,ExpressPaymentMethodsResource:()=>un,FunnelActionType:()=>Zt,GoogleAutocompleteCore:()=>ot,ISODataCore:()=>pn,OrderBumpUtils:()=>Vr,OrderUtils:()=>jr,OrdersResource:()=>ln,PaymentService:()=>Tr,PaymentsResource:()=>nt,PluginConfigUtils:()=>Nr,PostPurchasesUtils:()=>zr,ProductsUtils:()=>qr,PromotionsUtils:()=>Hr,ShippingRatesResource:()=>cn,StoreConfigResource:()=>rt,TagadaApiError:()=>Te,TagadaAuthError:()=>Xe,TagadaCircuitBreakerError:()=>Qe,TagadaClient:()=>Ot,TagadaError:()=>oe,TagadaErrorCode:()=>ne,TagadaExternalTracker:()=>Wt,TagadaNetworkError:()=>Ze,TagadaTracker:()=>Pi,TagadaValidationError:()=>sn,ThreedsResource:()=>st,broadcastConfigUpdate:()=>$u,clearFunnelSessionCookie:()=>Tt,createRawPluginConfig:()=>ao,createTagadaClient:()=>Ri,debounceConfigUpdate:()=>qu,formatMoney:()=>Mu,funnelQueryKeys:()=>Uu,getAssignedPaymentFlowId:()=>xt,getAssignedStepConfig:()=>ie,getBasisTheoryApiKey:()=>mh,getBasisTheoryTenantId:()=>hh,getFunnelSessionCookie:()=>Qt,getFunnelVariantId:()=>Yl,getInternalPath:()=>Lt,getPathInfo:()=>Ao,getPluginConfig:()=>Au,hasFunnelSessionCookie:()=>Wl,injectStepConfigScripts:()=>_i,isPathRemapped:()=>Io,loadLocalConfig:()=>oo,loadPluginConfig:()=>Lr,matchRoute:()=>xo,onConfigUpdate:()=>Fu,sendConfigUpdate:()=>So,setFunnelSessionCookie:()=>xr});Yt();Je();var ne={NETWORK_ERROR:"network_error",API_ERROR:"api_error",AUTH_REQUIRED:"auth_required",TOKEN_EXPIRED:"token_expired",NOT_FOUND:"not_found",VALIDATION_ERROR:"validation_error",CIRCUIT_BREAKER:"circuit_breaker",PAYMENT_FAILED:"payment_failed",CARD_DECLINED:"card_declined",SESSION_EXPIRED:"session_expired",RATE_LIMITED:"rate_limited",TIMEOUT:"timeout",UNKNOWN:"unknown"},oe=class extends Error{constructor(e,n){var r;super(e),this.name="TagadaError",this.code=n.code,this.statusCode=n.statusCode,this.retryable=(r=n.retryable)!=null?r:!1,this.details=n.details,Object.setPrototypeOf(this,new.target.prototype)}},Te=class extends oe{constructor(e,n,r){var s,i;super(e,{code:(s=r==null?void 0:r.code)!=null?s:ne.API_ERROR,statusCode:n,retryable:(i=r==null?void 0:r.retryable)!=null?i:n>=500,details:r==null?void 0:r.details}),this.name="TagadaApiError"}},Ze=class extends oe{constructor(e="Network request failed"){super(e,{code:ne.NETWORK_ERROR,retryable:!0}),this.name="TagadaNetworkError"}},Xe=class extends oe{constructor(e="Authentication required",n=401){super(e,{code:ne.AUTH_REQUIRED,statusCode:n,retryable:!1}),this.name="TagadaAuthError"}},sn=class extends oe{constructor(e,n){super(e,{code:ne.VALIDATION_ERROR,statusCode:400,retryable:!1,details:n}),this.name="TagadaValidationError"}},Qe=class extends oe{constructor(e){super(e,{code:ne.CIRCUIT_BREAKER,retryable:!1}),this.name="TagadaCircuitBreakerError"}};var et=class{constructor(e){this.currentToken=null;this.tokenProvider=null;this.requestHistory=new Map;this.WINDOW_MS=5e3;this.MAX_REQUESTS=30;this.baseURL=e.baseURL,this.timeout=e.timeout||6e4,this.defaultHeaders=b({"Content-Type":"application/json"},e.headers),typeof setInterval!="undefined"&&setInterval(()=>this.cleanupHistory(),1e4)}setTokenProvider(e){this.tokenProvider=e}async get(e,n){return this.request("GET",e,void 0,n)}async post(e,n,r){return this.request("POST",e,n,r)}async put(e,n,r){return this.request("PUT",e,n,r)}async patch(e,n,r){return this.request("PATCH",e,n,r)}async delete(e,n){return this.request("DELETE",e,void 0,n)}setHeader(e,n){this.defaultHeaders[e]=n}removeHeader(e){delete this.defaultHeaders[e]}updateToken(e){this.currentToken=e,e?this.setHeader("x-cms-token",e):(this.removeHeader("x-cms-token"),console.log("[SDK] Token removed from ApiClient"))}getCurrentToken(){return this.currentToken}updateConfig(e){e.baseURL&&(this.baseURL=e.baseURL),e.timeout&&(this.timeout=e.timeout),e.headers&&Object.assign(this.defaultHeaders,e.headers),console.log("[SDK] ApiClient configuration updated")}async request(e,n,r,s){let i="".concat(e,":").concat(n);try{this.checkRequestLimit(i)}catch(u){throw console.error("[SDK] \u{1F6D1} Request blocked by Circuit Breaker:",u),u}if(!(s!=null&&s.skipAuth)&&!this.currentToken&&this.tokenProvider)try{console.log("[SDK] Waiting for token...");let u=await this.tokenProvider();u&&this.updateToken(u)}catch(u){console.error("[SDK] Failed to get token from provider:",u)}let o=b({},this.defaultHeaders);s!=null&&s.headers&&Object.assign(o,s.headers),!(s!=null&&s.skipAuth)&&this.currentToken&&(o["x-cms-token"]=this.currentToken);let a="".concat(this.baseURL).concat(n);if(s!=null&&s.params){let u=new URLSearchParams(s.params);a+="?".concat(u.toString())}console.log("[SDK] Making ".concat(e," request to: ").concat(a));let l=new AbortController,c=setTimeout(()=>l.abort(),this.timeout),d=s!=null&&s.signal?gu([s.signal,l.signal]):l.signal;try{let u={method:e,headers:o,signal:d};r!==void 0&&(u.body=JSON.stringify(r));let p=await fetch(a,u);if(!p.ok){let f=await this.safeParseJson(p);throw this.toTagadaError(p.status,f,p.statusText)}return await p.json()}catch(u){throw u instanceof oe?u:u instanceof DOMException&&u.name==="AbortError"?new Te("Request timed out",0,{code:ne.TIMEOUT,retryable:!0}):u instanceof TypeError?new Ze(u.message):u instanceof Error?u:new Error(String(u))}finally{clearTimeout(c)}}toTagadaError(e,n,r){var i,o,a;let s=(o=(i=n==null?void 0:n.message)!=null?i:n==null?void 0:n.error)!=null?o:r;return e===401||e===403?new Xe(s,e):e===429?new Te(s,429,{code:ne.RATE_LIMITED,retryable:!0}):e===404?new Te(s,404,{code:ne.NOT_FOUND,retryable:!1}):new Te(s,e,{code:(a=n==null?void 0:n.code)!=null?a:ne.API_ERROR,details:n,retryable:e>=500})}async safeParseJson(e){try{return await e.json()}catch(n){return}}checkRequestLimit(e){let n=Date.now(),r=this.requestHistory.get(e);if(!r){this.requestHistory.set(e,{count:1,firstRequestTime:n});return}if(n-r.firstRequestTime>this.WINDOW_MS){this.requestHistory.set(e,{count:1,firstRequestTime:n});return}if(r.count++,r.count>this.MAX_REQUESTS)throw new Qe("Circuit Breaker: Too many requests to ".concat(e," (").concat(r.count," in ").concat(this.WINDOW_MS,"ms)"))}cleanupHistory(){let e=Date.now();for(let[n,r]of this.requestHistory.entries())e-r.firstRequestTime>this.WINDOW_MS&&this.requestHistory.delete(n)}};function gu(t){let e=new AbortController;for(let n of t){if(n.aborted)return e.abort(n.reason),e.signal;n.addEventListener("abort",()=>e.abort(n.reason),{once:!0,signal:e.signal})}return e.signal}function mu(){return{width:window.screen.width,height:window.screen.height}}function hu(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return"UTC"}}function to(){try{return navigator.language||"en-US"}catch(t){return"en-US"}}var Be=typeof navigator!="undefined"?navigator.userAgent:"";function ae(t,...e){for(let n of e){let r=t.match(n);if(r)return r}return null}function yu(t){let e=[[/EdgA?\/([\d.]+)/i,"Edge"],[/OPR\/([\d.]+)/i,"Opera"],[/Brave\/([\d.]+)/i,"Brave"],[/Vivaldi\/([\d.]+)/i,"Vivaldi"],[/SamsungBrowser\/([\d.]+)/i,"Samsung Internet"],[/UCBrowser\/([\d.]+)/i,"UC Browser"],[/Firefox\/([\d.]+)/i,"Firefox"],[/CriOS\/([\d.]+)/i,"Chrome"],[/FxiOS\/([\d.]+)/i,"Firefox"],[/Chrome\/([\d.]+)/i,"Chrome"],[/Version\/([\d.]+).*Safari/i,"Safari"],[/Safari\/([\d.]+)/i,"Safari"]];for(let[n,r]of e){let s=t.match(n);if(s){let i=s[1]||"";return{name:r,version:i,major:i.split(".")[0]||""}}}return{name:"",version:"",major:""}}function bu(t){let e=ae(t,/Windows NT ([\d.]+)/i)||ae(t,/Mac OS X ([\d_.]+)/i)||ae(t,/Android ([\d.]+)/i)||ae(t,/iPhone OS ([\d_]+)/i)||ae(t,/iPad.*OS ([\d_]+)/i)||ae(t,/CrOS[\w ]*\/([\d.]+)/i)||ae(t,/Linux/i);if(!e)return{name:"",version:""};let n=e[0],r=(e[1]||"").replace(/_/g,".");return/Windows/i.test(n)?{name:"Windows",version:{"10.0":"10","6.3":"8.1","6.2":"8","6.1":"7","6.0":"Vista","5.1":"XP"}[r]||r}:/Mac OS X/i.test(n)?{name:"macOS",version:r}:/Android/i.test(n)?{name:"Android",version:r}:/iPhone|iPad/i.test(n)?{name:"iOS",version:r}:/CrOS/i.test(n)?{name:"Chrome OS",version:r}:/Linux/i.test(n)?{name:"Linux",version:""}:{name:"",version:""}}function wu(t){var e;if(/iPad/i.test(t))return{type:"tablet",vendor:"Apple",model:"iPad"};if(/iPhone/i.test(t))return{type:"mobile",vendor:"Apple",model:"iPhone"};if(/iPod/i.test(t))return{type:"mobile",vendor:"Apple",model:"iPod"};if(/Android/i.test(t)){let n=t.match(/Android[\s\d.]+;\s*([^)]+?)(?:\s+Build)/i);return{type:/Mobile/i.test(t)?"mobile":"tablet",model:(e=n==null?void 0:n[1])==null?void 0:e.trim()}}}function Su(t){let e=ae(t,/AppleWebKit\/([\d.]+)/i)||ae(t,/Gecko\/([\d.]+)/i)||ae(t,/Trident\/([\d.]+)/i)||ae(t,/Presto\/([\d.]+)/i);if(!e)return{name:"",version:""};let n=e[0],r=e[1]||"";return/AppleWebKit/i.test(n)?{name:"WebKit",version:r}:/Gecko/i.test(n)?{name:"Gecko",version:r}:/Trident/i.test(n)?{name:"Trident",version:r}:/Presto/i.test(n)?{name:"Presto",version:r}:{name:"",version:""}}function Eu(t){return/x86_64|x64|amd64|Win64/i.test(t)?{architecture:"amd64"}:/ia32|x86/i.test(t)?{architecture:"ia32"}:/aarch64|arm64/i.test(t)?{architecture:"arm64"}:/arm/i.test(t)?{architecture:"arm"}:{architecture:""}}function vu(){return navigator.webdriver?!0:/bot|crawl|spider|slurp|Googlebot|bingbot|yandex|baidu|duckduck|facebookexternalhit|Twitterbot|linkedinbot|embedly|quora|pinterest|redditbot|Slackbot|Discordbot|WhatsApp|TelegramBot|Applebot/i.test(Be)}function Cu(t){return/Chrome|Chromium|Edge|Brave|Opera|Vivaldi|Arc/i.test(t)}function Tu(){return window.matchMedia("(display-mode: standalone)").matches||navigator.standalone===!0}function Pu(t){return/mac/i.test(t)?navigator.maxTouchPoints>0:!1}function no(){if(typeof window=="undefined")return{userAgent:{name:"",browser:{major:"",name:"",version:""},os:{name:"",version:""},device:void 0,engine:{name:"",version:""},cpu:{architecture:""}},screenResolution:{width:0,height:0},timeZone:"UTC",flags:{isBot:!1,isChromeFamily:!1,isStandalonePWA:!1,isAppleSilicon:!1}};let t=yu(Be),e=bu(Be),n=wu(Be),r=Su(Be),s=Eu(Be),i;try{i={isBot:vu(),isChromeFamily:Cu(t.name),isStandalonePWA:Tu(),isAppleSilicon:Pu(e.name)}}catch(o){i={isBot:!1,isChromeFamily:!1,isStandalonePWA:!1,isAppleSilicon:!1}}return{userAgent:{name:Be,browser:t,os:e,device:n,engine:r,cpu:s},screenResolution:mu(),timeZone:hu(),flags:i}}function ro(){if(typeof window=="undefined")return{};let t=new URLSearchParams(window.location.search);return{locale:t.get("locale")||void 0,currency:t.get("currency")||void 0,utmSource:t.get("utm_source")||void 0,utmMedium:t.get("utm_medium")||void 0,utmCampaign:t.get("utm_campaign")||void 0,gclid:t.get("gclid")||void 0}}var on=class{constructor(){this.listeners=new Map}on(e,n){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(n),()=>this.off(e,n)}off(e,n){this.listeners.has(e)&&this.listeners.get(e).delete(n)}async emit(e,n){if(this.listeners.has(e)){let r=Array.from(this.listeners.get(e));await Promise.all(r.map(s=>{try{return Promise.resolve(s(n))}catch(i){return console.error('[EventBus] Error in listener for event "'.concat(e,'":'),i),Promise.resolve()}}))}}clear(){this.listeners.clear()}};Ir();function kt(t){try{let e=t.split(".");if(e.length!==3)return console.error("Invalid JWT token format"),null;let n=e[1],r=n+"=".repeat((4-n.length%4)%4),s=atob(r),i=JSON.parse(s);return i.exp&&Date.now()>=i.exp*1e3?(console.warn("JWT token is expired"),null):{sessionId:i.sessionId,storeId:i.storeId,accountId:i.accountId,customerId:i.customerId,role:i.role,isValid:!0,isLoading:!1}}catch(e){return console.error("Failed to decode JWT token:",e),null}}function so(t){try{let e=t.split(".");if(e.length!==3)return!0;let n=e[1],r=n+"=".repeat((4-n.length%4)%4),s=atob(r),i=JSON.parse(s);return i.exp?Date.now()>=i.exp*1e3:!1}catch(e){return console.error("Failed to check token expiration:",e),!0}}Yt();var tt={},Ru=["","VITE_","REACT_APP_","NEXT_PUBLIC_"];function Pe(t,e=Ru){var n,r,s;for(let i of e){let o=i?"".concat(i).concat(t):t;if(typeof process!="undefined"&&((n=process==null?void 0:process.env)!=null&&n[o]))return console.log("process.env[".concat(o,"]"),process.env[o]),process.env[o];if(typeof tt!="undefined"&&((r=tt==null?void 0:tt.env)!=null&&r[o]))return console.log("import.meta.env[".concat(o,"]"),tt.env[o]),tt.env[o];if(typeof window!="undefined"&&((s=window==null?void 0:window.__TAGADA_ENV__)!=null&&s[o]))return console.log("window.__TAGADA_ENV__[".concat(o,"]"),window.__TAGADA_ENV__[o]),window.__TAGADA_ENV__[o]}}var _u=async(t="default")=>{try{if((Pe("TAGADA_ENV")||Pe("TAGADA_ENVIRONMENT"))==="production"||!vt(!0))return null;let n=await fetch("/.local.json");if(!n.ok)return null;let r=await n.json(),s={},i=!1;try{let a=await fetch("/config/".concat(t,".tgd.json"));a.ok||(a=await fetch("/config/".concat(t,".json"))),a.ok&&(s=await a.json(),i=!0)}catch(a){}if(!i&&t!=="default"){console.warn("\u26A0\uFE0F Config variant '".concat(t,"' not found, falling back to 'default'"));try{let a=await fetch("/config/default.tgd.json");a.ok||(a=await fetch("/config/default.json")),a.ok&&(s=await a.json(),i=!0,console.log("\u2705 Fallback to 'default' config successful"))}catch(a){}}i||console.warn(t==="default"?"\u26A0\uFE0F No 'default' config found. Create /config/default.tgd.json":"\u26A0\uFE0F Neither '".concat(t,"' nor 'default' config found. Create /config/default.tgd.json"));let o={storeId:r.storeId,accountId:r.accountId,basePath:r.basePath,config:s};return console.log("\u{1F6E0}\uFE0F Using local development plugin config:",o),o}catch(e){return null}},Iu=async()=>{try{if((Pe("TAGADA_ENV")||Pe("TAGADA_ENVIRONMENT"))==="production"||!vt(!0))return null;try{console.log("\u{1F6E0}\uFE0F [V2] Attempting to load /config/funnel.local.json...");let r=await fetch("/config/funnel.local.json");if(r.ok){let s=await r.json();console.log("\u{1F6E0}\uFE0F [V2] \u2705 Loaded local funnel config (NEW format):",s);let{loadLocalFunnelConfig:i}=await Promise.resolve().then(()=>(Je(),eo));if(await i(),s.staticResources){let o={};for(let[a,l]of Object.entries(s.staticResources))o[a]={id:l};return o}return null}}catch(r){console.log("\u{1F6E0}\uFE0F [V2] funnel.local.json not found, trying legacy format...")}console.log("\u{1F6E0}\uFE0F [V2] Attempting to load /config/resources.static.json (legacy)...");let e=await fetch("/config/resources.static.json");if(!e.ok)return console.log("\u{1F6E0}\uFE0F [V2] No local static resources found"),null;let n=await e.json();return console.log("\u{1F6E0}\uFE0F [V2] \u2705 Loaded legacy static resources:",n),n}catch(t){return console.error("\u{1F6E0}\uFE0F [V2] \u274C Error loading static resources:",t),null}},Me=t=>{if(typeof document=="undefined")return;let e=document.querySelector('meta[name="'.concat(t,'"]'));return(e==null?void 0:e.getAttribute("content"))||void 0},io=()=>{if(typeof window!="undefined"&&window.__TAGADA_PLUGIN_CONFIG__)return window.__TAGADA_PLUGIN_CONFIG__;try{let t=Me("x-plugin-config");if(t)return JSON.parse(decodeURIComponent(t))}catch(t){}return{}};function Au(){if(typeof document=="undefined")return{basePath:"/",config:{}};let t=Me("x-plugin-store-id"),e=Me("x-plugin-account-id"),n=Me("x-plugin-base-path")||"/",r=io();return{storeId:t,accountId:e,basePath:n,config:r}}var xu=async()=>{try{if(typeof document=="undefined")return null;let t=Me("x-plugin-store-id"),e=Me("x-plugin-account-id");if(!t)return null;let n=Me("x-plugin-base-path")||"/",r=io();e||console.warn("\u26A0\uFE0F Plugin config: Account ID not found in meta tags");let s={storeId:t,accountId:e,basePath:n,config:r};return console.log("\u{1F680} [HIGHEST PRIORITY] Plugin config loaded from meta tags (runtime injected config):",{storeId:t,accountId:e,basePath:n,configKeys:Object.keys(r),configSize:JSON.stringify(r).length}),s}catch(t){return console.warn("\u26A0\uFE0F Error loading production config from meta tags:",t),null}},Lr=async(t="default",e)=>{var o,a;console.log("\u{1F527} [V2] loadPluginConfig called with variant:",t);let n=await Iu(),r=await xu();if(r){let l=O(b({},r),{staticResources:n!=null?n:void 0});return console.log("\u2705 [V2] Using INJECTED config from meta tags (HIGHEST PRIORITY)"),l}if(e){let l={storeId:e.storeId,accountId:e.accountId,basePath:(o=e.basePath)!=null?o:"/",config:(a=e.config)!=null?a:{},staticResources:n!=null?n:void 0};return console.log("\u2705 [V2] Using raw config parameter (PRIORITY 2)"),l}let s=await ao();if(s){let l=O(b({},s),{staticResources:n!=null?n:void 0});return console.log("\u2705 [V2] Using environment variables config (PRIORITY 3 - build time)"),l}let i=await _u(t);if(i){let l=O(b({},i),{staticResources:n!=null?n:void 0});return console.log("\u2705 [V2] Using local dev config files (PRIORITY 4)"),l}return console.warn("\u26A0\uFE0F [V2] No plugin config found - using defaults"),{basePath:"/",config:{},staticResources:n!=null?n:void 0}};async function oo(t="default",e){try{if(!vt())return null;if(e)return e;let n=["/config/".concat(t,".config.json"),"/config/".concat(t,".tgd.json"),"/config/".concat(t,".json")];for(let r of n)try{let s=await fetch(r);if(s.ok)return await s.json()}catch(s){continue}return console.warn("\u26A0\uFE0F [loadLocalConfig] No config found for '".concat(t,"'")),null}catch(n){return console.error("[loadLocalConfig] Error loading config:",n),null}}async function ao(){try{if(!vt())return;let t=Pe("TAGADA_STORE_ID"),e=Pe("TAGADA_ACCOUNT_ID"),n=Pe("TAGADA_BASE_PATH"),r=Pe("TAGADA_CONFIG_NAME");if(!t||!e)return;let s=await oo(r);if(!s)return;let i={storeId:t,accountId:e,basePath:n||"/",config:s};return console.log("\u{1F6E0}\uFE0F [createRawPluginConfig] Using environment variables (build-time config):",{hasStoreId:!!i.storeId,hasAccountId:!!i.accountId,basePath:i.basePath,hasConfig:!!i.config}),i}catch(t){console.error("[createRawPluginConfig] Error creating config:",t);return}}var Nr=class{static getPluginConfig(e,n){return{storeId:(e==null?void 0:e.storeId)||(n==null?void 0:n.storeId),accountId:(e==null?void 0:e.accountId)||(n==null?void 0:n.accountId),basePath:(e==null?void 0:e.basePath)||(n==null?void 0:n.basePath)||"/",config:(e==null?void 0:e.config)||{}}}static validateConfig(e){return!!(e.storeId&&e.accountId)}};tn();Ve();Ve();var Br=new Map,Mr=new Set;function ku(){return typeof window=="undefined"?null:new URLSearchParams(window.location.search).get("authCode")}async function co(t,e,n,r=!1){if(Mr.has(t))throw r&&console.log("[AuthHandoff] Code already resolved, skipping duplicate request"),new Error("Auth code already resolved");let s=Br.get(t);if(s)return r&&console.log("[AuthHandoff] Resolution already in progress, waiting for existing request"),s;r&&console.log("[AuthHandoff] Resolving authCode:",t.substring(0,15)+"...");let i=(async()=>{try{let o=await fetch("".concat(n,"/api/v1/cms/auth/resolve-handoff"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,storeId:e})});if(!o.ok){let l=await o.json().catch(()=>({message:"Unknown error"}));throw new Error(l.message||"Failed to resolve auth handoff: ".concat(o.status))}let a=await o.json();return r&&console.log("[AuthHandoff] \u2705 Resolved successfully:",{customerId:a.customer.id,role:a.customer.role,hasContext:Object.keys(a.context).length>0}),r&&console.log("[AuthHandoff] Storing new token (overriding existing)"),re(a.token),Ou(r),Mr.add(t),a}catch(o){throw console.error("[AuthHandoff] \u274C Failed to resolve:",o),o}finally{Br.delete(t)}})();return Br.set(t,i),i}function Ou(t=!1){if(typeof window=="undefined")return;let e=new URL(window.location.href);e.searchParams.has("authCode")&&(e.searchParams.delete("authCode"),window.history.replaceState({},"",e.pathname+e.search+e.hash),t&&console.log("[AuthHandoff] Cleaned authCode from URL"))}function lo(){let t=ku();return!(!t||!t.startsWith("ah_")||Mr.has(t))}var Ot=class{constructor(e={}){this.bus=new on;this.eventDispatcher=new He;this.tokenPromise=null;this.tokenResolver=null;this.isInitializingSession=!1;this.lastSessionInitError=null;this.sessionInitRetryCount=0;this.MAX_SESSION_INIT_RETRIES=3;var a,l,c,d;this.config=e,this.instanceId=Math.random().toString(36).substr(2,9),this.boundHandleStorageChange=this.handleStorageChange.bind(this),this.boundHandlePageshow=u=>{if(u.persisted)if(this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Page restored from BFcache (back button), re-initializing funnel...")),this.funnel&&this.state.session&&this.state.store){this.funnel.resetInitialization();let p=this.getAccountId(),f=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("funnelId")||void 0;this.funnel.autoInitialize({customerId:this.state.session.customerId,sessionId:this.state.session.sessionId},{id:this.state.store.id,accountId:p},f).catch(y=>{console.error("[TagadaClient] Funnel re-initialization failed:",y)})}else this.sessionInitRetryCount=0,this.initialize()},console.log("[TagadaClient ".concat(this.instanceId,"] Initializing...")),console.log("[TagadaClient ".concat(this.instanceId,"] Config:"),{debugMode:e.debugMode,hasRawPluginConfig:!!e.rawPluginConfig,rawPluginConfig:e.rawPluginConfig,features:e.features}),$i(this.config.debugMode)&&this.config.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Preview mode active - state cleared"));let r=this.resolveEnvironment(),s=Bi(r);e.customApiConfig&&(s=O(b(b({},s),e.customApiConfig),{apiConfig:b(b({},s.apiConfig),e.customApiConfig.apiConfig)}),this.config.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Applied custom API config:"),s.apiConfig.baseUrl)),this.state={auth:{isAuthenticated:!1,isLoading:!1,customer:null,session:null},session:null,customer:null,locale:{locale:"en-US",language:"en",region:"US",messages:{}},currency:{code:"USD",symbol:"$",name:"US Dollar"},store:null,environment:s,isLoading:!0,isInitialized:!1,isSessionInitialized:!1,pluginConfig:{basePath:"/",config:{}},pluginConfigLoading:!0,debugMode:(a=e.debugMode)!=null?a:r!=="production",token:null},console.log("[TagadaClient ".concat(this.instanceId,"] Initial state:"),{pluginConfigLoading:this.state.pluginConfigLoading,hasRawPluginConfig:!!e.rawPluginConfig}),this.apiClient=new et({baseURL:s.apiConfig.baseUrl});let i=(l=e.features)==null?void 0:l.funnel;if(i!==!1){let u=typeof i=="object"?i:{};this.funnel=new At({apiClient:this.apiClient,debugMode:this.state.debugMode,pluginConfig:this.state.pluginConfig,environment:this.state.environment,autoRedirect:u.autoRedirect,funnelId:(c=e.rawPluginConfig)==null?void 0:c.funnelId,stepId:(d=e.rawPluginConfig)==null?void 0:d.stepId})}this.apiClient.setTokenProvider(this.waitForToken.bind(this)),typeof window!="undefined"&&(window.addEventListener("storage",this.boundHandleStorageChange),window.addEventListener("pageshow",this.boundHandlePageshow)),this.setupConfigHotReload(),this.initialize()}destroy(){typeof window!="undefined"&&(window.removeEventListener("storage",this.boundHandleStorageChange),window.removeEventListener("pageshow",this.boundHandlePageshow)),this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Destroyed")),this.eventDispatcher.clear(),this.bus.clear()}handleStorageChange(){if(Ct()===this.state.token){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Token unchanged (ignoring event)"));return}if(this.isInitializingSession){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Session initialization in progress, skipping storage change"));return}if(this.sessionInitRetryCount>=this.MAX_SESSION_INIT_RETRIES&&this.lastSessionInitError){this.state.debugMode&&console.error("[TagadaClient ".concat(this.instanceId,"] Max session init retries reached, giving up"),this.lastSessionInitError);return}this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Storage changed, re-initializing token...")),this.initializeToken()}subscribe(e){return this.eventDispatcher.subscribe(e)}getState(){return this.state}updateState(e){this.state=b(b({},this.state),e),this.eventDispatcher.notify(this.state)}resolveEnvironment(){return this.config.environment?this.config.environment:Et()}async initialize(){try{await this.initializePluginConfig(),this.state.pluginConfig.storeId?await this.initializeToken():(console.warn("[TagadaClient] No store ID found in plugin config. Skipping token initialization."),this.updateState({isLoading:!1,isInitialized:!0}))}catch(e){console.error("[TagadaClient] Initialization failed:",e),this.updateState({isLoading:!1,isInitialized:!0})}}async initializePluginConfig(){if(console.log("[TagadaClient ".concat(this.instanceId,"] initializePluginConfig called"),{pluginConfigLoading:this.state.pluginConfigLoading,hasRawPluginConfig:!!this.config.rawPluginConfig}),!this.state.pluginConfigLoading){console.log("[TagadaClient ".concat(this.instanceId,"] Plugin config already loading or loaded, skipping..."));return}try{let e=this.config.localConfig||"default";console.log("[TagadaClient ".concat(this.instanceId,"] Loading plugin config with variant: ").concat(e));let n=await Lr(e,this.config.rawPluginConfig);console.log("[TagadaClient ".concat(this.instanceId,"] Plugin config loaded:"),n),this.updateState({pluginConfig:n,pluginConfigLoading:!1}),this.funnel&&this.funnel.setConfig({pluginConfig:n,environment:this.state.environment})}catch(e){console.error("[TagadaClient] Failed to load plugin config:",e),this.updateState({pluginConfig:{basePath:"/",config:{}},pluginConfigLoading:!1})}}async initializeToken(){var e;if(lo()){let n=this.state.pluginConfig.storeId;if(!n)return console.error("[TagadaClient] Cannot resolve authCode: storeId not found in config"),this.fallbackToNormalFlow();console.log("[TagadaClient ".concat(this.instanceId,"] \u{1F510} Cross-domain auth detected, resolving..."));try{let r=new URLSearchParams(window.location.search).get("authCode");if(!r)return this.fallbackToNormalFlow();let s=await co(r,n,this.state.environment.apiConfig.baseUrl,this.state.debugMode);console.log("[TagadaClient ".concat(this.instanceId,"] \u2705 Auth handoff resolved:"),{customerId:s.customer.id,role:s.customer.role,hasContext:Object.keys(s.context).length>0}),this.setToken(s.token);let i=kt(s.token);i?(this.updateState({session:i}),await this.initializeSession(i),(e=s.context)!=null&&e.funnelSessionId&&this.funnel&&this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Restoring funnel session from handoff context:"),s.context.funnelSessionId)):(console.error("[TagadaClient] Failed to decode token from handoff"),this.updateState({isInitialized:!0,isLoading:!1}));return}catch(r){console.error("[TagadaClient ".concat(this.instanceId,"] \u274C Auth handoff failed, falling back to normal flow:"),r)}}await this.fallbackToNormalFlow()}async fallbackToNormalFlow(){let n=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("token");n&&(this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] \u{1F512} URL token detected, setting immediately to prevent race condition")),this.apiClient.updateToken(n),re(n));let r=Ct();console.log("[TagadaClient ".concat(this.instanceId,"] Initializing token (normal flow)..."),{hasExistingToken:!!r,hasQueryToken:!!n,storeId:this.state.pluginConfig.storeId});let s=null,i=!1;if(n?(s=n,i=!0):r&&!so(r)&&(s=r),s){this.setToken(s),i&&(this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Persisting query token to storage...")),re(s));let o=kt(s);o?(this.updateState({session:o}),await this.initializeSession(o)):(console.error("[TagadaClient] Failed to decode token"),this.updateState({isInitialized:!0,isLoading:!1}))}else{let o=this.state.pluginConfig.storeId;console.log("[TagadaClient ".concat(this.instanceId,"] No existing token, creating anonymous token..."),{hasStoreId:!!o,storeId:o}),o?await this.createAnonymousToken(o):(console.warn("[TagadaClient ".concat(this.instanceId,"] No storeId in plugin config, skipping anonymous token creation")),this.updateState({isInitialized:!0,isLoading:!1}))}}setToken(e){this.apiClient.updateToken(e),this.updateState({token:e}),this.tokenResolver&&(this.tokenResolver(e),this.tokenPromise=null,this.tokenResolver=null)}waitForToken(){return this.apiClient.getCurrentToken()?Promise.resolve(this.apiClient.getCurrentToken()):(this.tokenPromise||(this.tokenPromise=new Promise(e=>{this.tokenResolver=e})),this.tokenPromise)}async createAnonymousToken(e){if(typeof window!="undefined"){let r=new URLSearchParams(window.location.search).get("token");if(r){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] \u{1F512} URL has token, skipping anonymous token creation")),this.setToken(r),re(r);let s=kt(r);s&&(this.updateState({session:s}),await this.initializeSession(s));return}}if(this.isInitializingSession){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Session initialization in progress, skipping anonymous token creation"));return}try{let n=_t();this.state.debugMode&&console.log("[TagadaClient] Creating anonymous token for store:",e,{draft:n});let r=await this.apiClient.post("/api/v1/cms/session/anonymous",{storeId:e,role:"anonymous",draft:n},{skipAuth:!0});this.setToken(r.token),re(r.token);let s=kt(r.token);s&&(this.updateState({session:s}),await this.initializeSession(s)),this.updateState({isSessionInitialized:!0})}catch(n){console.error("[TagadaClient] Failed to create anonymous token:",n),this.updateState({isInitialized:!0,isLoading:!1})}}async initializeSession(e){var n,r,s,i,o,a,l,c,d,u,p;if(this.isInitializingSession){this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Session initialization already in progress, skipping"));return}this.isInitializingSession=!0;try{this.state.debugMode&&console.log("[TagadaClient ".concat(this.instanceId,"] Initializing session..."),{sessionId:e.sessionId});let m=await no(),f=ro(),y=to(),g=_t(),w=new URLSearchParams(window.location.search).get("draft");w!==null&&kr(w==="true");let v={storeId:e.storeId,accountId:e.accountId,customerId:e.customerId,role:e.role,browserLocale:y,queryLocale:f.locale,queryCurrency:f.currency,utmSource:f.utmSource,utmMedium:f.utmMedium,utmCampaign:f.utmCampaign,gclid:f.gclid,browser:m.userAgent.browser.name,browserVersion:m.userAgent.browser.version,os:m.userAgent.os.name,osVersion:m.userAgent.os.version,deviceType:(n=m.userAgent.device)==null?void 0:n.type,deviceModel:(r=m.userAgent.device)==null?void 0:r.model,deviceVendor:(s=m.userAgent.device)==null?void 0:s.vendor,userAgent:m.userAgent.name,engineName:m.userAgent.engine.name,engineVersion:m.userAgent.engine.version,cpuArchitecture:m.userAgent.cpu.architecture,isBot:(o=(i=m.flags)==null?void 0:i.isBot)!=null?o:!1,isChromeFamily:(l=(a=m.flags)==null?void 0:a.isChromeFamily)!=null?l:!1,isStandalonePWA:(d=(c=m.flags)==null?void 0:c.isStandalonePWA)!=null?d:!1,isAppleSilicon:(p=(u=m.flags)==null?void 0:u.isAppleSilicon)!=null?p:!1,screenWidth:m.screenResolution.width,screenHeight:m.screenResolution.height,timeZone:m.timeZone,draft:g,fetchMessages:!1},S=await this.apiClient.post("/api/v1/cms/session/v2/init",v);this.lastSessionInitError=null,this.sessionInitRetryCount=0,this.updateSessionState(S,e),this.updateState({isInitialized:!0,isSessionInitialized:!0,isLoading:!1}),this.state.debugMode&&console.log("[TagadaClient] Session initialized successfully")}catch(m){this.lastSessionInitError=m,this.sessionInitRetryCount++,console.error("[TagadaClient] Error initializing session (attempt ".concat(this.sessionInitRetryCount,"/").concat(this.MAX_SESSION_INIT_RETRIES,"):"),m),this.updateState({isInitialized:!0,isLoading:!1})}finally{this.isInitializingSession=!1}}updateSessionState(e,n){var o,a,l,c,d,u,p,m,f,y;if(e.store){let g=e.store,w=O(b({},e.store),{accountId:g.accountId||((o=this.state.pluginConfig)==null?void 0:o.accountId)||n.accountId||"",presentmentCurrencies:g.presentmentCurrencies||[e.store.currency||"USD"],chargeCurrencies:g.chargeCurrencies||[e.store.currency||"USD"]});this.updateState({store:w})}if(e.locale){let g={locale:e.locale,language:e.locale.split("-")[0],region:(a=e.locale.split("-")[1])!=null?a:"US",messages:(l=e.messages)!=null?l:{}};this.updateState({locale:g})}if(e.store){let g={code:e.store.currency,symbol:this.getCurrencySymbol(e.store.currency),name:this.getCurrencyName(e.store.currency)};this.updateState({currency:g})}let r={isAuthenticated:(d=(c=e.customer)==null?void 0:c.isAuthenticated)!=null?d:!1,isLoading:!1,customer:(u=e.customer)!=null?u:null,session:n};this.updateState({customer:(p=e.customer)!=null?p:null,auth:r});let s=(m=this.config.features)==null?void 0:m.funnel,i=typeof s=="object"&&s.skipAutoInit;if(this.funnel&&!i&&n.customerId&&((f=e.store)!=null&&f.id)){let g=e.store.accountId||((y=this.state.pluginConfig)==null?void 0:y.accountId)||n.accountId||"";if(g){let v=new URLSearchParams(typeof window!="undefined"?window.location.search:"").get("funnelId")||void 0;this.state.debugMode&&console.log("[TagadaClient] Auto-initializing funnel...",{customerId:n.customerId,storeId:e.store.id,accountId:g,funnelId:v||"auto-detect"}),this.funnel.autoInitialize({customerId:n.customerId,sessionId:n.sessionId},{id:e.store.id,accountId:g},v).catch(S=>{console.error("[TagadaClient] Funnel auto-initialization failed:",S)})}else console.warn("[TagadaClient] Cannot auto-initialize funnel: accountId is missing")}}getCurrencySymbol(e){return{USD:"$",EUR:"\u20AC",GBP:"\xA3",JPY:"\xA5",CAD:"C$",AUD:"A$"}[e]||e}getCurrencyName(e){return{USD:"US Dollar",EUR:"Euro",GBP:"British Pound",JPY:"Japanese Yen",CAD:"Canadian Dollar",AUD:"Australian Dollar"}[e]||e}getAccountId(){var e,n,r;return((e=this.state.store)==null?void 0:e.accountId)||((n=this.state.pluginConfig)==null?void 0:n.accountId)||((r=this.state.session)==null?void 0:r.accountId)||""}updatePluginConfig(e){this.state.debugMode&&console.log("[TagadaClient] Hot-reloading config:",e);let n=b(b({},this.state.pluginConfig.config),e);this.updateState({pluginConfig:O(b({},this.state.pluginConfig),{config:n})}),this.bus.emit("CONFIG_UPDATED",n),this.state.debugMode&&console.log("[TagadaClient] Config updated successfully")}setupConfigHotReload(){if(typeof window=="undefined")return;let e=n=>{var r,s;if(((r=n.data)==null?void 0:r.type)==="TAGADAPAY_CONFIG_UPDATE"){let{config:i}=n.data;this.state.debugMode&&console.log("[TagadaClient] Received config update from parent:",i),this.updatePluginConfig(i)}else if(((s=n.data)==null?void 0:s.type)==="APPLY_STYLES_TO_ELEMENT"){let{elementId:i,styles:o}=n.data;this.state.debugMode&&console.log("[TagadaClient] Received style application request:",{elementId:i,styles:o}),this.applyStylesToElement(i,o)}};window.addEventListener("message",e),this.state.debugMode&&console.log("[TagadaClient] Config hot-reload and style manipulation listeners enabled")}applyStylesToElement(e,n){if(typeof document=="undefined")return;let r="tagada-editor-highlight",s=document.getElementById(r);s&&s.remove();let i=u=>{var S;let m=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]).has(u.tagName.toLowerCase()),f=u;if(m){let C=u.parentElement;if((C==null?void 0:C.getAttribute("data-tagada-highlight-wrapper"))==="true"&&C instanceof HTMLElement)f=C;else{let _=document.createElement("div");_.setAttribute("data-tagada-highlight-wrapper","true");let A=window.getComputedStyle(u),N=A.display;if(N==="inline"?_.style.display="inline-block":_.style.display=N,_.style.position="relative",N==="inline"||N.includes("inline")){let U=A.verticalAlign;U&&U!=="baseline"&&(_.style.verticalAlign=U)}["width","height","minWidth","minHeight","maxWidth","maxHeight","flex","flexGrow","flexShrink","flexBasis","gridColumn","gridRow","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","gridArea","alignSelf","justifySelf","boxSizing","gap","rowGap","columnGap","order","aspectRatio"].forEach(U=>{let q=U.replace(/([A-Z])/g,"-$1").toLowerCase(),$=A.getPropertyValue(q);$&&$.trim()!==""&&(U==="flex"&&$!=="none"&&$!=="0 1 auto"?_.style.flex=$:U==="boxSizing"?_.style.boxSizing=$:_.style.setProperty(q,$))}),u.style&&["width","height","min-width","min-height","max-width","max-height","flex","flex-grow","flex-shrink","flex-basis","grid-column","grid-row","grid-column-start","grid-column-end","grid-row-start","grid-row-end","grid-area","align-self","justify-self","box-sizing","gap","row-gap","column-gap","order","aspect-ratio"].forEach(q=>{let $=u.style.getPropertyValue(q);$&&_.style.setProperty(q,$)}),(S=u.parentNode)==null||S.insertBefore(_,u),_.appendChild(u),f=_}}let y=getComputedStyle(m?u:f);(f.style.position==="static"||!f.style.position)&&(f.style.position="relative");let g=document.createElement("div");g.id=r,g.style.position="absolute",g.style.inset="0",g.style.pointerEvents="none",g.style.zIndex="9999",g.style.boxSizing="border-box",g.style.background="none",g.style.border="none",g.style.outline="none",g.style.margin="0",g.style.padding="0";let w=y.borderRadius;w&&(g.style.borderRadius=w),f.appendChild(g);let v=n||{boxShadow:"0 0 0 2px rgb(239 68 68)"};if(Object.entries(v).forEach(([C,R])=>{let _=C.includes("-")?C.replace(/-([a-z])/g,(A,N)=>N.toUpperCase()):C;C.includes("-")?g.style.setProperty(C,R):g.style[_]=R}),u.scrollIntoView({behavior:"smooth",block:"center"}),this.state.debugMode){let C=Object.entries(v).map(([R,_])=>"".concat(R,": ").concat(_)).join("; ");console.log("[TagadaClient] Applied styles to highlight div of element #".concat(e,":"),C)}},o=5,a=1e3,l=0,c=u=>{let p=window.getComputedStyle(u);return p.display==="none"||p.visibility==="hidden"||p.opacity==="0"||u.hidden||u.offsetWidth===0||u.offsetHeight===0},d=()=>{let u=document.querySelectorAll('[editor-id~="'.concat(e,'"]'));if(u.length===0){if(l+=1,l>=o){this.state.debugMode&&console.warn('[TagadaClient] Element with editor-id containing "'.concat(e,'" not found after ').concat(o," attempts"));return}this.state.debugMode&&console.warn('[TagadaClient] Element with editor-id containing "'.concat(e,'" not found (attempt ').concat(l,"/").concat(o,"), retrying in ").concat(a/1e3,"s")),setTimeout(d,a);return}let p=null;if(u.length===1)p=u[0];else{for(let m=0;m<u.length;m++)if(!c(u[m])){p=u[m];break}p||(p=u[0])}p&&i(p)};d()}};var an=class{constructor(e){this.apiClient=e}async initCheckout(e){return this.apiClient.post("/api/v1/checkout/session/init",e)}async initCheckoutAsync(e){return this.apiClient.post("/api/v1/checkout/session/init-async",e)}async preloadCheckout(e,n){let r=e.funnelSessionId;!r&&n&&(r=n()||void 0);let s=typeof e.navigationEvent=="string"?{type:e.navigationEvent}:e.navigationEvent,i=O(b(b(b({},e),r&&{funnelSessionId:r}),s&&{navigationEvent:s}),{currentUrl:e.currentUrl||(typeof window!="undefined"?window.location.href:void 0)});return this.apiClient.post("/api/v1/checkout/session/preload",i)}async checkAsyncStatus(e){return this.apiClient.get("/api/public/v1/checkout/async-status/".concat(e))}async getCheckout(e,n){let r=new URLSearchParams;n&&r.set("currency",n),r.set("skipAsyncWait","false");let s="/api/v1/checkout-sessions/".concat(e,"/v2").concat(r.toString()?"?".concat(r.toString()):"");return this.apiClient.get(s)}async getCheckoutRaw(e,n){let r=new URLSearchParams;n&&r.set("currency",n),r.set("skipAsyncWait","true");let s="/api/v1/checkout-sessions/".concat(e,"/v2").concat(r.toString()?"?".concat(r.toString()):"");return this.apiClient.get(s)}async updateAddress(e,n){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/address"),{data:n})}async setCheckoutInfo(e,n){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/checkout-info"),{shippingAddress:n.shippingAddress,billingAddress:n.differentBillingAddress?n.billingAddress:n.shippingAddress,differentBillingAddress:n.differentBillingAddress||!1})}async applyPromotionCode(e,n){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/promotions/apply"),{code:n})}async removePromotion(e,n){return this.apiClient.delete("/api/v1/checkout-sessions/".concat(e,"/promotions/").concat(n))}async getAppliedPromotions(e){return this.apiClient.get("/api/v1/checkout-sessions/".concat(e,"/promotions"))}async replaceSessionLineItems(e,n){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/line-items"),{lineItems:n})}async updateLineItems(e,n){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/line-items"),{lineItems:n})}async addLineItems(e,n){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/line-items/add"),{lineItems:n})}async removeLineItems(e,n){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/line-items/remove"),{lineItems:n})}async setItemQuantity(e,n,r,s){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/line-items/set-quantity"),{variantId:n,quantity:r,priceId:s})}async toggleOrderBump(e,n,r){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/toggle-order-bump"),{orderBumpOfferId:n,selected:r})}async updateCustomer(e,n){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/customer"),n)}async updateCustomerAndSessionInfo(e,n){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/customer-and-session-info"),n)}async previewCheckoutSession(e){return this.apiClient.post("/api/v1/checkout-sessions/preview",e)}async setPaymentMethod(e,n){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/payment-method"),{paymentMethodName:n})}};Je();var uo={production:{tenantId:"b1636929-db11-4b01-b2c2-6a97b3444061",publicKey:"key_prod_us_pub_PNMB2AiaECJ463K6QAPNU6"},test:{tenantId:"99821999-faf5-4427-a92c-9267cb930540",publicKey:"key_test_us_pub_VExdfbFQARn821iqP8zNaq"}};function Ur(t){let e=t?uo.production:uo.test;return{tenantId:e.tenantId,apiKey:e.publicKey}}function fo(){if(typeof window=="undefined")return!1;let t=window.location.hostname;return t.includes("app-dev.tagadapay.com")||t.includes("cdn-dev.tagadapay.com")?!1:t.includes("tagadapay.com")?!0:!(t.includes("tagadapay.dev")||t==="localhost"||t.startsWith("127.")||t.startsWith("192.168.")||t.startsWith("10.")||t.includes(".local")||t===""||t==="0.0.0.0"||t.includes("ngrok")||t.includes(".loclx.io")||t.includes("vercel.app")||t.includes("netlify.app"))}function Dt(){return Ur(fo()).apiKey}function po(){return Ur(fo()).tenantId}var cn=class{constructor(e){this.apiClient=e}async getShippingRates(e){return this.apiClient.get("/api/v1/checkout-sessions/".concat(e,"/shipping-rates"))}async setShippingRate(e,n){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/shipping-rate"),{shippingRateId:n})}async previewShippingRates(e,n){let r=new URLSearchParams({countryCode:n.countryCode});return n.stateCode&&r.set("stateCode",n.stateCode),this.apiClient.get("/api/v1/checkout-sessions/".concat(e,"/shipping-rates/preview?").concat(r.toString()))}};var nt=class{constructor(e){this.apiClient=e}async createPaymentInstrument(e){return this.apiClient.post("/api/v1/payment/create-payment-instrument",{paymentInstrumentData:e})}async createCardPaymentInstrument(e,n){var l,c;if(!e)throw new Error("Payment processor not initialized");console.log("Creating card payment instrument");let r=await e.tokens.create({type:"card",data:b({cvc:n.cvc,number:Number(n.cardNumber.replace(/\s+/g,""))},this.getCardMonthAndYear(n.expiryDate)),metadata:{nonSensitiveField:"nonSensitiveValue"}}),{expiration_month:s,expiration_year:i}=this.getCardMonthAndYear(n.expiryDate),o={type:r.type,card:{maskedCardNumber:(c=(l=r.enrichments)==null?void 0:l.cardDetails)!=null&&c.bin?"".concat(r.enrichments.cardDetails.bin,"****").concat(r.enrichments.cardDetails.last4):n.cardNumber.replace(/\d(?=\d{4})/g,"*"),expirationMonth:s,expirationYear:i},token:r.id},a=await this.apiClient.post("/api/v1/payment/create-payment-instrument",{paymentInstrumentData:o});return console.log("Payment instrument created:",a),a}async createApplePayPaymentInstrument(e,n){if(!e)throw new Error("Payment processor not initialized");if(!n.id)throw new Error("Apple Pay token is missing");let r={type:"apple_pay",token:n.id,dpanType:n.type,card:{bin:n.card.bin,last4:n.card.last4,expirationMonth:n.card.expiration_month,expirationYear:n.card.expiration_year,brand:n.card.brand}};return await this.apiClient.post("/api/v1/payment/create-payment-instrument",{paymentInstrumentData:r})}async createGooglePayPaymentInstrument(e,n){var i;if(!e)throw new Error("Payment processor not initialized");if(!n.id)throw new Error("Google Pay token is missing");let r={type:"google_pay",token:n.id,dpanType:n.type,card:{bin:n.card.bin,last4:n.card.last4,expirationMonth:n.card.expiration_month,expirationYear:n.card.expiration_year,brand:n.card.brand},authMethod:(i=n==null?void 0:n.details)==null?void 0:i.auth_method};return await this.apiClient.post("/api/v1/payment/create-payment-instrument",{paymentInstrumentData:r})}async createApmPaymentInstrument(e){console.log("Creating APM payment instrument:",e);let n={type:"apm",provider:e.provider,paymentMethod:e.paymentMethod,processorId:e.processorId},r=await this.apiClient.post("/api/v1/payment/create-payment-instrument",{paymentInstrumentData:n});return console.log("APM payment instrument created:",r),r}getCardMonthAndYear(e){let[n,r]=e.split("/"),s=new Date().getFullYear(),i=Math.floor(s/100)*100,o=Number(r)+i;return{expiration_month:Number(n),expiration_year:o}}async processPaymentDirect(e,n,r,s={}){console.log("[PaymentsResource] processPaymentDirect START",s.paymentFlowId?"(flow: ".concat(s.paymentFlowId,")"):""),console.log("[PaymentsResource] Full options object:",JSON.stringify(s,null,2)),console.log("[PaymentsResource] processorId:",s.processorId,"paymentMethod:",s.paymentMethod);try{let i=b(b(b(b(b(b(b({checkoutSessionId:e,paymentInstrumentId:n},r&&{threedsSessionId:r}),s.initiatedBy&&{initiatedBy:s.initiatedBy}),s.source&&{source:s.source}),s.paymentFlowId&&{paymentFlowId:s.paymentFlowId}),s.processorId&&{processorId:s.processorId}),s.paymentMethod&&{paymentMethod:s.paymentMethod}),s.isExpress&&{isExpress:s.isExpress});console.log("[PaymentsResource] Request body being sent:",JSON.stringify(i,null,2));let o=await this.apiClient.post("/api/public/v1/checkout/pay-v2",i);return console.log("[PaymentsResource] processPaymentDirect SUCCESS:",o),o}catch(i){throw console.error("[PaymentsResource] processPaymentDirect ERROR:",i),i}}async getCardPaymentInstruments(){return this.apiClient.get("/api/v1/payment-instruments/customer")}async markPaymentActionProcessed(e){return this.apiClient.post("/api/v1/payments/require-action/processed",{paymentId:e})}async getPaymentStatus(e){return this.apiClient.get("/api/v1/payments/".concat(e))}async retrievePayment(e){return this.apiClient.post("/api/v1/payments/retrieve",{paymentId:e})}async saveRadarSession(e){return this.apiClient.post("/api/v1/radar-sessions",e)}async completePaymentAfterAction(e){return this.apiClient.post("/api/v1/payments/complete-after-3ds",{paymentId:e})}async updateThreedsStatus(e){return this.apiClient.post("/api/v1/threeds/status",e)}};var ln=class{constructor(e){this.apiClient=e}async getOrder(e){let n=await this.apiClient.get("/api/v1/orders/".concat(e));if(typeof n=="object"&&n!==null&&"success"in n&&n.success===!1)throw new Error(n.error||"Failed to fetch order");let r=typeof n=="object"&&n!==null&&"order"in n?n.order:n;if(!r)throw new Error("Order not found");return r}async createOrder(e){return this.apiClient.post("/api/v1/orders",{checkoutSessionId:e})}async updateOrderStatus(e,n){return this.apiClient.patch("/api/v1/orders/".concat(e,"/status"),{status:n})}async addOrderItems(e,n){return this.apiClient.post("/api/v1/orders/".concat(e,"/items"),{items:n})}async getOrderLineItems(e){return(await this.getOrder(e)).items||[]}};var un=class{constructor(e){this.apiClient=e}async getPaymentMethods(e){return this.apiClient.get("/api/v1/payment-methods?checkoutSessionId=".concat(encodeURIComponent(e)))}async updateCheckoutSessionAddress(e,n){return this.apiClient.post("/api/v1/checkout-sessions/".concat(e,"/address"),n)}async updateCustomerEmail(e,n){return this.apiClient.post("/api/v1/customers/".concat(e),n)}};var rt=class{constructor(e){this.apiClient=e}async getStoreConfig(e){return await this.apiClient.get("/api/v1/checkout/config?storeId=".concat(e))}};var st=class{constructor(e){this.apiClient=e}async createSession(e){return this.apiClient.post("/api/v1/threeds/create-session",e)}};var go="https://cvwnizdbugpz6jwk.public.blob.vercel-storage.com/geodata/v1";var it=new Map,dn=new Map,$r=new Map,Fr=new Map;async function Du(t){let e=it.get(t);if(e)return e;let n=$r.get(t);return n||(n=(async()=>{let r="".concat(go,"/").concat(t,"/countries.json"),s=await fetch(r);if(!s.ok)throw new Error("Geodata fetch failed: ".concat(r," (").concat(s.status,")"));let i=await s.json();return it.set(t,i),$r.delete(t),i})(),$r.set(t,n),n)}async function Nu(t){let e=dn.get(t);if(e)return e;let n=Fr.get(t);return n||(n=(async()=>{let r="".concat(go,"/").concat(t,"/regions.json"),s=await fetch(r);if(!s.ok)throw new Error("Geodata fetch failed: ".concat(r," (").concat(s.status,")"));let i=await s.json();return dn.set(t,i),Fr.delete(t),i})(),Fr.set(t,n),n)}function Lu(t){return it.get(t)||it.get("en")||{}}function Bu(t){return dn.get(t)||dn.get("en")||{}}async function fn(t="en"){await Promise.all([Du(t),Nu(t)])}var mo=(t="en")=>{let e=Lu(t);return Object.entries(e).map(([n,r])=>({code:n,name:r.n,iso3:r.i3,numeric:r.nu,uniqueKey:"country-".concat(n)})).sort((n,r)=>n.name.localeCompare(r.name))},ho=(t,e="en")=>{let r=Bu(e)[t];return r?r.map(([s,i],o)=>({code:s,name:i,countryCode:t,uniqueKey:"state-".concat(t,"-").concat(s,"-").concat(o)})).sort((s,i)=>s.name.localeCompare(i.name)):[]};function yo(t){return it.has(t)}function bo(){return[...it.keys()]}async function wo(t){await fn(t)}typeof globalThis!="undefined"&&typeof fetch!="undefined"&&fn("en").catch(()=>{});var pn=class{static getCountriesData(e="en"){try{let n=mo(e),r={};return n.forEach(s=>{r[s.code]={iso:s.code,iso3:s.iso3||"",numeric:s.numeric||0,name:s.name}}),r}catch(n){return console.error("Failed to load ISO data for language: ".concat(e),n),{}}}static getRegions(e,n="en"){try{return ho(e,n).map(s=>({iso:s.code,name:s.name}))}catch(r){return[]}}static findRegion(e,n,r="en"){var i;return(i=this.getRegions(e,r).find(o=>o.iso===n))!=null?i:null}static mapGoogleToISO(e,n,r,s="en"){let i=this.getRegions(r,s);if(i.length===0)return null;let o=i.find(a=>a.iso===e);return o||(o=i.find(a=>a.name.toLowerCase()===e.toLowerCase()),o)||(o=i.find(a=>a.name.toLowerCase()===n.toLowerCase()),o)?o:(o=i.find(a=>a.name.toLowerCase().includes(n.toLowerCase())||n.toLowerCase().includes(a.name.toLowerCase())),o!=null?o:null)}static isLanguageRegistered(e){return yo(e)}static getRegisteredLanguages(){return bo()}static async importLanguage(e){return wo(e)}static async ensureLoaded(e="en"){return fn(e)}static getAvailableLanguages(){return["en","ru","de","fr","es","zh","hi","pt","ja","ar","it","he"]}};var ot=class{static initialize(e){var n,r;this.apiKey=e,typeof window!="undefined"&&((r=(n=window.google)==null?void 0:n.maps)!=null&&r.places)&&(this.service=new window.google.maps.places.AutocompleteService)}static async searchPlaces(e,n={}){return!this.service||!e.trim()?[]:new Promise((r,s)=>{this.service.getPlacePredictions({input:e,types:n.types||["address"],componentRestrictions:n.componentRestrictions},(i,o)=>{var a,l,c;o===((c=(l=(a=window.google)==null?void 0:a.maps)==null?void 0:l.places)==null?void 0:c.PlacesServiceStatus.OK)&&i?r(i):r([])})})}static async getPlaceDetails(e){var n,r;return typeof window=="undefined"||!((r=(n=window.google)==null?void 0:n.maps)!=null&&r.places)?null:new Promise((s,i)=>{new window.google.maps.places.PlacesService(document.createElement("div")).getDetails({placeId:e,fields:["place_id","formatted_address","address_components","geometry"]},(a,l)=>{var c,d,u;l===((u=(d=(c=window.google)==null?void 0:c.maps)==null?void 0:d.places)==null?void 0:u.PlacesServiceStatus.OK)&&a?s(a):s(null)})})}static extractAddressComponents(e){let n={};for(let r of e.address_components){let s=r.types;s.includes("street_number")?n.streetNumber=r.long_name:s.includes("route")?n.route=r.long_name:s.includes("locality")?(n.city=r.long_name,n.locality=r.long_name):s.includes("administrative_area_level_2")?(n.administrativeAreaLevel2=r.short_name,n.administrativeAreaLevel2Long=r.long_name,n.city||(n.city=r.long_name,n.locality=r.long_name)):s.includes("administrative_area_level_1")?(n.state=r.long_name,n.administrativeAreaLevel1=r.short_name,n.administrativeAreaLevel1Long=r.long_name):s.includes("postal_code")?n.postalCode=r.long_name:s.includes("country")&&(n.country=r.long_name,n.countryCode=r.short_name,n.iso=r.short_name)}return!n.administrativeAreaLevel1&&n.administrativeAreaLevel2&&(n.state=n.administrativeAreaLevel2Long||n.administrativeAreaLevel2,n.administrativeAreaLevel1=n.administrativeAreaLevel2,n.administrativeAreaLevel1Long=n.administrativeAreaLevel2Long),n}};ot.apiKey=null,ot.service=null;_r();var qr=class{static findVariant(e,n){for(let r of e){let s=r.variants.find(i=>i.id===n);if(s)return s}return null}static getVariantPrice(e,n="USD"){let r=e.prices.find(i=>i.currency===n);if(r)return r;let s=e.prices.find(i=>i.default);return s||e.prices[0]||null}static getAllVariants(e){let n=[];for(let r of e)if(r.variants)for(let s of r.variants)n.push({product:r,variant:s});return n}static filterVariants(e,n){let r=[];for(let s of e)if(s.variants)for(let i of s.variants)n(i,s)&&r.push({product:s,variant:i});return r}};var jr=class{static getOrderLineItems(e){return e.items||[]}static getOrderTotal(e){return e.paidAmount||0}static getOrderStatus(e){return e.status||"unknown"}static isOrderCompleted(e){return e.status==="completed"||e.status==="fulfilled"}static isOrderPending(e){return e.status==="pending"||e.status==="processing"}static isOrderCancelled(e){return e.status==="cancelled"||e.status==="refunded"}};function Mu(t,e="USD",n="en-US"){let r=Nt.getDecimalPlaces(e),s;r===0?s=t/100:s=t/Math.pow(10,r);try{return new Intl.NumberFormat(n,{style:"currency",currency:e,minimumFractionDigits:r,maximumFractionDigits:r}).format(s)}catch(i){let o=Nt.getCurrencySymbol(e);return"".concat(o).concat(s.toFixed(r))}}var Nt=class t{static getCurrency(e,n="USD"){var l,c,d,u;let r,s=!1,i=typeof window!="undefined"?new URLSearchParams(window.location.search).get("currency"):null,o=typeof window!="undefined"?localStorage.getItem("tgd_currency")||t.getCookieValue("tgd_currency"):null;i?(r=i.toUpperCase(),s=!0):o?(r=o.toUpperCase(),s=!0):typeof(e==null?void 0:e.currency)=="string"?r=e.currency:(l=e==null?void 0:e.currency)!=null&&l.code?r=e.currency.code:(d=(c=e==null?void 0:e.store)==null?void 0:c.presentmentCurrencies)!=null&&d[0]?r=e.store.presentmentCurrencies[0]:r=n;let a=(u=e==null?void 0:e.store)==null?void 0:u.presentmentCurrencies;if(a!=null&&a.length&&!a.includes(r)&&(console.warn('[CurrencyUtils] Currency "'.concat(r,'" is not in store presentmentCurrencies [').concat(a.join(", "),"]. Falling back to ").concat(a[0],".")),r=a[0],s&&typeof window!="undefined"))try{localStorage.setItem("tgd_currency",r)}catch(p){}return{code:r,symbol:this.getCurrencySymbol(r),name:this.getCurrencyName(r),decimalPlaces:this.getDecimalPlaces(r),isExplicit:s}}static getCookieValue(e){if(typeof document=="undefined")return null;let n=document.cookie.match(new RegExp("(?:^|; )".concat(e,"=([^;]*)")));return n?decodeURIComponent(n[1]):null}static getCurrencySymbol(e){return{USD:"$",EUR:"\u20AC",GBP:"\xA3",JPY:"\xA5",CAD:"C$",AUD:"A$",CHF:"CHF",CNY:"\xA5",SEK:"kr",NOK:"kr",DKK:"kr",PLN:"z\u0142",CZK:"K\u010D",HUF:"Ft",RON:"lei",BGN:"\u043B\u0432",HRK:"kn",RUB:"\u20BD",UAH:"\u20B4",TRY:"\u20BA",BRL:"R$",ARS:"$",CLP:"$",COP:"$",MXN:"$",PEN:"S/",UYU:"$U",VEF:"Bs",ZAR:"R",EGP:"\xA3",MAD:"\u062F.\u0645.",TND:"\u062F.\u062A",DZD:"\u062F.\u062C",LYD:"\u0644.\u062F",NGN:"\u20A6",GHS:"\u20B5",KES:"KSh",UGX:"USh",TZS:"TSh",ETB:"Br",ZMW:"ZK",BWP:"P",SZL:"L",LSL:"L",NAD:"N$",MUR:"\u20A8",SCR:"\u20A8",KWD:"\u062F.\u0643",BHD:"\u062F.\u0628",QAR:"\u0631.\u0642",AED:"\u062F.\u0625",OMR:"\u0631.\u0639.",YER:"\uFDFC",SAR:"\u0631.\u0633",JOD:"\u062F.\u0627",LBP:"\u0644.\u0644",ILS:"\u20AA",INR:"\u20B9",PKR:"\u20A8",BDT:"\u09F3",LKR:"\u20A8",NPR:"\u20A8",AFN:"\u060B",KZT:"\u20B8",UZS:"\u043B\u0432",KGS:"\u043B\u0432",TJS:"SM",TMT:"T",AZN:"\u20BC",GEL:"\u20BE",AMD:"\u058F",KRW:"\u20A9",THB:"\u0E3F",VND:"\u20AB",IDR:"Rp",MYR:"RM",SGD:"S$",PHP:"\u20B1",TWD:"NT$",HKD:"HK$",MOP:"MOP$",BND:"B$",LAK:"\u20AD",KHR:"\u17DB",MMK:"K",BOB:"Bs",PYG:"\u20B2",GTQ:"Q",HNL:"L",NIO:"C$",CRC:"\u20A1",PAB:"B/.",DOP:"RD$",JMD:"J$",TTD:"TT$",BBD:"Bds$",XCD:"EC$",AWG:"\u0192",ANG:"\u0192",SRD:"$",GYD:"G$",VES:"Bs.S",VED:"Bs.D"}[e]||e}static getCurrencyName(e){return{USD:"US Dollar",EUR:"Euro",GBP:"British Pound",JPY:"Japanese Yen",CAD:"Canadian Dollar",AUD:"Australian Dollar",CHF:"Swiss Franc",CNY:"Chinese Yuan",SEK:"Swedish Krona",NOK:"Norwegian Krone",DKK:"Danish Krone",PLN:"Polish Zloty",CZK:"Czech Koruna",HUF:"Hungarian Forint",RON:"Romanian Leu",BGN:"Bulgarian Lev",HRK:"Croatian Kuna",RUB:"Russian Ruble",UAH:"Ukrainian Hryvnia",TRY:"Turkish Lira",BRL:"Brazilian Real",ARS:"Argentine Peso",CLP:"Chilean Peso",COP:"Colombian Peso",MXN:"Mexican Peso",PEN:"Peruvian Sol",UYU:"Uruguayan Peso",VEF:"Venezuelan Bolivar",ZAR:"South African Rand",EGP:"Egyptian Pound",MAD:"Moroccan Dirham",TND:"Tunisian Dinar",DZD:"Algerian Dinar",LYD:"Libyan Dinar",NGN:"Nigerian Naira",GHS:"Ghanaian Cedi",KES:"Kenyan Shilling",UGX:"Ugandan Shilling",TZS:"Tanzanian Shilling",ETB:"Ethiopian Birr",ZMW:"Zambian Kwacha",BWP:"Botswana Pula",SZL:"Swazi Lilangeni",LSL:"Lesotho Loti",NAD:"Namibian Dollar",MUR:"Mauritian Rupee",SCR:"Seychellois Rupee",KWD:"Kuwaiti Dinar",BHD:"Bahraini Dinar",QAR:"Qatari Riyal",AED:"UAE Dirham",OMR:"Omani Rial",YER:"Yemeni Rial",SAR:"Saudi Riyal",JOD:"Jordanian Dinar",LBP:"Lebanese Pound",ILS:"Israeli Shekel",INR:"Indian Rupee",PKR:"Pakistani Rupee",BDT:"Bangladeshi Taka",LKR:"Sri Lankan Rupee",NPR:"Nepalese Rupee",AFN:"Afghan Afghani",KZT:"Kazakhstani Tenge",UZS:"Uzbekistani Som",KGS:"Kyrgyzstani Som",TJS:"Tajikistani Somoni",TMT:"Turkmenistani Manat",AZN:"Azerbaijani Manat",GEL:"Georgian Lari",AMD:"Armenian Dram",KRW:"South Korean Won",THB:"Thai Baht",VND:"Vietnamese Dong",IDR:"Indonesian Rupiah",MYR:"Malaysian Ringgit",SGD:"Singapore Dollar",PHP:"Philippine Peso",TWD:"Taiwan Dollar",HKD:"Hong Kong Dollar",MOP:"Macanese Pataca",BND:"Brunei Dollar",LAK:"Lao Kip",KHR:"Cambodian Riel",MMK:"Myanmar Kyat",BOB:"Bolivian Boliviano",PYG:"Paraguayan Guarani",GTQ:"Guatemalan Quetzal",HNL:"Honduran Lempira",NIO:"Nicaraguan Cordoba",CRC:"Costa Rican Colon",PAB:"Panamanian Balboa",DOP:"Dominican Peso",JMD:"Jamaican Dollar",TTD:"Trinidad and Tobago Dollar",BBD:"Barbadian Dollar",XCD:"East Caribbean Dollar",AWG:"Aruban Florin",ANG:"Netherlands Antillean Guilder",SRD:"Surinamese Dollar",GYD:"Guyanese Dollar",VES:"Venezuelan Bolivar Soberano",VED:"Venezuelan Bolivar Digital"}[e]||e}static getDecimalPlaces(e){var r;return(r={JPY:0,KRW:0,VND:0,IDR:0,LAK:0,KHR:0,MMK:0,PYG:0,VEF:0,VES:0,VED:0}[e])!=null?r:2}};var Kr=class{static getCheckoutSessionId(e){var n;return((n=e.checkoutSession)==null?void 0:n.id)||""}static getLineItems(e){var r;let n=(r=e.checkoutSession)==null?void 0:r.lineItems;return Array.isArray(n)?n:[]}static getTotal(e){var r;let n=(r=e.checkoutSession)==null?void 0:r.totalPrice;return typeof n=="number"?n:0}static isClubMember(e){return e.customerIsClubMember||!1}};var Hr=class{static isValidPromotion(e){return!!(e.id&&e.name)}static getPromotionType(e){return e.type||"unknown"}static hasRules(e){return!!(e.rules&&e.rules.length>0)}static hasActions(e){return!!(e.actions&&e.actions.length>0)}};var zr=class{static isValidOffer(e){return!!(e.id&&e.summaries&&e.summaries.length>0)}static getOfferTotal(e){var n,r;return((r=(n=e.summaries)==null?void 0:n[0])==null?void 0:r.totalAmount)||0}static getOfferAdjustedTotal(e){var n,r;return((r=(n=e.summaries)==null?void 0:n[0])==null?void 0:r.totalAdjustedAmount)||0}static hasItems(e){return!!(e.offerLineItems&&e.offerLineItems.length>0)}static getOfferCurrency(e){var n,r;return((r=(n=e.summaries)==null?void 0:n[0])==null?void 0:r.currency)||"USD"}static getOfferTitle(e,n="en"){var r,s;return((r=e.titleTrans)==null?void 0:r[n])||((s=e.titleTrans)==null?void 0:s.en)||"Offer ".concat(e.id)}};var Vr=class{static isValidOffer(e){return!!(e.id&&e.name&&e.price>0)}static toggleSelection(e){return O(b({},e),{isSelected:!e.isSelected})}static calculatePreview(e,n=0){let r=n+e.price,s=e.isSelected?r:n;return{offer:e,totalAmount:r,adjustedAmount:s}}static getSelectedOffers(e){return e.filter(n=>n.isSelected)}static getSelectedTotal(e){return e.filter(n=>n.isSelected).reduce((n,r)=>n+r.price,0)}};var Uu={session:t=>["funnel","session",t],allSessions:()=>["funnel","sessions"],funnelMeta:t=>["funnel","meta",t]};function So(t,e,n="*"){let r={type:"TAGADAPAY_CONFIG_UPDATE",config:e,timestamp:Date.now()};t.postMessage(r,n)}function $u(t,e="iframe"){if(typeof document=="undefined")return;let n=document.querySelectorAll(e);n.forEach(r=>{r.contentWindow&&So(r.contentWindow,t)}),console.log("[ConfigHotReload] Broadcasted config update to ".concat(n.length," iframe(s)"))}function Fu(t){if(typeof window=="undefined")return()=>{};let e=n=>{var r;((r=n.data)==null?void 0:r.type)==="TAGADAPAY_CONFIG_UPDATE"&&t(n.data.config)};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}}function qu(t,e=150){let n=null;return r=>{n&&clearTimeout(n),n=setTimeout(()=>{t(r),n=null},e)}}var Zr=Oi(Ro()),Y,at=typeof window!="undefined"&&typeof document!="undefined",Xu=at?history.pushState.bind(history):null,Qu=at?history.replaceState.bind(history):null;function hn(){Y=void 0}at&&(window.addEventListener("popstate",hn),window.addEventListener("hashchange",hn),history.pushState=function(...t){return hn(),Xu.apply(this,t)},history.replaceState=function(...t){return hn(),Qu.apply(this,t)});function Lt(){if(!at)return null;if(Y!==void 0)return console.log("[TagadaPay SDK] \u{1F4E6} Returning cached internal path:",Y),Y;console.log("[TagadaPay SDK] \u{1F50D} getInternalPath() called for:",window.location.pathname);try{let t=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"||window.location.hostname.endsWith(".localhost");if(console.log("[TagadaPay SDK] \u{1F3E0} isLocalhost:",t),t){let o=new URLSearchParams(window.location.search).get("__remap");if(console.log("[TagadaPay SDK] \u{1F50D} Query parameter __remap:",o),o)return Y=o,o;try{let a=localStorage.getItem("tagadapay-remap");if(console.log("[TagadaPay SDK] \u{1F50D} localStorage tagadapay-remap:",a),a)try{let l=JSON.parse(a);if(console.log("[TagadaPay SDK] \u{1F4DD} Parsed remap config:",l),l.externalPath&&l.internalPath){let c=window.location.pathname;console.log("[TagadaPay SDK] \u{1F50D} Checking if",c,"matches pattern",l.externalPath);let u=(0,Zr.match)(l.externalPath,{decode:decodeURIComponent,end:!0})(c);return console.log("[TagadaPay SDK] \u{1F3AF} Match result:",u),u!==!1?(Y=l.internalPath,console.log("[TagadaPay SDK] \u2705 Path remap: ".concat(l.externalPath," \u2192 ").concat(l.internalPath)),console.log("[TagadaPay SDK] \u2705 Current URL ".concat(c," matches external pattern")),console.log("[TagadaPay SDK] \u{1F4E6} Caching and returning:",l.internalPath),l.internalPath):(console.log("[TagadaPay SDK] \u274C Current URL ".concat(c," does NOT match external pattern ").concat(l.externalPath)),Y=null,null)}else console.log("[TagadaPay SDK] \u26A0\uFE0F Parsed config missing externalPath or internalPath")}catch(l){return console.log("[TagadaPay SDK] \u26A0\uFE0F Failed to parse as JSON, using legacy format:",l),Y=a,a}else console.log("[TagadaPay SDK] \u{1F4ED} No localStorage tagadapay-remap found")}catch(a){console.log("[TagadaPay SDK] \u274C localStorage error:",a)}}let e=document.querySelector('meta[name="tagadapay-path-remap"]');if(e)try{let i=e.getAttribute("content");if(i){let o=decodeURIComponent(i),a=JSON.parse(o);if(a.internal)return console.log("[TagadaPay SDK] \u2705 Got internal path from full remap config:",a.internal),Y=a.internal,a.internal}}catch(i){console.error("[TagadaPay SDK] Error parsing full remap config:",i)}let n=document.querySelector('meta[name="x-plugin-internal-path"]');if(!n)return console.log("[TagadaPay SDK] \u2139\uFE0F No path remap meta tags found"),Y=null,null;let r=n.getAttribute("content");if(!r||r.trim()==="")return Y=null,null;let s=r.trim();return s.startsWith("/")?(console.log("[TagadaPay SDK] \u2705 Got internal path from legacy meta tag:",s),Y=s,s):(Y=null,null)}catch(t){return Y=null,null}}function Io(){return Lt()!==null}function Ao(){if(!at)throw new Error("[TagadaPay SDK] getPathInfo() cannot be called in SSR context");try{let t=window.location.pathname,e=Lt(),n=new URLSearchParams(window.location.search),r=window.location.hash.replace(/^#/,"");return{externalPath:t,internalPath:e,isRemapped:e!==null,fullUrl:window.location.href,query:n,hash:r}}catch(t){return{externalPath:"/",internalPath:null,isRemapped:!1,fullUrl:"",query:new URLSearchParams,hash:""}}}function yn(t,e){try{if(t===e)return{matched:!0,params:{}};if(!(e.includes(":")||e.includes("*")||e.includes("{")))return{matched:t===e,params:{}};let s=(0,Zr.match)(e,{decode:decodeURIComponent,end:!0})(t);if(s===!1)return{matched:!1,params:{}};let i={};return typeof s=="object"&&s.params&&Object.keys(s.params).forEach(o=>{let a=s.params[o];i[o]=Array.isArray(a)?a.join("/"):String(a)}),{matched:!0,params:i}}catch(n){return{matched:t===e,params:{}}}}function ed(t,e,n){let r=_o(e),s=_o(n);if(r.length===0||r.length!==s.length)return t;let i={};return r.forEach((o,a)=>{let l=s[a],c=t[o];c!==void 0&&(i[l]=c)}),i}function _o(t){let e=t.match(/:([a-zA-Z0-9_]+)/g);return e?e.map(n=>n.substring(1)):[]}function xo(t){if(typeof t!="string")throw new Error("[TagadaPay SDK] internalPath must be a string, got ".concat(typeof t));if(t.trim()==="")throw new Error("[TagadaPay SDK] internalPath cannot be empty");if(!t.startsWith("/"))throw new Error('[TagadaPay SDK] internalPath must start with /, got "'.concat(t,'"'));if(!at)return{matched:!1,params:{}};try{let e=window.location.pathname,n=Lt();if(n){if(!yn(n,t).matched)return{matched:!1,params:{}};let s=null;if(typeof localStorage!="undefined")try{let o=localStorage.getItem("tagadapay-remap");if(o){let a=JSON.parse(o);a.externalPath&&a.internalPath===n&&(s=a.externalPath)}}catch(o){}if(!s&&typeof document!="undefined"){console.log("[TagadaPay SDK] \u{1F50D} Checking for production path remap meta tag...");let o=document.querySelector('meta[name="tagadapay-path-remap"]');if(o)try{let a=o.getAttribute("content");if(console.log("[TagadaPay SDK] \u{1F4C4} Found meta tag content (encoded):",(a==null?void 0:a.substring(0,100))+"..."),a){let l=decodeURIComponent(a);console.log("[TagadaPay SDK] \u{1F4C4} Decoded content:",l);let c=JSON.parse(l);console.log("[TagadaPay SDK] \u{1F4E6} Parsed remap config:",c),console.log("[TagadaPay SDK] \u{1F50D} Checking if internal path matches:",{parsedInternal:c.internal,remappedInternalPath:n}),c.external&&c.internal===n?(s=c.external,console.log("[TagadaPay SDK] \u2705 Using external pattern from meta tag:",s)):console.log("[TagadaPay SDK] \u26A0\uFE0F Internal path mismatch - not using meta tag config")}}catch(a){console.error("[TagadaPay SDK] \u274C Error parsing path remap meta tag:",a)}else console.log("[TagadaPay SDK] \u274C No tagadapay-path-remap meta tag found")}if(s){let o=yn(e,s);if(o.matched){console.log("[TagadaPay SDK] \u{1F504} Mapping params from external to internal pattern"),console.log("[TagadaPay SDK] External params:",o.params),console.log("[TagadaPay SDK] External pattern:",s),console.log("[TagadaPay SDK] Internal pattern:",t);let a=ed(o.params,s,t);return console.log("[TagadaPay SDK] Mapped params:",a),{matched:!0,params:a}}}return{matched:!0,params:yn(e,t).params}}return yn(e,t)}catch(e){return{matched:!1,params:{}}}}Je();Je();var Tr=class{constructor(e){this.callbacks={};this.basisTheory=null;this.btInitPromise=null;this.bt3dsClass=null;this.bt3dsInitPromise=null;this.storeConfig=null;this.storeConfigPromise=null;this.pollTimer=null;this.pollAttempts=0;this.isPollingActive=!1;this.redirectReturnProcessed=!1;this.paymentsResource=new nt(e.apiClient),this.threedsResource=new st(e.apiClient),this.storeConfigResource=new rt(e.apiClient),this.storeId=e.storeId}get payments(){return this.paymentsResource}setCallbacks(e){this.callbacks=e}warmup(){this.initBasisTheory(),this.initBt3ds(),this.storeId&&this.fetchStoreConfig()}destroy(){this.stopPolling(),this.basisTheory=null,this.btInitPromise=null,this.bt3dsClass=null,this.bt3dsInitPromise=null,this.storeConfig=null,this.storeConfigPromise=null}initBasisTheory(){return this.basisTheory?Promise.resolve(this.basisTheory):this.btInitPromise?this.btInitPromise:(this.btInitPromise=(async()=>{try{let e=Dt(),{BasisTheory:n}=await Promise.resolve().then(()=>Oi(yl())),r=await new n().init(e,{elements:!1});return this.basisTheory=r,console.log("[PaymentService] BasisTheory initialized"),this.basisTheory}catch(e){return console.error("[PaymentService] BasisTheory init failed:",e),null}})(),this.btInitPromise)}getBtApiKey(){return Dt()}initBt3ds(){return this.bt3dsClass?Promise.resolve(this.bt3dsClass):this.bt3dsInitPromise?this.bt3dsInitPromise:(this.bt3dsInitPromise=(async()=>{try{let{BasisTheory3ds:e}=await Promise.resolve().then(()=>(Ll(),Nl));return this.bt3dsClass=e,console.log("[PaymentService] BasisTheory 3DS loaded"),this.bt3dsClass}catch(e){return console.error("[PaymentService] BasisTheory 3DS load failed:",e),null}})(),this.bt3dsInitPromise)}fetchStoreConfig(){return this.storeConfig?Promise.resolve(this.storeConfig):this.storeConfigPromise?this.storeConfigPromise:this.storeId?(this.storeConfigPromise=(async()=>{try{return this.storeConfig=await this.storeConfigResource.getStoreConfig(this.storeId),this.storeConfig}catch(e){return null}})(),this.storeConfigPromise):Promise.resolve(null)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null),this.isPollingActive=!1,this.pollAttempts=0}startPolling(e,n,r=20,s=1500){this.stopPolling(),this.isPollingActive=!0,this.pollAttempts=0,console.log("[PaymentService] Starting payment polling:",e);let i=async()=>{var o;if(this.isPollingActive){this.pollAttempts++;try{let a=await this.paymentsResource.getPaymentStatus(e);if(console.log("[PaymentService] Poll #".concat(this.pollAttempts,": ").concat(a.status," / ").concat(a.subStatus)),!this.isPollingActive)return;if(a.status==="succeeded"||a.status==="pending"&&a.subStatus==="authorized"){this.stopPolling(),n.onSuccess(a);return}if(a.requireAction!=="none"&&a.requireActionData&&!a.requireActionData.processed){this.stopPolling(),(o=n.onRequireAction)==null||o.call(n,a);return}if(a.status!=="succeeded"&&a.status!=="pending"){this.stopPolling(),n.onFailure(a.status||"Payment failed");return}this.pollAttempts>=r&&(this.stopPolling(),n.onFailure("Payment verification timeout"))}catch(a){this.pollAttempts>=3&&(this.stopPolling(),n.onFailure("Payment verification failed due to network errors"))}}};i(),this.pollTimer=setInterval(()=>void i(),s)}async processAndHandle(e,n,r,s){var a,l,c,d,u,p,m,f;let i=xt(),o=await this.paymentsResource.processPaymentDirect(e,n,r,{initiatedBy:(s==null?void 0:s.initiatedBy)||"customer",source:(s==null?void 0:s.source)||"checkout",paymentFlowId:i,processorId:s==null?void 0:s.processorId,paymentMethod:s==null?void 0:s.paymentMethod});return console.log("[PaymentService] Payment response:",{paymentId:(a=o.payment)==null?void 0:a.id,status:(l=o.payment)==null?void 0:l.status,requireAction:(c=o.payment)==null?void 0:c.requireAction}),(p=(u=this.callbacks).onCurrentPaymentId)==null||p.call(u,((d=o.payment)==null?void 0:d.id)||null),o.payment.requireAction!=="none"?(await this.handlePaymentAction(o.payment),{success:!0,payment:o.payment,order:o.order,redirecting:!0}):o.payment.status==="succeeded"?((f=(m=this.callbacks).onProcessing)==null||f.call(m,!1),{success:!0,payment:o.payment,order:o.order}):new Promise(y=>{this.startPolling(o.payment.id,{onSuccess:g=>{var w,v;(v=(w=this.callbacks).onProcessing)==null||v.call(w,!1),y({success:!0,payment:g,order:o.order})},onFailure:g=>{var w,v,S,C;(v=(w=this.callbacks).onError)==null||v.call(w,g),(C=(S=this.callbacks).onProcessing)==null||C.call(S,!1),y({success:!1,error:g})},onRequireAction:g=>{this.handlePaymentAction(g)}})})}async handleResumedPayment(e){var n,r,s,i,o,a,l,c,d,u,p,m;if(e.status==="declined"||e.status==="failed"){let f=((n=e.error)==null?void 0:n.message)||((r=e.error)==null?void 0:r.processorMessage)||"Payment declined";(i=(s=this.callbacks).onError)==null||i.call(s,f),(a=(o=this.callbacks).onProcessing)==null||a.call(o,!1),(c=(l=this.callbacks).onFailure)==null||c.call(l,f);return}if(e.status==="succeeded"){(u=(d=this.callbacks).onProcessing)==null||u.call(d,!1),(m=(p=this.callbacks).onSuccess)==null||m.call(p,e);return}if(e.requireAction!=="none"&&e.requireActionData){await this.handlePaymentAction(e);return}this.startPolling(e.id,{onSuccess:f=>{var y,g,w,v;(g=(y=this.callbacks).onProcessing)==null||g.call(y,!1),(v=(w=this.callbacks).onSuccess)==null||v.call(w,f)},onFailure:f=>{var y,g,w,v;(g=(y=this.callbacks).onError)==null||g.call(y,f),(v=(w=this.callbacks).onProcessing)==null||v.call(w,!1)},onRequireAction:f=>{this.handlePaymentAction(f)}})}async handlePaymentAction(e){var r,s,i,o,a,l,c,d,u,p,m,f,y;if(e.requireAction==="none"||(r=e.requireActionData)!=null&&r.processed)return;let n=e.requireActionData;if(n){try{await this.paymentsResource.markPaymentActionProcessed(e.id)}catch(g){}switch(n.type){case"redirect":case"redirect_to_payment":case"processor_auth":{let g=((i=(s=n.metadata)==null?void 0:s.redirect)==null?void 0:i.redirectUrl)||n.redirectUrl||n.url;g?(console.log("[PaymentService] Redirecting:",g),window.location.href=g):e.status==="succeeded"&&((a=(o=this.callbacks).onProcessing)==null||a.call(o,!1),(c=(l=this.callbacks).onSuccess)==null||c.call(l,e));break}case"threeds_auth":{let g=(d=n.metadata)==null?void 0:d.threedsSession;g!=null&&g.acsChallengeUrl&&(console.log("[PaymentService] 3DS challenge redirect:",g.acsChallengeUrl),window.location.href=g.acsChallengeUrl);break}case"error":{let g=n.message||"Payment action failed";(p=(u=this.callbacks).onError)==null||p.call(u,g),(f=(m=this.callbacks).onProcessing)==null||f.call(m,!1);break}case"kesspay_auth":this.handleKessPayAuth(n);break;case"trustflow_auth":this.handleTrustFlowAuth(n);break;case"finix_radar":await this.handleFinixRadar(e,n);break;case"stripe_radar":await this.handleStripeRadar(e,n);break;case"radar":((y=n.metadata)==null?void 0:y.provider)==="airwallex"&&await this.handleAirwallexRadar(e,n);break;case"mastercard_auth":await this.handleMasterCardAuth(e,n);break;default:{console.log("[PaymentService] Unhandled action, starting polling:",n.type),this.startPolling(e.id,{onSuccess:g=>{var w,v,S,C;(v=(w=this.callbacks).onProcessing)==null||v.call(w,!1),(C=(S=this.callbacks).onSuccess)==null||C.call(S,g)},onFailure:g=>{var w,v,S,C;(v=(w=this.callbacks).onError)==null||v.call(w,g),(C=(S=this.callbacks).onProcessing)==null||C.call(S,!1)},onRequireAction:g=>{this.handlePaymentAction(g)}});break}}}}handleKessPayAuth(e){var r,s,i,o,a,l,c,d,u,p,m;let n=(r=e==null?void 0:e.metadata)==null?void 0:r.threeds;if(!(n!=null&&n.challengeHtml)){(i=(s=this.callbacks).onError)==null||i.call(s,"Missing KessPay 3DS challenge HTML"),(a=(o=this.callbacks).onProcessing)==null||a.call(o,!1);return}try{(c=(l=this.callbacks).onProcessing)==null||c.call(l,!1);let f=document.implementation.createHTMLDocument("KessPay 3DS");f.body.innerHTML=n.challengeHtml;let y=f.querySelector("form");if(y){let g=document.createElement("form");g.method=y.method||"POST",g.action=y.action||"",g.style.display="none",y.querySelectorAll("input").forEach(w=>{let v=document.createElement("input");v.type=w.type,v.name=w.name,v.value=w.value,g.appendChild(v)}),document.body.appendChild(g),g.submit()}else document.open(),document.write(n.challengeHtml),document.close()}catch(f){(u=(d=this.callbacks).onError)==null||u.call(d,f instanceof Error?f.message:"KessPay 3DS failed"),(m=(p=this.callbacks).onProcessing)==null||m.call(p,!1)}}handleTrustFlowAuth(e){var r,s,i,o,a,l,c,d,u,p,m;let n=(r=e==null?void 0:e.metadata)==null?void 0:r.trustflow;if(!(n!=null&&n.appId)||!(n!=null&&n.txnId)||!(n!=null&&n.hash)){(i=(s=this.callbacks).onError)==null||i.call(s,"Missing Trust Flow 3DS data"),(a=(o=this.callbacks).onProcessing)==null||a.call(o,!1);return}try{(c=(l=this.callbacks).onProcessing)==null||c.call(l,!1);let f=document.createElement("form");f.method="POST",f.action=n.captureUrl,f.style.display="none";for(let[y,g]of[["APP_ID",n.appId],["TXN_ID",n.txnId],["HASH",n.hash]]){let w=document.createElement("input");w.type="hidden",w.name=y,w.value=g,f.appendChild(w)}document.body.appendChild(f),f.submit()}catch(f){(u=(d=this.callbacks).onError)==null||u.call(d,f instanceof Error?f.message:"Trust Flow 3DS failed"),(m=(p=this.callbacks).onProcessing)==null||m.call(p,!1)}}async handleFinixRadar(e,n){var s,i,o,a,l,c,d,u,p;let r=(s=n.metadata)==null?void 0:s.radar;if(!r){(o=(i=this.callbacks).onError)==null||o.call(i,"Finix radar config missing"),(l=(a=this.callbacks).onProcessing)==null||l.call(a,!1);return}try{await this.loadScript("https://js.finix.com/v/1/finix.js",()=>{var y;return typeof((y=window.Finix)==null?void 0:y.Auth)=="function"});let m=await new Promise((y,g)=>{let w=setTimeout(()=>g(new Error("Timeout waiting for Finix Auth")),1e4),v=window.Finix.Auth(r.environment,r.merchantId,()=>{clearTimeout(w);let C=v.getSessionKey();C?y(C):g(new Error("No Finix session key"))}),S=v.getSessionKey();S&&(clearTimeout(w),y(S))});await this.paymentsResource.saveRadarSession({orderId:r.orderId,finixRadarSessionId:m,finixRadarSessionData:{sessionKey:m,merchantId:r.merchantId,environment:r.environment,createdAt:new Date().toISOString()}});let f=await this.paymentsResource.completePaymentAfterAction(e.id);await this.handleResumedPayment(f)}catch(m){(d=(c=this.callbacks).onError)==null||d.call(c,m instanceof Error?m.message:"Finix radar failed"),(p=(u=this.callbacks).onProcessing)==null||p.call(u,!1)}}async handleStripeRadar(e,n){var s,i,o,a,l,c,d,u,p;let r=(s=n.metadata)==null?void 0:s.radar;if(!(r!=null&&r.publishableKey)){(o=(i=this.callbacks).onError)==null||o.call(i,"Stripe radar config missing"),(l=(a=this.callbacks).onProcessing)==null||l.call(a,!1);return}try{await this.loadScript("https://js.stripe.com/v3/",()=>typeof window.Stripe=="function");let f=await window.Stripe(r.publishableKey).createRadarSession();if(f.error)throw new Error(f.error.message||"Failed to create Radar session");if(!f.radarSession)throw new Error("No radar session returned from Stripe");await this.paymentsResource.saveRadarSession({orderId:r.orderId,stripeRadarSessionId:f.radarSession.id,stripeRadarSessionData:f.radarSession});let y=await this.paymentsResource.completePaymentAfterAction(e.id);await this.handleResumedPayment(y)}catch(m){(d=(c=this.callbacks).onError)==null||d.call(c,m instanceof Error?m.message:"Stripe radar failed"),(p=(u=this.callbacks).onProcessing)==null||p.call(u,!1)}}async handleAirwallexRadar(e,n){var o,a,l,c,d,u,p,m,f,y,g;let r=((o=n.metadata)==null?void 0:o.isTest)||!1,s=(a=e.order)==null?void 0:a.id,i=(l=e.order)==null?void 0:l.checkoutSessionId;if(!s||!i){(d=(c=this.callbacks).onError)==null||d.call(c,"Missing order info for Airwallex radar"),(p=(u=this.callbacks).onProcessing)==null||p.call(u,!1);return}try{let w=crypto.randomUUID(),v=document.getElementById("airwallex-fraud-api");if(v)v.setAttribute("data-order-session-id",w);else{let C=r?"https://static-demo.airwallex.com":"https://static.airwallex.com",R=document.createElement("script");R.type="text/javascript",R.async=!0,R.id="airwallex-fraud-api",R.setAttribute("data-order-session-id",w),R.src="".concat(C,"/webapp/fraud/device-fingerprint/index.js"),await new Promise((_,A)=>{R.onload=()=>_(),R.onerror=()=>A(new Error("Failed to load Airwallex fraud script")),document.body.appendChild(R)})}await this.paymentsResource.saveRadarSession({paymentId:e.id,checkoutSessionId:i,orderId:s,airwallexRadarSessionId:w});let S=await this.paymentsResource.completePaymentAfterAction(e.id);await this.handleResumedPayment(S)}catch(w){(f=(m=this.callbacks).onError)==null||f.call(m,w instanceof Error?w.message:"Airwallex radar failed"),(g=(y=this.callbacks).onProcessing)==null||g.call(y,!1)}}async handleMasterCardAuth(e,n){var s,i,o,a,l,c,d,u,p,m,f,y,g,w;let r=(s=n==null?void 0:n.metadata)==null?void 0:s.threeds;if(!(r!=null&&r.sessionId)||!(r!=null&&r.merchantId)){(o=(i=this.callbacks).onError)==null||o.call(i,"Missing MasterCard 3DS data"),(l=(a=this.callbacks).onProcessing)==null||l.call(a,!1);return}try{(d=(c=this.callbacks).onProcessing)==null||d.call(c,!1),await this.loadScript(r.scriptUrl,()=>!!window.ThreeDS);let v="mastercard-3ds-container",S=document.getElementById(v);S||(S=document.createElement("div"),S.id=v,S.style.cssText="position:absolute;top:-9999px;left:-9999px;width:1px;height:1px;overflow:hidden",document.body.appendChild(S)),await new Promise((A,N)=>{window.ThreeDS.configure({merchantId:r.merchantId,sessionId:r.sessionId,containerId:v,callback:()=>{window.ThreeDS.isConfigured()?A():N(new Error("ThreeDS configuration failed"))},configuration:{userLanguage:"en-US",wsVersion:r.version?parseInt(r.version,10):72}})});let C=await new Promise(A=>{window.ThreeDS.authenticatePayer(r.orderId,r.transactionId,A)}),R=(C==null?void 0:C.htmlRedirectCode)||((m=(p=(u=C==null?void 0:C.restApiResponse)==null?void 0:u.authentication)==null?void 0:p.redirect)==null?void 0:m.html);if(R){let A=document.implementation.createHTMLDocument("MasterCard 3DS");A.body.innerHTML=R;let N=A.querySelector("form");if(N){let W=document.createElement("form");W.method=N.method||"POST",W.action=N.action||"",W.style.display="none",N.querySelectorAll("input").forEach(U=>{let q=document.createElement("input");q.type=U.type,q.name=U.name,q.value=U.value,W.appendChild(q)}),document.body.appendChild(W),W.submit()}else document.open(),document.write(R),document.close()}else if(r.paymentId){let A=await this.paymentsResource.completePaymentAfterAction(r.paymentId);await this.handleResumedPayment(A)}let _=document.getElementById(v);_&&_.remove()}catch(v){(y=(f=this.callbacks).onError)==null||y.call(f,v instanceof Error?v.message:"MasterCard 3DS failed"),(w=(g=this.callbacks).onProcessing)==null||w.call(g,!1)}}async loadScript(e,n){if(typeof window=="undefined"||n())return;if(document.querySelector('script[src="'.concat(e,'"]'))){await this.waitFor(n,1e4);return}let s=document.createElement("script");s.src=e,s.async=!0,await new Promise((i,o)=>{s.onload=()=>i(),s.onerror=()=>o(new Error("Failed to load script: ".concat(e))),document.head.appendChild(s)})}waitFor(e,n){return new Promise((r,s)=>{if(e()){r();return}let i=setTimeout(()=>s(new Error("Timeout")),n),o=()=>{e()?(clearTimeout(i),r()):setTimeout(o,100)};o()})}detectRedirectReturn(){return typeof window=="undefined"||this.redirectReturnProcessed?!1:this.detectAirwallex3dsReturn()?!0:this.detectGenericRedirectReturn()}detectGenericRedirectReturn(){var o,a,l,c,d,u;let e=new URLSearchParams(window.location.search),n=e.get("paymentAction"),r=e.get("paymentActionStatus"),s=e.get("paymentId");return e.get("mode")==="retrieve"||n!=="requireAction"||r!=="completed"||!s?!1:(console.log("[PaymentService] Generic redirect return detected:",s),this.redirectReturnProcessed=!0,(a=(o=this.callbacks).onProcessing)==null||a.call(o,!0),(c=(l=this.callbacks).onCurrentPaymentId)==null||c.call(l,s),(u=(d=this.callbacks).onRedirectReturn)==null||u.call(d,s),this.startPolling(s,{onSuccess:p=>{var m,f,y,g;(f=(m=this.callbacks).onProcessing)==null||f.call(m,!1),this.cleanPaymentUrlParams(),(g=(y=this.callbacks).onSuccess)==null||g.call(y,p)},onFailure:p=>{var m,f,y,g;(f=(m=this.callbacks).onError)==null||f.call(m,p),(g=(y=this.callbacks).onProcessing)==null||g.call(y,!1),this.cleanPaymentUrlParams()},onRequireAction:p=>{this.handlePaymentAction(p)}}),!0)}detectAirwallex3dsReturn(){var a,l,c,d;let e=new URLSearchParams(window.location.search),n=e.get("paymentId"),r=e.get("payment_intent_id"),s=e.get("succeeded"),i=e.get("processorType");return!(r||s!==null)||i!=="airwallex"||!n?!1:(console.log("[PaymentService] Airwallex 3DS return detected:",n),this.redirectReturnProcessed=!0,(l=(a=this.callbacks).onProcessing)==null||l.call(a,!0),(d=(c=this.callbacks).onCurrentPaymentId)==null||d.call(c,n),this.handleAirwallex3dsRedirectReturn(n,r,s),!0)}async handleAirwallex3dsRedirectReturn(e,n,r){var i,o,a,l,c,d,u,p,m,f,y,g,w,v,S,C,R,_,A,N,W,U,q,$,Ae,he,yt,Q,bt;let s=()=>{let k=new URLSearchParams(window.location.search);["payment_intent_id","succeeded","processorType","paymentId","paymentAction","paymentActionStatus","error_code","error_message","mode"].forEach(B=>k.delete(B));let xe=k.toString()?"".concat(window.location.pathname,"?").concat(k.toString()):window.location.pathname;window.history.replaceState({},document.title,xe)};if(r==="true")try{await this.paymentsResource.updateThreedsStatus({paymentId:e,status:"succeeded",paymentIntentId:n||""}),s();let k=await this.paymentsResource.retrievePayment(e),xe=((i=k==null?void 0:k.retrieveResult)==null?void 0:i.status)||(k==null?void 0:k.status);if((o=k==null?void 0:k.retrieveResult)!=null&&o.success&&xe==="succeeded"){let B=await this.paymentsResource.getPaymentStatus(e);(l=(a=this.callbacks).onProcessing)==null||l.call(a,!1),(d=(c=this.callbacks).onSuccess)==null||d.call(c,B)}else if(xe==="declined"||xe==="error"){let B=((u=k==null?void 0:k.retrieveResult)==null?void 0:u.message)||(k==null?void 0:k.message)||"Payment failed";(m=(p=this.callbacks).onError)==null||m.call(p,B),(y=(f=this.callbacks).onProcessing)==null||y.call(f,!1)}else{let B=await this.paymentsResource.getPaymentStatus(e);if(B.status==="declined"||B.status==="failed"){let j=((g=B.error)==null?void 0:g.message)||((w=B.error)==null?void 0:w.processorMessage)||"Payment declined";(S=(v=this.callbacks).onError)==null||S.call(v,j),(R=(C=this.callbacks).onProcessing)==null||R.call(C,!1)}else B.status==="succeeded"||B.status==="pending"&&B.subStatus==="authorized"?((A=(_=this.callbacks).onProcessing)==null||A.call(_,!1),(W=(N=this.callbacks).onSuccess)==null||W.call(N,B)):B.requireAction!=="none"&&B.requireActionData&&!B.requireActionData.processed?this.handlePaymentAction(B):this.startPolling(e,{onSuccess:j=>{var te,Ce,ye,ke;(Ce=(te=this.callbacks).onProcessing)==null||Ce.call(te,!1),(ke=(ye=this.callbacks).onSuccess)==null||ke.call(ye,j)},onFailure:j=>{var te,Ce,ye,ke;(Ce=(te=this.callbacks).onError)==null||Ce.call(te,j),(ke=(ye=this.callbacks).onProcessing)==null||ke.call(ye,!1)},onRequireAction:j=>{this.handlePaymentAction(j)}})}}catch(k){(q=(U=this.callbacks).onError)==null||q.call(U,k instanceof Error?k.message:"Failed to process Airwallex 3DS"),(Ae=($=this.callbacks).onProcessing)==null||Ae.call($,!1)}else{let k=new URLSearchParams(window.location.search).get("error_message")||"Authentication failed";(yt=(he=this.callbacks).onError)==null||yt.call(he,k),(bt=(Q=this.callbacks).onProcessing)==null||bt.call(Q,!1),s()}}cleanPaymentUrlParams(){if(typeof window=="undefined")return;let e=new URLSearchParams(window.location.search);["paymentAction","paymentActionStatus","paymentId","payment_intent","payment_intent_client_secret","source_type","redirect_status"].forEach(r=>e.delete(r));let n=e.toString()?"".concat(window.location.pathname,"?").concat(e.toString()):window.location.pathname;window.history.replaceState({},document.title,n)}async createCardPaymentInstrument(e){let n=await this.initBasisTheory();return this.paymentsResource.createCardPaymentInstrument(n!=null?n:void 0,e)}async createApplePayPaymentInstrument(e){let n=await this.initBasisTheory();return this.paymentsResource.createApplePayPaymentInstrument(n!=null?n:void 0,e)}async createGooglePayPaymentInstrument(e){let n=await this.initBasisTheory();return this.paymentsResource.createGooglePayPaymentInstrument(n!=null?n:void 0,e)}async getCardPaymentInstruments(){return this.paymentsResource.getCardPaymentInstruments()}async createThreedsSession(e){let n=await this.initBt3ds();if(!n)throw new Error("BasisTheory 3DS not loaded");let s=await n(this.getBtApiKey()).createSession({tokenId:e.token});return this.threedsResource.createSession({provider:"basis_theory",sessionData:s,paymentInstrumentId:e.id})}async processCardPayment(e,n){var r,s,i,o,a,l,c,d,u;(s=(r=this.callbacks).onProcessing)==null||s.call(r,!0),(o=(i=this.callbacks).onError)==null||o.call(i,null);try{let p=await this.createCardPaymentInstrument({cardNumber:n.cardNumber,expiryDate:n.expiryDate,cvc:n.cvc});if(!(p!=null&&p.id))throw new Error("Failed to create payment instrument");let m,f=await this.fetchStoreConfig();if((a=f==null?void 0:f.computed)!=null&&a.threedsEnabled)try{m=(await this.createThreedsSession(p)).id}catch(y){}return await this.processAndHandle(e,p.id,m)}catch(p){let m=p instanceof Error?p.message:String(p);return(c=(l=this.callbacks).onError)==null||c.call(l,m),(u=(d=this.callbacks).onProcessing)==null||u.call(d,!1),{success:!1,error:m}}}async processApplePayPayment(e,n){var r,s,i,o,a,l,c,d;(s=(r=this.callbacks).onProcessing)==null||s.call(r,!0),(o=(i=this.callbacks).onError)==null||o.call(i,null);try{let u=await this.createApplePayPaymentInstrument(n);return await this.processAndHandle(e,u.id)}catch(u){let p=u instanceof Error?u.message:String(u);return(l=(a=this.callbacks).onError)==null||l.call(a,p),(d=(c=this.callbacks).onProcessing)==null||d.call(c,!1),{success:!1,error:p}}}async processGooglePayPayment(e,n){var r,s,i,o,a,l,c,d;(s=(r=this.callbacks).onProcessing)==null||s.call(r,!0),(o=(i=this.callbacks).onError)==null||o.call(i,null);try{let u=await this.createGooglePayPaymentInstrument(n);return await this.processAndHandle(e,u.id)}catch(u){let p=u instanceof Error?u.message:String(u);return(l=(a=this.callbacks).onError)==null||l.call(a,p),(d=(c=this.callbacks).onProcessing)==null||d.call(c,!1),{success:!1,error:p}}}async processPaymentWithInstrument(e,n){var r,s,i,o,a,l,c,d;(s=(r=this.callbacks).onProcessing)==null||s.call(r,!0),(o=(i=this.callbacks).onError)==null||o.call(i,null);try{return await this.processAndHandle(e,n)}catch(u){let p=u instanceof Error?u.message:String(u);return(l=(a=this.callbacks).onError)==null||l.call(a,p),(d=(c=this.callbacks).onProcessing)==null||d.call(c,!1),{success:!1,error:p}}}async processApmPayment(e,n){var r,s,i,o,a,l,c,d;(s=(r=this.callbacks).onProcessing)==null||s.call(r,!0),(o=(i=this.callbacks).onError)==null||o.call(i,null);try{return await this.processAndHandle(e,"",void 0,{processorId:n.processorId,paymentMethod:n.paymentMethod,initiatedBy:n.initiatedBy,source:n.source})}catch(u){let p=u instanceof Error?u.message:String(u);return(l=(a=this.callbacks).onError)==null||l.call(a,p),(d=(c=this.callbacks).onProcessing)==null||d.call(c,!1),{success:!1,error:p}}}};Ve();var Bl="1.0.0";function Ml(t){return typeof window=="undefined"?null:new URLSearchParams(window.location.search).get(t)}function G(t,...e){t&&console.log("[TagadaTracker]",...e)}function Ul(...t){console.warn("[TagadaTracker]",...t)}function dh(t){if(!t.storeId||typeof t.storeId!="string")throw new Error("TagadaTracker: storeId is required and must be a non-empty string.");if(!t.accountId||typeof t.accountId!="string")throw new Error("TagadaTracker: accountId is required and must be a non-empty string.");if(!t.stepId||typeof t.stepId!="string")throw new Error("TagadaTracker: stepId is required and must be a non-empty string.");if(t.apiBaseUrl)try{new URL(t.apiBaseUrl)}catch(e){throw new Error('TagadaTracker: apiBaseUrl is not a valid URL: "'.concat(t.apiBaseUrl,'"'))}}async function fh(t,e,n){let r;for(let s=0;s<=e;s++)try{return await t()}catch(i){if(r=i instanceof Error?i:new Error(String(i)),s<e){let o=Math.min(1e3*2**s,8e3);G(n,"Retry ".concat(s+1,"/").concat(e," in ").concat(o,"ms...")),await new Promise(a=>setTimeout(a,o))}}throw r}var Wt=class{constructor(){this.config=null;this.client=null;this.initialized=!1;this.initializing=!1;this.unsubscribe=null;this.version=Bl}async init(e){var r,s;if(this.initialized)return G(e.debug||!1,"Already initialized \u2014 returning existing session."),this.getSession();if(this.initializing)return G(e.debug||!1,"Initialization in progress \u2014 skipping duplicate call."),null;this.initializing=!0,this.config=b({debug:!1},e);let n=this.config.debug;try{dh(this.config)}catch(i){this.initializing=!1;let o=i instanceof Error?i:new Error(String(i));if(this.config.onError)return this.config.onError(o),null;throw o}G(n,"\u{1F680} Initializing external tracker v".concat(Bl),{storeId:e.storeId,accountId:e.accountId,stepId:e.stepId,funnelId:e.funnelId});try{let i=Ml("token");i&&(re(i),G(n,"\u{1F511} Bootstrapped token from URL")),this.client=Ri({debugMode:n,features:{funnel:{skipAutoInit:!0}},rawPluginConfig:{storeId:this.config.storeId,accountId:this.config.accountId},customApiConfig:this.config.apiBaseUrl?{apiConfig:{baseUrl:this.config.apiBaseUrl.trim()}}:void 0}),await this.waitForClientReady();let o=await fh(()=>this.initializeFunnel(),2,n);G(n,"\u2705 Session initialized:",o),this.initialized=!0;let a=this.getSession();return a&&((s=(r=this.config).onReady)==null||s.call(r,a)),a}catch(i){let o=i instanceof Error?i:new Error(String(i));if(G(n,"\u274C Initialization failed:",o),this.config.onError)return this.config.onError(o),null;throw o}finally{this.initializing=!1}}getSession(){var n,r;if(!((r=(n=this.client)==null?void 0:n.funnel)!=null&&r.state.context))return null;let e=this.client.funnel.state.context;return{sessionId:e.sessionId,customerId:e.customerId,storeId:e.storeId,funnelId:e.funnelId,currentStepId:e.currentStepId,cmsToken:this.client.state.token||void 0}}isReady(){var e,n;return this.initialized&&!!((n=(e=this.client)==null?void 0:e.funnel)!=null&&n.state.context)}async navigate(e){if(!this.isReady())throw new Error("TagadaTracker: not initialized. Call init() first.");G(this.config.debug,"\u{1F680} Navigating:",e);let n=e.autoRedirect!==!1;try{let r=await this.client.funnel.navigate({type:e.eventType,data:e.eventData||{}},{autoRedirect:!1});return r!=null&&r.url?(G(this.config.debug,"\u2705 Navigation result:",r.url),n&&typeof window!="undefined"&&(window.location.href=e.returnUrl||r.url),{url:r.url}):null}catch(r){throw G(this.config.debug,"\u274C Navigation failed:",r),r}}async trackEvent(e){if(!this.isReady()){Ul("trackEvent called before init \u2014 event dropped:",e.name);return}G(this.config.debug,"\u{1F4CA} Tracking event:",e.name,e.data);try{await this.client.funnel.navigate({type:e.name,data:e.data||{}},{autoRedirect:!1})}catch(n){G(this.config.debug,"\u26A0\uFE0F Event tracking failed (non-critical):",e.name)}}getCustomerId(){var e,n,r,s,i;return((n=(e=this.client)==null?void 0:e.state.auth.customer)==null?void 0:n.id)||((i=(s=(r=this.client)==null?void 0:r.funnel)==null?void 0:s.state.context)==null?void 0:i.customerId)||null}getFunnelSessionId(){var e,n,r;return((r=(n=(e=this.client)==null?void 0:e.funnel)==null?void 0:n.state.context)==null?void 0:r.sessionId)||null}buildUrl(e,n){let r=this.getSession();if(!r)return e;let s=new URL(e,typeof window!="undefined"?window.location.origin:void 0);return s.searchParams.set("funnelSessionId",r.sessionId),r.cmsToken&&s.searchParams.set("token",r.cmsToken),r.funnelId&&s.searchParams.set("funnelId",r.funnelId),s.searchParams.set("storeId",r.storeId),n&&Object.entries(n).forEach(([i,o])=>{s.searchParams.set(i,o)}),s.toString()}getClient(){return this.client}async reset(e){var s,i;if(!this.client||!this.config)throw new Error("TagadaTracker: not initialized. Call init() first.");G(this.config.debug,"\u{1F504} Resetting to step:",e),this.config.stepId=e;let n=await this.initializeFunnel(),r=this.getSession();return r&&((i=(s=this.config).onReady)==null||i.call(s,r)),r}destroy(){var e,n;this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null),this.client&&((n=(e=this.client).destroy)==null||n.call(e)),this.client=null,this.config=null,this.initialized=!1,this.initializing=!1,G(!1,"\u{1F5D1}\uFE0F Tracker destroyed")}async waitForClientReady(){if(this.client)return new Promise(e=>{var s;if((s=this.client)!=null&&s.state.isInitialized){e();return}let n=!1,r=setTimeout(()=>{var i;n||(n=!0,G(((i=this.config)==null?void 0:i.debug)||!1,"\u23F1\uFE0F Client ready timeout \u2014 proceeding"),e())},1e4);this.unsubscribe=this.client.subscribe(()=>{var i;!n&&((i=this.client)!=null&&i.state.isInitialized)&&(n=!0,clearTimeout(r),e())})})}async initializeFunnel(){var o,a,l;if(!((o=this.client)!=null&&o.funnel))return null;let e=(a=this.client.state.auth.customer)==null?void 0:a.id,n=(l=this.client.state.auth.session)==null?void 0:l.sessionId;!e&&!n&&Ul("No auth session available \u2014 funnel init may fail.");let r={customerId:e||"anon_placeholder",sessionId:n||"sess_placeholder"},s={id:this.config.storeId,accountId:this.config.accountId},i=this.config.stepId;return G(this.config.debug,"\u{1F50D} Initializing funnel at step:",i),this.client.funnel.initialize(r,s,this.config.funnelId||Ml("funnelId")||void 0,i)}},Pi=new Wt;typeof window!="undefined"&&(window.TagadaTracker=Pi);function ph(){if(typeof window=="undefined"||typeof document=="undefined")return[];let t=ie();return t!=null&&t.scripts?t.scripts.filter(e=>e.enabled):[]}function gh(t,e){let n=t.position||"body-end",r="tagada-stepconfig-script-".concat(e);if(document.getElementById(r))return;let s=t.content.trim(),i=s.match(/^<script[^>]*>([\s\S]*)<\/script>$/i);if(i&&(s=i[1].trim()),!s)return;let o="(function() {\n try {\n // Script: "+t.name+"\n"+s+'\n } catch (error) {\n console.error("[TagadaPay] StepConfig script error:", error);\n }\n})();',a=document.createElement("script");switch(a.id=r,a.setAttribute("data-tagada-stepconfig-script","true"),a.setAttribute("data-script-name",t.name),a.textContent=o,n){case"head-start":document.head.firstChild?document.head.insertBefore(a,document.head.firstChild):document.head.appendChild(a);break;case"head-end":document.head.appendChild(a);break;case"body-start":document.body.firstChild?document.body.insertBefore(a,document.body.firstChild):document.body.appendChild(a);break;case"body-end":default:document.body.appendChild(a);break}}function _i(){let t=ph();t.length!==0&&t.forEach((e,n)=>{gh(e,n)})}if(typeof window!="undefined"&&typeof document!="undefined"){let t=()=>{document.body?_i():document.addEventListener("DOMContentLoaded",_i,{once:!0})};"requestIdleCallback"in window?window.requestIdleCallback(t,{timeout:100}):setTimeout(t,0)}function Ri(t={}){return new Ot(t)}function mh(){return Dt()}function hh(){return po()}return Pr(yh);})();
|
|
8
8
|
/*! Bundled license information:
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
(*!
|
|
12
|
-
Determine whether a user is from the European Union (EU) area
|
|
13
|
-
https://github.com/faisalman/detect-europe-js
|
|
14
|
-
Author: Faisal Salman <f@faisalman.com>
|
|
15
|
-
MIT License *)
|
|
16
|
-
|
|
17
|
-
ua-is-frozen/dist/esm/index.js:
|
|
18
|
-
(*! isFrozenUA
|
|
19
|
-
A freeze-test for your user-agent string
|
|
20
|
-
https://github.com/faisalman/ua-is-frozen
|
|
21
|
-
Author: Faisal Salman <f@faisalman.com>
|
|
22
|
-
MIT License *)
|
|
23
|
-
|
|
24
|
-
is-standalone-pwa/dist/esm/index.js:
|
|
25
|
-
(*! isStandalonePWA 0.1.1
|
|
26
|
-
Detect if PWA is running in standalone mode
|
|
27
|
-
https://github.com/faisalman/is-standalone-pwa
|
|
28
|
-
Author: Faisal Salman <f@faisalman.com>
|
|
29
|
-
MIT License *)
|
|
10
|
+
axios/dist/browser/axios.cjs:
|
|
11
|
+
(*! Axios v1.13.2 Copyright (c) 2025 Matt Zabriskie and contributors *)
|
|
30
12
|
*/
|
|
31
13
|
// Expose SDK under window.tgd namespace (clean, single global)
|
|
32
14
|
if (typeof window !== 'undefined' && TagadaSDKBundle) {
|