@dori-ai/dori-side-widget 1.13.173 → 1.13.174

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./MarkdownContent-C15ck6xJ.js","./provider-9Wh21Ch_.js","../widget.js","./link-DiZMDO7u.js"])))=>i.map(i=>d[i]);
2
- import{l as e,h as t,p as n,c as r,g as o,a,b as i,d as s,_ as l,s as c,e as d,f as u,i as p,j as h,k as f,m as g,w as m,n as b,o as x,t as y}from"../widget.js";import{r as v,j as w,c as C,a as k,u as j,g as S,b as z,d as A,e as E,m as R,f as T,h as _,i as W,B as I,k as L,l as M,n as B,R as F,o as D,p as H,q as P,s as q,t as O,I as N,H as Y,U as V,T as Z,v as U,w as Q,A as K,V as G,x as X,S as J,y as $,z as ee,C as te,D as ne,G as re,E as oe,F as ae,J as ie,K as se,L as le,M as ce,N as de,O as ue,P as pe,Q as he,W as fe,X as ge,Y as me,Z as be,_ as xe,$ as ye,a0 as ve,a1 as we,a2 as Ce,a3 as ke,a4 as je,a5 as Se,a6 as ze,a7 as Ae,a8 as Ee,a9 as Re,aa as Te,ab as _e,ac as We,ad as Ie,ae as Le,af as Me,ag as Be,ah as Fe,ai as De,aj as He,ak as Pe,al as qe,am as Oe,an as Ne,ao as Ye,ap as Ve,aq as Ze,ar as Ue,as as Qe,at as Ke,au as Ge,av as Xe,aw as Je,ax as $e,ay as et,az as tt,aA as nt,aB as rt,aC as ot,aD as at,aE as it,aF as st,aG as lt,aH as ct,aI as dt,aJ as ut,aK as pt,aL as ht,aM as ft,aN as gt,aO as mt,aP as bt,aQ as xt,aR as yt,aS as vt,aT as wt,aU as Ct,aV as kt,aW as jt,aX as St,aY as zt,aZ as At,a_ as Et,a$ as Rt,b0 as Tt,b1 as _t,b2 as Wt,b3 as It,b4 as Lt,b5 as Mt}from"./provider-9Wh21Ch_.js";import{u as Bt,L as Ft}from"./link-DiZMDO7u.js";import{d as Dt,s as Ht}from"./report-BHr6U1PB.js";const Pt=v.forwardRef(function(e,t){const{templateAreas:n,column:r,row:o,autoFlow:a,autoRows:i,templateRows:s,autoColumns:l,templateColumns:c,inline:d,...u}=e;return w.jsx(C.div,{...u,ref:t,css:[{display:d?"inline-grid":"grid",gridTemplateAreas:n,gridAutoColumns:l,gridColumn:r,gridRow:o,gridAutoFlow:a,gridAutoRows:i,gridTemplateRows:s,gridTemplateColumns:c},e.css]})});var qt=k();function Ot(e,t){const n=j().normalizeValue(e),r=function(e={}){e.fallback||(e.fallback="base");const t=j();let n=!1;const r=t.breakpoints.values.map(({min:t,name:r})=>{const o={breakpoint:r,query:`(min-width: ${t})`,fallback:!n};return r===e.fallback&&(n=!0),o}).filter(({breakpoint:t})=>!!e.breakpoints?.includes(t)),o=r.map(({fallback:e})=>e),a=function(e,t={}){const{fallback:n=[],ssr:r=!0,getWindow:o}=t,a=function(e,t=[]){const n=v.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return v.useInsertionEffect(()=>{n.current=e}),v.useCallback((...e)=>n.current?.(...e),t)}(o),i=Array.isArray(e)?e:[e],s=n?.filter(e=>null!=e),[l,c]=v.useState(()=>i.map((e,t)=>{if(!r){const{media:t,matches:n}=(o?.()??window).matchMedia(e);return{media:t,matches:n}}return{media:e,matches:!!s[t]}}));return v.useEffect(()=>{const e=a()??window;c(t=>{const n=i.map(t=>{const{media:n,matches:r}=e.matchMedia(t);return{media:n,matches:r}});return t.every((e,t)=>e.matches===n[t].matches&&e.media===n[t].media)?t:n});const t=i.map(t=>e.matchMedia(t)),n=e=>{c(t=>t.slice().map(t=>t.media===e.media?{...t,matches:e.matches}:t))},r=t.map(e=>function(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch(n){return e.addListener(t),()=>e.removeListener(t)}}(e,n));return()=>r.forEach(e=>e())},[a]),l.map(e=>e.matches)}(r.map(e=>e.query),{fallback:o,ssr:e.ssr}).lastIndexOf(!0);return r[a]?.breakpoint??e.fallback}({breakpoints:Object.keys(n),...t});return n[r]}var Nt=e=>{if(!e)return;const t=S(e),n=z(e),r=A(e),o=()=>{requestAnimationFrame(()=>{let n;e.style.height="auto",n="content-box"===t.boxSizing?e.scrollHeight-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):e.scrollHeight+parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),"none"!==t.maxHeight&&n>parseFloat(t.maxHeight)?("hidden"===t.overflowY&&(e.style.overflowY="scroll"),n=parseFloat(t.maxHeight)):"hidden"!==t.overflowY&&(e.style.overflowY="hidden"),e.style.height=`${n}px`})};e.addEventListener("input",o),e.form?.addEventListener("reset",o);const a=Object.getPrototypeOf(e),i=Object.getOwnPropertyDescriptor(a,"value");Object.defineProperty(e,"value",{...i,set(){i?.set?.apply(this,arguments),o()}});const s=new n.ResizeObserver(()=>{requestAnimationFrame(()=>o())});s.observe(e);const l=new n.MutationObserver(()=>o());return l.observe(e,{attributes:!0,attributeFilter:["rows","placeholder"]}),r.fonts?.addEventListener("loadingdone",o),()=>{e.removeEventListener("input",o),e.form?.removeEventListener("reset",o),r.fonts?.removeEventListener("loadingdone",o),s.disconnect(),l.disconnect()}};const Yt=v.forwardRef((e,t)=>{const{autoresize:n,...r}=e,o=v.useRef(null),a=E(),i=R(a?.getTextareaProps(),{style:{resize:n?"none":void 0}},r);return v.useEffect(()=>{if(n)return Nt(o.current)},[n]),w.jsx(T.textarea,{...i,ref:_(t,o)})});Yt.displayName="FieldTextarea";const{withContext:Vt}=W({key:"badge"}),Zt=Vt("span"),Ut=v.forwardRef(function(e,t){return w.jsx(I,{px:"0",py:"0",_icon:{fontSize:"1.2em"},ref:t,...e})}),{useRecipeResult:Qt}=W({key:"icon"}),Kt=v.forwardRef(function(e,t){const{styles:n,className:r,props:o}=Qt({asChild:!e.as,...e});return w.jsx(C.svg,{ref:t,focusable:!1,"aria-hidden":"true",...o,css:[n,e.css],className:L(r,e.className)})});function Gt(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,a=v.Children.toArray(e.path),i=v.forwardRef((e,r)=>w.jsx(Kt,{ref:r,asChild:!1,viewBox:t,...o,...e,children:a.length?a:w.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}const Xt=v.forwardRef(function(e,t){const{direction:n,align:r,justify:o,wrap:a,basis:i,grow:s,shrink:l,inline:c,...d}=e;return w.jsx(C.div,{ref:t,...d,css:{display:c?"inline-flex":"flex",flexDirection:n,alignItems:r,justifyContent:o,flexWrap:a,flexBasis:i,flexGrow:s,flexShrink:l,...e.css}})}),Jt=v.forwardRef(function(e,t){const{columns:n,minChildWidth:r,...o}=e,a=j(),i=r?function(e,t){return M(e,e=>{const n=t.tokens.getVar(`sizes.${e}`,"number"==typeof(r=e)?`${r}px`:r);var r;return null===e?null:`repeat(auto-fit, minmax(${n}, 1fr))`})}(r,a):M(n,e=>null===e?null:`repeat(${e}, minmax(0, 1fr))`);return w.jsx(Pt,{ref:t,templateColumns:i,...o})}),{withContext:$t}=W({key:"textarea"}),en=$t(Yt),tn=Gt({displayName:"CloseIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M6.26915 5.7309C5.98798 5.44973 5.53209 5.44973 5.25092 5.7309C4.96975 6.01207 4.96975 6.46796 5.25092 6.74913L10.5018 12L5.25092 17.2509C4.96975 17.5321 4.96975 17.9879 5.25092 18.2691C5.53209 18.5503 5.98798 18.5503 6.26915 18.2691L11.52 13.0183L16.7709 18.2691C17.0521 18.5503 17.5079 18.5503 17.7891 18.2691C18.0703 17.9879 18.0703 17.5321 17.7891 17.2509L12.5383 12L17.7891 6.74913C18.0703 6.46796 18.0703 6.01207 17.7891 5.7309C17.5079 5.44973 17.0521 5.44973 16.7709 5.7309L11.52 10.9817L6.26915 5.7309Z",fill:"currentColor"})}),nn=Gt({displayName:"CheckCircleIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm4.457 7.457-5.25 5.25a1 1 0 0 1-1.414 0l-2.25-2.25a1 1 0 1 1 1.414-1.414l1.543 1.543 4.543-4.543a1 1 0 0 1 1.414 1.414Z",fill:"currentColor"})}),rn=Gt({displayName:"ExternalLinkIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M14 4a1 1 0 0 1 0-2h7a1 1 0 0 1 1 1v7a1 1 0 1 1-2 0V6.414l-8.293 8.293a1 1 0 0 1-1.414-1.414L18.586 5H14ZM5 7a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-5a1 1 0 1 0-2 0v4H6V9h4a1 1 0 1 0 0-2H5Z",fill:"currentColor"})}),on=Gt({displayName:"ExpandIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",fill:"currentColor"})}),an=Gt({displayName:"ReplyIcon",viewBox:"0 0 15 12",path:w.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.16536 1.81467C7.16536 0.791333 5.9427 0.263999 5.1987 0.965999L1.30003 4.64C1.15132 4.78022 1.03284 4.94936 0.951856 5.13703C0.870874 5.3247 0.829102 5.52694 0.829102 5.73133C0.829102 5.93573 0.870874 6.13797 0.951856 6.32563C1.03284 6.5133 1.15132 6.68244 1.30003 6.82267L5.19736 10.5C5.94136 11.202 7.1647 10.674 7.1647 9.65133V8.33467C7.93731 8.19507 8.73376 8.28024 9.45939 8.58006C10.185 8.87989 10.8093 9.38175 11.258 10.026L11.7927 10.794C12.5207 11.84 14.162 11.3247 14.162 10.0507V9.738C14.162 5.89267 10.9394 2.87667 7.1647 3.05733L7.16536 1.81467ZM5.8847 1.69333C5.90839 1.67111 5.93807 1.6563 5.97007 1.65072C6.00208 1.64514 6.03501 1.64904 6.06483 1.66193C6.09465 1.67482 6.12005 1.69614 6.13791 1.72328C6.15577 1.75042 6.16531 1.78218 6.16536 1.81467V3.54C6.16536 3.87333 6.45736 4.132 6.78803 4.092C10.1767 3.68 13.1627 6.32467 13.1627 9.73867V10.0507C13.1627 10.3453 12.7827 10.4647 12.614 10.2227L12.0787 9.45467C11.4785 8.5928 10.6268 7.93727 9.63996 7.57763C8.65317 7.21799 7.5794 7.17179 6.56536 7.44533C6.45052 7.47639 6.34911 7.54442 6.27681 7.6389C6.2045 7.73337 6.16534 7.84903 6.16536 7.968V9.65067C6.16531 9.68315 6.15577 9.71492 6.13791 9.74205C6.12005 9.76919 6.09465 9.79051 6.06483 9.8034C6.03501 9.81629 6.00208 9.82019 5.97007 9.81461C5.93807 9.80903 5.90839 9.79422 5.8847 9.772L1.9867 6.09533C1.93716 6.04859 1.8977 5.99223 1.87072 5.92969C1.84375 5.86716 1.82984 5.79977 1.82984 5.73167C1.82984 5.66356 1.84375 5.59618 1.87072 5.53364C1.8977 5.4711 1.93716 5.41474 1.9867 5.368L5.8847 1.69333Z",fill:"currentColor"})}),sn=Gt({displayName:"SuggestionIcon",viewBox:"0 0 16 16",path:w.jsx("path",{d:"M4.56503 3.915C5.11896 2.73832 6.04737 1.77849 7.20497 1.18572C8.36257 0.592947 9.68402 0.400681 10.9625 0.63901C12.2411 0.877339 13.4045 1.53281 14.2708 2.50286C15.137 3.4729 15.6573 4.70277 15.75 6C15.8332 7.19515 15.548 8.38706 14.9329 9.41516C14.3178 10.4433 13.4024 11.2581 12.31 11.75C11.9379 12.672 11.3425 13.4871 10.5774 14.122C9.81221 14.7569 8.90126 15.1917 7.92642 15.3873C6.95158 15.5829 5.94341 15.5332 4.99255 15.2426C4.04169 14.952 3.17794 14.4297 2.47896 13.7226C1.77998 13.0155 1.26768 12.1458 0.988107 11.1916C0.708538 10.2375 0.670468 9.2288 0.877321 8.25629C1.08417 7.28377 1.52946 6.37791 2.17316 5.62013C2.81685 4.86235 3.63877 4.27641 4.56503 3.915ZM9.90503 1.5H9.60503C8.52019 1.56681 7.48862 1.99351 6.67357 2.71256C5.85852 3.43161 5.30656 4.40195 5.10503 5.47L10.675 1.565C10.4205 1.52309 10.163 1.50136 9.90503 1.5ZM11.905 1.93L5.33003 6.555L5.06003 6.745C5.11592 7.4665 5.33108 8.16663 5.69003 8.79499L13.565 3.155C13.1023 2.63199 12.5329 2.21427 11.895 1.93H11.905ZM14.145 3.97L6.25003 9.60999C6.70986 10.1331 7.27572 10.5524 7.91003 10.84L14.75 5.82C14.6759 5.16869 14.47 4.53927 14.145 3.97ZM14.75 7.065L9.10503 11.2C9.4681 11.2629 9.83728 11.283 10.205 11.26C11.33 11.1916 12.3968 10.7368 13.225 9.97234C14.0532 9.20793 14.5919 8.1809 14.75 7.065ZM6.75003 14.5C7.59348 14.4958 8.42238 14.2798 9.16061 13.8718C9.89883 13.4638 10.5227 12.8769 10.975 12.165C10.7406 12.2117 10.5035 12.2434 10.265 12.26H9.90003C8.40699 12.257 6.97069 11.6876 5.88117 10.6668C4.79165 9.64592 4.13007 8.24969 4.03003 6.76C4.00121 6.25734 4.03819 5.75307 4.14003 5.26C3.22219 5.83357 2.51524 6.68948 2.12538 7.69915C1.73553 8.70883 1.68382 9.81774 1.97803 10.8593C2.27224 11.9009 2.89648 12.8189 3.75697 13.4754C4.61746 14.1318 5.66774 14.4914 6.75003 14.5Z",fill:"currentColor"})}),ln=Gt({displayName:"AiSearchIcon",viewBox:"0 0 16 16",path:w.jsxs(w.Fragment,{children:[w.jsx("path",{d:"M8 2.66683C5.42267 2.66683 3.33333 4.75617 3.33333 7.3335H2C2 4.01979 4.68629 1.3335 8 1.3335C11.3137 1.3335 14 4.01979 14 7.3335C14 8.75016 13.509 10.0522 12.6879 11.0786L14.8047 13.1954L13.8619 14.1382L11.7451 12.0214C10.7187 12.8425 9.41667 13.3335 8 13.3335V12.0002C10.5773 12.0002 12.6667 9.91083 12.6667 7.3335C12.6667 4.75617 10.5773 2.66683 8 2.66683Z",fill:"currentColor"}),w.jsx("path",{d:"M5.85714 6.6665L2 11.2498H4.57143L4.14286 13.9998L8 9.4165H5.42857L5.85714 6.6665Z",fill:"currentColor"})]})}),cn=Gt({displayName:"SparkleIcon",viewBox:"0 0 16 16",path:w.jsxs(w.Fragment,{children:[w.jsx("path",{d:"M8 1.5l1.15 3.11a2 2 0 0 0 1.18 1.18L13.44 6.93l-3.11 1.15a2 2 0 0 0-1.18 1.18L8 12.37l-1.15-3.11a2 2 0 0 0-1.18-1.18L2.56 6.93l3.11-1.15a2 2 0 0 0 1.18-1.18L8 1.5Z",fill:"currentColor"}),w.jsx("path",{d:"M12.75 10.5l.42 1.13c.08.22.25.39.47.47l1.13.42-1.13.42a.83.83 0 0 0-.47.47l-.42 1.13-.42-1.13a.83.83 0 0 0-.47-.47l-1.13-.42 1.13-.42c.22-.08.39-.25.47-.47l.42-1.13Z",fill:"currentColor",opacity:"0.75"})]})}),dn=Gt({displayName:"SquareBlackIcon",viewBox:"0 0 32 32",path:w.jsxs(w.Fragment,{children:[w.jsx("circle",{cx:"16",cy:"16",r:"16",fill:"currentColor"}),w.jsx("path",{d:"M22 10H10V22H22V10Z",fill:"var(--chakra-colors-button-text, white)"})]})}),un=Gt({displayName:"ArrowUpBlackIcon",viewBox:"0 0 32 32",path:w.jsxs(w.Fragment,{children:[w.jsx("circle",{cx:"16",cy:"16",r:"16",fill:"currentColor"}),w.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5858 11.0002C15.3669 10.2191 16.6332 10.2191 17.4143 11.0002L20.3738 13.9597C20.7643 14.3502 20.7643 14.9834 20.3738 15.3739C19.9833 15.7644 19.3501 15.7644 18.9596 15.3739L17 13.4144V21.0002C17 21.5524 16.5523 22.0002 16 22.0002C15.4478 22.0002 15 21.5524 15 21.0002V13.4144L13.0405 15.3739C12.65 15.7644 12.0168 15.7645 11.6263 15.3739C11.2358 14.9834 11.2358 14.3502 11.6263 13.9597L14.5858 11.0002Z",fill:"var(--chakra-colors-button-text, white)"})]})}),pn=Gt({displayName:"ArrowLeftIcon",viewBox:"0 0 32 32",path:w.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.0002 17.4139C10.2191 16.6329 10.2191 15.3665 11.0002 14.5855L13.9597 11.6259C14.3502 11.2354 14.9834 11.2354 15.3739 11.6259C15.7644 12.0165 15.7644 12.6496 15.3739 13.0401L13.4144 14.9997H21.0002C21.5524 14.9997 22.0002 15.4474 22.0002 15.9997C22.0002 16.552 21.5524 16.9997 21.0002 16.9997H13.4144L15.3739 18.9592C15.7644 19.3498 15.7645 19.9829 15.3739 20.3735C14.9834 20.764 14.3502 20.764 13.9597 20.3735L11.0002 17.4139Z",fill:"currentColor"})}),hn=Gt({displayName:"ReloadIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M19.146 4.854l-1.489 1.489A8 8 0 1 0 12 20a8.094 8.094 0 0 0 7.371-4.886 1 1 0 1 0-1.842-.779A6.071 6.071 0 0 1 12 18a6 6 0 1 1 4.243-10.243l-1.39 1.39a.5.5 0 0 0 .354.854H19.5A.5.5 0 0 0 20 9.5V5.207a.5.5 0 0 0-.854-.353z",fill:"currentColor"})}),fn=Gt({displayName:"CartBagIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M16 7C16 5.4 14.9 4 13.5 4H10.5C9.1 4 8 5.4 8 7H5C4.448 7 4 7.448 4 8V19C4 19.552 4.448 20 5 20H19C19.552 20 20 19.552 20 19V8C20 7.448 19.552 7 19 7H16ZM10.5 6H13.5C13.776 6 14 6.4 14 7H10C10 6.4 10.224 6 10.5 6ZM18 18H6V9H8V10.5C8 11.052 8.448 11.5 9 11.5C9.552 11.5 10 11.052 10 10.5V9H14V10.5C14 11.052 14.448 11.5 15 11.5C15.552 11.5 16 11.052 16 10.5V9H18V18Z",fill:"currentColor"})}),gn=Gt({displayName:"HeartIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 1 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),mn=Gt({displayName:"HeartFilledIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 1 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z",fill:"currentColor",stroke:"currentColor",strokeWidth:"1",strokeLinejoin:"round"})}),bn=Gt({displayName:"ArrowRightIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M12.293 5.293C12.684 4.902 13.316 4.902 13.707 5.293L19.707 11.293C20.098 11.684 20.098 12.316 19.707 12.707L13.707 18.707C13.316 19.098 12.684 19.098 12.293 18.707C11.902 18.316 11.902 17.684 12.293 17.293L16.586 13H5C4.448 13 4 12.552 4 12C4 11.448 4.448 11 5 11H16.586L12.293 6.707C11.902 6.316 11.902 5.684 12.293 5.293Z",fill:"currentColor"})}),xn=Gt({displayName:"AiBigIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M18.423 9.97031L16.7505 10.5726C15.8336 10.903 15.0009 11.4317 14.3118 12.1208C13.6226 12.81 13.094 13.6427 12.7635 14.5596L12.1613 16.2321C12.1492 16.2651 12.1272 16.2936 12.0984 16.3137C12.0695 16.3339 12.0352 16.3447 12 16.3447C11.9649 16.3447 11.9305 16.3339 11.9017 16.3137C11.8728 16.2936 11.8509 16.2651 11.8388 16.2321L11.2365 14.5596C10.9061 13.6427 10.3774 12.81 9.68826 12.1208C8.99911 11.4317 8.16641 10.903 7.24953 10.5726L5.57703 9.97031C5.544 9.9582 5.51549 9.93624 5.49535 9.9074C5.47521 9.87856 5.46441 9.84423 5.46441 9.80906C5.46441 9.77388 5.47521 9.73955 5.49535 9.71071C5.51549 9.68188 5.544 9.65992 5.57703 9.64781L7.24953 9.04556C8.16641 8.7151 8.99911 8.18645 9.68826 7.49729C10.3774 6.80814 10.9061 5.97544 11.2365 5.05856L11.8388 3.38606C11.8509 3.35303 11.8728 3.32452 11.9017 3.30438C11.9305 3.28424 11.9649 3.27344 12 3.27344C12.0352 3.27344 12.0695 3.28424 12.0984 3.30438C12.1272 3.32452 12.1492 3.35303 12.1613 3.38606L12.7635 5.05856C13.094 5.97544 13.6226 6.80814 14.3118 7.49729C15.0009 8.18645 15.8336 8.7151 16.7505 9.04556L18.423 9.64781C18.4564 9.65958 18.4853 9.68141 18.5057 9.71029C18.5261 9.73917 18.5371 9.77368 18.5371 9.80906C18.5371 9.84443 18.5261 9.87894 18.5057 9.90782C18.4853 9.9367 18.4564 9.95853 18.423 9.97031ZM22.4423 17.4988L21.5955 17.8041C21.1313 17.9715 20.7097 18.2393 20.3607 18.5883C20.0118 18.9372 19.744 19.3588 19.5765 19.8231L19.2713 20.6698C19.2652 20.6866 19.254 20.7011 19.2394 20.7113C19.2248 20.7216 19.2074 20.727 19.1895 20.727C19.1717 20.727 19.1543 20.7216 19.1396 20.7113C19.125 20.7011 19.1139 20.6866 19.1078 20.6698L18.8025 19.8231C18.635 19.3588 18.3673 18.9372 18.0183 18.5883C17.6694 18.2393 17.2478 17.9715 16.7835 17.8041L15.9368 17.4988C15.92 17.4927 15.9055 17.4816 15.8953 17.467C15.885 17.4523 15.8795 17.4349 15.8795 17.4171C15.8795 17.3992 15.885 17.3818 15.8953 17.3672C15.9055 17.3525 15.92 17.3414 15.9368 17.3353L16.7835 17.0301C17.2478 16.8626 17.6694 16.5948 18.0183 16.2459C18.3673 15.8969 18.635 15.4753 18.8025 15.0111L19.1078 14.1643C19.1139 14.1475 19.125 14.133 19.1396 14.1228C19.1543 14.1126 19.1717 14.1071 19.1895 14.1071C19.2074 14.1071 19.2248 14.1126 19.2394 14.1228C19.254 14.133 19.2652 14.1475 19.2713 14.1643L19.5765 15.0111C19.744 15.4753 20.0118 15.8969 20.3607 16.2459C20.7097 16.5948 21.1313 16.8626 21.5955 17.0301L22.4423 17.3353C22.4591 17.3414 22.4735 17.3525 22.4838 17.3672C22.494 17.3818 22.4995 17.3992 22.4995 17.4171C22.4995 17.4349 22.494 17.4523 22.4838 17.467C22.4735 17.4816 22.4591 17.4927 22.4423 17.4988ZM8.06253 17.4988L7.21578 17.8041C6.75155 17.9715 6.32995 18.2393 5.98098 18.5883C5.63201 18.9372 5.36426 19.3588 5.19678 19.8231L4.89153 20.6698C4.88542 20.6866 4.8743 20.7011 4.85967 20.7113C4.84505 20.7216 4.82763 20.727 4.80978 20.727C4.79192 20.727 4.7745 20.7216 4.75988 20.7113C4.74525 20.7011 4.73413 20.6866 4.72803 20.6698L4.42278 19.8231C4.2553 19.3588 3.98754 18.9372 3.63858 18.5883C3.28961 18.2393 2.86801 17.9715 2.40378 17.8041L1.55703 17.4988C1.54025 17.4927 1.52576 17.4816 1.51552 17.467C1.50528 17.4523 1.49979 17.4349 1.49979 17.4171C1.49979 17.3992 1.50528 17.3818 1.51552 17.3672C1.52576 17.3525 1.54025 17.3414 1.55703 17.3353L2.40378 17.0301C2.86801 16.8626 3.28961 16.5948 3.63858 16.2459C3.98754 15.8969 4.2553 15.4753 4.42278 15.0111L4.72803 14.1643C4.73413 14.1475 4.74525 14.133 4.75988 14.1228C4.7745 14.1126 4.79192 14.1071 4.80978 14.1071C4.82763 14.1071 4.84505 14.1126 4.85967 14.1228C4.8743 14.133 4.88542 14.1475 4.89153 14.1643L5.19678 15.0111C5.36426 15.4753 5.63201 15.8969 5.98098 16.2459C6.32995 16.5948 6.75155 16.8626 7.21578 17.0301L8.06253 17.3353C8.13903 17.3631 8.13903 17.4718 8.06253 17.4988Z",fill:"currentColor"})});Gt({displayName:"AiRainbowIconBase",viewBox:"0 0 24 24",path:w.jsxs(w.Fragment,{children:[w.jsx("g",{clipPath:"url(#clip0_497_8063)",children:w.jsx("path",{d:"M18.2468 14.5235L16.5735 13.9236C15.656 13.5949 14.6772 13.4727 13.7071 13.5656C12.7369 13.6585 11.7991 13.9643 10.9607 14.4612L9.43171 15.3679C9.40135 15.3857 9.36627 15.3937 9.3312 15.3909C9.29614 15.3881 9.26279 15.3746 9.23566 15.3522C9.20853 15.3298 9.18892 15.2996 9.1795 15.2657C9.17007 15.2318 9.17128 15.1959 9.18296 15.1627L9.78291 13.4893C10.1116 12.5718 10.2338 11.5931 10.1409 10.6229C10.0479 9.65274 9.74213 8.71502 9.24525 7.87657L8.33853 6.34758C8.32077 6.31722 8.31275 6.28213 8.31557 6.24707C8.31839 6.21201 8.33191 6.17866 8.3543 6.15152C8.37668 6.12439 8.40686 6.10479 8.44075 6.09537C8.47464 6.08594 8.51061 6.08715 8.54379 6.09883L10.2171 6.69878C11.1346 7.02745 12.1134 7.14967 13.0835 7.05674C14.0537 6.9638 14.9914 6.65799 15.8299 6.16111L17.3589 5.2544C17.3893 5.23664 17.4243 5.22862 17.4594 5.23144C17.4945 5.23426 17.5278 5.24778 17.5549 5.27016C17.5821 5.29255 17.6017 5.32273 17.6111 5.35662C17.6205 5.39051 17.6193 5.42648 17.6076 5.45966L17.0077 7.13298C16.679 8.05051 16.5568 9.02924 16.6497 9.99941C16.7427 10.9696 17.0485 11.9073 17.5454 12.7458L18.4521 14.2748C18.4703 14.3051 18.4787 14.3403 18.4761 14.3756C18.4734 14.4109 18.4599 14.4445 18.4374 14.4717C18.4149 14.499 18.3845 14.5187 18.3503 14.5279C18.3162 14.5372 18.28 14.5357 18.2468 14.5235ZM16.5553 22.8884L15.7079 22.5849C15.2433 22.4186 14.7477 22.3568 14.2564 22.4039C13.7652 22.451 13.2903 22.6057 12.8657 22.8572L12.0913 23.316C12.0759 23.3251 12.0581 23.3292 12.0403 23.3278C12.0225 23.3264 12.0056 23.3195 11.9918 23.3081C11.978 23.2968 11.9681 23.2815 11.9633 23.2643C11.9586 23.2471 11.9592 23.2288 11.9652 23.212L12.2687 22.3646C12.4349 21.8999 12.4968 21.4043 12.4497 20.9131C12.4026 20.4218 12.2479 19.9469 11.9964 19.5223L11.5376 18.7479C11.5285 18.7325 11.5244 18.7147 11.5258 18.697C11.5272 18.6792 11.5341 18.6622 11.5454 18.6485C11.5568 18.6347 11.5721 18.6247 11.5893 18.62C11.6065 18.6152 11.6248 18.6159 11.6416 18.6218L12.489 18.9253C12.9537 19.0916 13.4493 19.1534 13.9405 19.1063C14.4318 19.0593 14.9067 18.9045 15.3313 18.653L16.1057 18.1942C16.1211 18.1851 16.1388 18.1811 16.1566 18.1825C16.1744 18.1839 16.1914 18.1907 16.2051 18.2021C16.2189 18.2134 16.2289 18.2288 16.2336 18.246C16.2384 18.2632 16.2377 18.2814 16.2318 18.2983L15.9283 19.1456C15.762 19.6103 15.7002 20.1059 15.7473 20.5972C15.7943 21.0884 15.9491 21.5633 16.2006 21.9879L16.6594 22.7623C16.6684 22.7777 16.6725 22.7955 16.6711 22.8133C16.6697 22.8311 16.6629 22.848 16.6515 22.8618C16.6402 22.8756 16.6248 22.8855 16.6076 22.8903C16.5904 22.895 16.5722 22.8944 16.5553 22.8884ZM5.46406 13.7363L4.61667 13.4328C4.15202 13.2666 3.65642 13.2047 3.16515 13.2518C2.67388 13.2989 2.19903 13.4536 1.77439 13.7051L1.00002 14.1639C0.984637 14.173 0.966838 14.1771 0.949042 14.1757C0.931245 14.1743 0.914312 14.1674 0.900542 14.1561C0.886772 14.1447 0.876831 14.1294 0.872069 14.1122C0.867305 14.095 0.86795 14.0767 0.873916 14.0599L1.17739 13.2125C1.34367 12.7478 1.40549 12.2522 1.35843 11.761C1.31137 11.2697 1.15659 10.7948 0.90512 10.3702L0.44629 9.59584C0.437238 9.58045 0.43314 9.56265 0.43455 9.54486C0.435961 9.52706 0.442813 9.51013 0.454176 9.49636C0.465538 9.48259 0.48086 9.47265 0.498065 9.46789C0.51527 9.46312 0.533525 9.46377 0.55035 9.46973L1.39774 9.77321C1.8624 9.93949 2.358 10.0013 2.84926 9.95424C3.34053 9.90718 3.81538 9.75241 4.24002 9.50094L5.01439 9.04211C5.02978 9.03306 5.04757 9.02896 5.06537 9.03037C5.08317 9.03178 5.1001 9.03863 5.11387 9.04999C5.12764 9.06135 5.13758 9.07668 5.14234 9.09388C5.14711 9.11109 5.14646 9.12934 5.1405 9.14617L4.83702 9.99356C4.67074 10.4582 4.60893 10.9538 4.65599 11.4451C4.70305 11.9363 4.85782 12.4112 5.10929 12.8358L5.56812 13.6102C5.60947 13.6803 5.54025 13.7642 5.46406 13.7363Z",fill:"url(#paint0_linear_497_8063)"})}),w.jsxs("defs",{children:[w.jsxs("linearGradient",{id:"paint0_linear_497_8063",x1:"19.4467",y1:"10.3723",x2:"4.37004",y2:"16.438",gradientUnits:"userSpaceOnUse",children:[w.jsx("stop",{stopColor:"#FF7E90"}),w.jsx("stop",{offset:"0.463542",stopColor:"#A939FF"}),w.jsx("stop",{offset:"1",stopColor:"#0020FF"})]}),w.jsx("clipPath",{id:"clip0_497_8063",children:w.jsx("rect",{width:"24",height:"24",fill:"white"})})]})]})});const yn=e=>{const t=Bt("colors","primary"),[n,r,o]=B(t),a=F.useMemo(()=>`rainbow-gradient-${Math.random().toString(36).substr(2,9)}`,[]),{w:i,width:s,transform:l}=e,c="string"==typeof i?i:"string"==typeof s?s:"number"==typeof i?`${i}px`:"number"==typeof s?`${s}px`:"24px";return w.jsx(D,{position:"relative",display:"inline-block",width:c,height:c,transform:l,children:w.jsxs("svg",{viewBox:"0 0 24 24",width:c,height:c,style:{display:"block"},children:[w.jsxs("defs",{children:[w.jsxs("linearGradient",{id:a,x1:"19.4467",y1:"10.3723",x2:"4.37004",y2:"16.438",gradientUnits:"userSpaceOnUse",children:[w.jsx("stop",{stopColor:n}),w.jsx("stop",{offset:"0.463542",stopColor:r}),w.jsx("stop",{offset:"1",stopColor:o})]}),w.jsx("clipPath",{id:`clip-${a}`,children:w.jsx("rect",{width:"24",height:"24",fill:"white"})})]}),w.jsx("g",{clipPath:`url(#clip-${a})`,children:w.jsx("path",{d:"M18.2468 14.5235L16.5735 13.9236C15.656 13.5949 14.6772 13.4727 13.7071 13.5656C12.7369 13.6585 11.7991 13.9643 10.9607 14.4612L9.43171 15.3679C9.40135 15.3857 9.36627 15.3937 9.3312 15.3909C9.29614 15.3881 9.26279 15.3746 9.23566 15.3522C9.20853 15.3298 9.18892 15.2996 9.1795 15.2657C9.17007 15.2318 9.17128 15.1959 9.18296 15.1627L9.78291 13.4893C10.1116 12.5718 10.2338 11.5931 10.1409 10.6229C10.0479 9.65274 9.74213 8.71502 9.24525 7.87657L8.33853 6.34758C8.32077 6.31722 8.31275 6.28213 8.31557 6.24707C8.31839 6.21201 8.33191 6.17866 8.3543 6.15152C8.37668 6.12439 8.40686 6.10479 8.44075 6.09537C8.47464 6.08594 8.51061 6.08715 8.54379 6.09883L10.2171 6.69878C11.1346 7.02745 12.1134 7.14967 13.0835 7.05674C14.0537 6.9638 14.9914 6.65799 15.8299 6.16111L17.3589 5.2544C17.3893 5.23664 17.4243 5.22862 17.4594 5.23144C17.4945 5.23426 17.5278 5.24778 17.5549 5.27016C17.5821 5.29255 17.6017 5.32273 17.6111 5.35662C17.6205 5.39051 17.6193 5.42648 17.6076 5.45966L17.0077 7.13298C16.679 8.05051 16.5568 9.02924 16.6497 9.99941C16.7427 10.9696 17.0485 11.9073 17.5454 12.7458L18.4521 14.2748C18.4703 14.3051 18.4787 14.3403 18.4761 14.3756C18.4734 14.4109 18.4599 14.4445 18.4374 14.4717C18.4149 14.499 18.3845 14.5187 18.3503 14.5279C18.3162 14.5372 18.28 14.5357 18.2468 14.5235ZM16.5553 22.8884L15.7079 22.5849C15.2433 22.4186 14.7477 22.3568 14.2564 22.4039C13.7652 22.451 13.2903 22.6057 12.8657 22.8572L12.0913 23.316C12.0759 23.3251 12.0581 23.3292 12.0403 23.3278C12.0225 23.3264 12.0056 23.3195 11.9918 23.3081C11.978 23.2968 11.9681 23.2815 11.9633 23.2643C11.9586 23.2471 11.9592 23.2288 11.9652 23.212L12.2687 22.3646C12.4349 21.8999 12.4968 21.4043 12.4497 20.9131C12.4026 20.4218 12.2479 19.9469 11.9964 19.5223L11.5376 18.7479C11.5285 18.7325 11.5244 18.7147 11.5258 18.697C11.5272 18.6792 11.5341 18.6622 11.5454 18.6485C11.5568 18.6347 11.5721 18.6247 11.5893 18.62C11.6065 18.6152 11.6248 18.6159 11.6416 18.6218L12.489 18.9253C12.9537 19.0916 13.4493 19.1534 13.9405 19.1063C14.4318 19.0593 14.9067 18.9045 15.3313 18.653L16.1057 18.1942C16.1211 18.1851 16.1388 18.1811 16.1566 18.1825C16.1744 18.1839 16.1914 18.1907 16.2051 18.2021C16.2189 18.2134 16.2289 18.2288 16.2336 18.246C16.2384 18.2632 16.2377 18.2814 16.2318 18.2983L15.9283 19.1456C15.762 19.6103 15.7002 20.1059 15.7473 20.5972C15.7943 21.0884 15.9491 21.5633 16.2006 21.9879L16.6594 22.7623C16.6684 22.7777 16.6725 22.7955 16.6711 22.8133C16.6697 22.8311 16.6629 22.848 16.6515 22.8618C16.6402 22.8756 16.6248 22.8855 16.6076 22.8903C16.5904 22.895 16.5722 22.8944 16.5553 22.8884ZM5.46406 13.7363L4.61667 13.4328C4.15202 13.2666 3.65642 13.2047 3.16515 13.2518C2.67388 13.2989 2.19903 13.4536 1.77439 13.7051L1.00002 14.1639C0.984637 14.173 0.966838 14.1771 0.949042 14.1757C0.931245 14.1743 0.914312 14.1674 0.900542 14.1561C0.886772 14.1447 0.876831 14.1294 0.872069 14.1122C0.867305 14.095 0.86795 14.0767 0.873916 14.0599L1.17739 13.2125C1.34367 12.7478 1.40549 12.2522 1.35843 11.761C1.31137 11.2697 1.15659 10.7948 0.90512 10.3702L0.44629 9.59584C0.437238 9.58045 0.43314 9.56265 0.43455 9.54486C0.435961 9.52706 0.442813 9.51013 0.454176 9.49636C0.465538 9.48259 0.48086 9.47265 0.498065 9.46789C0.51527 9.46312 0.533525 9.46377 0.55035 9.46973L1.39774 9.77321C1.8624 9.93949 2.358 10.0013 2.84926 9.95424C3.34053 9.90718 3.81538 9.75241 4.24002 9.50094L5.01439 9.04211C5.02978 9.03306 5.04757 9.02896 5.06537 9.03037C5.08317 9.03178 5.1001 9.03863 5.11387 9.04999C5.12764 9.06135 5.13758 9.07668 5.14234 9.09388C5.14711 9.11109 5.14646 9.12934 5.1405 9.14617L4.83702 9.99356C4.67074 10.4582 4.60893 10.9538 4.65599 11.4451C4.70305 11.9363 4.85782 12.4112 5.10929 12.8358L5.56812 13.6102C5.60947 13.6803 5.54025 13.7642 5.46406 13.7363Z",fill:`url(#${a})`})})]})})},vn=""+new URL("dori.ico",import.meta.url).href,wn=({onClose:e,isMobile:t=!1,isExpanded:n=!1,onToggleExpand:r,fullPageHref:o,onReload:a})=>{const{botData:i,cartItemCount:s,shortlistEnabled:l,shortlist:c,setShortlistOpen:d}=H(),u=P(),{t:p}=q(),h=O(i)&&s>0,f=l&&c.length>0,[g,m]=v.useState(!1),b=v.useRef(c.length);return v.useEffect(()=>{if(c.length===b.current)return;b.current=c.length,m(!0);const e=setTimeout(()=>m(!1),250);return()=>clearTimeout(e)},[c.length]),w.jsxs(Xt,{justify:"space-between",align:"center",flexShrink:0,children:[i?.feature_flags?.hide_header_logo?w.jsx(D,{h:u.length(40)}):w.jsx(N,{src:i?.bot_image?i?.bot_image:vn,alt:"",role:"presentation",w:u.length(40),h:u.length(40),borderRadius:"50%"}),w.jsxs(Y,{gap:u.space(3),children:[f&&w.jsxs(I,{variant:"outline",size:"sm",borderRadius:u.radius(4),px:u.space(2),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${u.length(5)} ${u.length(9)}`,transform:g?"scale(1.12)":"scale(1)",transition:"transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1)",onClick:()=>d(!0),"aria-label":p("savedProducts"),fontFamily:V,children:[w.jsx(mn,{boxSize:u.length(15),color:"primary"}),w.jsx(Z,{fontSize:u.font(13),fontWeight:"500",color:"text",children:c.length})]}),h&&w.jsxs(I,{variant:"outline",size:"sm",borderRadius:u.radius(4),px:u.space(2),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${u.length(5)} ${u.length(9)}`,onClick:()=>{if(!U()){const e=`${Q()}cart`;window.open(e,"_blank","noopener,noreferrer")||(window.location.href=e)}},fontFamily:V,children:[w.jsx(fn,{boxSize:u.length(16),color:"text"}),w.jsx(Z,{fontSize:u.font(13),fontWeight:"500",color:"text",children:s})]}),o?w.jsx(I,{asChild:!0,variant:"outline",size:"sm",borderRadius:u.radius(4),px:u.space(3),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${u.length(5)} ${u.length(9)}`,fontFamily:V,children:w.jsxs("a",{href:o,children:[w.jsx(on,{boxSize:u.length(16),color:"text"}),p("aiPageOpenFull")]})}):!t&&r&&w.jsxs(I,{variant:"outline",size:"sm",borderRadius:u.radius(4),px:u.space(3),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${u.length(5)} ${u.length(9)}`,onClick:()=>r?.(),fontFamily:V,children:[w.jsx(on,{boxSize:u.length(16),color:"text"}),p(n?"minimize":"showFullScreen")]}),a&&w.jsx(Ut,{size:"sm",boxSize:u.length(36),minW:u.length(36),variant:"ghost","aria-label":p("reload"),onClick:a,color:"text",_hover:{bgColor:"mutedText"},children:w.jsx(hn,{boxSize:t?u.length(16):u.length(24),color:"text"})}),w.jsx(Ut,{size:"sm",boxSize:u.length(36),minW:u.length(36),variant:"ghost","aria-label":p("close"),onClick:()=>{n&&r?.(),e()},color:"text",_hover:{bgColor:"mutedText"},children:w.jsx(tn,{boxSize:t?u.length(16):u.length(24),color:"text"})})]})]})};class Cn{static async getUploadCredentials(e){const t={file_extension:e,expires_in:3600,content_length_range:{min_bytes:1024,max_bytes:10485760}},n=await fetch(K.getUploadUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({data:t})});if(!n.ok)throw new Error(`Failed to get upload credentials: ${n.status} ${n.statusText}`);return await n.json()}static async compressImage(e,t=1024,n=.8){return new Promise(r=>{const o=document.createElement("canvas"),a=o.getContext("2d"),i=new Image;i.onload=()=>{const{width:s,height:l}=this.calculateDimensions(i.width,i.height,t);o.width=s,o.height=l,a.drawImage(i,0,0,s,l),o.toBlob(t=>{const a=new File([t],e.name,{type:"image/jpeg",lastModified:Date.now()});r({file:a,preview:o.toDataURL("image/jpeg",n),format:"jpeg"})},"image/jpeg",n)},i.src=URL.createObjectURL(e)})}static getFileExtension(e){const t=e.name.split(".").pop()?.toLowerCase();switch(t){case"jpg":case"jpeg":default:return"jpeg";case"webp":return"webp";case"png":return"png";case"heic":return"heic"}}static calculateDimensions(e,t,n){if(e<=n)return{width:e,height:t};const r=t/e;return{width:n,height:Math.round(n*r)}}static async uploadImage(e,t){const n=new FormData;Object.entries(e.fields).forEach(([e,t])=>{n.append(e,t)}),n.append("file",t);const r=await fetch(e.url,{method:"POST",body:n});if(!r.ok&&204!==r.status)throw new Error("Error uploading image");return e.public_url}}const kn=()=>{const[e,t]=v.useState(null),[n,r]=v.useState(!1);return{uploadedImage:e,isUploading:n,handleFileSelect:()=>{const e=document.createElement("input");e.type="file",e.accept="image/jpeg,image/jpg,image/webp,image/png,image/heic",e.onchange=e=>{const n=e.target.files?.[0];n&&(async e=>{try{r(!0);const n=await Cn.compressImage(e),o=await Cn.getUploadCredentials(n.format),a=await Cn.uploadImage(o,n.file);t({url:a,preview:n.preview,name:e.name,size:n.file.size})}catch(n){console.error("Upload failed:",n),alert("Failed to upload image")}finally{r(!1)}})(n)},e.click()},removeImage:()=>{e?.preview&&URL.revokeObjectURL(e.preview),t(null)}}},jn=({imageUrl:e,onRemove:t})=>{const n=P();return w.jsxs("div",{style:{position:"relative",display:"inline-block",background:"transparent"},children:[w.jsx(N,{src:e,alt:"Uploaded image",w:n.length(80),h:n.length(80),borderRadius:n.radius(12),objectFit:"cover",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.11)"}),w.jsx(Ut,{position:"absolute",top:n.length(6),right:n.length(6),bg:"primary",color:"buttonText","aria-label":"Remove image",onClick:t,size:"sm",borderRadius:"50%",minW:n.length(24),h:n.length(24),children:w.jsx(tn,{boxSize:n.length(14)})})]})},Sn=()=>{const[e,t]=v.useState(!1);return v.useEffect(()=>{const e=e=>{"Tab"===e.key&&t(!0)},n=()=>t(!1);return window.addEventListener("keydown",e,!0),window.addEventListener("pointerdown",n,!0),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("pointerdown",n,!0)}},[]),e},zn=e=>e?{"&:has(textarea:focus, input:focus)":{boxShadow:"inset 0 0 0 2px var(--chakra-colors-text)"}}:void 0,An=({placeholder:e="Write a prompt or paste a contract address",value:t="",onChange:n,onSend:r,isMobileView:o})=>{const{t:a}=q(),i=Sn(),{botData:s,chatState:{repliedProduct:l},setRepliedProduct:c}=H(),d=!s?.feature_flags?.hide_image_upload,u=P(),[p,h]=v.useState(t),{uploadedImage:f,isUploading:g,handleFileSelect:m,removeImage:b}=kn();v.useEffect(()=>{h(y(t))},[t]);const x=e=>{(p.trim()||e||f)&&(r?.({message:e??p.trim(),imageUrl:f?.url},l?.product),c?.(null),h(""),b())},y=e=>e.trimStart();return w.jsxs(G,{gap:u.space(2),align:"stretch",bg:"transparent",position:"relative",children:[f&&w.jsx(D,{position:"absolute",bottom:l?o?u.length(300):u.length(190):u.length(90),left:u.length(12),zIndex:1e6,bg:"transparent",pointerEvents:"auto",children:w.jsx(jn,{imageUrl:f.preview,onRemove:b})}),w.jsx(D,{bgColor:"lightBackground",borderRadius:u.radius(24),css:zn(i),position:"relative",p:u.space(2),w:"full",h:l?o?u.length(300):u.length(190):u.length(90),transition:"all 0.6s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",transform:"scale(1)",opacity:1,children:w.jsxs(D,{position:"absolute",top:0,left:0,right:0,bottom:0,p:u.space(2),opacity:1,transform:"translateY(0) scale(1)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:"auto",children:[l&&w.jsxs(G,{opacity:1,p:u.length(8),gap:u.length(8),borderRadius:u.radius(12),borderWidth:"1px",borderColor:"borderColor",bgColor:"lightBackground",children:[w.jsxs(Y,{justify:"space-between",align:"center",w:"full",children:[w.jsx(N,{src:l?.product?.image,alt:"product",w:u.length(40),h:u.length(40)}),w.jsx(Z,{fontSize:u.font(12),fontWeight:400,color:"text",children:l?.product?.name}),w.jsx(Ut,{bg:"transparent","aria-label":"Remove product",onClick:()=>c?.(null),children:w.jsx(tn,{boxSize:u.length(24),color:"text"})})]}),l?.suggestions&&l.suggestions.length>0&&w.jsxs(w.Fragment,{children:[w.jsx(D,{display:{base:"none",md:"block"},w:"full",children:w.jsx(Y,{w:"full",justify:"flex-start",align:"center",gap:u.space(2),children:l.suggestions.map(e=>w.jsx(I,{variant:"outline",bg:"transparent",color:"text",fontSize:u.font(12),borderColor:"borderColor",borderRadius:u.radius(24),fontWeight:400,onClick:()=>x(e),h:u.length(32),px:u.space(3),minW:"unset",flex:1,lineHeight:"1.5",overflow:"hidden",children:w.jsx(D,{as:"span",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block",w:"100%",children:e})},e))})}),w.jsx(D,{display:{base:"block",md:"none"},w:"full",children:w.jsx(G,{w:"full",align:"stretch",gap:u.length(8),children:l.suggestions.map(e=>w.jsx(I,{variant:"outline",bg:"transparent",w:"full",color:"text",fontSize:u.font(14),borderColor:"borderColor",borderRadius:u.radius(24),fontWeight:400,onClick:()=>x(e),children:e},e))})})]})]}),w.jsx(en,{"aria-label":a("messageInputLabel"),value:p,onChange:e=>(e=>{const t=y(e);h(t),n?.(t)})(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.repeat||(e.preventDefault(),x())},placeholder:e,fontSize:X(u,16),color:"text",fontWeight:300,resize:"none",rows:1,lineHeight:"1.5",h:"100%",border:"none",bg:"transparent",_focus:{boxShadow:"none",border:"none",outline:"none"},_placeholder:{color:"mutedText"},pr:u.length(48),transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)"}),d&&w.jsx(Ut,{position:"absolute",bottom:u.length(8),left:u.length(12),size:"xs",boxSize:u.length(32),minW:u.length(32),borderRadius:"full",bg:"background","aria-label":"Upload image",onClick:m,_hover:{bg:"background"},disabled:g,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",transform:"scale(1)",zIndex:2,border:"1px solid",borderColor:"borderColor",color:"text",children:g?w.jsx(J,{size:"sm",color:"text"}):w.jsx($,{color:"text"})}),w.jsx(Ut,{position:"absolute",bottom:u.length(12),right:u.length(12),size:"xs",boxSize:u.length(32),minW:u.length(32),borderRadius:"full",bg:"background",color:"text","aria-label":"Send",onClick:()=>x(),_hover:{bg:"veryLightBackground"},disabled:!p.trim()&&!f,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",_disabled:{bg:"background",cursor:"not-allowed",opacity:.7},transform:"scale(1)",zIndex:2,children:w.jsx(un,{boxSize:u.length(30),color:"primary"})})]})})]})},En=({placeholder:e="Write a prompt or paste a contract address",onStop:t})=>{const n=P(),{stopCurrentRequest:r}=H();return w.jsx(G,{gap:n.space(2),align:"stretch",bg:"transparent",position:"relative",children:w.jsx(D,{bg:"lightBackground",borderRadius:n.radius(32),position:"relative",p:n.space(3),w:"full",h:n.length(48),transition:"all 0.6s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",transform:"scale(1)",opacity:1,children:w.jsx(D,{position:"absolute",top:0,left:0,right:0,bottom:0,p:n.space(3),opacity:1,transform:"translateY(0) scale(1)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:"auto",children:w.jsxs(Y,{justify:"space-between",align:"center",h:"full",children:[w.jsx(Z,{color:"mutedText",fontSize:n.font(16),flex:1,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",children:e}),w.jsx(Ut,{size:"xs",boxSize:n.length(32),minW:n.length(32),borderRadius:"full",bg:"background",color:"text","aria-label":"Stop",onClick:()=>{r?.(),t?.()},_hover:{bg:"veryLightBackground"},transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",transform:"scale(1)",zIndex:2,children:w.jsx(dn,{boxSize:n.length(30),color:"primary"})})]})})})})},Rn=({placeholder:e="Write a prompt or paste a contract address",value:t="",onChange:n,onSend:r})=>{const{t:o}=q(),a=Sn(),i=P(),{botData:s}=H(),l=!s?.feature_flags?.hide_image_upload,[c,d]=v.useState(t),[u,p]=v.useState(!1),{uploadedImage:h,isUploading:f,handleFileSelect:g,removeImage:m}=kn(),b=v.useRef(null);v.useEffect(()=>{d(C(t))},[t]);const x=()=>{(c.trim()||h)&&(r?.({message:c.trim(),imageUrl:h?.url}),d(""),m())},y=e=>` ${e}`,C=e=>e.trimStart();return w.jsxs(G,{gap:i.space(2),align:"stretch",children:[h&&w.jsx(D,{mb:i.space(2),alignSelf:"flex-start",bg:"transparent",children:w.jsx(jn,{imageUrl:h.preview,onRemove:m})}),w.jsxs(D,{bg:"lightBackground",borderRadius:i.radius(24),css:zn(a),position:"relative",p:i.space(2),w:"full",h:u?i.length(80):i.length(48),transition:"all 0.6s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",cursor:"pointer",onClick:()=>{p(!0),setTimeout(()=>{if(b.current){b.current.focus();const e=b.current.value.length;b.current.setSelectionRange(e,e)}},100)},children:[w.jsx(D,{position:"absolute",top:i.length(8),left:i.length(8),zIndex:2,children:w.jsx(yn,{w:i.length(24),h:i.length(24),transform:"rotate(2700deg)",color:"primary"})}),w.jsx(D,{position:"absolute",top:0,left:0,right:0,bottom:0,p:i.space(2),opacity:u?0:1,transform:u?"translateY(-20px) scale(0.95)":"translateY(0) scale(1)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:u?"none":"auto",children:w.jsx(Y,{justify:"space-between",align:"center",h:"full",children:w.jsx(Z,{color:"#999999",fontSize:i.font(16),flex:1,paddingStart:i.length(32),transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",children:e})})}),l&&w.jsx(Ut,{position:"absolute",bottom:i.length(7.5),right:i.length(52),size:"xs",boxSize:i.length(32),minW:i.length(32),borderRadius:"full",bg:"background",color:"text","aria-label":"Upload image",onClick:e=>{e.stopPropagation(),g()},_hover:{bg:"veryLightBackground"},disabled:f,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",transform:"scale(1)",zIndex:2,border:"1px solid",borderColor:"borderColor",children:f?w.jsx(J,{size:"sm"}):w.jsx($,{size:i.length(24)})}),w.jsx(Ut,{position:"absolute",bottom:i.length(8),right:i.length(12),size:"xs",boxSize:i.length(32),minW:i.length(32),borderRadius:"full",bg:"primary","aria-label":"Send",onClick:e=>{e.stopPropagation(),x()},_hover:{bg:"darkPrimary"},disabled:!c.trim()&&!h,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",_disabled:{bg:"primary",opacity:.5,cursor:"not-allowed"},transform:"scale(1) rotate(180deg)",zIndex:2,children:w.jsx(pn,{boxSize:i.length(30),color:"buttonText"})}),w.jsx(D,{position:"absolute",top:0,left:0,right:0,bottom:0,p:i.space(2),opacity:u?1:0,transform:u?"translateY(0) scale(1)":"translateY(20px) scale(0.95)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:u?"auto":"none",children:w.jsx(en,{"aria-label":o("messageInputLabel"),ref:b,value:y(c),onChange:e=>(e=>{const t=C(e);d(t),n?.(t)})(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.repeat||(e.preventDefault(),x())},placeholder:y(e),fontSize:X(i,16),color:"text",fontWeight:300,resize:"none",h:"100%",border:"none",bg:"transparent",cursor:"text",_focus:{boxShadow:"none",border:"none",outline:"none"},_placeholder:{color:"mutedText"},transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",rows:2,lineHeight:"1.5"})})]})]})},Tn=({state:e="starting",placeholder:t="Write a prompt or paste a contract address",value:n="",onChange:r,onSend:o,onStop:a})=>{const[i,s]=v.useState(!1);return v.useEffect(()=>{const e=()=>{s(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),"starting"===e?w.jsx(An,{placeholder:t,value:n,onChange:r,onSend:o,isMobileView:i}):"generating"===e?w.jsx(En,{placeholder:t,onStop:a,isMobileView:i}):w.jsx(Rn,{placeholder:t,value:n,onChange:r,onSend:o})},_n=e=>{const t=e.includes("?")?"&":"?";return`${e}${t}utm_source=dori&utm_medium=dori_widget&utm_campaign=dori_product_recommendation`},Wn=(e,t)=>{const n=e.includes("?")?"&":"?";return`${e}${n}utm_source=customer_referral&utm_medium=widget&utm_campaign=powered_by&utm_term=${t}`};function In(e){return!e?.white_label?.ai_notice_only&&!1!==e?.customization?.enable_shopper_memory}const Ln="/policies/privacy-policy",Mn=()=>{const{t:e}=q(),t=P(),[n,r]=v.useState(!1);return w.jsxs(D,{position:"relative",display:"inline-flex",alignItems:"center",children:[w.jsxs(D,{as:"span",display:"inline-flex",alignItems:"center",gap:t.space(1),tabIndex:0,cursor:"default",px:t.space(2),py:"1px",borderRadius:"9999px",bgGradient:"to-r",gradientFrom:"primaryWash",gradientTo:"primaryWashStrong",color:"darkPrimary",border:"1px solid",borderColor:"primaryWash",lineHeight:"1.25",transition:"background 120ms ease, box-shadow 120ms ease",_hover:{boxShadow:"0 1px 6px rgba(0,0,0,0.10)"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"1px"},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),"aria-describedby":"dori-personalized-tip",children:[w.jsx(cn,{boxSize:t.font(11),"aria-hidden":"true"}),w.jsx(Z,{as:"span",fontSize:t.font(10),fontWeight:"600",children:e("personalizedBadge")})]}),n&&w.jsx(D,{id:"dori-personalized-tip",role:"tooltip",position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",zIndex:20,width:"max(220px, 80%)",maxW:"260px",bg:"rgba(32,34,35,0.96)",color:"white",fontSize:t.font(11),lineHeight:"1.45",px:t.space(3),py:t.space(2),borderRadius:"8px",boxShadow:"0 6px 20px rgba(0,0,0,0.22)",pointerEvents:"none",children:e("personalizedTooltip")})]})},Bn=()=>{const e=P(),{botData:t}=H(),{isMobile:n}=ee(),{t:r}=q(),o=function(e){const t=e?.white_label;if(t?.ai_notice_only)return{kind:"short"};const n=t?.disclaimer_text?.trim();return n?{kind:"custom",text:n}:{kind:"default"}}(t),a="custom"===o.kind?o.text:r("short"===o.kind?"aiCanMakeMistakesShort":"aiCanMakeMistakes"),i=function(e){const t=e?.white_label;if(t?.ai_notice_only)return{kind:"none"};const n=t?.logo_url?.trim();if(n)return{kind:"merchant",src:n,alt:t?.logo_alt?.trim()||e?.bot_name||"Store logo"};const r=Boolean(t?.disclaimer_text?.trim());return t?.is_white_labeled||r?{kind:"none"}:{kind:"dori"}}(t),s=function(e){const t=e?.white_label;if(!t?.privacy_link_enabled)return null;const n=t.privacy_link_url?.trim();return n?/^https?:\/\//i.test(n)||/^\/(?!\/)/.test(n)?n:/^[a-z0-9-]+(\.[a-z0-9-]+)+(\/|$)/i.test(n)?`https://${n}`:Ln:Ln}(t);return w.jsxs(Y,{gapX:e.space(2),justifyContent:n?"start":"center",align:"center",alignContent:"center",alignItems:"center",w:"full",wrap:n?"wrap":"nowrap",children:["dori"===i.kind&&w.jsx(Ft,{href:Wn("https://dori.tech/",t?.sharing_id||""),target:"_blank",rel:"noopener noreferrer",display:"inline-flex",alignItems:"center",children:w.jsx(N,{src:vn,alt:"Dori AI",boxSize:te(e)})}),"merchant"===i.kind&&w.jsx(N,{src:i.src,alt:i.alt,h:te(e),w:"auto",maxW:ne(e),objectFit:"contain",flexShrink:0}),w.jsxs(D,{fontSize:e.font(10),color:"mutedText",px:e.space(0),py:e.space(0),bg:"transparent",border:"none",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:e.space(1),children:[w.jsx(D,{as:"span",children:a}),s&&w.jsx(Ft,{href:s,target:"_blank",rel:"noopener noreferrer",color:"inherit",textDecoration:"underline",whiteSpace:"nowrap",children:r("privacyPolicy")}),In(t)&&w.jsx(Mn,{})]})]})};function Fn(e){return re({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"m112 184 144 144 144-144"},child:[]}]})(e)}function Dn(e){return re({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"m112 328 144-144 144 144"},child:[]}]})(e)}const Hn=(e={})=>{const{enableTwinkling:t=!0,enableFloating:n=!0,enableRotation:r=!0,enableScaling:o=!0,twinklingSpeed:a=1e3,floatingSpeed:i=3e3,rotationSpeed:s=8e3,scalingSpeed:l=4e3,floatingRange:c=2.5,rotationRange:d=90,scalingRange:u=1.2}=e,[p,h]=v.useState(1),[f,g]=v.useState(0),[m,b]=v.useState(0),[x,y]=v.useState(1);return v.useEffect(()=>{if(!t)return;const e=setInterval(()=>{h(e=>1===e?.2:1)},a);return()=>clearInterval(e)},[t,a]),v.useEffect(()=>{if(!n)return;const e=setInterval(()=>{g(e=>0===e?c:0)},i);return()=>clearInterval(e)},[n,i,c]),v.useEffect(()=>{if(!r)return;const e=setInterval(()=>{b(e=>0===e?d:0)},s);return()=>clearInterval(e)},[r,s,d]),v.useEffect(()=>{if(!o)return;const e=setInterval(()=>{y(e=>1===e?u:1)},l);return()=>clearInterval(e)},[o,l,u]),{getStarfieldTransform:(e,t)=>[].filter(Boolean).join(" "),getIconStyle:()=>({opacity:p,transition:"transform 0.8s ease-in-out, opacity 1s ease-in-out"}),twinkleOpacity:p,floatingOffset:f,rotationAngle:m,scaleFactor:x}};function Pn(e){if(!e)return null;const{customization:t,bot_image:n,agent_image:r,bot_image_original:o}=e;switch(t?.fab_avatar_source){case"none":return null;case"logo":return n||null;case"agent":return r||null}return t?.enable_avatar_in_fab&&((n&&n!==o?n:null)||r||n)||null}const qn=e=>"bottom"===e?.anchor?"bottom":"middle",On=(e,t)=>t?(e=>e?.customization?.mobile?.position?{align:e.customization?.mobile?.position?.align??"right",sideSpacing:e.customization?.mobile?.position?.side_spacing??8,bottomSpacing:e.customization?.mobile?.position?.bottom_spacing??0,anchor:qn(e.customization?.mobile?.position)}:{align:"right",sideSpacing:8,bottomSpacing:20,anchor:"middle"})(e):(e=>e?.customization?.position?{align:e.customization?.position?.align??"right",sideSpacing:e.customization?.position?.side_spacing??16,bottomSpacing:e.customization?.position?.bottom_spacing??0,anchor:qn(e.customization?.position)}:{align:"right",sideSpacing:16,bottomSpacing:60,anchor:"middle"})(e),Nn=(e,t,n)=>"bottom"===e.anchor||n&&!!Pn(t),Yn=(e,t)=>"bottom"===e.anchor?Math.max(0,e.bottomSpacing):t?.customization?.mobile?.position?.bottom_spacing??90;function Vn(){return"undefined"!=typeof window&&!!window.$crisp}function Zn(){Vn()&&window.$crisp.push(["do","chat:hide"])}function Un(){console.log("trying to open"),Vn()&&(console.log("trying to open2"),window.$crisp.push(["do","chat:show"]),window.$crisp.push(["do","chat:open"]))}const Qn=15e3,Kn="chatra";let Gn=!1,Xn=!1,Jn=null,$n=0,er=null,tr=0,nr=!1;function rr(...e){console.log("[Dori-Chatra]",...e)}function or(){return"undefined"!=typeof window&&"function"==typeof window.Chatra}function ar(){return!!or()&&!!document.getElementById(Kn)}function ir(e){if(or())try{window.Chatra("hide"),rr("called Chatra('hide') —",e)}catch(t){rr("error calling hide:",t)}}function sr(){null!==Jn&&(clearInterval(Jn),Jn=null,rr("stopped maintain loop"))}function lr(){Xn||Date.now()-$n>3e4?sr():Gn&&or()&&ir("maintain loop")}function cr(){if(!Xn)return;const e=document.getElementById(Kn);if(!e)return;const t=e.className||"",n=-1!==t.indexOf("chatra--visible");-1!==t.indexOf("chatra--expanded")?nr=!0:nr&&(Date.now()-tr<1500||n&&ir("user closed chat"))}function dr(){rr("openChatraChat invoked"),Xn=!0,nr=!1,sr(),function(){if(er||"undefined"==typeof document)return;const e=()=>{const e=document.getElementById(Kn);return!!e&&(er=new MutationObserver(cr),er.observe(e,{attributes:!0,attributeFilter:["class","style"]}),rr("attached close observer to #chatra"),!0)};if(e())return;const t=Date.now(),n=setInterval(()=>{(e()||Date.now()-t>Qn)&&clearInterval(n)},200)}(),function(e){if(ar())return void e();const t=Date.now(),n=setInterval(()=>{ar()?(clearInterval(n),e()):Date.now()-t>Qn&&(clearInterval(n),rr("Chatra never fully loaded within",Qn,"ms"))},200)}(()=>{tr=Date.now();try{window.Chatra("show"),rr("called Chatra('show')"),setTimeout(()=>{try{window.Chatra("openChat"),rr("called Chatra('openChat')")}catch(e){rr("error calling openChat:",e)}},50)}catch(e){rr("error calling show:",e)}})}const ur="dori-shopify-inbox-hide",pr="data-dori-inbox-open",hr="shopify-chat",fr="inbox-online-store-chat";let gr=null;function mr(...e){console.log("[Dori-ShopifyInbox]",...e)}function br(){if("undefined"==typeof document)return null;const e=document.querySelector(hr);if(e)return{el:e,legacy:!1};const t=document.querySelector(fr);return t?{el:t,legacy:!0}:null}function xr(){mr("openShopifyInbox invoked"),function(e){const t=br();if(t)return void e(t);const n=Date.now(),r=setInterval(()=>{const t=br();t?(clearInterval(r),e(t)):Date.now()-n>15e3&&(clearInterval(r),mr("Inbox embed never appeared within",15e3,"ms"))},200)}(({el:e,legacy:t})=>{if(document.documentElement.setAttribute(pr,""),t)requestAnimationFrame(()=>{const t=e.shadowRoot?.querySelector("button");t?(t.click(),mr("clicked legacy activator")):mr("legacy activator not found in shadow root")});else{if(function(e){gr||"undefined"==typeof document||(gr=new MutationObserver(()=>{e.hasAttribute("open")||document.documentElement.removeAttribute(pr)}),gr.observe(e,{attributes:!0,attributeFilter:["open"]}))}(e),"function"==typeof e.show)try{return e.show(),void mr("called shopify-chat.show()")}catch(n){mr("show() failed, falling back to the open attribute:",n)}e.setAttribute("open","")}})}const yr=e=>{if(!e)return[];const t=[];return e.crisp?.enabled&&t.push({type:"crisp",icon:e.crisp.icon,name:e.crisp.name,data:e.crisp}),e.chatra?.enabled&&t.push({type:"chatra",icon:e.chatra.icon,name:e.chatra.name,data:e.chatra}),e.shopifyInbox?.enabled&&t.push({type:"shopifyInbox",icon:e.shopifyInbox.icon,name:e.shopifyInbox.name,data:e.shopifyInbox}),e.customLink?.enabled&&t.push({type:"customLink",icon:e.customLink.icon,name:e.customLink.name,data:e.customLink}),e.telegram?.enabled&&t.push({type:"telegram",icon:e.telegram.icon,name:e.telegram.name,data:e.telegram}),e.whatsapp?.enabled&&t.push({type:"whatsapp",icon:e.whatsapp.icon,name:e.whatsapp.name,data:e.whatsapp}),t},vr=(e,t,n)=>{switch(e){case"whatsapp":const e=t.phoneNumber?.replace(/\s/g,""),r=t.welcomeMessage?`?text=${encodeURIComponent(t.welcomeMessage)}`:"";window.open(`https://wa.me/${e}${r}`,"_blank");break;case"telegram":window.open(`https://t.me/${t.username}`,"_blank");break;case"customLink":window.open(t.linkUrl,"_blank");break;case"crisp":Un(),window.dispatchEvent(new Event("dori:close-widget"));break;case"chatra":dr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"shopifyInbox":xr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"dori":n&&n()}},wr=({channels:e,isOpen:t,onToggle:n,isMobile:r,onMouseEnter:o,onChatClick:a})=>{const{botData:i}=H(),s=Ot({base:!0,md:!1})??!1,l=On(i,s),c=!0!==i?.customization?.disable_idle_animation,{getStarfieldTransform:d,getIconStyle:u}=Hn({enableTwinkling:c,enableFloating:c,enableRotation:c,enableScaling:c}),p=yr(e);return 0===p.length?null:w.jsxs(G,{gap:2,align:"flex-end",alignItems:"center",position:"absolute",bottom:"100%",right:0,children:[r&&t&&w.jsx(Ut,{"aria-label":"Toggle support channels",size:"2xs",borderRadius:"full",bg:"primary",color:"buttonText",boxShadow:"md",mb:2,opacity:t||r?1:0,transition:"all 0.2s ease",_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)",boxShadow:"lg"}},onClick:n,display:r||!t?"flex":"none",children:w.jsx(Fn,{size:20})}),w.jsx(D,{mb:3,opacity:t?1:0,transform:t?"translateY(0)":"translateY(10px)",transition:"all 0.2s ease",pointerEvents:t?"auto":"none",onMouseEnter:o,children:w.jsxs(G,{gap:2,align:"flex-end",children:[w.jsx(D,{borderRadius:"full",cursor:"pointer",onClick:()=>vr("dori",{},a),bg:"primary",boxSize:{base:"36px",md:"48px"},display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"md",_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)",boxShadow:"lg"}},transition:"all 0.2s ease",children:w.jsx(xn,{boxSize:{base:"24px",md:"32px"},color:"background",transform:d("expanded",l),...u()})}),p.map((e,t)=>w.jsx(D,{borderRadius:"full",cursor:"pointer",onClick:()=>vr(e.type,e.data,a),_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)"}},transition:"all 0.2s ease",children:w.jsx(N,{src:e.icon,alt:e.name,boxSize:{base:"36px",md:"48px"},borderRadius:"full",objectFit:"fill"})},`${e.type}-${t}`))]})}),r&&!t&&w.jsx(Ut,{"aria-label":"Toggle support channels",size:"2xs",borderRadius:"full",bg:"primary",color:"buttonText",boxShadow:"md",mb:2,opacity:t||r?1:0,transition:"all 0.2s ease",_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)",boxShadow:"lg"}},onClick:n,display:r||!t?"flex":"none",children:w.jsx(Dn,{size:20})})]})},Cr=({channels:e})=>{const t=P(),n=(e=>{if(!e)return[];const t=[];return e.crisp?.enabled&&t.push({type:"crisp",icon:e.crisp.icon,name:e.crisp.name,data:e.crisp}),e.chatra?.enabled&&t.push({type:"chatra",icon:e.chatra.icon,name:e.chatra.name,data:e.chatra}),e.shopifyInbox?.enabled&&t.push({type:"shopifyInbox",icon:e.shopifyInbox.icon,name:e.shopifyInbox.name,data:e.shopifyInbox}),e.customLink?.enabled&&t.push({type:"customLink",icon:e.customLink.icon,name:e.customLink.name,data:e.customLink}),e.telegram?.enabled&&t.push({type:"telegram",icon:e.telegram.icon,name:e.telegram.name,data:e.telegram}),e.whatsapp?.enabled&&t.push({type:"whatsapp",icon:e.whatsapp.icon,name:e.whatsapp.name,data:e.whatsapp}),t})(e);return 0===n.length?null:w.jsx(Y,{gap:t.space(3),w:"full",alignItems:"center",justifyContent:"start",wrap:"wrap",children:n.map((e,n)=>w.jsxs(D,{display:"flex",alignItems:"center",gap:t.space(3),cursor:"pointer",borderRadius:t.radius(16),padding:"6px 8px",bg:"lightBackground",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"veryLightBackground",transform:"scale(1.05)"}},transition:"all 0.2s ease",onClick:()=>((e,t)=>{switch(e){case"whatsapp":const e=t.phoneNumber?.replace(/\s/g,""),n=t.welcomeMessage?`?text=${encodeURIComponent(t.welcomeMessage)}`:"";window.open(`https://wa.me/${e}${n}`,"_blank");break;case"telegram":window.open(`https://t.me/${t.username}`,"_blank");break;case"customLink":window.open(t.linkUrl,"_blank");break;case"crisp":Un(),window.dispatchEvent(new Event("dori:close-widget"));break;case"chatra":dr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"shopifyInbox":xr(),window.dispatchEvent(new Event("dori:close-widget"))}})(e.type,e.data),flexShrink:0,children:[w.jsx(N,{src:e.icon,alt:e.name,boxSize:{base:t.length(22),md:t.length(24)},borderRadius:"full",objectFit:"cover"}),w.jsx(Z,{fontSize:{base:t.font(12),md:t.font(14)},fontWeight:"400",color:"text",whiteSpace:"nowrap",children:e.name})]},`${e.type}-${n}`))})},kr=({flow:e,onComplete:t,onClose:n})=>{const r=P(),[o,a]=v.useState(0),[i,s]=v.useState([]),[l,c]=v.useState("active"),[d,u]=v.useState(!1),[p,h]=v.useState(!1),[f,g]=v.useState(!1),m=v.useRef(null),b=v.useRef(null),x=v.useRef(null),y=v.useRef(null),C=Bt("colors","primary"),k=oe(C);v.useEffect(()=>{if("active"!==l)return;u(!1);const e=requestAnimationFrame(()=>{u(!0)});return()=>cancelAnimationFrame(e)},[o,l]),v.useEffect(()=>()=>{m.current&&clearTimeout(m.current),b.current&&clearTimeout(b.current),x.current&&clearTimeout(x.current),y.current&&clearTimeout(y.current)},[]);const j=v.useCallback(n=>{if(f)return;g(!0);const r=[...i,{stepIndex:o,option:n}];s(r),o<e.steps.length-1?(u(!1),m.current=setTimeout(()=>{a(e=>e+1),g(!1)},280)):(h(!0),y.current=setTimeout(()=>{c("analyzing"),h(!1);const n=800+700*Math.random();x.current=setTimeout(()=>{const n=r.map(e=>e.option.label).join(" · ");let o=e.result_prompt;r.forEach((e,t)=>{const n=`{step${t+1}}`;o=o.split(n).join(e.option.value)});const a=ae(),i=r.map(e=>e.option.label).join(", ");t(n,`${a}[Quiz selections: ${i}] ${o}`)},n)},300))},[f,i,o,e,t]),S=v.useCallback(()=>{o<=0||p||(u(!1),b.current=setTimeout(()=>{s(e=>e.slice(0,-1)),a(e=>e-1),g(!1)},250))},[o,p]),z=e.steps[o];return"analyzing"===l?w.jsxs(G,{gap:r.space(3),align:"center",flex:1,justify:"center",transition:"opacity 0.3s ease",children:[w.jsx(Y,{gap:r.space(2),flexWrap:"wrap",justify:"center",children:i.map((e,t)=>w.jsx(jr,{label:e.option.label},t))}),w.jsxs(G,{gap:r.space(2),align:"center",py:r.space(4),children:[w.jsx(ln,{boxSize:r.length(20),color:"primary",opacity:.6}),w.jsx(Z,{fontSize:r.font(14),fontWeight:500,fontFamily:V,css:{background:`linear-gradient(90deg, ${C}44, ${C}, ${C}44)`,backgroundSize:"200% 100%",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",animation:"dori-shimmer 1.5s ease-in-out infinite"},children:e.analyzing_text})]}),w.jsx("style",{children:"\n @keyframes dori-shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "})]}):w.jsxs(G,{gap:r.space(4),align:"stretch",flex:1,justify:"start",opacity:p?0:1,transform:p?"translateY(-8px)":"translateY(0)",transition:"opacity 0.3s ease, transform 0.3s ease",children:[i.length>0&&w.jsxs(Y,{gap:r.space(2),flexWrap:"wrap",align:"center",children:[w.jsx(D,{as:"button",onClick:S,"aria-label":"Back",cursor:"pointer",px:r.space(2),py:r.space(1),borderRadius:r.radius(12),fontSize:r.font(11),color:"primary",opacity:.8,_hover:{opacity:1,bg:"veryLightBackground"},transition:"all 0.15s ease",fontFamily:V,flexShrink:0,children:"←"}),i.map((e,t)=>w.jsx(jr,{label:e.option.label},t))]}),w.jsxs(D,{opacity:d?1:0,transform:d?"translateY(0)":"translateY(10px)",transition:"opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",children:[w.jsxs(G,{align:"stretch",gap:r.space(3),mb:r.space(3),children:[w.jsxs(Y,{justify:"space-between",align:"center",gap:r.space(3),children:[w.jsxs(Y,{gap:r.space(2),align:"center",minW:0,children:[w.jsx(D,{display:"flex",alignItems:"center",justifyContent:"center",boxSize:r.length(24),borderRadius:r.radius(12),bg:"background",border:"1px solid",borderColor:"primary",flexShrink:0,children:w.jsx(ln,{boxSize:r.length(12),color:"primary"})}),w.jsx(Z,{fontSize:r.font(11),fontWeight:600,fontFamily:V,lineHeight:"1.4",css:{background:k,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:e.entry_label})]}),w.jsxs(Y,{gap:r.space(1),align:"center",flexShrink:0,children:[w.jsxs(D,{px:r.space(2.5),py:r.space(1),borderRadius:r.radius(999),bg:"background",border:"1px solid",borderColor:"primary",fontSize:r.font(10),fontWeight:700,color:"primary",fontFamily:V,lineHeight:"1",flexShrink:0,children:[o+1,"/",e.steps.length]}),n&&w.jsx(D,{as:"button",onClick:n,cursor:"pointer",p:1,borderRadius:"full",opacity:.5,_hover:{opacity:1,bg:"lightBackground"},transition:"all 0.15s ease",flexShrink:0,"aria-label":"Close",children:w.jsx(Z,{fontSize:"16px",color:"text",lineHeight:"1",children:"×"})})]})]}),w.jsx(Z,{fontSize:r.font(17),fontWeight:700,color:"text",lineHeight:"1.45",fontFamily:V,children:z.question}),w.jsx(D,{bg:"background",border:"1px solid",borderColor:"borderColor",borderRadius:r.radius(16),px:r.space(3),py:r.space(2.5),children:w.jsxs(Y,{gap:r.space(2),align:"start",children:[w.jsx(D,{boxSize:r.length(7),borderRadius:"full",bg:"primary",mt:r.length(7),flexShrink:0}),w.jsx(Z,{fontSize:r.font(12),color:"mutedText",fontWeight:500,lineHeight:"1.65",fontFamily:V,opacity:.9,children:z.reason})]})})]}),w.jsx(D,{display:"grid",gridTemplateColumns:{base:"1fr 1fr"},gap:r.space(2),children:z.options.map((e,t)=>w.jsx(D,{as:"button",px:r.space(3),py:"8px",borderRadius:r.radius(24),border:"1px solid",borderColor:"primary",bg:"veryLightBackground",cursor:"pointer",textAlign:"start",display:"flex",alignItems:"center",gap:r.space(2),opacity:d?1:0,transform:d?"translateY(0)":"translateY(6px)",transition:`opacity 0.25s ease ${40*t}ms, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) ${40*t}ms, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease`,_hover:{bg:"lightBackground",boxShadow:`0 0 0 1px ${C}33`},_active:{bg:"lightBackground",transform:"translateY(0) scale(0.97)"},onClick:()=>j(e),fontFamily:V,children:w.jsxs(D,{flex:"1",minW:0,children:[w.jsx(Z,{fontSize:r.font(13),fontWeight:500,color:"text",lineHeight:"1.4",whiteSpace:"normal",wordBreak:"break-word",children:e.label}),e.subtitle&&w.jsx(Z,{fontSize:r.font(10),color:"mutedText",opacity:.6,lineHeight:"1.2",children:e.subtitle})]})},e.value))})]})]})},jr=({label:e})=>{const t=P();return w.jsxs(D,{px:t.space(3),py:t.space(1),borderRadius:t.radius(16),bg:"veryLightBackground",border:"1px solid",borderColor:"primary",fontSize:t.font(11),fontWeight:500,color:"primary",fontFamily:V,whiteSpace:"nowrap",children:["✓ ",e]})},Sr=({chips:e,onChipClick:t,onDismiss:n})=>{const r=P(),[o,a]=v.useState(!1);return v.useEffect(()=>{const e=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(e)},[]),0===e.length?null:w.jsx(D,{flexShrink:0,opacity:o?1:0,transform:o?"translateY(0)":"translateY(10px)",transition:"opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)","data-dori-nudge":"chip-row",children:w.jsxs(Y,{gap:r.space(2),wrap:"wrap",align:"center",children:[e.map((e,n)=>w.jsx(I,{size:"sm",variant:"outline",borderRadius:r.radius(20),borderWidth:"1.5px",borderColor:"primary",bg:"veryLightBackground",color:"text",fontSize:r.font(13),fontWeight:500,px:r.space(3),py:r.space(1.5),height:"auto",whiteSpace:"normal",wordBreak:"break-word",textAlign:"start",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"lightBackground"}},onClick:()=>t(e),fontFamily:V,children:e},`${n}-${e}`)),w.jsx(Ut,{size:"xs",borderRadius:"full",bg:"transparent","aria-label":"Dismiss nudge",color:"mutedText",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"lightBackground"}},minW:r.length(22),w:r.length(22),h:r.length(22),p:r.space(0),flexShrink:0,onClick:n,opacity:.6,children:w.jsx(tn,{boxSize:r.length(11)})})]})})};const zr=({onStartChat:e,isMobile:t,isExpanded:o=!1,onToggleExpand:a,fullPageHref:i,onClose:s})=>{const{inputValue:l,handleInputChange:c}=((e="")=>{const[t,n]=v.useState(e),r=v.useCallback(e=>{n(e)},[]),o=v.useCallback(e=>{t.trim()&&e&&(e(t.trim()),n(""))},[t]),a=v.useCallback((e,t)=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),o(t))},[o]),i=v.useCallback(()=>{n("")},[]),s=v.useCallback(e=>{n(e)},[]);return{inputValue:t,setInputValue:n,handleInputChange:r,handleSubmit:o,handleKeyPress:a,clearInput:i,setInput:s}})(),{botData:d,primedGreeting:u,effectiveSuggestedReplies:p,bannerChips:h,dismissBannerChips:f,suppressProactiveForSession:g}=H(),m=P(),b=ie(t?1:se(d).width),{t:x,translations:y}=q(),C=u||n(d,y),k=Bt("colors","primary"),j=oe(k),S=p,z=!1,A=v.useMemo(()=>S.slice(0,4),[S]),[E,R]=le();v.useMemo(()=>S.slice(0,2),[S]);const T=({message:t,imageUrl:n})=>{(t.trim()||n)&&e(t.trim(),n)},_=!0===d?.feature_flags?.greeting_one_line,W=v.useRef(null),L=function(e,t,n,r,o){const[a,i]=v.useState(n);return v.useLayoutEffect(()=>{if(!t)return void i(n);const o=e.current,a=o?.parentElement;if(!o||!a)return;const s=()=>{const e=o.style.fontSize;o.style.fontSize=`${n}px`;const t=o.scrollWidth;o.style.fontSize=e,i(function(e,t,n,r){if(!(e>0&&t>e))return n;const o=Math.floor(n*(e/t)*.99);return Math.max(r,Math.min(n,o))}(a.clientWidth,t,n,r))};if(s(),"undefined"==typeof ResizeObserver)return;const l=new ResizeObserver(s);return l.observe(a),()=>l.disconnect()},[e,t,n,r,o]),a}(W,_,parseFloat(m.isMini?m.font(24):`${b.greetingFontPx}px`),14,C||""),M=!0===d?.feature_flags?.composer_at_bottom,B=w.jsx(D,{children:w.jsx(Tn,{state:"minimized",placeholder:x("askAnything"),value:l,onChange:c,onSend:T})});return w.jsxs(w.Fragment,{children:[w.jsx(wn,{onClose:s,isMobile:t,isExpanded:o,onToggleExpand:a,fullPageHref:i}),w.jsxs(G,{h:"full",minH:0,justify:"flex-start",align:"stretch",gap:m.space(b.sectionGap),children:[C&&w.jsx(G,{gap:m.space(3),w:"full",align:"start",mb:m.length(b.greetingGapPx),flexShrink:0,children:w.jsx(Z,{ref:W,fontWeight:o?600:500,fontStyle:"normal",fontSize:_?`${L}px`:m.isMini?m.font(24):`${b.greetingFontPx}px`,whiteSpace:_?"nowrap":void 0,letterSpacing:"0",textAlign:o?"center":"right",fontFamily:V,css:{background:j,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:C})}),w.jsx(D,{flex:1,minH:0,overflowY:"auto",overflowX:"hidden","data-scroll-container":"chat-messages",overscrollBehavior:"contain",css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none"},children:w.jsxs(G,{gap:m.space(4),align:"stretch",justify:"start",pb:m.space(3),children:[!M&&B,h&&h.length>0&&w.jsx(Sr,{chips:h,onChipClick:t=>{r("banner_chip_tapped",{chip_text:t}),e(t),f()},onDismiss:()=>{r("banner_chips_dismissed"),f(),g()}}),!(h&&h.length>0)&&E&&w.jsx(Sr,{chips:[E],onChipClick:t=>{r("offer_guide_chat_opened",{from:"opening"}),R(),de(t).then(n=>e(t,void 0,n))},onDismiss:()=>{ce(),R()}}),z,z,A.length>0&&w.jsx(D,{w:"full",children:w.jsx(D,{display:"grid",gridTemplateColumns:{base:"1fr",md:b.starterColumns},gap:m.space(3),w:"full",children:A.map((e,t)=>w.jsxs(I,{variant:"outline",borderRadius:m.radius(24),border:"1px solid",borderColor:"borderColor",bg:"lightBackground",color:"text",fontSize:m.font(14),fontWeight:400,padding:"8px 12px",_hover:{bg:"veryLightBackground",borderColor:"borderColor"},onClick:()=>(e=>{T({message:e,imageUrl:void 0})})(e),justifyContent:"start",w:"full",height:"auto",lineHeight:"1.5",whiteSpace:"pre-wrap",children:[w.jsx(ln,{boxSize:m.length(16),color:"text"}),w.jsx(D,{as:"span",flex:"1",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"break-word",fontFamily:V,children:e})]},t))})})]})}),w.jsx(D,{w:"full",flexShrink:0,children:w.jsx(Cr,{channels:d?.merchant_support_channels})}),M&&w.jsx(D,{w:"full",flexShrink:0,children:B}),w.jsx(D,{flexShrink:0,transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",children:w.jsx(Bn,{variant:"default"})})]})]})},Ar=({message:e,type:t="default"})=>{const n="loading"===t,{botData:r}=H(),o=P(),a=e.replace(/\\([!?.,'":;\-\[\](){}#*_~`>+])/g,"$1"),i=n?a.replace(/[.\u2026]{1,3}\s*$/u,"").trim():a;return w.jsxs(D,{position:"relative",width:"full",children:[w.jsx(D,{opacity:"0",bg:"lightBackground",borderRadius:o.radius(24),padding:o.length(16),children:w.jsx(Z,{fontWeight:400,fontSize:o.font(14),lineHeight:o.lineHeight(21),fontFamily:V,children:a})}),w.jsx(D,{h:o.length(50)}),w.jsx(D,{position:"absolute",left:0,bottom:0,children:w.jsx(N,{src:r?.agent_image||vn,alt:"",role:"presentation",w:o.length(24),h:o.length(24),borderRadius:"50%"})}),w.jsx(D,{position:"absolute",left:o.length(21),bottom:o.length(21),width:o.length(7.68),height:o.length(7.68),bg:"lightBackground",borderRadius:"100%",borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor"}),w.jsx(D,{position:"absolute",left:o.length(27),bottom:o.length(27),width:o.length(15.8),height:o.length(15.8),bg:"lightBackground",borderRadius:"100%",borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor"}),w.jsx(D,{position:"absolute",left:o.length(35),bottom:o.length(35),bg:"lightBackground",borderRadius:o.radius(24),padding:o.length(16),borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",children:n?w.jsxs(Y,{gap:o.length(8),align:"center",children:[i&&w.jsx(Z,{fontWeight:400,fontSize:o.font(14),lineHeight:o.lineHeight(21),color:"mutedText",fontFamily:V,children:i}),w.jsx(Y,{gap:o.length(3),align:"center","aria-hidden":"true",children:[0,1,2].map(e=>w.jsx(D,{w:o.length(4),h:o.length(4),borderRadius:"full",bg:"mutedText",css:{animation:`dori-typing-dot 1.2s ease-in-out ${.15*e}s infinite`}},e))}),w.jsx("style",{children:"\n @keyframes dori-typing-dot {\n 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }\n 30% { opacity: 1; transform: translateY(-3px); }\n }\n "})]}):w.jsx(Z,{fontWeight:400,fontSize:o.font(14),lineHeight:o.lineHeight(21),color:"text",fontFamily:V,children:a})})]})};function Er(e,t){t?window.open(e,"_blank","noopener,noreferrer"):window.location.href=e}function Rr(e,t){let n=-1;const r=()=>{const r=e.getBoundingClientRect();n=r.width,t(function(e){const t={bgColor:null,transform:null};try{const n=e.naturalWidth||e.width,r=e.naturalHeight||e.height;if(!n||!r)return t;const o=Math.min(1,256/Math.max(n,r)),a=Math.max(1,Math.round(n*o)),i=Math.max(1,Math.round(r*o)),s=document.createElement("canvas"),l=s.getContext("2d",{willReadFrequently:!0});if(!l)return t;s.width=a,s.height=i,l.drawImage(e,0,0,a,i);const{data:c}=l.getImageData(0,0,a,i),d=(e,t)=>{const n=4*(t*a+e);return[c[n],c[n+1],c[n+2],c[n+3]]},u=[d(0,0),d(a-1,0),d(0,i-1),d(a-1,i-1)].filter(([,,,e])=>e>=128),p=0===u.length;let h=null,f=null;if(!p){const e=new Map;for(const t of u){const n=`${t[0]},${t[1]},${t[2]}`,r=e.get(n);r?r.n+=1:e.set(n,{c:t,n:1})}h=Array.from(e.values()).sort((e,t)=>t.n-e.n)[0].c,f=`rgb(${h[0]}, ${h[1]}, ${h[2]})`}const g=Math.max(1,Math.floor(Math.max(a,i)/160)),m=(e,t)=>{const[n,r,o,a]=d(e,t);if(a<128)return!1;if(p)return!0;if(!h)return!1;const i=n-h[0],s=r-h[1],l=o-h[2];return Math.sqrt(i*i+s*s+l*l)>30};let b=a,x=i,y=-1,v=-1;for(let e=0;e<i;e+=g)for(let t=0;t<a;t+=g)m(t,e)&&(t<b&&(b=t),t>y&&(y=t),e<x&&(x=e),e>v&&(v=e));if(y<0||v<0)return{bgColor:f,transform:null};const w=(y-b+g)/a,C=(v-x+g)/i;if(Math.max(w,C)>.8)return{bgColor:f,transform:null};const k=e.getBoundingClientRect();if(!k.width||!k.height)return{bgColor:f,transform:null};const j=Math.min(k.width/n,k.height/r),S=Math.max(w*n*j/k.width,C*r*j/k.height);if(!S)return{bgColor:f,transform:null};const z=Math.min(2.2,.88/S);if(z<1.06)return{bgColor:f,transform:null};const A=-((x+(v-x+g)/2)/i-.5)*r*j*z;return{bgColor:f,transform:`translate(${(-((b+(y-b+g)/2)/a-.5)*n*j*z).toFixed(1)}px, ${A.toFixed(1)}px) scale(${z.toFixed(3)})`}}catch{return t}}(e))},o=()=>r();e.complete&&e.naturalWidth>0?r():e.addEventListener("load",o);const a="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{const o=t[0]?.contentRect?.width??0;o>0&&Math.abs(o-n)>8&&e.complete&&e.naturalWidth>0&&r()}):null;return a?.observe(e),()=>{e.removeEventListener("load",o),a?.disconnect()}}const Tr={black:"#222222",white:"#ffffff",offwhite:"#f3efe7","off-white":"#f3efe7",ivory:"#f4f0e1",cream:"#f3ead3",natural:"#e8ded0",beige:"#d9c7a8",tan:"#cba36b",taupe:"#9b8978",camel:"#bd9a6a",khaki:"#a39a6a",sand:"#d8c19a",stone:"#cabfa9",nude:"#e3c4a8",gray:"#808080",grey:"#808080",charcoal:"#3a3d40",slate:"#5a6470",graphite:"#4a4a4a",silver:"#c4c4c4",ash:"#b2b2b2",smoke:"#8c8c8c",pewter:"#9a9a94",gunmetal:"#53565a",red:"#c8302b",crimson:"#a31f34",scarlet:"#c4302a",cherry:"#a31330",ruby:"#9b1b30",wine:"#5e1f2b",burgundy:"#5b1a26",bordeaux:"#4e1822",maroon:"#6b1f2a",brick:"#9c4a3a",terracotta:"#c46a4a",rust:"#9e4a2e",coral:"#e36a52",salmon:"#e69079",punch:"#d83a5e",pink:"#e58aab",rose:"#d98ca0",blush:"#e8c0c4",magenta:"#b8336a",fuchsia:"#c2407e",orange:"#e08234",pumpkin:"#e07b39",apricot:"#e7a473",peach:"#f0b48f",amber:"#c98a2b",mustard:"#c9962f",gold:"#c9a227",honey:"#d7a13a",sunshine:"#f4c842",yellow:"#e8c63a",lemon:"#e7d44a",canary:"#e6d24a",brown:"#6b4a2e",chocolate:"#4f3422",coffee:"#5a4334",mocha:"#7a5a44",caramel:"#a9743f",chestnut:"#6e3f2a",walnut:"#5a4031",espresso:"#3a2a21",bronze:"#7d5a33",copper:"#a35d3a",clay:"#a86a4f",green:"#3f7a3f",forest:"#2c4a2c",olive:"#6b6a35",sage:"#9aa583",moss:"#5e6b3a",mint:"#8fd0b0",emerald:"#1f8a5a",jade:"#3a9b78",lime:"#9bc24a","olive green":"#6b6a35",leaf:"#5a8a3a",blue:"#2f5fa8",navy:"#27314f",cobalt:"#2a4d9b",azure:"#3a8fd0",sky:"#86b8e0",denim:"#46688f",sapphire:"#1f4e8c",marine:"#27506b",ocean:"#1f6e8c",teal:"#1d8a85",turquoise:"#3fb7b0",aqua:"#5fc7c0",cyan:"#3bb6c4",periwinkle:"#8a9cd8",indigo:"#3a3a7a",purple:"#6f4a8e",violet:"#7a4ba0",plum:"#6e3a5e",grape:"#6f4a8e",eggplant:"#4b2e57",aubergine:"#4b2e57",amethyst:"#8a6aa0",lavender:"#b9a7d6",lilac:"#c4a8d6",mauve:"#a07a8a",seafoam:"#8fcab0",sangria:"#7a1f2b",midnight:"#1f2540",onyx:"#2a2a2a",ebony:"#2b2622",jet:"#2a2a2a",pearl:"#f0ead9",snow:"#fafafa",heather:"#9a8fa0",oat:"#dcceb4",fog:"#cfd2cf",berry:"#8a2f4a",rosso:"#c8302b",rojo:"#c8302b",rouge:"#c8302b",rot:"#c8302b",vermelho:"#c8302b",blu:"#2f5fa8",azul:"#2f5fa8",bleu:"#2f5fa8",blau:"#2f5fa8",azzurro:"#3a8fd0",verde:"#3f7a3f",vert:"#3f7a3f","grün":"#3f7a3f",gruen:"#3f7a3f",nero:"#222222",negro:"#222222",noir:"#222222",schwarz:"#222222",preto:"#222222",bianco:"#ffffff",blanco:"#ffffff",blanc:"#ffffff","weiß":"#ffffff",weiss:"#ffffff",branco:"#ffffff",giallo:"#e8c63a",amarillo:"#e8c63a",jaune:"#e8c63a",gelb:"#e8c63a",grigio:"#808080",gris:"#808080",grau:"#808080",marrone:"#6b4a2e","marrón":"#6b4a2e",marron:"#6b4a2e",braun:"#6b4a2e",viola:"#7a4ba0",morado:"#7a4ba0",lila:"#c4a8d6",arancione:"#e08234",naranja:"#e08234"},_r=/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i;function Wr(e,t){return t&&_r.test(t)?t:function(e){if(!e)return null;const t=e.trim().toLowerCase();if(Tr[t])return Tr[t];for(const n of t.split(/[\s/_,&+().-]+/))if(n&&Tr[n])return Tr[n];return null}(e)}function Ir(e,t,n,r,o){for(const a of e?.options??[])if(a.position===n)for(const e of a.values){if(!e.swatch||!e.swatch_variant)continue;const r=t.find(t=>String(t.id)===e.swatch_variant);if(r&&ue(r,n)===o)return e.swatch}return e?.options?.find(e=>e.name===r)?.values.find(e=>e.value===o)?.swatch??null}function Lr(e){return!!e?.values.some(e=>e.swatch)}const Mr=/colo|couleur|farbe|màu|colore|kleur/i,Br=({product:e,selectedColor:t=null,onColorChange:n,showQuantity:r=!1,onAdded:o,controlled:a=!1,onSelectionChange:i,onLiveLoaded:s})=>{const l=P(),{addToCartDirect:c,botData:d,isTestMode:u}=H(),{t:p}=q(),h=e.variant_summary,[f,g]=v.useState(null),[m,b]=v.useState(!1),x=v.useRef(s);x.current=s;const[y,C]=v.useState({}),[k,j]=v.useState("idle"),[S,z]=v.useState(null),[A,E]=v.useState(1);v.useEffect(()=>{let t=!1;const n=pe(e.url);if(n)return he(n).then(e=>{!t&&e&&e.variants?.length&&(g(e),b(!0),x.current?.(e))}).catch(()=>{}),()=>{t=!0}},[e.url]);const R=(e.currency||d?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",T=v.useMemo(()=>f?fe(f):[],[f]),_=v.useMemo(()=>m&&f?T.map((e,t)=>{const n=Mr.test(e.name)||function(e,t){return!!e?.options?.some(e=>e.position===t&&Lr(e))}(h,t+1),r=e.values.map(r=>{let o=null;if(n){const e=f.variants.find(e=>ue(e,t+1)===r&&e.featured_image?.src);o=e?.featured_image?.src??null}return{value:r,image:o,swatch:n?Ir(h,f.variants,t+1,e.name,r):null}}),o=n&&new Set(r.map(e=>e.image).filter(Boolean)).size>1;return{name:e.name,isColor:n,useImages:o,values:r}}).filter(e=>e.values.length>1):(h?.options??[]).map(e=>{const t=Mr.test(e.name)||Lr(e),n=e.values.map(e=>({value:e.value,image:e.image,swatch:e.swatch})),r=t&&new Set(n.map(e=>e.image).filter(Boolean)).size>1;return{name:e.name,isColor:t,useImages:r,values:n}}),[m,f,T,h]),W=_.findIndex(e=>e.isColor),L=v.useRef(null);v.useEffect(()=>{if(t===L.current)return;if(L.current=t??null,null==t||W<0)return;const e=_[W]?.name;e&&C(n=>{if(n[e]===t)return n;const r={};for(let e=0;e<W;e++){const t=_[e].name;n[t]&&(r[t]=n[t])}r[e]=t;for(let e=W+1;e<_.length;e++){const t=_[e],o=n[t.name];o&&((!m||!f||ge(f,{...r,[t.name]:o}).some(e=>!1!==e.available))&&(r[t.name]=o))}return r})},[t,W,_,m,f]);const M=v.useRef(!1),B=e=>{const t=_.find(t=>t.name===e);return!!t&&(t.isColor||1===t.values.length)};v.useEffect(()=>{if(!a||M.current||0===_.length)return;if(Object.keys(y).length>0)return void(M.current=!0);const e=_.find(e=>e.isColor),r=t=>{e&&t[e.name]&&n?.(t[e.name])},o=e&&t&&e.values.some(e=>e.value===t)?t:null;if(m&&f){const t=e?T.findIndex(t=>t.name===e.name)+1:0,n=o&&f.variants.find(e=>!1!==e.available&&ue(e,t)===o)||f.variants.find(e=>!1!==e.available),a={};return n&&T.forEach((e,t)=>{const r=ue(n,t+1);r&&B(e.name)&&(a[e.name]=r)}),M.current=!0,void(Object.keys(a).length&&(C(a),r(a)))}const i={};for(const t of _){if(!B(t.name))continue;const e=h?.options.find(e=>e.name===t.name)?.values??[],n=t=>{const n=e.find(e=>e.value===t);return!n||!1!==n.available},r=t.isColor&&o&&n(o)?{value:o}:t.values.find(e=>n(e.value));r&&(i[t.name]=r.value)}M.current=!0,Object.keys(i).length&&(C(i),r(i))},[a,m,f,_,T]);const F=_.every(e=>y[e.name]),O=v.useMemo(()=>m&&f&&F?ge(f,y).find(e=>!1!==e.available)??null:null,[m,f,F,y]),N=F&&!(m&&f&&!O),U=_.map(e=>y[e.name]).filter(Boolean).join(" · ");v.useEffect(()=>{a&&i?.({allChosen:F,canAdd:N,variantId:O?String(O.id):null,priceCents:O?.price??null,selectedLabel:U,selectedOptions:y})},[a,F,N,O,U,y]);const Q=r&&null!=O?.price?me(O.price/100*A,R):null,K=null!=O?.price?` · ${me(O.price/100,R)}`:"",X=be(l),J=(e,t,r)=>{const o=((e,t)=>{const n=_[e];if(m&&f){const r={[n.name]:t};for(let t=0;t<e;t++){const e=y[_[t].name];e&&(r[_[t].name]=e)}return ge(f,r).some(e=>!1!==e.available)}const r=h?.options.find(e=>e.name===n.name)?.values.find(e=>e.value===t);return!r||!1!==r.available})(e,r.value),i=y[t.name]===r.value,s=t.isColor?Wr(r.value,r.swatch):null,c={as:"button",type:"button",disabled:!o,"aria-pressed":i,"aria-label":r.value,title:r.value,onClick:()=>o&&((e,t)=>{const r=_[e].name,o=y[r]===t;C(n=>{const a={};for(let t=0;t<e;t++){const e=_[t].name;n[e]&&(a[e]=n[e])}return o||(a[r]=t),a}),!o&&_[e]?.isColor&&n?.(t),"added"!==k&&"error"!==k||(j("idle"),z(null))})(e,r.value),cursor:o?"pointer":"not-allowed",opacity:o?1:.35,style:{appearance:"none",WebkitAppearance:"none"}},d=a?`${X.image}px`:l.length(40),u=a?`${X.dot}px`:l.length(26);return t.useImages&&r.image?w.jsx(D,{...c,position:"relative",p:l.space(0),w:d,h:d,borderRadius:l.radius(10),overflow:"hidden",border:i?"3px solid":"2px solid",borderColor:i?"primary":"borderColor",boxShadow:i?"0 0 0 2px var(--chakra-colors-veryLightBackground)":void 0,backgroundImage:`url(${r.image})`,backgroundSize:"cover",backgroundPosition:"center",flexShrink:0,children:!o&&w.jsx(D,{position:"absolute",top:"50%",left:"-4px",right:"-4px",h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r.value):s?w.jsx(D,{...c,position:"relative",p:l.space(0),w:u,h:u,borderRadius:"full",bg:s,border:i?"3px solid":"2px solid",borderColor:i?"primary":"transparent",boxShadow:i?"0 0 0 2px var(--chakra-colors-background)":"inset 0 0 0 0.5px rgba(0,0,0,0.2)",flexShrink:0,children:!o&&w.jsx(D,{position:"absolute",top:"50%",left:"-2px",right:"-2px",h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r.value):w.jsx(D,{...c,px:l.space(2.5),py:l.space(1),minH:a?`${X.minH}px`:void 0,display:a?"flex":"inline-flex",alignItems:"center",justifyContent:"center",minW:0,borderRadius:l.radius(8),border:i?"2px solid":"1px solid",borderColor:i?"primary":"borderColor",bg:i?"primary":"background",children:w.jsx(Z,{fontSize:a?`${X.font}px`:l.font(12),overflow:"hidden",textOverflow:"ellipsis",fontWeight:i?600:400,color:i?"white":"text",textDecoration:o?"none":"line-through",whiteSpace:"nowrap",fontFamily:V,children:r.value})},r.value)},$=_.map((e,t)=>w.jsxs(D,{children:[w.jsxs(Z,{fontSize:a?l.font(12):l.font(11),color:"mutedText",mb:l.space(1.5),fontFamily:V,children:[e.name,y[e.name]?w.jsx(Z,{as:"span",color:"primary",fontWeight:600,children:` · ${y[e.name]}`}):""]}),!a||e.useImages||e.isColor?w.jsx(Y,{gap:l.space(a?X.gap:1.5),wrap:"wrap",children:e.values.map(n=>J(t,e,n))}):w.jsx(D,{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${X.minWidth}px, 1fr))`,gap:l.space(X.gap),children:e.values.map(n=>J(t,e,n))})]},e.name));return a?w.jsx(G,{align:"stretch",gap:l.space(3),w:"full",pt:l.space(1),children:$}):w.jsxs(G,{align:"stretch",gap:l.space(2),w:"full",pt:l.space(1),children:[$,r&&w.jsxs(Y,{justify:"space-between",align:"center",children:[w.jsx(Z,{fontSize:l.font(12),fontWeight:500,color:"text",fontFamily:V,children:p("quantity")}),w.jsxs(Y,{gap:l.space(0),border:"1px solid",borderColor:"borderColor",borderRadius:l.radius(8),overflow:"hidden",children:[w.jsx(I,{variant:"ghost",size:"xs",minW:l.length(30),h:l.length(28),borderRadius:0,color:A<=1?"mutedText":"text",disabled:A<=1||"adding"===k,onClick:()=>E(e=>Math.max(1,e-1)),"aria-label":p("decreaseQuantity"),children:"−"}),w.jsx(Z,{fontSize:l.font(13),fontWeight:600,minW:l.length(28),textAlign:"center",color:"text",fontFamily:V,children:A}),w.jsx(I,{variant:"ghost",size:"xs",minW:l.length(30),h:l.length(28),borderRadius:0,color:A>=10?"mutedText":"text",disabled:A>=10||"adding"===k,onClick:()=>E(e=>Math.min(10,e+1)),"aria-label":p("increaseQuantity"),children:"+"})]})]}),w.jsxs(I,{size:"sm",h:l.length(34),borderRadius:l.radius(8),fontSize:l.font(12),fontWeight:500,bg:"primary",color:"buttonText",gap:l.space(1.5),w:"full",disabled:!F||"adding"===k,loading:"adding"===k,onClick:async()=>{if(!F||"adding"===k)return;if(m&&f&&!O)return j("error"),void z(null);j("adding"),z(null);const t=r?A:1,n=null!=e.id?String(e.id):void 0,a=O?{variant_id:String(O.id),product_id:n,product_name:e.name,quantity:t}:{product_id:n,product_name:e.name,product_url:e.url,selected_options:y,quantity:t},i=xe(e,d);if(i)return void Er(i.href,u);const s=await c(a);"success"===s.type?(j("added"),o?.({selectedLabel:U,quantity:t})):(j("error"),z(ye(s,p)||null))},_hover:{opacity:.92},fontFamily:V,children:[w.jsx(fn,{boxSize:l.length(14)}),"added"===k?`✓ ${p("addedToCart")}`:F?Q&&F?p("addQty").replace("{qty}",String(A)).replace("{price}",Q):p("addToCartButton")+(U?` · ${U}`:"")+K:p("selectOptionsToContinue")]}),"error"===k&&w.jsx(Z,{fontSize:l.font(11),color:"error",fontFamily:V,children:S||p("errorOccurred")})]})},Fr=({src:e,alt:t,height:n,fallbackBg:r,onClick:o})=>{const{ref:a,bgColor:i,transform:s}=function(e){const t=v.useRef(null),[n,r]=v.useState({bgColor:null,transform:null});return v.useEffect(()=>{r({bgColor:null,transform:null});const n=t.current;if(n&&e)return Rr(n,r)},[e]),{ref:t,...n}}(e);return w.jsx(D,{css:{flex:"0 0 100%",scrollSnapAlign:"center"},bg:i||r,borderRadius:"md",overflow:"hidden",cursor:o?"pointer":"default",onClick:o,children:w.jsx(N,{ref:a,src:e,alt:t,w:"full",h:n,objectFit:"contain",borderRadius:"md",crossOrigin:"anonymous",transform:s??void 0,transition:"transform 0.25s ease"})})},Dr=({slides:e,activeColor:t,onColorChange:n,height:r,bgColor:o,alt:a,onImageClick:i})=>{const s=P(),l=v.useRef(null),c=v.useRef(!1),d=v.useRef(!1),u=v.useRef(null),[p,h]=v.useState(0),f=v.useRef(t);f.current=t;const g=v.useRef(e);g.current=e;const m=v.useRef(n);m.current=n;const b=v.useRef(p);b.current=p;const x=e=>{null!=e?.color&&e.color!==f.current&&m.current?.(e.color)},y=(e,t)=>{const n=l.current,r=g.current[e];n&&r&&(c.current=!0,n.scrollTo({left:e*n.clientWidth,behavior:"smooth"}),u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{c.current=!1},450),h(e),t&&x(r))},C=v.useRef(y);C.current=y;const k=v.useRef(t??null);v.useEffect(()=>{if(t===k.current)return;if(k.current=t??null,null==t||d.current)return;const n=e.findIndex(e=>e.color===t);n<0||n===b.current||C.current(n,!1)},[t,e]);const j=e.map(e=>e.id+"\0"+e.src).join("|"),S=v.useRef(null);v.useEffect(()=>{if(S.current===j)return;S.current=j;const e=l.current,t=g.current.findIndex(e=>null!=e.color&&e.color===f.current),n=Math.max(0,t);e&&e.clientWidth>0&&e.scrollTo({left:n*e.clientWidth}),h(n)},[j]),v.useEffect(()=>{const e=l.current;if(!e)return;let t;const n=()=>{if(c.current||0===e.clientWidth)return;const t=Math.round(e.scrollLeft/e.clientWidth),n=g.current[t];n&&(h(t),x(n))},r=()=>{c.current||(d.current=!0,t&&window.clearTimeout(t),t=window.setTimeout(()=>{d.current=!1,n()},160))},o=()=>{t&&window.clearTimeout(t),d.current=!1,n()},a=t=>{if(Math.abs(t.deltaY)<=Math.abs(t.deltaX))return;t.preventDefault();let n=e.parentElement;for(;n;){const e=getComputedStyle(n).overflowY;if(n.scrollHeight>n.clientHeight&&("auto"===e||"scroll"===e))return void n.scrollBy({top:t.deltaY});n=n.parentElement}window.scrollBy({top:t.deltaY})};return e.addEventListener("scroll",r,{passive:!0}),e.addEventListener("scrollend",o),e.addEventListener("wheel",a,{passive:!1}),()=>{e.removeEventListener("scroll",r),e.removeEventListener("scrollend",o),e.removeEventListener("wheel",a),t&&window.clearTimeout(t)}},[]),v.useEffect(()=>()=>{u.current&&window.clearTimeout(u.current)},[]);const z=e=>w.jsx(Ut,{"aria-label":e<0?"Previous image":"Next image",position:"absolute",top:"50%",...e<0?{left:"6px"}:{right:"6px"},transform:"translateY(-50%)",size:"xs",minW:s.length(28),w:s.length(28),h:s.length(28),borderRadius:"full",bg:"rgba(255,255,255,0.92)",color:"text",border:"1px solid",borderColor:"borderColor",boxShadow:"0 1px 4px rgba(0,0,0,0.12)",_hover:{bg:"white"},onClick:t=>{t.stopPropagation(),y(p+e,!0)},children:e<0?w.jsx(pn,{boxSize:s.length(12)}):w.jsx(bn,{boxSize:s.length(12)})});return w.jsxs(D,{position:"relative",w:"full",children:[w.jsx(Y,{ref:l,gap:0,w:"full",css:{overflowX:"auto",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},WebkitOverflowScrolling:"touch"},children:e.map((e,t)=>w.jsx(Fr,{src:e.src,alt:a,height:r,fallbackBg:o,onClick:i?()=>i(t):void 0},e.id))}),e.length>1&&p>0&&z(-1),e.length>1&&p<e.length-1&&z(1),e.length>1&&w.jsx(Y,{position:"absolute",bottom:s.length(6),left:"0",right:"0",justify:"center",gap:1,pointerEvents:"none",children:e.map((e,t)=>w.jsx(D,{w:s.length(5),h:s.length(5),borderRadius:"full",bg:t===p?"primary":"rgba(0,0,0,0.25)",transition:"background 0.2s"},`dot-${e.id}`))})]})},Hr=/colo|couleur|farbe|màu|colore|kleur/i,Pr=({product:e,isDesktop:t=!1,variant:n="default",badgeLabel:r,hideCta:o=!1})=>{const a="hero"===n,i="compact"===n,s=i?80:130,{sendMessage:l,setRepliedProduct:c,botData:d,chatState:u,addToCartDirect:p,isCartBusy:h,productFocusEnabled:f,shortlistEnabled:g,enterFocusMode:m,openVariantModal:b,isShortlisted:x,toggleShortlist:y,rememberCardColour:C,isTestMode:k}=H(),j=P(),S=a?j.length(160):i?j.length(80):j.length(124),{t:z}=q(),A=(e?.currency||d?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",{name:E,price:R,originalPrice:T,discount:_,image:W,id:L,url:M}=e,B=O(d),F="full",U=xe(e,d),Q=null!==U,K=Boolean(e.is_on_sale&&null!=e.sale_price&&e.sale_price>0&&null!=R&&e.sale_price<R),X=K&&e.sale_price?e.sale_price:R,J=K?R:T,$=K&&null!=e.sale_percent_off&&e.sale_percent_off>0?e.sale_percent_off:_,ee=K&&null!=e.sale_amount_off&&e.sale_amount_off>0?e.sale_amount_off:void 0,te=!!J&&!!X&&J>X,ne=K?e.sale_label:void 0,re=e.minimum_quantity&&e.minimum_quantity>1?Math.floor(e.minimum_quantity):void 0,[oe,ae]=v.useState(!1),[ie,se]=v.useState(!1),[le,ce]=v.useState(!1),[de,ue]=v.useState(!1),he=v.useRef(null);v.useEffect(()=>()=>{he.current&&clearTimeout(he.current)},[]);const[fe,ge]=v.useState(!1),be=(e.variant_summary?.options??[]).some(e=>(e.values?.length??0)>1),ye=Bt("colors","background"),ke=Array.isArray(ye)?ye[0]:ye,[je,Se]=v.useState(ke),ze=!0===d?.feature_flags?.disable_image_backdrop?ke:je,[Ae,Ee]=v.useState(null),Re=v.useRef(null),[Te,_e]=v.useState(e.selected_color??null);v.useEffect(()=>{null!=L&&C(String(L),Te)},[L,Te,C]);const We=v.useMemo(()=>{const t=e.variant_summary?.options?.find(e=>Hr.test(e.name||""));return!i&&t&&W&&t.values.some(e=>e.image)?t.values.map(e=>({id:`color:${e.value}`,src:e.image||W,color:e.value})):[]},[e.variant_summary,W,i]),Ie=We.length>1,Le=e.description?.length&&e.description?.length>s;v.useEffect(()=>{const e=Re.current;if(e)return Rr(e,e=>{Se(e.bgColor??ke),Ee(e.transform)})},[W,ke]);const Me=async()=>{if(U)return void Er(U.href,k);if(le)return;ce(!0);const t=pe(M);try{const n=await p({product_id:null!=L?String(L):void 0,product_name:E,product_url:M||void 0,product_handle:t||void 0,quantity:Ce(e),quantity_label:we(e)});if("success"===n.type&&(ue(!0),he.current&&clearTimeout(he.current),he.current=setTimeout(()=>ue(!1),1600)),"failed"===n.type&&"busy"===n.reason)return;if("success"!==n.type){const n=z("addToCartMessage").replace("{product}",E),r=`DORI_INTERNAL_EVENT:add_to_cart_request:${JSON.stringify({product_name:E,product_url:M||null,product_handle:t||null,quantity:e.price_unit?1:re??1})}`;await l({message:n,apiMessage:r})}}finally{ce(!1)}},Be=le||h,Fe=be&&fe,De=x(L),[He,Pe]=v.useState(!1),qe=v.useRef(null);v.useEffect(()=>()=>{qe.current&&clearTimeout(qe.current)},[]);const Oe=f?()=>m(e,`card_body:${n}`):async()=>{if(!M||!d)return;const t=_n(M);ve(e,d,u.threadId),Er(t,k)},Ne=e=>{e.stopPropagation(),U&&Er(U.href,k)},Ye=t=>{t.stopPropagation(),Q?Ne(t):be?b(Te?{...e,selected_color:Te}:e,"card"):Me()};return w.jsxs(G,{gap:j.space(1),children:[w.jsx(D,{bg:"background",borderRadius:i?j.radius(12):j.radius(16),border:"1px solid",borderColor:a?"primary":"borderColor",borderWidth:a?"1.5px":"1px",p:j.space(i?1.5:2),w:"full",transition:"all 0.2s ease",_hover:{borderColor:"primary",transform:"translateY(-1px)"},children:w.jsxs(G,{gap:j.space(i?1.5:2),align:"stretch",children:[w.jsxs(D,{position:"relative",borderRadius:"md",children:[g&&!i&&w.jsx(Ut,{"aria-label":z(De?"removeSaved":"saveForLater"),position:"absolute",top:j.length(6),right:j.length(6),zIndex:2,variant:"ghost",size:"xs",minW:j.length(26),w:j.length(26),h:j.length(26),p:j.space(0),borderRadius:"full",bg:"background",_hover:{bg:"background"},boxShadow:"0 1px 4px rgba(0,0,0,0.18)",color:De?"primary":"mutedText",transform:He?"scale(1.2)":"scale(1)",transition:"transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.15s",css:{"@media (hover: hover)":{"&:hover":{color:"var(--chakra-colors-primary)"}}},onClick:t=>{t.stopPropagation(),y(e),Pe(!0),qe.current&&clearTimeout(qe.current),qe.current=setTimeout(()=>Pe(!1),220)},children:De?w.jsx(mn,{boxSize:j.length(14)}):w.jsx(gn,{boxSize:j.length(14)})}),a&&r&&w.jsx(D,{position:"absolute",top:j.length(6),left:j.length(6),zIndex:1,bg:"primary",color:"buttonText",fontSize:j.font(10),fontWeight:"600",px:j.space(2),py:j.space(.5),borderRadius:j.radius(6),fontFamily:V,boxShadow:"0 1px 3px rgba(0,0,0,0.15)",children:r}),Ie?w.jsx(Dr,{slides:We,activeColor:Te,onColorChange:_e,height:S,bgColor:ze,alt:E,onImageClick:Oe}):w.jsx(D,{cursor:"pointer",onClick:Oe,_hover:{opacity:.9},transition:"all 0.3s ease",bg:ze,borderRadius:"md",overflow:"hidden",children:ie?w.jsx(D,{w:"full",h:S,display:"flex",alignItems:"center",justifyContent:"center",bg:"lightBackground",borderRadius:"md",children:w.jsx(fn,{boxSize:j.length(24),color:"mutedText"})}):w.jsx(N,{ref:Re,src:W,alt:E,w:"full",h:S,objectFit:"contain",borderRadius:"md",crossOrigin:"anonymous",transform:Ae??void 0,transition:"transform 0.25s ease",onError:()=>se(!0)})})]}),w.jsx(Y,{gap:j.space(1),align:"center",w:"full",children:w.jsx(Z,{fontWeight:600,fontSize:i?j.font(11):j.font(12),lineHeight:i?j.lineHeight(18):j.lineHeight(24),color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1,minW:0,title:E,fontFamily:V,cursor:"pointer",onClick:Oe,...f&&{role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),Oe())},"aria-label":z("selectedProduct").replace("{name}",E)},_hover:{color:"primary"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"2px",borderRadius:"4px"},transition:"color 0.2s",children:E})}),!i&&e.description&&w.jsx(D,{borderRadius:j.radius(8),borderLeft:"2px solid",borderLeftColor:"primary",padding:"6px 10px",w:"full",bg:"lightBackground",cursor:"pointer",onClick:Oe,_hover:{bg:"veryLightBackground"},transition:"background-color 0.2s",children:w.jsxs(Z,{fontSize:j.font(12),fontWeight:400,color:"text",lineHeight:j.lineHeight(20),overflow:"hidden",title:e.description,fontFamily:V,children:[Le&&!oe?e.description?.substring(0,s)+"... ":e.description,Le&&!oe&&w.jsx(Z,{as:"span",fontSize:j.font(12),lineHeight:j.lineHeight(4),color:"primary",borderRadius:j.radius(4),flex:1,cursor:"pointer",fontWeight:400,fontFamily:V,onClick:e=>{e.stopPropagation(),ae(!0)},children:z("more")})]})}),w.jsxs(Y,{justify:"space-between",align:"end",cursor:"pointer",onClick:Oe,children:[w.jsxs(G,{gap:j.space(1),align:"start",children:[(te||$||ee)&&w.jsxs(Y,{gap:j.space(1),children:[te&&w.jsx(Z,{fontSize:j.font(12),color:"mutedText",textDecoration:"line-through",fontFamily:V,children:null!=J?me(J,A):null}),($||ee)&&w.jsx(Zt,{bg:"errorBackground",color:"error",fontSize:j.font(12),borderRadius:j.radius(24),title:ne||void 0,children:$?`${$}%`:`-${me(ee??0,A)}`})]}),!!X&&X>0&&w.jsxs(Z,{fontSize:j.font(12),fontWeight:"700",color:"text",fontFamily:V,children:[me(X,A),e.price_unit?w.jsxs(Z,{as:"span",fontSize:j.font(10),fontWeight:500,color:"mutedText",children:[" / ",e.price_unit]}):re?w.jsxs(Z,{as:"span",fontSize:j.font(10),fontWeight:500,color:"mutedText",children:[" ",z("perUnit")]}):null]}),e.price_on_request&&w.jsx(Z,{fontSize:j.font(12),fontWeight:"700",color:"text",fontFamily:V,children:z("priceOnRequest")}),re&&!e.price_unit&&w.jsx(Z,{fontSize:j.font(11),fontWeight:600,color:"mutedText",fontFamily:V,children:z("soldInSetsOf").replace("{count}",String(re))})]}),f&&!i&&w.jsxs(Z,{role:"button",tabIndex:0,fontSize:j.font(11.5),fontWeight:500,color:"mutedText",whiteSpace:"nowrap",flexShrink:0,cursor:"pointer",onClick:t=>{t.stopPropagation(),m(e,"details_button")},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),m(e,"details_button"))},_hover:{color:"primary"},_focusVisible:{outline:"2px solid",outlineColor:"primary",borderRadius:"4px"},fontFamily:V,children:[z("detailsAction")," ›"]})]})]})}),o?null:f?B&&w.jsx(G,{gap:j.space(1),w:F,align:"stretch",children:i?w.jsx(Ut,{variant:"outline",size:"xs",h:j.length(26),color:"primary",borderColor:"borderColor",borderRadius:j.radius(6),borderWidth:"1px",_hover:{bg:"veryLightBackground"},onClick:Ye,disabled:!Q&&!be&&Be,"aria-label":z(Q?U.labelKey:"addToCartButton"),children:w.jsx(fn,{boxSize:j.length(14)})}):w.jsxs(I,{variant:"solid",size:"xs",h:j.length(36),fontSize:j.font(13),bg:"primary",color:"buttonText",borderRadius:j.radius(10),w:"full",fontWeight:600,onClick:Ye,disabled:!Q&&!be&&(Be||de),loading:!Q&&!be&&Be,_hover:{opacity:.9},fontFamily:V,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[Q?null:w.jsx(fn,{boxSize:j.length(15)}),Q?z(U.labelKey):be?z("addToCartFull"):de?`✓ ${z("addedToCart")}`:z(Be?"addToCartAdding":"addToCartFull")]})}):w.jsxs(G,{gap:j.space(1),w:F,align:"stretch",children:[w.jsxs(Y,{gap:j.space(.5),children:[w.jsx(Ut,{variant:"outline",size:"xs",h:i?j.length(26):j.length(30),fontSize:j.font(12),color:"primary",borderColor:"borderColor",borderRadius:j.radius(4),_hover:{bg:"veryLightBackground"},borderWidth:"1px",onClick:()=>{c({product:e,suggestions:[z("doesProductHaveDiscount"),z("whatFeaturesSpecial"),z("otherColorsAvailable")]})},"aria-label":"Reply to product",children:w.jsx(an,{boxSize:i?j.length(14):j.length(16)})}),!i&&w.jsxs(I,{variant:"outline",size:"xs",h:j.length(30),fontSize:j.font(12),color:"primary",borderRadius:j.radius(4),flex:1,fontWeight:400,onClick:()=>{const e=`${z("doYouHaveSimilar")} ${E}`;l({message:e,apiMessage:`${e} (product id: ${L})`})},_hover:{bg:"veryLightBackground"},borderColor:"borderColor",fontFamily:V,whiteSpace:"nowrap",minW:0,overflow:"hidden",textOverflow:"ellipsis",children:[w.jsx(sn,{boxSize:j.length(16)}),z("similar")]}),!i&&B&&w.jsxs(I,{variant:"outline",size:"xs",h:j.length(30),fontSize:j.font(12),color:"primary",borderRadius:t?"4px":"6px",flex:1,minW:0,fontWeight:400,onClick:Q?Ne:be?()=>ge(e=>!e):Me,disabled:!Q&&!be&&Be,loading:!Q&&!be&&Be,_hover:{bg:"veryLightBackground"},borderColor:"borderColor",fontFamily:V,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[Q?null:Fe?w.jsx(tn,{boxSize:j.length(11)}):w.jsx(fn,{boxSize:j.length(16)}),z(Q?U.labelKey:Fe?"close":Be?"addToCartAdding":"addToCartButton")]})]}),fe&&be&&!Q&&w.jsx(Br,{product:e,selectedColor:Te,onColorChange:_e})]})]})},qr=({index:e,delay:t=70,children:n})=>{const[r,o]=v.useState(!1);return v.useEffect(()=>{const n=setTimeout(()=>o(!0),e*t);return()=>clearTimeout(n)},[e,t]),w.jsx(D,{opacity:r?1:0,transform:r?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:n})},Or=({products:e,isDesktop:t})=>w.jsx(Jt,{dir:"ltr",columns:t?2:1,gapX:t?2:1,gapY:t?4:2,w:"full",children:e.map((e,n)=>w.jsx(qr,{index:n,children:w.jsx(Pr,{product:e,isDesktop:t})},e.id))});function Nr(e){return e.is_on_sale&&null!=e.sale_price&&e.sale_price>0&&null!=e.price&&e.sale_price<e.price&&e.sale_price?e.sale_price:e.price}const Yr=({product:e,index:t,isLast:n,isDesktop:r,delay:o,status:a,cardVariant:i,hideCardCta:s,onRemove:l})=>{const c=P(),[d,u]=v.useState(!1),{t:p}=q();v.useEffect(()=>{const e=setTimeout(()=>u(!0),o);return()=>clearTimeout(e)},[o]);const h=e.step_label?e.step_label.replace(/^\S+\s*\d+\s*[:.\-]\s*/i,"").trim()||e.step_label:null;return w.jsx(D,{opacity:d?1:0,transform:d?"translateY(0)":"translateY(10px)",transition:"opacity 0.35s ease-out, transform 0.35s ease-out",children:w.jsxs(Y,{align:"stretch",gap:c.space(0),children:[w.jsxs(G,{align:"center",gap:c.space(0),w:c.length(28),flexShrink:0,children:[w.jsx(D,{w:c.length(28),h:c.length(28),borderRadius:"full",bg:"primary",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,children:"adding"===a?w.jsx(J,{size:"xs",color:"buttonText"}):w.jsx(Z,{fontSize:c.font(12),fontWeight:"700",color:"buttonText",lineHeight:"1",children:"added"===a?"✓":t+1})}),!n&&w.jsx(D,{flex:1,w:"2px",bg:"borderColor",minH:c.length(8),opacity:d?1:0,transition:"opacity 0.3s ease-out 0.2s"})]}),w.jsxs(G,{align:"stretch",gap:c.space(1.5),flex:1,minW:0,pl:c.space(2.5),pb:n?0:3,children:[w.jsxs(Y,{justify:"space-between",align:"center",minH:c.length(28),children:[h?w.jsx(Z,{fontSize:c.font(13),fontWeight:"600",color:"text",fontFamily:V,pt:c.space(.5),children:h}):w.jsx(D,{}),w.jsxs(Y,{gap:c.space(0),align:"center",children:["failed"===a&&w.jsx(Z,{fontSize:c.font(11),color:"red.500",fontFamily:V,pr:c.space(1.5),children:p("stepAddFailed")}),"added"!==a&&w.jsx(D,{as:"button","aria-label":p("removeProduct"),onClick:l,color:"mutedText",cursor:"pointer",w:c.length(28),h:c.length(28),display:"flex",alignItems:"center",justifyContent:"center",borderRadius:c.radius(6),_hover:{color:"text",bg:"veryLightBackground"},children:w.jsx(tn,{boxSize:c.length(10)})})]})]}),w.jsx(Pr,{product:e,isDesktop:r,variant:i,hideCta:s})]})]})})};function Vr(e,t){const n=e.external_product_id?String(e.external_product_id):null;return t.some(t=>n&&null!=t.product_id&&String(t.product_id)===n||!!e.name&&!!t.product_title&&t.product_title===e.name)}const Zr={single_pick:({products:e,isDesktop:t})=>{const n=P(),r=e[0],o=e.slice(1,3),{t:a}=q(),[i,s]=v.useState(!1),[l,c]=v.useState(!1);return v.useEffect(()=>{const e=requestAnimationFrame(()=>s(!0)),t=o.length>0?setTimeout(()=>c(!0),300):void 0;return()=>{cancelAnimationFrame(e),t&&clearTimeout(t)}},[o.length]),r?w.jsxs(G,{gap:n.space(3),w:"full",align:"stretch",children:[w.jsx(D,{opacity:i?1:0,transform:i?"translateY(0)":"translateY(8px)",transition:"opacity 0.35s ease-out, transform 0.35s ease-out",children:w.jsx(Pr,{product:r,isDesktop:t,variant:"hero",badgeLabel:a("topPick")})}),o.length>0&&w.jsxs(D,{opacity:l?1:0,transform:l?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:[w.jsx(Z,{fontSize:n.font(11),fontWeight:500,color:"mutedText",fontFamily:V,mb:n.space(2),px:n.space(1),children:a("alsoConsider")}),w.jsx(Jt,{dir:"ltr",columns:1===o.length?1:2,gapX:n.space(2),gapY:n.space(2),w:"full",children:o.map(e=>w.jsx(D,{children:w.jsx(Pr,{product:e,isDesktop:t,variant:1===o.length?"default":"compact"})},e.id))})]})]}):null},shortlist:({products:e,isDesktop:t})=>{const{t:n}=q();return w.jsx(G,{gap:3,w:"full",align:"stretch",children:e.map((e,r)=>w.jsx(qr,{index:r,delay:120,children:w.jsx(Pr,{product:e,isDesktop:t,variant:0===r?"hero":"default",badgeLabel:0===r?n("topPick"):void 0})},e.id))})},routine:({products:e,isDesktop:t})=>{const n=P(),{botData:r,addToCartDirect:o,isCartBusy:a,cartItemCount:i}=H(),{t:s}=q(),[l,c]=v.useState({}),[d,u]=v.useState({}),[p,h]=v.useState({}),[f,g]=v.useState(!1);v.useEffect(()=>{if(!O(r))return;let t=!1;return(async()=>{const n=await ke();if(t||!n)return;const r={};for(const t of e)Vr(t,n.items||[])&&(r[t.id]=!0);h(r)})(),()=>{t=!0}},[r,e,i]);const m=e=>p[e.id]?"added":d[e.id]??"idle",b=e.filter(e=>!l[e.id]&&null===xe(e,r)),x=b.filter(e=>"added"!==m(e)),y=b.length>0&&0===x.length,C=x.every(e=>Number.isFinite(Nr(e))&&Nr(e)>0),k=b[0]?.currency||r?.currency,j=b.reduce((e,t)=>e+Nr(t),0),S=x.reduce((e,t)=>e+Nr(t),0),z=b.every(e=>Number.isFinite(Nr(e))&&Nr(e)>0),A=O(r)&&b.length>=2&&b.every(e=>!function(e){return(e.variant_summary?.options??[]).some(e=>(e.values?.length??0)>1)}(e)),E=f?s("addingRoutine"):y?`✓ ${s("addedToCart")}`:C?`${s("addRoutine")} · ${me(S,k)}`:s("addRoutine");return w.jsxs(G,{gap:n.space(0),w:"full",align:"stretch",children:[w.jsxs(Y,{justify:"space-between",align:"baseline",mb:n.space(1.5),pl:n.length(38),children:[w.jsx(Z,{fontSize:n.font(13),fontWeight:"700",color:"text",fontFamily:V,children:s("routineTitle")}),z&&b.length>=2&&w.jsx(Z,{fontSize:n.font(13),fontWeight:"700",color:"text",fontFamily:V,children:me(j,k)})]}),e.map((e,r)=>{if(l[e.id])return w.jsxs(Y,{pl:n.length(38),pb:n.space(2),gap:n.space(2),align:"center",children:[w.jsx(Z,{fontSize:n.font(12),color:"mutedText",fontFamily:V,textDecoration:"line-through",lineClamp:1,minW:0,children:e.name}),w.jsx(Z,{fontSize:n.font(12),color:"mutedText",fontFamily:V,children:s("stepRemoved")}),w.jsx(D,{as:"button",onClick:()=>c(t=>{const n={...t};return delete n[e.id],n}),color:"primary",fontSize:n.font(12),fontWeight:"600",cursor:"pointer",fontFamily:V,px:n.space(2),h:n.length(24),children:s("undo")})]},e.id);const o=b.findIndex(t=>t.id===e.id);return w.jsx(Yr,{product:e,index:o,isLast:o===b.length-1,isDesktop:t,delay:200*r,status:m(e),cardVariant:A?"compact":"default",hideCardCta:A,onRemove:()=>c(t=>({...t,[e.id]:!0}))},e.id)}),A&&w.jsx(I,{mt:n.space(2.5),ml:n.length(38),size:"sm",h:n.length(36),fontSize:n.font(13),fontWeight:"600",bg:y?"veryLightBackground":"primary",color:y?"text":"white",borderRadius:n.radius(8),fontFamily:V,onClick:async()=>{if(!f&&!a&&0!==x.length){g(!0);try{const e=[...x];for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;if(u(e=>({...e,[n.id]:"adding"})),"success"!==(await o({product_id:null!=n.id?String(n.id):void 0,product_name:n.name,product_url:n.url||void 0,product_handle:pe(n.url)||void 0,quantity:Ce(n),quantity_label:we(n)},{deferCartEffects:!r})).type)return void u(e=>({...e,[n.id]:"failed"}));u(e=>({...e,[n.id]:"added"}))}}finally{g(!1)}}},disabled:f||a||y,loading:f,_hover:y?{}:{opacity:.9},children:E})]})},explore:Or},Ur=({products:e,shape:t="explore"})=>{const{chatState:n,botData:r,isTestMode:i}=H(),s=v.useRef(new Set),l=v.useRef(null),[c,d]=v.useState(!1),u=v.useCallback(()=>{l.current&&d(l.current.offsetWidth>=600)},[]);v.useEffect(()=>{u();const e=new ResizeObserver(u);return l.current&&e.observe(l.current),()=>e.disconnect()},[u]),v.useEffect(()=>{if(i)return;const t=ze.SHOPIFY;if(!n.threadId)return;const l=r?.sharing_id||o();if(!l)return;const c=a(),d=[];if(e.forEach(e=>{const t=e.external_product_id;t&&(s.current.has(t)||(s.current.add(t),d.push(t)))}),d.length>0){const e=window.DORI_CUSTOMER_ID,r=null!=e?String(e):void 0,o=je();Se(d,n.threadId||"",c,t,l,void 0,r,o)}},[e,t,n.threadId,r?.sharing_id,r?.assistant_id,i]);const p=v.useRef(null),h=v.useRef(!1);v.useEffect(()=>{if(i)return;const o=p.current;if(!o||h.current)return;const a=e.map(e=>e.external_product_id).filter(e=>Boolean(e)).slice(0,12);if(0===a.length)return;const s=new IntersectionObserver(o=>{for(const i of o)i.isIntersecting&&!h.current&&(h.current=!0,Ae("recommendation_seen",{assistantId:r?.assistant_id,threadId:n.threadId,payload:{set_id:a.join(","),shape:t,count:e.length,product_ids:a}}),s.disconnect())},{threshold:0});return s.observe(o),()=>s.disconnect()},[e,t,i,r?.assistant_id,n.threadId]);const f=Zr[t]||Or;return w.jsxs(G,{ref:l,align:"stretch",gap:2,w:"full",children:[w.jsx(D,{ref:p,h:"1px",w:"full","aria-hidden":!0}),w.jsx(D,{px:1,w:"full",children:w.jsx(f,{products:e,isDesktop:c})})]})},Qr=({index:e,children:t})=>{const[n,r]=v.useState(!1);return v.useEffect(()=>{const t=setTimeout(()=>r(!0),70*e);return()=>clearTimeout(t)},[e]),w.jsx(D,{opacity:n?1:0,transform:n?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:t})},Kr=({suggestions:e,options:t=!1})=>{const n=P(),{sendMessage:r,focusModeProduct:o}=H(),{visible:a,asOptions:i}=Ee(e,{options:t,focusMode:!!o});return w.jsx(Xt,{direction:"row",wrap:"wrap",gap:n.space(2),maxW:"full",alignSelf:"flex-start",children:a.map((e,t)=>w.jsx(Qr,{index:t,children:w.jsxs(I,{bg:"background",border:"1px solid",borderColor:"borderColor",borderRadius:n.radius(18),px:n.space(3.5),h:"auto",lineHeight:"1.4",py:n.space(2),onClick:()=>(e=>{r({message:e})})(e),_hover:{bg:"lightBackground",borderColor:"primary"},_active:{bg:"veryLightBackground"},textAlign:"start",justifyContent:"flex-start",gap:n.space(1.5),w:"auto",maxW:"100%",children:[!i&&w.jsx(ln,{boxSize:n.length(13),color:"primary",flexShrink:0}),w.jsx(Z,{fontSize:{base:n.font(14),md:n.font(13)},fontWeight:"500",color:"text",textAlign:"start",wordBreak:"break-word",whiteSpace:"normal",lineClamp:2,children:e})]})},t))})},Gr=()=>{const e=P(),{botData:t}=H(),{t:n}=q(),r=!0===t?.hide_checkout_button;return w.jsxs(Y,{mt:e.space(3),gap:e.space(2),justify:"flex-start",children:[w.jsxs(I,{size:"xs",variant:"outline",borderColor:"borderColor",color:"mutedText",fontSize:e.font(12),fontWeight:"500",borderRadius:e.radius(24),h:"auto",px:e.space(3),py:e.space(1.5),onClick:()=>{if(!U()){const e=`${Q()}cart`;window.open(e,"_blank","noopener,noreferrer")||(window.location.href=e)}},_hover:{borderColor:"primary"},children:[w.jsx(fn,{boxSize:e.length(14)}),n("cartViewCart")]}),!r&&w.jsxs(I,{size:"xs",variant:"solid",bg:"primary",color:"buttonText",fontSize:e.font(12),fontWeight:"500",borderRadius:e.radius(24),h:"auto",px:e.space(3),py:e.space(1.5),onClick:()=>{Re()},_hover:{opacity:.85},children:[n("cartCheckout"),w.jsx(bn,{boxSize:e.length(14)})]})]})},Xr=({add:e})=>{const t=P(),{botData:n,chatState:r}=H(),{t:o}=q(),a=e?.cart??null,i=(a?.currency||n?.currency||"USD").split(" - ")[0]?.trim().toUpperCase(),s=e=>me(e/100,i),l=a?.added??null,c=l?.name||e?.product_name||null,d=l?.variant_title??null,u=l?.quantity??e?.quantity??null,p=null!=l?.unit_price&&null!=u?l.unit_price*u:null,h=null!=p?s(p):null,f=a?.others??[],g=e=>[e.variant_title,e.quantity>1?`x${e.quantity}`:null,null!=e.line_price?s(e.line_price):null].filter(Boolean).join(" · ");return w.jsx(D,{mt:t.space(3),border:"1.5px solid",borderColor:"borderColor",borderRadius:t.radius(14),p:t.space(3.5),bg:"background",w:"full",maxW:t.length(360),boxShadow:"0 1px 6px rgba(0, 0, 0, 0.05)",children:w.jsxs(G,{align:"stretch",gap:t.space(2.5),children:[w.jsxs(Y,{gap:t.space(1.5),children:[w.jsx(nn,{boxSize:t.length(16),color:"primary"}),w.jsx(Z,{fontSize:t.font(13),fontWeight:700,color:"primary",fontFamily:V,children:o("addedToCart")})]}),c&&w.jsxs(Y,{gap:t.space(2.5),align:"center",children:[l?.image?w.jsx(N,{src:l.image,alt:c,w:t.length(48),h:t.length(48),objectFit:"cover",borderRadius:t.radius(8),flexShrink:0,bg:"lightBackground"}):w.jsx(D,{w:t.length(48),h:t.length(48),borderRadius:t.radius(8),flexShrink:0,bg:"lightBackground",display:"flex",alignItems:"center",justifyContent:"center",children:w.jsx(fn,{boxSize:t.length(18),color:"mutedText"})}),w.jsxs(D,{minW:0,flex:1,children:[w.jsx(Z,{fontSize:t.font(13),fontWeight:600,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:V,children:c}),w.jsx(Z,{fontSize:t.font(12),color:"mutedText",fontFamily:V,children:[d,u&&u>1?`x${u}`:null,h].filter(Boolean).join(" · ")})]})]}),f.map((e,n)=>w.jsxs(Y,{gap:t.space(2.5),align:"center",opacity:.75,children:[e.image?w.jsx(N,{src:e.image,alt:e.title||"",w:t.length(32),h:t.length(32),objectFit:"cover",borderRadius:t.radius(6),flexShrink:0,bg:"lightBackground"}):w.jsx(D,{w:t.length(32),h:t.length(32),borderRadius:t.radius(6),flexShrink:0,bg:"lightBackground",display:"flex",alignItems:"center",justifyContent:"center",children:w.jsx(fn,{boxSize:t.length(14),color:"mutedText"})}),w.jsxs(D,{minW:0,flex:1,children:[w.jsx(Z,{fontSize:t.font(12),fontWeight:500,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:V,children:e.title}),w.jsx(Z,{fontSize:t.font(11),color:"mutedText",fontFamily:V,children:g(e)})]})]},n)),!!a?.hidden_line_count&&a.hidden_line_count>0&&w.jsx(Z,{fontSize:t.font(11),color:"mutedText",fontFamily:V,children:o("cartMoreItems").replace("{count}",String(a.hidden_line_count))}),a&&a.item_count>0&&w.jsx(Z,{fontSize:t.font(12),fontWeight:600,color:"text",borderTop:"1px solid",borderColor:"borderColor",pt:t.space(2),fontFamily:V,children:o(1===a.item_count?"cartLineOne":"cartLine").replace("{count}",String(a.item_count)).replace("{total}",s(a.total_price))}),w.jsxs(Y,{gap:t.space(2),children:[w.jsxs(I,{size:"sm",flex:1,variant:"outline",borderColor:"borderColor",color:"text",fontSize:t.font(13),fontWeight:"600",borderRadius:t.radius(10),h:t.length(38),onClick:()=>{if(Ae("closer_action_clicked",{assistantId:n?.assistant_id,threadId:r.threadId,payload:{action:"view_cart"}}),!U()){const e=`${Q()}cart`;window.location.href=e}},_hover:{borderColor:"primary"},children:[w.jsx(fn,{boxSize:t.length(13)}),o("cartViewCart")]}),!0!==n?.hide_checkout_button&&w.jsxs(I,{size:"sm",flex:1,variant:"solid",bg:"primary",color:"buttonText",fontSize:t.font(13),fontWeight:"600",borderRadius:t.radius(10),h:t.length(38),onClick:()=>{Ae("closer_action_clicked",{assistantId:n?.assistant_id,threadId:r.threadId,payload:{action:"checkout"}}),Re()},_hover:{opacity:.85},children:[o("cartCheckout"),w.jsx(bn,{boxSize:t.length(13)})]})]})]})})},Jr=({onSubmit:e,onClose:t,existingText:n})=>{const r=P(),[o,a]=v.useState(n||""),[i,s]=v.useState(!1);return v.useEffect(()=>{a(n||"")},[n]),w.jsx(D,{mt:r.space(2),bg:"background",borderRadius:r.radius(10),p:r.space(3),borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",maxW:r.length(280),children:w.jsxs(G,{gap:r.space(3),align:"stretch",children:[w.jsxs(G,{gap:r.space(.5),align:"start",children:[w.jsx(Z,{fontSize:r.font(13),fontWeight:"600",color:"text",lineHeight:"1.4",children:"Tell us what was wrong"}),w.jsx(Z,{fontSize:r.font(11),color:"mutedText",lineHeight:"1.4",children:"Your comment is optional and helps us improve responses."})]}),w.jsx(en,{value:o,onChange:e=>a(e.target.value),placeholder:"Describe what you expected...","aria-label":"Describe what you expected",rows:3,fontSize:r.font(12),resize:"none",borderColor:"borderColor",borderRadius:r.radius(8),p:r.space(2),bg:"lightBackground",color:"text",autoFocus:!0,_placeholder:{color:"mutedText"},_focus:{outline:"none",borderColor:"primary",boxShadow:"none"}}),w.jsxs(Y,{gap:r.space(2),justify:"flex-end",children:[w.jsx(I,{size:"sm",variant:"ghost",onClick:t,disabled:i,fontSize:r.font(12),color:"mutedText",px:r.space(3),h:r.length(30),_hover:{bg:"lightBackground"},children:"Cancel"}),w.jsx(I,{size:"sm",variant:"outline",onClick:async()=>{s(!0),await e(void 0),s(!1)},disabled:i,fontSize:r.font(12),color:"text",borderColor:"borderColor",px:r.space(3),h:r.length(30),children:"No Comment"}),w.jsx(I,{size:"sm",onClick:async()=>{s(!0),await e(o.trim()||void 0),s(!1)},disabled:i,fontSize:r.font(12),bg:"primary",color:"buttonText",px:r.space(3),h:r.length(30),borderRadius:r.radius(8),_hover:{opacity:.85},children:i?"Submitting...":"Submit"})]})]})})},$r=({messageIndex:e,feedback:t})=>{const n=P(),{submitFeedback:r}=H(),[o,a]=v.useState(!1),i="like"===t?.rating,s="dislike"===t?.rating;return w.jsxs(D,{mt:n.space(1.5),children:[w.jsxs(Y,{gap:n.space(1.5),align:"center",children:[w.jsx(D,{as:"button",onClick:async()=>{i||(await r(e,"like"),a(!1))},display:"flex",alignItems:"center",justifyContent:"center",w:n.length(36),h:n.length(36),borderRadius:n.radius(8),bg:i?"primary":"lightBackground",borderWidth:"1px",borderStyle:"solid",borderColor:i?"primary":"borderColor",cursor:"pointer",title:"This response was helpful","aria-label":"This response was helpful",_hover:{opacity:.85,transform:"translateY(-1px)"},_active:{transform:"scale(0.95)"},transition:"all 0.15s",children:w.jsx(Z,{fontSize:n.font(16),lineHeight:"1",children:"👍"})}),w.jsx(D,{as:"button",onClick:()=>{a(!0)},display:"flex",alignItems:"center",justifyContent:"center",w:n.length(36),h:n.length(36),borderRadius:n.radius(8),bg:s?"red.500":"lightBackground",borderWidth:"1px",borderStyle:"solid",borderColor:s?"red.500":"borderColor",cursor:"pointer",title:"This response wasn't helpful","aria-label":"This response wasn't helpful",_hover:{opacity:.85,transform:"translateY(-1px)"},_active:{transform:"scale(0.95)"},transition:"all 0.15s",children:w.jsx(Z,{fontSize:n.font(16),lineHeight:"1",children:"👎"})})]}),t?.feedbackText&&w.jsxs(D,{mt:n.space(1),px:n.space(2.5),py:n.space(2),bg:"lightBackground",borderRadius:n.radius(8),borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",maxW:n.length(280),children:[w.jsx(Z,{fontSize:n.font(10),color:"mutedText",lineHeight:"1.2",fontWeight:"600",textTransform:"uppercase",mb:n.space(1),children:"Submitted Feedback"}),w.jsx(Z,{fontSize:n.font(11),color:"mutedText",lineHeight:"1.4",children:t.feedbackText})]}),o&&w.jsx(D,{maxW:n.length(280),children:w.jsx(Jr,{onSubmit:async t=>{await r(e,"dislike",t),a(!1)},onClose:()=>{a(!1)},existingText:t?.feedbackText})})]})},eo=({variant:e,children:t,textSize:n={base:"15px",md:"14px"}})=>{const r=P(),o=Te(r,n);return"user"===e?w.jsx(Z,{wordBreak:"break-word",fontSize:r.font(14),fontWeight:"500",color:"text",fontFamily:V,whiteSpace:"pre-wrap",children:t}):w.jsx(Z,{fontSize:o,fontWeight:"400",color:"text",textAlign:"left",lineHeight:"1.6",whiteSpace:"pre-wrap",children:t})},to=(no=()=>l(()=>import("./MarkdownContent-C15ck6xJ.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),ro=eo,oo="markdown",F.lazy(()=>i(no,ro,(e,t)=>{console.warn(`[Dori] chunk "${oo}" failed twice, rendering plain fallback`,e,t);try{s(t instanceof Error?t:new Error(String(t)),{chunk:oo,degraded:!0})}catch{}})));var no,ro,oo;const ao=({message:e,isStreaming:t=!1,doriMessageIndex:n,isAfterProducts:r=!1})=>{const o=P(),{isTestMode:a,enterFocusMode:i,productFocusEnabled:s}=H(),l=Bt("colors","primary"),c=oe(l),d=function(e){const t=Date.now()-new Date(e).getTime()<2e3,[n,r]=v.useState(!t);return v.useEffect(()=>{if(!t)return;const e=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(e)},[t]),n}(e.timestamp),u=function(e,t){const n=v.useRef(e),r=v.useRef(t?0:e.length),[o,a]=v.useState(t?"":e),i=v.useRef(null),s=v.useRef(t);n.current=e,s.current=t;const l=v.useCallback(()=>{const e=n.current,t=e.length-r.current;if(t<=0||!s.current)return void(i.current=null);const o=Math.max(1,Math.ceil(.12*t));r.current=Math.min(e.length,r.current+o),a(e.slice(0,r.current)),r.current<e.length?i.current=requestAnimationFrame(l):i.current=null},[]),c=v.useCallback(()=>{null===i.current&&(i.current=requestAnimationFrame(l))},[l]),d=v.useCallback(()=>{null!==i.current&&(cancelAnimationFrame(i.current),i.current=null)},[]);return v.useEffect(()=>(t?r.current<e.length&&c():(d(),r.current=e.length,a(e)),d),[t]),v.useEffect(()=>{t&&r.current<e.length&&c()},[e,t,c]),o}(e.content,t);if("welcome"===e.type)return w.jsx(Ar,{message:e.content});if("loading"===e.type)return e.content&&w.jsx(Ar,{message:e.content,type:"loading"});if("user"===e.type)return w.jsxs(D,{maxW:o.length(220),alignSelf:"flex-end",mb:o.space(2),children:[e.imageUrl&&w.jsx(D,{w:o.length(120),h:o.length(120),mb:o.space(2),borderRadius:o.radius(12),background:c,children:w.jsx(N,{src:e.imageUrl,alt:"Uploaded image",w:"100%",h:"100%",borderRadius:o.radius(12),objectFit:"cover"})}),(e.content.length>0||e.repliedProduct)&&w.jsxs(G,{bg:"lightBackground",borderRadius:o.radius(24),px:o.space(3),py:o.space(2),gap:o.space(2),alignItems:"start",w:"full",borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",children:[e.repliedProduct&&(()=>{const t=e.repliedProduct,n=s&&null!=t.id,r=()=>i(t,"replied_chip");return w.jsxs(Y,{bg:"background",borderRadius:o.radius(12),p:o.space(2),gap:o.space(2),w:"full",...n&&{role:"button",tabIndex:0,cursor:"pointer","aria-label":t.name,onClick:e=>{e.stopPropagation(),r()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r())},_hover:{bg:"veryLightBackground"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"1px"},transition:"background 0.15s"},children:[w.jsx(N,{src:t.image,alt:"product",w:o.length(40),h:o.length(40),objectFit:"cover",borderRadius:o.radius(8)}),w.jsx(Z,{fontSize:o.font(12),fontWeight:"400",color:"text",children:t.name})]})})(),w.jsx(v.Suspense,{fallback:w.jsx(eo,{variant:"user",children:e.content}),children:w.jsx(to,{variant:"user",children:e.content})})]})]});if("products"===e.type)return w.jsx(D,{maxW:"100%",alignSelf:"flex-start",mb:o.space(4),w:"full",opacity:d?1:0,transform:d?"translateY(0)":"translateY(4px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:w.jsx(Ur,{products:e.products||[],shape:e.shape})});if("suggestions"===e.type)return w.jsx(Kr,{suggestions:e.suggestions||[],options:e.optionChips});if("follow_up"===e.type&&e.followUp)return w.jsx(We,{message:e});if("handover"===e.type&&e.handover)return w.jsx(Ie,{message:e});if("team"===e.type)return w.jsx(Le,{message:e});if("handover_event"===e.type&&e.handoverEvent)return w.jsx(Me,{message:e});if("dori"===e.type&&!e.content?.trim()&&!t&&!e.showCartSummary)return null;const p="undefined"!=typeof document&&"true"===document.querySelector("script#dori-side-widget")?.getAttribute("data-hide-ratings"),h=a&&!p&&"dori"===e.type&&!t,f=Te(o,r&&!t?{base:"14px",md:"13px"}:{base:"15px",md:"14px"});return w.jsxs(G,{align:"stretch",gap:o.space(2),opacity:d?1:0,transform:d?"translateY(0)":"translateY(4px)",transition:"opacity 0.25s ease-out, transform 0.25s ease-out",children:[(!!u?.trim()||t)&&w.jsx(D,{w:"full",alignSelf:"flex-start",children:w.jsx(v.Suspense,{fallback:w.jsx(eo,{variant:"dori",textSize:f,children:u}),children:w.jsx(to,{variant:"dori",textSize:f,children:u})})}),e.showCartSummary?w.jsx(Xr,{add:e.closerAdd}):e.showCartActions&&w.jsx(Gr,{}),h&&void 0!==n&&w.jsx($r,{messageIndex:n,feedback:e.feedback})]})},io=e=>w.jsx(_e,{label:"message",fallback:e.message?.content?w.jsx(eo,{variant:"user"===e.message.type?"user":"dori",children:e.message.content}):null,children:w.jsx(ao,{...e})}),so=({product:e,messages:t})=>{const n=P(),{enterFocusMode:r}=H(),{t:o}=q(),a=t.filter(e=>"user"===e.type||"products"===e.type||"dori"===e.type&&(!!e.content?.trim()||e.showCartSummary)).length,i=1===a?o("productChatMessageOne"):o("productChatMessages").replace("{count}",String(a)),s=()=>r(e,"chat_card");return w.jsxs(Y,{role:"button",tabIndex:0,"aria-label":`${e.name} · ${i}`,onClick:s,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s())},mt:n.space(1),mb:n.space(1),px:n.space(3),py:n.space(2.5),gap:n.space(2.5),align:"center",border:"1.5px solid",borderColor:"borderColor",borderRadius:n.radius(14),bg:"background",cursor:"pointer",_hover:{borderColor:"primary"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"1px"},transition:"border-color 0.15s",children:[e.image&&w.jsx(N,{src:e.image,alt:"",w:n.length(36),h:n.length(36),objectFit:"cover",borderRadius:n.radius(8),flexShrink:0,bg:"lightBackground"}),w.jsxs(D,{minW:0,flex:1,children:[w.jsx(Z,{fontSize:n.font(12.5),fontWeight:600,color:"text",lineHeight:"1.3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:V,children:e.name}),w.jsxs(Z,{fontSize:n.font(11),color:"mutedText",fontFamily:V,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[o("productChatLabel")," · ",i]})]}),w.jsx(bn,{boxSize:n.length(13),color:"mutedText",flexShrink:0})]})},lo=["product_click","add_to_cart","exit_intent"];function co(e){const t=(e?.fields??[]).filter(e=>"phone"===e||"email"===e);return Array.from(new Set(t))}const uo="dori-lead-settled-",po="dori-lead-asks-";function ho(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch{return null}}function fo(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch{}}function go(e){e&&fo(`${uo}${e}`,"1")}function mo(e){if(!e)return 0;const t=Number.parseInt(ho(`${po}${e}`)??"",10);return Number.isFinite(t)&&t>0?t:0}const bo=e=>/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e.trim()),xo=({threadId:e,fields:t,rule:n,message:r,note:o,onSettled:a})=>{const i=P(),{isMobile:s}=ee(),{t:l}=q(),[c,d]=v.useState(!1),[u,p]=v.useState({phone:"",email:""}),[h,f]=v.useState(!1),[g,m]=v.useState(!1);v.useEffect(()=>{const e=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(e)},[]),v.useEffect(()=>{if(!g)return;const e=setTimeout(a,2500);return()=>clearTimeout(e)},[g,a]);const b=v.useMemo(()=>{return{phone:t.includes("phone")&&(e=u.phone,(e.match(/\d/g)||[]).length>=6)?u.phone:void 0,email:t.includes("email")&&bo(u.email)?u.email:void 0};var e},[t,u]),x=Boolean(b.phone||b.email),y=async()=>{!h&&x&&(f(!0),go(e),await Fe(e,{...b,trigger:n.trigger}),f(!1),m(!0))},C=e=>l("phone"===e?"leadPromptPhonePlaceholder":"leadPromptEmailPlaceholder");return w.jsx(D,{flexShrink:0,opacity:c?1:0,transform:c?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",borderWidth:"1px",borderColor:"border",borderRadius:i.radius(10),bg:"veryLightBackground",px:i.space(2.5),py:i.space(2),"data-dori-lead-capture":n.trigger,children:g?w.jsx(Z,{fontSize:i.font(12),color:"text",fontFamily:V,children:l("leadPromptSaved")}):w.jsxs(G,{align:"stretch",gap:i.space(1.5),children:[w.jsx(Z,{fontSize:i.font(12),lineHeight:"1.35",color:"text",fontFamily:V,children:n.message||r||l("leadPromptText")}),w.jsxs(Y,{gap:i.space(1.5),wrap:"wrap",align:"center",children:[t.map(e=>w.jsx(Be,{value:u[e],onChange:t=>p(n=>({...n,[e]:t.target.value})),onKeyDown:e=>{"Enter"===e.key&&y()},placeholder:C(e),"aria-label":C(e),type:"phone"===e?"tel":"email",inputMode:"phone"===e?"tel":"email",autoComplete:"phone"===e?"tel":"email",fontSize:s?X(i,16):i.font(13),color:"text",bg:"background",borderColor:"border",borderRadius:i.radius(8),flex:"1 1 8rem",minW:"8rem",height:i.length(32),px:i.space(2.5),py:0,_placeholder:{color:"mutedText"},_focus:{borderColor:"primary",boxShadow:"none"}},e)),w.jsx(I,{size:"sm",flexShrink:0,borderRadius:i.radius(8),bg:"primary",color:"buttonText",fontSize:i.font(12),px:i.space(3),height:i.length(32),loading:h,disabled:!x,onClick:y,fontFamily:V,children:l("leadPromptSave")})]}),w.jsxs(Y,{justify:"space-between",align:"center",gap:i.space(2),children:[w.jsx(Z,{fontSize:i.font(10),lineHeight:"1.3",color:"mutedText",fontFamily:V,children:o||l("leadPromptNote")}),w.jsx(I,{size:"sm",variant:"plain",flexShrink:0,fontSize:i.font(11),color:"mutedText",px:0,height:"auto",minH:"auto",py:0,onClick:()=>{go(e),a()},fontFamily:V,children:l("leadPromptSkip")})]})]})})};function yo(){const e=H(),t=e.botData?.feature_flags?.lead_capture,n=e.chatState.threadId,[r,o]=v.useState(!1),[a,i]=v.useState(null),[s,l]=v.useState(0),[c,d]=v.useState([]),[u,p]=v.useState(0),h=Boolean(t?.enabled),f=v.useMemo(()=>e.messages.filter(e=>"dori"===e.type).length,[e.messages]);v.useEffect(()=>{o(function(e){return!!e&&"1"===ho(`${uo}${e}`)}(n)),l(mo(n)),d([]),i(null)},[n]);const g=e=>d(t=>t.includes(e)?t:[...t,e]),m=v.useRef(Date.now());v.useEffect(()=>{m.current=Date.now(),p(0)},[e.messages.length]),v.useEffect(()=>{if(!h)return;const e=setInterval(()=>{p(Math.floor((Date.now()-m.current)/1e3))},5e3);return()=>clearInterval(e)},[h]),v.useEffect(()=>{h&&(e.focusedProduct||e.focusModeProduct)&&g("product_click")},[h,e.focusedProduct,e.focusModeProduct]);const b=v.useRef(e.cartItemCount??0);v.useEffect(()=>{if(!h)return;const t=e.cartItemCount??0;t>b.current&&g("add_to_cart"),b.current=t},[h,e.cartItemCount]),v.useEffect(()=>{if(!h)return;if("undefined"==typeof window||"undefined"==typeof document)return;if(window.matchMedia?.("(hover: none)")?.matches)return;const e=e=>{e.clientY<=0&&g("exit_intent")};return document.addEventListener("mouseout",e),()=>document.removeEventListener("mouseout",e)},[h]);const x=function(e,t){if(!e?.enabled)return null;if(!t.hasThread||t.settled||t.busy)return null;const n=e.fields??[],r=e.rules??[];if(0===n.length||0===r.length)return null;const o=e.max_asks??1;return t.asksUsed>=o?null:r.find(e=>function(e,t){switch(e.trigger){case"conversation_start":return!0;case"after_turns":return t.botTurns>=(e.value??1);case"idle":return t.botTurns>0&&t.idleSeconds>=(e.value??45);default:return!!lo.includes(e.trigger)&&t.firedEvents.includes(e.trigger)}}(e,t))??null}(t,{botTurns:f,idleSeconds:u,firedEvents:c,asksUsed:s,settled:r,hasThread:Boolean(n),busy:e.anySheetOpen||"generating"===e.inputState||!!e.handover});v.useEffect(()=>{!r&&!a&&x&&n&&(i(x),l(function(e){if(!e)return 0;const t=mo(e)+1;return fo(`${po}${e}`,String(t)),t}(n)))},[x,a,r,n]);const y=function(e,t,n){return n?null:e??t}(a,x,r);return{rule:y,threadId:n,fields:co(t),message:t?.message,note:t?.note,settle:()=>{i(null),o(!0)}}}const vo=({chat:e,t:t})=>{const n=P(),[r,o]=v.useState(!1);return v.useEffect(()=>{const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[]),w.jsxs(Y,{role:"status","aria-live":"polite",flexShrink:0,justify:"space-between",align:"center",px:n.space(3),py:n.space(2),bg:"lightBackground",borderRadius:n.radius(8),borderLeft:"3px solid",borderLeftColor:"primary",fontSize:n.font(13),opacity:r?1:0,transform:r?"translateY(0)":"translateY(8px)",transition:"opacity 0.25s ease-out, transform 0.25s ease-out",children:[w.jsx(Z,{color:"mutedText",fontSize:n.font(13),lineClamp:1,flex:1,children:"remove"===e.cartUndoState.operation?t("cartUndoRemoved").replace("{product}",e.cartUndoState.productName):t("cartUndoQuantityChanged").replace("{product}",e.cartUndoState.productName)}),w.jsxs(Y,{gap:n.space(1),children:[w.jsx(I,{size:"xs",variant:"ghost",color:"primary",fontWeight:"600",fontSize:n.font(13),onClick:e.handleCartUndo,_hover:{bg:"transparent",opacity:.7},px:n.space(2),minW:"auto",children:t("cartUndoButton")}),w.jsx(Ut,{size:"xs",variant:"ghost","aria-label":"Dismiss",onClick:e.dismissCartUndo,color:"mutedText",_hover:{bg:"transparent",opacity:.7},minW:"auto",h:"auto",p:n.space(.5),children:w.jsx(tn,{boxSize:n.length(12)})})]})]})},wo=({header:e})=>{const t=H(),o=De(t.handover),a=t.messages[t.messages.length-1],i=!!t.handover&&"user"===a?.type&&null!==t.handoverTeamReadAt&&t.handoverTeamReadAt>=new Date(a.timestamp).getTime(),{botData:s,bannerChips:l,dismissBannerChips:d,suppressProactiveForSession:u}=t,{t:p,translations:h}=q(),f=n(s,h),{isMobile:g}=ee(),m=yo(),b=P(),x=ie(g?1:se(t.botData).width),y=v.useRef(null),C=v.useRef(!0),k=v.useRef(!1),j=v.useCallback(()=>{if(k.current)return void(k.current=!1);const e=y.current;if(!e)return;const n=e.scrollHeight-e.scrollTop-e.clientHeight<80;n!==C.current&&(C.current=n,t.setAutoScrollEnabled(n))},[t.setAutoScrollEnabled]);v.useEffect(()=>{const e=y.current;e&&(t.handoverTeamTyping||i)&&e.scrollHeight-e.scrollTop-e.clientHeight<160&&c(t.messagesEndRef.current)},[t.handoverTeamTyping,i,t.messagesEndRef]);const S=v.useRef(null);v.useEffect(()=>{const e=t.answerAnchorTurnRef.current;if(!e||S.current===e)return;const n=t.messages,r=n.findIndex(t=>"user"===t.type&&t.id===e);if(-1===r)return;if(!n.slice(r+1).find(e=>"dori"===e.type&&!e.showCartSummary||"products"===e.type))return;S.current=e,t.setAutoScrollEnabled(!1),C.current=!1;const o=y.current,a=o?.querySelector(`[data-turn-anchor="${e}"]`),i=a?.firstElementChild??null;if(o&&i){const e=i.getBoundingClientRect().top-o.getBoundingClientRect().top;Math.abs(e-4)>1&&(k.current=!0,o.scrollTop+=e-4)}},[t.messages,t.answerAnchorTurnRef,t.setAutoScrollEnabled]);const z=v.useRef(0),A=null!=t.focusModeProduct,E=v.useRef(A);v.useLayoutEffect(()=>{const e=y.current,n=E.current;E.current=A,e&&(!n&&A?z.current=e.scrollTop:n&&!A&&(t.setAutoScrollEnabled(!1),C.current=!1,e.scrollTop=z.current))},[A,t.setAutoScrollEnabled]);const[R,T]=le(),_=Bt("colors","primary"),W=oe(_),I=v.useMemo(()=>{if(!t.chatState.isRequestInProgress)return null;if(t.messages.some(e=>"loading"===e.type))return null;for(let e=t.messages.length-1;e>=0;e--)if("dori"===t.messages[e].type)return t.messages[e].id;return null},[t.chatState.isRequestInProgress,t.messages]),L=v.useMemo(()=>{const e=[];for(const n of t.messages){const t=n.focusProductId;if(null!=t){const r=e[e.length-1];if(r&&"productChat"===r.kind&&r.tagId===t){r.messages.push(n);continue}e.push({kind:"productChat",tagId:t,product:null,messages:[n]});continue}e.push({kind:"msg",msg:n})}return e.flatMap(e=>{if("productChat"!==e.kind)return[e];const t=e.messages.find(t=>"user"===t.type&&t.repliedProduct&&String(t.repliedProduct.id)===e.tagId)?.repliedProduct??e.messages.find(e=>"user"===e.type&&e.repliedProduct)?.repliedProduct??null;return t?[{...e,product:t}]:e.messages.map(e=>({kind:"msg",msg:e}))})},[t.messages]),M=v.useMemo(()=>{const e=new Map;let n=0;for(const r of t.messages)"dori"===r.type&&e.set(r.id,n++);return e},[t.messages]);return w.jsxs(w.Fragment,{children:[e,f&&w.jsx(Z,{fontWeight:"600",fontStyle:"normal",fontSize:b.isMini?b.font(24):`${x.greetingFontPx}px`,letterSpacing:"0",w:"fit-content",transition:"opacity 0.5s ease",fontFamily:V,css:{background:W,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:f}),w.jsxs(G,{flex:1,justify:"center",align:"stretch",gap:b.space(x.sectionGap),minH:0,transition:"opacity 0.5s ease",opacity:1,children:[w.jsx(D,{ref:y,flex:1,overflowY:"scroll",overflowX:"hidden","data-scroll-container":"chat-messages",overscrollBehavior:"contain",onScroll:j,css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch"},children:w.jsxs(G,{overscrollBehavior:"contain",gap:b.space(2),align:"stretch",pb:b.space(2),children:["live"===t.handover?.state&&w.jsx(He,{card:t.handover}),w.jsx(_e,{label:"message-list",children:L.reduce((e,t)=>{if("productChat"===t.kind)return e.elements.push(w.jsx(so,{product:t.product,messages:t.messages},`product-chat-${t.messages[0].id}`)),e.prevType="productChat",e;const n=t.msg,r="dori"===n.type,o=r&&"products"===e.prevType,a=w.jsx(io,{message:n,isStreaming:n.id===I,doriMessageIndex:r?M.get(n.id):void 0,isAfterProducts:o},n.id);return e.elements.push("user"===n.type?w.jsx("div",{"data-turn-anchor":n.id,style:{display:"contents"},children:a},n.id):a),e.prevType=n.type,e},{elements:[],prevType:""}).elements},L.length),t.handoverTeamTyping&&w.jsx(Pe,{card:t.handover}),i&&w.jsx(qe,{}),w.jsx("div",{ref:t.messagesEndRef,style:{height:"1px"}})]})}),t.cartUndoState&&w.jsx(vo,{chat:t,t:p}),!(l&&l.length>0)&&R&&!t.anySheetOpen&&w.jsx(Sr,{chips:[R],onChipClick:e=>{r("offer_guide_chat_opened",{from:"chat"}),T(),de(e).then(n=>t.sendMessage({message:e,apiMessage:n}))},onDismiss:()=>{ce(),T()}}),l&&l.length>0&&!t.anySheetOpen&&w.jsx(Sr,{chips:l,onChipClick:e=>{r("banner_chip_tapped",{chip_text:e}),t.sendMessage({message:e}),d()},onDismiss:()=>{r("banner_chips_dismissed"),d(),u()}}),m.rule&&m.threadId&&w.jsx(xo,{threadId:m.threadId,fields:m.fields,rule:m.rule,message:m.message,note:m.note,onSettled:m.settle}),w.jsx(D,{flexShrink:0,bg:"transparent",borderRadius:b.radius(12),transition:"all 0.2s ease",onInput:t.noteHandoverTyping,children:w.jsx(Tn,{state:t.inputState,placeholder:"generating"===t.inputState?p("processing"):"live"===t.handover?.state?p("handoverMessagePlaceholder").replace("{team}",o):t.focusedProduct?p("askAboutProduct"):p("whatsYourQuestion"),onSend:t.isInputDisabled?void 0:t.sendMessage,onStop:t.stopCurrentRequest})})]})]})};function Co(e){return{position:"fixed",transition:"all 0.5s ease",visibility:e?"visible":"hidden",opacity:e?1:0,bgColor:"background",zIndex:1e6,overflow:"hidden",willChange:"transform",pointerEvents:e?"auto":"none",overscrollBehavior:"contain",touchAction:"pan-x pan-y"}}const ko=({children:e,showSuggestionScreen:t,isOpen:n,isExpanded:r=!1})=>{const{isMobile:o}=ee(),{botData:a}=H(),i=v.useRef(null),s=a?.customization?.position?.align??"right",l=se(a),c=Qe(l.width,l.height),d=Ve(a),u=ie(o?1:l.width),p=Ze(Ue(a,o)),h=(f={isMobile:o,mobileScale:d,isOpen:n,isExpanded:r,align:s,panel:c,borderColor:Bt("colors","borderColor")}).isMobile?function(e){const{isOpen:t,mobileScale:n}=e,r=n<1;return{...Co(t),top:r?"auto":"0",left:"0",right:"0",bottom:"0",width:"auto",maxWidth:"100vw",height:r?`min(100dvh, max(${Math.round(100*n)}dvh, ${Ne}px))`:"auto",border:"none",borderRadius:r?`${Oe}px ${Oe}px 0px 0px`:"0px",boxShadow:r?"0px -6px 24px rgba(0, 0, 0, 0.12)":"none",transform:t?"translateY(0)":"translateY(100vh)"}}(f):function(e){const{isOpen:t,isExpanded:n,align:r,panel:o,borderColor:a}=e,i=n?"50%":"20px";return{...Co(t),top:"50%",left:"left"===r?i:"auto",right:"right"===r?i:"auto",bottom:"auto",width:n?o.expandedWidth:o.width,maxWidth:`calc(100vw - ${2*Ye}px)`,height:n?o.expandedHeight:o.height,border:`1px solid ${a}`,borderRadius:"24px",boxShadow:"0px 4px 20px rgba(0, 0, 0, 0.1)",transform:t?n?"right"===r?"translate(50%, -50%)":"translate(-50%, -50%)":"translateY(-50%)":n?"right"===r?"translate(50%, -50%) translateX(120%)":"translate(-50%, -50%) translateX(-120%)":"right"===r?"translateY(-50%) translateX(120%)":"translateY(-50%) translateX(-120%)"}}(f);var f;return(({containerRef:e,isOpen:t,showSuggestionScreen:n})=>{v.useEffect(()=>{if(!t||!e.current)return;const n=e.current,r=e=>{if(e.scrollHeight<=e.clientHeight+1)return!1;const t=getComputedStyle(e).overflowY;return"auto"===t||"scroll"===t},o=e=>{e.preventDefault(),e.stopPropagation();const t=(e=>{let t=e.composedPath?.()[0]??e.target;for(;t&&t!==n;){if(t instanceof HTMLElement&&r(t))return t;t=t.parentElement}return null})(e)||n.querySelector('[data-scroll-container="sheet"]')||n.querySelector('[data-scroll-container="focus-mode"]')||n.querySelector('[data-scroll-container="chat-messages"]');t&&(t.scrollTop+=e.deltaY)};return n.addEventListener("wheel",o,{passive:!1}),()=>{n.removeEventListener("wheel",o)}},[t,n])})({containerRef:i,isOpen:n,showSuggestionScreen:t}),v.useEffect(()=>{const e=i.current;if(!e)return;const t=e=>e.preventDefault();return e.addEventListener("gesturestart",t,{passive:!1}),e.addEventListener("gesturechange",t,{passive:!1}),()=>{e.removeEventListener("gesturestart",t),e.removeEventListener("gesturechange",t)}},[]),w.jsx(D,{ref:i,...h,children:w.jsxs(G,{p:p.space(u.padding),pb:p.space(u.paddingBottom),h:"full",justify:"flex-start",align:"stretch",gap:p.space(u.contentGap),children:[e,!t&&w.jsx(D,{transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",children:w.jsx(Bn,{variant:"default"})})]})})},jo=/colo|couleur|farbe|màu|colore|kleur/i,So=({variantSummary:e})=>{const t=P();if(!e?.options?.length)return null;const{options:n}=e,r=n.find(e=>jo.test(e.name||"")||Lr(e)),o=r?(()=>{const e=new Set(r.values.map(e=>e.image).filter(Boolean)).size>1,n=r.values.slice(0,6),o=r.values.length-n.length;return w.jsxs(Y,{gap:t.space(1),align:"center",wrap:"wrap",children:[n.map((n,r)=>{const o=!1===n.available,a=Wr(n.value,n.swatch);return e&&n.image?w.jsx(D,{position:"relative",title:n.value,w:t.length(16),h:t.length(16),borderRadius:t.radius(4),backgroundImage:`url(${n.image})`,backgroundSize:"cover",backgroundPosition:"center",border:"0.5px solid rgba(0,0,0,0.15)",opacity:o?.35:1,flexShrink:0,children:o&&w.jsx(D,{position:"absolute",top:t.length(7),left:"-2px",w:t.length(20),h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r):a?w.jsx(D,{position:"relative",title:n.value,w:t.length(15),h:t.length(15),borderRadius:"full",bg:a,border:"0.5px solid rgba(0,0,0,0.2)",opacity:o?.35:1,flexShrink:0,children:o&&w.jsx(D,{position:"absolute",top:t.length(7),left:"-1px",w:t.length(17),h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r):w.jsx(Z,{fontSize:t.font(10),px:t.space(1.5),py:t.space(.5),borderRadius:t.radius(6),border:"0.5px solid",borderColor:"borderColor",color:"mutedText",opacity:o?.5:1,textDecoration:o?"line-through":"none",whiteSpace:"nowrap",title:n.value,fontFamily:V,children:n.value},r)}),o>0&&w.jsxs(Z,{fontSize:t.font(11),color:"mutedText",fontFamily:V,children:["+",o]})]})})():null,a=(r?n.filter(e=>e!==r):n).map(e=>{const n=e.values.slice(0,4),r=e.values.length-n.length;return w.jsxs(Z,{fontSize:t.font(11),color:"mutedText",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxW:"100%",fontFamily:V,children:[e.name,":"," ",n.map((e,t)=>w.jsxs(Z,{as:"span",textDecoration:!1===e.available?"line-through":"none",opacity:!1===e.available?.6:1,children:[e.value,t<n.length-1?", ":""]},t)),r>0?`, +${r}`:""]},e.name)});return o||0!==a.length?w.jsxs(G,{align:"start",gap:t.space(.5),w:"full",children:[o,a]}):null};let zo=1;const Ao=[];let Eo=!1,Ro=0;function To(){if(Ro>0)return void Ro--;const e=Ao.pop();e&&e.close()}function _o(e,t){const n=v.useRef(t);n.current=t,v.useEffect(()=>{if(!e)return;const t=function(e){if("undefined"==typeof window||!window.history?.pushState)return null;const t=zo++;try{window.history.pushState({__dori_layer:t},"")}catch{return null}return Eo||(Eo=!0,window.addEventListener("popstate",To)),Ao.push({id:t,close:e}),t}(()=>n.current());return null!=t?()=>function(e){const t=Ao.findIndex(t=>t.id===e);if(-1!==t){Ao.splice(t,1);try{window.history.state?.__dori_layer===e&&(Ro++,window.history.back())}catch{}}}(t):void 0},[e])}const Wo=({slides:e,initialIndex:t,alt:n,onClose:r})=>{const o=P(),a=v.useRef(null),[i,s]=v.useState(t);return _o(!0,r),v.useEffect(()=>{const e=a.current;e&&e.clientWidth>0&&t>0&&e.scrollTo({left:t*e.clientWidth})},[]),w.jsxs(D,{position:"absolute",inset:0,zIndex:60,bg:"rgba(12, 12, 12, 0.94)","data-dori-sheet":"true",children:[w.jsx(Ut,{"aria-label":"Close",position:"absolute",top:o.length(10),right:o.length(10),zIndex:2,size:"sm",minW:o.length(34),w:o.length(34),h:o.length(34),p:0,borderRadius:"full",bg:"rgba(255,255,255,0.14)",color:"white",_hover:{bg:"rgba(255,255,255,0.26)"},onClick:r,children:w.jsx(tn,{boxSize:o.length(12)})}),w.jsx(Y,{ref:a,gap:0,w:"full",h:"full",onScroll:()=>{const e=a.current;if(!e||0===e.clientWidth)return;const t=Math.round(e.scrollLeft/e.clientWidth);t!==i&&s(t)},onClick:r,css:{overflowX:"auto",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},WebkitOverflowScrolling:"touch"},children:e.map(e=>w.jsx(D,{css:{flex:"0 0 100%",scrollSnapAlign:"center"},h:"full",display:"flex",alignItems:"center",justifyContent:"center",p:4,children:w.jsx(N,{src:e.src,alt:n,maxW:"100%",maxH:"100%",objectFit:"contain",onClick:e=>e.stopPropagation()})},e.id))}),e.length>1&&w.jsx(Y,{position:"absolute",bottom:o.length(14),left:"0",right:"0",justify:"center",gap:1.5,pointerEvents:"none",children:e.map((e,t)=>w.jsx(D,{w:o.length(6),h:o.length(6),borderRadius:"full",bg:t===i?"white":"rgba(255,255,255,0.35)"},`dot-${e.id}`))})]})},Io=/colo|couleur|farbe|màu|colore|kleur/i,Lo=e=>(e||"").replace(/^https?:/,"").split("?")[0],Mo=({onClose:e})=>{const{focusModeProduct:t,focusModeAnchorTs:n,exitFocusMode:r,openVariantModal:o,variantModalProduct:a,addToCartDirect:i,sendMessage:s,stopCurrentRequest:l,botData:c,chatState:d,messages:u,inputState:p,isInputDisabled:h,shortlistEnabled:f,isShortlisted:g,toggleShortlist:m,answerAnchorTurnRef:b,isTestMode:x}=H(),y=P(),{t:C}=q(),k=t,j=null!=k,S=v.useRef(null),[z,A]=v.useState(!1),[E,R]=v.useState(!1),T=v.useRef(null),_=v.useMemo(()=>"undefined"!=typeof window&&!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,[]);v.useEffect(()=>{if(!j)return A(!1),void R(!1);const e=requestAnimationFrame(()=>A(!0));return()=>cancelAnimationFrame(e)},[j]),v.useEffect(()=>()=>{T.current&&clearTimeout(T.current)},[]);const W=v.useCallback(e=>{_?r(e):R(t=>t||(T.current=setTimeout(()=>r(e),180),!0))},[_,r]);_o(j,()=>W("back_gesture"));const[L,M]=v.useState(null);v.useEffect(()=>{if(!j)return;const e=e=>{"Escape"===e.key&&(e.preventDefault(),null==L?a||W("escape"):M(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[j,a,L,W]),v.useEffect(()=>{if(j){const e=requestAnimationFrame(()=>S.current?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)}},[j]);const[B,F]=v.useState(null),U=k?.url;v.useEffect(()=>{F(null);const e=U?pe(U):void 0;if(!e)return;let t=!1;return he(e).then(e=>{!t&&e&&F(e)}).catch(()=>{}),()=>{t=!0}},[U]);const Q=null!=k?.id?String(k.id):null,K=v.useMemo(()=>null==Q?[]:u.filter(e=>null!=e.focusProductId&&String(e.focusProductId)===Q),[u,Q]),X=v.useMemo(()=>{if(!d.isRequestInProgress)return null;if(K.some(e=>"loading"===e.type))return null;for(let e=K.length-1;e>=0;e--)if("dori"===K[e].type)return K[e].id;return null},[d.isRequestInProgress,K]),J=v.useRef(null),$=v.useRef(null),ee=v.useRef(!1),te=v.useRef(!1);te.current=K.length>0,v.useEffect(()=>{M(null);const e=J.current;te.current?(ee.current=!0,e&&(e.scrollTop=e.scrollHeight)):(ee.current=!1,e&&(e.scrollTop=0)),T.current&&(clearTimeout(T.current),T.current=null),R(!1)},[n]);const ne=v.useRef(!1),re=v.useCallback(()=>{if(ne.current)return void(ne.current=!1);const e=J.current;e&&(ee.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)},[]);v.useEffect(()=>{if(!j)return;const e=J.current,t=$.current;if(!e||!t)return;const n=new ResizeObserver(()=>{ee.current&&(ne.current=!0,e.scrollTop=e.scrollHeight)});return n.observe(t),()=>n.disconnect()},[j]);const oe=v.useCallback(()=>{ee.current=!0;const e=J.current;e&&(ne.current=!0,e.scrollTop=e.scrollHeight)},[]),ae=v.useRef(null);v.useEffect(()=>{if(!j)return;const e=b.current;if(!e||ae.current===e)return;const t=K.findIndex(t=>"user"===t.type&&t.id===e);if(-1===t)return;if(!K.slice(t+1).find(e=>"dori"===e.type&&!e.showCartSummary||"products"===e.type))return;ae.current=e,ee.current=!1;const n=J.current,r=n?.querySelector(`[data-turn-anchor="${e}"]`),o=r?.firstElementChild??null;if(n&&o){const e=o.getBoundingClientRect().top-n.getBoundingClientRect().top;Math.abs(e-4)>1&&(ne.current=!0,n.scrollTop+=e-4)}},[j,K,b]);const ie=v.useMemo(()=>k?function(e,t){const n=[],r=new Set,o=(e,t,o)=>{t&&!r.has(Lo(t))&&(r.add(Lo(t)),n.push(null!=o?{id:e,src:t,color:o}:{id:e,src:t}))};if(t){const r=(t.options??[]).findIndex(e=>Io.test("string"==typeof e?e:e?.name||""));if(r>=0){const e=new Set;for(const n of t.variants){const t=ue(n,r+1);t&&!e.has(t)&&(e.add(t),o(`color:${t}`,n.featured_image?.src,t))}}for(const[e,a]of(t.images??[]).entries()){if(n.length>=8)break;o(`img:${e}`,a)}return 0===n.length&&o("main",e.image),n.slice(0,8)}const a=e.variant_summary?.options?.find(e=>Io.test(e.name||""));if(a?.values?.some(e=>e.image))for(const i of a.values)o(`color:${i.value}`,i.image,i.value);return 0===n.length&&o("main",e.image),n.slice(0,8)}(k,B):[],[k,B]);if(!k)return null;const se=ie[0]?.src||k.image,le=ie.length>0?ie:se?[{id:"hero",src:se}]:[],ce=O(c),de=(k.variant_summary?.options??[]).some(e=>(e.values?.length??0)>1),fe=(k.currency||c?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",ge=Boolean(k.is_on_sale&&null!=k.sale_price&&k.sale_price>0&&null!=k.price&&k.sale_price<k.price),be=ge&&k.sale_price?k.sale_price:k.price,ye=e=>Ae("focus_path_clicked",{assistantId:c?.assistant_id,threadId:d.threadId,payload:{product_id:k.id,path:e,mode_version:"focused_chat_v2"}}),ke=xe(k,c),je=null!==ke,Se=(e,t)=>{ye(e),oe(),s({message:t,apiMessage:`${t} (product id: ${k.id})`,focusScoped:!0})},ze=!0===c?.feature_flags?.hide_price_check,Ee=(e,t,n)=>w.jsxs(I,{variant:"outline",h:y.length(40),px:y.space(2),gap:y.space(1.5),fontSize:y.font(12.5),fontWeight:500,color:"text",borderColor:"borderColor",borderRadius:y.radius(10),bg:"background",justifyContent:"center",_hover:{bg:"veryLightBackground",borderColor:"primary",color:"primary"},onClick:n,fontFamily:V,children:[w.jsx(N,{src:e,alt:"",w:y.length(15),h:y.length(15),objectFit:"contain",flexShrink:0}),w.jsx(D,{as:"span",minW:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),Re=g(k.id);return w.jsxs(D,{position:"absolute",inset:0,zIndex:30,bg:"background","data-dori-sheet":"true","data-focus-mode":"true",transform:z&&!E?"translateX(0)":"translateX(100%)",transition:_?"none":"transform 180ms ease-out",children:[w.jsxs(Xt,{direction:"column",h:"full",minH:0,children:[w.jsxs(Xt,{align:"center",gap:y.space(2),px:y.space(4),py:y.space(2.5),flexShrink:0,borderBottom:"1px solid",borderColor:"borderColor",bg:"background",children:[w.jsx(Ut,{ref:S,"aria-label":C("back"),size:"sm",variant:"ghost",color:"text",borderRadius:"full",minW:y.length(34),w:y.length(34),h:y.length(34),p:y.space(0),flexShrink:0,css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:()=>W("back"),children:w.jsx(pn,{boxSize:y.length(16)})}),k.image&&w.jsx(N,{src:k.image,alt:k.name,w:y.length(38),h:y.length(38),objectFit:"cover",borderRadius:y.radius(8),flexShrink:0,bg:"lightBackground",border:"1px solid",borderColor:"borderColor"}),w.jsxs(D,{minW:0,flex:1,children:[w.jsx(Z,{fontSize:y.font(13.5),fontWeight:600,color:"text",lineHeight:"1.3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:V,children:k.name}),w.jsxs(Y,{gap:y.space(1.5),align:"center",children:[ge&&null!=k.price&&w.jsx(Z,{fontSize:y.font(11),color:"mutedText",textDecoration:"line-through",fontFamily:V,children:me(k.price,fe)}),!!be&&be>0&&w.jsx(Z,{fontSize:y.font(12.5),fontWeight:700,color:"text",fontFamily:V,children:me(be,fe)}),k.price_on_request&&w.jsx(Z,{fontSize:y.font(12.5),fontWeight:700,color:"text",fontFamily:V,children:C("priceOnRequest")}),ge&&!!k.sale_percent_off&&w.jsxs(Zt,{bg:"errorBackground",color:"error",fontSize:y.font(10),borderRadius:y.radius(12),children:[k.sale_percent_off,"%"]})]})]}),f&&w.jsx(Ut,{"aria-label":C(Re?"removeSaved":"saveForLater"),size:"sm",variant:"ghost",minW:y.length(34),w:y.length(34),h:y.length(34),p:y.space(0),borderRadius:"full",flexShrink:0,color:Re?"primary":"mutedText",css:{"@media (hover: hover)":{"&:hover":{color:"var(--chakra-colors-primary)"}}},onClick:()=>m(k),children:Re?w.jsx(mn,{boxSize:y.length(17)}):w.jsx(gn,{boxSize:y.length(17)})}),e&&w.jsx(Ut,{"aria-label":"Close",size:"sm",variant:"ghost",minW:y.length(34),w:y.length(34),h:y.length(34),p:y.space(0),borderRadius:"full",flexShrink:0,color:"mutedText",css:{"@media (hover: hover)":{"&:hover":{color:"var(--chakra-colors-primary)"}}},onClick:e,children:w.jsx(tn,{boxSize:y.length(13)})})]}),w.jsx(D,{ref:J,flex:1,minH:0,overflowY:"auto",overflowX:"hidden",overscrollBehavior:"contain","data-scroll-container":"focus-mode",onScroll:re,px:y.space(4),py:y.space(3),css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch"},children:w.jsxs(G,{ref:$,align:"stretch",gap:y.space(3.5),children:[ie.length>1?w.jsx(Dr,{slides:ie,activeColor:null,height:Ke(y,"gallery"),bgColor:"lightBackground",alt:k.name,onImageClick:e=>M(e)}):se&&w.jsx(N,{src:se,alt:k.name,role:"button",tabIndex:0,w:"full",h:Ke(y,"single"),objectFit:"contain",borderRadius:y.radius(12),bg:"lightBackground",cursor:"zoom-in",onClick:()=>M(0),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),M(0))}}),!!k.description&&w.jsx(D,{borderRadius:y.radius(8),borderLeft:"2px solid",borderLeftColor:"primary",px:y.length(10),py:y.length(6),bg:"lightBackground",children:w.jsx(Z,{fontSize:y.font(12.5),color:"text",lineHeight:"1.5",lineClamp:3,fontFamily:V,children:k.description})}),k.variant_summary&&w.jsx(So,{variantSummary:k.variant_summary}),w.jsxs(G,{align:"stretch",gap:y.space(1.5),children:[w.jsx(Z,{fontSize:y.font(11),fontWeight:600,color:"mutedText",textTransform:"uppercase",letterSpacing:"0.05em",fontFamily:V,children:C("needHelpDeciding")}),w.jsxs(D,{display:"grid",gridTemplateColumns:`repeat(${ze?2:3}, minmax(0, 1fr))`,gap:y.space(1.5),children:[Ee("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAY7klEQVR42tV7eZhU1bXvb+29z6mq7oamm0kGBZmEBlESPlEcqmX0xjhCNdg4R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FaCol7/nxP8a5802ymuZkiJSX8gxF93XsWLVybMdkBDtTmG6dePgZ1wBOrXl4bkBlcokLb7pz1yzEfff65X7gHAE7pDcy/aX6LMeaIzdzfDwB5gibddvXQfS31cwKjo8ba7m0ZXiE1Z1BgdE+GlQShHan2AoBvdA8GK0HCOFLtYXCh840L9QghaF/YCa3s3a3nw68+9Mym7woEOnGpz+XpY6snXd1iMk9qtl2ttbm4prPgJueLCpx18l0nZDGDGZBCQAnZVBouufn9P7+eKjz7ewOg0FsYveWyc3c27H1XGy2klJAsWgnYBsIhtr19KYDyzuDg72w748T5XJmZB1jYImMMXNflvqU9z39z4Uvvx9o1Pn8fEiCYmUfNuOB9j/U4YiAs3WTfbuV3vv6Hl7bR0dS5jiZxYqZLb5522jcte+7OmuAaBhBW7j8+eSZ9LuXqdSflFbvOKrSYesu0kcOmnWsHTzvHjr4mWsPMrpIKzOwU3grLD6fdOPh3p5P5He7Nr+mOvia6bsi0c+zw2Hl26uxpI0/0RUuFE+vNsc0mM5IUWQTgQAennD1rwrpRMy5UZ197saVDOsIO7hKjTk4JO07LWU/ikTMuFGOuncCBMWXMZKAkZY0/Gu06v08qAKjMHa65rgqLQEn2NTwblHm+Lus8k6V2Lv1wMQ4dpq3y0MxJKAWlXLc9LScVgHQid7zco6jnK/WNjX9zIkVngckW9i3Xjd0eB8r/HPqOEB3muJw6ygZR7o0eQEJIFp+Vu93+CoDytHx/cQABWPJGstQLSo5o9LrnP+s6+a79VZf/vrm5mUpKSrjwWQcg5Dg0c/KUBvsdvGT+fwEvnYKDff9ehQAAAABJRU5ErkJggg==",C("compareAction"),()=>Se("compare",C("compareIntent").replace("{name}",k.name))),Ee("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAVVklEQVR42t17e5xU1ZXut/bjnKrqbmleDSrGZHzwEALSiKjgqcZG0RGNSapvANF4o0OuoxF/SjQzv5uyvXeSEJM7xqC5zniTESXj7fpNYpxkFBC6SxBBacCA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MtZQm1/J0ZlMtlRG1ttyKi8Jm2mxcjfPOLlhkiPngmmE0y4aEQJZ5ovHzh6//xg9P9S08829z10him1laH1rx55/hGPxqg2upSqWWlQjyfBCE2Rpb9JFlBhGSqXD8coO8tvkv3YCBnmeEYoJeGTuvctf2xXVqJ4cawZThyTkDp2iez2axI7uuwdMv7H8DovyMzHeXI7DODhq4l43qISBKIqazESRhXOH3Q0NV9+x5DAOJcW0aMbWrpIemtTngSJNgpSbIQukNDGsasbm1tdem7OuxH48hMOTkpfvzt/7NbKrWBpCgL2GAnlIBWesOPv/3j3ZXk8x9VBDV0aBcBIKVT/0FlSuMSvmSS3toxM27ey1mIY2WF+vXcYBAEggH4ylsupACXCwRYCImE9lYwyvXD+KNLcdMOANeccMqqnpANO0tSSlI69SsA6Egfe65+NUCVFtcnBzxN5eSWAEMQM+pSdav69vljWmtrq8tms2LSFXfvECqx/ORhdV5vJEp+7fBfAaCKgT56h6fb2tr0tx5/4NXQxZ9mBhJKvznvylmn39ZyW+nDHp6u4vnqX357YK3dkekJdee0lvs6q//HR61lMuVE5cybW2ZNnHfRW43XXLS76W9mff7PeVKMP4SQ//8Ae5YJEhPYjogAAAAASUVORK5CYII=",C("similarAction"),()=>Se("similar",`${C("doYouHaveSimilar")} ${k.name}`)),!ze&&Ee("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAVpElEQVR42s2beZyU1ZX3f+feZ+2NpluaIIYIcUEwEGiNW5yiBRS3OPqmUGlEQG2Zd4S4ZN5ETT5FzRsSEycqkDjayhpc6EokBhRkr2iMII3LCE40ajJJRNmapbue7d575o/qxoZIBFnv59N/dD1PVT2/7z3n3HPPPUXYdzAIBAJgOl4SIBgwJAkoo0kKyU/Pf9rZmmwtXbN2DXvdqkphdMnr729Ej+qeFQZc+uHmD6l7dfduuws7nSCI7PKKii8ooxPLEu+eXNWjeWb25x8CQDqdlrlcTuMYDdrrv0xGIJs1ADBiUv3ZO8MdI6I46Se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99fr9/rElV3nC/qV0LF9HKijouOFrN4+Yx+19up0PYDKZjEC6KL52zPBH9oh3Xb+sc7TfT4Z33FjAPj/KZEHEA0YPeSqGvk6FScH2nRJfOE2vzlp6HREx0u2BOQdNAM4ae/GjrTpsSMIosD3XL5clTWtmLT64JOe4APCJO0AKYc4ed8lTu5PCdSqIA+lavivsRf2/2GfSE1Me/4ABTLj/rpp1G968v1WFY1QUB5bn+hXSa1oz64VDNvtjBqDzb5OZmc9vuGzmzrBtrAqTWNrSkUxtlrRfAUMpo85KyFTrRIW253rltt+0ZsbiQwp4xweATj/XI8CcM27ET9t0eGcSJ2BjQLLYpKK0ARHguA7KLP/JV2Y8N/pwiz8qQXC/dgAwZyBembXkrhNKK/+P73prLWklAgQBwJGSSxxvY1enpOHVmYvrqVifOqzij6UFdAoMEMjCWELiijuurd28reUUNkZUVVX+9cGLb1x72mWXRZ2e87AfvPwvV+e0GtOjKzYAAAAASUVORK5CYII=",C("worthItAction"),()=>Se("price_check",C("priceCheckIntent").replace("{name}",k.name)))]}),!!k.url&&w.jsxs(I,{variant:"outline",h:y.length(40),w:"full",px:y.space(3),fontSize:y.font(12.5),fontWeight:500,color:"text",borderColor:"borderColor",bg:"background",justifyContent:"center",gap:y.space(1.5),borderRadius:y.radius(10),onClick:()=>{ye("product_page"),k.url&&c&&(ve(k,c,d.threadId),Er(_n(k.url),x))},_hover:{bg:"veryLightBackground",borderColor:"primary",color:"primary"},fontFamily:V,children:[w.jsx(rn,{boxSize:y.length(13)}),C("productPage")]})]}),K.length>0&&w.jsx(G,{align:"stretch",gap:y.space(2),children:K.reduce((e,t)=>{const n=w.jsx(io,{message:t,isStreaming:t.id===X,isAfterProducts:"products"===e.prevType},t.id);return e.elements.push("user"===t.type?w.jsx("div",{"data-turn-anchor":t.id,style:{display:"contents"},children:n},t.id):n),e.prevType=t.type,e},{elements:[],prevType:""}).elements})]})}),w.jsxs(G,{flexShrink:0,align:"stretch",gap:y.space(2),px:y.space(4),pt:y.space(2.5),borderTop:"1px solid",borderColor:"borderColor",bg:"background",children:[ce&&w.jsxs(I,{h:y.length(44),borderRadius:y.radius(12),fontSize:y.font(14),fontWeight:600,bg:"primary",color:"buttonText",w:"full",gap:y.space(1.5),onClick:()=>{ke?Er(ke.href,x):(ye("add"),oe(),de?o(k,"focus_mode"):i({product_id:null!=k.id?String(k.id):void 0,product_name:k.name,product_url:k.url||void 0,product_handle:pe(k.url)||void 0,quantity:Ce(k),quantity_label:we(k)}))},_hover:{opacity:.92},fontFamily:V,children:[je?null:w.jsx(fn,{boxSize:y.length(16)}),C(je?ke.labelKey:"addToCartFull")]}),w.jsx(D,{children:w.jsx(Tn,{state:p,placeholder:C("generating"===p?"processing":"askAboutProduct"),onSend:h?void 0:(e,t)=>(oe(),s({message:e.message,imageUrl:e.imageUrl,focusScoped:!0},t)),onStop:l})})]})]}),null!=L&&le.length>0&&w.jsx(Wo,{slides:le,initialIndex:Math.min(L,le.length-1),alt:k.name,onClose:()=>M(null)})]})},Bo=({open:e,onClose:t,title:n,children:r,onBack:o,footer:a})=>{const i=P(),s=v.useRef(null);return _o(e,o??t),v.useEffect(()=>{if(!e)return;const n=document.activeElement,r=e=>{"Escape"===e.key&&(e.preventDefault(),t())};window.addEventListener("keydown",r);const o=requestAnimationFrame(()=>{const e=s.current?.querySelector("[data-sheet-initial-focus='true']");(e||s.current)?.focus({preventScroll:!0})});return()=>{cancelAnimationFrame(o),window.removeEventListener("keydown",r),n?.focus?.({preventScroll:!0})}},[e,t]),e?w.jsxs(D,{position:"absolute",inset:0,zIndex:30,"data-dori-sheet":"true",children:[w.jsx(D,{position:"absolute",inset:0,bg:"blackAlpha.500",onClick:t,"aria-hidden":"true"}),w.jsxs(Xt,{ref:s,tabIndex:-1,position:"absolute",bottom:0,left:0,right:0,direction:"column",bg:"background",borderTopRadius:"16px",maxH:"82%",pb:i.space(3),borderTop:"1px solid",borderColor:"borderColor",boxShadow:"0 -8px 24px rgba(0,0,0,0.18)",role:"dialog","aria-modal":"true","aria-label":n||void 0,children:[w.jsx(D,{w:i.length(36),h:i.length(4),borderRadius:i.radius(2),bg:"borderColor",mx:"auto",mt:i.space(2),mb:i.space(1),flexShrink:0}),w.jsxs(Xt,{align:"center",justify:"space-between",px:i.space(4),py:i.space(1),flexShrink:0,gap:i.space(2),children:[w.jsxs(Xt,{align:"center",gap:i.space(1.5),minW:0,children:[o&&w.jsx(Ut,{"aria-label":"Back",size:"xs",variant:"ghost",color:"mutedText",borderRadius:"full",minW:i.length(24),w:i.length(24),h:i.length(24),p:i.space(0),css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:o,children:w.jsx(pn,{boxSize:i.length(13)})}),w.jsx(Z,{fontSize:i.font(14),fontWeight:"600",color:"text",lineHeight:"1.3",fontFamily:V,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:n||""})]}),w.jsx(Ut,{"aria-label":"Close",size:"xs",variant:"ghost",color:"mutedText",borderRadius:"full",minW:i.length(24),w:i.length(24),h:i.length(24),p:i.space(0),css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:t,children:w.jsx(tn,{boxSize:i.length(10)})})]}),w.jsx(D,{flex:1,minH:0,overflowY:"auto","data-scroll-container":"sheet",px:i.space(4),pt:i.space(1),css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},children:r}),a&&w.jsx(D,{flexShrink:0,px:i.space(4),pt:i.space(2.5),borderTop:"1px solid",borderColor:"borderColor",children:a})]})]}):null},Fo=()=>{const e=P(),{variantModalProduct:t,variantModalSource:n,openVariantModal:r,addToCartDirect:o,botData:a,chatState:i,isTestMode:s}=H(),{t:l}=q(),c=v.useRef(null),[d,u]=v.useState(null),[p,h]=v.useState(1),[f,g]=v.useState("idle"),[m,b]=v.useState(null),[x,y]=v.useState(null),C=t,k=null!=C?.id?String(C.id):null,j=v.useRef(k);if(v.useEffect(()=>{j.current!==k&&(j.current=k,null!=k&&(u(null),h(1),g("idle"),b(null),y(null)))},[k]),!C)return null;const S=x??C.selected_color??null,z=(S?C.variant_summary?.options?.flatMap(e=>e.values).find(e=>e.value===S&&e.image)?.image:null)||C.image,A=(C.currency||a?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",E=()=>{c.current&&(clearTimeout(c.current),c.current=null),u(null),h(1),g("idle"),b(null),y(null),r(null)},R="focus_mode"===n?E:void 0,T=d?.canAdd??!1,_=d?.priceCents??null,W=null!=_?me(_/100*p,A):null,L=Ge(e),M=!T&&"added"!==f,B="added"===f?`✓ ${l("addedToCart")}`:T?W?l("addQty").replace("{qty}",String(p)).replace("{price}",W):l("addToCartFull"):l("selectOptionsToContinue"),F=(e,t,n)=>w.jsx(I,{variant:"ghost",size:"xs",minW:`${L.stepper}px`,h:`${L.stepper}px`,borderRadius:0,fontSize:`${L.stepperFont}px`,color:t?"mutedText":"text",disabled:t||"adding"===f||"added"===f,onClick:n,"aria-label":e,children:e}),O=w.jsxs(G,{align:"stretch",gap:e.space(1.5),pb:e.space(1),children:[w.jsxs(Y,{gap:e.space(2.5),align:"center",children:[w.jsxs(Y,{gap:e.space(0),border:"1px solid",borderColor:"borderColor",borderRadius:e.radius(10),overflow:"hidden",flexShrink:0,children:[F("−",p<=1,()=>h(e=>Math.max(1,e-1))),w.jsx(Z,{fontSize:`${L.stepperFont}px`,fontWeight:600,minW:`${L.qtyWidth}px`,textAlign:"center",color:"text",fontFamily:V,children:p}),F("+",p>=10,()=>h(e=>Math.min(10,e+1)))]}),w.jsxs(I,{flex:1,h:`${L.cta}px`,borderRadius:`${L.ctaRadius}px`,fontSize:`${M?L.ctaHintFont:L.ctaFont}px`,fontWeight:600,bg:"primary",color:"buttonText",gap:e.space(1.5),disabled:!T&&"added"!==f||"adding"===f,loading:"adding"===f,onClick:async()=>{if(!d?.canAdd||"adding"===f||"added"===f)return;g("adding"),b(null);const e=null!=C.id?String(C.id):void 0,t=d.variantId?{variant_id:d.variantId,product_id:e,product_name:C.name,quantity:p}:{product_id:e,product_name:C.name,product_url:C.url,selected_options:d.selectedOptions,quantity:p},n=xe(C,a);if(n)return void Er(n.href,s);const r=await o(t);"success"===r.type?(g("added"),Ae("variant_modal_added",{assistantId:a?.assistant_id,threadId:i.threadId,payload:{product_id:C.id,selected:d.selectedLabel,quantity:p}}),c.current=setTimeout(E,900)):"failed"===r.type&&"busy"===r.reason?g("idle"):(g("error"),b(ye(r,l)||null))},_hover:{opacity:.92},fontFamily:V,"data-sheet-initial-focus":"true",children:[w.jsx(fn,{boxSize:`${L.ctaIcon}px`,flexShrink:0}),w.jsx(D,{as:"span",minW:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:B})]})]}),"error"===f&&w.jsx(Z,{fontSize:e.font(11),color:"error",fontFamily:V,children:m||l("errorOccurred")})]});return w.jsx(Bo,{open:!0,onClose:E,onBack:R,title:l("chooseOptions"),footer:O,children:w.jsxs(G,{align:"stretch",gap:e.space(3),pb:e.space(2),children:[w.jsxs(Y,{gap:e.space(2.5),align:"center",children:[z&&w.jsx(N,{src:z,alt:C.name,w:e.length(52),h:e.length(52),objectFit:"cover",borderRadius:e.radius(10),flexShrink:0,bg:"lightBackground"}),w.jsxs(D,{minW:0,children:[w.jsx(Z,{fontSize:e.font(13),fontWeight:600,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:V,children:C.name}),w.jsx(Z,{fontSize:e.font(12),color:"mutedText",fontFamily:V,children:d?.selectedLabel||(C.price?me(C.price,A):"")})]})]}),w.jsx(Br,{product:C,controlled:!0,selectedColor:S,onColorChange:y,onSelectionChange:e=>{u(e),"error"===f&&(g("idle"),b(null))}},String(C.id))]})})},Do=()=>{const e=P(),{shortlist:t,removeFromShortlist:n,shortlistOpen:r,setShortlistOpen:o,enterFocusMode:a,sendMessage:i,botData:s,chatState:l}=H(),{t:c}=q();if(v.useEffect(()=>{r&&Ae("shortlist_opened",{assistantId:s?.assistant_id,threadId:l.threadId,payload:{count:t.length}})},[r]),!r)return null;const d=()=>o(!1),u=(e,t)=>{const n=(t||s?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD";return me(e,n)},p=t.length>=2?w.jsx(I,{w:"full",h:e.length(40),borderRadius:e.radius(12),fontSize:e.font(14),fontWeight:600,bg:"primary",color:"buttonText",onClick:()=>{const e=t.map(e=>e.name).join(", "),n=t.map(e=>e.id).join(", "),r=c("compareSavedIntent").replace("{names}",e);Ae("shortlist_compare_clicked",{assistantId:s?.assistant_id,threadId:l.threadId,payload:{count:t.length}}),d(),i({message:r,apiMessage:`${r} (product ids: ${n})`})},_hover:{opacity:.92},fontFamily:V,children:c("compareSaved").replace("{count}",String(t.length))}):void 0;return w.jsx(Bo,{open:!0,onClose:d,title:c("savedProducts"),footer:p,children:w.jsxs(G,{align:"stretch",gap:e.space(1.5),pb:e.space(2),children:[0===t.length&&w.jsx(Z,{fontSize:e.font(13),color:"mutedText",textAlign:"center",py:e.space(6),fontFamily:V,children:c("savedEmpty")}),t.map(t=>w.jsxs(Y,{gap:e.space(2.5),align:"center",p:e.space(1.5),borderRadius:e.radius(12),cursor:"pointer",onClick:()=>{d(),a(t,"shortlist")},_hover:{bg:"lightBackground"},transition:"background 0.15s",children:[t.image&&w.jsx(N,{src:t.image,alt:t.name,w:e.length(44),h:e.length(44),objectFit:"cover",borderRadius:e.radius(10),flexShrink:0,bg:"lightBackground",border:"1px solid",borderColor:"borderColor"}),w.jsxs(D,{minW:0,flex:1,children:[w.jsx(Z,{fontSize:e.font(13),fontWeight:600,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:V,children:t.name}),!!t.price&&t.price>0&&w.jsx(Z,{fontSize:e.font(12),color:"mutedText",fontFamily:V,children:u(t.price,t.currency)}),t.price_on_request&&w.jsx(Z,{fontSize:e.font(12),color:"mutedText",fontFamily:V,children:c("priceOnRequest")})]}),w.jsx(Ut,{"aria-label":c("removeSaved"),size:"xs",variant:"ghost",minW:e.length(28),w:e.length(28),h:e.length(28),p:e.space(0),borderRadius:"full",color:"primary",css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:e=>{e.stopPropagation(),n(t.id)},children:w.jsx(mn,{boxSize:e.length(14)})})]},String(t.id)))]})})},Ho=({isOpen:n,onClose:r,isExpanded:o=!1,onToggleExpand:a,fullPageHref:i,pendingChat:s,onPendingChatConsumed:l})=>{const{sendMessage:c,addWelcomeMessage:u,resetBot:p,chatState:h,focusedProduct:f}=H(),{showSuggestionScreen:g,goToChat:m,goToSuggestion:b}=(n=>{const[r,o]=v.useState(!0),a=v.useRef(!1),i=v.useRef(!1);return v.useEffect(()=>{if(!i.current){const n=e();t()&&n.length>0&&(a.current=!0,o(!1),console.log("Skipping welcome screen - existing messages found:",n.length)),i.current=!0}},[]),v.useEffect(()=>{n&&!a.current?o(!0):n&&a.current&&o(!1)},[n]),{showSuggestionScreen:r,goToChat:v.useCallback(()=>{a.current=!0,o(!1)},[]),goToSuggestion:v.useCallback(()=>{a.current=!1,o(!0)},[])}})(n);v.useEffect(()=>{g&&(h.isRequestInProgress||f)&&m()},[g,h.isRequestInProgress,f,m]);const{isMobile:x}=ee(),y=v.useRef(!1);v.useEffect(()=>{n&&!y.current&&(d(),y.current=!0)},[n]);const C=x,k=(e,t,n)=>{m(),u(),c({message:e,imageUrl:t,apiMessage:n})};v.useEffect(()=>{if(n&&s){const e=setTimeout(()=>{k(s.message,s.imageUrl,s.apiMessage),l?.()},100);return()=>clearTimeout(e)}},[n,s]);return w.jsxs(ko,{showSuggestionScreen:g,isOpen:n,isExpanded:o,children:[g?w.jsx(zr,{onStartChat:k,isMobile:C,isExpanded:o,onToggleExpand:a,fullPageHref:i,onClose:r}):w.jsx(wo,{header:w.jsx(wn,{onClose:r,isMobile:C,isExpanded:o,onToggleExpand:a,fullPageHref:i,onReload:()=>{p(),b()}})}),w.jsx(Mo,{onClose:r}),w.jsx(Fo,{}),w.jsx(Do,{})]})};function Po(e,t=!1){const n=e?.feature_flags,r=(t?n?.mobile_fab_scale:void 0)??n?.fab_scale??e?.customization?.avatar_fab_scale;return"number"==typeof r&&Number.isFinite(r)?Math.min(1.5,Math.max(.4,r)):1}const qo="0 6px 20px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06)",Oo={size:"xs",flexShrink:0,h:"32px",px:3,borderRadius:"full",bg:"primary",color:"buttonText",fontSize:"12px",fontWeight:600,fontFamily:V,whiteSpace:"nowrap",transition:"transform 100ms ease-out",_active:{transform:"scale(0.97)"}},No=v.forwardRef(function({icon:e,children:t,action:n,actionBelow:r=!1,onClose:o,closeLabel:a,maxW:i},s){return w.jsxs(Y,{ref:s,gap:2,align:r?"flex-start":"center",maxW:i,minH:"44px",py:r?2.5:1.5,ps:3,pe:1,bg:"background",borderRadius:"22px",border:"1px solid",borderColor:"borderColor",boxShadow:qo,children:[w.jsx(D,{flexShrink:0,display:"flex",color:"primary",mt:r?"2px":0,children:e}),w.jsxs(D,{flex:"1",minW:0,children:[t,r&&n?w.jsx(D,{mt:2,children:n}):null]}),r?null:n,w.jsx(Ut,{size:"xs",variant:"ghost","aria-label":a,onClick:o,flexShrink:0,w:"28px",minW:"28px",h:"28px",borderRadius:"full",color:"text",opacity:.55,transition:"transform 100ms ease-out",_active:{transform:"scale(0.9)"},children:w.jsx(tn,{boxSize:"12px"})})]})}),Yo=()=>!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function Vo(e,t,n,r){const o=v.useRef(null),a=v.useRef(r);a.current=r;const i=v.useRef(n);return i.current=n,v.useEffect(()=>{if(!e)return;o.current?.focus({preventScroll:!0});const n=e=>{const n=o.current;if(!n)return;if("Escape"===e.key)return t&&e.stopPropagation(),void i.current();if(!t||"Tab"!==e.key)return;const r=Array.from(n.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select, textarea, [tabindex]:not([tabindex="-1"])')),a=function(e){return e.getRootNode().activeElement??null}(n),s=r[0],l=r[r.length-1];if(s&&a&&n.contains(a))!e.shiftKey||a!==s&&a!==n?e.shiftKey||a!==l||(e.preventDefault(),s.focus()):(e.preventDefault(),l.focus());else{e.preventDefault();const t=e.shiftKey?l:s;t?t.focus():n.focus()}};return document.addEventListener("keydown",n,!0),()=>{document.removeEventListener("keydown",n,!0),a.current?.()}},[e,t]),o}function Zo({layer:e,open:t,onCollapse:n,onClosed:r,label:o,children:a}){const i=Vo(t,!0,n,r),[s,l]=v.useState(!1);if(v.useEffect(()=>{if(!t)return void l(!1);const e=requestAnimationFrame(()=>l(!0)),n=document.documentElement,r=n.style.overflow;return n.style.overflow="hidden",()=>{cancelAnimationFrame(e),n.style.overflow=r}},[t]),!e)return null;const c=Yo()?void 0:"transform 220ms ease-out, opacity 220ms ease-out";return qt.createPortal(w.jsxs(D,{display:t?"block":"none",children:[w.jsx(D,{position:"fixed",inset:0,zIndex:1000001,bg:"blackAlpha.400",opacity:s?1:0,transition:c,touchAction:"none",onClick:n,"aria-hidden":!0}),w.jsxs(D,{ref:i,role:"dialog","aria-modal":"true","aria-label":o,tabIndex:-1,outline:"none",position:"fixed",left:0,right:0,bottom:0,zIndex:1000002,display:"flex",flexDirection:"column",bg:"background",borderTopRadius:"20px",boxShadow:"0 -8px 32px rgba(0,0,0,0.14)",css:{maxHeight:"85vh","@supports (height: 1dvh)":{maxHeight:"85dvh"}},transform:s||Yo()?"none":"translateY(24px)",opacity:s?1:0,transition:c,children:[w.jsx(D,{as:"button",tabIndex:-1,"aria-hidden":!0,onClick:n,py:2.5,flexShrink:0,cursor:"pointer",children:w.jsx(D,{w:"36px",h:"4px",mx:"auto",borderRadius:"full",bg:"blackAlpha.300"})}),w.jsx(D,{overflowY:"auto",overscrollBehavior:"contain",px:4,pb:"calc(16px + env(safe-area-inset-bottom, 0px))",children:a})]})]}),e)}function Uo({open:e,onCollapse:t,onClosed:n,label:r,children:o,w:a,maxH:i}){const s=Vo(e,!1,t,n),l=v.useRef(t);return l.current=t,v.useEffect(()=>{if(!e)return;const t=e=>{s.current&&!e.composedPath().includes(s.current)&&l.current()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)},[e,s]),w.jsx(D,{ref:s,display:e?"block":"none",role:"dialog","aria-label":r,tabIndex:-1,outline:"none",w:a,maxH:i,overflowY:"auto",overscrollBehavior:"contain",bg:"background",borderRadius:"20px",border:"1px solid",borderColor:"borderColor",boxShadow:qo,p:4,children:o})}function Qo({isMobile:e,layer:t,w:n,maxH:r,...o}){return e?w.jsx(Zo,{layer:t,...o}):w.jsx(Uo,{w:n,maxH:r,...o})}const Ko={size:"xs",borderRadius:"999px",fontSize:"12.5px",fontWeight:600,px:3,h:"28px",fontFamily:V,transition:"transform 100ms ease-out",_active:{transform:"scale(0.97)"}},Go=e=>e&&"Default Title"!==e?e:"";function Xo({api:e,row:t}){const n=e.rowFacts(t),{price:r,note:o}=n,a="added"===t.state?null!=t.paid&&t.paid<r-.005?Math.max(0,t.paid):null:n.pay,i=t.variants.filter(e=>e.available),s="added"===t.state?e.say(null,"added_check"):"sold"===t.state?e.say(null,"sold_out"):e.say(null,"add");return w.jsxs(G,{align:"stretch",gap:1.5,py:2,borderTop:"1px solid",borderColor:"blackAlpha.100","data-dori-guide-row":t.pid,children:[w.jsxs(Y,{align:"flex-start",gap:2,children:[t.image?w.jsx(N,{src:t.image,alt:"",boxSize:"48px",objectFit:"cover",borderRadius:"8px",flexShrink:0,bg:"blackAlpha.50"}):null,w.jsxs(G,{align:"stretch",gap:.5,flex:1,minW:0,children:[w.jsx(Z,{fontSize:"12.5px",lineHeight:"1.3",lineClamp:2,fontFamily:V,color:"text",children:t.title}),w.jsxs(Z,{fontSize:"12.5px",fontFamily:V,color:"text",children:[w.jsx("b",{children:null==a?e.money(r):a<.005?e.say(null,"free"):e.money(a)}),null!=a?w.jsx("s",{style:{marginInlineStart:6,opacity:.6},children:e.money(r)}):null]}),o?w.jsx(Z,{fontSize:"11.5px",color:"mutedText",fontFamily:V,children:o}):null,1===i.length&&Go(i[0].title)?w.jsx(Z,{fontSize:"11.5px",color:"mutedText",fontFamily:V,children:i[0].title}):null]}),w.jsx(I,{...Ko,flexShrink:0,bg:"idle"===t.state?"primary":"blackAlpha.100",color:"idle"===t.state?"buttonText":"text",disabled:"idle"!==t.state||!t.chosen,loading:"adding"===t.state,onClick:()=>{e.add(t.pid)},"aria-label":`${s}: ${t.title}`,children:s})]}),i.length>1&&"added"!==t.state?w.jsx(Y,{gap:1,flexWrap:"wrap",ps:t.image?"56px":0,children:i.map(n=>w.jsx(I,{...Ko,h:"auto",minH:"24px",py:"3px",maxW:"100%",whiteSpace:"normal",textAlign:"start",lineHeight:"1.25",fontWeight:500,variant:"outline","aria-pressed":t.chosen===n.id,bg:t.chosen===n.id?"text":"transparent",color:t.chosen===n.id?"background":"text",onClick:()=>e.choose(t.pid,n.id),children:n.title},n.id))}):null]})}const Jo=({api:e,isMobile:t,layer:n,pillMaxW:r,panelW:o,panelMaxH:a})=>{const{v:i,visible:s}=function(e){const[t,n]=v.useState(e),[r,o]=v.useState(!1);return v.useEffect(()=>{if(e){n(e);const t=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(t)}o(!1);const t=window.setTimeout(()=>n(null),200);return()=>window.clearTimeout(t)},[e]),{v:e??t,visible:!!e&&r}}(e.view),l=v.useRef(null);if(!i)return null;const c=!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,d=!e.view,u=i.decision,p="add_this"!==u.cta&&"add_it"!==u.cta||!i.rows?.[0]?null:i.rows[0],h=p?.variants.find(e=>e.id===p.chosen)??null,f=p&&h?e.rowFacts(p):null,g=e.say(null,"close")||"Close",m=f?.note??i.note;let b=null;if(i.result)i.result.undoVid&&(b={label:e.say(null,"undo"),run:()=>{e.undo()},quiet:!0});else if("see_picks"===u.cta)b={label:e.say(null,"show_picks"),run:()=>{e.unfold()},opens:!0};else if(p&&"idle"===p.state){const t=f?null==f.pay?e.money(f.price):f.pay<.005?e.say(null,"free"):e.money(f.pay):"",n=h?[e.say(null,"add"),Go(h.title),t].filter(Boolean).join(" · "):"";b=n&&n.length<=40?{label:n,run:()=>{e.add(p.pid)}}:{label:e.say(null,"choose"),run:()=>{e.unfold()},opens:!0}}const x=b?w.jsx(I,{ref:l,...Oo,...b.quiet?{bg:"blackAlpha.100",color:"text"}:{},"aria-haspopup":b.opens?"dialog":void 0,onClick:b.run,children:b.label}):null,y=i.result?w.jsx(Z,{fontSize:"13px",lineHeight:"1.35",color:"text",fontFamily:V,children:i.result.text}):null,C=i.rows??[];return w.jsxs(D,{opacity:s?1:0,transform:s||c?"none":"translateY(8px) scale(0.98)",transformOrigin:"bottom",transition:"opacity 200ms ease-out, transform 200ms ease-out",pointerEvents:d?"none":void 0,"aria-hidden":d||void 0,"data-dori-offer-guide":d?void 0:u.offer,children:[!i.open&&w.jsx(No,{maxW:r,icon:w.jsx(fn,{boxSize:"16px"}),closeLabel:g,onClose:e.close,action:x,actionBelow:!!b&&b.label.length>12,children:w.jsx(D,{"aria-live":"polite",role:i.result?"status":void 0,children:y??w.jsxs(w.Fragment,{children:[w.jsx(Z,{fontSize:"13px",fontWeight:600,lineHeight:"1.35",color:"text",fontFamily:V,children:i.line}),m?w.jsx(Z,{fontSize:"12px",lineHeight:"1.35",color:"mutedText",mt:.5,fontFamily:V,children:m}):null]})})}),i.open&&w.jsx(Qo,{isMobile:t,layer:n,open:!0,label:i.head||i.line,w:o,maxH:a,onCollapse:e.fold,onClosed:()=>l.current?.focus(),children:w.jsxs(G,{align:"stretch",gap:2,children:[w.jsxs(Y,{align:"flex-start",gap:2,children:[w.jsx(Z,{flex:1,fontSize:"13px",fontWeight:600,lineHeight:"1.4",color:"text",fontFamily:V,children:i.line}),w.jsx(Ut,{size:"xs",variant:"ghost","aria-label":g,onClick:e.close,h:"auto",minW:"auto",p:1,color:"text",transition:"transform 100ms ease-out",_active:{transform:"scale(0.9)"},children:w.jsx(tn,{boxSize:"14px"})})]}),i.head?w.jsx(Z,{fontSize:"12px",color:"mutedText",fontFamily:V,children:i.head}):null,null==i.rows?w.jsx(Y,{justify:"center",py:4,children:w.jsx(J,{size:"sm",color:"primary"})}):C.length?C.map(t=>w.jsx(Xo,{api:e,row:t},t.pid)):w.jsx(Z,{fontSize:"12.5px",color:"mutedText",py:2,fontFamily:V,children:e.say(null,"sold_out")}),i.result?w.jsxs(Y,{role:"status","aria-live":"polite",gap:2,pt:1,borderTop:"1px solid",borderColor:"blackAlpha.100",children:[w.jsx(D,{flex:1,children:y}),i.result.undoVid?w.jsx(I,{variant:"plain",size:"xs",h:"auto",p:0,textDecoration:"underline",fontWeight:400,onClick:()=>{e.undo()},children:e.say(null,"undo")}):null]}):null]})})]})},$o="dori-quiz-dismissed";function ea(){try{return"true"===sessionStorage.getItem($o)}catch{return!1}}function ta(){try{sessionStorage.setItem($o,"true")}catch{}}const na=e=>null==e?null:{p:new Set(e.p),v:new Set(e.v||[])},ra=(e,t)=>null===e||e.p.has(t.pid)||e.v.has(t.vid),oa=e=>Math.round(100*e)/100;function aa(e,t=new Date){const n=e.offers.filter(e=>!e.ends_at||new Date(e.ends_at)>t);return{pack:e,offers:n.map(e=>({o:e,scope:na(e.scope),buys:na(e.buys),gets:e.same?na(e.buys):na(e.gets)}))}}const ia=e=>e.reduce((e,t)=>e+t.price*t.qty,0),sa=e=>e.flatMap(e=>Array.from({length:e.qty},()=>({pid:e.pid,vid:e.vid,price:e.price}))),la=(e,t)=>null!=e.pct?t*e.pct:Math.min(e.amount??0,t);function ca(e,t,n){const r=new Map,o=e.offers.filter(e=>"ship"!==e.o.kind).map(e=>"basic"===e.o.kind?function(e,t){const n=e.o,r=sa(t).filter(t=>ra(e.scope,t)),o=r.reduce((e,t)=>e+t.price,0),a=r.length,i=a>0&&(!n.min_amount||o>=n.min_amount)&&(!n.min_qty||a>=n.min_qty),s=i?null!=n.pct?n.pct*o:n.each?r.reduce((e,t)=>e+Math.min(n.amount??0,t.price),0):Math.min(n.amount??0,o):0;return{off:e,applies:i,value:s,disc:i?r:[],amt:o,qty:a,gapAmount:n.min_amount?Math.max(0,n.min_amount-o):null,gapQty:n.min_qty?Math.max(0,n.min_qty-a):null}}(e,t):function(e,t){const n=e.o,r=n.buy_qty||1,o=n.get_qty||1,a=sa(t);if(n.same){const t=a.filter(t=>ra(e.buys,t)).sort((e,t)=>t.price-e.price);let i=Math.floor(t.length/(r+o));n.per_order&&(i=Math.min(i,n.per_order));const s=t.slice(t.length-i*o).sort((e,t)=>e.price-t.price),l=t.length-i*(r+o);return{off:e,applies:i>0,value:s.reduce((e,t)=>e+la(n,t.price),0),disc:s,el:t,earned:l>=r&&(!n.per_order||i<n.per_order)}}const i=a.filter(t=>ra(e.buys,t)),s=a.filter(t=>ra(e.gets,t)).sort((e,t)=>e.price-t.price),l=n.per_order?n.per_order*o:1/0,c=new Set;for(const h of s){if(c.size>=l)break;i.filter(e=>e!==h&&!c.has(e)).length>=r*Math.ceil((c.size+1)/o)&&c.add(h)}const d=s.filter(e=>c.has(e)),u=i.filter(e=>!c.has(e)).length,p=Math.min(Math.floor(u/r)*o,l);return{off:e,applies:d.length>0,value:d.reduce((e,t)=>e+la(n,t.price),0),disc:d,earned:p>d.length,hasGet:s.length>0,hasBuy:u>0}}(e,t));o.forEach(e=>r.set(e.off.o.id,e));const a=o.filter(e=>e.applies&&e.value>0).sort((e,t)=>t.value-e.value),i=a.slice(0,1),s=a.slice(1).some(e=>{return t=i[0].off.o,n=e.off.o,!!t.cw?.[n.cls||"product"]&&!!n.cw?.[t.cls||"product"];var t,n}),l=oa(ia(t))-i.reduce((e,t)=>e+oa(t.value),0),c=e.offers.filter(e=>"ship"===e.o.kind).map(e=>{const t=((e,t)=>!e.countries||!!t.country&&e.countries.includes(t.country))(e.o,n),o={off:e,applies:t&&l>=(e.o.min??0),value:0,disc:[],gap:Math.max(0,(e.o.min??0)-l)};var a,s;return!o.applies||!i.length||(a=i[0].off.o,"rates"===(s=e.o).source||a.ship_ok&&("order"===a.cls?s.with_order:s.with_product))||(o.applies=!1,o.offBy=i[0].off),r.set(e.o.id,o),o}),d=i.concat(c.filter(e=>e.applies));return{st:r,applied:d,ids:new Set(d.map(e=>e.off.o.id)),base:l,stacked:s}}const da=(e,t,n)=>oa(ia(t))-ca(e,t,n).applied.reduce((e,t)=>e+oa(t.value),0);function ua(e,t,n,r){const o=ca(e,t,r);if(o.stacked)return!1;const a=o.applied.reduce((e,t)=>e+t.disc.length,0);return Math.abs(da(e,t,r)-n)<=.01*(a+1)+1e-9}const pa=(e,t,n,r="")=>e.concat([{pid:t,vid:r,qty:1,price:n}]),ha=(e,t,n,r,o,a="")=>da(e,pa(t,n,r,a),o)-da(e,t,o),fa=(e,t,n)=>t.speak&&!n.blocked.has(t.id)&&!("ship"===t.kind&&n.country!==e.pack.main_country)&&(!t.ends_at||new Date(t.ends_at)>new Date),ga=(e,t)=>e.pack.products[t]?.p??0,ma=(e,t)=>e.pack.products[t]?.ty||"",ba=(e,t)=>e.offers.find(n=>"ship"===n.o.kind&&fa(e,n.o,t))?.o??null;function xa(e,t,n){const r=function(e,t,n){const r=e=>!!e&&"basic"===e.off.o.kind&&!e.off.o.scope,o=n.applied.find(e=>r(e));return[...t.ids].filter(e=>!n.ids.has(e)).map(e=>t.st.get(e)).filter(e=>!(e.off.o.free_anyway||r(e)&&o&&o.value>e.value)).map(e=>e.off.o)}(0,t,n);return{block:r.find(e=>"ship"!==e.kind)??null,shipLost:r.find(e=>"ship"===e.kind)??null}}const ya=e=>e.pct??0;function va(e,t){const n=e.applied.find(e=>"basic"===e.off.o.kind&&!e.off.o.scope);return n&&!t.scope&&n.off.o.id!==t.id&&ya(n.off.o)<ya(t)?n.off.o:null}function wa(e,t,n,r,o,a,i){const s=e.offers.find(e=>e.o.id===n)?.o;if(!s||s.ends_at&&new Date(s.ends_at)<=new Date)return!1;const l=ca(e,t,i),c=ca(e,pa(t,r,a,o),i);return c.ids.has(n)&&!c.stacked&&!xa(0,l,c).block}function Ca(e,t,n,r){const o=t.o,a=new Set(n.map(e=>e.pid)),i=t=>!a.has(t)&&!r.sold.has(t)&&!!e.pack.products[t],s=new Set(n.map(t=>ma(e,t.pid)).filter(Boolean)),l=t=>ha(e,n,t,ga(e,t),r);let c=[];if("ship"===o.kind||"basic"===o.kind&&!o.scope&&o.min_amount){const t=e.pack.closers.filter(t=>(t=>!r.sold.has(t)&&!!e.pack.products[t])(t)&&ca(e,pa(n,t,ga(e,t)),r).ids.has(o.id)).map((e,t)=>({id:e,i:t,x:l(e)})).sort((e,t)=>e.x-t.x||e.i-t.i);if(t.length){const n=2*t[0].x;c=[t[0],...t.filter(t=>s.has(ma(e,t.id))&&t.x<=n),...t].map(e=>e.id)}}else if("basic"===o.kind)c=(o.scope?o.picks||[]:e.pack.closers).filter(i);else{c=(o.picks||[]).filter(e=>i(e)&&ra(t.gets,{pid:e,vid:""}));const a=ba(e,r);if(a?.fee){const t=t=>{const o=pa(n,t,ga(e,t));return da(e,o,r)+(ca(e,o,r).ids.has(a.id)?0:a.fee)},o=c.filter(t=>ka(e,n,t,ga(e,t),r)).sort((e,n)=>t(e)-t(n));o.length&&(!c.length||t(o[0])<t(c[0])-.005)&&(c=[o[0],...c])}}return[...new Set(c)].filter(t=>l(t)<=ga(e,t)+.005&&wa(e,n,o.id,t,"",ga(e,t),r)).slice(0,3)}function ka(e,t,n,r,o){const a=ba(e,o);return a&&!ca(e,t,o).ids.has(a.id)&&ca(e,pa(t,n,r),o).ids.has(a.id)?a:null}function ja(e){return null!=e.pct?Math.round(1e3*e.pct)/10+"%":e.amount??0}function Sa(e,t){const n=(t||e.language||"en").toLowerCase(),r=n.split("-")[0],o=e.copy[n]?n:e.copy[r]?r:null;return o?{lang:o,copy:e.copy[o]}:null}const za=new Set(["US","GB","AE","NL","PH","CZ","DO","BS","GM","CF","KM","MV","MH","SB","VA","CD","CG"]),Aa=new Set(["gap","fee","fee_lo","fee_hi","saving","price","paid","eff"]);const Ea=9e3;function Ra(e){const t=Date.parse(e?.checked_at||e?.built_at||"");return e&&Number.isFinite(t)&&Date.now()-t<2592e5?e:null}const Ta=new WeakMap;function _a(e){if(!1===e?.customization?.enable_offer_guide)return!1;const t=Ra(e?.offer_guide);if(!t||!Sa(t,Xe()))return!1;let n=Ta.get(t);return n||(n=aa(t),Ta.set(t,n)),r=n,o=Je($e()??null),r.offers.some(e=>fa(r,e.o,o));var r,o}const Wa=e=>String(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"");function Ia(e,t){const n=t.variants.map(e=>({id:String(e.id),title:String(e.title||""),available:!1!==e.available,price:Number(e.price??0)/100})),r=n.filter(e=>e.available);return{pid:e,title:t.title,image:t.images?.[0]??null,variants:n,chosen:1===r.length?r[0].id:null,state:r.length?"idle":"sold"}}function La(e,t){const n=v.useMemo(()=>Ra(e?.offer_guide),[e?.offer_guide]),o=v.useMemo(()=>n?aa(n):null,[n]),a=v.useMemo(()=>n?Sa(n,Xe()):null,[n]),[i,s]=v.useState(null),[l,c]=v.useState(!1),d=v.useRef(null),u=v.useRef(null),p=v.useRef(!1),h=v.useRef(0),f=v.useRef(t);f.current!==t&&(f.current=t,t||(h.current+=1));const g=v.useRef(null),m=v.useRef(!1),b=$e()??null,x=v.useCallback(e=>{d.current=e,s(e)},[]),y=v.useCallback(e=>{g.current&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{const e=d.current;!e||p.current||e.open||x(null)},e)},[x]),w=v.useCallback((e,t,r={})=>{if(!a||!n)return"";const o=function(e,t,n){return(t?e.copy.offers[t]?.[n]:void 0)??e.copy.ui[n]??null}(a,e,t),i=e?n.offers.find(t=>t.id===e)??null:null;return o?function(e,t,n,r,o){const a={...t};return o&&null==a.off&&(a.off=ja(o)),o?.countries?.length&&null==a.country&&(a.country=function(e,t){try{const n=new Intl.DisplayNames([t],{type:"region"}).of(e)||e;return"en"===t&&za.has(e)?`the ${n}`:n}catch{return e}}(o.countries[0],r)),e.replace(/\{([a-z_]+)\}/g,(e,t)=>{const r=a[t];return null==r?e:"number"!=typeof r||!Aa.has(t)&&"off"!==t?String(r):me(r,n.currency)})}(o,r,n,a.lang,i):""},[a,n]),C=v.useCallback((e,t,n,r,a=()=>!0)=>{if(!o)return null;const i=e.variants.map(i=>({...i,available:i.available&&wa(o,n,t,e.pid,i.id,i.price,r)&&a(i)})),s=i.filter(e=>e.available);if(!s.length)return null;const l=1===s.length?s[0].id:s.some(t=>t.id===e.chosen)?e.chosen:null;return{...e,variants:i,chosen:l}},[o]),k=v.useCallback(async()=>{const e=h.current;if(!o||!a||!t||p.current||et()||tt())return;const n=d.current;if(n&&(n.open||n.result))return;const i=await nt(),s=Je(b);if(!i||i.unknown||i.currency!==o.pack.currency||!ua(o,i.lines,i.total,s))return void(n&&x(null));if(u.current=i,n&&n.cart===rt(i.lines))return;const l=await async function(){const e=window.ShopifyAnalytics?.meta?.product;if(!e?.id||!Array.isArray(e.variants)||!e.variants.length)return null;const t=new URLSearchParams(window.location.search).get("variant"),n=e.variants.find(e=>String(e.id)===t)??(1===e.variants.length?e.variants[0]:null),r=n?Number(n.price)/100:Math.min(...e.variants.map(e=>Number(e.price)/100));return{pid:String(e.id),vid:n?String(n.id):"",price:r}}(),c=function(e,t,n,r){const o=ca(e,t,r);if(o.stacked)return{quiet:"two discounts combine here"};const a=ia(t);if(n&&!t.some(e=>e.pid===n.pid)){const a=pa(t,n.pid,n.price,n.vid),i=ca(e,a,r),{block:s,shipLost:l}=xa(0,o,i),c=i.applied.filter(t=>fa(e,t.off.o,r)&&(!o.ids.has(t.off.o.id)||t.value>(o.st.get(t.off.o.id)?.value??0)+.001));if(c.length&&!s&&!i.stacked){const i=c[0],s=i.off.o,d={offer:s.id,cta:"add_this",picks:[n.pid],shipNote:!!l};if("ship"===s.kind)return{...d,key:t.length?"page_add":"page_alone",vars:{}};if("basic"===s.kind){const e=va(o,s);return e?{...d,key:"page_move",vars:{from:ja(e)}}:{...d,key:"page_add",vars:{}}}if(s.same){const n=da(e,a,r)-da(e,t,r);return{...d,key:"page_add",vars:{n:i.el?.length??0},costsNothing:Math.abs(n)<.005}}return{...d,key:ra(i.off.gets,n)?"page_get":"page_buy",vars:{}}}}for(const i of e.offers){const n=i.o,a=o.st.get(n.id);if("bxgy"!==n.kind||!a.earned||!fa(e,n,r))continue;const s=Ca(e,i,t,r);if(!s.length)continue;const l=s[0],c=ca(e,pa(t,l,ga(e,l)),r);if(!c.ids.has(n.id)||c.stacked)continue;const{block:d,shipLost:u}=xa(0,o,c);if(d)continue;if(n.same){const t=Math.min(ga(e,l),...(a.el??[]).map(e=>e.price));if(la(n,t)<.2*ga(e,l))continue;return{offer:n.id,key:"earned",vars:{},cta:"see_picks",picks:s,shipNote:!!u}}const p=!!i.gets&&1===i.gets.p.size;return{offer:n.id,key:"earned",vars:{},cta:p?"add_it":"see_picks",picks:s,shipNote:!!u}}for(const i of e.offers){const n=i.o,a=o.st.get(n.id);if("bxgy"!==n.kind||n.same||!a.hasGet||a.hasBuy||r.infoSeen.has(`lost-${n.id}`)||!fa(e,n,r))continue;const s=t.find(e=>ra(i.gets,e));if(s)return{offer:n.id,key:"lost",vars:{price:s.price},cta:"info",picks:[],shipNote:!1,once:`lost-${n.id}`}}for(const i of e.offers){const n=i.o,s=o.st.get(n.id);if(!fa(e,n,r)||s.applies||!t.length)continue;const l="ship"===n.kind?s.gap??0:"basic"===n.kind&&!n.scope&&n.min_amount?s.gapAmount??0:0;if(l>0){if(l>.5*a)continue;const s=Ca(e,i,t,r);if(!s.length)continue;const c=s[0];if("basic"===n.kind&&ha(e,t,c,ga(e,c),r)>.8*ga(e,c))continue;const d=ca(e,pa(t,c,ga(e,c)),r),{block:u,shipLost:p}=xa(0,o,d);if(u||d.stacked)continue;const h={offer:n.id,cta:"see_picks",picks:s,shipNote:!!p};if("ship"===n.kind)return null!=n.fee?{...h,key:"gap_fee",vars:{gap:l,fee:n.fee}}:n.fee_range?{...h,key:"gap_fee",vars:{gap:l,fee_lo:n.fee_range[0],fee_hi:n.fee_range[1]}}:{...h,key:"gap",vars:{gap:l}};const f=va(o,n);return f?{...h,key:"gap_move",vars:{gap:l,from:ja(f)}}:{...h,key:"gap",vars:{gap:l}}}if("basic"===n.kind&&n.min_qty&&1===s.gapQty){const a=Ca(e,i,t,r);if(!a.length)continue;const s=ca(e,pa(t,a[0],ga(e,a[0])),r),{block:l,shipLost:c}=xa(0,o,s);if(!s.ids.has(n.id)||l||s.stacked)continue;const d=n.scope?null:va(o,n);return{offer:n.id,key:d?"one_more_move":"one_more",vars:d?{from:ja(d)}:{},cta:"see_picks",picks:a,shipNote:!!c}}}if(n)for(const i of e.offers){const t=i.o,a=o.st.get(t.id);if(!r.infoSeen.has(t.id)&&!o.ids.has(t.id)&&fa(e,t,r)){if("basic"===t.kind){if(!t.scope||!t.min_qty||!ra(i.scope,n))continue}else{if("bxgy"!==t.kind)continue;if(!ra(i.buys,n)||(t.same?(a.el?.length??0)>0:a.hasBuy))continue}return{offer:t.id,key:"info",vars:{},cta:"info",picks:[],shipNote:!1,once:t.id}}}return{quiet:"nothing true and worth saying here"}}(o,i.lines,l,s);if("quiet"in c)return void(n&&x(null));if("info"===c.cta&&m.current)return;const g=`${c.offer}|${c.key}|${rt(i.lines)}|${l?.pid??""}`;if(n?.sig===g||ot(g))return;const v=o.pack.offers.find(e=>e.id===c.offer)??null,k={sig:g,cart:rt(i.lines),decision:c,offer:v,line:w(c.offer,c.key,c.vars)+(c.costsNothing?` ${w(null,"costs_nothing")}`:""),note:c.shipNote?w(null,"ship_note"):null,head:"see_picks"===c.cta&&w(c.offer,"picks_head")||null,open:!1,rows:null,result:null,used:!1};if(k.line){if("add_this"===c.cta||"add_it"===c.cta){const e=c.picks[0],t=o.pack.products[e]?.h??("add_this"===c.cta?window.location.pathname.match(/\/products\/([^/?#]+)/)?.[1]:null),n=t?await he(decodeURIComponent(t)).catch(()=>null):null;if(!n)return;const r=Ia(e,n),a=t=>!c.costsNothing||Math.abs(ha(o,i.lines,e,t.price,s,t.id))<.005,d="sold"===r.state?null:C(r,c.offer,i.lines,s,a);if(!d)return;if("add_this"===c.cta&&l?.vid&&d.variants.some(e=>e.id===l.vid&&e.available)&&(d.chosen=l.vid),"add_it"===c.cta&&!d.chosen){const e=i.lines.find(e=>e.vt&&d.variants.some(t=>t.available&&Wa(t.title)===Wa(e.vt))),t=e&&d.variants.find(t=>t.available&&Wa(t.title)===Wa(e.vt));t&&(d.chosen=t.id,k.line=w(c.offer,"earned_size",c.vars)||k.line)}k.rows=[d]}e===h.current&&f.current&&(at(g),m.current=!0,c.once&&it(c.once),st(k.line,i),x(k),y(15e3),r("offer_guide_shown",{offer:c.offer,key:c.key,cta:c.cta,kind:v?.kind,lang:a.lang}))}},[o,a,t,b,w,x,y,C]),j=v.useCallback(async()=>{try{await k()}finally{c(!0)}},[k]);v.useEffect(()=>{if(!o||!a||!t)return;let e=null;const n=window.setTimeout(()=>{j()},1500),r=()=>{e&&window.clearTimeout(e),e=window.setTimeout(()=>{j()},800)};return window.addEventListener(lt,r),()=>{window.clearTimeout(n),e&&window.clearTimeout(e),window.removeEventListener(lt,r)}},[o,a,t,j]),v.useEffect(()=>()=>{h.current+=1,g.current&&window.clearTimeout(g.current)},[]);const S=v.useCallback(e=>{const t=d.current;t&&x(e(t))},[x]),z=v.useCallback(async()=>{const e=d.current;if(!e||!o)return;if(e.open)return;if(g.current&&window.clearTimeout(g.current),ct(),r("offer_guide_unfolded",{offer:e.decision.offer,key:e.decision.key}),e.rows)return void S(e=>({...e,open:!0}));S(e=>({...e,open:!0}));const t=Je(b),n=(await Promise.all(e.decision.picks.map(async n=>{const r=o.pack.products[n]?.h,a=r?await he(r).catch(()=>null):null;if(!a)return null;const i=Ia(n,a);return"sold"===i.state&&dt(n),"sold"===i.state||t.sold.has(n)?null:C(i,e.decision.offer,u.current?.lines??[],t)}))).filter(e=>!!e);S(t=>t.sig===e.sig?{...t,rows:n}:t)},[o,b,S,C]),A=v.useCallback(()=>{const e=d.current;e?.open&&(S(e=>({...e,open:!1})),e.used&&y(Ea))},[S,y]),E=v.useCallback(e=>{const t=e.variants.find(t=>t.id===e.chosen)??e.variants.filter(e=>e.available).sort((e,t)=>e.price-t.price)[0],r=t?.price??0,a=u.current?.lines??[];if(!o||!n||"added"===e.state)return{price:r,pay:null,note:null};const i=Je(b),s=ca(o,a.concat([{pid:e.pid,vid:t?.id??"",qty:1,price:r}]),i).applied.find(t=>"bxgy"===t.off.o.kind&&t.disc.some(t=>t.pid===e.pid)),l=ha(o,a,e.pid,r,i,t?.id??""),c=[];let d=null;s&&Math.abs(l-r)>.005?d=Math.max(0,l):Math.abs(l-r)>.005&&c.push(w(null,"adds_to_total",{eff:l}));const p=ka(o,a,e.pid,r,i);return p&&c.push(w(p.id,"reaches")),function(e,t,n,r,o,a){return!!xa(0,ca(e,t,a),ca(e,pa(t,n,o,r),a)).shipLost}(o,a,e.pid,t?.id??"",r,i)&&c.push(w(null,"ship_note")),{price:r,pay:d,note:c.filter(Boolean).join(" · ")||null}},[o,n,b,w]),R=v.useCallback((e,t)=>{S(n=>({...n,rows:n.rows?.map(n=>n.pid===e?{...n,chosen:t}:n)??null}))},[S]),T=v.useCallback(async e=>{const t=d.current,a=t?.rows?.find(t=>t.pid===e);if(!t||!a||!a.chosen||!o||p.current)return;const i=a.variants.find(e=>e.id===a.chosen);if(!i)return;p.current=!0,g.current&&window.clearTimeout(g.current),S(t=>({...t,rows:t.rows?.map(t=>t.pid===e?{...t,state:"adding"}:t)??null}));const s=Je(b),l=await nt();if(!Ra(n)||!l||l.unknown||l.currency!==o.pack.currency||rt(l.lines)!==t.cart||!ua(o,l.lines,l.total,s)||!wa(o,l.lines,t.decision.offer,e,i.id,i.price,s))return p.current=!1,x(null),void j();const c=await ut(i.id,t.decision.offer),h="success"===c.type||"out_of_stock"===c.reason?l:await nt(),f="success"===c.type||!!h&&pt(h,i.id)>pt(l,i.id);let m,v=!1,C="idle",k=null;if(f){C="added";const n=await nt();u.current=n;const c=!!n&&!n.unknown&&n.currency===l.currency;if(k=c&&"bxgy"===t.offer?.kind?oa(n.total-l.total):null,c&&ua(o,n.lines,n.total,s)){const r=function(e,t,n,r,o,a,i,s){const l=e.offers.find(e=>e.o.id===t)??null,c=l?.o??null,d=s??da(e,r,i)-da(e,n,i),u=ca(e,r,i),p=ca(e,n,i).applied.find(e=>"ship"===e.off.o.kind),h=p?u.st.get(p.off.o.id):void 0,f=!(!p||!h||h.applies||!h.offBy||p.off.o.free_anyway),g=(e,t={},n=!1)=>({key:e,from:"ui",vars:t,ok:n,shipNote:f});if(!c)return d<a-.005?g("added_cost",{eff:d}):g("added");if("ship"===c.kind){const t=u.st.get(c.id);return fa(e,c,i)?t.applies?{key:"added_reached",from:"offer",vars:{},ok:!0,shipNote:f}:{key:"added_gap",from:"offer",vars:{gap:t.gap??0},ok:!0,shipNote:f}:g("added")}const m=u.applied.find(e=>e.off.o.id===c.id);if(d<a-.005){if(!m)return g("added_cost",{eff:d});if("basic"===c.kind)return{key:"added",from:"offer",vars:{saving:oa(m.value)},ok:!0,shipNote:f};if(c.same){const t=m.disc[0];return t?{key:"added",from:"offer",vars:{title:e.pack.products[t.pid]?.t??"",price:t.price},ok:!0,shipNote:f}:g("added_cost",{eff:d},!0)}return"bxgy"!==c.kind||m.disc.some(e=>e.pid===o)?{key:"added",from:"offer",vars:{paid:oa(d),price:a},ok:!0,shipNote:f}:g("added_cost",{eff:d},!0)}if(Math.abs(d-a)<.005){if("bxgy"===c.kind&&!c.same){const t=m?.disc.find(e=>e.pid!==o),n=t?e.pack.products[t.pid]?.t:null;if(n)return{key:"added_full_went",from:"offer",vars:{title:n},ok:!1,shipNote:f}}return g("added_full")}return g("added_cost",{eff:d})}(o,t.decision.offer,l.lines,n.lines,e,i.price,s,k);m=w("offer"===r.from?t.decision.offer:null,r.key,r.vars)+(r.shipNote?` ${w(null,"ship_note")}`:""),v=r.ok}else m=w(null,"added");const d=t.offer;d&&"ship"!==d.kind&&c&&n.total-l.total>=i.price-.005&&!ca(o,n.lines,s).ids.has(d.id)&&ht(d.id),ft(a.title),r("offer_guide_add",{offer:t.decision.offer,ok:!0,promised:v,kind:d?.kind})}else"out_of_stock"===c.reason?(dt(e),C="sold",m=w(null,"sold_out_now")):h?m=w(null,"add_failed"):(C="unsure",m=w(null,"unsure")),r("offer_guide_add",{offer:t.decision.offer,ok:!1,reason:h?c.reason:"unread"});gt(m),p.current=!1,S(t=>({...t,used:!0,rows:t.rows?.map(t=>t.pid===e?{...t,state:C,paid:k}:t)??null,result:{text:m,ok:v,undoVid:"added"===C?i.id:null}})),y(Ea)},[o,b,w,S,y,x,j]),_=v.useCallback(async()=>{const e=d.current,t=e?.result?.undoVid;if(!e||!t||p.current)return;p.current=!0,g.current&&window.clearTimeout(g.current);const n=await mt(t,e.decision.offer),o="done"===n;p.current=!1,r("offer_guide_undo",{offer:e.decision.offer,ok:o});const a=e.rows?.find(e=>e.variants.some(e=>e.id===t));o&&a&&bt(a.title),S(e=>({...e,rows:o?e.rows?.map(e=>e.variants.some(e=>e.id===t)?{...e,state:"idle",paid:null}:e)??null:e.rows,result:{text:w(null,o?"removed":"failed"===n?"undo_failed":"unsure"),ok:!1,undoVid:"failed"===n?t:null}})),u.current=await nt(),y(Ea)},[w,S,y]),W=v.useCallback(()=>{const e=d.current;h.current+=1,xt(),ta(),yt(),vt(),x(null),r("offer_guide_closed",{offer:e?.decision.offer,used:!!e?.used})},[x]),I=v.useCallback(e=>me(e,n?.currency),[n?.currency]);return{view:i,looked:l,unfold:z,fold:A,choose:R,add:T,undo:_,close:W,rowFacts:E,say:w,money:I}}const Ma=v.forwardRef(function({hookText:e,cta:t,maxW:n,onStart:r,onDismiss:o},a){return w.jsx(No,{maxW:n,icon:w.jsx(ln,{boxSize:"16px"}),closeLabel:"Close",onClose:o,action:w.jsx(I,{ref:a,...Oo,onClick:r,children:t}),children:w.jsx(D,{as:"button",onClick:r,w:"full",textAlign:"start",cursor:"pointer",tabIndex:-1,children:w.jsx(Z,{fontSize:"13px",fontWeight:600,color:"text",lineHeight:"1.3",lineClamp:1,fontFamily:V,children:e})})})});function Ba(e,t,n,r){const o=e%10,a=e%100;return 1===o&&11!==a?t:o>=2&&o<=4&&(a<12||a>14)?n:r}const Fa={English:{subtitle:e=>`Answer ${e} quick question${e>1?"s":""} for personalized recommendations`,cta:"Start →",skip:"Or open chat instead"},Czech:{subtitle:e=>`Odpovězte na ${e} ${1===e?"otázku":"otázky"} pro personalizovaná doporučení`,cta:"Začít →",skip:"Nebo otevřít chat"},German:{subtitle:e=>`Beantworten Sie ${e} kurze Frage${e>1?"n":""} für persönliche Empfehlungen`,cta:"Starten →",skip:"Oder Chat öffnen"},Hungarian:{subtitle:e=>`Válaszolj ${e} gyors kérdésre személyre szabott ajánlásokért`,cta:"Indítás →",skip:"Vagy nyisd meg a chatet"},Persian:{subtitle:e=>`به ${e} سوال کوتاه پاسخ بدید تا پیشنهادات شخصی دریافت کنید`,cta:"شروع →",skip:"یا چت را باز کنید"},French:{subtitle:e=>`Répondez à ${e} question${e>1?"s":""} rapide${e>1?"s":""} pour des recommandations personnalisées`,cta:"Commencer →",skip:"Ou ouvrir le chat"},Spanish:{subtitle:e=>`Responde ${e} pregunta${e>1?"s":""} rápida${e>1?"s":""} para recomendaciones personalizadas`,cta:"Empezar →",skip:"O abrir el chat"},Arabic:{subtitle:e=>`أجب عن ${e} ${1===e?"سؤال سريع":"أسئلة سريعة"} للحصول على توصيات مخصصة`,cta:"ابدأ →",skip:"أو افتح المحادثة"},Turkish:{subtitle:e=>`Kişiselleştirilmiş öneriler için ${e} hızlı soruyu yanıtlayın`,cta:"Başla →",skip:"Veya sohbeti aç"},Portuguese:{subtitle:e=>`Responda ${e} pergunta${e>1?"s":""} rápida${e>1?"s":""} para recomendações personalizadas`,cta:"Começar →",skip:"Ou abrir o chat"},Italian:{subtitle:e=>`Rispondi a ${e} ${1===e?"domanda veloce":"domande veloci"} per raccomandazioni personalizzate`,cta:"Inizia →",skip:"Oppure apri la chat"},Japanese:{subtitle:e=>`${e}つの質問に答えるだけで、あなたにぴったりのおすすめをご提案します`,cta:"はじめる →",skip:"チャットで相談する"},Chinese:{subtitle:e=>`回答${e}个简单问题,获取专属推荐`,cta:"开始 →",skip:"或直接打开聊天"},Korean:{subtitle:e=>`${e}개의 간단한 질문에 답하고 맞춤 추천을 받아보세요`,cta:"시작하기 →",skip:"또는 채팅 열기"},Russian:{subtitle:e=>`Ответьте на ${e} ${Ba(e,"короткий вопрос","коротких вопроса","коротких вопросов")}, чтобы получить персональные рекомендации`,cta:"Начать →",skip:"Или открыть чат"},Ukrainian:{subtitle:e=>`Дайте відповідь на ${e} ${Ba(e,"коротке запитання","короткі запитання","коротких запитань")}, щоб отримати персональні рекомендації`,cta:"Почати →",skip:"Або відкрити чат"},Polish:{subtitle:e=>`Odpowiedz na ${e} ${function(e){if(1===e)return"krótkie pytanie";const t=e%10,n=e%100;return t>=2&&t<=4&&(n<12||n>14)?"krótkie pytania":"krótkich pytań"}(e)}, aby otrzymać spersonalizowane rekomendacje`,cta:"Zacznij →",skip:"Lub otwórz czat"},Slovak:{subtitle:e=>`Odpovedzte na ${e} ${1===e?"krátku otázku":e<5?"krátke otázky":"krátkych otázok"} a získajte odporúčania na mieru`,cta:"Začať →",skip:"Alebo otvoriť chat"},Bulgarian:{subtitle:e=>`Отговорете на ${e} ${1===e?"кратък въпрос":"кратки въпроса"} за персонални препоръки`,cta:"Започни →",skip:"Или отвори чата"},Croatian:{subtitle:e=>`Odgovorite na ${e} ${Ba(e,"kratko pitanje","kratka pitanja","kratkih pitanja")} za osobne preporuke`,cta:"Započni →",skip:"Ili otvori chat"},Dutch:{subtitle:e=>`Beantwoord ${e} korte ${1===e?"vraag":"vragen"} voor persoonlijke aanbevelingen`,cta:"Starten →",skip:"Of open de chat"},Swedish:{subtitle:e=>`Svara på ${e} ${1===e?"snabb fråga":"snabba frågor"} för personliga rekommendationer`,cta:"Börja →",skip:"Eller öppna chatten"},Norwegian:{subtitle:e=>`Svar på ${e} ${1===e?"raskt spørsmål":"raske spørsmål"} for personlige anbefalinger`,cta:"Start →",skip:"Eller åpne chatten"},Danish:{subtitle:e=>`Svar på ${e} ${1===e?"hurtigt spørgsmål":"hurtige spørgsmål"} for personlige anbefalinger`,cta:"Start →",skip:"Eller åbn chatten"},Finnish:{subtitle:e=>`Vastaa ${e} lyhyeen kysymykseen ja saat henkilökohtaisia suosituksia`,cta:"Aloita →",skip:"Tai avaa chat"},Estonian:{subtitle:e=>`Vasta ${e} lühikesele küsimusele ja saa isikupärastatud soovitusi`,cta:"Alusta →",skip:"Või ava vestlus"},Latvian:{subtitle:e=>`Atbildiet uz ${e} ${e%10==1&&e%100!=11?"īsu jautājumu":"īsiem jautājumiem"} un saņemiet personalizētus ieteikumus`,cta:"Sākt →",skip:"Vai atvērt tērzēšanu"},Lithuanian:{subtitle:e=>`Atsakykite į ${e} ${e%10==1&&e%100!=11?"trumpą klausimą":e%10>=2&&(e%100<10||e%100>=20)?"trumpus klausimus":"trumpų klausimų"} ir gaukite asmeninių rekomendacijų`,cta:"Pradėti →",skip:"Arba atidarykite pokalbį"},Greek:{subtitle:e=>`Απαντήστε σε ${e} ${1===e?"σύντομη ερώτηση":"σύντομες ερωτήσεις"} για εξατομικευμένες προτάσεις`,cta:"Έναρξη →",skip:"Ή ανοίξτε τη συνομιλία"},Romanian:{subtitle:e=>`Răspunde la ${e} ${1===e?"întrebare scurtă":"întrebări scurte"} pentru recomandări personalizate`,cta:"Începe →",skip:"Sau deschide chatul"},Albanian:{subtitle:e=>`Përgjigjuni ${e} ${1===e?"pyetjeje të shkurtër":"pyetjeve të shkurtra"} për rekomandime të personalizuara`,cta:"Fillo →",skip:"Ose hap bisedën"},Hebrew:{subtitle:e=>1===e?"ענו על שאלה קצרה אחת לקבלת המלצות מותאמות אישית":`ענו על ${e} שאלות קצרות לקבלת המלצות מותאמות אישית`,cta:"התחלה →",skip:"או פתחו את הצ׳אט"},Urdu:{subtitle:e=>`ذاتی سفارشات کے لیے ${e} مختصر ${1===e?"سوال":"سوالات"} کے جواب دیں`,cta:"شروع کریں →",skip:"یا چیٹ کھولیں"},Hindi:{subtitle:e=>`व्यक्तिगत सुझावों के लिए ${e} ${1===e?"छोटे सवाल":"छोटे सवालों"} का जवाब दें`,cta:"शुरू करें →",skip:"या चैट खोलें"},Bengali:{subtitle:e=>`ব্যক্তিগত সুপারিশ পেতে ${e}টি ছোট প্রশ্নের উত্তর দিন`,cta:"শুরু করুন →",skip:"অথবা চ্যাট খুলুন"},Tamil:{subtitle:e=>`தனிப்பட்ட பரிந்துரைகளுக்கு ${e} சிறிய ${1===e?"கேள்விக்கு":"கேள்விகளுக்கு"} பதிலளிக்கவும்`,cta:"தொடங்கு →",skip:"அல்லது அரட்டையைத் திற"},Telugu:{subtitle:e=>`వ్యక్తిగత సిఫార్సుల కోసం ${e} చిన్న ${1===e?"ప్రశ్నకు":"ప్రశ్నలకు"} సమాధానం ఇవ్వండి`,cta:"ప్రారంభించండి →",skip:"లేదా చాట్ తెరవండి"},Thai:{subtitle:e=>`ตอบคำถามสั้นๆ ${e} ข้อ เพื่อรับคำแนะนำเฉพาะคุณ`,cta:"เริ่มเลย →",skip:"หรือเปิดแชท"},Vietnamese:{subtitle:e=>`Trả lời ${e} câu hỏi ngắn để nhận gợi ý dành riêng cho bạn`,cta:"Bắt đầu →",skip:"Hoặc mở trò chuyện"},Indonesian:{subtitle:e=>`Jawab ${e} pertanyaan singkat untuk rekomendasi yang dipersonalisasi`,cta:"Mulai →",skip:"Atau buka obrolan"},Malay:{subtitle:e=>`Jawab ${e} soalan ringkas untuk cadangan yang diperibadikan`,cta:"Mula →",skip:"Atau buka sembang"},Swahili:{subtitle:e=>`Jibu ${1===e?"swali 1 fupi":`maswali ${e} mafupi`} upate mapendekezo yanayokufaa`,cta:"Anza →",skip:"Au fungua gumzo"},Filipino:{subtitle:e=>`Sagutin ang ${e} maikling tanong para sa mga personal na rekomendasyon`,cta:"Simulan →",skip:"O buksan ang chat"},Iraqi:{subtitle:e=>`جاوب على ${e} ${1===e?"سؤال سريع":"أسئلة سريعة"} حتى تحصل على اقتراحات تناسبك`,cta:"ابدأ →",skip:"أو افتح المحادثة"},Amharic:{subtitle:e=>`ለግል ምክሮች ${e} አጭር ጥያቄ${1===e?"":"ዎች"}ን ይመልሱ`,cta:"ጀምር →",skip:"ወይም ውይይቱን ይክፈቱ"},Burmese:{subtitle:e=>`သင့်အတွက် အကြံပြုချက်များ ရရန် မေးခွန်းတို ${e} ခုကို ဖြေဆိုပါ`,cta:"စတင်ရန် →",skip:"သို့မဟုတ် ချက်တင်ကို ဖွင့်ပါ"},Gujarati:{subtitle:e=>`વ્યક્તિગત ભલામણો માટે ${e} ટૂંકા ${1===e?"પ્રશ્નનો":"પ્રશ્નોના"} જવાબ આપો`,cta:"શરૂ કરો →",skip:"અથવા ચેટ ખોલો"},Hausa:{subtitle:e=>`Amsa ${1===e?"tambaya 1 gajera":`tambayoyi ${e} gajeru`} don samun shawarwari na musamman`,cta:"Fara →",skip:"Ko buɗe hira"},Igbo:{subtitle:e=>`Zaa ajụjụ ${e} dị mkpụmkpụ maka ndụmọdụ ahaziri gị`,cta:"Malite →",skip:"Ma ọ bụ mepee nkata"},Kannada:{subtitle:e=>`ವೈಯಕ್ತಿಕ ಶಿಫಾರಸುಗಳಿಗಾಗಿ ${e} ಚಿಕ್ಕ ${1===e?"ಪ್ರಶ್ನೆಗೆ":"ಪ್ರಶ್ನೆಗಳಿಗೆ"} ಉತ್ತರಿಸಿ`,cta:"ಪ್ರಾರಂಭಿಸಿ →",skip:"ಅಥವಾ ಚಾಟ್ ತೆರೆಯಿರಿ"},Khmer:{subtitle:e=>`ឆ្លើយសំណួរខ្លីៗ ${e} ដើម្បីទទួលបានការណែនាំសម្រាប់អ្នក`,cta:"ចាប់ផ្តើម →",skip:"ឬបើកការជជែក"},Lao:{subtitle:e=>`ຕອບຄຳຖາມສັ້ນໆ ${e} ຂໍ້ ເພື່ອຮັບຄຳແນະນຳສະເພາະທ່ານ`,cta:"ເລີ່ມ →",skip:"ຫຼື ເປີດແຊັດ"},Malayalam:{subtitle:e=>`വ്യക്തിഗത ശുപാർശകൾക്കായി ${e} ചെറിയ ${1===e?"ചോദ്യത്തിന്":"ചോദ്യങ്ങൾക്ക്"} ഉത്തരം നൽകുക`,cta:"തുടങ്ങുക →",skip:"അല്ലെങ്കിൽ ചാറ്റ് തുറക്കുക"},Marathi:{subtitle:e=>`वैयक्तिक शिफारशींसाठी ${e} ${1===e?"छोट्या प्रश्नाचे":"छोट्या प्रश्नांची"} उत्तरे द्या`,cta:"सुरू करा →",skip:"किंवा चॅट उघडा"},Mongolian:{subtitle:e=>`Танд тохирсон зөвлөмж авахын тулд ${e} богино асуултад хариулна уу`,cta:"Эхлэх →",skip:"Эсвэл чат нээх"},Nepali:{subtitle:e=>`व्यक्तिगत सुझावका लागि ${e} वटा छोटा प्रश्नको जवाफ दिनुहोस्`,cta:"सुरु गर्नुहोस् →",skip:"वा च्याट खोल्नुहोस्"},Pashto:{subtitle:e=>`د شخصي وړاندیزونو لپاره ${e} لنډو ${1===e?"پوښتنې":"پوښتنو"} ته ځواب ورکړئ`,cta:"پیل →",skip:"یا چیټ پرانیزئ"},Punjabi:{subtitle:e=>`ਨਿੱਜੀ ਸਿਫ਼ਾਰਸ਼ਾਂ ਲਈ ${e} ਛੋਟੇ ${1===e?"ਸਵਾਲ":"ਸਵਾਲਾਂ"} ਦੇ ਜਵਾਬ ਦਿਓ`,cta:"ਸ਼ੁਰੂ ਕਰੋ →",skip:"ਜਾਂ ਚੈਟ ਖੋਲ੍ਹੋ"},Sinhala:{subtitle:e=>`ඔබට ගැළපෙන නිර්දේශ ලබා ගැනීමට කෙටි ප්‍රශ්න ${e}කට පිළිතුරු දෙන්න`,cta:"අරඹන්න →",skip:"නැතහොත් කතාබහ විවෘත කරන්න"},Somali:{subtitle:e=>`Ka jawaab ${e} ${1===e?"su'aal gaaban":"su'aalood oo gaagaaban"} si aad u hesho talooyin kuu gaar ah`,cta:"Bilow →",skip:"Ama fur wada-sheekaysiga"},Yoruba:{subtitle:e=>`Dáhùn ìbéèrè kúkúrú ${e} láti gba àbá tó bá ọ mu`,cta:"Bẹ̀rẹ̀ →",skip:"Tàbí ṣí ìjíròrò"},Zulu:{subtitle:e=>`Phendula ${1===e?"umbuzo omfushane o-1":`imibuzo emifushane engu-${e}`} ukuze uthole iziphakamiso ezenzelwe wena`,cta:"Qala →",skip:"Noma vula ingxoxo"},Afrikaans:{subtitle:e=>`Beantwoord ${e} kort ${1===e?"vraag":"vrae"} vir persoonlike aanbevelings`,cta:"Begin →",skip:"Of maak die klets oop"}},Da={subtitle:e=>`Beantworte ${e} kurze Frage${e>1?"n":""} für persönliche Empfehlungen`,cta:"Starten →",skip:"Oder Chat öffnen"};function Ha(e,t=!1){const n=wt(e),r=Object.keys(Fa).find(e=>e.toLowerCase()===n.toLowerCase()),o=Fa[e]||Fa[n]||(r?Fa[r]:void 0)||Fa.English;return t&&o===Fa.German?Da:o}let Pa=!1;const qa=({quiz:e,isMobile:t,layer:n,pillMaxW:r,panelW:o,panelMaxH:a})=>{const{phase:i,open:s,flow:l,text:c,handleStart:d,handleDismiss:u,handleCollapse:p,handleComplete:h,handleSkipToChat:f}=e,g=v.useRef(null);if("hidden"===i||!l)return null;const m={isMobile:t,layer:n,w:o,maxH:a,onCollapse:p,onClosed:()=>g.current?.focus()};return w.jsxs(w.Fragment,{children:[!s&&w.jsx(Ma,{ref:g,hookText:l.welcome_hook,cta:c.cta,maxW:r,onStart:d,onDismiss:u}),"expanded"===i&&w.jsxs(Qo,{...m,open:s,label:l.entry_label,children:[w.jsx(kr,{flow:l,onComplete:h,onClose:u}),w.jsx(D,{as:"button",onClick:f,display:"block",mx:"auto",mt:1,fontSize:"12px",color:"mutedText",textDecoration:"underline",fontFamily:V,cursor:"pointer",children:c.skip})]})]})},Oa={own:3e3,hook:6400};function Na(e){const t=e.codePointAt(0)??0;return t>=19968&&t<=40959||t>=13312&&t<=19903||t>=12352&&t<=12543?4:t>=44032&&t<=55215?3:t>=1536&&t<=1791||t>=1872&&t<=1919?1.6:1}function Ya(e){const t=e?.feature_flags?.bubble_seconds;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:null}function Va(e){const t=e?.feature_flags?.bubble_stay;return"until_closed"===t?"until_closed":"seconds"===t&&null!==Ya(e)?"seconds":"read"}function Za(e,t,n,r=Oa.own){const o=Va(e);if("until_closed"===o)return null;if("seconds"===o)return 1e3*Math.min(20,Math.max(3,Ya(e)));const a="own"===n?r:Oa[n];return Math.min(1e4,Math.max(a,function(e){let t=0;for(const n of e)t+=Na(n);return Math.round(1e3+55*t)}(t)))}const Ua=["homepage","category","product","search","cart","other"],Qa={home:"homepage",collection:"category",product:"product",searchresults:"search",search:"search",cart:"cart"};function Ka(){if("undefined"==typeof window)return"other";try{const e=window.ShopifyAnalytics?.meta?.page?.pageType;if("string"==typeof e&&e)return Qa[e.toLowerCase()]??"other"}catch{}return Ct()}function Ga(e){return!(!function(e,t=Ka()){const n=function(e){const t=e?.customization?.quiz_pages;if(!Array.isArray(t))return null;const n=Ua.filter(e=>t.includes(e));return n.length?n:null}(e);return null===n||n.includes(t)}(e)||"product"===Ka()&&_a(e))}const Xa=({onClick:e,suppressBubble:t=!1,slot:n})=>{const{botData:r,diagnosticFlow:o,diagnosticShown:a,proactiveSuppressedThisSession:i,suppressProactiveForSession:s,effectiveFabCta:l,handover:c,handoverUnread:d}=H(),{t:h}=q(),f=Bt("colors","primary"),g=Bt("colors","background"),m=Bt("colors","lightBackground"),b=oe(f),x=Array.isArray(f)?f[0]:f,y=kt(g,m),C=function(e,t){if(t)return null;const n=e?.feature_flags?.fab_pill_each_page_seconds;return"number"!=typeof n||!Number.isFinite(n)||n<=0?null:Math.min(10,Math.max(1,n))}(r,!!Pn(r)),k="until_closed"===Va(r)&&!r?.customization?.disable_welcome_popup,[j,S]=v.useState(()=>k&&!jt()||!k&&!St()&&!zt()&&u()||null!==C&&!tt()?"expanded":"minimized"),[z,A]=v.useState(!1),[E,R]=v.useState(!1),[T,_]=v.useState(!1),[W,L]=v.useState(!1),[M,B]=v.useState(!1),F=v.useRef(null),P=()=>{F.current&&(clearTimeout(F.current),F.current=null)},O=yr(r?.merchant_support_channels).length>0,U=()=>{P(),!ee&&O&&(_(!0),L(!0))};v.useEffect(()=>()=>P(),[]);const Q=!0!==r?.customization?.disable_idle_animation,{getStarfieldTransform:K,getIconStyle:G}=Hn({enableTwinkling:Q,enableFloating:Q,enableRotation:Q,enableScaling:Q}),X=v.useRef(!1),J=v.useRef(0),$=v.useRef(null),ee=Ot({base:!0,md:!1})??!1,te=On(r,ee),ne=Pn(r),re=!!ne,ae=Po(r,ee),ie=(e,t)=>function(e,t,n){return{base:`${Math.round(e*n)}px`,md:`${Math.round(t*n)}px`}}(e,t,ae),se=function(e,t){return t&&!0===e?.feature_flags?.fab_transparent}(r,re),le=function(e,t){return!t&&!0===e?.feature_flags?.fab_always_expanded}(r,re),ce=function(e){return!0===e?.feature_flags?.fab_icon_only}(r),de=l??(r?.agent_name?h("askAgent").replace("{name}",r.agent_name):h("askDori")),ue=v.useRef(null),[pe,he]=v.useState(null);v.useEffect(()=>{let e=!1;const t=()=>{const t=ue.current;!e&&t&&he(t.scrollWidth)};return t(),document.fonts?.ready?.then(t).catch(()=>{}),()=>{e=!0}},[de,ee]);const fe=(()=>{if(null==pe)return{base:"120px",md:"150px"};const e=ee?120:150,t=2*(ee?8:12),n=Math.round((ee?20:24)*ae),r=ee?280:360,o=t+8+n+pe+2;return`${Math.min(r,Math.max(e,o))}px`})(),ge=!0===r?.customization?.enable_standalone_quiz&&Ga(r)&&o&&!a?o.welcome_hook:null,me=!ge,be=v.useRef(zt()),xe=k?jt():i,ye=t||xe||!k&&me&&be.current?null:function(e,t){return t||function(e){return e?.feature_flags?.bubble_text?.trim()||null}(e)}(r,ge),ve=()=>{if(k&&jt())return;p();const e=++J.current;S("expanded"),R(!1),B(!1);const t=setTimeout(()=>{if(J.current===e&&(A(!0),!r?.customization?.disable_welcome_popup)){const t=setTimeout(()=>{if(J.current!==e)return;R(!0);const t=Za(r,ye??"","own",1e3*(C??3));if(null===t)return;const n=setTimeout(()=>{J.current===e&&(R(!1),setTimeout(()=>{J.current===e&&S("minimized")},300))},t);return()=>clearTimeout(n)},100);return()=>clearTimeout(t)}},100);return()=>clearTimeout(t)},we=()=>{S("minimized"),R(!1);const e=setTimeout(()=>{A(!0)},0);return()=>clearTimeout(e)},Ce=e=>{const t=++J.current;S("expanded"),R(!1);const n=setTimeout(()=>A(!0),100),r=setTimeout(()=>{J.current===t&&S("minimized")},100+1e3*e);return()=>{clearTimeout(n),clearTimeout(r)}};v.useEffect(()=>{X.current||(X.current=!0,k?jt()||ge?we():ve():St()?null===C||tt()?we():Ce(C):!ge||r?.customization?.disable_welcome_popup?!zt()&&u()?ve():null!==C?Ce(C):we():we())},[]),v.useEffect(()=>{const e=setInterval(()=>{St()||zt()||u()&&ve()},1e3);return()=>clearInterval(e)},[]),v.useEffect(()=>{if(!ge)return;if(r?.customization?.disable_welcome_popup)return;if(k?jt():St())return;J.current++,$.current&&(clearTimeout($.current),$.current=null),B(!0),S("expanded");const e=setTimeout(()=>{R(!0)},400),t=Za(r,ge,"hook"),n=null===t?null:setTimeout(()=>{R(!1),$.current=setTimeout(()=>{S("minimized"),$.current=null},350)},t);return()=>{clearTimeout(e),n&&clearTimeout(n),$.current&&(clearTimeout($.current),$.current=null)}},[ge]);const ke=v.useRef(null);v.useEffect(()=>{if(E&&ye&&!r?.customization?.disable_welcome_popup){if(me){if(zt())return;return At(),void Et(!1)}ke.current!==ye&&(ke.current=ye,Et(!0))}},[E,ye]);const je=()=>{Tt(),e&&(e(),"minimized"===j&&(R(!1),setTimeout(()=>{S("expanded"),setTimeout(()=>{r?.customization?.disable_welcome_popup||setTimeout(()=>{R(!0)},50)},100)},0)))},Se=je,ze=ce||!le&&("minimized"===j||re),Ae=function(e){const t=e.hasAvatarFab&&e.animationsEnabled&&e.isMinimized&&!e.isMenuOpen;return{breathe:t,halo:t&&!e.isTransparentFab}}({hasAvatarFab:re,animationsEnabled:Q,isMinimized:ze,isMenuOpen:T,isTransparentFab:se}),Ee=Nn(te,r,ee),Re="right"===te.align?"32px 0px 32px 32px":"0px 32px 32px 32px";return w.jsxs(D,{position:"relative",transform:z?Ee?"translateY(0) scale(1)":`translateY(calc(-50% + ${te.bottomSpacing}px)) scale(1)`:Ee?"translateY(100px) scale(0.9)":`translateY(calc(-50% + ${te.bottomSpacing}px + 100px)) scale(0.9)`,opacity:z?1:0,onMouseLeave:()=>{ee||(P(),F.current=setTimeout(()=>{_(!1),L(!1)},100))},children:[w.jsx(wr,{channels:r?.merchant_support_channels,isOpen:T,onToggle:()=>_(!T),isMobile:ee,onMouseEnter:U,onChatClick:e}),w.jsx(D,{visibility:T?"hidden":void 0,"aria-hidden":T||void 0,children:n}),"expanded"===j&&ye&&!r?.customization?.disable_welcome_popup&&w.jsx(D,{position:"absolute",bottom:"100%",[te.align]:"0",mb:2,w:{base:"70vw",md:"25vw"},maxW:{base:"300px",md:"300px"},bg:y,borderRadius:"16px",p:2,pe:3,boxShadow:M?"0 8px 32px rgba(0,0,0,0.16), 0 0 0 1.5px rgba(120,120,200,0.13)":"lg",opacity:E?1:0,transform:E?"translateY(0) scale(1)":M?"translateY(20px) scale(0.88)":"translateY(10px) scale(0.95)",transition:E?M?"opacity 0.5s ease, transform 0.7s cubic-bezier(0.22, 1.61, 0.36, 1), box-shadow 0.4s ease":"opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1)":"opacity 0.25s ease, transform 0.25s ease",cursor:"pointer",onClick:Se,children:w.jsxs(Y,{gap:1,align:"center",width:"100%",justifyContent:"flex-start",children:[w.jsx(Ut,{size:"xs",variant:"ghost","aria-label":"Close",onClick:e=>{e.stopPropagation(),s(),vt(),xt(),ta(),R(!1),setTimeout(()=>S("minimized"),300)},color:"text",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"rgba(0,0,0,0.1)"}},h:"auto",p:1,children:w.jsx(tn,{boxSize:"16px"})}),w.jsx(Z,{fontSize:"12px",fontWeight:"400",color:"text",lineHeight:"1.75",flex:1,width:"100%",fontFamily:V,children:ye})]})}),Ae.breathe&&w.jsx("style",{children:"\n @keyframes dori-avatar-breathe {\n 0%, 100% { scale: 1; }\n 50% { scale: 1.06; }\n }\n @keyframes dori-avatar-halo {\n 0% { box-shadow: 0 0 0 0 var(--dori-halo); }\n 70%, 100% { box-shadow: 0 0 0 12px var(--dori-halo-end); }\n }\n .dori-avatar-breathe {\n animation: dori-avatar-breathe 3s ease-in-out infinite;\n }\n .dori-avatar-breathe.dori-avatar-halo {\n animation:\n dori-avatar-breathe 3s ease-in-out infinite,\n dori-avatar-halo 3s ease-out infinite;\n }\n @media (prefers-reduced-motion: reduce) {\n .dori-avatar-breathe { animation: none !important; }\n }\n "}),w.jsx(I,{borderRadius:ze?"50%":Re,borderWidth:0,bg:se?"transparent":b,color:"text",border:"none !important",w:ze?ie(48,56):fe,minW:ze?ie(48,56):fe,h:ze?ie(48,56):"auto",p:ze?"0":{base:2,md:3},overflow:"hidden",transition:"width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), min-width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), border-radius 0.4s ease, padding 0.3s ease, transform 0.2s ease",onClick:je,className:["fab-glass",Ae.breathe&&"dori-avatar-breathe",Ae.halo&&"dori-avatar-halo"].filter(Boolean).join(" "),_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.05)"}},style:{borderRadius:ze?"50%":Re,cursor:"pointer",touchAction:"manipulation",WebkitTapHighlightColor:"transparent",...Ae.halo?{"--dori-halo":Rt(x,.5),"--dori-halo-end":Rt(x,0)}:{}},onMouseEnter:U,justifyContent:"center",children:w.jsxs(Y,{gap:ze?0:2,position:"relative",w:"full",justify:ze?"center":"space-between",overflow:"hidden",children:[w.jsx(Z,{fontSize:{base:"14px",md:"16px"},fontWeight:{base:"500",md:"600"},lineHeight:"1.5",whiteSpace:"nowrap",fontFamily:V,color:"background",opacity:ze?0:1,maxW:ze?"0px":"none",transition:"opacity 0.2s ease, max-width 0.35s ease",overflow:"hidden",ref:ue,children:de}),!T&&(ne?w.jsx(N,{src:ne,alt:"",role:"presentation",boxSize:ie(52,60),borderRadius:"full",objectFit:"cover",flexShrink:0}):w.jsx(xn,{boxSize:ie(20,24),color:"background",transform:K(j,te),...G(),flexShrink:0}))]})}),d>0&&!T&&w.jsx(D,{position:"absolute",top:ie(-6,-6),..."right"===te.align?{left:ie(-6,-6)}:{right:ie(-6,-6)},minW:"20px",h:"20px",px:"5px",borderRadius:"full",bg:"#E5484D",color:"white",fontSize:"12px",fontWeight:"600",fontFamily:V,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",boxShadow:"0 0 0 2px white",role:"status","aria-label":h("handoverUnread").replace("{team}",c?.teamName||h("handoverTheTeam")),"data-dori-handover-unread":d,children:d>9?"9+":d})]})};let Ja=!1;const $a=v.forwardRef(function({bubble:e,settled:t,styles:n,onClick:r,quiz:o,sheetLayer:a},i){const{botData:s}=H(),l=Ot({base:!0,md:!1})??!1,[c,u]=v.useState(!1),p=La(s,!1!==s?.customization?.enable_offer_guide&&t&&!c),h=_a(s),[f,g]=v.useState(!1);v.useEffect(()=>{if(!h||!t||p.looked)return;const e=window.setTimeout(()=>g(!0),5e3);return()=>window.clearTimeout(e)},[h,t,p.looked]),v.useEffect(()=>{p.view&&(Ja=!0)},[p.view]);const m=!h||p.looked||f,b=Ja||!!p.view,x=c?"quiz":p.view?"guide":o.eligible&&t&&m&&!b?"quiz":null,y=function({speaking:e,onOpenWidget:t,onStartChat:n,onDismissed:r,onEngagedChange:o}){const{diagnosticFlow:a,diagnosticShown:i,markDiagnosticShown:s,effectiveLanguage:l,informalAddress:c,suppressProactiveForSession:u}=H(),[p,h]=v.useState("hidden"),[f,g]=v.useState(!1),m=!!a&&!i&&!ea();return v.useEffect(()=>{o("expanded"===p)},[p]),v.useEffect(()=>()=>o(!1),[]),v.useEffect(()=>{if("expanded"!==p){if("hidden"===p&&e&&m){const e=setTimeout(()=>h("teaser"),800);return()=>clearTimeout(e)}"teaser"!==p||e&&m||h("hidden")}},[p,e,m]),v.useEffect(()=>{"teaser"!==p||Pa||(Pa=!0,d()?.capture("quiz_card_impression",{presentation:"pill"}))},[p]),{phase:p,open:f,flow:a,text:Ha(l||"English",c),handleStart:()=>{"expanded"!==p&&d()?.capture("quiz_card_started",{presentation:"pill"}),h("expanded"),g(!0)},handleDismiss:()=>{ta(),u(),xt(),vt(),d()?.capture("quiz_card_dismiss",{phase:p,presentation:"pill"}),g(!1),h("hidden"),r?.()},handleCollapse:()=>g(!1),handleComplete:(e,t)=>{s(),d()?.capture("quiz_card_completed"),g(!1),h("hidden"),n(e,void 0,t),d()?.capture("quiz_card_widget_opened")},handleSkipToChat:()=>{ta(),s(),d()?.capture("quiz_card_skip_to_chat"),g(!1),h("hidden"),r?.(),t()}}}({speaking:"quiz"===x,onStartChat:o.onStartChat,onOpenWidget:o.onOpenWidget,onDismissed:o.onDismissed,onEngagedChange:u}),C=On(s,l),k=Math.round((l?48:56)*Po(s,l)),j=Nn(C,s,l),S=`calc(100vw - ${2*C.sideSpacing}px)`,z=`min(${l?340:360}px, ${S})`,A=`min(400px, ${S})`,E=j?`max(240px, calc(100vh - ${Yn(C,s)+(e?k+8:0)+16}px))`:`max(240px, calc(50vh + ${C.bottomSpacing+(e?-k/2-8:k/2)-16}px))`,R=w.jsxs(D,{position:"absolute",bottom:e?"100%":0,mb:e?2:0,[C.align]:0,w:"max-content","data-dori-corner-slot":"",children:[w.jsx(Jo,{api:p,isMobile:l,layer:a,pillMaxW:z,panelW:A,panelMaxH:E}),("quiz"===x||c)&&w.jsx(qa,{quiz:y,isMobile:l,layer:a,pillMaxW:z,panelW:A,panelMaxH:E})]}),T=null!==x||b||o.eligible&&!m;return e?w.jsx(D,{ref:i,position:"fixed",zIndex:"1000000",...n,children:w.jsx(Xa,{onClick:r,suppressBubble:T,slot:R})}):w.jsx(D,{position:"fixed",zIndex:"1000000",...n,children:w.jsx(D,{position:"relative",h:`${k}px`,transform:j?void 0:`translateY(calc(-50% + ${C.bottomSpacing}px))`,children:R})})}),ei="dori-chat",ti="#dori-chat",ni={open:!1,expand:!1};function ri(){if("undefined"==typeof window)return!1;try{const e=window.DORI_HIDE_LAUNCHER;if(!0===e||"true"===e)return!0;const t=document.querySelector("script#dori-side-widget");return"true"===t?.getAttribute("data-hide-launcher")}catch{return!1}}function oi({mode:e,askOn:t,askPlaced:n,pageHidden:r}){return!(r||"never"===e||"fallback"===e&&t&&!1!==n)}function ai({mode:e,askOn:t,askPlaced:n,pageHidden:r}){return r||"fallback"!==e||!t||null!==n}function ii(){const[e,t]=v.useState(()=>{const e=document.querySelector("script#dori-side-widget");return"true"===e?.getAttribute("data-test-mode")}),[n,r]=v.useState(!1),[o,a]=v.useState(ri),[i,s]=v.useState(()=>window.__doriAskResult??null),[l,c]=v.useState(!1),d=i?i.placed:!l&&null,[u,p]=v.useState(""),{botData:C,botError:k,updateBotData:j,diagnosticFlow:S,diagnosticShown:z,primeStarter:A,onWidgetOpened:E,setPanelOpen:R}=H(),T=P(),_=v.useRef(C);_.current=C;const W=v.useRef(null),I=v.useCallback(e=>{const t=x(e);if(!t)return!1;const n=_.current;if(!n)return W.current=e??{},!0;const r=g(n.feature_flags,Q(),t);return!!r&&(window.location.assign(r),!0)},[]);v.useEffect(()=>{const e=W.current;C&&e&&(W.current=null,window.doriWidget?.open?.(e))},[C]),function(e){const{isTestMode:t,sendMessage:n,submitFeedback:r,messages:o,inputState:a,chatState:i}=H(),s=v.useRef({open:e,sendMessage:n,submitFeedback:r});s.current={open:e,sendMessage:n,submitFeedback:r},v.useEffect(()=>{if(!t)return;const e=window,n=e=>{const t=String(e||"").trim();t&&(s.current.open(),s.current.sendMessage({message:t}))};return e.doriWidget={...e.doriWidget,ask:n,rateAnswer:(e,t,n)=>s.current.submitFeedback(e,t,n)},()=>{e.doriWidget?.ask===n&&(delete e.doriWidget.ask,delete e.doriWidget.rateAnswer)}},[t]);const l=v.useRef(o);l.current=o;const c=v.useRef(i.threadId);c.current=i.threadId;const d=v.useRef(!1);v.useEffect(()=>{const e="generating"===a,n=d.current&&!e;if(d.current=e,!t||!n)return;const r=window.setTimeout(()=>{const e=l.current.filter(e=>"dori"===e.type),t=e[e.length-1];t&&t.content?.trim()&&window.dispatchEvent(new CustomEvent("dori:test-answer",{detail:{widget:"side",index:e.length-1,text:t.content,threadId:c.current??null}}))},400);return()=>window.clearTimeout(r)},[a,t])}(()=>{M.current="api_open",t(!0)});const L=n&&!T.isMini,M=v.useRef("unknown"),B=v.useRef(e),F=v.useRef(e);F.current=e,v.useEffect(()=>{e&&!B.current&&(E(),Ae("widget_opened",{assistantId:C?.assistant_id,payload:{trigger:M.current}}),M.current="unknown"),B.current=e},[e,C?.assistant_id,E]),v.useEffect(()=>{R(e)},[e,R]);const[q,O]=v.useState(null),[N,Y]=v.useState(!1),V=!0===C?.customization?.disable_welcome_popup,Z=!0===C?.customization?.enable_standalone_quiz&&Ga(C)&&!!S&&!z&&!N&&!e&&!ea()&&!V&&!et(),[U,G]=v.useState(null),{isCurrentPathBanned:X}=(e=>{const[t,n]=v.useState("");return v.useEffect(()=>{const e=()=>{n(h())};e();const t=()=>{e()};window.addEventListener("popstate",t);const r=history.pushState,o=history.replaceState;return history.pushState=function(...t){r.apply(history,t),e()},history.replaceState=function(...t){o.apply(history,t),e()},()=>{window.removeEventListener("popstate",t),history.pushState=r,history.replaceState=o}},[]),{isCurrentPathBanned:()=>f(t,e)}})(C?.banned_paths||[]);v.useEffect(()=>{e&&vt()},[e]),v.useEffect(()=>{C?.merchant_support_channels?.crisp?.enabled&&(Zn(),Vn()&&window.$crisp.push(["on","chat:closed",()=>{Zn()}]))},[C?.merchant_support_channels?.crisp?.enabled]),v.useEffect(()=>{C?.merchant_support_channels?.chatra?.enabled&&(rr("hideChatraWidget invoked"),Gn=!0,function(e){if(or())return void e();const t=Date.now(),n=setInterval(()=>{or()?(clearInterval(n),e()):Date.now()-t>Qn&&(clearInterval(n),rr("Chatra never became ready within",Qn,"ms"))},200)}(()=>{Xn||ir("initial hide")}),null!==Jn||"undefined"==typeof window||Xn||($n=Date.now(),Jn=setInterval(lr,1e3)))},[C?.merchant_support_channels?.chatra?.enabled]),v.useEffect(()=>{C?.merchant_support_channels?.shopifyInbox?.enabled&&function(){if("undefined"==typeof document)return;if(document.getElementById(ur))return;const e=document.createElement("style");e.id=ur,e.textContent=`\n html:not([${pr}]) ${hr}::part(activator) { display: none !important; }\n html:not([${pr}]) ${fr} { display: none !important; }\n `,document.head.appendChild(e),mr("launcher hidden")}()},[C?.merchant_support_channels?.shopifyInbox?.enabled]),v.useEffect(()=>{if(!u||!C?.is_widget_enabled)return;const e=window.setTimeout(()=>{_t(K.klaviyoStorefront,u)},4e3);return()=>window.clearTimeout(e)},[u,C?.is_widget_enabled]),Wt({sharingId:u});const J=Ot({base:!0,md:!1})??!1,$=On(C,J),ee=((e,t=!1,n=null)=>{const{align:r,sideSpacing:o}=e;return t?{bottom:`${Yn(e,n)}px`,[r]:`${o}px`}:{top:"50%",[r]:`${o}px`}})($,Nn($,C,J),C);v.useEffect(()=>{window.chatbotData?p(window.chatbotData.sharingID):m("useEffect sharing ID",()=>{p((()=>{const e=document.querySelector("script#dori-side-widget");return e?.getAttribute("data-sharing-id")||""})());const e=document.querySelector("script#dori-side-widget");if(!e)return;const t=new MutationObserver(t=>{for(const n of t)if("attributes"===n.type&&"data-sharing-id"===n.attributeName){const t=e.getAttribute("data-sharing-id")||"";p(t),console.log("data-sharing-id changed:",t)}});return t.observe(e,{attributes:!0,attributeFilter:["data-sharing-id"]}),()=>{t.disconnect()}})()},[]);const te=v.useRef(null),ne=v.useRef(!1),re=v.useRef(null);v.useEffect(()=>{const e=e=>s(e.detail??null);return window.addEventListener("dori:ask-button",e),()=>window.removeEventListener("dori:ask-button",e)},[]);const oe=Boolean(C?.feature_flags?.ask_button);v.useEffect(()=>{if(!oe||i)return;const e=setTimeout(()=>c(!0),4e3);return()=>clearTimeout(e)},[oe,i]);const ae={mode:C?.feature_flags?.bubble_mode,askOn:oe,askPlaced:d,pageHidden:o},ie=i??(oe&&l?{zone:"none",device:Dt()}:null);v.useEffect(()=>{if(!ie||ie.pending||!C?.assistant_id)return;let e=!0;try{e=Ht(window.sessionStorage,ie.device)}catch{}e&&Ae("header_entry",{assistantId:C.assistant_id,payload:{zone:ie.zone,spot:ie.spot,label:ie.label,device:ie.device}})},[ie?.zone,ie?.device,ie?.pending,C?.assistant_id]);const se=v.useCallback(()=>{const e=document.getElementById("dori-react-widget-host");e&&e.contains(document.activeElement)&&(ne.current=!0),t(!1)},[]);v.useEffect(()=>{if(!e)return;const t=e=>{if("Escape"!==e.key)return;const t=document.getElementById("dori-react-widget-host");if(!(e.target instanceof Node))return;const n=re.current;(n&&n.contains(e.target)||t&&t.contains(e.target))&&setTimeout(()=>{e.defaultPrevented||se()},0)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,se]);const le=Sn(),ce=v.useRef(le);ce.current=le,v.useEffect(()=>{if(!e||!ce.current)return;const t=setTimeout(()=>{(function(){const e=document.getElementById("dori-react-widget-host");if(!e)return null;const t=[e];for(;t.length;){const e=t.shift();for(const t of e.querySelectorAll("textarea"))if(t.getClientRects().length)return t;for(const n of e.querySelectorAll("*"))n.shadowRoot&&t.push(n.shadowRoot)}return null})()?.focus({preventScroll:!0})},350);return()=>clearTimeout(t)},[e]),v.useEffect(()=>{if(e||!ne.current)return;ne.current=!1;const t=re.current;re.current=null;const n=requestAnimationFrame(()=>{t?.isConnected?t.focus({preventScroll:!0}):te.current?.querySelector("button.fab-glass")?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(n)},[e]),v.useEffect(()=>{const e=e=>{if(I(e))return;if(y(F.current,e?.source))return void t(!1);M.current=e?.source??(e?.starter?"banner":"api_open");const n=document.activeElement,o=document.getElementById("dori-react-widget-host");re.current=n instanceof HTMLElement&&n!==document.body&&!o?.contains(n)?n:null,t(!0),e?.expand&&r(!0),e?.starter?.greeting&&A({greeting:e.starter.greeting,chips:e.starter.chips,intent:e.intent})},n=()=>t(!1),o=e=>{"cart"===e.detail?.reason&&(ta(),Y(!0)),n()},i=()=>{M.current="api_toggle",t(e=>!e)},s=e=>{j(e)},l=()=>a(!0),c=()=>a(!1),d=window;d.doriWidget={...d.doriWidget,open:e,close:n,toggle:i,updateConfig:s,hideLauncher:l,showLauncher:c},b(t=>e(t));const u=t=>{const n=t.detail;e(n)};return window.addEventListener("dori:open-widget",u),window.addEventListener("dori:close-widget",o),window.addEventListener("dori:toggle-widget",i),window.addEventListener("dori:hide-launcher",l),window.addEventListener("dori:show-launcher",c),()=>{d.doriWidget&&(d.doriWidget.open===e&&delete d.doriWidget.open,d.doriWidget.close===n&&delete d.doriWidget.close,d.doriWidget.toggle===i&&delete d.doriWidget.toggle,d.doriWidget.updateConfig===s&&delete d.doriWidget.updateConfig,d.doriWidget.hideLauncher===l&&delete d.doriWidget.hideLauncher,d.doriWidget.showLauncher===c&&delete d.doriWidget.showLauncher),window.removeEventListener("dori:open-widget",u),window.removeEventListener("dori:close-widget",o),window.removeEventListener("dori:toggle-widget",i),window.removeEventListener("dori:hide-launcher",l),window.removeEventListener("dori:show-launcher",c)}},[j,A,I]),v.useEffect(()=>{const e=function(){if("undefined"==typeof window)return ni;try{const e=new URLSearchParams(window.location.search).get(ei)?.trim().toLowerCase();if("open"===e||"expand"===e)return{open:!0,expand:"expand"===e};if(window.location.hash.toLowerCase()===ti)return{open:!0,expand:!1}}catch{}return ni}();e.open&&(function(){if("undefined"!=typeof window&&window.history?.replaceState)try{const e=new URL(window.location.href);let t=!1;e.searchParams.has(ei)&&(e.searchParams.delete(ei),t=!0),e.hash.toLowerCase()===ti&&(e.hash="",t=!0),t&&window.history.replaceState(window.history.state,"",e.toString())}catch{}}(),e.expand&&I({expand:!0,source:"link"})||(M.current="deep_link",t(!0),e.expand&&r(!0)))},[I]);const de=function({botData:e,botError:t,isPathBanned:n}){return!((!t||e)&&e&&!n&&(!0===e.is_widget_enabled||null===e.is_widget_enabled))}({botData:C,botError:k,isPathBanned:X()});k&&!C&&console.warn("[Dori Widget] bot data unavailable — hiding widget:",k);const ue=v.useCallback((e,n,r)=>{Y(!0),O({message:e,imageUrl:n,apiMessage:r}),M.current="quiz_chat",t(!0)},[]),pe=v.useCallback(()=>{O(null)},[]);return w.jsx(D,{fontFamily:It("system-ui, Avenir, Helvetica, Arial, sans-serif"),lineHeight:"1.5",fontWeight:"400",colorScheme:"light",children:!de&&w.jsxs(w.Fragment,{children:[w.jsx(Ho,{isOpen:e,onClose:se,isExpanded:L,onToggleExpand:T.isMini?void 0:e=>r(void 0===e?!L:e),fullPageHref:g(C?.feature_flags,Q(),"chat"),pendingChat:q,onPendingChatConsumed:pe}),!e&&w.jsx($a,{ref:te,bubble:oi(ae),settled:ai(ae),styles:ee,onClick:()=>{e||(M.current="fab",re.current=null),t(!e)},quiz:{eligible:Z,onStartChat:ue,onOpenWidget:()=>{M.current="quiz_card",t(!0)},onDismissed:()=>Y(!0)},sheetLayer:U}),w.jsx(D,{ref:G,"data-dori-corner-layer":""})]})})}function si(){return w.jsx(ii,{})}console.log("isDevelopment",!1);let li=!1;function ci(){if(li)return console.log("[Dori Widget] Already initialized, skipping"),()=>{};li=!0;const e=[];let t=document.getElementById("dori-react-widget-host");t||(t=document.createElement("div"),t.id="dori-react-widget-host",t.setAttribute("data-nosnippet",""),document.body.appendChild(t));const n=Lt.createRoot(t);n.render(w.jsx(F.StrictMode,{children:w.jsx(_e,{children:w.jsx(Mt,{children:w.jsx(si,{})})})})),e.push(n);const r=()=>{l(()=>import("./MarkdownContent-C15ck6xJ.js"),__vite__mapDeps([0,1,2,3]),import.meta.url).catch(()=>{})};return"function"==typeof window.requestIdleCallback?window.requestIdleCallback(r,{timeout:3e3}):window.setTimeout(r,1500),()=>{e.forEach(e=>e.unmount()),li=!1}}export{ci as initializeDoriWidget};
2
+ import{l as e,h as t,p as n,c as r,g as o,a,b as i,d as s,_ as l,s as c,e as d,f as u,i as p,j as h,k as f,m as g,w as m,n as b,o as x,t as y}from"../widget.js";import{r as v,j as w,c as C,a as k,u as j,g as S,b as z,d as A,e as E,m as R,f as T,h as _,i as W,B as I,k as L,l as M,n as B,R as F,o as D,p as H,q as P,s as q,t as O,I as N,H as Y,U as V,T as Z,v as U,w as Q,A as K,V as G,x as X,S as J,y as $,z as ee,C as te,D as ne,G as re,E as oe,F as ae,J as ie,K as se,L as le,M as ce,N as de,O as ue,P as pe,Q as he,W as fe,X as ge,Y as me,Z as be,_ as xe,$ as ye,a0 as ve,a1 as we,a2 as Ce,a3 as ke,a4 as je,a5 as Se,a6 as ze,a7 as Ae,a8 as Ee,a9 as Re,aa as Te,ab as _e,ac as We,ad as Ie,ae as Le,af as Me,ag as Be,ah as Fe,ai as De,aj as He,ak as Pe,al as qe,am as Oe,an as Ne,ao as Ye,ap as Ve,aq as Ze,ar as Ue,as as Qe,at as Ke,au as Ge,av as Xe,aw as Je,ax as $e,ay as et,az as tt,aA as nt,aB as rt,aC as ot,aD as at,aE as it,aF as st,aG as lt,aH as ct,aI as dt,aJ as ut,aK as pt,aL as ht,aM as ft,aN as gt,aO as mt,aP as bt,aQ as xt,aR as yt,aS as vt,aT as wt,aU as Ct,aV as kt,aW as jt,aX as St,aY as zt,aZ as At,a_ as Et,a$ as Rt,b0 as Tt,b1 as _t,b2 as Wt,b3 as It,b4 as Lt,b5 as Mt}from"./provider-9Wh21Ch_.js";import{u as Bt,L as Ft}from"./link-DiZMDO7u.js";import{d as Dt,s as Ht}from"./report-BHr6U1PB.js";const Pt=v.forwardRef(function(e,t){const{templateAreas:n,column:r,row:o,autoFlow:a,autoRows:i,templateRows:s,autoColumns:l,templateColumns:c,inline:d,...u}=e;return w.jsx(C.div,{...u,ref:t,css:[{display:d?"inline-grid":"grid",gridTemplateAreas:n,gridAutoColumns:l,gridColumn:r,gridRow:o,gridAutoFlow:a,gridAutoRows:i,gridTemplateRows:s,gridTemplateColumns:c},e.css]})});var qt=k();function Ot(e,t){const n=j().normalizeValue(e),r=function(e={}){e.fallback||(e.fallback="base");const t=j();let n=!1;const r=t.breakpoints.values.map(({min:t,name:r})=>{const o={breakpoint:r,query:`(min-width: ${t})`,fallback:!n};return r===e.fallback&&(n=!0),o}).filter(({breakpoint:t})=>!!e.breakpoints?.includes(t)),o=r.map(({fallback:e})=>e),a=function(e,t={}){const{fallback:n=[],ssr:r=!0,getWindow:o}=t,a=function(e,t=[]){const n=v.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return v.useInsertionEffect(()=>{n.current=e}),v.useCallback((...e)=>n.current?.(...e),t)}(o),i=Array.isArray(e)?e:[e],s=n?.filter(e=>null!=e),[l,c]=v.useState(()=>i.map((e,t)=>{if(!r){const{media:t,matches:n}=(o?.()??window).matchMedia(e);return{media:t,matches:n}}return{media:e,matches:!!s[t]}}));return v.useEffect(()=>{const e=a()??window;c(t=>{const n=i.map(t=>{const{media:n,matches:r}=e.matchMedia(t);return{media:n,matches:r}});return t.every((e,t)=>e.matches===n[t].matches&&e.media===n[t].media)?t:n});const t=i.map(t=>e.matchMedia(t)),n=e=>{c(t=>t.slice().map(t=>t.media===e.media?{...t,matches:e.matches}:t))},r=t.map(e=>function(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch(n){return e.addListener(t),()=>e.removeListener(t)}}(e,n));return()=>r.forEach(e=>e())},[a]),l.map(e=>e.matches)}(r.map(e=>e.query),{fallback:o,ssr:e.ssr}).lastIndexOf(!0);return r[a]?.breakpoint??e.fallback}({breakpoints:Object.keys(n),...t});return n[r]}var Nt=e=>{if(!e)return;const t=S(e),n=z(e),r=A(e),o=()=>{requestAnimationFrame(()=>{let n;e.style.height="auto",n="content-box"===t.boxSizing?e.scrollHeight-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):e.scrollHeight+parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),"none"!==t.maxHeight&&n>parseFloat(t.maxHeight)?("hidden"===t.overflowY&&(e.style.overflowY="scroll"),n=parseFloat(t.maxHeight)):"hidden"!==t.overflowY&&(e.style.overflowY="hidden"),e.style.height=`${n}px`})};e.addEventListener("input",o),e.form?.addEventListener("reset",o);const a=Object.getPrototypeOf(e),i=Object.getOwnPropertyDescriptor(a,"value");Object.defineProperty(e,"value",{...i,set(){i?.set?.apply(this,arguments),o()}});const s=new n.ResizeObserver(()=>{requestAnimationFrame(()=>o())});s.observe(e);const l=new n.MutationObserver(()=>o());return l.observe(e,{attributes:!0,attributeFilter:["rows","placeholder"]}),r.fonts?.addEventListener("loadingdone",o),()=>{e.removeEventListener("input",o),e.form?.removeEventListener("reset",o),r.fonts?.removeEventListener("loadingdone",o),s.disconnect(),l.disconnect()}};const Yt=v.forwardRef((e,t)=>{const{autoresize:n,...r}=e,o=v.useRef(null),a=E(),i=R(a?.getTextareaProps(),{style:{resize:n?"none":void 0}},r);return v.useEffect(()=>{if(n)return Nt(o.current)},[n]),w.jsx(T.textarea,{...i,ref:_(t,o)})});Yt.displayName="FieldTextarea";const{withContext:Vt}=W({key:"badge"}),Zt=Vt("span"),Ut=v.forwardRef(function(e,t){return w.jsx(I,{px:"0",py:"0",_icon:{fontSize:"1.2em"},ref:t,...e})}),{useRecipeResult:Qt}=W({key:"icon"}),Kt=v.forwardRef(function(e,t){const{styles:n,className:r,props:o}=Qt({asChild:!e.as,...e});return w.jsx(C.svg,{ref:t,focusable:!1,"aria-hidden":"true",...o,css:[n,e.css],className:L(r,e.className)})});function Gt(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,a=v.Children.toArray(e.path),i=v.forwardRef((e,r)=>w.jsx(Kt,{ref:r,asChild:!1,viewBox:t,...o,...e,children:a.length?a:w.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}const Xt=v.forwardRef(function(e,t){const{direction:n,align:r,justify:o,wrap:a,basis:i,grow:s,shrink:l,inline:c,...d}=e;return w.jsx(C.div,{ref:t,...d,css:{display:c?"inline-flex":"flex",flexDirection:n,alignItems:r,justifyContent:o,flexWrap:a,flexBasis:i,flexGrow:s,flexShrink:l,...e.css}})}),Jt=v.forwardRef(function(e,t){const{columns:n,minChildWidth:r,...o}=e,a=j(),i=r?function(e,t){return M(e,e=>{const n=t.tokens.getVar(`sizes.${e}`,"number"==typeof(r=e)?`${r}px`:r);var r;return null===e?null:`repeat(auto-fit, minmax(${n}, 1fr))`})}(r,a):M(n,e=>null===e?null:`repeat(${e}, minmax(0, 1fr))`);return w.jsx(Pt,{ref:t,templateColumns:i,...o})}),{withContext:$t}=W({key:"textarea"}),en=$t(Yt),tn=Gt({displayName:"CloseIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M6.26915 5.7309C5.98798 5.44973 5.53209 5.44973 5.25092 5.7309C4.96975 6.01207 4.96975 6.46796 5.25092 6.74913L10.5018 12L5.25092 17.2509C4.96975 17.5321 4.96975 17.9879 5.25092 18.2691C5.53209 18.5503 5.98798 18.5503 6.26915 18.2691L11.52 13.0183L16.7709 18.2691C17.0521 18.5503 17.5079 18.5503 17.7891 18.2691C18.0703 17.9879 18.0703 17.5321 17.7891 17.2509L12.5383 12L17.7891 6.74913C18.0703 6.46796 18.0703 6.01207 17.7891 5.7309C17.5079 5.44973 17.0521 5.44973 16.7709 5.7309L11.52 10.9817L6.26915 5.7309Z",fill:"currentColor"})}),nn=Gt({displayName:"CheckCircleIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm4.457 7.457-5.25 5.25a1 1 0 0 1-1.414 0l-2.25-2.25a1 1 0 1 1 1.414-1.414l1.543 1.543 4.543-4.543a1 1 0 0 1 1.414 1.414Z",fill:"currentColor"})}),rn=Gt({displayName:"ExternalLinkIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M14 4a1 1 0 0 1 0-2h7a1 1 0 0 1 1 1v7a1 1 0 1 1-2 0V6.414l-8.293 8.293a1 1 0 0 1-1.414-1.414L18.586 5H14ZM5 7a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-5a1 1 0 1 0-2 0v4H6V9h4a1 1 0 1 0 0-2H5Z",fill:"currentColor"})}),on=Gt({displayName:"ExpandIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",fill:"currentColor"})}),an=Gt({displayName:"ReplyIcon",viewBox:"0 0 15 12",path:w.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.16536 1.81467C7.16536 0.791333 5.9427 0.263999 5.1987 0.965999L1.30003 4.64C1.15132 4.78022 1.03284 4.94936 0.951856 5.13703C0.870874 5.3247 0.829102 5.52694 0.829102 5.73133C0.829102 5.93573 0.870874 6.13797 0.951856 6.32563C1.03284 6.5133 1.15132 6.68244 1.30003 6.82267L5.19736 10.5C5.94136 11.202 7.1647 10.674 7.1647 9.65133V8.33467C7.93731 8.19507 8.73376 8.28024 9.45939 8.58006C10.185 8.87989 10.8093 9.38175 11.258 10.026L11.7927 10.794C12.5207 11.84 14.162 11.3247 14.162 10.0507V9.738C14.162 5.89267 10.9394 2.87667 7.1647 3.05733L7.16536 1.81467ZM5.8847 1.69333C5.90839 1.67111 5.93807 1.6563 5.97007 1.65072C6.00208 1.64514 6.03501 1.64904 6.06483 1.66193C6.09465 1.67482 6.12005 1.69614 6.13791 1.72328C6.15577 1.75042 6.16531 1.78218 6.16536 1.81467V3.54C6.16536 3.87333 6.45736 4.132 6.78803 4.092C10.1767 3.68 13.1627 6.32467 13.1627 9.73867V10.0507C13.1627 10.3453 12.7827 10.4647 12.614 10.2227L12.0787 9.45467C11.4785 8.5928 10.6268 7.93727 9.63996 7.57763C8.65317 7.21799 7.5794 7.17179 6.56536 7.44533C6.45052 7.47639 6.34911 7.54442 6.27681 7.6389C6.2045 7.73337 6.16534 7.84903 6.16536 7.968V9.65067C6.16531 9.68315 6.15577 9.71492 6.13791 9.74205C6.12005 9.76919 6.09465 9.79051 6.06483 9.8034C6.03501 9.81629 6.00208 9.82019 5.97007 9.81461C5.93807 9.80903 5.90839 9.79422 5.8847 9.772L1.9867 6.09533C1.93716 6.04859 1.8977 5.99223 1.87072 5.92969C1.84375 5.86716 1.82984 5.79977 1.82984 5.73167C1.82984 5.66356 1.84375 5.59618 1.87072 5.53364C1.8977 5.4711 1.93716 5.41474 1.9867 5.368L5.8847 1.69333Z",fill:"currentColor"})}),sn=Gt({displayName:"SuggestionIcon",viewBox:"0 0 16 16",path:w.jsx("path",{d:"M4.56503 3.915C5.11896 2.73832 6.04737 1.77849 7.20497 1.18572C8.36257 0.592947 9.68402 0.400681 10.9625 0.63901C12.2411 0.877339 13.4045 1.53281 14.2708 2.50286C15.137 3.4729 15.6573 4.70277 15.75 6C15.8332 7.19515 15.548 8.38706 14.9329 9.41516C14.3178 10.4433 13.4024 11.2581 12.31 11.75C11.9379 12.672 11.3425 13.4871 10.5774 14.122C9.81221 14.7569 8.90126 15.1917 7.92642 15.3873C6.95158 15.5829 5.94341 15.5332 4.99255 15.2426C4.04169 14.952 3.17794 14.4297 2.47896 13.7226C1.77998 13.0155 1.26768 12.1458 0.988107 11.1916C0.708538 10.2375 0.670468 9.2288 0.877321 8.25629C1.08417 7.28377 1.52946 6.37791 2.17316 5.62013C2.81685 4.86235 3.63877 4.27641 4.56503 3.915ZM9.90503 1.5H9.60503C8.52019 1.56681 7.48862 1.99351 6.67357 2.71256C5.85852 3.43161 5.30656 4.40195 5.10503 5.47L10.675 1.565C10.4205 1.52309 10.163 1.50136 9.90503 1.5ZM11.905 1.93L5.33003 6.555L5.06003 6.745C5.11592 7.4665 5.33108 8.16663 5.69003 8.79499L13.565 3.155C13.1023 2.63199 12.5329 2.21427 11.895 1.93H11.905ZM14.145 3.97L6.25003 9.60999C6.70986 10.1331 7.27572 10.5524 7.91003 10.84L14.75 5.82C14.6759 5.16869 14.47 4.53927 14.145 3.97ZM14.75 7.065L9.10503 11.2C9.4681 11.2629 9.83728 11.283 10.205 11.26C11.33 11.1916 12.3968 10.7368 13.225 9.97234C14.0532 9.20793 14.5919 8.1809 14.75 7.065ZM6.75003 14.5C7.59348 14.4958 8.42238 14.2798 9.16061 13.8718C9.89883 13.4638 10.5227 12.8769 10.975 12.165C10.7406 12.2117 10.5035 12.2434 10.265 12.26H9.90003C8.40699 12.257 6.97069 11.6876 5.88117 10.6668C4.79165 9.64592 4.13007 8.24969 4.03003 6.76C4.00121 6.25734 4.03819 5.75307 4.14003 5.26C3.22219 5.83357 2.51524 6.68948 2.12538 7.69915C1.73553 8.70883 1.68382 9.81774 1.97803 10.8593C2.27224 11.9009 2.89648 12.8189 3.75697 13.4754C4.61746 14.1318 5.66774 14.4914 6.75003 14.5Z",fill:"currentColor"})}),ln=Gt({displayName:"AiSearchIcon",viewBox:"0 0 16 16",path:w.jsxs(w.Fragment,{children:[w.jsx("path",{d:"M8 2.66683C5.42267 2.66683 3.33333 4.75617 3.33333 7.3335H2C2 4.01979 4.68629 1.3335 8 1.3335C11.3137 1.3335 14 4.01979 14 7.3335C14 8.75016 13.509 10.0522 12.6879 11.0786L14.8047 13.1954L13.8619 14.1382L11.7451 12.0214C10.7187 12.8425 9.41667 13.3335 8 13.3335V12.0002C10.5773 12.0002 12.6667 9.91083 12.6667 7.3335C12.6667 4.75617 10.5773 2.66683 8 2.66683Z",fill:"currentColor"}),w.jsx("path",{d:"M5.85714 6.6665L2 11.2498H4.57143L4.14286 13.9998L8 9.4165H5.42857L5.85714 6.6665Z",fill:"currentColor"})]})}),cn=Gt({displayName:"SparkleIcon",viewBox:"0 0 16 16",path:w.jsxs(w.Fragment,{children:[w.jsx("path",{d:"M8 1.5l1.15 3.11a2 2 0 0 0 1.18 1.18L13.44 6.93l-3.11 1.15a2 2 0 0 0-1.18 1.18L8 12.37l-1.15-3.11a2 2 0 0 0-1.18-1.18L2.56 6.93l3.11-1.15a2 2 0 0 0 1.18-1.18L8 1.5Z",fill:"currentColor"}),w.jsx("path",{d:"M12.75 10.5l.42 1.13c.08.22.25.39.47.47l1.13.42-1.13.42a.83.83 0 0 0-.47.47l-.42 1.13-.42-1.13a.83.83 0 0 0-.47-.47l-1.13-.42 1.13-.42c.22-.08.39-.25.47-.47l.42-1.13Z",fill:"currentColor",opacity:"0.75"})]})}),dn=Gt({displayName:"SquareBlackIcon",viewBox:"0 0 32 32",path:w.jsxs(w.Fragment,{children:[w.jsx("circle",{cx:"16",cy:"16",r:"16",fill:"currentColor"}),w.jsx("path",{d:"M22 10H10V22H22V10Z",fill:"var(--chakra-colors-button-text, white)"})]})}),un=Gt({displayName:"ArrowUpBlackIcon",viewBox:"0 0 32 32",path:w.jsxs(w.Fragment,{children:[w.jsx("circle",{cx:"16",cy:"16",r:"16",fill:"currentColor"}),w.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5858 11.0002C15.3669 10.2191 16.6332 10.2191 17.4143 11.0002L20.3738 13.9597C20.7643 14.3502 20.7643 14.9834 20.3738 15.3739C19.9833 15.7644 19.3501 15.7644 18.9596 15.3739L17 13.4144V21.0002C17 21.5524 16.5523 22.0002 16 22.0002C15.4478 22.0002 15 21.5524 15 21.0002V13.4144L13.0405 15.3739C12.65 15.7644 12.0168 15.7645 11.6263 15.3739C11.2358 14.9834 11.2358 14.3502 11.6263 13.9597L14.5858 11.0002Z",fill:"var(--chakra-colors-button-text, white)"})]})}),pn=Gt({displayName:"ArrowLeftIcon",viewBox:"0 0 32 32",path:w.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.0002 17.4139C10.2191 16.6329 10.2191 15.3665 11.0002 14.5855L13.9597 11.6259C14.3502 11.2354 14.9834 11.2354 15.3739 11.6259C15.7644 12.0165 15.7644 12.6496 15.3739 13.0401L13.4144 14.9997H21.0002C21.5524 14.9997 22.0002 15.4474 22.0002 15.9997C22.0002 16.552 21.5524 16.9997 21.0002 16.9997H13.4144L15.3739 18.9592C15.7644 19.3498 15.7645 19.9829 15.3739 20.3735C14.9834 20.764 14.3502 20.764 13.9597 20.3735L11.0002 17.4139Z",fill:"currentColor"})}),hn=Gt({displayName:"ReloadIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M19.146 4.854l-1.489 1.489A8 8 0 1 0 12 20a8.094 8.094 0 0 0 7.371-4.886 1 1 0 1 0-1.842-.779A6.071 6.071 0 0 1 12 18a6 6 0 1 1 4.243-10.243l-1.39 1.39a.5.5 0 0 0 .354.854H19.5A.5.5 0 0 0 20 9.5V5.207a.5.5 0 0 0-.854-.353z",fill:"currentColor"})}),fn=Gt({displayName:"CartBagIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M16 7C16 5.4 14.9 4 13.5 4H10.5C9.1 4 8 5.4 8 7H5C4.448 7 4 7.448 4 8V19C4 19.552 4.448 20 5 20H19C19.552 20 20 19.552 20 19V8C20 7.448 19.552 7 19 7H16ZM10.5 6H13.5C13.776 6 14 6.4 14 7H10C10 6.4 10.224 6 10.5 6ZM18 18H6V9H8V10.5C8 11.052 8.448 11.5 9 11.5C9.552 11.5 10 11.052 10 10.5V9H14V10.5C14 11.052 14.448 11.5 15 11.5C15.552 11.5 16 11.052 16 10.5V9H18V18Z",fill:"currentColor"})}),gn=Gt({displayName:"HeartIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 1 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),mn=Gt({displayName:"HeartFilledIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 1 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z",fill:"currentColor",stroke:"currentColor",strokeWidth:"1",strokeLinejoin:"round"})}),bn=Gt({displayName:"ArrowRightIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M12.293 5.293C12.684 4.902 13.316 4.902 13.707 5.293L19.707 11.293C20.098 11.684 20.098 12.316 19.707 12.707L13.707 18.707C13.316 19.098 12.684 19.098 12.293 18.707C11.902 18.316 11.902 17.684 12.293 17.293L16.586 13H5C4.448 13 4 12.552 4 12C4 11.448 4.448 11 5 11H16.586L12.293 6.707C11.902 6.316 11.902 5.684 12.293 5.293Z",fill:"currentColor"})}),xn=Gt({displayName:"AiBigIcon",viewBox:"0 0 24 24",path:w.jsx("path",{d:"M18.423 9.97031L16.7505 10.5726C15.8336 10.903 15.0009 11.4317 14.3118 12.1208C13.6226 12.81 13.094 13.6427 12.7635 14.5596L12.1613 16.2321C12.1492 16.2651 12.1272 16.2936 12.0984 16.3137C12.0695 16.3339 12.0352 16.3447 12 16.3447C11.9649 16.3447 11.9305 16.3339 11.9017 16.3137C11.8728 16.2936 11.8509 16.2651 11.8388 16.2321L11.2365 14.5596C10.9061 13.6427 10.3774 12.81 9.68826 12.1208C8.99911 11.4317 8.16641 10.903 7.24953 10.5726L5.57703 9.97031C5.544 9.9582 5.51549 9.93624 5.49535 9.9074C5.47521 9.87856 5.46441 9.84423 5.46441 9.80906C5.46441 9.77388 5.47521 9.73955 5.49535 9.71071C5.51549 9.68188 5.544 9.65992 5.57703 9.64781L7.24953 9.04556C8.16641 8.7151 8.99911 8.18645 9.68826 7.49729C10.3774 6.80814 10.9061 5.97544 11.2365 5.05856L11.8388 3.38606C11.8509 3.35303 11.8728 3.32452 11.9017 3.30438C11.9305 3.28424 11.9649 3.27344 12 3.27344C12.0352 3.27344 12.0695 3.28424 12.0984 3.30438C12.1272 3.32452 12.1492 3.35303 12.1613 3.38606L12.7635 5.05856C13.094 5.97544 13.6226 6.80814 14.3118 7.49729C15.0009 8.18645 15.8336 8.7151 16.7505 9.04556L18.423 9.64781C18.4564 9.65958 18.4853 9.68141 18.5057 9.71029C18.5261 9.73917 18.5371 9.77368 18.5371 9.80906C18.5371 9.84443 18.5261 9.87894 18.5057 9.90782C18.4853 9.9367 18.4564 9.95853 18.423 9.97031ZM22.4423 17.4988L21.5955 17.8041C21.1313 17.9715 20.7097 18.2393 20.3607 18.5883C20.0118 18.9372 19.744 19.3588 19.5765 19.8231L19.2713 20.6698C19.2652 20.6866 19.254 20.7011 19.2394 20.7113C19.2248 20.7216 19.2074 20.727 19.1895 20.727C19.1717 20.727 19.1543 20.7216 19.1396 20.7113C19.125 20.7011 19.1139 20.6866 19.1078 20.6698L18.8025 19.8231C18.635 19.3588 18.3673 18.9372 18.0183 18.5883C17.6694 18.2393 17.2478 17.9715 16.7835 17.8041L15.9368 17.4988C15.92 17.4927 15.9055 17.4816 15.8953 17.467C15.885 17.4523 15.8795 17.4349 15.8795 17.4171C15.8795 17.3992 15.885 17.3818 15.8953 17.3672C15.9055 17.3525 15.92 17.3414 15.9368 17.3353L16.7835 17.0301C17.2478 16.8626 17.6694 16.5948 18.0183 16.2459C18.3673 15.8969 18.635 15.4753 18.8025 15.0111L19.1078 14.1643C19.1139 14.1475 19.125 14.133 19.1396 14.1228C19.1543 14.1126 19.1717 14.1071 19.1895 14.1071C19.2074 14.1071 19.2248 14.1126 19.2394 14.1228C19.254 14.133 19.2652 14.1475 19.2713 14.1643L19.5765 15.0111C19.744 15.4753 20.0118 15.8969 20.3607 16.2459C20.7097 16.5948 21.1313 16.8626 21.5955 17.0301L22.4423 17.3353C22.4591 17.3414 22.4735 17.3525 22.4838 17.3672C22.494 17.3818 22.4995 17.3992 22.4995 17.4171C22.4995 17.4349 22.494 17.4523 22.4838 17.467C22.4735 17.4816 22.4591 17.4927 22.4423 17.4988ZM8.06253 17.4988L7.21578 17.8041C6.75155 17.9715 6.32995 18.2393 5.98098 18.5883C5.63201 18.9372 5.36426 19.3588 5.19678 19.8231L4.89153 20.6698C4.88542 20.6866 4.8743 20.7011 4.85967 20.7113C4.84505 20.7216 4.82763 20.727 4.80978 20.727C4.79192 20.727 4.7745 20.7216 4.75988 20.7113C4.74525 20.7011 4.73413 20.6866 4.72803 20.6698L4.42278 19.8231C4.2553 19.3588 3.98754 18.9372 3.63858 18.5883C3.28961 18.2393 2.86801 17.9715 2.40378 17.8041L1.55703 17.4988C1.54025 17.4927 1.52576 17.4816 1.51552 17.467C1.50528 17.4523 1.49979 17.4349 1.49979 17.4171C1.49979 17.3992 1.50528 17.3818 1.51552 17.3672C1.52576 17.3525 1.54025 17.3414 1.55703 17.3353L2.40378 17.0301C2.86801 16.8626 3.28961 16.5948 3.63858 16.2459C3.98754 15.8969 4.2553 15.4753 4.42278 15.0111L4.72803 14.1643C4.73413 14.1475 4.74525 14.133 4.75988 14.1228C4.7745 14.1126 4.79192 14.1071 4.80978 14.1071C4.82763 14.1071 4.84505 14.1126 4.85967 14.1228C4.8743 14.133 4.88542 14.1475 4.89153 14.1643L5.19678 15.0111C5.36426 15.4753 5.63201 15.8969 5.98098 16.2459C6.32995 16.5948 6.75155 16.8626 7.21578 17.0301L8.06253 17.3353C8.13903 17.3631 8.13903 17.4718 8.06253 17.4988Z",fill:"currentColor"})});Gt({displayName:"AiRainbowIconBase",viewBox:"0 0 24 24",path:w.jsxs(w.Fragment,{children:[w.jsx("g",{clipPath:"url(#clip0_497_8063)",children:w.jsx("path",{d:"M18.2468 14.5235L16.5735 13.9236C15.656 13.5949 14.6772 13.4727 13.7071 13.5656C12.7369 13.6585 11.7991 13.9643 10.9607 14.4612L9.43171 15.3679C9.40135 15.3857 9.36627 15.3937 9.3312 15.3909C9.29614 15.3881 9.26279 15.3746 9.23566 15.3522C9.20853 15.3298 9.18892 15.2996 9.1795 15.2657C9.17007 15.2318 9.17128 15.1959 9.18296 15.1627L9.78291 13.4893C10.1116 12.5718 10.2338 11.5931 10.1409 10.6229C10.0479 9.65274 9.74213 8.71502 9.24525 7.87657L8.33853 6.34758C8.32077 6.31722 8.31275 6.28213 8.31557 6.24707C8.31839 6.21201 8.33191 6.17866 8.3543 6.15152C8.37668 6.12439 8.40686 6.10479 8.44075 6.09537C8.47464 6.08594 8.51061 6.08715 8.54379 6.09883L10.2171 6.69878C11.1346 7.02745 12.1134 7.14967 13.0835 7.05674C14.0537 6.9638 14.9914 6.65799 15.8299 6.16111L17.3589 5.2544C17.3893 5.23664 17.4243 5.22862 17.4594 5.23144C17.4945 5.23426 17.5278 5.24778 17.5549 5.27016C17.5821 5.29255 17.6017 5.32273 17.6111 5.35662C17.6205 5.39051 17.6193 5.42648 17.6076 5.45966L17.0077 7.13298C16.679 8.05051 16.5568 9.02924 16.6497 9.99941C16.7427 10.9696 17.0485 11.9073 17.5454 12.7458L18.4521 14.2748C18.4703 14.3051 18.4787 14.3403 18.4761 14.3756C18.4734 14.4109 18.4599 14.4445 18.4374 14.4717C18.4149 14.499 18.3845 14.5187 18.3503 14.5279C18.3162 14.5372 18.28 14.5357 18.2468 14.5235ZM16.5553 22.8884L15.7079 22.5849C15.2433 22.4186 14.7477 22.3568 14.2564 22.4039C13.7652 22.451 13.2903 22.6057 12.8657 22.8572L12.0913 23.316C12.0759 23.3251 12.0581 23.3292 12.0403 23.3278C12.0225 23.3264 12.0056 23.3195 11.9918 23.3081C11.978 23.2968 11.9681 23.2815 11.9633 23.2643C11.9586 23.2471 11.9592 23.2288 11.9652 23.212L12.2687 22.3646C12.4349 21.8999 12.4968 21.4043 12.4497 20.9131C12.4026 20.4218 12.2479 19.9469 11.9964 19.5223L11.5376 18.7479C11.5285 18.7325 11.5244 18.7147 11.5258 18.697C11.5272 18.6792 11.5341 18.6622 11.5454 18.6485C11.5568 18.6347 11.5721 18.6247 11.5893 18.62C11.6065 18.6152 11.6248 18.6159 11.6416 18.6218L12.489 18.9253C12.9537 19.0916 13.4493 19.1534 13.9405 19.1063C14.4318 19.0593 14.9067 18.9045 15.3313 18.653L16.1057 18.1942C16.1211 18.1851 16.1388 18.1811 16.1566 18.1825C16.1744 18.1839 16.1914 18.1907 16.2051 18.2021C16.2189 18.2134 16.2289 18.2288 16.2336 18.246C16.2384 18.2632 16.2377 18.2814 16.2318 18.2983L15.9283 19.1456C15.762 19.6103 15.7002 20.1059 15.7473 20.5972C15.7943 21.0884 15.9491 21.5633 16.2006 21.9879L16.6594 22.7623C16.6684 22.7777 16.6725 22.7955 16.6711 22.8133C16.6697 22.8311 16.6629 22.848 16.6515 22.8618C16.6402 22.8756 16.6248 22.8855 16.6076 22.8903C16.5904 22.895 16.5722 22.8944 16.5553 22.8884ZM5.46406 13.7363L4.61667 13.4328C4.15202 13.2666 3.65642 13.2047 3.16515 13.2518C2.67388 13.2989 2.19903 13.4536 1.77439 13.7051L1.00002 14.1639C0.984637 14.173 0.966838 14.1771 0.949042 14.1757C0.931245 14.1743 0.914312 14.1674 0.900542 14.1561C0.886772 14.1447 0.876831 14.1294 0.872069 14.1122C0.867305 14.095 0.86795 14.0767 0.873916 14.0599L1.17739 13.2125C1.34367 12.7478 1.40549 12.2522 1.35843 11.761C1.31137 11.2697 1.15659 10.7948 0.90512 10.3702L0.44629 9.59584C0.437238 9.58045 0.43314 9.56265 0.43455 9.54486C0.435961 9.52706 0.442813 9.51013 0.454176 9.49636C0.465538 9.48259 0.48086 9.47265 0.498065 9.46789C0.51527 9.46312 0.533525 9.46377 0.55035 9.46973L1.39774 9.77321C1.8624 9.93949 2.358 10.0013 2.84926 9.95424C3.34053 9.90718 3.81538 9.75241 4.24002 9.50094L5.01439 9.04211C5.02978 9.03306 5.04757 9.02896 5.06537 9.03037C5.08317 9.03178 5.1001 9.03863 5.11387 9.04999C5.12764 9.06135 5.13758 9.07668 5.14234 9.09388C5.14711 9.11109 5.14646 9.12934 5.1405 9.14617L4.83702 9.99356C4.67074 10.4582 4.60893 10.9538 4.65599 11.4451C4.70305 11.9363 4.85782 12.4112 5.10929 12.8358L5.56812 13.6102C5.60947 13.6803 5.54025 13.7642 5.46406 13.7363Z",fill:"url(#paint0_linear_497_8063)"})}),w.jsxs("defs",{children:[w.jsxs("linearGradient",{id:"paint0_linear_497_8063",x1:"19.4467",y1:"10.3723",x2:"4.37004",y2:"16.438",gradientUnits:"userSpaceOnUse",children:[w.jsx("stop",{stopColor:"#FF7E90"}),w.jsx("stop",{offset:"0.463542",stopColor:"#A939FF"}),w.jsx("stop",{offset:"1",stopColor:"#0020FF"})]}),w.jsx("clipPath",{id:"clip0_497_8063",children:w.jsx("rect",{width:"24",height:"24",fill:"white"})})]})]})});const yn=e=>{const t=Bt("colors","primary"),[n,r,o]=B(t),a=F.useMemo(()=>`rainbow-gradient-${Math.random().toString(36).substr(2,9)}`,[]),{w:i,width:s,transform:l}=e,c="string"==typeof i?i:"string"==typeof s?s:"number"==typeof i?`${i}px`:"number"==typeof s?`${s}px`:"24px";return w.jsx(D,{position:"relative",display:"inline-block",width:c,height:c,transform:l,children:w.jsxs("svg",{viewBox:"0 0 24 24",width:c,height:c,style:{display:"block"},children:[w.jsxs("defs",{children:[w.jsxs("linearGradient",{id:a,x1:"19.4467",y1:"10.3723",x2:"4.37004",y2:"16.438",gradientUnits:"userSpaceOnUse",children:[w.jsx("stop",{stopColor:n}),w.jsx("stop",{offset:"0.463542",stopColor:r}),w.jsx("stop",{offset:"1",stopColor:o})]}),w.jsx("clipPath",{id:`clip-${a}`,children:w.jsx("rect",{width:"24",height:"24",fill:"white"})})]}),w.jsx("g",{clipPath:`url(#clip-${a})`,children:w.jsx("path",{d:"M18.2468 14.5235L16.5735 13.9236C15.656 13.5949 14.6772 13.4727 13.7071 13.5656C12.7369 13.6585 11.7991 13.9643 10.9607 14.4612L9.43171 15.3679C9.40135 15.3857 9.36627 15.3937 9.3312 15.3909C9.29614 15.3881 9.26279 15.3746 9.23566 15.3522C9.20853 15.3298 9.18892 15.2996 9.1795 15.2657C9.17007 15.2318 9.17128 15.1959 9.18296 15.1627L9.78291 13.4893C10.1116 12.5718 10.2338 11.5931 10.1409 10.6229C10.0479 9.65274 9.74213 8.71502 9.24525 7.87657L8.33853 6.34758C8.32077 6.31722 8.31275 6.28213 8.31557 6.24707C8.31839 6.21201 8.33191 6.17866 8.3543 6.15152C8.37668 6.12439 8.40686 6.10479 8.44075 6.09537C8.47464 6.08594 8.51061 6.08715 8.54379 6.09883L10.2171 6.69878C11.1346 7.02745 12.1134 7.14967 13.0835 7.05674C14.0537 6.9638 14.9914 6.65799 15.8299 6.16111L17.3589 5.2544C17.3893 5.23664 17.4243 5.22862 17.4594 5.23144C17.4945 5.23426 17.5278 5.24778 17.5549 5.27016C17.5821 5.29255 17.6017 5.32273 17.6111 5.35662C17.6205 5.39051 17.6193 5.42648 17.6076 5.45966L17.0077 7.13298C16.679 8.05051 16.5568 9.02924 16.6497 9.99941C16.7427 10.9696 17.0485 11.9073 17.5454 12.7458L18.4521 14.2748C18.4703 14.3051 18.4787 14.3403 18.4761 14.3756C18.4734 14.4109 18.4599 14.4445 18.4374 14.4717C18.4149 14.499 18.3845 14.5187 18.3503 14.5279C18.3162 14.5372 18.28 14.5357 18.2468 14.5235ZM16.5553 22.8884L15.7079 22.5849C15.2433 22.4186 14.7477 22.3568 14.2564 22.4039C13.7652 22.451 13.2903 22.6057 12.8657 22.8572L12.0913 23.316C12.0759 23.3251 12.0581 23.3292 12.0403 23.3278C12.0225 23.3264 12.0056 23.3195 11.9918 23.3081C11.978 23.2968 11.9681 23.2815 11.9633 23.2643C11.9586 23.2471 11.9592 23.2288 11.9652 23.212L12.2687 22.3646C12.4349 21.8999 12.4968 21.4043 12.4497 20.9131C12.4026 20.4218 12.2479 19.9469 11.9964 19.5223L11.5376 18.7479C11.5285 18.7325 11.5244 18.7147 11.5258 18.697C11.5272 18.6792 11.5341 18.6622 11.5454 18.6485C11.5568 18.6347 11.5721 18.6247 11.5893 18.62C11.6065 18.6152 11.6248 18.6159 11.6416 18.6218L12.489 18.9253C12.9537 19.0916 13.4493 19.1534 13.9405 19.1063C14.4318 19.0593 14.9067 18.9045 15.3313 18.653L16.1057 18.1942C16.1211 18.1851 16.1388 18.1811 16.1566 18.1825C16.1744 18.1839 16.1914 18.1907 16.2051 18.2021C16.2189 18.2134 16.2289 18.2288 16.2336 18.246C16.2384 18.2632 16.2377 18.2814 16.2318 18.2983L15.9283 19.1456C15.762 19.6103 15.7002 20.1059 15.7473 20.5972C15.7943 21.0884 15.9491 21.5633 16.2006 21.9879L16.6594 22.7623C16.6684 22.7777 16.6725 22.7955 16.6711 22.8133C16.6697 22.8311 16.6629 22.848 16.6515 22.8618C16.6402 22.8756 16.6248 22.8855 16.6076 22.8903C16.5904 22.895 16.5722 22.8944 16.5553 22.8884ZM5.46406 13.7363L4.61667 13.4328C4.15202 13.2666 3.65642 13.2047 3.16515 13.2518C2.67388 13.2989 2.19903 13.4536 1.77439 13.7051L1.00002 14.1639C0.984637 14.173 0.966838 14.1771 0.949042 14.1757C0.931245 14.1743 0.914312 14.1674 0.900542 14.1561C0.886772 14.1447 0.876831 14.1294 0.872069 14.1122C0.867305 14.095 0.86795 14.0767 0.873916 14.0599L1.17739 13.2125C1.34367 12.7478 1.40549 12.2522 1.35843 11.761C1.31137 11.2697 1.15659 10.7948 0.90512 10.3702L0.44629 9.59584C0.437238 9.58045 0.43314 9.56265 0.43455 9.54486C0.435961 9.52706 0.442813 9.51013 0.454176 9.49636C0.465538 9.48259 0.48086 9.47265 0.498065 9.46789C0.51527 9.46312 0.533525 9.46377 0.55035 9.46973L1.39774 9.77321C1.8624 9.93949 2.358 10.0013 2.84926 9.95424C3.34053 9.90718 3.81538 9.75241 4.24002 9.50094L5.01439 9.04211C5.02978 9.03306 5.04757 9.02896 5.06537 9.03037C5.08317 9.03178 5.1001 9.03863 5.11387 9.04999C5.12764 9.06135 5.13758 9.07668 5.14234 9.09388C5.14711 9.11109 5.14646 9.12934 5.1405 9.14617L4.83702 9.99356C4.67074 10.4582 4.60893 10.9538 4.65599 11.4451C4.70305 11.9363 4.85782 12.4112 5.10929 12.8358L5.56812 13.6102C5.60947 13.6803 5.54025 13.7642 5.46406 13.7363Z",fill:`url(#${a})`})})]})})},vn=""+new URL("dori.ico",import.meta.url).href,wn=({onClose:e,isMobile:t=!1,isExpanded:n=!1,onToggleExpand:r,fullPageHref:o,onReload:a})=>{const{botData:i,cartItemCount:s,shortlistEnabled:l,shortlist:c,setShortlistOpen:d}=H(),u=P(),{t:p}=q(),h=O(i)&&s>0,f=l&&c.length>0,[g,m]=v.useState(!1),b=v.useRef(c.length);return v.useEffect(()=>{if(c.length===b.current)return;b.current=c.length,m(!0);const e=setTimeout(()=>m(!1),250);return()=>clearTimeout(e)},[c.length]),w.jsxs(Xt,{justify:"space-between",align:"center",flexShrink:0,children:[i?.feature_flags?.hide_header_logo?w.jsx(D,{h:u.length(40)}):w.jsx(N,{src:i?.bot_image?i?.bot_image:vn,alt:"",role:"presentation",w:u.length(40),h:u.length(40),borderRadius:"50%"}),w.jsxs(Y,{gap:u.space(3),children:[f&&w.jsxs(I,{variant:"outline",size:"sm",borderRadius:u.radius(4),px:u.space(2),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${u.length(5)} ${u.length(9)}`,transform:g?"scale(1.12)":"scale(1)",transition:"transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1)",onClick:()=>d(!0),"aria-label":p("savedProducts"),fontFamily:V,children:[w.jsx(mn,{boxSize:u.length(15),color:"primary"}),w.jsx(Z,{fontSize:u.font(13),fontWeight:"500",color:"text",children:c.length})]}),h&&w.jsxs(I,{variant:"outline",size:"sm",borderRadius:u.radius(4),px:u.space(2),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${u.length(5)} ${u.length(9)}`,onClick:()=>{if(!U()){const e=`${Q()}cart`;window.open(e,"_blank","noopener,noreferrer")||(window.location.href=e)}},fontFamily:V,children:[w.jsx(fn,{boxSize:u.length(16),color:"text"}),w.jsx(Z,{fontSize:u.font(13),fontWeight:"500",color:"text",children:s})]}),o?w.jsx(I,{asChild:!0,variant:"outline",size:"sm",borderRadius:u.radius(4),px:u.space(3),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${u.length(5)} ${u.length(9)}`,fontFamily:V,children:w.jsxs("a",{href:o,children:[w.jsx(on,{boxSize:u.length(16),color:"text"}),p("aiPageOpenFull")]})}):!t&&r&&w.jsxs(I,{variant:"outline",size:"sm",borderRadius:u.radius(4),px:u.space(3),height:"auto",lineHeight:"1.5",border:"none",color:"text",bgColor:"lightBackground",_hover:{bgColor:"veryLightBackground"},padding:`${u.length(5)} ${u.length(9)}`,onClick:()=>r?.(),fontFamily:V,children:[w.jsx(on,{boxSize:u.length(16),color:"text"}),p(n?"minimize":"showFullScreen")]}),a&&w.jsx(Ut,{size:"sm",boxSize:u.length(36),minW:u.length(36),variant:"ghost","aria-label":p("reload"),onClick:a,color:"text",_hover:{bgColor:"mutedText"},children:w.jsx(hn,{boxSize:t?u.length(16):u.length(24),color:"text"})}),w.jsx(Ut,{size:"sm",boxSize:u.length(36),minW:u.length(36),variant:"ghost","aria-label":p("close"),onClick:()=>{n&&r?.(),e()},color:"text",_hover:{bgColor:"mutedText"},children:w.jsx(tn,{boxSize:t?u.length(16):u.length(24),color:"text"})})]})]})};class Cn{static async getUploadCredentials(e){const t={file_extension:e,expires_in:3600,content_length_range:{min_bytes:1024,max_bytes:10485760}},n=await fetch(K.getUploadUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({data:t})});if(!n.ok)throw new Error(`Failed to get upload credentials: ${n.status} ${n.statusText}`);return await n.json()}static async compressImage(e,t=1024,n=.8){return new Promise(r=>{const o=document.createElement("canvas"),a=o.getContext("2d"),i=new Image;i.onload=()=>{const{width:s,height:l}=this.calculateDimensions(i.width,i.height,t);o.width=s,o.height=l,a.drawImage(i,0,0,s,l),o.toBlob(t=>{const a=new File([t],e.name,{type:"image/jpeg",lastModified:Date.now()});r({file:a,preview:o.toDataURL("image/jpeg",n),format:"jpeg"})},"image/jpeg",n)},i.src=URL.createObjectURL(e)})}static getFileExtension(e){const t=e.name.split(".").pop()?.toLowerCase();switch(t){case"jpg":case"jpeg":default:return"jpeg";case"webp":return"webp";case"png":return"png";case"heic":return"heic"}}static calculateDimensions(e,t,n){if(e<=n)return{width:e,height:t};const r=t/e;return{width:n,height:Math.round(n*r)}}static async uploadImage(e,t){const n=new FormData;Object.entries(e.fields).forEach(([e,t])=>{n.append(e,t)}),n.append("file",t);const r=await fetch(e.url,{method:"POST",body:n});if(!r.ok&&204!==r.status)throw new Error("Error uploading image");return e.public_url}}const kn=()=>{const[e,t]=v.useState(null),[n,r]=v.useState(!1);return{uploadedImage:e,isUploading:n,handleFileSelect:()=>{const e=document.createElement("input");e.type="file",e.accept="image/jpeg,image/jpg,image/webp,image/png,image/heic",e.onchange=e=>{const n=e.target.files?.[0];n&&(async e=>{try{r(!0);const n=await Cn.compressImage(e),o=await Cn.getUploadCredentials(n.format),a=await Cn.uploadImage(o,n.file);t({url:a,preview:n.preview,name:e.name,size:n.file.size})}catch(n){console.error("Upload failed:",n),alert("Failed to upload image")}finally{r(!1)}})(n)},e.click()},removeImage:()=>{e?.preview&&URL.revokeObjectURL(e.preview),t(null)}}},jn=({imageUrl:e,onRemove:t})=>{const n=P();return w.jsxs("div",{style:{position:"relative",display:"inline-block",background:"transparent"},children:[w.jsx(N,{src:e,alt:"Uploaded image",w:n.length(80),h:n.length(80),borderRadius:n.radius(12),objectFit:"cover",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.11)"}),w.jsx(Ut,{position:"absolute",top:n.length(6),right:n.length(6),bg:"primary",color:"buttonText","aria-label":"Remove image",onClick:t,size:"sm",borderRadius:"50%",minW:n.length(24),h:n.length(24),children:w.jsx(tn,{boxSize:n.length(14)})})]})},Sn=()=>{const[e,t]=v.useState(!1);return v.useEffect(()=>{const e=e=>{"Tab"===e.key&&t(!0)},n=()=>t(!1);return window.addEventListener("keydown",e,!0),window.addEventListener("pointerdown",n,!0),()=>{window.removeEventListener("keydown",e,!0),window.removeEventListener("pointerdown",n,!0)}},[]),e},zn=e=>e?{"&:has(textarea:focus, input:focus)":{boxShadow:"inset 0 0 0 2px var(--chakra-colors-text)"}}:void 0,An=({placeholder:e="Write a prompt or paste a contract address",value:t="",onChange:n,onSend:r,isMobileView:o})=>{const{t:a}=q(),i=Sn(),{botData:s,chatState:{repliedProduct:l},setRepliedProduct:c}=H(),d=!s?.feature_flags?.hide_image_upload,u=P(),[p,h]=v.useState(t),{uploadedImage:f,isUploading:g,handleFileSelect:m,removeImage:b}=kn();v.useEffect(()=>{h(y(t))},[t]);const x=e=>{(p.trim()||e||f)&&(r?.({message:e??p.trim(),imageUrl:f?.url},l?.product),c?.(null),h(""),b())},y=e=>e.trimStart();return w.jsxs(G,{gap:u.space(2),align:"stretch",bg:"transparent",position:"relative",children:[f&&w.jsx(D,{position:"absolute",bottom:l?o?u.length(300):u.length(190):u.length(90),left:u.length(12),zIndex:1e6,bg:"transparent",pointerEvents:"auto",children:w.jsx(jn,{imageUrl:f.preview,onRemove:b})}),w.jsx(D,{bgColor:"lightBackground",borderRadius:u.radius(24),css:zn(i),position:"relative",p:u.space(2),w:"full",h:l?o?u.length(300):u.length(190):u.length(90),transition:"all 0.6s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",transform:"scale(1)",opacity:1,children:w.jsxs(D,{position:"absolute",top:0,left:0,right:0,bottom:0,p:u.space(2),opacity:1,transform:"translateY(0) scale(1)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:"auto",children:[l&&w.jsxs(G,{opacity:1,p:u.length(8),gap:u.length(8),borderRadius:u.radius(12),borderWidth:"1px",borderColor:"borderColor",bgColor:"lightBackground",children:[w.jsxs(Y,{justify:"space-between",align:"center",w:"full",children:[w.jsx(N,{src:l?.product?.image,alt:"product",w:u.length(40),h:u.length(40)}),w.jsx(Z,{fontSize:u.font(12),fontWeight:400,color:"text",children:l?.product?.name}),w.jsx(Ut,{bg:"transparent","aria-label":"Remove product",onClick:()=>c?.(null),children:w.jsx(tn,{boxSize:u.length(24),color:"text"})})]}),l?.suggestions&&l.suggestions.length>0&&w.jsxs(w.Fragment,{children:[w.jsx(D,{display:{base:"none",md:"block"},w:"full",children:w.jsx(Y,{w:"full",justify:"flex-start",align:"center",gap:u.space(2),children:l.suggestions.map(e=>w.jsx(I,{variant:"outline",bg:"transparent",color:"text",fontSize:u.font(12),borderColor:"borderColor",borderRadius:u.radius(24),fontWeight:400,onClick:()=>x(e),h:u.length(32),px:u.space(3),minW:"unset",flex:1,lineHeight:"1.5",overflow:"hidden",children:w.jsx(D,{as:"span",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block",w:"100%",children:e})},e))})}),w.jsx(D,{display:{base:"block",md:"none"},w:"full",children:w.jsx(G,{w:"full",align:"stretch",gap:u.length(8),children:l.suggestions.map(e=>w.jsx(I,{variant:"outline",bg:"transparent",w:"full",color:"text",fontSize:u.font(14),borderColor:"borderColor",borderRadius:u.radius(24),fontWeight:400,onClick:()=>x(e),children:e},e))})})]})]}),w.jsx(en,{"aria-label":a("messageInputLabel"),value:p,onChange:e=>(e=>{const t=y(e);h(t),n?.(t)})(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.repeat||(e.preventDefault(),x())},placeholder:e,fontSize:X(u,16),color:"text",fontWeight:300,resize:"none",rows:1,lineHeight:"1.5",h:"100%",border:"none",bg:"transparent",_focus:{boxShadow:"none",border:"none",outline:"none"},_placeholder:{color:"mutedText"},pr:u.length(48),transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)"}),d&&w.jsx(Ut,{position:"absolute",bottom:u.length(8),left:u.length(12),size:"xs",boxSize:u.length(32),minW:u.length(32),borderRadius:"full",bg:"background","aria-label":"Upload image",onClick:m,_hover:{bg:"background"},disabled:g,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",transform:"scale(1)",zIndex:2,border:"1px solid",borderColor:"borderColor",color:"text",children:g?w.jsx(J,{size:"sm",color:"text"}):w.jsx($,{color:"text"})}),w.jsx(Ut,{position:"absolute",bottom:u.length(12),right:u.length(12),size:"xs",boxSize:u.length(32),minW:u.length(32),borderRadius:"full",bg:"background",color:"text","aria-label":"Send",onClick:()=>x(),_hover:{bg:"veryLightBackground"},disabled:!p.trim()&&!f,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",_disabled:{bg:"background",cursor:"not-allowed",opacity:.7},transform:"scale(1)",zIndex:2,children:w.jsx(un,{boxSize:u.length(30),color:"primary"})})]})})]})},En=({placeholder:e="Write a prompt or paste a contract address",onStop:t})=>{const n=P(),{stopCurrentRequest:r}=H();return w.jsx(G,{gap:n.space(2),align:"stretch",bg:"transparent",position:"relative",children:w.jsx(D,{bg:"lightBackground",borderRadius:n.radius(32),position:"relative",p:n.space(3),w:"full",h:n.length(48),transition:"all 0.6s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",transform:"scale(1)",opacity:1,children:w.jsx(D,{position:"absolute",top:0,left:0,right:0,bottom:0,p:n.space(3),opacity:1,transform:"translateY(0) scale(1)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:"auto",children:w.jsxs(Y,{justify:"space-between",align:"center",h:"full",children:[w.jsx(Z,{color:"mutedText",fontSize:n.font(16),flex:1,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",children:e}),w.jsx(Ut,{size:"xs",boxSize:n.length(32),minW:n.length(32),borderRadius:"full",bg:"background",color:"text","aria-label":"Stop",onClick:()=>{r?.(),t?.()},_hover:{bg:"veryLightBackground"},transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",transform:"scale(1)",zIndex:2,children:w.jsx(dn,{boxSize:n.length(30),color:"primary"})})]})})})})},Rn=({placeholder:e="Write a prompt or paste a contract address",value:t="",onChange:n,onSend:r})=>{const{t:o}=q(),a=Sn(),i=P(),{botData:s}=H(),l=!s?.feature_flags?.hide_image_upload,[c,d]=v.useState(t),[u,p]=v.useState(!1),{uploadedImage:h,isUploading:f,handleFileSelect:g,removeImage:m}=kn(),b=v.useRef(null);v.useEffect(()=>{d(C(t))},[t]);const x=()=>{(c.trim()||h)&&(r?.({message:c.trim(),imageUrl:h?.url}),d(""),m())},y=e=>` ${e}`,C=e=>e.trimStart();return w.jsxs(G,{gap:i.space(2),align:"stretch",children:[h&&w.jsx(D,{mb:i.space(2),alignSelf:"flex-start",bg:"transparent",children:w.jsx(jn,{imageUrl:h.preview,onRemove:m})}),w.jsxs(D,{bg:"lightBackground",borderRadius:i.radius(24),css:zn(a),position:"relative",p:i.space(2),w:"full",h:u?i.length(80):i.length(48),transition:"all 0.6s cubic-bezier(0.4, 0, 0.2, 1)",overflow:"hidden",cursor:"pointer",onClick:()=>{p(!0),setTimeout(()=>{if(b.current){b.current.focus();const e=b.current.value.length;b.current.setSelectionRange(e,e)}},100)},children:[w.jsx(D,{position:"absolute",top:i.length(8),left:i.length(8),zIndex:2,children:w.jsx(yn,{w:i.length(24),h:i.length(24),transform:"rotate(2700deg)",color:"primary"})}),w.jsx(D,{position:"absolute",top:0,left:0,right:0,bottom:0,p:i.space(2),opacity:u?0:1,transform:u?"translateY(-20px) scale(0.95)":"translateY(0) scale(1)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:u?"none":"auto",children:w.jsx(Y,{justify:"space-between",align:"center",h:"full",children:w.jsx(Z,{color:"#999999",fontSize:i.font(16),flex:1,paddingStart:i.length(32),transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",children:e})})}),l&&w.jsx(Ut,{position:"absolute",bottom:i.length(7.5),right:i.length(52),size:"xs",boxSize:i.length(32),minW:i.length(32),borderRadius:"full",bg:"background",color:"text","aria-label":"Upload image",onClick:e=>{e.stopPropagation(),g()},_hover:{bg:"veryLightBackground"},disabled:f,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",transform:"scale(1)",zIndex:2,border:"1px solid",borderColor:"borderColor",children:f?w.jsx(J,{size:"sm"}):w.jsx($,{size:i.length(24)})}),w.jsx(Ut,{position:"absolute",bottom:i.length(8),right:i.length(12),size:"xs",boxSize:i.length(32),minW:i.length(32),borderRadius:"full",bg:"primary","aria-label":"Send",onClick:e=>{e.stopPropagation(),x()},_hover:{bg:"darkPrimary"},disabled:!c.trim()&&!h,transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",_disabled:{bg:"primary",opacity:.5,cursor:"not-allowed"},transform:"scale(1) rotate(180deg)",zIndex:2,children:w.jsx(pn,{boxSize:i.length(30),color:"buttonText"})}),w.jsx(D,{position:"absolute",top:0,left:0,right:0,bottom:0,p:i.space(2),opacity:u?1:0,transform:u?"translateY(0) scale(1)":"translateY(20px) scale(0.95)",transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",pointerEvents:u?"auto":"none",children:w.jsx(en,{"aria-label":o("messageInputLabel"),ref:b,value:y(c),onChange:e=>(e=>{const t=C(e);d(t),n?.(t)})(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.repeat||(e.preventDefault(),x())},placeholder:y(e),fontSize:X(i,16),color:"text",fontWeight:300,resize:"none",h:"100%",border:"none",bg:"transparent",cursor:"text",_focus:{boxShadow:"none",border:"none",outline:"none"},_placeholder:{color:"mutedText"},transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)",rows:2,lineHeight:"1.5"})})]})]})},Tn=({state:e="starting",placeholder:t="Write a prompt or paste a contract address",value:n="",onChange:r,onSend:o,onStop:a})=>{const[i,s]=v.useState(!1);return v.useEffect(()=>{const e=()=>{s(window.innerWidth<=768)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),"starting"===e?w.jsx(An,{placeholder:t,value:n,onChange:r,onSend:o,isMobileView:i}):"generating"===e?w.jsx(En,{placeholder:t,onStop:a,isMobileView:i}):w.jsx(Rn,{placeholder:t,value:n,onChange:r,onSend:o})},_n=e=>{const t=e.includes("?")?"&":"?";return`${e}${t}utm_source=dori&utm_medium=dori_widget&utm_campaign=dori_product_recommendation`},Wn=(e,t)=>{const n=e.includes("?")?"&":"?";return`${e}${n}utm_source=customer_referral&utm_medium=widget&utm_campaign=powered_by&utm_term=${t}`};function In(e){return!e?.white_label?.ai_notice_only&&!1!==e?.customization?.enable_shopper_memory}const Ln="/policies/privacy-policy",Mn=()=>{const{t:e}=q(),t=P(),[n,r]=v.useState(!1);return w.jsxs(D,{position:"relative",display:"inline-flex",alignItems:"center",children:[w.jsxs(D,{as:"span",display:"inline-flex",alignItems:"center",gap:t.space(1),tabIndex:0,cursor:"default",px:t.space(2),py:"1px",borderRadius:"9999px",bgGradient:"to-r",gradientFrom:"primaryWash",gradientTo:"primaryWashStrong",color:"darkPrimary",border:"1px solid",borderColor:"primaryWash",lineHeight:"1.25",transition:"background 120ms ease, box-shadow 120ms ease",_hover:{boxShadow:"0 1px 6px rgba(0,0,0,0.10)"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"1px"},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),"aria-describedby":"dori-personalized-tip",children:[w.jsx(cn,{boxSize:t.font(11),"aria-hidden":"true"}),w.jsx(Z,{as:"span",fontSize:t.font(10),fontWeight:"600",children:e("personalizedBadge")})]}),n&&w.jsx(D,{id:"dori-personalized-tip",role:"tooltip",position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",zIndex:20,width:"max(220px, 80%)",maxW:"260px",bg:"rgba(32,34,35,0.96)",color:"white",fontSize:t.font(11),lineHeight:"1.45",px:t.space(3),py:t.space(2),borderRadius:"8px",boxShadow:"0 6px 20px rgba(0,0,0,0.22)",pointerEvents:"none",children:e("personalizedTooltip")})]})},Bn=()=>{const e=P(),{botData:t}=H(),{isMobile:n}=ee(),{t:r}=q(),o=function(e){const t=e?.white_label;if(t?.ai_notice_only)return{kind:"short"};const n=t?.disclaimer_text?.trim();return n?{kind:"custom",text:n}:{kind:"default"}}(t),a="custom"===o.kind?o.text:r("short"===o.kind?"aiCanMakeMistakesShort":"aiCanMakeMistakes"),i=function(e){const t=e?.white_label;if(t?.ai_notice_only)return{kind:"none"};const n=t?.logo_url?.trim();if(n)return{kind:"merchant",src:n,alt:t?.logo_alt?.trim()||e?.bot_name||"Store logo"};const r=Boolean(t?.disclaimer_text?.trim());return t?.is_white_labeled||r?{kind:"none"}:{kind:"dori"}}(t),s=function(e){const t=e?.white_label;if(!t?.privacy_link_enabled)return null;const n=t.privacy_link_url?.trim();return n?/^https?:\/\//i.test(n)||/^\/(?!\/)/.test(n)?n:/^[a-z0-9-]+(\.[a-z0-9-]+)+(\/|$)/i.test(n)?`https://${n}`:Ln:Ln}(t);return w.jsxs(Y,{gapX:e.space(2),justifyContent:n?"start":"center",align:"center",alignContent:"center",alignItems:"center",w:"full",wrap:n?"wrap":"nowrap",children:["dori"===i.kind&&w.jsx(Ft,{href:Wn("https://dori.tech/",t?.sharing_id||""),target:"_blank",rel:"noopener noreferrer",display:"inline-flex",alignItems:"center",children:w.jsx(N,{src:vn,alt:"Dori AI",boxSize:te(e)})}),"merchant"===i.kind&&w.jsx(N,{src:i.src,alt:i.alt,h:te(e),w:"auto",maxW:ne(e),objectFit:"contain",flexShrink:0}),w.jsxs(D,{fontSize:e.font(10),color:"mutedText",px:e.space(0),py:e.space(0),bg:"transparent",border:"none",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:e.space(1),children:[w.jsx(D,{as:"span",children:a}),s&&w.jsx(Ft,{href:s,target:"_blank",rel:"noopener noreferrer",color:"inherit",textDecoration:"underline",whiteSpace:"nowrap",children:r("privacyPolicy")}),In(t)&&w.jsx(Mn,{})]})]})};function Fn(e){return re({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"m112 184 144 144 144-144"},child:[]}]})(e)}function Dn(e){return re({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"m112 328 144-144 144 144"},child:[]}]})(e)}const Hn=(e={})=>{const{enableTwinkling:t=!0,enableFloating:n=!0,enableRotation:r=!0,enableScaling:o=!0,twinklingSpeed:a=1e3,floatingSpeed:i=3e3,rotationSpeed:s=8e3,scalingSpeed:l=4e3,floatingRange:c=2.5,rotationRange:d=90,scalingRange:u=1.2}=e,[p,h]=v.useState(1),[f,g]=v.useState(0),[m,b]=v.useState(0),[x,y]=v.useState(1);return v.useEffect(()=>{if(!t)return;const e=setInterval(()=>{h(e=>1===e?.2:1)},a);return()=>clearInterval(e)},[t,a]),v.useEffect(()=>{if(!n)return;const e=setInterval(()=>{g(e=>0===e?c:0)},i);return()=>clearInterval(e)},[n,i,c]),v.useEffect(()=>{if(!r)return;const e=setInterval(()=>{b(e=>0===e?d:0)},s);return()=>clearInterval(e)},[r,s,d]),v.useEffect(()=>{if(!o)return;const e=setInterval(()=>{y(e=>1===e?u:1)},l);return()=>clearInterval(e)},[o,l,u]),{getStarfieldTransform:(e,t)=>[].filter(Boolean).join(" "),getIconStyle:()=>({opacity:p,transition:"transform 0.8s ease-in-out, opacity 1s ease-in-out"}),twinkleOpacity:p,floatingOffset:f,rotationAngle:m,scaleFactor:x}};function Pn(e){if(!e)return null;const{customization:t,bot_image:n,agent_image:r,bot_image_original:o}=e;switch(t?.fab_avatar_source){case"none":return null;case"logo":return n||null;case"agent":return r||null}return t?.enable_avatar_in_fab&&((n&&n!==o?n:null)||r||n)||null}const qn=e=>"bottom"===e?.anchor?"bottom":"middle",On=(e,t)=>t?(e=>e?.customization?.mobile?.position?{align:e.customization?.mobile?.position?.align??"right",sideSpacing:e.customization?.mobile?.position?.side_spacing??8,bottomSpacing:e.customization?.mobile?.position?.bottom_spacing??0,anchor:qn(e.customization?.mobile?.position)}:{align:"right",sideSpacing:8,bottomSpacing:20,anchor:"middle"})(e):(e=>e?.customization?.position?{align:e.customization?.position?.align??"right",sideSpacing:e.customization?.position?.side_spacing??16,bottomSpacing:e.customization?.position?.bottom_spacing??0,anchor:qn(e.customization?.position)}:{align:"right",sideSpacing:16,bottomSpacing:60,anchor:"middle"})(e),Nn=(e,t,n)=>"bottom"===e.anchor||n&&!!Pn(t),Yn=(e,t)=>"bottom"===e.anchor?Math.max(0,e.bottomSpacing):t?.customization?.mobile?.position?.bottom_spacing??90;function Vn(){return"undefined"!=typeof window&&!!window.$crisp}function Zn(){Vn()&&window.$crisp.push(["do","chat:hide"])}function Un(){console.log("trying to open"),Vn()&&(console.log("trying to open2"),window.$crisp.push(["do","chat:show"]),window.$crisp.push(["do","chat:open"]))}const Qn=15e3,Kn="chatra";let Gn=!1,Xn=!1,Jn=null,$n=0,er=null,tr=0,nr=!1;function rr(...e){console.log("[Dori-Chatra]",...e)}function or(){return"undefined"!=typeof window&&"function"==typeof window.Chatra}function ar(){return!!or()&&!!document.getElementById(Kn)}function ir(e){if(or())try{window.Chatra("hide"),rr("called Chatra('hide') —",e)}catch(t){rr("error calling hide:",t)}}function sr(){null!==Jn&&(clearInterval(Jn),Jn=null,rr("stopped maintain loop"))}function lr(){Xn||Date.now()-$n>3e4?sr():Gn&&or()&&ir("maintain loop")}function cr(){if(!Xn)return;const e=document.getElementById(Kn);if(!e)return;const t=e.className||"",n=-1!==t.indexOf("chatra--visible");-1!==t.indexOf("chatra--expanded")?nr=!0:nr&&(Date.now()-tr<1500||n&&ir("user closed chat"))}function dr(){rr("openChatraChat invoked"),Xn=!0,nr=!1,sr(),function(){if(er||"undefined"==typeof document)return;const e=()=>{const e=document.getElementById(Kn);return!!e&&(er=new MutationObserver(cr),er.observe(e,{attributes:!0,attributeFilter:["class","style"]}),rr("attached close observer to #chatra"),!0)};if(e())return;const t=Date.now(),n=setInterval(()=>{(e()||Date.now()-t>Qn)&&clearInterval(n)},200)}(),function(e){if(ar())return void e();const t=Date.now(),n=setInterval(()=>{ar()?(clearInterval(n),e()):Date.now()-t>Qn&&(clearInterval(n),rr("Chatra never fully loaded within",Qn,"ms"))},200)}(()=>{tr=Date.now();try{window.Chatra("show"),rr("called Chatra('show')"),setTimeout(()=>{try{window.Chatra("openChat"),rr("called Chatra('openChat')")}catch(e){rr("error calling openChat:",e)}},50)}catch(e){rr("error calling show:",e)}})}const ur="dori-shopify-inbox-hide",pr="data-dori-inbox-open",hr="shopify-chat",fr="inbox-online-store-chat";let gr=null;function mr(...e){console.log("[Dori-ShopifyInbox]",...e)}function br(){if("undefined"==typeof document)return null;const e=document.querySelector(hr);if(e)return{el:e,legacy:!1};const t=document.querySelector(fr);return t?{el:t,legacy:!0}:null}function xr(){mr("openShopifyInbox invoked"),function(e){const t=br();if(t)return void e(t);const n=Date.now(),r=setInterval(()=>{const t=br();t?(clearInterval(r),e(t)):Date.now()-n>15e3&&(clearInterval(r),mr("Inbox embed never appeared within",15e3,"ms"))},200)}(({el:e,legacy:t})=>{if(document.documentElement.setAttribute(pr,""),t)requestAnimationFrame(()=>{const t=e.shadowRoot?.querySelector("button");t?(t.click(),mr("clicked legacy activator")):mr("legacy activator not found in shadow root")});else{if(function(e){gr||"undefined"==typeof document||(gr=new MutationObserver(()=>{e.hasAttribute("open")||document.documentElement.removeAttribute(pr)}),gr.observe(e,{attributes:!0,attributeFilter:["open"]}))}(e),"function"==typeof e.show)try{return e.show(),void mr("called shopify-chat.show()")}catch(n){mr("show() failed, falling back to the open attribute:",n)}e.setAttribute("open","")}})}const yr=e=>{if(!e)return[];const t=[];return e.crisp?.enabled&&t.push({type:"crisp",icon:e.crisp.icon,name:e.crisp.name,data:e.crisp}),e.chatra?.enabled&&t.push({type:"chatra",icon:e.chatra.icon,name:e.chatra.name,data:e.chatra}),e.shopifyInbox?.enabled&&t.push({type:"shopifyInbox",icon:e.shopifyInbox.icon,name:e.shopifyInbox.name,data:e.shopifyInbox}),e.customLink?.enabled&&t.push({type:"customLink",icon:e.customLink.icon,name:e.customLink.name,data:e.customLink}),e.telegram?.enabled&&t.push({type:"telegram",icon:e.telegram.icon,name:e.telegram.name,data:e.telegram}),e.whatsapp?.enabled&&t.push({type:"whatsapp",icon:e.whatsapp.icon,name:e.whatsapp.name,data:e.whatsapp}),t},vr=(e,t,n)=>{switch(e){case"whatsapp":const e=t.phoneNumber?.replace(/\s/g,""),r=t.welcomeMessage?`?text=${encodeURIComponent(t.welcomeMessage)}`:"";window.open(`https://wa.me/${e}${r}`,"_blank");break;case"telegram":window.open(`https://t.me/${t.username}`,"_blank");break;case"customLink":window.open(t.linkUrl,"_blank");break;case"crisp":Un(),window.dispatchEvent(new Event("dori:close-widget"));break;case"chatra":dr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"shopifyInbox":xr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"dori":n&&n()}},wr=({channels:e,isOpen:t,onToggle:n,isMobile:r,onMouseEnter:o,onChatClick:a})=>{const{botData:i}=H(),s=Ot({base:!0,md:!1})??!1,l=On(i,s),c=!0!==i?.customization?.disable_idle_animation,{getStarfieldTransform:d,getIconStyle:u}=Hn({enableTwinkling:c,enableFloating:c,enableRotation:c,enableScaling:c}),p=yr(e);return 0===p.length?null:w.jsxs(G,{gap:2,align:"flex-end",alignItems:"center",position:"absolute",bottom:"100%",right:0,children:[r&&t&&w.jsx(Ut,{"aria-label":"Toggle support channels",size:"2xs",borderRadius:"full",bg:"primary",color:"buttonText",boxShadow:"md",mb:2,opacity:t||r?1:0,transition:"all 0.2s ease",_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)",boxShadow:"lg"}},onClick:n,display:r||!t?"flex":"none",children:w.jsx(Fn,{size:20})}),w.jsx(D,{mb:3,opacity:t?1:0,transform:t?"translateY(0)":"translateY(10px)",transition:"all 0.2s ease",pointerEvents:t?"auto":"none",onMouseEnter:o,children:w.jsxs(G,{gap:2,align:"flex-end",children:[w.jsx(D,{borderRadius:"full",cursor:"pointer",onClick:()=>vr("dori",{},a),bg:"primary",boxSize:{base:"36px",md:"48px"},display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"md",_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)",boxShadow:"lg"}},transition:"all 0.2s ease",children:w.jsx(xn,{boxSize:{base:"24px",md:"32px"},color:"background",transform:d("expanded",l),...u()})}),p.map((e,t)=>w.jsx(D,{borderRadius:"full",cursor:"pointer",onClick:()=>vr(e.type,e.data,a),_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)"}},transition:"all 0.2s ease",children:w.jsx(N,{src:e.icon,alt:e.name,boxSize:{base:"36px",md:"48px"},borderRadius:"full",objectFit:"fill"})},`${e.type}-${t}`))]})}),r&&!t&&w.jsx(Ut,{"aria-label":"Toggle support channels",size:"2xs",borderRadius:"full",bg:"primary",color:"buttonText",boxShadow:"md",mb:2,opacity:t||r?1:0,transition:"all 0.2s ease",_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.1)",boxShadow:"lg"}},onClick:n,display:r||!t?"flex":"none",children:w.jsx(Dn,{size:20})})]})},Cr=({channels:e})=>{const t=P(),n=(e=>{if(!e)return[];const t=[];return e.crisp?.enabled&&t.push({type:"crisp",icon:e.crisp.icon,name:e.crisp.name,data:e.crisp}),e.chatra?.enabled&&t.push({type:"chatra",icon:e.chatra.icon,name:e.chatra.name,data:e.chatra}),e.shopifyInbox?.enabled&&t.push({type:"shopifyInbox",icon:e.shopifyInbox.icon,name:e.shopifyInbox.name,data:e.shopifyInbox}),e.customLink?.enabled&&t.push({type:"customLink",icon:e.customLink.icon,name:e.customLink.name,data:e.customLink}),e.telegram?.enabled&&t.push({type:"telegram",icon:e.telegram.icon,name:e.telegram.name,data:e.telegram}),e.whatsapp?.enabled&&t.push({type:"whatsapp",icon:e.whatsapp.icon,name:e.whatsapp.name,data:e.whatsapp}),t})(e);return 0===n.length?null:w.jsx(Y,{gap:t.space(3),w:"full",alignItems:"center",justifyContent:"start",wrap:"wrap",children:n.map((e,n)=>w.jsxs(D,{display:"flex",alignItems:"center",gap:t.space(3),cursor:"pointer",borderRadius:t.radius(16),padding:"6px 8px",bg:"lightBackground",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"veryLightBackground",transform:"scale(1.05)"}},transition:"all 0.2s ease",onClick:()=>((e,t)=>{switch(e){case"whatsapp":const e=t.phoneNumber?.replace(/\s/g,""),n=t.welcomeMessage?`?text=${encodeURIComponent(t.welcomeMessage)}`:"";window.open(`https://wa.me/${e}${n}`,"_blank");break;case"telegram":window.open(`https://t.me/${t.username}`,"_blank");break;case"customLink":window.open(t.linkUrl,"_blank");break;case"crisp":Un(),window.dispatchEvent(new Event("dori:close-widget"));break;case"chatra":dr(),window.dispatchEvent(new Event("dori:close-widget"));break;case"shopifyInbox":xr(),window.dispatchEvent(new Event("dori:close-widget"))}})(e.type,e.data),flexShrink:0,children:[w.jsx(N,{src:e.icon,alt:e.name,boxSize:{base:t.length(22),md:t.length(24)},borderRadius:"full",objectFit:"cover"}),w.jsx(Z,{fontSize:{base:t.font(12),md:t.font(14)},fontWeight:"400",color:"text",whiteSpace:"nowrap",children:e.name})]},`${e.type}-${n}`))})},kr=({flow:e,onComplete:t,onClose:n})=>{const r=P(),[o,a]=v.useState(0),[i,s]=v.useState([]),[l,c]=v.useState("active"),[d,u]=v.useState(!1),[p,h]=v.useState(!1),[f,g]=v.useState(!1),m=v.useRef(null),b=v.useRef(null),x=v.useRef(null),y=v.useRef(null),C=Bt("colors","primary"),k=oe(C);v.useEffect(()=>{if("active"!==l)return;u(!1);const e=requestAnimationFrame(()=>{u(!0)});return()=>cancelAnimationFrame(e)},[o,l]),v.useEffect(()=>()=>{m.current&&clearTimeout(m.current),b.current&&clearTimeout(b.current),x.current&&clearTimeout(x.current),y.current&&clearTimeout(y.current)},[]);const j=v.useCallback(n=>{if(f)return;g(!0);const r=[...i,{stepIndex:o,option:n}];s(r),o<e.steps.length-1?(u(!1),m.current=setTimeout(()=>{a(e=>e+1),g(!1)},280)):(h(!0),y.current=setTimeout(()=>{c("analyzing"),h(!1);const n=800+700*Math.random();x.current=setTimeout(()=>{const n=r.map(e=>e.option.label).join(" · ");let o=e.result_prompt;r.forEach((e,t)=>{const n=`{step${t+1}}`;o=o.split(n).join(e.option.value)});const a=ae(),i=r.map(e=>e.option.label).join(", ");t(n,`${a}[Quiz selections: ${i}] ${o}`)},n)},300))},[f,i,o,e,t]),S=v.useCallback(()=>{o<=0||p||(u(!1),b.current=setTimeout(()=>{s(e=>e.slice(0,-1)),a(e=>e-1),g(!1)},250))},[o,p]),z=e.steps[o];return"analyzing"===l?w.jsxs(G,{gap:r.space(3),align:"center",flex:1,justify:"center",transition:"opacity 0.3s ease",children:[w.jsx(Y,{gap:r.space(2),flexWrap:"wrap",justify:"center",children:i.map((e,t)=>w.jsx(jr,{label:e.option.label},t))}),w.jsxs(G,{gap:r.space(2),align:"center",py:r.space(4),children:[w.jsx(ln,{boxSize:r.length(20),color:"primary",opacity:.6}),w.jsx(Z,{fontSize:r.font(14),fontWeight:500,fontFamily:V,css:{background:`linear-gradient(90deg, ${C}44, ${C}, ${C}44)`,backgroundSize:"200% 100%",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",animation:"dori-shimmer 1.5s ease-in-out infinite"},children:e.analyzing_text})]}),w.jsx("style",{children:"\n @keyframes dori-shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n }\n "})]}):w.jsxs(G,{gap:r.space(4),align:"stretch",flex:1,justify:"start",opacity:p?0:1,transform:p?"translateY(-8px)":"translateY(0)",transition:"opacity 0.3s ease, transform 0.3s ease",children:[i.length>0&&w.jsxs(Y,{gap:r.space(2),flexWrap:"wrap",align:"center",children:[w.jsx(D,{as:"button",onClick:S,"aria-label":"Back",cursor:"pointer",px:r.space(2),py:r.space(1),borderRadius:r.radius(12),fontSize:r.font(11),color:"primary",opacity:.8,_hover:{opacity:1,bg:"veryLightBackground"},transition:"all 0.15s ease",fontFamily:V,flexShrink:0,children:"←"}),i.map((e,t)=>w.jsx(jr,{label:e.option.label},t))]}),w.jsxs(D,{opacity:d?1:0,transform:d?"translateY(0)":"translateY(10px)",transition:"opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",children:[w.jsxs(G,{align:"stretch",gap:r.space(3),mb:r.space(3),children:[w.jsxs(Y,{justify:"space-between",align:"center",gap:r.space(3),children:[w.jsxs(Y,{gap:r.space(2),align:"center",minW:0,children:[w.jsx(D,{display:"flex",alignItems:"center",justifyContent:"center",boxSize:r.length(24),borderRadius:r.radius(12),bg:"background",border:"1px solid",borderColor:"primary",flexShrink:0,children:w.jsx(ln,{boxSize:r.length(12),color:"primary"})}),w.jsx(Z,{fontSize:r.font(11),fontWeight:600,fontFamily:V,lineHeight:"1.4",css:{background:k,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:e.entry_label})]}),w.jsxs(Y,{gap:r.space(1),align:"center",flexShrink:0,children:[w.jsxs(D,{px:r.space(2.5),py:r.space(1),borderRadius:r.radius(999),bg:"background",border:"1px solid",borderColor:"primary",fontSize:r.font(10),fontWeight:700,color:"primary",fontFamily:V,lineHeight:"1",flexShrink:0,children:[o+1,"/",e.steps.length]}),n&&w.jsx(D,{as:"button",onClick:n,cursor:"pointer",p:1,borderRadius:"full",opacity:.5,_hover:{opacity:1,bg:"lightBackground"},transition:"all 0.15s ease",flexShrink:0,"aria-label":"Close",children:w.jsx(Z,{fontSize:"16px",color:"text",lineHeight:"1",children:"×"})})]})]}),w.jsx(Z,{fontSize:r.font(17),fontWeight:700,color:"text",lineHeight:"1.45",fontFamily:V,children:z.question}),w.jsx(D,{bg:"background",border:"1px solid",borderColor:"borderColor",borderRadius:r.radius(16),px:r.space(3),py:r.space(2.5),children:w.jsxs(Y,{gap:r.space(2),align:"start",children:[w.jsx(D,{boxSize:r.length(7),borderRadius:"full",bg:"primary",mt:r.length(7),flexShrink:0}),w.jsx(Z,{fontSize:r.font(12),color:"mutedText",fontWeight:500,lineHeight:"1.65",fontFamily:V,opacity:.9,children:z.reason})]})})]}),w.jsx(D,{display:"grid",gridTemplateColumns:{base:"1fr 1fr"},gap:r.space(2),children:z.options.map((e,t)=>w.jsx(D,{as:"button",px:r.space(3),py:"8px",borderRadius:r.radius(24),border:"1px solid",borderColor:"primary",bg:"veryLightBackground",cursor:"pointer",textAlign:"start",display:"flex",alignItems:"center",gap:r.space(2),opacity:d?1:0,transform:d?"translateY(0)":"translateY(6px)",transition:`opacity 0.25s ease ${40*t}ms, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) ${40*t}ms, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease`,_hover:{bg:"lightBackground",boxShadow:`0 0 0 1px ${C}33`},_active:{bg:"lightBackground",transform:"translateY(0) scale(0.97)"},onClick:()=>j(e),fontFamily:V,children:w.jsxs(D,{flex:"1",minW:0,children:[w.jsx(Z,{fontSize:r.font(13),fontWeight:500,color:"text",lineHeight:"1.4",whiteSpace:"normal",wordBreak:"break-word",children:e.label}),e.subtitle&&w.jsx(Z,{fontSize:r.font(10),color:"mutedText",opacity:.6,lineHeight:"1.2",children:e.subtitle})]})},e.value))})]})]})},jr=({label:e})=>{const t=P();return w.jsxs(D,{px:t.space(3),py:t.space(1),borderRadius:t.radius(16),bg:"veryLightBackground",border:"1px solid",borderColor:"primary",fontSize:t.font(11),fontWeight:500,color:"primary",fontFamily:V,whiteSpace:"nowrap",children:["✓ ",e]})},Sr=({chips:e,onChipClick:t,onDismiss:n})=>{const r=P(),[o,a]=v.useState(!1);return v.useEffect(()=>{const e=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(e)},[]),0===e.length?null:w.jsx(D,{flexShrink:0,opacity:o?1:0,transform:o?"translateY(0)":"translateY(10px)",transition:"opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)","data-dori-nudge":"chip-row",children:w.jsxs(Y,{gap:r.space(2),wrap:"wrap",align:"center",children:[e.map((e,n)=>w.jsx(I,{size:"sm",variant:"outline",borderRadius:r.radius(20),borderWidth:"1.5px",borderColor:"primary",bg:"veryLightBackground",color:"text",fontSize:r.font(13),fontWeight:500,px:r.space(3),py:r.space(1.5),height:"auto",whiteSpace:"normal",wordBreak:"break-word",textAlign:"start",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"lightBackground"}},onClick:()=>t(e),fontFamily:V,children:e},`${n}-${e}`)),w.jsx(Ut,{size:"xs",borderRadius:"full",bg:"transparent","aria-label":"Dismiss nudge",color:"mutedText",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"lightBackground"}},minW:r.length(22),w:r.length(22),h:r.length(22),p:r.space(0),flexShrink:0,onClick:n,opacity:.6,children:w.jsx(tn,{boxSize:r.length(11)})})]})})};const zr=({onStartChat:e,isMobile:t,isExpanded:o=!1,onToggleExpand:a,fullPageHref:i,onClose:s})=>{const{inputValue:l,handleInputChange:c}=((e="")=>{const[t,n]=v.useState(e),r=v.useCallback(e=>{n(e)},[]),o=v.useCallback(e=>{t.trim()&&e&&(e(t.trim()),n(""))},[t]),a=v.useCallback((e,t)=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),o(t))},[o]),i=v.useCallback(()=>{n("")},[]),s=v.useCallback(e=>{n(e)},[]);return{inputValue:t,setInputValue:n,handleInputChange:r,handleSubmit:o,handleKeyPress:a,clearInput:i,setInput:s}})(),{botData:d,primedGreeting:u,effectiveSuggestedReplies:p,bannerChips:h,dismissBannerChips:f,suppressProactiveForSession:g}=H(),m=P(),b=ie(t?1:se(d).width),{t:x,translations:y}=q(),C=u||n(d,y),k=Bt("colors","primary"),j=oe(k),S=p,z=!1,A=v.useMemo(()=>S.slice(0,4),[S]),[E,R]=le();v.useMemo(()=>S.slice(0,2),[S]);const T=({message:t,imageUrl:n})=>{(t.trim()||n)&&e(t.trim(),n)},_=!0===d?.feature_flags?.greeting_one_line,W=v.useRef(null),L=function(e,t,n,r,o){const[a,i]=v.useState(n);return v.useLayoutEffect(()=>{if(!t)return void i(n);const o=e.current,a=o?.parentElement;if(!o||!a)return;const s=()=>{const e=o.style.fontSize;o.style.fontSize=`${n}px`;const t=o.scrollWidth;o.style.fontSize=e,i(function(e,t,n,r){if(!(e>0&&t>e))return n;const o=Math.floor(n*(e/t)*.99);return Math.max(r,Math.min(n,o))}(a.clientWidth,t,n,r))};if(s(),"undefined"==typeof ResizeObserver)return;const l=new ResizeObserver(s);return l.observe(a),()=>l.disconnect()},[e,t,n,r,o]),a}(W,_,parseFloat(m.isMini?m.font(24):`${b.greetingFontPx}px`),14,C||""),M=!0===d?.feature_flags?.composer_at_bottom,B=w.jsx(D,{children:w.jsx(Tn,{state:"minimized",placeholder:x("askAnything"),value:l,onChange:c,onSend:T})});return w.jsxs(w.Fragment,{children:[w.jsx(wn,{onClose:s,isMobile:t,isExpanded:o,onToggleExpand:a,fullPageHref:i}),w.jsxs(G,{h:"full",minH:0,justify:"flex-start",align:"stretch",gap:m.space(b.sectionGap),children:[C&&w.jsx(G,{gap:m.space(3),w:"full",align:"start",mb:m.length(b.greetingGapPx),flexShrink:0,children:w.jsx(Z,{ref:W,fontWeight:o?600:500,fontStyle:"normal",fontSize:_?`${L}px`:m.isMini?m.font(24):`${b.greetingFontPx}px`,whiteSpace:_?"nowrap":void 0,letterSpacing:"0",textAlign:o?"center":"right",fontFamily:V,css:{background:j,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:C})}),w.jsx(D,{flex:1,minH:0,overflowY:"auto",overflowX:"hidden","data-scroll-container":"chat-messages",overscrollBehavior:"contain",css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none"},children:w.jsxs(G,{gap:m.space(4),align:"stretch",justify:"start",pb:m.space(3),children:[!M&&B,h&&h.length>0&&w.jsx(Sr,{chips:h,onChipClick:t=>{r("banner_chip_tapped",{chip_text:t}),e(t),f()},onDismiss:()=>{r("banner_chips_dismissed"),f(),g()}}),!(h&&h.length>0)&&E&&w.jsx(Sr,{chips:[E],onChipClick:t=>{r("offer_guide_chat_opened",{from:"opening"}),R(),de(t).then(n=>e(t,void 0,n))},onDismiss:()=>{ce(),R()}}),z,z,A.length>0&&w.jsx(D,{w:"full",children:w.jsx(D,{display:"grid",gridTemplateColumns:{base:"1fr",md:b.starterColumns},gap:m.space(3),w:"full",children:A.map((e,t)=>w.jsxs(I,{variant:"outline",borderRadius:m.radius(24),border:"1px solid",borderColor:"borderColor",bg:"lightBackground",color:"text",fontSize:m.font(14),fontWeight:400,padding:"8px 12px",_hover:{bg:"veryLightBackground",borderColor:"borderColor"},onClick:()=>(e=>{T({message:e,imageUrl:void 0})})(e),justifyContent:"start",w:"full",height:"auto",lineHeight:"1.5",whiteSpace:"pre-wrap",children:[w.jsx(ln,{boxSize:m.length(16),color:"text"}),w.jsx(D,{as:"span",flex:"1",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"break-word",fontFamily:V,children:e})]},t))})})]})}),w.jsx(D,{w:"full",flexShrink:0,children:w.jsx(Cr,{channels:d?.merchant_support_channels})}),M&&w.jsx(D,{w:"full",flexShrink:0,children:B}),w.jsx(D,{flexShrink:0,transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",children:w.jsx(Bn,{variant:"default"})})]})]})},Ar=({message:e,type:t="default"})=>{const n="loading"===t,{botData:r}=H(),o=P(),a=e.replace(/\\([!?.,'":;\-\[\](){}#*_~`>+])/g,"$1"),i=n?a.replace(/[.\u2026]{1,3}\s*$/u,"").trim():a;return w.jsxs(D,{position:"relative",width:"full",children:[w.jsx(D,{opacity:"0",bg:"lightBackground",borderRadius:o.radius(24),padding:o.length(16),children:w.jsx(Z,{fontWeight:400,fontSize:o.font(14),lineHeight:o.lineHeight(21),fontFamily:V,children:a})}),w.jsx(D,{h:o.length(50)}),w.jsx(D,{position:"absolute",left:0,bottom:0,children:w.jsx(N,{src:r?.agent_image||vn,alt:"",role:"presentation",w:o.length(24),h:o.length(24),borderRadius:"50%"})}),w.jsx(D,{position:"absolute",left:o.length(21),bottom:o.length(21),width:o.length(7.68),height:o.length(7.68),bg:"lightBackground",borderRadius:"100%",borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor"}),w.jsx(D,{position:"absolute",left:o.length(27),bottom:o.length(27),width:o.length(15.8),height:o.length(15.8),bg:"lightBackground",borderRadius:"100%",borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor"}),w.jsx(D,{position:"absolute",left:o.length(35),bottom:o.length(35),bg:"lightBackground",borderRadius:o.radius(24),padding:o.length(16),borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",children:n?w.jsxs(Y,{gap:o.length(8),align:"center",children:[i&&w.jsx(Z,{fontWeight:400,fontSize:o.font(14),lineHeight:o.lineHeight(21),color:"mutedText",fontFamily:V,children:i}),w.jsx(Y,{gap:o.length(3),align:"center","aria-hidden":"true",children:[0,1,2].map(e=>w.jsx(D,{w:o.length(4),h:o.length(4),borderRadius:"full",bg:"mutedText",css:{animation:`dori-typing-dot 1.2s ease-in-out ${.15*e}s infinite`}},e))}),w.jsx("style",{children:"\n @keyframes dori-typing-dot {\n 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }\n 30% { opacity: 1; transform: translateY(-3px); }\n }\n "})]}):w.jsx(Z,{fontWeight:400,fontSize:o.font(14),lineHeight:o.lineHeight(21),color:"text",fontFamily:V,children:a})})]})};function Er(e,t){t?window.open(e,"_blank","noopener,noreferrer"):window.location.href=e}function Rr(e,t){let n=-1;const r=()=>{const r=e.getBoundingClientRect();n=r.width,t(function(e){const t={bgColor:null,transform:null};try{const n=e.naturalWidth||e.width,r=e.naturalHeight||e.height;if(!n||!r)return t;const o=Math.min(1,256/Math.max(n,r)),a=Math.max(1,Math.round(n*o)),i=Math.max(1,Math.round(r*o)),s=document.createElement("canvas"),l=s.getContext("2d",{willReadFrequently:!0});if(!l)return t;s.width=a,s.height=i,l.drawImage(e,0,0,a,i);const{data:c}=l.getImageData(0,0,a,i),d=(e,t)=>{const n=4*(t*a+e);return[c[n],c[n+1],c[n+2],c[n+3]]},u=[d(0,0),d(a-1,0),d(0,i-1),d(a-1,i-1)].filter(([,,,e])=>e>=128),p=0===u.length;let h=null,f=null;if(!p){const e=new Map;for(const t of u){const n=`${t[0]},${t[1]},${t[2]}`,r=e.get(n);r?r.n+=1:e.set(n,{c:t,n:1})}h=Array.from(e.values()).sort((e,t)=>t.n-e.n)[0].c,f=`rgb(${h[0]}, ${h[1]}, ${h[2]})`}const g=Math.max(1,Math.floor(Math.max(a,i)/160)),m=(e,t)=>{const[n,r,o,a]=d(e,t);if(a<128)return!1;if(p)return!0;if(!h)return!1;const i=n-h[0],s=r-h[1],l=o-h[2];return Math.sqrt(i*i+s*s+l*l)>30};let b=a,x=i,y=-1,v=-1;for(let e=0;e<i;e+=g)for(let t=0;t<a;t+=g)m(t,e)&&(t<b&&(b=t),t>y&&(y=t),e<x&&(x=e),e>v&&(v=e));if(y<0||v<0)return{bgColor:f,transform:null};const w=(y-b+g)/a,C=(v-x+g)/i;if(Math.max(w,C)>.8)return{bgColor:f,transform:null};const k=e.getBoundingClientRect();if(!k.width||!k.height)return{bgColor:f,transform:null};const j=Math.min(k.width/n,k.height/r),S=Math.max(w*n*j/k.width,C*r*j/k.height);if(!S)return{bgColor:f,transform:null};const z=Math.min(2.2,.88/S);if(z<1.06)return{bgColor:f,transform:null};const A=-((x+(v-x+g)/2)/i-.5)*r*j*z;return{bgColor:f,transform:`translate(${(-((b+(y-b+g)/2)/a-.5)*n*j*z).toFixed(1)}px, ${A.toFixed(1)}px) scale(${z.toFixed(3)})`}}catch{return t}}(e))},o=()=>r();e.complete&&e.naturalWidth>0?r():e.addEventListener("load",o);const a="undefined"!=typeof ResizeObserver?new ResizeObserver(t=>{const o=t[0]?.contentRect?.width??0;o>0&&Math.abs(o-n)>8&&e.complete&&e.naturalWidth>0&&r()}):null;return a?.observe(e),()=>{e.removeEventListener("load",o),a?.disconnect()}}const Tr={black:"#222222",white:"#ffffff",offwhite:"#f3efe7","off-white":"#f3efe7",ivory:"#f4f0e1",cream:"#f3ead3",natural:"#e8ded0",beige:"#d9c7a8",tan:"#cba36b",taupe:"#9b8978",camel:"#bd9a6a",khaki:"#a39a6a",sand:"#d8c19a",stone:"#cabfa9",nude:"#e3c4a8",gray:"#808080",grey:"#808080",charcoal:"#3a3d40",slate:"#5a6470",graphite:"#4a4a4a",silver:"#c4c4c4",ash:"#b2b2b2",smoke:"#8c8c8c",pewter:"#9a9a94",gunmetal:"#53565a",red:"#c8302b",crimson:"#a31f34",scarlet:"#c4302a",cherry:"#a31330",ruby:"#9b1b30",wine:"#5e1f2b",burgundy:"#5b1a26",bordeaux:"#4e1822",maroon:"#6b1f2a",brick:"#9c4a3a",terracotta:"#c46a4a",rust:"#9e4a2e",coral:"#e36a52",salmon:"#e69079",punch:"#d83a5e",pink:"#e58aab",rose:"#d98ca0",blush:"#e8c0c4",magenta:"#b8336a",fuchsia:"#c2407e",orange:"#e08234",pumpkin:"#e07b39",apricot:"#e7a473",peach:"#f0b48f",amber:"#c98a2b",mustard:"#c9962f",gold:"#c9a227",honey:"#d7a13a",sunshine:"#f4c842",yellow:"#e8c63a",lemon:"#e7d44a",canary:"#e6d24a",brown:"#6b4a2e",chocolate:"#4f3422",coffee:"#5a4334",mocha:"#7a5a44",caramel:"#a9743f",chestnut:"#6e3f2a",walnut:"#5a4031",espresso:"#3a2a21",bronze:"#7d5a33",copper:"#a35d3a",clay:"#a86a4f",green:"#3f7a3f",forest:"#2c4a2c",olive:"#6b6a35",sage:"#9aa583",moss:"#5e6b3a",mint:"#8fd0b0",emerald:"#1f8a5a",jade:"#3a9b78",lime:"#9bc24a","olive green":"#6b6a35",leaf:"#5a8a3a",blue:"#2f5fa8",navy:"#27314f",cobalt:"#2a4d9b",azure:"#3a8fd0",sky:"#86b8e0",denim:"#46688f",sapphire:"#1f4e8c",marine:"#27506b",ocean:"#1f6e8c",teal:"#1d8a85",turquoise:"#3fb7b0",aqua:"#5fc7c0",cyan:"#3bb6c4",periwinkle:"#8a9cd8",indigo:"#3a3a7a",purple:"#6f4a8e",violet:"#7a4ba0",plum:"#6e3a5e",grape:"#6f4a8e",eggplant:"#4b2e57",aubergine:"#4b2e57",amethyst:"#8a6aa0",lavender:"#b9a7d6",lilac:"#c4a8d6",mauve:"#a07a8a",seafoam:"#8fcab0",sangria:"#7a1f2b",midnight:"#1f2540",onyx:"#2a2a2a",ebony:"#2b2622",jet:"#2a2a2a",pearl:"#f0ead9",snow:"#fafafa",heather:"#9a8fa0",oat:"#dcceb4",fog:"#cfd2cf",berry:"#8a2f4a",rosso:"#c8302b",rojo:"#c8302b",rouge:"#c8302b",rot:"#c8302b",vermelho:"#c8302b",blu:"#2f5fa8",azul:"#2f5fa8",bleu:"#2f5fa8",blau:"#2f5fa8",azzurro:"#3a8fd0",verde:"#3f7a3f",vert:"#3f7a3f","grün":"#3f7a3f",gruen:"#3f7a3f",nero:"#222222",negro:"#222222",noir:"#222222",schwarz:"#222222",preto:"#222222",bianco:"#ffffff",blanco:"#ffffff",blanc:"#ffffff","weiß":"#ffffff",weiss:"#ffffff",branco:"#ffffff",giallo:"#e8c63a",amarillo:"#e8c63a",jaune:"#e8c63a",gelb:"#e8c63a",grigio:"#808080",gris:"#808080",grau:"#808080",marrone:"#6b4a2e","marrón":"#6b4a2e",marron:"#6b4a2e",braun:"#6b4a2e",viola:"#7a4ba0",morado:"#7a4ba0",lila:"#c4a8d6",arancione:"#e08234",naranja:"#e08234"},_r=/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i;function Wr(e,t){return t&&_r.test(t)?t:function(e){if(!e)return null;const t=e.trim().toLowerCase();if(Tr[t])return Tr[t];for(const n of t.split(/[\s/_,&+().-]+/))if(n&&Tr[n])return Tr[n];return null}(e)}function Ir(e,t,n,r,o){for(const a of e?.options??[])if(a.position===n)for(const e of a.values){if(!e.swatch||!e.swatch_variant)continue;const r=t.find(t=>String(t.id)===e.swatch_variant);if(r&&ue(r,n)===o)return e.swatch}return e?.options?.find(e=>e.name===r)?.values.find(e=>e.value===o)?.swatch??null}function Lr(e){return!!e?.values.some(e=>e.swatch)}const Mr=/colo|couleur|farbe|màu|colore|kleur/i,Br=({product:e,selectedColor:t=null,onColorChange:n,showQuantity:r=!1,onAdded:o,controlled:a=!1,onSelectionChange:i,onLiveLoaded:s})=>{const l=P(),{addToCartDirect:c,botData:d,isTestMode:u}=H(),{t:p}=q(),h=e.variant_summary,[f,g]=v.useState(null),[m,b]=v.useState(!1),x=v.useRef(s);x.current=s;const[y,C]=v.useState({}),[k,j]=v.useState("idle"),[S,z]=v.useState(null),[A,E]=v.useState(1);v.useEffect(()=>{let t=!1;const n=pe(e.url);if(n)return he(n).then(e=>{!t&&e&&e.variants?.length&&(g(e),b(!0),x.current?.(e))}).catch(()=>{}),()=>{t=!0}},[e.url]);const R=(e.currency||d?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",T=v.useMemo(()=>f?fe(f):[],[f]),_=v.useMemo(()=>m&&f?T.map((e,t)=>{const n=Mr.test(e.name)||function(e,t){return!!e?.options?.some(e=>e.position===t&&Lr(e))}(h,t+1),r=e.values.map(r=>{let o=null;if(n){const e=f.variants.find(e=>ue(e,t+1)===r&&e.featured_image?.src);o=e?.featured_image?.src??null}return{value:r,image:o,swatch:n?Ir(h,f.variants,t+1,e.name,r):null}}),o=n&&new Set(r.map(e=>e.image).filter(Boolean)).size>1;return{name:e.name,isColor:n,useImages:o,values:r}}).filter(e=>e.values.length>1):(h?.options??[]).map(e=>{const t=Mr.test(e.name)||Lr(e),n=e.values.map(e=>({value:e.value,image:e.image,swatch:e.swatch})),r=t&&new Set(n.map(e=>e.image).filter(Boolean)).size>1;return{name:e.name,isColor:t,useImages:r,values:n}}),[m,f,T,h]),W=_.findIndex(e=>e.isColor),L=v.useRef(null);v.useEffect(()=>{if(t===L.current)return;if(L.current=t??null,null==t||W<0)return;const e=_[W]?.name;e&&C(n=>{if(n[e]===t)return n;const r={};for(let e=0;e<W;e++){const t=_[e].name;n[t]&&(r[t]=n[t])}r[e]=t;for(let e=W+1;e<_.length;e++){const t=_[e],o=n[t.name];o&&((!m||!f||ge(f,{...r,[t.name]:o}).some(e=>!1!==e.available))&&(r[t.name]=o))}return r})},[t,W,_,m,f]);const M=v.useRef(!1),B=e=>{const t=_.find(t=>t.name===e);return!!t&&(t.isColor||1===t.values.length)};v.useEffect(()=>{if(!a||M.current||0===_.length)return;if(Object.keys(y).length>0)return void(M.current=!0);const e=_.find(e=>e.isColor),r=t=>{e&&t[e.name]&&n?.(t[e.name])},o=e&&t&&e.values.some(e=>e.value===t)?t:null;if(m&&f){const t=e?T.findIndex(t=>t.name===e.name)+1:0,n=o&&f.variants.find(e=>!1!==e.available&&ue(e,t)===o)||f.variants.find(e=>!1!==e.available),a={};return n&&T.forEach((e,t)=>{const r=ue(n,t+1);r&&B(e.name)&&(a[e.name]=r)}),M.current=!0,void(Object.keys(a).length&&(C(a),r(a)))}const i={};for(const t of _){if(!B(t.name))continue;const e=h?.options.find(e=>e.name===t.name)?.values??[],n=t=>{const n=e.find(e=>e.value===t);return!n||!1!==n.available},r=t.isColor&&o&&n(o)?{value:o}:t.values.find(e=>n(e.value));r&&(i[t.name]=r.value)}M.current=!0,Object.keys(i).length&&(C(i),r(i))},[a,m,f,_,T]);const F=_.every(e=>y[e.name]),O=v.useMemo(()=>m&&f&&F?ge(f,y).find(e=>!1!==e.available)??null:null,[m,f,F,y]),N=F&&!(m&&f&&!O),U=_.map(e=>y[e.name]).filter(Boolean).join(" · ");v.useEffect(()=>{a&&i?.({allChosen:F,canAdd:N,variantId:O?String(O.id):null,priceCents:O?.price??null,selectedLabel:U,selectedOptions:y})},[a,F,N,O,U,y]);const Q=r&&null!=O?.price?me(O.price/100*A,R):null,K=null!=O?.price?` · ${me(O.price/100,R)}`:"",X=be(l),J=(e,t,r)=>{const o=((e,t)=>{const n=_[e];if(m&&f){const r={[n.name]:t};for(let t=0;t<e;t++){const e=y[_[t].name];e&&(r[_[t].name]=e)}return ge(f,r).some(e=>!1!==e.available)}const r=h?.options.find(e=>e.name===n.name)?.values.find(e=>e.value===t);return!r||!1!==r.available})(e,r.value),i=y[t.name]===r.value,s=t.isColor?Wr(r.value,r.swatch):null,c={as:"button",type:"button",disabled:!o,"aria-pressed":i,"aria-label":r.value,title:r.value,onClick:()=>o&&((e,t)=>{const r=_[e].name,o=y[r]===t;C(n=>{const a={};for(let t=0;t<e;t++){const e=_[t].name;n[e]&&(a[e]=n[e])}return o||(a[r]=t),a}),!o&&_[e]?.isColor&&n?.(t),"added"!==k&&"error"!==k||(j("idle"),z(null))})(e,r.value),cursor:o?"pointer":"not-allowed",opacity:o?1:.35,style:{appearance:"none",WebkitAppearance:"none"}},d=a?`${X.image}px`:l.length(40),u=a?`${X.dot}px`:l.length(26);return t.useImages&&r.image?w.jsx(D,{...c,position:"relative",p:l.space(0),w:d,h:d,borderRadius:l.radius(10),overflow:"hidden",border:i?"3px solid":"2px solid",borderColor:i?"primary":"borderColor",boxShadow:i?"0 0 0 2px var(--chakra-colors-veryLightBackground)":void 0,backgroundImage:`url(${r.image})`,backgroundSize:"cover",backgroundPosition:"center",flexShrink:0,children:!o&&w.jsx(D,{position:"absolute",top:"50%",left:"-4px",right:"-4px",h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r.value):s?w.jsx(D,{...c,position:"relative",p:l.space(0),w:u,h:u,borderRadius:"full",bg:s,border:i?"3px solid":"2px solid",borderColor:i?"primary":"transparent",boxShadow:i?"0 0 0 2px var(--chakra-colors-background)":"inset 0 0 0 0.5px rgba(0,0,0,0.2)",flexShrink:0,children:!o&&w.jsx(D,{position:"absolute",top:"50%",left:"-2px",right:"-2px",h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r.value):w.jsx(D,{...c,px:l.space(2.5),py:l.space(1),minH:a?`${X.minH}px`:void 0,display:a?"flex":"inline-flex",alignItems:"center",justifyContent:"center",minW:0,borderRadius:l.radius(8),border:i?"2px solid":"1px solid",borderColor:i?"primary":"borderColor",bg:i?"primary":"background",children:w.jsx(Z,{fontSize:a?`${X.font}px`:l.font(12),overflow:"hidden",textOverflow:"ellipsis",fontWeight:i?600:400,color:i?"white":"text",textDecoration:o?"none":"line-through",whiteSpace:"nowrap",fontFamily:V,children:r.value})},r.value)},$=_.map((e,t)=>w.jsxs(D,{children:[w.jsxs(Z,{fontSize:a?l.font(12):l.font(11),color:"mutedText",mb:l.space(1.5),fontFamily:V,children:[e.name,y[e.name]?w.jsx(Z,{as:"span",color:"primary",fontWeight:600,children:` · ${y[e.name]}`}):""]}),!a||e.useImages||e.isColor?w.jsx(Y,{gap:l.space(a?X.gap:1.5),wrap:"wrap",children:e.values.map(n=>J(t,e,n))}):w.jsx(D,{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${X.minWidth}px, 1fr))`,gap:l.space(X.gap),children:e.values.map(n=>J(t,e,n))})]},e.name));return a?w.jsx(G,{align:"stretch",gap:l.space(3),w:"full",pt:l.space(1),children:$}):w.jsxs(G,{align:"stretch",gap:l.space(2),w:"full",pt:l.space(1),children:[$,r&&w.jsxs(Y,{justify:"space-between",align:"center",children:[w.jsx(Z,{fontSize:l.font(12),fontWeight:500,color:"text",fontFamily:V,children:p("quantity")}),w.jsxs(Y,{gap:l.space(0),border:"1px solid",borderColor:"borderColor",borderRadius:l.radius(8),overflow:"hidden",children:[w.jsx(I,{variant:"ghost",size:"xs",minW:l.length(30),h:l.length(28),borderRadius:0,color:A<=1?"mutedText":"text",disabled:A<=1||"adding"===k,onClick:()=>E(e=>Math.max(1,e-1)),"aria-label":p("decreaseQuantity"),children:"−"}),w.jsx(Z,{fontSize:l.font(13),fontWeight:600,minW:l.length(28),textAlign:"center",color:"text",fontFamily:V,children:A}),w.jsx(I,{variant:"ghost",size:"xs",minW:l.length(30),h:l.length(28),borderRadius:0,color:A>=10?"mutedText":"text",disabled:A>=10||"adding"===k,onClick:()=>E(e=>Math.min(10,e+1)),"aria-label":p("increaseQuantity"),children:"+"})]})]}),w.jsxs(I,{size:"sm",h:l.length(34),borderRadius:l.radius(8),fontSize:l.font(12),fontWeight:500,bg:"primary",color:"buttonText",gap:l.space(1.5),w:"full",disabled:!F||"adding"===k,loading:"adding"===k,onClick:async()=>{if(!F||"adding"===k)return;if(m&&f&&!O)return j("error"),void z(null);j("adding"),z(null);const t=r?A:1,n=null!=e.id?String(e.id):void 0,a=O?{variant_id:String(O.id),product_id:n,product_name:e.name,quantity:t}:{product_id:n,product_name:e.name,product_url:e.url,selected_options:y,quantity:t},i=xe(e,d);if(i)return void Er(i.href,u);const s=await c(a);"success"===s.type?(j("added"),o?.({selectedLabel:U,quantity:t})):(j("error"),z(ye(s,p)||null))},_hover:{opacity:.92},fontFamily:V,children:[w.jsx(fn,{boxSize:l.length(14)}),"added"===k?`✓ ${p("addedToCart")}`:F?Q&&F?p("addQty").replace("{qty}",String(A)).replace("{price}",Q):p("addToCartButton")+(U?` · ${U}`:"")+K:p("selectOptionsToContinue")]}),"error"===k&&w.jsx(Z,{fontSize:l.font(11),color:"error",fontFamily:V,children:S||p("errorOccurred")})]})},Fr=({src:e,alt:t,height:n,fallbackBg:r,onClick:o})=>{const{ref:a,bgColor:i,transform:s}=function(e){const t=v.useRef(null),[n,r]=v.useState({bgColor:null,transform:null});return v.useEffect(()=>{r({bgColor:null,transform:null});const n=t.current;if(n&&e)return Rr(n,r)},[e]),{ref:t,...n}}(e);return w.jsx(D,{css:{flex:"0 0 100%",scrollSnapAlign:"center"},bg:i||r,borderRadius:"md",overflow:"hidden",cursor:o?"pointer":"default",onClick:o,children:w.jsx(N,{ref:a,src:e,alt:t,w:"full",h:n,objectFit:"contain",borderRadius:"md",crossOrigin:"anonymous",transform:s??void 0,transition:"transform 0.25s ease"})})},Dr=({slides:e,activeColor:t,onColorChange:n,height:r,bgColor:o,alt:a,onImageClick:i})=>{const s=P(),l=v.useRef(null),c=v.useRef(!1),d=v.useRef(!1),u=v.useRef(null),[p,h]=v.useState(0),f=v.useRef(t);f.current=t;const g=v.useRef(e);g.current=e;const m=v.useRef(n);m.current=n;const b=v.useRef(p);b.current=p;const x=e=>{null!=e?.color&&e.color!==f.current&&m.current?.(e.color)},y=(e,t)=>{const n=l.current,r=g.current[e];n&&r&&(c.current=!0,n.scrollTo({left:e*n.clientWidth,behavior:"smooth"}),u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{c.current=!1},450),h(e),t&&x(r))},C=v.useRef(y);C.current=y;const k=v.useRef(t??null);v.useEffect(()=>{if(t===k.current)return;if(k.current=t??null,null==t||d.current)return;const n=e.findIndex(e=>e.color===t);n<0||n===b.current||C.current(n,!1)},[t,e]);const j=e.map(e=>e.id+"\0"+e.src).join("|"),S=v.useRef(null);v.useEffect(()=>{if(S.current===j)return;S.current=j;const e=l.current,t=g.current.findIndex(e=>null!=e.color&&e.color===f.current),n=Math.max(0,t);e&&e.clientWidth>0&&e.scrollTo({left:n*e.clientWidth}),h(n)},[j]),v.useEffect(()=>{const e=l.current;if(!e)return;let t;const n=()=>{if(c.current||0===e.clientWidth)return;const t=Math.round(e.scrollLeft/e.clientWidth),n=g.current[t];n&&(h(t),x(n))},r=()=>{c.current||(d.current=!0,t&&window.clearTimeout(t),t=window.setTimeout(()=>{d.current=!1,n()},160))},o=()=>{t&&window.clearTimeout(t),d.current=!1,n()},a=t=>{if(Math.abs(t.deltaY)<=Math.abs(t.deltaX))return;t.preventDefault();let n=e.parentElement;for(;n;){const e=getComputedStyle(n).overflowY;if(n.scrollHeight>n.clientHeight&&("auto"===e||"scroll"===e))return void n.scrollBy({top:t.deltaY});n=n.parentElement}window.scrollBy({top:t.deltaY})};return e.addEventListener("scroll",r,{passive:!0}),e.addEventListener("scrollend",o),e.addEventListener("wheel",a,{passive:!1}),()=>{e.removeEventListener("scroll",r),e.removeEventListener("scrollend",o),e.removeEventListener("wheel",a),t&&window.clearTimeout(t)}},[]),v.useEffect(()=>()=>{u.current&&window.clearTimeout(u.current)},[]);const z=e=>w.jsx(Ut,{"aria-label":e<0?"Previous image":"Next image",position:"absolute",top:"50%",...e<0?{left:"6px"}:{right:"6px"},transform:"translateY(-50%)",size:"xs",minW:s.length(28),w:s.length(28),h:s.length(28),borderRadius:"full",bg:"rgba(255,255,255,0.92)",color:"text",border:"1px solid",borderColor:"borderColor",boxShadow:"0 1px 4px rgba(0,0,0,0.12)",_hover:{bg:"white"},onClick:t=>{t.stopPropagation(),y(p+e,!0)},children:e<0?w.jsx(pn,{boxSize:s.length(12)}):w.jsx(bn,{boxSize:s.length(12)})});return w.jsxs(D,{position:"relative",w:"full",children:[w.jsx(Y,{ref:l,gap:0,w:"full",css:{overflowX:"auto",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},WebkitOverflowScrolling:"touch"},children:e.map((e,t)=>w.jsx(Fr,{src:e.src,alt:a,height:r,fallbackBg:o,onClick:i?()=>i(t):void 0},e.id))}),e.length>1&&p>0&&z(-1),e.length>1&&p<e.length-1&&z(1),e.length>1&&w.jsx(Y,{position:"absolute",bottom:s.length(6),left:"0",right:"0",justify:"center",gap:1,pointerEvents:"none",children:e.map((e,t)=>w.jsx(D,{w:s.length(5),h:s.length(5),borderRadius:"full",bg:t===p?"primary":"rgba(0,0,0,0.25)",transition:"background 0.2s"},`dot-${e.id}`))})]})},Hr=/colo|couleur|farbe|màu|colore|kleur/i,Pr=({product:e,isDesktop:t=!1,variant:n="default",badgeLabel:r,hideCta:o=!1})=>{const a="hero"===n,i="compact"===n,s=i?80:130,{sendMessage:l,setRepliedProduct:c,botData:d,chatState:u,addToCartDirect:p,isCartBusy:h,productFocusEnabled:f,shortlistEnabled:g,enterFocusMode:m,openVariantModal:b,isShortlisted:x,toggleShortlist:y,rememberCardColour:C,isTestMode:k}=H(),j=P(),S=a?j.length(160):i?j.length(80):j.length(124),{t:z}=q(),A=(e?.currency||d?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",{name:E,price:R,originalPrice:T,discount:_,image:W,id:L,url:M}=e,B=O(d),F="full",U=xe(e,d),Q=null!==U,K=Boolean(e.is_on_sale&&null!=e.sale_price&&e.sale_price>0&&null!=R&&e.sale_price<R),X=K&&e.sale_price?e.sale_price:R,J=K?R:T,$=K&&null!=e.sale_percent_off&&e.sale_percent_off>0?e.sale_percent_off:_,ee=K&&null!=e.sale_amount_off&&e.sale_amount_off>0?e.sale_amount_off:void 0,te=!!J&&!!X&&J>X,ne=K?e.sale_label:void 0,re=e.minimum_quantity&&e.minimum_quantity>1?Math.floor(e.minimum_quantity):void 0,[oe,ae]=v.useState(!1),[ie,se]=v.useState(!1),[le,ce]=v.useState(!1),[de,ue]=v.useState(!1),he=v.useRef(null);v.useEffect(()=>()=>{he.current&&clearTimeout(he.current)},[]);const[fe,ge]=v.useState(!1),be=(e.variant_summary?.options??[]).some(e=>(e.values?.length??0)>1),ye=Bt("colors","background"),ke=Array.isArray(ye)?ye[0]:ye,[je,Se]=v.useState(ke),ze=!0===d?.feature_flags?.disable_image_backdrop?ke:je,[Ae,Ee]=v.useState(null),Re=v.useRef(null),[Te,_e]=v.useState(e.selected_color??null);v.useEffect(()=>{null!=L&&C(String(L),Te)},[L,Te,C]);const We=v.useMemo(()=>{const t=e.variant_summary?.options?.find(e=>Hr.test(e.name||""));return!i&&t&&W&&t.values.some(e=>e.image)?t.values.map(e=>({id:`color:${e.value}`,src:e.image||W,color:e.value})):[]},[e.variant_summary,W,i]),Ie=We.length>1,Le=e.description?.length&&e.description?.length>s;v.useEffect(()=>{const e=Re.current;if(e)return Rr(e,e=>{Se(e.bgColor??ke),Ee(e.transform)})},[W,ke]);const Me=async()=>{if(U)return void Er(U.href,k);if(le)return;ce(!0);const t=pe(M);try{const n=await p({product_id:null!=L?String(L):void 0,product_name:E,product_url:M||void 0,product_handle:t||void 0,quantity:Ce(e),quantity_label:we(e)});if("success"===n.type&&(ue(!0),he.current&&clearTimeout(he.current),he.current=setTimeout(()=>ue(!1),1600)),"failed"===n.type&&"busy"===n.reason)return;if("success"!==n.type){const n=z("addToCartMessage").replace("{product}",E),r=`DORI_INTERNAL_EVENT:add_to_cart_request:${JSON.stringify({product_name:E,product_url:M||null,product_handle:t||null,quantity:e.price_unit?1:re??1})}`;await l({message:n,apiMessage:r})}}finally{ce(!1)}},Be=le||h,Fe=be&&fe,De=x(L),[He,Pe]=v.useState(!1),qe=v.useRef(null);v.useEffect(()=>()=>{qe.current&&clearTimeout(qe.current)},[]);const Oe=f?()=>m(e,`card_body:${n}`):async()=>{if(!M||!d)return;const t=_n(M);ve(e,d,u.threadId),Er(t,k)},Ne=e=>{e.stopPropagation(),U&&Er(U.href,k)},Ye=t=>{t.stopPropagation(),Q?Ne(t):be?b(Te?{...e,selected_color:Te}:e,"card"):Me()};return w.jsxs(G,{gap:j.space(1),children:[w.jsx(D,{bg:"background",borderRadius:i?j.radius(12):j.radius(16),border:"1px solid",borderColor:a?"primary":"borderColor",borderWidth:a?"1.5px":"1px",p:j.space(i?1.5:2),w:"full",transition:"all 0.2s ease",_hover:{borderColor:"primary",transform:"translateY(-1px)"},children:w.jsxs(G,{gap:j.space(i?1.5:2),align:"stretch",children:[w.jsxs(D,{position:"relative",borderRadius:"md",children:[g&&!i&&w.jsx(Ut,{"aria-label":z(De?"removeSaved":"saveForLater"),position:"absolute",top:j.length(6),right:j.length(6),zIndex:2,variant:"ghost",size:"xs",minW:j.length(26),w:j.length(26),h:j.length(26),p:j.space(0),borderRadius:"full",bg:"background",_hover:{bg:"background"},boxShadow:"0 1px 4px rgba(0,0,0,0.18)",color:De?"primary":"mutedText",transform:He?"scale(1.2)":"scale(1)",transition:"transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.15s",css:{"@media (hover: hover)":{"&:hover":{color:"var(--chakra-colors-primary)"}}},onClick:t=>{t.stopPropagation(),y(e),Pe(!0),qe.current&&clearTimeout(qe.current),qe.current=setTimeout(()=>Pe(!1),220)},children:De?w.jsx(mn,{boxSize:j.length(14)}):w.jsx(gn,{boxSize:j.length(14)})}),a&&r&&w.jsx(D,{position:"absolute",top:j.length(6),left:j.length(6),zIndex:1,bg:"primary",color:"buttonText",fontSize:j.font(10),fontWeight:"600",px:j.space(2),py:j.space(.5),borderRadius:j.radius(6),fontFamily:V,boxShadow:"0 1px 3px rgba(0,0,0,0.15)",children:r}),Ie?w.jsx(Dr,{slides:We,activeColor:Te,onColorChange:_e,height:S,bgColor:ze,alt:E,onImageClick:Oe}):w.jsx(D,{cursor:"pointer",onClick:Oe,_hover:{opacity:.9},transition:"all 0.3s ease",bg:ze,borderRadius:"md",overflow:"hidden",children:ie?w.jsx(D,{w:"full",h:S,display:"flex",alignItems:"center",justifyContent:"center",bg:"lightBackground",borderRadius:"md",children:w.jsx(fn,{boxSize:j.length(24),color:"mutedText"})}):w.jsx(N,{ref:Re,src:W,alt:E,w:"full",h:S,objectFit:"contain",borderRadius:"md",crossOrigin:"anonymous",transform:Ae??void 0,transition:"transform 0.25s ease",onError:()=>se(!0)})})]}),w.jsx(Y,{gap:j.space(1),align:"center",w:"full",children:w.jsx(Z,{fontWeight:600,fontSize:i?j.font(11):j.font(12),lineHeight:i?j.lineHeight(18):j.lineHeight(24),color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1,minW:0,title:E,fontFamily:V,cursor:"pointer",onClick:Oe,...f&&{role:"button",tabIndex:0,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),Oe())},"aria-label":z("selectedProduct").replace("{name}",E)},_hover:{color:"primary"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"2px",borderRadius:"4px"},transition:"color 0.2s",children:E})}),!i&&e.description&&w.jsx(D,{borderRadius:j.radius(8),borderLeft:"2px solid",borderLeftColor:"primary",padding:"6px 10px",w:"full",bg:"lightBackground",cursor:"pointer",onClick:Oe,_hover:{bg:"veryLightBackground"},transition:"background-color 0.2s",children:w.jsxs(Z,{fontSize:j.font(12),fontWeight:400,color:"text",lineHeight:j.lineHeight(20),overflow:"hidden",title:e.description,fontFamily:V,children:[Le&&!oe?e.description?.substring(0,s)+"... ":e.description,Le&&!oe&&w.jsx(Z,{as:"span",fontSize:j.font(12),lineHeight:j.lineHeight(4),color:"primary",borderRadius:j.radius(4),flex:1,cursor:"pointer",fontWeight:400,fontFamily:V,onClick:e=>{e.stopPropagation(),ae(!0)},children:z("more")})]})}),w.jsxs(Y,{justify:"space-between",align:"end",cursor:"pointer",onClick:Oe,children:[w.jsxs(G,{gap:j.space(1),align:"start",children:[(te||$||ee)&&w.jsxs(Y,{gap:j.space(1),children:[te&&w.jsx(Z,{fontSize:j.font(12),color:"mutedText",textDecoration:"line-through",fontFamily:V,children:null!=J?me(J,A):null}),($||ee)&&w.jsx(Zt,{bg:"errorBackground",color:"error",fontSize:j.font(12),borderRadius:j.radius(24),title:ne||void 0,children:$?`${$}%`:`-${me(ee??0,A)}`})]}),!!X&&X>0&&w.jsxs(Z,{fontSize:j.font(12),fontWeight:"700",color:"text",fontFamily:V,children:[me(X,A),e.price_unit?w.jsxs(Z,{as:"span",fontSize:j.font(10),fontWeight:500,color:"mutedText",children:[" / ",e.price_unit]}):re?w.jsxs(Z,{as:"span",fontSize:j.font(10),fontWeight:500,color:"mutedText",children:[" ",z("perUnit")]}):null]}),e.price_on_request&&w.jsx(Z,{fontSize:j.font(12),fontWeight:"700",color:"text",fontFamily:V,children:z("priceOnRequest")}),re&&!e.price_unit&&w.jsx(Z,{fontSize:j.font(11),fontWeight:600,color:"mutedText",fontFamily:V,children:z("soldInSetsOf").replace("{count}",String(re))})]}),f&&!i&&w.jsxs(Z,{role:"button",tabIndex:0,fontSize:j.font(11.5),fontWeight:500,color:"mutedText",whiteSpace:"nowrap",flexShrink:0,cursor:"pointer",onClick:t=>{t.stopPropagation(),m(e,"details_button")},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),m(e,"details_button"))},_hover:{color:"primary"},_focusVisible:{outline:"2px solid",outlineColor:"primary",borderRadius:"4px"},fontFamily:V,children:[z("detailsAction")," ›"]})]})]})}),o?null:f?B&&w.jsx(G,{gap:j.space(1),w:F,align:"stretch",children:i?w.jsx(Ut,{variant:"outline",size:"xs",h:j.length(26),color:"primary",borderColor:"borderColor",borderRadius:j.radius(6),borderWidth:"1px",_hover:{bg:"veryLightBackground"},onClick:Ye,disabled:!Q&&!be&&Be,"aria-label":z(Q?U.labelKey:"addToCartButton"),children:w.jsx(fn,{boxSize:j.length(14)})}):w.jsxs(I,{variant:"solid",size:"xs",h:j.length(36),fontSize:j.font(13),bg:"primary",color:"buttonText",borderRadius:j.radius(10),w:"full",fontWeight:600,onClick:Ye,disabled:!Q&&!be&&(Be||de),loading:!Q&&!be&&Be,_hover:{opacity:.9},fontFamily:V,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[Q?null:w.jsx(fn,{boxSize:j.length(15)}),Q?z(U.labelKey):be?z("addToCartFull"):de?`✓ ${z("addedToCart")}`:z(Be?"addToCartAdding":"addToCartFull")]})}):w.jsxs(G,{gap:j.space(1),w:F,align:"stretch",children:[w.jsxs(Y,{gap:j.space(.5),children:[w.jsx(Ut,{variant:"outline",size:"xs",h:i?j.length(26):j.length(30),fontSize:j.font(12),color:"primary",borderColor:"borderColor",borderRadius:j.radius(4),_hover:{bg:"veryLightBackground"},borderWidth:"1px",onClick:()=>{c({product:e,suggestions:[z("doesProductHaveDiscount"),z("whatFeaturesSpecial"),z("otherColorsAvailable")]})},"aria-label":"Reply to product",children:w.jsx(an,{boxSize:i?j.length(14):j.length(16)})}),!i&&w.jsxs(I,{variant:"outline",size:"xs",h:j.length(30),fontSize:j.font(12),color:"primary",borderRadius:j.radius(4),flex:1,fontWeight:400,onClick:()=>{const e=`${z("doYouHaveSimilar")} ${E}`;l({message:e,apiMessage:`${e} (product id: ${L})`})},_hover:{bg:"veryLightBackground"},borderColor:"borderColor",fontFamily:V,whiteSpace:"nowrap",minW:0,overflow:"hidden",textOverflow:"ellipsis",children:[w.jsx(sn,{boxSize:j.length(16)}),z("similar")]}),!i&&B&&w.jsxs(I,{variant:"outline",size:"xs",h:j.length(30),fontSize:j.font(12),color:"primary",borderRadius:t?"4px":"6px",flex:1,minW:0,fontWeight:400,onClick:Q?Ne:be?()=>ge(e=>!e):Me,disabled:!Q&&!be&&Be,loading:!Q&&!be&&Be,_hover:{bg:"veryLightBackground"},borderColor:"borderColor",fontFamily:V,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[Q?null:Fe?w.jsx(tn,{boxSize:j.length(11)}):w.jsx(fn,{boxSize:j.length(16)}),z(Q?U.labelKey:Fe?"close":Be?"addToCartAdding":"addToCartButton")]})]}),fe&&be&&!Q&&w.jsx(Br,{product:e,selectedColor:Te,onColorChange:_e})]})]})},qr=({index:e,delay:t=70,children:n})=>{const[r,o]=v.useState(!1);return v.useEffect(()=>{const n=setTimeout(()=>o(!0),e*t);return()=>clearTimeout(n)},[e,t]),w.jsx(D,{opacity:r?1:0,transform:r?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:n})},Or=({products:e,isDesktop:t})=>w.jsx(Jt,{dir:"ltr",columns:t?2:1,gapX:t?2:1,gapY:t?4:2,w:"full",children:e.map((e,n)=>w.jsx(qr,{index:n,children:w.jsx(Pr,{product:e,isDesktop:t})},e.id))});function Nr(e){return e.is_on_sale&&null!=e.sale_price&&e.sale_price>0&&null!=e.price&&e.sale_price<e.price&&e.sale_price?e.sale_price:e.price}const Yr=({product:e,index:t,isLast:n,isDesktop:r,delay:o,status:a,cardVariant:i,hideCardCta:s,onRemove:l})=>{const c=P(),[d,u]=v.useState(!1),{t:p}=q();v.useEffect(()=>{const e=setTimeout(()=>u(!0),o);return()=>clearTimeout(e)},[o]);const h=e.step_label?e.step_label.replace(/^\S+\s*\d+\s*[:.\-]\s*/i,"").trim()||e.step_label:null;return w.jsx(D,{opacity:d?1:0,transform:d?"translateY(0)":"translateY(10px)",transition:"opacity 0.35s ease-out, transform 0.35s ease-out",children:w.jsxs(Y,{align:"stretch",gap:c.space(0),children:[w.jsxs(G,{align:"center",gap:c.space(0),w:c.length(28),flexShrink:0,children:[w.jsx(D,{w:c.length(28),h:c.length(28),borderRadius:"full",bg:"primary",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,children:"adding"===a?w.jsx(J,{size:"xs",color:"buttonText"}):w.jsx(Z,{fontSize:c.font(12),fontWeight:"700",color:"buttonText",lineHeight:"1",children:"added"===a?"✓":t+1})}),!n&&w.jsx(D,{flex:1,w:"2px",bg:"borderColor",minH:c.length(8),opacity:d?1:0,transition:"opacity 0.3s ease-out 0.2s"})]}),w.jsxs(G,{align:"stretch",gap:c.space(1.5),flex:1,minW:0,pl:c.space(2.5),pb:n?0:3,children:[w.jsxs(Y,{justify:"space-between",align:"center",minH:c.length(28),children:[h?w.jsx(Z,{fontSize:c.font(13),fontWeight:"600",color:"text",fontFamily:V,pt:c.space(.5),children:h}):w.jsx(D,{}),w.jsxs(Y,{gap:c.space(0),align:"center",children:["failed"===a&&w.jsx(Z,{fontSize:c.font(11),color:"red.500",fontFamily:V,pr:c.space(1.5),children:p("stepAddFailed")}),"added"!==a&&w.jsx(D,{as:"button","aria-label":p("removeProduct"),onClick:l,color:"mutedText",cursor:"pointer",w:c.length(28),h:c.length(28),display:"flex",alignItems:"center",justifyContent:"center",borderRadius:c.radius(6),_hover:{color:"text",bg:"veryLightBackground"},children:w.jsx(tn,{boxSize:c.length(10)})})]})]}),w.jsx(Pr,{product:e,isDesktop:r,variant:i,hideCta:s})]})]})})};function Vr(e,t){const n=e.external_product_id?String(e.external_product_id):null;return t.some(t=>n&&null!=t.product_id&&String(t.product_id)===n||!!e.name&&!!t.product_title&&t.product_title===e.name)}const Zr={single_pick:({products:e,isDesktop:t})=>{const n=P(),r=e[0],o=e.slice(1,3),{t:a}=q(),[i,s]=v.useState(!1),[l,c]=v.useState(!1);return v.useEffect(()=>{const e=requestAnimationFrame(()=>s(!0)),t=o.length>0?setTimeout(()=>c(!0),300):void 0;return()=>{cancelAnimationFrame(e),t&&clearTimeout(t)}},[o.length]),r?w.jsxs(G,{gap:n.space(3),w:"full",align:"stretch",children:[w.jsx(D,{opacity:i?1:0,transform:i?"translateY(0)":"translateY(8px)",transition:"opacity 0.35s ease-out, transform 0.35s ease-out",children:w.jsx(Pr,{product:r,isDesktop:t,variant:"hero",badgeLabel:a("topPick")})}),o.length>0&&w.jsxs(D,{opacity:l?1:0,transform:l?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:[w.jsx(Z,{fontSize:n.font(11),fontWeight:500,color:"mutedText",fontFamily:V,mb:n.space(2),px:n.space(1),children:a("alsoConsider")}),w.jsx(Jt,{dir:"ltr",columns:1===o.length?1:2,gapX:n.space(2),gapY:n.space(2),w:"full",children:o.map(e=>w.jsx(D,{children:w.jsx(Pr,{product:e,isDesktop:t,variant:1===o.length?"default":"compact"})},e.id))})]})]}):null},shortlist:({products:e,isDesktop:t})=>{const{t:n}=q();return w.jsx(G,{gap:3,w:"full",align:"stretch",children:e.map((e,r)=>w.jsx(qr,{index:r,delay:120,children:w.jsx(Pr,{product:e,isDesktop:t,variant:0===r?"hero":"default",badgeLabel:0===r?n("topPick"):void 0})},e.id))})},routine:({products:e,isDesktop:t})=>{const n=P(),{botData:r,addToCartDirect:o,isCartBusy:a,cartItemCount:i}=H(),{t:s}=q(),[l,c]=v.useState({}),[d,u]=v.useState({}),[p,h]=v.useState({}),[f,g]=v.useState(!1);v.useEffect(()=>{if(!O(r))return;let t=!1;return(async()=>{const n=await ke();if(t||!n)return;const r={};for(const t of e)Vr(t,n.items||[])&&(r[t.id]=!0);h(r)})(),()=>{t=!0}},[r,e,i]);const m=e=>p[e.id]?"added":d[e.id]??"idle",b=e.filter(e=>!l[e.id]&&null===xe(e,r)),x=b.filter(e=>"added"!==m(e)),y=b.length>0&&0===x.length,C=x.every(e=>Number.isFinite(Nr(e))&&Nr(e)>0),k=b[0]?.currency||r?.currency,j=b.reduce((e,t)=>e+Nr(t),0),S=x.reduce((e,t)=>e+Nr(t),0),z=b.every(e=>Number.isFinite(Nr(e))&&Nr(e)>0),A=O(r)&&b.length>=2&&b.every(e=>!function(e){return(e.variant_summary?.options??[]).some(e=>(e.values?.length??0)>1)}(e)),E=f?s("addingRoutine"):y?`✓ ${s("addedToCart")}`:C?`${s("addRoutine")} · ${me(S,k)}`:s("addRoutine");return w.jsxs(G,{gap:n.space(0),w:"full",align:"stretch",children:[w.jsxs(Y,{justify:"space-between",align:"baseline",mb:n.space(1.5),pl:n.length(38),children:[w.jsx(Z,{fontSize:n.font(13),fontWeight:"700",color:"text",fontFamily:V,children:s("routineTitle")}),z&&b.length>=2&&w.jsx(Z,{fontSize:n.font(13),fontWeight:"700",color:"text",fontFamily:V,children:me(j,k)})]}),e.map((e,r)=>{if(l[e.id])return w.jsxs(Y,{pl:n.length(38),pb:n.space(2),gap:n.space(2),align:"center",children:[w.jsx(Z,{fontSize:n.font(12),color:"mutedText",fontFamily:V,textDecoration:"line-through",lineClamp:1,minW:0,children:e.name}),w.jsx(Z,{fontSize:n.font(12),color:"mutedText",fontFamily:V,children:s("stepRemoved")}),w.jsx(D,{as:"button",onClick:()=>c(t=>{const n={...t};return delete n[e.id],n}),color:"primary",fontSize:n.font(12),fontWeight:"600",cursor:"pointer",fontFamily:V,px:n.space(2),h:n.length(24),children:s("undo")})]},e.id);const o=b.findIndex(t=>t.id===e.id);return w.jsx(Yr,{product:e,index:o,isLast:o===b.length-1,isDesktop:t,delay:200*r,status:m(e),cardVariant:A?"compact":"default",hideCardCta:A,onRemove:()=>c(t=>({...t,[e.id]:!0}))},e.id)}),A&&w.jsx(I,{mt:n.space(2.5),ml:n.length(38),size:"sm",h:n.length(36),fontSize:n.font(13),fontWeight:"600",bg:y?"veryLightBackground":"primary",color:y?"text":"white",borderRadius:n.radius(8),fontFamily:V,onClick:async()=>{if(!f&&!a&&0!==x.length){g(!0);try{const e=[...x];for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;if(u(e=>({...e,[n.id]:"adding"})),"success"!==(await o({product_id:null!=n.id?String(n.id):void 0,product_name:n.name,product_url:n.url||void 0,product_handle:pe(n.url)||void 0,quantity:Ce(n),quantity_label:we(n)},{deferCartEffects:!r})).type)return void u(e=>({...e,[n.id]:"failed"}));u(e=>({...e,[n.id]:"added"}))}}finally{g(!1)}}},disabled:f||a||y,loading:f,_hover:y?{}:{opacity:.9},children:E})]})},explore:Or},Ur=({products:e,shape:t="explore"})=>{const{chatState:n,botData:r,isTestMode:i}=H(),s=v.useRef(new Set),l=v.useRef(null),[c,d]=v.useState(!1),u=v.useCallback(()=>{l.current&&d(l.current.offsetWidth>=600)},[]);v.useEffect(()=>{u();const e=new ResizeObserver(u);return l.current&&e.observe(l.current),()=>e.disconnect()},[u]),v.useEffect(()=>{if(i)return;const t=ze.SHOPIFY;if(!n.threadId)return;const l=r?.sharing_id||o();if(!l)return;const c=a(),d=[];if(e.forEach(e=>{const t=e.external_product_id;t&&(s.current.has(t)||(s.current.add(t),d.push(t)))}),d.length>0){const e=window.DORI_CUSTOMER_ID,r=null!=e?String(e):void 0,o=je();Se(d,n.threadId||"",c,t,l,void 0,r,o)}},[e,t,n.threadId,r?.sharing_id,r?.assistant_id,i]);const p=v.useRef(null),h=v.useRef(!1);v.useEffect(()=>{if(i)return;const o=p.current;if(!o||h.current)return;const a=e.map(e=>e.external_product_id).filter(e=>Boolean(e)).slice(0,12);if(0===a.length)return;const s=new IntersectionObserver(o=>{for(const i of o)i.isIntersecting&&!h.current&&(h.current=!0,Ae("recommendation_seen",{assistantId:r?.assistant_id,threadId:n.threadId,payload:{set_id:a.join(","),shape:t,count:e.length,product_ids:a}}),s.disconnect())},{threshold:0});return s.observe(o),()=>s.disconnect()},[e,t,i,r?.assistant_id,n.threadId]);const f=Zr[t]||Or;return w.jsxs(G,{ref:l,align:"stretch",gap:2,w:"full",children:[w.jsx(D,{ref:p,h:"1px",w:"full","aria-hidden":!0}),w.jsx(D,{px:1,w:"full",children:w.jsx(f,{products:e,isDesktop:c})})]})},Qr=({index:e,children:t})=>{const[n,r]=v.useState(!1);return v.useEffect(()=>{const t=setTimeout(()=>r(!0),70*e);return()=>clearTimeout(t)},[e]),w.jsx(D,{opacity:n?1:0,transform:n?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:t})},Kr=({suggestions:e,options:t=!1})=>{const n=P(),{sendMessage:r,focusModeProduct:o}=H(),{visible:a,asOptions:i}=Ee(e,{options:t,focusMode:!!o});return w.jsx(Xt,{direction:"row",wrap:"wrap",gap:n.space(2),maxW:"full",alignSelf:"flex-start",children:a.map((e,t)=>w.jsx(Qr,{index:t,children:w.jsxs(I,{bg:"background",border:"1px solid",borderColor:"borderColor",borderRadius:n.radius(18),px:n.space(3.5),h:"auto",lineHeight:"1.4",py:n.space(2),onClick:()=>(e=>{r({message:e})})(e),_hover:{bg:"lightBackground",borderColor:"primary"},_active:{bg:"veryLightBackground"},textAlign:"start",justifyContent:"flex-start",gap:n.space(1.5),w:"auto",maxW:"100%",children:[!i&&w.jsx(ln,{boxSize:n.length(13),color:"primary",flexShrink:0}),w.jsx(Z,{fontSize:{base:n.font(14),md:n.font(13)},fontWeight:"500",color:"text",textAlign:"start",wordBreak:"break-word",whiteSpace:"normal",lineClamp:2,children:e})]})},t))})},Gr=()=>{const e=P(),{botData:t}=H(),{t:n}=q(),r=!0===t?.hide_checkout_button;return w.jsxs(Y,{mt:e.space(3),gap:e.space(2),justify:"flex-start",children:[w.jsxs(I,{size:"xs",variant:"outline",borderColor:"borderColor",color:"mutedText",fontSize:e.font(12),fontWeight:"500",borderRadius:e.radius(24),h:"auto",px:e.space(3),py:e.space(1.5),onClick:()=>{if(!U()){const e=`${Q()}cart`;window.open(e,"_blank","noopener,noreferrer")||(window.location.href=e)}},_hover:{borderColor:"primary"},children:[w.jsx(fn,{boxSize:e.length(14)}),n("cartViewCart")]}),!r&&w.jsxs(I,{size:"xs",variant:"solid",bg:"primary",color:"buttonText",fontSize:e.font(12),fontWeight:"500",borderRadius:e.radius(24),h:"auto",px:e.space(3),py:e.space(1.5),onClick:()=>{Re()},_hover:{opacity:.85},children:[n("cartCheckout"),w.jsx(bn,{boxSize:e.length(14)})]})]})},Xr=({add:e})=>{const t=P(),{botData:n,chatState:r}=H(),{t:o}=q(),a=e?.cart??null,i=(a?.currency||n?.currency||"USD").split(" - ")[0]?.trim().toUpperCase(),s=e=>me(e/100,i),l=a?.added??null,c=l?.name||e?.product_name||null,d=l?.variant_title??null,u=l?.quantity??e?.quantity??null,p=null!=l?.unit_price&&null!=u?l.unit_price*u:null,h=null!=p?s(p):null,f=a?.others??[],g=e=>[e.variant_title,e.quantity>1?`x${e.quantity}`:null,null!=e.line_price?s(e.line_price):null].filter(Boolean).join(" · ");return w.jsx(D,{mt:t.space(3),border:"1.5px solid",borderColor:"borderColor",borderRadius:t.radius(14),p:t.space(3.5),bg:"background",w:"full",maxW:t.length(360),boxShadow:"0 1px 6px rgba(0, 0, 0, 0.05)",children:w.jsxs(G,{align:"stretch",gap:t.space(2.5),children:[w.jsxs(Y,{gap:t.space(1.5),children:[w.jsx(nn,{boxSize:t.length(16),color:"primary"}),w.jsx(Z,{fontSize:t.font(13),fontWeight:700,color:"primary",fontFamily:V,children:o("addedToCart")})]}),c&&w.jsxs(Y,{gap:t.space(2.5),align:"center",children:[l?.image?w.jsx(N,{src:l.image,alt:c,w:t.length(48),h:t.length(48),objectFit:"cover",borderRadius:t.radius(8),flexShrink:0,bg:"lightBackground"}):w.jsx(D,{w:t.length(48),h:t.length(48),borderRadius:t.radius(8),flexShrink:0,bg:"lightBackground",display:"flex",alignItems:"center",justifyContent:"center",children:w.jsx(fn,{boxSize:t.length(18),color:"mutedText"})}),w.jsxs(D,{minW:0,flex:1,children:[w.jsx(Z,{fontSize:t.font(13),fontWeight:600,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:V,children:c}),w.jsx(Z,{fontSize:t.font(12),color:"mutedText",fontFamily:V,children:[d,u&&u>1?`x${u}`:null,h].filter(Boolean).join(" · ")})]})]}),f.map((e,n)=>w.jsxs(Y,{gap:t.space(2.5),align:"center",opacity:.75,children:[e.image?w.jsx(N,{src:e.image,alt:e.title||"",w:t.length(32),h:t.length(32),objectFit:"cover",borderRadius:t.radius(6),flexShrink:0,bg:"lightBackground"}):w.jsx(D,{w:t.length(32),h:t.length(32),borderRadius:t.radius(6),flexShrink:0,bg:"lightBackground",display:"flex",alignItems:"center",justifyContent:"center",children:w.jsx(fn,{boxSize:t.length(14),color:"mutedText"})}),w.jsxs(D,{minW:0,flex:1,children:[w.jsx(Z,{fontSize:t.font(12),fontWeight:500,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:V,children:e.title}),w.jsx(Z,{fontSize:t.font(11),color:"mutedText",fontFamily:V,children:g(e)})]})]},n)),!!a?.hidden_line_count&&a.hidden_line_count>0&&w.jsx(Z,{fontSize:t.font(11),color:"mutedText",fontFamily:V,children:o("cartMoreItems").replace("{count}",String(a.hidden_line_count))}),a&&a.item_count>0&&w.jsx(Z,{fontSize:t.font(12),fontWeight:600,color:"text",borderTop:"1px solid",borderColor:"borderColor",pt:t.space(2),fontFamily:V,children:o(1===a.item_count?"cartLineOne":"cartLine").replace("{count}",String(a.item_count)).replace("{total}",s(a.total_price))}),w.jsxs(Y,{gap:t.space(2),children:[w.jsxs(I,{size:"sm",flex:1,variant:"outline",borderColor:"borderColor",color:"text",fontSize:t.font(13),fontWeight:"600",borderRadius:t.radius(10),h:t.length(38),onClick:()=>{if(Ae("closer_action_clicked",{assistantId:n?.assistant_id,threadId:r.threadId,payload:{action:"view_cart"}}),!U()){const e=`${Q()}cart`;window.location.href=e}},_hover:{borderColor:"primary"},children:[w.jsx(fn,{boxSize:t.length(13)}),o("cartViewCart")]}),!0!==n?.hide_checkout_button&&w.jsxs(I,{size:"sm",flex:1,variant:"solid",bg:"primary",color:"buttonText",fontSize:t.font(13),fontWeight:"600",borderRadius:t.radius(10),h:t.length(38),onClick:()=>{Ae("closer_action_clicked",{assistantId:n?.assistant_id,threadId:r.threadId,payload:{action:"checkout"}}),Re()},_hover:{opacity:.85},children:[o("cartCheckout"),w.jsx(bn,{boxSize:t.length(13)})]})]})]})})},Jr=({onSubmit:e,onClose:t,existingText:n})=>{const r=P(),[o,a]=v.useState(n||""),[i,s]=v.useState(!1);return v.useEffect(()=>{a(n||"")},[n]),w.jsx(D,{mt:r.space(2),bg:"background",borderRadius:r.radius(10),p:r.space(3),borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",maxW:r.length(280),children:w.jsxs(G,{gap:r.space(3),align:"stretch",children:[w.jsxs(G,{gap:r.space(.5),align:"start",children:[w.jsx(Z,{fontSize:r.font(13),fontWeight:"600",color:"text",lineHeight:"1.4",children:"Tell us what was wrong"}),w.jsx(Z,{fontSize:r.font(11),color:"mutedText",lineHeight:"1.4",children:"Your comment is optional and helps us improve responses."})]}),w.jsx(en,{value:o,onChange:e=>a(e.target.value),placeholder:"Describe what you expected...","aria-label":"Describe what you expected",rows:3,fontSize:r.font(12),resize:"none",borderColor:"borderColor",borderRadius:r.radius(8),p:r.space(2),bg:"lightBackground",color:"text",autoFocus:!0,_placeholder:{color:"mutedText"},_focus:{outline:"none",borderColor:"primary",boxShadow:"none"}}),w.jsxs(Y,{gap:r.space(2),justify:"flex-end",children:[w.jsx(I,{size:"sm",variant:"ghost",onClick:t,disabled:i,fontSize:r.font(12),color:"mutedText",px:r.space(3),h:r.length(30),_hover:{bg:"lightBackground"},children:"Cancel"}),w.jsx(I,{size:"sm",variant:"outline",onClick:async()=>{s(!0),await e(void 0),s(!1)},disabled:i,fontSize:r.font(12),color:"text",borderColor:"borderColor",px:r.space(3),h:r.length(30),children:"No Comment"}),w.jsx(I,{size:"sm",onClick:async()=>{s(!0),await e(o.trim()||void 0),s(!1)},disabled:i,fontSize:r.font(12),bg:"primary",color:"buttonText",px:r.space(3),h:r.length(30),borderRadius:r.radius(8),_hover:{opacity:.85},children:i?"Submitting...":"Submit"})]})]})})},$r=({messageIndex:e,feedback:t})=>{const n=P(),{submitFeedback:r}=H(),[o,a]=v.useState(!1),i="like"===t?.rating,s="dislike"===t?.rating;return w.jsxs(D,{mt:n.space(1.5),children:[w.jsxs(Y,{gap:n.space(1.5),align:"center",children:[w.jsx(D,{as:"button",onClick:async()=>{i||(await r(e,"like"),a(!1))},display:"flex",alignItems:"center",justifyContent:"center",w:n.length(36),h:n.length(36),borderRadius:n.radius(8),bg:i?"primary":"lightBackground",borderWidth:"1px",borderStyle:"solid",borderColor:i?"primary":"borderColor",cursor:"pointer",title:"This response was helpful","aria-label":"This response was helpful",_hover:{opacity:.85,transform:"translateY(-1px)"},_active:{transform:"scale(0.95)"},transition:"all 0.15s",children:w.jsx(Z,{fontSize:n.font(16),lineHeight:"1",children:"👍"})}),w.jsx(D,{as:"button",onClick:()=>{a(!0)},display:"flex",alignItems:"center",justifyContent:"center",w:n.length(36),h:n.length(36),borderRadius:n.radius(8),bg:s?"red.500":"lightBackground",borderWidth:"1px",borderStyle:"solid",borderColor:s?"red.500":"borderColor",cursor:"pointer",title:"This response wasn't helpful","aria-label":"This response wasn't helpful",_hover:{opacity:.85,transform:"translateY(-1px)"},_active:{transform:"scale(0.95)"},transition:"all 0.15s",children:w.jsx(Z,{fontSize:n.font(16),lineHeight:"1",children:"👎"})})]}),t?.feedbackText&&w.jsxs(D,{mt:n.space(1),px:n.space(2.5),py:n.space(2),bg:"lightBackground",borderRadius:n.radius(8),borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",maxW:n.length(280),children:[w.jsx(Z,{fontSize:n.font(10),color:"mutedText",lineHeight:"1.2",fontWeight:"600",textTransform:"uppercase",mb:n.space(1),children:"Submitted Feedback"}),w.jsx(Z,{fontSize:n.font(11),color:"mutedText",lineHeight:"1.4",children:t.feedbackText})]}),o&&w.jsx(D,{maxW:n.length(280),children:w.jsx(Jr,{onSubmit:async t=>{await r(e,"dislike",t),a(!1)},onClose:()=>{a(!1)},existingText:t?.feedbackText})})]})},eo=({variant:e,children:t,textSize:n={base:"15px",md:"14px"}})=>{const r=P(),o=Te(r,n);return"user"===e?w.jsx(Z,{wordBreak:"break-word",fontSize:r.font(14),fontWeight:"500",color:"text",fontFamily:V,whiteSpace:"pre-wrap",children:t}):w.jsx(Z,{fontSize:o,fontWeight:"400",color:"text",textAlign:"left",lineHeight:"1.6",whiteSpace:"pre-wrap",children:t})},to=(no=()=>l(()=>import("./MarkdownContent-C15ck6xJ.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),ro=eo,oo="markdown",F.lazy(()=>i(no,ro,(e,t)=>{console.warn(`[Dori] chunk "${oo}" failed twice, rendering plain fallback`,e,t);try{s(t instanceof Error?t:new Error(String(t)),{chunk:oo,degraded:!0})}catch{}})));var no,ro,oo;const ao=({message:e,isStreaming:t=!1,doriMessageIndex:n,isAfterProducts:r=!1})=>{const o=P(),{isTestMode:a,enterFocusMode:i,productFocusEnabled:s}=H(),l=Bt("colors","primary"),c=oe(l),d=function(e){const t=Date.now()-new Date(e).getTime()<2e3,[n,r]=v.useState(!t);return v.useEffect(()=>{if(!t)return;const e=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(e)},[t]),n}(e.timestamp),u=function(e,t){const n=v.useRef(e),r=v.useRef(t?0:e.length),[o,a]=v.useState(t?"":e),i=v.useRef(null),s=v.useRef(t);n.current=e,s.current=t;const l=v.useCallback(()=>{const e=n.current,t=e.length-r.current;if(t<=0||!s.current)return void(i.current=null);const o=Math.max(1,Math.ceil(.12*t));r.current=Math.min(e.length,r.current+o),a(e.slice(0,r.current)),r.current<e.length?i.current=requestAnimationFrame(l):i.current=null},[]),c=v.useCallback(()=>{null===i.current&&(i.current=requestAnimationFrame(l))},[l]),d=v.useCallback(()=>{null!==i.current&&(cancelAnimationFrame(i.current),i.current=null)},[]);return v.useEffect(()=>(t?r.current<e.length&&c():(d(),r.current=e.length,a(e)),d),[t]),v.useEffect(()=>{t&&r.current<e.length&&c()},[e,t,c]),o}(e.content,t);if("welcome"===e.type)return w.jsx(Ar,{message:e.content});if("loading"===e.type)return e.content&&w.jsx(Ar,{message:e.content,type:"loading"});if("user"===e.type)return w.jsxs(D,{maxW:o.length(220),alignSelf:"flex-end",mb:o.space(2),children:[e.imageUrl&&w.jsx(D,{w:o.length(120),h:o.length(120),mb:o.space(2),borderRadius:o.radius(12),background:c,children:w.jsx(N,{src:e.imageUrl,alt:"Uploaded image",w:"100%",h:"100%",borderRadius:o.radius(12),objectFit:"cover"})}),(e.content.length>0||e.repliedProduct)&&w.jsxs(G,{bg:"lightBackground",borderRadius:o.radius(24),px:o.space(3),py:o.space(2),gap:o.space(2),alignItems:"start",w:"full",borderWidth:"1px",borderStyle:"solid",borderColor:"borderColor",children:[e.repliedProduct&&(()=>{const t=e.repliedProduct,n=s&&null!=t.id,r=()=>i(t,"replied_chip");return w.jsxs(Y,{bg:"background",borderRadius:o.radius(12),p:o.space(2),gap:o.space(2),w:"full",...n&&{role:"button",tabIndex:0,cursor:"pointer","aria-label":t.name,onClick:e=>{e.stopPropagation(),r()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r())},_hover:{bg:"veryLightBackground"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"1px"},transition:"background 0.15s"},children:[w.jsx(N,{src:t.image,alt:"product",w:o.length(40),h:o.length(40),objectFit:"cover",borderRadius:o.radius(8)}),w.jsx(Z,{fontSize:o.font(12),fontWeight:"400",color:"text",children:t.name})]})})(),w.jsx(v.Suspense,{fallback:w.jsx(eo,{variant:"user",children:e.content}),children:w.jsx(to,{variant:"user",children:e.content})})]})]});if("products"===e.type)return w.jsx(D,{maxW:"100%",alignSelf:"flex-start",mb:o.space(4),w:"full",opacity:d?1:0,transform:d?"translateY(0)":"translateY(4px)",transition:"opacity 0.3s ease-out, transform 0.3s ease-out",children:w.jsx(Ur,{products:e.products||[],shape:e.shape})});if("suggestions"===e.type)return w.jsx(Kr,{suggestions:e.suggestions||[],options:e.optionChips});if("follow_up"===e.type&&e.followUp)return w.jsx(We,{message:e});if("handover"===e.type&&e.handover)return w.jsx(Ie,{message:e});if("team"===e.type)return w.jsx(Le,{message:e});if("handover_event"===e.type&&e.handoverEvent)return w.jsx(Me,{message:e});if("dori"===e.type&&!e.content?.trim()&&!t&&!e.showCartSummary)return null;const p="undefined"!=typeof document&&"true"===document.querySelector("script#dori-side-widget")?.getAttribute("data-hide-ratings"),h=a&&!p&&"dori"===e.type&&!t,f=Te(o,r&&!t?{base:"14px",md:"13px"}:{base:"15px",md:"14px"});return w.jsxs(G,{align:"stretch",gap:o.space(2),opacity:d?1:0,transform:d?"translateY(0)":"translateY(4px)",transition:"opacity 0.25s ease-out, transform 0.25s ease-out",children:[(!!u?.trim()||t)&&w.jsx(D,{w:"full",alignSelf:"flex-start",children:w.jsx(v.Suspense,{fallback:w.jsx(eo,{variant:"dori",textSize:f,children:u}),children:w.jsx(to,{variant:"dori",textSize:f,children:u})})}),e.showCartSummary?w.jsx(Xr,{add:e.closerAdd}):e.showCartActions&&w.jsx(Gr,{}),h&&void 0!==n&&w.jsx($r,{messageIndex:n,feedback:e.feedback})]})},io=e=>w.jsx(_e,{label:"message",fallback:e.message?.content?w.jsx(eo,{variant:"user"===e.message.type?"user":"dori",children:e.message.content}):null,children:w.jsx(ao,{...e})}),so=({product:e,messages:t})=>{const n=P(),{enterFocusMode:r}=H(),{t:o}=q(),a=t.filter(e=>"user"===e.type||"products"===e.type||"dori"===e.type&&(!!e.content?.trim()||e.showCartSummary)).length,i=1===a?o("productChatMessageOne"):o("productChatMessages").replace("{count}",String(a)),s=()=>r(e,"chat_card");return w.jsxs(Y,{role:"button",tabIndex:0,"aria-label":`${e.name} · ${i}`,onClick:s,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s())},mt:n.space(1),mb:n.space(1),px:n.space(3),py:n.space(2.5),gap:n.space(2.5),align:"center",border:"1.5px solid",borderColor:"borderColor",borderRadius:n.radius(14),bg:"background",cursor:"pointer",_hover:{borderColor:"primary"},_focusVisible:{outline:"2px solid",outlineColor:"primary",outlineOffset:"1px"},transition:"border-color 0.15s",children:[e.image&&w.jsx(N,{src:e.image,alt:"",w:n.length(36),h:n.length(36),objectFit:"cover",borderRadius:n.radius(8),flexShrink:0,bg:"lightBackground"}),w.jsxs(D,{minW:0,flex:1,children:[w.jsx(Z,{fontSize:n.font(12.5),fontWeight:600,color:"text",lineHeight:"1.3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:V,children:e.name}),w.jsxs(Z,{fontSize:n.font(11),color:"mutedText",fontFamily:V,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:[o("productChatLabel")," · ",i]})]}),w.jsx(bn,{boxSize:n.length(13),color:"mutedText",flexShrink:0})]})},lo=["product_click","add_to_cart","exit_intent"];function co(e){const t=(e?.fields??[]).filter(e=>"phone"===e||"email"===e);return Array.from(new Set(t))}const uo="dori-lead-settled-",po="dori-lead-asks-";function ho(e){if("undefined"==typeof window)return null;try{return localStorage.getItem(e)}catch{return null}}function fo(e,t){if("undefined"!=typeof window)try{localStorage.setItem(e,t)}catch{}}function go(e){e&&fo(`${uo}${e}`,"1")}function mo(e){if(!e)return 0;const t=Number.parseInt(ho(`${po}${e}`)??"",10);return Number.isFinite(t)&&t>0?t:0}const bo=e=>/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e.trim()),xo=({threadId:e,fields:t,rule:n,message:r,note:o,onSettled:a})=>{const i=P(),{isMobile:s}=ee(),{t:l}=q(),[c,d]=v.useState(!1),[u,p]=v.useState({phone:"",email:""}),[h,f]=v.useState(!1),[g,m]=v.useState(!1);v.useEffect(()=>{const e=requestAnimationFrame(()=>d(!0));return()=>cancelAnimationFrame(e)},[]),v.useEffect(()=>{if(!g)return;const e=setTimeout(a,2500);return()=>clearTimeout(e)},[g,a]);const b=v.useMemo(()=>{return{phone:t.includes("phone")&&(e=u.phone,(e.match(/\d/g)||[]).length>=6)?u.phone:void 0,email:t.includes("email")&&bo(u.email)?u.email:void 0};var e},[t,u]),x=Boolean(b.phone||b.email),y=async()=>{!h&&x&&(f(!0),go(e),await Fe(e,{...b,trigger:n.trigger}),f(!1),m(!0))},C=e=>l("phone"===e?"leadPromptPhonePlaceholder":"leadPromptEmailPlaceholder");return w.jsx(D,{flexShrink:0,opacity:c?1:0,transform:c?"translateY(0)":"translateY(6px)",transition:"opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1)",borderWidth:"1px",borderColor:"border",borderRadius:i.radius(10),bg:"veryLightBackground",px:i.space(2.5),py:i.space(2),"data-dori-lead-capture":n.trigger,children:g?w.jsx(Z,{fontSize:i.font(12),color:"text",fontFamily:V,children:l("leadPromptSaved")}):w.jsxs(G,{align:"stretch",gap:i.space(1.5),children:[w.jsx(Z,{fontSize:i.font(12),lineHeight:"1.35",color:"text",fontFamily:V,children:n.message||r||l("leadPromptText")}),w.jsxs(Y,{gap:i.space(1.5),wrap:"wrap",align:"center",children:[t.map(e=>w.jsx(Be,{value:u[e],onChange:t=>p(n=>({...n,[e]:t.target.value})),onKeyDown:e=>{"Enter"===e.key&&y()},placeholder:C(e),"aria-label":C(e),type:"phone"===e?"tel":"email",inputMode:"phone"===e?"tel":"email",autoComplete:"phone"===e?"tel":"email",fontSize:s?X(i,16):i.font(13),color:"text",bg:"background",borderColor:"border",borderRadius:i.radius(8),flex:"1 1 8rem",minW:"8rem",height:i.length(32),px:i.space(2.5),py:0,_placeholder:{color:"mutedText"},_focus:{borderColor:"primary",boxShadow:"none"}},e)),w.jsx(I,{size:"sm",flexShrink:0,borderRadius:i.radius(8),bg:"primary",color:"buttonText",fontSize:i.font(12),px:i.space(3),height:i.length(32),loading:h,disabled:!x,onClick:y,fontFamily:V,children:l("leadPromptSave")})]}),w.jsxs(Y,{justify:"space-between",align:"center",gap:i.space(2),children:[w.jsx(Z,{fontSize:i.font(10),lineHeight:"1.3",color:"mutedText",fontFamily:V,children:o||l("leadPromptNote")}),w.jsx(I,{size:"sm",variant:"plain",flexShrink:0,fontSize:i.font(11),color:"mutedText",px:0,height:"auto",minH:"auto",py:0,onClick:()=>{go(e),a()},fontFamily:V,children:l("leadPromptSkip")})]})]})})};function yo(){const e=H(),t=e.botData?.feature_flags?.lead_capture,n=e.chatState.threadId,[r,o]=v.useState(!1),[a,i]=v.useState(null),[s,l]=v.useState(0),[c,d]=v.useState([]),[u,p]=v.useState(0),h=Boolean(t?.enabled),f=v.useMemo(()=>e.messages.filter(e=>"dori"===e.type).length,[e.messages]);v.useEffect(()=>{o(function(e){return!!e&&"1"===ho(`${uo}${e}`)}(n)),l(mo(n)),d([]),i(null)},[n]);const g=e=>d(t=>t.includes(e)?t:[...t,e]),m=v.useRef(Date.now());v.useEffect(()=>{m.current=Date.now(),p(0)},[e.messages.length]),v.useEffect(()=>{if(!h)return;const e=setInterval(()=>{p(Math.floor((Date.now()-m.current)/1e3))},5e3);return()=>clearInterval(e)},[h]),v.useEffect(()=>{h&&(e.focusedProduct||e.focusModeProduct)&&g("product_click")},[h,e.focusedProduct,e.focusModeProduct]);const b=v.useRef(e.cartItemCount??0);v.useEffect(()=>{if(!h)return;const t=e.cartItemCount??0;t>b.current&&g("add_to_cart"),b.current=t},[h,e.cartItemCount]),v.useEffect(()=>{if(!h)return;if("undefined"==typeof window||"undefined"==typeof document)return;if(window.matchMedia?.("(hover: none)")?.matches)return;const e=e=>{e.clientY<=0&&g("exit_intent")};return document.addEventListener("mouseout",e),()=>document.removeEventListener("mouseout",e)},[h]);const x=function(e,t){if(!e?.enabled)return null;if(!t.hasThread||t.settled||t.busy)return null;const n=e.fields??[],r=e.rules??[];if(0===n.length||0===r.length)return null;const o=e.max_asks??1;return t.asksUsed>=o?null:r.find(e=>function(e,t){switch(e.trigger){case"conversation_start":return!0;case"after_turns":return t.botTurns>=(e.value??1);case"idle":return t.botTurns>0&&t.idleSeconds>=(e.value??45);default:return!!lo.includes(e.trigger)&&t.firedEvents.includes(e.trigger)}}(e,t))??null}(t,{botTurns:f,idleSeconds:u,firedEvents:c,asksUsed:s,settled:r,hasThread:Boolean(n),busy:e.anySheetOpen||"generating"===e.inputState||!!e.handover});v.useEffect(()=>{!r&&!a&&x&&n&&(i(x),l(function(e){if(!e)return 0;const t=mo(e)+1;return fo(`${po}${e}`,String(t)),t}(n)))},[x,a,r,n]);const y=function(e,t,n){return n?null:e??t}(a,x,r);return{rule:y,threadId:n,fields:co(t),message:t?.message,note:t?.note,settle:()=>{i(null),o(!0)}}}const vo=({chat:e,t:t})=>{const n=P(),[r,o]=v.useState(!1);return v.useEffect(()=>{const e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[]),w.jsxs(Y,{role:"status","aria-live":"polite",flexShrink:0,justify:"space-between",align:"center",px:n.space(3),py:n.space(2),bg:"lightBackground",borderRadius:n.radius(8),borderLeft:"3px solid",borderLeftColor:"primary",fontSize:n.font(13),opacity:r?1:0,transform:r?"translateY(0)":"translateY(8px)",transition:"opacity 0.25s ease-out, transform 0.25s ease-out",children:[w.jsx(Z,{color:"mutedText",fontSize:n.font(13),lineClamp:1,flex:1,children:"remove"===e.cartUndoState.operation?t("cartUndoRemoved").replace("{product}",e.cartUndoState.productName):t("cartUndoQuantityChanged").replace("{product}",e.cartUndoState.productName)}),w.jsxs(Y,{gap:n.space(1),children:[w.jsx(I,{size:"xs",variant:"ghost",color:"primary",fontWeight:"600",fontSize:n.font(13),onClick:e.handleCartUndo,_hover:{bg:"transparent",opacity:.7},px:n.space(2),minW:"auto",children:t("cartUndoButton")}),w.jsx(Ut,{size:"xs",variant:"ghost","aria-label":"Dismiss",onClick:e.dismissCartUndo,color:"mutedText",_hover:{bg:"transparent",opacity:.7},minW:"auto",h:"auto",p:n.space(.5),children:w.jsx(tn,{boxSize:n.length(12)})})]})]})},wo=({header:e})=>{const t=H(),o=De(t.handover),a=t.messages[t.messages.length-1],i=!!t.handover&&"user"===a?.type&&null!==t.handoverTeamReadAt&&t.handoverTeamReadAt>=new Date(a.timestamp).getTime(),{botData:s,bannerChips:l,dismissBannerChips:d,suppressProactiveForSession:u}=t,{t:p,translations:h}=q(),f=n(s,h),{isMobile:g}=ee(),m=yo(),b=P(),x=ie(g?1:se(t.botData).width),y=v.useRef(null),C=v.useRef(!0),k=v.useRef(!1),j=v.useCallback(()=>{if(k.current)return void(k.current=!1);const e=y.current;if(!e)return;const n=e.scrollHeight-e.scrollTop-e.clientHeight<80;n!==C.current&&(C.current=n,t.setAutoScrollEnabled(n))},[t.setAutoScrollEnabled]);v.useEffect(()=>{const e=y.current;e&&(t.handoverTeamTyping||i)&&e.scrollHeight-e.scrollTop-e.clientHeight<160&&c(t.messagesEndRef.current)},[t.handoverTeamTyping,i,t.messagesEndRef]);const S=v.useRef(null);v.useEffect(()=>{const e=t.answerAnchorTurnRef.current;if(!e||S.current===e)return;const n=t.messages,r=n.findIndex(t=>"user"===t.type&&t.id===e);if(-1===r)return;if(!n.slice(r+1).find(e=>"dori"===e.type&&!e.showCartSummary||"products"===e.type))return;S.current=e,t.setAutoScrollEnabled(!1),C.current=!1;const o=y.current,a=o?.querySelector(`[data-turn-anchor="${e}"]`),i=a?.firstElementChild??null;if(o&&i){const e=i.getBoundingClientRect().top-o.getBoundingClientRect().top;Math.abs(e-4)>1&&(k.current=!0,o.scrollTop+=e-4)}},[t.messages,t.answerAnchorTurnRef,t.setAutoScrollEnabled]);const z=v.useRef(0),A=null!=t.focusModeProduct,E=v.useRef(A);v.useLayoutEffect(()=>{const e=y.current,n=E.current;E.current=A,e&&(!n&&A?z.current=e.scrollTop:n&&!A&&(t.setAutoScrollEnabled(!1),C.current=!1,e.scrollTop=z.current))},[A,t.setAutoScrollEnabled]);const[R,T]=le(),_=Bt("colors","primary"),W=oe(_),I=v.useMemo(()=>{if(!t.chatState.isRequestInProgress)return null;if(t.messages.some(e=>"loading"===e.type))return null;for(let e=t.messages.length-1;e>=0;e--)if("dori"===t.messages[e].type)return t.messages[e].id;return null},[t.chatState.isRequestInProgress,t.messages]),L=v.useMemo(()=>{const e=[];for(const n of t.messages){const t=n.focusProductId;if(null!=t){const r=e[e.length-1];if(r&&"productChat"===r.kind&&r.tagId===t){r.messages.push(n);continue}e.push({kind:"productChat",tagId:t,product:null,messages:[n]});continue}e.push({kind:"msg",msg:n})}return e.flatMap(e=>{if("productChat"!==e.kind)return[e];const t=e.messages.find(t=>"user"===t.type&&t.repliedProduct&&String(t.repliedProduct.id)===e.tagId)?.repliedProduct??e.messages.find(e=>"user"===e.type&&e.repliedProduct)?.repliedProduct??null;return t?[{...e,product:t}]:e.messages.map(e=>({kind:"msg",msg:e}))})},[t.messages]),M=v.useMemo(()=>{const e=new Map;let n=0;for(const r of t.messages)"dori"===r.type&&e.set(r.id,n++);return e},[t.messages]);return w.jsxs(w.Fragment,{children:[e,f&&w.jsx(Z,{fontWeight:"600",fontStyle:"normal",fontSize:b.isMini?b.font(24):`${x.greetingFontPx}px`,letterSpacing:"0",w:"fit-content",transition:"opacity 0.5s ease",fontFamily:V,css:{background:W,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:f}),w.jsxs(G,{flex:1,justify:"center",align:"stretch",gap:b.space(x.sectionGap),minH:0,transition:"opacity 0.5s ease",opacity:1,children:[w.jsx(D,{ref:y,flex:1,overflowY:"scroll",overflowX:"hidden","data-scroll-container":"chat-messages",overscrollBehavior:"contain",onScroll:j,css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch"},children:w.jsxs(G,{overscrollBehavior:"contain",gap:b.space(2),align:"stretch",pb:b.space(2),children:["live"===t.handover?.state&&w.jsx(He,{card:t.handover}),w.jsx(_e,{label:"message-list",children:L.reduce((e,t)=>{if("productChat"===t.kind)return e.elements.push(w.jsx(so,{product:t.product,messages:t.messages},`product-chat-${t.messages[0].id}`)),e.prevType="productChat",e;const n=t.msg,r="dori"===n.type,o=r&&"products"===e.prevType,a=w.jsx(io,{message:n,isStreaming:n.id===I,doriMessageIndex:r?M.get(n.id):void 0,isAfterProducts:o},n.id);return e.elements.push("user"===n.type?w.jsx("div",{"data-turn-anchor":n.id,style:{display:"contents"},children:a},n.id):a),e.prevType=n.type,e},{elements:[],prevType:""}).elements},L.length),t.handoverTeamTyping&&w.jsx(Pe,{card:t.handover}),i&&w.jsx(qe,{}),w.jsx("div",{ref:t.messagesEndRef,style:{height:"1px"}})]})}),t.cartUndoState&&w.jsx(vo,{chat:t,t:p}),!(l&&l.length>0)&&R&&!t.anySheetOpen&&w.jsx(Sr,{chips:[R],onChipClick:e=>{r("offer_guide_chat_opened",{from:"chat"}),T(),de(e).then(n=>t.sendMessage({message:e,apiMessage:n}))},onDismiss:()=>{ce(),T()}}),l&&l.length>0&&!t.anySheetOpen&&w.jsx(Sr,{chips:l,onChipClick:e=>{r("banner_chip_tapped",{chip_text:e}),t.sendMessage({message:e}),d()},onDismiss:()=>{r("banner_chips_dismissed"),d(),u()}}),m.rule&&m.threadId&&w.jsx(xo,{threadId:m.threadId,fields:m.fields,rule:m.rule,message:m.message,note:m.note,onSettled:m.settle}),w.jsx(D,{flexShrink:0,bg:"transparent",borderRadius:b.radius(12),transition:"all 0.2s ease",onInput:t.noteHandoverTyping,children:w.jsx(Tn,{state:t.inputState,placeholder:"generating"===t.inputState?p("processing"):"live"===t.handover?.state?p("handoverMessagePlaceholder").replace("{team}",o):t.focusedProduct?p("askAboutProduct"):p("whatsYourQuestion"),onSend:t.isInputDisabled?void 0:t.sendMessage,onStop:t.stopCurrentRequest})})]})]})};function Co(e){return{position:"fixed",transition:"all 0.5s ease",visibility:e?"visible":"hidden",opacity:e?1:0,bgColor:"background",zIndex:1e6,overflow:"hidden",willChange:"transform",pointerEvents:e?"auto":"none",overscrollBehavior:"contain",touchAction:"pan-x pan-y"}}const ko=({children:e,showSuggestionScreen:t,isOpen:n,isExpanded:r=!1})=>{const{isMobile:o}=ee(),{botData:a}=H(),i=v.useRef(null),s=a?.customization?.position?.align??"right",l=se(a),c=Qe(l.width,l.height),d=Ve(a),u=ie(o?1:l.width),p=Ze(Ue(a,o)),h=(f={isMobile:o,mobileScale:d,isOpen:n,isExpanded:r,align:s,panel:c,borderColor:Bt("colors","borderColor")}).isMobile?function(e){const{isOpen:t,mobileScale:n}=e,r=n<1;return{...Co(t),top:r?"auto":"0",left:"0",right:"0",bottom:"0",width:"auto",maxWidth:"100vw",height:r?`min(100dvh, max(${Math.round(100*n)}dvh, ${Ne}px))`:"auto",border:"none",borderRadius:r?`${Oe}px ${Oe}px 0px 0px`:"0px",boxShadow:r?"0px -6px 24px rgba(0, 0, 0, 0.12)":"none",transform:t?"translateY(0)":"translateY(100vh)"}}(f):function(e){const{isOpen:t,isExpanded:n,align:r,panel:o,borderColor:a}=e,i=n?"50%":"20px";return{...Co(t),top:"50%",left:"left"===r?i:"auto",right:"right"===r?i:"auto",bottom:"auto",width:n?o.expandedWidth:o.width,maxWidth:`calc(100vw - ${2*Ye}px)`,height:n?o.expandedHeight:o.height,border:`1px solid ${a}`,borderRadius:"24px",boxShadow:"0px 4px 20px rgba(0, 0, 0, 0.1)",transform:t?n?"right"===r?"translate(50%, -50%)":"translate(-50%, -50%)":"translateY(-50%)":n?"right"===r?"translate(50%, -50%) translateX(120%)":"translate(-50%, -50%) translateX(-120%)":"right"===r?"translateY(-50%) translateX(120%)":"translateY(-50%) translateX(-120%)"}}(f);var f;return(({containerRef:e,isOpen:t,showSuggestionScreen:n})=>{v.useEffect(()=>{if(!t||!e.current)return;const n=e.current,r=e=>{if(e.scrollHeight<=e.clientHeight+1)return!1;const t=getComputedStyle(e).overflowY;return"auto"===t||"scroll"===t},o=e=>{e.preventDefault(),e.stopPropagation();const t=(e=>{let t=e.composedPath?.()[0]??e.target;for(;t&&t!==n;){if(t instanceof HTMLElement&&r(t))return t;t=t.parentElement}return null})(e)||n.querySelector('[data-scroll-container="sheet"]')||n.querySelector('[data-scroll-container="focus-mode"]')||n.querySelector('[data-scroll-container="chat-messages"]');t&&(t.scrollTop+=e.deltaY)};return n.addEventListener("wheel",o,{passive:!1}),()=>{n.removeEventListener("wheel",o)}},[t,n])})({containerRef:i,isOpen:n,showSuggestionScreen:t}),v.useEffect(()=>{const e=i.current;if(!e)return;const t=e=>e.preventDefault();return e.addEventListener("gesturestart",t,{passive:!1}),e.addEventListener("gesturechange",t,{passive:!1}),()=>{e.removeEventListener("gesturestart",t),e.removeEventListener("gesturechange",t)}},[]),w.jsx(D,{ref:i,...h,children:w.jsxs(G,{p:p.space(u.padding),pb:p.space(u.paddingBottom),h:"full",justify:"flex-start",align:"stretch",gap:p.space(u.contentGap),children:[e,!t&&w.jsx(D,{transition:"all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",children:w.jsx(Bn,{variant:"default"})})]})})},jo=/colo|couleur|farbe|màu|colore|kleur/i,So=({variantSummary:e})=>{const t=P();if(!e?.options?.length)return null;const{options:n}=e,r=n.find(e=>jo.test(e.name||"")||Lr(e)),o=r?(()=>{const e=new Set(r.values.map(e=>e.image).filter(Boolean)).size>1,n=r.values.slice(0,6),o=r.values.length-n.length;return w.jsxs(Y,{gap:t.space(1),align:"center",wrap:"wrap",children:[n.map((n,r)=>{const o=!1===n.available,a=Wr(n.value,n.swatch);return e&&n.image?w.jsx(D,{position:"relative",title:n.value,w:t.length(16),h:t.length(16),borderRadius:t.radius(4),backgroundImage:`url(${n.image})`,backgroundSize:"cover",backgroundPosition:"center",border:"0.5px solid rgba(0,0,0,0.15)",opacity:o?.35:1,flexShrink:0,children:o&&w.jsx(D,{position:"absolute",top:t.length(7),left:"-2px",w:t.length(20),h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r):a?w.jsx(D,{position:"relative",title:n.value,w:t.length(15),h:t.length(15),borderRadius:"full",bg:a,border:"0.5px solid rgba(0,0,0,0.2)",opacity:o?.35:1,flexShrink:0,children:o&&w.jsx(D,{position:"absolute",top:t.length(7),left:"-1px",w:t.length(17),h:"1.5px",bg:"text",transform:"rotate(-45deg)"})},r):w.jsx(Z,{fontSize:t.font(10),px:t.space(1.5),py:t.space(.5),borderRadius:t.radius(6),border:"0.5px solid",borderColor:"borderColor",color:"mutedText",opacity:o?.5:1,textDecoration:o?"line-through":"none",whiteSpace:"nowrap",title:n.value,fontFamily:V,children:n.value},r)}),o>0&&w.jsxs(Z,{fontSize:t.font(11),color:"mutedText",fontFamily:V,children:["+",o]})]})})():null,a=(r?n.filter(e=>e!==r):n).map(e=>{const n=e.values.slice(0,4),r=e.values.length-n.length;return w.jsxs(Z,{fontSize:t.font(11),color:"mutedText",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxW:"100%",fontFamily:V,children:[e.name,":"," ",n.map((e,t)=>w.jsxs(Z,{as:"span",textDecoration:!1===e.available?"line-through":"none",opacity:!1===e.available?.6:1,children:[e.value,t<n.length-1?", ":""]},t)),r>0?`, +${r}`:""]},e.name)});return o||0!==a.length?w.jsxs(G,{align:"start",gap:t.space(.5),w:"full",children:[o,a]}):null};let zo=1;const Ao=[];let Eo=!1,Ro=0;function To(){if(Ro>0)return void Ro--;const e=Ao.pop();e&&e.close()}function _o(e,t){const n=v.useRef(t);n.current=t,v.useEffect(()=>{if(!e)return;const t=function(e){if("undefined"==typeof window||!window.history?.pushState)return null;const t=zo++;try{window.history.pushState({__dori_layer:t},"")}catch{return null}return Eo||(Eo=!0,window.addEventListener("popstate",To)),Ao.push({id:t,close:e}),t}(()=>n.current());return null!=t?()=>function(e){const t=Ao.findIndex(t=>t.id===e);if(-1!==t){Ao.splice(t,1);try{window.history.state?.__dori_layer===e&&(Ro++,window.history.back())}catch{}}}(t):void 0},[e])}const Wo=({slides:e,initialIndex:t,alt:n,onClose:r})=>{const o=P(),a=v.useRef(null),[i,s]=v.useState(t);return _o(!0,r),v.useEffect(()=>{const e=a.current;e&&e.clientWidth>0&&t>0&&e.scrollTo({left:t*e.clientWidth})},[]),w.jsxs(D,{position:"absolute",inset:0,zIndex:60,bg:"rgba(12, 12, 12, 0.94)","data-dori-sheet":"true",children:[w.jsx(Ut,{"aria-label":"Close",position:"absolute",top:o.length(10),right:o.length(10),zIndex:2,size:"sm",minW:o.length(34),w:o.length(34),h:o.length(34),p:0,borderRadius:"full",bg:"rgba(255,255,255,0.14)",color:"white",_hover:{bg:"rgba(255,255,255,0.26)"},onClick:r,children:w.jsx(tn,{boxSize:o.length(12)})}),w.jsx(Y,{ref:a,gap:0,w:"full",h:"full",onScroll:()=>{const e=a.current;if(!e||0===e.clientWidth)return;const t=Math.round(e.scrollLeft/e.clientWidth);t!==i&&s(t)},onClick:r,css:{overflowX:"auto",scrollSnapType:"x mandatory",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"},WebkitOverflowScrolling:"touch"},children:e.map(e=>w.jsx(D,{css:{flex:"0 0 100%",scrollSnapAlign:"center"},h:"full",display:"flex",alignItems:"center",justifyContent:"center",p:4,children:w.jsx(N,{src:e.src,alt:n,maxW:"100%",maxH:"100%",objectFit:"contain",onClick:e=>e.stopPropagation()})},e.id))}),e.length>1&&w.jsx(Y,{position:"absolute",bottom:o.length(14),left:"0",right:"0",justify:"center",gap:1.5,pointerEvents:"none",children:e.map((e,t)=>w.jsx(D,{w:o.length(6),h:o.length(6),borderRadius:"full",bg:t===i?"white":"rgba(255,255,255,0.35)"},`dot-${e.id}`))})]})},Io=/colo|couleur|farbe|màu|colore|kleur/i,Lo=e=>(e||"").replace(/^https?:/,"").split("?")[0],Mo=({onClose:e})=>{const{focusModeProduct:t,focusModeAnchorTs:n,exitFocusMode:r,openVariantModal:o,variantModalProduct:a,addToCartDirect:i,sendMessage:s,stopCurrentRequest:l,botData:c,chatState:d,messages:u,inputState:p,isInputDisabled:h,shortlistEnabled:f,isShortlisted:g,toggleShortlist:m,answerAnchorTurnRef:b,isTestMode:x}=H(),y=P(),{t:C}=q(),k=t,j=null!=k,S=v.useRef(null),[z,A]=v.useState(!1),[E,R]=v.useState(!1),T=v.useRef(null),_=v.useMemo(()=>"undefined"!=typeof window&&!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,[]);v.useEffect(()=>{if(!j)return A(!1),void R(!1);const e=requestAnimationFrame(()=>A(!0));return()=>cancelAnimationFrame(e)},[j]),v.useEffect(()=>()=>{T.current&&clearTimeout(T.current)},[]);const W=v.useCallback(e=>{_?r(e):R(t=>t||(T.current=setTimeout(()=>r(e),180),!0))},[_,r]);_o(j,()=>W("back_gesture"));const[L,M]=v.useState(null);v.useEffect(()=>{if(!j)return;const e=e=>{"Escape"===e.key&&(e.preventDefault(),null==L?a||W("escape"):M(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[j,a,L,W]),v.useEffect(()=>{if(j){const e=requestAnimationFrame(()=>S.current?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)}},[j]);const[B,F]=v.useState(null),U=k?.url;v.useEffect(()=>{F(null);const e=U?pe(U):void 0;if(!e)return;let t=!1;return he(e).then(e=>{!t&&e&&F(e)}).catch(()=>{}),()=>{t=!0}},[U]);const Q=null!=k?.id?String(k.id):null,K=v.useMemo(()=>null==Q?[]:u.filter(e=>null!=e.focusProductId&&String(e.focusProductId)===Q),[u,Q]),X=v.useMemo(()=>{if(!d.isRequestInProgress)return null;if(K.some(e=>"loading"===e.type))return null;for(let e=K.length-1;e>=0;e--)if("dori"===K[e].type)return K[e].id;return null},[d.isRequestInProgress,K]),J=v.useRef(null),$=v.useRef(null),ee=v.useRef(!1),te=v.useRef(!1);te.current=K.length>0,v.useEffect(()=>{M(null);const e=J.current;te.current?(ee.current=!0,e&&(e.scrollTop=e.scrollHeight)):(ee.current=!1,e&&(e.scrollTop=0)),T.current&&(clearTimeout(T.current),T.current=null),R(!1)},[n]);const ne=v.useRef(!1),re=v.useCallback(()=>{if(ne.current)return void(ne.current=!1);const e=J.current;e&&(ee.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)},[]);v.useEffect(()=>{if(!j)return;const e=J.current,t=$.current;if(!e||!t)return;const n=new ResizeObserver(()=>{ee.current&&(ne.current=!0,e.scrollTop=e.scrollHeight)});return n.observe(t),()=>n.disconnect()},[j]);const oe=v.useCallback(()=>{ee.current=!0;const e=J.current;e&&(ne.current=!0,e.scrollTop=e.scrollHeight)},[]),ae=v.useRef(null);v.useEffect(()=>{if(!j)return;const e=b.current;if(!e||ae.current===e)return;const t=K.findIndex(t=>"user"===t.type&&t.id===e);if(-1===t)return;if(!K.slice(t+1).find(e=>"dori"===e.type&&!e.showCartSummary||"products"===e.type))return;ae.current=e,ee.current=!1;const n=J.current,r=n?.querySelector(`[data-turn-anchor="${e}"]`),o=r?.firstElementChild??null;if(n&&o){const e=o.getBoundingClientRect().top-n.getBoundingClientRect().top;Math.abs(e-4)>1&&(ne.current=!0,n.scrollTop+=e-4)}},[j,K,b]);const ie=v.useMemo(()=>k?function(e,t){const n=[],r=new Set,o=(e,t,o)=>{t&&!r.has(Lo(t))&&(r.add(Lo(t)),n.push(null!=o?{id:e,src:t,color:o}:{id:e,src:t}))};if(t){const r=(t.options??[]).findIndex(e=>Io.test("string"==typeof e?e:e?.name||""));if(r>=0){const e=new Set;for(const n of t.variants){const t=ue(n,r+1);t&&!e.has(t)&&(e.add(t),o(`color:${t}`,n.featured_image?.src,t))}}for(const[e,a]of(t.images??[]).entries()){if(n.length>=8)break;o(`img:${e}`,a)}return 0===n.length&&o("main",e.image),n.slice(0,8)}const a=e.variant_summary?.options?.find(e=>Io.test(e.name||""));if(a?.values?.some(e=>e.image))for(const i of a.values)o(`color:${i.value}`,i.image,i.value);return 0===n.length&&o("main",e.image),n.slice(0,8)}(k,B):[],[k,B]);if(!k)return null;const se=ie[0]?.src||k.image,le=ie.length>0?ie:se?[{id:"hero",src:se}]:[],ce=O(c),de=(k.variant_summary?.options??[]).some(e=>(e.values?.length??0)>1),fe=(k.currency||c?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",ge=Boolean(k.is_on_sale&&null!=k.sale_price&&k.sale_price>0&&null!=k.price&&k.sale_price<k.price),be=ge&&k.sale_price?k.sale_price:k.price,ye=e=>Ae("focus_path_clicked",{assistantId:c?.assistant_id,threadId:d.threadId,payload:{product_id:k.id,path:e,mode_version:"focused_chat_v2"}}),ke=xe(k,c),je=null!==ke,Se=(e,t)=>{ye(e),oe(),s({message:t,apiMessage:`${t} (product id: ${k.id})`,focusScoped:!0})},ze=!0===c?.feature_flags?.hide_price_check,Ee=(e,t,n)=>w.jsxs(I,{variant:"outline",h:y.length(40),px:y.space(2),gap:y.space(1.5),fontSize:y.font(12.5),fontWeight:500,color:"text",borderColor:"borderColor",borderRadius:y.radius(10),bg:"background",justifyContent:"center",_hover:{bg:"veryLightBackground",borderColor:"primary",color:"primary"},onClick:n,fontFamily:V,children:[w.jsx(N,{src:e,alt:"",w:y.length(15),h:y.length(15),objectFit:"contain",flexShrink:0}),w.jsx(D,{as:"span",minW:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),Re=g(k.id);return w.jsxs(D,{position:"absolute",inset:0,zIndex:30,bg:"background","data-dori-sheet":"true","data-focus-mode":"true",transform:z&&!E?"translateX(0)":"translateX(100%)",transition:_?"none":"transform 180ms ease-out",children:[w.jsxs(Xt,{direction:"column",h:"full",minH:0,children:[w.jsxs(Xt,{align:"center",gap:y.space(2),px:y.space(4),py:y.space(2.5),flexShrink:0,borderBottom:"1px solid",borderColor:"borderColor",bg:"background",children:[w.jsx(Ut,{ref:S,"aria-label":C("back"),size:"sm",variant:"ghost",color:"text",borderRadius:"full",minW:y.length(34),w:y.length(34),h:y.length(34),p:y.space(0),flexShrink:0,css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:()=>W("back"),children:w.jsx(pn,{boxSize:y.length(16)})}),k.image&&w.jsx(N,{src:k.image,alt:k.name,w:y.length(38),h:y.length(38),objectFit:"cover",borderRadius:y.radius(8),flexShrink:0,bg:"lightBackground",border:"1px solid",borderColor:"borderColor"}),w.jsxs(D,{minW:0,flex:1,children:[w.jsx(Z,{fontSize:y.font(13.5),fontWeight:600,color:"text",lineHeight:"1.3",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:V,children:k.name}),w.jsxs(Y,{gap:y.space(1.5),align:"center",children:[ge&&null!=k.price&&w.jsx(Z,{fontSize:y.font(11),color:"mutedText",textDecoration:"line-through",fontFamily:V,children:me(k.price,fe)}),!!be&&be>0&&w.jsx(Z,{fontSize:y.font(12.5),fontWeight:700,color:"text",fontFamily:V,children:me(be,fe)}),k.price_on_request&&w.jsx(Z,{fontSize:y.font(12.5),fontWeight:700,color:"text",fontFamily:V,children:C("priceOnRequest")}),ge&&!!k.sale_percent_off&&w.jsxs(Zt,{bg:"errorBackground",color:"error",fontSize:y.font(10),borderRadius:y.radius(12),children:[k.sale_percent_off,"%"]})]})]}),f&&w.jsx(Ut,{"aria-label":C(Re?"removeSaved":"saveForLater"),size:"sm",variant:"ghost",minW:y.length(34),w:y.length(34),h:y.length(34),p:y.space(0),borderRadius:"full",flexShrink:0,color:Re?"primary":"mutedText",css:{"@media (hover: hover)":{"&:hover":{color:"var(--chakra-colors-primary)"}}},onClick:()=>m(k),children:Re?w.jsx(mn,{boxSize:y.length(17)}):w.jsx(gn,{boxSize:y.length(17)})}),e&&w.jsx(Ut,{"aria-label":"Close",size:"sm",variant:"ghost",minW:y.length(34),w:y.length(34),h:y.length(34),p:y.space(0),borderRadius:"full",flexShrink:0,color:"mutedText",css:{"@media (hover: hover)":{"&:hover":{color:"var(--chakra-colors-primary)"}}},onClick:e,children:w.jsx(tn,{boxSize:y.length(13)})})]}),w.jsx(D,{ref:J,flex:1,minH:0,overflowY:"auto",overflowX:"hidden",overscrollBehavior:"contain","data-scroll-container":"focus-mode",onScroll:re,px:y.space(4),py:y.space(3),css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch"},children:w.jsxs(G,{ref:$,align:"stretch",gap:y.space(3.5),children:[ie.length>1?w.jsx(Dr,{slides:ie,activeColor:null,height:Ke(y,"gallery"),bgColor:"lightBackground",alt:k.name,onImageClick:e=>M(e)}):se&&w.jsx(N,{src:se,alt:k.name,role:"button",tabIndex:0,w:"full",h:Ke(y,"single"),objectFit:"contain",borderRadius:y.radius(12),bg:"lightBackground",cursor:"zoom-in",onClick:()=>M(0),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),M(0))}}),!!k.description&&w.jsx(D,{borderRadius:y.radius(8),borderLeft:"2px solid",borderLeftColor:"primary",px:y.length(10),py:y.length(6),bg:"lightBackground",children:w.jsx(Z,{fontSize:y.font(12.5),color:"text",lineHeight:"1.5",lineClamp:3,fontFamily:V,children:k.description})}),k.variant_summary&&w.jsx(So,{variantSummary:k.variant_summary}),w.jsxs(G,{align:"stretch",gap:y.space(1.5),children:[w.jsx(Z,{fontSize:y.font(11),fontWeight:600,color:"mutedText",textTransform:"uppercase",letterSpacing:"0.05em",fontFamily:V,children:C("needHelpDeciding")}),w.jsxs(D,{display:"grid",gridTemplateColumns:`repeat(${ze?2:3}, minmax(0, 1fr))`,gap:y.space(1.5),children:[Ee("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAY7klEQVR42tV7eZhU1bXvb+29z6mq7oamm0kGBZmEBlESPlEcqmX0xjhCNdg4RqM3GC6+jyRivpdX1PfevZrnM04vajDRvCuiVDnFqBFEoYxjAIkDLYMgqEwNDT1XnXP23uv9UVVNNzQy+fB7h95f0dX77LPWb695rwOc7CsOUfjvihUrwhs3bgx19reTddH38Dy+7Oex07+pr4t7vjeeAA6FQh/0KemWePXRF7YU5pwsgk4e4vG4AICr5szqv7l25zvNQfYGzwZDs1YPaw4y12/Zt/vdqbfNGJibGj9pdMmTuPs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LCpx18l0nZDGDGZBCQAnZVBouufn9P7+eKjz7ewOg0FsYveWyc3c27H1XGy2klJAsWgnYBsIhtr19KYDyzuDg72w748T5XJmZB1jYImMMXNflvqU9z39z4Uvvx9o1Pn8fEiCYmUfNuOB9j/U4YiAs3WTfbuV3vv6Hl7bR0dS5jiZxYqZLb5522jcte+7OmuAaBhBW7j8+eSZ9LuXqdSflFbvOKrSYesu0kcOmnWsHTzvHjr4mWsPMrpIKzOwU3grLD6fdOPh3p5P5He7Nr+mOvia6bsi0c+zw2Hl26uxpI0/0RUuFE+vNsc0mM5IUWQTgQAennD1rwrpRMy5UZ197saVDOsIO7hKjTk4JO07LWU/ikTMuFGOuncCBMWXMZKAkZY0/Gu06v08qAKjMHa65rgqLQEn2NTwblHm+Lus8k6V2Lv1wMQ4dpq3y0MxJKAWlXLc9LScVgHQid7zco6jnK/WNjX9zIkVngckW9i3Xjd0eB8r/HPqOEB3muJw6ygZR7o0eQEJIFp+Vu93+CoDytHx/cQABWPJGstQLSo5o9LrnP+s6+a79VZf/vrm5mUpKSrjwWQcg5Dg0c/KUBvsdvGT+fwEvnYKDff9ehQAAAABJRU5ErkJggg==",C("compareAction"),()=>Se("compare",C("compareIntent").replace("{name}",k.name))),Ee("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAVVklEQVR42t17e5xU1ZXut/bjnKrqbmleDSrGZHzwEALSiKjgqcZG0RGNSapvANF4o0OuoxF/SjQzv5uyvXeSEJM7xqC5zniTESXj7fpNYpxkFBC6SxBBacCAqIlMIgaFlnd3ddU5Z++97h9VhQ0+iDeho+5/uqpr733OWWfv9X1rfWsD/dyy2awAgAu/MuvzZ1/dtGvivIt2pW+4/At9f+vPRn+J62UfzCYfb2/fHsMNBwBNsuuCM9OnPdDaWqj04/66oX61eCaTEQB49abNjU5gODtn2TnLAg3bd22dBIArffCJNEBXVxcBQKG31MyCGAATgSHBh8Ke5r59PpEGyOfzThAhMmEzW0sEIgBk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0aMbWrpIemtTngSJNgpSbIQukNDGsasbm1tdem7OuxH48hMOTkpfvzt/7NbKrWBpCgL2GAnlIBWesOPv/3j3ZXk8x9VBDV0aBcBIKVT/0FlSuMSvmSS3toxM27ey1mIY2WF+vXcYBAEggH4ylsupACXCwRYCImE9lYwyvXD+KNLcdMOANeccMqqnpANO0tSSlI69SsA6Egfe65+NUCVFtcnBzxN5eSWAEMQM+pSdav69vljWmtrq8tms2LSFXfvECqx/ORhdV5vJEp+7fBfAaCKgT56h6fb2tr0tx5/4NXQxZ9mBhJKvznvylmn39ZyW+nDHp6u4vnqX357YK3dkekJdee0lvs6q//HR61lMuVE5cybW2ZNnHfRW43XXLS76W9mff7PeVKMP4SQ//8Ae5YJEhPYjogAAAAASUVORK5CYII=",C("similarAction"),()=>Se("similar",`${C("doYouHaveSimilar")} ${k.name}`)),!ze&&Ee("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAVpElEQVR42s2beZyU1ZX3f+feZ+2NpluaIIYIcUEwEGiNW5yiBRS3OPqmUGlEQG2Zd4S4ZN5ETT5FzRsSEycqkDjayhpc6EokBhRkr2iMII3LCE40ajJJRNmapbue7d575o/qxoZIBFnv59N/dD1PVT2/7z3n3HPPPUXYdzAIBAJgOl4SIBgwJAkoo0kKyU/Pf9rZmmwtXbN2DXvdqkphdMnr729Ej+qeFQZc+uHmD6l7dfduuws7nSCI7PKKii8ooxPLEu+eXNWjeWb25x8CQDqdlrlcTuMYDdrrv0xGIJs1ADBiUv3ZO8MdI6I46SeIugVhQFLKEimt8iAMISQcS9rlcRJDkvBICDfRCYQQDoGkNhpSSjADzAwSBHDxKyXRVt91F/asrLnv1w/84p1jCYE+0Z4R2WzW1N/e0OO/t38wNUjCtCGG4eKfIAlmhjEGQgiAGQyGEALGGAAEIal4nQQAAnPxOjNA7d/E2gDGQDgSEqLthNKKCfnGhfNSqZSVz+fVMQHQIf7G79x68hsfvrsiVHEfHSlNtpDSlkUx2k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a1oz64VDNvtjBqDzb5OZmc9vuGzmzrBtrAqTWNrSkUxtlrRfAUMpo85KyFTrRIW253rltt+0ZsbiQwp4xweATj/XI8CcM27ET9t0eGcSJ2BjQLLYpKK0ARHguA7KLP/JV2Y8N/pwiz8qQXC/dgAwZyBembXkrhNKK/+P73prLWklAgQBwJGSSxxvY1enpOHVmYvrqVifOqzij6UFdAoMEMjCWELiijuurd28reUUNkZUVVX+9cGLb1x72mWXRZ2e87AfvPwvV+e0GtOjKzYAAAAASUVORK5CYII=",C("worthItAction"),()=>Se("price_check",C("priceCheckIntent").replace("{name}",k.name)))]}),!!k.url&&w.jsxs(I,{variant:"outline",h:y.length(40),w:"full",px:y.space(3),fontSize:y.font(12.5),fontWeight:500,color:"text",borderColor:"borderColor",bg:"background",justifyContent:"center",gap:y.space(1.5),borderRadius:y.radius(10),onClick:()=>{ye("product_page"),k.url&&c&&(ve(k,c,d.threadId),Er(_n(k.url),x))},_hover:{bg:"veryLightBackground",borderColor:"primary",color:"primary"},fontFamily:V,children:[w.jsx(rn,{boxSize:y.length(13)}),C("productPage")]})]}),K.length>0&&w.jsx(G,{align:"stretch",gap:y.space(2),children:K.reduce((e,t)=>{const n=w.jsx(io,{message:t,isStreaming:t.id===X,isAfterProducts:"products"===e.prevType},t.id);return e.elements.push("user"===t.type?w.jsx("div",{"data-turn-anchor":t.id,style:{display:"contents"},children:n},t.id):n),e.prevType=t.type,e},{elements:[],prevType:""}).elements})]})}),w.jsxs(G,{flexShrink:0,align:"stretch",gap:y.space(2),px:y.space(4),pt:y.space(2.5),borderTop:"1px solid",borderColor:"borderColor",bg:"background",children:[ce&&w.jsxs(I,{h:y.length(44),borderRadius:y.radius(12),fontSize:y.font(14),fontWeight:600,bg:"primary",color:"buttonText",w:"full",gap:y.space(1.5),onClick:()=>{ke?Er(ke.href,x):(ye("add"),oe(),de?o(k,"focus_mode"):i({product_id:null!=k.id?String(k.id):void 0,product_name:k.name,product_url:k.url||void 0,product_handle:pe(k.url)||void 0,quantity:Ce(k),quantity_label:we(k)}))},_hover:{opacity:.92},fontFamily:V,children:[je?null:w.jsx(fn,{boxSize:y.length(16)}),C(je?ke.labelKey:"addToCartFull")]}),w.jsx(D,{children:w.jsx(Tn,{state:p,placeholder:C("generating"===p?"processing":"askAboutProduct"),onSend:h?void 0:(e,t)=>(oe(),s({message:e.message,imageUrl:e.imageUrl,focusScoped:!0},t)),onStop:l})})]})]}),null!=L&&le.length>0&&w.jsx(Wo,{slides:le,initialIndex:Math.min(L,le.length-1),alt:k.name,onClose:()=>M(null)})]})},Bo=({open:e,onClose:t,title:n,children:r,onBack:o,footer:a})=>{const i=P(),s=v.useRef(null);return _o(e,o??t),v.useEffect(()=>{if(!e)return;const n=document.activeElement,r=e=>{"Escape"===e.key&&(e.preventDefault(),t())};window.addEventListener("keydown",r);const o=requestAnimationFrame(()=>{const e=s.current?.querySelector("[data-sheet-initial-focus='true']");(e||s.current)?.focus({preventScroll:!0})});return()=>{cancelAnimationFrame(o),window.removeEventListener("keydown",r),n?.focus?.({preventScroll:!0})}},[e,t]),e?w.jsxs(D,{position:"absolute",inset:0,zIndex:30,"data-dori-sheet":"true",children:[w.jsx(D,{position:"absolute",inset:0,bg:"blackAlpha.500",onClick:t,"aria-hidden":"true"}),w.jsxs(Xt,{ref:s,tabIndex:-1,position:"absolute",bottom:0,left:0,right:0,direction:"column",bg:"background",borderTopRadius:"16px",maxH:"82%",pb:i.space(3),borderTop:"1px solid",borderColor:"borderColor",boxShadow:"0 -8px 24px rgba(0,0,0,0.18)",role:"dialog","aria-modal":"true","aria-label":n||void 0,children:[w.jsx(D,{w:i.length(36),h:i.length(4),borderRadius:i.radius(2),bg:"borderColor",mx:"auto",mt:i.space(2),mb:i.space(1),flexShrink:0}),w.jsxs(Xt,{align:"center",justify:"space-between",px:i.space(4),py:i.space(1),flexShrink:0,gap:i.space(2),children:[w.jsxs(Xt,{align:"center",gap:i.space(1.5),minW:0,children:[o&&w.jsx(Ut,{"aria-label":"Back",size:"xs",variant:"ghost",color:"mutedText",borderRadius:"full",minW:i.length(24),w:i.length(24),h:i.length(24),p:i.space(0),css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:o,children:w.jsx(pn,{boxSize:i.length(13)})}),w.jsx(Z,{fontSize:i.font(14),fontWeight:"600",color:"text",lineHeight:"1.3",fontFamily:V,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:n||""})]}),w.jsx(Ut,{"aria-label":"Close",size:"xs",variant:"ghost",color:"mutedText",borderRadius:"full",minW:i.length(24),w:i.length(24),h:i.length(24),p:i.space(0),css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:t,children:w.jsx(tn,{boxSize:i.length(10)})})]}),w.jsx(D,{flex:1,minH:0,overflowY:"auto","data-scroll-container":"sheet",px:i.space(4),pt:i.space(1),css:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},children:r}),a&&w.jsx(D,{flexShrink:0,px:i.space(4),pt:i.space(2.5),borderTop:"1px solid",borderColor:"borderColor",children:a})]})]}):null},Fo=()=>{const e=P(),{variantModalProduct:t,variantModalSource:n,openVariantModal:r,addToCartDirect:o,botData:a,chatState:i,isTestMode:s}=H(),{t:l}=q(),c=v.useRef(null),[d,u]=v.useState(null),[p,h]=v.useState(1),[f,g]=v.useState("idle"),[m,b]=v.useState(null),[x,y]=v.useState(null),C=t,k=null!=C?.id?String(C.id):null,j=v.useRef(k);if(v.useEffect(()=>{j.current!==k&&(j.current=k,null!=k&&(u(null),h(1),g("idle"),b(null),y(null)))},[k]),!C)return null;const S=x??C.selected_color??null,z=(S?C.variant_summary?.options?.flatMap(e=>e.values).find(e=>e.value===S&&e.image)?.image:null)||C.image,A=(C.currency||a?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD",E=()=>{c.current&&(clearTimeout(c.current),c.current=null),u(null),h(1),g("idle"),b(null),y(null),r(null)},R="focus_mode"===n?E:void 0,T=d?.canAdd??!1,_=d?.priceCents??null,W=null!=_?me(_/100*p,A):null,L=Ge(e),M=!T&&"added"!==f,B="added"===f?`✓ ${l("addedToCart")}`:T?W?l("addQty").replace("{qty}",String(p)).replace("{price}",W):l("addToCartFull"):l("selectOptionsToContinue"),F=(e,t,n)=>w.jsx(I,{variant:"ghost",size:"xs",minW:`${L.stepper}px`,h:`${L.stepper}px`,borderRadius:0,fontSize:`${L.stepperFont}px`,color:t?"mutedText":"text",disabled:t||"adding"===f||"added"===f,onClick:n,"aria-label":e,children:e}),O=w.jsxs(G,{align:"stretch",gap:e.space(1.5),pb:e.space(1),children:[w.jsxs(Y,{gap:e.space(2.5),align:"center",children:[w.jsxs(Y,{gap:e.space(0),border:"1px solid",borderColor:"borderColor",borderRadius:e.radius(10),overflow:"hidden",flexShrink:0,children:[F("−",p<=1,()=>h(e=>Math.max(1,e-1))),w.jsx(Z,{fontSize:`${L.stepperFont}px`,fontWeight:600,minW:`${L.qtyWidth}px`,textAlign:"center",color:"text",fontFamily:V,children:p}),F("+",p>=10,()=>h(e=>Math.min(10,e+1)))]}),w.jsxs(I,{flex:1,h:`${L.cta}px`,borderRadius:`${L.ctaRadius}px`,fontSize:`${M?L.ctaHintFont:L.ctaFont}px`,fontWeight:600,bg:"primary",color:"buttonText",gap:e.space(1.5),disabled:!T&&"added"!==f||"adding"===f,loading:"adding"===f,onClick:async()=>{if(!d?.canAdd||"adding"===f||"added"===f)return;g("adding"),b(null);const e=null!=C.id?String(C.id):void 0,t=d.variantId?{variant_id:d.variantId,product_id:e,product_name:C.name,quantity:p}:{product_id:e,product_name:C.name,product_url:C.url,selected_options:d.selectedOptions,quantity:p},n=xe(C,a);if(n)return void Er(n.href,s);const r=await o(t);"success"===r.type?(g("added"),Ae("variant_modal_added",{assistantId:a?.assistant_id,threadId:i.threadId,payload:{product_id:C.id,selected:d.selectedLabel,quantity:p}}),c.current=setTimeout(E,900)):"failed"===r.type&&"busy"===r.reason?g("idle"):(g("error"),b(ye(r,l)||null))},_hover:{opacity:.92},fontFamily:V,"data-sheet-initial-focus":"true",children:[w.jsx(fn,{boxSize:`${L.ctaIcon}px`,flexShrink:0}),w.jsx(D,{as:"span",minW:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:B})]})]}),"error"===f&&w.jsx(Z,{fontSize:e.font(11),color:"error",fontFamily:V,children:m||l("errorOccurred")})]});return w.jsx(Bo,{open:!0,onClose:E,onBack:R,title:l("chooseOptions"),footer:O,children:w.jsxs(G,{align:"stretch",gap:e.space(3),pb:e.space(2),children:[w.jsxs(Y,{gap:e.space(2.5),align:"center",children:[z&&w.jsx(N,{src:z,alt:C.name,w:e.length(52),h:e.length(52),objectFit:"cover",borderRadius:e.radius(10),flexShrink:0,bg:"lightBackground"}),w.jsxs(D,{minW:0,children:[w.jsx(Z,{fontSize:e.font(13),fontWeight:600,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:V,children:C.name}),w.jsx(Z,{fontSize:e.font(12),color:"mutedText",fontFamily:V,children:d?.selectedLabel||(C.price?me(C.price,A):"")})]})]}),w.jsx(Br,{product:C,controlled:!0,selectedColor:S,onColorChange:y,onSelectionChange:e=>{u(e),"error"===f&&(g("idle"),b(null))}},String(C.id))]})})},Do=()=>{const e=P(),{shortlist:t,removeFromShortlist:n,shortlistOpen:r,setShortlistOpen:o,enterFocusMode:a,sendMessage:i,botData:s,chatState:l}=H(),{t:c}=q();if(v.useEffect(()=>{r&&Ae("shortlist_opened",{assistantId:s?.assistant_id,threadId:l.threadId,payload:{count:t.length}})},[r]),!r)return null;const d=()=>o(!1),u=(e,t)=>{const n=(t||s?.currency||"USD").split(" - ")[0]?.trim().toUpperCase()||"USD";return me(e,n)},p=t.length>=2?w.jsx(I,{w:"full",h:e.length(40),borderRadius:e.radius(12),fontSize:e.font(14),fontWeight:600,bg:"primary",color:"buttonText",onClick:()=>{const e=t.map(e=>e.name).join(", "),n=t.map(e=>e.id).join(", "),r=c("compareSavedIntent").replace("{names}",e);Ae("shortlist_compare_clicked",{assistantId:s?.assistant_id,threadId:l.threadId,payload:{count:t.length}}),d(),i({message:r,apiMessage:`${r} (product ids: ${n})`})},_hover:{opacity:.92},fontFamily:V,children:c("compareSaved").replace("{count}",String(t.length))}):void 0;return w.jsx(Bo,{open:!0,onClose:d,title:c("savedProducts"),footer:p,children:w.jsxs(G,{align:"stretch",gap:e.space(1.5),pb:e.space(2),children:[0===t.length&&w.jsx(Z,{fontSize:e.font(13),color:"mutedText",textAlign:"center",py:e.space(6),fontFamily:V,children:c("savedEmpty")}),t.map(t=>w.jsxs(Y,{gap:e.space(2.5),align:"center",p:e.space(1.5),borderRadius:e.radius(12),cursor:"pointer",onClick:()=>{d(),a(t,"shortlist")},_hover:{bg:"lightBackground"},transition:"background 0.15s",children:[t.image&&w.jsx(N,{src:t.image,alt:t.name,w:e.length(44),h:e.length(44),objectFit:"cover",borderRadius:e.radius(10),flexShrink:0,bg:"lightBackground",border:"1px solid",borderColor:"borderColor"}),w.jsxs(D,{minW:0,flex:1,children:[w.jsx(Z,{fontSize:e.font(13),fontWeight:600,color:"text",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontFamily:V,children:t.name}),!!t.price&&t.price>0&&w.jsx(Z,{fontSize:e.font(12),color:"mutedText",fontFamily:V,children:u(t.price,t.currency)}),t.price_on_request&&w.jsx(Z,{fontSize:e.font(12),color:"mutedText",fontFamily:V,children:c("priceOnRequest")})]}),w.jsx(Ut,{"aria-label":c("removeSaved"),size:"xs",variant:"ghost",minW:e.length(28),w:e.length(28),h:e.length(28),p:e.space(0),borderRadius:"full",color:"primary",css:{"@media (hover: hover)":{"&:hover":{background:"var(--chakra-colors-lightBackground)"}}},onClick:e=>{e.stopPropagation(),n(t.id)},children:w.jsx(mn,{boxSize:e.length(14)})})]},String(t.id)))]})})},Ho=({isOpen:n,onClose:r,isExpanded:o=!1,onToggleExpand:a,fullPageHref:i,pendingChat:s,onPendingChatConsumed:l})=>{const{sendMessage:c,addWelcomeMessage:u,resetBot:p,chatState:h,focusedProduct:f}=H(),{showSuggestionScreen:g,goToChat:m,goToSuggestion:b}=(n=>{const[r,o]=v.useState(!0),a=v.useRef(!1),i=v.useRef(!1);return v.useEffect(()=>{if(!i.current){const n=e();t()&&n.length>0&&(a.current=!0,o(!1),console.log("Skipping welcome screen - existing messages found:",n.length)),i.current=!0}},[]),v.useEffect(()=>{n&&!a.current?o(!0):n&&a.current&&o(!1)},[n]),{showSuggestionScreen:r,goToChat:v.useCallback(()=>{a.current=!0,o(!1)},[]),goToSuggestion:v.useCallback(()=>{a.current=!1,o(!0)},[])}})(n);v.useEffect(()=>{g&&(h.isRequestInProgress||f)&&m()},[g,h.isRequestInProgress,f,m]);const{isMobile:x}=ee(),y=v.useRef(!1);v.useEffect(()=>{n&&!y.current&&(d(),y.current=!0)},[n]);const C=x,k=(e,t,n)=>{m(),u(),c({message:e,imageUrl:t,apiMessage:n})};v.useEffect(()=>{if(n&&s){const e=setTimeout(()=>{k(s.message,s.imageUrl,s.apiMessage),l?.()},100);return()=>clearTimeout(e)}},[n,s]);return w.jsxs(ko,{showSuggestionScreen:g,isOpen:n,isExpanded:o,children:[g?w.jsx(zr,{onStartChat:k,isMobile:C,isExpanded:o,onToggleExpand:a,fullPageHref:i,onClose:r}):w.jsx(wo,{header:w.jsx(wn,{onClose:r,isMobile:C,isExpanded:o,onToggleExpand:a,fullPageHref:i,onReload:()=>{p(),b()}})}),w.jsx(Mo,{onClose:r}),w.jsx(Fo,{}),w.jsx(Do,{})]})};function Po(e,t=!1){const n=e?.feature_flags,r=(t?n?.mobile_fab_scale:void 0)??n?.fab_scale??e?.customization?.avatar_fab_scale;return"number"==typeof r&&Number.isFinite(r)?Math.min(1.5,Math.max(.4,r)):1}const qo="0 6px 20px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06)",Oo={size:"xs",flexShrink:0,h:"32px",px:3,borderRadius:"full",bg:"primary",color:"buttonText",fontSize:"12px",fontWeight:600,fontFamily:V,whiteSpace:"nowrap",transition:"transform 100ms ease-out",_active:{transform:"scale(0.97)"}},No=v.forwardRef(function({icon:e,children:t,action:n,actionBelow:r=!1,onClose:o,closeLabel:a,maxW:i},s){return w.jsxs(Y,{ref:s,gap:2,align:r?"flex-start":"center",maxW:i,minH:"44px",py:r?2.5:1.5,ps:3,pe:1,bg:"background",borderRadius:"22px",border:"1px solid",borderColor:"borderColor",boxShadow:qo,children:[w.jsx(D,{flexShrink:0,display:"flex",color:"primary",mt:r?"2px":0,children:e}),w.jsxs(D,{flex:"1",minW:0,children:[t,r&&n?w.jsx(D,{mt:2,children:n}):null]}),r?null:n,w.jsx(Ut,{size:"xs",variant:"ghost","aria-label":a,onClick:o,flexShrink:0,w:"28px",minW:"28px",h:"28px",borderRadius:"full",color:"text",opacity:.55,transition:"transform 100ms ease-out",_active:{transform:"scale(0.9)"},children:w.jsx(tn,{boxSize:"12px"})})]})}),Yo=()=>!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function Vo(e,t,n,r){const o=v.useRef(null),a=v.useRef(r);a.current=r;const i=v.useRef(n);return i.current=n,v.useEffect(()=>{if(!e)return;o.current?.focus({preventScroll:!0});const n=e=>{const n=o.current;if(!n)return;if("Escape"===e.key)return t&&e.stopPropagation(),void i.current();if(!t||"Tab"!==e.key)return;const r=Array.from(n.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select, textarea, [tabindex]:not([tabindex="-1"])')),a=function(e){return e.getRootNode().activeElement??null}(n),s=r[0],l=r[r.length-1];if(s&&a&&n.contains(a))!e.shiftKey||a!==s&&a!==n?e.shiftKey||a!==l||(e.preventDefault(),s.focus()):(e.preventDefault(),l.focus());else{e.preventDefault();const t=e.shiftKey?l:s;t?t.focus():n.focus()}};return document.addEventListener("keydown",n,!0),()=>{document.removeEventListener("keydown",n,!0),a.current?.()}},[e,t]),o}function Zo({layer:e,open:t,onCollapse:n,onClosed:r,label:o,children:a}){const i=Vo(t,!0,n,r),[s,l]=v.useState(!1);if(v.useEffect(()=>{if(!t)return void l(!1);const e=requestAnimationFrame(()=>l(!0)),n=document.documentElement,r=n.style.overflow;return n.style.overflow="hidden",()=>{cancelAnimationFrame(e),n.style.overflow=r}},[t]),!e)return null;const c=Yo()?void 0:"transform 220ms ease-out, opacity 220ms ease-out";return qt.createPortal(w.jsxs(D,{display:t?"block":"none",children:[w.jsx(D,{position:"fixed",inset:0,zIndex:1000001,bg:"blackAlpha.400",opacity:s?1:0,transition:c,touchAction:"none",onClick:n,"aria-hidden":!0}),w.jsxs(D,{ref:i,role:"dialog","aria-modal":"true","aria-label":o,tabIndex:-1,outline:"none",position:"fixed",left:0,right:0,bottom:0,zIndex:1000002,display:"flex",flexDirection:"column",bg:"background",borderTopRadius:"20px",boxShadow:"0 -8px 32px rgba(0,0,0,0.14)",css:{maxHeight:"85vh","@supports (height: 1dvh)":{maxHeight:"85dvh"}},transform:s||Yo()?"none":"translateY(24px)",opacity:s?1:0,transition:c,children:[w.jsx(D,{as:"button",tabIndex:-1,"aria-hidden":!0,onClick:n,py:2.5,flexShrink:0,cursor:"pointer",children:w.jsx(D,{w:"36px",h:"4px",mx:"auto",borderRadius:"full",bg:"blackAlpha.300"})}),w.jsx(D,{overflowY:"auto",overscrollBehavior:"contain",px:4,pb:"calc(16px + env(safe-area-inset-bottom, 0px))",children:a})]})]}),e)}function Uo({open:e,onCollapse:t,onClosed:n,label:r,children:o,w:a,maxH:i}){const s=Vo(e,!1,t,n),l=v.useRef(t);return l.current=t,v.useEffect(()=>{if(!e)return;const t=e=>{s.current&&!e.composedPath().includes(s.current)&&l.current()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)},[e,s]),w.jsx(D,{ref:s,display:e?"block":"none",role:"dialog","aria-label":r,tabIndex:-1,outline:"none",w:a,maxH:i,overflowY:"auto",overscrollBehavior:"contain",bg:"background",borderRadius:"20px",border:"1px solid",borderColor:"borderColor",boxShadow:qo,p:4,children:o})}function Qo({isMobile:e,layer:t,w:n,maxH:r,...o}){return e?w.jsx(Zo,{layer:t,...o}):w.jsx(Uo,{w:n,maxH:r,...o})}const Ko={size:"xs",borderRadius:"999px",fontSize:"12.5px",fontWeight:600,px:3,h:"28px",fontFamily:V,transition:"transform 100ms ease-out",_active:{transform:"scale(0.97)"}},Go=e=>e&&"Default Title"!==e?e:"";function Xo({api:e,row:t}){const n=e.rowFacts(t),{price:r,note:o}=n,a="added"===t.state?null!=t.paid&&t.paid<r-.005?Math.max(0,t.paid):null:n.pay,i=t.variants.filter(e=>e.available),s="added"===t.state?e.say(null,"added_check"):"sold"===t.state?e.say(null,"sold_out"):e.say(null,"add");return w.jsxs(G,{align:"stretch",gap:1.5,py:2,borderTop:"1px solid",borderColor:"blackAlpha.100","data-dori-guide-row":t.pid,children:[w.jsxs(Y,{align:"flex-start",gap:2,children:[t.image?w.jsx(N,{src:t.image,alt:"",boxSize:"48px",objectFit:"cover",borderRadius:"8px",flexShrink:0,bg:"blackAlpha.50"}):null,w.jsxs(G,{align:"stretch",gap:.5,flex:1,minW:0,children:[w.jsx(Z,{fontSize:"12.5px",lineHeight:"1.3",lineClamp:2,fontFamily:V,color:"text",children:t.title}),w.jsxs(Z,{fontSize:"12.5px",fontFamily:V,color:"text",children:[w.jsx("b",{children:null==a?e.money(r):a<.005?e.say(null,"free"):e.money(a)}),null!=a?w.jsx("s",{style:{marginInlineStart:6,opacity:.6},children:e.money(r)}):null]}),o?w.jsx(Z,{fontSize:"11.5px",color:"mutedText",fontFamily:V,children:o}):null,1===i.length&&Go(i[0].title)?w.jsx(Z,{fontSize:"11.5px",color:"mutedText",fontFamily:V,children:i[0].title}):null]}),w.jsx(I,{...Ko,flexShrink:0,bg:"idle"===t.state?"primary":"blackAlpha.100",color:"idle"===t.state?"buttonText":"text",disabled:"idle"!==t.state||!t.chosen,loading:"adding"===t.state,onClick:()=>{e.add(t.pid)},"aria-label":`${s}: ${t.title}`,children:s})]}),i.length>1&&"added"!==t.state?w.jsx(Y,{gap:1,flexWrap:"wrap",ps:t.image?"56px":0,children:i.map(n=>w.jsx(I,{...Ko,h:"auto",minH:"24px",py:"3px",maxW:"100%",whiteSpace:"normal",textAlign:"start",lineHeight:"1.25",fontWeight:500,variant:"outline","aria-pressed":t.chosen===n.id,bg:t.chosen===n.id?"text":"transparent",color:t.chosen===n.id?"background":"text",onClick:()=>e.choose(t.pid,n.id),children:n.title},n.id))}):null]})}const Jo=({api:e,isMobile:t,layer:n,pillMaxW:r,panelW:o,panelMaxH:a})=>{const{v:i,visible:s}=function(e){const[t,n]=v.useState(e),[r,o]=v.useState(!1);return v.useEffect(()=>{if(e){n(e);const t=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(t)}o(!1);const t=window.setTimeout(()=>n(null),200);return()=>window.clearTimeout(t)},[e]),{v:e??t,visible:!!e&&r}}(e.view),l=v.useRef(null);if(!i)return null;const c=!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches,d=!e.view,u=i.decision,p="add_this"!==u.cta&&"add_it"!==u.cta||!i.rows?.[0]?null:i.rows[0],h=p?.variants.find(e=>e.id===p.chosen)??null,f=p&&h?e.rowFacts(p):null,g=e.say(null,"close")||"Close",m=f?.note??i.note;let b=null;if(i.result)i.result.undoVid&&(b={label:e.say(null,"undo"),run:()=>{e.undo()},quiet:!0});else if("see_picks"===u.cta)b={label:e.say(null,"show_picks"),run:()=>{e.unfold()},opens:!0};else if(p&&"idle"===p.state){const t=f?null==f.pay?e.money(f.price):f.pay<.005?e.say(null,"free"):e.money(f.pay):"",n=h?[e.say(null,"add"),Go(h.title),t].filter(Boolean).join(" · "):"";b=n&&n.length<=40?{label:n,run:()=>{e.add(p.pid)}}:{label:e.say(null,"choose"),run:()=>{e.unfold()},opens:!0}}const x=b?w.jsx(I,{ref:l,...Oo,...b.quiet?{bg:"blackAlpha.100",color:"text"}:{},"aria-haspopup":b.opens?"dialog":void 0,onClick:b.run,children:b.label}):null,y=i.result?w.jsx(Z,{fontSize:"13px",lineHeight:"1.35",color:"text",fontFamily:V,children:i.result.text}):null,C=i.rows??[];return w.jsxs(D,{opacity:s?1:0,transform:s||c?"none":"translateY(8px) scale(0.98)",transformOrigin:"bottom",transition:"opacity 200ms ease-out, transform 200ms ease-out",pointerEvents:d?"none":void 0,"aria-hidden":d||void 0,"data-dori-offer-guide":d?void 0:u.offer,children:[!i.open&&w.jsx(No,{maxW:r,icon:w.jsx(fn,{boxSize:"16px"}),closeLabel:g,onClose:e.close,action:x,actionBelow:!!b&&b.label.length>12,children:w.jsx(D,{"aria-live":"polite",role:i.result?"status":void 0,children:y??w.jsxs(w.Fragment,{children:[w.jsx(Z,{fontSize:"13px",fontWeight:600,lineHeight:"1.35",color:"text",fontFamily:V,children:i.line}),m?w.jsx(Z,{fontSize:"12px",lineHeight:"1.35",color:"mutedText",mt:.5,fontFamily:V,children:m}):null]})})}),i.open&&w.jsx(Qo,{isMobile:t,layer:n,open:!0,label:i.head||i.line,w:o,maxH:a,onCollapse:e.fold,onClosed:()=>l.current?.focus(),children:w.jsxs(G,{align:"stretch",gap:2,children:[w.jsxs(Y,{align:"flex-start",gap:2,children:[w.jsx(Z,{flex:1,fontSize:"13px",fontWeight:600,lineHeight:"1.4",color:"text",fontFamily:V,children:i.line}),w.jsx(Ut,{size:"xs",variant:"ghost","aria-label":g,onClick:e.close,h:"auto",minW:"auto",p:1,color:"text",transition:"transform 100ms ease-out",_active:{transform:"scale(0.9)"},children:w.jsx(tn,{boxSize:"14px"})})]}),i.head?w.jsx(Z,{fontSize:"12px",color:"mutedText",fontFamily:V,children:i.head}):null,null==i.rows?w.jsx(Y,{justify:"center",py:4,children:w.jsx(J,{size:"sm",color:"primary"})}):C.length?C.map(t=>w.jsx(Xo,{api:e,row:t},t.pid)):w.jsx(Z,{fontSize:"12.5px",color:"mutedText",py:2,fontFamily:V,children:e.say(null,"sold_out")}),i.result?w.jsxs(Y,{role:"status","aria-live":"polite",gap:2,pt:1,borderTop:"1px solid",borderColor:"blackAlpha.100",children:[w.jsx(D,{flex:1,children:y}),i.result.undoVid?w.jsx(I,{variant:"plain",size:"xs",h:"auto",p:0,textDecoration:"underline",fontWeight:400,onClick:()=>{e.undo()},children:e.say(null,"undo")}):null]}):null]})})]})},$o="dori-quiz-dismissed";function ea(){try{return"true"===sessionStorage.getItem($o)}catch{return!1}}function ta(){try{sessionStorage.setItem($o,"true")}catch{}}const na=e=>null==e?null:{p:new Set(e.p),v:new Set(e.v||[])},ra=(e,t)=>null===e||e.p.has(t.pid)||e.v.has(t.vid),oa=e=>Math.round(100*e)/100;function aa(e,t=new Date){const n=e.offers.filter(e=>!e.ends_at||new Date(e.ends_at)>t);return{pack:e,offers:n.map(e=>({o:e,scope:na(e.scope),buys:na(e.buys),gets:e.same?na(e.buys):na(e.gets)}))}}const ia=e=>e.reduce((e,t)=>e+t.price*t.qty,0),sa=e=>e.flatMap(e=>Array.from({length:e.qty},()=>({pid:e.pid,vid:e.vid,price:e.price}))),la=(e,t)=>null!=e.pct?t*e.pct:Math.min(e.amount??0,t);function ca(e,t,n){const r=new Map,o=e.offers.filter(e=>"ship"!==e.o.kind).map(e=>"basic"===e.o.kind?function(e,t){const n=e.o,r=sa(t).filter(t=>ra(e.scope,t)),o=r.reduce((e,t)=>e+t.price,0),a=r.length,i=a>0&&(!n.min_amount||o>=n.min_amount)&&(!n.min_qty||a>=n.min_qty),s=i?null!=n.pct?n.pct*o:n.each?r.reduce((e,t)=>e+Math.min(n.amount??0,t.price),0):Math.min(n.amount??0,o):0;return{off:e,applies:i,value:s,disc:i?r:[],amt:o,qty:a,gapAmount:n.min_amount?Math.max(0,n.min_amount-o):null,gapQty:n.min_qty?Math.max(0,n.min_qty-a):null}}(e,t):function(e,t){const n=e.o,r=n.buy_qty||1,o=n.get_qty||1,a=sa(t);if(n.same){const t=a.filter(t=>ra(e.buys,t)).sort((e,t)=>t.price-e.price);let i=Math.floor(t.length/(r+o));n.per_order&&(i=Math.min(i,n.per_order));const s=t.slice(t.length-i*o).sort((e,t)=>e.price-t.price),l=t.length-i*(r+o);return{off:e,applies:i>0,value:s.reduce((e,t)=>e+la(n,t.price),0),disc:s,el:t,earned:l>=r&&(!n.per_order||i<n.per_order)}}const i=a.filter(t=>ra(e.buys,t)),s=a.filter(t=>ra(e.gets,t)).sort((e,t)=>e.price-t.price),l=n.per_order?n.per_order*o:1/0,c=new Set;for(const h of s){if(c.size>=l)break;i.filter(e=>e!==h&&!c.has(e)).length>=r*Math.ceil((c.size+1)/o)&&c.add(h)}const d=s.filter(e=>c.has(e)),u=i.filter(e=>!c.has(e)).length,p=Math.min(Math.floor(u/r)*o,l);return{off:e,applies:d.length>0,value:d.reduce((e,t)=>e+la(n,t.price),0),disc:d,earned:p>d.length,hasGet:s.length>0,hasBuy:u>0}}(e,t));o.forEach(e=>r.set(e.off.o.id,e));const a=o.filter(e=>e.applies&&e.value>0).sort((e,t)=>t.value-e.value),i=a.slice(0,1),s=a.slice(1).some(e=>{return t=i[0].off.o,n=e.off.o,!!t.cw?.[n.cls||"product"]&&!!n.cw?.[t.cls||"product"];var t,n}),l=oa(ia(t))-i.reduce((e,t)=>e+oa(t.value),0),c=e.offers.filter(e=>"ship"===e.o.kind).map(e=>{const t=((e,t)=>!e.countries||!!t.country&&e.countries.includes(t.country))(e.o,n),o={off:e,applies:t&&l>=(e.o.min??0),value:0,disc:[],gap:Math.max(0,(e.o.min??0)-l)};var a,s;return!o.applies||!i.length||(a=i[0].off.o,"rates"===(s=e.o).source||a.ship_ok&&("order"===a.cls?s.with_order:s.with_product))||(o.applies=!1,o.offBy=i[0].off),r.set(e.o.id,o),o}),d=i.concat(c.filter(e=>e.applies));return{st:r,applied:d,ids:new Set(d.map(e=>e.off.o.id)),base:l,stacked:s}}const da=(e,t,n)=>oa(ia(t))-ca(e,t,n).applied.reduce((e,t)=>e+oa(t.value),0);function ua(e,t,n,r){const o=ca(e,t,r);if(o.stacked)return!1;const a=o.applied.reduce((e,t)=>e+t.disc.length,0);return Math.abs(da(e,t,r)-n)<=.01*(a+1)+1e-9}const pa=(e,t,n,r="")=>e.concat([{pid:t,vid:r,qty:1,price:n}]),ha=(e,t,n,r,o,a="")=>da(e,pa(t,n,r,a),o)-da(e,t,o),fa=(e,t,n)=>t.speak&&!n.blocked.has(t.id)&&!("ship"===t.kind&&n.country!==e.pack.main_country)&&(!t.ends_at||new Date(t.ends_at)>new Date),ga=(e,t)=>e.pack.products[t]?.p??0,ma=(e,t)=>e.pack.products[t]?.ty||"",ba=(e,t)=>e.offers.find(n=>"ship"===n.o.kind&&fa(e,n.o,t))?.o??null;function xa(e,t,n){const r=function(e,t,n){const r=e=>!!e&&"basic"===e.off.o.kind&&!e.off.o.scope,o=n.applied.find(e=>r(e));return[...t.ids].filter(e=>!n.ids.has(e)).map(e=>t.st.get(e)).filter(e=>!(e.off.o.free_anyway||r(e)&&o&&o.value>e.value)).map(e=>e.off.o)}(0,t,n);return{block:r.find(e=>"ship"!==e.kind)??null,shipLost:r.find(e=>"ship"===e.kind)??null}}const ya=e=>e.pct??0;function va(e,t){const n=e.applied.find(e=>"basic"===e.off.o.kind&&!e.off.o.scope);return n&&!t.scope&&n.off.o.id!==t.id&&ya(n.off.o)<ya(t)?n.off.o:null}function wa(e,t,n,r,o,a,i){const s=e.offers.find(e=>e.o.id===n)?.o;if(!s||s.ends_at&&new Date(s.ends_at)<=new Date)return!1;const l=ca(e,t,i),c=ca(e,pa(t,r,a,o),i);return c.ids.has(n)&&!c.stacked&&!xa(0,l,c).block}function Ca(e,t,n,r){const o=t.o,a=new Set(n.map(e=>e.pid)),i=t=>!a.has(t)&&!r.sold.has(t)&&!!e.pack.products[t],s=new Set(n.map(t=>ma(e,t.pid)).filter(Boolean)),l=t=>ha(e,n,t,ga(e,t),r);let c=[];if("ship"===o.kind||"basic"===o.kind&&!o.scope&&o.min_amount){const t=e.pack.closers.filter(t=>(t=>!r.sold.has(t)&&!!e.pack.products[t])(t)&&ca(e,pa(n,t,ga(e,t)),r).ids.has(o.id)).map((e,t)=>({id:e,i:t,x:l(e)})).sort((e,t)=>e.x-t.x||e.i-t.i);if(t.length){const n=2*t[0].x;c=[t[0],...t.filter(t=>s.has(ma(e,t.id))&&t.x<=n),...t].map(e=>e.id)}}else if("basic"===o.kind)c=(o.scope?o.picks||[]:e.pack.closers).filter(i);else{c=(o.picks||[]).filter(e=>i(e)&&ra(t.gets,{pid:e,vid:""}));const a=ba(e,r);if(a?.fee){const t=t=>{const o=pa(n,t,ga(e,t));return da(e,o,r)+(ca(e,o,r).ids.has(a.id)?0:a.fee)},o=c.filter(t=>ka(e,n,t,ga(e,t),r)).sort((e,n)=>t(e)-t(n));o.length&&(!c.length||t(o[0])<t(c[0])-.005)&&(c=[o[0],...c])}}return[...new Set(c)].filter(t=>l(t)<=ga(e,t)+.005&&wa(e,n,o.id,t,"",ga(e,t),r)).slice(0,3)}function ka(e,t,n,r,o){const a=ba(e,o);return a&&!ca(e,t,o).ids.has(a.id)&&ca(e,pa(t,n,r),o).ids.has(a.id)?a:null}function ja(e){return null!=e.pct?Math.round(1e3*e.pct)/10+"%":e.amount??0}function Sa(e,t){const n=(t||e.language||"en").toLowerCase(),r=n.split("-")[0],o=e.copy[n]?n:e.copy[r]?r:null;return o?{lang:o,copy:e.copy[o]}:null}const za=new Set(["US","GB","AE","NL","PH","CZ","DO","BS","GM","CF","KM","MV","MH","SB","VA","CD","CG"]),Aa=new Set(["gap","fee","fee_lo","fee_hi","saving","price","paid","eff"]);const Ea=9e3;function Ra(e){const t=Date.parse(e?.checked_at||e?.built_at||"");return e&&Number.isFinite(t)&&Date.now()-t<2592e5?e:null}const Ta=new WeakMap;function _a(e){if(!1===e?.customization?.enable_offer_guide)return!1;const t=Ra(e?.offer_guide);if(!t||!Sa(t,Xe()))return!1;let n=Ta.get(t);return n||(n=aa(t),Ta.set(t,n)),r=n,o=Je($e()??null),r.offers.some(e=>fa(r,e.o,o));var r,o}const Wa=e=>String(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"");function Ia(e,t){const n=t.variants.map(e=>({id:String(e.id),title:String(e.title||""),available:!1!==e.available,price:Number(e.price??0)/100})),r=n.filter(e=>e.available);return{pid:e,title:t.title,image:t.images?.[0]??null,variants:n,chosen:1===r.length?r[0].id:null,state:r.length?"idle":"sold"}}function La(e,t){const n=v.useMemo(()=>Ra(e?.offer_guide),[e?.offer_guide]),o=v.useMemo(()=>n?aa(n):null,[n]),a=v.useMemo(()=>n?Sa(n,Xe()):null,[n]),[i,s]=v.useState(null),[l,c]=v.useState(!1),d=v.useRef(null),u=v.useRef(null),p=v.useRef(!1),h=v.useRef(0),f=v.useRef(t);f.current!==t&&(f.current=t,t||(h.current+=1));const g=v.useRef(null),m=v.useRef(!1),b=$e()??null,x=v.useCallback(e=>{d.current=e,s(e)},[]),y=v.useCallback(e=>{g.current&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{const e=d.current;!e||p.current||e.open||x(null)},e)},[x]),w=v.useCallback((e,t,r={})=>{if(!a||!n)return"";const o=function(e,t,n){return(t?e.copy.offers[t]?.[n]:void 0)??e.copy.ui[n]??null}(a,e,t),i=e?n.offers.find(t=>t.id===e)??null:null;return o?function(e,t,n,r,o){const a={...t};return o&&null==a.off&&(a.off=ja(o)),o?.countries?.length&&null==a.country&&(a.country=function(e,t){try{const n=new Intl.DisplayNames([t],{type:"region"}).of(e)||e;return"en"===t&&za.has(e)?`the ${n}`:n}catch{return e}}(o.countries[0],r)),e.replace(/\{([a-z_]+)\}/g,(e,t)=>{const r=a[t];return null==r?e:"number"!=typeof r||!Aa.has(t)&&"off"!==t?String(r):me(r,n.currency)})}(o,r,n,a.lang,i):""},[a,n]),C=v.useCallback((e,t,n,r,a=()=>!0)=>{if(!o)return null;const i=e.variants.map(i=>({...i,available:i.available&&wa(o,n,t,e.pid,i.id,i.price,r)&&a(i)})),s=i.filter(e=>e.available);if(!s.length)return null;const l=1===s.length?s[0].id:s.some(t=>t.id===e.chosen)?e.chosen:null;return{...e,variants:i,chosen:l}},[o]),k=v.useCallback(async()=>{const e=h.current;if(!o||!a||!t||p.current||et()||tt())return;const n=d.current;if(n&&(n.open||n.result))return;const i=await nt(),s=Je(b);if(!i||i.unknown||i.currency!==o.pack.currency||!ua(o,i.lines,i.total,s))return void(n&&x(null));if(u.current=i,n&&n.cart===rt(i.lines))return;const l=await async function(){const e=window.ShopifyAnalytics?.meta?.product;if(!e?.id||!Array.isArray(e.variants)||!e.variants.length)return null;const t=new URLSearchParams(window.location.search).get("variant"),n=e.variants.find(e=>String(e.id)===t)??(1===e.variants.length?e.variants[0]:null),r=n?Number(n.price)/100:Math.min(...e.variants.map(e=>Number(e.price)/100));return{pid:String(e.id),vid:n?String(n.id):"",price:r}}(),c=function(e,t,n,r){const o=ca(e,t,r);if(o.stacked)return{quiet:"two discounts combine here"};const a=ia(t);if(n&&!t.some(e=>e.pid===n.pid)){const a=pa(t,n.pid,n.price,n.vid),i=ca(e,a,r),{block:s,shipLost:l}=xa(0,o,i),c=i.applied.filter(t=>fa(e,t.off.o,r)&&(!o.ids.has(t.off.o.id)||t.value>(o.st.get(t.off.o.id)?.value??0)+.001));if(c.length&&!s&&!i.stacked){const i=c[0],s=i.off.o,d={offer:s.id,cta:"add_this",picks:[n.pid],shipNote:!!l};if("ship"===s.kind)return{...d,key:t.length?"page_add":"page_alone",vars:{}};if("basic"===s.kind){const e=va(o,s);return e?{...d,key:"page_move",vars:{from:ja(e)}}:{...d,key:"page_add",vars:{}}}if(s.same){const n=da(e,a,r)-da(e,t,r);return{...d,key:"page_add",vars:{n:i.el?.length??0},costsNothing:Math.abs(n)<.005}}return{...d,key:ra(i.off.gets,n)?"page_get":"page_buy",vars:{}}}}for(const i of e.offers){const n=i.o,a=o.st.get(n.id);if("bxgy"!==n.kind||!a.earned||!fa(e,n,r))continue;const s=Ca(e,i,t,r);if(!s.length)continue;const l=s[0],c=ca(e,pa(t,l,ga(e,l)),r);if(!c.ids.has(n.id)||c.stacked)continue;const{block:d,shipLost:u}=xa(0,o,c);if(d)continue;if(n.same){const t=Math.min(ga(e,l),...(a.el??[]).map(e=>e.price));if(la(n,t)<.2*ga(e,l))continue;return{offer:n.id,key:"earned",vars:{},cta:"see_picks",picks:s,shipNote:!!u}}const p=!!i.gets&&1===i.gets.p.size;return{offer:n.id,key:"earned",vars:{},cta:p?"add_it":"see_picks",picks:s,shipNote:!!u}}for(const i of e.offers){const n=i.o,a=o.st.get(n.id);if("bxgy"!==n.kind||n.same||!a.hasGet||a.hasBuy||r.infoSeen.has(`lost-${n.id}`)||!fa(e,n,r))continue;const s=t.find(e=>ra(i.gets,e));if(s)return{offer:n.id,key:"lost",vars:{price:s.price},cta:"info",picks:[],shipNote:!1,once:`lost-${n.id}`}}for(const i of e.offers){const n=i.o,s=o.st.get(n.id);if(!fa(e,n,r)||s.applies||!t.length)continue;const l="ship"===n.kind?s.gap??0:"basic"===n.kind&&!n.scope&&n.min_amount?s.gapAmount??0:0;if(l>0){if(l>.5*a)continue;const s=Ca(e,i,t,r);if(!s.length)continue;const c=s[0];if("basic"===n.kind&&ha(e,t,c,ga(e,c),r)>.8*ga(e,c))continue;const d=ca(e,pa(t,c,ga(e,c)),r),{block:u,shipLost:p}=xa(0,o,d);if(u||d.stacked)continue;const h={offer:n.id,cta:"see_picks",picks:s,shipNote:!!p};if("ship"===n.kind)return null!=n.fee?{...h,key:"gap_fee",vars:{gap:l,fee:n.fee}}:n.fee_range?{...h,key:"gap_fee",vars:{gap:l,fee_lo:n.fee_range[0],fee_hi:n.fee_range[1]}}:{...h,key:"gap",vars:{gap:l}};const f=va(o,n);return f?{...h,key:"gap_move",vars:{gap:l,from:ja(f)}}:{...h,key:"gap",vars:{gap:l}}}if("basic"===n.kind&&n.min_qty&&1===s.gapQty){const a=Ca(e,i,t,r);if(!a.length)continue;const s=ca(e,pa(t,a[0],ga(e,a[0])),r),{block:l,shipLost:c}=xa(0,o,s);if(!s.ids.has(n.id)||l||s.stacked)continue;const d=n.scope?null:va(o,n);return{offer:n.id,key:d?"one_more_move":"one_more",vars:d?{from:ja(d)}:{},cta:"see_picks",picks:a,shipNote:!!c}}}if(n)for(const i of e.offers){const t=i.o,a=o.st.get(t.id);if(!r.infoSeen.has(t.id)&&!o.ids.has(t.id)&&fa(e,t,r)){if("basic"===t.kind){if(!t.scope||!t.min_qty||!ra(i.scope,n))continue}else{if("bxgy"!==t.kind)continue;if(!ra(i.buys,n)||(t.same?(a.el?.length??0)>0:a.hasBuy))continue}return{offer:t.id,key:"info",vars:{},cta:"info",picks:[],shipNote:!1,once:t.id}}}return{quiet:"nothing true and worth saying here"}}(o,i.lines,l,s);if("quiet"in c)return void(n&&x(null));if("info"===c.cta&&m.current)return;const g=`${c.offer}|${c.key}|${rt(i.lines)}|${l?.pid??""}`;if(n?.sig===g||ot(g))return;const v=o.pack.offers.find(e=>e.id===c.offer)??null,k={sig:g,cart:rt(i.lines),decision:c,offer:v,line:w(c.offer,c.key,c.vars)+(c.costsNothing?` ${w(null,"costs_nothing")}`:""),note:c.shipNote?w(null,"ship_note"):null,head:"see_picks"===c.cta&&w(c.offer,"picks_head")||null,open:!1,rows:null,result:null,used:!1};if(k.line){if("add_this"===c.cta||"add_it"===c.cta){const e=c.picks[0],t=o.pack.products[e]?.h??("add_this"===c.cta?window.location.pathname.match(/\/products\/([^/?#]+)/)?.[1]:null),n=t?await he(decodeURIComponent(t)).catch(()=>null):null;if(!n)return;const r=Ia(e,n),a=t=>!c.costsNothing||Math.abs(ha(o,i.lines,e,t.price,s,t.id))<.005,d="sold"===r.state?null:C(r,c.offer,i.lines,s,a);if(!d)return;if("add_this"===c.cta&&l?.vid&&d.variants.some(e=>e.id===l.vid&&e.available)&&(d.chosen=l.vid),"add_it"===c.cta&&!d.chosen){const e=i.lines.find(e=>e.vt&&d.variants.some(t=>t.available&&Wa(t.title)===Wa(e.vt))),t=e&&d.variants.find(t=>t.available&&Wa(t.title)===Wa(e.vt));t&&(d.chosen=t.id,k.line=w(c.offer,"earned_size",c.vars)||k.line)}k.rows=[d]}e===h.current&&f.current&&(at(g),m.current=!0,c.once&&it(c.once),st(k.line,i),x(k),y(15e3),r("offer_guide_shown",{offer:c.offer,key:c.key,cta:c.cta,kind:v?.kind,lang:a.lang}))}},[o,a,t,b,w,x,y,C]),j=v.useCallback(async()=>{try{await k()}finally{c(!0)}},[k]);v.useEffect(()=>{if(!o||!a||!t)return;let e=null;const n=window.setTimeout(()=>{j()},1500),r=()=>{e&&window.clearTimeout(e),e=window.setTimeout(()=>{j()},800)};return window.addEventListener(lt,r),()=>{window.clearTimeout(n),e&&window.clearTimeout(e),window.removeEventListener(lt,r)}},[o,a,t,j]),v.useEffect(()=>()=>{h.current+=1,g.current&&window.clearTimeout(g.current)},[]);const S=v.useCallback(e=>{const t=d.current;t&&x(e(t))},[x]),z=v.useCallback(async()=>{const e=d.current;if(!e||!o)return;if(e.open)return;if(g.current&&window.clearTimeout(g.current),ct(),r("offer_guide_unfolded",{offer:e.decision.offer,key:e.decision.key}),e.rows)return void S(e=>({...e,open:!0}));S(e=>({...e,open:!0}));const t=Je(b),n=(await Promise.all(e.decision.picks.map(async n=>{const r=o.pack.products[n]?.h,a=r?await he(r).catch(()=>null):null;if(!a)return null;const i=Ia(n,a);return"sold"===i.state&&dt(n),"sold"===i.state||t.sold.has(n)?null:C(i,e.decision.offer,u.current?.lines??[],t)}))).filter(e=>!!e);S(t=>t.sig===e.sig?{...t,rows:n}:t)},[o,b,S,C]),A=v.useCallback(()=>{const e=d.current;e?.open&&(S(e=>({...e,open:!1})),e.used&&y(Ea))},[S,y]),E=v.useCallback(e=>{const t=e.variants.find(t=>t.id===e.chosen)??e.variants.filter(e=>e.available).sort((e,t)=>e.price-t.price)[0],r=t?.price??0,a=u.current?.lines??[];if(!o||!n||"added"===e.state)return{price:r,pay:null,note:null};const i=Je(b),s=ca(o,a.concat([{pid:e.pid,vid:t?.id??"",qty:1,price:r}]),i).applied.find(t=>"bxgy"===t.off.o.kind&&t.disc.some(t=>t.pid===e.pid)),l=ha(o,a,e.pid,r,i,t?.id??""),c=[];let d=null;s&&Math.abs(l-r)>.005?d=Math.max(0,l):Math.abs(l-r)>.005&&c.push(w(null,"adds_to_total",{eff:l}));const p=ka(o,a,e.pid,r,i);return p&&c.push(w(p.id,"reaches")),function(e,t,n,r,o,a){return!!xa(0,ca(e,t,a),ca(e,pa(t,n,o,r),a)).shipLost}(o,a,e.pid,t?.id??"",r,i)&&c.push(w(null,"ship_note")),{price:r,pay:d,note:c.filter(Boolean).join(" · ")||null}},[o,n,b,w]),R=v.useCallback((e,t)=>{S(n=>({...n,rows:n.rows?.map(n=>n.pid===e?{...n,chosen:t}:n)??null}))},[S]),T=v.useCallback(async e=>{const t=d.current,a=t?.rows?.find(t=>t.pid===e);if(!t||!a||!a.chosen||!o||p.current)return;const i=a.variants.find(e=>e.id===a.chosen);if(!i)return;p.current=!0,g.current&&window.clearTimeout(g.current),S(t=>({...t,rows:t.rows?.map(t=>t.pid===e?{...t,state:"adding"}:t)??null}));const s=Je(b),l=await nt();if(!Ra(n)||!l||l.unknown||l.currency!==o.pack.currency||rt(l.lines)!==t.cart||!ua(o,l.lines,l.total,s)||!wa(o,l.lines,t.decision.offer,e,i.id,i.price,s))return p.current=!1,x(null),void j();const c=await ut(i.id,t.decision.offer),h="success"===c.type||"out_of_stock"===c.reason?l:await nt(),f="success"===c.type||!!h&&pt(h,i.id)>pt(l,i.id);let m,v=!1,C="idle",k=null;if(f){C="added";const n=await nt();u.current=n;const c=!!n&&!n.unknown&&n.currency===l.currency;if(k=c&&"bxgy"===t.offer?.kind?oa(n.total-l.total):null,c&&ua(o,n.lines,n.total,s)){const r=function(e,t,n,r,o,a,i,s){const l=e.offers.find(e=>e.o.id===t)??null,c=l?.o??null,d=s??da(e,r,i)-da(e,n,i),u=ca(e,r,i),p=ca(e,n,i).applied.find(e=>"ship"===e.off.o.kind),h=p?u.st.get(p.off.o.id):void 0,f=!(!p||!h||h.applies||!h.offBy||p.off.o.free_anyway),g=(e,t={},n=!1)=>({key:e,from:"ui",vars:t,ok:n,shipNote:f});if(!c)return d<a-.005?g("added_cost",{eff:d}):g("added");if("ship"===c.kind){const t=u.st.get(c.id);return fa(e,c,i)?t.applies?{key:"added_reached",from:"offer",vars:{},ok:!0,shipNote:f}:{key:"added_gap",from:"offer",vars:{gap:t.gap??0},ok:!0,shipNote:f}:g("added")}const m=u.applied.find(e=>e.off.o.id===c.id);if(d<a-.005){if(!m)return g("added_cost",{eff:d});if("basic"===c.kind)return{key:"added",from:"offer",vars:{saving:oa(m.value)},ok:!0,shipNote:f};if(c.same){const t=m.disc[0];return t?{key:"added",from:"offer",vars:{title:e.pack.products[t.pid]?.t??"",price:t.price},ok:!0,shipNote:f}:g("added_cost",{eff:d},!0)}return"bxgy"!==c.kind||m.disc.some(e=>e.pid===o)?{key:"added",from:"offer",vars:{paid:oa(d),price:a},ok:!0,shipNote:f}:g("added_cost",{eff:d},!0)}if(Math.abs(d-a)<.005){if("bxgy"===c.kind&&!c.same){const t=m?.disc.find(e=>e.pid!==o),n=t?e.pack.products[t.pid]?.t:null;if(n)return{key:"added_full_went",from:"offer",vars:{title:n},ok:!1,shipNote:f}}return g("added_full")}return g("added_cost",{eff:d})}(o,t.decision.offer,l.lines,n.lines,e,i.price,s,k);m=w("offer"===r.from?t.decision.offer:null,r.key,r.vars)+(r.shipNote?` ${w(null,"ship_note")}`:""),v=r.ok}else m=w(null,"added");const d=t.offer;d&&"ship"!==d.kind&&c&&n.total-l.total>=i.price-.005&&!ca(o,n.lines,s).ids.has(d.id)&&ht(d.id),ft(a.title),r("offer_guide_add",{offer:t.decision.offer,ok:!0,promised:v,kind:d?.kind})}else"out_of_stock"===c.reason?(dt(e),C="sold",m=w(null,"sold_out_now")):h?m=w(null,"add_failed"):(C="unsure",m=w(null,"unsure")),r("offer_guide_add",{offer:t.decision.offer,ok:!1,reason:h?c.reason:"unread"});gt(m),p.current=!1,S(t=>({...t,used:!0,rows:t.rows?.map(t=>t.pid===e?{...t,state:C,paid:k}:t)??null,result:{text:m,ok:v,undoVid:"added"===C?i.id:null}})),y(Ea)},[o,b,w,S,y,x,j]),_=v.useCallback(async()=>{const e=d.current,t=e?.result?.undoVid;if(!e||!t||p.current)return;p.current=!0,g.current&&window.clearTimeout(g.current);const n=await mt(t,e.decision.offer),o="done"===n;p.current=!1,r("offer_guide_undo",{offer:e.decision.offer,ok:o});const a=e.rows?.find(e=>e.variants.some(e=>e.id===t));o&&a&&bt(a.title),S(e=>({...e,rows:o?e.rows?.map(e=>e.variants.some(e=>e.id===t)?{...e,state:"idle",paid:null}:e)??null:e.rows,result:{text:w(null,o?"removed":"failed"===n?"undo_failed":"unsure"),ok:!1,undoVid:"failed"===n?t:null}})),u.current=await nt(),y(Ea)},[w,S,y]),W=v.useCallback(()=>{const e=d.current;h.current+=1,xt(),ta(),yt(),vt(),x(null),r("offer_guide_closed",{offer:e?.decision.offer,used:!!e?.used})},[x]),I=v.useCallback(e=>me(e,n?.currency),[n?.currency]);return{view:i,looked:l,unfold:z,fold:A,choose:R,add:T,undo:_,close:W,rowFacts:E,say:w,money:I}}const Ma=v.forwardRef(function({hookText:e,cta:t,maxW:n,onStart:r,onDismiss:o},a){return w.jsx(No,{maxW:n,icon:w.jsx(ln,{boxSize:"16px"}),closeLabel:"Close",onClose:o,action:w.jsx(I,{ref:a,...Oo,onClick:r,children:t}),children:w.jsx(D,{as:"button",onClick:r,w:"full",textAlign:"start",cursor:"pointer",tabIndex:-1,children:w.jsx(Z,{fontSize:"13px",fontWeight:600,color:"text",lineHeight:"1.3",lineClamp:2,fontFamily:V,children:e})})})});function Ba(e,t,n,r){const o=e%10,a=e%100;return 1===o&&11!==a?t:o>=2&&o<=4&&(a<12||a>14)?n:r}const Fa={English:{subtitle:e=>`Answer ${e} quick question${e>1?"s":""} for personalized recommendations`,cta:"Start →",skip:"Or open chat instead"},Czech:{subtitle:e=>`Odpovězte na ${e} ${1===e?"otázku":"otázky"} pro personalizovaná doporučení`,cta:"Začít →",skip:"Nebo otevřít chat"},German:{subtitle:e=>`Beantworten Sie ${e} kurze Frage${e>1?"n":""} für persönliche Empfehlungen`,cta:"Starten →",skip:"Oder Chat öffnen"},Hungarian:{subtitle:e=>`Válaszolj ${e} gyors kérdésre személyre szabott ajánlásokért`,cta:"Indítás →",skip:"Vagy nyisd meg a chatet"},Persian:{subtitle:e=>`به ${e} سوال کوتاه پاسخ بدید تا پیشنهادات شخصی دریافت کنید`,cta:"شروع →",skip:"یا چت را باز کنید"},French:{subtitle:e=>`Répondez à ${e} question${e>1?"s":""} rapide${e>1?"s":""} pour des recommandations personnalisées`,cta:"Commencer →",skip:"Ou ouvrir le chat"},Spanish:{subtitle:e=>`Responde ${e} pregunta${e>1?"s":""} rápida${e>1?"s":""} para recomendaciones personalizadas`,cta:"Empezar →",skip:"O abrir el chat"},Arabic:{subtitle:e=>`أجب عن ${e} ${1===e?"سؤال سريع":"أسئلة سريعة"} للحصول على توصيات مخصصة`,cta:"ابدأ →",skip:"أو افتح المحادثة"},Turkish:{subtitle:e=>`Kişiselleştirilmiş öneriler için ${e} hızlı soruyu yanıtlayın`,cta:"Başla →",skip:"Veya sohbeti aç"},Portuguese:{subtitle:e=>`Responda ${e} pergunta${e>1?"s":""} rápida${e>1?"s":""} para recomendações personalizadas`,cta:"Começar →",skip:"Ou abrir o chat"},Italian:{subtitle:e=>`Rispondi a ${e} ${1===e?"domanda veloce":"domande veloci"} per raccomandazioni personalizzate`,cta:"Inizia →",skip:"Oppure apri la chat"},Japanese:{subtitle:e=>`${e}つの質問に答えるだけで、あなたにぴったりのおすすめをご提案します`,cta:"はじめる →",skip:"チャットで相談する"},Chinese:{subtitle:e=>`回答${e}个简单问题,获取专属推荐`,cta:"开始 →",skip:"或直接打开聊天"},Korean:{subtitle:e=>`${e}개의 간단한 질문에 답하고 맞춤 추천을 받아보세요`,cta:"시작하기 →",skip:"또는 채팅 열기"},Russian:{subtitle:e=>`Ответьте на ${e} ${Ba(e,"короткий вопрос","коротких вопроса","коротких вопросов")}, чтобы получить персональные рекомендации`,cta:"Начать →",skip:"Или открыть чат"},Ukrainian:{subtitle:e=>`Дайте відповідь на ${e} ${Ba(e,"коротке запитання","короткі запитання","коротких запитань")}, щоб отримати персональні рекомендації`,cta:"Почати →",skip:"Або відкрити чат"},Polish:{subtitle:e=>`Odpowiedz na ${e} ${function(e){if(1===e)return"krótkie pytanie";const t=e%10,n=e%100;return t>=2&&t<=4&&(n<12||n>14)?"krótkie pytania":"krótkich pytań"}(e)}, aby otrzymać spersonalizowane rekomendacje`,cta:"Zacznij →",skip:"Lub otwórz czat"},Slovak:{subtitle:e=>`Odpovedzte na ${e} ${1===e?"krátku otázku":e<5?"krátke otázky":"krátkych otázok"} a získajte odporúčania na mieru`,cta:"Začať →",skip:"Alebo otvoriť chat"},Bulgarian:{subtitle:e=>`Отговорете на ${e} ${1===e?"кратък въпрос":"кратки въпроса"} за персонални препоръки`,cta:"Започни →",skip:"Или отвори чата"},Croatian:{subtitle:e=>`Odgovorite na ${e} ${Ba(e,"kratko pitanje","kratka pitanja","kratkih pitanja")} za osobne preporuke`,cta:"Započni →",skip:"Ili otvori chat"},Dutch:{subtitle:e=>`Beantwoord ${e} korte ${1===e?"vraag":"vragen"} voor persoonlijke aanbevelingen`,cta:"Starten →",skip:"Of open de chat"},Swedish:{subtitle:e=>`Svara på ${e} ${1===e?"snabb fråga":"snabba frågor"} för personliga rekommendationer`,cta:"Börja →",skip:"Eller öppna chatten"},Norwegian:{subtitle:e=>`Svar på ${e} ${1===e?"raskt spørsmål":"raske spørsmål"} for personlige anbefalinger`,cta:"Start →",skip:"Eller åpne chatten"},Danish:{subtitle:e=>`Svar på ${e} ${1===e?"hurtigt spørgsmål":"hurtige spørgsmål"} for personlige anbefalinger`,cta:"Start →",skip:"Eller åbn chatten"},Finnish:{subtitle:e=>`Vastaa ${e} lyhyeen kysymykseen ja saat henkilökohtaisia suosituksia`,cta:"Aloita →",skip:"Tai avaa chat"},Estonian:{subtitle:e=>`Vasta ${e} lühikesele küsimusele ja saa isikupärastatud soovitusi`,cta:"Alusta →",skip:"Või ava vestlus"},Latvian:{subtitle:e=>`Atbildiet uz ${e} ${e%10==1&&e%100!=11?"īsu jautājumu":"īsiem jautājumiem"} un saņemiet personalizētus ieteikumus`,cta:"Sākt →",skip:"Vai atvērt tērzēšanu"},Lithuanian:{subtitle:e=>`Atsakykite į ${e} ${e%10==1&&e%100!=11?"trumpą klausimą":e%10>=2&&(e%100<10||e%100>=20)?"trumpus klausimus":"trumpų klausimų"} ir gaukite asmeninių rekomendacijų`,cta:"Pradėti →",skip:"Arba atidarykite pokalbį"},Greek:{subtitle:e=>`Απαντήστε σε ${e} ${1===e?"σύντομη ερώτηση":"σύντομες ερωτήσεις"} για εξατομικευμένες προτάσεις`,cta:"Έναρξη →",skip:"Ή ανοίξτε τη συνομιλία"},Romanian:{subtitle:e=>`Răspunde la ${e} ${1===e?"întrebare scurtă":"întrebări scurte"} pentru recomandări personalizate`,cta:"Începe →",skip:"Sau deschide chatul"},Albanian:{subtitle:e=>`Përgjigjuni ${e} ${1===e?"pyetjeje të shkurtër":"pyetjeve të shkurtra"} për rekomandime të personalizuara`,cta:"Fillo →",skip:"Ose hap bisedën"},Hebrew:{subtitle:e=>1===e?"ענו על שאלה קצרה אחת לקבלת המלצות מותאמות אישית":`ענו על ${e} שאלות קצרות לקבלת המלצות מותאמות אישית`,cta:"התחלה →",skip:"או פתחו את הצ׳אט"},Urdu:{subtitle:e=>`ذاتی سفارشات کے لیے ${e} مختصر ${1===e?"سوال":"سوالات"} کے جواب دیں`,cta:"شروع کریں →",skip:"یا چیٹ کھولیں"},Hindi:{subtitle:e=>`व्यक्तिगत सुझावों के लिए ${e} ${1===e?"छोटे सवाल":"छोटे सवालों"} का जवाब दें`,cta:"शुरू करें →",skip:"या चैट खोलें"},Bengali:{subtitle:e=>`ব্যক্তিগত সুপারিশ পেতে ${e}টি ছোট প্রশ্নের উত্তর দিন`,cta:"শুরু করুন →",skip:"অথবা চ্যাট খুলুন"},Tamil:{subtitle:e=>`தனிப்பட்ட பரிந்துரைகளுக்கு ${e} சிறிய ${1===e?"கேள்விக்கு":"கேள்விகளுக்கு"} பதிலளிக்கவும்`,cta:"தொடங்கு →",skip:"அல்லது அரட்டையைத் திற"},Telugu:{subtitle:e=>`వ్యక్తిగత సిఫార్సుల కోసం ${e} చిన్న ${1===e?"ప్రశ్నకు":"ప్రశ్నలకు"} సమాధానం ఇవ్వండి`,cta:"ప్రారంభించండి →",skip:"లేదా చాట్ తెరవండి"},Thai:{subtitle:e=>`ตอบคำถามสั้นๆ ${e} ข้อ เพื่อรับคำแนะนำเฉพาะคุณ`,cta:"เริ่มเลย →",skip:"หรือเปิดแชท"},Vietnamese:{subtitle:e=>`Trả lời ${e} câu hỏi ngắn để nhận gợi ý dành riêng cho bạn`,cta:"Bắt đầu →",skip:"Hoặc mở trò chuyện"},Indonesian:{subtitle:e=>`Jawab ${e} pertanyaan singkat untuk rekomendasi yang dipersonalisasi`,cta:"Mulai →",skip:"Atau buka obrolan"},Malay:{subtitle:e=>`Jawab ${e} soalan ringkas untuk cadangan yang diperibadikan`,cta:"Mula →",skip:"Atau buka sembang"},Swahili:{subtitle:e=>`Jibu ${1===e?"swali 1 fupi":`maswali ${e} mafupi`} upate mapendekezo yanayokufaa`,cta:"Anza →",skip:"Au fungua gumzo"},Filipino:{subtitle:e=>`Sagutin ang ${e} maikling tanong para sa mga personal na rekomendasyon`,cta:"Simulan →",skip:"O buksan ang chat"},Iraqi:{subtitle:e=>`جاوب على ${e} ${1===e?"سؤال سريع":"أسئلة سريعة"} حتى تحصل على اقتراحات تناسبك`,cta:"ابدأ →",skip:"أو افتح المحادثة"},Amharic:{subtitle:e=>`ለግል ምክሮች ${e} አጭር ጥያቄ${1===e?"":"ዎች"}ን ይመልሱ`,cta:"ጀምር →",skip:"ወይም ውይይቱን ይክፈቱ"},Burmese:{subtitle:e=>`သင့်အတွက် အကြံပြုချက်များ ရရန် မေးခွန်းတို ${e} ခုကို ဖြေဆိုပါ`,cta:"စတင်ရန် →",skip:"သို့မဟုတ် ချက်တင်ကို ဖွင့်ပါ"},Gujarati:{subtitle:e=>`વ્યક્તિગત ભલામણો માટે ${e} ટૂંકા ${1===e?"પ્રશ્નનો":"પ્રશ્નોના"} જવાબ આપો`,cta:"શરૂ કરો →",skip:"અથવા ચેટ ખોલો"},Hausa:{subtitle:e=>`Amsa ${1===e?"tambaya 1 gajera":`tambayoyi ${e} gajeru`} don samun shawarwari na musamman`,cta:"Fara →",skip:"Ko buɗe hira"},Igbo:{subtitle:e=>`Zaa ajụjụ ${e} dị mkpụmkpụ maka ndụmọdụ ahaziri gị`,cta:"Malite →",skip:"Ma ọ bụ mepee nkata"},Kannada:{subtitle:e=>`ವೈಯಕ್ತಿಕ ಶಿಫಾರಸುಗಳಿಗಾಗಿ ${e} ಚಿಕ್ಕ ${1===e?"ಪ್ರಶ್ನೆಗೆ":"ಪ್ರಶ್ನೆಗಳಿಗೆ"} ಉತ್ತರಿಸಿ`,cta:"ಪ್ರಾರಂಭಿಸಿ →",skip:"ಅಥವಾ ಚಾಟ್ ತೆರೆಯಿರಿ"},Khmer:{subtitle:e=>`ឆ្លើយសំណួរខ្លីៗ ${e} ដើម្បីទទួលបានការណែនាំសម្រាប់អ្នក`,cta:"ចាប់ផ្តើម →",skip:"ឬបើកការជជែក"},Lao:{subtitle:e=>`ຕອບຄຳຖາມສັ້ນໆ ${e} ຂໍ້ ເພື່ອຮັບຄຳແນະນຳສະເພາະທ່ານ`,cta:"ເລີ່ມ →",skip:"ຫຼື ເປີດແຊັດ"},Malayalam:{subtitle:e=>`വ്യക്തിഗത ശുപാർശകൾക്കായി ${e} ചെറിയ ${1===e?"ചോദ്യത്തിന്":"ചോദ്യങ്ങൾക്ക്"} ഉത്തരം നൽകുക`,cta:"തുടങ്ങുക →",skip:"അല്ലെങ്കിൽ ചാറ്റ് തുറക്കുക"},Marathi:{subtitle:e=>`वैयक्तिक शिफारशींसाठी ${e} ${1===e?"छोट्या प्रश्नाचे":"छोट्या प्रश्नांची"} उत्तरे द्या`,cta:"सुरू करा →",skip:"किंवा चॅट उघडा"},Mongolian:{subtitle:e=>`Танд тохирсон зөвлөмж авахын тулд ${e} богино асуултад хариулна уу`,cta:"Эхлэх →",skip:"Эсвэл чат нээх"},Nepali:{subtitle:e=>`व्यक्तिगत सुझावका लागि ${e} वटा छोटा प्रश्नको जवाफ दिनुहोस्`,cta:"सुरु गर्नुहोस् →",skip:"वा च्याट खोल्नुहोस्"},Pashto:{subtitle:e=>`د شخصي وړاندیزونو لپاره ${e} لنډو ${1===e?"پوښتنې":"پوښتنو"} ته ځواب ورکړئ`,cta:"پیل →",skip:"یا چیټ پرانیزئ"},Punjabi:{subtitle:e=>`ਨਿੱਜੀ ਸਿਫ਼ਾਰਸ਼ਾਂ ਲਈ ${e} ਛੋਟੇ ${1===e?"ਸਵਾਲ":"ਸਵਾਲਾਂ"} ਦੇ ਜਵਾਬ ਦਿਓ`,cta:"ਸ਼ੁਰੂ ਕਰੋ →",skip:"ਜਾਂ ਚੈਟ ਖੋਲ੍ਹੋ"},Sinhala:{subtitle:e=>`ඔබට ගැළපෙන නිර්දේශ ලබා ගැනීමට කෙටි ප්‍රශ්න ${e}කට පිළිතුරු දෙන්න`,cta:"අරඹන්න →",skip:"නැතහොත් කතාබහ විවෘත කරන්න"},Somali:{subtitle:e=>`Ka jawaab ${e} ${1===e?"su'aal gaaban":"su'aalood oo gaagaaban"} si aad u hesho talooyin kuu gaar ah`,cta:"Bilow →",skip:"Ama fur wada-sheekaysiga"},Yoruba:{subtitle:e=>`Dáhùn ìbéèrè kúkúrú ${e} láti gba àbá tó bá ọ mu`,cta:"Bẹ̀rẹ̀ →",skip:"Tàbí ṣí ìjíròrò"},Zulu:{subtitle:e=>`Phendula ${1===e?"umbuzo omfushane o-1":`imibuzo emifushane engu-${e}`} ukuze uthole iziphakamiso ezenzelwe wena`,cta:"Qala →",skip:"Noma vula ingxoxo"},Afrikaans:{subtitle:e=>`Beantwoord ${e} kort ${1===e?"vraag":"vrae"} vir persoonlike aanbevelings`,cta:"Begin →",skip:"Of maak die klets oop"}},Da={subtitle:e=>`Beantworte ${e} kurze Frage${e>1?"n":""} für persönliche Empfehlungen`,cta:"Starten →",skip:"Oder Chat öffnen"};function Ha(e,t=!1){const n=wt(e),r=Object.keys(Fa).find(e=>e.toLowerCase()===n.toLowerCase()),o=Fa[e]||Fa[n]||(r?Fa[r]:void 0)||Fa.English;return t&&o===Fa.German?Da:o}let Pa=!1;const qa=({quiz:e,isMobile:t,layer:n,pillMaxW:r,panelW:o,panelMaxH:a})=>{const{phase:i,open:s,flow:l,text:c,handleStart:d,handleDismiss:u,handleCollapse:p,handleComplete:h,handleSkipToChat:f}=e,g=v.useRef(null);if("hidden"===i||!l)return null;const m={isMobile:t,layer:n,w:o,maxH:a,onCollapse:p,onClosed:()=>g.current?.focus()};return w.jsxs(w.Fragment,{children:[!s&&w.jsx(Ma,{ref:g,hookText:l.welcome_hook,cta:c.cta,maxW:r,onStart:d,onDismiss:u}),"expanded"===i&&w.jsxs(Qo,{...m,open:s,label:l.entry_label,children:[w.jsx(kr,{flow:l,onComplete:h,onClose:u}),w.jsx(D,{as:"button",onClick:f,display:"block",mx:"auto",mt:1,fontSize:"12px",color:"mutedText",textDecoration:"underline",fontFamily:V,cursor:"pointer",children:c.skip})]})]})},Oa={own:3e3,hook:6400};function Na(e){const t=e.codePointAt(0)??0;return t>=19968&&t<=40959||t>=13312&&t<=19903||t>=12352&&t<=12543?4:t>=44032&&t<=55215?3:t>=1536&&t<=1791||t>=1872&&t<=1919?1.6:1}function Ya(e){const t=e?.feature_flags?.bubble_seconds;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:null}function Va(e){const t=e?.feature_flags?.bubble_stay;return"until_closed"===t?"until_closed":"seconds"===t&&null!==Ya(e)?"seconds":"read"}function Za(e,t,n,r=Oa.own){const o=Va(e);if("until_closed"===o)return null;if("seconds"===o)return 1e3*Math.min(20,Math.max(3,Ya(e)));const a="own"===n?r:Oa[n];return Math.min(1e4,Math.max(a,function(e){let t=0;for(const n of e)t+=Na(n);return Math.round(1e3+55*t)}(t)))}const Ua=["homepage","category","product","search","cart","other"],Qa={home:"homepage",collection:"category",product:"product",searchresults:"search",search:"search",cart:"cart"};function Ka(){if("undefined"==typeof window)return"other";try{const e=window.ShopifyAnalytics?.meta?.page?.pageType;if("string"==typeof e&&e)return Qa[e.toLowerCase()]??"other"}catch{}return Ct()}function Ga(e){return!(!function(e,t=Ka()){const n=function(e){const t=e?.customization?.quiz_pages;if(!Array.isArray(t))return null;const n=Ua.filter(e=>t.includes(e));return n.length?n:null}(e);return null===n||n.includes(t)}(e)||"product"===Ka()&&_a(e))}const Xa=({onClick:e,suppressBubble:t=!1,slot:n})=>{const{botData:r,diagnosticFlow:o,diagnosticShown:a,proactiveSuppressedThisSession:i,suppressProactiveForSession:s,effectiveFabCta:l,handover:c,handoverUnread:d}=H(),{t:h}=q(),f=Bt("colors","primary"),g=Bt("colors","background"),m=Bt("colors","lightBackground"),b=oe(f),x=Array.isArray(f)?f[0]:f,y=kt(g,m),C=function(e,t){if(t)return null;const n=e?.feature_flags?.fab_pill_each_page_seconds;return"number"!=typeof n||!Number.isFinite(n)||n<=0?null:Math.min(10,Math.max(1,n))}(r,!!Pn(r)),k="until_closed"===Va(r)&&!r?.customization?.disable_welcome_popup,[j,S]=v.useState(()=>k&&!jt()||!k&&!St()&&!zt()&&u()||null!==C&&!tt()?"expanded":"minimized"),[z,A]=v.useState(!1),[E,R]=v.useState(!1),[T,_]=v.useState(!1),[W,L]=v.useState(!1),[M,B]=v.useState(!1),F=v.useRef(null),P=()=>{F.current&&(clearTimeout(F.current),F.current=null)},O=yr(r?.merchant_support_channels).length>0,U=()=>{P(),!ee&&O&&(_(!0),L(!0))};v.useEffect(()=>()=>P(),[]);const Q=!0!==r?.customization?.disable_idle_animation,{getStarfieldTransform:K,getIconStyle:G}=Hn({enableTwinkling:Q,enableFloating:Q,enableRotation:Q,enableScaling:Q}),X=v.useRef(!1),J=v.useRef(0),$=v.useRef(null),ee=Ot({base:!0,md:!1})??!1,te=On(r,ee),ne=Pn(r),re=!!ne,ae=Po(r,ee),ie=(e,t)=>function(e,t,n){return{base:`${Math.round(e*n)}px`,md:`${Math.round(t*n)}px`}}(e,t,ae),se=function(e,t){return t&&!0===e?.feature_flags?.fab_transparent}(r,re),le=function(e,t){return!t&&!0===e?.feature_flags?.fab_always_expanded}(r,re),ce=function(e){return!0===e?.feature_flags?.fab_icon_only}(r),de=l??(r?.agent_name?h("askAgent").replace("{name}",r.agent_name):h("askDori")),ue=v.useRef(null),[pe,he]=v.useState(null);v.useEffect(()=>{let e=!1;const t=()=>{const t=ue.current;!e&&t&&he(t.scrollWidth)};return t(),document.fonts?.ready?.then(t).catch(()=>{}),()=>{e=!0}},[de,ee]);const fe=(()=>{if(null==pe)return{base:"120px",md:"150px"};const e=ee?120:150,t=2*(ee?8:12),n=Math.round((ee?20:24)*ae),r=ee?280:360,o=t+8+n+pe+2;return`${Math.min(r,Math.max(e,o))}px`})(),ge=!0===r?.customization?.enable_standalone_quiz&&Ga(r)&&o&&!a?o.welcome_hook:null,me=!ge,be=v.useRef(zt()),xe=k?jt():i,ye=t||xe||!k&&me&&be.current?null:function(e,t){return t||function(e){return e?.feature_flags?.bubble_text?.trim()||null}(e)}(r,ge),ve=()=>{if(k&&jt())return;p();const e=++J.current;S("expanded"),R(!1),B(!1);const t=setTimeout(()=>{if(J.current===e&&(A(!0),!r?.customization?.disable_welcome_popup)){const t=setTimeout(()=>{if(J.current!==e)return;R(!0);const t=Za(r,ye??"","own",1e3*(C??3));if(null===t)return;const n=setTimeout(()=>{J.current===e&&(R(!1),setTimeout(()=>{J.current===e&&S("minimized")},300))},t);return()=>clearTimeout(n)},100);return()=>clearTimeout(t)}},100);return()=>clearTimeout(t)},we=()=>{S("minimized"),R(!1);const e=setTimeout(()=>{A(!0)},0);return()=>clearTimeout(e)},Ce=e=>{const t=++J.current;S("expanded"),R(!1);const n=setTimeout(()=>A(!0),100),r=setTimeout(()=>{J.current===t&&S("minimized")},100+1e3*e);return()=>{clearTimeout(n),clearTimeout(r)}};v.useEffect(()=>{X.current||(X.current=!0,k?jt()||ge?we():ve():St()?null===C||tt()?we():Ce(C):!ge||r?.customization?.disable_welcome_popup?!zt()&&u()?ve():null!==C?Ce(C):we():we())},[]),v.useEffect(()=>{const e=setInterval(()=>{St()||zt()||u()&&ve()},1e3);return()=>clearInterval(e)},[]),v.useEffect(()=>{if(!ge)return;if(r?.customization?.disable_welcome_popup)return;if(k?jt():St())return;J.current++,$.current&&(clearTimeout($.current),$.current=null),B(!0),S("expanded");const e=setTimeout(()=>{R(!0)},400),t=Za(r,ge,"hook"),n=null===t?null:setTimeout(()=>{R(!1),$.current=setTimeout(()=>{S("minimized"),$.current=null},350)},t);return()=>{clearTimeout(e),n&&clearTimeout(n),$.current&&(clearTimeout($.current),$.current=null)}},[ge]);const ke=v.useRef(null);v.useEffect(()=>{if(E&&ye&&!r?.customization?.disable_welcome_popup){if(me){if(zt())return;return At(),void Et(!1)}ke.current!==ye&&(ke.current=ye,Et(!0))}},[E,ye]);const je=()=>{Tt(),e&&(e(),"minimized"===j&&(R(!1),setTimeout(()=>{S("expanded"),setTimeout(()=>{r?.customization?.disable_welcome_popup||setTimeout(()=>{R(!0)},50)},100)},0)))},Se=je,ze=ce||!le&&("minimized"===j||re),Ae=function(e){const t=e.hasAvatarFab&&e.animationsEnabled&&e.isMinimized&&!e.isMenuOpen;return{breathe:t,halo:t&&!e.isTransparentFab}}({hasAvatarFab:re,animationsEnabled:Q,isMinimized:ze,isMenuOpen:T,isTransparentFab:se}),Ee=Nn(te,r,ee),Re="right"===te.align?"32px 0px 32px 32px":"0px 32px 32px 32px";return w.jsxs(D,{position:"relative",transform:z?Ee?"translateY(0) scale(1)":`translateY(calc(-50% + ${te.bottomSpacing}px)) scale(1)`:Ee?"translateY(100px) scale(0.9)":`translateY(calc(-50% + ${te.bottomSpacing}px + 100px)) scale(0.9)`,opacity:z?1:0,onMouseLeave:()=>{ee||(P(),F.current=setTimeout(()=>{_(!1),L(!1)},100))},children:[w.jsx(wr,{channels:r?.merchant_support_channels,isOpen:T,onToggle:()=>_(!T),isMobile:ee,onMouseEnter:U,onChatClick:e}),w.jsx(D,{visibility:T?"hidden":void 0,"aria-hidden":T||void 0,children:n}),"expanded"===j&&ye&&!r?.customization?.disable_welcome_popup&&w.jsx(D,{position:"absolute",bottom:"100%",[te.align]:"0",mb:2,w:{base:"70vw",md:"25vw"},maxW:{base:"300px",md:"300px"},bg:y,borderRadius:"16px",p:2,pe:3,boxShadow:M?"0 8px 32px rgba(0,0,0,0.16), 0 0 0 1.5px rgba(120,120,200,0.13)":"lg",opacity:E?1:0,transform:E?"translateY(0) scale(1)":M?"translateY(20px) scale(0.88)":"translateY(10px) scale(0.95)",transition:E?M?"opacity 0.5s ease, transform 0.7s cubic-bezier(0.22, 1.61, 0.36, 1), box-shadow 0.4s ease":"opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1)":"opacity 0.25s ease, transform 0.25s ease",cursor:"pointer",onClick:Se,children:w.jsxs(Y,{gap:1,align:"center",width:"100%",justifyContent:"flex-start",children:[w.jsx(Ut,{size:"xs",variant:"ghost","aria-label":"Close",onClick:e=>{e.stopPropagation(),s(),vt(),xt(),ta(),R(!1),setTimeout(()=>S("minimized"),300)},color:"text",_hover:{"@media (hover: hover) and (pointer: fine)":{bg:"rgba(0,0,0,0.1)"}},h:"auto",p:1,children:w.jsx(tn,{boxSize:"16px"})}),w.jsx(Z,{fontSize:"12px",fontWeight:"400",color:"text",lineHeight:"1.75",flex:1,width:"100%",fontFamily:V,children:ye})]})}),Ae.breathe&&w.jsx("style",{children:"\n @keyframes dori-avatar-breathe {\n 0%, 100% { scale: 1; }\n 50% { scale: 1.06; }\n }\n @keyframes dori-avatar-halo {\n 0% { box-shadow: 0 0 0 0 var(--dori-halo); }\n 70%, 100% { box-shadow: 0 0 0 12px var(--dori-halo-end); }\n }\n .dori-avatar-breathe {\n animation: dori-avatar-breathe 3s ease-in-out infinite;\n }\n .dori-avatar-breathe.dori-avatar-halo {\n animation:\n dori-avatar-breathe 3s ease-in-out infinite,\n dori-avatar-halo 3s ease-out infinite;\n }\n @media (prefers-reduced-motion: reduce) {\n .dori-avatar-breathe { animation: none !important; }\n }\n "}),w.jsx(I,{borderRadius:ze?"50%":Re,borderWidth:0,bg:se?"transparent":b,color:"text",border:"none !important",w:ze?ie(48,56):fe,minW:ze?ie(48,56):fe,h:ze?ie(48,56):"auto",p:ze?"0":{base:2,md:3},overflow:"hidden",transition:"width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), min-width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), border-radius 0.4s ease, padding 0.3s ease, transform 0.2s ease",onClick:je,className:["fab-glass",Ae.breathe&&"dori-avatar-breathe",Ae.halo&&"dori-avatar-halo"].filter(Boolean).join(" "),_hover:{"@media (hover: hover) and (pointer: fine)":{transform:"scale(1.05)"}},style:{borderRadius:ze?"50%":Re,cursor:"pointer",touchAction:"manipulation",WebkitTapHighlightColor:"transparent",...Ae.halo?{"--dori-halo":Rt(x,.5),"--dori-halo-end":Rt(x,0)}:{}},onMouseEnter:U,justifyContent:"center",children:w.jsxs(Y,{gap:ze?0:2,position:"relative",w:"full",justify:ze?"center":"space-between",overflow:"hidden",children:[w.jsx(Z,{fontSize:{base:"14px",md:"16px"},fontWeight:{base:"500",md:"600"},lineHeight:"1.5",whiteSpace:"nowrap",fontFamily:V,color:"background",opacity:ze?0:1,maxW:ze?"0px":"none",transition:"opacity 0.2s ease, max-width 0.35s ease",overflow:"hidden",ref:ue,children:de}),!T&&(ne?w.jsx(N,{src:ne,alt:"",role:"presentation",boxSize:ie(52,60),borderRadius:"full",objectFit:"cover",flexShrink:0}):w.jsx(xn,{boxSize:ie(20,24),color:"background",transform:K(j,te),...G(),flexShrink:0}))]})}),d>0&&!T&&w.jsx(D,{position:"absolute",top:ie(-6,-6),..."right"===te.align?{left:ie(-6,-6)}:{right:ie(-6,-6)},minW:"20px",h:"20px",px:"5px",borderRadius:"full",bg:"#E5484D",color:"white",fontSize:"12px",fontWeight:"600",fontFamily:V,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",boxShadow:"0 0 0 2px white",role:"status","aria-label":h("handoverUnread").replace("{team}",c?.teamName||h("handoverTheTeam")),"data-dori-handover-unread":d,children:d>9?"9+":d})]})};let Ja=!1;const $a=v.forwardRef(function({bubble:e,settled:t,styles:n,onClick:r,quiz:o,sheetLayer:a},i){const{botData:s}=H(),l=Ot({base:!0,md:!1})??!1,[c,u]=v.useState(!1),p=La(s,!1!==s?.customization?.enable_offer_guide&&t&&!c),h=_a(s),[f,g]=v.useState(!1);v.useEffect(()=>{if(!h||!t||p.looked)return;const e=window.setTimeout(()=>g(!0),5e3);return()=>window.clearTimeout(e)},[h,t,p.looked]),v.useEffect(()=>{p.view&&(Ja=!0)},[p.view]);const m=!h||p.looked||f,b=Ja||!!p.view,x=c?"quiz":p.view?"guide":o.eligible&&t&&m&&!b?"quiz":null,y=function({speaking:e,onOpenWidget:t,onStartChat:n,onDismissed:r,onEngagedChange:o}){const{diagnosticFlow:a,diagnosticShown:i,markDiagnosticShown:s,effectiveLanguage:l,informalAddress:c,suppressProactiveForSession:u}=H(),[p,h]=v.useState("hidden"),[f,g]=v.useState(!1),m=!!a&&!i&&!ea();return v.useEffect(()=>{o("expanded"===p)},[p]),v.useEffect(()=>()=>o(!1),[]),v.useEffect(()=>{if("expanded"!==p){if("hidden"===p&&e&&m){const e=setTimeout(()=>h("teaser"),800);return()=>clearTimeout(e)}"teaser"!==p||e&&m||h("hidden")}},[p,e,m]),v.useEffect(()=>{"teaser"!==p||Pa||(Pa=!0,d()?.capture("quiz_card_impression",{presentation:"pill"}))},[p]),{phase:p,open:f,flow:a,text:Ha(l||"English",c),handleStart:()=>{"expanded"!==p&&d()?.capture("quiz_card_started",{presentation:"pill"}),h("expanded"),g(!0)},handleDismiss:()=>{ta(),u(),xt(),vt(),d()?.capture("quiz_card_dismiss",{phase:p,presentation:"pill"}),g(!1),h("hidden"),r?.()},handleCollapse:()=>g(!1),handleComplete:(e,t)=>{s(),d()?.capture("quiz_card_completed"),g(!1),h("hidden"),n(e,void 0,t),d()?.capture("quiz_card_widget_opened")},handleSkipToChat:()=>{ta(),s(),d()?.capture("quiz_card_skip_to_chat"),g(!1),h("hidden"),r?.(),t()}}}({speaking:"quiz"===x,onStartChat:o.onStartChat,onOpenWidget:o.onOpenWidget,onDismissed:o.onDismissed,onEngagedChange:u}),C=On(s,l),k=Math.round((l?48:56)*Po(s,l)),j=Nn(C,s,l),S=`calc(100vw - ${2*C.sideSpacing}px)`,z=`min(${l?340:360}px, ${S})`,A=`min(400px, ${S})`,E=j?`max(240px, calc(100vh - ${Yn(C,s)+(e?k+8:0)+16}px))`:`max(240px, calc(50vh + ${C.bottomSpacing+(e?-k/2-8:k/2)-16}px))`,R=w.jsxs(D,{position:"absolute",bottom:e?"100%":0,mb:e?2:0,[C.align]:0,w:"max-content","data-dori-corner-slot":"",children:[w.jsx(Jo,{api:p,isMobile:l,layer:a,pillMaxW:z,panelW:A,panelMaxH:E}),("quiz"===x||c)&&w.jsx(qa,{quiz:y,isMobile:l,layer:a,pillMaxW:z,panelW:A,panelMaxH:E})]}),T=null!==x||b||o.eligible&&!m;return e?w.jsx(D,{ref:i,position:"fixed",zIndex:"1000000",...n,children:w.jsx(Xa,{onClick:r,suppressBubble:T,slot:R})}):w.jsx(D,{position:"fixed",zIndex:"1000000",...n,children:w.jsx(D,{position:"relative",h:`${k}px`,transform:j?void 0:`translateY(calc(-50% + ${C.bottomSpacing}px))`,children:R})})}),ei="dori-chat",ti="#dori-chat",ni={open:!1,expand:!1};function ri(){if("undefined"==typeof window)return!1;try{const e=window.DORI_HIDE_LAUNCHER;if(!0===e||"true"===e)return!0;const t=document.querySelector("script#dori-side-widget");return"true"===t?.getAttribute("data-hide-launcher")}catch{return!1}}function oi({mode:e,askOn:t,askPlaced:n,pageHidden:r}){return!(r||"never"===e||"fallback"===e&&t&&!1!==n)}function ai({mode:e,askOn:t,askPlaced:n,pageHidden:r}){return r||"fallback"!==e||!t||null!==n}function ii(){const[e,t]=v.useState(()=>{const e=document.querySelector("script#dori-side-widget");return"true"===e?.getAttribute("data-test-mode")}),[n,r]=v.useState(!1),[o,a]=v.useState(ri),[i,s]=v.useState(()=>window.__doriAskResult??null),[l,c]=v.useState(!1),d=i?i.placed:!l&&null,[u,p]=v.useState(""),{botData:C,botError:k,updateBotData:j,diagnosticFlow:S,diagnosticShown:z,primeStarter:A,onWidgetOpened:E,setPanelOpen:R}=H(),T=P(),_=v.useRef(C);_.current=C;const W=v.useRef(null),I=v.useCallback(e=>{const t=x(e);if(!t)return!1;const n=_.current;if(!n)return W.current=e??{},!0;const r=g(n.feature_flags,Q(),t);return!!r&&(window.location.assign(r),!0)},[]);v.useEffect(()=>{const e=W.current;C&&e&&(W.current=null,window.doriWidget?.open?.(e))},[C]),function(e){const{isTestMode:t,sendMessage:n,submitFeedback:r,messages:o,inputState:a,chatState:i}=H(),s=v.useRef({open:e,sendMessage:n,submitFeedback:r});s.current={open:e,sendMessage:n,submitFeedback:r},v.useEffect(()=>{if(!t)return;const e=window,n=e=>{const t=String(e||"").trim();t&&(s.current.open(),s.current.sendMessage({message:t}))};return e.doriWidget={...e.doriWidget,ask:n,rateAnswer:(e,t,n)=>s.current.submitFeedback(e,t,n)},()=>{e.doriWidget?.ask===n&&(delete e.doriWidget.ask,delete e.doriWidget.rateAnswer)}},[t]);const l=v.useRef(o);l.current=o;const c=v.useRef(i.threadId);c.current=i.threadId;const d=v.useRef(!1);v.useEffect(()=>{const e="generating"===a,n=d.current&&!e;if(d.current=e,!t||!n)return;const r=window.setTimeout(()=>{const e=l.current.filter(e=>"dori"===e.type),t=e[e.length-1];t&&t.content?.trim()&&window.dispatchEvent(new CustomEvent("dori:test-answer",{detail:{widget:"side",index:e.length-1,text:t.content,threadId:c.current??null}}))},400);return()=>window.clearTimeout(r)},[a,t])}(()=>{M.current="api_open",t(!0)});const L=n&&!T.isMini,M=v.useRef("unknown"),B=v.useRef(e),F=v.useRef(e);F.current=e,v.useEffect(()=>{e&&!B.current&&(E(),Ae("widget_opened",{assistantId:C?.assistant_id,payload:{trigger:M.current}}),M.current="unknown"),B.current=e},[e,C?.assistant_id,E]),v.useEffect(()=>{R(e)},[e,R]);const[q,O]=v.useState(null),[N,Y]=v.useState(!1),V=!0===C?.feature_flags?.base_channel&&!0===C?.customization?.disable_welcome_popup,Z=!0===C?.customization?.enable_standalone_quiz&&Ga(C)&&!!S&&!z&&!N&&!e&&!ea()&&!V&&!et(),[U,G]=v.useState(null),{isCurrentPathBanned:X}=(e=>{const[t,n]=v.useState("");return v.useEffect(()=>{const e=()=>{n(h())};e();const t=()=>{e()};window.addEventListener("popstate",t);const r=history.pushState,o=history.replaceState;return history.pushState=function(...t){r.apply(history,t),e()},history.replaceState=function(...t){o.apply(history,t),e()},()=>{window.removeEventListener("popstate",t),history.pushState=r,history.replaceState=o}},[]),{isCurrentPathBanned:()=>f(t,e)}})(C?.banned_paths||[]);v.useEffect(()=>{e&&vt()},[e]),v.useEffect(()=>{C?.merchant_support_channels?.crisp?.enabled&&(Zn(),Vn()&&window.$crisp.push(["on","chat:closed",()=>{Zn()}]))},[C?.merchant_support_channels?.crisp?.enabled]),v.useEffect(()=>{C?.merchant_support_channels?.chatra?.enabled&&(rr("hideChatraWidget invoked"),Gn=!0,function(e){if(or())return void e();const t=Date.now(),n=setInterval(()=>{or()?(clearInterval(n),e()):Date.now()-t>Qn&&(clearInterval(n),rr("Chatra never became ready within",Qn,"ms"))},200)}(()=>{Xn||ir("initial hide")}),null!==Jn||"undefined"==typeof window||Xn||($n=Date.now(),Jn=setInterval(lr,1e3)))},[C?.merchant_support_channels?.chatra?.enabled]),v.useEffect(()=>{C?.merchant_support_channels?.shopifyInbox?.enabled&&function(){if("undefined"==typeof document)return;if(document.getElementById(ur))return;const e=document.createElement("style");e.id=ur,e.textContent=`\n html:not([${pr}]) ${hr}::part(activator) { display: none !important; }\n html:not([${pr}]) ${fr} { display: none !important; }\n `,document.head.appendChild(e),mr("launcher hidden")}()},[C?.merchant_support_channels?.shopifyInbox?.enabled]),v.useEffect(()=>{if(!u||!C?.is_widget_enabled)return;const e=window.setTimeout(()=>{_t(K.klaviyoStorefront,u)},4e3);return()=>window.clearTimeout(e)},[u,C?.is_widget_enabled]),Wt({sharingId:u});const J=Ot({base:!0,md:!1})??!1,$=On(C,J),ee=((e,t=!1,n=null)=>{const{align:r,sideSpacing:o}=e;return t?{bottom:`${Yn(e,n)}px`,[r]:`${o}px`}:{top:"50%",[r]:`${o}px`}})($,Nn($,C,J),C);v.useEffect(()=>{window.chatbotData?p(window.chatbotData.sharingID):m("useEffect sharing ID",()=>{p((()=>{const e=document.querySelector("script#dori-side-widget");return e?.getAttribute("data-sharing-id")||""})());const e=document.querySelector("script#dori-side-widget");if(!e)return;const t=new MutationObserver(t=>{for(const n of t)if("attributes"===n.type&&"data-sharing-id"===n.attributeName){const t=e.getAttribute("data-sharing-id")||"";p(t),console.log("data-sharing-id changed:",t)}});return t.observe(e,{attributes:!0,attributeFilter:["data-sharing-id"]}),()=>{t.disconnect()}})()},[]);const te=v.useRef(null),ne=v.useRef(!1),re=v.useRef(null);v.useEffect(()=>{const e=e=>s(e.detail??null);return window.addEventListener("dori:ask-button",e),()=>window.removeEventListener("dori:ask-button",e)},[]);const oe=Boolean(C?.feature_flags?.ask_button);v.useEffect(()=>{if(!oe||i)return;const e=setTimeout(()=>c(!0),4e3);return()=>clearTimeout(e)},[oe,i]);const ae={mode:C?.feature_flags?.bubble_mode,askOn:oe,askPlaced:d,pageHidden:o},ie=i??(oe&&l?{zone:"none",device:Dt()}:null);v.useEffect(()=>{if(!ie||ie.pending||!C?.assistant_id)return;let e=!0;try{e=Ht(window.sessionStorage,ie.device)}catch{}e&&Ae("header_entry",{assistantId:C.assistant_id,payload:{zone:ie.zone,spot:ie.spot,label:ie.label,device:ie.device}})},[ie?.zone,ie?.device,ie?.pending,C?.assistant_id]);const se=v.useCallback(()=>{const e=document.getElementById("dori-react-widget-host");e&&e.contains(document.activeElement)&&(ne.current=!0),t(!1)},[]);v.useEffect(()=>{if(!e)return;const t=e=>{if("Escape"!==e.key)return;const t=document.getElementById("dori-react-widget-host");if(!(e.target instanceof Node))return;const n=re.current;(n&&n.contains(e.target)||t&&t.contains(e.target))&&setTimeout(()=>{e.defaultPrevented||se()},0)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e,se]);const le=Sn(),ce=v.useRef(le);ce.current=le,v.useEffect(()=>{if(!e||!ce.current)return;const t=setTimeout(()=>{(function(){const e=document.getElementById("dori-react-widget-host");if(!e)return null;const t=[e];for(;t.length;){const e=t.shift();for(const t of e.querySelectorAll("textarea"))if(t.getClientRects().length)return t;for(const n of e.querySelectorAll("*"))n.shadowRoot&&t.push(n.shadowRoot)}return null})()?.focus({preventScroll:!0})},350);return()=>clearTimeout(t)},[e]),v.useEffect(()=>{if(e||!ne.current)return;ne.current=!1;const t=re.current;re.current=null;const n=requestAnimationFrame(()=>{t?.isConnected?t.focus({preventScroll:!0}):te.current?.querySelector("button.fab-glass")?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(n)},[e]),v.useEffect(()=>{const e=e=>{if(I(e))return;if(y(F.current,e?.source))return void t(!1);M.current=e?.source??(e?.starter?"banner":"api_open");const n=document.activeElement,o=document.getElementById("dori-react-widget-host");re.current=n instanceof HTMLElement&&n!==document.body&&!o?.contains(n)?n:null,t(!0),e?.expand&&r(!0),e?.starter?.greeting&&A({greeting:e.starter.greeting,chips:e.starter.chips,intent:e.intent})},n=()=>t(!1),o=e=>{"cart"===e.detail?.reason&&(ta(),Y(!0)),n()},i=()=>{M.current="api_toggle",t(e=>!e)},s=e=>{j(e)},l=()=>a(!0),c=()=>a(!1),d=window;d.doriWidget={...d.doriWidget,open:e,close:n,toggle:i,updateConfig:s,hideLauncher:l,showLauncher:c},b(t=>e(t));const u=t=>{const n=t.detail;e(n)};return window.addEventListener("dori:open-widget",u),window.addEventListener("dori:close-widget",o),window.addEventListener("dori:toggle-widget",i),window.addEventListener("dori:hide-launcher",l),window.addEventListener("dori:show-launcher",c),()=>{d.doriWidget&&(d.doriWidget.open===e&&delete d.doriWidget.open,d.doriWidget.close===n&&delete d.doriWidget.close,d.doriWidget.toggle===i&&delete d.doriWidget.toggle,d.doriWidget.updateConfig===s&&delete d.doriWidget.updateConfig,d.doriWidget.hideLauncher===l&&delete d.doriWidget.hideLauncher,d.doriWidget.showLauncher===c&&delete d.doriWidget.showLauncher),window.removeEventListener("dori:open-widget",u),window.removeEventListener("dori:close-widget",o),window.removeEventListener("dori:toggle-widget",i),window.removeEventListener("dori:hide-launcher",l),window.removeEventListener("dori:show-launcher",c)}},[j,A,I]),v.useEffect(()=>{const e=function(){if("undefined"==typeof window)return ni;try{const e=new URLSearchParams(window.location.search).get(ei)?.trim().toLowerCase();if("open"===e||"expand"===e)return{open:!0,expand:"expand"===e};if(window.location.hash.toLowerCase()===ti)return{open:!0,expand:!1}}catch{}return ni}();e.open&&(function(){if("undefined"!=typeof window&&window.history?.replaceState)try{const e=new URL(window.location.href);let t=!1;e.searchParams.has(ei)&&(e.searchParams.delete(ei),t=!0),e.hash.toLowerCase()===ti&&(e.hash="",t=!0),t&&window.history.replaceState(window.history.state,"",e.toString())}catch{}}(),e.expand&&I({expand:!0,source:"link"})||(M.current="deep_link",t(!0),e.expand&&r(!0)))},[I]);const de=function({botData:e,botError:t,isPathBanned:n}){return!((!t||e)&&e&&!n&&(!0===e.is_widget_enabled||null===e.is_widget_enabled))}({botData:C,botError:k,isPathBanned:X()});k&&!C&&console.warn("[Dori Widget] bot data unavailable — hiding widget:",k);const ue=v.useCallback((e,n,r)=>{Y(!0),O({message:e,imageUrl:n,apiMessage:r}),M.current="quiz_chat",t(!0)},[]),pe=v.useCallback(()=>{O(null)},[]);return w.jsx(D,{fontFamily:It("system-ui, Avenir, Helvetica, Arial, sans-serif"),lineHeight:"1.5",fontWeight:"400",colorScheme:"light",children:!de&&w.jsxs(w.Fragment,{children:[w.jsx(Ho,{isOpen:e,onClose:se,isExpanded:L,onToggleExpand:T.isMini?void 0:e=>r(void 0===e?!L:e),fullPageHref:g(C?.feature_flags,Q(),"chat"),pendingChat:q,onPendingChatConsumed:pe}),!e&&w.jsx($a,{ref:te,bubble:oi(ae),settled:ai(ae),styles:ee,onClick:()=>{e||(M.current="fab",re.current=null),t(!e)},quiz:{eligible:Z,onStartChat:ue,onOpenWidget:()=>{M.current="quiz_card",t(!0)},onDismissed:()=>Y(!0)},sheetLayer:U}),w.jsx(D,{ref:G,"data-dori-corner-layer":""})]})})}function si(){return w.jsx(ii,{})}console.log("isDevelopment",!1);let li=!1;function ci(){if(li)return console.log("[Dori Widget] Already initialized, skipping"),()=>{};li=!0;const e=[];let t=document.getElementById("dori-react-widget-host");t||(t=document.createElement("div"),t.id="dori-react-widget-host",t.setAttribute("data-nosnippet",""),document.body.appendChild(t));const n=Lt.createRoot(t);n.render(w.jsx(F.StrictMode,{children:w.jsx(_e,{children:w.jsx(Mt,{children:w.jsx(si,{})})})})),e.push(n);const r=()=>{l(()=>import("./MarkdownContent-C15ck6xJ.js"),__vite__mapDeps([0,1,2,3]),import.meta.url).catch(()=>{})};return"function"==typeof window.requestIdleCallback?window.requestIdleCallback(r,{timeout:3e3}):window.setTimeout(r,1500),()=>{e.forEach(e=>e.unmount()),li=!1}}export{ci as initializeDoriWidget};