const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./layers-widget-CdgSAZ9m.js","./layers-widget-EsaJEcap.js","./layers-widget-DeqaJRh1.js","./layers-widget-B3FqYvfB.js","./layers-widget-98ks9uNH.js","./layers-widget-CL7yCGc4.js","./layers-widget-BRgAlcSu.js","./layers-widget-CglxezVK.js"])))=>i.map(i=>d[i]); var M=Object.defineProperty;var T=(s,e,t)=>e in s?M(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var y=(s,e,t)=>T(s,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=t(i);fetch(i.href,a)}})();const B="modulepreload",I=function(s,e){return new URL(s,e).href},v={},p=function(e,t,r){let i=Promise.resolve();if(t&&t.length>0){const o=document.getElementsByTagName("link"),n=document.querySelector("meta[property=csp-nonce]"),x=n?.nonce||n?.getAttribute("nonce");i=Promise.allSettled(t.map(l=>{if(l=I(l,r),l in v)return;v[l]=!0;const h=l.endsWith(".css"),C=h?'[rel="stylesheet"]':"";if(!!r)for(let m=o.length-1;m>=0;m--){const f=o[m];if(f.href===l&&(!h||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${C}`))return;const c=document.createElement("link");if(c.rel=h?"stylesheet":B,h||(c.as="script"),c.crossOrigin="",c.href=l,x&&c.setAttribute("nonce",x),document.head.appendChild(c),h)return new Promise((m,f)=>{c.addEventListener("load",m),c.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${l}`)))})}))}function a(o){const n=new Event("vite:preloadError",{cancelable:!0});if(n.payload=o,window.dispatchEvent(n),!n.defaultPrevented)throw o}return i.then(o=>{for(const n of o||[])n.status==="rejected"&&a(n.reason);return e().catch(a)})},d=class d{themeProperties=new Map;observers=new Set;static getInstance(){return d.instance||(d.instance=new d),d.instance}constructor(){this.initializeDefaultTheme(),this.observeDocumentTheme()}initializeDefaultTheme(){["--layers-widget-color-primary","--layers-widget-color-primary-hover","--layers-widget-color-primary-light","--layers-widget-color-primary-transparent","--layers-widget-color-text","--layers-widget-color-text-secondary","--layers-widget-color-text-light","--layers-widget-color-background","--layers-widget-color-border","--layers-widget-color-shadow","--layers-widget-color-hover-bg","--layers-widget-color-overlay-bg","--layers-widget-color-price","--layers-widget-color-compare-price","--layers-widget-product-image-bg","--layers-widget-font-family","--layers-widget-font-size-sm","--layers-widget-font-size-md","--layers-widget-font-size-lg","--layers-widget-font-size-xl","--layers-widget-font-weight-normal","--layers-widget-font-weight-medium","--layers-widget-font-weight-bold","--layers-widget-spacing-xs","--layers-widget-spacing-sm","--layers-widget-spacing-md","--layers-widget-spacing-lg","--layers-widget-spacing-xl","--layers-widget-spacing-xxl","--layers-widget-spacing-xxxl","--layers-widget-border-radius-sm","--layers-widget-border-radius-md","--layers-widget-border-width","--layers-widget-border-width-dashed","--layers-widget-border-style-dashed","--layers-widget-icon-size-sm","--layers-widget-icon-size-md","--layers-widget-icon-size-lg","--layers-widget-icon-size-xl","--layers-widget-transition-duration","--layers-widget-transition-timing","--layers-widget-dialog-max-width","--layers-widget-dialog-width","--layers-widget-dialog-max-height","--layers-widget-dialog-shadow","--layers-widget-dialog-shadow-mobile","--layers-widget-dialog-border-radius","--layers-widget-results-image-max-width","--layers-widget-product-grid-columns","--layers-widget-product-grid-columns-desktop","--layers-widget-product-grid-columns-mobile","--layers-widget-product-grid-columns-desktop-mobile","--layers-widget-product-grid-gap","--layers-widget-product-image-aspect-ratio"].forEach(t=>{const r=getComputedStyle(document.documentElement).getPropertyValue(t).trim();r?this.themeProperties.set(t,r):this.setDefaultValue(t)}),window.Layers?.widgetManager?.config?.debug&&console.debug("[Layers] Theme properties initialized:",Object.fromEntries(this.themeProperties))}setDefaultValue(e){const t={"--layers-widget-color-primary":"#ff4500","--layers-widget-color-primary-hover":"#ff6347","--layers-widget-color-primary-light":"rgba(255, 69, 0, 0.05)","--layers-widget-color-primary-transparent":"rgba(255, 69, 0, 0.2)","--layers-widget-color-text":"#333333","--layers-widget-color-text-secondary":"#666666","--layers-widget-color-text-light":"#ffffff","--layers-widget-color-background":"#ffffff","--layers-widget-color-border":"#e0e0e0","--layers-widget-color-shadow":"rgba(0, 0, 0, 0.1)","--layers-widget-color-hover-bg":"rgba(0, 0, 0, 0.05)","--layers-widget-color-overlay-bg":"rgba(0, 0, 0, 0.5)","--layers-widget-color-price":"#333333","--layers-widget-color-compare-price":"#999999","--layers-widget-product-image-bg":"#f8f8f8","--layers-widget-font-family":"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif","--layers-widget-font-size-sm":"0.9rem","--layers-widget-font-size-md":"1rem","--layers-widget-font-size-lg":"1.2rem","--layers-widget-font-size-xl":"1.5rem","--layers-widget-font-weight-normal":"400","--layers-widget-font-weight-medium":"500","--layers-widget-font-weight-bold":"600","--layers-widget-spacing-xs":"0.25rem","--layers-widget-spacing-sm":"0.5rem","--layers-widget-spacing-md":"0.75rem","--layers-widget-spacing-lg":"1rem","--layers-widget-spacing-xl":"1.25rem","--layers-widget-spacing-xxl":"1.5rem","--layers-widget-spacing-xxxl":"2.5rem","--layers-widget-border-radius-sm":"0.25rem","--layers-widget-border-radius-md":"0.5rem","--layers-widget-border-width":"0.0625rem","--layers-widget-border-width-dashed":"0.125rem","--layers-widget-border-style-dashed":"dashed","--layers-widget-icon-size-sm":"1rem","--layers-widget-icon-size-md":"1.5rem","--layers-widget-icon-size-lg":"2rem","--layers-widget-icon-size-xl":"3rem","--layers-widget-transition-duration":"0.2s","--layers-widget-transition-timing":"ease","--layers-widget-dialog-max-width":"28.125rem","--layers-widget-dialog-width":"28.125rem","--layers-widget-dialog-max-height":"100vh","--layers-widget-dialog-shadow":"-0.3125rem 0 1.25rem rgba(0, 0, 0, 0.1)","--layers-widget-dialog-shadow-mobile":"0 -0.3125rem 1.25rem rgba(0, 0, 0, 0.1)","--layers-widget-dialog-border-radius":"0.5rem","--layers-widget-results-image-max-width":"12.5rem","--layers-widget-product-grid-columns":"2","--layers-widget-product-grid-columns-desktop":"3","--layers-widget-product-grid-columns-mobile":"2","--layers-widget-product-grid-columns-desktop-mobile":"2","--layers-widget-product-grid-gap":"1rem","--layers-widget-product-image-aspect-ratio":"1 / 1"};t[e]&&this.themeProperties.set(e,t[e])}observeDocumentTheme(){new MutationObserver(()=>{let t=!1;this.themeProperties.forEach((r,i)=>{const a=getComputedStyle(document.documentElement).getPropertyValue(i).trim();a&&a!==r&&(this.themeProperties.set(i,a),t=!0)}),t&&this.notifyObservers()}).observe(document.documentElement,{attributes:!0,attributeFilter:["style","class"]})}getThemePropertiesString(){let e="";return this.themeProperties.forEach((t,r)=>{e+=`${r}: ${t}; `}),e}getProperty(e){return this.themeProperties.get(e)}setProperty(e,t){this.themeProperties.set(e,t),this.notifyObservers()}setProperties(e){Object.entries(e).forEach(([t,r])=>{this.themeProperties.set(t,r)}),this.notifyObservers()}subscribe(e){return this.observers.add(e),e(this.themeProperties),()=>{this.observers.delete(e)}}notifyObservers(){this.observers.forEach(e=>{e(this.themeProperties)})}applyThemeToShadowRoot(e){let t=e.querySelector("#layers-theme-style");t||(t=document.createElement("style"),t.id="layers-theme-style",e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)),t.textContent=` :host { ${this.getThemePropertiesString()} } /* Ensure variables are available to all elements in the shadow DOM */ :host > * { ${this.getThemePropertiesString()} } `,window.Layers?.widgetManager?.config?.debug&&console.debug("[Layers] Applied theme to shadow root:",e)}};y(d,"instance");let b=d;function O(){return b.getInstance()}const A={tooltip:{text:"NEW: Search with your camera",closeButton:{ariaLabel:"Close tooltip"}},modal:{header:{title:"Search with an image"},closeButton:{ariaLabel:"Close modal"},poweredBy:{text:"Powered by",logoAlt:"Layers logo"}},steps:{upload:{ariaLabel:"Upload a photo",fileInput:{ariaLabel:"Upload photo"},button:{text:"Take or upload photo",ariaLabel:"Take or upload a photo"},dragDrop:{text:"Drag and drop a photo or click to upload",ariaLabel:"Drag and drop area for photo upload"},customContent:{ariaLabel:"Additional upload options"},paste:{text:"Paste from clipboard",ariaLabel:"Paste image from clipboard"},privacyNotice:{text:"We do not store, sell, or share the photos you upload."},instructions:{title:"Find exactly what you see—instantly.",steps:[{text:"Upload a screen shot from social media.",icon:"Sparkles"},{text:"Snap your friend's outfit and find similar styles in seconds.",icon:"Sparkles"},{text:"Crop in on a specific item.",icon:"Sparkles"}]}},choose:{ariaLabel:"Choose photo options",preview:{imageAlt:"Photo preview"},searchButton:{text:"Search with this photo",ariaLabel:"Search with this photo"},cropButton:{ariaLabel:"Crop photo"},backButton:{text:"Back",ariaLabel:"Go back to upload step"}},crop:{ariaLabel:"Crop photo",mobileInstructions:"Click and drag to select any area of the photo",desktopInstructions:"Click and drag to select any area of the photo",squareDrawer:{ariaLabel:"Square selection area",imageAlt:"Photo to select area from",selectionAriaLabel:"Selected area",containerAriaLabel:"Photo selection area",selectionMade:"Area selected. Press the Select Area button to continue."},backButton:{text:"Back",ariaLabel:"Go back to search results"},resetButton:{text:"Reset",ariaLabel:"Reset selection"},selectButton:{text:"Select Area",ariaLabel:"Select this area"}}},results:{ariaLabel:"Search results",selectedImage:{alt:"Selected photo area"},editButton:{text:"Crop Image",ariaLabel:"Crop image to refine search"},newSearchButton:{text:"New Search",ariaLabel:"Select a new photo to search with"},states:{loading:{text:"Searching for similar products..."},success:{title:"Search Results",productAriaLabel:"{title} - {price}"},empty:{title:"No results found",text:"We couldn't find any products that match your photo. Try selecting a different area or uploading another photo.",tryAgainButton:{text:"Try Another Photo",ariaLabel:"Try another photo"}},error:{title:"Something went wrong",defaultText:"An error occurred while searching for products. Please try again.",retryButton:{text:"Retry",ariaLabel:"Retry search"}}}}},P={modal:{header:{title:"Similar Products"},closeButton:{ariaLabel:"Close modal"},poweredBy:{text:"Powered by",logoAlt:"Layers logo"}},results:{title:"You might also like",productAriaLabel:"{title} - {price}",referenceImage:{alt:"Reference product image"},filterDropdown:{defaultLabel:"All Options",ariaLabel:"Filter products by option"},refineButton:{text:"Refine Search",ariaLabel:"Apply selected filter to refine search results"},states:{loading:{text:"Finding similar products..."},success:{title:"Similar Products",productAriaLabel:"{title} - {price}"},empty:{title:"No similar products found",text:"We couldn't find any similar products at this time."},error:{title:"Something went wrong",defaultText:"An error occurred while searching for similar products. Please try again.",retryButton:{text:"Retry",ariaLabel:"Retry search"}}}},preview:{title:"SHOP SIMILAR STYLES",titleWithCount:"SHOP {count}+ SIMILAR STYLES",ctaButton:"Shop Similar",emptyState:"We couldn't find any similar products at this time.",errorState:"An error occurred while searching for similar products."}},u=class u{translations={"image-search":{...A},"similar-products":{...P}};listeners=new Map;currentLanguage="en";constructor(){this.listeners.set("image-search",[]),this.listeners.set("similar-products",[]),this.detectLanguage()}static getInstance(){return u.instance||(u.instance=new u),u.instance}detectLanguage(){try{const e=navigator.language.split("-")[0];e&&(this.currentLanguage=e)}catch{console.warn("Could not detect browser language, using default")}}getTranslations(e){return this.translations[e]}updateTranslations(e,t){this.translations[e]=this.deepMerge(this.translations[e],t),this.notifyListeners(e)}setLanguage(e){this.currentLanguage=e,this.notifyAllListeners()}getLanguage(){return this.currentLanguage}subscribe(e,t){const r=this.listeners.get(e)||[];return r.push(t),this.listeners.set(e,r),()=>{const i=this.listeners.get(e)||[],a=i.indexOf(t);a!==-1&&(i.splice(a,1),this.listeners.set(e,i))}}notifyListeners(e){(this.listeners.get(e)||[]).forEach(r=>r())}notifyAllListeners(){Array.from(this.listeners.keys()).forEach(e=>{this.notifyListeners(e)})}deepMerge(e,t){const r={...e};return w(e)&&w(t)&&Object.keys(t).forEach(i=>{w(t[i])?i in e?r[i]=this.deepMerge(e[i],t[i]):Object.assign(r,{[i]:t[i]}):Object.assign(r,{[i]:t[i]})}),r}getTranslationByKey(e,t){const r=t.split(".");let i=this.translations[e];for(const a of r)if(i&&typeof i=="object"&&a in i)i=i[a];else return t;return typeof i=="string"?i:t}formatTranslation(e,t={}){return e.replace(/{(\w+)}/g,(r,i)=>t[i]??r)}loadTranslations(e,t){try{const r=typeof t=="string"?JSON.parse(t):t;this.updateTranslations(e,r)}catch(r){console.error("Failed to parse translations:",r)}}resetTranslations(e){e==="image-search"?this.translations[e]={...A}:e==="similar-products"&&(this.translations[e]={...P}),this.notifyListeners(e)}};y(u,"instance");let L=u;function w(s){return s&&typeof s=="object"&&!Array.isArray(s)}function z(){return L.getInstance()}const E="layers-analytics-event",g=class g{eventHandlers=[];constructor(){document.addEventListener(E,e=>{const t=e;t.detail&&t.detail.type&&this.notifyHandlers(t.detail.type,t.detail.data)})}static getInstance(){return g.instance||(g.instance=new g),g.instance}subscribe(e){return this.eventHandlers.push(e),()=>{const t=this.eventHandlers.indexOf(e);t!==-1&&this.eventHandlers.splice(t,1)}}emit(e,t={}){const r={timestamp:Date.now(),...t};document.dispatchEvent(new CustomEvent(E,{detail:{type:e,data:r},bubbles:!0,cancelable:!0})),this.notifyHandlers(e,r),typeof window.edgetag<"u"&&window.edgetag("tag",e,r,{},{method:"beacon",sync:!1}),typeof window.clarity=="function"&&window.clarity("event",e,r)}notifyHandlers(e,t){this.eventHandlers.forEach(r=>{try{r(e,t)}catch(i){console.error("Error in analytics event handler:",i)}})}};y(g,"instance");let S=g;const D=S.getInstance();class N{config={apiKey:null,debug:!1,hideBranding:!1,showInstructions:!0,currencyFormat:{currency:"USD",locale:"en-US",style:"currency",showSymbol:!0,currencyDisplay:"symbol"}};themeManager;translationManager;constructor(){this.themeManager=O(),this.translationManager=z()}readScriptConfig(e){const t=e.getAttribute("data-api-key"),r=e.getAttribute("data-debug")==="true",i=e.getAttribute("data-hide-branding")==="true";t&&(this.config.apiKey=t),r!==null&&(this.config.debug=r),i!==null&&(this.config.hideBranding=i),this.config.debug&&console.debug("[Layers] Widget Manager initialized with config:",this.config)}configure(e){this.config={...this.config,...e},this.config.debug&&console.debug("[Layers] Widget Manager configured:",this.config)}getApiKey(){return this.config.apiKey}setApiKey(e){this.config.apiKey=e,this.config.debug&&console.debug("[Layers] Widget Manager API key updated:",e)}updateTranslations(e,t){this.translationManager.updateTranslations(e,t),this.config.debug&&console.debug(`[Layers] Translations updated for ${e}:`,t)}updateTheme(e){this.themeManager.setProperties(e),this.config.debug&&console.debug("[Layers] Theme updated:",e)}updateCurrencyFormat(e){this.config.currencyFormat={...this.config.currencyFormat,...e},this.config.debug&&console.debug("[Layers] Currency format updated:",this.config.currencyFormat)}createImageSearchToggle(e){const t=typeof e.container=="string"?document.querySelector(e.container):e.container;if(!t)return this.config.debug&&console.error("Container not found:",e.container),null;const r=document.createElement("layers-image-search-toggle");return e.templateId&&r.setAttribute("template-id",e.templateId),e.uploadMode&&r.setAttribute("upload-mode",e.uploadMode),e.icon&&r.setAttribute("icon",e.icon),e.className&&(r.className=e.className),e.tooltip&&(e.tooltip.enabled!==void 0&&r.setAttribute("tooltip-enabled",e.tooltip.enabled.toString()),e.tooltip.text&&r.setAttribute("tooltip-text",e.tooltip.text),e.tooltip.duration&&r.setAttribute("tooltip-duration",e.tooltip.duration.toString()),e.tooltip.maxShows&&r.setAttribute("tooltip-max-shows",e.tooltip.maxShows.toString()),e.tooltip.showCloseButton!==void 0&&r.setAttribute("tooltip-show-close-button",e.tooltip.showCloseButton.toString())),e.showInstructions!==void 0&&r.setAttribute("show-instructions",e.showInstructions.toString()),t.appendChild(r),r}createSimilarProductsToggle(e){const t=typeof e.container=="string"?document.querySelector(e.container):e.container;if(!t)return this.config.debug&&console.error("Container not found:",e.container),null;const r=document.createElement("layers-similar-products-toggle");return r.setAttribute("product-id",e.productId),e.icon&&r.setAttribute("icon",e.icon),e.className&&(r.className=e.className),t.appendChild(r),r}createSimilarProductsPreview(e){const t=typeof e.container=="string"?document.querySelector(e.container):e.container;if(!t)return this.config.debug&&console.error("Container not found:",e.container),null;const r=document.createElement("layers-similar-products-preview");if(r.setAttribute("product-id",e.productId),e.title&&r.setAttribute("title",e.title),e.limit!==void 0&&r.setAttribute("limit",e.limit.toString()),e.showButton!==void 0&&r.setAttribute("show-button",e.showButton.toString()),e.lazyLoad!==void 0&&r.setAttribute("lazy-load",e.lazyLoad.toString()),e.filterGroups){const i=document.createElement("script");i.setAttribute("type","layers/filter-groups"),i.textContent=JSON.stringify(e.filterGroups),r.appendChild(i)}return t.appendChild(r),r}debugTheme(){const e=Object.fromEntries(Array.from(document.styleSheets).flatMap(i=>{try{return Array.from(i.cssRules)}catch{return[]}}).filter(i=>i.type===CSSRule.STYLE_RULE).flatMap(i=>Array.from(i.style)).filter(i=>i.startsWith("--layers-widget-")).map(i=>[i,getComputedStyle(document.documentElement).getPropertyValue(i)]));console.group("Layers Widget Theme Variables"),console.log("Theme Manager Variables:",Object.fromEntries(this.themeManager.themeProperties)),console.log("Document CSS Variables:",e);const t=Object.keys(e).filter(i=>!this.themeManager.themeProperties.has(i));t.length>0&&console.warn("Variables in document but missing in ThemeManager:",t);const r=Array.from(this.themeManager.themeProperties.keys()).filter(i=>!e[i]);r.length>0&&console.warn("Variables in ThemeManager but missing in document:",r),console.groupEnd()}}typeof window<"u"&&(window.Layers=window.Layers||{},window.Layers.widgetManager=new N,setTimeout(()=>{window.Layers.analytics=D},0));window.Layers.widgetManager;const k=document.querySelector("#layers-script");window.Layers.widgetManager.readScriptConfig(k);typeof window<"u"&&window.Layers?.widgetManager?.config?.debug&&console.debug("[Layers] Widgets initialized");setTimeout(()=>{p(()=>import("./layers-widget-CdgSAZ9m.js"),__vite__mapDeps([0,1,2]),import.meta.url),p(()=>import("./layers-widget-B3FqYvfB.js"),__vite__mapDeps([3,4,2]),import.meta.url),p(()=>import("./layers-widget-CL7yCGc4.js"),__vite__mapDeps([5,6,7,4]),import.meta.url)},0);export{p as _,O as a,D as b,z as u};