';var n={};n='';var o=Object.defineProperty,r=(e,t,n)=>(((e,t,n)=>{t in e?o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function s(e){if(g(e)){const t={};for(let n=0;n{if(e){const n=e.split(c);n.length>1&&(t[n[0].trim()]=n[1].trim())}})),t}function l(e){let t="";if(b(e))t=e;else if(g(e))for(let n=0;nd(e,t)))}const f=Object.assign,p=Object.prototype.hasOwnProperty,h=(e,t)=>p.call(e,t),g=Array.isArray,m=e=>"[object Map]"===k(e),v=e=>e instanceof Date,b=e=>"string"==typeof e,w=e=>"symbol"==typeof e,y=e=>null!==e&&"object"==typeof e,x=Object.prototype.toString,k=e=>x.call(e),_=e=>k(e).slice(8,-1),S=e=>b(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,$=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},z=/-(\w)/g,O=$((e=>e.replace(z,((e,t)=>t?t.toUpperCase():"")))),E=/\B([A-Z])/g,M=$((e=>e.replace(E,"-$1").toLowerCase())),R=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let j;function C(e,t){(t=t||j)&&t.active&&t.effects.push(e)}const A=e=>{const t=new Set(e);return t.w=0,t.n=0,t},N=e=>(e.w&B)>0,P=e=>(e.n&B)>0,L=new WeakMap;let T=0,B=1;const I=30,W=[];let V;const D=Symbol(""),F=Symbol("");class H{constructor(e,t=null,n){this.fn=e,this.scheduler=t,this.active=!0,this.deps=[],C(this,n)}run(){if(!this.active)return this.fn();if(!W.includes(this))try{return W.push(V=this),Z.push(K),K=!0,B=1<<++T,T<=I?(({deps:e})=>{if(e.length)for(let t=0;t{const{deps:t}=e;if(t.length){let n=0;for(let o=0;o0?W[e-1]:void 0}}stop(){this.active&&(J(this),this.onStop&&this.onStop(),this.active=!1)}}function J(e){const{deps:t}=e;if(t.length){for(let n=0;n{("length"===t||t>=o)&&c.push(e)}));else switch(void 0!==n&&c.push(i.get(n)),t){case"add":g(e)?S(n)&&c.push(i.get("length")):(c.push(i.get(D)),m(e)&&c.push(i.get(F)));break;case"delete":g(e)||(c.push(i.get(D)),m(e)&&c.push(i.get(F)));break;case"set":m(e)&&c.push(i.get(D))}if(1===c.length)c[0]&&X(c[0]);else{const e=[];for(const t of c)t&&e.push(...t);X(A(e))}}function X(e,t){for(const t of g(e)?e:[...e])(t!==V||t.allowRecurse)&&(t.scheduler?t.scheduler():t.run())}const Y=function(e,t){const n=Object.create(null),o=e.split(",");for(let e=0;e!!n[e.toLowerCase()]:e=>!!n[e]}("__proto__,__v_isRef,__isVue"),ee=new Set(Object.getOwnPropertyNames(Symbol).map((e=>Symbol[e])).filter(w)),te=re(),ne=re(!0),oe=function(){const e={};return["includes","indexOf","lastIndexOf"].forEach((t=>{e[t]=function(...e){const n=pe(this);for(let e=0,t=this.length;e{e[t]=function(...e){Z.push(K),K=!1;const n=pe(this)[t].apply(this,e);return q(),n}})),e}();function re(e=!1,t=!1){return function(n,o,r){if("__v_isReactive"===o)return!e;if("__v_isReadonly"===o)return e;if("__v_raw"===o&&r===(e?t?de:le:t?ae:ce).get(n))return n;const s=g(n);if(!e&&s&&h(oe,o))return Reflect.get(oe,o,r);const i=Reflect.get(n,o,r);return(w(o)?ee.has(o):Y(o))||(e||G(n,0,o),t)?i:he(i)?s&&S(o)?i:i.value:y(i)?e?function(e){return fe(e,!0,ie,null,le)}(i):ue(i):i}}const se={get:te,set:function(e=!1){return function(t,n,o,r){let s=t[n];if(!e&&!function(e){return!(!e||!e.__v_isReadonly)}(o)&&(o=pe(o),s=pe(s),!g(t)&&he(s)&&!he(o)))return s.value=o,!0;const i=g(t)&&S(n)?Number(n)!Object.is(e,t))(o,s)&&Q(t,"set",n,o):Q(t,"add",n,o)),c}}(),deleteProperty:function(e,t){const n=h(e,t);e[t];const o=Reflect.deleteProperty(e,t);return o&&n&&Q(e,"delete",t,void 0),o},has:function(e,t){const n=Reflect.has(e,t);return(!w(t)||!ee.has(t))&&G(e,0,t),n},ownKeys:function(e){return G(e,0,g(e)?"length":D),Reflect.ownKeys(e)}},ie={get:ne,set:(e,t)=>!0,deleteProperty:(e,t)=>!0},ce=new WeakMap,ae=new WeakMap,le=new WeakMap,de=new WeakMap;function ue(e){return e&&e.__v_isReadonly?e:fe(e,!1,se,null,ce)}function fe(e,t,n,o,r){if(!y(e)||e.__v_raw&&(!t||!e.__v_isReactive))return e;const s=r.get(e);if(s)return s;const i=function(e){return e.__v_skip||!Object.isExtensible(e)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(_(e))}(e);if(0===i)return e;const c=new Proxy(e,2===i?o:n);return r.set(e,c),c}function pe(e){const t=e&&e.__v_raw;return t?pe(t):e}function he(e){return Boolean(e&&!0===e.__v_isRef)}Promise.resolve();let ge=!1;const me=[],ve=Promise.resolve(),be=e=>ve.then(e),we=e=>{me.includes(e)||me.push(e),ge||(ge=!0,be(ye))},ye=()=>{for(const e of me)e();me.length=0,ge=!1},xe=/^(spellcheck|draggable|form|list|type)$/,ke=({el:e,get:t,effect:n,arg:o,modifiers:r})=>{let s;"class"===o&&(e._class=e.className),n((()=>{let n=t();if(o)(null==r?void 0:r.camel)&&(o=O(o)),_e(e,o,n,s);else{for(const t in n)_e(e,t,n[t],s&&s[t]);for(const t in s)(!n||!(t in n))&&_e(e,t,null)}s=n}))},_e=(e,t,n,o)=>{if("class"===t)e.setAttribute("class",l(e._class?[e._class,n]:n)||"");else if("style"===t){n=s(n);const{style:t}=e;if(n)if(b(n))n!==o&&(t.cssText=n);else{for(const e in n)$e(t,e,n[e]);if(o&&!b(o))for(const e in o)null==n[e]&&$e(t,e,"")}else e.removeAttribute("style")}else e instanceof SVGElement||!(t in e)||xe.test(t)?"true-value"===t?e._trueValue=n:"false-value"===t?e._falseValue=n:null!=n?e.setAttribute(t,n):e.removeAttribute(t):(e[t]=n,"value"===t&&(e._value=n))},Se=/\s*!important$/,$e=(e,t,n)=>{g(n)?n.forEach((n=>$e(e,t,n))):t.startsWith("--")?e.setProperty(t,n):Se.test(n)?e.setProperty(M(t),n.replace(Se,""),"important"):e[t]=n},ze=(e,t)=>{const n=e.getAttribute(t);return null!=n&&e.removeAttribute(t),n},Oe=(e,t,n,o)=>{e.addEventListener(t,n,o)},Ee=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Me=["ctrl","shift","alt","meta"],Re={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&0!==e.button,middle:e=>"button"in e&&1!==e.button,right:e=>"button"in e&&2!==e.button,exact:(e,t)=>Me.some((n=>e[`${n}Key`]&&!t[n]))},je=({el:e,get:t,exp:n,arg:o,modifiers:r})=>{if(!o)return;let s=Ee.test(n)?t(`(e => ${n}(e))`):t(`($event => { ${n} })`);if("vue:mounted"!==o){if("vue:unmounted"===o)return()=>s();if(r){"click"===o&&(r.right&&(o="contextmenu"),r.middle&&(o="mouseup"));const e=s;s=t=>{if(!("key"in t)||M(t.key)in r){for(const e in r){const n=Re[e];if(n&&n(t,r))return}return e(t)}}}Oe(e,o,s,r)}else be(s)},Ce=({el:e,get:t,effect:n})=>{n((()=>{e.textContent=Ae(t())}))},Ae=e=>null==e?"":y(e)?JSON.stringify(e,null,2):String(e),Ne=e=>"_value"in e?e._value:e.value,Pe=(e,t)=>{const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t},Le=e=>{e.target.composing=!0},Te=e=>{const t=e.target;t.composing&&(t.composing=!1,Be(t,"input"))},Be=(e,t)=>{const n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!0),e.dispatchEvent(n)},Ie=Object.create(null),We=(e,t,n)=>Ve(e,`return(${t})`,n),Ve=(e,t,n)=>{const o=Ie[t]||(Ie[t]=De(t));try{return o(e,n)}catch(e){console.error(e)}},De=e=>{try{return new Function("$data","$el",`with($data){${e}}`)}catch(t){return console.error(`${t.message} in expression: ${e}`),()=>{}}},Fe={bind:ke,on:je,show:({el:e,get:t,effect:n})=>{const o=e.style.display;n((()=>{e.style.display=t()?o:"none"}))},text:Ce,html:({el:e,get:t,effect:n})=>{n((()=>{e.innerHTML=t()}))},model:({el:e,exp:t,get:n,effect:o,modifiers:r})=>{const s=e.type,i=n(`(val) => { ${t} = val }`),{trim:c,number:a="number"===s}=r||{};if("SELECT"===e.tagName){const t=e;Oe(e,"change",(()=>{const e=Array.prototype.filter.call(t.options,(e=>e.selected)).map((e=>a?R(Ne(e)):Ne(e)));i(t.multiple?e:e[0])})),o((()=>{const e=n(),o=t.multiple;for(let n=0,r=t.options.length;n-1:r.selected=e.has(s);else if(d(Ne(r),e))return void(t.selectedIndex!==n&&(t.selectedIndex=n))}!o&&-1!==t.selectedIndex&&(t.selectedIndex=-1)}))}else if("checkbox"===s){let t;Oe(e,"change",(()=>{const t=n(),o=e.checked;if(g(t)){const n=Ne(e),r=u(t,n),s=-1!==r;if(o&&!s)i(t.concat(n));else if(!o&&s){const e=[...t];e.splice(r,1),i(e)}}else i(Pe(e,o))})),o((()=>{const o=n();g(o)?e.checked=u(o,Ne(e))>-1:o!==t&&(e.checked=d(o,Pe(e,!0))),t=o}))}else if("radio"===s){let t;Oe(e,"change",(()=>{i(Ne(e))})),o((()=>{const o=n();o!==t&&(e.checked=d(o,Ne(e)))}))}else{const t=e=>c?e.trim():a?R(e):e;Oe(e,"compositionstart",Le),Oe(e,"compositionend",Te),Oe(e,(null==r?void 0:r.lazy)?"change":"input",(()=>{e.composing||i(t(e.value))})),c&&Oe(e,"change",(()=>{e.value=e.value.trim()})),o((()=>{if(e.composing)return;const o=e.value,r=n();document.activeElement===e&&t(o)===r||o!==r&&(e.value=r)}))}},effect:({el:e,ctx:t,exp:n,effect:o})=>{be((()=>o((()=>Ve(t.scope,n,e)))))}},He=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,Je=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Ue=/^\(|\)$/g,Ke=/^[{[]\s*((?:[\w_$]+\s*,?\s*)+)[\]}]$/,Ze=(e,t,n)=>{const o=t.match(He);if(!o)return;const r=e.nextSibling,s=e.parentElement,i=new Text("");s.insertBefore(i,e),s.removeChild(e);const c=o[2].trim();let a,l,d,u,f=o[1].trim().replace(Ue,"").trim(),p=!1,h="key",m=e.getAttribute(h)||e.getAttribute(h=":key")||e.getAttribute(h="v-bind:key");m&&(e.removeAttribute(h),"key"===h&&(m=JSON.stringify(m))),(u=f.match(Je))&&(f=f.replace(Je,"").trim(),l=u[1].trim(),u[2]&&(d=u[2].trim())),(u=f.match(Ke))&&(a=u[1].split(",").map((e=>e.trim())),p="["===f[0]);let v,b,w,x=!1;const k=(e,t,o,r)=>{const s={};a?a.forEach(((e,n)=>s[e]=t[p?n:e])):s[f]=t,r?(l&&(s[l]=r),d&&(s[d]=o)):l&&(s[l]=o);const i=st(n,s),c=m?We(i.scope,m):o;return e.set(c,o),i.key=c,i},_=(t,n)=>{const o=new ct(e,t);return o.key=t.key,o.insert(s,n),o};return n.effect((()=>{const e=We(n.scope,c),t=w;if([b,w]=(e=>{const t=new Map,n=[];if(g(e))for(let o=0;o_(e,i))),x=!0})),r},qe=({el:e,ctx:{scope:{$refs:t}},get:n,effect:o})=>{let r;return o((()=>{const o=n();t[o]=e,r&&o!==r&&delete t[r],r=o})),()=>{r&&delete t[r]}},Ge=/^(?:v-|:|@)/,Qe=/\.([\w-]+)/g;let Xe=!1;const Ye=(e,t)=>{const n=e.nodeType;if(1===n){const n=e;if(n.hasAttribute("v-pre"))return;let o;if(ze(n,"v-cloak"),o=ze(n,"v-if"))return((e,t,n)=>{const o=e.parentElement,r=new Comment("v-if");o.insertBefore(r,e);const s=[{exp:t,el:e}];let i,c;for(;(i=e.nextElementSibling)&&(c=null,""===ze(i,"v-else")||(c=ze(i,"v-else-if")));)o.removeChild(i),s.push({exp:c,el:i});const a=e.nextSibling;o.removeChild(e);let l,d=-1;const u=()=>{l&&(o.insertBefore(r,l.el),l.remove(),l=void 0)};return n.effect((()=>{for(let e=0;e{let n=e.firstChild;for(;n;)n=Ye(n,t)||n.nextSibling},tt=(e,t,n,o)=>{let r,s,i;if(":"===(t=t.replace(Qe,((e,t)=>((i||(i={}))[t]=!0,""))))[0])r=ke,s=t.slice(1);else if("@"===t[0])r=je,s=t.slice(1);else{const e=t.indexOf(":"),n=e>0?t.slice(2,e):t.slice(2);r=Fe[n]||o.dirs[n],s=e>0?t.slice(e+1):void 0}r&&(r===ke&&"ref"===s&&(r=qe),nt(e,r,n,o,s,i),e.removeAttribute(t))},nt=(e,t,n,o,r,s)=>{const i=t({el:e,get:(t=n)=>We(o.scope,t,e),effect:o.effect,ctx:o,exp:n,arg:r,modifiers:s});i&&o.cleanups.push(i)},ot=(e,t)=>{if("#"!==t[0])e.innerHTML=t;else{const n=document.querySelector(t);e.appendChild(n.content.cloneNode(!0))}},rt=e=>{const t={delimiters:["{{","}}"],delimitersRE:/\{\{([^]+?)\}\}/g,...e,scope:e?e.scope:ue({}),dirs:e?e.dirs:{},effects:[],blocks:[],cleanups:[],effect:e=>{if(Xe)return we(e),e;const n=function(e,t){e.effect&&(e=e.effect.fn);const n=new H(e);t&&(f(n,t),t.scope&&C(n,t.scope)),(!t||!t.lazy)&&n.run();const o=n.run.bind(n);return o.effect=n,o}(e,{scheduler:()=>we(n)});return t.effects.push(n),n}};return t},st=(e,t={})=>{const n=e.scope,o=Object.create(n);Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)),o.$refs=Object.create(n.$refs);const r=ue(new Proxy(o,{set:(e,t,o,s)=>s!==r||e.hasOwnProperty(t)?Reflect.set(e,t,o,s):Reflect.set(n,t,o)}));return it(r),{...e,scope:r}},it=e=>{for(const t of Object.keys(e))"function"==typeof e[t]&&(e[t]=e[t].bind(e))};class ct{constructor(e,t,n=!1){r(this,"template"),r(this,"ctx"),r(this,"key"),r(this,"parentCtx"),r(this,"isFragment"),r(this,"start"),r(this,"end"),this.isFragment=e instanceof HTMLTemplateElement,n?this.template=e:this.isFragment?this.template=e.content.cloneNode(!0):this.template=e.cloneNode(!0),n?this.ctx=t:(this.parentCtx=t,t.blocks.push(this),this.ctx=rt(t)),Ye(this.template,this.ctx)}get el(){return this.start||this.template}insert(e,t=null){if(this.isFragment)if(this.start){let n,o=this.start;for(;o&&(n=o.nextSibling,e.insertBefore(o,t),o!==this.end);)o=n}else this.start=new Text(""),this.end=new Text(""),e.insertBefore(this.end,t),e.insertBefore(this.start,this.end),e.insertBefore(this.template,this.end);else e.insertBefore(this.template,t)}remove(){if(this.parentCtx&&((e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)})(this.parentCtx.blocks,this),this.start){const e=this.start.parentNode;let t,n=this.start;for(;n&&(t=n.nextSibling,e.removeChild(n),n!==this.end);)n=t}else this.template.parentNode.removeChild(this.template);this.teardown()}teardown(){this.ctx.blocks.forEach((e=>{e.teardown()})),this.ctx.effects.forEach(U),this.ctx.cleanups.forEach((e=>e()))}}const at=e=>e.replace(/[-.*+?^${}()|[\]\/\\]/g,"\\$&"),lt=e=>{const t=rt();if(e&&(t.scope=ue(e),it(t.scope),e.$delimiters)){const[n,o]=t.delimiters=e.$delimiters;t.delimitersRE=new RegExp(at(n)+"([^]+?)"+at(o),"g")}let n;return t.scope.$s=Ae,t.scope.$nextTick=be,t.scope.$refs=Object.create(null),{directive(e,n){return n?(t.dirs[e]=n,this):t.dirs[e]},mount(e){if("string"==typeof e&&!(e=document.querySelector(e)))return;let o;return o=(e=e||document.documentElement).hasAttribute("v-scope")?[e]:[...e.querySelectorAll("[v-scope]")].filter((e=>!e.matches("[v-scope] [v-scope]"))),o.length||(o=[e]),n=o.map((e=>new ct(e,t,!0))),this},unmount(){n.forEach((e=>e.teardown()))}}},dt=document.currentScript;dt&&dt.hasAttribute("init")&<().mount();function ut(e){return new URL(e).origin}JSON.parse('"6.7.1"');const ft=["info","debug","error","warn"],pt=(()=>{let e="info";return{get level(){return e},set level(t){if(!ft.includes(t))throw new Error(`Invalid log level: ${t}`);t!==e&&ht(`Log level changed to ${t}`),e=t}}})(),ht=(...e)=>{["info","debug"].includes(pt.level)&&console.log("%cChoozr%cInfo","background: #ff5b60; color: white; border-bottom-left-radius: 5px; border-top-left-radius: 5px; padding: 2px","background: #5bbbff; color: white; border-bottom-right-radius: 5px; border-top-right-radius: 5px; padding: 2px",...e)},gt=(...e)=>{["debug"].includes(pt.level)&&console.log("%cChoozr%cDebug","background: #ff5b60; color: white; border-bottom-left-radius: 5px; border-top-left-radius: 5px; padding: 2px","background: #333; color: white; border-bottom-right-radius: 5px; border-top-right-radius: 5px; padding: 2px",...e)},mt=(...e)=>{["debug","warn","info","error"].includes(pt.level)&&console.log("%cChoozr%cLog","background: #ff5b60; color: white; border-bottom-left-radius: 5px; border-top-left-radius: 5px; padding: 2px","background: #ff3b3b; color: white; border-bottom-right-radius: 5px; border-top-right-radius: 5px; padding: 2px",...e)},vt=(...e)=>{["debug","warn","info"].includes(pt.level)&&console.log("%cChoozr%cWarning","background: #ff5b60; color: white; border-bottom-left-radius: 5px; border-top-left-radius: 5px; padding: 2px","background: #ffc55b; color: white; border-bottom-right-radius: 5px; border-top-right-radius: 5px; padding: 2px",...e)},bt="https://app.choozr.ai,https://imagewear.choozr.ai".split(",").map((e=>ut(e)));let wt,yt,xt=ut("https://app.choozr.ai"),kt="",_t=e=>{};function St(e){if(gt("Bridge received a message",e),!bt.includes(e.origin))return;xt=e.origin;const t=e.data;if("token"===t.type)!function(e){gt("Received a token",e),""===e||"null"===e?vt("Empty token received"):(window.localStorage.setItem("jwt",e),kt=e);_t(kt)}(t.token)}function $t(){ht("Sending logout message"),window.localStorage.clear();yt.postMessage({type:"logout"},xt)}const zt=()=>{zt.called||(zt.called=!0,gt("Initializing Choozr bridge"),wt=document.createElement("iframe"),wt.id="choozr-bridge",wt.style.display="none",wt.src="https://app.choozr.ai/bridge.html",document.body.appendChild(wt),yt=wt.contentWindow,window.addEventListener("message",St,!1))};var Ot={};Ot=JSON.parse('["de_DE","en_US","es_ES","fi_FI","fr_FR","it_IT","ja_JP","pt_PT"]');let Et="en_US";const Mt={};let Rt={};async function jt(t){let n="en_US";const o=[];t&&o.push(t),navigator.languages?o.push(...navigator.languages):o.push(navigator.language);for(const t of o){const o=t.slice(0,2),r=e(Ot).find((e=>e.startsWith(o)));if(r){n=r;break}}"en_US"!==n&&await async function(e){if("undefined"!==Mt[e]){const t=await async function(e){return await fetch(`./locales/${e}.json`).then((e=>{if(e.ok)return e.json();throw new Error("Something went wrong!")})).catch((e=>{mt(e)}))}(e);void 0!==t&&(Rt=t,Mt[e]=t)}else Rt=Mt[e];Et=e}(n)}function Ct(e,t={}){return console.log("$t",e,t),void 0!==Rt[e]&&""!==Rt[e]&&(e=Rt[e]),void 0===t&&(t={}),e.replace(/{(\w+)}/g,(function(e,n){return void 0===t[n]?e:t[n]}))}const At={poweredBy:!0,colors:{choozr:"#ff5b60",icon:"#000000",text:"#000000",poweredBy:"#696969",background:"transparent"}},Nt={...At};let Pt="size-recommendation",Lt={},Tt={},Bt="";function It(){const e=document.body.scrollHeight;window.parent.postMessage({type:"updateHeight",height:e},"*")}function Wt(){ht("Locale changed to",Et),this.currentLocale=Et}window.addEventListener("message",(function(o){if(gt("handleMessage inside widget",o),"object"==typeof o.data&&o.data.hasOwnProperty("type"))switch(o.data.type){case"config":gt("Received config",o.data),"object"==typeof o.data.data?.product?Tt=o.data.data.product:error("The product information sent from the integration was malformed"),"object"==typeof o.data.data?.options?(Lt=o.data.data.options,Lt.fontColor&&(Nt.colors.text=Lt.fontColor,Nt.colors.icon=Lt.fontColor,Nt.colors.poweredBy=function(e,t){if(t<-100||t>100)throw new Error("Percent should be between -100 and 100.");const n=parseInt(e.slice(1),16),o=(n>>16)+Math.round(2.55*t),r=(n>>8&255)+Math.round(2.55*t),s=(255&n)+Math.round(2.55*t);return`#${(16777216+(Math.min(255,Math.max(0,o))<<16)+(Math.min(255,Math.max(0,r))<<8)+Math.min(255,Math.max(0,s))).toString(16).slice(1)}`}(Lt.fontColor,40)),Lt.fontSize&&(document.body.style.fontSize=Lt.fontSize),["size-recommendation","measurements","pictures"].includes(Lt.type)&&(Pt=Lt.type),Lt.brandName&&(Bt=Lt.brandName),Lt.sso&&(Nt.sso=Lt.sso),jt(Lt?.languageCode).then(Wt)):error("The options sent from the integration was malformed"),lt({view:"loading",currentLocale:"en_US",scanSvg:e(t),choozrSvg:e(n),brandName:Bt,size:"N/A",type:Pt,config:{...At,...Nt},get allDone(){return 0===this.remaining},get cssVariables(){return Object.fromEntries(Object.entries({...this.config.colors}).map((([e,t])=>[`--${e}`,t])))},set allDone(e){this.todos.forEach((function(t){t.completed=e}))},$t:Ct,start(){ht("Starting to render the widget"),"complete"===document.readyState||"loaded"===document.readyState||"interactive"===document.readyState?(gt("Calling setupOnce"),zt()):(gt("Adding event listeners for setupOnce"),document.addEventListener("DOMContentLoaded",zt,!1),window.addEventListener("load",zt,!1)),_t=e=>{if(null==e||""===e)return ht("We are not logged in"),void(this.view="welcome");"size-recommendation"===Pt?(ht("Received a valid token and going into size-recommendation"),fetch("https://sizeguide-api.tailor.guide/v4/sizes/recommendations/?units=metric&lang=en_US",{headers:{accept:"application/json, text/plain, */*",authorization:`Bearer ${e}`,"content-type":"application/json"},body:JSON.stringify({store:Lt.storeId,...Tt}),method:"POST"}).then((async e=>{const t=await e.json();Array.isArray(t.data)&&t.data.length>0&&void 0===t.data[0].error&&t.data[0].optimalRecommendation?.isPerfectFit?(ht("Perfect fit received",t.data[0]),this.view="recommendation",this.size=t.data[0].optimalRecommendation.main,sizeResponse={main:t.data[0].optimalRecommendation.main,alternative:t.data[0].optimalRecommendation.alternative},this.sendSize(sizeResponse)):(ht("No perfect fit",t?.data),this.view="no-fit")}))):"pictures"===Pt?(ht("Received a valid token and going into pictures"),this.view="pictures"):"measurements"===Pt&&(ht("Received a valid token and going into measurements"),this.view="measurements")}},click(){ht("Widget clicked"),window.parent.postMessage({type:"click"},"*")},sendSize(e){gt("Sending size"),window.parent.postMessage({type:"size",data:e},"*")}}).mount("#app");break;case"logout":gt("Received logout",o.data),$t(),setTimeout((()=>{window.location.reload()}),500);break;case"measurements":gt("Received measurements",o.data),window.parent.postMessage({type:"measurements",data:o.data},"*");break;case"pictures":gt("Received pictures",o.data),window.parent.postMessage({type:"pictures",data:o.data},"*");break;case"detailedSize":gt("Received detailedSize",o.data),window.parent.postMessage({type:"detailedSize",data:o.data},"*")}})),ht("Sending init from widget"),window.parent.postMessage({type:"init",data:{}},"*"),window.addEventListener("DOMContentLoaded",It);new ResizeObserver(It).observe(document.documentElement)}();