@askdialog/dialog-vue 3.7.0 → 3.9.0

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,4 +1,4 @@
1
- (function(k,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(k=typeof globalThis<"u"?globalThis:k||self,t(k["dialog-vue"]={},k.Vue))})(this,(function(k,t){"use strict";var Co=Object.defineProperty;var So=(k,t,R)=>t in k?Co(k,t,{enumerable:!0,configurable:!0,writable:!0,value:R}):k[t]=R;var M=(k,t,R)=>So(k,typeof t!="symbol"?t+"":t,R);const R=new Set(["ar","he","iw","fa","ur"]),se=o=>o!==void 0&&R.has(o.trim().toLowerCase().slice(0,2)),re=o=>se(o)?"rtl":"ltr";var I;(function(o){o.OPEN_ASSISTANT="open_assistant",o.CLOSE_ASSISTANT="close_assistant",o.SEND_MESSAGE="PRODUCT_QUESTION",o.SEND_GENERIC_QUESTION="GENERIC_QUESTION",o.TRACK_ADD_TO_CART="TRACK_ADD_TO_CART",o.TRACK_SUBMIT_CHECKOUT="TRACK_SUBMIT_CHECKOUT",o.TRACK_VIEW_SEARCH_RESULTS="TRACK_VIEW_SEARCH_RESULTS",o.TRACK_SELECT_SEARCH_RESULT="TRACK_SELECT_SEARCH_RESULT"})(I||(I={}));var q;(function(o){o.USER_OPENED_ASSISTANT="userOpenedAssistant",o.USER_CLOSED_ASSISTANT="userClosedAssistant",o.USER_SENT_MESSAGE="userSentMessage",o.USER_CLICKED_ON_PRODUCT_CARD="userClickedOnProductCard",o.USER_OPENED_RECOMMENDATION="userOpenedRecommendation",o.USER_ADDED_TO_CART="userAddedToCart",o.USER_SEND_POSITIVE_FEEDBACK="userSendPositiveFeedback",o.USER_SEND_NEGATIVE_FEEDBACK="userSendNegativeFeedback"})(q||(q={})),I.TRACK_ADD_TO_CART,I.TRACK_SUBMIT_CHECKOUT,I.TRACK_VIEW_SEARCH_RESULTS,I.TRACK_SELECT_SEARCH_RESULT;class ce extends Error{constructor({status:n,code:s,message:c}){super(c);M(this,"status");M(this,"code");this.name="DialogSearchError",this.status=n,this.code=s}}const A=(o,e,n)=>{if(!/^[a-z]{2}$/.test(e))throw new Error("Search language must be a lowercase ISO 639-1 code.");if(!/^[A-Za-z]{3}$/.test(n))throw new Error("Search currency must be an ISO 4217 code.");return`${o}_${e}_${n.toLowerCase()}`},U="multiple installation methods detected:",le=()=>typeof window>"u"?void 0:window,H=()=>{const o=le();if(o!==void 0)return o.dialog=o.dialog??{},o.dialog.audit=o.dialog.audit??{methods:[],context:{},capabilities:[],warnings:[]},o.dialog.audit},ae=o=>{if(o.warnings=o.warnings.filter(e=>!e.startsWith(U)),o.methods.length>=2){const e=o.methods.map(n=>n.method).join(", ");o.warnings.push(`${U} ${e}`)}},ie=(o,e)=>e===void 0?o:{version:(o==null?void 0:o.version)??e.version,commit:(o==null?void 0:o.commit)??e.commit},K=o=>{const e=H();if(e===void 0)return;const n=e.methods.find(s=>s.method===o.method);if(n===void 0){e.methods.push({...o,registeredAt:new Date().toISOString()}),ae(e);return}n.version=n.version??o.version,n.build=ie(n.build,o.build),n.source=n.source??o.source},de=o=>{const e=H();e!==void 0&&(e.capabilities.includes(o)||e.capabilities.push(o))},w={IDLE:"idle",LOADING:"loading",SUCCESS:"success",EMPTY:"empty",ERROR:"error"},ue=.5,pe=500,me=1500,he=100;function fe({emit:o,visibilityThreshold:e=ue,dwellMs:n=pe,idleFlushMs:s=me,maxItemsPerEvent:c=he}){let r,a=[];const l=new Set,p=new Map,i=new Map;let d;const m=()=>{clearTimeout(d),!(r===void 0||a.length===0)&&(o({...r,items:a}),a=[])},b=g=>{if(r===void 0)return;const f=`${r.query_id}:${g.product_id}`;if(!l.has(f)){if(l.add(f),a.push(g),a.length>=c){m();return}clearTimeout(d),d=setTimeout(m,s)}},_=g=>{const f=i.get(g);f!==void 0&&(clearTimeout(f),i.delete(g))},h=new IntersectionObserver(g=>{for(const f of g){const u=p.get(f.target);u!==void 0&&(f.intersectionRatio>=e?i.has(f.target)||i.set(f.target,setTimeout(()=>{i.delete(f.target),b(u)},n)):_(f.target))}},{threshold:e}),C=()=>{h.disconnect();for(const g of i.values())clearTimeout(g);i.clear(),p.clear()},S=()=>{m()},y=g=>{if(g.persisted){l.clear();for(const f of p.keys())_(f),h.unobserve(f),h.observe(f)}};return window.addEventListener("pagehide",S),window.addEventListener("pageshow",y),{setContext(g){m(),l.clear(),r=g,C()},observe(g,f){p.set(g,f),h.observe(g)},forceImpression(g){b(g),m()},flush:m,disconnect(){m(),C(),window.removeEventListener("pagehide",S),window.removeEventListener("pageshow",y)}}}const F=(o,e)=>({product_id:o.hits[e].objectID,position:o.page*o.hitsPerPage+e+1});function ge(o){let e,n;const s=()=>(e??(e=fe({emit:o.trackViewSearchResults})),e);return{onResponse(c){n={query_id:c.queryID,index:c.index,surface:o.surface,search_type:"lexical",page:c.page+1,total_hits:c.nbHits,query_length:[...c.query].length},s().setContext(n),c.nbHits===0&&o.trackViewSearchResults({...n,items:[]})},observeResult(c,r,a){s().observe(c,F(r,a))},select(c,r){if(n===void 0)return;const a=F(c,r);s().forceImpression(a),o.trackSelectSearchResult({...n,items:[a]})},dispose(){e==null||e.disconnect()}}}const _e=2,j=o=>{const e=o.trim();return[...e].length>=_e?e:void 0},Ee=(o,e,n,{indexName:s,language:c,currency:r,hitsPerPage:a})=>({requests:[{indexName:s,query:o,page:e,hitsPerPage:a},...n.map(l=>({indexName:A(l.index,c,r),query:o,page:0,hitsPerPage:l.hitsPerPage??a}))]}),be=(o,e,{indexName:n,language:s,currency:c})=>{const r=o.results.find(l=>l.index===n);if(r===void 0)throw new Error(`Dialog search returned no ${n} entry`);const a={};for(const l of e){const p=A(l.index,s,c),i=o.results.find(d=>d.index===p);i!==void 0&&(a[l.index]=i)}return{response:r,sections:e.length===0?void 0:a}},D={status:w.IDLE,query:"",page:0,response:void 0,sections:void 0,error:void 0};function ke({search:o,language:e,currency:n,analytics:s,navigate:c,debounceMs:r=250,hitsPerPage:a=12,sections:l=[]}){const p={indexName:A("products",e,n),language:e,currency:n,hitsPerPage:a};let i=D;const d=new Set,m=ge(s);let b,_,h,C=0,S=!1;const y=u=>{i={...i,...u};for(const E of d)E(i)},g=()=>{clearTimeout(b),_=void 0,C+=1,h==null||h.abort(),h=void 0},f=async(u,E)=>{g(),h=new AbortController;const T=C;y({status:w.LOADING,query:u,page:E});try{const N=typeof l=="function"?l():l,ne=Ee(u,E,N,p),ko=await o(ne,{signal:h.signal});if(T!==C)return;const O=be(ko,N,p);m.onResponse(O.response),y({...O,status:O.response.nbHits===0?w.EMPTY:w.SUCCESS,error:void 0})}catch(N){if(N instanceof DOMException&&N.name==="AbortError"||T!==C)return;y({status:w.ERROR,error:N,response:void 0,sections:void 0})}};return{setQuery(u){if(S)return;g();const E=j(u);if(E===void 0){y(D);return}_=E,b=setTimeout(()=>void f(E,0),r)},submit(u){if(S)return;g();const E=j(u);if(E===void 0){y(D);return}f(E,0)},setPage(u){if(!S){if(_!==void 0){f(_,0);return}i.query!==""&&f(i.query,u)}},retry(){S||i.status!==w.ERROR||f(i.query,i.page)},observeResult(u,E){i.response!==void 0&&m.observeResult(u,i.response,E)},selectResult(u,E){const T=i.response;if(T===void 0)return!1;m.select(T,u);const N=T.hits[u].url;return((E==null?void 0:E.navigate)??!0)&&c!==void 0&&N!==void 0?(c(N,T.hits[u]),!0):!1},subscribe(u){return d.add(u),()=>{d.delete(u)}},getState:()=>i,dispose(){S=!0,g(),d.clear(),m.dispose()}}}const Ce={class:"dialog-block-header-container"},Se={class:"dialog-block-title"},ye={class:"dialog-block-description"},we=t.defineComponent({__name:"DialogBlockHeader",props:{title:{},description:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("div",Ce,[t.createElementVNode("div",Se,t.toDisplayString(e.title??"Your expert"),1),t.createElementVNode("div",ye,t.toDisplayString(e.description??"A question about this product?"),1)]))}}),$=(o,e)=>{const n=o.__vccOpts||o;for(const[s,c]of e)n[s]=c;return n},$e=$(we,[["__scopeId","data-v-28e6dda7"]]),Ne={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Te={"clip-path":"url(#clip0_466_934)"},Re=["stroke"],Ie=["stroke"],Be=t.defineComponent({__name:"AiStarsIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",Ne,[t.createElementVNode("g",Te,[t.createElementVNode("path",{d:`M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
1
+ (function(S,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(S=typeof globalThis<"u"?globalThis:S||self,t(S["dialog-vue"]={},S.Vue))})(this,(function(S,t){"use strict";var Ro=Object.defineProperty;var Bo=(S,t,T)=>t in S?Ro(S,t,{enumerable:!0,configurable:!0,writable:!0,value:T}):S[t]=T;var q=(S,t,T)=>Bo(S,typeof t!="symbol"?t+"":t,T);const T=new Set(["ar","he","iw","fa","ur"]),ce=o=>o!==void 0&&T.has(o.trim().toLowerCase().slice(0,2)),le=o=>ce(o)?"rtl":"ltr";var R;(function(o){o.OPEN_ASSISTANT="open_assistant",o.OPEN_WITH_SUGGESTIONS="OPEN_WITH_SUGGESTIONS",o.CLOSE_ASSISTANT="close_assistant",o.SEND_MESSAGE="PRODUCT_QUESTION",o.SEND_GENERIC_QUESTION="GENERIC_QUESTION",o.TRACK_ADD_TO_CART="TRACK_ADD_TO_CART",o.TRACK_SUBMIT_CHECKOUT="TRACK_SUBMIT_CHECKOUT",o.TRACK_VIEW_SEARCH_RESULTS="TRACK_VIEW_SEARCH_RESULTS",o.TRACK_SELECT_SEARCH_RESULT="TRACK_SELECT_SEARCH_RESULT"})(R||(R={}));var M;(function(o){o.USER_OPENED_ASSISTANT="userOpenedAssistant",o.USER_CLOSED_ASSISTANT="userClosedAssistant",o.USER_SENT_MESSAGE="userSentMessage",o.USER_CLICKED_ON_PRODUCT_CARD="userClickedOnProductCard",o.USER_OPENED_RECOMMENDATION="userOpenedRecommendation",o.USER_ADDED_TO_CART="userAddedToCart",o.USER_SEND_POSITIVE_FEEDBACK="userSendPositiveFeedback",o.USER_SEND_NEGATIVE_FEEDBACK="userSendNegativeFeedback"})(M||(M={})),R.TRACK_ADD_TO_CART,R.TRACK_SUBMIT_CHECKOUT,R.TRACK_VIEW_SEARCH_RESULTS,R.TRACK_SELECT_SEARCH_RESULT;class ae extends Error{constructor({status:n,code:s,message:r}){super(r);q(this,"status");q(this,"code");this.name="DialogSearchError",this.status=n,this.code=s}}const V=(o,e,n)=>{if(!/^[a-z]{2}$/.test(e))throw new Error("Search language must be a lowercase ISO 639-1 code.");if(!/^[A-Za-z]{3}$/.test(n))throw new Error("Search currency must be an ISO 4217 code.");return`${o}_${e}_${n.toLowerCase()}`},U="multiple installation methods detected:",ie=()=>typeof window>"u"?void 0:window,H=()=>{const o=ie();if(o!==void 0)return o.dialog=o.dialog??{},o.dialog.audit=o.dialog.audit??{methods:[],context:{},capabilities:[],warnings:[]},o.dialog.audit},de=o=>{if(o.warnings=o.warnings.filter(e=>!e.startsWith(U)),o.methods.length>=2){const e=o.methods.map(n=>n.method).join(", ");o.warnings.push(`${U} ${e}`)}},ue=(o,e)=>e===void 0?o:{version:(o==null?void 0:o.version)??e.version,commit:(o==null?void 0:o.commit)??e.commit},K=o=>{const e=H();if(e===void 0)return;const n=e.methods.find(s=>s.method===o.method);if(n===void 0){e.methods.push({...o,registeredAt:new Date().toISOString()}),de(e);return}n.version=n.version??o.version,n.build=ue(n.build,o.build),n.source=n.source??o.source},pe=o=>{const e=H();e!==void 0&&(e.capabilities.includes(o)||e.capabilities.push(o))},I={IDLE:"idle",LOADING:"loading",SUCCESS:"success",EMPTY:"empty",ERROR:"error"},me=.5,he=500,fe=1500,ge=100;function _e({emit:o,visibilityThreshold:e=me,dwellMs:n=he,idleFlushMs:s=fe,maxItemsPerEvent:r=ge}){let c,a=[];const l=new Set,p=new Map,d=new Map;let E;const i=()=>{clearTimeout(E),!(c===void 0||a.length===0)&&(o({...c,items:a}),a=[])},h=_=>{if(c===void 0)return;const g=`${c.query_id}:${_.product_id}`;if(!l.has(g)){if(l.add(g),a.push(_),a.length>=r){i();return}clearTimeout(E),E=setTimeout(i,s)}},f=_=>{const g=d.get(_);g!==void 0&&(clearTimeout(g),d.delete(_))},m=new IntersectionObserver(_=>{for(const g of _){const u=p.get(g.target);u!==void 0&&(g.intersectionRatio>=e?d.has(g.target)||d.set(g.target,setTimeout(()=>{d.delete(g.target),h(u)},n)):f(g.target))}},{threshold:e}),b=()=>{m.disconnect();for(const _ of d.values())clearTimeout(_);d.clear(),p.clear()},C=()=>{i()},y=_=>{if(_.persisted){l.clear();for(const g of p.keys())f(g),m.unobserve(g),m.observe(g)}};return window.addEventListener("pagehide",C),window.addEventListener("pageshow",y),{setContext(_){i(),l.clear(),c=_,b()},observe(_,g){p.set(_,g),m.observe(_)},forceImpression(_){h(_),i()},flush:i,disconnect(){i(),b(),window.removeEventListener("pagehide",C),window.removeEventListener("pageshow",y)}}}const F=(o,e)=>({product_id:o.hits[e].objectID,position:o.page*o.hitsPerPage+e+1});function Ee(o){let e,n;const s=()=>(e??(e=_e({emit:o.trackViewSearchResults})),e);return{onResponse(r){n={query_id:r.queryID,index:r.index,surface:o.surface,search_type:"lexical",page:r.page+1,total_hits:r.nbHits,query_length:[...r.query].length},s().setContext(n),r.nbHits===0&&o.trackViewSearchResults({...n,items:[]})},observeResult(r,c,a){s().observe(r,F(c,a))},select(r,c){if(n===void 0)return;const a=F(r,c);s().forceImpression(a),o.trackSelectSearchResult({...n,items:[a]})},dispose(){e==null||e.disconnect()}}}const ke=2,z=o=>{const e=o.trim();return[...e].length>=ke?e:void 0},Se=(o,e,n,{indexName:s,language:r,currency:c,hitsPerPage:a})=>({requests:[{indexName:s,query:o,page:e,hitsPerPage:a},...n.map(l=>({indexName:V(l.index,r,c),query:o,page:0,hitsPerPage:l.hitsPerPage??a}))]}),be=(o,e,{indexName:n,language:s,currency:r})=>{const c=o.results.find(l=>l.index===n);if(c===void 0)throw new Error(`Dialog search returned no ${n} entry`);const a={};for(const l of e){const p=V(l.index,s,r),d=o.results.find(E=>E.index===p);d!==void 0&&(a[l.index]=d)}return{response:c,sections:e.length===0?void 0:a}},D={status:I.IDLE,query:"",page:0,response:void 0,sections:void 0,error:void 0};function Ce({search:o,language:e,currency:n,analytics:s,navigate:r,debounceMs:c=250,hitsPerPage:a=12,sections:l=[]}){const p={indexName:V("products",e,n),language:e,currency:n,hitsPerPage:a};let d=D;const E=new Set,i=Ee(s);let h,f,m,b=0,C=!1;const y=u=>{d={...d,...u};for(const k of E)k(d)},_=()=>{clearTimeout(h),f=void 0,b+=1,m==null||m.abort(),m=void 0},g=async(u,k)=>{_(),m=new AbortController;const N=b;y({status:I.LOADING,query:u,page:k});try{const $=typeof l=="function"?l():l,re=Se(u,k,$,p),To=await o(re,{signal:m.signal});if(N!==b)return;const O=be(To,$,p);i.onResponse(O.response),y({...O,status:O.response.nbHits===0?I.EMPTY:I.SUCCESS,error:void 0})}catch($){if($ instanceof DOMException&&$.name==="AbortError"||N!==b)return;y({status:I.ERROR,error:$,response:void 0,sections:void 0})}};return{setQuery(u){if(C)return;_();const k=z(u);if(k===void 0){y(D);return}f=k,h=setTimeout(()=>void g(k,0),c)},submit(u){if(C)return;_();const k=z(u);if(k===void 0){y(D);return}g(k,0)},setPage(u){if(!C){if(f!==void 0){g(f,0);return}d.query!==""&&g(d.query,u)}},retry(){C||d.status!==I.ERROR||g(d.query,d.page)},observeResult(u,k){d.response!==void 0&&i.observeResult(u,d.response,k)},selectResult(u,k){const N=d.response;if(N===void 0)return!1;i.select(N,u);const $=N.hits[u].url;return((k==null?void 0:k.navigate)??!0)&&r!==void 0&&$!==void 0?(r($,N.hits[u]),!0):!1},subscribe(u){return E.add(u),()=>{E.delete(u)}},getState:()=>d,dispose(){C=!0,_(),E.clear(),i.dispose()}}}const j={en:{placeholder:"Ask the AI a question",aiDisclosure:"You're chatting with an AI assistant. It can make mistakes, so please double-check important information",askSomethingElse:"Ask something else"},fr:{placeholder:"Posez une question à l'IA",aiDisclosure:"Vous discutez avec un assistant IA. Il peut se tromper, pensez à vérifier les informations importantes",askSomethingElse:"Posez une autre question"},es:{placeholder:"Haz una pregunta a la IA",aiDisclosure:"Estás chateando con un asistente de IA. Puede cometer errores, así que verifica la información importante",askSomethingElse:"Pregunta otra cosa"}},G=o=>{var n;const e=((n=o==null?void 0:o.split("-")[0])==null?void 0:n.toLowerCase())??"en";return j[e]??j.en},ye=["disabled"],Ie=t.defineComponent({__name:"DialogAskSomethingElse",props:{client:{},questions:{},disabled:{type:Boolean},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o,n=()=>{e.client.openAssistantWithSuggestions({questions:e.questions??[],product:{id:e.productId,title:e.productTitle,selectedVariantId:e.selectedVariantId}})};return(s,r)=>(t.openBlock(),t.createElementBlock("button",{type:"button",class:"dialog-ask-something-else",disabled:e.disabled,onClick:n},t.toDisplayString(t.unref(G)(e.client.locale).askSomethingElse),9,ye))}}),w=(o,e)=>{const n=o.__vccOpts||o;for(const[s,r]of e)n[s]=r;return n},we=w(Ie,[["__scopeId","data-v-d0e272a0"]]),$e={class:"dialog-block-header-container"},Ne={class:"dialog-block-title"},Te={class:"dialog-block-description"},Re=w(t.defineComponent({__name:"DialogBlockHeader",props:{title:{},description:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("div",$e,[t.createElementVNode("div",Ne,t.toDisplayString(e.title??"Your expert"),1),t.createElementVNode("div",Te,t.toDisplayString(e.description??"A question about this product?"),1)]))}}),[["__scopeId","data-v-28e6dda7"]]),Be={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ae={"clip-path":"url(#clip0_466_934)"},Le=["stroke"],Ve=["stroke"],De=t.defineComponent({__name:"AiStarsIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",Be,[t.createElementVNode("g",Ae,[t.createElementVNode("path",{d:`M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
2
2
  12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
3
3
  13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559
4
4
  15.5689 7.00388 15.7167C6.83375 15.8478 6.68124 16.0003 6.55011 16.1704C6.40232
@@ -7,7 +7,7 @@
7
7
  15.7167C3.6379 15.5689 3.41666 15.4583 2.97418 15.237L1.66675 14.5833L2.97418
8
8
  13.9296C3.41666 13.7084 3.6379 13.5977 3.82962 13.45C3.99974 13.3188 4.15225
9
9
  13.1663 4.28339 12.9962C4.43117 12.8045 4.54179 12.5832 4.76303 12.1408L5.41675
10
- 10.8333Z`,stroke:e.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Re),t.createElementVNode("path",{d:`M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
10
+ 10.8333Z`,stroke:e.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Le),t.createElementVNode("path",{d:`M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
11
11
  5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
12
12
  6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632
13
13
  8.83469 14.6062 9.01742C14.3785 9.17937 14.1795 9.37836 14.0175 9.60612C13.8348
@@ -16,4 +16,4 @@
16
16
  9.01742C10.137 8.83469 9.83145 8.71718 9.22043 8.48217L6.66675 7.49999L9.22043
17
17
  6.5178C9.83145 6.28279 10.137 6.16529 10.3939 5.98256C10.6217 5.82061 10.8207
18
18
  5.62162 10.9827 5.39386C11.1654 5.13688 11.2829 4.83136 11.5179 4.22034L12.5001
19
- 1.66666Z`,stroke:e.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Ie)]),s[0]||(s[0]=t.createElementVNode("defs",null,[t.createElementVNode("clipPath",{id:"clip0_466_934"},[t.createElementVNode("rect",{width:"20",height:"20",fill:"white"})])],-1))]))}}),Le=["onClick"],Ve={class:"dialog-block-suggestions-item-label"},Ae=$(t.defineComponent({__name:"DialogBlockSuggestions",props:{client:{},questions:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o,n=s=>{e.client.sendProductMessage({productId:e.productId,productTitle:e.productTitle,selectedVariantId:e.selectedVariantId,question:s,fromQuestionSuggestion:!0})};return(s,c)=>(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.questions,r=>(t.openBlock(),t.createElementBlock("button",{key:r.question,class:"dialog-block-suggestions-item",onClick:a=>n(r.question)},[t.createVNode(Be,{class:"dialog-block-suggestions-item-icon",color:e.client.theme.primaryColor},null,8,["color"]),t.createElementVNode("span",Ve,t.toDisplayString(r.question),1)],8,Le))),128))}}),[["__scopeId","data-v-db34d4b4"]]),De={};function xe(o,e){return t.openBlock(),t.createElementBlock(t.Fragment,null,[e[0]||(e[0]=t.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),e[1]||(e[1]=t.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),e[2]||(e[2]=t.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1))],64)}const Pe=$(De,[["render",xe],["__scopeId","data-v-26a64b58"]]),Oe={class:"dialog-block-suggestions-container"},Me=$(t.defineComponent({__name:"DialogBlockSuggestionsContainer",props:{client:{},questions:{},isLoading:{type:Boolean},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("div",Oe,[e.isLoading||!e.questions?(t.openBlock(),t.createBlock(Pe,{key:0})):(t.openBlock(),t.createBlock(Ae,{key:1,client:e.client,questions:e.questions,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e.selectedVariantId},null,8,["client","questions","product-id","product-title","selected-variant-id"]))]))}}),[["__scopeId","data-v-18c9e78b"]]),qe={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ue=["stroke"],He=t.defineComponent({__name:"ArrowIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",qe,[t.createElementVNode("path",{d:"M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",stroke:e.color||"#ffffff","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Ue)]))}}),Ke=["placeholder"],Fe=["disabled"],z=$(t.defineComponent({__name:"DialogInput",props:{client:{},placeholder:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o,n=t.ref(),s=t.ref(""),c=()=>{var a;(a=n.value)==null||a.focus()},r=()=>{const a=s.value;a.trim()&&(e.client.sendProductMessage({productId:e.productId,productTitle:e.productTitle,selectedVariantId:e.selectedVariantId,question:a,fromQuestionSuggestion:!0}),s.value="")};return(a,l)=>(t.openBlock(),t.createElementBlock("div",{class:"dialog-input-wrapper",onClick:c},[t.withDirectives(t.createElementVNode("input",{id:"dialog-ask-anything-input-ai-input",ref_key:"inputRef",ref:n,"onUpdate:modelValue":l[0]||(l[0]=p=>s.value=p),class:"dialog-ask-anything-input-ai-input",placeholder:e.placeholder??"Ask anything...",onKeydown:t.withKeys(r,["enter"])},null,40,Ke),[[t.vModelText,s.value]]),t.createElementVNode("button",{id:"send-message-button-ai-input",class:"dialog-input-submit",disabled:!s.value.trim(),onClick:r},[t.createVNode(He,{color:e.client.theme.ctaTextColor},null,8,["color"])],8,Fe)]))}}),[["__scopeId","data-v-4f5901c9"]]),je=t.defineComponent({__name:"ThemeProvider",props:{theme:{}},setup(o){const e=o,n=document.body,s=r=>r.replace(/([A-Z])/g,"-$1").toLowerCase(),c=r=>{r&&Object.keys(r).forEach(a=>{const l=a,p=s(a);if(r[l]!==void 0){if(typeof r[l]=="object"){Object.keys(r[l]).forEach(i=>{var m;const d=i;if(d!==void 0){const b=s(i),_=r[l];n.style.setProperty(`--dialog-theme-${p}-${b}`,(m=_[d])==null?void 0:m.toString())}});return}if(l==="ctaBorderType"){const i=r[l]==="rounded"?"24px":"0";n.style.setProperty(`--dialog-theme-${p}`,i);return}n.style.setProperty(`--dialog-theme-${p}`,r[l].toString())}})};return t.onMounted(()=>{e.theme&&c(e.theme)}),t.watch(()=>e.theme,r=>{r&&c(r)},{deep:!0}),(r,a)=>t.renderSlot(r.$slots,"default")}}),ze=["dir"],ve=$(t.defineComponent({__name:"DialogProductBlock",props:{client:{},productId:{},productTitle:{},selectedVariantId:{default:void 0},enableInput:{type:Boolean,default:!0}},setup(o){const e=o;t.onMounted(()=>{K({method:"vue",version:"3.7.0"}),de("pdp-block")});const n=t.ref(!0),s=t.ref(void 0),c=t.ref(0),r=t.computed(()=>{var d;return n.value?"":(d=s.value)==null?void 0:d.assistantName}),a=t.computed(()=>{var d;return n.value?"":(d=s.value)==null?void 0:d.description}),l=t.computed(()=>{var d;return n.value?"":(d=s.value)==null?void 0:d.inputPlaceholder}),p=t.computed(()=>{var d;return re((d=e.client.getLocalizationInformations())==null?void 0:d.languageCode)}),i=async()=>{const d=++c.value;n.value=!0,s.value=void 0;try{const m=await e.client.getSuggestions(e.productId);d===c.value&&(s.value=m)}catch(m){console.error("error",m)}finally{d===c.value&&(n.value=!1)}};return t.watch(()=>[e.client,e.productId],()=>{i()},{immediate:!0}),(d,m)=>(t.openBlock(),t.createBlock(je,{theme:e.client.theme},{default:t.withCtx(()=>{var b;return[t.createElementVNode("div",{id:"dialog-instant",class:"dialog-block-container",dir:p.value},[t.createVNode($e,{title:r.value,description:a.value},null,8,["title","description"]),t.createVNode(Me,{client:e.client,questions:(b=s.value)==null?void 0:b.questions,"is-loading":n.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e==null?void 0:e.selectedVariantId},null,8,["client","questions","is-loading","product-id","product-title","selected-variant-id"]),e.enableInput?(t.openBlock(),t.createBlock(z,{key:0,client:e.client,placeholder:l.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e==null?void 0:e.selectedVariantId},null,8,["client","placeholder","product-id","product-title","selected-variant-id"])):t.createCommentVNode("",!0)],8,ze)]}),_:1},8,["theme"]))}}),[["__scopeId","data-v-c57aa677"]]),Ge={},Qe={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function We(o,e){return t.openBlock(),t.createElementBlock("svg",Qe,e[0]||(e[0]=[t.createElementVNode("path",{d:"M8 13V3M8 3L3 8M8 3L13 8",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const Xe=$(Ge,[["render",We]]),Ze={width:"16",height:"16",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},Ye=["fill"],Je="M5.3217 0.588255C5.63241 -0.196084 6.36759 -0.196085 6.6783 0.588254C6.98901 1.37259 7.68193 2.82807 8.42693 3.57307C9.17193 4.31807 10.6274 5.01099 11.4117 5.3217C12.1961 5.63241 12.1961 6.36759 11.4117 6.6783C10.6274 6.98901 9.17193 7.68193 8.42693 8.42693C7.68193 9.17193 6.98901 10.6274 6.6783 11.4117C6.36759 12.1961 5.63241 12.1961 5.3217 11.4117C5.01099 10.6274 4.31807 9.17193 3.57307 8.42693C2.82808 7.68193 1.37259 6.98901 0.588255 6.6783C-0.196084 6.36759 -0.196085 5.63241 0.588254 5.3217C1.37259 5.01099 2.82807 4.31807 3.57307 3.57307C4.31807 2.82808 5.01099 1.37259 5.3217 0.588255Z",et=t.defineComponent({__name:"ShurikenIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",Ze,[t.createElementVNode("path",{d:Je,fill:e.color||"currentColor"},null,8,Ye)]))}}),tt={class:"dialog-search-bar-field"},ot={class:"dialog-search-bar-icon"},nt=["aria-label","placeholder","autofocus"],st=["aria-label"],rt=t.defineComponent({__name:"DialogSearchBar",props:{controller:{},placeholder:{default:"Search products..."},autoFocus:{type:Boolean,default:!1},submitAriaLabel:{default:"Search"}},setup(o){const e=o,n=t.ref(""),s=()=>{e.controller.setQuery(n.value)},c=()=>{e.controller.submit(n.value)};return(r,a)=>(t.openBlock(),t.createElementBlock("form",{class:"dialog-search-bar",role:"search",onSubmit:t.withModifiers(c,["prevent"])},[t.createElementVNode("div",tt,[t.createElementVNode("span",ot,[t.createVNode(et)]),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>n.value=l),type:"text",name:"dialog-search-query",class:"dialog-search-bar-input","aria-label":e.placeholder,placeholder:e.placeholder,autofocus:e.autoFocus,onInput:s},null,40,nt),[[t.vModelText,n.value]])]),t.createElementVNode("button",{type:"submit",class:"dialog-search-bar-submit","aria-label":e.submitAriaLabel},[t.createVNode(Xe)],8,st)],32))}}),ct=(o,e)=>{try{return new Intl.NumberFormat(e).format(o)}catch{return String(o)}},v={en:o=>({searching:e=>`Searching “${e}”…`,noResults:"No matching products",retry:"Retry",collectionsLabel:"Collections",productsLabel:"Products",collectionsCount:e=>e===1?"1 collection":`${o(e)} collections`,resultsCount:e=>e===1?"1 result":`${o(e)} results`,seeAllLabel:e=>e===1?"See the result":`See all ${o(e)} results`,previous:"Previous",next:"Next",pageOf:(e,n)=>`Page ${o(e)} / ${o(n)}`}),fr:o=>({searching:e=>`Recherche de « ${e} »…`,noResults:"Aucun produit correspondant",retry:"Réessayer",collectionsLabel:"Collections",productsLabel:"Produits",collectionsCount:e=>e===1?"1 collection":`${o(e)} collections`,resultsCount:e=>e===1?"1 résultat":`${o(e)} résultats`,seeAllLabel:e=>e===1?"Voir le résultat":`Voir les ${o(e)} résultats`,previous:"Précédent",next:"Suivant",pageOf:(e,n)=>`Page ${o(e)} / ${o(n)}`}),de:o=>({searching:e=>`Suche nach „${e}“…`,noResults:"Keine passenden Produkte",retry:"Erneut versuchen",collectionsLabel:"Kollektionen",productsLabel:"Produkte",collectionsCount:e=>e===1?"1 Kollektion":`${o(e)} Kollektionen`,resultsCount:e=>e===1?"1 Ergebnis":`${o(e)} Ergebnisse`,seeAllLabel:e=>e===1?"Das Ergebnis anzeigen":`Alle ${o(e)} Ergebnisse anzeigen`,previous:"Zurück",next:"Weiter",pageOf:(e,n)=>`Seite ${o(e)} / ${o(n)}`}),es:o=>({searching:e=>`Buscando «${e}»…`,noResults:"No hay productos que coincidan",retry:"Reintentar",collectionsLabel:"Colecciones",productsLabel:"Productos",collectionsCount:e=>e===1?"1 colección":`${o(e)} colecciones`,resultsCount:e=>e===1?"1 resultado":`${o(e)} resultados`,seeAllLabel:e=>e===1?"Ver el resultado":`Ver los ${o(e)} resultados`,previous:"Anterior",next:"Siguiente",pageOf:(e,n)=>`Página ${o(e)} / ${o(n)}`}),it:o=>({searching:e=>`Ricerca di “${e}”…`,noResults:"Nessun prodotto corrispondente",retry:"Riprova",collectionsLabel:"Collezioni",productsLabel:"Prodotti",collectionsCount:e=>e===1?"1 collezione":`${o(e)} collezioni`,resultsCount:e=>e===1?"1 risultato":`${o(e)} risultati`,seeAllLabel:e=>e===1?"Vedi il risultato":`Vedi tutti i ${o(e)} risultati`,previous:"Precedente",next:"Successivo",pageOf:(e,n)=>`Pagina ${o(e)} / ${o(n)}`})},G=o=>{var s;const e=((s=o==null?void 0:o.split("-")[0])==null?void 0:s.toLowerCase())??"en";return(v[e]??v.en)(c=>ct(c,o))},Q=o=>o.status!==w.LOADING&&o.response!==void 0&&o.response.nbPages>1,lt={key:0,"aria-label":"Search results pages",class:"dialog-search-pagination"},at=["disabled"],it=["disabled"],W=t.defineComponent({__name:"DialogSearchPagination",props:{controller:{},state:{},locale:{}},setup(o){const e=o,n=t.computed(()=>e.state.response),s=t.computed(()=>G(e.locale));return(c,r)=>n.value!==void 0&&t.unref(Q)(e.state)?(t.openBlock(),t.createElementBlock("nav",lt,[t.createElementVNode("button",{type:"button",disabled:n.value.page===0,onClick:r[0]||(r[0]=a=>e.controller.setPage(n.value.page-1))},t.toDisplayString(s.value.previous),9,at),t.createElementVNode("span",null,t.toDisplayString(s.value.pageOf(n.value.page+1,n.value.nbPages)),1),t.createElementVNode("button",{type:"button",disabled:n.value.page>=n.value.nbPages-1,onClick:r[1]||(r[1]=a=>e.controller.setPage(n.value.page+1))},t.toDisplayString(s.value.next),9,it)])):t.createCommentVNode("",!0)}}),X=o=>o.normalize("NFD").replace(new RegExp("\\p{M}","gu"),"").replace(/ẞ/gu,"ß").toUpperCase().toLowerCase().replace(/ς/g,"σ"),dt=(o,e)=>{const n={before:"",match:o,after:""},s=X(e.trim());if(s==="")return n;const c=[...o],r=[];let a="";c.forEach((d,m)=>{const b=X(d);for(let _=0;_<b.length;_+=1)r.push(m);a+=b});const l=a.indexOf(s);if(l===-1)return n;const p=r[l],i=r[l+s.length-1]+1;return{before:c.slice(0,p).join(""),match:c.slice(p,i).join(""),after:c.slice(i).join("")}},ut={key:0,class:"dialog-search-muted"},pt={class:"dialog-search-match"},mt={key:1,class:"dialog-search-muted"},Z=t.defineComponent({__name:"HighlightedTitle",props:{title:{},query:{}},setup(o){const e=o,n=t.computed(()=>dt(e.title,e.query));return(s,c)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[n.value.before!==""?(t.openBlock(),t.createElementBlock("span",ut,t.toDisplayString(n.value.before),1)):t.createCommentVNode("",!0),t.createElementVNode("span",pt,t.toDisplayString(n.value.match),1),n.value.after!==""?(t.openBlock(),t.createElementBlock("span",mt,t.toDisplayString(n.value.after),1)):t.createCommentVNode("",!0)],64))}}),ht=({amount:o,currencyCode:e},n)=>e===void 0?new Intl.NumberFormat(n).format(Number(o)):new Intl.NumberFormat(n,{style:"currency",currency:e}).format(Number(o)),ft=(o,e)=>{if(o===void 0)return"";try{return ht(o.min,e)}catch{return""}},gt=o=>{try{const{protocol:e}=new URL(o,window.location.href);return e==="http:"||e==="https:"?o:void 0}catch{return}},Y=o=>o.url===void 0||o.url===""?void 0:gt(o.url),J=o=>o.title??o.handle??o.objectID,_t={class:"dialog-search-product-thumb","aria-hidden":"true"},Et=["src"],bt={class:"dialog-search-product-title"},kt={key:0,class:"dialog-search-product-price"},ee=t.defineComponent({__name:"DialogSearchProductCard",props:{controller:{},hit:{},index:{},locale:{default:void 0},query:{default:""}},setup(o){const e=o,n=t.ref();t.watch(()=>e.hit,()=>{n.value!==void 0&&e.controller.observeResult(n.value,e.index)},{immediate:!0,flush:"post"});const s=t.computed(()=>Y(e.hit)),c=t.computed(()=>ft(e.hit.priceRange,e.locale)),r=l=>{const p=l.metaKey||l.ctrlKey||l.shiftKey||l.altKey;e.controller.selectResult(e.index,{navigate:!p})&&l.preventDefault()},a=l=>{l.button===1&&e.controller.selectResult(e.index,{navigate:!1})};return(l,p)=>(t.openBlock(),t.createElementBlock("li",{ref_key:"cardRef",ref:n,class:"dialog-search-card"},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.value===void 0?"div":"a"),t.mergeProps({class:"dialog-search-product",href:s.value},t.toHandlers(s.value===void 0?{}:{click:r,auxclick:a})),{default:t.withCtx(()=>[t.createElementVNode("span",_t,[e.hit.imageUrl!==void 0&&e.hit.imageUrl!==""?(t.openBlock(),t.createElementBlock("img",{key:0,src:e.hit.imageUrl,alt:"",loading:"lazy"},null,8,Et)):t.createCommentVNode("",!0)]),t.createElementVNode("span",bt,[t.createVNode(Z,{title:t.unref(J)(e.hit),query:e.query},null,8,["title","query"])]),c.value!==""?(t.openBlock(),t.createElementBlock("span",kt,t.toDisplayString(c.value),1)):t.createCommentVNode("",!0)]),_:1},16,["href"]))],512))}}),Ct={},St={width:"16",height:"16",viewBox:"0 0 256 256",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function yt(o,e){return t.openBlock(),t.createElementBlock("svg",St,e[0]||(e[0]=[t.createElementVNode("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"},null,-1)]))}const wt=$(Ct,[["render",yt]]),$t={},Nt={width:"12",height:"12",viewBox:"0 0 256 256",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function Tt(o,e){return t.openBlock(),t.createElementBlock("svg",Nt,e[0]||(e[0]=[t.createElementVNode("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"},null,-1)]))}const Rt=$($t,[["render",Tt]]),te=o=>(o??[]).flatMap(e=>{const n=Y(e);return n===void 0?[]:[{collection:e,href:n}]}),It={key:0,class:"dialog-search-collections"},Bt={class:"dialog-search-section-head"},Lt={class:"dialog-search-label"},Vt={class:"dialog-search-count"},At={class:"dialog-search-collection-list"},Dt=["href"],xt={class:"dialog-search-collection-thumb","aria-hidden":"true"},Pt=["src"],Ot={class:"dialog-search-collection-title"},Mt={class:"dialog-search-caret"},qt=t.defineComponent({__name:"DialogSearchCollections",props:{collections:{},query:{},messages:{}},setup(o){const e=o,n=t.computed(()=>te(e.collections));return(s,c)=>n.value.length>0?(t.openBlock(),t.createElementBlock("aside",It,[t.createElementVNode("div",Bt,[t.createElementVNode("p",Lt,t.toDisplayString(e.messages.collectionsLabel),1),t.createElementVNode("span",Vt,t.toDisplayString(e.messages.collectionsCount(n.value.length)),1)]),t.createElementVNode("ul",At,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value,({collection:r,href:a})=>(t.openBlock(),t.createElementBlock("li",{key:r.objectID},[t.createElementVNode("a",{class:"dialog-search-collection",href:a},[t.createElementVNode("span",xt,[r.imageUrl!==void 0&&r.imageUrl!==""?(t.openBlock(),t.createElementBlock("img",{key:0,src:r.imageUrl,alt:"",loading:"lazy"},null,8,Pt)):t.createCommentVNode("",!0)]),t.createElementVNode("span",Ot,[t.createVNode(Z,{title:t.unref(J)(r),query:e.query},null,8,["title","query"])]),t.createElementVNode("span",Mt,[t.createVNode(Rt)])],8,Dt)]))),128))])])):t.createCommentVNode("",!0)}}),Ut={class:"dialog-search-products"},Ht={class:"dialog-search-section-head"},Kt={class:"dialog-search-label"},Ft={key:0,class:"dialog-search-label-count"},jt={class:"dialog-search-results"},zt={key:0,class:"dialog-search-empty",role:"status"},vt=t.defineComponent({__name:"DialogSearchProducts",props:{controller:{},response:{},locale:{},messages:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("section",Ut,[t.createElementVNode("div",Ht,[t.createElementVNode("p",Kt,[t.createTextVNode(t.toDisplayString(e.messages.productsLabel),1),e.response.nbHits>0?(t.openBlock(),t.createElementBlock("span",Ft," · "+t.toDisplayString(e.messages.resultsCount(e.response.nbHits)),1)):t.createCommentVNode("",!0)])]),t.createElementVNode("ul",jt,[e.response.hits.length===0?(t.openBlock(),t.createElementBlock("li",zt,t.toDisplayString(e.messages.noResults),1)):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(e.response.hits,(c,r)=>(t.openBlock(),t.createBlock(ee,{key:c.objectID,controller:e.controller,hit:c,index:r,locale:e.locale,query:e.response.query},null,8,["controller","hit","index","locale","query"]))),128))])]))}}),L=8,B=16,Gt=200,Qt=1440,Wt=(o,e)=>o.bottom>0&&o.top<e,Xt=(o,e)=>{const n=Math.min(Qt,e-2*B),s=o.left+o.width/2-n/2;return{left:`${Math.min(Math.max(s,B),e-B-n)}px`,width:`${n}px`}},Zt=(o,e,n)=>{const s=n-o.bottom-L-B,c=o.top-L-B,r=Xt(o,e);return s<Gt&&c>s?{...r,bottom:`${n-o.top+L}px`,maxHeight:`${Math.max(c,0)}px`}:{...r,top:`${o.bottom+L}px`,maxHeight:`${Math.max(s,0)}px`}},Yt=o=>{const e=o.trim().replace(/^#/,"");if(!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e))return;const n=e.length<=4?[...e].map(s=>s+s).join(""):e;return[0,2,4].map(s=>Number.parseInt(n.slice(s,s+2),16))},Jt=o=>{const e=/^rgba?\((\d+), (\d+), (\d+)(?:, [\d.]+)?\)$/.exec(o);if(e!==null)return[e[1],e[2],e[3]].map(Number)},eo=o=>{if(typeof document>"u")return;const e=document.createElement("span");if(e.style.color=o,e.style.color==="")return;document.body.appendChild(e);const n=Jt(getComputedStyle(e).color);return e.remove(),n},to=o=>Yt(o)??eo(o),oo=o=>{const e=o/255;return e<=.03928?e/12.92:((e+.055)/1.055)**2.4},oe=o=>{const e=to(o);if(e===void 0)return;const[n,s,c]=e.map(oo);return .2126*n+.7152*s+.0722*c},no="#181825",so="#ffffff",ro="straight",x=.5,P={light:{panel:"#ffffff",side:"#fafbfc",text:"#111827","text-sec":"#6b7280",border:"#eceef2",hover:"#eef2f7",thumb:"#eef1f5"},dark:{panel:"#15171c",side:"#1b1e25",text:"#f3f4f6","text-sec":"#9ca3af",border:"#2b2f38",hover:"#242830",thumb:"#2b2f38"}},co={rectangle:{"r-panel":"4px","r-item":"4px","r-thumb":"2px","r-btn":"4px"},"rectangle-rounded":{"r-panel":"16px","r-item":"10px","r-thumb":"8px","r-btn":"10px"}},V=o=>o===void 0||o.trim()===""?void 0:o.trim(),lo=o=>{const e=o===void 0?void 0:oe(o);return e===void 0?"light":e<x?"dark":"light"},ao=(o,e)=>{const n=oe(o);return n===void 0?P[e].text:(e==="light"?n<x:n>=x)?o:P[e].text},io=o=>{const e=lo(V(o==null?void 0:o.backgroundColor)),n=(o==null?void 0:o.ctaBorderType)===ro?"rectangle":"rectangle-rounded",s=V(o==null?void 0:o.primaryColor)??no,c=V(o==null?void 0:o.fontFamily),r={...P[e],...co[n],primary:s,accent:ao(s,e),"cta-text":V(o==null?void 0:o.ctaTextColor)??so,...c===void 0?{}:{font:c}};return Object.fromEntries(Object.entries(r).map(([a,l])=>[`--dso-${a}`,l]))},uo=o=>{const e=t.ref(),n=t.ref(void 0),s=t.ref({width:0,height:0});return t.watch(o,(c,r,a)=>{if(!c)return;const l=()=>{const p=e.value;if(p===void 0)return;const i=p.previousElementSibling??p,{top:d,bottom:m,left:b,width:_}=i.getBoundingClientRect();(s.value.width!==window.innerWidth||s.value.height!==window.innerHeight)&&(s.value={width:window.innerWidth,height:window.innerHeight});const h=n.value;(h===void 0||h.top!==d||h.bottom!==m||h.left!==b||h.width!==_)&&(n.value={top:d,bottom:m,left:b,width:_})};l(),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),a(()=>{window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)})},{immediate:!0,flush:"post"}),{anchorRef:e,rect:n,viewport:s}},po=(o,e)=>{const n=t.ref(!1),s=t.ref(),c=t.computed(()=>o.value.status!==w.IDLE&&!n.value);t.watch(()=>o.value.query,()=>{n.value=!1}),t.watch(c,(a,l,p)=>{if(!a)return;const i=d=>{var C,S;const m=d.target;if(!(m instanceof Node))return;const b=(C=e.value)==null?void 0:C.previousElementSibling,_=((S=s.value)==null?void 0:S.contains(m))??!1,h=(b==null?void 0:b.contains(m))??!1;!_&&!h&&(n.value=!0)};document.addEventListener("pointerdown",i),p(()=>document.removeEventListener("pointerdown",i))},{immediate:!0});const r=()=>{n.value=!1};return t.onMounted(()=>{var a,l;(l=(a=e.value)==null?void 0:a.previousElementSibling)==null||l.addEventListener("focusin",r)}),t.onUnmounted(()=>{var a,l;(l=(a=e.value)==null?void 0:a.previousElementSibling)==null||l.removeEventListener("focusin",r)}),{isOpen:c,panelRef:s}},mo={key:0,class:"dialog-search-error"},ho={role:"alert",class:"dialog-search-status dialog-search-status-error"},fo={key:1,role:"status",class:"dialog-search-status"},go={key:0,class:"dialog-search-footer"},_o=["href"],Eo=t.defineComponent({__name:"DialogSearchResults",props:{controller:{},state:{},locale:{default:void 0},theme:{default:void 0},layout:{default:"list"},seeAllHref:{type:Function,default:void 0}},setup(o){const e=o,n=u=>u instanceof ce?`Search failed (${u.status}${u.code?` ${u.code}`:""}): ${u.message}`:"Search failed: network error. Check your connection and try again.",s=t.computed(()=>e.state),c=t.computed(()=>e.state.status!==w.IDLE),{anchorRef:r,rect:a,viewport:l}=uo(c),{isOpen:p,panelRef:i}=po(s,r),d=t.computed(()=>p.value&&a.value!==void 0&&Wt(a.value,l.value.height)),m=t.computed(()=>io(e.theme)),b=t.computed(()=>({...a.value===void 0?{}:Zt(a.value,l.value.width,l.value.height),...m.value})),_=t.computed(()=>G(e.locale)),h=t.computed(()=>e.state.response),C=t.computed(()=>{var u,E;return((E=(u=e.state.sections)==null?void 0:u.collections)==null?void 0:E.hits)??[]}),S=t.computed(()=>te(C.value).length>0),y=t.computed(()=>e.seeAllHref!==void 0&&h.value!==void 0&&h.value.nbHits>0),g=t.computed(()=>!y.value&&Q(e.state)),f=t.computed(()=>{var u;return h.value===void 0||(u=e.seeAllHref)==null?void 0:u.call(e,h.value.query)});return(u,E)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"anchorRef",ref:r},null,512),d.value?(t.openBlock(),t.createBlock(t.Teleport,{key:0,to:"body"},[t.createElementVNode("div",{ref_key:"panelRef",ref:i,class:t.normalizeClass(["dialog-search-panel",`dialog-search-panel--${e.layout}`]),style:t.normalizeStyle(b.value)},[e.state.status===t.unref(w).ERROR?(t.openBlock(),t.createElementBlock("div",mo,[t.createElementVNode("p",ho,t.toDisplayString(n(e.state.error)),1),t.createElementVNode("button",{type:"button",class:"dialog-search-retry",onClick:E[0]||(E[0]=T=>e.controller.retry())},t.toDisplayString(_.value.retry),1)])):h.value===void 0?(t.openBlock(),t.createElementBlock("p",fo,t.toDisplayString(_.value.searching(e.state.query)),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",{class:t.normalizeClass(["dialog-search-body",{"dialog-search-body--no-collections":!S.value}])},[t.createVNode(qt,{collections:C.value,query:h.value.query,messages:_.value},null,8,["collections","query","messages"]),t.createVNode(vt,{controller:e.controller,response:h.value,locale:e.locale,messages:_.value},null,8,["controller","response","locale","messages"])],2),y.value||g.value?(t.openBlock(),t.createElementBlock("div",go,[y.value?(t.openBlock(),t.createElementBlock("a",{key:0,class:"dialog-search-cta",href:f.value},[t.createTextVNode(t.toDisplayString(_.value.seeAllLabel(h.value.nbHits))+" ",1),t.createVNode(wt)],8,_o)):(t.openBlock(),t.createBlock(W,{key:1,controller:e.controller,state:e.state,locale:e.locale},null,8,["controller","state","locale"]))])):t.createCommentVNode("",!0)],64))],6)])):t.createCommentVNode("",!0)],64))}}),bo=o=>{const{client:e,surface:n="search_page",...s}=o,c=ke({search:(l,p)=>e.search(l,p),analytics:{surface:n,trackViewSearchResults:l=>e.trackViewSearchResults(l),trackSelectSearchResult:l=>e.trackSelectSearchResult(l)},...s}),r=t.shallowRef(c.getState()),a=c.subscribe(()=>{r.value=c.getState()});return t.onMounted(()=>{K({method:"vue",version:"3.7.0"})}),t.onUnmounted(()=>{a(),c.dispose()}),{controller:c,state:r,theme:e.theme}};k.DialogInput=z,k.DialogProductBlock=ve,k.DialogSearchBar=rt,k.DialogSearchPagination=W,k.DialogSearchProductCard=ee,k.DialogSearchResults=Eo,k.useDialogSearch=bo,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}));
19
+ 1.66666Z`,stroke:e.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Ve)]),s[0]||(s[0]=t.createElementVNode("defs",null,[t.createElementVNode("clipPath",{id:"clip0_466_934"},[t.createElementVNode("rect",{width:"20",height:"20",fill:"white"})])],-1))]))}}),xe=["onClick"],Pe={class:"dialog-block-suggestions-item-label"},Oe=w(t.defineComponent({__name:"DialogBlockSuggestions",props:{client:{},questions:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o,n=s=>{e.client.sendProductMessage({productId:e.productId,productTitle:e.productTitle,selectedVariantId:e.selectedVariantId,question:s,fromQuestionSuggestion:!0})};return(s,r)=>(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.questions,c=>(t.openBlock(),t.createElementBlock("button",{key:c.question,class:"dialog-block-suggestions-item",onClick:a=>n(c.question)},[t.createVNode(De,{class:"dialog-block-suggestions-item-icon",color:e.client.theme.primaryColor},null,8,["color"]),t.createElementVNode("span",Pe,t.toDisplayString(c.question),1)],8,xe))),128))}}),[["__scopeId","data-v-db34d4b4"]]),qe={};function Me(o,e){return t.openBlock(),t.createElementBlock(t.Fragment,null,[e[0]||(e[0]=t.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),e[1]||(e[1]=t.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),e[2]||(e[2]=t.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1))],64)}const Ue=w(qe,[["render",Me],["__scopeId","data-v-26a64b58"]]),He={class:"dialog-block-suggestions-container"},Ke=w(t.defineComponent({__name:"DialogBlockSuggestionsContainer",props:{client:{},questions:{},isLoading:{type:Boolean},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("div",He,[e.isLoading||!e.questions?(t.openBlock(),t.createBlock(Ue,{key:0})):(t.openBlock(),t.createBlock(Oe,{key:1,client:e.client,questions:e.questions,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e.selectedVariantId},null,8,["client","questions","product-id","product-title","selected-variant-id"]))]))}}),[["__scopeId","data-v-18c9e78b"]]),Fe={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ze=["stroke"],je=t.defineComponent({__name:"ArrowIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",Fe,[t.createElementVNode("path",{d:"M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",stroke:e.color||"#ffffff","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,ze)]))}}),Ge={class:"dialog-input-container"},ve=["placeholder"],Qe=["disabled"],We={id:"dialog-input-ai-disclosure",class:"dialog-input-ai-disclosure"},v=w(t.defineComponent({__name:"DialogInput",props:{client:{},placeholder:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o,n=t.ref(),s=t.ref(""),r=t.computed(()=>G(e.client.locale)),c=()=>{var l;(l=n.value)==null||l.focus()},a=()=>{const l=s.value;l.trim()&&(e.client.sendProductMessage({productId:e.productId,productTitle:e.productTitle,selectedVariantId:e.selectedVariantId,question:l,fromQuestionSuggestion:!0}),s.value="")};return(l,p)=>(t.openBlock(),t.createElementBlock("div",Ge,[t.createElementVNode("div",{class:"dialog-input-wrapper",onClick:c},[t.withDirectives(t.createElementVNode("input",{id:"dialog-ask-anything-input-ai-input",ref_key:"inputRef",ref:n,"onUpdate:modelValue":p[0]||(p[0]=d=>s.value=d),class:"dialog-ask-anything-input-ai-input",placeholder:r.value.placeholder,"aria-describedby":"dialog-input-ai-disclosure",onKeydown:t.withKeys(a,["enter"])},null,40,ve),[[t.vModelText,s.value]]),t.createElementVNode("button",{id:"send-message-button-ai-input",class:"dialog-input-submit",disabled:!s.value.trim(),onClick:a},[t.createVNode(je,{color:e.client.theme.ctaTextColor},null,8,["color"])],8,Qe)]),t.createElementVNode("p",We,t.toDisplayString(r.value.aiDisclosure),1)]))}}),[["__scopeId","data-v-87013888"]]),Xe=t.defineComponent({__name:"ThemeProvider",props:{theme:{}},setup(o){const e=o,n=document.body,s=c=>c.replace(/([A-Z])/g,"-$1").toLowerCase(),r=c=>{c&&Object.keys(c).forEach(a=>{const l=a,p=s(a);if(c[l]!==void 0){if(typeof c[l]=="object"){Object.keys(c[l]).forEach(d=>{var i;const E=d;if(E!==void 0){const h=s(d),f=c[l];n.style.setProperty(`--dialog-theme-${p}-${h}`,(i=f[E])==null?void 0:i.toString())}});return}if(l==="ctaBorderType"){const d=c[l]==="rounded"?"24px":"0";n.style.setProperty(`--dialog-theme-${p}`,d);return}n.style.setProperty(`--dialog-theme-${p}`,c[l].toString())}})};return t.onMounted(()=>{e.theme&&r(e.theme)}),t.watch(()=>e.theme,c=>{c&&r(c)},{deep:!0}),(c,a)=>t.renderSlot(c.$slots,"default")}}),Ye=["dir"],Ze=2,Je=5,et=w(t.defineComponent({__name:"DialogProductBlock",props:{client:{},productId:{},productTitle:{},selectedVariantId:{default:void 0},enableInput:{type:Boolean,default:!1}},setup(o){const e=o;t.onMounted(()=>{K({method:"vue",version:"3.9.0"}),pe("pdp-block")});const n=t.ref(!0),s=t.ref(void 0),r=t.ref(0),c=t.computed(()=>{var i;return n.value?"":(i=s.value)==null?void 0:i.assistantName}),a=t.computed(()=>{var i;return n.value?"":(i=s.value)==null?void 0:i.description}),l=t.computed(()=>{var i,h;return(h=(i=s.value)==null?void 0:i.questions)==null?void 0:h.slice(0,Ze)}),p=t.computed(()=>{var i;return n.value?"":(i=s.value)==null?void 0:i.inputPlaceholder}),d=t.computed(()=>{var i;return le((i=e.client.getLocalizationInformations())==null?void 0:i.languageCode)}),E=async()=>{const i=++r.value;n.value=!0,s.value=void 0;try{const h=await e.client.getSuggestions(e.productId,{limit:Je});i===r.value&&(s.value=h)}catch(h){console.error("error",h)}finally{i===r.value&&(n.value=!1)}};return t.watch(()=>[e.client,e.productId],()=>{E()},{immediate:!0}),(i,h)=>(t.openBlock(),t.createBlock(Xe,{theme:e.client.theme},{default:t.withCtx(()=>{var f;return[t.createElementVNode("div",{id:"dialog-instant",class:"dialog-block-container",dir:d.value},[t.createVNode(Re,{title:c.value,description:a.value},null,8,["title","description"]),t.createVNode(Ke,{client:e.client,questions:l.value,"is-loading":n.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e==null?void 0:e.selectedVariantId},null,8,["client","questions","is-loading","product-id","product-title","selected-variant-id"]),e.enableInput?(t.openBlock(),t.createBlock(v,{key:0,client:e.client,placeholder:p.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e==null?void 0:e.selectedVariantId},null,8,["client","placeholder","product-id","product-title","selected-variant-id"])):(t.openBlock(),t.createBlock(we,{key:1,client:e.client,questions:(f=s.value)==null?void 0:f.questions,disabled:n.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e.selectedVariantId},null,8,["client","questions","disabled","product-id","product-title","selected-variant-id"]))],8,Ye)]}),_:1},8,["theme"]))}}),[["__scopeId","data-v-0c307e5f"]]),tt={},ot={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function nt(o,e){return t.openBlock(),t.createElementBlock("svg",ot,e[0]||(e[0]=[t.createElementVNode("path",{d:"M8 13V3M8 3L3 8M8 3L13 8",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const st=w(tt,[["render",nt]]),rt={width:"16",height:"16",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},ct=["fill"],lt="M5.3217 0.588255C5.63241 -0.196084 6.36759 -0.196085 6.6783 0.588254C6.98901 1.37259 7.68193 2.82807 8.42693 3.57307C9.17193 4.31807 10.6274 5.01099 11.4117 5.3217C12.1961 5.63241 12.1961 6.36759 11.4117 6.6783C10.6274 6.98901 9.17193 7.68193 8.42693 8.42693C7.68193 9.17193 6.98901 10.6274 6.6783 11.4117C6.36759 12.1961 5.63241 12.1961 5.3217 11.4117C5.01099 10.6274 4.31807 9.17193 3.57307 8.42693C2.82808 7.68193 1.37259 6.98901 0.588255 6.6783C-0.196084 6.36759 -0.196085 5.63241 0.588254 5.3217C1.37259 5.01099 2.82807 4.31807 3.57307 3.57307C4.31807 2.82808 5.01099 1.37259 5.3217 0.588255Z",at=t.defineComponent({__name:"ShurikenIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",rt,[t.createElementVNode("path",{d:lt,fill:e.color||"currentColor"},null,8,ct)]))}}),it={class:"dialog-search-bar-field"},dt={class:"dialog-search-bar-icon"},ut=["aria-label","placeholder","autofocus"],pt=["aria-label"],mt=t.defineComponent({__name:"DialogSearchBar",props:{controller:{},placeholder:{default:"Search products..."},autoFocus:{type:Boolean,default:!1},submitAriaLabel:{default:"Search"}},setup(o){const e=o,n=t.ref(""),s=()=>{e.controller.setQuery(n.value)},r=()=>{e.controller.submit(n.value)};return(c,a)=>(t.openBlock(),t.createElementBlock("form",{class:"dialog-search-bar",role:"search",onSubmit:t.withModifiers(r,["prevent"])},[t.createElementVNode("div",it,[t.createElementVNode("span",dt,[t.createVNode(at)]),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>n.value=l),type:"text",name:"dialog-search-query",class:"dialog-search-bar-input","aria-label":e.placeholder,placeholder:e.placeholder,autofocus:e.autoFocus,onInput:s},null,40,ut),[[t.vModelText,n.value]])]),t.createElementVNode("button",{type:"submit",class:"dialog-search-bar-submit","aria-label":e.submitAriaLabel},[t.createVNode(st)],8,pt)],32))}}),ht=(o,e)=>{try{return new Intl.NumberFormat(e).format(o)}catch{return String(o)}},Q={en:o=>({searching:e=>`Searching “${e}”…`,noResults:"No matching products",retry:"Retry",collectionsLabel:"Collections",productsLabel:"Products",collectionsCount:e=>e===1?"1 collection":`${o(e)} collections`,resultsCount:e=>e===1?"1 result":`${o(e)} results`,seeAllLabel:e=>e===1?"See the result":`See all ${o(e)} results`,previous:"Previous",next:"Next",pageOf:(e,n)=>`Page ${o(e)} / ${o(n)}`}),fr:o=>({searching:e=>`Recherche de « ${e} »…`,noResults:"Aucun produit correspondant",retry:"Réessayer",collectionsLabel:"Collections",productsLabel:"Produits",collectionsCount:e=>e===1?"1 collection":`${o(e)} collections`,resultsCount:e=>e===1?"1 résultat":`${o(e)} résultats`,seeAllLabel:e=>e===1?"Voir le résultat":`Voir les ${o(e)} résultats`,previous:"Précédent",next:"Suivant",pageOf:(e,n)=>`Page ${o(e)} / ${o(n)}`}),de:o=>({searching:e=>`Suche nach „${e}“…`,noResults:"Keine passenden Produkte",retry:"Erneut versuchen",collectionsLabel:"Kollektionen",productsLabel:"Produkte",collectionsCount:e=>e===1?"1 Kollektion":`${o(e)} Kollektionen`,resultsCount:e=>e===1?"1 Ergebnis":`${o(e)} Ergebnisse`,seeAllLabel:e=>e===1?"Das Ergebnis anzeigen":`Alle ${o(e)} Ergebnisse anzeigen`,previous:"Zurück",next:"Weiter",pageOf:(e,n)=>`Seite ${o(e)} / ${o(n)}`}),es:o=>({searching:e=>`Buscando «${e}»…`,noResults:"No hay productos que coincidan",retry:"Reintentar",collectionsLabel:"Colecciones",productsLabel:"Productos",collectionsCount:e=>e===1?"1 colección":`${o(e)} colecciones`,resultsCount:e=>e===1?"1 resultado":`${o(e)} resultados`,seeAllLabel:e=>e===1?"Ver el resultado":`Ver los ${o(e)} resultados`,previous:"Anterior",next:"Siguiente",pageOf:(e,n)=>`Página ${o(e)} / ${o(n)}`}),it:o=>({searching:e=>`Ricerca di “${e}”…`,noResults:"Nessun prodotto corrispondente",retry:"Riprova",collectionsLabel:"Collezioni",productsLabel:"Prodotti",collectionsCount:e=>e===1?"1 collezione":`${o(e)} collezioni`,resultsCount:e=>e===1?"1 risultato":`${o(e)} risultati`,seeAllLabel:e=>e===1?"Vedi il risultato":`Vedi tutti i ${o(e)} risultati`,previous:"Precedente",next:"Successivo",pageOf:(e,n)=>`Pagina ${o(e)} / ${o(n)}`})},W=o=>{var s;const e=((s=o==null?void 0:o.split("-")[0])==null?void 0:s.toLowerCase())??"en";return(Q[e]??Q.en)(r=>ht(r,o))},X=o=>o.status!==I.LOADING&&o.response!==void 0&&o.response.nbPages>1,ft={key:0,"aria-label":"Search results pages",class:"dialog-search-pagination"},gt=["disabled"],_t=["disabled"],Y=t.defineComponent({__name:"DialogSearchPagination",props:{controller:{},state:{},locale:{}},setup(o){const e=o,n=t.computed(()=>e.state.response),s=t.computed(()=>W(e.locale));return(r,c)=>n.value!==void 0&&t.unref(X)(e.state)?(t.openBlock(),t.createElementBlock("nav",ft,[t.createElementVNode("button",{type:"button",disabled:n.value.page===0,onClick:c[0]||(c[0]=a=>e.controller.setPage(n.value.page-1))},t.toDisplayString(s.value.previous),9,gt),t.createElementVNode("span",null,t.toDisplayString(s.value.pageOf(n.value.page+1,n.value.nbPages)),1),t.createElementVNode("button",{type:"button",disabled:n.value.page>=n.value.nbPages-1,onClick:c[1]||(c[1]=a=>e.controller.setPage(n.value.page+1))},t.toDisplayString(s.value.next),9,_t)])):t.createCommentVNode("",!0)}}),Z=o=>o.normalize("NFD").replace(new RegExp("\\p{M}","gu"),"").replace(/ẞ/gu,"ß").toUpperCase().toLowerCase().replace(/ς/g,"σ"),Et=(o,e)=>{const n={before:"",match:o,after:""},s=Z(e.trim());if(s==="")return n;const r=[...o],c=[];let a="";r.forEach((E,i)=>{const h=Z(E);for(let f=0;f<h.length;f+=1)c.push(i);a+=h});const l=a.indexOf(s);if(l===-1)return n;const p=c[l],d=c[l+s.length-1]+1;return{before:r.slice(0,p).join(""),match:r.slice(p,d).join(""),after:r.slice(d).join("")}},kt={key:0,class:"dialog-search-muted"},St={class:"dialog-search-match"},bt={key:1,class:"dialog-search-muted"},J=t.defineComponent({__name:"HighlightedTitle",props:{title:{},query:{}},setup(o){const e=o,n=t.computed(()=>Et(e.title,e.query));return(s,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[n.value.before!==""?(t.openBlock(),t.createElementBlock("span",kt,t.toDisplayString(n.value.before),1)):t.createCommentVNode("",!0),t.createElementVNode("span",St,t.toDisplayString(n.value.match),1),n.value.after!==""?(t.openBlock(),t.createElementBlock("span",bt,t.toDisplayString(n.value.after),1)):t.createCommentVNode("",!0)],64))}}),Ct=({amount:o,currencyCode:e},n)=>e===void 0?new Intl.NumberFormat(n).format(Number(o)):new Intl.NumberFormat(n,{style:"currency",currency:e}).format(Number(o)),yt=(o,e)=>{if(o===void 0)return"";try{return Ct(o.min,e)}catch{return""}},It=o=>{try{const{protocol:e}=new URL(o,window.location.href);return e==="http:"||e==="https:"?o:void 0}catch{return}},ee=o=>o.url===void 0||o.url===""?void 0:It(o.url),te=o=>o.title??o.handle??o.objectID,wt={class:"dialog-search-product-thumb","aria-hidden":"true"},$t=["src"],Nt={class:"dialog-search-product-title"},Tt={key:0,class:"dialog-search-product-price"},oe=t.defineComponent({__name:"DialogSearchProductCard",props:{controller:{},hit:{},index:{},locale:{default:void 0},query:{default:""}},setup(o){const e=o,n=t.ref();t.watch(()=>e.hit,()=>{n.value!==void 0&&e.controller.observeResult(n.value,e.index)},{immediate:!0,flush:"post"});const s=t.computed(()=>ee(e.hit)),r=t.computed(()=>yt(e.hit.priceRange,e.locale)),c=l=>{const p=l.metaKey||l.ctrlKey||l.shiftKey||l.altKey;e.controller.selectResult(e.index,{navigate:!p})&&l.preventDefault()},a=l=>{l.button===1&&e.controller.selectResult(e.index,{navigate:!1})};return(l,p)=>(t.openBlock(),t.createElementBlock("li",{ref_key:"cardRef",ref:n,class:"dialog-search-card"},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.value===void 0?"div":"a"),t.mergeProps({class:"dialog-search-product",href:s.value},t.toHandlers(s.value===void 0?{}:{click:c,auxclick:a})),{default:t.withCtx(()=>[t.createElementVNode("span",wt,[e.hit.imageUrl!==void 0&&e.hit.imageUrl!==""?(t.openBlock(),t.createElementBlock("img",{key:0,src:e.hit.imageUrl,alt:"",loading:"lazy"},null,8,$t)):t.createCommentVNode("",!0)]),t.createElementVNode("span",Nt,[t.createVNode(J,{title:t.unref(te)(e.hit),query:e.query},null,8,["title","query"])]),r.value!==""?(t.openBlock(),t.createElementBlock("span",Tt,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0)]),_:1},16,["href"]))],512))}}),Rt={},Bt={width:"16",height:"16",viewBox:"0 0 256 256",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function At(o,e){return t.openBlock(),t.createElementBlock("svg",Bt,e[0]||(e[0]=[t.createElementVNode("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"},null,-1)]))}const Lt=w(Rt,[["render",At]]),Vt={},Dt={width:"12",height:"12",viewBox:"0 0 256 256",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function xt(o,e){return t.openBlock(),t.createElementBlock("svg",Dt,e[0]||(e[0]=[t.createElementVNode("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"},null,-1)]))}const Pt=w(Vt,[["render",xt]]),ne=o=>(o??[]).flatMap(e=>{const n=ee(e);return n===void 0?[]:[{collection:e,href:n}]}),Ot={key:0,class:"dialog-search-collections"},qt={class:"dialog-search-section-head"},Mt={class:"dialog-search-label"},Ut={class:"dialog-search-count"},Ht={class:"dialog-search-collection-list"},Kt=["href"],Ft={class:"dialog-search-collection-thumb","aria-hidden":"true"},zt=["src"],jt={class:"dialog-search-collection-title"},Gt={class:"dialog-search-caret"},vt=t.defineComponent({__name:"DialogSearchCollections",props:{collections:{},query:{},messages:{}},setup(o){const e=o,n=t.computed(()=>ne(e.collections));return(s,r)=>n.value.length>0?(t.openBlock(),t.createElementBlock("aside",Ot,[t.createElementVNode("div",qt,[t.createElementVNode("p",Mt,t.toDisplayString(e.messages.collectionsLabel),1),t.createElementVNode("span",Ut,t.toDisplayString(e.messages.collectionsCount(n.value.length)),1)]),t.createElementVNode("ul",Ht,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value,({collection:c,href:a})=>(t.openBlock(),t.createElementBlock("li",{key:c.objectID},[t.createElementVNode("a",{class:"dialog-search-collection",href:a},[t.createElementVNode("span",Ft,[c.imageUrl!==void 0&&c.imageUrl!==""?(t.openBlock(),t.createElementBlock("img",{key:0,src:c.imageUrl,alt:"",loading:"lazy"},null,8,zt)):t.createCommentVNode("",!0)]),t.createElementVNode("span",jt,[t.createVNode(J,{title:t.unref(te)(c),query:e.query},null,8,["title","query"])]),t.createElementVNode("span",Gt,[t.createVNode(Pt)])],8,Kt)]))),128))])])):t.createCommentVNode("",!0)}}),Qt={class:"dialog-search-products"},Wt={class:"dialog-search-section-head"},Xt={class:"dialog-search-label"},Yt={key:0,class:"dialog-search-label-count"},Zt={class:"dialog-search-results"},Jt={key:0,class:"dialog-search-empty",role:"status"},eo=t.defineComponent({__name:"DialogSearchProducts",props:{controller:{},response:{},locale:{},messages:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("section",Qt,[t.createElementVNode("div",Wt,[t.createElementVNode("p",Xt,[t.createTextVNode(t.toDisplayString(e.messages.productsLabel),1),e.response.nbHits>0?(t.openBlock(),t.createElementBlock("span",Yt," · "+t.toDisplayString(e.messages.resultsCount(e.response.nbHits)),1)):t.createCommentVNode("",!0)])]),t.createElementVNode("ul",Zt,[e.response.hits.length===0?(t.openBlock(),t.createElementBlock("li",Jt,t.toDisplayString(e.messages.noResults),1)):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(e.response.hits,(r,c)=>(t.openBlock(),t.createBlock(oe,{key:r.objectID,controller:e.controller,hit:r,index:c,locale:e.locale,query:e.response.query},null,8,["controller","hit","index","locale","query"]))),128))])]))}}),A=8,B=16,to=200,oo=1440,no=(o,e)=>o.bottom>0&&o.top<e,so=(o,e)=>{const n=Math.min(oo,e-2*B),s=o.left+o.width/2-n/2;return{left:`${Math.min(Math.max(s,B),e-B-n)}px`,width:`${n}px`}},ro=(o,e,n)=>{const s=n-o.bottom-A-B,r=o.top-A-B,c=so(o,e);return s<to&&r>s?{...c,bottom:`${n-o.top+A}px`,maxHeight:`${Math.max(r,0)}px`}:{...c,top:`${o.bottom+A}px`,maxHeight:`${Math.max(s,0)}px`}},co=o=>{const e=o.trim().replace(/^#/,"");if(!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e))return;const n=e.length<=4?[...e].map(s=>s+s).join(""):e;return[0,2,4].map(s=>Number.parseInt(n.slice(s,s+2),16))},lo=o=>{const e=/^rgba?\((\d+), (\d+), (\d+)(?:, [\d.]+)?\)$/.exec(o);if(e!==null)return[e[1],e[2],e[3]].map(Number)},ao=o=>{if(typeof document>"u")return;const e=document.createElement("span");if(e.style.color=o,e.style.color==="")return;document.body.appendChild(e);const n=lo(getComputedStyle(e).color);return e.remove(),n},io=o=>co(o)??ao(o),uo=o=>{const e=o/255;return e<=.03928?e/12.92:((e+.055)/1.055)**2.4},se=o=>{const e=io(o);if(e===void 0)return;const[n,s,r]=e.map(uo);return .2126*n+.7152*s+.0722*r},po="#181825",mo="#ffffff",ho="straight",x=.5,P={light:{panel:"#ffffff",side:"#fafbfc",text:"#111827","text-sec":"#6b7280",border:"#eceef2",hover:"#eef2f7",thumb:"#eef1f5"},dark:{panel:"#15171c",side:"#1b1e25",text:"#f3f4f6","text-sec":"#9ca3af",border:"#2b2f38",hover:"#242830",thumb:"#2b2f38"}},fo={rectangle:{"r-panel":"4px","r-item":"4px","r-thumb":"2px","r-btn":"4px"},"rectangle-rounded":{"r-panel":"16px","r-item":"10px","r-thumb":"8px","r-btn":"10px"}},L=o=>o===void 0||o.trim()===""?void 0:o.trim(),go=o=>{const e=o===void 0?void 0:se(o);return e===void 0?"light":e<x?"dark":"light"},_o=(o,e)=>{const n=se(o);return n===void 0?P[e].text:(e==="light"?n<x:n>=x)?o:P[e].text},Eo=o=>{const e=go(L(o==null?void 0:o.backgroundColor)),n=(o==null?void 0:o.ctaBorderType)===ho?"rectangle":"rectangle-rounded",s=L(o==null?void 0:o.primaryColor)??po,r=L(o==null?void 0:o.fontFamily),c={...P[e],...fo[n],primary:s,accent:_o(s,e),"cta-text":L(o==null?void 0:o.ctaTextColor)??mo,...r===void 0?{}:{font:r}};return Object.fromEntries(Object.entries(c).map(([a,l])=>[`--dso-${a}`,l]))},ko=o=>{const e=t.ref(),n=t.ref(void 0),s=t.ref({width:0,height:0});return t.watch(o,(r,c,a)=>{if(!r)return;const l=()=>{const p=e.value;if(p===void 0)return;const d=p.previousElementSibling??p,{top:E,bottom:i,left:h,width:f}=d.getBoundingClientRect();(s.value.width!==window.innerWidth||s.value.height!==window.innerHeight)&&(s.value={width:window.innerWidth,height:window.innerHeight});const m=n.value;(m===void 0||m.top!==E||m.bottom!==i||m.left!==h||m.width!==f)&&(n.value={top:E,bottom:i,left:h,width:f})};l(),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),a(()=>{window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)})},{immediate:!0,flush:"post"}),{anchorRef:e,rect:n,viewport:s}},So=(o,e)=>{const n=t.ref(!1),s=t.ref(),r=t.computed(()=>o.value.status!==I.IDLE&&!n.value);t.watch(()=>o.value.query,()=>{n.value=!1}),t.watch(r,(a,l,p)=>{if(!a)return;const d=E=>{var b,C;const i=E.target;if(!(i instanceof Node))return;const h=(b=e.value)==null?void 0:b.previousElementSibling,f=((C=s.value)==null?void 0:C.contains(i))??!1,m=(h==null?void 0:h.contains(i))??!1;!f&&!m&&(n.value=!0)};document.addEventListener("pointerdown",d),p(()=>document.removeEventListener("pointerdown",d))},{immediate:!0});const c=()=>{n.value=!1};return t.onMounted(()=>{var a,l;(l=(a=e.value)==null?void 0:a.previousElementSibling)==null||l.addEventListener("focusin",c)}),t.onUnmounted(()=>{var a,l;(l=(a=e.value)==null?void 0:a.previousElementSibling)==null||l.removeEventListener("focusin",c)}),{isOpen:r,panelRef:s}},bo={key:0,class:"dialog-search-error"},Co={role:"alert",class:"dialog-search-status dialog-search-status-error"},yo={key:1,role:"status",class:"dialog-search-status"},Io={key:0,class:"dialog-search-footer"},wo=["href"],$o=t.defineComponent({__name:"DialogSearchResults",props:{controller:{},state:{},locale:{default:void 0},theme:{default:void 0},layout:{default:"list"},seeAllHref:{type:Function,default:void 0}},setup(o){const e=o,n=u=>u instanceof ae?`Search failed (${u.status}${u.code?` ${u.code}`:""}): ${u.message}`:"Search failed: network error. Check your connection and try again.",s=t.computed(()=>e.state),r=t.computed(()=>e.state.status!==I.IDLE),{anchorRef:c,rect:a,viewport:l}=ko(r),{isOpen:p,panelRef:d}=So(s,c),E=t.computed(()=>p.value&&a.value!==void 0&&no(a.value,l.value.height)),i=t.computed(()=>Eo(e.theme)),h=t.computed(()=>({...a.value===void 0?{}:ro(a.value,l.value.width,l.value.height),...i.value})),f=t.computed(()=>W(e.locale)),m=t.computed(()=>e.state.response),b=t.computed(()=>{var u,k;return((k=(u=e.state.sections)==null?void 0:u.collections)==null?void 0:k.hits)??[]}),C=t.computed(()=>ne(b.value).length>0),y=t.computed(()=>e.seeAllHref!==void 0&&m.value!==void 0&&m.value.nbHits>0),_=t.computed(()=>!y.value&&X(e.state)),g=t.computed(()=>{var u;return m.value===void 0||(u=e.seeAllHref)==null?void 0:u.call(e,m.value.query)});return(u,k)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"anchorRef",ref:c},null,512),E.value?(t.openBlock(),t.createBlock(t.Teleport,{key:0,to:"body"},[t.createElementVNode("div",{ref_key:"panelRef",ref:d,class:t.normalizeClass(["dialog-search-panel",`dialog-search-panel--${e.layout}`]),style:t.normalizeStyle(h.value)},[e.state.status===t.unref(I).ERROR?(t.openBlock(),t.createElementBlock("div",bo,[t.createElementVNode("p",Co,t.toDisplayString(n(e.state.error)),1),t.createElementVNode("button",{type:"button",class:"dialog-search-retry",onClick:k[0]||(k[0]=N=>e.controller.retry())},t.toDisplayString(f.value.retry),1)])):m.value===void 0?(t.openBlock(),t.createElementBlock("p",yo,t.toDisplayString(f.value.searching(e.state.query)),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",{class:t.normalizeClass(["dialog-search-body",{"dialog-search-body--no-collections":!C.value}])},[t.createVNode(vt,{collections:b.value,query:m.value.query,messages:f.value},null,8,["collections","query","messages"]),t.createVNode(eo,{controller:e.controller,response:m.value,locale:e.locale,messages:f.value},null,8,["controller","response","locale","messages"])],2),y.value||_.value?(t.openBlock(),t.createElementBlock("div",Io,[y.value?(t.openBlock(),t.createElementBlock("a",{key:0,class:"dialog-search-cta",href:g.value},[t.createTextVNode(t.toDisplayString(f.value.seeAllLabel(m.value.nbHits))+" ",1),t.createVNode(Lt)],8,wo)):(t.openBlock(),t.createBlock(Y,{key:1,controller:e.controller,state:e.state,locale:e.locale},null,8,["controller","state","locale"]))])):t.createCommentVNode("",!0)],64))],6)])):t.createCommentVNode("",!0)],64))}}),No=o=>{const{client:e,surface:n="search_page",...s}=o,r=Ce({search:(l,p)=>e.search(l,p),analytics:{surface:n,trackViewSearchResults:l=>e.trackViewSearchResults(l),trackSelectSearchResult:l=>e.trackSelectSearchResult(l)},...s}),c=t.shallowRef(r.getState()),a=r.subscribe(()=>{c.value=r.getState()});return t.onMounted(()=>{K({method:"vue",version:"3.9.0"})}),t.onUnmounted(()=>{a(),r.dispose()}),{controller:r,state:c,theme:e.theme}};S.DialogInput=v,S.DialogProductBlock=et,S.DialogSearchBar=mt,S.DialogSearchPagination=Y,S.DialogSearchProductCard=oe,S.DialogSearchResults=$o,S.useDialogSearch=No,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@askdialog/dialog-vue",
3
3
  "private": false,
4
- "version": "3.7.0",
4
+ "version": "3.9.0",
5
5
  "type": "module",
6
6
  "main": "./dist/dialog-vue.umd.js",
7
7
  "module": "./dist/dialog-vue.js",
@@ -19,7 +19,7 @@
19
19
  "dist"
20
20
  ],
21
21
  "peerDependencies": {
22
- "@askdialog/dialog-sdk": "^2.1.0",
22
+ "@askdialog/dialog-sdk": "^2.15.0",
23
23
  "vue": "^3.0.0"
24
24
  },
25
25
  "devDependencies": {
@@ -29,7 +29,7 @@
29
29
  "eslint-plugin-vue": "^10.0.0",
30
30
  "vite-plugin-eslint": "^1.8.1",
31
31
  "vue-tsc": "^2.2.4",
32
- "@askdialog/dialog-sdk": "2.13.0"
32
+ "@askdialog/dialog-sdk": "2.15.1"
33
33
  },
34
34
  "author": "Dialog",
35
35
  "publishConfig": {