var e,t,n,r,o,i,a,s,c,u,l,f,d={},h=[],p=/^m(i|n|o|s|text|space)$/,m=Array.isArray,_=h.slice,v=Object.assign;function y(e){e&&e.parentNode&&e.remove()}function g(e,t,n){var r,o,i,a={},s=arguments.length;for(i in t)"key"==i?r=t[i]:"ref"==i&&"function"!=typeof e?o=t[i]:a[i]=t[i];return s>2&&(a.children=s>3?_.call(arguments,2):n),b(e,a,r,o,null)}function w(e,t,n){var r,o,i,a=v({},e.props),s=arguments.length;for(i in t)"key"==i?r=t[i]:"ref"==i&&"function"!=typeof e.type?o=t[i]:a[i]=t[i];return s>2&&(a.children=s>3?_.call(arguments,2):n),b(e.type,a,void 0!==r?r:e.key,void 0!==o?o:e.ref,null)}function b(n,r,o,i,a){var s={type:n,props:r,key:o,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a||++t,__i:-1,__u:0};return!a&&e.vnode&&e.vnode(s),s}function E(){return{current:null}}function S(e){return e.children}function k(e,t){this.props=e,this.context=t,this.__g=0}function x(e,t){if(null==t)return e.__?x(e.__,e.__i+1):null;for(var n;tn&&r.sort(a),t=r.shift(),n=r.length,8&t.__g&&(s=void 0,c=void 0,u=(c=(o=t).__v).__e,l=[],f=[],(d=o.__P)&&((s=v({constructor:void 0},c)).__v=c.__v+1,e.vnode&&e.vnode(s),L(d,s,c,o.__n,d.namespaceURI,32&c.__u?[u]:null,l,u||x(c),32&c.__u,f),s.__v=c.__v,s.__.__k[s.__i]=s,I(l,s,f),c.__=c.__e=null,s.__e!=u&&C(s)))}finally{r.length=i=0}}function $(e,t,n,r,o,i,a,s,c,u,l){var f,p,_,v,y,g,w=r.__k||h,E=t.length;for(c=function(e,t,n,r,o){var i,a,s,c,u,l,f,d,h,p,_=n.length,v=_,y=0,g=!1,w=e.__k=Array(o);for(i=0;ic?y--:y++,g=!0)):(~u||(o>_?y--:o<_&&y++),"function"!=typeof a.type&&(a.__u|=4))):w[i]=null;if(g){for(l=[],f=[],i=0;i>1](l?1:0))for(o=n-1,i=n+1;o>=0||i=0?o--:i++])&&!(2&u.__u)&&s==u.key&&c==u.type)return a;return-1}function O(e,t,n){null==n&&(n=""),"-"==t[0]?e.setProperty(t,n):e[t]=n}function R(t,n,r,o,i){var a,f;e:if("style"==n)if("string"==typeof r)t.style.cssText=r;else{if("string"==typeof o&&(t.style.cssText=o=""),o)for(n in o)r&&n in r||O(t.style,n,"");if(r)for(n in r)o&&r[n]==o[n]||O(t.style,n,r[n])}else if("o"==n[0]&&"n"==n[1])(t.__e||(t.__e={}))[n]=r,r&&o||(f=l[n]||(l[n]=function(t){return function(n){if(this.__e){var r=this.__e[t];if(null==n[s])n[s]=u++;else if(n[s]=n.__.length&&n.__.push({}),n.__[e]}function se(e){return Z=1,ce(Ce,e)}function ce(e,t,n){var r=ae(K++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ce(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);V(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=z,!z.__f)){z.__f=!0;var o=z.shouldComponentUpdate;z.shouldComponentUpdate=function(e,t,n){var r=this.__H;if(!r)return!0;var i=!1,a=this.props!=e;if(r.__.some(function(e){e.__N&&(i=!0,V(e.__[0],e.__N[0])||(a=!0))}),o){var s=o.call(this,e,t,n);return i?s||a:s}return!i||a}}return r.__}function ue(e,t){var n=ae(K++,3);!Y.__s&&xe(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,z.__H.__h.push(n))}function le(e,t){var n=ae(K++,4);!Y.__s&&xe(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,z.__h.push(n))}function fe(e){return Z=5,he(function(){return{current:e}},[])}function de(e,t,n){Z=6,le(function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}},null==n?n:n.concat(e))}function he(e,t){var n=ae(K++,7);return xe(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function pe(e,t){return Z=8,he(function(){return e},t)}function me(e){var t=z.context[e.__c],n=ae(K++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(z)),t.props.value):e.__}function _e(e,t){Y.useDebugValue&&Y.useDebugValue(t?t(e):e)}function ve(e){var t=ae(K++,10),n=se();return t.__=e,z.componentDidCatch||(z.componentDidCatch=function(e,r){t.__&&t.__(e,r),n[1](e)}),[n[0],function(){n[1](void 0)}]}function ye(){var e=ae(K++,11);if(!e.__){for(var t=z.__v;!t.__m&&t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function ge(){var e;do{for(;e=Q.shift();)try{Se(e)}catch(n){Y.__e(n,{__:(e=e.__P)&&e.__v})}for(;e=X.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Se),t.__h.some(ke),t.__h=[]}catch(r){t.__h=[],Y.__e(r,e.__v)}}}while(Q.length)}Y.__b=function(e){z=null,ee&&ee(e)},Y.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ie&&ie(e,t)},Y.__r=function(e){te&&te(e),K=0;var t=(z=e.__c).__H;t&&(G==z?z.__h=[]:(t.__h.some(Se),t.__h.some(ke),K=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),G=z},Y.diffed=function(e){ne&&ne(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&Ee(X.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),G=z=null},Y.__c=function(e,t){t.some(function(e){try{e.__h.some(Se),e.__h=e.__h.filter(function(e){return!e.__||ke(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],Y.__e(n,e.__v)}}),re&&re(e,t)},Y.unmount=function(e){oe&&oe(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(void 0===n){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n=n&&n.__c}r.__P=n,Ee(Q.push(r))}else Se(r)}catch(o){t=o}}),r.__H=void 0,t&&Y.__e(t,r.__v))};var we="function"==typeof requestAnimationFrame;function be(e){var t,n=function(){clearTimeout(r),we&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);we&&(t=requestAnimationFrame(n))}function Ee(e){1!=e&&J==Y.requestAnimationFrame||((J=Y.requestAnimationFrame)||be)(ge)}function Se(e){var t=z,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),z=t}function ke(e){var t=z;e.__c=e.__(),z=t}function xe(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!V(t,e[n])})}function Ce(e,t){return"function"==typeof t?t(e):t}var Pe=Symbol.for("preact-signals");function Ae(){if(Re>1)Re--;else{var e,t=!1;for(function(){var e=De;for(De=void 0;void 0!==e;){var t=e.S;if(t.v===e.v)for(var n=t.t;void 0!==n;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}}();void 0!==Oe;){var n=Oe;for(Oe=void 0,Le++;void 0!==n;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&He(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(Le=0,Re--,t)throw e}}function $e(e){if(Re>0)return e();Ie=++Ue,Re++;try{return e()}finally{Ae()}}var Te,Ne=void 0;function Me(e){var t=Ne,n=Te;Ne=void 0,Te=void 0;try{return e()}finally{Ne=t,Te=n}}var Oe=void 0,Re=0,Le=0,Ue=0,Ie=0,De=void 0,je=0;function Fe(e){if(void 0!==Ne){var t=e.n;if(void 0===t||t.t!==Ne)return t={i:0,S:e,p:Ne.s,n:void 0,t:Ne,e:void 0,x:void 0,r:t},void 0!==Ne.s&&(Ne.s.n=t),Ne.s=t,e.n=t,32&Ne.f&&e.S(t),t;if(-1===t.i)return t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=Ne.s,t.n=void 0,Ne.s.n=t,Ne.s=t),t}}function Be(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function qe(e,t){return new Be(e,t)}function He(e){for(var t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function We(e){for(var t=e.s;void 0!==t;t=t.n){var n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function Ke(e){for(var t=e.s,n=void 0;void 0!==t;){var r=t.p;-1===t.i?(t.S.U(t),void 0!==r&&(r.n=t.n),void 0!==t.n&&(t.n.p=r)):n=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=r}e.s=n}function ze(e,t){Be.call(this,void 0,t),this.x=e,this.s=void 0,this.g=je-1,this.f=4}function Ge(e,t){return new ze(e,t)}function Je(e){var t=e.m;if(e.m=void 0,"function"==typeof t){Re++;var n=Ne;Ne=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,Ve(e),r}finally{Ne=n,Ae()}}}function Ve(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Je(e)}function Ze(e){if(Ne!==this)throw new Error("Out-of-order effect");Ke(this),Ne=e,this.f&=-2,8&this.f&&Ve(this),Ae()}function Xe(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=null==t?void 0:t.name,Te&&Te.push(this)}function Qe(e,t){var n=new Xe(e,t);try{n.c()}catch(o){throw n.d(),o}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}function Ye(e){return function(){var t=arguments,n=this;return $e(function(){return Me(function(){return e.apply(n,[].slice.call(t))})})}}Be.prototype.brand=Pe,Be.prototype.h=function(){return!0},Be.prototype.S=function(e){var t=this,n=this.t;n!==e&&void 0===e.e&&(e.x=n,this.t=e,void 0!==n?n.e=e:Me(function(){var e;null==(e=t.W)||e.call(t)}))},Be.prototype.U=function(e){var t=this;if(void 0!==this.t){var n=e.e,r=e.x;void 0!==n&&(n.x=r,e.e=void 0),void 0!==r&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,void 0===r&&Me(function(){var e;null==(e=t.Z)||e.call(t)}))}},Be.prototype.subscribe=function(e){var t=this;return Qe(function(){var n=t.value;Me(function(){return e(n)})},{name:"sub"})},Be.prototype.valueOf=function(){return this.value},Be.prototype.toString=function(){return this.value+""},Be.prototype.toJSON=function(){return this.value},Be.prototype.peek=function(){var e=this;return Me(function(){return e.value})},Object.defineProperty(Be.prototype,"value",{get:function(){var e=Fe(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Le>100)throw new Error("Cycle detected");n=this,0!==Re&&0===Le&&n.l!==Ie&&(n.l=Ie,De={S:n,v:n.v,i:n.i,o:De}),this.v=e,this.i++,je++,Re++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{Ae()}}var n}}),ze.prototype=new Be,ze.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===je)return!0;if(this.g=je,this.f|=1,this.i>0&&!He(this))return this.f&=-2,!0;var e=Ne;try{We(this),Ne=this;var t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return Ne=e,Ke(this),this.f&=-2,!0},ze.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}Be.prototype.S.call(this,e)},ze.prototype.U=function(e){if(void 0!==this.t&&(Be.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}},ze.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(ze.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Fe(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Xe.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.m=t)}finally{e()}},Xe.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Je(this),We(this),Re++;var e=Ne;return Ne=this,Ze.bind(this,e)},Xe.prototype.N=function(){2&this.f||(this.f|=2,this.u=Oe,Oe=this)},Xe.prototype.d=function(){this.f|=8,1&this.f||Ve(this)},Xe.prototype.dispose=function(){this.d()};var et=function(e){for(var t in e){var n=e[t];"function"==typeof n?e[t]=Ye(n):"object"!=typeof n||null===n||"brand"in n||et(n)}};function tt(e){return function(){var t,n,r=function(){var e=Te;return Te=[],function(){var t=Te;return Te&&e&&(e=e.concat(Te)),Te=e,t}}();try{n=e.apply(void 0,[].slice.call(arguments))}catch(o){throw Te=void 0,o}finally{t=r()}return et(n),n[Symbol.dispose]=Ye(function(){if(t)for(var e=0;e"undefined"==typeof window,St=()=>"undefined"!=typeof __CtaTestEnv__&&"true"===__CtaTestEnv__;class kt{}kt.warn=e=>{St()||console.warn(e)},kt.error=e=>{St()||console.error(e)},kt.info=e=>{St()||console.info(e)},kt.debug=e=>{St()||console.debug(e)},kt.trace=e=>{St()||console.trace(e)};const xt=kt;function Ct(e,t){if(null===e)return"null";if(Array.isArray(e))return`[${e.map(e=>Ct(e,!0)).join(",")}]`;if("object"==typeof e){let n=[];for(const t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&n.push(`${t}:${Ct(e[t],!0)}`);const r=n.join(",");return t?`{${r}}`:r}return"string"==typeof e?JSON.stringify(e):`${e}`}function Pt(e,...t){if(0===t.length)return e;const n=t[0];return e[n]||(e[n]={}),Pt(e[n],...t.slice(1))}function At(e){try{return decodeURIComponent(e)}catch(t){return""}}function $t(){if(!Et())return window}function Tt(){return!Et()&&Boolean($t()?.Shopify?.theme)}function Nt(){return!Et()&&Boolean($t()?.__CUSTOMER_ACCOUNT__)}function Mt(){try{return"undefined"!=typeof PerformanceServerTiming}catch{return!1}}class Ot extends TypeError{constructor(e){super(e),this.name="ConsentValidationError",Object.setPrototypeOf(this,Ot.prototype)}}const Rt={TRACKING_ACCEPTED:"trackingConsentAccepted",TRACKING_DECLINED:"trackingConsentDeclined",MARKETING_ACCEPTED:"firstPartyMarketingConsentAccepted",SALE_OF_DATA_ACCEPTED:"thirdPartyMarketingConsentAccepted",ANALYTICS_ACCEPTED:"analyticsConsentAccepted",PREFERENCES_ACCEPTED:"preferencesConsentAccepted",MARKETING_DECLINED:"firstPartyMarketingConsentDeclined",SALE_OF_DATA_DECLINED:"thirdPartyMarketingConsentDeclined",ANALYTICS_DECLINED:"analyticsConsentDeclined",PREFERENCES_DECLINED:"preferencesConsentDeclined",CONSENT_COLLECTED:"visitorConsentCollected"},Lt="p",Ut="a",It="m",Dt="t",jt="m",Ft="a",Bt="p",qt="s",Ht="marketing",Wt="analytics",Kt="preferences",zt="sale_of_data",Gt=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Jt(e,t){if("string"!=typeof e)return;if(!function(e){return!!e&&Gt.test(e.trim().toLowerCase())}(e))return;const n=e.trim();if("00000000-0000-0000-0000-000000000000"===n)return;if("00000000-0000-0000-5000-000000000000"===n)return;const r=null==t||"string"==typeof t&&""===t.trim()?NaN:Number(t);return Number.isFinite(r)&&Date.now()>r?void 0:n}const Vt="_tracking_consent";function Zt(){try{return document.cookie}catch{return!1}}function Xt(e){return e===encodeURIComponent(At(e))}function Qt(e,t,n,r){if(!Xt(r))throw new TypeError("Cookie value is not correctly URI encoded.");if(!Xt(e))throw new TypeError("Cookie name is not correctly URI encoded.");let o=`${e}=${r}`;o+="; path=/",t&&(o+=`; domain=${t}`),o+=`; expires=${new Date((new Date).getTime()+n).toUTCString()}`,document.cookie=o}const Yt=["_shopify_y","_shopify_s",Vt];let en=class e{constructor(){if(e.instance)return e.instance;e.instance=this}produce(e,t){if(!Et())try{const n={schema_id:"customer_privacy_api_events/2.0",payload:{shop_domain:window.location.host,method_name:e,call_details:t||null}},r={accept:"*/*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8","content-type":"application/json; charset=utf-8","x-monorail-edge-event-created-at-ms":String(Date.now()),"x-monorail-edge-event-sent-at-ms":String(Date.now())};if(!window.location.host.endsWith("spin.dev"))return fetch("https://monorail-edge.shopifysvc.com/v1/produce",{headers:r,body:JSON.stringify(n),method:"POST",mode:"cors",credentials:"omit"}).catch(()=>{});console.log("Monorail event from consent API:",r,n)}catch(n){}}};function tn(){return Et()?{}:window.Shopify?.customerPrivacy?.config||{}}en.instance=void 0;const nn=/^https?:\/\/([^/]+)(\/api\/(?:unstable|2\d{3}-\d{2})\/graphql\.json(?=$|\?))?/;function rn(e,t){if("fetch"!==e.initiatorType)return!1;const n=e.name.match(nn);if(!n)return!1;const[,r,o]=n;return r===t||!!o&&!!r?.endsWith(`.${t}`)}const on="_cmp",an="consentHeader";function sn(e){if(!Et()){try{e=decodeURIComponent(e)}catch{}try{sessionStorage.setItem(an,e)}catch{}}}function cn(e){try{return e()}catch{return}}function un(e=on){if(!hn()&&!function(){try{const e=performance.getEntriesByType("navigation")[0].serverTiming;return!!e&&0!=e.length}catch{return!1}}()){const e=new en;let t="failed_to_fetch";try{t=navigator.userAgent}catch{}e.produce("navigationServerTiming",JSON.stringify({failed:!0,userAgent:t,apiSupported:Mt()})),hn()||(Pt($t(),"Shopify","customerPrivacy").serverTimingSupportVerified=!0)}const t=performance?.getEntriesByType?.("navigation");if(!t)return;const n=t.map(t=>fn(t,e)).find(e=>e);return n&&e===on&&sn(n),n}const ln={};function fn(e,t=on){if(e)return e.serverTiming?.find(e=>e.name==t)?.description}function dn(){const e=$t();return!0===e?.Shopify?.customerPrivacy?.backendConsentEnabled||!0===tn().asyncVisitorState}function hn(){const e=$t();return e?.Shopify?.customerPrivacy?.serverTimingSupportVerified}let pn;function mn(){if(Et())return pn;{const e=window.Shopify?.customerPrivacy?.injectedConsent||tn().injectedConsent;return e?At(e):void 0}}function _n(e,t){if(!Et())try{document.dispatchEvent(new CustomEvent(e,{detail:t||{}}))}catch(n){console.error(`[Shopify Customer Privacy] Error in event listener for "${e}":`,n)}}function vn(e){!function(e){const t=function(){if(!Et())return window.Shopify?.customerPrivacy}();t&&(t.consentStatus=e)}("loaded");const t=e[It],n=e[Dt],r=e[Ut],o=e[Lt];!0===t?_n(Rt.MARKETING_ACCEPTED):!1===t&&_n(Rt.MARKETING_DECLINED),!0===n?_n(Rt.SALE_OF_DATA_ACCEPTED):!1===n&&_n(Rt.SALE_OF_DATA_DECLINED),!0===r?_n(Rt.ANALYTICS_ACCEPTED):!1===r&&_n(Rt.ANALYTICS_DECLINED),!0===o?_n(Rt.PREFERENCES_ACCEPTED):!1===o&&_n(Rt.PREFERENCES_DECLINED);const i=function(e){return{marketingAllowed:e[It],saleOfDataAllowed:e[Dt],analyticsAllowed:e[Ut],preferencesAllowed:e[Lt],firstPartyMarketingAllowed:e[It],thirdPartyMarketingAllowed:e[Dt]}}(e);_n(Rt.CONSENT_COLLECTED,i);const a=[r,o,t,n];a.every(e=>!0===e)&&_n(Rt.TRACKING_ACCEPTED),a.every(e=>!1===e)&&_n(Rt.TRACKING_DECLINED)}function yn(e){!function(e){Et()?pn=e:Pt(window,"Shopify","customerPrivacy").injectedConsent=e}(e),Et()||(window.Shopify?.customerPrivacy?.cachedConsent&&(window.Shopify.customerPrivacy.cachedConsent=void 0),vn({[Lt]:Pn(),[Ut]:An(),[It]:$n(),[Dt]:Tn()}))}function gn(){let e;if(e=Et()?mn():function(){const e=window.Shopify?.customerPrivacy?.cachedConsent;return e?At(e):void 0}()||mn()||new URLSearchParams(window.location.search).get("_cs")||function(e){const t=Zt()?document.cookie.split("; "):[];for(let n=0;nun(e)):cn(()=>function(e=on){if(Et())return;const t=performance?.getEntriesByType?.("resource"),n=window.location.host;let r=ln[e];for(let o=t.length-1;o>=0;o--){const i=t[o];if(!rn(i,n))continue;const a=fn(i,e);if(a){r=a;break}}return ln[e]=r,r}(e))||cn(()=>un(e)),!t){if(e!==on)return;let t;try{t=sessionStorage.getItem(an)}catch{}return t||void 0}try{t=decodeURIComponent(t)}catch{}return t}(),void 0!==e)return En(e)}function wn(){try{let e=gn();if(!e)return;return e}catch{return}}function bn(e=null){return null===e&&(e=wn()),void 0===e}function En(e){if("%"==e.slice(0,1))try{e=decodeURIComponent(e)}catch{}const t=e.slice(0,1);return"{"==t?function(e){let t;try{t=JSON.parse(e)}catch{return}if("2.1"===t.v&&t.con?.CMP)return t}(e):"3"==t?function(e){const t=e.slice(1).split("_"),[n,r,o,i,a]=t;let s,c;try{s=t[5]?JSON.parse(t.slice(5).join("_")):void 0}catch{}if(a){const e=a.replace(/\*/g,"/").replace(/-/g,"+"),t=atob(e);let n="";for(let r=0;re.slice(0,t)+"-"+e.slice(t),n)}function u(e){const t=n.split(".")[0];return t.includes(e.toLowerCase())?"0":t.includes(e.toUpperCase())?"1":""}function l(e){return n.includes(e.replace("t","s").toUpperCase())}return{v:"3",con:{CMP:{[Ft]:u(Ft),[Bt]:u(Bt),[jt]:u(jt),[qt]:u(qt)}},region:r||"",cus:s,purposes:{[Ut]:l(Ut),[Lt]:l(Lt),[It]:l(It),[Dt]:l(Dt)},sale_of_data_region:"t"==i,display_banner:"t"==o,consent_id:c}}(e):void 0}function Sn(e){switch(e){case"1":return"yes";case"0":return"no";default:return""}}function kn(e){switch(e){case Ft:return Wt;case jt:return Ht;case Bt:return Kt;case qt:return zt}}function xn(e){const t=wn();if(!t)return"";const n=t.con.CMP;return n?n[e]:""}function Cn(e){const t=wn();if(!t||!t.purposes)return!0;const n=t.purposes[e];return"boolean"!=typeof n||n}function Pn(){return Cn(Lt)}function An(){return Cn(Ut)}function $n(){return Cn(It)}function Tn(){return Cn(Dt)}function Nn(){const e=wn();return!!e&&"boolean"==typeof e.display_banner&&e.display_banner}function Mn(){const e=wn();return e&&e.sale_of_data_region||!1}function On(e,t){const n=$t();if(!n)return;const r=Pt(n,"Shopify","customerPrivacy","cachedToken");if(t){const n="_shopify_s"===e?18e5:31536e6;r[e]=t,r[e+"_expires_at"]=Date.now()+n}else delete r[e],delete r[e+"_expires_at"]}function Rn(e){return`${e.origin}${t=e.pathname,t.replace(/\/$/,"")}`;var t}function Ln(e){return e.startsWith("http://")||e.startsWith("https://")}const Un="Shopify-Storefront-Consent-Management";function In(e){return""===e?void 0:e}function Dn(e){const t=e.granular_consent;return{query:`query { consentManagement { cookies(${Ct({visitorConsent:{marketing:In(t.marketing),analytics:In(t.analytics),preferences:In(t.preferences),saleOfData:In(t.sale_of_data),...t.metafields&&{metafields:t.metafields}},...t.email&&{visitorEmail:t.email},origReferrer:In(e.referrer),landingPage:In(e.landing_page)})}) { trackingConsentCookie cookieDomain landingPageCookie origReferrerCookie shopifyUnique shopifyVisit } customerAccountUrl } }`,variables:{}}}let jn;function Fn(e,t,n,r={}){const o=tn().consentDomain||t.granular_consent.checkoutRootDomain||window.location.host,i=()=>function(e,t,n,r){const o=t.granular_consent;let i="",a={};if(o.customerAccountRequestInfo)i=o.customerAccountRequestInfo.url,a=o.customerAccountRequestInfo.headers;else{const t=tn(),r=o.storefrontAccessToken||t.storefrontAccessToken||function(){if(!0!==tn().isHeadless)try{const e=document.documentElement.querySelector("#shopify-features"),t="Could not find liquid access token";if(!e)return void xt.warn(t);const n=e.textContent;if(!n)return void xt.warn(t);let r;try{r=JSON.parse(n).accessToken}catch{return void xt.warn(t)}return r||void xt.warn(t)}catch{return void xt.warn("Could not find liquid access token")}}();i=`${/^(localhost|127\.0\.0\.1)(:|$)/.test(e)?"http:":"https:"}//${e}/api/unstable/graphql.json`;const s=o.isExtensionToken?"Shopify-Storefront-Extension-Token":"x-shopify-storefront-access-token";a=r?{[s]:r}:{},n&&(a={...a,...n()})}const s={headers:{"content-type":"application/json",...!0===tn().asyncConsent&&new URL(i).origin===window.location.origin&&{[Un]:"1"},...a,...St()?{"x-test-payload":JSON.stringify(t)}:{}},body:JSON.stringify(Dn(t)),method:"POST"};let c;try{c=fetch(i,s)}catch(u){c=Promise.reject(u)}return c.then(e=>{try{r?.(e)}catch{}if(e.ok)return e.json();{const t=new Error("Server error");throw t.cause={status:e.status},t}})}(o,t,r.getVisitorTokenHeaders,r.onResponse).then(e=>{const o=e?.data?.consentManagement;if(!o){const t=(e?.errors??[]).map(e=>e?.message).filter(Boolean).join("; ");throw new Error(t?`GraphQL error: ${t}`:"GraphQL response missing consentManagement")}const i=o.cookies.cookieDomain,a=o.cookies.trackingConsentCookie,s=o.cookies.shopifyUnique,c=o.cookies.shopifyVisit,u=o.customerAccountUrl??"";if(!0===tn().asyncConsent&&a&&!function(e){try{return void 0!==En(At(e))}catch{return!1}}(a))throw new Error("Consent response contains unreadable consent");var l,f,d;if(a&&(l=a,Pt(window,"Shopify","customerPrivacy").cachedConsent=l,!0!==tn().asyncConsent&&sn(a)),On("_shopify_y",s),On("_shopify_s",c),!0===tn().asyncConsent)e.errors?.length||!a||bn()||function(){if(Et()||!function(){const e=Zt();return!!e&&e.split(";").some(e=>Yt.includes(e.split("=")[0].trim()))}())return;const e=window.location.hostname.split("."),t=["",...e.map((t,n)=>e.slice(n).join("."))];for(const n of Yt)for(const e of t)try{Qt(n,e,-1,"")}catch{}}();else if(t.granular_consent.headlessStorefront&&!dn()){const e=31536e6,n=t.granular_consent,r=i||n.checkoutRootDomain||window.location.hostname,o=n.storefrontRootDomain||i||window.location.hostname;Qt(Vt,r,e,a),o!==r&&Qt(Vt,o,e,a)}return!1!==r.emitEvents&&(f=t,d={[Lt]:Pn(),[Ut]:An(),[It]:$n(),[Dt]:Tn()},void 0!==f.granular_consent&&vn(d)),function(e,t){if(!e)return;const n=function(e){const t=new URL(e,window.location.origin),n=Ln(e)?Rn(t):Rn(t).replace(window.location.origin,""),r=document.querySelectorAll(`a[href^="${n}"]`),o=document.querySelectorAll(`a[href*="${window.location.hostname}/customer_authentication"]`),i=new Set,a=[];for(let s=0;s{const t="Error while setting storefront API consent: "+e.message,r=e.cause?.status,o={error:t};if(void 0!==r&&(o.statusCode=r),void 0===n)throw o;n(o)});if(!0!==tn().asyncConsent)return i();const a=jn=jn?jn.then(i,i):i(),s=()=>{jn===a&&(jn=void 0)};return a.then(s,s),a}const Bn=[Ht,Wt,Kt,zt],qn=[...Bn,"email","rootDomain","checkoutRootDomain","storefrontRootDomain","storefrontAccessToken","headlessStorefront","isExtensionToken","metafields","customerAccountRequestInfo"],Hn=Bn.map(e=>`"${e}"`).join(", "),Wn="https://shopify.dev/docs/api/customer-privacy";function Kn(e,t){if(Et())throw new Error("setTrackingConsent is not supported in Node.js environments. This function requires browser APIs (XHR, cookies, window) and can only be called client-side.");const n=new en;if(An()&&n.produce("setTrackingConsent","v0.2"),function(e){if("boolean"!=typeof e&&"object"!=typeof e)throw new Ot(`setTrackingConsent received an invalid argument of type "${typeof e}". Expected an object with consent keys. Example: setTrackingConsent({ analytics: true, marketing: false }). See ${Wn} for documentation.`);if("object"==typeof e){const t=Object.keys(e);if(0===t.length)throw new Ot(`The submitted consent object is empty. Expected at least one consent key: ${Hn}. Example: setTrackingConsent({ analytics: true, marketing: false }). See ${Wn} for documentation.`);for(const e of t)if(!qn.includes(e))throw new Ot(`The submitted consent object contains an invalid key: "${e}". Valid keys are: ${Hn}. Example: setTrackingConsent({ analytics: true, marketing: false }). See ${Wn} for documentation.`)}}(e),void 0!==t&&"function"!=typeof t)throw new Ot(`setTrackingConsent received an invalid callback of type "${typeof t}". The second argument must be a function if provided. Example: setTrackingConsent({ analytics: true }, (error, result) => { ... }). See ${Wn} for documentation.`);const r=function(e){if(!e)return null;try{return Gn()?document.referrer:""}catch{return""}}(e.analytics),o=function(e){if(!e)return null;if(!Gn())return"/";try{return window.location.pathname+window.location.search}catch{return"/"}}(e.analytics);return Fn(0,{granular_consent:e,...null!==r&&{referrer:r},...null!==o&&{landing_page:o}},t)}function zn(){return function(){const e=wn();return bn(e)?"":e.region||""}()}function Gn(){try{if(""===document.referrer)return!0;const e=document.createElement("a");return e.href=document.referrer,window.location.hostname!=e.hostname}catch{return!0}}function Jn(){return function(){const e=wn();if(!bn(e)&&e.cus)return Object.entries(e.cus).map(([e,t])=>({key:decodeURIComponent(e),value:decodeURIComponent(t)}))}()}function Vn(){const e={},t={m:xn(jt),a:xn(Ft),p:xn(Bt),s:xn(qt)};for(const n of Object.keys(t))e[kn(n)]=Sn(t[n]);return e}async function Zn(e){try{if(Math.random()>.01)return;let t=null;if(e)try{const n=await e.json();t=Array.isArray(n?.errors)&&n.errors.length>0}catch{}(new en).produce("persistOutcome",JSON.stringify({ok:!!e?.ok,status:e?.status??null,graphqlErrors:t,sampleRate:.01}))}catch{}}function Xn(e,t){if(!Et())try{const r=Jt(e),o=Jt(t);if(!r&&!o)return;const i=function(){const e=document.querySelector('[data-serialized-id="app-base-path"]');if(Nt()||e){const t=document.querySelector('[data-serialized-id="preview-mode-data"]');if("/"!==JSON.parse(e?.textContent||"null")||!1!==JSON.parse(t?.textContent||"null")?.inPreviewMode)return;return new URL("/customer/api/unstable/graphql",window.location.origin).href}const{protocol:t,host:n}=function(){const e=tn().consentDomain||window.location.host;return{protocol:/^(localhost|127\.0\.0\.1)(:|$)/.test(e)?"http:":"https:",host:e}}();return`${t}//${n}/api/unstable/graphql.json`}();if(!i)return;const a=new URLSearchParams,s={"content-type":"application/json"};r&&(a.set("_y",r),s["X-Shopify-UniqueToken"]=r),o&&(a.set("_s",o),s["X-Shopify-VisitToken"]=o);const c=`${i}?${a.toString()}`;let u;try{u=fetch(c,{headers:s,body:JSON.stringify({query:"query { consentManagement { cookies(visitorConsent:{}) { cookieDomain } } }",variables:{}}),method:"POST",mode:"cors",credentials:"include"})}catch(n){u=Promise.reject(n)}u.then(e=>Zn(e),()=>Zn(void 0))}catch{}}function Qn(){return $n()}function Yn(){return An()}function er(){return Pn()}function tr(){return Tn()}!function(){try{if(Et()||Tt())return;if("function"!=typeof performance?.setResourceTimingBufferSize)return;if((performance.getEntriesByType?.("resource")?.length??0)>=1e3)return;performance.setResourceTimingBufferSize(1e3)}catch{}}();const nr="uc",rr=["ac","ah","ba","bin","cn","do","e","md","o","pc","sim",nr],or="(?[a-z]{2,3}|zh-hans|zh-hant)(?:-(?[a-zA-Z0-9]+))?",ir=new RegExp(`^${or}$`),ar=`/(?[a-zA-Z0-9=\\-_]+)(?:/(?${or}))?(?:/(?[^/]+))?`;function sr(e){return`(?${e.join("|")})${ar}`}const cr=sr(rr.filter(e=>e!==nr)),ur=sr([nr]),lr=new RegExp(`^/checkouts/${cr}/?$`),fr=new RegExp(`^/checkout/(?[0-9]+)/${cr}/?$`),dr=new RegExp(`^/checkouts/${ur}/?$`),hr=new RegExp("^/checkout/(?[0-9]+)/(?spe)(?:/(?[a-zA-Z0-9=\\-_]+)?)?(?:/(?[^/]+)?)?/?$");function pr(e,t){const n=function(e,{isShopPayActive:t,isShopPayExternal:n}){return t?n?e.match(hr):e.match(fr)??e.match(dr):e.match(lr)}(e.pathname,t);if(!n)return;const{shopId:r,sourceType:o,sourceId:i,route:a,locale:s}=n.groups??{};let c;if("spe"===o)c={type:o,id:i};else{const e=rr.find(e=>e===o);if(!e||void 0===i)return;c={type:e,id:"o"!==e||(u=i)&&/^[a-f0-9]{32}$/i.test(u)?i:`gid://shopify/Order/${i}`}}var u;const l=r?{id:r}:void 0,f=e.searchParams.get("locale")??void 0;let d;return mr(f)?d=f:mr(s)&&(d=s),{shop:l,source:c,route:`/${a??""}`,locale:d,shopPaySimulated:"sim"===c.type&&e.searchParams.has("shop_pay_sim")}}function mr(e){return!!e&&ir.test(e)}var _r=function(e,t,n){return null==e?null:N(N(e).map(t.bind(n)))},vr={map:_r,forEach:_r,count:function(e){return e?N(e).length:0},only:function(e){var t=N(e);if(1!=t.length)throw"Children.only";return t[0]},toArray:N},yr=Object.assign,gr=/^(-|f[lo].*[^se]$|g.{5,}[^ps]$|z|o[pr]|(W.{5})?[lL]i.*(t|mp)$|an|(bo|s).{4}Im|sca|m.{6}[ds]|ta|c.*[st]$|wido|ini)/,wr=Symbol.for("react.forward_ref");function br(e){function t(t){var n=yr({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=wr,t.render=e,t.prototype.isReactComponent=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}function Er(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&("function"==typeof n?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:function(e,t){for(var n in e)if("__source"!=n&&e[n]!==t[n])return!0;for(var r in t)if("__source"!=r&&!(r in e))return!0;return!1}(this.props,e)}function r(t){return this.shouldComponentUpdate=n,g(e,t)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.type=e,r}function Sr(e,t){var n=function(e,t){return b(W,{__P:t,children:e})}(e,t);return n.containerInfo=t,n}var kr,xr,Cr=Symbol.for("react.element"),Pr=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(?!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ar=/[A-Z0-9]/g,$r=typeof document<"u",Tr=Ur(function(t,n,r){var o=e.__s||kr?(r||n)():n(),i=se({t:{__:o,u:n}}),a=i[0].t,s=i[1];return le(function(){a.__=o,a.u=n,Nr(a)&&s({t:a})},[t,o,n]),ue(function(){return Nr(a)&&s({t:a}),t(function(){Nr(a)&&s({t:a})})},[t]),o});function Nr(e){try{return!Object.is(e.__,e.u())}catch(t){return!0}}var Mr=function(e){return/fil|che|rad/.test(e)};k.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(k.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Or=e.event;e.event=function(e){return Or&&(e=Or(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Rr={configurable:!0,get:function(){return this.class}},Lr=e.vnode;function Ur(t){if(!xr){xr=!0;var n=e.__r;e.__r=function(e){n&&n(e),32&e.__u&&(kr=e),e.__c};var r=e.diffed;e.diffed=function(e){r&&r(e),kr==e&&(kr=null)}}return t}function Ir(e,t,n){if(e){var r=e.__c&&e.__c.__H;r&&(r.__.forEach(function(e){null!=e.__P&&("function"==typeof e.__c&&e.__c(),e.__c=e.__H=void 0)}),r.__h=e.__c.__h=[]),"string"==typeof e.type&&(e.__u|=8),null!=(e=yr({constructor:void 0},e)).__c&&(e.__c.__P==n&&(e.__c.__P=t),e.__c.__g|=4,e.__c=e.ref=null),e.__k=e.__k&&e.__k.map(function(e){return Ir(e,t,n)})}return e}function Dr(e,t,n){return e&&n&&("string"==typeof e.type&&(e.__u|=1),e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Dr(e,t,n)}),e.__c&&e.__c.__P==t&&(e.__e&&n.appendChild(e.__e),e.__c.__g|=4,e.__c.__P=n)),e}function jr(){function t(){this.__u=0,this.i=null,this.__b=null}return function(){var t=e.__e;e.__e=function(e,n,r,o){if(e.then)for(var i,a=n;a=a.__;)if((i=a.__c)&&i.__c)return r&&!r.__c&&(n.__c.__H=void 0),i.__c(e,n);t(e,n,r,o)};var n=e.unmount;e.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),n&&n(e)}}(),(t.prototype=new k).__c=function(e,t){var n=this,r=t.__c;null==this.i&&(this.i=[]),this.i.push(r);var o=!1,i=function(){!o&&n.__P&&(o=!0,r.__R=null,s())};r.__R=i;var a=r.__P;r.__P=null;var s=function(){if(! --n.__u){if(n.state.__a){var e=n.state.__a;n.__v.__k[0]=Dr(e,e.__c.__P,e.__c.__O)}var t;for(n.setState({__a:n.__b=null});t=n.i.pop();)t.__P=a,t.forceUpdate()}};this.__u++||32&t.__u||this.setState({__a:this.__b=this.__v.__k[0]}),e.then(i,i)},t.prototype.componentWillUnmount=function(){this.i=[],this.state.__a&&(this.__v.__k[0]=this.state.__a)},t.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Ir(this.__b,n,r.__O=r.__P)}this.__b=null}return[g(S,null,t.__a?null:e.children),t.__a&&g(S,null,e.fallback)]},t}e.vnode=function(e){if("string"==typeof e.type)!function(e){var t=e.props,n=e.type,r={},o=-1==n.indexOf("-");for(var i in t){var a=t[i];if(!("value"==i&&"defaultValue"in t&&null==a||$r&&"children"==i&&"noscript"==n||"class"==i||"className"==i)){if("style"==i&&"object"==typeof a){var s=void 0;for(var c in a)"number"!=typeof a[c]||gr.test(c)||(s||(s=a=yr({},a)),a[c]+="px")}else if("defaultValue"==i&&"value"in t&&null==t.value)i="value";else if("download"==i&&!0===a)a="";else if("translate"==i&&"no"===a)a=!1;else if("o"==i[0]&&"n"==i[1]){var u=i.toLowerCase();"ondoubleclick"==u?i="ondblclick":"onchange"!=u||"input"!=n&&"textarea"!=n||Mr(t.type)?"onfocus"==u?i="onfocusin":"onblur"==u&&(i="onfocusout"):u=i="oninput","oninput"==u&&r[i=u]&&(i="oninputCapture")}else o&&Pr.test(i)?i=i.replace(Ar,"-$&").toLowerCase():null===a&&(a=void 0);r[i]=a}}"select"==n&&(r.multiple&&Array.isArray(r.value)&&(r.value=N(t.children).forEach(function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)})),null!=r.defaultValue&&(r.value=N(t.children).forEach(function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",Rr)):t.className&&(r.class=r.className=t.className),e.props=r}(e);else if("function"==typeof e.type&&("ref"in e.props&&"prototype"in e.type&&e.type.prototype.render&&(e.ref=e.props.ref,delete e.props.ref),e.type.defaultProps)){var t=yr({},e.props);for(var n in e.type.defaultProps)void 0===t[n]&&(t[n]=e.type.defaultProps[n]);e.props=t}e.ref&&!("ref"in e.props)&&Object.defineProperty(e.props,"ref",{value:e.ref,configurable:!0,writable:!0}),e.$$typeof=Cr,Lr&&Lr(e)};var Fr=jr();function Br(e){return!!e&&e.$$typeof===Cr}function qr(e){return Br(e)?w.apply(null,arguments):e}function Hr(e){return!!e.__k&&(B(null,e),!0)}var Wr=function(t,n){var r,o=e.debounceRendering;e.debounceRendering=function(e){r=e};try{var i=t(n);return r&&r(),i}finally{e.debounceRendering=o}};class Kr extends Error{constructor(){super(...arguments),this.name="TypescriptAssertionError"}}function zr(e){throw new Kr(`Received unexpected value ${JSON.stringify(e)} in an exhaustive switch/conditional block`)}function Gr(e){throw new Kr(`Received unexpected value ${JSON.stringify(e)} in an exhaustive switch/conditional block`)}const Jr=()=>e=>e;function Vr({url:e,method:t="POST",credentials:n,headers:r,source:o,explicitSearchParams:i={},onResult:a,onError:s,fetch:c=globalThis.fetch}){return async u=>{const l=performance.now(),f=new Headers("function"==typeof r?r(u):r);if(u.additionalHeaders)for(const[e,t]of Object.entries(u.additionalHeaders))f.set(e,t);const d="function"==typeof t?t(u):t,h=("function"==typeof o?o(u):o)??"GET"!==d;f.has("Content-Type")||f.set("Content-Type","application/json"),f.has("Accept")||f.set("Accept","application/json"),f.set("Shopify-Checkout-Client","checkout-web/1.0");const p={method:d,headers:f,credentials:n,redirect:"manual",signal:u.signal},m=new URL("function"==typeof e?e(u):e);if(u.query.name&&m.searchParams.set("operationName",u.query.name),i&&Object.entries(i).forEach(([e,t])=>{m.searchParams.set(e,t)}),"GET"===d)u.variables&&"{}"!==JSON.stringify(u.variables)&&m.searchParams.set("variables",JSON.stringify(u.variables)),h?m.searchParams.set("query",u.query.source):m.searchParams.set("id",u.query.id),m.search.includes(";")&&(m.search=m.search.replace(/;/g,"%3B"));else{const e={variables:u.variables,operationName:u.query.name};h?e.query=u.query.source:e.id=u.query.id,p.body=JSON.stringify(e)}const _=new Request(m,p),v=await c(_).catch(e=>e);try{if(v instanceof Error)throw new Qr(v);if(!v.ok){if(400===v.status)throw new to(v,u.query.name);throw new eo(v,u.query.name)}const e=v.headers.get("Content-Type")??"missing";if(!e.includes("application/json"))throw new no(v,e,(await v.text()).substring(0,200),u.query.name);let t;try{t=await v.json()}catch(y){throw new ro(v,m.toString(),u.query.name,y)}const{data:n,errors:r}=t;let o;o=null!=r&&r.length>0?{data:void 0,error:new Zr(r)}:null==n?{data:void 0,error:new Zr([{name:"NoDataError",message:"No data returned by GraphQL"}],"GraphQLExecutionError::NoDataReturned")}:{data:n,error:void 0};const i=performance.now();return a?.({...u,request:_,response:v,result:o,start:l,end:i,duration:i-l}),o}catch(y){const e=performance.now();throw s?.({...u,request:_,response:v instanceof Error?void 0:v,error:y,start:l,end:e,duration:e-l}),y}}}class Zr extends Error{constructor(e,t){const n=JSON.stringify(e.map(({message:e})=>e),null,2);super(`GraphQL execution failed with errors: ${n}`),this.errors=e,this.name="GraphQLExecutionError",this.groupingHash=t??function(e){const t=[{pattern:/syntax error/i,hash:"graphql_parsing_error"},{pattern:/No operation named/i,hash:"graphql_missing_operation_error"},{pattern:/Variable.*geolocation\.countryCode/i,hash:"invalid_country_code_error"},{pattern:/Variable.*coordinates\.(latitude|longitude)/i,hash:"invalid_coordinates_error"},{pattern:/Variable.*was provided invalid value/i,hash:"invalid_variable_error"},{pattern:/Cannot target merchandise with stableId/i,hash:"merchandise_stable_id_error"},{pattern:/Cannot return null for non-nullable field CreditCard/i,hash:"credit_card_field_error"},{pattern:/doesn't exist on type/i,hash:"graphql_undefined_field_error"},{pattern:/isn't a defined input type/i,hash:"graphql_undefined_input_type_error"},{pattern:/could not be composed from extendedFields/i,hash:"address_composition_error"},{pattern:/Invalid query string parameter/i,hash:"invalid_query_string_parameter_error"},{pattern:/Cannot return null for non-nullable field/i,hash:"graphql_non_nullable_field_error"},{pattern:/Field '[^']+' doesn't accept argument '[^']+'/i,hash:"graphql_unsupported_argument_error"},{pattern:/Cashback is temporarily unavailable/i,hash:"cashback_unavailable_error"},{pattern:/ProductVariantReferenceInput with invalid \w+ input:/i,hash:"invalid_product_variant_reference_error"},{pattern:/disclosureCountryCode is required when phoneNumber is present|(?:phoneNumber|value) is required when consentState is GRANTED/i,hash:"invalid_consent_input_error"},{pattern:/Invalid custom delivery strategy handle:/i,hash:"invalid_delivery_strategy_handle_error"},{pattern:/LineAllocation quantity \S+ is out of bounds/i,hash:"line_allocation_quantity_out_of_bounds_error"}].find(({pattern:t})=>t.test(e));return t?.hash??"generic_graphql_execution_error"}(n)}}const Xr="GraphQL fetch failed with network failure:";class Qr extends Error{constructor(e){super(`${Xr} ${e.message}`),this.error=e,this.name="GraphQLFetchNetworkError"}}class Yr extends Error{constructor(e){super(e),this.message=e,this.name="GraphQLFetchHttpBaseError"}getGroupingHash(e){const t=e??"UNKNOWN NAME";return[this.name,t].join(":")}}class eo extends Yr{constructor(e,t){super(`GraphQL query [${t??"UNKNOWN NAME"}] fetch failed with status: ${e.status}`),this.response=e,this.queryName=t,this.name="GraphQLFetchHttpStatusError",this.groupingHash=this.getGroupingHash(t)}}class to extends eo{constructor(e,t){super(e,t),this.response=e,this.queryName=t,this.name="GraphQLFetchHttpBadRequestError",this.groupingHash=this.getGroupingHash(t)}}class no extends Yr{constructor(e,t,n,r){super(`GraphQL UnsupportedContentType ${t}: ${n}`),this.response=e,this.contentType=t,this.contentPreview=n,this.queryName=r,this.name="GraphQLFetchHttpContentTypeError",this.groupingHash=this.getGroupingHash(r)}}class ro extends Yr{constructor(e,t,n,r){const o=r?` (${r.constructor.name}: ${r.message})`:"";super(`GraphQL JSON parse error for query [${n??"UNKNOWN NAME"}]: status ${e.status}, url ${t}${o}`),this.response=e,this.requestUrl=t,this.queryName=n,this.name="GraphQLFetchJsonParseError",this.groupingHash=this.getGroupingHash(n)}}function oo({id:e},t){return`${e}${JSON.stringify(t?io(t):{})}`}function io(e){const t={};for(const n of Object.keys(e).sort((e,t)=>e.localeCompare(t)))t[n]=e[n];return t}var ao=0;function so(t,n,r,o,i,a){n||(n={});var s,c,u=n;if("ref"in u&&"function"!=typeof t)for(c in u={},n)"ref"==c?s=n[c]:u[c]=n[c];var l={type:t,props:u,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ao,__i:-1,__u:0};return e.vnode&&e.vnode(l),l}function co(e){var t=e.match(/^var\((.*)\)$/);return t?t[1]:e}function uo(e,t){var n={},r=e;for(var o in r){var i=r[o];null!=i&&(n[co(o)]=i)}return Object.defineProperty(n,"toString",{value:function(){return Object.keys(this).map(e=>"".concat(e,":").concat(this[e])).join(";")},writable:!1}),n}function lo(e,t=2){return 1e3*Math.min(t**e,60)+Math.floor(100*Math.random())}function*fo(e=2,t=10){for(let n=1;n<=t;n++)yield lo(n,e)}function ho({initialDelay:e=2,maxAttempts:t=10}={}){return he(()=>{let n=fo(e,t);return{next:()=>n.next(),reset:()=>{n=fo(e,t)}}},[e,t])}class po extends Error{constructor(){super(...arguments),this.name="RetryError"}}async function mo(e,{shouldRetry:t=_o,maxAttempts:n=3,initialRetryDelay:r}={}){let o;for(let a=1;a<=n;a++){a>1&&await vo(lo(a-1,r));try{return await e()}catch(i){if(o=i,!t(i))break;console.warn(`Failed to execute action on attempt ${a} of ${n}.`)}}if(o instanceof Error)throw o;throw new po("Failed to execute action after retrying.",{cause:o})}function _o(e){return null!=e}function vo(e){return new Promise(t=>setTimeout(t,Math.max(e,0)))}var yo=function(e){return"function"==typeof e.children?e.children(e.v,e.i?e.i.value:void 0):e.children};function go(e){var t="function"==typeof e.when?e.when():e.when.value;if(!t){var n=e.fallback;return"function"==typeof n?n():n||null}return g(yo,{v:t,children:e.children})}function wo(e){var t=he(function(){return new Map},[]),n="function"==typeof e.each?e.each():e.each,r=n instanceof Be?n.value:n;if(!r.length)return e.fallback||null;var o=new Set(t.keys()),i=r.map(function(n,r){o.delete(n);var i=t.get(n);if(i)i.i.peek()!==r&&(i.i.value=r);else{var a=qe(r),s=e.getKey?e.getKey(n,r):r;i={vnode:g(yo,{key:s,v:n,i:a,children:e.children}),i:a},t.set(n,i)}return i.vnode});return o.forEach(function(e){t.delete(e)}),g(S,null,i)}function bo(e){var t=dt(e);return t.name="useLiveSignal",t.peek()!==e&&(t.value=e),t}function Eo(e){var t=dt(e);return"current"in t||Object.defineProperty(t,"current",So),t}yo.displayName="Item",go.displayName="Show",wo.displayName="For";var So={configurable:!0,get:function(){return this.value},set:function(e){this.value=e}};class ko extends Error{constructor(){super(...arguments),this.name="CheckoutGraphQLError"}}function xo(e){return"function"==typeof e?e():e}function Co(e){return e?Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&"):""}class Po{constructor(e,t=new Map,{timing:n}={}){this.cache=t,this.timings=[],this.inflight=new Map,this.cacheWriteSequence=new Map,this.fetch=n?function(e,t,n){return async r=>{const o=performance.now();try{return await e(r)}finally{n({clientName:t,operationName:r.query.name??r.query.id,startedAt:o,duration:Math.max(0,performance.now()-o)})}}}(e,n.clientName,e=>this.timings.push(e)):e}read(e,t){return this.cache.get("string"==typeof e?e:oo(e))}extract(){return Object.fromEntries(this.cache.entries())}mutate(e,{variables:t}={}){return this.run(e,{variables:t})}staticQuery(e,t={}){return this.internalQuery(e,t)}get reactiveEffectsEnabled(){return!0}query(e,t={}){const n=qe(void 0),r=qe(!1),o=qe(void 0),i=qe(!1);let a,s,c=0,u=Promise.resolve({});const l=t.cache??!0,f=()=>{const e=(c??0)+1;return c=e,e},d=(e,t)=>{t===c&&(e.error?(o.value=e.error,n.value=void 0):(o.value=void 0,n.value=e.data),r.value=!1)},h=n=>{if(null===c)return Promise.resolve({});const o=f();s=Co(n.additionalHeaders);const a=(t.getCacheKey??oo)(e,n.variables),u=!n.forceNetwork&&(n.cache??l)&&!this.inflight.has(a)&&this.cache.has(a),h=this.internalQuery(e,{variables:n.variables,cache:n.cache??l,getCacheKey:t.getCacheKey,additionalHeaders:n.additionalHeaders,forceNetwork:n.forceNetwork});return i.value=u,h instanceof Promise?(r.value=!0,h.then(e=>(d(e,o),e))):(d(h,o),Promise.resolve(h))};if(this.reactiveEffectsEnabled)a=Qe(()=>{if(xo(t.skip))return f(),void(r.value=!1);const e=xo(t.variables),n=xo(t.additionalHeaders),o=Co(n);u=h({variables:e,cache:l,additionalHeaders:n,forceNetwork:void 0!==s&&o!==s})});else if(!xo(t.skip)){const o=(t.getCacheKey??oo)(e,xo(t.variables)),a=l?this.read(o):void 0;null==a?r.value=!0:(n.value=a,i.value=!0,u=Promise.resolve({data:a}))}const p=()=>{null!==c&&(c=null,a?.())};Qe(()=>()=>p());const m={data:n,loading:r,error:o,isFromCache:i,refetch:e=>(u=h({variables:e?.variables??xo(t.variables),cache:!1,additionalHeaders:xo(t.additionalHeaders),forceNetwork:!e?.deduplicate}),m),[Symbol.dispose]:p,then:(e,t)=>u.then(e,t)};return m}internalQuery(e,{cache:t=!0,variables:n,getCacheKey:r,skip:o=!1,additionalHeaders:i,forceNetwork:a=!1}={}){const s=(r??oo)(e,n);if(o)return{data:this.cache.get(s)};if(!a){if(this.inflight.has(s))return this.inflight.get(s);if(t&&this.cache.has(s))return{data:this.cache.get(s)}}const c=(this.cacheWriteSequence.get(s)??0)+1;this.cacheWriteSequence.set(s,c);const u=(async()=>{try{const t=await this.run(e,{variables:n},i);return t.error||this.cacheWriteSequence.get(s)!==c||this.cache.set(s,t.data),t}finally{this.cacheWriteSequence.get(s)===c&&this.inflight.delete(s)}})();return this.inflight.set(s,u),u}async run(e,{variables:t}={},n){try{const r=await this.fetch({query:e,variables:t??{},...n&&{additionalHeaders:n}}),{data:o,error:i}=r;return o?{data:o}:{error:i}}catch(r){return{error:r instanceof Error?r:new ko}}}}const Ao={"America/Indiana":"America/Indiana/Indianapolis","America/Argentina":"America/Argentina/Buenos_Aires","Asia/Chongqing":"Asia/Shanghai","Asia/Istanbul":"Europe/Istanbul","Australia/ACT":"Australia/Sydney","Australia/LHI":"Australia/Lord_Howe","Australia/North":"Australia/Darwin","Australia/NSW":"Australia/Sydney","Australia/Queensland":"Australia/Brisbane","Australia/South":"Australia/Adelaide","Australia/Tasmania":"Australia/Hobart","Australia/Victoria":"Australia/Melbourne","Australia/West":"Australia/Perth","Brazil/Acre":"America/Rio_Branco","Brazil/DeNoronha":"America/Noronha","Brazil/East":"America/Sao_Paulo","Brazil/West":"America/Manaus","Canada/Atlantic":"America/Halifax","Canada/Central":"America/Winnipeg","Canada/Eastern":"America/Toronto","Canada/Mountain":"America/Edmonton","Canada/Newfoundland":"America/St_Johns","Canada/Pacific":"America/Vancouver","Canada/Saskatchewan":"America/Regina","Canada/Yukon":"America/Whitehorse","Chile/Continental":"America/Santiago","Chile/EasterIsland":"Pacific/Easter",Cuba:"America/Havana",Egypt:"Africa/Cairo",Eire:"Europe/Dublin","Europe/Kyiv":"Europe/Kiev","Etc/Greenwich":"Etc/GMT","Etc/UCT":"UTC","Etc/Universal":"UTC","Etc/Zulu":"UTC",GB:"Europe/London","GB-Eire":"Europe/London","GMT+0":"Etc/GMT",GMT0:"Etc/GMT","GMT−0":"Etc/GMT",Greenwich:"Etc/GMT",Hongkong:"Asia/Hong_Kong",Iceland:"Atlantic/Reykjavik",Iran:"Asia/Tehran",Israel:"Asia/Jerusalem",Jamaica:"America/Jamaica",Japan:"Asia/Tokyo",Kwajalein:"Pacific/Kwajalein",Libya:"Africa/Tripoli","Mexico/BajaNorte":"America/Tijuana","Mexico/BajaSur":"America/Mazatlan","Mexico/General":"America/Mexico_City",Navajo:"America/Denver",NZ:"Pacific/Auckland","NZ-CHAT":"Pacific/Chatham",Poland:"Europe/Warsaw",Portugal:"Europe/Lisbon",PRC:"Asia/Shanghai",ROC:"Asia/Taipei",ROK:"Asia/Seoul",Singapore:"Asia/Singapore",Turkey:"Europe/Istanbul",UCT:"UTC",Universal:"UTC","US/Alaska":"America/Anchorage","US/Aleutian":"America/Adak","US/Arizona":"America/Phoenix","US/Central":"America/Chicago","US/Eastern":"America/New_York","US/East-Indiana":"America/Indiana/Indianapolis","US/Hawaii":"Pacific/Honolulu","US/Indiana-Starke":"America/Indiana/Knox","US/Michigan":"America/Detroit","US/Mountain":"America/Denver","US/Pacific":"America/Los_Angeles","US/Pacific-New":"America/Los_Angeles","US/Samoa":"Pacific/Pago_Pago","W-SU":"Europe/Moscow",Zulu:"UTC"},$o=new Map;function To(e,t){const n=null!=t&&t.timeZone?(r=t.timeZone,Object.keys(Ao).some(e=>e===r)?Ao[r]:r):void 0;var r;const o=function(e,t={}){return`${Array.isArray(e)?e.sort().join("-"):e}-${JSON.stringify(t)}`}(e,{...t,timeZone:n});if($o.has(o))return $o.get(o);const i=new Intl.DateTimeFormat(e,{...t,timeZone:n});return $o.set(o,i),i}const No=Intl.DateTimeFormat("en",{hour:"numeric"}),Mo=void 0===No.resolvedOptions?void 0:No.resolvedOptions(),Oo=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]),Ro=/[\p{Script=Adlam}\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Mandaic}\p{Script=Nko}\p{Script=Samaritan}\p{Script=Syriac}\p{Script=Thaana}]/u;function Lo(e){return Ro.test(e)}function Uo(e){return Io.get(e)??2}const Io=new Map([["BHD",3],["BIF",0],["BYR",0],["CLF",4],["CLP",0],["DJF",0],["GNF",0],["HUF",2],["IQD",3],["ISK",0],["JOD",3],["JPY",0],["KMF",0],["KRW",0],["KWD",3],["LYD",3],["MGA",2],["MRO",5],["OMR",3],["PYG",0],["RWF",0],["TND",3],["UGX",0],["VND",0],["VUV",0],["XAF",0],["XAG",0],["XAU",0],["XBA",0],["XBB",0],["XBC",0],["XBD",0],["XDR",0],["XOF",0],["XPD",0],["XPF",0],["XPT",0],["XTS",0]]);function Do(e){return e.replace(/\s*[A-Z]{3}\s*/g,"")}function jo(e,t={},n){const r="he"===n.locale.split("-")[0],o=e<0||Object.is(e,-0),i=Ho(t.currency||n.currency||"",n),a=Wo(n,t),s=Do(n.numberFormatter({style:"currency",maximumFractionDigits:a,minimumFractionDigits:a,currencyDisplay:"code",...t}).format(t.spacedMinusSign&&!r?Math.abs(e):e)),c=i.prefixed&&/^[A-Za-z]+$/.test(i.symbol)?" ":"",u=i.prefixed?`${i.symbol}${c}${s}`:`${s} ${i.symbol}`,l=t.spacedMinusSign?"− ":"-";return o&&r?u.replace("−","-").replace("-",l):o?`${l}${u.replace("-","").replace("−","")}`:u}function Fo(e,t={},n){const r=jo(e,t,n),o=t.currency||n.currency||"";return qo(o,r)?r:`${r} ${o}`}const Bo={SRD:{symbol:"SRD",prefixed:!0,explicit:!0},TRY:{symbol:"TL",prefixed:!1,explicit:!0},CHF:{symbol:"CHF",explicit:!0},KGS:{symbol:"лв",prefixed:!0}};function qo(e,t){return!0===Bo[e]?.explicit||null!=t&&t.includes(e)}function Ho(e,t){const n=e||t.currency,r=Bo[n];if(void 0!==r?.prefixed)return{symbol:r.symbol,prefixed:r.prefixed};const o=n.substring(0,2),i=Wo(t),a=t.numberFormatter({currency:n,style:"currency",currencyDisplay:"narrowSymbol",maximumFractionDigits:i,minimumFractionDigits:i}).format(0).replace(/[\u200E\u200F]/g,""),s=t.numberFormatter({currency:n,style:"currency",currencyDisplay:"code",maximumFractionDigits:i,minimumFractionDigits:i}).format(0).replace(/[\u200E\u200F]/g,"");if(r&&a!==s)return{symbol:r.symbol,prefixed:s.startsWith(n)};if(a===s){const e=s.replace(n,"").trim();return{symbol:s.replace(e,"").trimStart(),prefixed:s.startsWith(n)}}const c=s.replace(n,"").trim(),u=a.replace(c,"").trimStart(),l=a.startsWith(u);return{symbol:u.replace(o,""),prefixed:l}}function Wo(e,t={}){let n=t.precision;return void 0===n&&(n=Uo((t.currency||e.currency||"").toUpperCase())),n}const Ko=(e,t)=>e&&t?`${t}${e}`:"",zo=(e,t,n)=>e?Ko(n,t):n||"",Go=new Map([["ko",zo],["ja",(e,t,n)=>e?Ko(n,t):t?`${t}様`:""],["zh-CN",zo],["zh-TW",zo]]),Jo=new RegExp("^(?[a-z]{2,3})(?:-(?[a-zA-Z0-9]+))?$");class Vo{constructor(e,t){this.language=e,this.region=t}toString(){return this.region?`${this.language}-${this.region}`:this.language}}const Zo="latn",Xo=`-u-nu-${Zo}`;function Qo(e){try{const t=new Intl.Locale(e);return new Intl.Locale(t.baseName,{numberingSystem:Zo}).toString()}catch{return function(e){return e.includes("-u-nu-")?e.replace(/-u-nu-[a-z0-9]+/i,Xo):`${e}${Xo}`}(e)}}const Yo="count",ei="scope",ti=".";function ni(e){const t=new Map;return ri(e,(e,n)=>t.set(e,n)),t}function ri(e,t,n){Object.keys(e).forEach(r=>{const o=e[r],i=n?`${n}.${r}`:r;null!=o&&("string"==typeof o?t(i,o):ri(o,t,i))})}function oi(e,t,n){Object.keys(e).forEach(r=>{const o=e[r],i=n?`${n}.${r}`:r;null!=o&&(t(i,o),"string"!=typeof o&&oi(o,t,i))})}function ii(e){const t=new Map;return oi(e,(e,n)=>t.set(e,n)),t}function ai(){return`${si()}-${si()}-${si()}-${si()}`}function si(){return Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)}class ci extends Error{constructor(e,t){super(`The value for "${e}" was not a string. Found ${JSON.stringify(t)} instead.`),this.name="TranslationNotStringError"}}class ui extends Error{constructor(e,t,n){super(`The key "${t}" is not a valid replacement for "${e}".`),this.rawTranslation=n,this.name="MissingReplacementError"}}const li=/(%{([^}]*)})|({{([^}]*)}})/g,fi=/((?:%{([^}]*)}|{{([^}]*)}})[….,!?;:)'"’”]?)/g,di=/(href="%{([^}]*)}")|(href="{{([^}]*)}}")/g,hi={"&":"&","<":"<",">":">",'"':""","'":"'"};class pi extends Error{constructor(){super(...arguments),this.name="MissingHtmlEscapeError"}}const mi="data-replacement-index";function _i(e){return String(e).replace(/[&<>"']/g,e=>{const t=hi[e];if(void 0===t)throw new pi(`No HTML escape for "${e}"`);return t})}const vi=["…",".",",","!","?",";",":",")","'",'"',"’","”"];function yi({i18n:e,rawTranslation:t,replacements:n,translationKey:r,noWrapElementReplacements:o}){const i=[];let a=t;try{a=t.replace(di,e=>{const o=e.startsWith('href="%')?e.substring(8,e.length-2).trim():e.substring(8,e.length-3).trim();if(o in n)return`href="${_i(n[o])}"`;throw new ui(r,o,t)}).replace(li,e=>{const a="%"===e.slice(0,1)?e.substring(2,e.length-1):e.substring(2,e.length-2).trim();if(a in n){const e=n[a];if(!Br(e))return _i(e);i.push(e);const t=o?' style="white-space: nowrap;"':"";return``}throw new ui(r,a,t)})}catch(s){s instanceof Error&&e.onError?.(s)}return so(gi,{translation:a,portals:i})}function gi({translation:e,portals:t=[]}){const n=fe(null),[r,o]=se([]);return le(()=>{const e=n.current;o(e?Array.from(e.querySelectorAll(`[${mi}]`)):[])},[e]),so(S,{children:[so("span",{ref:n,dangerouslySetInnerHTML:{__html:e}}),t.map((e,t)=>{const n=r[t];return n?Sr(e,n):null})]})}class wi{constructor(e,t){this.pluralRules=function(e,t){const n=new WeakMap,r=new Map,o=[];return function(...i){if("undefined"==typeof window)return e.apply(this,i);const a=1===i.length&&"object"==typeof i[0]&&!t;let s;s=a?i[0]:t&&t instanceof Function?t(...i):i[0];const c=a?n:r;if(c.has(s))return c.get(s);const u=e.apply(this,i);if(a)n.set(s,u);else if(r.set(s,u),o.push(s),r.size>50){const e=o[0];r.delete(e),o.shift()}return u}}(Ei,(e,t={})=>`${e}${JSON.stringify(t)}`),this.numberFormats=new Map,this.translations=ii(t),this.locale=function(e="en"){const t=function(e){if(!e)return null;const t=e.match(Jo);return t?new Vo(t.groups?.language,t.groups?.region):null}(e);return t?.toString()??bi(e)??"en"}(e.locale),this.localeDirection=e.direction??function(e){const t=e.indexOf("-"),n=(-1===t?e:e.slice(0,t)).toLowerCase();return n&&Oo.has(n)?"rtl":"ltr"}(this.locale),this.currency=e.currency&&function(e){try{return new Intl.NumberFormat(void 0,{style:"currency",currency:e}).format(123),!0}catch{return!1}}(e.currency)?e.currency:"USD";const n=e.fallbackTimeZone&&Si(e.fallbackTimeZone)?e.fallbackTimeZone:void 0;this.timeZone=Si(e.timeZone)?e.timeZone:n,this.onError=e.onError,this.uuid=e.uuid??ai,this.formattingLocale=Qo(this.locale)}numberFormatter(e={}){const t=function(e,t={}){return`${e}${JSON.stringify(t)}`}(this.formattingLocale,e);if(this.numberFormats.has(t))return this.numberFormats.get(t);let n;try{const n=new Intl.NumberFormat(this.formattingLocale,e);return this.numberFormats.set(t,n),n}catch(c){n=c}const{currencyDisplay:r,...o}=e,i=bi(this.locale),a=i?Qo(i):void 0,s=[];r&&s.push({locale:this.formattingLocale,options:o}),a&&a!==this.formattingLocale&&(s.push({locale:a,options:e}),r&&s.push({locale:a,options:o}));for(const{locale:u,options:l}of s)try{const e=new Intl.NumberFormat(u,l);return this.numberFormats.set(t,e),e}catch(c){n=c;continue}throw n}formatCurrency(e,t){return function(e,t,{form:n,...r}={}){switch(n){case"auto":return function(e,t={},n){return null==t.currency||null==n.currency||t.currency===n.currency?jo(e,t,n):Fo(e,t,n)}(t,r,e);case"explicit":return Fo(t,r,e);case"name":return function(e,t={},n){const r=t.currency||n.currency,o=Wo(n,t);return n.numberFormatter({maximumFractionDigits:o,minimumFractionDigits:o,...t,style:"currency",currency:r,currencyDisplay:"name"}).format(e)}(t,r,e);case"plain":return function(e,t={},n){const r=Wo(n,t);return Do(n.numberFormatter({style:"currency",useGrouping:!1,maximumFractionDigits:r,minimumFractionDigits:r,currencyDisplay:"code",...t}).format(e))}(t,r,e);default:return jo(t,r,e)}}(this,e,t)}formatDate(e,t){return function(e,t,n={}){if(null!=Mo&&!1===n.hour12&&null!=Mo.hourCycle&&(n.hour12=void 0,n.hourCycle="h23"),null!=n.timeZone&&"Etc/GMT+12"===n.timeZone){const r=new Date(e.valueOf()-432e5);return To(t,{...n,timeZone:"UTC"}).format(r)}return To(t,n).format(e)}(e,this.formattingLocale,{timeZone:this.timeZone,...t})}formatName(e,t,n){return function(e,t,n,r){const o=e.indexOf("-"),i=-1!==o&&"zh-CN"!==e&&"zh-TW"!==e?e.slice(0,o).toLowerCase():e,a=Boolean(r&&t&&n),s=Go.get(i);return s?s(a,n,t):a?`${t} ${n}`:t||""}(this.locale,e,t,n)}translate(e,t,n){return function(e,t,n,r){let o=!!t.endsWith("_html")||void 0,i=!1;"object"==typeof r&&(o=r.dangerouslySetInnerHTML??o,i=r.noWrapElementReplacements??!1);try{if("object"==typeof n&&Boolean(Object.keys(n).length)){const r=function(e,t,n){let r;return r=function(e){return ei in e&&"string"==typeof e[ei]}(n)?function(e,t,n){const r=n[ei],o=t+ti+r,i=e.translations.get(o),a="string"==typeof i?i:i?.[r];if("string"!=typeof a)throw new ci(o,a);return{translation:a,key:o,replacements:n}}(e,t,n):function(e){return Yo in e&&"number"==typeof e[Yo]}(n)?function(e,t,n){const r=n[Yo],o=e.pluralRules(e.locale).select(r),i=e.pluralRules(e.locale).resolvedOptions().pluralCategories,a=e.numberFormatter().format(r),s=t+ti+o;let c=e.translations.get(s);if(c||i.includes("other")&&e.translations.has(`${t}${ti}other`)&&(c=e.translations.get(`${t}${ti}other`)),"string"!=typeof c)throw new ci(s,c);return{translation:c,key:s,replacements:{...n,[Yo]:a}}}(e,t,n):function(e,t,n){const r=e.translations.get(t);if("string"!=typeof r)throw new ci(t,r);return{translation:r,key:t,replacements:n}}(e,t,n),{translation:r.translation,replacements:r.replacements,key:r.key}}(e,t,n);return function(e,t,n,r,o,i){return o?so(yi,{i18n:e,rawTranslation:t,replacements:n,translationKey:r,noWrapElementReplacements:i}):function(e){return Object.values(e).every(e=>!Br(e))}(n)?function(e,t,n){return e.replace(li,r=>{let o;if(o="%"===r.slice(0,1)?r.substring(2,r.length-1).trim():r.substring(2,r.length-2).trim(),o in t)return t[o];throw new ui(n,o,e)})}(t,n,r):function(e,t,n,r){return e.split(r?fi:li).filter(e=>Boolean(e)).reduce((o,i)=>{if(o.nextExtryIsReplacementKey){const a=i.trim();if(!(a in t))throw new ui(n,a,e);const s=o.matchIndex+1,c=function(e,t,n,r){const o=t.slice(-1),i=r&&vi.includes(o);if(!Br(e))return i?`${e}${o}`:e;const a=qr(e,{key:n});return i?so("span",{style:{whiteSpace:"nowrap"},children:[a,o]}):a}(t[a],o.previousEntry,s,r);return{nextExtryIsReplacementKey:!1,matchIndex:s,splitTranslationWithReplacements:[...o.splitTranslationWithReplacements,c],previousEntry:i}}return i.match(li)?{...o,nextExtryIsReplacementKey:!0,previousEntry:i}:{...o,nextExtryIsReplacementKey:!1,splitTranslationWithReplacements:[...o.splitTranslationWithReplacements,i],previousEntry:i}},{nextExtryIsReplacementKey:!1,matchIndex:0,splitTranslationWithReplacements:[],previousEntry:""}).splitTranslationWithReplacements}(t,n,r,i)}(e,r.translation,r.replacements,r.key,o,i)}return o?function(e,t){const n=e.translations.get(t);if("string"!=typeof n)throw new ci(t,n);return so(gi,{translation:n})}(e,t):function(e,t){const n=e.translations.get(t);if(n&&"string"==typeof n)return n;throw new ci(t,n)}(e,t)}catch(a){if(a instanceof ui)return a.rawTranslation;if(a instanceof Error)return e.onError?.(a),`I18n Error: ${a.message}`}}(this,e,t,n)}}function bi(e){if(e)return e.match(/^([a-z]{2,3})(?:[-_].*)?$/i)?.[1]}function Ei(e,t={}){try{return new Intl.PluralRules(e,t)}catch(n){const r=bi(e);if(!r)throw n;return new Intl.PluralRules(r,t)}}function Si(e){try{if(new Intl.DateTimeFormat(void 0,{timeZone:e}))return!0}catch{return!1}return!1}function ki(...e){const t={};return e.forEach(e=>{Object.entries(e).forEach(([e,n])=>{t[e]?t[e]="string"==typeof n?n:ki(t[e],n):t[e]=n})}),t}function xi(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var Ci=0;function Pi(e){return"__private_"+Ci+++"_"+e}function Ai(e){return Object.entries(e).map(([e,t])=>({key:e,value:{stringValue:String(t)}}))}function $i(e){if(Array.isArray(e))return{arrayValue:{values:e.map(e=>$i(e))}};switch(typeof e){case"boolean":return{boolValue:Boolean(e)};case"number":return{doubleValue:Number(e)};default:return{stringValue:String(e)}}}const Ti=function(){const e=[0];for(let t=0;t<12;t++){const n=Math.floor(5*2**t);e.push(n)}return e}();function Ni(e){return"number"==typeof e&&Number.isFinite(e)}function Mi(e,t,n){throw new Error(`[OpenTelemetry] Invalid ${e} "${t}": value must be a finite number, got ${null===n?"null":typeof n}`)}var Oi=Pi("exporter"),Ri=Pi("attributes"),Li=Pi("metrics"),Ui=Pi("logs");class Ii{constructor({exporter:e,attributes:t}){Object.defineProperty(this,Oi,{writable:!0,value:void 0}),Object.defineProperty(this,Ri,{writable:!0,value:void 0}),Object.defineProperty(this,Li,{writable:!0,value:[]}),Object.defineProperty(this,Ui,{writable:!0,value:[]}),xi(this,Oi)[Oi]=e,xi(this,Ri)[Ri]=null!=t?t:{}}addAttributes(e){xi(this,Ri)[Ri]={...xi(this,Ri)[Ri],...e}}histogram({name:e,value:t,unit:n,description:r,bounds:o,attributes:i,scale:a,requiresKeepalive:s}){Ni(t)||Mi("histogram",e,t);const c=1e6*Date.now();o?xi(this,Li)[Li].push({name:e,type:"histogram",value:t,unit:n,description:r,timeUnixNano:c,attributes:i,bounds:o,requiresKeepalive:s}):xi(this,Li)[Li].push({name:e,type:"exponential_histogram",value:t,unit:n,description:r,timeUnixNano:c,attributes:i,scale:a,requiresKeepalive:s})}counter({name:e,value:t,unit:n,description:r,attributes:o,requiresKeepalive:i}){Ni(t)||Mi("counter",e,t);const a=1e6*Date.now();xi(this,Li)[Li].push({name:e,type:"counter",value:t,unit:n,description:r,timeUnixNano:a,attributes:o,requiresKeepalive:i})}gauge({name:e,value:t,unit:n,description:r,attributes:o,requiresKeepalive:i}){Ni(t)||Mi("gauge",e,t);const a=1e6*Date.now();xi(this,Li)[Li].push({name:e,type:"gauge",value:t,unit:n,description:r,timeUnixNano:a,attributes:o,requiresKeepalive:i})}log({body:e,attributes:t,requiresKeepalive:n}){const r=1e6*Date.now();xi(this,Ui)[Ui].push({timeUnixNano:r,body:e,attributes:t,requiresKeepalive:n})}async exportMetrics(){xi(this,Li)[Li].forEach(e=>{e.attributes={...xi(this,Ri)[Ri],...e.attributes}});const e=xi(this,Li)[Li];xi(this,Li)[Li]=[],await this.exportByKeepalive(e,(e,t)=>xi(this,Oi)[Oi].exportMetrics(this.aggregateMetrics(e),t))}async exportLogs(){const e=xi(this,Ui)[Ui];xi(this,Ui)[Ui]=[],await this.exportByKeepalive(e,(e,t)=>xi(this,Oi)[Oi].exportLogs(this.formatLogs(e),t))}aggregateMetrics(e){const t={};return e.forEach(e=>{switch(e.type){case"histogram":!function(e,t){var n;const{name:r,value:o,unit:i,description:a,timeUnixNano:s,attributes:c}=t,u=null!==(n=t.bounds)&&void 0!==n?n:Ti,l=new Array(u.length+1).fill(0);e[r]||={name:r,unit:i||"1",description:a,histogram:{aggregationTemporality:1,dataPoints:[]}};for(let f=0;f0?d:0,bucketCounts:r>0?[1]:[]};e[n].exponentialHistogram.dataPoints.push({attributes:Ai(null!=s?s:{}),startTimeUnixNano:a,timeUnixNano:a,count:1,sum:u,scale:l,zeroCount:h,positive:p,negative:{offset:0,bucketCounts:[]},min:u,max:u,zeroThreshold:0})}(t,e);break;case"counter":!function(e,t){const{name:n,value:r,unit:o,description:i,timeUnixNano:a,attributes:s}=t;e[n]||={name:n,unit:o||"1",description:i,sum:{aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}},e[n].sum.dataPoints.push({startTimeUnixNano:a,timeUnixNano:a,asDouble:r,attributes:Ai(null!=s?s:{})})}(t,e);break;case"gauge":!function(e,t){const{name:n,value:r,unit:o,description:i,timeUnixNano:a,attributes:s}=t;e[n]||={name:n,unit:o||"1",description:i,gauge:{dataPoints:[]}},e[n].gauge.dataPoints.push({startTimeUnixNano:a,timeUnixNano:a,asDouble:r,attributes:Ai(null!=s?s:{})})}(t,e)}}),Object.values(t)}async exportByKeepalive(e,t){if(0===e.length)return;const n=[],r=[];e.forEach(e=>{var t;null===(t=e.requiresKeepalive)||void 0===t||t?n.push(e):r.push(e)});const o=[n.length>0?t(n,{keepalive:!0}):void 0,r.length>0?t(r,{keepalive:!1}):void 0].filter(e=>void 0!==e);await Promise.all(o)}formatLogs(e){return e.map(e=>{const t={timeUnixNano:e.timeUnixNano,observedTimeUnixNano:e.timeUnixNano,attributes:(n={...xi(this,Ri)[Ri],...e.attributes},Object.entries(n).map(([e,t])=>({key:e,value:$i(t)})))};var n;return e.body&&(t.body={stringValue:e.body}),t})}}var Di=Pi("url"),ji=Pi("serviceName"),Fi=Pi("logger"),Bi=Pi("fetchFn"),qi=Pi("maxPayloadSizeBytes"),Hi=Pi("retry");class Wi{constructor(e,t,n){var r;Object.defineProperty(this,Di,{writable:!0,value:void 0}),Object.defineProperty(this,ji,{writable:!0,value:void 0}),Object.defineProperty(this,Fi,{writable:!0,value:void 0}),Object.defineProperty(this,Bi,{writable:!0,value:void 0}),Object.defineProperty(this,qi,{writable:!0,value:void 0}),Object.defineProperty(this,Hi,{writable:!0,value:void 0}),xi(this,Di)[Di]=e.replace(/\/v1\/(logs|metrics|traces)\/?$/,""),xi(this,ji)[ji]=t,xi(this,Fi)[Fi]=null==n?void 0:n.logger,xi(this,Bi)[Bi]=null==n?void 0:n.fetchFn,xi(this,qi)[qi]=null!==(r=null==n?void 0:n.maxPayloadSizeBytes)&&void 0!==r?r:51200,xi(this,Hi)[Hi]=null==n?void 0:n.retry}async exportMetrics(e,t){var n;const r=null===(n=null==t?void 0:t.keepalive)||void 0===n||n;await this.exportBatches("/v1/metrics",[...e],e=>({resourceMetrics:[{resource:{attributes:[{key:"service.name",value:{stringValue:xi(this,ji)[ji]}}]},scopeMetrics:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},metrics:e}]}]}),r,{splitEntry:Ki,describeEntry:e=>({metricName:e.name,dataPointCount:Gi(e)})})}async exportLogs(e,t){var n;const r=null===(n=null==t?void 0:t.keepalive)||void 0===n||n;await this.exportBatches("/v1/logs",[...e],e=>({resourceLogs:[{resource:{attributes:[{key:"service.name",value:{stringValue:xi(this,ji)[ji]}}]},scopeLogs:[{scope:{name:"open-telemetry-mini-client",version:"1.1.0",attributes:[]},logRecords:e}]}]}),r)}async exportTo(e,t,n){await this.exportSerializedWithRetry(this.serializeBody(e),t,n)}serializeBody(e){const t=JSON.stringify(e),n=(new TextEncoder).encode(t).length;if(n>xi(this,qi)[qi])throw new Zi(n,xi(this,qi)[qi]);return{body:e,jsonBody:t}}async exportSerializedTo({body:e,jsonBody:t},n,r){var o;const i=await this.exporterFetch()(`${xi(this,Di)[Di]}${n}`,{method:"POST",keepalive:r,headers:{"Content-Type":"application/json"},body:t});if(null===(o=xi(this,Fi)[Fi])||void 0===o||o.log({status:i.status}),!i.ok){if(400===i.status){const e=await i.text();throw new Vi(`Invalid OpenTelemetry Data: ${e}`)}if(429===i.status||503===i.status){const t=await i.text(),n=i.headers.get("Retry-After"),r=n?{seconds:Number(n)}:void 0;throw new Vi("Server did not accept data",{errorData:t,retryAfter:r,body:e})}if(401===i.status||403===i.status){const t=await i.text();throw new Xi(`Authentication failed: ${i.status} ${401===i.status?"Unauthorized":"Forbidden"}`,{errorData:t,body:e})}throw new Vi(`Server responded with ${i.status}`)}}async exportSerializedWithRetry(e,t,n){const r=()=>this.exportSerializedTo(e,t,n);await(xi(this,Hi)[Hi]?xi(this,Hi)[Hi](r):r())}exporterFetch(){return xi(this,Bi)[Bi]||fetch}async exportBatches(e,t,n,r,o){const i=this.serializedBatches(t,n,o);for(const a of i)await this.exportSerializedWithRetry(a,e,r)}serializedBatches(e,t,n){if(0===e.length)return[];try{return[this.serializeBody(t(e))]}catch(i){var r;if(!(i instanceof Zi))throw i;if(e.length>1){const r=Math.ceil(e.length/2);return[...this.serializedBatches(e.slice(0,r),t,n),...this.serializedBatches(e.slice(r),t,n)]}const a=e[0];if(void 0===a)throw i;const s=null==n||null===(r=n.splitEntry)||void 0===r?void 0:r.call(n,a);var o;if(!s)throw i.metricDetails=null==n||null===(o=n.describeEntry)||void 0===o?void 0:o.call(n,a),i;return[...this.serializedBatches([s[0]],t,n),...this.serializedBatches([s[1]],t,n)]}}}function Ki(e){const t=Gi(e);if(t<=1)return;const n=Math.ceil(t/2);return[zi(e,0,n),zi(e,n,t)]}function zi(e,t,n){switch(!0){case"exponentialHistogram"in e:return{...e,exponentialHistogram:{...e.exponentialHistogram,dataPoints:e.exponentialHistogram.dataPoints.slice(t,n)}};case"histogram"in e:return{...e,histogram:{...e.histogram,dataPoints:e.histogram.dataPoints.slice(t,n)}};case"gauge"in e:return{...e,gauge:{...e.gauge,dataPoints:e.gauge.dataPoints.slice(t,n)}};case"sum"in e:return{...e,sum:{...e.sum,dataPoints:e.sum.dataPoints.slice(t,n)}};default:return Ji(e)}}function Gi(e){switch(!0){case"exponentialHistogram"in e:return e.exponentialHistogram.dataPoints.length;case"histogram"in e:return e.histogram.dataPoints.length;case"gauge"in e:return e.gauge.dataPoints.length;case"sum"in e:return e.sum.dataPoints.length;default:return Ji(e)}}function Ji(e){throw new Error(`Unhandled metric type: ${JSON.stringify(e)}`)}class Vi extends Error{constructor(e,t){super(e),this.metadata=void 0,this.name="OpenTelemetryClientError",this.metadata=t}}class Zi extends Error{constructor(e,t){const n="number"==typeof e&&void 0!==t;super(n?`Payload size ${e} exceeds ${t} bytes`:String(e)),this.name="PayloadTooLargeError",this.payloadSizeBytes=void 0,this.payloadSizeLimitBytes=void 0,this.metricDetails=void 0,n&&(this.payloadSizeBytes=e,this.payloadSizeLimitBytes=t)}}class Xi extends Error{constructor(e,t){super(e),this.name="AuthenticationFailedError",this.metadata=void 0,this.name="AuthenticationFailedError",this.metadata=t}}function Qi(e){return Yi(e).map(e=>e instanceof Error?e:new ea(`[${typeof e}] ${function(e){if("function"==typeof e)return`${e.name||"anonymous"}`;if("string"!=typeof e)try{return JSON.stringify(e)??typeof e}catch{}return`${e}`}(e).slice(0,10240)}`))}function Yi(e,t=0){return t>=20?[e,"Truncated cause stack"]:e instanceof Error&&e.cause?[e,...Yi(e.cause,t+1)]:[e]}var ea=class extends Error{name="BugsnagInvalidError"},ta=/^\s*at .*(\S+:\d+|\(native\))/m,na=/^(eval@)?(\[native code])?$/;function ra(e){if(-1===e.indexOf(":"))return[e];let t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]?Number(t[2]):void 0,t[3]?Number(t[3]):void 0]}var oa=class{breadcrumbs=[];apiKey;plugins;appId;appType;appVersion;releaseStage;locale;userAgent;metadata;persistedMetadata;onError;onPostErrorListeners=[];endpoints;session;constructor(e){this.apiKey=e.apiKey,this.appType=e.appType,this.appId=e.appId,this.appVersion=e.appVersion,this.releaseStage=e.releaseStage,this.locale=e.locale,this.userAgent=e.userAgent,this.metadata=e.metadata,this.onError=e.onError,this.persistedMetadata={},this.endpoints=e.endpoints??{notify:"https://error-analytics-production.shopifysvc.com",sessions:"https://error-analytics-sessions-production.shopifysvc.com/observeonly"},this.plugins=e.plugins??[],this.plugins.forEach(e=>e.load(this)),this.leaveBreadcrumb("Bugsnag started",void 0,"state"),(e.withSessionTracking??!0)&&(this.session={id:this.getRandomUUID(),startedAt:(new Date).toISOString(),events:{handled:0,unhandled:0}},this.startSession())}addMetadata(e){for(let t of Object.keys(e))this.persistedMetadata[t]=e[t]}getSessionId(){return this.session?.id}leaveBreadcrumb(e,t,n="manual"){this.breadcrumbs.push({name:e,metaData:t,type:n,timestamp:(new Date).toISOString()})}notify(e,{errorClass:t,severity:n,severityType:r,handled:o=!0,metadata:i,context:a,groupingHash:s}={}){let c=Qi(e),u={...this.metadata,...this.persistedMetadata,...i},l=this.buildBugsnagEvent(c,{errorClass:t,severityType:r,handled:o,severity:n,metadata:u,context:a,groupingHash:s});if((this.onError?.(l,e)??!0)&&"development"!==this.releaseStage){this.updateAndAppendSessionInformation(l);let t=this.sendToBugsnag(l);return this.onPostErrorListeners.forEach(t=>t(l,e)),t}return Promise.resolve()}addOnPostError(e){this.onPostErrorListeners.push(e)}updateAndAppendSessionInformation(e){this.session&&(e.unhandled?this.session.events.unhandled++:this.session.events.handled++,e.session=this.session)}buildBugsnagEvent(e,{errorClass:t,severity:n="error",severityType:r="handledException",handled:o,metadata:i={},context:a,groupingHash:s}){let c=(new Date).toISOString(),{breadcrumbs:u,appId:l,appType:f,appVersion:d,releaseStage:h,locale:p,userAgent:m}=this;return{payloadVersion:"5",exceptions:e.map((e,n)=>({errorClass:0===n?t??e.name:e.name,stacktrace:ia(l,e),message:e.message,type:"browserjs"})),severity:n,severityReason:{type:r},unhandled:!o,app:{id:l,type:f,version:d,releaseStage:h},device:{time:c,locale:p,userAgent:m},breadcrumbs:u,context:a,metaData:i,groupingHash:s}}async startSession(){if("development"===this.releaseStage)return void console.log("Skipping error logging session tracking in development mode");let{apiKey:e}=this,t={notifier:{name:"Bugsnag JavaScript",version:"7.22.2",url:"https://github.com/bugsnag/bugsnag-js"},app:{version:this.appVersion,releaseStage:this.releaseStage,type:this.appType},device:{id:this.appId,locale:this.locale,userAgent:this.userAgent},sessions:[this.session]};try{await fetch(this.endpoints.sessions,{method:"POST",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":e,"Bugsnag-Payload-Version":"5","Bugsnag-Sent-At":this.session?.startedAt??(new Date).toISOString()},body:JSON.stringify(sa(t))})}catch(n){console.warn("[bugsnag-light] failed to start session"),console.warn(n)}}async sendToBugsnag(e){let{apiKey:t}=this,n={apiKey:t,notifier:{name:"Bugsnag JavaScript",version:"7.22.2",url:"https://github.com/bugsnag/bugsnag-js"},events:[e]};try{await fetch(this.endpoints.notify,{method:"POST",headers:{"Content-Type":"application/json","Bugsnag-Api-Key":t,"Bugsnag-Payload-Version":"5","Bugsnag-Sent-At":e.device.time},body:JSON.stringify(sa(n))})}catch(r){console.warn("[bugsnag-light] failed to send an event"),console.warn(r)}}getRandomUUID(){try{return crypto.randomUUID()}catch{return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}}};function ia(e,t){let n=function(e){return e.stack?e.stack.match(ta)?function(e){return e.stack.split("\n").filter(e=>!!e.match(ta)).map(e=>{let t=e.replace(/^\s+/,"").replace(/^.*?\s+/,""),n=t.match(/ (\(.+\)$)/);t=n?t.replace(n[0],""):t;let r=ra(n?n[1]:t);return{method:n&&t||void 0,file:["eval",""].indexOf(r[0])>-1?void 0:r[0],lineNumber:r[1],columnNumber:r[2]}})}(e):function(e){return e.stack.split("\n").filter(e=>!e.match(na)).map(e=>{if(-1===e.indexOf("@")&&-1===e.indexOf(":"))return{method:e};let t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,o=ra(e.replace(t,""));return{method:r,file:o[0],lineNumber:o[1],columnNumber:o[2]}})}(e):[]}(t).map(t=>{let n=t.file?.includes(e);return{method:t.method??"",file:t.file??"",lineNumber:t.lineNumber??0,columnNumber:t.columnNumber,inProject:n}});if(t instanceof ea){let e=n.findIndex(e=>e.method.endsWith("notify"));e>-1&&(n=n.slice(e+1))}return n}var aa=50;function sa(e,t=new Set,n=0){if(null===e||"object"!=typeof e)return e;if(n>=aa)return"[MaxDepth]";if(t.has(e))return"[Circular]";let r=new Set(t);if(r.add(e),Array.isArray(e))return e.map(e=>sa(e,r,n+1));let o={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(o[i]=sa(e[i],r,n+1));return o}var ca=class e extends Error{reason;constructor(t,n){super(t,n),this.name="BreadcrumbsPluginFetchError",Object.setPrototypeOf(this,e.prototype)}};function ua(e,{metadata:t}={}){let n=window.onerror;window.onerror=(r,o,i,a,s)=>{s&&e.notify(s,{severityType:"unhandledException",handled:!1,metadata:t}),"function"==typeof n&&n.apply(window.onerror,[r,o,i,a,s])}}function la(e,{metadata:t}={}){window.addEventListener("unhandledrejection",n=>{n.reason&&n.reason instanceof Error&&n.reason.stack&&!(n.reason instanceof ca)&&e.notify(n.reason,{severityType:"unhandledPromiseRejection",handled:!1,metadata:t})})}var fa={load(e){e.addOnPostError(t=>{e.leaveBreadcrumb(t.exceptions[0].errorClass,{errorClass:t.exceptions[0].errorClass,errorMessage:t.exceptions[0].message,severity:t.severity},"error")})}};function da(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var ha={load(e){"addEventListener"in self&&self.addEventListener("click",t=>{let n="[hidden]";try{let e=function(e){return da(e)&&e.nodeType===Node.ELEMENT_NODE}(t.target)?t.target:null;n=e?pa(e):"(Non-Element Target)"}catch{}let r=function(){try{return window.self===window.top?"in-top-window":"in-same-origin-iframe"}catch{return"in-cross-origin-iframe"}}();e.leaveBreadcrumb("UI click",{targetSelector:n,targetFrame:r},"user")},!0)}};function pa(e){let t=e.tagName;if(e.id&&(t+=`#${e.id}`),e.className?.length&&(t+=`.${e.className.replace(/ /g,".")}`),!self.document.querySelectorAll)return t;try{if(1===self.document.querySelectorAll(t).length)return t}catch{return t}return e.parentNode&&e.parentNode.childNodes.length>1&&(t+=`:nth-child(${Array.from(e.parentNode.children).indexOf(e)+1})`),1===self.document.querySelectorAll(t).length?t:e.parentElement?`${pa(e.parentElement)} > ${t}`:t}var ma={load(e){let t=["log","debug","info","warn","error"].filter(e=>typeof console<"u"&&"function"==typeof console[e]);for(let n of t){let t=console[n];console[n]=(...r)=>{e.leaveBreadcrumb("Console output",r.reduce((e,t,n)=>{let r="[Unknown value]";try{r=String(t)}catch{}if("[object Object]"===r)try{r=JSON.stringify(t)}catch{}return e[`[${n}]`]=r,e},{severity:n}),"log"),t.apply(console,r)}}}},_a={load(e){if(!("addEventListener"in self))return;let t=t=>()=>e.leaveBreadcrumb(t,void 0,"navigation");self.addEventListener("pagehide",t("Page hidden"),!0),self.addEventListener("pageshow",t("Page shown"),!0),self.addEventListener("load",()=>{self.addEventListener("popstate",t("Navigated back"),!0)},!0),self.document?.addEventListener("DOMContentLoaded",t("DOMContentLoaded"),!0),self.location&&self.addEventListener("hashchange",t=>e.leaveBreadcrumb("Hash changed",{from:t.oldURL&&va(t.oldURL),to:va(t.oldURL?t.newURL:self.location.href),state:t.oldURL&&ya(self)},"navigation"),!0);let n=e.leaveBreadcrumb.bind(e);self.history&&self instanceof Window&&("function"==typeof self.history.replaceState&&ga({fn:"replaceState",target:self.history,leaveBreadcrumb:n,win:self}),"function"==typeof self.history.pushState&&ga({fn:"pushState",target:self.history,leaveBreadcrumb:n,win:self}))}};function va(e){try{let t=new URL(e);return`${t.pathname}${t.search}${t.hash}`}catch{return e}}function ya(e){try{return e.history.state}catch{return{}}}function ga({fn:e,leaveBreadcrumb:t,target:n,win:r}){let o=n[e];n[e]=(i,a,s)=>{t(`History ${e}`,function({win:e,state:t,title:n,url:r}){let o=va(e.location.href);return{title:n,state:t,prevState:ya(e),to:r||o,from:o}}({win:r,state:i,title:a,url:s}),"navigation"),o.apply(n,[i,a,s])}}var wa={load(e){if(!("fetch"in self))return;let t=self.fetch;self.fetch=function(n,r){let o,i="GET";!function(e){return e instanceof Request||da(e)&&"url"in e}(n)?o=n.toString():(o=n.url,i=n.method),r&&"string"==typeof r.method&&r.method.length&&(i=r.method);let a=e.leaveBreadcrumb.bind(e);return new Promise((e,s)=>{t(n,r).then(t=>{let n=t.headers?.get("x-request-id");ba({message:"fetch() "+(t.status>=400?"failed":"succeeded"),url:o,leaveBreadcrumb:a,breadcrumbMetadata:{request:`${i} ${o}`,status:t.status,...n&&{requestId:n}}}),e(t)}).catch(e=>{ba({message:"fetch() error",url:o,leaveBreadcrumb:a,breadcrumbMetadata:{error:e?.message,request:`${i} ${o}`}}),s(new ca(e?.message,{cause:e}))})})}}};function ba({message:e,url:t,leaveBreadcrumb:n,breadcrumbMetadata:r}){t.startsWith("https://notify.bugsnag")||n(e,r,"request")}var Ea,Sa=-1,ka=function(e){addEventListener("pageshow",function(t){t.persisted&&(Sa=t.timeStamp,e(t))},!0)},xa=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart=0?r="back-forward-cache":n&&(document.prerendering||Ca()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},Aa=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver(function(e){Promise.resolve().then(function(){t(e.getEntries())})});return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(o){}},$a=function(e,t,n,r){var o,i;return function(a){var s,c;t.value>=0&&(a||r)&&((i=t.value-(o||0))||void 0===o)&&(o=t.value,t.delta=i,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t))}},Ta=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},Na=function(e){document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&e()})},Ma=function(e){var t=!1;return function(){t||(e(),t=!0)}},Oa=-1,Ra=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},La=function(e){"hidden"===document.visibilityState&&Oa>-1&&(Oa="visibilitychange"===e.type?e.timeStamp:0,Ia())},Ua=function(){addEventListener("visibilitychange",La,!0),addEventListener("prerenderingchange",La,!0)},Ia=function(){removeEventListener("visibilitychange",La,!0),removeEventListener("prerenderingchange",La,!0)},Da=function(){return Oa<0&&(Oa=Ra(),Ua(),ka(function(){setTimeout(function(){Oa=Ra(),Ua()},0)})),{get firstHiddenTime(){return Oa}}},ja=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},Fa=[1800,3e3],Ba=[.1,.25],qa=function(e,t){t=t||{},function(e,t){t=t||{},ja(function(){var n,r=Da(),o=Pa("FCP"),i=Aa("paint",function(e){e.forEach(function(e){"first-contentful-paint"===e.name&&(i.disconnect(),e.startTimer.value&&(r.value=o,r.entries=i,n())},s=Aa("layout-shift",a);s&&(n=$a(e,r,Ba,t.reportAllChanges),Na(function(){a(s.takeRecords()),n(!0)}),ka(function(){o=0,r=Pa("CLS",0),n=$a(e,r,Ba,t.reportAllChanges),Ta(function(){return n()})}),setTimeout(n,0))}))},Ha=0,Wa=1/0,Ka=0,za=function(e){e.forEach(function(e){e.interactionId&&(Wa=Math.min(Wa,e.interactionId),Ka=Math.max(Ka,e.interactionId),Ha=Ka?(Ka-Wa)/7+1:0)})},Ga=function(){return Ea?Ha:performance.interactionCount||0},Ja=[],Va=new Map,Za=0,Xa=[],Qa=function(e){if(Xa.forEach(function(t){return t(e)}),e.interactionId||"first-input"===e.entryType){var t=Ja[Ja.length-1],n=Va.get(e.interactionId);if(n||Ja.length<10||e.duration>t.latency){if(n)e.duration>n.latency?(n.entries=[e],n.latency=e.duration):e.duration===n.latency&&e.startTime===n.entries[0].startTime&&n.entries.push(e);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};Va.set(r.id,r),Ja.push(r)}Ja.sort(function(e,t){return t.latency-e.latency}),Ja.length>10&&Ja.splice(10).forEach(function(e){return Va.delete(e.id)})}}},Ya=function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=Ma(e),"hidden"===document.visibilityState?e():(n=t(e),Na(e)),n},es=[200,500],ts=function(e,t){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(t=t||{},ja(function(){var n;"interactionCount"in performance||Ea||(Ea=Aa("event",za,{type:"event",buffered:!0,durationThreshold:0}));var r,o=Pa("INP"),i=function(e){Ya(function(){e.forEach(Qa);var t=function(){var e=Math.min(Ja.length-1,Math.floor((Ga()-Za)/50));return Ja[e]}();t&&t.latency!==o.value&&(o.value=t.latency,o.entries=t.entries,r())})},a=Aa("event",i,{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40});r=$a(e,o,es,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),Na(function(){i(a.takeRecords()),r(!0)}),ka(function(){Za=Ga(),Ja.length=0,Va.clear(),o=Pa("INP"),r=$a(e,o,es,t.reportAllChanges)}))}))},ns=[2500,4e3],rs={},os=function(e,t){t=t||{},ja(function(){var n,r=Da(),o=Pa("LCP"),i=function(e){t.reportAllChanges||(e=e.slice(-1)),e.forEach(function(e){e.startTime`${t}${n}=${encodeURIComponent(e[n])}`,""))}(r),s=ls("#",o);return new URL(us(`${i}${a}${s}`,t.prefix),t.href)}return"function"==typeof e?cs(e(t),t):new URL(us(e,t.prefix),ds(t.href))}function us(e,t){return t&&0===e.indexOf("/")?`${ds(t)}${e.slice(1)}`:e}function ls(e,t=""){return 0===t.length||t[0]===e?t:`${e}${t}`}function fs(){return`${String(Date.now())}${Math.random()}`}function ds(e){return 0===e.length?"/":"/"===e[e.length-1]?e:`${e}/`}function hs(e){return 1===e.length?e:"/"===e[e.length-1]?e.slice(0,-1):e}function ps(e){return"/"===e[0]?hs(e):`/${hs(e)}`}function ms(e,t,n,r){const o=function(e,t,n=""){const r=vs(e,t)??"",o=n?`${r}${n}`:r,i="/"===(a=hs(e.pathname.replace(o,"")))[0]?a.slice(1):a;var a;return{previousMatchedPathPrefix:n,remainderRelative:i,remainderAbsolute:`${ds(n)}${i}`}}(e,t,r);if(null==n)return{matched:hs(o.remainderAbsolute)};if("function"==typeof n){if(!n(e))return;return{matched:hs(o.remainderAbsolute)}}if("string"==typeof n){const e=hs(n);if("/"===e)return"/"===o.remainderAbsolute?{matched:e,nextMatchedPathPrefix:e}:void 0;if("/"===e[0]){if(!o.remainderAbsolute.startsWith(e))return;return{matched:e,nextMatchedPathPrefix:e}}if(!o.remainderRelative.startsWith(e))return;return{matched:e,nextMatchedPathPrefix:`${o.previousMatchedPathPrefix}${ps(e)}`}}if(n instanceof RegExp){const e=o.remainderRelative.match(n);if(null!=e&&0===e.index)return{matched:hs(e[0]),nextMatchedPathPrefix:`${o.previousMatchedPathPrefix}${ps(e[0])}`};const t=o.remainderAbsolute.match(n);if(null==t||0!==t.index)return;const r=hs(t[0]);return{matched:r,nextMatchedPathPrefix:r}}}function _s(e,t){return null!=vs(e,t)}function vs(e,t){if(!t)return;if("string"==typeof t)return 0===e.pathname.indexOf(t)?hs(t):void 0;const n=new RegExp(t.source).exec(e.pathname);return null!=n&&0===n.index?hs(n[0]):void 0}const ys="_key";class gs{#e;#t;#n=new Set;#r=new Set;#o=!1;#i;#a;constructor(e,{prefix:t,state:n}={}){this.prefix=t,this.#e=qe(e?ss(e,n??{},fs(),t):ws(t)),this.currentUrl=this.#e,this.#t=[this.#e.value.key],"undefined"!=typeof window&&window.addEventListener("popstate",this.#s)}currentUrlMatches(e){return null!=ms(this.#e.value,this.prefix,e)}navigate(e,{state:t={},replace:n=!1}={}){const r=this.#e.value,o=cs(e,r);for(const d of this.#r)d(r,o);const i=fs(),a=ss(o,t,i,this.prefix),s={...t,[ys]:i};if(!this.#o&&this.#c(a,()=>{this.#o=!0,this.navigate(a,{replace:n})}))return;this.#o=!1;const c=`${(u=a).pathname}${u.search}${u.hash}`;var u;try{history[n?"replaceState":"pushState"](s,"",c)}catch{return void window.location[n?"replace":"assign"](c)}const l=this.#t.lastIndexOf(r.key);n?this.#t.splice(l,1,i):this.#t.splice(l+1,this.#t.length-l-1,i);const f=ws(this.prefix,i);this.#e.value=f,this.#u(r,f)}redirect(e){if(null==e)return;const t=this.#e.value,n=cs(e,t);if("undefined"==typeof window)throw new is(n);const r=t.key;if(null!=this.#i)return this.#i.to=n,void(this.#i.fromNavigationKey=r);this.#i={to:n,fromNavigationKey:r},window.requestAnimationFrame(()=>{const e=this.#i;this.#i=void 0,null!=e&&this.#e.value.key===e.fromNavigationKey&&this.navigate(e.to,{replace:!0})})}beforeNavigate(e){return this.#r.add(e),()=>{this.#r.delete(e)}}block(e=()=>!0){return this.#n.add(e),()=>{this.#n.delete(e)}}go(e){window.history.go(e)}back(e=-1){this.go(e)}forward(e=1){this.go(e)}resolve(e){return cs(e,this.#e.value)}#s=()=>{const e=this.#e.value;if(e.pathname===window.location.pathname){const e=window.location.hash,t=e?.slice(1);if(t)return}const t=this.#t[0],n=ws(this.prefix,t),r=this.#t.lastIndexOf(window.history.state?.[ys]??t),o=this.#t.lastIndexOf(e.key)-r;if(!this.#o&&this.#c(n,()=>{o&&(this.#o=!0,this.go(o))},!0))return this.#o=!0,void this.go(-o);this.#o=!1,this.#e.value=n,this.#u(e,n)};#u(e,t){e.pathname!==t.pathname&&"undefined"!=typeof window&&(null!=this.#a&&window.cancelAnimationFrame(this.#a),this.#a=window.requestAnimationFrame(()=>{this.#a=void 0,document.body.focus()}))}#c(e,t,n=!1){return[...this.#n].some(r=>r(e,t,n))}}function ws(e,t){const{[ys]:n,...r}=window.history.state??{};return ss(new URL(window.location.href),r,n??t??fs(),e)}const bs="http://localhost:8082",Es="https://monorail-edge.shopifysvc.com",Ss="/v1/produce";function ks(e){return void 0!==e.schemaId}class xs{constructor(e){this.producer=e}do(e,t){return ks(e)?this.producer.produce(e):this.producer.produceBatch(e)}}function Cs(){if("undefined"!=typeof crypto&&crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();const e=new Array(36);for(let t=0;t<36;t++)e[t]=Math.floor(16*Math.random());return e[14]=4,e[19]=e[19]&=-5,e[19]=e[19]|=8,e[8]=e[13]=e[18]=e[23]="-",e.map(e=>e.toString(16)).join("")}function Ps(e,t=!0){return e&&Object.keys(e).length&&t?Object.keys(e).map(t=>({[As(t)]:e[t]})).reduce((e,t)=>({...e,...t})):e}function As(e){return e.split(/(?=[A-Z])/).join("_").toLowerCase()}function $s(e){return e.events.map(e=>{let t=!0,n=!0;return e&&e.options&&Object.prototype.hasOwnProperty.call(e.options,"convertEventCase")&&(t=Boolean(e.options.convertEventCase)),e&&e.options&&Object.prototype.hasOwnProperty.call(e.options,"convertMetaDataCase")&&(n=Boolean(e.options.convertMetaDataCase)),{schema_id:e.schemaId,payload:Ps(e.payload,t),...e.metadata&&{metadata:Ps(e.metadata,n)}}})}class Ts extends Error{name="MonorailUnableToProduceError";constructor(e){super(`Error producing to the Monorail Edge. Response received: ${JSON.stringify(e)}`),this.response=e,Object.setPrototypeOf(this,Ts.prototype)}}class Ns extends Error{name="MonorailInterceptedProduceError";constructor(e){super(`Response not from Monorail Edge. Response received: ${JSON.stringify(e)}`),this.response=e,Object.setPrototypeOf(this,Ns.prototype)}}class Ms extends Error{name="MonorailBatchProduceError";constructor(e){super(`Error producing to the Monorail Edge. Response received: ${JSON.stringify(e)}`),Object.setPrototypeOf(this,Ms.prototype),this.response=e}}class Os extends Error{name="MonorailRequestError";constructor(e,t){super(`Error completing request. A network failure may have prevented the request from completing. Error: ${e}. Schemas: ${Array.from(new Set(t)).join(", ")}`),Object.setPrototypeOf(this,Os.prototype)}}class Rs extends Error{name="MonorailResponseReadError";constructor(e,t){super(`Error reading response from Monorail Edge. Status: ${t||"unknown"}. Error: ${e?.message||"Unknown error"}`),this.error=e,this.status=t,Object.setPrototypeOf(this,Rs.prototype)}}class Ls{static withEndpoint(e){return new Ls(`https://${new URL(e).hostname}`)}constructor(e=bs,t={}){if(this.edgeDomain=e,this.optionsOrKeepalive=t,"boolean"==typeof t)return this.keepalive=t,void(this.detectInterceptedErrorEnabled=!1);this.keepalive=t.keepalive??!1,this.detectInterceptedErrorEnabled=t.detectInterceptedErrorEnabled??!1}async produceBatch(e){const t={events:$s(e),metadata:Ps(e.metadata)};let n,r;try{n=await fetch(this.produceBatchEndpoint(),{method:"post",headers:Us(e.metadata),body:JSON.stringify(t),keepalive:e.options?.keepalive??this.resolveKeepaliveFromEvents(e.events)})}catch(o){throw new Os(o,e.events.map(e=>e.schemaId))}if(207===n.status){const e=await n.json();throw new Ms(e)}try{r=await n.text()}catch(o){throw new Rs(o,n.status)}if(!n.ok){if(!Boolean(n.headers.get("x-request-id"))&&this.detectInterceptedErrorEnabled)throw new Ns({status:n.status,message:r});throw new Ts({status:n.status,message:r})}return{status:n.status}}async produce(e){let t,n,r=!0;e&&e.options&&Object.prototype.hasOwnProperty.call(e.options,"convertEventCase")&&(r=Boolean(e.options.convertEventCase));try{t=await async function({endpoint:e,event:t,keepalive:n}){const r=t.metadata?{clientMessageId:t.metadata?.clientMessageId,eventCreatedAtMs:t.metadata?.eventCreatedAtMs,consent:t.metadata?.consent,consent_provider:t.metadata?.consent_provider,consent_version:t.metadata?.consent_version}:void 0;return fetch(e??Es+Ss,{method:"post",headers:Us(t.metadata),body:JSON.stringify({schema_id:t.schemaId,payload:t.payload,metadata:r&&Ps(r,!0)}),keepalive:n})}({endpoint:this.produceEndpoint(),keepalive:e.options?.keepalive??this.keepalive,event:{...e,payload:Ps(e.payload,r)}})}catch(o){throw new Os(o,[e.schemaId])}if(!t)throw new Ts({message:"No response from edge"});try{n=await t.text()}catch(o){throw new Rs(o,t.status)}if(!t.ok){if(!Boolean(t.headers.get("x-request-id"))&&this.detectInterceptedErrorEnabled)throw new Ns({status:t.status,message:n});throw new Ts({status:t.status,message:n})}return{status:t.status}}resolveKeepaliveFromEvents(e){for(const t of e)if(!0===t.options?.keepalive)return!0;return this.keepalive}produceBatchEndpoint(){return this.edgeDomain+"/unstable/produce_batch"}produceEndpoint(){return this.edgeDomain+Ss}}function Us(e){const t={"Content-Type":"application/json; charset=utf-8","X-Monorail-Edge-Event-Created-At-Ms":(e&&e.eventCreatedAtMs||Date.now()).toString(),"X-Monorail-Edge-Event-Sent-At-Ms":Date.now().toString(),"X-Monorail-Edge-Client-Message-Id":(e&&e.clientMessageId||Cs()).toString()};return e&&e.userAgent&&(t["User-Agent"]=e.userAgent),e&&e.remoteIp&&(t["X-Forwarded-For"]=e.remoteIp),e&&e.deviceInstallId&&(t["X-Monorail-Edge-Device-Install-Id"]=e.deviceInstallId),e&&e.client&&(t["X-Monorail-Edge-Client"]=e.client),e&&e.clientOs&&(t["X-Monorail-Edge-Client-OS"]=e.clientOs),t}class Is{static printWelcomeMessage(e){console.log(`%c👋 from Monorail%c\n\nWe've noticed that you're${e?"":" not"} running in debug mode. As such, we will ${e?"produce":"not produce"} Monorail events to the console. \n\nIf you want Monorail events to ${e?"stop":"start"} appearing here, %cset debugMode=${(!e).toString()}%c, for the Monorail Log Producer in your code.`,"font-size: large;","font-size: normal;","font-weight: bold;","font-weight: normal;")}constructor(e){this.sendToConsole=e,e&&Is.printWelcomeMessage(e)}async produce(e){return this.sendToConsole&&console.log("Monorail event produced",e),new Promise(t=>{t(e)})}produceBatch(e){return this.sendToConsole&&console.log("Monorail Batch event produced",e),new Promise(t=>{t(e)})}}class Ds{static createLogProducer(e){return new Ds(new Is(e.debugMode),e.middleware||[])}static createHttpProducerWithEndpoint(e,t=[]){return new Ds(Ls.withEndpoint(e),t)}static createHttpProducer(e){return new Ds(e.production?new Ls(Es,e.options):new Ls(bs,e.options),e.middleware||[])}static buildMiddlewareChain(e,t=0){return t===e.length?this.identityFn:n=>e[t].do(n,this.buildMiddlewareChain(e,t+1))}constructor(e,t){this.producer=e,this.middleware=t,this.executeChain=Ds.buildMiddlewareChain(this.middleware.concat(new xs(e)))}produce(e){return e.metadata={eventCreatedAtMs:Date.now(),clientMessageId:Cs(),...e.metadata},this.executeChain(e)}produceBatch(e){return this.executeChain(e)}}class js{constructor(e){this.version=e.version}}class Fs{eventsAwaitingConsent=[];constructor(e,t=()=>!1){if(!e?.provider)throw new Bs("ConsentTrackingMiddleware requires an instance of ConsentTrackingProvider");this.isStrictlyNecessary=t,this.provider=e.provider}async do(e,t){if(ks(e)){const n=await this.provider.annotateEvent(e);return this.isConsentGivenForEmission(n)?(await this.processBufferedEvents(t),t(n)):this.isStrictlyNecessary(n)?t(n):(this.eventsAwaitingConsent.push(e),Promise.resolve({status:0,message:"Consent not granted and event not marked strictly necessary, event not sent"}))}{if(this.isConsentGivenForEmission(await this.provider.annotateEvent(e.events[0]))){await this.processBufferedEvents(t);const n=await Promise.all(e.events.map(e=>this.provider.annotateEvent(e)));return t({...e,events:n})}const n=e.events.filter(e=>!!this.isStrictlyNecessary(e)||(this.eventsAwaitingConsent.push(e),!1));if(n.length>0){const r=await Promise.all(n.map(e=>this.provider.annotateEvent(e)));return t({...e,events:r})}return Promise.resolve({status:0,message:"Consent not granted for any event, and no event marked strictly necessary, event batch not sent"})}}isConsentGivenForEmission(e){const t=e.metadata?.consent,n=this.provider.getRequiredConsentForEmission();return Boolean(Array.isArray(t)&&t.some(e=>n.includes(e)))}async processBufferedEvents(e){if(0===this.eventsAwaitingConsent.length)return;const t=this.eventsAwaitingConsent;this.eventsAwaitingConsent=[];const n=await Promise.all(t.map(e=>this.provider.annotateEvent(e)));await e({events:n})}}class Bs extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Bs.prototype)}}const qs="__quiltRouterScroll",Hs={},Ws="undefined"==typeof window?()=>{}:le;function Ks(){return!0}function zs(){}const Gs=H(null);class Js extends Error{constructor(){super(...arguments),this.name="PrefetcherError"}}function Vs(e){return null==e?"":"string"==typeof e?e:e instanceof RegExp?e.source:e.toString()}function Zs(e,t,n){if(0===n.length)return"";let r,o="";for(const i of n){const n=ms(e,t.prefix,i,r);if(null==n)return!1;r=n.nextMatchedPathPrefix??r,o=n.matched}return o}function Xs({event:e,handler:t,...n}){return function(e,t,{target:n,once:r,passive:o,capture:i}={}){ue(()=>{const a=n||window,s=function(){if(null!==Ys)return Ys;try{const e=Object.defineProperty({},"once",{get(){Ys=!0}});document.addEventListener("test",ec,e)}catch{Ys=!1}return document.removeEventListener("test",ec),Ys}(),c=function(){if(null!==Qs)return Qs;try{const e=Object.defineProperty({},"passive",{get(){Qs=!0}});document.addEventListener("test",ec,e)}catch{Qs=!1}return document.removeEventListener("test",ec),Qs}(),u=r&&!s?function(e,t,n){return function(r){n(r),e.removeEventListener(t,n)}}(a,e,t):t;return s||c?(a.addEventListener(e,u,{once:r,passive:o,capture:i}),()=>{a.removeEventListener(e,u,{capture:i})}):(a.addEventListener(e,u,i),()=>{a.removeEventListener(e,u,i)})},[e,t,n,r,o,i])}(e,t,n),null}let Qs=null,Ys=null;function ec(){}const tc=Er(function({router:e,children:t}){const n=he(()=>function(e){let t=0;const n=new Set,r=new Set;return{registerRoutes(e){const n=new Set,o=new Set;function a(e,i=[]){const{children:s,match:c,renderPrefetch:u}=e,l=c?[...i,c]:i;if(null!=u){const e=l.map(Vs).join(",");if(o.has(e))throw new Js(`Duplicate prefetch registration for match chain "${e}"`);o.add(e);const i={id:"Prefetch"+t++,matches:l,render:u};n.add(i),r.add(i)}if(null!=s)for(const t of s)a(t,l)}for(const t of e)a(t);return n.size>0&&i(),()=>{if(0!==n.size){for(const e of n)r.delete(e);n.clear(),i()}}},getMatches:o,listenForMatch(e,t){function r(){t(o(e))}return n.add(r),()=>{n.delete(r)}}};function o(t){const n=[];for(const o of r){const r=Zs(t,e,o.matches);"string"==typeof r&&n.push({id:o.id,matched:r,render:o.render})}return n}function i(){for(const e of n)e()}}(e),[e]),[r,o]=se(null),[i,a]=se([]),s=fe(null),c=fe(null),{current:u}=fe("undefined"==typeof navigator||!("connection"in navigator)||!navigator.connection?.saveData);ue(()=>{if(null!=r)return n.listenForMatch(r,a)},[n,r]);const l=()=>{null!=s.current&&(window.clearTimeout(s.current),s.current=null,c.current=null)},f=pe(({target:e})=>{if(null==e)return;const t=rc(e);if(null!=t){if(s.current){if(nc(t,c.current))return;l()}c.current=t,s.current=window.setTimeout(()=>{l(),o(t),a(n.getMatches(t))},150)}},[n]),d=pe(({target:e,relatedTarget:t})=>{if(null==e)return void l();if(null==r&&null==s.current)return;const n=rc(e),i=t&&rc(t);null!=s.current&&nc(n,c.current)&&!nc(i,c.current)&&l(),nc(n,r)&&!nc(i,r)&&(o(null),a([]))},[r]),h=pe(({target:e})=>{if(l(),null==e)return;const t=rc(e);null!=t&&(o(t),a(n.getMatches(t)))},[n]),p=r?so("div",{style:{visibility:"hidden"},children:i.map(({id:e,matched:t,render:n})=>so("div",{children:n({url:r,matched:t})},e))}):null,m=u?so(S,{children:[so(Xs,{passive:!0,event:"mouseover",handler:f}),so(Xs,{passive:!0,event:"focusin",handler:f}),so(Xs,{passive:!0,event:"mouseout",handler:d}),so(Xs,{passive:!0,event:"focusout",handler:d})]}):null;return so(S,{children:[so(Gs.Provider,{value:n,children:t}),so(Xs,{passive:!0,event:"mousedown",handler:h}),m,p]})});function nc(e,t){return null==e&&e===t||null!=e&&null!=t&&e.href===t.href}function rc(e){if(!(e instanceof HTMLElement))return;const t=e.closest("[href], [data-href]");if(null==t||!(t instanceof HTMLElement))return;const n=t.getAttribute("href")||t.getAttribute("data-href");try{return n?new URL(n,window.location.href):void 0}catch{return}}const oc=Er(function({children:e,router:t}){return so(tc,{router:t,children:[e,so(ic,{router:t}),so(ac,{router:t})]})});function ic({router:e}){return function(e,{id:t="__default",manual:n=!1,include:r=Ks,persist:o="sessionStorage"}={}){const i=e.currentUrl.value,a=fe(null),s=fe(),c=fe(),u=he(()=>"memory"===o?Hs:(()=>{try{return JSON.parse(sessionStorage.getItem(qs)??"{}")}catch{return{}}})(),[o]),l=pe(()=>{const e=a.current??document.documentElement;if(!r(i))return zs;let n=u[i.key];if(n){const e=n[t];null==e?(n[t]=0,l(0)):l(e)}else n={[t]:0},u[i.key]=n,l(0);return f(),()=>{n[t]=e.scrollTop,f(),null!=c.current&&(window.cancelAnimationFrame(c.current),c.current=void 0)};function l(t){c.current=window.requestAnimationFrame(()=>{e.scrollTop=t,c.current=void 0})}function f(){var e,t;"sessionStorage"===o&&(null!=(t=s.current)&&("function"==typeof window.cancelIdleCallback?window.cancelIdleCallback(t):"number"==typeof t&&window.clearTimeout(t)),s.current=(e=()=>{try{sessionStorage.setItem(qs,JSON.stringify(u))}catch{}},"function"==typeof window.requestIdleCallback?window.requestIdleCallback(e):window.setTimeout(e,0)))}},[i.normalizedPath]);Ws(()=>{if(!n)return l()},[l])}(e),null}function ac({router:e}){return function(e){const t=e.currentUrl.value;ue(()=>{if("undefined"==typeof window)return;const e=t.hash;if(!e||e.length<=1)return;const n=e.substring(1),r=document.getElementById(n);r&&window.requestAnimationFrame(()=>{r.scrollIntoView()})},[t.hash])}(e),null}const sc={}.hasOwnProperty;function cc(...e){let t="";for(const n of e)n&&(t=lc(t,uc(n)));return t}function uc(e){if("string"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return cc(...e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();let t="";for(const n in e)sc.call(e,n)&&e[n]&&(t=lc(t,n));return t}function lc(e,t){return t?e?`${e} ${t}`:t:e}function fc(e,t){return`${e}${"number"==typeof t?String(t):`${t[0].toUpperCase()}${t.substring(1)}`}`}function dc(e,{suspense:t,cacheErrors:n=!0}={}){const{id:r}=e,o=pe(()=>e.resolve({cacheErrors:n}),[e,n]),{snapshot:i,subscribe:a}=he(()=>({snapshot:()=>e.resolved,subscribe:t=>e.subscribe(t)}),[e]),s=Tr(a,i);if(t&&null==s)throw"undefined"==typeof window?new Promise(e=>{setTimeout(()=>{e(o())},10)}):new Promise(e=>{setTimeout(async()=>{e(await o())},0)});return s instanceof Error?{id:r,resolved:null,error:s,loading:!1,load:o}:{id:r,resolved:s,error:null,loading:null==s,load:o}}class hc extends Error{constructor(e,t){const n=t?`Dynamic import "${t}"`:"Dynamic import",{detail:r,exports:o}=function(e){if(null==e)return{detail:`${String(e)} instead of a module`};if("default"in e)return{detail:`a module whose default export is ${String(e.default)}`};const t=Object.keys(e);return{detail:`a module without a default export${t.length>0?` (exports: ${t.join(", ")})`:""}`,exports:t}}(e);super(`${n} resolved to ${r}`),this.name="MissingDefaultExportError",this.exports=o}}function pc({name:e,fallback:t,children:n}){const r=he(()=>e?function(e){return`S${t=e,0===t.length?"0":Array.from(t,e=>e.codePointAt(0).toString(36)).join("_")}`;var t}(e):void 0,[e]);return void 0===r?so(Fr,{fallback:t,children:n}):so(mc,{namespace:r,fallback:t,children:n},r)}class mc extends k{render(){const e=this.__v;return e&&(this.mask??=[this.props.namespace,0],e.__m=this.mask),so(Fr,{fallback:this.props.fallback,children:this.props.children})}}function _c({id:e,load:t,displayName:n,suspense:r=!0,suspenseName:o,renderLoading:i=yc,renderError:a=bc,useError:s,usePreload:c,usePrefetch:u}){const l=function({id:e,displayName:t,load:n}){let r,o,i=!0;const a=e?.(),s=a??t,c=new Set;return{get id(){return a},get resolved(){return r},resolve:async e=>{const t=e?.cacheErrors??!0;return o?i||=t:(i=t,o=async function(){let e=!1;try{return r=function(e,t){if(null==e)throw new hc(e,t);if("object"!=typeof e)return e;if("default"in e){if(null==e.default)throw new hc(e,t);return e.default}if(n=e,"[object Module]"===Object.prototype.toString.call(n))throw new hc(e,t);var n;return e}(await n(),s),e=!0,u(),r}catch(t){const e=t instanceof Error?t:void 0;return i&&(r=e,u()),e}finally{e||(o=void 0,i=!0)}}()),o},subscribe:e=>(c.add(e),()=>{c.delete(e)})};function u(){for(const e of c)e(r)}}({id:e,displayName:n,load:t}),f=n??function(e){if(!e)return gc;const t=wc.exec(e);return t?.[1]??gc}(l.id);function d(e){const{resolved:t,load:n,loading:o,error:c}=dc(l,{suspense:r});if(s?.(c,e),c)return so(S,{children:a(c,e)});let u=null;const f=t?so(t,{...e}):null;return r?f:(u=o?i(e):f,so(S,{children:[u,o&&so(Ec,{load:n})]}))}function h(e){if(!r)return so(d,{...e});const t=i(e)??null,n="function"==typeof o?o(e):o;return void 0===n?so(Fr,{fallback:t,children:so(d,{...e})}):so(pc,{name:n,fallback:t,children:so(d,{...e})})}function p(e){const{load:t}=dc(l,{cacheErrors:!1}),n=c?.(e);return pe(()=>(t(),n?.()??vc),[t,n])}function m(e){const{load:t}=dc(l,{cacheErrors:!1}),n=u?.(e);return pe(()=>(t(),n?.()??vc),[t,n])}function _(e){const t=p(e);return ue(()=>t(),[t]),null}function v(e){const t=m(e);return ue(()=>t(),[t]),null}d.displayName=`Suspender(${f})`,h.displayName=`Async(${f})`,_.displayName=`Async.Preload(${n})`,v.displayName=`Async.Prefetch(${n})`;const y=h;return Reflect.defineProperty(y,"load",{value:()=>l.resolve(),writable:!1}),Reflect.defineProperty(y,"preload",{value:()=>l.resolve({cacheErrors:!1}),writable:!1}),Reflect.defineProperty(y,"Preload",{value:_,writable:!1}),Reflect.defineProperty(y,"Prefetch",{value:v,writable:!1}),Reflect.defineProperty(y,"usePreload",{value:p,writable:!1}),Reflect.defineProperty(y,"usePrefetch",{value:m,writable:!1}),Reflect.defineProperty(y,"useLoadState",{value:function(){const e=Tr(l.subscribe,()=>l.resolved,()=>l.resolved);return e instanceof Error?"failed":null==e?"loading":"loaded"},writable:!1}),y}function vc(){}function yc(){return null}const gc="Component",wc=/([^/]*)\.\w+$/;function bc(e){return null}function Ec({load:e}){return ue(()=>{e()},[e]),null}const Sc=Symbol.for("RemoteUi::Retain"),kc=Symbol.for("RemoteUi::Release"),xc=Symbol.for("RemoteUi::RetainedBy");class Cc{constructor(){this.memoryManaged=new Set}add(e){this.memoryManaged.add(e),e[xc].add(this),e[Sc]()}release(){for(const e of this.memoryManaged)e[xc].delete(this),e[kc]();this.memoryManaged.clear()}}function Pc(e){return Boolean(e&&e[Sc]&&e[kc])}function Ac(e,{deep:t=!0}={}){return $c(e,t,new Map)}function $c(e,t,n){const r=n.get(e);if(null!=r)return r;const o=Pc(e);if(o&&e[Sc](),n.set(e,o),t){if(Array.isArray(e)){const r=e.reduce((e,r)=>$c(r,t,n)||e,o);return n.set(e,r),r}if(Mc(e)){const r=Object.keys(e).reduce((r,o)=>$c(e[o],t,n)||r,o);return n.set(e,r),r}}return n.set(e,o),o}function Tc(e,{deep:t=!0}={}){return Nc(e,t,new Map)}function Nc(e,t,n){const r=n.get(e);if(null!=r)return r;const o=Pc(e);if(o&&e[kc](),n.set(e,o),t){if(Array.isArray(e)){const r=e.reduce((e,r)=>Nc(r,t,n)||e,o);return n.set(e,r),r}if(Mc(e)){const r=Object.keys(e).reduce((r,o)=>Nc(e[o],t,n)||r,o);return n.set(e,r),r}}return o}function Mc(e){if(null==e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return null==t||t===Object.prototype}const Oc="_@f",Rc="_@fn";function Lc(e){const t="undefined"!=typeof self&&self.name||globalThis.location?.origin||"unknown",n=e.uuid();let r=null;const o=new Map,i=new Map,a=new Map,s=new Map;return{encode:function t(n,r=new Map){if(null==n)return[n];const a=r.get(n);if(a)return a;if("object"==typeof n){if(Array.isArray(n)){r.set(n,[void 0]);const e=[],o=[n.map(n=>{const[o,i=[]]=t(n,r);return e.push(...i),o}),e];return r.set(n,o),o}if(Mc(n)){r.set(n,[void 0]);const e=[],o=[Object.keys(n).reduce((o,i)=>{const[a,s=[]]=t(n[i],r);return e.push(...s),{...o,[i]:a}},{}),e];return r.set(n,o),o}}if("function"==typeof n){if(o.has(n)){const e=o.get(n),t=[{[Oc]:e}];return r.set(n,t),t}const t=e.uuid();o.set(n,t),i.set(t,n);const a=[{[Oc]:t,[Rc]:n.name||String(n).slice(0,100)}];return r.set(n,a),a}const s=[n];return r.set(n,s),s},decode:c,async call(e,o){const a=new Cc,u=i.get(e);if(null==u){const o=s.get(e)||"unknown",i=new Error(`[${t}] You attempted to call a function that was already released. (function: ${o}, endpoint: ${n}${null!=r?`, endpoint terminated ${Date.now()-r}ms ago`:""})`);throw i.name="RemoteFunctionReleasedError",i}try{const e=Pc(u)?[a,...u[xc]]:[a];return await u(...c(o,e))}finally{a.release()}},release(e){const t=i.get(e);t&&(i.delete(e),o.delete(t),s.set(e,t.name||"unknown"))},terminate(){r=Date.now(),o.clear(),i.clear(),a.clear(),s.clear()}};function c(o,i){if("object"==typeof o){if(null==o)return o;if(Array.isArray(o))return o.map(e=>c(e,i));if(Oc in o){const s=o[Oc];if(a.has(s))return a.get(s);let c=0,u=!1,l=null;const f=()=>{c-=1,0===c&&(u=!0,l=Date.now(),a.delete(s),e.release(s))},d=()=>{c+=1},h=new Set(i),p=Rc in o&&o[Rc]||"unknown",m=(...o)=>{if(u){const e=new Error(`[${t}] You attempted to call a function that was already released. (function: ${p}, endpoint: ${n}${null!=l?`, released ${Date.now()-l}ms ago`:""}, retained by ${h.size})`);throw e.name="RemoteFunctionReleasedError",e}if(!a.has(s)){const e=new Error(`[${t}] You attempted to call a function that was already revoked. (function: ${p}, endpoint: ${n}${null!=r?`, endpoint terminated ${Date.now()-r}ms ago`:""}, retained by ${h.size})`);throw e.name="RemoteFunctionRevokedError",e}return e.call(s,o)};Object.defineProperties(m,{[kc]:{value:f,writable:!1},[Sc]:{value:d,writable:!1},[xc]:{value:h,writable:!1}});for(const e of h)e.add(m);return a.set(s,m),m}if(Mc(o))return Object.keys(o).reduce((e,t)=>({...e,[t]:c(o[t],i)}),{})}return o}}function Uc(e,{uuid:t=Ic,createEncoder:n=Lc,callable:r}={}){let o=!1,i=e;const a=new Map,s=new Map,c=function(e,t){let n;if(null==t){if("function"!=typeof Proxy)throw new Error("You must pass an array of callable methods in environments without Proxies.");const t=new Map;n=new Proxy({},{get(n,r){if(t.has(r))return t.get(r);const o=e(r);return t.set(r,o),o}})}else{n={};for(const r of t)Object.defineProperty(n,r,{value:e(r),writable:!1,configurable:!0,enumerable:!0})}return n}(d,r),u=n({uuid:t,release(e){l(3,[e])},call(e,n,r){const o=t(),i=h(o,r),[a,s]=u.encode(n);return l(5,[o,e,a],s),i}});return i.addEventListener("message",f),{call:c,replace(e){const t=i;i=e,t.removeEventListener("message",f),e.addEventListener("message",f)},expose(e){for(const t of Object.keys(e)){const n=e[t];"function"==typeof n?a.set(t,n):a.delete(t)}},callable(...e){if(null!=r)for(const t of e)Object.defineProperty(c,t,{value:d(t),writable:!1,configurable:!0,enumerable:!0})},terminate(){l(2,void 0),p(),i.terminate&&i.terminate()}};function l(e,t,n){o||i.postMessage(t?[e,t]:[e],n)}async function f(e){if(o)return;const{data:t}=e;var n;if(n=t,Array.isArray(n)&&"number"==typeof n[0]&&(null==n[1]||Array.isArray(n[1])))switch(t[0]){case 2:p();break;case 0:{const e=new Cc,[n,o,i]=t[1],s=a.get(o);try{if(null==s)throw new Error(`No '${o}' method is exposed on this endpoint`);const[t,r]=u.encode(await s(...u.decode(i,[e])));l(1,[n,void 0,t],r)}catch(r){const{name:e,message:t,stack:o}=r;throw l(1,[n,{name:e,message:t,stack:o}]),r}finally{e.release()}break}case 1:{const[e]=t[1],n=s.get(e);if(null==n)break;n(...t[1]),s.delete(e);break}case 3:{const[e]=t[1];u.release(e);break}case 6:{const[e]=t[1],n=s.get(e);if(null==n)break;n(...t[1]),s.delete(e);break}case 5:{const[e,n,o]=t[1];try{const t=await u.call(n,o),[r,i]=u.encode(t);l(6,[e,void 0,r],i)}catch(r){const{name:t,message:n,stack:o}=r;throw l(6,[e,{name:t,message:n,stack:o}]),r}break}}}function d(e){return(...n)=>{if(o)return Promise.reject(new Error("You attempted to call a function on a terminated web worker."));if("string"!=typeof e&&"number"!=typeof e)return Promise.reject(new Error(`Can’t call a symbol method on a remote endpoint: ${e.toString()}`));const r=t(),i=h(r),[a,s]=u.encode(n);return l(0,[r,e,a],s),i}}function h(e,t){return new Promise((n,r)=>{s.set(e,(e,o,i)=>{if(null==o)n(i&&u.decode(i,t));else{const e=new Error;Object.assign(e,o),r(e)}})})}function p(){var e;o=!0,a.clear(),s.clear(),null===(e=u.terminate)||void 0===e||e.call(u),i.removeEventListener("message",f)}}function Ic(){return`${Dc()}-${Dc()}-${Dc()}-${Dc()}`}function Dc(){return Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)}function jc(e){return{postMessage:(...t)=>e.postMessage(...t),addEventListener:(...t)=>e.addEventListener(...t),removeEventListener:(...t)=>e.removeEventListener(...t),terminate(){e.close()}}}const Fc="remote-ui::ready";function Bc(e,{terminate:t=!0,targetOrigin:n="*"}={}){var r;if("undefined"==typeof window)throw new Error("You can only run fromIframe() in a browser context, but no window was found.");const o=new WeakMap;let i;function a(t){t.source===e.contentWindow&&t.data===Fc&&(window.removeEventListener("message",a),i())}null===(r=e.contentWindow)||void 0===r||r.postMessage(Fc,n);const s=new Promise(e=>{i=e,window.addEventListener("message",a)});return{async postMessage(t,r){var o;await s,null===(o=e.contentWindow)||void 0===o||o.postMessage(t,n,r)},addEventListener(t,n){const r=t=>{t.source===e.contentWindow&&n(t)};o.set(n,r),self.addEventListener(t,r)},removeEventListener(e,t){const n=o.get(t);null!=n&&(o.delete(t),self.removeEventListener(e,n))},terminate(){window.removeEventListener("message",a),t&&e.remove()}}}function qc({targetOrigin:e="*"}={}){if("undefined"==typeof self||null==self.parent)throw new Error("This does not appear to be a child iframe, because there is no parent window.");const{parent:t}=self,n=()=>t.postMessage(Fc,e);window.addEventListener("message",e=>{e.source===t&&"complete"===document.readyState&&e.data===Fc&&n()}),"complete"===document.readyState?n():document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&n()});const r=new WeakMap;return{postMessage(n,r){t.postMessage(n,e,r)},addEventListener(e,n){const o=e=>{e.source===t&&n(e)};r.set(n,o),self.addEventListener(e,o)},removeEventListener(e,t){const n=r.get(t);null!=n&&(r.delete(t),self.removeEventListener(e,n))}}}function Hc({children:e,router:t,href:n,onClick:r,...o}){return so("a",{href:t.resolve(n).href,onClick:e=>{r?.(e),e.defaultPrevented||e.shiftKey||e.ctrlKey||e.metaKey||(e.preventDefault(),t.navigate(n))},...o,children:e})}function Wc(e,t){return function(e){const t=me(Gs)??void 0;ue(()=>{if(null!=t)return t.registerRoutes(e)},[t,e])}(t),so(Kc,{routes:t,router:e})}const Kc=Er(function e({routes:t,router:n,parentMatchedPath:r}){let o;for(const h of t){const e=ms(n.currentUrl.value,n.prefix,h.match,r);if(null!=e){o={...e,route:h};break}}if(null==o)return null;const{route:i,nextMatchedPathPrefix:a,matched:s}=o,{render:c,redirect:u,children:l}=i,f=a??r;let d=null;return c?d=c({url:n.currentUrl.value,matched:s,children:l&&so(e,{routes:l,router:n,parentMatchedPath:f})}):l?d=so(e,{routes:l,router:n,parentMatchedPath:f}):u&&n.redirect(u),d});function zc(e){const t=URL.createObjectURL(new Blob([`importScripts(${JSON.stringify(e.href)})`])),n=new Worker(t),r=n.terminate.bind(n);return n.terminate=()=>{URL.revokeObjectURL(t),r()},n}const Gc=new WeakMap;function Jc(e){const t=function(e){return"undefined"==typeof window||"string"!=typeof e?void 0:new URL(e,window.location.href)}(e);function n({createMessenger:n=zc,...r}={}){if(t){const e=Uc(n(t),r),{call:o}=e;return Gc.set(o,e),o}if("function"==typeof e)return new Proxy({},{get:(t,n)=>async(...t)=>(await e())[n](...t)});if("undefined"==typeof window)return new Proxy({},{get:(e,t)=>()=>{throw new Error("You can’t call a method on a worker on the server.")}});throw new Error("Could not create a suitable fallback")}return Reflect.defineProperty(n,"url",{value:t}),n}function Vc(e,t){const n=Xc(e);return null==n||n.expose(t),null!=n}function Zc(e){const t=Xc(e);return null==t||t.terminate(),Gc.delete(e),null!=t}function Xc(e){return Gc.get(e)}const Qc=0,Yc=1,eu=2,tu=3,nu=4,ru=1,ou=2,iu=3,au=Symbol("RootId");function su(){const e=new Set,t=new Map,n=new Map;let r=null,o="unmounted";const i={id:au,kind:0,children:[],version:0},a=new Map([[au,i]]),s=function({mount:e,insertChild:t,removeChild:n,updateProps:r,updateText:o}){const i=new Map([[0,e],[2,n],[1,t],[4,r],[3,o]]);return(e,...t)=>i.get(e)(...t)}({mount:e=>{const n=a.get(au),r=e.map(e=>uu(e,cu));n.version+=1,n.children=r,o="mounted";for(const t of r)Ac(t),u(t);c(n).then(()=>{!function(){const e=t.get("mount");if(e)for(const t of e)t()}()})},insertChild:(e,t,n,r)=>{const o=a.get(null!=e?e:au),{children:i}=o;let s,l;if(e===r?s=o:!1!==r&&(s=a.get(null!=r?r:au)),s){const t=n.id,o=s.children,i=o.findIndex(e=>e.id===t),[a]=o.splice(i,1);l=a,e!==r&&(s.version+=1,c(s))}else l=uu(n,cu),Ac(l),u(l);t===i.length?i.push(l):i.splice(t,0,l),o.version+=1,c(o)},removeChild:(e,t)=>{const n=a.get(null!=e?e:au),{children:r}=n,[o]=r.splice(t,1);o&&(n.version+=1,l(o),c(n).then(()=>{Tc(o)}))},updateProps:(e,t)=>{const n=a.get(e),r={...n.props};Ac(t),Object.keys(t).forEach(e=>{const n=t[e],o=r[e];fu(o)&&l(o),lu(n)&&u(uu(n,cu))}),Object.assign(n.props,t),n.version+=1,c(n).then(()=>{for(const e of Object.keys(t))Tc(r[e])})},updateText:(e,t)=>{const n=a.get(e);n.text=t,n.version+=1,c(n)}});return{get state(){return o},receive:s,attached:{root:i,get({id:e}){var t;return null!==(t=a.get(e))&&void 0!==t?t:null},subscribe({id:e},t){let r=n.get(e);return null==r&&(r=new Set,n.set(e,r)),r.add(t),()=>{const r=n.get(e);r&&(r.delete(t),0===r.size&&n.delete(e))}}},flush:function(){var e;return null!==(e=r)&&void 0!==e?e:Promise.resolve()},on(e,n){let r=t.get(e);return null==r&&(r=new Set,t.set(e,r)),r.add(n),()=>{const r=t.get(e);r&&(r.delete(n),0===r.size&&t.delete(e))}}};function c(t){var o;return r=null!==(o=r)&&void 0!==o?o:new Promise(t=>{setTimeout(()=>{const o=[...e];r=null,e.clear();for(const e of o){const t=n.get(e.id);if(t)for(const n of t)n(e)}t()},0)}),e.add(t),r}function u(e){if(a.set(e.id,e),1===e.kind&&"props"in e){const{props:t={}}=e;Object.keys(t).forEach(e=>{const n=t[e];fu(n)&&u(n)})}if("children"in e)for(const t of e.children)u(t)}function l(e){if(a.delete(e.id),1===e.kind&&"props"in e){const{props:t={}}=e;Object.keys(t).forEach(e=>{const n=t[e];fu(n)&&l(n)})}if("children"in e)for(const t of e.children)l(t)}}function cu(e){return e.version=0,e}function uu(e,t){if(3!==e.kind&&1!==e.kind||e.children.forEach(e=>uu(e,t)),1===e.kind&&"props"in e){const{props:n}=e;for(const e of Object.keys(n)){const r=n[e];lu(r)&&(n[e]=uu(r,t))}}return t(e)}function lu(e){return function(e){return null!=e&&3===e.kind}(e)&&"id"in e&&"children"in e}function fu(e){return lu(e)&&"version"in e}function du(e){"undefined"!=typeof window&&("function"==typeof window.requestIdleCallback?window.requestIdleCallback(e):window.setTimeout(e,0))}function hu(e){const t=fe(!1);t.current||(t.current=!0,du(()=>{Promise.resolve(e()).catch(()=>{})}))}class pu extends js{async annotateEvent(e){return Promise.resolve(function(e,t){if("v1"===t){const n=function(){const e=[];return Yn()&&e.push("analytics"),Qn()&&e.push("marketing"),tr()&&e.push("sale_of_data"),er()&&e.push("preferences"),e}();return{...e,metadata:{...e?.metadata,consent:n,consent_provider:"consent-tracking-api",consent_version:t}}}throw new mu(t||"unknown")}(e,this.version))}getRequiredConsentForEmission(){if("v1"===this.version)return["analytics","marketing"];throw new mu(this.version||"unknown")}}class mu extends Error{constructor(e){super(`Version ${e} is not supported by the consent-tracking-api provider`),this.name="MonorailConsentTrackingApiProviderVersionError",Object.setPrototypeOf(this,mu.prototype)}}export{oo as $,nu as A,Qe as B,Jc as C,go as D,me as E,le as F,se as G,Uc as H,Bc as I,Vc as J,iu as K,Zc as L,S as M,Me as N,zr as O,wo as P,uo as Q,no as R,ro as S,fe as T,Zr as U,Qr as V,eo as W,bt as X,_e as Y,Ho as Z,ce as _,tu as a,wa as a$,Xr as a0,Gr as a1,vo as a2,k as a3,E as a4,Wr as a5,g as a6,fc as a7,vr as a8,Br as a9,io as aA,du as aB,fu as aC,su as aD,wi as aE,hu as aF,Lo as aG,Jt as aH,Rt as aI,tr as aJ,er as aK,Qn as aL,Yn as aM,zn as aN,Mn as aO,Nn as aP,Vn as aQ,Jn as aR,Kn as aS,yn as aT,Po as aU,Vr as aV,ki as aW,fa as aX,ha as aY,ma as aZ,_a as a_,qr as aa,ho as ab,Tr as ac,Eo as ad,Jr as ae,Tc as af,Wi as ag,Ii as ah,Uo as ai,ni as aj,qc as ak,n as al,ye as am,Sr as an,de as ao,Vi as ap,oa as aq,ve as ar,Rs as as,Os as at,Ts as au,pu as av,Fs as aw,Ds as ax,w as ay,B as az,eu as b,ua as b0,la as b1,ts as b2,os as b3,qa as b4,gs as b5,js as b6,pr as b7,Fr as b8,Hc as b9,_s as ba,oc as bb,qo as bc,Wc as bd,e as be,q as bf,Hr as bg,jc as bh,Xn as bi,Yc as c,Qc as d,ru as e,ou as f,Er as g,ue as h,H as i,_c as j,mo as k,Be as l,ht as m,$e as n,cc as o,dt as p,wt as q,Ac as r,br as s,pe as t,so as u,he as v,bo as w,tt as x,qe as y,Ge as z};