@dori-ai/dori-side-widget 1.13.171 → 1.13.172

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.
@@ -0,0 +1,2 @@
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{j as e,w as n,r as t,s as a,_ as i,ad as r,af as s,ae as o,ac as l,p as c,b2 as p,a7 as d,b6 as u,b7 as m,Y as h,b4 as g,R as x,ab as f,b5 as b}from"./provider-9Wh21Ch_.js";import{_ as v,g as y,q as w,r as k,A as j,n as z}from"../widget.js";const S={current:null},N={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"},C=()=>e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",strokeWidth:"2",...N,"aria-hidden":!0,children:e.jsx("path",{d:"M12 5v14M5 12h14"})}),A=()=>e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",strokeWidth:"2.4",...N,"aria-hidden":!0,children:e.jsx("path",{d:"m5 12.5 4.5 4.5L19 7.5"})}),_=()=>e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",strokeWidth:"1.8",...N,"aria-hidden":!0,children:e.jsx("path",{d:"M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10Z"})}),P=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",strokeWidth:"1.8",...N,"aria-hidden":!0,children:e.jsx("path",{d:"M5 12h14M13 6l6 6-6 6"})}),q=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",strokeWidth:"2",...N,"aria-hidden":!0,children:e.jsx("path",{d:"m15 5-7 7 7 7"})}),I=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",strokeWidth:"2",...N,"aria-hidden":!0,children:e.jsx("path",{d:"m9 5 7 7-7 7"})}),R=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",strokeWidth:"2",...N,"aria-hidden":!0,children:e.jsx("path",{d:"M6 6l12 12M18 6 6 18"})}),E=()=>e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",strokeWidth:"1.8",...N,"aria-hidden":!0,children:[e.jsx("path",{d:"M5 8h14l-1 13H6L5 8Z"}),e.jsx("path",{d:"M9 8V6a3 3 0 0 1 6 0v2"})]}),D=()=>e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",strokeWidth:"2.2",...N,"aria-hidden":!0,children:e.jsx("path",{d:"M12 19V5M5.5 11.5 12 5l6.5 6.5"})}),F=/\b(colou?rs?|colou?rway|colore|colori|couleurs?|farben?|kleur(en)?|cor(es)?|shade|warna|renk|kolor|barva|f[äa]rg)\b/i,$=/\b(sizes?|taille|gr(ö|oe)(ß|ss)e|talla|maat|tamanho|misura|taglia|storlek|st(ø|o)rrelse|koko|rozmiar|velikost|m(é|e)ret|beden|ukuran)\b/i,L=/\b(siz(e|ing) (down|up)|true to size|(your|their) true size|runs? (small|large|big)|order (one|a) size|fits? (small|large|true))\b/i,M=/detail|feature|highlight|measure|spec|dimension|size ?& ?fit|^fit|fabric|material|content|composition|care/i,U=/size guide|sizing guide|size chart|guideline/i,O=e=>e?e.startsWith("//")?`https:${e}`:e:void 0;function B(e){const n=(e??"").match(/(?:^|\/)products\/([^/?#]+)/);return n?decodeURIComponent(n[1]):null}const W={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",rsquo:"’",lsquo:"‘",rdquo:"”",ldquo:"“",ndash:"-",mdash:"-",hellip:"…",deg:"°",reg:"®",trade:"™",copy:"©",frac12:"½"};function T(e){const n=function(e){return(n=e.replace(/<(script|style)[\s\S]*?<\/\1>/gi,"").replace(/<li[^>]*>\s*/gi,"\n• ").replace(/<br\s*\/?>/gi,"\n").replace(/<\/?(p|div|h[1-6]|ul|ol|tr|table|section|blockquote)[^>]*>/gi,"␞").replace(/<[^>]+>/g,""),n.replace(/&(#x?[0-9a-f]+|[a-z]+[0-9]*);/gi,(e,n)=>{if("#"===n[0]){const t="x"===n[1].toLowerCase()?parseInt(n.slice(2),16):parseInt(n.slice(1),10);return Number.isFinite(t)&&t>0?String.fromCodePoint(t):e}return W[n.toLowerCase()]??e})).split("␞").map(e=>e.split("\n").map(e=>e.replace(/\s+/g," ").trim()).filter(e=>e&&"•"!==e).map(e=>e.replace(/^[-*–]\s+/,"• "))).filter(e=>e.length>0);var n}(e??""),t=[];let a=null;for(const o of n.flat()){const e=o.startsWith("• "),n=e?o.slice(2).trim():o;if(!n)continue;const i=e?null:n.match(/^([^:]{2,40}):\s*(.*)$/);i?(a={label:i[1].trim(),items:i[2]?[i[2].trim()]:[]},t.push(a)):a&&(e||0===a.items.length)?a.items.push(n):a=null}const i=function(e){const n=[];for(const t of e){let e=[],a=[];const i=()=>{e.length&&n.push({type:"p",text:e.join(" ")}),a.length&&n.push({type:"ul",items:a}),e=[],a=[]};for(const n of t)n.startsWith("• ")?(e.length&&i(),a.push(n.slice(2).trim())):(a.length&&i(),e.push(n));i()}return n}(n),r=i.find(e=>"p"===e.type&&L.test(e.text))?.text??i.flatMap(e=>"ul"===e.type?e.items:[]).find(e=>L.test(e))??null;return{sections:t.filter(e=>e.items.length>0&&M.test(e.label)&&!U.test(e.label)).slice(0,3).map(e=>({label:e.label,items:e.items.slice(0,6)})),full:i,tip:r?(s=r,s.length>420?`${s.slice(0,419).trimEnd()}…`:s):null};var s}function Z(e,n,t){return e.variants.filter(a=>!(null!==n&&null!==e.colourIndex&&a.options[e.colourIndex]!==n||null!==t&&null!==e.sizeIndex&&a.options[e.sizeIndex]!==t))}const G=(e,n,t)=>Z(e,n,t).some(e=>e.available);function K(e,n){const t=n?e.variants.find(e=>e.id===String(n)):void 0;if(t)return{price:t.price,compareAt:t.compareAt,from:!1};const a=e.variants.map(e=>e.price);if(0===a.length)return{price:e.price,compareAt:e.compareAt,from:!1};const i=Math.min(...a),r=e.variants.find(e=>e.price===i);return{price:i,compareAt:r?.compareAt??null,from:i<Math.max(...a)}}const X=new Map,Y=new Map;function V(e,{fresh:t=!1}={}){const a=B(e);if(!a)return Promise.resolve(null);let i=t?void 0:X.get(a);return i||(i=fetch(`${n()}products/${encodeURIComponent(a)}.js`,{credentials:"same-origin",...t?{cache:"no-store"}:{}}).then(e=>e.ok?e.json():null).then(e=>e?function(e){const n=(e.options??[]).map(e=>"string"==typeof e?e:e.name),t=(e.options??[]).map(e=>"string"==typeof e?[]:e.values??[]),a=e=>(t[e]?.length??0)>1,i=(e,t)=>{const i=n.findIndex((n,i)=>e.test(n)&&!(t&&t.test(n))&&a(i));return-1===i?null:i},r=i(F),s=i($,F),o=n.findIndex(e=>$.test(e)&&!F.test(e)),l=-1===o?null:o,c=n.some((e,n)=>a(n)&&n!==r&&n!==s),p=!!e.requires_selling_plan||(e.variants??[]).some(e=>!!e.requires_selling_plan||(e.quantity_rule?.min??1)>1||(e.quantity_rule?.increment??1)>1),d=(e.variants??[]).map(e=>{const n="number"==typeof e.price?e.price/100:0,t="number"==typeof e.compare_at_price?e.compare_at_price/100:null;return{id:String(e.id),options:e.options??[e.option1,e.option2,e.option3].filter(e=>!!e),available:!1!==e.available,price:n,compareAt:null!==t&&t>n?t:null,image:O(e.featured_image?.src)}}),u=null===r?[]:t[r].map(e=>{const n=d.filter(n=>n.options[r]===e);return{name:e,image:n.find(e=>e.image)?.image,available:n.some(e=>e.available)}}),m="number"==typeof e.price?e.price/100:0,h="number"==typeof e.compare_at_price?e.compare_at_price/100:null;return{handle:e.handle??"",url:e.url??"",title:e.title??"",vendor:e.vendor??"",productType:e.type??"",price:m,compareAt:null!==h&&h>m?h:null,images:(e.images??[]).map(O).filter(e=>!!e),colourIndex:r,sizeIndex:s,sizeOption:l,colours:u,sizes:null===s?[]:t[s],variants:d,extraOptions:c,sellingRules:p,...T(e.description)}}(e):null).catch(()=>null),X.set(a,i),t&&i.then(e=>{e&&Y.get(a)?.forEach(n=>n(e))})),i}function H(e,n){if(!e)return"";if(!/cdn\.shopify\.com|\/cdn\/shop\//.test(e))return e;const t=e.replace(/([?&])width=\d+&?/,"$1").replace(/[?&]$/,"");return`${t}${t.includes("?")?"&":"?"}width=${n}`}function J(e){const[n,a]=t.useState(void 0);return t.useEffect(()=>{let n=!0;a(void 0),V(e).then(e=>{n&&a(e)});const t=B(e),i=e=>{n&&a(e)};return t&&(Y.has(t)||Y.set(t,new Set),Y.get(t).add(i)),()=>{n=!1,t&&Y.get(t)?.delete(i)}},[e]),n}function Q(e,n){const t=[];for(const a of[e,...n])if(a&&!t.some(e=>{return n=a,e.split("?")[0]===n.split("?")[0];var n})&&t.push(a),5===t.length)break;return t}function ee({photos:n,name:a,width:i,labels:r}){const s=t.useRef(null),[o,l]=t.useState(0),c=e=>{const n=s.current;n&&n.scrollBy({left:e*n.clientWidth,behavior:"smooth"})};return e.jsxs("div",{className:"gal",children:[e.jsx("div",{className:"slides",ref:s,tabIndex:0,"aria-label":r.photos.replace("{name}",a),onScroll:e=>{const n=e.currentTarget;l(Math.round(n.scrollLeft/Math.max(1,n.clientWidth)))},children:n.map((n,t)=>e.jsx("span",{className:"frame",children:e.jsx("img",{src:H(n,i),alt:t?"":a,loading:t?"lazy":void 0})},n))}),n.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"dots",children:n.map((n,t)=>e.jsx("i",{className:t===o?"on":void 0},n))}),e.jsx("button",{type:"button",className:"gnav gprev","aria-label":r.prev,onClick:()=>c(-1),children:e.jsx(q,{})}),e.jsx("button",{type:"button",className:"gnav gnext","aria-label":r.next,onClick:()=>c(1),children:e.jsx(I,{})})]})]})}const ne=/\b(colou?rs?|colou?rway|colore|colori|couleurs?|farben?|kleur(en)?|cor(es)?|shade|warna|renk|kolor|barva|f[äa]rg)\b/i,te=/\b(sizes?|taille|gr(ö|oe)(ß|ss)e|talla|maat|tamanho|misura|taglia|storlek|st(ø|o)rrelse|koko|rozmiar|velikost|m(é|e)ret|beden|ukuran)\b/i,ae=e=>(e??"").trim().toLowerCase(),ie=e=>Object.entries(e.options).find(([e])=>ne.test(e))?.[1]??null;function re(e){const n=e.qualifying_variants;if(!n?.length)return null;const t=ae(e.selected_color);return t&&n.find(e=>ae(ie(e))===t)||n[0]}function se(e,n){const t=n?ae(ie(n)):"";if(t)for(const a of e.variant_summary?.options??[]){if(!ne.test(a.name))continue;const e=a.values.find(e=>ae(e.value)===t)?.image;if(e)return e}return e.image}function oe(e,n){const t=re(e),a=!t&&!!e.is_on_sale&&"number"==typeof e.sale_price&&e.sale_price<e.price,i=n.size,r=i&&t?Object.entries(t.options).find(([e,n])=>ae(e)===ae(i.option)&&ae(n)===ae(i.value))?.[1]:void 0,s=e.variant_summary,o=!t&&!a&&"number"==typeof s?.price_min&&"number"==typeof s?.price_max&&s.price_min<s.price_max?s.price_min:null;return{variant:t,image:se(e,t),price:t?t.price:a?e.sale_price:o??e.price,compareAt:a?e.price:null,from:null!==o,currency:t?e.currency:e.sale_currency||e.currency,...r?{size:r}:{}}}function le(e){let n=null;const t=[],a=new Set,i=new Map;for(const o of e){const e=o.variant_summary?.options.find(e=>te.test(e.name)&&!ne.test(e.name));if(!e)continue;n=n??e.name,o.product_type&&i.set(o.product_type,(i.get(o.product_type)??0)+1);let r=0;for(const n of e.values){const e=t.indexOf(n.value);-1===e&&t.splice(r,0,n.value),r=(-1===e?r:e)+1,n.available&&a.add(n.value)}}const r=t.filter(e=>a.has(e));if(!n||r.length<2)return null;const s=[...i.entries()].sort((e,n)=>n[1]-e[1])[0]?.[0];return{option:n,values:r,...s?{scope:s}:{}}}const ce=(e,n,t)=>({...e,size:{value:t,option:n.option,...n.scope?{scope:n.scope}:{}}});function pe(e){const n={...e};return delete n.size,n}function de(e){const n={...e};return delete n.max_price,n}function ue(e,n){const t=e=>e.size?[ae(e.size.value),ae(e.size.option),ae(e.size.scope)].join("|"):"";return t(e)===t(n)&&(e.max_price??null)===(n.max_price??null)}function me(e,n){const t=e.size;return t?t.scope&&n.product_type&&ae(t.scope)!==ae(n.product_type)?null:t:null}function he(e,n){return!!e.price_on_request||0===n?.price||(e.minimum_quantity??1)>1||!!e.add_quantity||!!e.price_unit||!!n?.extraOptions||!!n?.sellingRules}function ge(e,n,t,a){if(!t.available)return!1;if("number"==typeof a.max_price&&t.price>a.max_price)return!1;const i=me(a,e);return!i||null===n.sizeOption||ae(t.options[n.sizeOption])===ae(i.value)}function xe(e,n,t){if(he(e,n))return{kind:"open"};if(void 0===n)return function(e,n){const t=(e.variant_summary?.options??[]).filter(e=>e.values.length>1);return 0===t.length||!t.some(e=>!te.test(e.name)||ne.test(e.name))&&!!me(n,e)}(e,t)?{kind:"wait"}:{kind:"open"};const a=n?function(e,n,t){if(null!==n.colourIndex)return null;if(null===n.sizeIndex)return 1===n.variants.length?n.variants[0]:null;const a=me(t,e);if(!a)return null;const i=n.sizeIndex,r=n.variants.filter(e=>ae(e.options[i])===ae(a.value));return 1===r.length?r[0]:null}(e,n,t):null;return n&&a&&ge(e,n,a,t)?{kind:"add",request:{variant_id:a.id,product_id:String(e.id),product_name:e.name,product_url:e.url,quantity:1}}:{kind:"open"}}function fe(e){const n=re(e);return n?ie(n):e.selected_color??null}async function be(e,n,t){const a=await V(e.url,{fresh:!0});if(!a)return"unknown";const i=a.variants.find(e=>e.id===String(n));return i&&i.available?t&&!ge(e,a,i,t)?"changed":"ok":"changed"}const ve={"€":"EUR","£":"GBP","₹":"INR","₩":"KRW","₺":"TRY","₽":"RUB","¥":"¥",$:"$"},ye={dollar:"$",dollars:"$",bucks:"$",euro:"EUR",euros:"EUR",pound:"GBP",pounds:"GBP"},we=String.raw`(?:[A-Z]{1,3}\$|[$€£¥₹₩₺₽]|\b(?:${"usd|eur|gbp|cad|aud|nzd|chf|sek|nok|dkk|pln|inr|jpy|cny|hkd|sgd|mxn"})\b)`,ke=String.raw`(\d{1,3}(?:[.,\s]\d{3})+|\d+)(?:[.,](\d{1,2}))?`,je=String.raw`(${we})?\s?${ke}\s?(${we}|dollars?|euros?|pounds?|bucks)?`,ze=new RegExp(String.raw`(?:under|below|less than|cheaper than|no more than|not more than|at most|up to|max(?:imum)?|within|budget(?: of| is)?|moins de|sous|unter|bis zu|menos de|por debajo de|meno di|sotto|abaixo de|até|onder|tot)\s*`+je,"i"),Se=new RegExp(je+String.raw`\s*(?:or less|or under|or below|max(?:imum)?|tops|at most)`,"i"),Ne=new Set(["USD","CAD","AUD","NZD","SGD","HKD","TWD","MXN","CLP","COP","ARS","FJD","JMD","TTD","BSD","BBD","BZD","XCD"]),Ce={US:"USD",USD:"USD",C:"CAD",CA:"CAD",CAD:"CAD",A:"AUD",AU:"AUD",AUD:"AUD",NZ:"NZD",NZD:"NZD",S:"SGD",SG:"SGD",SGD:"SGD",HK:"HKD",HKD:"HKD",NT:"TWD",MX:"MXN",MXN:"MXN",R:"BRL"};function Ae(e){const n=e.toLowerCase();if(ye[n])return ye[n];if(ve[e])return ve[e];const t=e.match(/^([a-z]{1,3})\$$/i);return t?Ce[t[1].toUpperCase()]??null:e.toUpperCase()}function _e(e){const n=e.brand?.trim()||null;return n&&e.name.toLowerCase().startsWith(`${n.toLowerCase()} `)?{brand:n,name:e.name.slice(n.length).trim()}:{brand:n,name:e.name}}function Pe(e,n,t){return e.price_on_request?t:0===n?"":null}const qe=/[??؟]/,Ie=/[^.!??؟。!\n]*[??؟]/gu,Re=new Set(["something","anything","what","which","with","this","that","these","those","your","more","show","have","like","about","want","need","would","could","should","from","there","them","they","some","just","other"]),Ee=e=>e.normalize("NFC").replace(/[*_`]+/g,"").replace(/[“”]/g,'"').replace(/[‘’]/g,"'").replace(/\s+/g," ").trim().toLowerCase(),De=e=>Ee(e).replace(/[\p{P}\p{S}\s]+$/u,""),Fe=e=>e.split(/[^\p{L}\p{N}]+/u).filter(e=>e.length>=4&&!Re.has(e)).map(e=>e.slice(0,4));function $e({product:n,page:t,actions:i}){const{t:r}=a(),s=oe(n,i.rules),o=t?K(t,s.variant?.variant_id):null,l=o?void 0:s.currency,c=o?o.price:s.price,p=o?o.compareAt:s.compareAt,d=Pe(n,c,r("priceOnRequest"));if(null!==d)return e.jsx(e.Fragment,{children:d});const u=i.money(c,l);return e.jsxs(e.Fragment,{children:[null!==p&&e.jsx("s",{children:i.money(p,l)}),(o?o.from:s.from)?r("aiPageFrom").replace("{price}",u):u]})}function Le(e,n,a,i){const r=t.useRef(!1),[s,o]=t.useState(!1);return{checking:s,onAdd:async()=>{if(!r.current){if("add"!==n?.kind||!n.request.variant_id)return i();r.current=!0,o(!0);try{"ok"===await be(e,String(n.request.variant_id),a.rules)?await a.onAdd(e,n.request):i()}finally{r.current=!1,o(!1)}}}}}function Me({product:n,step:t,actions:r}){const{t:s}=a(),o=oe(n,r.rules),l=J(n.url),{brand:c,name:p}=_e(n),d=String(n.id),u=r.inCart.has(d),m=r.saved?.has(d)??!1,h=i(n,r.botData),g=h?null:xe(n,l,r.rules),x=function(e){const n=e.variant_summary?.options.find(e=>ne.test(e.name));return n?n.values.length:0}(n),f=()=>r.onOpen(n,r.rules),b=Le(n,g,r,f);return e.jsxs("div",{className:"card fadein",children:[e.jsxs("div",{className:"phw",children:[e.jsx("button",{type:"button",className:"frame",onClick:f,"aria-label":n.name,children:e.jsx("img",{src:H(o.image,700),alt:"",loading:"lazy"})}),r.saved&&e.jsx("button",{type:"button",className:"save","aria-pressed":m,"aria-label":`${s("saveForLater")}: ${n.name}`,onClick:()=>r.onSave(n),children:e.jsx(_,{})}),!h&&e.jsx("button",{type:"button",className:"qa"+(u?" inbag":""),"aria-label":`${s(u?"aiPageInCart":"addToCartFull")}: ${n.name}`,disabled:(r.busy||"wait"===g?.kind||b.checking)&&!u,onClick:()=>u?r.onCart():void b.onAdd(),children:u?e.jsx(A,{}):e.jsx(C,{})})]}),t?e.jsx("p",{className:"step",children:t}):c&&e.jsx("p",{className:"brand",children:c}),e.jsx("h4",{className:"nm",children:e.jsx("button",{type:"button",onClick:f,children:p})}),e.jsxs("p",{className:"pr",children:[e.jsx($e,{product:n,page:l,actions:r}),x>1&&e.jsx("span",{children:s("aiPageColours").replace("{count}",String(x))})]}),n.description&&e.jsx("p",{className:"wy",children:n.description}),u&&e.jsxs("p",{className:"got",children:[e.jsx(A,{}),s("aiPageInCart")]})]})}function Ue({product:n,tagged:t,nudge:r,actions:s}){const{t:o}=a(),l=oe(n,s.rules),{brand:c,name:p}=_e(n),d=J(n.url),u=String(n.id),m=s.inCart.has(u),h=i(n,s.botData),g=h?null:xe(n,d,s.rules),x=()=>s.onOpen(n,s.rules),f=Le(n,g,s,x);return e.jsxs("div",{className:"pick fadein",children:[e.jsxs("div",{className:"head",children:[t&&e.jsx("p",{className:"tag",children:o("aiPageMyPick")}),c&&e.jsx("p",{className:"brand",children:c}),e.jsx("h3",{className:"name",children:p}),e.jsx("p",{className:"price",children:e.jsx($e,{product:n,page:d,actions:s})})]}),e.jsx(ee,{photos:Q(l.image,d?.images??[]),name:n.name,width:900,labels:{photos:o("aiPagePhotos"),prev:o("aiPagePrev"),next:o("aiPageNext")}}),e.jsxs("div",{className:"body",children:[n.description&&e.jsx("p",{className:"why",children:n.description}),l.size&&e.jsxs("p",{className:"opts",children:[e.jsx(A,{}),o("aiPageInStockSize").replace("{size}",l.size)]}),e.jsxs("div",{className:"acts",children:[h?e.jsx("a",{className:"btn primary",href:h.href,children:o(h.labelKey)}):e.jsx("button",{type:"button",className:"btn primary",disabled:(s.busy||"wait"===g?.kind||f.checking)&&!m,onClick:()=>m?s.onCart():void f.onAdd(),children:m?e.jsxs(e.Fragment,{children:[e.jsx(A,{}),o("aiPageInCart")]}):o("open"!==g?.kind?"addToCartFull":"chooseOptions")}),e.jsx("button",{type:"button",className:"btn ghost",onClick:x,children:o("aiPageSeeDetails")})]}),r&&e.jsxs("p",{className:"nudge",children:[o("aiPageNotSure")," ",e.jsx("button",{type:"button",onClick:()=>s.onAsk(r),children:r})]})]})]})}const Oe=t.lazy(()=>v(()=>import("./MarkdownContent-C15ck6xJ.js"),__vite__mapDeps([0,1,2,3]),import.meta.url));function Be(n,t,a="{size}"){const[i,r]=n.split(a);return e.jsxs(e.Fragment,{children:[i,e.jsx("b",{children:t}),r]})}function We({row:n,cap:t,busy:i,onSize:r,onAllSizes:s,onAnyPrice:o}){const{t:l}=a();return e.jsxs("div",{className:"fitask",children:[t&&e.jsxs("p",{children:[e.jsx("span",{children:Be(l("aiPageShowingUnder"),t,"{price}")}),e.jsx("button",{type:"button",className:"linkbtn",disabled:i,onClick:o,children:l("aiPageAllPrices")})]}),n&&e.jsxs(e.Fragment,{children:[e.jsx("p",{children:n.checking?e.jsx("span",{children:Be(l("aiPageCheckingSize"),n.checking)}):n.chosen?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:Be(l("aiPageShowingSize"),n.chosen)}),e.jsx("button",{type:"button",className:"linkbtn",disabled:i,onClick:s,children:l("aiPageAllSizes")})]}):e.jsxs("span",{children:[e.jsx("b",{children:l("aiPageSizeQuestion")})," ",l("aiPageSizeHint")]})}),e.jsx("div",{className:"sizes",role:"group","aria-label":l("aiPageYourSize"),children:n.values.map(t=>e.jsx("button",{type:"button",className:"sz","aria-pressed":t===(n.checking??n.chosen),disabled:i,onClick:()=>r(t),children:t},t))})]})]})}function Te({message:n}){return"handover"===n.type&&n.handover?e.jsx(r,{message:n}):"handover_event"===n.type&&n.handoverEvent?e.jsx(s,{message:n}):"team"===n.type?e.jsx(o,{message:n}):"follow_up"===n.type&&n.followUp?e.jsx(l,{message:n}):null}function Ze({turn:n,nudge:t,actions:i}){const{t:r}=a(),s=n.products,o=e=>String(e.id??e.url??e.name),l=(t,a)=>e.jsx(Me,{product:t,step:"routine"===n.shape&&t.step_label?`${a+1}. ${t.step_label}`:void 0,actions:i},o(t));if(1===s.length)return e.jsx(Ue,{product:s[0],tagged:!1,nudge:t,actions:i},o(s[0]));if("single_pick"===n.shape){const[n,...a]=s;return e.jsxs(e.Fragment,{children:[e.jsx(Ue,{product:n,tagged:!0,nudge:t,actions:i},o(n)),e.jsx("h3",{className:"more",children:r("aiPageAlso")}),e.jsx("div",{className:"grid",children:a.map((e,n)=>l(e,n+1))})]})}return"shortlist"===n.shape||"routine"===n.shape?e.jsx("div",{className:"row"+(2===s.length?" two":""),children:s.map(l)}):e.jsx("div",{className:"grid top",children:s.map(l)})}function Ge({section:n,latest:i,avatar:r,sizeRow:s,cap:o,onSize:l,onAllSizes:c,onAnyPrice:p,failed:d,chipsDisabled:u,actions:m}){const{t:h}=a(),{head:g,shown:x}=n,f={...m,rules:n.rules,busy:m.busy||!!n.pending,onOpen:(e,t)=>m.onOpen(e,t??n.rules,n.key)},b=x.text.length>0||x.products.length>0||n.cards.length>0,v=i&&!u&&n.complete?x.chips:[],{choices:y,followUps:w}=function(e,n){const t={choices:[],followUps:e},a=Ee(n);if(e.length>=2&&e.every(e=>De(e).length>0&&a.includes(De(e))))return{choices:e,followUps:[]};const i=[...a.matchAll(Ie)].pop()?.[0];if(!i)return t;const r=new Set(Fe(i)),s=e.filter(e=>{const n=De(e);return!(!n||qe.test(e.trim().slice(-1)))&&(i.includes(n)||Fe(n).some(e=>r.has(e)))});return s.length<2?t:{choices:s,followUps:e.filter(e=>!s.includes(e))}}(v,x.text.map(e=>e.content).join(" ")),k=1===x.products.length||"single_pick"===x.shape&&x.products.length>1,j=k?w[0]:void 0,z=k?w.slice(1):w,S=!!n.rules.size||!!n.rules.max_price,N=i&&n.complete&&!n.pending&&b&&0===x.products.length&&S&&n.ruleChange;return e.jsxs("article",{className:"turn",children:[g.question&&e.jsx("h2",{className:"q",children:g.question.content}),!b&&!n.complete&&!d&&e.jsxs("div",{className:"think",role:"status",children:[e.jsx("span",{className:"dot",children:r&&e.jsx("img",{src:r,alt:""})}),e.jsx("span",{children:h("aiPageLooking")})]}),e.jsxs("div",{className:n.pending?"updating":void 0,children:[x.text.map(n=>e.jsx("div",{className:"say",children:e.jsx(t.Suspense,{fallback:e.jsx("p",{children:n.content}),children:e.jsx(Oe,{variant:"dori",textSize:{base:"17px",md:"18px"},children:n.content})})},n.id)),y.length>0&&e.jsx("div",{className:"choices",children:y.map(n=>e.jsx("button",{type:"button",className:"choice",onClick:()=>m.onAsk(n),children:n},n))}),n.cards.length>0&&e.jsx("div",{className:"cards",children:n.cards.map(n=>e.jsx(Te,{message:n},n.id))}),d&&e.jsxs("div",{className:"failed",children:[e.jsx("span",{children:d.expired?h("aiPageExpired"):h("aiPageNotLoaded")}),e.jsx("button",{type:"button",className:"btn primary",onClick:d.expired?d.onAskAgain:d.onRetry,children:d.expired?h("aiPageAskAgain"):h("aiPageTryAgain")})]}),i&&(s||o)&&e.jsxs(e.Fragment,{children:[e.jsx(We,{row:s,cap:o,busy:u,onSize:l,onAllSizes:c,onAnyPrice:p}),e.jsx("div",{className:"bar"})]}),e.jsxs("div",{className:"set",children:[x.products.length>0&&e.jsx(Ze,{turn:x,nudge:j,actions:f}),N&&e.jsx("div",{className:"none",children:e.jsxs("div",{className:"acts",children:[v[0]&&e.jsx("button",{type:"button",className:"btn primary",onClick:()=>m.onAsk(v[0]),children:v[0]}),n.rules.size&&e.jsx("button",{type:"button",className:"btn ghost",onClick:c,children:h("aiPageAllSizes")}),n.rules.max_price&&e.jsx("button",{type:"button",className:"btn ghost",onClick:p,children:h("aiPageAllPrices")})]})})]}),z.length>0&&!N&&e.jsxs("div",{className:"asknext",children:[e.jsx("h3",{children:h("aiPageAskNext")}),z.map(n=>e.jsxs("button",{type:"button",className:"nx",onClick:()=>m.onAsk(n),children:[n,e.jsx(P,{})]},n))]})]})]})}const Ke=e=>e===e.toUpperCase()&&/[A-Z]/.test(e)?e.toLowerCase().replace(new RegExp("\\b\\p{L}","gu"),e=>e.toUpperCase()):e;function Xe({product:n,actions:r,storeName:s,onAdd:o,onAskAbout:l,onClose:c}){const{t:p}=a(),[d,u]=t.useState(void 0),[m,h]=t.useState(null),[g,x]=t.useState(null),[f,b]=t.useState(!0),[v,y]=t.useState(!1),w=t.useRef(!1),[k,j]=t.useState(!1),[z,S]=t.useState(null),[N,C]=t.useState(!1),[_,P]=t.useState(!1),q=t.useRef(null),I=t.useRef(c);I.current=c;const E=e=>{if(u(e),!e)return;const t=function(e,n,t){const a=me(t,e),i=a?n.sizes.find(e=>ae(e)===ae(a.value))??null:null,r=n.variants.filter(a=>ge(e,n,a,t)).map(e=>({colour:null===n.colourIndex?null:e.options[n.colourIndex],size:null===n.sizeIndex?null:e.options[n.sizeIndex]}));if(0===r.length)return{colour:null,size:null,fits:!1};const s=[(o=fe(e),n.colours.find(e=>ae(e.name)===ae(o))?.name??null),...n.colours.map(e=>e.name)];var o;const l=(null===n.colourIndex?r[0]:s.map(e=>r.find(n=>n.colour===e)).find(Boolean))??r[0],c=null===n.sizeIndex||null===l.size||l.size!==i&&1!==n.sizes.length?null:l.size;return{colour:l.colour,size:c,fits:!0}}(n,e,r.rules);h(t.colour),x(t.size),b(t.fits),y(!1)};t.useEffect(()=>{let e=!0;return V(n.url,{fresh:!0}).then(n=>{e&&E(n)}),()=>{e=!1}},[n]),t.useEffect(()=>{q.current?.focus({preventScroll:!0});const e=e=>{"Escape"===e.key&&I.current()},n=document.documentElement,t=n.style.overflow;return n.style.overflow="hidden",document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e),n.style.overflow=t}},[]);const D=oe(n,r.rules),{brand:F,name:$}=_e(n),L=i(n,r.botData),M=he(n,d)||null===d,U=d?function(e,n,t){if(null!==e.colourIndex&&null===n)return null;if(null!==e.sizeIndex&&null===t)return null;const a=Z(e,n,t).filter(e=>e.available);return 1===a.length?a[0]:null}(d,m,g):null,O=!!d&&d.variants.every(e=>!e.available),B=L||M||!U?null:{variant_id:U.id,product_id:String(n.id),product_name:n.name,product_url:n.url,quantity:1},W=d?U?{price:U.price,compareAt:U.compareAt,from:!1}:K(d,D.variant?.variant_id):null,T=W?void 0:D.currency,X=W?W.price:D.price,Y=r.money(X,T),J=W?W.compareAt:D.compareAt,ne=Pe(n,X,p("priceOnRequest")),te=d?.colours.find(e=>e.name===m)?.image,ie=Q(te??D.image,d?.images??[]),re=`${m??""}|${g??""}`,se=!!d&&d.colours.length>0&&d.colours.every(e=>e.image),le=d&&null!==d.colourIndex&&null===m?p("aiPageChooseColour"):d&&null!==d.sizeIndex&&null===g?p("aiPageChooseSize"):null,ce=[m&&d&&d.colours.length>1?Ke(m):null,g&&d&&d.sizes.length>1?g:null].filter(Boolean).join(", ");return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"scrim",onClick:c,"aria-hidden":!0}),e.jsxs("aside",{className:"sheet",role:"dialog","aria-modal":"true","aria-labelledby":"aip-sheet-name",children:[e.jsx("span",{className:"grab","aria-hidden":!0}),e.jsx("button",{type:"button",className:"x",ref:q,onClick:c,"aria-label":p("close"),children:e.jsx(R,{})}),e.jsx(ee,{photos:ie,name:n.name,width:1e3,labels:{photos:p("aiPagePhotos"),prev:p("aiPagePrev"),next:p("aiPageNext")}},m??"all"),e.jsxs("div",{className:"shb",children:[F&&e.jsx("p",{className:"brand",children:F}),e.jsx("h3",{className:"name",id:"aip-sheet-name",children:$}),e.jsx("p",{className:"price",children:ne??e.jsxs(e.Fragment,{children:[null!==J&&e.jsx("s",{children:r.money(J,T)}),W?.from?p("aiPageFrom").replace("{price}",Y):Y]})}),n.description&&e.jsxs("div",{className:"note",children:[e.jsx("b",{children:p("aiPageWhy")}),e.jsx("p",{children:n.description})]}),d&&d.colours.length>1&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"lbl",children:[p("aiPageColour"),": ",e.jsx("b",{children:m?Ke(m):p("aiPageChooseOne")})]}),e.jsx("div",{className:se?"swatches":"sizes",role:"group","aria-label":p("aiPageColour"),children:d.colours.map(n=>e.jsx("button",{type:"button",className:se?"sw":"sz","aria-pressed":n.name===m,"aria-label":se?Ke(n.name):void 0,disabled:!n.available||k,onClick:()=>{h(n.name),y(!0),g&&!G(d,n.name,g)&&x(null)},children:se&&n.image?e.jsx("img",{src:H(n.image,120),alt:""}):Ke(n.name)},n.name))})]}),d&&d.sizes.length>1&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"lbl",children:[p("aiPageSize"),": ",e.jsx("b",{children:g??p("aiPageChooseOne")})]}),e.jsx("div",{className:"sizes",role:"group","aria-label":p("aiPageSize"),children:d.sizes.map(n=>e.jsx("button",{type:"button",className:"sz","aria-pressed":n===g,disabled:!G(d,m,n)||k,onClick:()=>{x(n),y(!0)},children:n},n))})]}),d?.tip&&e.jsxs("p",{className:"tip",children:[e.jsx("b",{children:p("aiPageFitTip").replace("{store}",s)})," ",d.tip]}),e.jsx("div",{className:"buy",children:z===re?e.jsxs("div",{className:"done",children:[e.jsxs("p",{children:[e.jsx(A,{}),e.jsx("span",{children:p("aiPageAddedTo").replace("{item}",ce?`${$}, ${ce}`:$)})]}),e.jsx("button",{type:"button",className:"btn primary wide",onClick:r.onCart,children:p("cartViewCart")}),e.jsx("button",{type:"button",className:"btn ghost wide",onClick:c,children:p("aiPageKeepBrowsing")})]}):L?e.jsx("a",{className:"btn primary wide",href:L.href,children:p(L.labelKey)}):M&&n.url?e.jsxs(e.Fragment,{children:[e.jsx("a",{className:"btn primary wide",href:n.url,children:p("chooseOptions")}),e.jsx("button",{type:"button",className:"btn ghost wide",onClick:()=>l(n),children:p("askAboutProduct")})]}):e.jsxs(e.Fragment,{children:[N&&e.jsx("p",{className:"err",children:p("aiPageAddFailed")}),O?e.jsx("p",{className:"err",children:p("cartErrorProductOutOfStock")}):d&&!f&&!v&&e.jsx("p",{className:"err",children:p("aiPageNoLongerFits")}),e.jsx("button",{type:"button",className:"btn primary wide",disabled:!B||r.busy||k,onClick:()=>{(async()=>{if(B?.variant_id&&!w.current){w.current=!0,j(!0),C(!1);try{const e=await be(n,String(B.variant_id),f&&!v?r.rules:null);if("changed"===e)return void E(await V(n.url));if("unknown"===e)return void C(!0);await o(n,B)?S(re):C(!0)}finally{w.current=!1,j(!1)}}})()},children:le??p(!d||f||v||O?"addToCartFull":"aiPageAddAnyway")}),e.jsx("button",{type:"button",className:"btn ghost wide",onClick:()=>l(n),children:p("askAboutProduct")})]})}),d&&d.sections.length>0&&e.jsx("div",{className:"facts",children:d.sections.map(n=>e.jsxs("div",{children:[e.jsx("h4",{children:n.label}),e.jsx("ul",{children:n.items.map(n=>e.jsx("li",{children:n},n))})]},n.label))}),d&&d.full.length>0&&(_?e.jsx("div",{className:"about",children:d.full.map((n,t)=>"p"===n.type?e.jsx("p",{children:n.text},t):e.jsx("ul",{children:n.items.map(n=>e.jsx("li",{children:n},n))},t))}):e.jsx("button",{type:"button",className:"linkbtn",onClick:()=>P(!0),children:p("aiPageReadMore")})),n.url&&e.jsx("a",{className:"pdp",href:n.url,children:p("aiPageProductPage")})]})]})]})}const Ye=new Set(["running","done","failed","unknown"]);function Ve({items:n,money:i,onOpen:r,onRemove:s,onCompare:o,onClose:l}){const{t:c}=a(),p=t.useRef(null),d=t.useRef(l);return d.current=l,t.useEffect(()=>{p.current?.focus({preventScroll:!0});const e=e=>{"Escape"===e.key&&d.current()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"scrim",onClick:l,"aria-hidden":!0}),e.jsxs("aside",{className:"sheet list",role:"dialog","aria-modal":"true","aria-labelledby":"aip-saved-title",children:[e.jsx("span",{className:"grab","aria-hidden":!0}),e.jsx("button",{type:"button",className:"x",ref:p,onClick:l,"aria-label":c("close"),children:e.jsx(R,{})}),e.jsxs("div",{className:"shb",children:[e.jsx("h3",{className:"name",id:"aip-saved-title",children:c("savedProducts")}),0===n.length&&e.jsx("p",{className:"empty",children:c("savedEmpty")}),n.map(n=>e.jsxs("div",{className:"lrow",children:[e.jsx("span",{className:"frame",children:e.jsx("img",{src:H(n.image,160),alt:""})}),e.jsxs("div",{children:[e.jsx("b",{children:_e(n).name}),e.jsx("span",{children:Pe(n,n.price,c("priceOnRequest"))??i(n.price,n.currency)})]}),e.jsx("button",{type:"button",className:"linkbtn",onClick:()=>r(n),children:c("aiPageView")}),e.jsx("button",{type:"button",className:"linkbtn",onClick:()=>s(n),children:c("aiPageRemove")})]},String(n.id))),n.length>=2&&e.jsx("div",{className:"buy",children:e.jsx("button",{type:"button",className:"btn primary wide",onClick:o,children:c("compareSaved").replace("{count}",String(Math.min(n.length,3)))})})]})]})]})}function He(e){e.classList.add("dori-aip--asked")}function Je(e){const n=(e??"").match(/rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)/i);if(!n)return null;const t=void 0===n[4]?1:n[4].endsWith("%")?parseFloat(n[4])/100:parseFloat(n[4]);return{rgb:[Number(n[1]),Number(n[2]),Number(n[3])],alpha:t}}const Qe=e=>`rgb(${e.map(e=>Math.round(e)).join(", ")})`,en=(e,n,t)=>Qe([0,1,2].map(a=>e[a]*t+n[a]*(1-t))),nn=/hidden|auto|scroll|overlay/;function tn({draft:n,onDraft:t,onSubmit:i,sending:r,placeholder:s,inputRef:o,about:l,onClearAbout:c,savedCount:p,onSaved:d,cartCount:u,onCart:m}){const{t:h}=a();return e.jsxs("div",{className:"tray",children:[l&&e.jsxs("div",{className:"about-line",children:[e.jsxs("span",{children:[h("askAboutProduct"),": ",e.jsx("b",{children:l.name})]}),e.jsx("button",{type:"button",className:"linkbtn","aria-label":h("close"),onClick:c,children:e.jsx(R,{})})]}),e.jsxs("div",{className:"tray-in",children:[p>0&&e.jsxs("button",{type:"button",className:"tb","aria-label":h("savedProducts"),onClick:d,children:[e.jsx(_,{}),e.jsx("span",{children:p})]}),u>0&&e.jsxs("button",{type:"button",className:"tb","aria-label":h("cartViewCart"),onClick:m,children:[e.jsx(E,{}),e.jsx("span",{children:u})]}),e.jsxs("form",{className:"ask",onSubmit:e=>{e.preventDefault(),!r&&n.trim()&&i()},children:[e.jsx("label",{className:"sr",htmlFor:"aip-dock",children:s}),e.jsx("input",{id:"aip-dock",ref:o,value:n,autoComplete:"off",placeholder:s,onChange:e=>t(e.target.value)}),e.jsx("button",{type:"submit",className:"send","aria-label":s,disabled:r||!n.trim(),children:e.jsx(D,{})})]})]})]})}const an=new Set(["team","handover","handover_event","follow_up"]);function rn(e,n){return{key:n,question:e,text:[],products:[],chips:[],cards:[],pending:!1}}function sn(e){const n=[];let t=null;const a=new Set;for(const i of e)if("welcome"!==i.type)if("user"!==i.type)if(t||(t=rn(null,`before-${i.id}`),n.push(t)),"dori"===i.type&&i.isError)t.failed=!0;else if("dori"!==i.type||i.showCartSummary||i.showCartActions)if("products"===i.type){i.shape&&(t.shape=i.shape);for(const e of i.products??[]){const n=String(e.id??e.url??e.name);a.has(n)||(a.add(n),t.products.push(e))}}else"suggestions"===i.type?t.chips=i.suggestions??[]:an.has(i.type)?t.cards.push(i):"loading"!==i.type&&"typing"!==i.type||(t.pending=!0);else t.text.push(i),t.failed=!1;else t=rn(i,i.id),n.push(t),a.clear();return n}function on(e,n=Date.now()){return n-e>=864e5}const ln="dori_ai_page_view",cn={asks:[],inFlight:null};function pn(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const{size:n,max_price:t}=e;if(!(void 0===t||"number"==typeof t&&t>0))return!1;if(void 0===n)return!0;const a=n;return"object"==typeof a&&null!==a&&"string"==typeof a.value&&"string"==typeof a.option}function dn(e){const n=e;return!!n&&"string"==typeof n.turnId&&"string"==typeof n.question&&"boolean"==typeof n.refine&&pn(n.rules)}const un={},mn=e=>(e??"").trim().toLowerCase(),hn=(e,n,t,a)=>{const i=a?.feature_flags?.sale_units,r=Array.isArray(i)?i.find(n=>mn(n?.product_type)===mn(e.productType)&&n?.unit):void 0;return{id:e.handle,name:e.title,brand:e.vendor||null,product_type:e.productType,price:e.price,...null!==e.compareAt?{is_on_sale:!0,sale_price:e.price,price:e.compareAt}:{},image:e.images[0]??"",url:n,...t>1?{minimum_quantity:t}:{},...r?.unit?{price_unit:r.unit}:{}}};function gn({shell:i}){const{botData:r,messages:s,sendMessage:o,isInputDisabled:l,setPanelOpen:g,chatState:x,addToCartDirect:f,isCartBusy:b,cartItemCount:v,shortlist:z,shortlistEnabled:N,toggleShortlist:C}=c(),{t:A}=a();p({sharingId:y()});const[_,P]=t.useState(()=>function(e=localStorage,n=Date.now()){try{const t=e.getItem(ln);if(!t)return cn;const a=JSON.parse(t),i=Array.isArray(a.asks)?a.asks.filter(dn).slice(-30).map(e=>({...e,askedAt:"number"==typeof e.askedAt?e.askedAt:0})):[],r=function(e){const n=e;return!!n&&"string"==typeof n.turnId&&"string"==typeof n.question&&"number"==typeof n.startedAt&&pn(n.rules)}(a.inFlight)&&!on(a.inFlight.startedAt,n)?a.inFlight:null,s=a.recovered;return{asks:i,inFlight:r,...!s||"string"!=typeof s.question||"string"!=typeof s.turnId||"done"!==s.status&&"failed"!==s.status?{}:{recovered:s}}}catch{return cn}}()),q=t.useRef(_);q.current=_,t.useEffect(()=>{!function(e,n=localStorage){try{n.setItem(ln,JSON.stringify(e))}catch{}}(_)},[_]);const I=t.useRef(x);I.current=x;const R=t.useRef(s);R.current=s;const E=r?.assistant_id??null,D=t.useRef(E);D.current=E;const F=t.useRef(r);F.current=r;const[$,L]=t.useState(null),[M,U]=t.useState(null),[O,B]=t.useState(!1),W=O||!1===r?.is_widget_enabled,T=t.useRef(W);T.current=W;const[Z,G]=t.useState(()=>new Set),[K,X]=t.useState(null),[Y,H]=t.useState(null),[J,Q]=t.useState(!1),[ee,ne]=t.useState(null),te=t.useRef(ee);te.current=ee;const[ae,ie]=t.useState({});t.useEffect(()=>{const e=i??document.body;ie(function(e,n){const t=Je(e)?.rgb??[34,34,34],a=Je(n)?.rgb??[255,255,255],i=(([e,n,t])=>(.2126*e+.7152*n+.0722*t)/255)(a)<.45;return{"--ink":Qe(t),"--text":en(t,a,.9),"--muted":en(t,a,.6),"--line":en(t,a,.1),"--edge":en(t,a,.2),"--stone":en(t,a,i?.08:.035),"--paper":Qe(a),"--btn":Qe(t),"--btn-ink":Qe(a),"--blend":i?"normal":"multiply"}}(getComputedStyle(e).color,function(e){for(let n=e;n;n=n.parentElement){const e=getComputedStyle(n).backgroundColor,t=Je(e);if(t&&t.alpha>.9)return e}return"rgb(255, 255, 255)"}(e)))},[i]);const re=t.useMemo(()=>{const e=function(e,n){if(!n)return e;let t=-1;e.forEach((e,a)=>{e.question?.content===n.question&&(t=a)});const a=t>=0?e[t]:rn({id:`recovered-q-${n.turnId}`,type:"user",content:n.question,timestamp:new Date},`recovered-${n.turnId}`),i="done"===n.status?{...a,text:n.text?[{id:`recovered-a-${n.turnId}`,type:"dori",content:n.text,timestamp:new Date}]:[],products:n.products??[],chips:n.chips??[],pending:!1,failed:!1}:{...a,pending:!1,failed:!0};return t>=0?e.map((e,n)=>n===t?i:e):[...e,i]}(sn(s),_.recovered);return e.map(e=>$&&e.question?.content===$.question?{...e,pending:!0,failed:!1}:M&&e.question?.content===M.question?{...e,pending:!1,failed:!0}:e)},[s,_.recovered,$,M]),[se,oe]=t.useState(!1);t.useEffect(()=>{x.isRequestInProgress||oe(!1)},[x.isRequestInProgress]);const me=se&&!!x.isRequestInProgress,[he,ge]=t.useState(null),xe=t.useMemo(()=>function(e,n,t){const a=[];let i=0;return e.forEach((r,s)=>{const o=(e=>{if(!e)return null;for(let t=i;t<n.length;t++)if(n[t].question===e)return i=t+1,n[t];return null})(r.question?.content),l=r.pending||t&&s===e.length-1,c=a[a.length-1];if(o?.refine&&c)return c.cards.push(...r.cards),void(l?(c.pending=o.rules,c.failed=null):r.failed?(c.pending=null,c.failed=r):(c.shown=r,c.rules=o.rules,c.pending=null,c.failed=null,c.complete=!0,c.ruleChange=!0));const p=o?.rules??{};a.push({key:r.key,head:r,shown:r,rules:p,pending:null,failed:r.failed&&!l?r:null,complete:!l,cards:[...r.cards],ruleChange:!ue(p,c?.rules??{})})}),a}(re,_.asks,me),[re,_.asks,me]),fe=xe[xe.length-1]?.rules??un,be=t.useRef(fe);be.current=fe;const[ve,ye]=t.useState(""),we=t.useRef(null),ke=t.useRef(null),je=t.useRef(null),Ce=t.useRef(xe.length),_e=t.useRef(null),[Pe,qe]=t.useState(!1);t.useEffect(()=>{const e=_e.current;if(!e)return;const n=e.getRootNode();qe(function(e){for(const n of e)if(nn.test(`${n.overflowX} ${n.overflowY}`))return!0;return!1}(function*(e){for(let n=e;n&&n!==document.body&&n!==document.documentElement;n=n.parentElement)yield getComputedStyle(n)}(n instanceof ShadowRoot?n.host:e.parentElement)))},[]);const Ie=t.useCallback((e,n,t,a={})=>{oe(!0),o({message:e,page:{turnId:n,rules:t},...a.silent?{silent:!0}:{}},a.about??void 0)},[o]),Re=t.useCallback((e,n={})=>{if(T.current)return void(window.location.href=i?function(e,n){const t=e.querySelector("[data-dori-ask-form]");return`${t?.action||"/search"}?q=${encodeURIComponent(n)}`}(i,e):`/search?q=${encodeURIComponent(e)}`);const t=n.rules??be.current,a=n.refine?null:function(e){const n=e.match(ze)??e.match(Se),t=n?.[1]??n?.[4];if(!n||!t)return null;const a=Number(n[2].replace(/[.,\s]/g,""))+(n[3]?Number(n[3].padEnd(2,"0"))/100:0);return a>0?{amount:a,currency:Ae(t)}:null}(e),s=a&&function(e,n){const t=(n??"").toUpperCase();return!(!t||!e)&&("$"===e?Ne.has(t):"¥"===e?"JPY"===t||"CNY"===t:e===t)}(a.currency,function(){const e=document.querySelector("script#dori-side-widget")?.getAttribute("data-currency"),n=window.Shopify?.currency?.active;return e||n||null}())?a.amount:null,o=s?{...t,max_price:s}:t,l=w(),c=Date.now(),p=te.current;ne(null),U(null),P(t=>({asks:[...t.asks,{turnId:l,question:e,rules:o,refine:!!n.refine,askedAt:c}].slice(-30),inFlight:{turnId:l,question:e,startedAt:c,rules:o},recovered:"done"===t.recovered?.status?t.recovered:null})),i&&He(i),d("ai_page_ask",{assistantId:D.current}),r?Ie(e,l,o,{about:p}):ke.current={question:e,turnId:l,rules:o,about:p}},[r,Ie,i]),Ee=t.useRef(Re);Ee.current=Re,t.useEffect(()=>{if(!i)return;const e=function(e,n){const t=e.querySelector("[data-dori-ask-form]"),a=e.querySelector("[data-dori-ask-input]"),i=[];if(t&&a){const e=e=>{e.preventDefault();const t=a.value.trim();t&&(a.value="",n(t))};t.addEventListener("submit",e),i.push(()=>t.removeEventListener("submit",e))}for(const r of Array.from(e.querySelectorAll("[data-dori-ask]"))){const e=e=>{e.preventDefault();const t=r.dataset.doriAsk?.trim();t&&n(t)};r.addEventListener("click",e),i.push(()=>r.removeEventListener("click",e))}return()=>i.forEach(e=>e())}(i,e=>Ee.current(e));!function(e,n,t,a){const i=new URLSearchParams(n.search).get("q")?.trim().slice(0,300),r=e.querySelector("[data-dori-ask-input]");if(!i||!r)return null;r.value=i;const s=e.querySelector("[data-dori-ask-send]");s&&(s.textContent=a);try{const e=new URL(n.href);e.searchParams.delete("q"),(e=>{history.replaceState(history.state,"",e)})(e.toString())}catch{}}(i,window.location,0,A("aiPageShowMe")),u(k(window.location.search));const n=function(e,n){n.__doriAiPageReady=!0;const t="string"==typeof n.__doriAiAsk?n.__doriAiAsk.trim():"";n.__doriAiAsk=null;const a=e.querySelector("[data-dori-ask-input]");a&&(a.readOnly=!1);const i=e.querySelector("[data-dori-ask-send]");return i&&(i.disabled=!1,i.removeAttribute?.("aria-busy")),t||null}(i,window);n&&Ee.current(n);const t=e=>{const n=e.target?.closest?.("[data-dori-product]");if(!n)return;e.preventDefault();const t=n.getAttribute("href")||"",a=Number(n.getAttribute("data-dori-min"))||1;V(t).then(e=>{e?H({product:hn(e,t,a,F.current),rules:be.current}):window.location.href=t})};return i.addEventListener("click",t),()=>{e(),i.removeEventListener("click",t)}},[i]),t.useEffect(()=>{i&&re.length>0&&He(i)},[i,re.length]),t.useEffect(()=>(g(!0),()=>g(!1)),[g]);const De=t.useRef(!1);t.useEffect(()=>{!De.current&&E&&(De.current=!0,d("ai_page_view",{assistantId:E}))},[E]),t.useEffect(()=>{if(!r||!ke.current)return;const{question:e,turnId:n,rules:t,about:a}=ke.current;ke.current=null,T.current||Ie(e,n,t,{about:a})},[r,Ie]),t.useEffect(()=>{const e=()=>B(!0);return window.addEventListener("dori:usage-cap",e),()=>window.removeEventListener("dori:usage-cap",e)},[]),t.useEffect(()=>{W&&i&&function(e,n){const t=e.querySelector("[data-dori-ask-input]");t&&(t.placeholder=n,t.setAttribute("aria-label",n));const a=e.querySelector("[data-dori-ask-send]");a&&(a.textContent=n)}(i,A("aiPageSearch"))},[W,i]);const Fe=t.useCallback((e,n)=>{const t=n||I.current.threadId,a=y();return t&&a?async function(e,n,t,a,i=fetch){try{const r=`${e}/v2/turn/${encodeURIComponent(n)}/${encodeURIComponent(t)}?sharing_id=${encodeURIComponent(a)}`,s=await i(r,{cache:"no-store"});if(!s.ok)return{status:"unreachable"};const o=await s.json();return o&&Ye.has(o.status)?o:{status:"unreachable"}}catch{return{status:"unreachable"}}}(j,t,e.turnId,a):Promise.resolve({status:"unreachable"})},[]),$e=t.useCallback(async(e,n,t)=>{L(e);const a=await async function(e,{pollMs:n=2e3,maxWaitMs:t=6e4,sleep:a=e=>new Promise(n=>setTimeout(n,e))}={}){let i=0;for(;;){const r=await e();if("running"!==r.status&&"unreachable"!==r.status)return r;if(i>=t)return r;await a(n),i+=n}}(()=>Fe(e,t),{maxWaitMs:n});L(null);const{turnId:i,question:r}=e;return"running"===a.status||"unreachable"===a.status?(U(e),a.status):(U(null),P(e=>({...e,inFlight:e.inFlight?.turnId===i?null:e.inFlight,recovered:"done"===a.status?{question:r,turnId:i,status:"done",text:a.text,products:a.products,chips:a.chips}:{question:r,turnId:i,status:"failed"}})),a.status)},[Fe]),Le=t.useRef(!1);t.useEffect(()=>{if(Le.current||!r)return;Le.current=!0;const e=q.current.inFlight;e&&$e(e,6e4)},[r,$e]),t.useEffect(()=>{const e=e=>{const n=q.current.inFlight,t=e.detail?.threadId;n&&$e(n,6e4,t)};return window.addEventListener("dori:turn-known",e),()=>window.removeEventListener("dori:turn-known",e)},[$e]);const Me=t.useRef(!1);t.useEffect(()=>{const e=!!x.isRequestInProgress;Me.current&&!e&&q.current.inFlight&&!re[re.length-1]?.failed&&P(e=>({...e,inFlight:null})),Me.current=e},[x.isRequestInProgress,re]);const Ue=t.useCallback(async e=>{if(T.current)return;if(on(e.startedAt))return void ge(e.turnId);const n=await $e(e,2e4);if("failed"!==n&&"unknown"!==n)return;if(on(e.startedAt))return void ge(e.turnId);const{turnId:t,question:a,rules:i,startedAt:r}=e,s=sn(R.current).some(e=>e.question?.content===a);P(e=>({...e,recovered:null,inFlight:{turnId:t,question:a,startedAt:r,rules:i}})),Ie(a,t,i,{silent:s})},[$e,Ie]);t.useEffect(()=>{xe.length>Ce.current&&je.current?.scrollIntoView({block:"start",behavior:"smooth"}),Ce.current=xe.length},[xe.length]);const Oe=re.length>0;t.useEffect(()=>(S.current=Oe?()=>we.current?.focus():null,()=>{S.current=null}),[Oe]),t.useEffect(()=>{const e=_e.current,n=e?.querySelector(":scope > .tray");if(Pe&&e&&n)return function(e,n){let t=0,a=0;const i=()=>{a=0;const i=(r=e.getBoundingClientRect().bottom+t,s=n.getBoundingClientRect().bottom,Math.max(0,Math.round(r-s)));var r,s;i!==t&&(t=i,e.style.transform=i?`translateY(${-i}px)`:"")},r=()=>{a||(a=requestAnimationFrame(i))};document.addEventListener("scroll",r,{capture:!0,passive:!0}),window.addEventListener("resize",r);const s=new ResizeObserver(r);return s.observe(n),i(),()=>{document.removeEventListener("scroll",r,{capture:!0}),window.removeEventListener("resize",r),s.disconnect(),a&&cancelAnimationFrame(a),e.style.transform=""}}(n,e)},[Pe,Oe]),t.useEffect(()=>{if(!K)return;const e=setTimeout(()=>X(null),3600);return()=>clearTimeout(e)},[K]);const Be=t.useCallback(()=>{X(null),H(null),Q(!1),m()||(window.location.href=`${n()}cart`)},[]),We=t.useCallback(async(e,n,t=!1)=>"success"!==(await f(n,{quiet:!0})).type?(t||X(A("aiPageAddFailed")),!1):(G(n=>new Set(n).add(String(e.id))),d("ai_page_add",{assistantId:D.current}),t||X(A("aiPageAddedTo").replace("{item}",e.name)),!0),[f,A]),Te=t.useCallback(e=>{H(null),ne(e),setTimeout(()=>we.current?.focus(),0)},[]),Ze="undefined"!=typeof document&&document.documentElement.lang||void 0,Ke="undefined"!=typeof document&&document.querySelector("script#dori-side-widget")?.getAttribute("data-currency")||r?.currency?.split(" - ")[0]?.trim()||void 0,an=t.useCallback((e,n)=>h(e,n||Ke,Ze),[Ke,Ze]),gn=t.useMemo(()=>new Set(z.map(e=>String(e.id))),[z]),xn={botData:r,rules:fe,inCart:Z,saved:N?gn:null,busy:b,money:an,onAdd:(e,n)=>We(e,n),onOpen:(e,n,t)=>H({product:e,rules:n??be.current,from:t}),onSave:C,onCart:Be,onAsk:e=>Re(e)},fn=xe[xe.length-1],bn=fn?le(fn.shown.products)??le(fn.head.products):null,vn=e=>{const n=e?.size;return!n||n.scope&&bn?.scope&&mn(n.scope)!==mn(bn.scope)?null:n.value},yn=(()=>{if(!fn||W||!fn.complete&&!fn.pending)return null;const e=vn(fn.rules),n=fn.pending?vn(fn.pending):null,t=bn?[...bn.values]:[];for(const a of[e,n])a&&!t.some(e=>mn(e)===mn(a))&&t.push(a);return t.length<2&&!e&&!n?null:{values:t,chosen:e,checking:n}})(),wn=fn&&!W?(fn.pending??fn.rules).max_price??null:null,kn=e=>{const n=fn?.rules??un;if(n.size&&mn(n.size.value)===mn(e))return void Re(A("aiPageAnySize"),{rules:pe(n),refine:!0});const t=bn??{option:n.size?.option??"Size",scope:n.size?.scope};Re(A("aiPageMySize").replace("{size}",e),{rules:ce(n,t,e),refine:!0})},jn=()=>Re(A("aiPageAnySize"),{rules:pe(fn?.rules??un),refine:!0}),zn=()=>Re(A("aiPageAnyPrice"),{rules:de(fn?.rules??un),refine:!0}),Sn=ae,Nn=r?.agent_image||r?.bot_image||void 0,Cn=r?.agent_name||r?.bot_name||"";return e.jsxs("div",{className:Pe?"aip floats":"aip",ref:_e,style:Sn,children:[e.jsx("style",{children:'\n.aip{--ink:#222;--text:#34312e;--muted:#7a746e;--line:#ebe6e0;--stone:#f8f5f2;--paper:#fff;--btn:#222;--btn-ink:#fff;--edge:#dcd6cf;--blend:multiply;\n --ease:cubic-bezier(.2,.75,.2,1);--read:680px;--gut:24px;--tray:84px;\n color:var(--text);font-size:16px;line-height:1.5;-webkit-font-smoothing:antialiased}\n.aip *,.aip *::before,.aip *::after{box-sizing:border-box}\n.aip button{font:inherit;color:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;text-align:inherit}\n.aip img{display:block;max-width:100%}\n.aip a{color:inherit}\n.aip :focus-visible{outline:2px solid var(--ink);outline-offset:3px;border-radius:6px}\n.aip [hidden]{display:none!important}\n.aip .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n/* Strips that scroll sideways never widen the page: themes size their main area to its content. */\n.aip .sizes,.aip .slides,.aip .row{contain:inline-size}\n\n.aip .frame{position:relative;display:block;width:100%;aspect-ratio:var(--ar,3/4);background:var(--stone);border-radius:6px;overflow:hidden}\n.aip .frame img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;mix-blend-mode:var(--blend)}\n\n.aip .thread{padding-bottom:40px}\n.aip.floats .thread{padding-bottom:calc(var(--tray) + 40px)}\n.aip .turn{padding:40px 0 12px;scroll-margin-top:12px}\n.aip .turn + .turn{border-top:1px solid var(--line);margin-top:32px}\n.aip .q{text-wrap:balance;font-weight:300;font-size:clamp(23px,2.4vw,31px);line-height:1.2;letter-spacing:-.018em;color:var(--ink);margin:0 0 14px;max-width:24em}\n.aip .say{font-size:clamp(17px,1.4vw,18.5px);line-height:1.62;color:var(--text);max-width:var(--read);margin:0;transition:opacity .2s}\n.aip .say p{margin:0 0 10px}\n.aip .say p:last-child{margin-bottom:0}\n.aip .say strong,.aip .say b{font-weight:700;color:var(--ink)}\n.aip .say ul,.aip .say ol{margin:6px 0 10px;padding-left:20px}\n.aip .think{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:16px}\n.aip .think .dot{width:30px;height:30px;border-radius:50%;border:1px solid var(--line);background:var(--paper);display:grid;place-items:center;overflow:hidden;animation:aip-breathe 1.6s ease-in-out infinite}\n.aip .think .dot img{width:100%;height:100%;object-fit:contain;padding:4px}\n@keyframes aip-breathe{50%{box-shadow:0 0 0 6px color-mix(in srgb,var(--ink) 6%,transparent)}}\n.aip .fadein{animation:aip-fadein .2s ease both}\n@keyframes aip-fadein{from{opacity:0}}\n.aip .failed{margin-top:14px;display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:14px 16px;border:1px solid var(--line);border-radius:14px;max-width:var(--read)}\n.aip .cards{margin-top:14px;max-width:var(--read);display:grid;gap:10px}\n\n.aip .fitask{margin:24px 0 0}\n.aip .fitask p{margin:0 0 10px;font-size:15px;color:var(--muted);display:flex;flex-wrap:wrap;gap:4px 12px;align-items:baseline}\n.aip .fitask p b{color:var(--ink);font-weight:700}\n.aip .choices{display:flex;flex-wrap:wrap;gap:10px;margin:18px 0 6px;max-width:var(--read)}\n.aip .choice{min-height:46px;padding:0 20px;border:1px solid var(--edge);border-radius:999px;background:var(--paper);color:var(--ink);font-size:15.5px;line-height:1.25;text-align:center;transition:background .2s,color .2s,border-color .2s,transform .12s;animation:aip-choice .32s var(--ease) both}\n.aip .choice:nth-child(2){animation-delay:.05s}.aip .choice:nth-child(3){animation-delay:.1s}.aip .choice:nth-child(n+4){animation-delay:.15s}\n.aip .choice:hover{border-color:var(--ink)}\n.aip .choice:active{transform:scale(.97);background:var(--ink);color:var(--paper)}\n@keyframes aip-choice{from{opacity:0;transform:translateY(6px)}}\n@media (prefers-reduced-motion:reduce){.aip .choice{animation:none}}\n.aip .linkbtn{font-size:14.5px;color:var(--ink);text-decoration:underline;text-underline-offset:3px}\n.aip .sizes{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;scroll-padding-inline:var(--gut);margin:0 calc(var(--gut) * -1);padding:2px var(--gut) 6px}\n.aip .sizes::-webkit-scrollbar{display:none}\n.aip .sz{flex:none;min-width:56px;height:44px;padding:0 13px;border:1px solid var(--edge);border-radius:10px;font-size:14.5px;color:var(--ink);background:var(--paper);text-align:center;transition:background .2s,color .2s,border-color .2s}\n.aip .sz:hover{border-color:var(--ink)}\n.aip .sz[aria-pressed="true"]{background:var(--ink);color:var(--paper);border-color:var(--ink)}\n.aip .sz:disabled{color:var(--muted);opacity:.55;border-color:var(--line);cursor:default;background:linear-gradient(to top right,transparent calc(50% - .5px),var(--line) calc(50% - .5px),var(--line) calc(50% + .5px),transparent calc(50% + .5px))}\n.aip .bar{height:2px;margin:16px 0 -18px;border-radius:1px;background:linear-gradient(90deg,transparent,var(--ink),transparent) no-repeat;background-size:35% 100%;opacity:0;transition:opacity .2s}\n.aip .updating .bar{opacity:1;animation:aip-bar 1s linear infinite}\n@keyframes aip-bar{from{background-position:-40% 0}to{background-position:140% 0}}\n.aip .set{transition:opacity .2s}\n.aip .updating .set,.aip .updating .say{opacity:.5}\n\n.aip .pick{margin-top:30px;display:grid;grid-template-columns:minmax(0,400px) minmax(0,1fr);grid-template-areas:"gal head" "gal body";grid-template-rows:auto 1fr;column-gap:52px;align-items:start}\n.aip .pick .head{grid-area:head;padding-top:4px}\n.aip .pick .gal{grid-area:gal}\n.aip .pick .body{grid-area:body}\n.aip .gal{position:relative}\n.aip .slides{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;overscroll-behavior-x:contain;border-radius:6px}\n.aip .slides::-webkit-scrollbar{display:none}\n.aip .slides .frame{flex:0 0 100%;scroll-snap-align:start;border-radius:0}\n.aip .dots{position:absolute;left:0;right:0;bottom:14px;display:flex;justify-content:center;gap:6px;pointer-events:none}\n.aip .dots i{width:6px;height:6px;border-radius:3px;background:color-mix(in srgb,var(--ink) 22%,transparent);transition:width .25s var(--ease),background .25s}\n.aip .dots i.on{width:18px;background:color-mix(in srgb,var(--ink) 70%,transparent)}\n.aip .gnav{position:absolute;top:50%;margin-top:-20px;width:40px;height:40px;border-radius:50%;background:color-mix(in srgb,var(--paper) 94%,transparent);color:var(--ink);display:grid;place-items:center;opacity:0;transition:opacity .2s;box-shadow:0 2px 10px -4px rgba(0,0,0,.25)}\n.aip .gprev{left:12px}.aip .gnext{right:12px}\n@media (hover:hover){.aip .gal:hover .gnav{opacity:1}}\n.aip .gnav:focus-visible{opacity:1}\n.aip .tag{display:inline-block;font-size:13px;font-weight:700;color:var(--ink);background:var(--stone);border-radius:999px;padding:5px 11px;margin:0 0 14px}\n.aip .brand{font-size:13.5px;color:var(--muted);margin:0 0 3px}\n.aip .name{font-size:clamp(21px,2vw,27px);line-height:1.2;font-weight:700;letter-spacing:-.012em;color:var(--ink);margin:0 0 8px;max-width:17em}\n.aip .price{font-size:17px;color:var(--ink);margin:0}\n.aip .price s,.aip .pr s{color:var(--muted);margin-right:6px}\n.aip .why{font-size:16.5px;line-height:1.6;color:var(--text);margin:18px 0 0;max-width:30em}\n.aip .opts{display:flex;align-items:center;gap:8px;font-size:14.5px;font-weight:700;color:var(--ink);margin:16px 0 0}\n.aip .acts{display:flex;gap:10px;flex-wrap:wrap;margin-top:20px}\n.aip .btn{height:50px;padding:0 26px;border-radius:999px;font-size:15.5px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;gap:8px;text-align:center;text-decoration:none;transition:transform .15s,background .2s,color .2s,border-color .2s}\n.aip .btn:active{transform:scale(.98)}\n.aip .btn:disabled{opacity:.6;cursor:default}\n.aip .btn.primary{background:var(--btn);color:var(--btn-ink)}\n.aip .btn.ghost{border:1px solid var(--edge);color:var(--ink);background:var(--paper)}\n.aip .btn.ghost:hover{border-color:var(--ink)}\n.aip .nudge{margin:18px 0 0;font-size:15px;color:var(--muted)}\n.aip .nudge button{color:var(--ink);font-weight:700;text-decoration:underline;text-underline-offset:3px}\n.aip .none{margin-top:28px;padding:24px;border-radius:14px;background:var(--stone);max-width:var(--read)}\n.aip .none .acts{margin-top:0}\n\n.aip .more{font-size:16px;font-weight:700;color:var(--ink);margin:48px 0 16px}\n.aip .grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:32px 18px}\n.aip .row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px;margin-top:30px}\n.aip .row.two{grid-template-columns:repeat(2,minmax(0,1fr));max-width:760px}\n.aip .grid.top{margin-top:30px}\n.aip .card{min-width:0}\n.aip .phw{position:relative}\n.aip .save,.aip .qa{position:absolute;width:38px;height:38px;border-radius:50%;background:color-mix(in srgb,var(--paper) 94%,transparent);color:var(--ink);display:grid;place-items:center;box-shadow:0 3px 12px -5px rgba(34,30,26,.35);transition:transform .15s}\n.aip .save{top:10px;right:10px}\n.aip .qa{right:10px;bottom:10px}\n.aip .save:active,.aip .qa:active{transform:scale(.92)}\n.aip .save[aria-pressed="true"] svg{fill:currentColor}\n.aip .qa.inbag{background:var(--ink);color:var(--paper)}\n.aip .card .brand{font-size:12.5px;margin:12px 0 2px}\n.aip .step{font-size:12.5px;font-weight:700;color:var(--muted);margin:12px 0 2px}\n.aip .nm{font-size:15px;line-height:1.36;font-weight:700;color:var(--ink);margin:0}\n.aip .card .brand + .nm,.aip .step + .nm{margin-top:0}\n.aip .card .phw + .nm{margin-top:12px}\n.aip .nm button{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}\n.aip .pr{font-size:15px;color:var(--ink);margin:4px 0 0}\n.aip .pr span{color:var(--muted);font-size:13.5px;margin-left:8px}\n.aip .wy{font-size:14.5px;line-height:1.5;color:var(--text);margin:8px 0 0}\n.aip .row .wy{font-size:15.5px;line-height:1.55}\n.aip .got{display:flex;align-items:center;gap:6px;font-size:13.5px;font-weight:700;color:var(--ink);margin:8px 0 0}\n\n.aip .asknext{margin-top:48px;max-width:var(--read)}\n.aip .asknext h3{font-size:14.5px;font-weight:700;color:var(--ink);margin:0 0 4px}\n.aip .nx{display:flex;width:100%;align-items:center;justify-content:space-between;gap:14px;padding:14px 2px;border-bottom:1px solid var(--line);font-size:16px;color:var(--ink)}\n.aip .nx svg{flex:none;color:var(--muted);transition:transform .2s var(--ease)}\n.aip .nx:hover svg{transform:translateX(3px)}\n.aip .paused{margin:12px 0 0;font-size:15px;color:var(--muted)}\n\n/* Sticks to the bottom of the screen while the conversation scrolls, then stops at its end, so the footer comes after it. It spans the section with its side margins; a fade, not a line, so the two widths look the same. */\n.aip .tray{position:sticky;bottom:0;z-index:900;margin:0 calc(-1 * var(--gut));background:var(--paper);padding:12px 16px max(12px,env(safe-area-inset-bottom))}\n.aip .tray::before{content:"";position:absolute;left:0;right:0;bottom:100%;height:28px;background:linear-gradient(to top,var(--paper),transparent);pointer-events:none}\n.aip.floats .tray{position:fixed;left:0;right:0;margin:0}\n.aip .tray-in{max-width:760px;margin:0 auto;display:flex;align-items:center;gap:8px}\n.aip .about-line{max-width:760px;margin:0 auto 8px;display:flex;align-items:center;gap:8px;font-size:13.5px;color:var(--muted)}\n.aip .about-line b{color:var(--ink)}\n.aip .ask{position:relative;margin:0;flex:1;min-width:0}\n.aip .ask input{width:100%;height:52px;border-radius:26px;border:1px solid var(--edge);background:var(--paper);padding:0 64px 0 22px;font:inherit;font-size:16.5px;color:var(--ink);transition:border-color .2s,box-shadow .2s}\n.aip .ask input::placeholder{color:var(--muted)}\n.aip .ask input:focus{outline:none;border-color:var(--ink);box-shadow:0 0 0 4px color-mix(in srgb,var(--ink) 7%,transparent)}\n.aip .send{position:absolute;right:5px;top:50%;margin-top:-21px;width:42px;height:42px;border-radius:50%;background:var(--btn);color:var(--btn-ink);display:grid;place-items:center;transition:transform .15s}\n.aip .send:active{transform:scale(.94)}\n.aip .send:disabled{opacity:.45;cursor:default}\n.aip .tb{position:relative;flex:none;height:52px;min-width:52px;padding:0 14px;border-radius:26px;border:1px solid var(--edge);display:inline-flex;align-items:center;justify-content:center;gap:7px;font-size:14.5px;font-weight:700;color:var(--ink);background:var(--paper)}\n.aip .tb.bump{animation:aip-bump .45s var(--ease)}\n@keyframes aip-bump{40%{transform:scale(1.12)}}\n\n.aip .scrim{position:fixed;inset:0;background:rgba(24,20,16,.34);z-index:2147482000;animation:aip-fadein .25s ease both}\n.aip .sheet{position:fixed;z-index:2147482001;background:var(--paper);color:var(--text);overscroll-behavior:contain;top:50%;left:50%;width:min(1000px,92vw);height:min(700px,88vh);border-radius:16px;overflow:hidden;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);transform:translate(-50%,-50%);animation:aip-sheet-in .35s var(--ease) both}\n@keyframes aip-sheet-in{from{transform:translate(-50%,-47%) scale(.98);opacity:0}}\n.aip .sheet.list{grid-template-columns:1fr;width:min(560px,92vw);height:auto;max-height:80vh}\n.aip .sheet > .gal{height:100%;background:var(--stone)}\n.aip .sheet > .gal .slides{height:100%;border-radius:0}\n.aip .sheet > .gal .slides .frame{aspect-ratio:auto;height:100%}\n.aip .sheet .x{position:absolute;top:14px;right:14px;width:42px;height:42px;border-radius:50%;background:color-mix(in srgb,var(--paper) 94%,transparent);display:grid;place-items:center;z-index:3;color:var(--ink);box-shadow:0 2px 10px -4px rgba(0,0,0,.25)}\n.aip .sheet .grab{display:none}\n.aip .shb{padding:26px 28px 34px;overflow-y:auto}\n.aip .shb .name{font-size:23px;margin-right:40px}\n.aip .note{background:var(--stone);border-radius:14px;padding:14px 16px;margin:18px 0 0}\n.aip .note b{display:block;font-size:13.5px;color:var(--ink);margin:0 0 3px}\n.aip .note p{margin:0;font-size:15.5px;line-height:1.55;color:var(--text)}\n.aip .lbl{font-size:14.5px;color:var(--ink);margin:22px 0 10px}\n.aip .lbl b{font-weight:700}\n.aip .swatches{display:flex;flex-wrap:wrap;gap:10px}\n.aip .sw{width:44px;height:44px;border-radius:50%;padding:2px;border:1px solid transparent;transition:border-color .2s}\n.aip .sw img,.aip .sw span{width:100%;height:100%;border-radius:50%;object-fit:cover;background:var(--stone);display:grid;place-items:center;font-size:12px;color:var(--ink)}\n.aip .sw[aria-pressed="true"]{border-color:var(--ink)}\n.aip .sw:disabled{opacity:.35}\n.aip .shb .sizes{flex-wrap:wrap;overflow:visible;margin:0;padding:0}\n.aip .tip{font-size:14px;line-height:1.5;color:var(--muted);margin:12px 0 0}\n.aip .tip b{color:var(--ink)}\n.aip .buy{margin-top:22px;display:flex;flex-direction:column;gap:10px}\n.aip .wide{width:100%}\n.aip .done{display:flex;flex-direction:column;gap:10px}\n.aip .done p{margin:0 0 4px;display:flex;align-items:flex-start;gap:8px;font-size:15.5px;color:var(--ink);line-height:1.45}\n.aip .done p svg{flex:none;margin-top:3px}\n.aip .err{margin:0;font-size:14.5px;color:var(--ink)}\n.aip .facts{margin-top:28px;padding-top:20px;border-top:1px solid var(--line)}\n.aip .facts h4{font-size:14px;font-weight:700;color:var(--ink);margin:16px 0 6px}\n.aip .facts h4:first-child{margin-top:0}\n.aip .facts ul{margin:0;padding-left:18px;font-size:14.5px;line-height:1.6;color:var(--text)}\n.aip .about{margin-top:16px;font-size:14.5px;line-height:1.65;color:var(--muted)}\n.aip .about p{margin:0 0 10px}\n.aip .about ul{margin:0 0 10px;padding-left:18px}\n.aip .shb > .linkbtn{display:block;margin-top:16px}\n.aip .pdp{display:inline-block;margin-top:16px;font-size:15px;font-weight:700;color:var(--ink);text-underline-offset:3px}\n.aip .lrow{display:flex;align-items:center;gap:14px;padding:12px 0;border-bottom:1px solid var(--line)}\n.aip .lrow .frame{width:56px;flex:none;border-radius:5px}\n.aip .lrow div{flex:1;min-width:0}\n.aip .lrow b{display:block;font-size:15px;color:var(--ink);line-height:1.35;word-break:normal;overflow-wrap:break-word}\n.aip .lrow span{display:block;font-size:14px;color:var(--muted)}\n.aip .lrow .linkbtn{font-size:14px;flex:none;white-space:nowrap}\n.aip .empty{color:var(--muted);font-size:15px;margin:12px 0 0}\n\n.aip .toast{position:fixed;left:50%;bottom:calc(var(--tray) + 12px);transform:translateX(-50%);background:var(--ink);color:var(--paper);border-radius:999px;padding:12px 14px 12px 20px;display:flex;align-items:center;gap:16px;font-size:14.5px;z-index:2147481999;width:max-content;max-width:calc(100% - 32px);animation:aip-toast .35s var(--ease) both}\n@keyframes aip-toast{from{opacity:0;transform:translate(-50%,14px)}}\n.aip .toast button{color:var(--paper);font-weight:700;white-space:nowrap;text-decoration:underline;text-underline-offset:3px;padding:2px 6px}\n\n@media (max-width:900px){\n .aip{--gut:20px;--tray:78px}\n .aip .turn{padding-top:26px}\n .aip .pick{grid-template-columns:1fr;grid-template-areas:"head" "gal" "body";row-gap:16px;margin-top:24px}\n .aip .pick .head{padding-top:0}\n .aip .pick .gal{margin:0 calc(var(--gut) * -1)}\n .aip .pick .gal .slides{gap:8px;padding:0 var(--gut);scroll-padding-inline:var(--gut);border-radius:0}\n .aip .pick .gal .slides .frame{flex:0 0 56%;border-radius:6px}\n /* A lone photo fills the width but never more than about 340px tall: the decision stays in view. */\n .aip .pick .gal .slides .frame:only-child,.aip .sheet > .gal .slides .frame:only-child{flex-basis:min(100%, calc(340px * var(--ar,.75)))}\n .aip .pick .gal .dots,.aip .pick .gal .gnav{display:none}\n .aip .why{margin-top:2px}\n .aip .grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:26px 12px}\n .aip .row{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scroll-padding-inline:var(--gut);gap:12px;margin:24px calc(var(--gut) * -1) 0;padding:0 var(--gut) 6px;scrollbar-width:none}\n .aip .row::-webkit-scrollbar{display:none}\n .aip .row .card{flex:0 0 62%;scroll-snap-align:start}\n .aip .row.two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:24px 0 0;padding:0}\n .aip .row.two .wy,.aip .row.two .nm{font-size:14.5px}\n .aip .more{margin-top:40px}\n .aip .asknext{margin-top:40px}\n .aip .tray{padding:10px 12px max(10px,env(safe-area-inset-bottom))}\n .aip .ask input{height:50px}\n .aip .tb{height:50px;min-width:50px;padding:0 12px}\n .aip .sheet,.aip .sheet.list{display:block;top:auto;bottom:0;left:0;width:100%;height:auto;max-height:92vh;overflow-y:auto;border-radius:20px 20px 0 0;transform:none;animation:aip-sheet-up .35s var(--ease) both}\n @keyframes aip-sheet-up{from{transform:translateY(102%)}}\n .aip .sheet .grab{display:block;position:absolute;top:8px;left:50%;margin-left:-20px;width:40px;height:4px;border-radius:2px;background:color-mix(in srgb,var(--ink) 25%,transparent);z-index:3}\n .aip .sheet > .gal,.aip .sheet > .gal .slides{height:auto;background:none}\n .aip .sheet > .gal{padding-top:22px}\n .aip .sheet > .gal .slides{gap:8px;padding:0 var(--gut);scroll-padding-inline:var(--gut)}\n .aip .sheet > .gal .slides .frame{flex:0 0 58%;aspect-ratio:var(--ar,3/4);height:auto;border-radius:6px}\n .aip .sheet > .gal .dots,.aip .sheet > .gal .gnav{display:none}\n .aip .shb{padding:18px var(--gut) 28px;overflow:visible}\n .aip .buy{position:sticky;bottom:0;background:var(--paper);margin:22px calc(var(--gut) * -1) 0;padding:12px var(--gut) max(14px,env(safe-area-inset-bottom));border-top:1px solid var(--line);z-index:2}\n}\n@media (min-width:901px) and (max-width:1100px){.aip .grid{grid-template-columns:repeat(3,minmax(0,1fr))}.aip .pick{grid-template-columns:minmax(0,340px) minmax(0,1fr);column-gap:36px}}\n@media (prefers-reduced-motion:reduce){.aip *,.aip *::before,.aip *::after{animation:none!important;transition:none!important}}\n'}),Oe&&e.jsxs("div",{className:"thread",children:[xe.map((n,t)=>{const a=t===xe.length-1,i=a&&n.failed&&!W?(e=>{const n=e.question?.content;if(!n)return null;const{inFlight:t,asks:a}=q.current;if(t?.question===n)return t;const i=[...a].reverse().find(e=>e.question===n);return i?{turnId:i.turnId,question:n,rules:i.rules,startedAt:i.askedAt}:{turnId:w(),question:n,rules:be.current,startedAt:Date.now()}})(n.failed):null,r=!!i&&(he===i.turnId||on(i.startedAt));return e.jsx("div",{ref:a?je:void 0,children:e.jsx(Ge,{section:n,latest:a,avatar:Nn,sizeRow:a?yn:null,cap:a&&wn?an(wn):null,onSize:kn,onAllSizes:jn,onAnyPrice:zn,failed:i?r?{expired:!0,onAskAgain:()=>Re(i.question)}:{expired:!1,onRetry:()=>{Ue(i)}}:void 0,chipsDisabled:l||W,actions:xn})},n.key)}),W&&e.jsx("p",{className:"paused",role:"status",children:A("aiPagePaused").replace("{name}",Cn)})]}),Oe&&e.jsx(tn,{draft:ve,onDraft:ye,onSubmit:()=>{const e=ve.trim();ye(""),Re(e)},sending:l&&!W,placeholder:A(W?"aiPageSearch":"aiPageFollowUp"),inputRef:we,about:ee,onClearAbout:()=>ne(null),savedCount:N?z.length:0,onSaved:()=>Q(!0),cartCount:v,onCart:Be}),K&&e.jsxs("div",{className:"toast",role:"status",children:[e.jsx("span",{children:K}),K!==A("aiPageAddFailed")&&e.jsx("button",{type:"button",onClick:Be,children:A("cartViewCart")})]}),Y&&e.jsx(Xe,{product:Y.product,actions:{...xn,rules:Y.rules,busy:xn.busy||!!xe.find(e=>e.key===Y.from)?.pending},storeName:r?.bot_name||"",onAdd:(e,n)=>We(e,n,!0),onAskAbout:Te,onClose:()=>H(null)},String(Y.product.id)),J&&e.jsx(Ve,{items:z,money:an,onOpen:e=>{Q(!1),H({product:e,rules:be.current})},onRemove:C,onCompare:()=>{const e=z.slice(0,3).map(e=>e.name);Q(!1),Re(A("compareSavedIntent").replace("{names}",e.join(", ")))},onClose:()=>Q(!1)})]})}function xn(n){if(n.dataset.doriMounted)return;n.dataset.doriMounted="1";const t=n.closest("[data-dori-ai-shell]");n.setAttribute("data-nosnippet",""),g.createRoot(n).render(e.jsx(x.StrictMode,{children:e.jsx(f,{children:e.jsx(b,{forceStoreFont:!0,children:e.jsx(gn,{shell:t})})})}));const a=()=>{if(S.current)return S.current();t?.querySelector("[data-dori-ask-input]")?.focus()},i=window;i.doriWidget={...i.doriWidget??{},open:a},z(a)}export{xn as mountAiPage};
Binary file
Binary file