const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./apps-startup-lhdqefoc.js","./vendor-djx2j5qm.js","./shared-kj4ph1fy.js","./apps-js-api-lmpxre9h.js","./apps-tracker-dxfm72gh.js","./apps-add-to-bag-cv3gwhsc.js","./apps-categories-v1-iabx85q6.js","./apps-categories-v2-h514x16h.js","./apps-minicart-v1-nsn1rsjf.js","./apps-minicart-v2-jswt9615.js","./apps-product-thumbnail-lqxm25g9.js","./apps-product-browser-kqca9vvv.js","./apps-product-browser-popup-eqxsmht6.js","./apps-search-panel-hrhie9w6.js","./apps-search-widget-dvhp549m.js","./apps-single-product-m42ikt4q.js","./apps-cp-preview-product-card-o98406tw.js","./apps-cp-preview-category-nkgp8wnw.js"])))=>i.map(i=>d[i]); const Ue="modulepreload",Me=function(t,e){return new URL(t,e).href},ie={},h=function(e,r,n){let o=Promise.resolve();if(r&&r.length>0){let s=function(c){return Promise.all(c.map(l=>Promise.resolve(l).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};const u=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));o=s(r.map(c=>{if(c=Me(c,n),c in ie)return;ie[c]=!0;const l=c.endsWith(".css"),f=l?'[rel="stylesheet"]':"";if(!!n)for(let C=u.length-1;C>=0;C--){const v=u[C];if(v.href===c&&(!l||v.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${f}`))return;const E=document.createElement("link");if(E.rel=l?"stylesheet":Ue,l||(E.as="script"),E.crossOrigin="",E.href=c,m&&E.setAttribute("nonce",m),document.head.appendChild(E),l)return new Promise((C,v)=>{E.addEventListener("load",C),E.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(s){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=s,window.dispatchEvent(u),!u.defaultPrevented)throw s}return o.then(s=>{for(const u of s||[])u.status==="rejected"&&i(u.reason);return e().catch(i)})};var be=Object.defineProperty,xe=(t,e,r)=>e in t?be(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,se=(t,e,r)=>xe(t,typeof e!="symbol"?e+"":e,r);const L={INFO:"INFO",WARNING:"WARNING",ERROR:"ERROR",LOG:"LOG"},D={ALL:"ALL",PARTIAL:"PARTIAL",DEFAULT:"DEFAULT"};function Ve(t){switch(t){case L.INFO:return console.info;case L.WARNING:return console.warn;case L.ERROR:return console.error;case L.LOG:return console.info;default:throw new Error(`Unknown log level '${t}'`)}}const G="ALL";function We(t){return["%c%s",`background: ${t.background}; color: ${t.color}; padding: 1px 4px`,t.badgeName]}class Fe{constructor(e){se(this,"localStorageKey"),se(this,"isGreetingsPrinted",!1),this.localStorageKey=e}createDebugGreetingsData(e){const r="",n='font-family: "Monospace"; font-size: 1.1em';return[`%cTo enable all development logs please run in development console: %c localStorage.setItem("${this.localStorageKey}", "${G}") %cInstead of %c${G} %cyou can use comma separated event types list to partially enable logs. Available event types are: %O`,r,n,r,n,r,e]}printGreetingsIfNeeded(e){this.isGreetingsPrinted||(this.isGreetingsPrinted=!0,console.log(...this.createDebugGreetingsData(e)))}printLog(e,r,n,...o){const i=We(n);Ve(e)(...i,...o)}getEventTypesToLog(){try{const e=window.localStorage.getItem(this.localStorageKey);return e===""||e===null?{type:D.DEFAULT}:e===G||e==="true"?{type:D.ALL}:{type:D.PARTIAL,events:e.split(",")}}catch{return{type:D.DEFAULT}}}dumpLogs(){return Promise.resolve()}}function N(t){for(var e=1;e"u")){s=N({},e,s),typeof s.expires=="number"&&(s.expires=new Date(Date.now()+s.expires*864e5)),s.expires&&(s.expires=s.expires.toUTCString()),o=encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var u="";for(var d in s)s[d]&&(u+="; "+d,s[d]!==!0&&(u+="="+s[d].split(";")[0]));return document.cookie=o+"="+t.write(i,o)+u}}function n(o){if(!(typeof document>"u"||arguments.length&&!o)){for(var i=document.cookie?document.cookie.split("; "):[],s={},u=0;u!t(e))}function F(t){T().push(t)}function ee(t){return T().find(e=>e.element===t)}function Ae(){return T().filter(t=>t.mountState===void 0||t.mountState===y.UNMOUNTED)}function ce(){return T().filter(t=>t.mountState===y.MOUNTED)}function tn(){ke(t=>t.widgetType===a.PRODUCT_BROWSER)}function Ge(t){return T().find(e=>e.widgetType===t)}function Ee(){return T().some(t=>t.widgetType===a.PRODUCT_BROWSER)}function Je(){return T().some(t=>t.widgetType===a.PRODUCT||t.widgetType===a.SINGLE_PRODUCT)}function Ie(){return T().some(t=>t.widgetType===a.MINICART_V1||t.widgetType===a.MINICART_V2)}function Te(){var r,n,o;const t=[a.PRODUCT_BROWSER,a.SINGLE_PRODUCT,a.PRODUCT,a.MINICART_V1,a.CATEGORIES_V2,a.VERTICAL_CATEGORIES_V1];for(const i of t){const s=(n=(r=T().filter(u=>u.widgetType===i))==null?void 0:r.reverse())==null?void 0:n[0];if(s!==void 0)return(o=s.element)==null?void 0:o.parentNode}const e=document.getElementsByClassName(Z);if(e.length>0){const i=e[e.length-1];return i==null?void 0:i.parentNode}}function $(t,e){var r;if(((r=document.defaultView)==null?void 0:r.getComputedStyle)!==void 0)return document.defaultView.getComputedStyle(t,null).getPropertyValue(e)}function He(){const t={},e=Te();if(e!==void 0){const r=$(e,"font-family");r!==void 0&&(t["font-family"]=r)}return t}function je(t){var n;const e=document.createElement("a");e.href="",e.textContent="",t.appendChild(e);const r=((n=document.defaultView)==null?void 0:n.getComputedStyle(e,null).color)??"";return t.removeChild(e),r}function qe(t){let e=t,r=$(e,"background-color");for(;r===void 0||r==="transparent"||r==="#000000"||r==="rgba(0, 0, 0, 0)";)e===document.documentElement?r="white":(e=e.parentNode,r=$(e,"background-color"));return r}function $e(t,e){var n;let r;if(((n=e==null?void 0:e.chameleon)==null?void 0:n.font)!==void 0&&(r=e.chameleon.font),(r===void 0&&t||r==="auto")&&(r=He()),r!==void 0){const i=r["font-family"];if(i!==void 0){const s=i.split(/,\s*/);let u="",d="";for(const m of s){if(u.length+m.length+d.length>150)break;u+=d+m,d=","}return u}}}function Ye(t,e){var r,n;return t&&(((n=(r=e==null?void 0:e.chameleon)==null?void 0:r.gallery)==null?void 0:n.useExactColors)??!1)}function ze(){var t;return((t=window.top)==null?void 0:t.location)!==window.location}function Xe(t,e){var m,c;let r;((m=e==null?void 0:e.chameleon)==null?void 0:m.colors)!==void 0&&(r=(c=e==null?void 0:e.chameleon)==null?void 0:c.colors);const n=document.styleSheets.length===0;if(r!==void 0&&r!=="auto"||!t||n)return r!=="auto"?r:{};const o={},i=Te();if(i===void 0)return o;const s=getComputedStyle(i,null).color;s.replace(/ /g,"")!=="rgba(0,0,0,0)"&&s!=="transparent"&&(o["color-foreground"]=s,o["color-price"]=o["color-foreground"]);const u=qe(i);u.replace(/ /g,"")!=="rgba(0,0,0,0)"&&u!=="transparent"?o["color-background"]=u:o["color-background"]="white";const d=je(i);return d.replace(/ /g,"")!=="rgba(0,0,0,0)"&&d!=="transparent"&&(o["color-link"]=d),o}function ye(t,e){const r=t&&!ze();return{isEnabled:t,colors:Xe(r,e),fontFamily:$e(r,e),useExactColors:Ye(r,e)}}const Ke="ecwid_body";function Qe(){let t;const r=document.getElementsByTagName("body")[0];return r!==void 0&&(r.id===""&&(r.id=Ke),t=r.id),t}const Ze="ecwid_html";function et(){let t;const r=document.getElementsByTagName("html")[0];return r!==void 0&&(r.id===""&&(r.id=Ze),t=r.id),t}function Se(t,e){if(e===void 0)return t;let r;const n=Promise.race([t,new Promise((o,i)=>{r=setTimeout(()=>{i(new Error(`Timeout exceeded (${e} ms)`))},e)})]);return n.finally(()=>clearTimeout(r)),n}const R={SUCCESS:"success",DUPLICATE:"duplicate",FAILED:"failed"};var tt=Object.defineProperty,rt=(t,e,r)=>e in t?tt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,J=(t,e,r)=>rt(t,typeof e!="symbol"?e+"":e,r);const S={INFO:"INFO",WARNING:"WARNING",ERROR:"ERROR",LOG:"LOG"},H={ALL:"ALL",PARTIAL:"PARTIAL",DEFAULT:"DEFAULT"};function nt(t,e,r){const n=r.type;switch(n){case H.ALL:return!0;case H.PARTIAL:return r.events.some(o=>o===t);case H.DEFAULT:return e.isDefault===!0;default:throw new Error(`Unknown event types to log '${n}'`)}}function ot(t,e,r,n){return t===S.WARNING||t===S.ERROR||nt(e,r,n)}class it{constructor(e,r){J(this,"eventsLogSettings"),J(this,"baseLogger"),J(this,"allowedEventTypes"),this.eventsLogSettings=e,this.baseLogger=r,this.allowedEventTypes=Object.keys(this.eventsLogSettings).sort()}doLog(e,r,...n){this.baseLogger.printGreetingsIfNeeded(this.allowedEventTypes);const o=this.eventsLogSettings[e];ot(r,e,o,this.baseLogger.getEventTypesToLog())&&this.baseLogger.printLog(r,e,o,...n)}info(e,...r){this.doLog(e,S.INFO,...r)}warn(e,...r){this.doLog(e,S.WARNING,...r)}error(e,...r){this.doLog(e,S.ERROR,...r)}log(e,...r){this.doLog(e,S.LOG,...r)}dumpLogs(){return this.baseLogger.dumpLogs()}}const g={APP_LIFECYCLE:"APP_LIFECYCLE",DEPRECATION:"DEPRECATION",JS_API:"JS_API",PERSISTENCE:"PERSISTENCE",RESOURCES:"RESOURCES",REST:"REST",ROUTER:"ROUTER",MUTATION:"MUTATION",SUSPENSE:"SUSPENSE",SSR:"SSR",TODO:"TODO",TRACKER:"TRACKER"},st={[g.APP_LIFECYCLE]:{badgeName:"app-lifecycle",background:"#006400",color:"#ffffff"},[g.DEPRECATION]:{badgeName:"deprecation",background:"#8b4513",color:"#ffffff",isDefault:!0},[g.JS_API]:{badgeName:"js-api",background:"#800080",color:"#ffffff"},[g.MUTATION]:{badgeName:"mutation",background:"#FFFF00",color:"#000000"},[g.PERSISTENCE]:{badgeName:"persistence",background:"#ff8c00",color:"#ffffff"},[g.RESOURCES]:{badgeName:"resources",background:"#20b2aa",color:"#ffffff"},[g.REST]:{badgeName:"rest",background:"#20b2aa",color:"#ffffff"},[g.ROUTER]:{badgeName:"router",background:"#1e90ff",color:"#ffffff"},[g.SUSPENSE]:{badgeName:"suspense",background:"#daa520",color:"#ffffff"},[g.SSR]:{badgeName:"ssr",background:"#191970",color:"#ffffff",isDefault:!0},[g.TODO]:{badgeName:"todo",background:"#8b0000",color:"#ffffff",isDefault:!0},[g.TRACKER]:{badgeName:"tracker",background:"#8a2be2",color:"#ffffff"}};class ct extends it{constructor(e){super(st,e)}}function te(t){return t!==void 0?[t]:[]}function Pe(t){return new Date().getTime()-t.getTime()}function Ce(t){const e=[`#${t.resourceLoadIndex}`,t.resourceType,"⮕",t.resourceUrl,...te(t.attributes)];t.logger.info(g.RESOURCES,...e)}function _e(t){const e=Pe(t.requestStartTime),r=[`#${t.resourceLoadIndex}`,t.resourceType,"⬅",`[${e} ms]`,t.resourceUrl,...te(t.attributes)];t.logger.info(g.RESOURCES,...r)}function x(t){const e=Pe(t.requestStartTime),r=[`#${t.resourceLoadIndex}`,t.resourceType,"⛌",`[${e} ms]`,t.resourceUrl,...te(t.attributes),t.errorDetails];t.logger.warn(g.RESOURCES,...r)}function ae(t,e,r,n,o){const i=document.querySelectorAll(`script[src='${t}']`);if(i.length>0){const c={type:R.DUPLICATE,scriptElement:i[0]};return Promise.resolve(c)}const s=(r.resourceLoadIndex??0)+1;r.resourceLoadIndex=s;const u="🔨 JS",d=new Date;Ce({resourceLoadIndex:r.resourceLoadIndex,resourceType:u,resourceUrl:t,attributes:void 0,logger:n});const m=new Promise(c=>{var f;const l=document.createElement("script");l.type="text/javascript",l.src=t,l.async=e,l.onerror=()=>{x({resourceLoadIndex:s,resourceType:u,requestStartTime:d,resourceUrl:t,attributes:void 0,errorDetails:void 0,logger:n}),l.remove();const A={type:R.FAILED};c(A)},l.onload=()=>{_e({resourceLoadIndex:s,resourceType:u,requestStartTime:d,resourceUrl:t,attributes:void 0,logger:n});const A={type:R.SUCCESS,scriptElement:l};c(A)},(f=document.getElementsByTagName("head")[0])==null||f.appendChild(l)});return Se(m,o).catch(c=>(c instanceof Error&&x({resourceLoadIndex:s,resourceType:u,requestStartTime:d,resourceUrl:t,attributes:void 0,errorDetails:c.message,logger:n}),Promise.resolve({type:R.FAILED})))}const w={SUCCESS:"success",DUPLICATE:"duplicate",FAILED:"failed"},Y="data-loading";function at(t,e,r,n,o){const i=document.head.querySelectorAll(`link[href='${t}']`);if(i.length>0){const c={type:w.DUPLICATE,linkElement:i[0]};return Promise.resolve(c)}const s=(n.resourceLoadIndex??0)+1;n.resourceLoadIndex=s;const u="🎨 CSS",d=new Date;Ce({resourceLoadIndex:s,resourceType:u,resourceUrl:t,attributes:e,logger:o});const m=new Promise(c=>{var f;const l=document.createElement("link");l.rel="stylesheet",l.href=t,l.setAttribute(Y,""),e!==void 0&&Object.entries(e).forEach(([A,E])=>{l.setAttribute(A,E)}),l.onerror=()=>{x({resourceLoadIndex:s,resourceType:u,requestStartTime:d,resourceUrl:t,attributes:e,errorDetails:void 0,logger:o}),l.remove();const A={type:w.FAILED};c(A)},l.onload=()=>{l.removeAttribute(Y),_e({resourceLoadIndex:s,resourceType:u,requestStartTime:d,resourceUrl:t,attributes:e,logger:o});const A={type:w.SUCCESS,linkElement:l};c(A)},(f=document.getElementsByTagName("head")[0])==null||f.appendChild(l)});return Se(m,r).catch(c=>(x({resourceLoadIndex:s,resourceType:u,requestStartTime:d,resourceUrl:t,attributes:void 0,errorDetails:c instanceof Error?c.message:void 0,logger:o}),Promise.resolve({type:w.FAILED})))}function ut(t){return Object.entries(t).map(([e,r])=>`${encodeURIComponent(e)}=${encodeURIComponent(r.substring(0,150))}`).join("&")}function dt(t,e){const r={};return Object.entries(e.baseQueryParams).forEach(([n,o])=>{r[n]=o}),r.ownerid=e.storeId.toString(),e.cssSelectorsPrefix!==""&&(r["id-selector"]=e.cssSelectorsPrefix),e.isHoverDisabled&&(r.hover="disable"),e.chameleonParams.colors!==void 0&&Object.entries(e.chameleonParams.colors).forEach(([n,o])=>{r[n]=o}),e.chameleonParams.fontFamily!==void 0&&(r["font-family"]=e.chameleonParams.fontFamily),e.chameleonParams.useExactColors&&(r.useExactGalleryColors="true"),r.frontendV2="true",`${t}?${ut(r)}`}const lt=1e4;function gt(){return"ontouchstart"in window&&typeof window.matchMedia=="function"&&!window.matchMedia("(pointer: fine)").matches&&window.matchMedia("(hover: none)").matches}function pt(t,e){try{const r=new URL(e),n=new URL(t);return n.origin===r.origin&&n.pathname===r.pathname}catch{return!1}}function mt(t){const e=Array.from(document.getElementsByTagName("link")).filter(i=>i.rel==="stylesheet").filter(i=>!i.hasAttribute(Y)).filter(i=>pt(i.href,t)),r=e.filter(i=>document.head.contains(i)),o=[...e.filter(i=>document.body.contains(i))];return r.length>1&&o.push(...r.slice(0,-1)),o}function ht(t,e,r,n,o){var d;const i={baseQueryParams:t.stylesheetsSettings.baseQueryParams,cssSelectorsPrefix:((d=e.stylesheet)==null?void 0:d.cssSelectorsPrefix)??"",chameleonParams:ye(t.isChameleonEnabled,e.ecConfig),isHoverDisabled:gt(),storeId:o},s=m=>{const c=dt(m,i);return at(c,{"data-ec-stylesheet":""},lt,r,n)},u=t.stylesheetsSettings.baseUrl;return s(u.primaryUrl).then(m=>(m.type===w.SUCCESS&&mt(u.primaryUrl).forEach(l=>{n.warn(g.RESOURCES,"Removing obsolete stylesheet link element",l),l.remove()}),m)).catch(()=>s(u.fallbackUrl))}function re(t,e){return{widgetType:t,id:e.id!==""?e.id:void 0,currentScript:void 0,element:e,arg:[],mountState:y.UNMOUNTED,unmountFn:void 0}}function ft(t){window.ec.config=window.ec.config??{},window.ec.config.chameleonDefaults=window.ec.config.chameleonDefaults??{},window.ec.config.chameleonDefaults.isEnabled=t.isEnabled,window.ec.config.chameleonDefaults.gallery=window.ec.config.chameleonDefaults.gallery??{},t.colors!==void 0&&(window.ec.config.chameleonDefaults.colors=t.colors),t.fontFamily!==void 0&&(window.ec.config.chameleonDefaults.font={"font-family":t.fontFamily})}function At(t){var e;window.css_selectors_prefix=((e=t.stylesheet)==null?void 0:e.cssSelectorsPrefix)??""}function Et(t){t.then(e=>{window.ecwidMessages={...window.ecwidMessages,...e.translationsSettings.overrides}})}const It="new-frontend",rn="en";function Tt(t){if(t.cssSelectorsPrefix!==void 0)return t.cssSelectorsPrefix;let e="";return t.isCssSelectorsPrefixDisabled!==!0&&(t.htmlTagId!==void 0||t.bodyTagId!==void 0)&&(t.htmlTagId!==void 0&&(e+=`html#${t.htmlTagId}`),t.htmlTagId!==void 0&&t.bodyTagId!==void 0&&(e+=" "),t.bodyTagId!==void 0&&(e+=`body#${t.bodyTagId}`)),e}function yt(t){return JSON.parse(JSON.stringify(t))}function St(t){return t.chameleon!==void 0?{...t,chameleon:yt(t.chameleon)}:{...t}}const Pt="ec-storefront-show-i18n-keys",Ct="ec-storefront-highlight-version";function _t(t){const e={...t};let r={};return e.queryState!==void 0&&(r=e.queryState,delete e.queryState),{queryState:r,piniaState:e}}function Rt(t,e,r,n,o){return t.then(i=>{At(e);const s=ye(i.isChameleonEnabled,e.ecConfig);return ft(s),ht(i,e,r,n,o)})}function wt(t,e,r){const n=t.translationsSettings.urls.map(o=>ae(o.primaryUrl,!0,e,r).then(i=>{i.type===R.FAILED&&ae(o.fallbackUrl,!0,e,r)}));return Promise.allSettled(n).then(()=>window.rosettaMessages[It])}function Ot(t,e,r){return t.then(async n=>{const o=n.translationsSettings.overrides,i=await wt(n,e,r);return[o,i]})}function vt(t,e){return{...t??{},...e.config??{}}}function Lt(t,e){return{...t??{},...e.order??{}}}function Dt(t,e){return{...t??{},...e.storefront??{}}}function Nt(t){return{containerWidth:t==null?void 0:t.containerWidth}}function Ut(){var t;return((t=Q.get(Pt))==null?void 0:t.toString())==="true"?!0:void 0}function Mt(){var t;return((t=Q.get(Ct))==null?void 0:t.toString())==="true"?!0:void 0}function bt(t){return{showI18nKeys:Ut()??(t==null?void 0:t.showI18nKeys),shouldHighlightVersion:Mt()??(t==null?void 0:t.shouldHighlightVersion)}}function xt(t,e){return{customHistoryStateHandler:(e==null?void 0:e.customHistoryStateHandler)??(t==null?void 0:t.customHistoryStateHandler)}}function Vt(t,e){const r={cssSelectorsPrefix:(e==null?void 0:e.css_selectors_prefix)??(t==null?void 0:t.cssSelectorsPrefix),isCssSelectorsPrefixDisabled:(e==null?void 0:e.ecwid_nocssrewrite)??(t==null?void 0:t.isCssSelectorsPrefixDisabled),htmlTagId:et()??(t==null?void 0:t.htmlTagId),bodyTagId:Qe()??(t==null?void 0:t.bodyTagId)};return{...r,cssSelectorsPrefix:Tt(r)}}function Wt(t,e){return{signInProvider:t==null?void 0:t.signInProvider,signInUrls:t==null?void 0:t.signInUrls,ssoProfile:e.ecwid_sso_profile??(t==null?void 0:t.ssoProfile)}}function Ft(t){var r;const e=(r=t.globalOverrides)==null?void 0:r.globalOverrides;return{ecConfig:St(vt(e==null?void 0:e.ecConfig,window.ec)),ecOrder:Lt(e==null?void 0:e.ecOrder,window.ec),ecStorefront:Dt(e==null?void 0:e.ecStorefront,window.ec),browser:Nt(e==null?void 0:e.browser),debug:bt(e==null?void 0:e.debug),routing:xt(e==null?void 0:e.routing,window.Ecwid),stylesheet:Vt(e==null?void 0:e.stylesheet,window),sso:Wt(e==null?void 0:e.sso,window)}}function Bt(t,e){const r=ee(t.containerElement);if(r!==void 0)return r;const n=re(e,t.containerElement);return F(n),n}function _(t){if(t.containerElement===void 0||t.containerElement===null)throw new Error("Cannot find containerElement, please sure that it is passed to the widget options correctly.");const{containerElement:e,rootProps:r,states:n}=t;return{containerElement:e,rootProps:r,states:n}}function ue(){return document.createElement("div")}class kt{constructor(e){this.options=e}getBootstrapPromise(){return this.options.bootstrapPromise}async createWidget(e,r){const n=r.states??{},{queryState:o,piniaState:i}=_t(n),s=Ft(i),u=this.widgetData??this.createWidgetData(s,this.options);Et(this.options.bootstrapPromise),this.widgetData=u;const d={containerElement:r.containerElement,isHydrateExistingMarkup:Object.keys(n).length>0,queryState:o,piniaState:{...i,globalOverrides:{globalOverrides:s}},rootProps:r.rootProps??{},bootstrap:this.options.bootstrapPromise,widgetData:u,storefrontApiClient:this.options.storefrontApiClient,requestContext:this.options.requestContext,ecommerce:this.options.ecommerce,logger:this.options.logger};return await(await e).render(d)}createWidgetData(e,r){return{appMode:r.appMode,customizeStorefrontAppsResources:Promise.resolve(void 0),stylesheet:Rt(this.options.bootstrapPromise,e,this.options.requestContext,this.options.logger,this.options.storeId),translations:Ot(this.options.bootstrapPromise,this.options.requestContext,this.options.logger)}}getOrCreateConfigAndWidget(e,r,n){const o=_(r),i=Bt(o,n);return i.ecwidWidget!==void 0&&i.mountState!==y.UNMOUNTED||(i.mountState=y.MOUNTING,i.ecwidWidget=this.createWidget(e,o).then(s=>(i.mountState=y.MOUNTED,i.unmountFn=()=>{i.mountState=y.UNMOUNTED,i.unmountFn=void 0,i.element=i.id!==void 0?void 0:i.element,s.unmountFn()},s))),i.ecwidWidget}createOrGetStartup(e){if(this.startupApp===void 0){const r=_({containerElement:ue(),rootProps:{storeId:this.options.storeId},states:e.states});this.startupApp=this.createWidget(h(()=>import("./apps-startup-lhdqefoc.js"),__vite__mapDeps([0,1,2]),import.meta.url),r)}return this.startupApp}createOrGetJsApi(){if(this.jsApi===void 0){const e=_({containerElement:ue(),rootProps:{}});this.jsApi=this.createOrGetStartup(e).then(()=>this.createWidget(h(()=>import("./apps-js-api-lmpxre9h.js"),__vite__mapDeps([3,1,2]),import.meta.url),e))}return this.jsApi}createTracker(e){return this.createOrGetStartup(e).then(()=>this.createWidget(h(()=>import("./apps-tracker-dxfm72gh.js").then(r=>r.l),__vite__mapDeps([4,1,2]),import.meta.url),_(e)))}createAddToBag(e){return this.createOrGetStartup(e).then(()=>this.getOrCreateConfigAndWidget(h(()=>import("./apps-add-to-bag-cv3gwhsc.js"),__vite__mapDeps([5,2,1]),import.meta.url),e,a.ADD_TO_BAG))}createCategoriesV1(e){var n;const r=((n=e.rootProps)==null?void 0:n.direction)===q.VERTICAL?a.VERTICAL_CATEGORIES_V1:a.HORIZONTAL_CATEGORIES_V1;return this.createOrGetStartup(e).then(()=>this.getOrCreateConfigAndWidget(h(()=>import("./apps-categories-v1-iabx85q6.js"),__vite__mapDeps([6,1,2]),import.meta.url),e,r))}createCategoriesV2(e){return this.createOrGetStartup(e).then(()=>this.getOrCreateConfigAndWidget(h(()=>import("./apps-categories-v2-h514x16h.js"),__vite__mapDeps([7,1,2]),import.meta.url),e,a.CATEGORIES_V2))}createMinicartV1(e){return this.createOrGetStartup(e).then(()=>this.getOrCreateConfigAndWidget(h(()=>import("./apps-minicart-v1-nsn1rsjf.js"),__vite__mapDeps([8,1,2]),import.meta.url),e,a.MINICART_V1))}createMinicartV2(e){return this.createOrGetStartup(e).then(()=>this.getOrCreateConfigAndWidget(h(()=>import("./apps-minicart-v2-jswt9615.js"),__vite__mapDeps([9,1,2]),import.meta.url),e,a.MINICART_V2))}createProductThumbnail(e){return this.createOrGetStartup(e).then(()=>this.getOrCreateConfigAndWidget(h(()=>import("./apps-product-thumbnail-lqxm25g9.js"),__vite__mapDeps([10,2,1]),import.meta.url),e,a.PRODUCT_THUMBNAIL))}createProductBrowser(e){return this.createOrGetStartup(e).then(()=>this.getOrCreateConfigAndWidget(h(()=>import("./apps-product-browser-kqca9vvv.js").then(r=>r.ba),__vite__mapDeps([11,1,2]),import.meta.url),e,a.PRODUCT_BROWSER))}createProductBrowserPopup(e){return this.createOrGetStartup(e).then(()=>this.createWidget(h(()=>import("./apps-product-browser-popup-eqxsmht6.js"),__vite__mapDeps([12,1,2]),import.meta.url),_(e)))}createSearchPanel(e){return this.createOrGetStartup(e).then(()=>this.getOrCreateConfigAndWidget(h(()=>import("./apps-search-panel-hrhie9w6.js"),__vite__mapDeps([13,1,2]),import.meta.url),e,a.SEARCH_PANEL))}createSearchWidget(e){return this.createOrGetStartup(e).then(()=>this.getOrCreateConfigAndWidget(h(()=>import("./apps-search-widget-dvhp549m.js"),__vite__mapDeps([14,1,2]),import.meta.url),e,a.SEARCH_WIDGET))}createSingleProduct(e){return this.createOrGetStartup(e).then(()=>this.getOrCreateConfigAndWidget(h(()=>import("./apps-single-product-m42ikt4q.js"),__vite__mapDeps([15,2,1]),import.meta.url),e,a.SINGLE_PRODUCT))}createCpPreviewProductCard(e){return this.createOrGetStartup(e).then(()=>this.getOrCreateConfigAndWidget(h(()=>import("./apps-cp-preview-product-card-o98406tw.js"),__vite__mapDeps([16,2,1]),import.meta.url),e,a.CP_PREVIEW_PRODUCT_CARD))}createCpPreviewCategory(e){return this.createOrGetStartup(e).then(()=>this.getOrCreateConfigAndWidget(h(()=>import("./apps-cp-preview-category-nkgp8wnw.js"),__vite__mapDeps([17,2,1]),import.meta.url),e,a.CP_PREVIEW_CATEGORY))}}class Gt{constructor(e){this.legacyApiImpl=e}setInternalState(e){return this.legacyApiImpl.ensureJsApiSync().setRouterExternalState(e)}saveUtmDataFromUrl(e){return this.legacyApiImpl.ensureJsApiSync().saveUtmDataFromUrl(e)}}const Re={TOP_LEFT:"TOP_LEFT",TOP_RIGHT:"TOP_RIGHT",BOTTOM_LEFT:"BOTTOM_LEFT",BOTTOM_RIGHT:"BOTTOM_RIGHT"},B={RECT:"RECT",PILL:"PILL",NONE:"NONE"},we={BAG:"BAG",CART:"CART",BASKET:"BASKET"},Oe={SMALL_ICON:"SMALL_ICON",SMALL_ICON_COUNTER:"SMALL_ICON_COUNTER",COUNTER_ONLY:"COUNTER_ONLY",TITLE_COUNTER:"TITLE_COUNTER",MEDIUM_ICON_COUNTER:"MEDIUM_ICON_COUNTER",MEDIUM_ICON_TITLE_COUNTER:"MEDIUM_ICON_TITLE_COUNTER",BIG_ICON_TITLE_SUBTOTAL:"BIG_ICON_TITLE_SUBTOTAL",BIG_ICON_DETAILS_SUBTOTAL:"BIG_ICON_DETAILS_SUBTOTAL"},p={DATA_LAYOUT:"data-layout",DATA_ICON:"data-icon",DATA_FIXED:"data-fixed",DATA_FIXED_POSITION:"data-fixed-position",DATA_FIXED_SHAPE:"data-fixed-shape",DATA_HORIZONTAL_INDENT:"data-horizontal-indent",DATA_VERTICAL_INDENT:"data-vertical-indent",DATA_RESPONSIVE:"data-responsive",DATA_CUSTOM_ICON_URL:"data-custom-icon-url",DATA_SHOW_EMPTY_CART:"data-show-empty-cart",DATA_SHOW_BUY_ANIMATION:"data-show-buy-animation"};function Jt(){const t=document.createElement("div");return t.setAttribute(p.DATA_FIXED,"true"),t.setAttribute(p.DATA_FIXED_SHAPE,B.PILL),t.setAttribute(p.DATA_SHOW_EMPTY_CART,"false"),t.className=Z,t}function ve(t){if(t!==void 0){const e=document.getElementById(t);if(e!==null)return e}}const de="autogenerated";function Ht(t){if(t===void 0)return document.body;const e=t.nextElementSibling;if(e instanceof HTMLElement&&e.dataset[de]!==void 0)return e;const r=document.createElement("div");return r.dataset[de]="true",t.insertAdjacentElement("afterend",r),r}function z(t){const e=document.createElement("div");return e.id=t.id??`${t.widgetType}-${new Date().getTime()}`,Ht(t.currentScript).appendChild(e),e}function X(t){if(t.element!==void 0&&t.element!==null)return t.element;const e=ve(t.id);if(e!==void 0)return e}class jt{constructor(e,r,n){this.affiliateId=void 0,this.OnAPILoaded={add:o=>{this.legacyApiImpl.getJsApiAsync().then(i=>{i.onApiLoaded(o)})}},this.OnCartChanged={add:o=>{this.legacyApiImpl.getJsApiAsync().then(i=>{i.onCartChanged(o)})}},this.OnCartSynchronized={add:o=>{this.legacyApiImpl.getJsApiAsync().then(i=>{i.onCartSynchronized(o)})},clear:()=>{this.legacyApiImpl.getJsApiAsync().then(o=>{o.clearCartSynchronizedHandlers()})}},this.OnConsentChanged={add:o=>{this.legacyApiImpl.getJsApiAsync().then(i=>{i.onConsentChanged(o)})}},this.OnOrderPlaced={add:o=>{this.legacyApiImpl.getJsApiAsync().then(i=>{i.onOrderPlaced(o)})}},this.OnPageLoad={add:o=>{this.legacyApiImpl.getJsApiAsync().then(i=>{i.onPageLoad(o)})}},this.OnPageLoaded={add:o=>{this.legacyApiImpl.getJsApiAsync().then(i=>{i.onPageLoaded(o)})}},this.OnPageSwitch={add:o=>{this.legacyApiImpl.getJsApiAsync().then(i=>{i.onPageSwitch(o)})}},this.OnProductOptionsChanged={add:o=>{this.legacyApiImpl.getJsApiAsync().then(i=>{i.onProductOptionsChanged(o)})}},this.OnRouterExternalStateChanged={add:o=>{this.legacyApiImpl.getJsApiAsync().then(i=>{i.onRouterExternalStateChanged(o)})},clear:()=>{this.legacyApiImpl.getJsApiAsync().then(o=>{o.clearRouterExternalStateChangedHandlers()})}},this.OnSessionChanged={add:o=>{this.legacyApiImpl.getJsApiAsync().then(i=>{i.onSessionChanged(o)})}},this.OnSetProfile={add:o=>{this.legacyApiImpl.getJsApiAsync().then(i=>{i.onSetProfile(o)})}},this.legacyApiImpl=e,this.widgetRendererImpl=r,this.logger=n}customerSignOut(e){this.legacyApiImpl.getJsApiAsync().then(r=>{r.customerSignOut(e)})}createMinicartV2Config(e=void 0){let r=e;r===void 0&&(r=Jt(),document.body.appendChild(r));const n=re(a.MINICART_V2,r);return F(n),n}addMinicartV2Widgets(){const e=Array.from(document.getElementsByClassName(Z));if(e.length>0){const n=e.filter(o=>ee(o)===void 0).map(o=>this.createMinicartV2Config(o));return Promise.resolve(n)}if(Je()&&!Ee()&&!Ie()){const n=this.createMinicartV2Config();return Promise.resolve([n])}return this.legacyApiImpl.getEcommerce().widgets.getBootstrapPromise().then(n=>{var o,i;return n.shouldInitMinicartForced&&((o=window.ec.storefront)==null?void 0:o.show_cart_widget)!==!1||((i=window.ec.storefront)==null?void 0:i.show_cart_widget)===!0?[this.createMinicartV2Config()]:[]})}_showPBLoader(){this.logger.warn(g.DEPRECATION,"Method Ecwid._showPBLoader() is a dummy in current implementation")}_onComplete(){this.logger.warn(g.DEPRECATION,"Method Ecwid._onComplete() is a dummy in current implementation")}destroy(){const e=ce().filter(r=>r.widgetType===a.PRODUCT_BROWSER);e.length>0&&(this.logger.info(g.JS_API,"Ecwid.destroy()"),e.forEach(r=>{r.unmountFn!==void 0&&r.unmountFn()}))}formatCurrency(e){return this.legacyApiImpl.ensureJsApiSync().formatCurrency(e)}init(){this.logger.info(g.JS_API,"Ecwid.init()"),Ae().forEach(e=>this.initWidget(e)),this.addMinicartV2Widgets().then(e=>{e.forEach(r=>this.initWidget(r))})}initWidget(e){try{let r=X(e);if(e.id!==void 0&&r===void 0)throw new Error(`No such element: ${e.id}`);r=r??z(e),e.element=r,e.id=r.id,this.widgetRendererImpl.renderWidget(e,r).then()}catch(r){this.logger.warn(g.APP_LIFECYCLE,"Cannot initialize widget",r)}}isCheckoutMutating(){return this.legacyApiImpl.ensureJsApiSync().isCheckoutMutating()}isPageServicedByStorefrontV3(e){return this.legacyApiImpl.ensureJsApiSync().isPageServicedByStorefrontV3(e)}isStorefrontV3(){throw new Error("This method is implemented in entrypoint and should not be invoked")}getAppPublicConfig(e){return this.legacyApiImpl.ensureJsApiSync().getAppPublicConfig(e)}getAppPublicToken(e){return this.legacyApiImpl.ensureJsApiSync().getAppPublicToken(e)}getAndClearLegacyStorefrontNotices(){return this.legacyApiImpl.ensureJsApiSync().getAndClearLegacyStorefrontNotices()}isIsolatedSessionMode(){return this.legacyApiImpl.ensureJsApiSync().isIsolatedSessionMode()}getCheckoutInfo(){return this.legacyApiImpl.ensureJsApiSync().getCheckoutInfo()}getLegacyAuthToken(){return this.legacyApiImpl.ensureJsApiSync().getLegacyAuthToken()}getFeatureToggles(){return this.legacyApiImpl.ensureJsApiSync().getFeatureToggles()}getInitializedWidgets(){const e=ce().map(n=>n.widgetType),r=[...new Set(e)];return this.logger.info(g.JS_API,"Ecwid.getInitializedWidgets()",r),r}getPageSwitchCallbacks(){return this.legacyApiImpl.ensureJsApiSync().getPageSwitchCallbacks()}getStoreConfiguration(){return this.legacyApiImpl.ensureJsApiSync().getStoreConfiguration()}getStorefrontLang(){return this.legacyApiImpl.ensureJsApiSync().getStorefrontLang()}getOwnerId(){throw new Error("This method is implemented in entrypoint and should not be invoked")}getStaticBaseUrl(){return this.logger.warn(g.DEPRECATION,`Method Ecwid.getStaticBaseUrl() returns nothing in current implementation. If you use this method in your scripts, please contact us at https://support.ecwid.com/hc/en-us/requests/new`),""}scrollToContent(){return this.legacyApiImpl.ensureJsApiSync().scrollToContent()}getTrackingConsent(){return this.legacyApiImpl.ensureJsApiSync().getTrackingConsent()}getVisitorLocation(){return this.legacyApiImpl.ensureJsApiSync().getVisitorLocation()}onAllCheckoutMutationsCompleted(e){return this.legacyApiImpl.ensureJsApiSync().onAllCheckoutMutationsCompleted(e)}openCookiesSettingSidePanel(){return this.legacyApiImpl.ensureJsApiSync().openCookiesSettingSidePanel()}openPage(e,r){return this.legacyApiImpl.ensureJsApiSync().openPage(e,r)}refreshConfig(){this.legacyApiImpl.ensureJsApiSync().refreshConfig(window.ec)}resizeProductBrowser(){this.logger.warn(g.DEPRECATION,"Method Ecwid.resizeProductBrowser() is do nothing in current implementation and its call can be removed")}setSignInProvider(e){this.legacyApiImpl.getJsApiAsync().then(r=>{r.setSignInProvider(e)})}setSignInUrls(e){this.legacyApiImpl.getJsApiAsync().then(r=>{r.setSignInUrls(e)})}setSsoProfile(e){this.legacyApiImpl.getJsApiAsync().then(r=>{r.setSsoProfile(e)})}setCheckoutInfo(e){this.legacyApiImpl.ensureJsApiSync().setCheckoutInfo(e)}setLegacyAuthToken(e){this.legacyApiImpl.ensureJsApiSync().setLegacyAuthToken(e)}setSession(e){this.legacyApiImpl.ensureJsApiSync().setSession(e)}setStorefrontBaseUrl(e){this.legacyApiImpl.getJsApiAsync().then(r=>{r.setStorefrontBaseUrl(e)})}setTrackingConsent(e){this.legacyApiImpl.getJsApiAsync().then(r=>{r.setTrackingConsent(e)})}showProductFilters(){this.legacyApiImpl.ensureJsApiSync().showProductFilters()}getSupportedStorages(){return this.legacyApiImpl.ensureJsApiSync().getSupportedStorages()}getStorageValue(e,r){return this.legacyApiImpl.ensureJsApiSync().getStorageValue(e,r)}setStorageValue(e,r,n){return this.legacyApiImpl.ensureJsApiSync().setStorageValue(e,r,n)}}function Le(t){const e={};return t.forEach(r=>{const n=r.split("=");if(n.length===2){const o=n[0],i=n[1];o!==void 0&&i!==void 0&&(e[o]=i)}}),e}const qt="id";function $t(t){return t.find(e=>e instanceof HTMLScriptElement)}const Yt=t=>t.filter(e=>typeof e=="string");function zt(t,e){const r=$t(e),n=Yt(e),i=Le(n)[qt];return{widgetType:t,id:i,element:ve(i),currentScript:r,arg:n,mountState:y.UNMOUNTED,unmountFn:void 0}}function Xt(t){document.querySelectorAll("div[itemtype='http://schema.org/Product'], div[itemtype='https://schema.org/Product']").forEach(r=>{ee(r)===void 0&&F(re(t,r))})}class Kt{constructor(e,r,n){this.widgetRendererImpl=r,this.logger=n,this.ecwidImpl=e}xWidget(e,r){try{const n=this.getOrCreateWidgetConfig(e,r),o=X(n)??z(n);n.element=o,n.id=o.id,this.widgetRendererImpl.renderWidget(n,o)}catch(n){this.logger.warn(g.APP_LIFECYCLE,"Cannot initialize widget",n)}}getOrCreateWidgetConfig(e,r){let n;if(e===a.PRODUCT_BROWSER&&(n=Ge(a.PRODUCT_BROWSER)),n!==void 0)return n;const o=zt(e,r);return F(o),o}addMinicartIfNeeded(){!Ee()&&!Ie()&&this.xWidget(a.MINICART_V2,[`${p.DATA_FIXED}=true`,`${p.DATA_FIXED_SHAPE}=${B.PILL}`,`${p.DATA_SHOW_EMPTY_CART}=false`])}xSingleProductWidgets(e){Xt(e),Ae().filter(r=>r.widgetType===e).forEach(r=>{try{const n=X(r)??z(r);r.element=n,r.id=n.id,this.widgetRendererImpl.renderWidget(r,n).then(()=>this.addMinicartIfNeeded())}catch(n){this.logger.warn(g.APP_LIFECYCLE,"Cannot initialize widget",n)}})}xProductBrowser(...e){this.ecwidImpl.destroy(),this.xWidget(a.PRODUCT_BROWSER,e)}xMinicart(...e){this.xWidget(a.MINICART_V1,e)}xSearchPanel(...e){this.xWidget(a.SEARCH_PANEL,e)}xSearch(...e){this.xWidget(a.SEARCH_WIDGET,e)}xCategories(...e){this.xWidget(a.HORIZONTAL_CATEGORIES_V1,e)}xCategoriesV2(...e){this.xWidget(a.CATEGORIES_V2,e)}xVCategories(...e){this.xWidget(a.VERTICAL_CATEGORIES_V1,e)}ecwid_onBodyDone(){this.logger.warn(g.DEPRECATION,"Function window.ecwid_onBodyDone() is deprecated. Use window.Ecwid.init() instead"),this.ecwidImpl.init()}xAddToBag(...e){this.xWidget(a.ADD_TO_BAG,e)}xProductThumbnail(...e){this.xWidget(a.PRODUCT_THUMBNAIL,e)}xSingleProduct(){this.xSingleProductWidgets(a.SINGLE_PRODUCT)}xProduct(){this.xSingleProductWidgets(a.PRODUCT)}}class Qt{constructor(e){this.legacyApiImpl=e}addProduct(e,r){this.legacyApiImpl.getJsApiAsync().then(n=>{typeof e=="object"?n.addProductToCart(e):n.addProductToCart({id:parseInt(e.toString(),10),callback:r??(()=>{})})})}removeProduct(e,r){this.legacyApiImpl.getJsApiAsync().then(n=>{typeof e>"u"?n.removeFromCart(void 0,!1,r):n.removeFromCart([e],!1,r)})}removeProducts(e,r){this.legacyApiImpl.getJsApiAsync().then(n=>{n.removeFromCart(e,!0,r)})}clear(e){this.legacyApiImpl.getJsApiAsync().then(r=>{r.clearCart(e)})}get(e){this.legacyApiImpl.getJsApiAsync().then(r=>{r.getCart(e)})}calculateTotal(e){this.legacyApiImpl.getJsApiAsync().then(r=>{r.calculateTotal(e)})}gotoCheckout(e){this.legacyApiImpl.getJsApiAsync().then(r=>{r.goToCheckout(e)})}canGotoCheckout(e){return this.legacyApiImpl.getJsApiAsync().then(r=>{r.canGoToCheckout(e)}),!0}setCustomerEmail(e,r,n){if(this.isEmptyString(e))return;const o="Ecwid.Cart.setCustomerEmail()";this.legacyApiImpl.getJsApiAsync().then(i=>{i.updateCart({email:e},r,n,o)})}setOrderComments(e,r,n){if(this.isEmptyString(e))return;const o="Ecwid.Cart.setOrderComments()";this.legacyApiImpl.getJsApiAsync().then(i=>{i.updateCart({orderComments:e},r,n,o)})}setAddress(e,r,n){const o="Ecwid.Cart.setAddress()";this.legacyApiImpl.getJsApiAsync().then(i=>{i.updateCart({shippingPerson:e},r,n,o)})}setBillingAddress(e,r,n){const o="Ecwid.Cart.setBillingAddress()";this.legacyApiImpl.getJsApiAsync().then(i=>{i.updateCart({billingPerson:e},r,n,o)})}refreshCartInfo(e){this.legacyApiImpl.getJsApiAsync().then(r=>{r.refreshCartInfo(e)})}isEmptyString(e){return e===void 0||e.trim()===""}}const U={STANDARD:"STANDARD",MINI:"MINI",FLOATING:"FLOATING",UNSUPPORTED:"UNSUPPORTED"};function O(t){var e;switch((e=t==null?void 0:t.toString())==null?void 0:e.toLowerCase()){case"true":case"1":return!0;case"false":case"0":return!1;default:return}}function V(t){if(t!==void 0){const e=parseInt(t==null?void 0:t.toString(),10);if(!Number.isNaN(e))return e}}function nn(t){if(t!==void 0){const e=parseFloat(t);if(!Number.isNaN(e))return e}}function P(t,e){for(const r of Object.keys(t)){const n=t[r];if(n!==void 0&&n.toString()===e)return t[r]}}function ne(t,e){const r=t.getAttribute(e);if(r!==null)return r}function K(t,e){const r=ne(t,e);return V(r)}function M(t,e){const r=ne(t,e);return O(r)}function b(t,e,r){return P(r,t.getAttribute(e))}const le="productid",Zt="layout",er="defaultCategoryId",tr="defaultProductId",rr=/grid\((?\d+), *(?\d+)\)/,nr="views",ge="productid",pe="data-single-product-id";function or(t){const e=t[nr];if(e!==void 0){const r=e.match(rr);if(r!==null&&r.groups!==void 0&&r.groups.rows!==void 0&&r.groups.cols!==void 0){const n=Math.max(1,parseInt(r.groups.rows,10)),o=Math.max(1,parseInt(r.groups.cols,10));return n*o}}}function ir(t){const e=t[er],r=e!==void 0?parseInt(e,10):NaN;return!Number.isNaN(r)&&r>0?r:void 0}function sr(t){const e=t[tr],r=e!==void 0?parseInt(e,10):NaN;return!Number.isNaN(r)&&r>0?r:void 0}function cr(t,e){const r=e[Zt]??"";return r.toLowerCase().includes("attach")?U.UNSUPPORTED:r==="floating"?U.FLOATING:r==="Mini"?U.MINI:U.STANDARD}function ar(t){const e=V(t[le]);if(e===void 0)throw new Error(`Parameter '${le}' is missing or invalid`);return e}function ur(t,e,r){return{productId:e,pageProductIdsPromise:r}}function dr(t,e){return{layout:cr(t,e)}}function lr(t){return{isMobileViewNotAllowed:t.hasAttribute("data-mobile-no"),isChildrenNotAllowed:t.hasAttribute("data-children-no")}}function gr(t){return{layout:b(t,p.DATA_LAYOUT,Oe),icon:b(t,p.DATA_ICON,we),isFixed:M(t,p.DATA_FIXED),fixedPosition:b(t,p.DATA_FIXED_POSITION,Re),fixedShape:b(t,p.DATA_FIXED_SHAPE,B),horizontalIndent:K(t,p.DATA_HORIZONTAL_INDENT),verticalIndent:K(t,p.DATA_VERTICAL_INDENT),isResponsive:M(t,p.DATA_RESPONSIVE),customIconUrl:ne(t,p.DATA_CUSTOM_ICON_URL),showEmptyCart:M(t,p.DATA_SHOW_EMPTY_CART),showBuyAnimation:M(t,p.DATA_SHOW_BUY_ANIMATION)}}function pr(t){return{layout:P(Oe,t[p.DATA_LAYOUT]),icon:P(we,t[p.DATA_ICON]),isFixed:O(t[p.DATA_FIXED]),fixedPosition:P(Re,t[p.DATA_FIXED_POSITION]),fixedShape:P(B,t[p.DATA_FIXED_SHAPE]),horizontalIndent:V(t[p.DATA_HORIZONTAL_INDENT]),verticalIndent:V(t[p.DATA_VERTICAL_INDENT]),isResponsive:O(t[p.DATA_RESPONSIVE]),customIconUrl:t[p.DATA_CUSTOM_ICON_URL],showEmptyCart:O(t[p.DATA_SHOW_EMPTY_CART]),showBuyAnimation:O(t[p.DATA_SHOW_BUY_ANIMATION])}}function mr(t,e){const r=gr(t),n=pr(e);return{layout:n.layout??r.layout,icon:n.icon??r.icon,isFixed:n.isFixed??r.isFixed,fixedPosition:n.fixedPosition??r.fixedPosition,fixedShape:n.fixedShape??r.fixedShape,horizontalIndent:n.horizontalIndent??r.horizontalIndent,verticalIndent:n.verticalIndent??r.verticalIndent,isResponsive:n.isResponsive??r.isResponsive,customIconUrl:n.customIconUrl??r.customIconUrl,showEmptyCart:n.showEmptyCart??r.showEmptyCart,showBuyAnimation:n.showBuyAnimation??r.showBuyAnimation}}function hr(t){return{defaultCategoryId:ir(t),defaultProductId:sr(t),productsPerPage:or(t),timeZoneOffset:void 0}}function fr(t){const e=t[ge],r=e!==void 0?parseInt(e,10):NaN;if(Number.isNaN(r))throw new Error(`Parameter '${ge}' is missing or invalid`);return r}function Ar(t,e){return{productId:t,pageProductIdsPromise:e}}function me(t){const e=K(t,pe);if(e===void 0)throw new Error(`Attribute '${pe}' is missing or invalid`);return e}function he(t,e,r){return{productId:t,pageProductIdsPromise:e,isNewLookAndFeel:r}}class Er{constructor(e){this.pageProductIds=new Set,this.ecommerce=e}collectPageProductId(e){return this.pageProductIds.add(e),new Promise(r=>{setTimeout(()=>{const n=[...this.pageProductIds].sort();r(n)},0)})}async renderWidget(e,r){const n=Le(e.arg??[]);switch(await new Promise(o=>{setTimeout(o)}),e.widgetType){case a.ADD_TO_BAG:{const o=ar(n),i=this.collectPageProductId(o);return this.ecommerce.widgets.createAddToBag({containerElement:r,rootProps:ur(r,o,i)})}case a.HORIZONTAL_CATEGORIES_V1:return this.ecommerce.widgets.createCategoriesV1({containerElement:r,rootProps:{direction:q.HORIZONTAL}});case a.CATEGORIES_V2:return this.ecommerce.widgets.createCategoriesV2({containerElement:r,rootProps:lr(r)});case a.MINICART_V1:return this.ecommerce.widgets.createMinicartV1({containerElement:r,rootProps:dr(r,n)});case a.MINICART_V2:return this.ecommerce.widgets.createMinicartV2({containerElement:r,rootProps:mr(r,n)});case a.PRODUCT:{const o=me(r),i=this.collectPageProductId(o);return this.ecommerce.widgets.createSingleProduct({containerElement:r,rootProps:he(o,i,!0)})}case a.PRODUCT_BROWSER:return this.ecommerce.widgets.createProductBrowser({containerElement:r,rootProps:hr(n)});case a.PRODUCT_THUMBNAIL:{const o=fr(n),i=this.collectPageProductId(o);return this.ecommerce.widgets.createProductThumbnail({containerElement:r,rootProps:Ar(o,i)})}case a.SEARCH_PANEL:return this.ecommerce.widgets.createSearchPanel({containerElement:r,rootProps:{}});case a.SEARCH_WIDGET:return this.ecommerce.widgets.createSearchWidget({containerElement:r,rootProps:{}});case a.SINGLE_PRODUCT:{const o=me(r),i=this.collectPageProductId(o);return this.ecommerce.widgets.createSingleProduct({containerElement:r,rootProps:he(o,i,!1)})}case a.VERTICAL_CATEGORIES_V1:return this.ecommerce.widgets.createCategoriesV1({containerElement:r,rootProps:{direction:q.VERTICAL}});case a.CP_PREVIEW_PRODUCT_CARD:return this.ecommerce.widgets.createCpPreviewProductCard({containerElement:r});case a.CP_PREVIEW_CATEGORY:return this.ecommerce.widgets.createCpPreviewCategory({containerElement:r});default:throw new Error(`Unknown widget type '${e.widgetType}'`)}}}class Ir{constructor(e,r,n){this.ecommerce=e;const o=new Er(this.ecommerce);this.ecImpl=new Gt(this),this.ecwidImpl=new jt(this,o,n),this.ecwidCartImpl=new Qt(this),this.windowImpl=new Kt(this.ecwidImpl,o,n)}getEcImpl(){return this.ecImpl}getEcwidImpl(){return this.ecwidImpl}getEcwidCartImpl(){return this.ecwidCartImpl}getWindowImpl(){return this.windowImpl}getEcommerce(){return this.ecommerce}ensureJsApiSync(){if(this.jsApiSync===void 0)throw Error(`Ecwid JS API is not initialized! Please make sure your code is wrapped in an Ecwid.OnAPILoaded.add callback. See the documentation for more details: https://api-docs.ecwid.com/reference/ecwidonapiloaded#ecwidonapiloaded`);return this.jsApiSync}getJsApiAsync(){const r=this.getEcommerce().widgets.createOrGetJsApi();return r.then(n=>{this.jsApiSync=n}),r}getTrackerAsync(){if(this.trackerAsync===void 0){const e=this.getEcommerce(),r=document.createElement("div");this.trackerAsync=e.widgets.createTracker({containerElement:r,rootProps:{}})}return this.trackerAsync}}class Tr extends EventTarget{addEventListener(e,r,n){super.addEventListener(e,r,n)}removeEventListener(e,r,n){super.removeEventListener(e,r,n)}dispatchTypedEvent(e,r){return super.dispatchEvent(r)}}function yr(t){return typeof t!="function"||!t.toString().includes("[native code]")}function Sr(t,e,r,n){const o=e;yr(o[r])&&(t.warn(g.APP_LIFECYCLE,`Restoring patched browser function '${r}'. Old value:`,o[r]),n!==void 0?o[r]=n:delete o[r])}function Pr(){const t=document.createElement("iframe");document.body.appendChild(t);const e=t.contentWindow;try{return e===null?[]:[{target:Array,property:"from",iframeCorrectFunc:e.Array.from},{target:Array.prototype,property:"reduce",iframeCorrectFunc:e.Array.prototype.reduce},{target:Array.prototype,property:"toJSON",iframeCorrectFunc:void 0},{target:Function.prototype,property:"bind",iframeCorrectFunc:e.window.Function.prototype.bind},{target:String.prototype,property:"replaceAll",iframeCorrectFunc:e.window.String.prototype.replaceAll},{target:String.prototype,property:"trim",iframeCorrectFunc:e.window.String.prototype.trim},{target:String.prototype,property:"trimLeft",iframeCorrectFunc:e.window.String.prototype.trimLeft},{target:String.prototype,property:"trimRight",iframeCorrectFunc:e.window.String.prototype.trimRight},{target:Promise,property:"allSettled",iframeCorrectFunc:e.window.Promise.allSettled},{target:window,property:"Event",iframeCorrectFunc:e.window.Event}]}finally{t.remove()}}function Cr(t){try{Pr().forEach(({target:r,property:n,iframeCorrectFunc:o})=>{Sr(t,r,n,o)})}catch(e){t.error(g.APP_LIFECYCLE,"Failed to restore patched browser functions:",e)}}function _r(t){return new Promise(e=>{setTimeout(()=>e(t()))})}function Rr(t){if(t===void 0)return{};const e=t.storeId,r=t.sessionToken.getValue(e);return r!==void 0?{Authorization:`Bearer ${r}`}:{}}function wr(t){return JSON.stringify(t)}function Or(t,e){return new Headers({"Content-Type":"application/json",...Rr(t),...e})}async function vr(t,e,r,n){return _r(()=>({method:t,mode:"cors",headers:Or(r,n),body:wr(e)}))}async function Lr(t,e,r){const n=new AbortController,o={...e,signal:n.signal},i=setTimeout(()=>{const s=new DOMException("The user aborted a request.","AbortError");n.abort(s)},r);try{return await fetch(t,o)}finally{clearTimeout(i)}}const De="StorefrontApiBusinessError";class Dr extends Error{constructor(e,r){super(e.statusText),this.type=De,this.response=e;try{this.data=JSON.parse(r)}catch{this.data=void 0}this.text=r}isBadRequestError(){return this.response.status===400}isUnauthorizedError(){return this.response.status===401}isNotFoundError(){return this.response.status===404}getData(){return this.data}getText(){return this.text}getResponse(){return this.response}}function W(t){return"type"in t&&t.type===De}const Nr=8,Ur=3e4;function on(){return!1}function sn(){var t;return((t=window.top)==null?void 0:t.location)!==window.location}function Mr(t,e,r){if((e==null?void 0:e.isRetryable)===!1||t>=Nr)return!1;if(W(r)){const o=r.getResponse().status;return o>=500&&o<=599}return!0}function Ne(t){return new Date().getTime()-t.getTime()}function k(t){return t>1?[`(x${t})`]:[]}function br(t){var o;const e=Ne(t.requestStartDate),r=t.error.getResponse(),n=[`#${t.currentRequestIndex}`,...k(t.retryNumber),"⛌",`[${e} ms]`,`[${r.status} ${r.statusText}]`,(o=t.requestMethod)==null?void 0:o.toUpperCase(),t.url,t.error.getData()??t.error.getText()];t.logger.warn(g.REST,...n)}function xr(t){const e=[];let r=t;for(;r!==void 0;)e.push(r.stack??r.message??String(r)),r=r.cause;return e.join(` Caused by: `)}function Vr(t){var r;const e=[`#${t.currentRequestIndex}`,...k(t.retryNumber),"⛌",(r=t.requestMethod)==null?void 0:r.toUpperCase(),t.url,xr(t.error)];t.logger.warn(g.REST,...e)}function Wr(t){W(t.error)?br({logger:t.logger,requestStartDate:t.requestStartDate,currentRequestIndex:t.currentRequestIndex,retryNumber:t.retryNumber,requestMethod:t.requestMethod,url:t.url,error:t.error}):Vr({logger:t.logger,url:t.url,currentRequestIndex:t.currentRequestIndex,retryNumber:t.retryNumber,requestMethod:t.requestMethod,error:t.error.getError()})}function Fr(t){const e=[`#${t.currentRequestIndex}`,...k(t.retryNumber),"⮕",t.requestMethod.toUpperCase(),t.url,t.data];t.logger.info(g.REST,...e)}function Br(t){var o;const e=Ne(t.requestStartDate),r=`${t.responseStatus} ${t.responseStatusText}`.trim(),n=[`#${t.currentRequestIndex}`,...k(t.retryNumber),"⬅",`[${e} ms]`,`[${r}]`,(o=t.requestMethod)==null?void 0:o.toUpperCase(),t.url,t.responseData];t.logger.info(g.REST,...n)}const kr="StorefrontApiFatalError";class Gr extends Error{constructor(e){super(e.message),this.type=kr,this.error=e}getError(){return this.error}}function Jr(t){const e=2**t*100,r=e*.2*Math.random();return e+r}function Hr(t){return new Promise(e=>{setTimeout(e,Jr(t))})}class jr{constructor(e,r,n,o){this.requestIndex=0,this.storeId=e,this.apiBaseUrl=r,this.additionalHeaders=n,this.logger=o}createRequestUrl(e){return`${this.apiBaseUrl}/${this.storeId}${e}`}setSessionStorageOptions(e){this.sessionStorageOptions=e}async makeRequest(e,r,n){let o=1;this.requestIndex+=1;const i="post",s=this.requestIndex,u=async()=>{const d=new Date;try{Fr({logger:this.logger,url:e,data:r,currentRequestIndex:s,retryNumber:o,requestMethod:i});const m=await vr(i,r,this.sessionStorageOptions,this.additionalHeaders),c=await Lr(this.createRequestUrl(e),m,Ur);if(!c.ok){const f=await c.text();throw new Dr(c,f)}const l=await c.json();return Br({logger:this.logger,url:e,currentRequestIndex:s,retryNumber:o,requestStartDate:d,requestMethod:i,responseStatus:c.status,responseStatusText:c.statusText,responseData:l}),{data:l}}catch(m){const c=m,l=W(c)?c:new Gr(c);if(Wr({logger:this.logger,url:e,currentRequestIndex:s,retryNumber:o,requestStartDate:d,requestMethod:i,error:l}),W(c)&&c.isUnauthorizedError())throw this.resetInvalidSession(),c;if(Mr(o,n,l))return await Hr(o),o+=1,u();throw c}};return u()}resetInvalidSession(){var r,n,o,i,s;const e=((r=this.sessionStorageOptions)==null?void 0:r.storeId)??0;(n=this.sessionStorageOptions)==null||n.isolatedSessionMode.setValue(e,void 0),(o=this.sessionStorageOptions)==null||o.sessionToken.setValue(e,void 0),(i=this.sessionStorageOptions)==null||i.checkoutInfo.setValue(e,void 0),(s=this.sessionStorageOptions)==null||s.legacyAuthToken.setValue(e,void 0)}}const fe={NORMAL:"NORMAL",PREVIEW:"PREVIEW",PREVIEW_PRODUCT_EDITOR_PAGE:"PREVIEW_PRODUCT_EDITOR_PAGE",PREVIEW_DESIGN_PAGE:"PREVIEW_DESIGN_PAGE"};class qr{constructor(){this.eventListeners=new Map}ensureListeners(e){const r=this.eventListeners.get(e);if(r!==void 0)return r;const n=new Set;return this.eventListeners.set(e,n),n}publish(e,...r){const n=this.eventListeners.get(e);n!==void 0&&n.forEach(o=>{o(...r)})}subscribe(e,r){const n=this.ensureListeners(e);return n.add(r),()=>{n.has(r)&&(n.delete(r),n.size===0&&this.eventListeners.delete(e))}}}const $r="ec-storefront-forced-tracing-enabled",Yr="X-Ec-Forced-Tracing-Enabled";function zr(){return new ct(new Fe("show_ec_logs"))}function Xr(t,e,r){if(t!==void 0)return Promise.resolve(t);const n={lang:e};return r.makeRequest("/bootstrap",n).then(o=>o.data)}function Kr(t){const e=Math.random()import("./vendor-datadog-browser-rum-mdoymghf.js"),[],import.meta.url).then(n=>{var i,s;const o=n.datadogRum;return o.init({applicationId:t.applicationId,clientToken:t.clientToken,site:t.site,service:t.service,env:t.env,version:t.version,allowedTracingUrls:[{match:e,propagatorTypes:["tracecontext"]}],sessionSampleRate:100,sessionReplaySampleRate:0,trackingConsent:((s=(i=window.ec)==null?void 0:i.config)==null?void 0:s.disable_all_cookies)===!0?"not-granted":"granted",trackUserInteractions:!0,trackResources:!0,trackLongTasks:!0}),o})}class oe extends Tr{static updateGlobalEcommerceInstance(e){window.Ecwid.ecommerceInstance===void 0&&(window.Ecwid.ecommerceInstance=e)}constructor(e){super(),oe.updateGlobalEcommerceInstance(this);const r=zr();Cr(r);const n=I.getEntryPointQueryParams(),o=(e==null?void 0:e.storeId)??n.storeId,i=(e==null?void 0:e.apiBaseUrl)??I.getEcommerceJsParams().apiBaseUrl,s=(e==null?void 0:e.lang)??n.lang,u=P(fe,e==null?void 0:e.appMode)??fe.NORMAL,d=Q.get($r)==="true",m=en(I.getEcommerceJsParams().datadogRum,i,d),c={ecommerceEventTarget:this,apiEventBus:new qr,datadogRumPromise:m,widgetLang:s};this.legacyApiImpl=new Ir(this,c,r);const l=new jr(o,i,Qr(d),r),f=Xr(e==null?void 0:e.bootstrap,s,l);this.widgets=new kt({appMode:u,bootstrapPromise:f,ecommerce:this,logger:r,requestContext:c,storefrontApiClient:l,storeId:o})}addEventListener(e,r,n){this.legacyApiImpl.getJsApiAsync().then(()=>{super.addEventListener(e,r,n)})}}window.ec=window.ec??{};window.ec.config=window.ec.config??{};window.ec.order=window.ec.order??{};window.ec.storefront=window.ec.storefront??{};window._xnext_initialization_scripts=window._xnext_initialization_scripts??[];window.Ecommerce=oe;window.EcommerceGlobals=I;window.rtCommonProps!==void 0&&(delete window.rtCommonProps["new.store.fix.ecwid.back.bug"],delete window.rtCommonProps["new.store.accountPage.ecwid.signIn.fix"]);(()=>{const t=new CustomEvent("ecommerce.ready");document.dispatchEvent(t)})();export{fe as A,q as C,a as D,oe as E,g as L,U as M,h as _,P as a,Re as b,Oe as c,yt as d,B as e,we as f,sn as g,ae as h,W as i,R as j,Q as k,ht as l,at as m,on as n,nn as o,V as p,O as q,tn as r,rn as s,T as t,St as u,Ee as v,F as w,zt as x,ee as y}; //# sourceMappingURL=https://storefront.ecwid.dev:16088/static/ecommerce-l3l4fdob.js.map