@magicx-eng/ai-autocomplete-vanilla 0.73.2 → 0.73.3

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.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="options"}function J(t){return t?.type?.kind==="date"?"date":t?.type?.kind==="date_range"?"date-range":t?.type?.kind==="time"?"time":t?.type?.kind==="location"&&!t.options?.length?"location":"options"}var xt=class{constructor(e){this.config=e;this.current=null;this.expiresAt=null;this.inFlightRefresh=null;e.accessToken&&(this.current=e.accessToken)}async getToken(e=!1){if(!e&&this.current&&!this.isExpired())return this.current;if(!e&&this.inFlightRefresh)return this.inFlightRefresh;this.inFlightRefresh=this.refresh();try{return await this.inFlightRefresh}finally{this.inFlightRefresh=null}}async refresh(){let e=await this.config.getAccessToken();return this.current=e.accessToken,this.expiresAt=e.expiresAt??null,this.current}isExpired(){return this.expiresAt==null?!1:Date.now()>=this.expiresAt-3e4}};var Ms="https://api.ai-autocomplete.com",Z=`${Ms}/api/suggest`,vt=new Map([["api.ai-autocomplete.com","cdn.ai-autocomplete.com"],["dev-api.ai-autocomplete.com","dev-cdn.ai-autocomplete.com"]]),Do=new WeakMap;function ze(t){return t?.type==="accessToken"}function ks(t){if(!(!t||ze(t)))return t}function Et(t){let e=Do.get(t.getAccessToken);return e||(e=new xt(t),Do.set(t.getAccessToken,e)),e}function Pt(t){return{"Content-Type":"application/json",...t?.appIdentifier&&{"X-App-Identifier":t.appIdentifier},...t?.headers}}function wt(t){let e=ks(t),n=e?.apiKey;return n?(e?.authScheme??"Bearer")==="Basic"?`Basic ${btoa(n)}`:`Bearer ${n}`:null}var kn="aiaPlace",Lt=2,Fo=250,Ho=new Set("new san los las santa saint st fort port north south east west lake mount el la rio de palm long grand cape salt hong".split(" ")),No=new Set("city beach springs falls island park heights valley bay".split(" ")),Rs=new Set("a an the in at to off on of from for by near into onto around via toward towards up out and or with within".split(" "));function Wo(t){let e=_s(t);for(;e.length>0&&Rs.has(e[0].toLowerCase().replace(/[.,]+$/,""));)e.shift();return e.join(" ")}function _s(t){let e=t.trim().split(/\s+/).filter(Boolean);if(e.length===0)return[];let n=e[e.length-1].replace(/[.,]+$/,"");if(!n)return[];let i=e.length>1?e[e.length-2]:void 0,o=e.length>2?e[e.length-3]:void 0,r=a=>a.toLowerCase().replace(/[.,]+$/,"");return i&&o&&Ho.has(r(o))&&No.has(r(n))?[o,i,n]:i&&(Ho.has(r(i))||No.has(r(n)))?[i,n]:[n]}function Bo(t){let e=t.secondary?.split(",")[0]?.trim();return e?`${t.name}, ${e}`:t.name}function Mn(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/\s+/g," ").trim()}function Rn(t,e){let n=Mn(e);if(!n)return!1;if(Mn(t.name)===n)return!0;for(let[,i]of t.name.matchAll(/\(([^()]*)\)/g))if(Mn(i)===n)return!0;return!1}function Vo(t,e){let n=e.metadata?.[kn];if(typeof n?.name!="string")return 0;let i={id:"",name:n.name},o=[...t.matchAll(/\S+/g)];for(let r of o){let a=r.index??0,s=t.slice(a).trim().replace(/[.,]+$/,"");if(Rn(i,s))return t.length-a}return 0}function _n(t){return typeof t=="string"?{text:t,is_tappable:!0,kind:null}:{text:Bo(t),is_tappable:!0,kind:null,metadata:{[kn]:{id:t.id,name:t.name}}}}function Dn(t){if(t?.locationEndpoint)return t.locationEndpoint;let e=t?.endpoint??Z,n=e.indexOf("?"),i=n<0?e:e.slice(0,n),o=n<0?"":e.slice(n+1);if(!/\/suggest\/?$/.test(i))return null;let r=i.replace(/\/suggest\/?$/,"/locations/autocomplete");return o?`${r}?${o}`:r}function Uo(t){let e=t?.places;if(!Array.isArray(e))return[];let n=[];for(let i of e){let{id:o,name:r,secondary:a}=i??{};typeof o!="string"||!o||typeof r!="string"||!r.trim()||n.push({id:o,name:r.trim(),...typeof a=="string"&&a.trim()?{secondary:a.trim()}:{}})}return n}function je(t){return t.map(e=>({parameter:e.parameter,text:e.text}))}var $o="skipped";function Ye(t,e){if(t.some(o=>"group"in o)&&(t=t.map(o=>{let{group:r,...a}=o;return a})),e.length===0)return t;let n=new Set(t.map(o=>o.parameter)),i=e.filter(o=>!n.has(o.parameter)).map(o=>({placeholder:"",parameter:o.parameter,text:$o,kind:null}));return i.length>0?[...t,...i]:t}var Ds="0.73.2",Ko="1.0",Go=!1;function Hs(t,e){return{placeholder:t.placeholder,parameter:t.parameter,...e&&{text:t.value??t.text},kind:t.kind}}function ue(t){return t??(typeof navigator<"u"?navigator.language:"en-US")}function Ns(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||void 0}catch{return}}function Fs(t,e,n,i,o,r,a,s,l,d,c,u,g){let m=e.find(h=>h.parameter==="contact"&&h.metadata?.contact_account_count)?.metadata?.contact_account_count,p=typeof m=="number"?m:void 0,f=Ns();return{data:{raw_query:t,accepts_traditional_autocomplete:!0,client_option_parameters:g??[],completed_params:Ye(e.map(h=>Hs(h,n)),l??[]),...a&&a.length>0&&{identified_params:je(a)},...s&&s.length>0&&{recently_suggested:s},...p!=null&&{contact_account_count:p},...d!==void 0&&{additional_context:d}},meta:{request_id:o,request_at:new Date().toISOString(),language:ue(c),...f&&{timezone:f},...u?.code&&Number.isFinite(u.rate)&&u.rate>0&&{currency:u.code,currency_rate:u.rate,...u.country!==void 0&&{country:u.country}},client_version:Ds,session_id:i,source:r,schema_version:Ko}}}async function qo(t,e,n,i,o){return fetch(t,{method:"POST",headers:{...e,Authorization:`Bearer ${n}`},body:i,signal:o})}async function zo(t,e,n){let i=n.apiConfig,o=!n.maskCompletedText,r=Fs(t,e,o,n.sessionId,n.requestId??crypto.randomUUID(),n.source,n.identifiedParams,n.recentlySuggested,n.skippedParams,n.additionalContext,n.language,n.currency,n.clientOptionParameters),a=i?.endpoint??Z,s=await jo(a,JSON.stringify(r),i,n.signal);if(!s.ok)throw new Error(`API error: ${s.status} ${s.statusText}`);return s.json()}async function jo(t,e,n,i){let o=Pt(n);if(ze(n)){let a=Et(n),s=await a.getToken(),l=await qo(t,o,s,e,i);if(l.status===401){let d=await a.getToken(!0);l=await qo(t,o,d,e,i)}return l}let r=wt(n);return!r&&!Go&&(Go=!0,console.warn("[AIAutocomplete] No apiKey in apiConfig. Requests will be sent without an Authorization header.")),r&&(o.Authorization=r),fetch(t,{method:"POST",headers:o,body:e,signal:i})}var Qe=class extends Error{constructor(n){super(`Location search error: ${n}`);this.status=n;this.name="LocationSearchError"}};async function Yo(t,e,n){let i=JSON.stringify({query:e,session_token:n.sessionToken,language:ue(n.language)}),o=await jo(t,i,n.apiConfig,n.signal);if(!o.ok)throw new Qe(o.status);return Uo(await o.json())}var Ct=/[\p{L}\p{N}]/u,Ws=/['\u2019-]/;function Qo(t,e,n){let i=t[e];if(i===void 0)return!1;if(Ct.test(i))return!0;let o=t[e+n];return Ws.test(i)&&o!==void 0&&Ct.test(o)}function Bs(t,e,n){let i=e+n.length;return!(Ct.test(n[0])&&Qo(t,e-1,-1)||Ct.test(n[n.length-1])&&Qo(t,i,1))}function re(t,e,n=0,i=()=>!0){if(e.length===0)return t.indexOf(e,n);let o=-1,r=t.indexOf(e,n);for(;r!==-1;){if(i(r)){if(Bs(t,r,e))return r;o===-1&&(o=r)}r=t.indexOf(e,r+1)}return o}function W(t,e){let n=t,i={},o=[],r=[],a=0;for(let s of e){let l=(i[s.parameter]??0)+1;i[s.parameter]=l;let c=`{{${s.parameter.toUpperCase().replace(/\s+/g,"_")}_${l}}}`,u=m=>re(n,s.text,m,p=>!r.some(f=>p<f.end&&p+s.text.length>f.start)),g=u(a);if(g===-1&&(g=u(0)),g!==-1){n=n.slice(0,g)+c+n.slice(g+s.text.length);let m=c.length-s.text.length;for(let p of r)p.start>=g+s.text.length&&(p.start+=m,p.end+=m);r.push({start:g,end:g+c.length}),a=g>=a?g+c.length:a+m}o.push({...s,placeholder:c})}return{rawQuery:n,completedParams:o}}function me(t,e,n){return e>0||!n?e:t.toLowerCase().startsWith(n.toLowerCase())?n.length:e}function Le(t,e){return e===!1?"":t}function Xe(t,e,n){return e===0&&t.length>0&&n.length>0&&n.toLowerCase().startsWith(t.toLowerCase())}function Je(t,e,n){let i=t.slice(e);if(n||e===0||t[e-1]===" ")return i;let o=i.indexOf(" ");return o===-1?"":i.slice(o+1)}function Xo(t,e){let n=t.trimEnd().replace(/\s+/g," ");if(n.length===0||e.length===0)return 0;let i=n.split(" "),o=e.toLowerCase();for(let r=0;r<i.length;r++){let a=i.slice(r).join(" ");if(o.startsWith(a.toLowerCase())){let s=n.length-a.length;return t.length-s}}return 0}function Jo(t){return t.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase().replace(/[_\-\s]+/g," ")}function Vs(t,e){let n=Jo(t).trim();return n.startsWith(e)||n.includes(` ${e}`)}function pe(t,e,n=!1){if(!t)return[];let i=e.trimStart();if(!i)return t;let o=n?Jo(i).trimStart():"";if(o)return t.filter(a=>!a.is_tappable||Vs(a.text,o));let r=i.toLowerCase();return t.filter(a=>!a.is_tappable||a.text.toLowerCase().includes(r))}function At(t,e){if(!t)return null;let n=e.trim();if(!n)return null;let i=n.toLowerCase();return t.find(o=>o.is_tappable&&o.text.toLowerCase()===i)??null}function Ze(t,e,n,i,o){let r=Je(e,n,i),a=At(t,r);if(a||!o||!r.trim())return a;if(r===e.slice(n))return null;let s=e.lastIndexOf(" ",n-1)+1;return At(t,e.slice(s))}function Zo(t,e){let n=e.replace(/^\s+/,"").toLowerCase();for(let i=0;i<n.length;){let o=n.slice(i);if(o.trim().length>=2){let a=t.findIndex(s=>s.is_tappable&&!s.selectsAll&&s.text.toLowerCase().startsWith(o));if(a>=0)return t.map((s,l)=>l===a?{...s,liveMatch:!0}:s)}let r=n.indexOf(" ",i);if(r<0)break;i=r+1}return t}function tr(t,e){return e?t.map(n=>e[n.parameter]?{...n,options:[]}:n):t}function nr(t,e){let{icon:n,icon_svg:i}=e;return!i||t.every(er)?t:t.map(o=>er(o)?o:{...o,icon:n,icon_svg:i})}function er(t){return!!(t.icon_svg||t.image_url)}function Us(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^a-zA-Z0-9]+/).filter(Boolean).map(e=>e.toLowerCase())}function ae(t){let e=Us(t);return e.length>0?e.join(" "):t}function ee(t,e){return t.parameter||e}function et(t,e){return{parameter:t,suggestionParameter:t,suggestionValueType:{kind:"traditional_autocomplete"},suggestionPlaceholder:ae(t),...e?{suggestionHeader:e}:{}}}function tt(t){return t.suggestionValueType?.kind==="traditional_autocomplete"?{parameter:t.suggestionParameter,text:t.suggestionHeader??"",required:!0,type:t.suggestionValueType,options:t.options}:{parameter:t.suggestionParameter,text:t.suggestionPlaceholder,required:!0,options:t.options}}function It(t,e){let n=ee(e,t.suggestionParameter);return t.suggestionValueType?.kind==="traditional_autocomplete"?et(n,t.suggestionHeader):{parameter:n,suggestionParameter:t.suggestionParameter,suggestionValueType:t.suggestionValueType,suggestionPlaceholder:t.suggestionPlaceholder,suggestionIcon:t.suggestionIcon,suggestionIconSvg:t.suggestionIconSvg}}function C(t){return t?.type?.kind==="traditional_autocomplete"}function Hn(t){let e=t?.replace(/[_\-\s]+/g," ").trim();return e?e.charAt(0).toUpperCase()+e.slice(1):void 0}function Ce(t){return C(t)||t?.smart_suggestion===!0}function Nn(t){return t.some(C)?t.filter(e=>!C(e)):t}function Fn(t,e){return t.some(n=>C(n)&&!n.text)?t.map(n=>C(n)&&!n.text?{...n,text:e}:n):t}var Wn='<svg viewBox="0 0 20 20" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false"><path class="aia-sparkle-large" d="M8 5C8.5 9.5 10.5 11.5 15 12C10.5 12.5 8.5 14.5 8 19C7.5 14.5 5.5 12.5 1 12C5.5 11.5 7.5 9.5 8 5Z"/><path class="aia-sparkle-small" d="M16 1C16.2 3 17 3.8 19 4C17 4.2 16.2 5 16 7C15.8 5 15 4.2 13 4C15 3.8 15.8 3 16 1Z"/></svg>';function Bn(t){return t.some(e=>!C(e))}function ir(t,e){let n=0,i=e;for(let o of t)n+=o.value.length,o.type!=="text"&&(i=Math.max(i,n));return i}function or(t,e){let n=0;for(let i of t){let o=n+i.value.length;if(i.type==="text"&&o>e&&i.value.slice(Math.max(e-n,0)).trim().length>0)return!1;n=o}return!0}function rr(t,e){let n=[],i=new Map;for(let o of[...t,...e]){if(o.parameter==="placeholder"||C(o))continue;let r=i.get(o.parameter);r||(r={parameter:o.parameter,text:o.text},i.set(o.parameter,r),n.push(r));for(let a of o.options??[])!a.is_tappable||r.options?.includes(a.text)||(r.options??(r.options=[]),r.options.push(a.text))}return n}function ar(t,e,n){if(t===e)return n;let i=Math.min(t.length,e.length),o=0;for(;o<i&&t[o]===e[o];)o++;if(o>=n)return n;let r=0;for(;r<i-o&&t[t.length-1-r]===e[e.length-1-r];)r++;return t.length-r<=n?n+(e.length-t.length):null}function Ot(t,e){let n=[],i=[],o=0;for(let r of e){let a=re(t,r.text,o);if(a===-1){i.push(r);continue}n.push({start:a,end:a+r.text.length,param:r}),o=a+r.text.length}return{located:n,missing:i}}function Te(t,e){let{located:n}=Ot(t,e);return n.length>0?n[n.length-1].end:0}function sr(t,e,n){let i=[],o=[],r=0;for(let a of n){let s=re(t,a.text,r,l=>!e.some(d=>l<d.end&&l+a.text.length>d.start));if(s===-1){o.push(a);continue}i.push({start:s,end:s+a.text.length,param:a}),r=s+a.text.length}return{located:i,missing:o}}function Mt(t,e,n=[]){let i=Ot(t,e).located,o=[];for(let c of i){let u=o[o.length-1];c.param.group&&u?.param.group===c.param.group?(u.end=c.end,u.params?.push(c.param)):o.push({...c,...c.param.group?{params:[c.param]}:{}})}let r=sr(t,o,n).located,a=[...o.map(c=>({start:c.start,end:c.end,segment:{type:"completed",value:t.slice(c.start,c.end),param:c.param,...c.params?{params:c.params}:{}}})),...r.map(c=>({start:c.start,end:c.end,segment:{type:"identified",value:c.param.text,param:c.param}}))].sort((c,u)=>c.start-u.start),s=[],l=0;for(let c of a)c.start>l&&s.push({type:"text",value:t.slice(l,c.start)}),s.push(c.segment),l=c.end;let d=t.slice(l);return d&&s.push({type:"text",value:d}),s}function lr(t,e){let{located:n,missing:i}=Ot(t,e),o=new Set(i.map(a=>a.group).filter(Boolean)),r=n.map(a=>a.param).filter(a=>!o.has(a.group));return{valid:r,invalid:e.filter(a=>!r.includes(a))}}function nt(t,e,n){let i=Ot(t,e).located,{located:o,missing:r}=sr(t,i,n);return{valid:o.map(a=>a.param),invalid:r}}function cr(t,e,n){let i=e?.endpoint??Z,o=i.replace(/\/suggest(?=[?#]|$)/,`/starting-state/${encodeURIComponent(t)}${$s(n)}`);if(o!==i)return o.replace(/^https:\/\/([^/?#]+)/,(r,a)=>{let s=vt.get(a);return s?`https://${s}`:r})}function $s(t){let e=t?.replace(/_/g,"-").toLowerCase()??"",[n,i=""]=e.split("-");return n!=="zh"?/^[a-z]{2,3}$/.test(n)?`/${n}`:"":/^[a-z]{4}$/.test(i)?i==="hant"?"/zh-TW":"/zh":["tw","hk","mo"].includes(i)?"/zh-TW":"/zh"}async function dr(t){try{let e=await t;if(!e.ok)return null;let n=await e.json();return Array.isArray(n?.data?.suggestions)?n:null}catch{return null}}function Gs(t){if(t instanceof Error)return t;try{return new Error(String(t))}catch{return new Error("Unknown error")}}var qs=100,Ks=300,zs=2,kt=class{constructor(e,n,i,o,r,a,s,l,d,c={}){this.store=e;this.getApiConfig=n;this.getOptionOverrides=i;this.getMaskCompletedText=o;this.getOnError=r;this.getSessionId=a;this.getSource=s;this.getAdditionalContext=l;this.getLanguage=d;this.callbacks=c;this.fetchVersion=0;this.abortController=null;this.debounceTimer=null;this.slowDebounceTimer=null;this.unsubscribe=null;this.phraseExactMatch=!1}start(){this.doFetch("",[]);let e=this.store.get().text,n=this.store.get().completedParams;this.unsubscribe=this.store.subscribe(i=>{(i.text!==e||i.completedParams!==n)&&(e=i.text,n=i.completedParams,this.scheduleFetch())})}isPhraseExactMatch(){return this.phraseExactMatch}dispose(){this.abortController?.abort(),this.clearTimers(),this.unsubscribe?.()}async doFetch(e,n){this.abortController?.abort();let i=new AbortController;this.abortController=i;let o=++this.fetchVersion,r=this.store.get().text.length,a=this.store.get().text;try{this.callbacks.onRequest?.({query:this.store.get().text,signal:i.signal,isCurrent:()=>o===this.fetchVersion})}catch{}try{this.store.set({isLoading:!0,error:null});let s=this.store.get(),l=s.pendingSpan?rr(s.pendingSpan.snapshot,s.actionableSuggestions):void 0,d=crypto.randomUUID(),c=e===""&&n.length===0&&s.skippedParams.length===0&&s.identifiedParams.length===0,u=c?this.startingStateUrl():void 0,g=u?await dr(fetch(u,{signal:i.signal})):null;if(o!==this.fetchVersion)return;let m=g??await zo(e,n,{sessionId:this.getSessionId(),requestId:d,source:this.getSource(),maskCompletedText:this.getMaskCompletedText(),signal:i.signal,apiConfig:this.getApiConfig(),identifiedParams:s.identifiedParams,recentlySuggested:l,skippedParams:s.skippedParams,additionalContext:this.getAdditionalContext(),language:this.getLanguage(),currency:this.callbacks.getCurrency?.(),clientOptionParameters:Object.keys(this.getOptionOverrides()??{})});if(o!==this.fetchVersion)return;this.phraseExactMatch=m.meta?.phrase_exact_match===!0;let p=(m.data.suggestions??[]).find(C),f=p?[]:m.data.input??[],h=w=>({id:crypto.randomUUID(),parameter:w.parameter,text:w.text,...w.type?{type:w.type}:{},...w.iso_date?{isoDate:w.iso_date}:{},...w.iso_date_end?{isoDateEnd:w.iso_date_end}:{}}),v=f.filter(w=>w.source==="identified");this.callbacks.waitIdentified?.(v.filter(w=>w.state==="need_confirmation").map(h),a);let y=v.filter(w=>w.state!=="need_confirmation").map(h),S=this.callbacks.isWordOpen?.()??!1,b=this.store.get().text.toLowerCase(),x=w=>S&&b.endsWith(w.text.toLowerCase()),E=y.filter(w=>!x(w));S&&this.callbacks.holdIdentified?.(y.filter(x));let P=p?[p]:tr(m.data.suggestions??[],this.getOptionOverrides()),T=f,L=T[T.length-1],A=this.store.get().text,F,R;if(L?.state==="in_progress"){R=!0;let w=A.toLowerCase().lastIndexOf(L.text.toLowerCase());F=w!==-1?w:r}else R=!1,F=r;let I=P.filter(w=>w.parameter!=="placeholder")[0],Q=null;if(I&&!C(I)&&!S&&I.type?.kind!=="multi_select"&&!H(J(I))){let w=Ze(I.options,A,F,R,this.phraseExactMatch);w&&(Q={id:crypto.randomUUID(),placeholder:"",parameter:ee(w,I.parameter),text:w.text,value:w.value,kind:w.kind,suggestionParameter:I.parameter,suggestionValueType:I.type,suggestionPlaceholder:I.text,suggestionIcon:I.icon,suggestionIconSvg:I.icon_svg,options:I.options??[],metadata:w.metadata,icon:w.icon,icon_svg:w.icon_svg,image_url:w.image_url},P=P.filter(oe=>oe!==I),this.callbacks.onAutoMatch?.({active:I,matched:w,rawQuery:e}))}let ie=m.data.custom_fields??null,D=this.callbacks.productsForResponse?.(ie);this.store.set(w=>{let oe=Q?[...w.completedParams,Q]:w.completedParams,Ue=new Set,ye=nt(w.text,oe,E).valid.map(M=>{let Ge=w.identifiedParams.find(qe=>!Ue.has(qe.id)&&qe.parameter===M.parameter&&qe.text===M.text);return Ge?(Ue.add(Ge.id),{...M,id:Ge.id}):M}),yt=new Set(s.skippedParams.map(M=>M.id)),Tt=new Set(w.skippedParams.filter(M=>!yt.has(M.id)).map(M=>M.parameter)),$e=Tt.size>0?P.filter(M=>M.parameter==="placeholder"||!Tt.has(M.parameter)):P;return{suggestions:this.callbacks.getAllOption?.()===!0&&!c?$e.map(M=>M.parameter==="placeholder"?M:{...M,leadsWithAll:!0}):$e,isLoading:!1,isReady:m.data.is_ready??!1,lastRawQuery:e,activeDropdownIndex:-1,filterBase:F,filterInProgress:R,identifiedParams:ye,customFields:ie,traditionalAutocomplete:m.meta?.traditional_autocomplete===!0,...D!==void 0?{products:D}:{},...Q?{completedParams:oe}:{}}}),this.callbacks.onResponse?.({requestId:d,funnelTelemetry:m.meta?.funnel_telemetry===!0,visibleImpression:m.meta?.visible_impression===!0})}catch(s){let l=Gs(s);o===this.fetchVersion&&(this.store.set({error:l,isLoading:!1}),this.getOnError()?.(l))}finally{if(o===this.fetchVersion&&this.store.get().isLoading)try{this.store.set({isLoading:!1})}catch{}}}startingStateUrl(){let e=this.callbacks.getProductId?.();return e?cr(e,this.getApiConfig(),ue(this.getLanguage())):void 0}attemptNow(){if(this.clearTimers(),this.store.get().skipNextFetch){this.store.set({skipNextFetch:!1});return}this.attemptFetch(1,!0)}scheduleFetch(){if(this.clearTimers(),this.store.get().skipNextFetch){this.store.set({skipNextFetch:!1});return}this.debounceTimer=setTimeout(()=>{this.attemptFetch(zs)&&this.slowDebounceTimer&&clearTimeout(this.slowDebounceTimer)},qs),this.slowDebounceTimer=setTimeout(()=>this.attemptFetch(1,!0,!0),Ks)}attemptFetch(e,n=!1,i=!1){let o=this.store.get();if(!o.text&&o.completedParams.length===0)return this.doFetch("",[]),!0;let r=this.callbacks.consumerTick?.(o,e)??"no";if(r==="asked")return!0;if(r==="owns")return!1;let a=Le(o.suggestions.filter(E=>E.parameter==="placeholder").map(E=>E.text).join(" "),this.callbacks.getPrependPlaceholder?.()),s=me(o.text,o.filterBase,a),l=Je(o.text,s,o.filterInProgress),d=o.suggestions.filter(E=>E.parameter!=="placeholder"),c=C(d[0])?void 0:d[0],u=H(o.activeFormatType),g=c&&!u?pe(c.options,l,o.traditionalAutocomplete):[];if(o.multiSelectView&&l.trim().length>0&&g.length>0)return!1;let m=g.filter(E=>E.is_tappable),p=c&&!u&&!this.callbacks.isWordOpen?.()?Ze(c.options,o.text,s,o.filterInProgress,this.phraseExactMatch)!==null:!1,f=l.trim().length>0,h=i&&o.products.length>0;if(m.length>0&&!p&&f&&!h||Xe(o.text,o.completedParams.length,a))return!1;let{rawQuery:v,completedParams:y}=W(o.text,o.completedParams),S=v.length<o.lastRawQuery.length,b=Math.abs(v.length-o.lastRawQuery.length),x=n&&v!==o.lastRawQuery;return S||b>=e||x?(this.doFetch(v,y),!0):!1}clearTimers(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.slowDebounceTimer&&clearTimeout(this.slowDebounceTimer),this.debounceTimer=null,this.slowDebounceTimer=null}};var js="(hover: none) and (pointer: coarse)";var Ys="[data-aia-dropdown], [data-aia-input-wrapper]",Qs=["a[href]","button","input","select","textarea","label","summary","[contenteditable]:not([contenteditable='false'])","[role='button']","[role='link']","[tabindex]:not([tabindex='-1'])"].join(", "),Rt=class{constructor(e,n){this.store=e;this.container=n;this.listening=!1;this.declined=!1;this.pressOutside=!1;this.pressWhileFocused=!1;this.recheckTimer=null;this.releaseTimer=null;this.onPointerDown=e=>{let n=e.composedPath(),i=this.isInside(n);this.pressOutside=!i;let o=this.store.get();this.pressWhileFocused=o.isFocused,!(i||!o.isFocused)&&(this.declined=n.some(r=>r instanceof Element&&r.matches(Qs)),this.declined&&o.dropdownHeld?this.store.set({dropdownHeld:!1}):!this.declined&&!o.dropdownHeld&&o.isDropdownOpen&&this.store.set({dropdownHeld:!0}))};this.onPointerCancel=()=>{this.pressOutside=!1,this.pressWhileFocused&&this.declined&&this.scheduleRecheck(),this.pressWhileFocused=!1};this.onPointerUp=e=>{let n=this.pressOutside&&!this.isInside(e.composedPath()),i=this.pressWhileFocused;if(this.pressOutside=!1,this.pressWhileFocused=!1,i){this.declined&&this.scheduleRecheck();return}!n||this.store.get().isFocused||(this.cancelRelease(),this.releaseTimer=setTimeout(()=>{this.releaseTimer=null;let o=this.store.get();o.dropdownHeld&&!o.isFocused&&this.store.set({dropdownHeld:!1})},150))};this.touchPrimary=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(js):null,this.unsubscribe=e.subscribe(()=>this.sync())}dispose(){this.unsubscribe(),this.listen(!1),this.cancelRelease(),this.recheckTimer!==null&&clearTimeout(this.recheckTimer),this.recheckTimer=null}sync(){let e=this.store.get(),n=this.touchPrimary?.matches??!1;e.isFocused||(this.declined=!1),e.isDropdownOpen?e.isFocused&&!e.dropdownHeld&&!this.declined&&n&&this.store.set({dropdownHeld:!0}):e.dropdownHeld&&this.store.set({dropdownHeld:!1});let i=this.store.get();this.listen(n&&i.isDropdownOpen),i.isFocused&&this.cancelRelease()}listen(e){if(!(e===this.listening||typeof document>"u")){if(this.listening=e,e){document.addEventListener("pointerdown",this.onPointerDown,!0),document.addEventListener("pointerup",this.onPointerUp,!0),document.addEventListener("pointercancel",this.onPointerCancel,!0);return}document.removeEventListener("pointerdown",this.onPointerDown,!0),document.removeEventListener("pointerup",this.onPointerUp,!0),document.removeEventListener("pointercancel",this.onPointerCancel,!0),this.pressOutside=!1}}scheduleRecheck(){this.recheckTimer!==null&&clearTimeout(this.recheckTimer),this.recheckTimer=setTimeout(()=>{this.recheckTimer=null,!(!this.declined||!this.store.get().isFocused)&&(this.declined=!1,this.sync())},150)}cancelRelease(){this.releaseTimer!==null&&(clearTimeout(this.releaseTimer),this.releaseTimer=null)}isInside(e){let n=this.container,i=n?.getRootNode(),o=typeof ShadowRoot<"u"&&i instanceof ShadowRoot?i.host:null;for(let r of e)if(r===n||r===o||r instanceof Element&&r.matches(Ys))return!0;return!1}};var Ae=["January","February","March","April","May","June","July","August","September","October","November","December"],_t=["S","M","T","W","T","F","S"],pr=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Dt="aiaDate",gr="aiaDay",ur=t=>String(t).padStart(2,"0");function B(t){return`${t.getFullYear()}-${ur(t.getMonth()+1)}-${ur(t.getDate())}`}function Vn(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function Xs(t){let e=Vn(t).getTime()-Vn(new Date).getTime();return Math.round(e/864e5)}function fr(t){let e=Xs(t);return e>=0&&e<7?pr[t.getDay()]:Ie(t)}function Ie(t){return t.getFullYear()===new Date().getFullYear()?`${Ae[t.getMonth()]} ${t.getDate()}`:`${Ae[t.getMonth()]} ${t.getDate()} ${t.getFullYear()}`}function Ht(t){if(!t)return null;let e=pr.findIndex(s=>s.toLowerCase()===t.trim().toLowerCase());if(e>=0){let s=Vn(new Date),l=(e-s.getDay()+7)%7;return new Date(s.getFullYear(),s.getMonth(),s.getDate()+l)}let n=/^\s*([A-Za-z]+)\s+(\d{1,2})(?:\s+(\d{4}))?\s*$/.exec(t);if(!n)return null;let i=Ae.findIndex(s=>s.toLowerCase()===n[1].toLowerCase());if(i<0)return null;let o=Number(n[2]),r=n[3]?Number(n[3]):new Date().getFullYear(),a=new Date(r,i,o);return a.getMonth()!==i||a.getDate()!==o?null:a}function Un(t){return`${Ae[t.month]} ${t.year}`}function $n(){let t=new Date;return{year:t.getFullYear(),month:t.getMonth()}}function hr(t){return{year:t.getFullYear(),month:t.getMonth()}}function Gn(t,e){let n=new Date(t.year,t.month+e,1);return{year:n.getFullYear(),month:n.getMonth()}}function mr(){return{text:"",is_tappable:!1,kind:null}}function qn(t){let e=new Date(t.year,t.month,1).getDay(),n=new Date(t.year,t.month+1,0).getDate(),i=[];for(let o=0;o<e;o++)i.push(mr());for(let o=1;o<=n;o++){let r=new Date(t.year,t.month,o);i.push({text:fr(r),is_tappable:!0,kind:null,metadata:{[Dt]:B(r),[gr]:o}})}for(;i.length%_t.length!==0;)i.push(mr());return i}function it(t){let e=Ht(t);return e?B(e):null}function j(t){let e=t?.metadata?.[Dt];return typeof e=="string"?e:null}function Kn(t){let e=t?.metadata?.[gr];return typeof e=="number"?e:null}function Js(t){return t.nodeType===Node.DOCUMENT_NODE?!0:t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in t}function ge(t){let e=typeof t.getRootNode=="function"?t.getRootNode():null;return e&&Js(e)?e:t.ownerDocument??t}function Nt(t){return ge(t).activeElement??null}function N(t){return t.ownerDocument??t}function Zs(t){return t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function br(t){let e=ge(t);return!Zs(e)||typeof e.getSelection=="function"?null:e}function Sr(t){let e=br(t);if(!e)return null;let n=N(t).getSelection?.();return!n||typeof n.getComposedRanges!="function"?null:e}function yr(t,e){let n=t,i;try{i=n.getComposedRanges({shadowRoots:[e]})}catch{i=n.getComposedRanges(e)}return i.length>0?i[0]:null}function ot(t){let n=ge(t).getSelection?.();return n||(N(t).getSelection?.()??null)}function fe(t){let e=ot(t);if(!e||e.rangeCount===0)return null;let n=Sr(t);if(n){let i=yr(e,n);return i?{node:i.startContainer,offset:i.startOffset,collapsed:i.startContainer===i.endContainer&&i.startOffset===i.endOffset}:null}return e.anchorNode?{node:e.anchorNode,offset:e.anchorOffset,collapsed:e.isCollapsed}:null}function xe(t){let e=ot(t);if(!e||e.rangeCount===0)return null;let n=Sr(t);if(!n)return e.getRangeAt(0);let i=yr(e,n);if(!i)return null;let o=N(t).createRange();return o.setStart(i.startContainer,i.startOffset),o.setEnd(i.endContainer,i.endOffset),o}function rt(t,e,n){let i=ot(t);if(!i)return null;if(br(t))return i.collapse(e,n),i;let o=N(t).createRange();return o.setStart(e,n),o.collapse(!0),i.removeAllRanges(),i.addRange(o),i}function Ft(t,e){let n=t?ge(t):typeof document<"u"?document:null;return n?typeof n.getElementById=="function"?n.getElementById(e):typeof document<"u"?document.getElementById(e):null:null}var Wt=2,el="magicx-aia";function Tr(t){return t==="auto"||t==="scroll"||t==="hidden"||t==="overlay"}function tl(t){let e=N(t),n=e.defaultView;if(!n?.getComputedStyle)return null;let i=t;for(;i&&i!==e.body&&i!==e.documentElement;){let o=i.scrollWidth>i.clientWidth,r=i.scrollHeight>i.clientHeight;if(o||r){let a=n.getComputedStyle(i);if(o&&Tr(a.overflowX)||r&&Tr(a.overflowY))return i}if(i.classList.contains(el))return null;i=i.parentElement}return null}function zn(t){let e=xe(t);if(!e||!e.collapsed||!t.contains(e.startContainer))return;let n=tl(t);if(!n||typeof e.getBoundingClientRect!="function")return;let i=e.getBoundingClientRect();if(i.height===0)return;let o=n.getBoundingClientRect();if(n.scrollWidth>n.clientWidth){let r=o.left+n.clientLeft,a=r+n.clientWidth;i.right>a?n.scrollLeft+=i.right-a+Wt:i.left<r&&(n.scrollLeft-=r-i.left+Wt)}if(n.scrollHeight>n.clientHeight){let r=o.top+n.clientTop,a=r+n.clientHeight;i.bottom>a?n.scrollTop+=i.bottom-a+Wt:i.top<r&&(n.scrollTop-=r-i.top+Wt)}}var vr='[contenteditable="false"]',Yn="strong[data-param-id]",Oe;function nl(){if(Oe!==void 0)return Oe;let t=globalThis.Intl.Segmenter;if(!t)return Oe=null,null;try{Oe=new t(void 0,{granularity:"grapheme"})}catch{Oe=null}return Oe??null}function Bt(t,e){let n=t;for(;n&&n!==e;){if(n.nodeType===Node.ELEMENT_NODE&&n.matches(vr))return!0;n=n.parentNode}return!1}function Vt(t){return N(t).createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(e){return Bt(e,t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}})}function Ut(t){let e=Vt(t),n="",i=e.nextNode();for(;i;)n+=i.data,i=e.nextNode();return n}function Qn(t){let e=Vt(t),n=0,i=e.nextNode();for(;i;)n+=i.data.length,i=e.nextNode();return n}function Y(t){let e=fe(t);if(!e)return null;let n=e.node,i=e.offset;if(!t.contains(n))return null;if(n.nodeType===Node.ELEMENT_NODE){let o=n;if(Bt(o,t)&&o!==t)return null;let r=0;for(let a=0;a<i&&a<o.childNodes.length;a++)r+=Xn(o.childNodes[a],t);return r+jn(o,t)}return n.nodeType!==Node.TEXT_NODE||Bt(n,t)?null:jn(n,t)+i}function Xn(t,e){if(t.nodeType===Node.TEXT_NODE)return Bt(t,e)?0:t.data.length;if(t.nodeType!==Node.ELEMENT_NODE)return 0;let n=t;if(n.matches(vr))return 0;let i=0;for(let o of Array.from(n.childNodes))i+=Xn(o,e);return i}function jn(t,e){let n=Vt(e),i=0,o=n.nextNode();for(;o;){if(o===t||t.nodeType===Node.ELEMENT_NODE&&t.contains(o))return i;i+=o.data.length,o=n.nextNode()}return i}function V(t,e){let n=N(t),i=Math.max(0,Math.min(e,Qn(t))),o=Vt(t),r=0,a=null,s=0,l=o.nextNode(),d=null;for(;l;){let u=l.data.length;if(i<r+u){a=l,s=i-r;break}if(i===r+u){let g=o.nextNode();g?(a=g,s=0):(a=l,s=u);break}r+=u,d=l,l=o.nextNode()}let c=n.createRange();if(a){let u=a.parentElement?.closest('strong[data-seg="completed"]');u&&u!==t&&t.contains(u)?s===0?c.setStartBefore(u):s===a.data.length?c.setStartAfter(u):c.setStart(a,s):c.setStart(a,s)}else d?c.setStart(d,d.data.length):c.setStart(t,0);c.collapse(!0),rt(t,c.startContainer,c.startOffset)&&(il(t,c,i),zn(t))}function xr(t,e){if(!t||!e.contains(t))return null;let i=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest(Yn)??null;return i&&e.contains(i)?i:null}function il(t,e,n){let i=xr(fe(t)?.node??null,t);if(i&&i!==xr(e.startContainer,t)){t.dataset.aiaCaretEscapedChip=`${n}:${i.dataset.paramId}`;return}delete t.dataset.aiaCaretEscapedChip}function Er(t,e){let n=t.dataset.aiaCaretEscapedChip;if(!n)return!1;let i=Y(t);return i!==null&&n===`${i}:${e}`}function Pr(t){return ge(t).activeElement===t}function Jn(t,e){if(!e||e.nodeType===void 0)return null;let n=e,i=n.nodeType===Node.ELEMENT_NODE?n:n.parentElement;if(i?.closest("[data-aia-chip-remove]"))return null;let o=i?.closest(Yn);if(!o||!t.contains(o))return null;let r=fe(t);return r&&!r.collapsed?null:o.dataset.paramId??null}function Zn(t,e){let n=null;for(let a of t.querySelectorAll(Yn))if(a.dataset.paramId===e){n=a;break}if(!n)return;let i=jn(n,t),o=i+Xn(n,t),r=Y(t);r!=null&&r>=i&&r<=o||V(t,i)}function ei(t){let e=Y(t);return e==null?!1:e>=Qn(t)}function ti(t,e){if(e<=0)return 0;let n=nl();if(!n)return e-1;let i=t.slice(0,e),o=0;for(let{index:r}of n.segment(i))r<e&&(o=r);return o}var wr="aiaTime",ii=5;var oi=[12,1,2,3,4,5,6,7,8,9,10,11],ri=Array.from({length:60/5},(t,e)=>e*5),ai=["AM","PM"];function ke(t){return(Math.round(t)%1440+1440)%1440}function si(t){let e=ke(t),n=Math.floor(e/60);return{hour:n%12===0?12:n%12,minute:e%60,period:n<12?"AM":"PM"}}function $t(t){let e=t.hour%12+(t.period==="PM"?12:0);return ke(e*60+t.minute)}function Gt(t){let{hour:e,minute:n,period:i}=si(t);return`${e}:${String(n).padStart(2,"0")} ${i}`}function Lr(t){let e=ke(t);return`${String(Math.floor(e/60)).padStart(2,"0")}:${String(e%60).padStart(2,"0")}`}function Me(t){return ke(Math.round(t/5)*5)}function Cr(t,e){return ke(t+e)}var ol=/^(\d{1,2})(?::(\d{2}))?\s*([ap])\.?\s*m?\.?$/i,rl=/^(\d{1,2}):(\d{2})$/;function ni(t){if(!t)return null;let e=t.trim().toLowerCase();if(e==="noon"||e==="midday")return 720;if(e==="midnight")return 0;let n=ol.exec(e);if(n){let o=Number(n[1]),r=n[2]===void 0?0:Number(n[2]);return o<1||o>12||r>59?null:$t({hour:o,minute:r,period:n[3]==="a"?"AM":"PM"})}let i=rl.exec(e);if(i){let o=Number(i[1]),r=Number(i[2]);return o>23||r>59?null:o*60+r}return null}function Ar(t){let e=ni(t.editingText);if(e!=null)return Me(e);let n=(t.options??[]).filter(o=>o.is_tappable).map(o=>ni(o.text)).filter(o=>o!=null);if(n.length>0)return Me(n[Math.floor((n.length-1)/2)]);let i=t.now??new Date;return ke((i.getHours()+1)*60)}function li(t){return{text:Gt(t),is_tappable:!0,kind:null,metadata:{[wr]:Lr(t)}}}var qt=30,Kt=["hour","minute","period"],ci={hour:oi.map(t=>({label:String(t)})),minute:ri.map(t=>({label:String(t).padStart(2,"0")})),period:ai.map(t=>({label:t}))};function di(t){return ci[t]}function zt(t,e){let n=si(Me(e));return t==="hour"?oi.indexOf(n.hour):t==="minute"?ri.indexOf(n.minute):ai.indexOf(n.period)}function jt(t,e,n){let i=ci[t],o=Math.min(Math.max(n,0),i.length-1),r=si(Me(e));return $t(t==="hour"?{...r,hour:oi[o]}:t==="minute"?{...r,minute:ri[o]}:{...r,period:ai[o]})}function ui(t,e){let n=ci[t].length-1;return Math.min(Math.max(Math.round(e/qt),0),n)}function ve(t,e,n=[],i={}){let{rawQuery:o,completedParams:r}=W(t,e);return{query:t.trim(),raw_query:o,completed_params:Ye(r,n),identified_params:je(i.identifiedParams??[]),is_ready:i.isReady??!1,...i.customFields?{custom_fields:i.customFields}:{}}}function Yt(t,e){return t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement?t.selectionStart!=null&&t.selectionStart===t.value.length:t instanceof HTMLElement&&t.hasAttribute("data-aia-input")?ei(t):e?.caretOffset!=null?e.caretOffset>=e.text.length:!1}function mi(t){return t instanceof HTMLElement&&t.hasAttribute("data-aia-input")?Y(t):null}var Qt=class{constructor(e,n){this.store=e;this.ctx=n}handleKeyDown(e){if(e.isComposing||e.keyCode===229)return;let n=this.store.get(),{listboxId:i,getOnSubmit:o}=this.ctx,r=e.target instanceof Node?e.target:null,a=this.getEffectiveColumns(r),s=o(),l=this.getTappableIndices(a);if((e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)&&(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight"))return;let d=this.ctx.getOptionsPosition()==="above";if(n.multiSelectView&&n.isDropdownOpen){let c=n.filteredOptions[n.activeDropdownIndex];if(e.key===" "&&!n.optionQuery&&c?.is_tappable){e.preventDefault(),this.ctx.selectOption(c);return}if(e.key==="Enter"){e.preventDefault(),n.multiSelectView.picked.length===0&&c?.is_tappable&&this.ctx.selectOption(c),this.ctx.commitMultiSelect?.();return}}if(!this.handleTimeWheelKey(e,n))switch(e.key){case"ArrowDown":{let c=Yt(e.target,n),u=!!n.editingParam;if(!c&&!u&&n.activeDropdownIndex<0)break;if(n.activeDropdownIndex<0){if(d)break;e.preventDefault();let p=_(n.activeFormatType)?this.dateEntryIndex(n,!1):l[0]??0;if(!n.isDropdownOpen&&n.actionableSuggestions.length>0){this.store.set({pillTapped:!0,activeDropdownIndex:p});break}if(l.length===0)return;this.store.set({activeDropdownIndex:p});break}if(e.preventDefault(),l.length===0)return;if(_(n.activeFormatType)){this.stepDateWeek(n,7);break}if(n.filteredOptions.length>0){let p=Math.floor((n.filteredOptions.length-1)/a);if(Math.floor(n.activeDropdownIndex/a)===p){this.store.set({activeDropdownIndex:-1});break}}let g=l.indexOf(n.activeDropdownIndex),m=g<l.length-1?g+1:0;this.store.set({activeDropdownIndex:l[m]});break}case"ArrowUp":{if(n.activeDropdownIndex<0){if(!d)break;let g=Yt(e.target,n),m=!!n.editingParam;if(!g&&!m)break;e.preventDefault();let p=_(n.activeFormatType)?this.dateEntryIndex(n,!0):this.firstTappableInBottomRow(a)??l[0]??0;if(!n.isDropdownOpen&&n.actionableSuggestions.length>0){this.store.set({pillTapped:!0,activeDropdownIndex:p});break}if(l.length===0)return;this.store.set({activeDropdownIndex:p});break}if(l.length===0)break;if(e.preventDefault(),_(n.activeFormatType)){this.stepDateWeek(n,-7);break}if(n.activeDropdownIndex<a){this.store.set({activeDropdownIndex:-1});break}let c=l.indexOf(n.activeDropdownIndex),u=c>0?c-1:l.length-1;this.store.set({activeDropdownIndex:l[u]});break}case"ArrowRight":{if(n.activeDropdownIndex>=0){if(e.preventDefault(),_(n.activeFormatType)){this.stepDateDay(n,1);break}if(n.activeDropdownIndex%a<a-1){let g=n.activeDropdownIndex+1;g<n.filteredOptions.length&&n.filteredOptions[g]?.is_tappable&&this.store.set({activeDropdownIndex:g})}break}if(n.editingParam&&e.target instanceof HTMLElement&&n.editingTail!=null){e.preventDefault();let u=e.target.closest("[data-aia-input]")??e.target,g=n.editingTail;this.ctx.exitEditMode?.(),V(u,g);break}Yt(e.target,n)&&n.actionableSuggestions.length>=1&&(e.preventDefault(),this.ctx.skipActivePill());break}case"ArrowLeft":{if(n.activeDropdownIndex>=0){if(e.preventDefault(),_(n.activeFormatType)){this.stepDateDay(n,-1);break}if(n.activeDropdownIndex%a>0){let c=n.activeDropdownIndex-1;c>=0&&n.filteredOptions[c]?.is_tappable&&this.store.set({activeDropdownIndex:c});break}if(!n.editingParam&&this.ctx.startEditingParamAtCaret){let c=mi(e.target);c!=null&&this.ctx.startEditingParamAtCaret(c)}break}if(n.editingParam&&e.target instanceof HTMLElement&&n.editingAnchor!=null){e.preventDefault();let c=e.target.closest("[data-aia-input]")??e.target,u=n.editingAnchor;this.ctx.exitEditMode?.(),V(c,u);break}if(this.ctx.startEditingParamAtCaret){let c=mi(e.target);c!=null&&this.ctx.startEditingParamAtCaret(c)&&e.preventDefault()}break}case"Backspace":{if(n.editingParam||!this.ctx.removeParamAtCaret)break;let c=mi(e.target);if(c==null)break;this.ctx.removeParamAtCaret(c)&&e.preventDefault();break}case"Enter":{if(e.preventDefault(),n.activeDropdownIndex>=0&&n.filteredOptions[n.activeDropdownIndex]?.is_tappable)this.clickOrSelect(n.activeDropdownIndex,n.filteredOptions,i,r);else if(s){this.ctx.endTypedWord?.(!0);let c=this.store.get();s(ve(c.text,c.completedParams,c.skippedParams,{identifiedParams:c.identifiedParams,isReady:c.isReady,customFields:c.customFields}))&&this.ctx.afterSubmit?.()}break}case"Tab":{if(this.ctx.endTypedWord?.()){e.preventDefault();break}let c=n.filteredOptions.map((m,p)=>m.is_tappable?p:-1).filter(m=>m!==-1);if(c.length===0)break;if(!n.isDropdownOpen){if(n.actionableSuggestions.length===0)break;e.preventDefault();let m=e.shiftKey?c[c.length-1]:c[0];this.store.set({pillTapped:!0,activeDropdownIndex:m});break}e.preventDefault();let u=c.indexOf(n.activeDropdownIndex);if(!e.shiftKey&&!_(n.activeFormatType)&&!n.multiSelectView){let m=u>=0?c[u]:c.find(p=>!n.filteredOptions[p]?.selectsAll);if(m===void 0)break;this.clickOrSelect(m,n.filteredOptions,i,r);break}let g;if(u<0)g=e.shiftKey?c.length-1:0;else{let m=e.shiftKey?-1:1;g=(u+m+c.length)%c.length}this.store.set({activeDropdownIndex:c[g]});break}case"Escape":{if(n.dateRangeStart){this.store.set({pendingRangeStart:null});break}if(n.editingIdentified){this.ctx.exitEditingIdentified?.(),this.store.set({activeDropdownIndex:-1});break}if(n.editingParam&&e.target instanceof HTMLElement&&n.editingTail!=null){let c=e.target.closest("[data-aia-input]")??e.target,u=n.editingTail;this.ctx.exitEditMode?.(),V(c,u)}this.store.set({activeDropdownIndex:-1});break}}}handleTimeWheelKey(e,n){let i=n.timeView;if(n.activeFormatType!=="time"||!i||!n.isDropdownOpen)return!1;switch(e.key){case"ArrowDown":case"ArrowUp":return!Yt(e.target,n)&&!n.editingParam?!1:(e.preventDefault(),this.ctx.stepTime?.(e.key==="ArrowDown"?5:-5),!0);case"Enter":return i.touched?(e.preventDefault(),this.ctx.commitTime?.(),!0):!1;case"Escape":return i.touched?(this.store.set({timeDraft:null}),!0):!1;default:return!1}}firstTappableInBottomRow(e){let n=this.store.get();if(n.filteredOptions.length===0)return null;let o=Math.floor((n.filteredOptions.length-1)/e)*e;for(let r=o;r<n.filteredOptions.length;r++)if(n.filteredOptions[r]?.is_tappable)return r;return null}dateEntryIndex(e,n){if(e.dateFloor){let a=e.filteredOptions.findIndex(s=>j(s)===e.dateFloor);if(a>=0)return a}let i=B(new Date),o=e.filteredOptions.findIndex(a=>j(a)===i);if(o>=0)return o;let r=e.filteredOptions.map((a,s)=>a.is_tappable?s:-1).filter(a=>a!==-1);return(n?r[r.length-1]:r[0])??0}stepDateDay(e,n){for(let i=e.activeDropdownIndex+n;i>=0&&i<e.filteredOptions.length;i+=n)if(e.filteredOptions[i]?.is_tappable){this.store.set({activeDropdownIndex:i});return}}stepDateWeek(e,n){let i=e.activeDropdownIndex+n;this.store.set({activeDropdownIndex:e.filteredOptions[i]?.is_tappable?i:-1})}getTappableIndices(e){let i=this.store.get().filteredOptions.map((r,a)=>r.is_tappable?a:-1).filter(r=>r!==-1),o=Array.from({length:e},()=>[]);for(let r of i)o[r%e].push(r);return o.flat()}getEffectiveColumns(e){let n=Ft(e,this.ctx.listboxId);if(!n)return this.store.get().multiSelectView?1:this.ctx.columns;let o=Ft(e,`${this.ctx.listboxId}-option-0`)?.parentElement??null;for(;o;){let r=getComputedStyle(o).gridTemplateColumns;if(r&&r!=="none"){let a=r.split(" ").filter(Boolean).length;if(a>0)return a}if(o===n)break;o=o.parentElement}return this.ctx.columns}clickOrSelect(e,n,i,o){let r=Ft(o,`${i}-option-${e}`);r?r.click():this.ctx.selectOption(n[e])}};var Xt=class{constructor(e,n,i={}){this.store=e;this.getOverrides=n;this.callbacks=i;this.unsubscribe=null;this.current=null;this.version=0;this.lastMiss=null;this.hasLoggedError=!1}start(){this.unsubscribe=this.store.subscribe(e=>this.sync(e)),this.sync(this.store.get())}dispose(){this.unsubscribe?.(),this.unsubscribe=null,this.cancel(),this.current=null}reset(){this.cancel(),this.current=null,this.lastMiss=null}refresh(){this.reset(),this.sync(this.store.get())}hasOverride(e){return!!this.getOverrides()?.[e]}owns(e,n){return this.hasOverride(e)&&!this.missCovers(e,n)}tick(e,n){let i=this.resolveTarget(e);if(!i||this.missCovers(i.parameter,i.query))return"no";let o=this.current;if(o&&o.key===i.key){if(o.query===i.query)return"owns";let r=Math.abs(i.query.length-o.query.length),a=i.query.length<o.query.length;if(n>1&&!a&&r<n)return"owns"}return this.ask(i),"asked"}sync(e){let n=this.resolveTarget(e);if(!n){this.current&&(this.cancel(),this.current=null),e.optionSearch&&this.store.set({optionSearch:null});return}this.current&&this.current.key===n.key||this.ask(n)}resolveTarget(e){if(H(e.activeFormatType)||e.editingIdentified)return null;let n=e.editingParam;if(n&&e.editingAnchor!=null)return this.hasOverride(n.suggestionParameter)?{mode:"edit",key:n.id,parameter:n.suggestionParameter,suggestion:{parameter:n.suggestionParameter,text:n.suggestionPlaceholder,required:!0,options:n.options,icon:n.suggestionIcon,icon_svg:n.suggestionIconSvg},query:e.optionQuery}:null;let i=e.actionableSuggestions[0];return!i||!this.hasOverride(i.parameter)?null:{mode:"pill",key:i,parameter:i.parameter,suggestion:i,query:e.optionQuery}}missCovers(e,n){return this.lastMiss!=null&&this.lastMiss.parameter===e&&this.lastMiss.query===n}ask(e){this.cancel();let n=this.getOverrides()?.[e.parameter],i=++this.version;if(!n||this.missCovers(e.parameter,e.query)){this.current={key:e.key,parameter:e.parameter,query:e.query,abort:null},this.setSearch(e,"done");return}let o=new AbortController;this.current={key:e.key,parameter:e.parameter,query:e.query,abort:o};let r;try{r=n(e.query,o.signal,e.suggestion)}catch(a){this.logOnce(a),this.commit(e,[],i);return}if(Array.isArray(r)){this.commit(e,r,i);return}this.setSearch(e,"loading"),this.await(e,r,o.signal,i)}async await(e,n,i,o){let r;try{let a=await n;if(i.aborted||o!==this.version)return;r=Array.isArray(a)?a:[]}catch(a){if(i.aborted||o!==this.version||al(a))return;this.logOnce(a),r=[]}this.commit(e,r,o)}commit(e,n,i){if(i!==this.version)return;let o=nr(n,e.suggestion),r=this.resolveTarget(this.store.get());if(!r||r.key!==e.key)return;o.length===0?this.lastMiss={parameter:e.parameter,query:e.query}:this.lastMiss?.parameter===e.parameter&&(this.lastMiss=null);let a={parameter:e.parameter,query:e.query,status:"done"};if(e.mode==="edit")this.store.set(s=>({editingParam:s.editingParam&&s.editingParam.id===e.key?{...s.editingParam,options:o}:s.editingParam,optionSearch:a}));else{let s={...e.suggestion,options:o};this.current&&this.current.key===e.key&&(this.current.key=s),this.store.set(l=>({suggestions:l.suggestions.map(d=>d===e.suggestion?s:d),optionSearch:a}))}o.length===0?this.callbacks.onMiss?.(e.mode,e.query):this.callbacks.onAnswer?.(e.mode,e.query)}setSearch(e,n){let i=this.store.get().optionSearch;i&&i.parameter===e.parameter&&i.query===e.query&&i.status===n||this.store.set({optionSearch:{parameter:e.parameter,query:e.query,status:n}})}cancel(){this.current?.abort?.abort(),this.version++}logOnce(e){this.hasLoggedError||(this.hasLoggedError=!0,console.warn("[AIAutocomplete] an optionOverrides entry threw or rejected \u2014 treated as no options. Later failures on this instance are not logged.",e))}};function al(t){return t instanceof Error&&t.name==="AbortError"}var Jt=class{constructor(e,n={}){this.store=e;this.callbacks=n}setActivePill(e){let n=this.store.get(),i=n.suggestions.filter(d=>d.parameter!=="placeholder");if(e<0||e>=i.length)return;let o=i[e];if(C(o))return;let r=i.filter((d,c)=>c!==e),a=n.suggestions.filter(d=>d.parameter==="placeholder");if(this.callbacks.onPillSelected){let{rawQuery:d}=W(n.text,n.completedParams);this.callbacks.onPillSelected({rawQuery:d,selectedPill:o.text,otherPills:r.map(c=>c.text)})}let s=[...a,o,...r],l=this.store.peek({suggestions:s}).filteredOptions.findIndex(d=>d.is_tappable&&!d.selectsAll);this.store.set({suggestions:s,pillTapped:!0,activeDropdownIndex:l})}removeLastParam(){this.store.get().completedParams.length!==0&&this.store.set(n=>({completedParams:n.completedParams.slice(0,-1),activeDropdownIndex:-1}))}};var Mr="/products/",Ir="https://relative.invalid";function sl(t){if(!t)return;let e;try{e=new URL(t,`${Ir}/`)}catch{return}if(!(e.protocol!=="http:"&&e.protocol!=="https:"))return t.startsWith("/")?e.origin===Ir?t:void 0:/^https?:\/\//i.test(t)?t:void 0}function kr(t,e){let n=sl(t.item_url)??cl(t);return{id:t.source_id,title:t.title,...n&&{url:n},imageUrl:t.image_url||null,...t.price&&{price:Or(t.price,t.currency,e)},...ll(t)&&{compareAtPrice:Or(t.compare_at_price,t.currency,e)},...t.vendor&&{vendor:t.vendor},...typeof t.available=="boolean"&&{available:t.available}}}function ll(t){if(!t.price||!t.compare_at_price)return!1;let e=Number(t.price),n=Number(t.compare_at_price);return Number.isFinite(e)&&Number.isFinite(n)&&n>e}function Or(t,e,n){if(n===void 0||!e||!/^\d+(\.\d+)?$/.test(t))return t;try{return new Intl.NumberFormat(n,{style:"currency",currency:e}).format(Number(t))}catch{return t}}function cl(t){if(!t.handle)return;let e=`${Mr}${encodeURIComponent(t.handle)}`;return t.variant_id?`${e}?variant=${encodeURIComponent(t.variant_id)}`:e}function pi(t,e){return(t?.items.matched??[]).map(n=>kr(n,e))}var Zt=class{constructor(e,n,i=()=>!0,o=()=>{},r=()=>{}){this.store=e;this.getConfig=n;this.isEnabled=i;this.getLanguage=o;this.getMapper=r;this.hasLoggedError=!1;this.hasLoggedMapperError=!1}forResponse(e){if(!this.isEnabled())return[];if(this.getConfig())return;let n=pi(e,ue(this.getLanguage())),i=this.getMapper();if(!i)return n;try{let o=i(n,e?.items.matched??[]);if(Array.isArray(o))return o}catch(o){this.hasLoggedMapperError||(this.hasLoggedMapperError=!0,console.warn("[AIAutocomplete] mapProducts failed. The original cards are shown.",o))}return n}async run(e,n,i){if(!this.isEnabled())return;let o=this.getConfig();if(!o)return;if(e.trim().length===0){this.clear(i);return}let r=()=>n.aborted||!i()||!this.owns(o);try{let a=await o.fetch(e,n);if(r())return;let s=o.transform(a),l=Array.isArray(s)?s:[],d=o.limit!=null?l.slice(0,o.limit):l;if(r())return;this.commit(d)}catch(a){if(n.aborted||dl(a)||(this.logOnce(a),r()))return;this.clear(i)}}owns(e){return this.isEnabled()&&this.getConfig()===e}resync(){let e=this.forResponse(this.store.get().customFields);this.commit(e??[])}refresh(){if(this.getConfig())return;let e=this.forResponse(this.store.get().customFields);e!==void 0&&this.commit(e)}clear(e){e()&&this.commit([])}commit(e){e.length===0&&this.store.get().products.length===0||this.store.set({products:e})}logOnce(e){this.hasLoggedError||(this.hasLoggedError=!0,console.warn("[AIAutocomplete] products.fetch/transform failed \u2014 the product strip is hidden. Later failures on this instance are not logged.",e))}};function dl(t){return t instanceof Error&&t.name==="AbortError"}function ul(t){return t.replace(/(\d+)(?:st|nd|rd|th)\b/g,"$1")}function Rr(t){let e=t.toLowerCase().replace(/\.$/,"");return e.length<3?-1:Ae.findIndex(n=>n.toLowerCase().startsWith(e))}function ml(t,e,n){let i=new Date(n.getFullYear(),t,e);if(i.getMonth()!==t||i.getDate()!==e)return null;let o=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(i>=o)return i;let r=new Date(n.getFullYear()+1,t,e);return r.getMonth()===t&&r.getDate()===e?r:null}var pl=/^(?:(?:on|from) )?(?:the )?(\d{1,2})(?:st|nd|rd|th)$/;function gi(t){let e=pl.exec(t.trim().toLowerCase().replace(/\s+/g," "));if(!e)return null;let n=Number(e[1]);return n>=1&&n<=31?n:null}function gl(t,e){if(!Number.isFinite(e.getTime()))return null;let n=new Date(e.getFullYear(),e.getMonth(),e.getDate());for(let i=0;i<12;i++){let o=new Date(e.getFullYear(),e.getMonth()+i,t);if(o.getDate()===t&&o>=n)return o}return null}function _r(t,e,n){let i=new Date(t,e,n);return i.getMonth()===e&&i.getDate()===n?i:null}function Re(t,e={}){if(!t)return null;let n=e.today??new Date,i=gi(t);if(i!==null){let d=gl(i,n);return d?B(d):null}let o=ul(t.trim().toLowerCase()).replace(/\s+/g," "),r=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(o);if(r){let d=_r(Number(r[1]),Number(r[2])-1,Number(r[3]));return d?B(d):null}let a=/^([a-z]+)\.? (\d{1,2})(?:,? (\d{4}))?$/.exec(o);if(a){let d=Rr(a[1]);if(d>=0)return en(d,Number(a[2]),a[3],n)}let s=/^(\d{1,2}) (?:of )?([a-z]+)\.?(?:,? (\d{4}))?$/.exec(o);if(s){let d=Rr(s[2]);if(d>=0)return en(d,Number(s[1]),s[3],n)}let l=/^(\d{1,2})[/\-.](\d{1,2})(?:[/\-.](\d{2,4}))?$/.exec(o);if(l){let d=Number(l[1]),c=Number(l[2]);return d>12&&c<=12?en(c-1,d,l[3],n):c>12&&d<=12?en(d-1,c,l[3],n):null}return null}function en(t,e,n,i){if(n){if(n.length!==4)return null;let r=_r(Number(n),t,e);return r?B(r):null}let o=ml(t,e,i);return o?B(o):null}var fl=/^\d{4}-\d{2}-\d{2}$/;function at(t){return typeof t=="string"&&fl.test(t)?t:null}function fi(t,e={}){return at(t.isoDate)??Re(t.text,e)}function st(t){let e=at(t.isoDate);return e?{start:e,end:at(t.isoDateEnd)}:null}var Dr=" - ",Si="aiaDateRangeStart",yi="aiaDateRangeEnd";function lt(t,e){return t<=e?{start:t,end:e}:{start:e,end:t}}var hi=/^\d{4}-\d{2}-\d{2}$/;function bi(t){if(!hi.test(t))return null;let[e,n,i]=t.split("-").map(Number),o=new Date(e,n-1,i);return o.getMonth()===n-1&&o.getDate()===i?o:null}var hl=/\s+(?:to|through|thru|until|til|till)\s+/g,bl=/[-–—]/g;function Sl(t){let e=[];for(let n of[hl,bl]){n.lastIndex=0;let i=n.exec(t);for(;i!==null;)e.push([t.slice(0,i.index),t.slice(i.index+i[0].length)]),i=n.exec(t)}return e}function tn(t,e={}){if(!t)return null;let n=new Set,i=null;for(let[o,r]of Sl(t.trim())){let a=Re(o.trim(),e);if(!a)continue;let s=gi(r)!==null?Re(r.trim(),{...e,today:bi(a)??e.today}):Re(r.trim(),e);!s||s<a||(n.add(`${a}|${s}`),i={start:a,end:s})}return n.size===1?i:null}function Hr(t){let e=bi(t.start),n=bi(t.end);return!e||!n?"":t.start===t.end?Ie(e):`${Ie(e)}${Dr}${Ie(n)}`}function Nr(t,e){let n=lt(t,e);return{text:Hr(n),is_tappable:!0,kind:null,metadata:{[Si]:n.start,[yi]:n.end}}}function _e(t,e={}){let n=t?.metadata?.[Si],i=t?.metadata?.[yi];return typeof n=="string"&&typeof i=="string"&&hi.test(n)&&hi.test(i)?lt(n,i):tn(t?.text,e)}var nn="(max-width: 768px)";var yl="var(--aia-option-row-height, 25.9px)",Tl="var(--aia-grid-scroll-top, 0px) + var(--aia-grid-scroll-bottom, 0px)";function Fr(t,e){return e?Ti(1,Math.min(t,5)):Ti(1,Math.min(t,4))}function Ti(t,e){return{cols:t,rows:e,maxHeight:`calc(${e} * ${yl} + ${Tl})`}}function vi(t,e){return!e&&t>=5}function Ei(t,e,n,i){if(!(!e&&t>=5&&xl(n,i))){let a=Fr(t,e);return{...a,template:xi(a.cols),scrollHintIndices:!e&&t>a.rows?[a.rows-1]:[]}}let r=6;return{...Ti(2,3),template:xi(2),scrollHintIndices:t>r?[r-2,r-1]:[]}}function xl(t,e){return!t||t.length===0||e==null||e<=0||t.some(i=>i<=0)?!1:Math.ceil(Math.max(...t))*2<=e}function ct(t){if(typeof document>"u")return null;let e=Array.from(t.querySelectorAll("[data-aia-option]"));if(e.length===0)return null;let n=document.createElement("div");n.style.cssText="position:absolute;visibility:hidden;left:-9999px;top:0;";for(let a of e){let s=a.cloneNode(!0);s.removeAttribute("id"),s.removeAttribute("role"),s.removeAttribute("aria-selected"),s.style.whiteSpace="nowrap",s.style.width="max-content",n.appendChild(s)}t.appendChild(n);let i=Array.from(n.children).map(a=>a.offsetWidth);n.remove();let o=getComputedStyle(t),r=t.clientWidth-(Number.parseFloat(o.paddingLeft)||0)-(Number.parseFloat(o.paddingRight)||0)-(Number.parseFloat(o.columnGap)||0)+vl(t);return{rowWidths:i,gridWidth:r}}function vl(t){let e=t.closest("[data-aia-dropdown]"),n=Number.parseFloat(e?.getAttribute(on)??"");if(!e||!Number.isFinite(n)||e.style.getPropertyValue(dt)!=="")return 0;let i=e.getBoundingClientRect().width;return i>0?n-i:0}var on="data-aia-glide-width",dt="--aia-glide-content-width";function xi(t){return Array.from({length:t},()=>"minmax(0,1fr)").join(" ")}function ut(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(nn).matches}function Pi(t,e){return!t||t.length!==e.length?!1:t.every((n,i)=>n.text===e[i].text)}var Wr={language:"en",and:"and",proceed:"to proceed",select:"to select",skipHint:"to skip",skip:"skip",skipLabel:"Skip",products:"Items",soldOut:"Sold out",addToCart:"Add to cart",submit:"Submit",seeAllResults:"See all results",scrollArrow:"Scroll down for more options",keepTyping:"Keep typing",done:"Done",allOption:"All",timeLabel:"Time",locationSearch:"Say a location",locationNoResults:"No places found",locationUseTyped:"Press Enter to use what you typed"},El={language:"es",and:"y",proceed:"para continuar",select:"para seleccionar",skipHint:"para omitir",skip:"omitir",skipLabel:"Omitir",products:"Mejor coincidencia",soldOut:"Agotado",addToCart:"A\xF1adir al carrito",submit:"Buscar",seeAllResults:"Ver todos los resultados",scrollArrow:"Despl\xE1zate para ver m\xE1s opciones",keepTyping:"Sigue escribiendo",done:"Listo",allOption:"Todo",timeLabel:"Hora",locationSearch:"Di una ubicaci\xF3n",locationNoResults:"No se encontraron lugares",locationUseTyped:"Pulsa Intro para usar lo que escribiste"},wi={en:Wr,es:El,fr:{language:"fr",and:"et",proceed:"pour continuer",select:"pour s\xE9lectionner",skipHint:"pour passer",skip:"passer",skipLabel:"Passer",products:"Meilleure correspondance",soldOut:"\xC9puis\xE9",addToCart:"Ajouter au panier",submit:"Rechercher",seeAllResults:"Voir tous les r\xE9sultats",scrollArrow:"Faites d\xE9filer pour voir plus d\u2019options",keepTyping:"Continuez \xE0 taper",done:"Termin\xE9",allOption:"Tout",timeLabel:"Heure",locationSearch:"Dites un lieu",locationNoResults:"Aucun lieu trouv\xE9",locationUseTyped:"Appuyez sur Entr\xE9e pour utiliser votre saisie"},"pt-BR":{language:"pt-BR",and:"e",proceed:"para continuar",select:"para selecionar",skipHint:"para pular",skip:"pular",skipLabel:"Pular",products:"Melhor correspond\xEAncia",soldOut:"Esgotado",addToCart:"Adicionar ao carrinho",submit:"Buscar",seeAllResults:"Ver todos os resultados",scrollArrow:"Role para ver mais op\xE7\xF5es",keepTyping:"Continue digitando",done:"Conclu\xEDdo",allOption:"Tudo",timeLabel:"Hor\xE1rio",locationSearch:"Diga um local",locationNoResults:"Nenhum lugar encontrado",locationUseTyped:"Pressione Enter para usar o que voc\xEA digitou"},it:{language:"it",and:"e",proceed:"per continuare",select:"per selezionare",skipHint:"per saltare",skip:"salta",skipLabel:"Salta",products:"Migliore corrispondenza",soldOut:"Esaurito",addToCart:"Aggiungi al carrello",submit:"Cerca",seeAllResults:"Vedi tutti i risultati",scrollArrow:"Scorri per vedere altre opzioni",keepTyping:"Continua a scrivere",done:"Fatto",allOption:"Tutto",timeLabel:"Ora",locationSearch:"Di' un luogo",locationNoResults:"Nessun luogo trovato",locationUseTyped:"Premi Invio per usare ci\xF2 che hai scritto"},tr:{language:"tr",and:"ve",proceed:"devam etmek i\xE7in",select:"se\xE7mek i\xE7in",skipHint:"atlamak i\xE7in",skip:"atla",skipLabel:"Atla",products:"En iyi e\u015Fle\u015Fme",soldOut:"T\xFCkendi",addToCart:"Sepete ekle",submit:"Ara",seeAllResults:"T\xFCm sonu\xE7lar\u0131 g\xF6r",scrollArrow:"Daha fazla se\xE7enek i\xE7in kayd\u0131r",keepTyping:"Yazmaya devam et",done:"Tamam",allOption:"T\xFCm\xFC",timeLabel:"Saat",locationSearch:"Bir konum s\xF6yleyin",locationNoResults:"Yer bulunamad\u0131",locationUseTyped:"Yazd\u0131\u011F\u0131n\u0131z\u0131 kullanmak i\xE7in Enter'a bas\u0131n"},id:{language:"id",and:"dan",proceed:"untuk melanjutkan",select:"untuk memilih",skipHint:"untuk melewati",skip:"lewati",skipLabel:"Lewati",products:"Paling cocok",soldOut:"Habis",addToCart:"Tambah ke keranjang",submit:"Cari",seeAllResults:"Lihat semua hasil",scrollArrow:"Gulir untuk melihat opsi lainnya",keepTyping:"Teruskan mengetik",done:"Selesai",allOption:"Semua",timeLabel:"Waktu",locationSearch:"Sebutkan lokasi",locationNoResults:"Tempat tidak ditemukan",locationUseTyped:"Tekan Enter untuk memakai yang Anda ketik"},pl:{language:"pl",and:"i",proceed:"aby kontynuowa\u0107",select:"aby wybra\u0107",skipHint:"aby pomin\u0105\u0107",skip:"pomi\u0144",skipLabel:"Pomi\u0144",products:"Najlepsze dopasowanie",soldOut:"Wyprzedane",addToCart:"Dodaj do koszyka",submit:"Szukaj",seeAllResults:"Zobacz wszystkie wyniki",scrollArrow:"Przewi\u0144, aby zobaczy\u0107 wi\u0119cej opcji",keepTyping:"Pisz dalej",done:"Gotowe",allOption:"Wszystko",timeLabel:"Godzina",locationSearch:"Podaj lokalizacj\u0119",locationNoResults:"Nie znaleziono miejsc",locationUseTyped:"Naci\u015Bnij Enter, aby u\u017Cy\u0107 wpisanego tekstu"},de:{language:"de",and:"und",proceed:"zum Fortfahren",select:"zum Ausw\xE4hlen",skipHint:"zum \xDCberspringen",skip:"\xFCberspringen",skipLabel:"\xDCberspringen",products:"Beste Treffer",soldOut:"Ausverkauft",addToCart:"In den Warenkorb",submit:"Suchen",seeAllResults:"Alle Ergebnisse anzeigen",scrollArrow:"Scrolle f\xFCr weitere Optionen",keepTyping:"Weitertippen",done:"Fertig",allOption:"Alle",timeLabel:"Uhrzeit",locationSearch:"Nenne einen Ort",locationNoResults:"Keine Orte gefunden",locationUseTyped:"Dr\xFCcke Enter, um deine Eingabe zu verwenden"},nl:{language:"nl",and:"en",proceed:"om door te gaan",select:"om te selecteren",skipHint:"om over te slaan",skip:"overslaan",skipLabel:"Overslaan",products:"Beste match",soldOut:"Uitverkocht",addToCart:"In winkelwagen",submit:"Zoeken",seeAllResults:"Alle resultaten bekijken",scrollArrow:"Scrol voor meer opties",keepTyping:"Blijf typen",done:"Klaar",allOption:"Alles",timeLabel:"Tijd",locationSearch:"Noem een locatie",locationNoResults:"Geen plaatsen gevonden",locationUseTyped:"Druk op Enter om je invoer te gebruiken"},sv:{language:"sv",and:"och",proceed:"f\xF6r att forts\xE4tta",select:"f\xF6r att v\xE4lja",skipHint:"f\xF6r att hoppa \xF6ver",skip:"hoppa \xF6ver",skipLabel:"Hoppa \xF6ver",products:"B\xE4sta matchning",soldOut:"Sluts\xE5ld",addToCart:"L\xE4gg i varukorgen",submit:"S\xF6k",seeAllResults:"Visa alla resultat",scrollArrow:"Skrolla f\xF6r fler alternativ",keepTyping:"Forts\xE4tt skriva",done:"Klar",allOption:"Alla",timeLabel:"Tid",locationSearch:"S\xE4g en plats",locationNoResults:"Inga platser hittades",locationUseTyped:"Tryck p\xE5 Enter f\xF6r att anv\xE4nda det du skrev"},nb:{language:"nb",and:"og",proceed:"for \xE5 fortsette",select:"for \xE5 velge",skipHint:"for \xE5 hoppe over",skip:"hopp over",skipLabel:"Hopp over",products:"Beste treff",soldOut:"Utsolgt",addToCart:"Legg i handlekurven",submit:"S\xF8k",seeAllResults:"Se alle resultater",scrollArrow:"Rull ned for \xE5 se flere alternativer",keepTyping:"Fortsett \xE5 skrive",done:"Ferdig",allOption:"Alle",timeLabel:"Tid",locationSearch:"Si et sted",locationNoResults:"Fant ingen steder",locationUseTyped:"Trykk Enter for \xE5 bruke det du skrev"},da:{language:"da",and:"og",proceed:"for at forts\xE6tte",select:"for at v\xE6lge",skipHint:"for at springe over",skip:"spring over",skipLabel:"Spring over",products:"Bedste match",soldOut:"Udsolgt",addToCart:"L\xE6g i kurv",submit:"S\xF8g",seeAllResults:"Se alle resultater",scrollArrow:"Rul for flere muligheder",keepTyping:"Forts\xE6t med at skrive",done:"F\xE6rdig",allOption:"Alle",timeLabel:"Tidspunkt",locationSearch:"Sig et sted",locationNoResults:"Ingen steder fundet",locationUseTyped:"Tryk p\xE5 Enter for at bruge det, du skrev"},fi:{language:"fi",and:"ja",proceed:"jatkaaksesi",select:"valitaksesi",skipHint:"ohittaaksesi",skip:"ohita",skipLabel:"Ohita",products:"Paras vastaavuus",soldOut:"Loppuunmyyty",addToCart:"Lis\xE4\xE4 ostoskoriin",submit:"Hae",seeAllResults:"N\xE4yt\xE4 kaikki tulokset",scrollArrow:"Vierit\xE4 n\xE4hd\xE4ksesi lis\xE4\xE4 vaihtoehtoja",keepTyping:"Jatka kirjoittamista",done:"Valmis",allOption:"Kaikki",timeLabel:"Aika",locationSearch:"Sano sijainti",locationNoResults:"Paikkoja ei l\xF6ytynyt",locationUseTyped:"Paina Enteri\xE4 k\xE4ytt\xE4\xE4ksesi kirjoittamaasi"},ja:{language:"ja",and:"\u3068",proceed:"\u3067\u6B21\u3078",select:"\u3067\u9078\u629E",skipHint:"\u3067\u30B9\u30AD\u30C3\u30D7",skip:"\u30B9\u30AD\u30C3\u30D7",skipLabel:"\u30B9\u30AD\u30C3\u30D7",products:"\u30D9\u30B9\u30C8\u30DE\u30C3\u30C1",soldOut:"\u58F2\u308A\u5207\u308C",addToCart:"\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0",submit:"\u691C\u7D22",seeAllResults:"\u3059\u3079\u3066\u306E\u7D50\u679C\u3092\u898B\u308B",scrollArrow:"\u30B9\u30AF\u30ED\u30FC\u30EB\u3057\u3066\u4ED6\u306E\u5019\u88DC\u3092\u898B\u308B",keepTyping:"\u5165\u529B\u3092\u7D9A\u3051\u308B",done:"\u5B8C\u4E86",allOption:"\u3059\u3079\u3066",timeLabel:"\u6642\u523B",locationSearch:"\u5834\u6240\u3092\u8A00\u3063\u3066\u304F\u3060\u3055\u3044",locationNoResults:"\u5834\u6240\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",locationUseTyped:"\u5165\u529B\u3057\u305F\u5185\u5BB9\u3092\u4F7F\u3046\u306B\u306F Enter \u3092\u62BC\u3057\u3066\u304F\u3060\u3055\u3044"},ko:{language:"ko",and:"\uBC0F",proceed:"\uACC4\uC18D",select:"\uC120\uD0DD",skipHint:"\uAC74\uB108\uB6F0\uAE30",skip:"\uAC74\uB108\uB6F0\uAE30",skipLabel:"\uAC74\uB108\uB6F0\uAE30",products:"\uCD94\uCC9C \uC0C1\uD488",soldOut:"\uD488\uC808",addToCart:"\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uB2F4\uAE30",submit:"\uAC80\uC0C9",seeAllResults:"\uBAA8\uB4E0 \uACB0\uACFC \uBCF4\uAE30",scrollArrow:"\uB354 \uB9CE\uC740 \uC635\uC158\uC744 \uBCF4\uB824\uBA74 \uC2A4\uD06C\uB864\uD558\uC138\uC694",keepTyping:"\uACC4\uC18D \uC785\uB825\uD558\uC138\uC694",done:"\uC644\uB8CC",allOption:"\uC804\uCCB4",timeLabel:"\uC2DC\uAC04",locationSearch:"\uC704\uCE58\uB97C \uB9D0\uD558\uC138\uC694",locationNoResults:"\uC7A5\uC18C\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",locationUseTyped:"\uC785\uB825\uD55C \uB0B4\uC6A9\uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 Enter\uB97C \uB204\uB974\uC138\uC694"},"zh-CN":{language:"zh-CN",and:"\u548C",proceed:"\u7EE7\u7EED",select:"\u9009\u62E9",skipHint:"\u8DF3\u8FC7",skip:"\u8DF3\u8FC7",skipLabel:"\u8DF3\u8FC7",products:"\u6700\u4F73\u5339\u914D",soldOut:"\u552E\u7F44",addToCart:"\u52A0\u5165\u8D2D\u7269\u8F66",submit:"\u641C\u7D22",seeAllResults:"\u67E5\u770B\u5168\u90E8\u7ED3\u679C",scrollArrow:"\u5411\u4E0B\u6EDA\u52A8\u67E5\u770B\u66F4\u591A\u9009\u9879",keepTyping:"\u7EE7\u7EED\u8F93\u5165",done:"\u5B8C\u6210",allOption:"\u5168\u90E8",timeLabel:"\u65F6\u95F4",locationSearch:"\u8BF4\u51FA\u5730\u70B9",locationNoResults:"\u672A\u627E\u5230\u5730\u70B9",locationUseTyped:"\u6309 Enter \u4F7F\u7528\u4F60\u8F93\u5165\u7684\u5185\u5BB9"},"zh-TW":{language:"zh-TW",and:"\u548C",proceed:"\u7E7C\u7E8C",select:"\u9078\u64C7",skipHint:"\u7565\u904E",skip:"\u7565\u904E",skipLabel:"\u7565\u904E",products:"\u6700\u4F73\u5339\u914D",soldOut:"\u552E\u5B8C",addToCart:"\u52A0\u5165\u8CFC\u7269\u8ECA",submit:"\u641C\u5C0B",seeAllResults:"\u67E5\u770B\u5168\u90E8\u7D50\u679C",scrollArrow:"\u5411\u4E0B\u6372\u52D5\u67E5\u770B\u66F4\u591A\u9078\u9805",keepTyping:"\u7E7C\u7E8C\u8F38\u5165",done:"\u5B8C\u6210",allOption:"\u5168\u90E8",timeLabel:"\u6642\u9593",locationSearch:"\u8AAA\u51FA\u5730\u9EDE",locationNoResults:"\u627E\u4E0D\u5230\u5730\u9EDE",locationUseTyped:"\u6309 Enter \u4F7F\u7528\u4F60\u8F38\u5165\u7684\u5167\u5BB9"}},Pl={pt:"pt-BR",no:"nb",nn:"nb"};function k(t){let[e,...n]=t?.toLowerCase().split("-")??[];if(e==="zh"){let o=n.some(r=>["hant","tw","hk","mo"].includes(r));return wi[o?"zh-TW":"zh-CN"]}let i=Pl[e]??e;return Object.prototype.hasOwnProperty.call(wi,i)?wi[i]:Wr}function Br(t,e){let n=e.dropdownTrigger??"auto",i=e.closeDropdownOnBlur??!0,a=t.filteredOptionsLength>0||t.activePillHasNoOptions||t.hasProducts;if(t.inEditMode){let s=i?t.isFocused||t.dropdownHeld:!0;return a&&s}if(n==="auto"){let s=i?t.isFocused||t.dropdownHeld:!0,l=t.text.replace(/\s+$/,"").length,d=t.caretOffset==null||t.caretOffset>=l;return(a||t.isLoading)&&s&&d}return n==="manual"?(a||t.isLoading)&&t.pillTapped:!1}function U(t){if(t.editingIdentified){let{parameter:n,anchor:i}=t.editingIdentified;return`identified:${n}@${i}`}return t.editingParam!=null&&t.editingAnchor!=null?`edit:${t.editingParam?.id}`:`pill:${t.actionableSuggestions[0]?.parameter??""}`}function rn(t){if(!t)return $n();let[e,n]=t.split("-").map(Number);return{year:e,month:n-1}}function wl(t){let e=Ht(t);return e?hr(e):$n()}function Ll(t,e){if(!t)return null;for(let n of e){if(n.parameter!==t||n.type?.kind!=="date_range")continue;let i=st(n);if(i&&i.end==null)return i.start}return null}function Cl(t){let e=new Set,n=i=>{i&&e.add(i)};for(let i of t.completedParams??[]){if(i.id===t.editingParam?.id)continue;let o=i.suggestionValueType?.kind;if(o==="date"&&n(at(i.metadata?.[Dt])??it(i.text)),o==="date_range"){let r=_e(i);n(r?.start),n(r?.end)}}for(let i of t.identifiedParams??[]){if(i.id===t.editingIdentified?.id)continue;let o=i.type?.kind;if(o!=="date"&&o!=="date_range")continue;let r=st(i);n(r?.start),n(r?.end)}return[...e].sort()}function Li(t,e){return t.editingParam!=null&&t.editingAnchor!=null?e:t.text.slice(Te(t.text,t.completedParams))}var Al=/price/i;function Il(t){return!t||Ce(t)||H(J(t))||t.type?.kind==="multi_select"||Al.test(t.parameter)?!1:(t.options??[]).filter(e=>e.is_tappable).length>=2}function mt(t,e,n){if(e>0)return!1;let i=t.trim();return i===""||i.toLowerCase()===n.trim().toLowerCase()||Xe(i,0,n)}var Ol=4;function Ml(t,e){let n={text:e,kind:null,is_tappable:!0,selectsAll:!0},i=[...new Set(t.filter(r=>r.is_tappable&&r.image_url).map(r=>r.image_url))].slice(0,Ol);if(i.length>0)return n.image_url=i[0],i.length>1&&(n.imageCollage=i),[n,...t];let o;for(let r of t)r.is_tappable&&(o=r);return o?.icon&&(n.icon=o.icon),o?.icon_svg&&(n.icon_svg=o.icon_svg),[n,...t]}function Vr(t,e){let n=Mt(t.text,t.completedParams,t.identifiedParams),i=t.suggestions.filter(O=>O.parameter!=="placeholder"),o=i[0],r=t.suggestions.filter(O=>O.parameter==="placeholder").map(O=>O.text).join(" "),a=Le(r,e.prependPlaceholder),s=me(t.text,Math.min(t.filterBase,t.text.length),a),d=s===0&&Xe(t.text,t.completedParams.length,a)?"":Je(t.text,s,t.filterInProgress),c=o?.options??[],u=t.editingParam!=null&&t.editingAnchor!=null,g=!u&&!t.editingIdentified&&o?.type?.kind==="multi_select",m,p,f,h;if(u&&t.editingParam&&t.editingAnchor!=null){let O=t.editingParam.id,K=t.completedParams.some(de=>de.id===O),Ke=t.caretOffset??t.editingAnchor,X=K?"":t.text.slice(t.editingAnchor,Ke);p=X.trim(),f=t.editingParam.options,h=t.editingParam.suggestionParameter,m=t.editingParam.suggestionValueType?.kind==="traditional_autocomplete"?pe(t.editingParam.options,X).map(de=>({...de,matchedText:p,parameterLabel:Hn(de.parameter)})):pe(t.editingParam.options,X)}else p=d.trim(),f=c,h=o?.parameter,m=C(o)?c.map(O=>({...O,matchedText:t.text.slice(Te(t.text,t.completedParams)),parameterLabel:Hn(O.parameter)})):pe(c,d,t.traditionalAutocomplete);let v=t.optionSearch,y=v!=null&&h!=null&&v.parameter===h;y&&v.status==="done"&&v.query===p&&(m=f);let S=y&&v.status==="loading",b=e.showNonTappableOptions===!1;b&&(m=m.filter(O=>O.is_tappable));let x=mt(t.text,t.completedParams.length,a);e.allOption===!0&&o?.leadsWithAll===!0&&!x&&!u&&!t.editingIdentified&&d.trim()===""&&Il(o)&&(m=Ml(m,k(e.language).allOption));let E=Li(t,p),P=u?t.editingParam?.suggestionValueType?.kind==="traditional_autocomplete":C(o);!g&&!P&&(m=Zo(m,E));let T=t.editingIdentified,L=u?t.editingParam&&{type:t.editingParam.suggestionValueType,options:t.editingParam.options}:o,A=T?T.format:J(L),F=u?t.editingParam?.suggestionParameter:o?.parameter,R=A==="location"&&F&&e.optionOverrides?.[F]?"options":A,q=u&&R==="date-range"?_e(t.editingParam):null,I=!u&&!T&&R==="date"?Ll(o?.parameter,t.identifiedParams):null,Q=null,ie=null,D=_(R)?Cl(t):[];if(_(R)){let O=B(new Date),K=D.find(Os=>Os>=O)??null,Ke=U({...t,actionableSuggestions:i}),X=t.dateViewMonth;Q=X&&X.key===Ke?{year:X.year,month:X.month}:T?rn(T.iso):q?rn(q.start):I?rn(I):K&&!u?rn(K):wl(t.editingParam?.text),m=qn(Q);let de=t.pendingRangeStart;R==="date-range"&&de&&de.key===Ke&&(ie=de.iso)}let w=null;if(R==="time"){let O=U({...t,actionableSuggestions:i}),K=t.timeDraft;w=K&&K.key===O?{minutes:K.minutes,touched:!0}:{minutes:Ar({editingText:u?t.editingParam?.text:null,options:u?t.editingParam?.options:o?.options}),touched:!1},m=[]}let oe=null;if(R==="location"){let O=U({...t,actionableSuggestions:i}),K=t.locationSearch;if(K&&K.key===O){let{key:Ke,...X}=K;oe=X}else oe={query:u?t.editingParam?.text??"":"",places:[],status:t.locationAutocomplete&&e.locationSearch!==!1?"idle":"unavailable",highlighted:-1};m=[]}let Ue=O=>b?O.is_tappable:!0,ye;if(u){let O=t.editingParam?.options??[];ye=t.editingParam!=null&&O.filter(Ue).length===0}else ye=o!=null&&c.filter(Ue).length===0;w&&(ye=!0),oe&&(ye=!0);let yt=Br({inEditMode:u||T!=null,filteredOptionsLength:m.length,isFocused:t.isFocused||t.locationFieldFocused,dropdownHeld:t.dropdownHeld,text:t.text,caretOffset:t.caretOffset,isLoading:t.isLoading||S,pillTapped:t.pillTapped,activePillHasNoOptions:ye,hasProducts:t.products.length>0},{dropdownTrigger:e.dropdownTrigger,closeDropdownOnBlur:e.closeDropdownOnBlur}),Tt=yt&&t.activeDropdownIndex>=0&&!!m[t.activeDropdownIndex]?.is_tappable,$e=t.skeletonOptions!==null&&t.skeletonRequested&&!t.isLoading&&!t.editingParam&&!t.inSelectionAnimation,On=t.isLoading&&!t.editingParam&&!t.inSelectionAnimation||S||$e,M=On&&t.skeletonOptions!==null,Ge=M&&t.skeletonOptions?t.skeletonOptions:m,qe=M?t.skeletonSuggestion:null,_o=g?{picked:t.multiSelectDraft?.key===U({...t,actionableSuggestions:i})?t.multiSelectDraft.picked:[]}:null,Is=_o??(M&&t.skeletonSuggestion?.type?.kind==="multi_select"?{picked:t.skeletonPicked??[]}:null);return{segments:n,actionableSuggestions:i,filteredOptions:m,dropdownLoading:On,dropdownOptions:Ge,dropdownSuggestion:qe,skeletonExiting:$e,activeFormatType:R,dateView:Q,dateRangeStart:ie,dateFloor:I,dateReferences:D,timeView:w,multiSelectView:_o,dropdownMultiSelect:Is,locationView:oe,placeholderText:r,leadInText:a,optionQuery:p,isSearchingOptions:S,isDropdownOpen:yt,isActivePillSelected:Tt}}function an(t){return t.mode!=="edit"?Rl(t):_l(t)}function kl(t,e,n){let i=t.find(C);if(!i?.options)return null;let o=e.slice(Te(e,n)).trim().toLowerCase();if(!o)return null;let r=i.options.filter(l=>l.is_tappable&&l.text.trim().toLowerCase()===o);if(new Set(r.map(l=>ee(l,i.parameter))).size!==1)return null;let s=r[0];return{suggestion:i,option:s,matchText:s.text.trim()}}function Ur(t){let{text:e,suggestions:n,filterBase:i,filterInProgress:o,phraseExactMatch:r}=t,a=n.find(c=>c.parameter!=="placeholder"&&!C(c));if(!a?.options||a.type?.kind==="multi_select")return null;let s=n.filter(c=>c.parameter==="placeholder").map(c=>c.text).join(" "),l=me(e,i,Le(s,t.prependPlaceholder)),d=Ze(a.options,e,l,o,r===!0);return d?{suggestion:a,option:d,matchText:d.text}:null}function Rl(t){let{text:e,completedParams:n,suggestions:i}=t,o=t.mode==="submit"?(t.finishWord?Ur(t):null)??kl(i,e,n):Ur(t);if(!o)return null;let{suggestion:r,option:a,matchText:s}=o,l=s.toLowerCase(),d=e.toLowerCase().lastIndexOf(l),c=d>=0?d:Math.max(0,e.length-a.text.length),u=c+s.length,g=e.slice(c,u),p=u<e.length&&e[u]===" "?u+1:u,f={id:crypto.randomUUID(),placeholder:"",parameter:ee(a,r.parameter),text:g,value:a.value,kind:a.kind,suggestionParameter:r.parameter,suggestionValueType:r.type,suggestionPlaceholder:r.text,suggestionIcon:r.icon,suggestionIconSvg:r.icon_svg,...t.mode==="submit"&&C(r)?et(ee(a,r.parameter),r.text):{},options:r.options??[],metadata:a.metadata,icon:a.icon,icon_svg:a.icon_svg,image_url:a.image_url};return{patch:{text:e,completedParams:[...n,f],suggestions:i.filter(h=>h!==r),filterBase:p,newParamId:f.id,caretOffset:p,activeDropdownIndex:-1},caretPos:p,option:a,suggestion:r}}function _l(t){let{text:e,completedParams:n,editingParam:i,editingAnchor:o,editingTail:r}=t;if(n.some(S=>S.id===i.id))return null;let a=e.slice(o,r),s=At(i.options,a);if(!s)return null;let l=s.text.toLowerCase(),d=a.toLowerCase().lastIndexOf(l),c=o+Math.max(0,d),u=c+s.text.length,g=e.slice(c,u),m=u<e.length&&e[u]===" "?u+1:u,p=e.length,f={id:crypto.randomUUID(),placeholder:"",...It(i,s),text:g,value:s.value,kind:s.kind,options:i.options,metadata:s.metadata,icon:s.icon,icon_svg:s.icon_svg,image_url:s.image_url},h=n.length,v=0;for(let S=0;S<n.length;S++){let b=re(e,n[S].text,v);if(b!==-1){if(b>=m){h=S;break}v=b+n[S].text.length}}let y=[...n];return y.splice(h,0,f),{patch:{text:e,completedParams:y,newParamId:f.id,filterBase:p,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:p,activeDropdownIndex:-1},caretPos:p,option:s}}function $r(t){return t.slice(t.search(/\S*$/))}function Gr(t){return t.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase()}function qr(t,e){let n="",i=0;for(let o of t){if(n+=Gr(o),i+=o.length,n.length>=e.length)return n.startsWith(e)?i+(t.slice(i).match(/^\p{M}*/u)?.[0].length??0):0;if(!e.startsWith(n))return 0}return 0}function Ci(t){return[...t].map(Gr).join("")}function sn(t,e){if(/\s$/.test(e))return null;let n=e.split(/\s+/).filter(Boolean).map(Ci),i=[...t.matchAll(/\S+/g)].map(o=>({index:o.index??0,text:o[0],folded:Ci(o[0])}));for(let o=n.length;o>=1;o--){let r=n.slice(n.length-o),a=r[o-1];for(let s=0;s+o<=i.length;s++){if(!r.slice(0,-1).every((u,g)=>i[s+g].folded===u))continue;let d=i[s+o-1],c=qr(d.text,a);if(c>0)return{typedWords:o,start:i[s].index,end:d.index+c}}}return null}function Ai(t,e){let n=e?sn(t,e):null;if(n&&n.typedWords>1)return[{text:t.slice(0,n.start),bold:!1},{text:t.slice(n.start,n.end),bold:!0},{text:t.slice(n.end),bold:!1}].filter(a=>a.text!=="");let i=e?$r(e):"",o=Ci(i);if(!o)return[{text:t,bold:!1}];let r=[];for(let a of t.split(/(\s+)/)){if(a==="")continue;let s=/^\s/.test(a)?0:qr(a,o);s>0&&r.push({text:a.slice(0,s),bold:!0});let l=s>0?a.slice(s):a;l&&r.push({text:l,bold:!1})}return r}var Dl=6e4;function Hl(t){return typeof TextEncoder>"u"?t.length*3:new TextEncoder().encode(t).length}function Nl(t){return(t??Z).replace(/\/suggest(\?|#|$)/,"/telemetry/events$1")}async function Fl(t){return ze(t)?`Bearer ${await Et(t).getToken()}`:wt(t)}async function Kr(t){try{let e=Nl(t.apiConfig?.endpoint),n=Pt(t.apiConfig),i=await Fl(t.apiConfig);i&&(n.Authorization=i);let o=JSON.stringify({source:t.source,session_id:t.sessionId,...t.visitorId&&{visitor_id:t.visitorId},...t.requestId&&{request_id:t.requestId},type:t.type,...t.language&&{language:t.language},at:new Date().toISOString(),query_data:t.queryData});await fetch(e,{method:"POST",headers:n,body:o,...t.keepalive&&Hl(o)<=Dl&&{keepalive:!0}})}catch{}}function he(t,e){let n=t.findIndex(i=>i.text===e);return n>=0?n+1:null}var Ii=t=>t.toLowerCase().split(/\s+/).filter(Boolean);function Wl(t,e,n){let i=Ii(t??"");if(i.length===0)return"";let r=Ii(e).slice(-i.length),a=Ii(n).slice(0,i.length);return r.join(" ")===i.join(" ")||a.join(" ")===i.join(" ")?"":(t??"").trim().split(/\s+/).join(" ")}function zr(t,e){let n=t.actionableSuggestions[0];if(!n)return null;let i=C(n),o=e.parameter;if(i&&!o)return null;let r=i&&o?o:ee(e,n.parameter),a=i?t.text.length:t.filterBase,s=t.text.slice(0,a),l=s.length===0&&t.text.length===0,d=s.length===0&&t.text.length>0&&t.placeholderText.length>0&&t.placeholderText.toLowerCase().startsWith(t.text.toLowerCase());(l||d)&&t.placeholderText&&(s=`${t.placeholderText} `);let c=Math.min(Te(t.text,t.completedParams),s.length),u=!1;if(i){let T=[...s.slice(c).matchAll(/\S+/g)],L=sn(e.text,s.slice(c)),A=T[T.length-(L?.typedWords??1)];s=s.slice(0,A?c+(A.index??0):Math.max(s.lastIndexOf(" ")+1,c))}else if(n.completes_word===!0){let T=[...s.slice(c).matchAll(/\S+/g)],L=T[T.length-1];s=s.slice(0,L?c+(L.index??0):Math.max(s.lastIndexOf(" ")+1,c))}else if(n.completes_word!==!1){let T=s.slice(c),L=Math.max(Xo(T,e.text),Vo(T,e));L>0&&(s=s.slice(0,s.length-L)),u=L>0}let g=s.length>0&&s[s.length-1]!==" ",m=i||n.completes_word===!0||u,p=t.activeFormatType!==void 0&&!H(t.activeFormatType)&&H(J({type:n.type})),f=m||p?"":Wl(n.lead_in,s,e.text),h=`${s}${g?" ":""}${f?`${f} `:""}${e.text} `,y=(l||d||i&&s.length===0)&&h.length>0?h[0].toUpperCase()+h.slice(1):h,S=y.toLowerCase().lastIndexOf(e.text.toLowerCase()),b=S>=0?y.slice(S,S+e.text.length):e.text,x=i?et(r,n.text):{parameter:r,suggestionParameter:n.parameter,suggestionValueType:n.type,suggestionPlaceholder:n.text,suggestionIcon:n.icon,suggestionIconSvg:n.icon_svg},E={id:crypto.randomUUID(),placeholder:"",...x,text:b,value:e.value,kind:e.kind,options:n.options??[],metadata:e.metadata,icon:e.icon,icon_svg:e.icon_svg,image_url:e.image_url},P=t.actionableSuggestions.length-1;return{patch:{text:y,filterBase:y.length,completedParams:[...t.completedParams,E],newParamId:E.id,caretOffset:y.length,pillTapped:!1,activeDropdownIndex:-1,skipNextFetch:!0,inSelectionAnimation:!0,pendingSpan:null},telemetry:{selectedOption:e.text,otherOptions:t.filteredOptions.filter(T=>T.text!==e.text).map(T=>T.text),key:i?r:n.parameter,position:he(n.options??[],e.text)},consumedSuggestion:n,remainingActionable:P}}function pt(t,e){let n=H(t.activeFormatType)||t.filteredOptions.length===0?null:t.filteredOptions,i=t.editingParam,o=i?tt(i):t.actionableSuggestions[0]??null;return{skeletonOptions:n,skeletonSuggestion:n?o:null,skeletonPicked:n?e??null:null,skeletonRequested:!1}}function ln(t,e,n){let i=t.slice(0,e),o=t.slice(n),r=(i===""||i.endsWith(" "))&&o.startsWith(" ");return r&&(o=o.slice(1)),{text:i+o,removed:n-e+(r?1:0)}}var cn=class{constructor(e){this.deps=e}start(e){let n=this.deps.store.get();if(n.editingParam?.id===e)return;let i=n.completedParams.find(a=>a.id===e);if(!i)return;let o=0,r=-1;for(let a of n.completedParams){let s=re(n.text,a.text,o);if(s!==-1){if(a.id===e){r=s;break}o=s+a.text.length}}r<0||this.deps.store.set({editingParam:i,editingAnchor:r,editingTail:r+i.text.length,caretOffset:r+i.text.length,activeDropdownIndex:-1,editingIdentified:null})}exit(){this.deps.store.get().editingParam&&this.deps.store.set({editingParam:null,editingAnchor:null,editingTail:null,activeDropdownIndex:-1})}replaceRange(e){let n=this.deps.store.get(),i=n.editingParam,o=n.editingAnchor,r=n.editingTail;if(!i||o==null||r==null||!n.completedParams.some(l=>l.id===i.id))return!1;let{text:a}=e===""?ln(n.text,o,r):{text:n.text.slice(0,o)+e+n.text.slice(r)},s=o+e.length;return this.deps.store.set(l=>({text:a,completedParams:l.completedParams.filter(d=>d.id!==i.id),editingTail:s,caretOffset:s,activeDropdownIndex:-1})),this.deps.scheduleSetCursor(s),this.promoteIfExact(),!0}caretAfterInput(e){let n=this.deps.store.get(),i={caretOffset:e};n.editingParam&&n.editingAnchor!=null&&e!=null&&(e<n.editingAnchor?(i.editingParam=null,i.editingAnchor=null,i.editingTail=null,i.activeDropdownIndex=-1):n.editingTail!=null&&(i.editingTail=Math.max(n.editingTail,e))),this.deps.store.set(i),this.promoteIfExact()}caretMove(e){let n=this.deps.store.get();if(n.editingParam&&n.editingAnchor!=null&&n.editingTail!=null&&e!=null&&(e<n.editingAnchor||e>n.editingTail)){this.deps.store.set({caretOffset:e,editingParam:null,editingAnchor:null,editingTail:null,activeDropdownIndex:-1});return}this.deps.store.set({caretOffset:e})}selectOption(e){let n=this.deps.store.get(),i=n.editingParam,o=n.editingAnchor,r=n.editingTail;if(!i||o==null||r==null)return;let a=It(i,e);this.deps.fireTelemetry("option",{raw_query:W(n.text,n.completedParams).rawQuery,selected_option:e.text,other_options:i.options.filter(y=>y.text!==e.text).map(y=>y.text),key:a.suggestionParameter,position:he(i.options,e.text),chip_origin:"tap"});let s=n.text.slice(0,o),l=n.text.slice(r),d=o===0&&e.text.length>0?e.text[0].toUpperCase()+e.text.slice(1):e.text,u=l.length===0||l[0]!==" "?`${d} `:d,g=s+u+l,m=g.length,p={id:crypto.randomUUID(),placeholder:"",...a,text:d,value:e.value,kind:e.kind,options:i.options,metadata:e.metadata,icon:e.icon,icon_svg:e.icon_svg,image_url:e.image_url},f=n.completedParams.findIndex(y=>y.id===i.id),h=n.completedParams.filter(y=>y.id!==i.id),v=f>=0?Math.min(f,h.length):h.length;h.splice(v,0,p),this.deps.store.set({text:g,completedParams:h,newParamId:p.id,filterBase:m,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:m,activeDropdownIndex:-1,pillTapped:!1,skipNextFetch:!0,inSelectionAnimation:!0,...pt(n)}),this.deps.startSelectionAnimationTimer(),this.deps.scheduleSetCursor(m),this.deps.fetchNow()}promoteIfExact(){let e=this.deps.store.get();if(!e.editingParam||e.editingAnchor==null||e.editingTail==null)return;let n=an({mode:"edit",text:e.text,completedParams:e.completedParams,editingParam:e.editingParam,editingAnchor:e.editingAnchor,editingTail:e.editingTail});n&&(this.deps.store.set(n.patch),this.deps.scheduleSetCursor(n.caretPos))}};var Bl=33,Vl=70,Ul=120,$l=50,De="data-aia-placeholder-leaving",He=new WeakMap;function dn(t){t.timer!==null&&(clearTimeout(t.timer),t.timer=null)}function Gl(t){return t.closest('[data-animations="off"]')?!0:!!t.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function Yr(t,e,n){e.shown=n,t.dataset.placeholder=e.target.slice(0,n)}function Qr(t,e){if(e.timer=null,!t.isConnected||e.shown>=e.target.length||(Yr(t,e,e.shown+1),e.shown>=e.target.length))return;let n=e.target[e.shown-1],i=n===" "||n==="-"?70:0;e.timer=setTimeout(()=>Qr(t,e),33+i)}function jr(t,e){Yr(t,e,0),e.timer=setTimeout(()=>Qr(t,e),33)}function Xr(t,e){let n=He.get(t);if(e===""){n&&(dn(n),He.delete(t)),t.removeAttribute(De),delete t.dataset.placeholder;return}if(n?.target===e)return;if(Gl(t)){n&&dn(n),t.removeAttribute(De),He.set(t,{target:e,shown:e.length,timer:null}),t.dataset.placeholder=e;return}let i={target:e,shown:0,timer:null},o=n&&n.shown>0?n:null;if(n&&dn(n),He.set(t,i),o){t.setAttribute(De,""),i.timer=setTimeout(()=>{i.timer=null,t.removeAttribute(De),t.isConnected&&jr(t,i)},170);return}t.removeAttribute(De),jr(t,i)}function Jr(t){let e=He.get(t);e&&(dn(e),He.delete(t))}var ql={selectedIso:null,selectedRange:null,rangeStart:null};function gt(t){if(!_(t.activeFormatType))return ql;let e=t.editingIdentified;if(e){let{iso:i,isoEnd:o}=e;return{selectedIso:o?null:i,selectedRange:i&&o?lt(i,o):null,rangeStart:t.dateRangeStart,references:t.dateReferences??[]}}let n=_e(t.editingParam);return{selectedIso:n?null:it(t.editingParam?.text),selectedRange:n,rangeStart:t.dateRangeStart??t.dateFloor??null,floor:t.dateFloor??null,references:t.dateReferences??[]}}function Oi(t){let e=t.floor!=null&&t.highlightedIso!=null&&t.highlightedIso<t.floor?null:t.highlightedIso;return t.pendingStart?lt(t.pendingStart,e??t.pendingStart):t.selected}function Mi(t,e){if(t==null)return{selected:!1,inRange:!1,reference:!1};let{selectedIso:n,range:i}=e,o=t===n||i!=null&&(t===i.start||t===i.end),r=i!=null&&t>i.start&&t<i.end,a=!o&&!r&&(e.references?.includes(t)??!1);return{selected:o,inRange:r,reference:a}}function ki(t,e,n){return t==null?!1:t<e||n!=null&&t<n}function Ri(t,e){return t==="date"?e??null:null}var Zr="https://ai-autocomplete.com";function _i(t=Zr){try{if(typeof window>"u"||!window.location)return t;let e=window.location.hostname;if(!e)return t;let n=new URL(t);return n.searchParams.set("utm_source",e),n.toString()}catch{return t}}function Di(t,e,n=k()){return t?{key:"enter",hint:n.proceed}:e?{key:"tab",hint:n.select}:{key:"\u2192",hint:n.skipHint}}function Hi(t){let e=a=>{a.ctrlKey||ea(a.target,t,a.deltaX,a.deltaY)||a.preventDefault()},n=0,i=0,o=a=>{let s=a.touches[0];s&&(n=s.clientX,i=s.clientY)},r=a=>{if(a.touches.length!==1)return;let s=a.touches[0],l=n-s.clientX,d=i-s.clientY;n=s.clientX,i=s.clientY,a.cancelable&&!ea(a.target,t,l,d)&&a.preventDefault()};return t.addEventListener("wheel",e,{passive:!1}),t.addEventListener("touchstart",o,{passive:!0}),t.addEventListener("touchmove",r,{passive:!1}),()=>{t.removeEventListener("wheel",e),t.removeEventListener("touchstart",o),t.removeEventListener("touchmove",r)}}function ea(t,e,n,i){let o=t instanceof Element?t:null;for(;o;){if(i!==0&&Kl(o,i)||n!==0&&zl(o,n))return!0;if(o===e)break;o=o.parentElement}return!1}var ta=/^(auto|scroll|overlay)$/;function Kl(t,e){return t.scrollHeight<=t.clientHeight||!ta.test(getComputedStyle(t).overflowY)?!1:e>0?t.scrollTop+t.clientHeight<t.scrollHeight-1:t.scrollTop>0}function zl(t,e){if(t.scrollWidth<=t.clientWidth)return!1;let n=getComputedStyle(t);if(!ta.test(n.overflowX))return!1;let i=Math.abs(t.scrollLeft),o=t.scrollWidth-t.clientWidth;return(n.direction==="rtl"?e<0:e>0)?i<o-1:i>0}var na=new WeakMap,ia=new WeakSet;function $(t,e,n){if(na.set(t,n),ia.has(t))return;ia.add(t);let i=()=>na.get(t),o=r=>{if(!(r instanceof Element))return null;let a=r.closest(e.itemSelector);return a&&t.contains(a)?a:null};e.onClick&&t.addEventListener("click",r=>{let a=o(r.target);a&&e.onClick?.(a,i(),r)}),e.onEnter&&t.addEventListener("mouseenter",r=>{let a=r.target;a instanceof HTMLElement&&a.matches(e.itemSelector)&&e.onEnter?.(a,i())},!0),e.onLeave&&t.addEventListener("mouseleave",r=>{let a=r.target;a instanceof HTMLElement&&a.matches(e.itemSelector)&&e.onLeave?.(a,i())},!0),e.preventMousedown&&t.addEventListener("mousedown",r=>r.preventDefault())}function be(t){return Number.parseInt(t.dataset.aiaIndex??"-1",10)}function z(t){t.offsetWidth}var se="magicx-aia-panel-ghost";function Ne(t){return t.closest(`.${se}`)!==null}function G(t,e){for(let n of t.querySelectorAll(e))if(!Ne(n))return n;return null}var Ni="--aia-multi-done-fit";function jl(t){return G(t,"[data-aia-multi-done]")}function Fi(t,e){if(!e?.isConnected)return;let n=e.ownerDocument,i=n.defaultView?.getComputedStyle(e).direction==="rtl";if(typeof n.createRange().getBoundingClientRect!="function")return;let o=e.getBoundingClientRect(),r=0;for(let a of t.querySelectorAll("[data-aia-option]")){if(Ne(a))continue;let s=n.defaultView?.getComputedStyle(a),l=Number.parseFloat(i?s?.paddingRight??"0":s?.paddingLeft??"0")||0,d=n.createTreeWalker(a,NodeFilter.SHOW_TEXT),c=n.createRange();for(let u=d.nextNode();u;u=d.nextNode()){if(!u.textContent?.trim())continue;c.selectNodeContents(u);let g=c.getBoundingClientRect();if(g.width===0)continue;let m=i?o.right-g.left:g.right-o.left;r=Math.max(r,m+l)}}r>0?e.style.setProperty(Ni,`${Math.ceil(r)}px`):e.style.removeProperty(Ni)}var Yl=40,Ql=340,Xl=340,Jl=7,Wi="--aia-option-enter-delay";function Bi(t,e,n,i="below"){let o=Math.max(1,Math.floor(e)),r=Math.floor(Math.max(0,t)/o);if(i!=="above")return r*40;let a=Math.max(1,Math.ceil(Math.max(0,n)/o));return Math.max(0,a-1-r)*40}function Vi(t,e){let n=Math.max(1,Math.floor(e));return(Math.max(1,Math.ceil(Math.max(0,t)/n))-1)*40+340}var ra="magicx-aia-scroll-arrow",un="data-aia-scroll-arrow",Fe="data-aia-visible",aa=1e3,sa=160,la="--aia-scroll-arrow-bottom",Zl="Scroll down for more options",Ui="data-aia-scrollable",ec="--aia-scroll-track-top",tc="--aia-scroll-track-height",nc="--aia-scroll-track-right",ic="--aia-scroll-thumb-top",oc="--aia-scroll-thumb-height",rc=12,ac=.5,sc="[data-aia-products-label]",oa=4,lc=8,cc=240;function dc(t,e,n,i){let o=t.scrollTop,r=n?.requestAnimationFrame,a=t.ownerDocument?.visibilityState==="hidden";if(!r||a||$i(t)){t.scrollTop=o+e,i();return}let s=n.performance?.now?.()??Date.now(),l=()=>n.performance?.now?.()??Date.now(),d=()=>{let c=Math.min(1,(l()-s)/cc),u=1-(1-c)*(1-c);t.scrollTop=o+e*u,c<1?r.call(n,d):i()};r.call(n,d)}function uc(t=document){let e="http://www.w3.org/2000/svg",n=t.createElementNS(e,"svg");n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("width","18"),n.setAttribute("height","18"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","1.75"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false");let i=t.createElementNS(e,"path");return i.setAttribute("d","M4 6.5 8 10.5l4-4"),n.appendChild(i),n}function ca(t=document,e=k()){let n=t.createElement("button");return n.type="button",n.tabIndex=-1,n.className=ra,n.setAttribute(un,""),n.setAttribute("aria-label",e.scrollArrow),n.setAttribute("aria-hidden","true"),n.disabled=!0,n.appendChild(uc(t)),n}function mc(t){return Math.max(1,qi(t.style.gridTemplateColumns))}function $i(t){return t.closest('[data-animations="off"]')?!0:!!t.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function Gi({dropdown:t,grid:e,button:n}){let i=e.ownerDocument?.defaultView??(typeof window<"u"?window:null),o=!1;n.disabled=!0;let r=null,a=null,s=null,l=null,d=E=>{if(E){if(n.hasAttribute(Fe))return;if(n.setAttribute(Fe,""),n.setAttribute("aria-hidden","false"),l!==null&&clearTimeout(l),$i(e)){n.disabled=!1;return}l=setTimeout(()=>{l=null,!o&&n.hasAttribute(Fe)&&(n.disabled=!1)},aa)}else n.removeAttribute(Fe),n.setAttribute("aria-hidden","true"),l!==null&&clearTimeout(l),l=null,n.disabled=!0},c=E=>{let P=0,T=E;for(;T&&T!==t;)P+=T.offsetTop,T=T.offsetParent instanceof HTMLElement?T.offsetParent:null;return P},u=()=>{let E=G(t,sc),P;if(E){let T=c(E)+E.offsetHeight/2;P=t.clientHeight-T-n.offsetHeight/2}else{let T=c(e),L=i&&Number.parseFloat(i.getComputedStyle(e).paddingBottom)||0;P=t.clientHeight-(T+e.offsetHeight)+(L>0?0:lc)}n.style.setProperty(la,`${Math.max(0,Math.round(P))}px`)},g=E=>{let P=0,T=E;for(;T&&T!==t;)P+=T.offsetLeft,T=T.offsetParent instanceof HTMLElement?T.offsetParent:null;return P},m=null,p=(E,P)=>{let T=Math.min(1,Math.max(0,e.scrollTop/E));n.style.setProperty(ic,`${Math.round(P*T)}px`)},f=()=>{let E=e.scrollHeight-e.clientHeight,P=e.querySelector("[data-aia-option][data-aia-loading]")!==null;if(E<=oa||P){m=null,n.removeAttribute(Ui);return}let T=e.clientHeight,L=Math.round(T*ac),A=c(e)+(T-L)/2,F=t.clientWidth-(g(e)+e.offsetWidth),R=Math.min(L,Math.max(rc,Math.round(L*T/e.scrollHeight)));m={overflow:E,travel:L-R},n.style.setProperty(ec,`${Math.round(A)}px`),n.style.setProperty(tc,`${L}px`),n.style.setProperty(nc,`${Math.max(0,Math.round(F))}px`),n.style.setProperty(oc,`${R}px`),p(E,m.travel),n.setAttribute(Ui,"")},h=()=>{if(o||a!==null||s!==null)return;let E=e.querySelector("[data-aia-option][data-aia-loading]")!==null,P=e.scrollHeight-e.clientHeight-e.scrollTop;d(!E&&P>oa)},v=()=>{if(o)return;u(),f();let E=e.getAttribute("data-aia-group")??"";if(E!==r){r=E,d(!1),a!==null&&clearTimeout(a);let P=e.querySelectorAll("[data-aia-option]").length,T=$i(e)?0:Vi(P,mc(e));a=setTimeout(()=>{a=null,h()},T);return}h()},y=()=>{o||(m&&p(m.overflow,m.travel),a===null&&(d(!1),s!==null&&clearTimeout(s),s=setTimeout(()=>{s=null,h()},sa)))};e.addEventListener("scroll",y,{passive:!0});let S=E=>E.preventDefault(),b=()=>{let E=i?(Number.parseFloat(i.getComputedStyle(e).paddingTop)||0)+(Number.parseFloat(i.getComputedStyle(e).paddingBottom)||0):0,P=Math.max(1,e.clientHeight-E);dc(e,P,i,y)};n.addEventListener("mousedown",S),n.addEventListener("click",b);let x=null;return i&&typeof i.ResizeObserver=="function"&&(x=new i.ResizeObserver(()=>{u(),f(),h()}),x.observe(e)),v(),{update:v,destroy(){o||(o=!0,a!==null&&clearTimeout(a),a=null,s!==null&&clearTimeout(s),s=null,l!==null&&clearTimeout(l),l=null,n.disabled=!0,e.removeEventListener("scroll",y),n.removeEventListener("mousedown",S),n.removeEventListener("click",b),x?.disconnect(),n.removeAttribute(Fe),n.removeAttribute(Ui),n.setAttribute("aria-hidden","true"))}}}var da="cubic-bezier(0.25, 0.1, 0.25, 1)",pc="cubic-bezier(0.32, 0.72, 0, 1)",ua=360,ma=280,pa=320,ga=40,fa="blur(2px)",gc=160,fc=.05,hc=/pressed/i;function ha(){return typeof performance<"u"?performance.now():Date.now()}function bc(t){for(let e of t.querySelectorAll("[data-aia-loading]"))if(!e.closest(`.${se}`))return!0;return!1}function Sc(t){return t===null?1:1-Math.min(1,Math.max(0,(ha()-t)/gc))**1.7}function ji(t){return t.hasAttribute(un)}function zi(t){let e=0;for(let n of Array.from(t.children))n.classList.contains(se)||ji(n)||(e+=n.offsetHeight||0);return e}var te=new WeakMap;function yc(t){return(Number.parseFloat(t.borderLeftWidth)||0)+(Number.parseFloat(t.borderRightWidth)||0)}function Tc(t){let e=(t.ownerDocument.defaultView??window).getComputedStyle(t);return(Number.parseFloat(e.paddingLeft)||0)+(Number.parseFloat(e.paddingRight)||0)+(Number.parseFloat(e.borderLeftWidth)||0)+(Number.parseFloat(e.borderRightWidth)||0)}var Ki=new WeakMap;function xc(t,e){return!e||typeof t.animate!="function"||t.closest('[data-animations="off"]')||t.closest('[data-aia-options-style="classic"]')?!1:!(t.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)")??null)?.matches}function vc(t,e){let n=0,i="";for(let o of Array.from(t.children))o.classList.contains(se)||(n+=1+o.getElementsByTagName("*").length,i+=`${o.textContent??""}\0`);return`${e??""}${n}${i}`}function Ec(t){let e=t.ownerDocument.createElement("div");e.className=se,e.setAttribute("aria-hidden","true"),e.inert=!0;for(let n of Array.from(t.children))n.classList.contains(se)||ji(n)||e.appendChild(n.cloneNode(!0));for(let n of[e,...Array.from(e.querySelectorAll("*"))]){n.removeAttribute("id"),n.removeAttribute("role"),n.removeAttribute("tabindex");for(let i of Array.from(n.classList))hc.test(i)&&n.classList.remove(i);n.tagName==="A"&&n.removeAttribute("href"),n.tagName==="BUTTON"&&(n.disabled=!0);for(let i of Array.from(n.attributes))i.name.startsWith("aria-")&&i.name!=="aria-hidden"&&n.removeAttribute(i.name)}return e}function Pc(t,e,n,i,o){for(let a of Array.from(t.children))a.classList.contains(se)&&a.remove();let r=Array.from(t.children).filter(a=>!ji(a));i>fc&&wc(t,e,n,i,o);for(let a of r)a.animate([{opacity:0,filter:fa},{opacity:1,filter:"blur(0px)"}],{duration:pa,delay:ga,easing:da,fill:"backwards"})}function wc(t,e,n,i,o){let r=(t.ownerDocument.defaultView??window).getComputedStyle(t);e.style.cssText=["position:absolute","left:0",o>0?`width:${o-yc(r)}px`:"right:0",n?"bottom:0":"top:0",`padding:${r.padding}`,"pointer-events:none","box-sizing:border-box"].join(";"),t.appendChild(e),e.animate([{opacity:i,filter:"blur(0px)"},{opacity:0,filter:fa}],{duration:ma*i,easing:da,fill:"forwards"}).finished.then(()=>e.remove(),()=>e.remove())}function Yi(t){let e=t[0]?.text;return e==null||e===""?null:e}function mn(t,e,n){let i=n.visible,o=xc(t,n.enabled??!0),r=te.get(t);if(!i||!o){o||r?.glide?.cancel(),te.set(t,{height:0,width:0,key:i?e:null,signature:"",snapshot:null,glide:o?r?.glide??null:null,loadingSince:null,contentHeight:0});return}let a=vc(t,e),s=bc(t)?r?.loadingSince??ha():null;if(r&&r.height>0&&r.glide&&r.signature===a){r.loadingSince=s;return}let l=Se(t),d=t.getBoundingClientRect(),c=d.height;r?.glide?.cancel();let u=t.getBoundingClientRect(),g=u.height,m=u.width||0,p=null,f=r?l?c:r.height:0,h=r?l?d.width||0:r.width:0;r&&f>0&&(e!==r.key&&r.snapshot&&Pc(t,r.snapshot,n.anchorBottom??!1,Sc(r.loadingSince),h),p=ba(t,{height:f,width:h},{height:g,width:m}));let v=null;e!==null&&(v=r&&r.signature===a&&r.snapshot&&!r.snapshot.isConnected?r.snapshot:Ec(t)),te.set(t,{height:g,width:m,key:e,signature:a,snapshot:v,glide:p,loadingSince:s,contentHeight:p?zi(t):0})}function ba(t,e,n){let i=e.width>0&&n.width>0&&Math.abs(e.width-n.width)>1;if(Math.abs(e.height-n.height)<=1&&!i)return null;let o=i?[{height:`${e.height}px`,width:`${e.width}px`},{height:`${n.height}px`,width:`${n.width}px`}]:[{height:`${e.height}px`},{height:`${n.height}px`}],r=t.animate(o,{duration:ua,easing:pc});i&&(t.setAttribute(on,String(n.width)),n.width>e.width?t.style.setProperty(dt,`${n.width-Tc(t)}px`):t.style.removeProperty(dt),Ki.set(t,r));let a=()=>{Ki.get(t)===r&&(Ki.delete(t),t.removeAttribute(on),t.style.removeProperty(dt))};return r.finished.then(()=>{a();let s=te.get(t);if(s?.glide!==r||(s.glide=null,s.height<=0))return;let l=t.getBoundingClientRect();l.height>0&&(s.height=l.height),l.width>0&&(s.width=l.width)},a),r}function Se(t){let e=te.get(t)?.glide??null;return e&&(e.playState==="running"||e.pending)?e:null}function Qi(t){if(!Se(t))return null;let e=te.get(t)?.height??0;return e>0?e:null}function Xi(t,e){let n=te.get(t);n&&n.height>0&&!Se(t)&&e>0&&(n.height=e)}function Sa(t,{widthChanged:e}){let n=te.get(t);if(!n||n.height<=0)return;let i=Se(t);if(!i||!e&&(t.hasAttribute("data-aia-fit")||Math.abs(zi(t)-n.contentHeight)<=1))return;let o=t.getBoundingClientRect();i.cancel();let r=t.getBoundingClientRect();n.width=r.width||0,n.height=r.height,n.glide=ba(t,{height:o.height,width:o.width||0},{height:r.height,width:n.width}),n.contentHeight=n.glide?zi(t):0}function Ji(t){te.get(t)?.glide?.cancel(),te.delete(t)}var Zi="data-aia-hug",We="--aia-panel-fit-width",eo="data-aia-full-width",Lc=36;function ft(t){t.removeAttribute(Zi)}function to(t,e,{eligible:n,loading:i}){let o=t.style.getPropertyValue(We);Cc(t,e,n,i),Sa(t,{widthChanged:t.style.getPropertyValue(We)!==o})}function Cc(t,e,n,i){if(!n){t.style.removeProperty(We),ft(t);return}if(i){t.style.getPropertyValue(We)&&t.setAttribute(Zi,"");return}let o=Ac(t,e);if(o==null){t.style.removeProperty(We);return}t.style.setProperty(We,`${o}px`),t.setAttribute(Zi,"")}var ya=new WeakMap;function Ac(t,e){if(ut())return null;let n=G(e,".aia-grid");if(!n||t.offsetWidth===0)return null;let i=G(e,"[data-aia-pillbar]"),o=[n.style.gridTemplateColumns,i?.textContent??"",...Array.from(n.querySelectorAll("[data-aia-option]"),s=>s.textContent)].join("\0"),r=ya.get(t);if(r?.key===o)return r.width;let a=Ic(t,e,n);return ya.set(t,{key:o,width:a}),a}function Ic(t,e,n){let i=ct(n);if(!i||i.rowWidths.some(s=>s<=0))return null;let o=Math.ceil(Math.max(...i.rowWidths)),r=Math.max(1,qi(n.style.gridTemplateColumns)),a=Ta(n,t,r-1)+r*(o+Lc);return Math.ceil(Math.max(a,Oc(e,t)))}function Oc(t,e){let n=G(t,"[data-aia-pillbar]");if(!n)return 0;let i=n.querySelector("[data-aia-pill-scroll]")?.scrollWidth??0,o=n.querySelector("[data-aia-skip]")?.offsetWidth??0;return i+o===0?0:Ta(n,e,i>0&&o>0?1:0)+i+o}function qi(t){let e=0,n=0,i=!1;for(let o of t)o==="("?e++:o===")"&&e--,e===0&&/\s/.test(o)?i=!1:i||(i=!0,n++);return n}function Ta(t,e,n){let i=0;for(let o=t;o;o=o.parentElement){let r=getComputedStyle(o);if(i+=(Number.parseFloat(r.paddingLeft)||0)+(Number.parseFloat(r.paddingRight)||0)+(Number.parseFloat(r.borderLeftWidth)||0)+(Number.parseFloat(r.borderRightWidth)||0),o===t&&(i+=n*(Number.parseFloat(r.columnGap)||0)),o===e)break}return i}var Mc="[data-aia-products], [data-aia-datepicker], [data-aia-date-grid], [data-aia-time-wheel], [data-aia-location], [data-aia-see-all]";function kc(t){let e=!t.hasAttribute("data-aia-has-products")&&!t.hasAttribute(eo)&&G(t,".aia-grid [data-aia-option]")!==null&&G(t,Mc)===null,n=G(t,".aia-grid [data-aia-option][data-aia-loading]")!==null;e||ft(t),to(t,t,{eligible:e,loading:n})}var xa="data-aia-key";function ne(t,e,n){let i=new Map;for(let a of Array.from(t.children)){let s=a.getAttribute(xa);s!=null&&i.set(s,a)}let o=new Set,r=[];for(let a=0;a<e.length;a++){let s=e[a],l=n.keyOf(s,a);o.add(l);let d=i.get(l);d||(d=n.create(s,a),d.setAttribute(xa,l)),n.update?.(d,s,a),t.children[a]!==d&&t.insertBefore(d,t.children[a]??null),r.push(d)}for(let[a,s]of i)o.has(a)||s.remove();return r}function va(t,e){if(!e.interactive)return null;let n=e.options[be(t)];return n?.is_tappable?n:null}var Rc={itemSelector:"[data-aia-date-cell], [data-aia-date-prev], [data-aia-date-next]",onClick:(t,e)=>{if(t.hasAttribute("data-aia-date-prev")){e.callbacks.onPreviousMonth();return}if(t.hasAttribute("data-aia-date-next")){e.callbacks.onNextMonth();return}let n=va(t,e);n&&(t.classList.add("magicx-aia-date-cell--pressed"),e.callbacks.onSelect(n),setTimeout(()=>t.classList.remove("magicx-aia-date-cell--pressed"),170))},onEnter:(t,e)=>{t.hasAttribute("data-aia-date-cell")&&va(t,e)&&e.callbacks.onHighlight(be(t))},onLeave:(t,e)=>{t.hasAttribute("data-aia-date-cell")&&e.callbacks.onHighlight(-1,be(t))}};function Pa(t,e,n,i,o,r,a,s=!0){let l=t.querySelector(".magicx-aia-datepicker");if(!o||e.length===0){l?.remove();return}if(!l){l=Hc(),t.appendChild(l),z(l);for(let u of l.querySelectorAll(".magicx-aia-datepicker-nav"))u.disabled=!1}$(l,Rc,{options:e,callbacks:a,interactive:s});let d=l.querySelector(".magicx-aia-datepicker-month");d&&(d.textContent=Un(o));let c=l.querySelector(".magicx-aia-datepicker-grid");c&&_c(c,e,n,i,r)}function _c(t,e,n,i,o){let r=B(new Date),a=Oi({pendingStart:o.rangeStart,highlightedIso:j(e[n]),selected:o.selectedRange,floor:o.floor});ne(t,e,{keyOf:(s,l)=>j(s)??`pad-${l}`,create:s=>Dc(s),update:(s,l,d)=>{let c=j(l),u=Mi(c,{selectedIso:o.selectedIso,range:a,references:o.references}),g=d===n&&l.is_tappable;s.id=`${i}-option-${d}`,s.dataset.aiaIndex=String(d),s.setAttribute("aria-selected",String(g)),s.classList.toggle("magicx-aia-date-cell--past",ki(c,r,o.floor)),s.classList.toggle("magicx-aia-date-cell--highlighted",g),s.classList.toggle("magicx-aia-date-cell--today",c!=null&&c===r),s.classList.toggle("magicx-aia-date-cell--selected",u.selected),s.classList.toggle("magicx-aia-date-cell--in-range",u.inRange),s.classList.toggle("magicx-aia-date-cell--reference",u.reference)}})}function Dc(t){let e=document.createElement("div");e.setAttribute("role","option"),e.setAttribute("data-aia-option",""),e.setAttribute("data-aia-date-cell","");let n=Kn(t);if(n==null)return e.className="magicx-aia-date-cell magicx-aia-date-cell--blank",e.setAttribute("aria-hidden","true"),e.tabIndex=-1,e;e.className="magicx-aia-date-cell magicx-aia-date-cell--day",e.tabIndex=0,e.setAttribute("aria-label",t.text);let i=document.createElement("span");return i.className="magicx-aia-date-cell-number",i.textContent=String(n),e.appendChild(i),e}function Hc(){let t=document.createElement("div");t.className="magicx-aia-datepicker",t.setAttribute("data-aia-datepicker","");let e=document.createElement("div");e.className="magicx-aia-datepicker-header";let n=document.createElement("span");n.className="magicx-aia-datepicker-month",n.setAttribute("data-aia-date-month",""),n.setAttribute("aria-live","polite"),e.append(Ea("prev","Previous month","\u2039"),n,Ea("next","Next month","\u203A"));let i=document.createElement("div");i.className="magicx-aia-datepicker-weekdays",i.setAttribute("aria-hidden","true");for(let r of _t){let a=document.createElement("span");a.className="magicx-aia-datepicker-weekday",a.textContent=r,i.appendChild(a)}let o=document.createElement("div");return o.className="magicx-aia-datepicker-grid",o.setAttribute("data-aia-date-grid",""),t.append(e,i,o),t}function Ea(t,e,n){let i=document.createElement("button");return i.type="button",i.tabIndex=-1,i.className="magicx-aia-datepicker-nav",i.setAttribute(`data-aia-date-${t}`,""),i.setAttribute("aria-label",e),i.textContent=n,i.disabled=!0,i}var Nc='<svg class="magicx-aia-location-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"/><circle cx="12" cy="9.5" r="2.5"/></svg>',wa="data-aia-location-body";function Fc(t){let e=document.createElement("div");e.className="magicx-aia-location-row",e.setAttribute("data-aia-location-row",""),e.setAttribute("role","option");let n=document.createElement("span");n.className="magicx-aia-location-pin",n.innerHTML=Nc;let i=document.createElement("span");i.className="magicx-aia-location-text";let o=document.createElement("span");if(o.className="magicx-aia-location-name",o.textContent=t.name,i.appendChild(o),t.secondary){let r=document.createElement("span");r.className="magicx-aia-location-secondary",r.textContent=t.secondary,i.appendChild(r)}return e.append(n,i),e}function Wc(t,e){if(t==="loading"){let o=document.createElement("div");o.className="magicx-aia-location-loading",o.setAttribute("data-aia-location-loading","");for(let r=0;r<3;r++)o.appendChild(document.createElement("span")).className="magicx-aia-location-loading-bar";return o}if(t==="")return null;let n=document.createElement("div");if(n.className="magicx-aia-location-note",n.setAttribute("data-aia-location-note",""),t==="note-empty"){let o=document.createElement("span");o.className="magicx-aia-location-empty",o.textContent=e.locationNoResults,n.appendChild(o)}let i=document.createElement("span");return i.textContent=e.locationUseTyped,n.appendChild(i),n}function La(t,e,n,i){let o=e.places,r="";if(o.length===0&&(e.status==="loading"?r="loading":e.query.trim()&&(r=e.status==="done"?"note-empty":"note")),t.getAttribute(wa)!==r){for(let s of Array.from(t.children))s.hasAttribute("data-aia-location-row")||s.remove();let a=Wc(r,n);a&&t.appendChild(a),t.setAttribute(wa,r)}ne(t,o,{keyOf:(a,s)=>`${s}:${a.id}`,create:a=>Fc(a),update:(a,s,l)=>{let d=l===e.highlighted;a.classList.toggle("magicx-aia-location-row--highlighted",d),a.setAttribute("aria-selected",String(d)),a.setAttribute("data-aia-index",String(l)),a.id=i(l)}})}var le=new WeakMap,Bc=0,Ee=new WeakMap,Vc='<svg class="magicx-aia-location-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>',Pe=t=>Nt(t.input)===t.input;function Ca(t,e){let n=Nt(t);if(n instanceof HTMLElement&&n!==e.input&&n!==N(t).body&&!t.contains(n)&&(e.returnTo=n,e.returnRange=null,n.isContentEditable)){let i=xe(n);i&&n.contains(i.startContainer)&&(e.returnRange=i.cloneRange())}}function Uc(t,e,n){if(!(!(n instanceof HTMLElement)||n===e.returnTo||t.contains(n))&&n!==N(t).body&&(e.returnTo=n,e.returnRange=null,n.isContentEditable)){let i=xe(n);i&&n.contains(i.startContainer)&&(e.returnRange=i.cloneRange())}}function $c(t,e){if(t.focus({preventScroll:!0}),!t.isContentEditable)return;let n=ot(t);if(!n)return;let i=e;(!i||!i.startContainer.isConnected||!t.contains(i.startContainer))&&(i=N(t).createRange(),i.selectNodeContents(t),i.collapse(!1)),n.removeAllRanges(),n.addRange(i)}var Gc={itemSelector:"[data-aia-location-row]",onClick:(t,e)=>{if(!e.interactive)return;let n=t.closest("[data-aia-location]");n&&Be(n,!0),e.callbacks.onLocationCommit(Number(t.dataset.aiaIndex))}};function Be(t,e=!1){let n=Ee.get(t),i=le.get(t);if(!n||!i)return;e&&(n.declined=!0);let o=n.returnTo;o?.isConnected&&Pe(n)&&(n.returning=!0,$c(o,n.returnRange),n.returning=!1),i.callbacks.onLocationFocusChange(!1)}function qc(t){let e=Ee.get(t),n=le.get(t);if(!(!e||!n||Pe(e))){if(Ca(t,e),n.callbacks.onLocationFocusChange(!0),e.input.focus({preventScroll:!0}),!Pe(e)){e.declined=!0,n.callbacks.onLocationFocusChange(!1);return}e.input.value&&e.input.select()}}function Kc(t,e){t.className="magicx-aia-location",t.setAttribute("data-aia-location",""),t.id=`magicx-aia-location-${++Bc}`;let n=document.createElement("label");n.className="magicx-aia-location-field",n.innerHTML=Vc;let i=document.createElement("input");i.type="text",i.className="magicx-aia-location-input",i.setAttribute("data-aia-location-input",""),i.setAttribute("autocomplete","off"),i.setAttribute("autocapitalize","words"),i.setAttribute("enterkeyhint","done"),i.spellcheck=!1,i.placeholder=e.locationSearch,i.setAttribute("aria-label",e.locationSearch),n.appendChild(i);let o=document.createElement("div");o.className="magicx-aia-location-results",o.setAttribute("data-aia-location-results",""),o.setAttribute("aria-live","polite"),t.append(n,o);let r={input:i,field:n,results:o,returnTo:null,returnRange:null,returning:!1,declined:!1,widgetFocused:!1,wasReediting:!1};return t.addEventListener("mousedown",a=>{!(a.target instanceof Node)||!n.contains(a.target)||(a.stopPropagation(),Ca(t,r),le.get(t)?.callbacks.onLocationFocusChange(!0))}),i.addEventListener("input",()=>le.get(t)?.callbacks.onLocationQuery(i.value)),i.addEventListener("focus",a=>{Uc(t,r,a.relatedTarget),le.get(t)?.callbacks.onLocationFocusChange(!0)}),i.addEventListener("blur",()=>{r.returning||(r.declined=!0,le.get(t)?.callbacks.onLocationFocusChange(!1))}),i.addEventListener("keydown",a=>{let s=le.get(t);if(!(!s||a.isComposing))switch(a.key){case"ArrowDown":case"ArrowUp":a.preventDefault(),s.callbacks.onLocationMove(a.key==="ArrowDown"?1:-1);return;case"Enter":if(a.preventDefault(),!s.interactive)return;Be(t,!0),s.callbacks.onLocationCommit();return;case"Escape":a.preventDefault(),a.stopPropagation(),r.declined=!0,Be(t);return;case"Backspace":if(i.value!=="")return;a.preventDefault(),r.declined=!0,Be(t);return}}),Ee.set(t,r),r}function Aa(t){for(let e of t.querySelectorAll("[data-aia-location]")){let n=Ee.get(e);n&&(Pe(n)&&Be(e),n.declined=!1,n.input.tabIndex=-1)}}function Ia(t,e,n,i,o={}){let r=Array.from(t.children).find(l=>l.hasAttribute("data-aia-location"))??null;if(!e){if(r){let l=Ee.get(r);l&&Pe(l)&&Be(r),r.remove()}return}r||(r=document.createElement("div"),t.appendChild(r));let a=Ee.get(r)??Kc(r,n);a.input.tabIndex=0,le.set(r,{view:e,callbacks:i,interactive:o.interactive??!0}),$(a.results,Gc,le.get(r)),a.input.value!==e.query&&!Pe(a)&&(a.input.value=e.query);let s=l=>`${r?.id}-row-${l}`;if(La(a.results,e,n,s),e.highlighted>=0&&e.highlighted<e.places.length?a.input.setAttribute("aria-activedescendant",s(e.highlighted)):a.input.removeAttribute("aria-activedescendant"),o.inputFocused){let l=o.reediting??!1;l&&!a.wasReediting&&(a.declined=!1),a.wasReediting=l}if(a.widgetFocused=o.inputFocused??!1,o.inputFocused){if(o.reediting&&!a.declined&&o.interactive!==!1&&!Pe(a)){let l=r;queueMicrotask(()=>{l.isConnected&&!Ee.get(l)?.declined&&qc(l)})}}else{let l=a;setTimeout(()=>{if(l.widgetFocused)return;let d=l.returnTo;d&&Nt(d)===d||(l.declined=!1)},0)}}var zc={itemSelector:"[data-aia-pill]",onClick:(t,e)=>{if(e.loading||t.disabled)return;let n=Number.parseInt(t.dataset.aiaPillIndex??"-1",10);n>=0&&e.onSelectPill(n)},preventMousedown:!0},Oa=[125,69];function Ma(t,e){return e?1:t===0?.7:t===1?.4:.2}function pn(t,e,n,i,o=!1,r=!1,a=!1){let s=t.querySelector(".magicx-aia-pill-list");if(s||(s=document.createElement("span"),s.className="magicx-aia-pill-list",t.appendChild(s)),$(s,zc,{onSelectPill:i,loading:r}),r&&e.length===0){s.setAttribute("data-aia-pill-list-loading",""),s.innerHTML="";for(let l=0;l<Oa.length;l++){let d=Oa[l],c=document.createElement("span");c.setAttribute("data-aia-pill-skeleton",""),c.className=`magicx-aia-pill magicx-aia-pill--skeleton${o?" magicx-aia-pill--rounded":""}`,c.style.width=`${d}px`,c.style.setProperty("--aia-pill-opacity",String(Ma(l,!1))),s.appendChild(c)}return}r?s.setAttribute("data-aia-pill-list-loading",""):s.removeAttribute("data-aia-pill-list-loading");for(let l of s.querySelectorAll("[data-aia-pill-skeleton]"))l.remove();ne(s,e,{keyOf:l=>`${l.type?.kind??""}|${Ce(l)?1:0}|${l.parameter}|${l.text}`,create:l=>{let d=document.createElement("button");if(d.type="button",d.tabIndex=-1,d.setAttribute("data-aia-pill",""),d.setAttribute("contenteditable","false"),Ce(l)){d.setAttribute("data-aia-smart-suggestion",C(l)?"header":"");let c=document.createElement("span");c.className="magicx-aia-smart-suggestion-text",c.textContent=l.text;let u=document.createElement("span");u.className="magicx-aia-smart-suggestion-sparkle",u.innerHTML=Wn,d.append(c,u)}else d.textContent=l.text;return d.disabled=!0,d},update:(l,d,c)=>{let u=l,g=a&&c===n&&!r,m=["magicx-aia-pill"];o&&m.push("magicx-aia-pill--rounded"),r&&m.push("magicx-aia-pill--skeleton"),u.className=m.join(" "),u.style.width="",u.style.setProperty("--aia-pill-opacity",String(Ma(c,g))),u.dataset.aiaPillIndex=String(c),u.toggleAttribute("data-aia-pill-active",c===n),r?u.setAttribute("data-aia-loading",""):u.removeAttribute("data-aia-loading")}}),z(s);for(let l of s.querySelectorAll("[data-aia-pill]"))l.disabled=r}function no(t){t.querySelector(".magicx-aia-pill-list")?.remove()}var jc=32;function ka(t,e){if(e.ctrlKey)return null;let n=e.deltaY||0,i=e.deltaX||0;if(!n||Math.abs(i)>=Math.abs(n))return null;let o=t.scrollWidth-t.clientWidth;if(o<=1)return null;let r=t.scrollLeft,a=n;return e.deltaMode===1?a*=32:e.deltaMode===2&&(a*=t.clientWidth),Math.max(0,Math.min(o,r+a))}function io(t){let e=n=>{let i=ka(t,n);i!==null&&(n.preventDefault(),t.scrollLeft=i)};return t.addEventListener("wheel",e,{passive:!1}),()=>t.removeEventListener("wheel",e)}var Ra=Intl.Segmenter,_a=Ra?new Ra(void 0,{granularity:"grapheme"}):null;function oo(t){let e=t.trim().normalize("NFC").toUpperCase();if(_a)for(let n of _a.segment(e))return n.segment;return Array.from(e)[0]??"?"}var ro=120,Yc=360;function Qc(t){let e=t.pathname;return t.hostname==="cdn.shopify.com"&&e.startsWith("/s/files/")||e.startsWith("/cdn/shop/")?/\.png$/i.test(e)?{format:"pjpg"}:/\.webp$/i.test(e)?{format:null}:null:null}function Da(t,e){let n;try{n=new URL(t,typeof document>"u"?void 0:document.baseURI)}catch{return t}let i=Qc(n);return i?(n.searchParams.set("width",String(e)),i.format&&n.searchParams.set("format",i.format),t.startsWith("/")&&!t.startsWith("//")?`${n.pathname}${n.search}${n.hash}`:n.href):t}function ao(t,e){let n=Da(t,e);return n===t?[t]:[n,t]}function so(t,e){if(!(t>0)||!(e>0))return null;let n=t/e,i=o=>Math.round(o*1e3)/1e3;return{x:i(Math.min(n,1)),y:i(Math.min(1/n,1))}}function gn(t){let e=t?.trim();return e?ao(e,360):[]}function Xc(t){return gn(t)[0]}var fn=new WeakMap,co=new WeakMap,Na=new WeakMap;function Fa(t,e,n,i,o,r="row",a="image",s=k(),l){let d=t.querySelector(".magicx-aia-products");if(e.length===0){d?.remove();return}if(!d){d=document.createElement("section"),d.className="magicx-aia-products",d.setAttribute("data-aia-products",""),d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${n}-products-label`);let g=document.createElement("div");g.className="magicx-aia-products-label",g.id=`${n}-products-label`,g.setAttribute("data-aia-products-label",""),g.textContent=s.products;let m=document.createElement("div");m.className="magicx-aia-products-row",m.setAttribute("data-aia-products-row",""),io(m),d.append(g,m),t.appendChild(d)}d.setAttribute("data-aia-products-layout",r);let c=d.querySelector(".magicx-aia-products-label");c&&c.textContent!==s.products&&(c.textContent=s.products);let u=d.querySelector(".magicx-aia-products-row");if(u){ne(u,e,{keyOf:g=>td(g,!!l),create:g=>nd(g,i,o,a,s,l),update:(g,m,p)=>{fn.set(g,m),Jc(g,m.price,m.compareAtPrice),g.id=`${n}-product-${p}`,g.dataset.aiaIndex=String(p),Na.get(g)?.(a);let f=g.querySelector(".magicx-aia-product-badge");f&&f.textContent!==s.soldOut&&(f.textContent=s.soldOut);let h=g.querySelector(".magicx-aia-product-cart");h&&h.setAttribute("aria-label",Wa(m,s))}}),z(u);for(let g of u.querySelectorAll("[data-aia-product]")){let m=co.get(g);m&&(co.delete(g),m())}}}function uo(t,e){let n=t.querySelectorAll("[data-aia-product], [data-aia-product-cart]");for(let i of n)Ne(i)||(i.tabIndex=e?0:-1)}function Jc(t,e,n){let i=t.querySelector(".magicx-aia-product-price");if(!e){i?.remove();return}i||(i=document.createElement("span"),i.className="magicx-aia-product-price",i.append(document.createTextNode("")),t.querySelector(".magicx-aia-product-title")?.after(i));let o=i.firstChild;o.data!==e&&(o.data=e);let r=i.querySelector(".magicx-aia-product-compare-at");if(!n){r?.remove();return}r||(r=document.createElement("s"),r.className="magicx-aia-product-compare-at",i.append(r)),r.textContent!==n&&(r.textContent=n)}function Ha(t,e){e?(t.style.setProperty("--aia-product-photo-fill-x",String(e.x)),t.style.setProperty("--aia-product-photo-fill-y",String(e.y))):(t.style.removeProperty("--aia-product-photo-fill-x"),t.style.removeProperty("--aia-product-photo-fill-y"))}function Wa(t,e){return`${e.addToCart}: ${t.title}`}var lo="http://www.w3.org/2000/svg";function Zc(){let t=document.createElementNS(lo,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false");let e=[["magicx-aia-product-cart-glyph","M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"],["magicx-aia-product-cart-glyph","M13.5 6.5v-4M11.5 4.5h4"],["magicx-aia-product-cart-check","M5 12.5l4.5 4.5L19 7.5"],["magicx-aia-product-cart-spinner","M12 4a8 8 0 1 0 8 8"]];for(let[n,i]of e){let o=document.createElementNS(lo,"path");o.setAttribute("class",n),o.setAttribute("d",i),t.appendChild(o)}for(let n of["9","17.5"]){let i=document.createElementNS(lo,"circle");i.setAttribute("class","magicx-aia-product-cart-glyph"),i.setAttribute("cx",n),i.setAttribute("cy","20"),i.setAttribute("r","1.3"),t.appendChild(i)}return t}function ed(t,e,n,i,o){let r=document.createElement("span");r.className="magicx-aia-product-cart",r.setAttribute("data-aia-product-cart",""),r.setAttribute("role","button"),r.setAttribute("aria-label",Wa(e,o)),r.tabIndex=0,r.appendChild(Zc());let a=s=>{s.preventDefault(),s.stopPropagation(),r.getAttribute("data-aia-cart-state")!=="adding"&&(r.setAttribute("data-aia-cart-state","adding"),r.setAttribute("aria-busy","true"),n(fn.get(t)??e).then(()=>{r.removeAttribute("aria-busy"),r.setAttribute("data-aia-cart-state","added")},()=>{r.removeAttribute("aria-busy"),r.removeAttribute("data-aia-cart-state")}))};return r.addEventListener("keydown",s=>{s.key!=="Enter"&&s.key!==" "||a(s)}),r.addEventListener("focus",()=>i(!0)),r.addEventListener("blur",s=>{s.relatedTarget?.closest("[data-aia-dropdown]")||i(!1)}),{el:r,arm:()=>r.addEventListener("click",a)}}function td(t,e){return[e?"cart":"",t.id,t.title,t.url,t.imageUrl,t.vendor,t.available===!1?"sold-out":""].map(n=>n??"").join("\0")}function nd(t,e,n,i,o,r){let a=document.createElement("a");a.className="magicx-aia-product",a.setAttribute("data-aia-product",""),a.setAttribute("role","option"),a.setAttribute("aria-selected","false"),a.tabIndex=0;let s=document.createElement("span");s.className="magicx-aia-product-media",s.setAttribute("aria-hidden","true");let l=gn(t.imageUrl),d=l[0],c=!!d,u=()=>{s.replaceChildren(),s.removeAttribute("data-aia-image-loaded"),s.toggleAttribute("data-aia-product-placeholder",i==="image"),s.toggleAttribute("data-aia-product-initial",i==="initial"),i==="initial"&&(s.textContent=oo(t.title))};if(Na.set(a,f=>{f!==i&&(i=f,c||u())}),d){let f=document.createElement("img"),h=0;f.onload=()=>{s.setAttribute("data-aia-image-loaded",""),Ha(a,so(f.naturalWidth,f.naturalHeight))},f.onerror=()=>{let v=l[++h];if(v){f.src=v;return}c=!1,Ha(a,null),u()},f.className="magicx-aia-product-image",f.src=d,f.alt="",f.loading="lazy",f.decoding="async",s.appendChild(f)}else u();a.appendChild(s);let g=document.createElement("span");if(g.className="magicx-aia-product-body",t.vendor){let f=document.createElement("span");f.className="magicx-aia-product-vendor",f.textContent=t.vendor,g.appendChild(f)}let m=document.createElement("span");if(m.className="magicx-aia-product-title",m.textContent=t.title,g.appendChild(m),t.available===!1){a.setAttribute("data-aia-product-sold-out","");let f=document.createElement("span");f.className="magicx-aia-product-badge",f.textContent=o.soldOut,g.appendChild(f)}a.appendChild(g);let p=r&&t.available!==!1?ed(a,t,r,n,o):null;return p&&(a.setAttribute("data-aia-product-has-cart",""),a.appendChild(p.el)),co.set(a,()=>{p?.arm(),t.url&&(a.href=t.url),a.addEventListener("click",f=>{f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||f.button!==0||(f.preventDefault(),e(fn.get(a)??t))})}),a.addEventListener("keydown",f=>{f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),e(fn.get(a)??t))}),a.addEventListener("focus",()=>n(!0)),a.addEventListener("blur",f=>{f.relatedTarget?.closest("[data-aia-dropdown]")||n(!1)}),a}var id=10,od=44;function mo(t,e,n){if(!e||n.detail===0)return!0;let i=t.getBoundingClientRect(),o=e.getBoundingClientRect();if(t.ownerDocument.defaultView?.getComputedStyle(t).direction==="rtl"){let s=Math.min(o.left-10,i.right-44);return n.clientX>=s}let a=Math.max(o.right+10,i.left+44);return n.clientX<=a}var Ba="http://www.w3.org/2000/svg",rd=new Set(["svg","g","path","circle","ellipse","line","polyline","polygon","rect"]);function ad(t,e){let n=t.toLowerCase();return n.startsWith("on")||n.includes("href")||n==="style"||n==="xml:base"||n==="id"||n==="name"||/^\s*javascript:/i.test(e)||/url\s*\(\s*['"]?\s*[^#'"\s)]/i.test(e)}var sd=["fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","fill-rule","clip-rule","opacity","fill-opacity","stroke-opacity"],ld=/^[a-zA-Z0-9#.,%\s()-]+$/;function cd(t){let e=[];for(let n of sd){let i=t.getAttribute(n);i===null||!ld.test(i)||/url\s*\(/i.test(i)||e.push(`${n}: ${i.trim()}`)}e.length>0&&t.setAttribute("style",e.join("; "))}function Va(t){for(let e of Array.from(t.attributes))ad(e.name,e.value)&&t.removeAttribute(e.name);cd(t);for(let e of Array.from(t.childNodes))if(e.nodeType===Node.ELEMENT_NODE){let n=e;!rd.has(n.localName)||n.namespaceURI!==Ba?n.remove():Va(n)}else e.remove()}function ce(t){if(typeof DOMParser>"u"||typeof XMLSerializer>"u")return null;let e=new DOMParser().parseFromString(t,"image/svg+xml"),n=e.documentElement;return!n||n.localName!=="svg"||n.namespaceURI!==Ba||e.getElementsByTagName("parsererror").length>0?null:(Va(n),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),new XMLSerializer().serializeToString(n))}function hn(t){return t.text}function we(t){return ht(t)[0]??null}function ht(t){let e=dd(t);return e?ao(e,120):[]}function dd(t){if(!t)return null;let e=t.trim();if(e==="")return null;let n;try{n=new URL(e,typeof document>"u"?void 0:document.baseURI)}catch{return null}return n.protocol!=="http:"&&n.protocol!=="https:"?null:n.href}function bt(t){return t===void 0||!Number.isInteger(t)||t<0?null:t.toLocaleString()}var Ua={one:"item",other:"items"};function ud(t,e=Ua){let n=bt(t);if(n===null)return null;let i=typeof e=="string"?e:t===1?e.one:e.other;return i===""?n:`${n} ${i}`}function $a(t){return we(t.image_url)!==null}var bn=new Map;function md(t){let e=t.icon_svg;if(!e)return!1;let n=bn.get(e);return n===void 0&&(n=ce(e)!==null,bn.size>=256&&bn.clear(),bn.set(e,n)),n}function po(t,e,n){return!e&&!n?!1:t.every(i=>!i.is_tappable||n&&$a(i)||e&&md(i))}var Ga=new WeakMap;function pd(t,e,n){let i=e.length,o=ut(),r=Ga.get(t),a=n&&r&&Pi(r.options,e)?r.plan:null,s=!a&&!n&&vi(i,o)?ct(t):null,l=a??Ei(i,o,s?.rowWidths??null,s?.gridWidth??null);return n||Ga.set(t,{options:e,plan:l}),t.style.gridTemplateColumns=l.template,t.style.setProperty("--aia-grid-max-height",l.maxHeight),t.querySelectorAll("[data-aia-option]").forEach((d,c)=>{d.classList.toggle("magicx-aia-option--scroll-hint",!n&&l.scrollHintIndices.includes(c))}),l.cols}function qa(t,e){if(e.loading||!e.interactive)return null;let n=e.options[be(t)];return n?.is_tappable?n:null}var gd={itemSelector:"[data-aia-option]",onClick:(t,e,n)=>{let i=qa(t,e);if(!i)return;t.classList.add("magicx-aia-option--pressed");let o=t.querySelector(".magicx-aia-checkbox"),r=o!==null&&!mo(t,o,n);if(o){let a=r||t.getAttribute("aria-selected")!=="true";t.setAttribute("aria-selected",String(a)),o.dataset.checked=String(a),o.textContent=a?"\u2713":""}r?e.onSelect(i,{commit:!0}):e.onSelect(i),setTimeout(()=>t.classList.remove("magicx-aia-option--pressed"),170)},onEnter:(t,e)=>{qa(t,e)&&e.onHighlight(be(t))},onLeave:(t,e)=>e.onHighlight(-1,be(t))};function Ka(t,e,n,i,o,r,a,s="",l="below",d=!0,c=!0,u=!0,g=!0,m){let p=t.querySelector(".aia-grid");if(e.length===0){p?.remove();return}p||(p=document.createElement("div"),p.className="aia-grid magicx-aia-grid",p.setAttribute("data-scroll",""),p.style.setProperty("--aia-grid-min","250px"),p.style.setProperty("--aia-grid-max","1fr"),p.style.setProperty("--aia-grid-gap","0"),t.appendChild(p)),$(p,gd,{options:e,onSelect:i,onHighlight:o,loading:a,interactive:g});let f=p.dataset.aiaGroup!==s;p.dataset.aiaGroup=s;let h=po(e,d,c);fd(p,e,n,r,a,{showIcons:d&&h,showImages:c&&h,showCounts:u,picked:m});let v=pd(p,e,a);hd(p,e.length,v,a,l),f&&(p.scrollTop=0)}function fd(t,e,n,i,o,r){let a=o?"1":"0",s=t.dataset.aiaGroup??"",{showIcons:l,showImages:d,showCounts:c}=r,u=l?p=>p.icon??p.icon_svg??"":()=>"",g=d?p=>`${we(p.image_url)??""}${(p.imageCollage??[]).join("")}`:()=>"",m=c?p=>bt(p.item_count)??"":()=>"";ne(t,e,{keyOf:p=>`${p.text}\0${p.parameter??""}\0${p.parameterLabel??""}\0${u(p)}\0${g(p)}\0${m(p)}\0${a}\0${s}`,create:(p,f)=>{let h=bd(p,o,r);return o||(h.dataset.aiaEntering=""),h},update:(p,f,h)=>{if(go.get(p)!==(f.matchedText??"")){let S=p.querySelector(".magicx-aia-option-text");S&&za(S,f),go.set(p,f.matchedText??"")}let v=h===n&&!o;p.id=`${i}-option-${h}`,p.dataset.aiaIndex=String(h),p.setAttribute("aria-selected",String(r.picked?r.picked.includes(f.text):v));let y=p.querySelector(".magicx-aia-checkbox");r.picked&&f.is_tappable?(y||(y=document.createElement("span"),y.className="magicx-aia-checkbox",y.setAttribute("aria-hidden","true"),p.querySelector(".magicx-aia-option-content")?.prepend(y)),y.dataset.checked=String(r.picked.includes(f.text)),y.textContent=r.picked.includes(f.text)?"\u2713":""):y?.remove(),p.classList.toggle("magicx-aia-option--highlighted",v),p.classList.toggle("magicx-aia-option--live-match",!!f.liveMatch&&!o)}})}function hd(t,e,n,i,o){for(let r of t.querySelectorAll("[data-aia-entering]")){if(!i){let a=Number.parseInt(r.dataset.aiaIndex??"-1",10);a>=0&&r.style.setProperty(Wi,`${Bi(a,n,e,o)}ms`)}delete r.dataset.aiaEntering}}var go=new WeakMap;function za(t,e){if(t.replaceChildren(),e.matchedText)for(let n of Ai(hn(e),e.matchedText))if(n.bold){let i=document.createElement("strong");i.className="magicx-aia-option-match",i.textContent=n.text,t.appendChild(i)}else t.appendChild(document.createTextNode(n.text));else t.appendChild(document.createTextNode(hn(e)));if(e.parameterLabel){t.appendChild(document.createTextNode(" "));let n=document.createElement("span");n.className="magicx-aia-option-parameter",n.textContent=e.parameterLabel,t.appendChild(n)}}function bd(t,e,{showIcons:n,showImages:i,showCounts:o}){let r=document.createElement("div");r.setAttribute("role","option"),r.setAttribute("data-aia-option",""),e&&r.setAttribute("data-aia-loading",""),r.tabIndex=e||!t.is_tappable?-1:0;let a=["magicx-aia-option"];t.is_tappable?a.push("magicx-aia-option--tappable"):a.push("magicx-aia-option--non-tappable"),r.className=a.join(" ");let s=document.createElement("span");s.className="magicx-aia-option-content";let l=i?ht(t.image_url):[],d=l[0];if(d){let m=document.createElement("span");m.className="magicx-aia-option-image",m.setAttribute("aria-hidden","true");let p=(t.imageCollage??[]).map(f=>ht(f)).filter(f=>f.length>0);p.length>1&&m.setAttribute("data-aia-collage",String(p.length));for(let f of p.length>1?p:[l]){let h=document.createElement("img");h.setAttribute("alt",""),h.setAttribute("loading","lazy"),h.setAttribute("decoding","async"),h.setAttribute("referrerpolicy","no-referrer"),h.setAttribute("draggable","false");let v=0;h.onload=()=>m.setAttribute("data-aia-image-loaded",""),h.onerror=()=>{let y=f[++v];y?h.src=y:h.hidden=!0},h.src=f[0],m.appendChild(h)}s.appendChild(m),r.dataset.aiaImage=""}let c=!d&&n&&t.icon_svg?ce(t.icon_svg):null;if(c){let m=document.createElement("span");m.className="magicx-aia-option-icon",m.setAttribute("aria-hidden","true"),m.innerHTML=c,s.appendChild(m),t.icon&&(r.dataset.aiaIcon=t.icon)}let u=document.createElement("span");if(u.className="magicx-aia-option-text",za(u,t),go.set(r,t.matchedText??""),s.appendChild(u),t.tag){let m=document.createElement("span");m.className="magicx-aia-option-tag",m.textContent=t.tag,s.appendChild(m)}let g=o?bt(t.item_count):null;if(g!==null){let m=document.createElement("span");m.className="magicx-aia-option-count",m.textContent=g,s.appendChild(m),r.dataset.aiaItemCount=String(t.item_count)}return r.appendChild(s),r}var Sd=120,yd={itemSelector:"[data-aia-time-row], [data-aia-time-done]",onClick:(t,e)=>{if(!e.interactive)return;if(t.hasAttribute("data-aia-time-done")){e.callbacks.onTimeCommit();return}let n=t.dataset.aiaTimeColumn;n&&e.callbacks.onTimeChange(jt(n,e.view.minutes,Number(t.dataset.aiaIndex)))}},Ya=new WeakMap,ja=new WeakMap;function Qa(t,e,n,i,o=!0){let r=t.querySelector(".magicx-aia-time-wheel");if(!e){r?.remove();return}if(!r){r=vd(),t.appendChild(r),z(r);let d=r.querySelector("[data-aia-time-done]");d&&(d.disabled=!1)}let a={view:e,callbacks:i,interactive:o};Ya.set(r,a),$(r,yd,a),r.setAttribute("aria-label",n.timeLabel);let s=r.querySelector("[data-aia-time-done]");s&&(s.textContent=n.done);let l=r.querySelector("[data-aia-time-value]");l&&(l.textContent=Gt(e.minutes));for(let d of Kt){let c=r.querySelector(`[data-aia-time-column="${d}"]`);c&&Td(c,d,e.minutes)}}function Td(t,e,n){let i=zt(e,n);for(let a of t.querySelectorAll("[data-aia-time-row]")){let s=Number(a.dataset.aiaIndex)===i;a.classList.toggle("magicx-aia-time-wheel-row--selected",s),a.setAttribute("aria-selected",String(s))}let o=Sn(t);if(o.settle)return;let r=i*qt;Math.abs(t.scrollTop-r)<1||(o.syncedTop=r,t.scrollTop=r)}function Sn(t){let e=ja.get(t);return e||(e={syncedTop:null,settle:null},ja.set(t,e)),e}function xd(t,e,n){let i=Sn(e);if(i.syncedTop!=null&&Math.abs(e.scrollTop-i.syncedTop)<1){i.syncedTop=null;return}i.syncedTop=null,i.settle&&clearTimeout(i.settle),i.settle=setTimeout(()=>Xa(t,e,n),Sd)}function Xa(t,e,n){let i=Sn(e);i.settle&&clearTimeout(i.settle),i.settle=null;let o=Ya.get(t);if(!o||!o.interactive)return;let r=ui(n,e.scrollTop);r!==zt(n,o.view.minutes)&&o.callbacks.onTimeChange(jt(n,o.view.minutes,r))}function vd(){let t=document.createElement("div");t.className="magicx-aia-time-wheel",t.setAttribute("data-aia-time-wheel",""),t.setAttribute("role","group");let e=document.createElement("span");e.className="magicx-aia-time-wheel-value",e.setAttribute("data-aia-time-value",""),e.setAttribute("aria-live","polite");let n=document.createElement("div");n.className="magicx-aia-time-wheel-columns",n.setAttribute("aria-hidden","true");let i=document.createElement("div");i.className="magicx-aia-time-wheel-band",n.appendChild(i);for(let r of Kt){if(r==="minute"){let a=document.createElement("span");a.className="magicx-aia-time-wheel-separator",a.textContent=":",n.appendChild(a)}n.appendChild(Ed(t,r))}let o=document.createElement("button");return o.type="button",o.tabIndex=-1,o.className="magicx-aia-time-wheel-done",o.setAttribute("data-aia-time-done",""),o.disabled=!0,t.append(e,n,o),t}function Ed(t,e){let n=document.createElement("div");return n.className="magicx-aia-time-wheel-column",n.setAttribute("data-aia-time-column",e),di(e).forEach((i,o)=>{let r=document.createElement("div");r.className="magicx-aia-time-wheel-row",r.setAttribute("data-aia-time-row",""),r.dataset.aiaTimeColumn=e,r.dataset.aiaIndex=String(o),r.textContent=i.label,n.appendChild(r)}),n.addEventListener("scroll",()=>xd(t,n,e),{passive:!0}),n.addEventListener("scrollend",()=>{Sn(n).settle&&Xa(t,n,e)}),n}var Ve="data-aia-fit",yn="--aia-dropdown-fit-height",Ja=8,Pd=160;function fo({dropdown:t,isOpen:e}){let n=t.ownerDocument?.defaultView??null,i=!1,o=!1,r=null,a=null,s=null,l=null,d=!1,c=()=>{t.removeAttribute(Ve),t.style.removeProperty(yn)},u=()=>{if(Se(t)){d=!0;return}d=!1,Xi(t,t.getBoundingClientRect().height)},g=y=>`${r}|${(y??t).scrollHeight}|${t.offsetWidth}`,m=y=>s?.key===g(y)?s.height:null,p=y=>{let S=g(y);if(s?.key===S)return s.height;let b=y?.scrollTop??0;t.removeAttribute(Ve);let x=t.offsetHeight;return t.setAttribute(Ve,""),y&&b&&(y.scrollTop=b),s={key:S,height:x},x},f=()=>{if(i)return;if(!e()){o=!1;return}let y=Se(t),S=y?Qi(t):null;y&&l!==y&&(l=y,y.finished.then(h,h)),!y&&d&&u(),o||(o=!0,c());let b=t.hasAttribute(Ve),x=G(t,".aia-grid")?.getAttribute("data-aia-group")??null,E=x!==r;r=x;let P=Ld(t,n);if(P===null)return;let T=wd(t);if(b){let F=y?m(T):p(T);if(F!==null&&F<=P){c(),u();return}}else if((S??t.offsetHeight)<=P)return;let L=`${Math.max(Pd,Math.floor(P))}px`,A=t.style.getPropertyValue(yn)!==L;A&&t.style.setProperty(yn,L),b?E&&T&&(T.scrollTop=0):t.setAttribute(Ve,""),(A||!b)&&u()},h=()=>{i||a!==null||!n||(a=n.requestAnimationFrame(()=>{a=null,f()}))},v=n?.visualViewport??null;return v?.addEventListener("resize",h),v?.addEventListener("scroll",h),n?.addEventListener("resize",h),n?.addEventListener("scroll",h,{capture:!0,passive:!0}),f(),{update:f,destroy(){i||(i=!0,a!==null&&n?.cancelAnimationFrame(a),v?.removeEventListener("resize",h),v?.removeEventListener("scroll",h),n?.removeEventListener("resize",h),n?.removeEventListener("scroll",h,{capture:!0}))}}}function wd(t){for(let e of Array.from(t.children))if(e.classList.contains("aia-stack"))return e;return null}function Ld(t,e){if(!e)return null;let n=e.visualViewport,i=n?n.offsetTop:0,o=n?n.height:e.innerHeight;if(!o)return null;let r=t.offsetParent,a=r?r.getBoundingClientRect().top:0,s=r?a+t.offsetTop:t.getBoundingClientRect().top;return t.closest("[data-options-position]")?.getAttribute("data-options-position")==="above"?(r?s+t.offsetHeight:t.getBoundingClientRect().bottom)-i-Ja:i+o-s-Ja}var Cd=[159,119,164];function vn(t){let e=document.createElement("div");return e.id=t,e.setAttribute("role","listbox"),e.setAttribute("data-aia-dropdown",""),e.className="magicx-aia-dropdown",e.addEventListener("mousedown",n=>n.preventDefault()),Hi(e),e}var Tn=new WeakMap;function Ad(t,e,n){let i=Tn.get(t);if(i||(i={button:ca(t.ownerDocument,n),grid:null,controller:null},t.appendChild(i.button),Tn.set(t,i)),i.button.getAttribute("aria-label")!==n.scrollArrow&&i.button.setAttribute("aria-label",n.scrollArrow),i.grid!==e&&(i.controller?.destroy(),i.controller=null,i.grid=e,e)){i.controller=Gi({dropdown:t,grid:e,button:i.button});return}i.controller?.update()}var xn=new WeakMap;function Za(t){let e=xn.get(t);if(e){e.update();return}xn.set(t,fo({dropdown:t,isOpen:()=>t.classList.contains("magicx-aia-dropdown--visible")}))}function ho(t){xn.get(t)?.destroy(),xn.delete(t),Ji(t);let e=Tn.get(t);e&&(e.controller?.destroy(),Tn.delete(t))}function En(t,e){let n=e.strings??k(),{filteredOptions:i,activeIndex:o,isOpen:r,isLoading:a,showPills:s,isActivePillSelected:l,onSelect:d,onHighlight:c,onPillClick:u,onSkip:g}=e,m=Fn(e.pills,n.keepTyping),p=Bn(m),f=s&&m.length>0,h=i.length>0,v=e.products.length>0,y=e.formatType==="time"&&e.timeView!=null,S=e.formatType==="location"&&e.locationView!=null,b=r&&(h||f||a||v||y||S);if(b?t.classList.add("magicx-aia-dropdown--visible"):t.classList.remove("magicx-aia-dropdown--visible"),a?t.setAttribute("data-aia-loading",""):t.removeAttribute("data-aia-loading"),!b){uo(t,!1),Aa(t),Za(t),mn(t,null,{visible:!1});return}v?t.setAttribute("data-aia-has-products",""):t.removeAttribute("data-aia-has-products"),t.toggleAttribute(eo,e.fullWidth===!0),ft(t),t.toggleAttribute("data-aia-skeleton-exiting",!!e.skeletonExiting);let x=t.querySelector(".aia-stack");x||(x=document.createElement("div"),x.className="aia-stack",x.style.setProperty("--aia-stack-space","8px"),t.appendChild(x));let E=e.showSkipButton&&p&&!e.isInputEmpty,P=f||a&&s||E,T=x.querySelector(".magicx-aia-pill-bar");if(P){T||(T=document.createElement("div"),T.className="magicx-aia-pill-bar aia-cluster",T.setAttribute("data-nowrap",""),T.setAttribute("data-aia-pillbar",""),x.insertBefore(T,x.firstChild));let ie=f||a&&s,D=T.querySelector(".magicx-aia-pill-scroll");ie?(D||(D=document.createElement("span"),D.className="magicx-aia-pill-scroll",D.setAttribute("data-aia-pill-scroll",""),T.insertBefore(D,T.firstChild)),pn(D,m,0,u,!0,a,l)):D&&D.remove(),Md(T,E,a||e.skipDisabled,m[0],g,n)}else T&&T.remove();let L=e.suggestions[0],A=L?`${L.parameter} ${L.text}`:"",F=_(e.formatType),R=F&&!a;Ka(x,F?[]:i,o,d,c,e.listboxId,a,A,e.optionsPosition??"below",e.showOptionIcons??!0,e.showOptionImages??!0,e.showOptionCounts??!0,!e.skipDisabled,e.multiSelectView?.picked),t.setAttribute("aria-multiselectable",String(!!e.multiSelectView)),Nd(x,!!e.multiSelectView,e.skipDisabled||a,e.onMultiSelectCommit,n.done),Ad(t,x.querySelector(".aia-grid"),n),Pa(x,R?i:[],o,e.listboxId,R?e.dateView:null,{selectedIso:e.selectedDateIso,selectedRange:e.selectedDateRange,rangeStart:e.dateRangeStart,floor:Ri(e.formatType,e.dateRangeStart),references:e.dateReferences??[]},{onSelect:d,onHighlight:c,onPreviousMonth:e.onPreviousMonth,onNextMonth:e.onNextMonth},!e.skipDisabled),Qa(x,e.formatType==="time"&&!a?e.timeView:null,n,{onTimeChange:e.onTimeChange,onTimeCommit:e.onTimeCommit},!e.skipDisabled),Ia(x,e.formatType==="location"&&!a?e.locationView:null,n,{onLocationQuery:e.onLocationQuery,onLocationMove:e.onLocationMove,onLocationCommit:e.onLocationCommit,onLocationFocusChange:e.onLocationFocusChange},{interactive:!e.skipDisabled,inputFocused:e.isFocused??!1,reediting:e.isReediting??!1});let q=x.querySelector(".magicx-aia-skeleton-bars");if(a&&(!h||H(e.formatType))){if(!q){q=document.createElement("div"),q.className="magicx-aia-skeleton-bars",q.setAttribute("data-aia-skeleton-bars","");for(let ie of Cd){let D=document.createElement("span");D.className="magicx-aia-skeleton-bar",D.style.width=`${ie}px`,q.appendChild(D)}x.appendChild(q)}}else q&&q.remove();Fa(x,e.products,e.listboxId,e.onProductSelect,e.onProductFocusChange,e.productsLayout??"row",e.productImageFallback??"image",n,e.onProductAddToCart),uo(t,!a),Dd(x,e.onSeeAllResults,n.seeAllResults);let I=x.querySelector(".magicx-aia-footer")??Rd(n),Q=o>=0&&!!i[o]?.is_tappable;kd(I,Di(Q,e.isInputEmpty,n)),I.isConnected||x.appendChild(I),Id(x,[".magicx-aia-pill-bar",".aia-grid","[data-aia-multi-actions]",".magicx-aia-datepicker",".magicx-aia-time-wheel","[data-aia-location]",".magicx-aia-skeleton-bars",".magicx-aia-products","[data-aia-see-all]",".magicx-aia-footer"]),Fi(x,x.querySelector(".magicx-aia-multi-done")),to(t,x,{eligible:h&&!v&&!F&&!y&&!S&&!e.onSeeAllResults&&!e.fullWidth,loading:a}),Za(t),mn(t,Yi(s?m:[]),{visible:!0,anchorBottom:e.optionsPosition==="above"})}function Id(t,e){let n=e.map(i=>t.querySelector(`:scope > ${i}`)).filter(i=>i!==null);for(let i=0;i<n.length;i++)t.children[i]!==n[i]&&t.insertBefore(n[i],t.children[i]??null)}var Od={itemSelector:".magicx-aia-skip",onClick:(t,e)=>{e.loading||e.onSkip()}};function Md(t,e,n,i,o,r){$(t,Od,{onSkip:o,loading:n});let a=t.querySelector(".magicx-aia-skip");if(!e){a?.remove();return}a||(a=document.createElement("button"),a.type="button",a.tabIndex=-1,a.className="magicx-aia-skip",a.setAttribute("data-aia-skip",""),a.textContent=r.skip,a.disabled=!0,t.appendChild(a),z(a)),a.textContent!==r.skip&&(a.textContent=r.skip),a.setAttribute("aria-label",i?`${r.skipLabel} ${i.text}`:r.skipLabel),a.disabled=n}function kd(t,{key:e,hint:n}){let i=t.querySelector(".magicx-aia-footer-key"),o=t.querySelector(".magicx-aia-footer-hint");!i||!o||(i.textContent!==e&&(i.textContent=e),o.textContent!==n&&(o.textContent=n))}function Rd(t){let e=document.createElement("footer");e.className="magicx-aia-footer",e.setAttribute("data-aia-footer","");let n=document.createElement("div");n.className="aia-cluster magicx-aia-footer-row",n.setAttribute("data-align","center"),n.setAttribute("data-justify","between"),n.setAttribute("data-nowrap","");let i=document.createElement("div");i.className="aia-cluster magicx-aia-footer-hint-group",i.setAttribute("data-align","center"),i.style.setProperty("--aia-cluster-gap","5px");let o=document.createElement("kbd");o.className="magicx-aia-footer-key",o.textContent="tab";let r=document.createElement("span");r.className="magicx-aia-footer-hint",r.textContent=t.select,i.append(o,r);let a=document.createElement("a");a.className="aia-cluster magicx-aia-footer-brand-link",a.setAttribute("data-align","center"),a.href=_i(),a.target="_blank",a.rel="noopener noreferrer",a.style.setProperty("--aia-cluster-gap","2px");let s=document.createElement("span");s.className="magicx-aia-footer-brand",s.textContent="AI";let l=document.createElement("span");return l.className="magicx-aia-footer-badge",l.textContent="Autocomplete",a.append(s,l),n.append(i,a),e.append(n),e}var _d={itemSelector:".magicx-aia-see-all",onClick:(t,e,n)=>{e.submit&&(n.stopPropagation(),e.submit())}};function Dd(t,e,n){let i=t.querySelector(":scope > [data-aia-see-all]");if(!e){i?.remove();return}if(!i){i=document.createElement("div"),i.className="magicx-aia-see-all-row",i.dataset.aiaSeeAll="";let r=document.createElement("button");r.type="button",r.tabIndex=-1,r.className="magicx-aia-see-all",r.disabled=!0,i.appendChild(r),t.appendChild(i),z(r)}$(i,_d,{submit:e});let o=i.querySelector("button");o&&(o.textContent!==n&&(o.textContent=n),o.disabled=!1)}var Hd={itemSelector:".magicx-aia-multi-done",onClick:(t,e)=>{e.disabled||e.commit?.()}};function Nd(t,e,n,i,o){let r=t.querySelector("[data-aia-multi-actions]");if(!e){r?.remove();return}if(!r){r=document.createElement("div"),r.dataset.aiaMultiActions="";let s=document.createElement("button");s.type="button",s.tabIndex=-1,s.className="magicx-aia-multi-done",s.setAttribute("data-aia-multi-done",""),s.disabled=!0,r.appendChild(s),t.appendChild(r),z(s)}$(r,Hd,{commit:i,disabled:n});let a=r.querySelector("button");a&&(a.textContent=o,a.disabled=n)}function es(t,e){let n=vn(e.listboxId);return t.appendChild(n),{dropdown:n}}function bo(t,e,n){let i=gt(e);En(t.dropdown,{strings:n.strings,suggestions:e.editingIdentified?[{parameter:e.editingIdentified.parameter,text:ae(e.editingIdentified.parameter),required:!0,options:e.filteredOptions}]:e.dropdownSuggestion??e.actionableSuggestions[0]?[{...e.dropdownSuggestion??e.actionableSuggestions[0],options:e.dropdownOptions}]:[],filteredOptions:e.dropdownOptions,activeIndex:e.activeDropdownIndex,isOpen:e.isDropdownOpen,isLoading:e.dropdownLoading,skeletonExiting:e.skeletonExiting,listboxId:n.listboxId,pills:e.actionableSuggestions,showPills:!0,showSkipButton:n.showSkipButton&&!e.editingParam&&!e.editingIdentified,skipDisabled:e.inSelectionAnimation,showOptionIcons:n.showOptionIcons??!0,showOptionImages:n.showOptionImages??!0,showOptionCounts:n.showOptionCounts??!0,isActivePillSelected:e.isActivePillSelected,isInputEmpty:e.text.trim().length===0,products:e.products,productsLayout:n.productsLayout??"row",productImageFallback:n.productImageFallback??"image",onProductAddToCart:n.addProductToCart,formatType:e.activeFormatType,dateView:e.dateView,selectedDateIso:i.selectedIso,selectedDateRange:i.selectedRange,dateRangeStart:i.rangeStart,dateReferences:i.references,timeView:e.timeView,multiSelectView:e.dropdownMultiSelect,locationView:e.locationView,isReediting:e.editingParam!=null,isFocused:e.isFocused||e.locationFieldFocused,optionsPosition:n.optionsPosition??"below",onSelect:n.selectOption,onHighlight:(o,r)=>{r!==void 0&&n.store.get().activeDropdownIndex!==r||n.store.set({activeDropdownIndex:o})},onPillClick:n.setActivePill,onSkip:n.skipActivePill,onPreviousMonth:n.showPreviousMonth,onNextMonth:n.showNextMonth,onTimeChange:n.setTime,onTimeCommit:n.commitTime,onMultiSelectCommit:n.commitMultiSelect,onLocationQuery:n.setLocationQuery,onLocationMove:n.moveLocationHighlight,onLocationCommit:n.commitLocation,onLocationFocusChange:n.setLocationFieldFocused,onProductSelect:n.selectProduct,onProductFocusChange:o=>n.store.set({isFocused:o})})}var Fd="[data-aia-chip-remove]";function So(t,e){let n=e;if(!n||n.nodeType===void 0)return null;let o=(n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest(Fd)??null;return o&&t.contains(o)?o:null}function yo(t,e){let n=null,i=d=>{n=null;let c=d;if(c.button)return;let u=So(t,d.target);if(!u)return;d.preventDefault(),d.stopPropagation();let g=u.dataset.aiaChipRemove,m=c.pointerType==="touch"||c.pointerType==="pen";n={id:g,x:c.clientX,y:c.clientY,pending:m},!m&&g&&e(g)},o=d=>{if(!n?.pending)return;n.pending=!1;let c=d;if(Math.hypot(c.clientX-n.x,c.clientY-n.y)>10)return;let g=t.getRootNode().elementFromPoint?.(c.clientX,c.clientY)??d.target,m=So(t,g)?.dataset.aiaChipRemove;m&&m===n.id&&e(m)},r=()=>{n&&(n.pending=!1)},a=d=>{!n&&!So(t,d.target)||(d.cancelable&&d.preventDefault(),d.type==="click"&&(d.stopImmediatePropagation(),n=null))},s={capture:!0},l={capture:!0,passive:!1};return t.addEventListener("pointerdown",i,s),t.addEventListener("pointerup",o,s),t.addEventListener("pointercancel",r,s),t.addEventListener("touchstart",a,l),t.addEventListener("mousedown",a,s),t.addEventListener("click",a,s),()=>{t.removeEventListener("pointerdown",i,s),t.removeEventListener("pointerup",o,s),t.removeEventListener("pointercancel",r,s),t.removeEventListener("touchstart",a,l),t.removeEventListener("mousedown",a,s),t.removeEventListener("click",a,s)}}var Wd=340;function To(t){let e=t.ownerDocument.defaultView;if(!e||typeof e.MutationObserver!="function")return()=>{};let n=()=>{if(!t.isConnected)return;let c=t.style.height?t.getBoundingClientRect().height:0;t.style.height="";let u=t.getBoundingClientRect().height;if(u!==0){if(c===0||Math.abs(u-c)<.5){t.style.height=`${u}px`;return}t.style.height=`${c}px`,t.getBoundingClientRect(),t.style.height=`${u}px`}},i=-1,o=typeof e.ResizeObserver=="function"?new e.ResizeObserver(c=>{for(let g of c)if(g.target!==t){n();return}let u=t.getBoundingClientRect().width;Math.abs(u-i)<.5||(i=u,n())}):null,r=()=>{for(let c of Array.from(t.children))o?.observe(c)},a=0,s=()=>{r(),n(),e.clearTimeout(a),a=e.setTimeout(n,340)},l=new e.MutationObserver(s);l.observe(t,{childList:!0,characterData:!0,subtree:!0,attributes:!0,attributeFilter:["data-placeholder","data-aia-empty"]}),o?.observe(t),r(),t.addEventListener("load",s,!0);let d=!1;return t.ownerDocument.fonts?.ready.then(()=>{d||n()}),n(),()=>{d=!0,t.removeEventListener("load",s,!0),l.disconnect(),o?.disconnect(),e.clearTimeout(a),t.style.height=""}}var os=2600,Bd=3,Po="data-aia-hint",Eo="magicx-aia-hint",rs="data-aia-hint-el",Vd={position:"absolute",pointerEvents:"none",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--aia-hint-color, #999)",userSelect:"none"},Ud=280,$d=320,Gd=380,xo="cubic-bezier(0.25, 0.1, 0.25, 1)",ts=new Set(["a","an","the","some","my"]),Ln=new WeakMap;function qd(t){return t.closest('[data-animations="off"]')?!0:!!t.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function ns(t,e){let n=t.text.trim(),i=e.trim(),o=[];i&&n.toLowerCase().startsWith(`${i.toLowerCase()} `)&&(n=n.slice(i.length+1).trim());let r=i?i.split(/\s+/):[],a=null;r.length>1&&ts.has(r[r.length-1].toLowerCase())&&(a=r.pop()??null);let s=r.join(" ");s&&o.push({key:`w:${s.toLowerCase()}`,text:s,icon:null});let l=null,[d,...c]=n.split(/\s+/);c.length&&d&&ts.has(d.toLowerCase())&&(l=d,n=c.join(" "));let u=l??a;u&&o.push({key:`w:${u.toLowerCase()}`,text:u,icon:null});let g=t.icon_svg?ce(t.icon_svg):null;return o.push({key:`c:${g??""}:${n}`,text:n,icon:g}),o}function Kd(t,e){let n=t.createElement("span");if(n.className=`${Eo}__word`,n.dataset.key=e.key,n.style.display="inline-block",e.icon){let i=t.createElement("span");i.className=`${Eo}__icon`,Object.assign(i.style,{display:"inline-flex",width:"1em",height:"1em",marginRight:"0.25em",verticalAlign:"-0.125em",opacity:"var(--aia-hint-icon-opacity, 0.7)"}),i.innerHTML=e.icon;let o=i.querySelector("svg");o&&(o.style.width="100%",o.style.height="100%"),n.appendChild(i)}return n.appendChild(t.createTextNode(e.text)),n}function vo(t,e,n){return typeof t.animate=="function"?t.animate(e,n):null}function Pn(t,e){let n=t.ownerDocument?.defaultView;if(!n)return;let i=n.getComputedStyle(t),o=c=>Number.parseFloat(c)||0,r=t.offsetLeft+o(i.borderLeftWidth)+o(i.paddingLeft),a=t.offsetTop+o(i.borderTopWidth)+o(i.paddingTop),s=t.clientWidth-o(i.paddingLeft)-o(i.paddingRight),l=t.offsetParent instanceof HTMLElement?t.offsetParent.clientWidth-r:0,d=Math.max(s,l);e.style.left=`${r}px`,e.style.top=`${a}px`,d>0&&(e.style.maxWidth=`${d}px`),e.style.font=i.font,e.style.lineHeight=i.lineHeight,e.style.letterSpacing=i.letterSpacing,e.style.fontWeight="var(--aia-hint-font-weight, 300)"}function is(t,e,n,i){let{el:o}=t,r=o.ownerDocument,a=new Map;for(let m of Array.from(o.children))m.dataset.leaving===void 0&&m.dataset.key&&a.set(m.dataset.key,m);let s=new Map;for(let[m,p]of a)s.set(m,p.offsetLeft);let l=new Set(e.map(m=>m.key));for(let[m,p]of a){if(l.has(m))continue;if(!n){p.remove();continue}p.dataset.leaving="",p.style.position="absolute",p.style.left=`${s.get(m)??0}px`,p.style.top=`${p.offsetTop}px`;let f=vo(p,[{opacity:1,filter:"blur(0)"},{opacity:0,filter:"blur(2px)"}],{duration:Ud,easing:xo,fill:"forwards"});f?f.onfinish=()=>p.remove():p.remove()}let d=Array.from(o.children).filter(m=>m.dataset.leaving!==void 0),c=[];if(e.forEach((m,p)=>{p>0&&c.push(r.createTextNode(" ")),c.push(a.get(m.key)??Kd(r,m))}),o.replaceChildren(...c,...d),!n)return;let u=new Map;for(let m of c)m instanceof HTMLElement&&m.dataset.key&&u.set(m.dataset.key,m);let g=0;for(let m of e){let p=u.get(m.key);if(p)if(!a.has(m.key))vo(p,[{opacity:0,filter:"blur(2px)"},{opacity:1,filter:"blur(0)"}],{duration:$d,delay:i?80*g++:180+60*g++,easing:xo,fill:"backwards"});else{let h=(s.get(m.key)??p.offsetLeft)-p.offsetLeft;Math.abs(h)>.5&&vo(p,[{transform:`translateX(${h}px)`},{transform:"none"}],{duration:Gd,easing:xo})}}}function wn(t){let e=Ln.get(t);e&&(e.timer!==null&&clearInterval(e.timer),e.resize?.disconnect(),e.el.remove(),Ln.delete(t),t.removeAttribute(Po),t.removeAttribute("aria-placeholder"))}function as(t,e,n,i){let o=i.filter(p=>p.text.trim()!=="").slice(0,Bd),r=t.parentElement;if(!e||o.length<2||!r){wn(t);return}let a=`${n}\0${o.map(p=>`${p.text}${p.icon_svg??""}`).join("\0")}`,s=Ln.get(t);if(s&&s.key===a&&s.el.isConnected){Pn(t,s.el);return}wn(t);let l=t.ownerDocument,d=l.createElement("span");d.className=Eo,d.setAttribute(rs,""),d.setAttribute("aria-hidden","true"),Object.assign(d.style,Vd),r.insertBefore(d,t),t.setAttribute(Po,""),n.trim()&&t.setAttribute("aria-placeholder",n.trim()),Pn(t,d);let c=l.defaultView,u=c?.ResizeObserver?new c.ResizeObserver(()=>{d.isConnected&&Pn(t,d)}):null;u?.observe(r);let g=qd(t),m={key:a,lead:n,options:o,index:0,el:d,timer:null,resize:u};Ln.set(t,m),is(m,ns(o[0],n),!g,!0),!g&&(m.timer=setInterval(()=>{if(!t.isConnected||!d.isConnected){wn(t);return}t.ownerDocument?.hidden||(m.index=(m.index+1)%m.options.length,Pn(t,d),is(m,ns(m.options[m.index],m.lead),!0,!1))},os))}function wo(t){wn(t)}function Lo(t){return(t.find(n=>n.type?.kind!=="traditional_autocomplete")?.options??[]).filter(n=>n.is_tappable!==!1).map(n=>({text:n.text,icon_svg:n.icon_svg}))}var zd=6,jd=.3;function ss(t){return t<=0?"0px":`${(-Math.min(jd,2*zd/t)).toFixed(3)}px`}var ls=new Map;function Yd(t,e,n){let i=ls.get(e);if(i!==void 0){t.style.setProperty("--aia-chip-image-fit",i),t.setAttribute("data-aia-image-loaded","");return}let o=n.createElement("img");o.setAttribute("referrerpolicy","no-referrer"),o.onload=()=>{if(!t.isConnected)return;t.setAttribute("data-aia-image-loaded","");let r=t.getBoundingClientRect().height,a=Number.parseFloat(getComputedStyle(t).fontSize);if(!(r>0&&a>0&&o.naturalWidth>0&&o.naturalHeight>0))return;let s=`${(r/a*(o.naturalWidth/o.naturalHeight)).toFixed(3)}em`;ls.set(e,s),t.style.setProperty("--aia-chip-image-fit",s)},o.src=e}function Co(t){let{input:e,segments:n,newParamId:i,editingParamId:o,placeholderText:r}=t,a=t.showChipIcons??!0,s=t.showChipImages??!0,l=t.showChipRemove??!1,d=n.length===0;e.dataset.aiaEmpty=d?"true":"false",Xr(e,d?r:""),as(e,d,r,t.hintOptions??[]);let c=n.map(S=>S.type==="completed"?`${S.type}:${S.value}${a?S.param.icon??S.param.icon_svg??"":""}${s?we(S.param.image_url)??"":""}${l?"x":""}`:S.type==="identified"?`${S.type}:${S.value}${S.param.id}${l?"x":""}`:`${S.type}:${S.value}`).join("\0"),u=e.dataset.segKey??"",g=e.dataset.newParamId??"",m=e.dataset.editingParamId??"";if(c===u&&(i??"")===g&&(o??"")===m)return;if(c===u){e.dataset.newParamId=i??"",e.dataset.editingParamId=o??"";for(let S of e.querySelectorAll("strong[data-param-id]")){let b=S.dataset.paramId,x=S.dataset.seg==="completed"&&b===i;S.classList.toggle("magicx-aia-shimmer-revealed",x),S.classList.toggle("magicx-aia-shimmer-sweep",x),S.classList.toggle("magicx-aia-segment--editing",b===o)}return}let p=Pr(e),f=p?Y(e):null;e.dataset.segKey=c,e.dataset.newParamId=i??"",e.dataset.editingParamId=o??"";let h=N(e),v=h.createDocumentFragment(),y=0;for(let S of n)if(y+=S.value.length,S.type==="completed"){let b=h.createElement("strong");b.dataset.seg="completed",b.dataset.paramId=S.param.id;let x=S.param.id===i,E=S.param.id===o,P=["magicx-aia-segment","magicx-aia-segment--completed"];x&&P.push("magicx-aia-shimmer-revealed","magicx-aia-shimmer-sweep"),E&&P.push("magicx-aia-segment--editing"),b.className=P.join(" "),b.style.letterSpacing=ss(S.value.length);let T=s?we(S.param.image_url):null;if(T){let A=h.createElement("span");A.className="magicx-aia-segment-image",A.setAttribute("contenteditable","false"),A.setAttribute("aria-hidden","true"),A.style.setProperty("--aia-chip-image",`url("${T}")`),Yd(A,T,h),b.appendChild(A),b.dataset.aiaImage=""}let L=!T&&a&&S.param.icon_svg?ce(S.param.icon_svg):null;if(L){let A=h.createElement("span");A.className="magicx-aia-segment-icon",A.setAttribute("contenteditable","false"),A.setAttribute("aria-hidden","true"),A.innerHTML=L,b.appendChild(A),S.param.icon&&(b.dataset.aiaIcon=S.param.icon)}b.appendChild(h.createTextNode(S.value)),l&&b.appendChild(cs(h,S.param.id)),v.appendChild(b)}else if(S.type==="identified"){let b=h.createElement("strong");b.dataset.seg="identified",b.dataset.paramId=S.param.id;let x=["magicx-aia-segment","magicx-aia-segment--completed"];S.param.id===o&&x.push("magicx-aia-segment--editing"),b.className=x.join(" "),b.style.letterSpacing=ss(S.value.length),b.textContent=S.value,l&&b.appendChild(cs(h,S.param.id)),v.appendChild(b)}else v.appendChild(h.createTextNode(S.value));e.replaceChildren(v),e.dataset.aiaTextLength=String(y),f!=null?V(e,Math.max(0,Math.min(f,y))):p&&V(e,y)}function cs(t,e){let n=t.createElement("span");return n.className="magicx-aia-segment-remove",n.setAttribute("contenteditable","false"),n.setAttribute("aria-hidden","true"),n.dataset.aiaChipRemove=e,n.innerHTML='<svg viewBox="0 0 10 10" aria-hidden="true"><path d="M2.5 2.5l5 5M7.5 2.5l-5 5"/></svg>',n}var Qd='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" role="img" aria-label="Submit"><path d="M9 14V4M9 4L4 9M9 4L14 9" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';function ds(t=k()){let e=document.createElement("button");return e.type="button",e.className="magicx-aia-submit",e.setAttribute("aria-label",t.submit),e.setAttribute("data-aia-submit",""),e.innerHTML=Qd.replace('aria-label="Submit"',`aria-label="${t.submit}"`),e}function us(t){let e=t.store.get();return(!!e.text||e.completedParams.length>0)&&!!t.onSubmit}function ms(t){if(!t.onSubmit)return;t.endTypedWord?.();let e=t.store.get();t.onSubmit(ve(e.text,e.completedParams,e.skippedParams,{identifiedParams:e.identifiedParams,isReady:e.isReady,customFields:e.customFields}))&&t.afterSubmit?.()}function Xd(){let t=document.createElement("div");return t.setAttribute("contenteditable","plaintext-only"),t.contentEditable==="plaintext-only"}function ps(t,e){let n=e.firstElementChild;if(!n){e.removeAttribute("data-aia-pill-wrapped");return}let i=n.getBoundingClientRect(),o=t.getBoundingClientRect();i.top>=o.bottom-2?e.setAttribute("data-aia-pill-wrapped",""):e.removeAttribute("data-aia-pill-wrapped")}function gs(t,e){let{listboxId:n}=e,i=vn(n);t.appendChild(i);let o=document.createElement("div");o.className="magicx-aia-input-wrapper",o.setAttribute("data-aia-input-wrapper",""),t.appendChild(o);let r=document.createElement("div");r.className="magicx-aia-editor",r.setAttribute("data-aia-editor",""),o.appendChild(r);let a=document.createElement("div");a.className="magicx-aia-input",a.setAttribute("data-aia-input",""),a.setAttribute("contenteditable",Xd()?"plaintext-only":"true"),a.setAttribute("role","combobox"),a.setAttribute("aria-autocomplete","list"),a.setAttribute("aria-haspopup","listbox"),a.setAttribute("aria-controls",n),a.setAttribute("aria-expanded","false"),a.setAttribute("spellcheck","true"),a.setAttribute("enterkeyhint","send"),r.appendChild(a);let s=document.createElement("span");s.className="magicx-aia-pill-list-container",s.setAttribute("data-aia-pill-list-container",""),r.appendChild(s);let l=null,d=null;e.submitButton===void 0?(l=ds(e.strings),o.appendChild(l),d=l):e.submitButton!==null&&(d=e.submitButton,d.hasAttribute("data-aia-submit")||d.setAttribute("data-aia-submit",""),d.setAttribute("data-aia-submit-slot",""),o.appendChild(d));let c=new AbortController,{signal:u}=c,g=!1,m=0,p=()=>{let b=Ut(a),E=b.length>0&&b[0]!==b[0].toUpperCase()?b[0].toUpperCase()+b.slice(1):b;e.handleChange(E)},f=()=>{let b=fe(a)?.node??null;if(!b||!a.contains(b))return null;let P=(b.nodeType===Node.ELEMENT_NODE?b:b.parentElement)?.closest("strong[data-param-id]")?.dataset.paramId??null;return P&&Er(a,P)?null:P};o.addEventListener("click",b=>{b.target?.closest("[data-aia-pill]")||a.getRootNode().activeElement?.closest("[data-aia-location]")||a.focus()},{signal:u});let h=null,v=()=>{let b=e.showChipRemove??!1;b!==(h!==null)&&(h?.(),h=b?yo(a,x=>e.removeParam(x)):null)};if(v(),u.addEventListener("abort",()=>{h?.(),h=null}),a.addEventListener("input",()=>{g||(m=performance.now(),p(),e.handleCaretAfterInput(Y(a)))},{signal:u}),N(a).addEventListener("selectionchange",()=>{let b=fe(a);if(!b||!a.contains(b.node))return;let x=b.collapsed?f():null,E=e.store.get(),P=E.editingParam?.id??E.editingIdentified?.id??null;if(x&&x!==P){e.startEditingParam(x);return}performance.now()-m<50||e.handleCaretMove(Y(a))},{signal:u}),a.addEventListener("click",b=>{let x=Jn(a,b.target);x&&(e.startEditingParam(x),Zn(a,x))},{signal:u}),a.addEventListener("compositionstart",()=>{g=!0,a.setAttribute("data-aia-composing","true")},{signal:u}),a.addEventListener("compositionend",()=>{g=!1,a.removeAttribute("data-aia-composing"),p()},{signal:u}),a.addEventListener("beforeinput",b=>{let x=b,E=x.inputType;if(E==="insertParagraph"||E==="insertLineBreak"||E==="insertFromDrop"){b.preventDefault();return}if(E.startsWith("insert")||E.startsWith("delete")){let P=E.startsWith("delete")?"":x.data??"";e.replaceEditingRange(P)&&b.preventDefault()}},{signal:u}),a.addEventListener("paste",b=>{b.preventDefault();let x=(b.clipboardData?.getData("text/plain")??"").replace(/\r?\n/g," ");if(!x)return;let E=N(a),P=xe(a);if(!P||!a.contains(P.startContainer))return;P.deleteContents();let T=E.createTextNode(x);P.insertNode(T),P.setStartAfter(T),rt(a,P.startContainer,P.startOffset),p()},{signal:u}),a.addEventListener("keydown",b=>e.handleKeyDown(b),{signal:u}),a.addEventListener("focus",()=>e.store.set({isFocused:!0}),{signal:u}),a.addEventListener("blur",()=>e.store.set({isFocused:!1}),{signal:u}),d&&d.addEventListener("click",b=>{us(e)&&(b.stopPropagation(),ms(e))},{signal:u}),e.autoFocus!==!1){a.focus();let b=fe(a);(!b||!a.contains(b.node))&&rt(a,a,0)}if(typeof ResizeObserver<"u"){let b=new ResizeObserver(()=>ps(a,s));b.observe(a),c.signal.addEventListener("abort",()=>b.disconnect(),{once:!0})}let S=To(r);return c.signal.addEventListener("abort",S,{once:!0}),{input:a,inlinePillContainer:s,dropdown:i,submitButton:l,abort:c,syncChipRemove:v}}function Ao(t,e,n){let{input:i,inlinePillContainer:o,dropdown:r,submitButton:a}=t,{pillPlacement:s,setActivePill:l,selectOption:d,store:c}=n;t.syncChipRemove(),i.setAttribute("aria-expanded",String(e.isDropdownOpen));let u=e.activeDropdownIndex>=0?`${n.listboxId}-option-${e.activeDropdownIndex}`:"";if(u?i.setAttribute("aria-activedescendant",u):i.removeAttribute("aria-activedescendant"),a){let v=n.strings??k();a.getAttribute("aria-label")!==v.submit&&a.setAttribute("aria-label",v.submit);let y=a.querySelector("svg");y&&y.getAttribute("aria-label")!==v.submit&&y.setAttribute("aria-label",v.submit);let S=!!e.text||e.completedParams.length>0;a.disabled=!S,a.toggleAttribute("data-aia-ready",S&&e.isReady)}let g=i.dataset.newParamId??"",m=e.newParamId!==null&&e.newParamId!==g;if(Co({input:i,segments:e.segments,newParamId:e.newParamId,editingParamId:e.editingParam?.id??null,placeholderText:e.placeholderText,isFocused:e.isFocused,showChipIcons:n.showChipIcons??!0,showChipImages:n.showChipImages??!0,hintOptions:s==="inline"?[]:Lo(e.actionableSuggestions),showChipRemove:n.showChipRemove??!1}),s==="inline"){let v=e.isLoading&&!e.editingParam&&!e.inSelectionAnimation,y=Nn(e.actionableSuggestions);v||y.length>0?pn(o,y,0,l,!1,v,e.isActivePillSelected):no(o)}else no(o);ps(i,o),m?(i.focus(),V(i,e.caretOffset??e.text.length)):e.isFocused&&Ut(i)!==e.text&&V(i,e.text.length);let p=e.editingParam?tt(e.editingParam):e.editingIdentified?{parameter:e.editingIdentified.parameter,text:ae(e.editingIdentified.parameter),required:!0,options:[]}:null,f=e.dropdownSuggestion??p??e.actionableSuggestions[0],h=gt(e);En(r,{strings:n.strings,suggestions:f?[{...f,options:e.dropdownOptions}]:[],filteredOptions:e.dropdownOptions,activeIndex:e.activeDropdownIndex,isOpen:e.isDropdownOpen,isLoading:e.dropdownLoading,skeletonExiting:e.skeletonExiting,listboxId:n.listboxId,pills:p?[p]:e.actionableSuggestions,showPills:s==="dropdown",showSkipButton:n.showSkipButton&&!e.editingParam&&!e.editingIdentified,skipDisabled:e.inSelectionAnimation,showOptionIcons:n.showOptionIcons??!0,showOptionImages:n.showOptionImages??!0,showOptionCounts:n.showOptionCounts??!0,isActivePillSelected:e.isActivePillSelected,isInputEmpty:e.text.trim().length===0,products:e.products,productsLayout:n.productsLayout??"row",productImageFallback:n.productImageFallback??"image",onProductAddToCart:n.addProductToCart,formatType:e.activeFormatType,dateView:e.dateView,selectedDateIso:h.selectedIso,selectedDateRange:h.selectedRange,dateRangeStart:h.rangeStart,dateReferences:h.references,timeView:e.timeView,multiSelectView:e.dropdownMultiSelect,locationView:e.locationView,isReediting:e.editingParam!=null,isFocused:e.isFocused||e.locationFieldFocused,optionsPosition:n.optionsPosition??"below",onSelect:d,onHighlight:(v,y)=>{y!==void 0&&c.get().activeDropdownIndex!==y||c.set({activeDropdownIndex:v})},onPillClick:l,onSkip:n.skipActivePill,onPreviousMonth:n.showPreviousMonth,onNextMonth:n.showNextMonth,onTimeChange:n.setTime,onTimeCommit:n.commitTime,onMultiSelectCommit:n.commitMultiSelect,onLocationQuery:n.setLocationQuery,onLocationMove:n.moveLocationHighlight,onLocationCommit:n.commitLocation,onLocationFocusChange:n.setLocationFieldFocused,onProductSelect:n.selectProduct,onProductFocusChange:v=>c.set({isFocused:v}),onSeeAllResults:n.seeAllResults&&e.text.trim().length>0&&us(n)?()=>ms(n):void 0,fullWidth:n.seeAllResults===!0})}function Io(t){let e=t,n=new Set,i=[],o=!1;return{get:()=>e,set:r=>{let a=typeof r=="function"?r(e):r,s=e;if(e={...e,...a},i.push([e,s]),!o){o=!0;try{let l=0;for(let d=i.shift();d;d=i.shift()){if(++l>1e4)throw i.length=0,new Error("createStore: notifications did not settle after 10000 deliveries \u2014 a listener is likely calling set() on every notification");let[c,u]=d;for(let g of n)g(c,u)}}catch(l){throw i.length=0,l}finally{o=!1}}},subscribe:r=>(n.add(r),()=>{n.delete(r)})}}function fs(t,e){let n,i,o=r=>(r!==n&&(n=r,i=e(r)),i);return{get:()=>{let r=t.get();return{...r,...o(r)}},set:r=>{typeof r=="function"?t.set(a=>{let s={...a,...o(a)};return r(s)}):t.set(r)},peek:r=>{let a={...t.get(),...r};return{...a,...e(a)}},subscribe:r=>t.subscribe((a,s)=>{let l={...s,...o(s)},d={...a,...o(a)};r(d,l)})}}var Oo=new WeakSet,hs=new WeakMap;function Ss(t){return t.nodeType===Node.DOCUMENT_NODE}function Jd(t){return Ss(t)?t:t.ownerDocument}function Zd(t){let e=hs.get(t);if(e)return e;let n=t.defaultView?.CSSStyleSheet;if(typeof n!="function")return null;try{let i=new n;return typeof i.replaceSync!="function"?null:(i.replaceSync(Ts),hs.set(t,i),i)}catch{return null}}function bs(t,e){if(e.querySelector("style[data-magicx-aia]"))return;let n=t.createElement("style");n.setAttribute("data-magicx-aia",""),n.textContent=Ts,e.appendChild(n)}function ys(t){if(typeof document>"u")return;let e=t??document;if(Oo.has(e))return;let n=Jd(e);if(Ss(e)){let r=e.head??e.documentElement;if(!r)return;bs(n,r),Oo.add(e);return}let i=Zd(n),o=e.adoptedStyleSheets;i&&Array.isArray(o)?o.includes(i)||(e.adoptedStyleSheets=[...o,i]):bs(n,e),Oo.add(e)}var Ts=`.aia-stack {
1
+ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="options"}function J(t){return t?.type?.kind==="date"?"date":t?.type?.kind==="date_range"?"date-range":t?.type?.kind==="time"?"time":t?.type?.kind==="location"&&!t.options?.length?"location":"options"}var xt=class{constructor(e){this.config=e;this.current=null;this.expiresAt=null;this.inFlightRefresh=null;e.accessToken&&(this.current=e.accessToken)}async getToken(e=!1){if(!e&&this.current&&!this.isExpired())return this.current;if(!e&&this.inFlightRefresh)return this.inFlightRefresh;this.inFlightRefresh=this.refresh();try{return await this.inFlightRefresh}finally{this.inFlightRefresh=null}}async refresh(){let e=await this.config.getAccessToken();return this.current=e.accessToken,this.expiresAt=e.expiresAt??null,this.current}isExpired(){return this.expiresAt==null?!1:Date.now()>=this.expiresAt-3e4}};var Ms="https://api.ai-autocomplete.com",Z=`${Ms}/api/suggest`,vt=new Map([["api.ai-autocomplete.com","cdn.ai-autocomplete.com"],["dev-api.ai-autocomplete.com","dev-cdn.ai-autocomplete.com"]]),Do=new WeakMap;function ze(t){return t?.type==="accessToken"}function ks(t){if(!(!t||ze(t)))return t}function Et(t){let e=Do.get(t.getAccessToken);return e||(e=new xt(t),Do.set(t.getAccessToken,e)),e}function Pt(t){return{"Content-Type":"application/json",...t?.appIdentifier&&{"X-App-Identifier":t.appIdentifier},...t?.headers}}function wt(t){let e=ks(t),n=e?.apiKey;return n?(e?.authScheme??"Bearer")==="Basic"?`Basic ${btoa(n)}`:`Bearer ${n}`:null}var kn="aiaPlace",Lt=2,Fo=250,Ho=new Set("new san los las santa saint st fort port north south east west lake mount el la rio de palm long grand cape salt hong".split(" ")),No=new Set("city beach springs falls island park heights valley bay".split(" ")),Rs=new Set("a an the in at to off on of from for by near into onto around via toward towards up out and or with within".split(" "));function Wo(t){let e=_s(t);for(;e.length>0&&Rs.has(e[0].toLowerCase().replace(/[.,]+$/,""));)e.shift();return e.join(" ")}function _s(t){let e=t.trim().split(/\s+/).filter(Boolean);if(e.length===0)return[];let n=e[e.length-1].replace(/[.,]+$/,"");if(!n)return[];let i=e.length>1?e[e.length-2]:void 0,o=e.length>2?e[e.length-3]:void 0,r=a=>a.toLowerCase().replace(/[.,]+$/,"");return i&&o&&Ho.has(r(o))&&No.has(r(n))?[o,i,n]:i&&(Ho.has(r(i))||No.has(r(n)))?[i,n]:[n]}function Bo(t){let e=t.secondary?.split(",")[0]?.trim();return e?`${t.name}, ${e}`:t.name}function Mn(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/\s+/g," ").trim()}function Rn(t,e){let n=Mn(e);if(!n)return!1;if(Mn(t.name)===n)return!0;for(let[,i]of t.name.matchAll(/\(([^()]*)\)/g))if(Mn(i)===n)return!0;return!1}function Vo(t,e){let n=e.metadata?.[kn];if(typeof n?.name!="string")return 0;let i={id:"",name:n.name},o=[...t.matchAll(/\S+/g)];for(let r of o){let a=r.index??0,s=t.slice(a).trim().replace(/[.,]+$/,"");if(Rn(i,s))return t.length-a}return 0}function _n(t){return typeof t=="string"?{text:t,is_tappable:!0,kind:null}:{text:Bo(t),is_tappable:!0,kind:null,metadata:{[kn]:{id:t.id,name:t.name}}}}function Dn(t){if(t?.locationEndpoint)return t.locationEndpoint;let e=t?.endpoint??Z,n=e.indexOf("?"),i=n<0?e:e.slice(0,n),o=n<0?"":e.slice(n+1);if(!/\/suggest\/?$/.test(i))return null;let r=i.replace(/\/suggest\/?$/,"/locations/autocomplete");return o?`${r}?${o}`:r}function Uo(t){let e=t?.places;if(!Array.isArray(e))return[];let n=[];for(let i of e){let{id:o,name:r,secondary:a}=i??{};typeof o!="string"||!o||typeof r!="string"||!r.trim()||n.push({id:o,name:r.trim(),...typeof a=="string"&&a.trim()?{secondary:a.trim()}:{}})}return n}function je(t){return t.map(e=>({parameter:e.parameter,text:e.text}))}var $o="skipped";function Ye(t,e){if(t.some(o=>"group"in o)&&(t=t.map(o=>{let{group:r,...a}=o;return a})),e.length===0)return t;let n=new Set(t.map(o=>o.parameter)),i=e.filter(o=>!n.has(o.parameter)).map(o=>({placeholder:"",parameter:o.parameter,text:$o,kind:null}));return i.length>0?[...t,...i]:t}var Ds="0.73.3",Ko="1.0",Go=!1;function Hs(t,e){return{placeholder:t.placeholder,parameter:t.parameter,...e&&{text:t.value??t.text},kind:t.kind}}function ue(t){return t??(typeof navigator<"u"?navigator.language:"en-US")}function Ns(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||void 0}catch{return}}function Fs(t,e,n,i,o,r,a,s,l,d,c,u,g){let m=e.find(h=>h.parameter==="contact"&&h.metadata?.contact_account_count)?.metadata?.contact_account_count,p=typeof m=="number"?m:void 0,f=Ns();return{data:{raw_query:t,accepts_traditional_autocomplete:!0,client_option_parameters:g??[],completed_params:Ye(e.map(h=>Hs(h,n)),l??[]),...a&&a.length>0&&{identified_params:je(a)},...s&&s.length>0&&{recently_suggested:s},...p!=null&&{contact_account_count:p},...d!==void 0&&{additional_context:d}},meta:{request_id:o,request_at:new Date().toISOString(),language:ue(c),...f&&{timezone:f},...u?.code&&Number.isFinite(u.rate)&&u.rate>0&&{currency:u.code,currency_rate:u.rate,...u.country!==void 0&&{country:u.country}},client_version:Ds,session_id:i,source:r,schema_version:Ko}}}async function qo(t,e,n,i,o){return fetch(t,{method:"POST",headers:{...e,Authorization:`Bearer ${n}`},body:i,signal:o})}async function zo(t,e,n){let i=n.apiConfig,o=!n.maskCompletedText,r=Fs(t,e,o,n.sessionId,n.requestId??crypto.randomUUID(),n.source,n.identifiedParams,n.recentlySuggested,n.skippedParams,n.additionalContext,n.language,n.currency,n.clientOptionParameters),a=i?.endpoint??Z,s=await jo(a,JSON.stringify(r),i,n.signal);if(!s.ok)throw new Error(`API error: ${s.status} ${s.statusText}`);return s.json()}async function jo(t,e,n,i){let o=Pt(n);if(ze(n)){let a=Et(n),s=await a.getToken(),l=await qo(t,o,s,e,i);if(l.status===401){let d=await a.getToken(!0);l=await qo(t,o,d,e,i)}return l}let r=wt(n);return!r&&!Go&&(Go=!0,console.warn("[AIAutocomplete] No apiKey in apiConfig. Requests will be sent without an Authorization header.")),r&&(o.Authorization=r),fetch(t,{method:"POST",headers:o,body:e,signal:i})}var Qe=class extends Error{constructor(n){super(`Location search error: ${n}`);this.status=n;this.name="LocationSearchError"}};async function Yo(t,e,n){let i=JSON.stringify({query:e,session_token:n.sessionToken,language:ue(n.language)}),o=await jo(t,i,n.apiConfig,n.signal);if(!o.ok)throw new Qe(o.status);return Uo(await o.json())}var Ct=/[\p{L}\p{N}]/u,Ws=/['\u2019-]/;function Qo(t,e,n){let i=t[e];if(i===void 0)return!1;if(Ct.test(i))return!0;let o=t[e+n];return Ws.test(i)&&o!==void 0&&Ct.test(o)}function Bs(t,e,n){let i=e+n.length;return!(Ct.test(n[0])&&Qo(t,e-1,-1)||Ct.test(n[n.length-1])&&Qo(t,i,1))}function re(t,e,n=0,i=()=>!0){if(e.length===0)return t.indexOf(e,n);let o=-1,r=t.indexOf(e,n);for(;r!==-1;){if(i(r)){if(Bs(t,r,e))return r;o===-1&&(o=r)}r=t.indexOf(e,r+1)}return o}function W(t,e){let n=t,i={},o=[],r=[],a=0;for(let s of e){let l=(i[s.parameter]??0)+1;i[s.parameter]=l;let c=`{{${s.parameter.toUpperCase().replace(/\s+/g,"_")}_${l}}}`,u=m=>re(n,s.text,m,p=>!r.some(f=>p<f.end&&p+s.text.length>f.start)),g=u(a);if(g===-1&&(g=u(0)),g!==-1){n=n.slice(0,g)+c+n.slice(g+s.text.length);let m=c.length-s.text.length;for(let p of r)p.start>=g+s.text.length&&(p.start+=m,p.end+=m);r.push({start:g,end:g+c.length}),a=g>=a?g+c.length:a+m}o.push({...s,placeholder:c})}return{rawQuery:n,completedParams:o}}function me(t,e,n){return e>0||!n?e:t.toLowerCase().startsWith(n.toLowerCase())?n.length:e}function Le(t,e){return e===!1?"":t}function Xe(t,e,n){return e===0&&t.length>0&&n.length>0&&n.toLowerCase().startsWith(t.toLowerCase())}function Je(t,e,n){let i=t.slice(e);if(n||e===0||t[e-1]===" ")return i;let o=i.indexOf(" ");return o===-1?"":i.slice(o+1)}function Xo(t,e){let n=t.trimEnd().replace(/\s+/g," ");if(n.length===0||e.length===0)return 0;let i=n.split(" "),o=e.toLowerCase();for(let r=0;r<i.length;r++){let a=i.slice(r).join(" ");if(o.startsWith(a.toLowerCase())){let s=n.length-a.length;return t.length-s}}return 0}function Jo(t){return t.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase().replace(/[_\-\s]+/g," ")}function Vs(t,e){let n=Jo(t).trim();return n.startsWith(e)||n.includes(` ${e}`)}function pe(t,e,n=!1){if(!t)return[];let i=e.trimStart();if(!i)return t;let o=n?Jo(i).trimStart():"";if(o)return t.filter(a=>!a.is_tappable||Vs(a.text,o));let r=i.toLowerCase();return t.filter(a=>!a.is_tappable||a.text.toLowerCase().includes(r))}function At(t,e){if(!t)return null;let n=e.trim();if(!n)return null;let i=n.toLowerCase();return t.find(o=>o.is_tappable&&o.text.toLowerCase()===i)??null}function Ze(t,e,n,i,o){let r=Je(e,n,i),a=At(t,r);if(a||!o||!r.trim())return a;if(r===e.slice(n))return null;let s=e.lastIndexOf(" ",n-1)+1;return At(t,e.slice(s))}function Zo(t,e){let n=e.replace(/^\s+/,"").toLowerCase();for(let i=0;i<n.length;){let o=n.slice(i);if(o.trim().length>=2){let a=t.findIndex(s=>s.is_tappable&&!s.selectsAll&&s.text.toLowerCase().startsWith(o));if(a>=0)return t.map((s,l)=>l===a?{...s,liveMatch:!0}:s)}let r=n.indexOf(" ",i);if(r<0)break;i=r+1}return t}function tr(t,e){return e?t.map(n=>e[n.parameter]?{...n,options:[]}:n):t}function nr(t,e){let{icon:n,icon_svg:i}=e;return!i||t.every(er)?t:t.map(o=>er(o)?o:{...o,icon:n,icon_svg:i})}function er(t){return!!(t.icon_svg||t.image_url)}function Us(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^a-zA-Z0-9]+/).filter(Boolean).map(e=>e.toLowerCase())}function ae(t){let e=Us(t);return e.length>0?e.join(" "):t}function ee(t,e){return t.parameter||e}function et(t,e){return{parameter:t,suggestionParameter:t,suggestionValueType:{kind:"traditional_autocomplete"},suggestionPlaceholder:ae(t),...e?{suggestionHeader:e}:{}}}function tt(t){return t.suggestionValueType?.kind==="traditional_autocomplete"?{parameter:t.suggestionParameter,text:t.suggestionHeader??"",required:!0,type:t.suggestionValueType,options:t.options}:{parameter:t.suggestionParameter,text:t.suggestionPlaceholder,required:!0,options:t.options}}function It(t,e){let n=ee(e,t.suggestionParameter);return t.suggestionValueType?.kind==="traditional_autocomplete"?et(n,t.suggestionHeader):{parameter:n,suggestionParameter:t.suggestionParameter,suggestionValueType:t.suggestionValueType,suggestionPlaceholder:t.suggestionPlaceholder,suggestionIcon:t.suggestionIcon,suggestionIconSvg:t.suggestionIconSvg}}function C(t){return t?.type?.kind==="traditional_autocomplete"}function Hn(t){let e=t?.replace(/[_\-\s]+/g," ").trim();return e?e.charAt(0).toUpperCase()+e.slice(1):void 0}function Ce(t){return C(t)||t?.smart_suggestion===!0}function Nn(t){return t.some(C)?t.filter(e=>!C(e)):t}function Fn(t,e){return t.some(n=>C(n)&&!n.text)?t.map(n=>C(n)&&!n.text?{...n,text:e}:n):t}var Wn='<svg viewBox="0 0 20 20" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false"><path class="aia-sparkle-large" d="M8 5C8.5 9.5 10.5 11.5 15 12C10.5 12.5 8.5 14.5 8 19C7.5 14.5 5.5 12.5 1 12C5.5 11.5 7.5 9.5 8 5Z"/><path class="aia-sparkle-small" d="M16 1C16.2 3 17 3.8 19 4C17 4.2 16.2 5 16 7C15.8 5 15 4.2 13 4C15 3.8 15.8 3 16 1Z"/></svg>';function Bn(t){return t.some(e=>!C(e))}function ir(t,e){let n=0,i=e;for(let o of t)n+=o.value.length,o.type!=="text"&&(i=Math.max(i,n));return i}function or(t,e){let n=0;for(let i of t){let o=n+i.value.length;if(i.type==="text"&&o>e&&i.value.slice(Math.max(e-n,0)).trim().length>0)return!1;n=o}return!0}function rr(t,e){let n=[],i=new Map;for(let o of[...t,...e]){if(o.parameter==="placeholder"||C(o))continue;let r=i.get(o.parameter);r||(r={parameter:o.parameter,text:o.text},i.set(o.parameter,r),n.push(r));for(let a of o.options??[])!a.is_tappable||r.options?.includes(a.text)||(r.options??(r.options=[]),r.options.push(a.text))}return n}function ar(t,e,n){if(t===e)return n;let i=Math.min(t.length,e.length),o=0;for(;o<i&&t[o]===e[o];)o++;if(o>=n)return n;let r=0;for(;r<i-o&&t[t.length-1-r]===e[e.length-1-r];)r++;return t.length-r<=n?n+(e.length-t.length):null}function Ot(t,e){let n=[],i=[],o=0;for(let r of e){let a=re(t,r.text,o);if(a===-1){i.push(r);continue}n.push({start:a,end:a+r.text.length,param:r}),o=a+r.text.length}return{located:n,missing:i}}function Te(t,e){let{located:n}=Ot(t,e);return n.length>0?n[n.length-1].end:0}function sr(t,e,n){let i=[],o=[],r=0;for(let a of n){let s=re(t,a.text,r,l=>!e.some(d=>l<d.end&&l+a.text.length>d.start));if(s===-1){o.push(a);continue}i.push({start:s,end:s+a.text.length,param:a}),r=s+a.text.length}return{located:i,missing:o}}function Mt(t,e,n=[]){let i=Ot(t,e).located,o=[];for(let c of i){let u=o[o.length-1];c.param.group&&u?.param.group===c.param.group?(u.end=c.end,u.params?.push(c.param)):o.push({...c,...c.param.group?{params:[c.param]}:{}})}let r=sr(t,o,n).located,a=[...o.map(c=>({start:c.start,end:c.end,segment:{type:"completed",value:t.slice(c.start,c.end),param:c.param,...c.params?{params:c.params}:{}}})),...r.map(c=>({start:c.start,end:c.end,segment:{type:"identified",value:c.param.text,param:c.param}}))].sort((c,u)=>c.start-u.start),s=[],l=0;for(let c of a)c.start>l&&s.push({type:"text",value:t.slice(l,c.start)}),s.push(c.segment),l=c.end;let d=t.slice(l);return d&&s.push({type:"text",value:d}),s}function lr(t,e){let{located:n,missing:i}=Ot(t,e),o=new Set(i.map(a=>a.group).filter(Boolean)),r=n.map(a=>a.param).filter(a=>!o.has(a.group));return{valid:r,invalid:e.filter(a=>!r.includes(a))}}function nt(t,e,n){let i=Ot(t,e).located,{located:o,missing:r}=sr(t,i,n);return{valid:o.map(a=>a.param),invalid:r}}function cr(t,e,n){let i=e?.endpoint??Z,o=i.replace(/\/suggest(?=[?#]|$)/,`/starting-state/${encodeURIComponent(t)}${$s(n)}`);if(o!==i)return o.replace(/^https:\/\/([^/?#]+)/,(r,a)=>{let s=vt.get(a);return s?`https://${s}`:r})}function $s(t){let e=t?.replace(/_/g,"-").toLowerCase()??"",[n,i=""]=e.split("-");return n!=="zh"?/^[a-z]{2,3}$/.test(n)?`/${n}`:"":/^[a-z]{4}$/.test(i)?i==="hant"?"/zh-TW":"/zh":["tw","hk","mo"].includes(i)?"/zh-TW":"/zh"}async function dr(t){try{let e=await t;if(!e.ok)return null;let n=await e.json();return Array.isArray(n?.data?.suggestions)?n:null}catch{return null}}function Gs(t){if(t instanceof Error)return t;try{return new Error(String(t))}catch{return new Error("Unknown error")}}var qs=100,Ks=300,zs=2,kt=class{constructor(e,n,i,o,r,a,s,l,d,c={}){this.store=e;this.getApiConfig=n;this.getOptionOverrides=i;this.getMaskCompletedText=o;this.getOnError=r;this.getSessionId=a;this.getSource=s;this.getAdditionalContext=l;this.getLanguage=d;this.callbacks=c;this.fetchVersion=0;this.abortController=null;this.debounceTimer=null;this.slowDebounceTimer=null;this.unsubscribe=null;this.phraseExactMatch=!1}start(){this.doFetch("",[]);let e=this.store.get().text,n=this.store.get().completedParams;this.unsubscribe=this.store.subscribe(i=>{(i.text!==e||i.completedParams!==n)&&(e=i.text,n=i.completedParams,this.scheduleFetch())})}isPhraseExactMatch(){return this.phraseExactMatch}dispose(){this.abortController?.abort(),this.clearTimers(),this.unsubscribe?.()}async doFetch(e,n){this.abortController?.abort();let i=new AbortController;this.abortController=i;let o=++this.fetchVersion,r=this.store.get().text.length,a=this.store.get().text;try{this.callbacks.onRequest?.({query:this.store.get().text,signal:i.signal,isCurrent:()=>o===this.fetchVersion})}catch{}try{this.store.set({isLoading:!0,error:null});let s=this.store.get(),l=s.pendingSpan?rr(s.pendingSpan.snapshot,s.actionableSuggestions):void 0,d=crypto.randomUUID(),c=e===""&&n.length===0&&s.skippedParams.length===0&&s.identifiedParams.length===0,u=c?this.startingStateUrl():void 0,g=u?await dr(fetch(u,{signal:i.signal})):null;if(o!==this.fetchVersion)return;let m=g??await zo(e,n,{sessionId:this.getSessionId(),requestId:d,source:this.getSource(),maskCompletedText:this.getMaskCompletedText(),signal:i.signal,apiConfig:this.getApiConfig(),identifiedParams:s.identifiedParams,recentlySuggested:l,skippedParams:s.skippedParams,additionalContext:this.getAdditionalContext(),language:this.getLanguage(),currency:this.callbacks.getCurrency?.(),clientOptionParameters:Object.keys(this.getOptionOverrides()??{})});if(o!==this.fetchVersion)return;this.phraseExactMatch=m.meta?.phrase_exact_match===!0;let p=(m.data.suggestions??[]).find(C),f=p?[]:m.data.input??[],h=w=>({id:crypto.randomUUID(),parameter:w.parameter,text:w.text,...w.type?{type:w.type}:{},...w.iso_date?{isoDate:w.iso_date}:{},...w.iso_date_end?{isoDateEnd:w.iso_date_end}:{}}),v=f.filter(w=>w.source==="identified");this.callbacks.waitIdentified?.(v.filter(w=>w.state==="need_confirmation").map(h),a);let y=v.filter(w=>w.state!=="need_confirmation").map(h),S=this.callbacks.isWordOpen?.()??!1,b=this.store.get().text.toLowerCase(),x=w=>S&&b.endsWith(w.text.toLowerCase()),E=y.filter(w=>!x(w));S&&this.callbacks.holdIdentified?.(y.filter(x));let P=p?[p]:tr(m.data.suggestions??[],this.getOptionOverrides()),T=f,L=T[T.length-1],A=this.store.get().text,F,R;if(L?.state==="in_progress"){R=!0;let w=A.toLowerCase().lastIndexOf(L.text.toLowerCase());F=w!==-1?w:r}else R=!1,F=r;let I=P.filter(w=>w.parameter!=="placeholder")[0],Q=null;if(I&&!C(I)&&!S&&I.type?.kind!=="multi_select"&&!H(J(I))){let w=Ze(I.options,A,F,R,this.phraseExactMatch);w&&(Q={id:crypto.randomUUID(),placeholder:"",parameter:ee(w,I.parameter),text:w.text,value:w.value,kind:w.kind,suggestionParameter:I.parameter,suggestionValueType:I.type,suggestionPlaceholder:I.text,suggestionIcon:I.icon,suggestionIconSvg:I.icon_svg,options:I.options??[],metadata:w.metadata,icon:w.icon,icon_svg:w.icon_svg,image_url:w.image_url},P=P.filter(oe=>oe!==I),this.callbacks.onAutoMatch?.({active:I,matched:w,rawQuery:e}))}let ie=m.data.custom_fields??null,D=this.callbacks.productsForResponse?.(ie);this.store.set(w=>{let oe=Q?[...w.completedParams,Q]:w.completedParams,Ue=new Set,ye=nt(w.text,oe,E).valid.map(M=>{let Ge=w.identifiedParams.find(qe=>!Ue.has(qe.id)&&qe.parameter===M.parameter&&qe.text===M.text);return Ge?(Ue.add(Ge.id),{...M,id:Ge.id}):M}),yt=new Set(s.skippedParams.map(M=>M.id)),Tt=new Set(w.skippedParams.filter(M=>!yt.has(M.id)).map(M=>M.parameter)),$e=Tt.size>0?P.filter(M=>M.parameter==="placeholder"||!Tt.has(M.parameter)):P;return{suggestions:this.callbacks.getAllOption?.()===!0&&!c?$e.map(M=>M.parameter==="placeholder"?M:{...M,leadsWithAll:!0}):$e,isLoading:!1,isReady:m.data.is_ready??!1,lastRawQuery:e,activeDropdownIndex:-1,filterBase:F,filterInProgress:R,identifiedParams:ye,customFields:ie,traditionalAutocomplete:m.meta?.traditional_autocomplete===!0,...D!==void 0?{products:D}:{},...Q?{completedParams:oe}:{}}}),this.callbacks.onResponse?.({requestId:d,funnelTelemetry:m.meta?.funnel_telemetry===!0,visibleImpression:m.meta?.visible_impression===!0})}catch(s){let l=Gs(s);o===this.fetchVersion&&(this.store.set({error:l,isLoading:!1}),this.getOnError()?.(l))}finally{if(o===this.fetchVersion&&this.store.get().isLoading)try{this.store.set({isLoading:!1})}catch{}}}startingStateUrl(){let e=this.callbacks.getProductId?.();return e?cr(e,this.getApiConfig(),ue(this.getLanguage())):void 0}attemptNow(){if(this.clearTimers(),this.store.get().skipNextFetch){this.store.set({skipNextFetch:!1});return}this.attemptFetch(1,!0)}scheduleFetch(){if(this.clearTimers(),this.store.get().skipNextFetch){this.store.set({skipNextFetch:!1});return}this.debounceTimer=setTimeout(()=>{this.attemptFetch(zs)&&this.slowDebounceTimer&&clearTimeout(this.slowDebounceTimer)},qs),this.slowDebounceTimer=setTimeout(()=>this.attemptFetch(1,!0,!0),Ks)}attemptFetch(e,n=!1,i=!1){let o=this.store.get();if(!o.text&&o.completedParams.length===0)return this.doFetch("",[]),!0;let r=this.callbacks.consumerTick?.(o,e)??"no";if(r==="asked")return!0;if(r==="owns")return!1;let a=Le(o.suggestions.filter(E=>E.parameter==="placeholder").map(E=>E.text).join(" "),this.callbacks.getPrependPlaceholder?.()),s=me(o.text,o.filterBase,a),l=Je(o.text,s,o.filterInProgress),d=o.suggestions.filter(E=>E.parameter!=="placeholder"),c=C(d[0])?void 0:d[0],u=H(o.activeFormatType),g=c&&!u?pe(c.options,l,o.traditionalAutocomplete):[];if(o.multiSelectView&&l.trim().length>0&&g.length>0)return!1;let m=g.filter(E=>E.is_tappable),p=c&&!u&&!this.callbacks.isWordOpen?.()?Ze(c.options,o.text,s,o.filterInProgress,this.phraseExactMatch)!==null:!1,f=l.trim().length>0,h=i&&o.products.length>0;if(m.length>0&&!p&&f&&!h||Xe(o.text,o.completedParams.length,a))return!1;let{rawQuery:v,completedParams:y}=W(o.text,o.completedParams),S=v.length<o.lastRawQuery.length,b=Math.abs(v.length-o.lastRawQuery.length),x=n&&v!==o.lastRawQuery;return S||b>=e||x?(this.doFetch(v,y),!0):!1}clearTimers(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.slowDebounceTimer&&clearTimeout(this.slowDebounceTimer),this.debounceTimer=null,this.slowDebounceTimer=null}};var js="(hover: none) and (pointer: coarse)";var Ys="[data-aia-dropdown], [data-aia-input-wrapper]",Qs=["a[href]","button","input","select","textarea","label","summary","[contenteditable]:not([contenteditable='false'])","[role='button']","[role='link']","[tabindex]:not([tabindex='-1'])"].join(", "),Rt=class{constructor(e,n){this.store=e;this.container=n;this.listening=!1;this.declined=!1;this.pressOutside=!1;this.pressWhileFocused=!1;this.recheckTimer=null;this.releaseTimer=null;this.onPointerDown=e=>{let n=e.composedPath(),i=this.isInside(n);this.pressOutside=!i;let o=this.store.get();this.pressWhileFocused=o.isFocused,!(i||!o.isFocused)&&(this.declined=n.some(r=>r instanceof Element&&r.matches(Qs)),this.declined&&o.dropdownHeld?this.store.set({dropdownHeld:!1}):!this.declined&&!o.dropdownHeld&&o.isDropdownOpen&&this.store.set({dropdownHeld:!0}))};this.onPointerCancel=()=>{this.pressOutside=!1,this.pressWhileFocused&&this.declined&&this.scheduleRecheck(),this.pressWhileFocused=!1};this.onPointerUp=e=>{let n=this.pressOutside&&!this.isInside(e.composedPath()),i=this.pressWhileFocused;if(this.pressOutside=!1,this.pressWhileFocused=!1,i){this.declined&&this.scheduleRecheck();return}!n||this.store.get().isFocused||(this.cancelRelease(),this.releaseTimer=setTimeout(()=>{this.releaseTimer=null;let o=this.store.get();o.dropdownHeld&&!o.isFocused&&this.store.set({dropdownHeld:!1})},150))};this.touchPrimary=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(js):null,this.unsubscribe=e.subscribe(()=>this.sync())}dispose(){this.unsubscribe(),this.listen(!1),this.cancelRelease(),this.recheckTimer!==null&&clearTimeout(this.recheckTimer),this.recheckTimer=null}sync(){let e=this.store.get(),n=this.touchPrimary?.matches??!1;e.isFocused||(this.declined=!1),e.isDropdownOpen?e.isFocused&&!e.dropdownHeld&&!this.declined&&n&&this.store.set({dropdownHeld:!0}):e.dropdownHeld&&this.store.set({dropdownHeld:!1});let i=this.store.get();this.listen(n&&i.isDropdownOpen),i.isFocused&&this.cancelRelease()}listen(e){if(!(e===this.listening||typeof document>"u")){if(this.listening=e,e){document.addEventListener("pointerdown",this.onPointerDown,!0),document.addEventListener("pointerup",this.onPointerUp,!0),document.addEventListener("pointercancel",this.onPointerCancel,!0);return}document.removeEventListener("pointerdown",this.onPointerDown,!0),document.removeEventListener("pointerup",this.onPointerUp,!0),document.removeEventListener("pointercancel",this.onPointerCancel,!0),this.pressOutside=!1}}scheduleRecheck(){this.recheckTimer!==null&&clearTimeout(this.recheckTimer),this.recheckTimer=setTimeout(()=>{this.recheckTimer=null,!(!this.declined||!this.store.get().isFocused)&&(this.declined=!1,this.sync())},150)}cancelRelease(){this.releaseTimer!==null&&(clearTimeout(this.releaseTimer),this.releaseTimer=null)}isInside(e){let n=this.container,i=n?.getRootNode(),o=typeof ShadowRoot<"u"&&i instanceof ShadowRoot?i.host:null;for(let r of e)if(r===n||r===o||r instanceof Element&&r.matches(Ys))return!0;return!1}};var Ae=["January","February","March","April","May","June","July","August","September","October","November","December"],_t=["S","M","T","W","T","F","S"],pr=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Dt="aiaDate",gr="aiaDay",ur=t=>String(t).padStart(2,"0");function B(t){return`${t.getFullYear()}-${ur(t.getMonth()+1)}-${ur(t.getDate())}`}function Vn(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function Xs(t){let e=Vn(t).getTime()-Vn(new Date).getTime();return Math.round(e/864e5)}function fr(t){let e=Xs(t);return e>=0&&e<7?pr[t.getDay()]:Ie(t)}function Ie(t){return t.getFullYear()===new Date().getFullYear()?`${Ae[t.getMonth()]} ${t.getDate()}`:`${Ae[t.getMonth()]} ${t.getDate()} ${t.getFullYear()}`}function Ht(t){if(!t)return null;let e=pr.findIndex(s=>s.toLowerCase()===t.trim().toLowerCase());if(e>=0){let s=Vn(new Date),l=(e-s.getDay()+7)%7;return new Date(s.getFullYear(),s.getMonth(),s.getDate()+l)}let n=/^\s*([A-Za-z]+)\s+(\d{1,2})(?:\s+(\d{4}))?\s*$/.exec(t);if(!n)return null;let i=Ae.findIndex(s=>s.toLowerCase()===n[1].toLowerCase());if(i<0)return null;let o=Number(n[2]),r=n[3]?Number(n[3]):new Date().getFullYear(),a=new Date(r,i,o);return a.getMonth()!==i||a.getDate()!==o?null:a}function Un(t){return`${Ae[t.month]} ${t.year}`}function $n(){let t=new Date;return{year:t.getFullYear(),month:t.getMonth()}}function hr(t){return{year:t.getFullYear(),month:t.getMonth()}}function Gn(t,e){let n=new Date(t.year,t.month+e,1);return{year:n.getFullYear(),month:n.getMonth()}}function mr(){return{text:"",is_tappable:!1,kind:null}}function qn(t){let e=new Date(t.year,t.month,1).getDay(),n=new Date(t.year,t.month+1,0).getDate(),i=[];for(let o=0;o<e;o++)i.push(mr());for(let o=1;o<=n;o++){let r=new Date(t.year,t.month,o);i.push({text:fr(r),is_tappable:!0,kind:null,metadata:{[Dt]:B(r),[gr]:o}})}for(;i.length%_t.length!==0;)i.push(mr());return i}function it(t){let e=Ht(t);return e?B(e):null}function j(t){let e=t?.metadata?.[Dt];return typeof e=="string"?e:null}function Kn(t){let e=t?.metadata?.[gr];return typeof e=="number"?e:null}function Js(t){return t.nodeType===Node.DOCUMENT_NODE?!0:t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in t}function ge(t){let e=typeof t.getRootNode=="function"?t.getRootNode():null;return e&&Js(e)?e:t.ownerDocument??t}function Nt(t){return ge(t).activeElement??null}function N(t){return t.ownerDocument??t}function Zs(t){return t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function br(t){let e=ge(t);return!Zs(e)||typeof e.getSelection=="function"?null:e}function Sr(t){let e=br(t);if(!e)return null;let n=N(t).getSelection?.();return!n||typeof n.getComposedRanges!="function"?null:e}function yr(t,e){let n=t,i;try{i=n.getComposedRanges({shadowRoots:[e]})}catch{i=n.getComposedRanges(e)}return i.length>0?i[0]:null}function ot(t){let n=ge(t).getSelection?.();return n||(N(t).getSelection?.()??null)}function fe(t){let e=ot(t);if(!e||e.rangeCount===0)return null;let n=Sr(t);if(n){let i=yr(e,n);return i?{node:i.startContainer,offset:i.startOffset,collapsed:i.startContainer===i.endContainer&&i.startOffset===i.endOffset}:null}return e.anchorNode?{node:e.anchorNode,offset:e.anchorOffset,collapsed:e.isCollapsed}:null}function xe(t){let e=ot(t);if(!e||e.rangeCount===0)return null;let n=Sr(t);if(!n)return e.getRangeAt(0);let i=yr(e,n);if(!i)return null;let o=N(t).createRange();return o.setStart(i.startContainer,i.startOffset),o.setEnd(i.endContainer,i.endOffset),o}function rt(t,e,n){let i=ot(t);if(!i)return null;if(br(t))return i.collapse(e,n),i;let o=N(t).createRange();return o.setStart(e,n),o.collapse(!0),i.removeAllRanges(),i.addRange(o),i}function Ft(t,e){let n=t?ge(t):typeof document<"u"?document:null;return n?typeof n.getElementById=="function"?n.getElementById(e):typeof document<"u"?document.getElementById(e):null:null}var Wt=2,el="magicx-aia";function Tr(t){return t==="auto"||t==="scroll"||t==="hidden"||t==="overlay"}function tl(t){let e=N(t),n=e.defaultView;if(!n?.getComputedStyle)return null;let i=t;for(;i&&i!==e.body&&i!==e.documentElement;){let o=i.scrollWidth>i.clientWidth,r=i.scrollHeight>i.clientHeight;if(o||r){let a=n.getComputedStyle(i);if(o&&Tr(a.overflowX)||r&&Tr(a.overflowY))return i}if(i.classList.contains(el))return null;i=i.parentElement}return null}function zn(t){let e=xe(t);if(!e||!e.collapsed||!t.contains(e.startContainer))return;let n=tl(t);if(!n||typeof e.getBoundingClientRect!="function")return;let i=e.getBoundingClientRect();if(i.height===0)return;let o=n.getBoundingClientRect();if(n.scrollWidth>n.clientWidth){let r=o.left+n.clientLeft,a=r+n.clientWidth;i.right>a?n.scrollLeft+=i.right-a+Wt:i.left<r&&(n.scrollLeft-=r-i.left+Wt)}if(n.scrollHeight>n.clientHeight){let r=o.top+n.clientTop,a=r+n.clientHeight;i.bottom>a?n.scrollTop+=i.bottom-a+Wt:i.top<r&&(n.scrollTop-=r-i.top+Wt)}}var vr='[contenteditable="false"]',Yn="strong[data-param-id]",Oe;function nl(){if(Oe!==void 0)return Oe;let t=globalThis.Intl.Segmenter;if(!t)return Oe=null,null;try{Oe=new t(void 0,{granularity:"grapheme"})}catch{Oe=null}return Oe??null}function Bt(t,e){let n=t;for(;n&&n!==e;){if(n.nodeType===Node.ELEMENT_NODE&&n.matches(vr))return!0;n=n.parentNode}return!1}function Vt(t){return N(t).createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(e){return Bt(e,t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}})}function Ut(t){let e=Vt(t),n="",i=e.nextNode();for(;i;)n+=i.data,i=e.nextNode();return n}function Qn(t){let e=Vt(t),n=0,i=e.nextNode();for(;i;)n+=i.data.length,i=e.nextNode();return n}function Y(t){let e=fe(t);if(!e)return null;let n=e.node,i=e.offset;if(!t.contains(n))return null;if(n.nodeType===Node.ELEMENT_NODE){let o=n;if(Bt(o,t)&&o!==t)return null;let r=0;for(let a=0;a<i&&a<o.childNodes.length;a++)r+=Xn(o.childNodes[a],t);return r+jn(o,t)}return n.nodeType!==Node.TEXT_NODE||Bt(n,t)?null:jn(n,t)+i}function Xn(t,e){if(t.nodeType===Node.TEXT_NODE)return Bt(t,e)?0:t.data.length;if(t.nodeType!==Node.ELEMENT_NODE)return 0;let n=t;if(n.matches(vr))return 0;let i=0;for(let o of Array.from(n.childNodes))i+=Xn(o,e);return i}function jn(t,e){let n=Vt(e),i=0,o=n.nextNode();for(;o;){if(o===t||t.nodeType===Node.ELEMENT_NODE&&t.contains(o))return i;i+=o.data.length,o=n.nextNode()}return i}function V(t,e){let n=N(t),i=Math.max(0,Math.min(e,Qn(t))),o=Vt(t),r=0,a=null,s=0,l=o.nextNode(),d=null;for(;l;){let u=l.data.length;if(i<r+u){a=l,s=i-r;break}if(i===r+u){let g=o.nextNode();g?(a=g,s=0):(a=l,s=u);break}r+=u,d=l,l=o.nextNode()}let c=n.createRange();if(a){let u=a.parentElement?.closest('strong[data-seg="completed"]');u&&u!==t&&t.contains(u)?s===0?c.setStartBefore(u):s===a.data.length?c.setStartAfter(u):c.setStart(a,s):c.setStart(a,s)}else d?c.setStart(d,d.data.length):c.setStart(t,0);c.collapse(!0),rt(t,c.startContainer,c.startOffset)&&(il(t,c,i),zn(t))}function xr(t,e){if(!t||!e.contains(t))return null;let i=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest(Yn)??null;return i&&e.contains(i)?i:null}function il(t,e,n){let i=xr(fe(t)?.node??null,t);if(i&&i!==xr(e.startContainer,t)){t.dataset.aiaCaretEscapedChip=`${n}:${i.dataset.paramId}`;return}delete t.dataset.aiaCaretEscapedChip}function Er(t,e){let n=t.dataset.aiaCaretEscapedChip;if(!n)return!1;let i=Y(t);return i!==null&&n===`${i}:${e}`}function Pr(t){return ge(t).activeElement===t}function Jn(t,e){if(!e||e.nodeType===void 0)return null;let n=e,i=n.nodeType===Node.ELEMENT_NODE?n:n.parentElement;if(i?.closest("[data-aia-chip-remove]"))return null;let o=i?.closest(Yn);if(!o||!t.contains(o))return null;let r=fe(t);return r&&!r.collapsed?null:o.dataset.paramId??null}function Zn(t,e){let n=null;for(let a of t.querySelectorAll(Yn))if(a.dataset.paramId===e){n=a;break}if(!n)return;let i=jn(n,t),o=i+Xn(n,t),r=Y(t);r!=null&&r>=i&&r<=o||V(t,i)}function ei(t){let e=Y(t);return e==null?!1:e>=Qn(t)}function ti(t,e){if(e<=0)return 0;let n=nl();if(!n)return e-1;let i=t.slice(0,e),o=0;for(let{index:r}of n.segment(i))r<e&&(o=r);return o}var wr="aiaTime",ii=5;var oi=[12,1,2,3,4,5,6,7,8,9,10,11],ri=Array.from({length:60/5},(t,e)=>e*5),ai=["AM","PM"];function ke(t){return(Math.round(t)%1440+1440)%1440}function si(t){let e=ke(t),n=Math.floor(e/60);return{hour:n%12===0?12:n%12,minute:e%60,period:n<12?"AM":"PM"}}function $t(t){let e=t.hour%12+(t.period==="PM"?12:0);return ke(e*60+t.minute)}function Gt(t){let{hour:e,minute:n,period:i}=si(t);return`${e}:${String(n).padStart(2,"0")} ${i}`}function Lr(t){let e=ke(t);return`${String(Math.floor(e/60)).padStart(2,"0")}:${String(e%60).padStart(2,"0")}`}function Me(t){return ke(Math.round(t/5)*5)}function Cr(t,e){return ke(t+e)}var ol=/^(\d{1,2})(?::(\d{2}))?\s*([ap])\.?\s*m?\.?$/i,rl=/^(\d{1,2}):(\d{2})$/;function ni(t){if(!t)return null;let e=t.trim().toLowerCase();if(e==="noon"||e==="midday")return 720;if(e==="midnight")return 0;let n=ol.exec(e);if(n){let o=Number(n[1]),r=n[2]===void 0?0:Number(n[2]);return o<1||o>12||r>59?null:$t({hour:o,minute:r,period:n[3]==="a"?"AM":"PM"})}let i=rl.exec(e);if(i){let o=Number(i[1]),r=Number(i[2]);return o>23||r>59?null:o*60+r}return null}function Ar(t){let e=ni(t.editingText);if(e!=null)return Me(e);let n=(t.options??[]).filter(o=>o.is_tappable).map(o=>ni(o.text)).filter(o=>o!=null);if(n.length>0)return Me(n[Math.floor((n.length-1)/2)]);let i=t.now??new Date;return ke((i.getHours()+1)*60)}function li(t){return{text:Gt(t),is_tappable:!0,kind:null,metadata:{[wr]:Lr(t)}}}var qt=30,Kt=["hour","minute","period"],ci={hour:oi.map(t=>({label:String(t)})),minute:ri.map(t=>({label:String(t).padStart(2,"0")})),period:ai.map(t=>({label:t}))};function di(t){return ci[t]}function zt(t,e){let n=si(Me(e));return t==="hour"?oi.indexOf(n.hour):t==="minute"?ri.indexOf(n.minute):ai.indexOf(n.period)}function jt(t,e,n){let i=ci[t],o=Math.min(Math.max(n,0),i.length-1),r=si(Me(e));return $t(t==="hour"?{...r,hour:oi[o]}:t==="minute"?{...r,minute:ri[o]}:{...r,period:ai[o]})}function ui(t,e){let n=ci[t].length-1;return Math.min(Math.max(Math.round(e/qt),0),n)}function ve(t,e,n=[],i={}){let{rawQuery:o,completedParams:r}=W(t,e);return{query:t.trim(),raw_query:o,completed_params:Ye(r,n),identified_params:je(i.identifiedParams??[]),is_ready:i.isReady??!1,...i.customFields?{custom_fields:i.customFields}:{}}}function Yt(t,e){return t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement?t.selectionStart!=null&&t.selectionStart===t.value.length:t instanceof HTMLElement&&t.hasAttribute("data-aia-input")?ei(t):e?.caretOffset!=null?e.caretOffset>=e.text.length:!1}function mi(t){return t instanceof HTMLElement&&t.hasAttribute("data-aia-input")?Y(t):null}var Qt=class{constructor(e,n){this.store=e;this.ctx=n}handleKeyDown(e){if(e.isComposing||e.keyCode===229)return;let n=this.store.get(),{listboxId:i,getOnSubmit:o}=this.ctx,r=e.target instanceof Node?e.target:null,a=this.getEffectiveColumns(r),s=o(),l=this.getTappableIndices(a);if((e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)&&(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="ArrowLeft"||e.key==="ArrowRight"))return;let d=this.ctx.getOptionsPosition()==="above";if(n.multiSelectView&&n.isDropdownOpen){let c=n.filteredOptions[n.activeDropdownIndex];if(e.key===" "&&!n.optionQuery&&c?.is_tappable){e.preventDefault(),this.ctx.selectOption(c);return}if(e.key==="Enter"){e.preventDefault(),n.multiSelectView.picked.length===0&&c?.is_tappable&&this.ctx.selectOption(c),this.ctx.commitMultiSelect?.();return}}if(!this.handleTimeWheelKey(e,n))switch(e.key){case"ArrowDown":{let c=Yt(e.target,n),u=!!n.editingParam;if(!c&&!u&&n.activeDropdownIndex<0)break;if(n.activeDropdownIndex<0){if(d)break;e.preventDefault();let p=_(n.activeFormatType)?this.dateEntryIndex(n,!1):l[0]??0;if(!n.isDropdownOpen&&n.actionableSuggestions.length>0){this.store.set({pillTapped:!0,activeDropdownIndex:p});break}if(l.length===0)return;this.store.set({activeDropdownIndex:p});break}if(e.preventDefault(),l.length===0)return;if(_(n.activeFormatType)){this.stepDateWeek(n,7);break}if(n.filteredOptions.length>0){let p=Math.floor((n.filteredOptions.length-1)/a);if(Math.floor(n.activeDropdownIndex/a)===p){this.store.set({activeDropdownIndex:-1});break}}let g=l.indexOf(n.activeDropdownIndex),m=g<l.length-1?g+1:0;this.store.set({activeDropdownIndex:l[m]});break}case"ArrowUp":{if(n.activeDropdownIndex<0){if(!d)break;let g=Yt(e.target,n),m=!!n.editingParam;if(!g&&!m)break;e.preventDefault();let p=_(n.activeFormatType)?this.dateEntryIndex(n,!0):this.firstTappableInBottomRow(a)??l[0]??0;if(!n.isDropdownOpen&&n.actionableSuggestions.length>0){this.store.set({pillTapped:!0,activeDropdownIndex:p});break}if(l.length===0)return;this.store.set({activeDropdownIndex:p});break}if(l.length===0)break;if(e.preventDefault(),_(n.activeFormatType)){this.stepDateWeek(n,-7);break}if(n.activeDropdownIndex<a){this.store.set({activeDropdownIndex:-1});break}let c=l.indexOf(n.activeDropdownIndex),u=c>0?c-1:l.length-1;this.store.set({activeDropdownIndex:l[u]});break}case"ArrowRight":{if(n.activeDropdownIndex>=0){if(e.preventDefault(),_(n.activeFormatType)){this.stepDateDay(n,1);break}if(n.activeDropdownIndex%a<a-1){let g=n.activeDropdownIndex+1;g<n.filteredOptions.length&&n.filteredOptions[g]?.is_tappable&&this.store.set({activeDropdownIndex:g})}break}if(n.editingParam&&e.target instanceof HTMLElement&&n.editingTail!=null){e.preventDefault();let u=e.target.closest("[data-aia-input]")??e.target,g=n.editingTail;this.ctx.exitEditMode?.(),V(u,g);break}Yt(e.target,n)&&n.actionableSuggestions.length>=1&&(e.preventDefault(),this.ctx.skipActivePill());break}case"ArrowLeft":{if(n.activeDropdownIndex>=0){if(e.preventDefault(),_(n.activeFormatType)){this.stepDateDay(n,-1);break}if(n.activeDropdownIndex%a>0){let c=n.activeDropdownIndex-1;c>=0&&n.filteredOptions[c]?.is_tappable&&this.store.set({activeDropdownIndex:c});break}if(!n.editingParam&&this.ctx.startEditingParamAtCaret){let c=mi(e.target);c!=null&&this.ctx.startEditingParamAtCaret(c)}break}if(n.editingParam&&e.target instanceof HTMLElement&&n.editingAnchor!=null){e.preventDefault();let c=e.target.closest("[data-aia-input]")??e.target,u=n.editingAnchor;this.ctx.exitEditMode?.(),V(c,u);break}if(this.ctx.startEditingParamAtCaret){let c=mi(e.target);c!=null&&this.ctx.startEditingParamAtCaret(c)&&e.preventDefault()}break}case"Backspace":{if(n.editingParam||!this.ctx.removeParamAtCaret)break;let c=mi(e.target);if(c==null)break;this.ctx.removeParamAtCaret(c)&&e.preventDefault();break}case"Enter":{if(e.preventDefault(),n.activeDropdownIndex>=0&&n.filteredOptions[n.activeDropdownIndex]?.is_tappable)this.clickOrSelect(n.activeDropdownIndex,n.filteredOptions,i,r);else if(s){this.ctx.endTypedWord?.(!0);let c=this.store.get();s(ve(c.text,c.completedParams,c.skippedParams,{identifiedParams:c.identifiedParams,isReady:c.isReady,customFields:c.customFields}))&&this.ctx.afterSubmit?.()}break}case"Tab":{if(this.ctx.endTypedWord?.()){e.preventDefault();break}let c=n.filteredOptions.map((m,p)=>m.is_tappable?p:-1).filter(m=>m!==-1);if(c.length===0)break;if(!n.isDropdownOpen){if(n.actionableSuggestions.length===0)break;e.preventDefault();let m=e.shiftKey?c[c.length-1]:c[0];this.store.set({pillTapped:!0,activeDropdownIndex:m});break}e.preventDefault();let u=c.indexOf(n.activeDropdownIndex);if(!e.shiftKey&&!_(n.activeFormatType)&&!n.multiSelectView){let m=u>=0?c[u]:c.find(p=>!n.filteredOptions[p]?.selectsAll);if(m===void 0)break;this.clickOrSelect(m,n.filteredOptions,i,r);break}let g;if(u<0)g=e.shiftKey?c.length-1:0;else{let m=e.shiftKey?-1:1;g=(u+m+c.length)%c.length}this.store.set({activeDropdownIndex:c[g]});break}case"Escape":{if(n.dateRangeStart){this.store.set({pendingRangeStart:null});break}if(n.editingIdentified){this.ctx.exitEditingIdentified?.(),this.store.set({activeDropdownIndex:-1});break}if(n.editingParam&&e.target instanceof HTMLElement&&n.editingTail!=null){let c=e.target.closest("[data-aia-input]")??e.target,u=n.editingTail;this.ctx.exitEditMode?.(),V(c,u)}this.store.set({activeDropdownIndex:-1});break}}}handleTimeWheelKey(e,n){let i=n.timeView;if(n.activeFormatType!=="time"||!i||!n.isDropdownOpen)return!1;switch(e.key){case"ArrowDown":case"ArrowUp":return!Yt(e.target,n)&&!n.editingParam?!1:(e.preventDefault(),this.ctx.stepTime?.(e.key==="ArrowDown"?5:-5),!0);case"Enter":return i.touched?(e.preventDefault(),this.ctx.commitTime?.(),!0):!1;case"Escape":return i.touched?(this.store.set({timeDraft:null}),!0):!1;default:return!1}}firstTappableInBottomRow(e){let n=this.store.get();if(n.filteredOptions.length===0)return null;let o=Math.floor((n.filteredOptions.length-1)/e)*e;for(let r=o;r<n.filteredOptions.length;r++)if(n.filteredOptions[r]?.is_tappable)return r;return null}dateEntryIndex(e,n){if(e.dateFloor){let a=e.filteredOptions.findIndex(s=>j(s)===e.dateFloor);if(a>=0)return a}let i=B(new Date),o=e.filteredOptions.findIndex(a=>j(a)===i);if(o>=0)return o;let r=e.filteredOptions.map((a,s)=>a.is_tappable?s:-1).filter(a=>a!==-1);return(n?r[r.length-1]:r[0])??0}stepDateDay(e,n){for(let i=e.activeDropdownIndex+n;i>=0&&i<e.filteredOptions.length;i+=n)if(e.filteredOptions[i]?.is_tappable){this.store.set({activeDropdownIndex:i});return}}stepDateWeek(e,n){let i=e.activeDropdownIndex+n;this.store.set({activeDropdownIndex:e.filteredOptions[i]?.is_tappable?i:-1})}getTappableIndices(e){let i=this.store.get().filteredOptions.map((r,a)=>r.is_tappable?a:-1).filter(r=>r!==-1),o=Array.from({length:e},()=>[]);for(let r of i)o[r%e].push(r);return o.flat()}getEffectiveColumns(e){let n=Ft(e,this.ctx.listboxId);if(!n)return this.store.get().multiSelectView?1:this.ctx.columns;let o=Ft(e,`${this.ctx.listboxId}-option-0`)?.parentElement??null;for(;o;){let r=getComputedStyle(o).gridTemplateColumns;if(r&&r!=="none"){let a=r.split(" ").filter(Boolean).length;if(a>0)return a}if(o===n)break;o=o.parentElement}return this.ctx.columns}clickOrSelect(e,n,i,o){let r=Ft(o,`${i}-option-${e}`);r?r.click():this.ctx.selectOption(n[e])}};var Xt=class{constructor(e,n,i={}){this.store=e;this.getOverrides=n;this.callbacks=i;this.unsubscribe=null;this.current=null;this.version=0;this.lastMiss=null;this.hasLoggedError=!1}start(){this.unsubscribe=this.store.subscribe(e=>this.sync(e)),this.sync(this.store.get())}dispose(){this.unsubscribe?.(),this.unsubscribe=null,this.cancel(),this.current=null}reset(){this.cancel(),this.current=null,this.lastMiss=null}refresh(){this.reset(),this.sync(this.store.get())}hasOverride(e){return!!this.getOverrides()?.[e]}owns(e,n){return this.hasOverride(e)&&!this.missCovers(e,n)}tick(e,n){let i=this.resolveTarget(e);if(!i||this.missCovers(i.parameter,i.query))return"no";let o=this.current;if(o&&o.key===i.key){if(o.query===i.query)return"owns";let r=Math.abs(i.query.length-o.query.length),a=i.query.length<o.query.length;if(n>1&&!a&&r<n)return"owns"}return this.ask(i),"asked"}sync(e){let n=this.resolveTarget(e);if(!n){this.current&&(this.cancel(),this.current=null),e.optionSearch&&this.store.set({optionSearch:null});return}this.current&&this.current.key===n.key||this.ask(n)}resolveTarget(e){if(H(e.activeFormatType)||e.editingIdentified)return null;let n=e.editingParam;if(n&&e.editingAnchor!=null)return this.hasOverride(n.suggestionParameter)?{mode:"edit",key:n.id,parameter:n.suggestionParameter,suggestion:{parameter:n.suggestionParameter,text:n.suggestionPlaceholder,required:!0,options:n.options,icon:n.suggestionIcon,icon_svg:n.suggestionIconSvg},query:e.optionQuery}:null;let i=e.actionableSuggestions[0];return!i||!this.hasOverride(i.parameter)?null:{mode:"pill",key:i,parameter:i.parameter,suggestion:i,query:e.optionQuery}}missCovers(e,n){return this.lastMiss!=null&&this.lastMiss.parameter===e&&this.lastMiss.query===n}ask(e){this.cancel();let n=this.getOverrides()?.[e.parameter],i=++this.version;if(!n||this.missCovers(e.parameter,e.query)){this.current={key:e.key,parameter:e.parameter,query:e.query,abort:null},this.setSearch(e,"done");return}let o=new AbortController;this.current={key:e.key,parameter:e.parameter,query:e.query,abort:o};let r;try{r=n(e.query,o.signal,e.suggestion)}catch(a){this.logOnce(a),this.commit(e,[],i);return}if(Array.isArray(r)){this.commit(e,r,i);return}this.setSearch(e,"loading"),this.await(e,r,o.signal,i)}async await(e,n,i,o){let r;try{let a=await n;if(i.aborted||o!==this.version)return;r=Array.isArray(a)?a:[]}catch(a){if(i.aborted||o!==this.version||al(a))return;this.logOnce(a),r=[]}this.commit(e,r,o)}commit(e,n,i){if(i!==this.version)return;let o=nr(n,e.suggestion),r=this.resolveTarget(this.store.get());if(!r||r.key!==e.key)return;o.length===0?this.lastMiss={parameter:e.parameter,query:e.query}:this.lastMiss?.parameter===e.parameter&&(this.lastMiss=null);let a={parameter:e.parameter,query:e.query,status:"done"};if(e.mode==="edit")this.store.set(s=>({editingParam:s.editingParam&&s.editingParam.id===e.key?{...s.editingParam,options:o}:s.editingParam,optionSearch:a}));else{let s={...e.suggestion,options:o};this.current&&this.current.key===e.key&&(this.current.key=s),this.store.set(l=>({suggestions:l.suggestions.map(d=>d===e.suggestion?s:d),optionSearch:a}))}o.length===0?this.callbacks.onMiss?.(e.mode,e.query):this.callbacks.onAnswer?.(e.mode,e.query)}setSearch(e,n){let i=this.store.get().optionSearch;i&&i.parameter===e.parameter&&i.query===e.query&&i.status===n||this.store.set({optionSearch:{parameter:e.parameter,query:e.query,status:n}})}cancel(){this.current?.abort?.abort(),this.version++}logOnce(e){this.hasLoggedError||(this.hasLoggedError=!0,console.warn("[AIAutocomplete] an optionOverrides entry threw or rejected \u2014 treated as no options. Later failures on this instance are not logged.",e))}};function al(t){return t instanceof Error&&t.name==="AbortError"}var Jt=class{constructor(e,n={}){this.store=e;this.callbacks=n}setActivePill(e){let n=this.store.get(),i=n.suggestions.filter(d=>d.parameter!=="placeholder");if(e<0||e>=i.length)return;let o=i[e];if(C(o))return;let r=i.filter((d,c)=>c!==e),a=n.suggestions.filter(d=>d.parameter==="placeholder");if(this.callbacks.onPillSelected){let{rawQuery:d}=W(n.text,n.completedParams);this.callbacks.onPillSelected({rawQuery:d,selectedPill:o.text,otherPills:r.map(c=>c.text)})}let s=[...a,o,...r],l=this.store.peek({suggestions:s}).filteredOptions.findIndex(d=>d.is_tappable&&!d.selectsAll);this.store.set({suggestions:s,pillTapped:!0,activeDropdownIndex:l})}removeLastParam(){this.store.get().completedParams.length!==0&&this.store.set(n=>({completedParams:n.completedParams.slice(0,-1),activeDropdownIndex:-1}))}};var Mr="/products/",Ir="https://relative.invalid";function sl(t){if(!t)return;let e;try{e=new URL(t,`${Ir}/`)}catch{return}if(!(e.protocol!=="http:"&&e.protocol!=="https:"))return t.startsWith("/")?e.origin===Ir?t:void 0:/^https?:\/\//i.test(t)?t:void 0}function kr(t,e){let n=sl(t.item_url)??cl(t);return{id:t.source_id,title:t.title,...n&&{url:n},imageUrl:t.image_url||null,...t.price&&{price:Or(t.price,t.currency,e)},...ll(t)&&{compareAtPrice:Or(t.compare_at_price,t.currency,e)},...t.vendor&&{vendor:t.vendor},...typeof t.available=="boolean"&&{available:t.available}}}function ll(t){if(!t.price||!t.compare_at_price)return!1;let e=Number(t.price),n=Number(t.compare_at_price);return Number.isFinite(e)&&Number.isFinite(n)&&n>e}function Or(t,e,n){if(n===void 0||!e||!/^\d+(\.\d+)?$/.test(t))return t;try{return new Intl.NumberFormat(n,{style:"currency",currency:e}).format(Number(t))}catch{return t}}function cl(t){if(!t.handle)return;let e=`${Mr}${encodeURIComponent(t.handle)}`;return t.variant_id?`${e}?variant=${encodeURIComponent(t.variant_id)}`:e}function pi(t,e){return(t?.items.matched??[]).map(n=>kr(n,e))}var Zt=class{constructor(e,n,i=()=>!0,o=()=>{},r=()=>{}){this.store=e;this.getConfig=n;this.isEnabled=i;this.getLanguage=o;this.getMapper=r;this.hasLoggedError=!1;this.hasLoggedMapperError=!1}forResponse(e){if(!this.isEnabled())return[];if(this.getConfig())return;let n=pi(e,ue(this.getLanguage())),i=this.getMapper();if(!i)return n;try{let o=i(n,e?.items.matched??[]);if(Array.isArray(o))return o}catch(o){this.hasLoggedMapperError||(this.hasLoggedMapperError=!0,console.warn("[AIAutocomplete] mapProducts failed. The original cards are shown.",o))}return n}async run(e,n,i){if(!this.isEnabled())return;let o=this.getConfig();if(!o)return;if(e.trim().length===0){this.clear(i);return}let r=()=>n.aborted||!i()||!this.owns(o);try{let a=await o.fetch(e,n);if(r())return;let s=o.transform(a),l=Array.isArray(s)?s:[],d=o.limit!=null?l.slice(0,o.limit):l;if(r())return;this.commit(d)}catch(a){if(n.aborted||dl(a)||(this.logOnce(a),r()))return;this.clear(i)}}owns(e){return this.isEnabled()&&this.getConfig()===e}resync(){let e=this.forResponse(this.store.get().customFields);this.commit(e??[])}refresh(){if(this.getConfig())return;let e=this.forResponse(this.store.get().customFields);e!==void 0&&this.commit(e)}clear(e){e()&&this.commit([])}commit(e){e.length===0&&this.store.get().products.length===0||this.store.set({products:e})}logOnce(e){this.hasLoggedError||(this.hasLoggedError=!0,console.warn("[AIAutocomplete] products.fetch/transform failed \u2014 the product strip is hidden. Later failures on this instance are not logged.",e))}};function dl(t){return t instanceof Error&&t.name==="AbortError"}function ul(t){return t.replace(/(\d+)(?:st|nd|rd|th)\b/g,"$1")}function Rr(t){let e=t.toLowerCase().replace(/\.$/,"");return e.length<3?-1:Ae.findIndex(n=>n.toLowerCase().startsWith(e))}function ml(t,e,n){let i=new Date(n.getFullYear(),t,e);if(i.getMonth()!==t||i.getDate()!==e)return null;let o=new Date(n.getFullYear(),n.getMonth(),n.getDate());if(i>=o)return i;let r=new Date(n.getFullYear()+1,t,e);return r.getMonth()===t&&r.getDate()===e?r:null}var pl=/^(?:(?:on|from) )?(?:the )?(\d{1,2})(?:st|nd|rd|th)$/;function gi(t){let e=pl.exec(t.trim().toLowerCase().replace(/\s+/g," "));if(!e)return null;let n=Number(e[1]);return n>=1&&n<=31?n:null}function gl(t,e){if(!Number.isFinite(e.getTime()))return null;let n=new Date(e.getFullYear(),e.getMonth(),e.getDate());for(let i=0;i<12;i++){let o=new Date(e.getFullYear(),e.getMonth()+i,t);if(o.getDate()===t&&o>=n)return o}return null}function _r(t,e,n){let i=new Date(t,e,n);return i.getMonth()===e&&i.getDate()===n?i:null}function Re(t,e={}){if(!t)return null;let n=e.today??new Date,i=gi(t);if(i!==null){let d=gl(i,n);return d?B(d):null}let o=ul(t.trim().toLowerCase()).replace(/\s+/g," "),r=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(o);if(r){let d=_r(Number(r[1]),Number(r[2])-1,Number(r[3]));return d?B(d):null}let a=/^([a-z]+)\.? (\d{1,2})(?:,? (\d{4}))?$/.exec(o);if(a){let d=Rr(a[1]);if(d>=0)return en(d,Number(a[2]),a[3],n)}let s=/^(\d{1,2}) (?:of )?([a-z]+)\.?(?:,? (\d{4}))?$/.exec(o);if(s){let d=Rr(s[2]);if(d>=0)return en(d,Number(s[1]),s[3],n)}let l=/^(\d{1,2})[/\-.](\d{1,2})(?:[/\-.](\d{2,4}))?$/.exec(o);if(l){let d=Number(l[1]),c=Number(l[2]);return d>12&&c<=12?en(c-1,d,l[3],n):c>12&&d<=12?en(d-1,c,l[3],n):null}return null}function en(t,e,n,i){if(n){if(n.length!==4)return null;let r=_r(Number(n),t,e);return r?B(r):null}let o=ml(t,e,i);return o?B(o):null}var fl=/^\d{4}-\d{2}-\d{2}$/;function at(t){return typeof t=="string"&&fl.test(t)?t:null}function fi(t,e={}){return at(t.isoDate)??Re(t.text,e)}function st(t){let e=at(t.isoDate);return e?{start:e,end:at(t.isoDateEnd)}:null}var Dr=" - ",Si="aiaDateRangeStart",yi="aiaDateRangeEnd";function lt(t,e){return t<=e?{start:t,end:e}:{start:e,end:t}}var hi=/^\d{4}-\d{2}-\d{2}$/;function bi(t){if(!hi.test(t))return null;let[e,n,i]=t.split("-").map(Number),o=new Date(e,n-1,i);return o.getMonth()===n-1&&o.getDate()===i?o:null}var hl=/\s+(?:to|through|thru|until|til|till)\s+/g,bl=/[-–—]/g;function Sl(t){let e=[];for(let n of[hl,bl]){n.lastIndex=0;let i=n.exec(t);for(;i!==null;)e.push([t.slice(0,i.index),t.slice(i.index+i[0].length)]),i=n.exec(t)}return e}function tn(t,e={}){if(!t)return null;let n=new Set,i=null;for(let[o,r]of Sl(t.trim())){let a=Re(o.trim(),e);if(!a)continue;let s=gi(r)!==null?Re(r.trim(),{...e,today:bi(a)??e.today}):Re(r.trim(),e);!s||s<a||(n.add(`${a}|${s}`),i={start:a,end:s})}return n.size===1?i:null}function Hr(t){let e=bi(t.start),n=bi(t.end);return!e||!n?"":t.start===t.end?Ie(e):`${Ie(e)}${Dr}${Ie(n)}`}function Nr(t,e){let n=lt(t,e);return{text:Hr(n),is_tappable:!0,kind:null,metadata:{[Si]:n.start,[yi]:n.end}}}function _e(t,e={}){let n=t?.metadata?.[Si],i=t?.metadata?.[yi];return typeof n=="string"&&typeof i=="string"&&hi.test(n)&&hi.test(i)?lt(n,i):tn(t?.text,e)}var nn="(max-width: 768px)";var yl="var(--aia-option-row-height, 37px)",Tl="var(--aia-grid-scroll-top, 0px) + var(--aia-grid-scroll-bottom, 0px)";function Fr(t,e){return e?Ti(1,Math.min(t,5)):Ti(1,Math.min(t,4))}function Ti(t,e){return{cols:t,rows:e,maxHeight:`calc(${e} * ${yl} + ${Tl})`}}function vi(t,e){return!e&&t>=5}function Ei(t,e,n,i){if(!(!e&&t>=5&&xl(n,i))){let a=Fr(t,e);return{...a,template:xi(a.cols),scrollHintIndices:!e&&t>a.rows?[a.rows-1]:[]}}let r=6;return{...Ti(2,3),template:xi(2),scrollHintIndices:t>r?[r-2,r-1]:[]}}function xl(t,e){return!t||t.length===0||e==null||e<=0||t.some(i=>i<=0)?!1:Math.ceil(Math.max(...t))*2<=e}function ct(t){if(typeof document>"u")return null;let e=Array.from(t.querySelectorAll("[data-aia-option]"));if(e.length===0)return null;let n=document.createElement("div");n.style.cssText="position:absolute;visibility:hidden;left:-9999px;top:0;";for(let a of e){let s=a.cloneNode(!0);s.removeAttribute("id"),s.removeAttribute("role"),s.removeAttribute("aria-selected"),s.style.whiteSpace="nowrap",s.style.width="max-content",n.appendChild(s)}t.appendChild(n);let i=Array.from(n.children).map(a=>a.offsetWidth);n.remove();let o=getComputedStyle(t),r=t.clientWidth-(Number.parseFloat(o.paddingLeft)||0)-(Number.parseFloat(o.paddingRight)||0)-(Number.parseFloat(o.columnGap)||0)+vl(t);return{rowWidths:i,gridWidth:r}}function vl(t){let e=t.closest("[data-aia-dropdown]"),n=Number.parseFloat(e?.getAttribute(on)??"");if(!e||!Number.isFinite(n)||e.style.getPropertyValue(dt)!=="")return 0;let i=e.getBoundingClientRect().width;return i>0?n-i:0}var on="data-aia-glide-width",dt="--aia-glide-content-width";function xi(t){return Array.from({length:t},()=>"minmax(0,1fr)").join(" ")}function ut(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(nn).matches}function Pi(t,e){return!t||t.length!==e.length?!1:t.every((n,i)=>n.text===e[i].text)}var Wr={language:"en",and:"and",proceed:"to proceed",select:"to select",skipHint:"to skip",skip:"skip",skipLabel:"Skip",products:"Items",soldOut:"Sold out",addToCart:"Add to cart",submit:"Submit",seeAllResults:"See all results",scrollArrow:"Scroll down for more options",keepTyping:"Keep typing",done:"Done",allOption:"All",timeLabel:"Time",locationSearch:"Say a location",locationNoResults:"No places found",locationUseTyped:"Press Enter to use what you typed"},El={language:"es",and:"y",proceed:"para continuar",select:"para seleccionar",skipHint:"para omitir",skip:"omitir",skipLabel:"Omitir",products:"Mejor coincidencia",soldOut:"Agotado",addToCart:"A\xF1adir al carrito",submit:"Buscar",seeAllResults:"Ver todos los resultados",scrollArrow:"Despl\xE1zate para ver m\xE1s opciones",keepTyping:"Sigue escribiendo",done:"Listo",allOption:"Todo",timeLabel:"Hora",locationSearch:"Di una ubicaci\xF3n",locationNoResults:"No se encontraron lugares",locationUseTyped:"Pulsa Intro para usar lo que escribiste"},wi={en:Wr,es:El,fr:{language:"fr",and:"et",proceed:"pour continuer",select:"pour s\xE9lectionner",skipHint:"pour passer",skip:"passer",skipLabel:"Passer",products:"Meilleure correspondance",soldOut:"\xC9puis\xE9",addToCart:"Ajouter au panier",submit:"Rechercher",seeAllResults:"Voir tous les r\xE9sultats",scrollArrow:"Faites d\xE9filer pour voir plus d\u2019options",keepTyping:"Continuez \xE0 taper",done:"Termin\xE9",allOption:"Tout",timeLabel:"Heure",locationSearch:"Dites un lieu",locationNoResults:"Aucun lieu trouv\xE9",locationUseTyped:"Appuyez sur Entr\xE9e pour utiliser votre saisie"},"pt-BR":{language:"pt-BR",and:"e",proceed:"para continuar",select:"para selecionar",skipHint:"para pular",skip:"pular",skipLabel:"Pular",products:"Melhor correspond\xEAncia",soldOut:"Esgotado",addToCart:"Adicionar ao carrinho",submit:"Buscar",seeAllResults:"Ver todos os resultados",scrollArrow:"Role para ver mais op\xE7\xF5es",keepTyping:"Continue digitando",done:"Conclu\xEDdo",allOption:"Tudo",timeLabel:"Hor\xE1rio",locationSearch:"Diga um local",locationNoResults:"Nenhum lugar encontrado",locationUseTyped:"Pressione Enter para usar o que voc\xEA digitou"},it:{language:"it",and:"e",proceed:"per continuare",select:"per selezionare",skipHint:"per saltare",skip:"salta",skipLabel:"Salta",products:"Migliore corrispondenza",soldOut:"Esaurito",addToCart:"Aggiungi al carrello",submit:"Cerca",seeAllResults:"Vedi tutti i risultati",scrollArrow:"Scorri per vedere altre opzioni",keepTyping:"Continua a scrivere",done:"Fatto",allOption:"Tutto",timeLabel:"Ora",locationSearch:"Di' un luogo",locationNoResults:"Nessun luogo trovato",locationUseTyped:"Premi Invio per usare ci\xF2 che hai scritto"},tr:{language:"tr",and:"ve",proceed:"devam etmek i\xE7in",select:"se\xE7mek i\xE7in",skipHint:"atlamak i\xE7in",skip:"atla",skipLabel:"Atla",products:"En iyi e\u015Fle\u015Fme",soldOut:"T\xFCkendi",addToCart:"Sepete ekle",submit:"Ara",seeAllResults:"T\xFCm sonu\xE7lar\u0131 g\xF6r",scrollArrow:"Daha fazla se\xE7enek i\xE7in kayd\u0131r",keepTyping:"Yazmaya devam et",done:"Tamam",allOption:"T\xFCm\xFC",timeLabel:"Saat",locationSearch:"Bir konum s\xF6yleyin",locationNoResults:"Yer bulunamad\u0131",locationUseTyped:"Yazd\u0131\u011F\u0131n\u0131z\u0131 kullanmak i\xE7in Enter'a bas\u0131n"},id:{language:"id",and:"dan",proceed:"untuk melanjutkan",select:"untuk memilih",skipHint:"untuk melewati",skip:"lewati",skipLabel:"Lewati",products:"Paling cocok",soldOut:"Habis",addToCart:"Tambah ke keranjang",submit:"Cari",seeAllResults:"Lihat semua hasil",scrollArrow:"Gulir untuk melihat opsi lainnya",keepTyping:"Teruskan mengetik",done:"Selesai",allOption:"Semua",timeLabel:"Waktu",locationSearch:"Sebutkan lokasi",locationNoResults:"Tempat tidak ditemukan",locationUseTyped:"Tekan Enter untuk memakai yang Anda ketik"},pl:{language:"pl",and:"i",proceed:"aby kontynuowa\u0107",select:"aby wybra\u0107",skipHint:"aby pomin\u0105\u0107",skip:"pomi\u0144",skipLabel:"Pomi\u0144",products:"Najlepsze dopasowanie",soldOut:"Wyprzedane",addToCart:"Dodaj do koszyka",submit:"Szukaj",seeAllResults:"Zobacz wszystkie wyniki",scrollArrow:"Przewi\u0144, aby zobaczy\u0107 wi\u0119cej opcji",keepTyping:"Pisz dalej",done:"Gotowe",allOption:"Wszystko",timeLabel:"Godzina",locationSearch:"Podaj lokalizacj\u0119",locationNoResults:"Nie znaleziono miejsc",locationUseTyped:"Naci\u015Bnij Enter, aby u\u017Cy\u0107 wpisanego tekstu"},de:{language:"de",and:"und",proceed:"zum Fortfahren",select:"zum Ausw\xE4hlen",skipHint:"zum \xDCberspringen",skip:"\xFCberspringen",skipLabel:"\xDCberspringen",products:"Beste Treffer",soldOut:"Ausverkauft",addToCart:"In den Warenkorb",submit:"Suchen",seeAllResults:"Alle Ergebnisse anzeigen",scrollArrow:"Scrolle f\xFCr weitere Optionen",keepTyping:"Weitertippen",done:"Fertig",allOption:"Alle",timeLabel:"Uhrzeit",locationSearch:"Nenne einen Ort",locationNoResults:"Keine Orte gefunden",locationUseTyped:"Dr\xFCcke Enter, um deine Eingabe zu verwenden"},nl:{language:"nl",and:"en",proceed:"om door te gaan",select:"om te selecteren",skipHint:"om over te slaan",skip:"overslaan",skipLabel:"Overslaan",products:"Beste match",soldOut:"Uitverkocht",addToCart:"In winkelwagen",submit:"Zoeken",seeAllResults:"Alle resultaten bekijken",scrollArrow:"Scrol voor meer opties",keepTyping:"Blijf typen",done:"Klaar",allOption:"Alles",timeLabel:"Tijd",locationSearch:"Noem een locatie",locationNoResults:"Geen plaatsen gevonden",locationUseTyped:"Druk op Enter om je invoer te gebruiken"},sv:{language:"sv",and:"och",proceed:"f\xF6r att forts\xE4tta",select:"f\xF6r att v\xE4lja",skipHint:"f\xF6r att hoppa \xF6ver",skip:"hoppa \xF6ver",skipLabel:"Hoppa \xF6ver",products:"B\xE4sta matchning",soldOut:"Sluts\xE5ld",addToCart:"L\xE4gg i varukorgen",submit:"S\xF6k",seeAllResults:"Visa alla resultat",scrollArrow:"Skrolla f\xF6r fler alternativ",keepTyping:"Forts\xE4tt skriva",done:"Klar",allOption:"Alla",timeLabel:"Tid",locationSearch:"S\xE4g en plats",locationNoResults:"Inga platser hittades",locationUseTyped:"Tryck p\xE5 Enter f\xF6r att anv\xE4nda det du skrev"},nb:{language:"nb",and:"og",proceed:"for \xE5 fortsette",select:"for \xE5 velge",skipHint:"for \xE5 hoppe over",skip:"hopp over",skipLabel:"Hopp over",products:"Beste treff",soldOut:"Utsolgt",addToCart:"Legg i handlekurven",submit:"S\xF8k",seeAllResults:"Se alle resultater",scrollArrow:"Rull ned for \xE5 se flere alternativer",keepTyping:"Fortsett \xE5 skrive",done:"Ferdig",allOption:"Alle",timeLabel:"Tid",locationSearch:"Si et sted",locationNoResults:"Fant ingen steder",locationUseTyped:"Trykk Enter for \xE5 bruke det du skrev"},da:{language:"da",and:"og",proceed:"for at forts\xE6tte",select:"for at v\xE6lge",skipHint:"for at springe over",skip:"spring over",skipLabel:"Spring over",products:"Bedste match",soldOut:"Udsolgt",addToCart:"L\xE6g i kurv",submit:"S\xF8g",seeAllResults:"Se alle resultater",scrollArrow:"Rul for flere muligheder",keepTyping:"Forts\xE6t med at skrive",done:"F\xE6rdig",allOption:"Alle",timeLabel:"Tidspunkt",locationSearch:"Sig et sted",locationNoResults:"Ingen steder fundet",locationUseTyped:"Tryk p\xE5 Enter for at bruge det, du skrev"},fi:{language:"fi",and:"ja",proceed:"jatkaaksesi",select:"valitaksesi",skipHint:"ohittaaksesi",skip:"ohita",skipLabel:"Ohita",products:"Paras vastaavuus",soldOut:"Loppuunmyyty",addToCart:"Lis\xE4\xE4 ostoskoriin",submit:"Hae",seeAllResults:"N\xE4yt\xE4 kaikki tulokset",scrollArrow:"Vierit\xE4 n\xE4hd\xE4ksesi lis\xE4\xE4 vaihtoehtoja",keepTyping:"Jatka kirjoittamista",done:"Valmis",allOption:"Kaikki",timeLabel:"Aika",locationSearch:"Sano sijainti",locationNoResults:"Paikkoja ei l\xF6ytynyt",locationUseTyped:"Paina Enteri\xE4 k\xE4ytt\xE4\xE4ksesi kirjoittamaasi"},ja:{language:"ja",and:"\u3068",proceed:"\u3067\u6B21\u3078",select:"\u3067\u9078\u629E",skipHint:"\u3067\u30B9\u30AD\u30C3\u30D7",skip:"\u30B9\u30AD\u30C3\u30D7",skipLabel:"\u30B9\u30AD\u30C3\u30D7",products:"\u30D9\u30B9\u30C8\u30DE\u30C3\u30C1",soldOut:"\u58F2\u308A\u5207\u308C",addToCart:"\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0",submit:"\u691C\u7D22",seeAllResults:"\u3059\u3079\u3066\u306E\u7D50\u679C\u3092\u898B\u308B",scrollArrow:"\u30B9\u30AF\u30ED\u30FC\u30EB\u3057\u3066\u4ED6\u306E\u5019\u88DC\u3092\u898B\u308B",keepTyping:"\u5165\u529B\u3092\u7D9A\u3051\u308B",done:"\u5B8C\u4E86",allOption:"\u3059\u3079\u3066",timeLabel:"\u6642\u523B",locationSearch:"\u5834\u6240\u3092\u8A00\u3063\u3066\u304F\u3060\u3055\u3044",locationNoResults:"\u5834\u6240\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",locationUseTyped:"\u5165\u529B\u3057\u305F\u5185\u5BB9\u3092\u4F7F\u3046\u306B\u306F Enter \u3092\u62BC\u3057\u3066\u304F\u3060\u3055\u3044"},ko:{language:"ko",and:"\uBC0F",proceed:"\uACC4\uC18D",select:"\uC120\uD0DD",skipHint:"\uAC74\uB108\uB6F0\uAE30",skip:"\uAC74\uB108\uB6F0\uAE30",skipLabel:"\uAC74\uB108\uB6F0\uAE30",products:"\uCD94\uCC9C \uC0C1\uD488",soldOut:"\uD488\uC808",addToCart:"\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uB2F4\uAE30",submit:"\uAC80\uC0C9",seeAllResults:"\uBAA8\uB4E0 \uACB0\uACFC \uBCF4\uAE30",scrollArrow:"\uB354 \uB9CE\uC740 \uC635\uC158\uC744 \uBCF4\uB824\uBA74 \uC2A4\uD06C\uB864\uD558\uC138\uC694",keepTyping:"\uACC4\uC18D \uC785\uB825\uD558\uC138\uC694",done:"\uC644\uB8CC",allOption:"\uC804\uCCB4",timeLabel:"\uC2DC\uAC04",locationSearch:"\uC704\uCE58\uB97C \uB9D0\uD558\uC138\uC694",locationNoResults:"\uC7A5\uC18C\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4",locationUseTyped:"\uC785\uB825\uD55C \uB0B4\uC6A9\uC744 \uC0AC\uC6A9\uD558\uB824\uBA74 Enter\uB97C \uB204\uB974\uC138\uC694"},"zh-CN":{language:"zh-CN",and:"\u548C",proceed:"\u7EE7\u7EED",select:"\u9009\u62E9",skipHint:"\u8DF3\u8FC7",skip:"\u8DF3\u8FC7",skipLabel:"\u8DF3\u8FC7",products:"\u6700\u4F73\u5339\u914D",soldOut:"\u552E\u7F44",addToCart:"\u52A0\u5165\u8D2D\u7269\u8F66",submit:"\u641C\u7D22",seeAllResults:"\u67E5\u770B\u5168\u90E8\u7ED3\u679C",scrollArrow:"\u5411\u4E0B\u6EDA\u52A8\u67E5\u770B\u66F4\u591A\u9009\u9879",keepTyping:"\u7EE7\u7EED\u8F93\u5165",done:"\u5B8C\u6210",allOption:"\u5168\u90E8",timeLabel:"\u65F6\u95F4",locationSearch:"\u8BF4\u51FA\u5730\u70B9",locationNoResults:"\u672A\u627E\u5230\u5730\u70B9",locationUseTyped:"\u6309 Enter \u4F7F\u7528\u4F60\u8F93\u5165\u7684\u5185\u5BB9"},"zh-TW":{language:"zh-TW",and:"\u548C",proceed:"\u7E7C\u7E8C",select:"\u9078\u64C7",skipHint:"\u7565\u904E",skip:"\u7565\u904E",skipLabel:"\u7565\u904E",products:"\u6700\u4F73\u5339\u914D",soldOut:"\u552E\u5B8C",addToCart:"\u52A0\u5165\u8CFC\u7269\u8ECA",submit:"\u641C\u5C0B",seeAllResults:"\u67E5\u770B\u5168\u90E8\u7D50\u679C",scrollArrow:"\u5411\u4E0B\u6372\u52D5\u67E5\u770B\u66F4\u591A\u9078\u9805",keepTyping:"\u7E7C\u7E8C\u8F38\u5165",done:"\u5B8C\u6210",allOption:"\u5168\u90E8",timeLabel:"\u6642\u9593",locationSearch:"\u8AAA\u51FA\u5730\u9EDE",locationNoResults:"\u627E\u4E0D\u5230\u5730\u9EDE",locationUseTyped:"\u6309 Enter \u4F7F\u7528\u4F60\u8F38\u5165\u7684\u5167\u5BB9"}},Pl={pt:"pt-BR",no:"nb",nn:"nb"};function k(t){let[e,...n]=t?.toLowerCase().split("-")??[];if(e==="zh"){let o=n.some(r=>["hant","tw","hk","mo"].includes(r));return wi[o?"zh-TW":"zh-CN"]}let i=Pl[e]??e;return Object.prototype.hasOwnProperty.call(wi,i)?wi[i]:Wr}function Br(t,e){let n=e.dropdownTrigger??"auto",i=e.closeDropdownOnBlur??!0,a=t.filteredOptionsLength>0||t.activePillHasNoOptions||t.hasProducts;if(t.inEditMode){let s=i?t.isFocused||t.dropdownHeld:!0;return a&&s}if(n==="auto"){let s=i?t.isFocused||t.dropdownHeld:!0,l=t.text.replace(/\s+$/,"").length,d=t.caretOffset==null||t.caretOffset>=l;return(a||t.isLoading)&&s&&d}return n==="manual"?(a||t.isLoading)&&t.pillTapped:!1}function U(t){if(t.editingIdentified){let{parameter:n,anchor:i}=t.editingIdentified;return`identified:${n}@${i}`}return t.editingParam!=null&&t.editingAnchor!=null?`edit:${t.editingParam?.id}`:`pill:${t.actionableSuggestions[0]?.parameter??""}`}function rn(t){if(!t)return $n();let[e,n]=t.split("-").map(Number);return{year:e,month:n-1}}function wl(t){let e=Ht(t);return e?hr(e):$n()}function Ll(t,e){if(!t)return null;for(let n of e){if(n.parameter!==t||n.type?.kind!=="date_range")continue;let i=st(n);if(i&&i.end==null)return i.start}return null}function Cl(t){let e=new Set,n=i=>{i&&e.add(i)};for(let i of t.completedParams??[]){if(i.id===t.editingParam?.id)continue;let o=i.suggestionValueType?.kind;if(o==="date"&&n(at(i.metadata?.[Dt])??it(i.text)),o==="date_range"){let r=_e(i);n(r?.start),n(r?.end)}}for(let i of t.identifiedParams??[]){if(i.id===t.editingIdentified?.id)continue;let o=i.type?.kind;if(o!=="date"&&o!=="date_range")continue;let r=st(i);n(r?.start),n(r?.end)}return[...e].sort()}function Li(t,e){return t.editingParam!=null&&t.editingAnchor!=null?e:t.text.slice(Te(t.text,t.completedParams))}var Al=/price/i;function Il(t){return!t||Ce(t)||H(J(t))||t.type?.kind==="multi_select"||Al.test(t.parameter)?!1:(t.options??[]).filter(e=>e.is_tappable).length>=2}function mt(t,e,n){if(e>0)return!1;let i=t.trim();return i===""||i.toLowerCase()===n.trim().toLowerCase()||Xe(i,0,n)}var Ol=4;function Ml(t,e){let n={text:e,kind:null,is_tappable:!0,selectsAll:!0},i=[...new Set(t.filter(r=>r.is_tappable&&r.image_url).map(r=>r.image_url))].slice(0,Ol);if(i.length>0)return n.image_url=i[0],i.length>1&&(n.imageCollage=i),[n,...t];let o;for(let r of t)r.is_tappable&&(o=r);return o?.icon&&(n.icon=o.icon),o?.icon_svg&&(n.icon_svg=o.icon_svg),[n,...t]}function Vr(t,e){let n=Mt(t.text,t.completedParams,t.identifiedParams),i=t.suggestions.filter(O=>O.parameter!=="placeholder"),o=i[0],r=t.suggestions.filter(O=>O.parameter==="placeholder").map(O=>O.text).join(" "),a=Le(r,e.prependPlaceholder),s=me(t.text,Math.min(t.filterBase,t.text.length),a),d=s===0&&Xe(t.text,t.completedParams.length,a)?"":Je(t.text,s,t.filterInProgress),c=o?.options??[],u=t.editingParam!=null&&t.editingAnchor!=null,g=!u&&!t.editingIdentified&&o?.type?.kind==="multi_select",m,p,f,h;if(u&&t.editingParam&&t.editingAnchor!=null){let O=t.editingParam.id,K=t.completedParams.some(de=>de.id===O),Ke=t.caretOffset??t.editingAnchor,X=K?"":t.text.slice(t.editingAnchor,Ke);p=X.trim(),f=t.editingParam.options,h=t.editingParam.suggestionParameter,m=t.editingParam.suggestionValueType?.kind==="traditional_autocomplete"?pe(t.editingParam.options,X).map(de=>({...de,matchedText:p,parameterLabel:Hn(de.parameter)})):pe(t.editingParam.options,X)}else p=d.trim(),f=c,h=o?.parameter,m=C(o)?c.map(O=>({...O,matchedText:t.text.slice(Te(t.text,t.completedParams)),parameterLabel:Hn(O.parameter)})):pe(c,d,t.traditionalAutocomplete);let v=t.optionSearch,y=v!=null&&h!=null&&v.parameter===h;y&&v.status==="done"&&v.query===p&&(m=f);let S=y&&v.status==="loading",b=e.showNonTappableOptions===!1;b&&(m=m.filter(O=>O.is_tappable));let x=mt(t.text,t.completedParams.length,a);e.allOption===!0&&o?.leadsWithAll===!0&&!x&&!u&&!t.editingIdentified&&d.trim()===""&&Il(o)&&(m=Ml(m,k(e.language).allOption));let E=Li(t,p),P=u?t.editingParam?.suggestionValueType?.kind==="traditional_autocomplete":C(o);!g&&!P&&(m=Zo(m,E));let T=t.editingIdentified,L=u?t.editingParam&&{type:t.editingParam.suggestionValueType,options:t.editingParam.options}:o,A=T?T.format:J(L),F=u?t.editingParam?.suggestionParameter:o?.parameter,R=A==="location"&&F&&e.optionOverrides?.[F]?"options":A,q=u&&R==="date-range"?_e(t.editingParam):null,I=!u&&!T&&R==="date"?Ll(o?.parameter,t.identifiedParams):null,Q=null,ie=null,D=_(R)?Cl(t):[];if(_(R)){let O=B(new Date),K=D.find(Os=>Os>=O)??null,Ke=U({...t,actionableSuggestions:i}),X=t.dateViewMonth;Q=X&&X.key===Ke?{year:X.year,month:X.month}:T?rn(T.iso):q?rn(q.start):I?rn(I):K&&!u?rn(K):wl(t.editingParam?.text),m=qn(Q);let de=t.pendingRangeStart;R==="date-range"&&de&&de.key===Ke&&(ie=de.iso)}let w=null;if(R==="time"){let O=U({...t,actionableSuggestions:i}),K=t.timeDraft;w=K&&K.key===O?{minutes:K.minutes,touched:!0}:{minutes:Ar({editingText:u?t.editingParam?.text:null,options:u?t.editingParam?.options:o?.options}),touched:!1},m=[]}let oe=null;if(R==="location"){let O=U({...t,actionableSuggestions:i}),K=t.locationSearch;if(K&&K.key===O){let{key:Ke,...X}=K;oe=X}else oe={query:u?t.editingParam?.text??"":"",places:[],status:t.locationAutocomplete&&e.locationSearch!==!1?"idle":"unavailable",highlighted:-1};m=[]}let Ue=O=>b?O.is_tappable:!0,ye;if(u){let O=t.editingParam?.options??[];ye=t.editingParam!=null&&O.filter(Ue).length===0}else ye=o!=null&&c.filter(Ue).length===0;w&&(ye=!0),oe&&(ye=!0);let yt=Br({inEditMode:u||T!=null,filteredOptionsLength:m.length,isFocused:t.isFocused||t.locationFieldFocused,dropdownHeld:t.dropdownHeld,text:t.text,caretOffset:t.caretOffset,isLoading:t.isLoading||S,pillTapped:t.pillTapped,activePillHasNoOptions:ye,hasProducts:t.products.length>0},{dropdownTrigger:e.dropdownTrigger,closeDropdownOnBlur:e.closeDropdownOnBlur}),Tt=yt&&t.activeDropdownIndex>=0&&!!m[t.activeDropdownIndex]?.is_tappable,$e=t.skeletonOptions!==null&&t.skeletonRequested&&!t.isLoading&&!t.editingParam&&!t.inSelectionAnimation,On=t.isLoading&&!t.editingParam&&!t.inSelectionAnimation||S||$e,M=On&&t.skeletonOptions!==null,Ge=M&&t.skeletonOptions?t.skeletonOptions:m,qe=M?t.skeletonSuggestion:null,_o=g?{picked:t.multiSelectDraft?.key===U({...t,actionableSuggestions:i})?t.multiSelectDraft.picked:[]}:null,Is=_o??(M&&t.skeletonSuggestion?.type?.kind==="multi_select"?{picked:t.skeletonPicked??[]}:null);return{segments:n,actionableSuggestions:i,filteredOptions:m,dropdownLoading:On,dropdownOptions:Ge,dropdownSuggestion:qe,skeletonExiting:$e,activeFormatType:R,dateView:Q,dateRangeStart:ie,dateFloor:I,dateReferences:D,timeView:w,multiSelectView:_o,dropdownMultiSelect:Is,locationView:oe,placeholderText:r,leadInText:a,optionQuery:p,isSearchingOptions:S,isDropdownOpen:yt,isActivePillSelected:Tt}}function an(t){return t.mode!=="edit"?Rl(t):_l(t)}function kl(t,e,n){let i=t.find(C);if(!i?.options)return null;let o=e.slice(Te(e,n)).trim().toLowerCase();if(!o)return null;let r=i.options.filter(l=>l.is_tappable&&l.text.trim().toLowerCase()===o);if(new Set(r.map(l=>ee(l,i.parameter))).size!==1)return null;let s=r[0];return{suggestion:i,option:s,matchText:s.text.trim()}}function Ur(t){let{text:e,suggestions:n,filterBase:i,filterInProgress:o,phraseExactMatch:r}=t,a=n.find(c=>c.parameter!=="placeholder"&&!C(c));if(!a?.options||a.type?.kind==="multi_select")return null;let s=n.filter(c=>c.parameter==="placeholder").map(c=>c.text).join(" "),l=me(e,i,Le(s,t.prependPlaceholder)),d=Ze(a.options,e,l,o,r===!0);return d?{suggestion:a,option:d,matchText:d.text}:null}function Rl(t){let{text:e,completedParams:n,suggestions:i}=t,o=t.mode==="submit"?(t.finishWord?Ur(t):null)??kl(i,e,n):Ur(t);if(!o)return null;let{suggestion:r,option:a,matchText:s}=o,l=s.toLowerCase(),d=e.toLowerCase().lastIndexOf(l),c=d>=0?d:Math.max(0,e.length-a.text.length),u=c+s.length,g=e.slice(c,u),p=u<e.length&&e[u]===" "?u+1:u,f={id:crypto.randomUUID(),placeholder:"",parameter:ee(a,r.parameter),text:g,value:a.value,kind:a.kind,suggestionParameter:r.parameter,suggestionValueType:r.type,suggestionPlaceholder:r.text,suggestionIcon:r.icon,suggestionIconSvg:r.icon_svg,...t.mode==="submit"&&C(r)?et(ee(a,r.parameter),r.text):{},options:r.options??[],metadata:a.metadata,icon:a.icon,icon_svg:a.icon_svg,image_url:a.image_url};return{patch:{text:e,completedParams:[...n,f],suggestions:i.filter(h=>h!==r),filterBase:p,newParamId:f.id,caretOffset:p,activeDropdownIndex:-1},caretPos:p,option:a,suggestion:r}}function _l(t){let{text:e,completedParams:n,editingParam:i,editingAnchor:o,editingTail:r}=t;if(n.some(S=>S.id===i.id))return null;let a=e.slice(o,r),s=At(i.options,a);if(!s)return null;let l=s.text.toLowerCase(),d=a.toLowerCase().lastIndexOf(l),c=o+Math.max(0,d),u=c+s.text.length,g=e.slice(c,u),m=u<e.length&&e[u]===" "?u+1:u,p=e.length,f={id:crypto.randomUUID(),placeholder:"",...It(i,s),text:g,value:s.value,kind:s.kind,options:i.options,metadata:s.metadata,icon:s.icon,icon_svg:s.icon_svg,image_url:s.image_url},h=n.length,v=0;for(let S=0;S<n.length;S++){let b=re(e,n[S].text,v);if(b!==-1){if(b>=m){h=S;break}v=b+n[S].text.length}}let y=[...n];return y.splice(h,0,f),{patch:{text:e,completedParams:y,newParamId:f.id,filterBase:p,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:p,activeDropdownIndex:-1},caretPos:p,option:s}}function $r(t){return t.slice(t.search(/\S*$/))}function Gr(t){return t.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase()}function qr(t,e){let n="",i=0;for(let o of t){if(n+=Gr(o),i+=o.length,n.length>=e.length)return n.startsWith(e)?i+(t.slice(i).match(/^\p{M}*/u)?.[0].length??0):0;if(!e.startsWith(n))return 0}return 0}function Ci(t){return[...t].map(Gr).join("")}function sn(t,e){if(/\s$/.test(e))return null;let n=e.split(/\s+/).filter(Boolean).map(Ci),i=[...t.matchAll(/\S+/g)].map(o=>({index:o.index??0,text:o[0],folded:Ci(o[0])}));for(let o=n.length;o>=1;o--){let r=n.slice(n.length-o),a=r[o-1];for(let s=0;s+o<=i.length;s++){if(!r.slice(0,-1).every((u,g)=>i[s+g].folded===u))continue;let d=i[s+o-1],c=qr(d.text,a);if(c>0)return{typedWords:o,start:i[s].index,end:d.index+c}}}return null}function Ai(t,e){let n=e?sn(t,e):null;if(n&&n.typedWords>1)return[{text:t.slice(0,n.start),bold:!1},{text:t.slice(n.start,n.end),bold:!0},{text:t.slice(n.end),bold:!1}].filter(a=>a.text!=="");let i=e?$r(e):"",o=Ci(i);if(!o)return[{text:t,bold:!1}];let r=[];for(let a of t.split(/(\s+)/)){if(a==="")continue;let s=/^\s/.test(a)?0:qr(a,o);s>0&&r.push({text:a.slice(0,s),bold:!0});let l=s>0?a.slice(s):a;l&&r.push({text:l,bold:!1})}return r}var Dl=6e4;function Hl(t){return typeof TextEncoder>"u"?t.length*3:new TextEncoder().encode(t).length}function Nl(t){return(t??Z).replace(/\/suggest(\?|#|$)/,"/telemetry/events$1")}async function Fl(t){return ze(t)?`Bearer ${await Et(t).getToken()}`:wt(t)}async function Kr(t){try{let e=Nl(t.apiConfig?.endpoint),n=Pt(t.apiConfig),i=await Fl(t.apiConfig);i&&(n.Authorization=i);let o=JSON.stringify({source:t.source,session_id:t.sessionId,...t.visitorId&&{visitor_id:t.visitorId},...t.requestId&&{request_id:t.requestId},type:t.type,...t.language&&{language:t.language},at:new Date().toISOString(),query_data:t.queryData});await fetch(e,{method:"POST",headers:n,body:o,...t.keepalive&&Hl(o)<=Dl&&{keepalive:!0}})}catch{}}function he(t,e){let n=t.findIndex(i=>i.text===e);return n>=0?n+1:null}var Ii=t=>t.toLowerCase().split(/\s+/).filter(Boolean);function Wl(t,e,n){let i=Ii(t??"");if(i.length===0)return"";let r=Ii(e).slice(-i.length),a=Ii(n).slice(0,i.length);return r.join(" ")===i.join(" ")||a.join(" ")===i.join(" ")?"":(t??"").trim().split(/\s+/).join(" ")}function zr(t,e){let n=t.actionableSuggestions[0];if(!n)return null;let i=C(n),o=e.parameter;if(i&&!o)return null;let r=i&&o?o:ee(e,n.parameter),a=i?t.text.length:t.filterBase,s=t.text.slice(0,a),l=s.length===0&&t.text.length===0,d=s.length===0&&t.text.length>0&&t.placeholderText.length>0&&t.placeholderText.toLowerCase().startsWith(t.text.toLowerCase());(l||d)&&t.placeholderText&&(s=`${t.placeholderText} `);let c=Math.min(Te(t.text,t.completedParams),s.length),u=!1;if(i){let T=[...s.slice(c).matchAll(/\S+/g)],L=sn(e.text,s.slice(c)),A=T[T.length-(L?.typedWords??1)];s=s.slice(0,A?c+(A.index??0):Math.max(s.lastIndexOf(" ")+1,c))}else if(n.completes_word===!0){let T=[...s.slice(c).matchAll(/\S+/g)],L=T[T.length-1];s=s.slice(0,L?c+(L.index??0):Math.max(s.lastIndexOf(" ")+1,c))}else if(n.completes_word!==!1){let T=s.slice(c),L=Math.max(Xo(T,e.text),Vo(T,e));L>0&&(s=s.slice(0,s.length-L)),u=L>0}let g=s.length>0&&s[s.length-1]!==" ",m=i||n.completes_word===!0||u,p=t.activeFormatType!==void 0&&!H(t.activeFormatType)&&H(J({type:n.type})),f=m||p?"":Wl(n.lead_in,s,e.text),h=`${s}${g?" ":""}${f?`${f} `:""}${e.text} `,y=(l||d||i&&s.length===0)&&h.length>0?h[0].toUpperCase()+h.slice(1):h,S=y.toLowerCase().lastIndexOf(e.text.toLowerCase()),b=S>=0?y.slice(S,S+e.text.length):e.text,x=i?et(r,n.text):{parameter:r,suggestionParameter:n.parameter,suggestionValueType:n.type,suggestionPlaceholder:n.text,suggestionIcon:n.icon,suggestionIconSvg:n.icon_svg},E={id:crypto.randomUUID(),placeholder:"",...x,text:b,value:e.value,kind:e.kind,options:n.options??[],metadata:e.metadata,icon:e.icon,icon_svg:e.icon_svg,image_url:e.image_url},P=t.actionableSuggestions.length-1;return{patch:{text:y,filterBase:y.length,completedParams:[...t.completedParams,E],newParamId:E.id,caretOffset:y.length,pillTapped:!1,activeDropdownIndex:-1,skipNextFetch:!0,inSelectionAnimation:!0,pendingSpan:null},telemetry:{selectedOption:e.text,otherOptions:t.filteredOptions.filter(T=>T.text!==e.text).map(T=>T.text),key:i?r:n.parameter,position:he(n.options??[],e.text)},consumedSuggestion:n,remainingActionable:P}}function pt(t,e){let n=H(t.activeFormatType)||t.filteredOptions.length===0?null:t.filteredOptions,i=t.editingParam,o=i?tt(i):t.actionableSuggestions[0]??null;return{skeletonOptions:n,skeletonSuggestion:n?o:null,skeletonPicked:n?e??null:null,skeletonRequested:!1}}function ln(t,e,n){let i=t.slice(0,e),o=t.slice(n),r=(i===""||i.endsWith(" "))&&o.startsWith(" ");return r&&(o=o.slice(1)),{text:i+o,removed:n-e+(r?1:0)}}var cn=class{constructor(e){this.deps=e}start(e){let n=this.deps.store.get();if(n.editingParam?.id===e)return;let i=n.completedParams.find(a=>a.id===e);if(!i)return;let o=0,r=-1;for(let a of n.completedParams){let s=re(n.text,a.text,o);if(s!==-1){if(a.id===e){r=s;break}o=s+a.text.length}}r<0||this.deps.store.set({editingParam:i,editingAnchor:r,editingTail:r+i.text.length,caretOffset:r+i.text.length,activeDropdownIndex:-1,editingIdentified:null})}exit(){this.deps.store.get().editingParam&&this.deps.store.set({editingParam:null,editingAnchor:null,editingTail:null,activeDropdownIndex:-1})}replaceRange(e){let n=this.deps.store.get(),i=n.editingParam,o=n.editingAnchor,r=n.editingTail;if(!i||o==null||r==null||!n.completedParams.some(l=>l.id===i.id))return!1;let{text:a}=e===""?ln(n.text,o,r):{text:n.text.slice(0,o)+e+n.text.slice(r)},s=o+e.length;return this.deps.store.set(l=>({text:a,completedParams:l.completedParams.filter(d=>d.id!==i.id),editingTail:s,caretOffset:s,activeDropdownIndex:-1})),this.deps.scheduleSetCursor(s),this.promoteIfExact(),!0}caretAfterInput(e){let n=this.deps.store.get(),i={caretOffset:e};n.editingParam&&n.editingAnchor!=null&&e!=null&&(e<n.editingAnchor?(i.editingParam=null,i.editingAnchor=null,i.editingTail=null,i.activeDropdownIndex=-1):n.editingTail!=null&&(i.editingTail=Math.max(n.editingTail,e))),this.deps.store.set(i),this.promoteIfExact()}caretMove(e){let n=this.deps.store.get();if(n.editingParam&&n.editingAnchor!=null&&n.editingTail!=null&&e!=null&&(e<n.editingAnchor||e>n.editingTail)){this.deps.store.set({caretOffset:e,editingParam:null,editingAnchor:null,editingTail:null,activeDropdownIndex:-1});return}this.deps.store.set({caretOffset:e})}selectOption(e){let n=this.deps.store.get(),i=n.editingParam,o=n.editingAnchor,r=n.editingTail;if(!i||o==null||r==null)return;let a=It(i,e);this.deps.fireTelemetry("option",{raw_query:W(n.text,n.completedParams).rawQuery,selected_option:e.text,other_options:i.options.filter(y=>y.text!==e.text).map(y=>y.text),key:a.suggestionParameter,position:he(i.options,e.text),chip_origin:"tap"});let s=n.text.slice(0,o),l=n.text.slice(r),d=o===0&&e.text.length>0?e.text[0].toUpperCase()+e.text.slice(1):e.text,u=l.length===0||l[0]!==" "?`${d} `:d,g=s+u+l,m=g.length,p={id:crypto.randomUUID(),placeholder:"",...a,text:d,value:e.value,kind:e.kind,options:i.options,metadata:e.metadata,icon:e.icon,icon_svg:e.icon_svg,image_url:e.image_url},f=n.completedParams.findIndex(y=>y.id===i.id),h=n.completedParams.filter(y=>y.id!==i.id),v=f>=0?Math.min(f,h.length):h.length;h.splice(v,0,p),this.deps.store.set({text:g,completedParams:h,newParamId:p.id,filterBase:m,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:m,activeDropdownIndex:-1,pillTapped:!1,skipNextFetch:!0,inSelectionAnimation:!0,...pt(n)}),this.deps.startSelectionAnimationTimer(),this.deps.scheduleSetCursor(m),this.deps.fetchNow()}promoteIfExact(){let e=this.deps.store.get();if(!e.editingParam||e.editingAnchor==null||e.editingTail==null)return;let n=an({mode:"edit",text:e.text,completedParams:e.completedParams,editingParam:e.editingParam,editingAnchor:e.editingAnchor,editingTail:e.editingTail});n&&(this.deps.store.set(n.patch),this.deps.scheduleSetCursor(n.caretPos))}};var Bl=33,Vl=70,Ul=120,$l=50,De="data-aia-placeholder-leaving",He=new WeakMap;function dn(t){t.timer!==null&&(clearTimeout(t.timer),t.timer=null)}function Gl(t){return t.closest('[data-animations="off"]')?!0:!!t.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function Yr(t,e,n){e.shown=n,t.dataset.placeholder=e.target.slice(0,n)}function Qr(t,e){if(e.timer=null,!t.isConnected||e.shown>=e.target.length||(Yr(t,e,e.shown+1),e.shown>=e.target.length))return;let n=e.target[e.shown-1],i=n===" "||n==="-"?70:0;e.timer=setTimeout(()=>Qr(t,e),33+i)}function jr(t,e){Yr(t,e,0),e.timer=setTimeout(()=>Qr(t,e),33)}function Xr(t,e){let n=He.get(t);if(e===""){n&&(dn(n),He.delete(t)),t.removeAttribute(De),delete t.dataset.placeholder;return}if(n?.target===e)return;if(Gl(t)){n&&dn(n),t.removeAttribute(De),He.set(t,{target:e,shown:e.length,timer:null}),t.dataset.placeholder=e;return}let i={target:e,shown:0,timer:null},o=n&&n.shown>0?n:null;if(n&&dn(n),He.set(t,i),o){t.setAttribute(De,""),i.timer=setTimeout(()=>{i.timer=null,t.removeAttribute(De),t.isConnected&&jr(t,i)},170);return}t.removeAttribute(De),jr(t,i)}function Jr(t){let e=He.get(t);e&&(dn(e),He.delete(t))}var ql={selectedIso:null,selectedRange:null,rangeStart:null};function gt(t){if(!_(t.activeFormatType))return ql;let e=t.editingIdentified;if(e){let{iso:i,isoEnd:o}=e;return{selectedIso:o?null:i,selectedRange:i&&o?lt(i,o):null,rangeStart:t.dateRangeStart,references:t.dateReferences??[]}}let n=_e(t.editingParam);return{selectedIso:n?null:it(t.editingParam?.text),selectedRange:n,rangeStart:t.dateRangeStart??t.dateFloor??null,floor:t.dateFloor??null,references:t.dateReferences??[]}}function Oi(t){let e=t.floor!=null&&t.highlightedIso!=null&&t.highlightedIso<t.floor?null:t.highlightedIso;return t.pendingStart?lt(t.pendingStart,e??t.pendingStart):t.selected}function Mi(t,e){if(t==null)return{selected:!1,inRange:!1,reference:!1};let{selectedIso:n,range:i}=e,o=t===n||i!=null&&(t===i.start||t===i.end),r=i!=null&&t>i.start&&t<i.end,a=!o&&!r&&(e.references?.includes(t)??!1);return{selected:o,inRange:r,reference:a}}function ki(t,e,n){return t==null?!1:t<e||n!=null&&t<n}function Ri(t,e){return t==="date"?e??null:null}var Zr="https://ai-autocomplete.com";function _i(t=Zr){try{if(typeof window>"u"||!window.location)return t;let e=window.location.hostname;if(!e)return t;let n=new URL(t);return n.searchParams.set("utm_source",e),n.toString()}catch{return t}}function Di(t,e,n=k()){return t?{key:"enter",hint:n.proceed}:e?{key:"tab",hint:n.select}:{key:"\u2192",hint:n.skipHint}}function Hi(t){let e=a=>{a.ctrlKey||ea(a.target,t,a.deltaX,a.deltaY)||a.preventDefault()},n=0,i=0,o=a=>{let s=a.touches[0];s&&(n=s.clientX,i=s.clientY)},r=a=>{if(a.touches.length!==1)return;let s=a.touches[0],l=n-s.clientX,d=i-s.clientY;n=s.clientX,i=s.clientY,a.cancelable&&!ea(a.target,t,l,d)&&a.preventDefault()};return t.addEventListener("wheel",e,{passive:!1}),t.addEventListener("touchstart",o,{passive:!0}),t.addEventListener("touchmove",r,{passive:!1}),()=>{t.removeEventListener("wheel",e),t.removeEventListener("touchstart",o),t.removeEventListener("touchmove",r)}}function ea(t,e,n,i){let o=t instanceof Element?t:null;for(;o;){if(i!==0&&Kl(o,i)||n!==0&&zl(o,n))return!0;if(o===e)break;o=o.parentElement}return!1}var ta=/^(auto|scroll|overlay)$/;function Kl(t,e){return t.scrollHeight<=t.clientHeight||!ta.test(getComputedStyle(t).overflowY)?!1:e>0?t.scrollTop+t.clientHeight<t.scrollHeight-1:t.scrollTop>0}function zl(t,e){if(t.scrollWidth<=t.clientWidth)return!1;let n=getComputedStyle(t);if(!ta.test(n.overflowX))return!1;let i=Math.abs(t.scrollLeft),o=t.scrollWidth-t.clientWidth;return(n.direction==="rtl"?e<0:e>0)?i<o-1:i>0}var na=new WeakMap,ia=new WeakSet;function $(t,e,n){if(na.set(t,n),ia.has(t))return;ia.add(t);let i=()=>na.get(t),o=r=>{if(!(r instanceof Element))return null;let a=r.closest(e.itemSelector);return a&&t.contains(a)?a:null};e.onClick&&t.addEventListener("click",r=>{let a=o(r.target);a&&e.onClick?.(a,i(),r)}),e.onEnter&&t.addEventListener("mouseenter",r=>{let a=r.target;a instanceof HTMLElement&&a.matches(e.itemSelector)&&e.onEnter?.(a,i())},!0),e.onLeave&&t.addEventListener("mouseleave",r=>{let a=r.target;a instanceof HTMLElement&&a.matches(e.itemSelector)&&e.onLeave?.(a,i())},!0),e.preventMousedown&&t.addEventListener("mousedown",r=>r.preventDefault())}function be(t){return Number.parseInt(t.dataset.aiaIndex??"-1",10)}function z(t){t.offsetWidth}var se="magicx-aia-panel-ghost";function Ne(t){return t.closest(`.${se}`)!==null}function G(t,e){for(let n of t.querySelectorAll(e))if(!Ne(n))return n;return null}var Ni="--aia-multi-done-fit";function jl(t){return G(t,"[data-aia-multi-done]")}function Fi(t,e){if(!e?.isConnected)return;let n=e.ownerDocument,i=n.defaultView?.getComputedStyle(e).direction==="rtl";if(typeof n.createRange().getBoundingClientRect!="function")return;let o=e.getBoundingClientRect(),r=0;for(let a of t.querySelectorAll("[data-aia-option]")){if(Ne(a))continue;let s=n.defaultView?.getComputedStyle(a),l=Number.parseFloat(i?s?.paddingRight??"0":s?.paddingLeft??"0")||0,d=n.createTreeWalker(a,NodeFilter.SHOW_TEXT),c=n.createRange();for(let u=d.nextNode();u;u=d.nextNode()){if(!u.textContent?.trim())continue;c.selectNodeContents(u);let g=c.getBoundingClientRect();if(g.width===0)continue;let m=i?o.right-g.left:g.right-o.left;r=Math.max(r,m+l)}}r>0?e.style.setProperty(Ni,`${Math.ceil(r)}px`):e.style.removeProperty(Ni)}var Yl=40,Ql=340,Xl=340,Jl=7,Wi="--aia-option-enter-delay";function Bi(t,e,n,i="below"){let o=Math.max(1,Math.floor(e)),r=Math.floor(Math.max(0,t)/o);if(i!=="above")return r*40;let a=Math.max(1,Math.ceil(Math.max(0,n)/o));return Math.max(0,a-1-r)*40}function Vi(t,e){let n=Math.max(1,Math.floor(e));return(Math.max(1,Math.ceil(Math.max(0,t)/n))-1)*40+340}var ra="magicx-aia-scroll-arrow",un="data-aia-scroll-arrow",Fe="data-aia-visible",aa=1e3,sa=160,la="--aia-scroll-arrow-bottom",Zl="Scroll down for more options",Ui="data-aia-scrollable",ec="--aia-scroll-track-top",tc="--aia-scroll-track-height",nc="--aia-scroll-track-right",ic="--aia-scroll-thumb-top",oc="--aia-scroll-thumb-height",rc=12,ac=.5,sc="[data-aia-products-label]",oa=4,lc=8,cc=240;function dc(t,e,n,i){let o=t.scrollTop,r=n?.requestAnimationFrame,a=t.ownerDocument?.visibilityState==="hidden";if(!r||a||$i(t)){t.scrollTop=o+e,i();return}let s=n.performance?.now?.()??Date.now(),l=()=>n.performance?.now?.()??Date.now(),d=()=>{let c=Math.min(1,(l()-s)/cc),u=1-(1-c)*(1-c);t.scrollTop=o+e*u,c<1?r.call(n,d):i()};r.call(n,d)}function uc(t=document){let e="http://www.w3.org/2000/svg",n=t.createElementNS(e,"svg");n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("width","18"),n.setAttribute("height","18"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","1.75"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false");let i=t.createElementNS(e,"path");return i.setAttribute("d","M4 6.5 8 10.5l4-4"),n.appendChild(i),n}function ca(t=document,e=k()){let n=t.createElement("button");return n.type="button",n.tabIndex=-1,n.className=ra,n.setAttribute(un,""),n.setAttribute("aria-label",e.scrollArrow),n.setAttribute("aria-hidden","true"),n.disabled=!0,n.appendChild(uc(t)),n}function mc(t){return Math.max(1,qi(t.style.gridTemplateColumns))}function $i(t){return t.closest('[data-animations="off"]')?!0:!!t.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function Gi({dropdown:t,grid:e,button:n}){let i=e.ownerDocument?.defaultView??(typeof window<"u"?window:null),o=!1;n.disabled=!0;let r=null,a=null,s=null,l=null,d=E=>{if(E){if(n.hasAttribute(Fe))return;if(n.setAttribute(Fe,""),n.setAttribute("aria-hidden","false"),l!==null&&clearTimeout(l),$i(e)){n.disabled=!1;return}l=setTimeout(()=>{l=null,!o&&n.hasAttribute(Fe)&&(n.disabled=!1)},aa)}else n.removeAttribute(Fe),n.setAttribute("aria-hidden","true"),l!==null&&clearTimeout(l),l=null,n.disabled=!0},c=E=>{let P=0,T=E;for(;T&&T!==t;)P+=T.offsetTop,T=T.offsetParent instanceof HTMLElement?T.offsetParent:null;return P},u=()=>{let E=G(t,sc),P;if(E){let T=c(E)+E.offsetHeight/2;P=t.clientHeight-T-n.offsetHeight/2}else{let T=c(e),L=i&&Number.parseFloat(i.getComputedStyle(e).paddingBottom)||0;P=t.clientHeight-(T+e.offsetHeight)+(L>0?0:lc)}n.style.setProperty(la,`${Math.max(0,Math.round(P))}px`)},g=E=>{let P=0,T=E;for(;T&&T!==t;)P+=T.offsetLeft,T=T.offsetParent instanceof HTMLElement?T.offsetParent:null;return P},m=null,p=(E,P)=>{let T=Math.min(1,Math.max(0,e.scrollTop/E));n.style.setProperty(ic,`${Math.round(P*T)}px`)},f=()=>{let E=e.scrollHeight-e.clientHeight,P=e.querySelector("[data-aia-option][data-aia-loading]")!==null;if(E<=oa||P){m=null,n.removeAttribute(Ui);return}let T=e.clientHeight,L=Math.round(T*ac),A=c(e)+(T-L)/2,F=t.clientWidth-(g(e)+e.offsetWidth),R=Math.min(L,Math.max(rc,Math.round(L*T/e.scrollHeight)));m={overflow:E,travel:L-R},n.style.setProperty(ec,`${Math.round(A)}px`),n.style.setProperty(tc,`${L}px`),n.style.setProperty(nc,`${Math.max(0,Math.round(F))}px`),n.style.setProperty(oc,`${R}px`),p(E,m.travel),n.setAttribute(Ui,"")},h=()=>{if(o||a!==null||s!==null)return;let E=e.querySelector("[data-aia-option][data-aia-loading]")!==null,P=e.scrollHeight-e.clientHeight-e.scrollTop;d(!E&&P>oa)},v=()=>{if(o)return;u(),f();let E=e.getAttribute("data-aia-group")??"";if(E!==r){r=E,d(!1),a!==null&&clearTimeout(a);let P=e.querySelectorAll("[data-aia-option]").length,T=$i(e)?0:Vi(P,mc(e));a=setTimeout(()=>{a=null,h()},T);return}h()},y=()=>{o||(m&&p(m.overflow,m.travel),a===null&&(d(!1),s!==null&&clearTimeout(s),s=setTimeout(()=>{s=null,h()},sa)))};e.addEventListener("scroll",y,{passive:!0});let S=E=>E.preventDefault(),b=()=>{let E=i?(Number.parseFloat(i.getComputedStyle(e).paddingTop)||0)+(Number.parseFloat(i.getComputedStyle(e).paddingBottom)||0):0,P=Math.max(1,e.clientHeight-E);dc(e,P,i,y)};n.addEventListener("mousedown",S),n.addEventListener("click",b);let x=null;return i&&typeof i.ResizeObserver=="function"&&(x=new i.ResizeObserver(()=>{u(),f(),h()}),x.observe(e)),v(),{update:v,destroy(){o||(o=!0,a!==null&&clearTimeout(a),a=null,s!==null&&clearTimeout(s),s=null,l!==null&&clearTimeout(l),l=null,n.disabled=!0,e.removeEventListener("scroll",y),n.removeEventListener("mousedown",S),n.removeEventListener("click",b),x?.disconnect(),n.removeAttribute(Fe),n.removeAttribute(Ui),n.setAttribute("aria-hidden","true"))}}}var da="cubic-bezier(0.25, 0.1, 0.25, 1)",pc="cubic-bezier(0.32, 0.72, 0, 1)",ua=360,ma=280,pa=320,ga=40,fa="blur(2px)",gc=160,fc=.05,hc=/pressed/i;function ha(){return typeof performance<"u"?performance.now():Date.now()}function bc(t){for(let e of t.querySelectorAll("[data-aia-loading]"))if(!e.closest(`.${se}`))return!0;return!1}function Sc(t){return t===null?1:1-Math.min(1,Math.max(0,(ha()-t)/gc))**1.7}function ji(t){return t.hasAttribute(un)}function zi(t){let e=0;for(let n of Array.from(t.children))n.classList.contains(se)||ji(n)||(e+=n.offsetHeight||0);return e}var te=new WeakMap;function yc(t){return(Number.parseFloat(t.borderLeftWidth)||0)+(Number.parseFloat(t.borderRightWidth)||0)}function Tc(t){let e=(t.ownerDocument.defaultView??window).getComputedStyle(t);return(Number.parseFloat(e.paddingLeft)||0)+(Number.parseFloat(e.paddingRight)||0)+(Number.parseFloat(e.borderLeftWidth)||0)+(Number.parseFloat(e.borderRightWidth)||0)}var Ki=new WeakMap;function xc(t,e){return!e||typeof t.animate!="function"||t.closest('[data-animations="off"]')||t.closest('[data-aia-options-style="classic"]')?!1:!(t.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)")??null)?.matches}function vc(t,e){let n=0,i="";for(let o of Array.from(t.children))o.classList.contains(se)||(n+=1+o.getElementsByTagName("*").length,i+=`${o.textContent??""}\0`);return`${e??""}${n}${i}`}function Ec(t){let e=t.ownerDocument.createElement("div");e.className=se,e.setAttribute("aria-hidden","true"),e.inert=!0;for(let n of Array.from(t.children))n.classList.contains(se)||ji(n)||e.appendChild(n.cloneNode(!0));for(let n of[e,...Array.from(e.querySelectorAll("*"))]){n.removeAttribute("id"),n.removeAttribute("role"),n.removeAttribute("tabindex");for(let i of Array.from(n.classList))hc.test(i)&&n.classList.remove(i);n.tagName==="A"&&n.removeAttribute("href"),n.tagName==="BUTTON"&&(n.disabled=!0);for(let i of Array.from(n.attributes))i.name.startsWith("aria-")&&i.name!=="aria-hidden"&&n.removeAttribute(i.name)}return e}function Pc(t,e,n,i,o){for(let a of Array.from(t.children))a.classList.contains(se)&&a.remove();let r=Array.from(t.children).filter(a=>!ji(a));i>fc&&wc(t,e,n,i,o);for(let a of r)a.animate([{opacity:0,filter:fa},{opacity:1,filter:"blur(0px)"}],{duration:pa,delay:ga,easing:da,fill:"backwards"})}function wc(t,e,n,i,o){let r=(t.ownerDocument.defaultView??window).getComputedStyle(t);e.style.cssText=["position:absolute","left:0",o>0?`width:${o-yc(r)}px`:"right:0",n?"bottom:0":"top:0",`padding:${r.padding}`,"pointer-events:none","box-sizing:border-box"].join(";"),t.appendChild(e),e.animate([{opacity:i,filter:"blur(0px)"},{opacity:0,filter:fa}],{duration:ma*i,easing:da,fill:"forwards"}).finished.then(()=>e.remove(),()=>e.remove())}function Yi(t){let e=t[0]?.text;return e==null||e===""?null:e}function mn(t,e,n){let i=n.visible,o=xc(t,n.enabled??!0),r=te.get(t);if(!i||!o){o||r?.glide?.cancel(),te.set(t,{height:0,width:0,key:i?e:null,signature:"",snapshot:null,glide:o?r?.glide??null:null,loadingSince:null,contentHeight:0});return}let a=vc(t,e),s=bc(t)?r?.loadingSince??ha():null;if(r&&r.height>0&&r.glide&&r.signature===a){r.loadingSince=s;return}let l=Se(t),d=t.getBoundingClientRect(),c=d.height;r?.glide?.cancel();let u=t.getBoundingClientRect(),g=u.height,m=u.width||0,p=null,f=r?l?c:r.height:0,h=r?l?d.width||0:r.width:0;r&&f>0&&(e!==r.key&&r.snapshot&&Pc(t,r.snapshot,n.anchorBottom??!1,Sc(r.loadingSince),h),p=ba(t,{height:f,width:h},{height:g,width:m}));let v=null;e!==null&&(v=r&&r.signature===a&&r.snapshot&&!r.snapshot.isConnected?r.snapshot:Ec(t)),te.set(t,{height:g,width:m,key:e,signature:a,snapshot:v,glide:p,loadingSince:s,contentHeight:p?zi(t):0})}function ba(t,e,n){let i=e.width>0&&n.width>0&&Math.abs(e.width-n.width)>1;if(Math.abs(e.height-n.height)<=1&&!i)return null;let o=i?[{height:`${e.height}px`,width:`${e.width}px`},{height:`${n.height}px`,width:`${n.width}px`}]:[{height:`${e.height}px`},{height:`${n.height}px`}],r=t.animate(o,{duration:ua,easing:pc});i&&(t.setAttribute(on,String(n.width)),n.width>e.width?t.style.setProperty(dt,`${n.width-Tc(t)}px`):t.style.removeProperty(dt),Ki.set(t,r));let a=()=>{Ki.get(t)===r&&(Ki.delete(t),t.removeAttribute(on),t.style.removeProperty(dt))};return r.finished.then(()=>{a();let s=te.get(t);if(s?.glide!==r||(s.glide=null,s.height<=0))return;let l=t.getBoundingClientRect();l.height>0&&(s.height=l.height),l.width>0&&(s.width=l.width)},a),r}function Se(t){let e=te.get(t)?.glide??null;return e&&(e.playState==="running"||e.pending)?e:null}function Qi(t){if(!Se(t))return null;let e=te.get(t)?.height??0;return e>0?e:null}function Xi(t,e){let n=te.get(t);n&&n.height>0&&!Se(t)&&e>0&&(n.height=e)}function Sa(t,{widthChanged:e}){let n=te.get(t);if(!n||n.height<=0)return;let i=Se(t);if(!i||!e&&(t.hasAttribute("data-aia-fit")||Math.abs(zi(t)-n.contentHeight)<=1))return;let o=t.getBoundingClientRect();i.cancel();let r=t.getBoundingClientRect();n.width=r.width||0,n.height=r.height,n.glide=ba(t,{height:o.height,width:o.width||0},{height:r.height,width:n.width}),n.contentHeight=n.glide?zi(t):0}function Ji(t){te.get(t)?.glide?.cancel(),te.delete(t)}var Zi="data-aia-hug",We="--aia-panel-fit-width",eo="data-aia-full-width",Lc=36;function ft(t){t.removeAttribute(Zi)}function to(t,e,{eligible:n,loading:i}){let o=t.style.getPropertyValue(We);Cc(t,e,n,i),Sa(t,{widthChanged:t.style.getPropertyValue(We)!==o})}function Cc(t,e,n,i){if(!n){t.style.removeProperty(We),ft(t);return}if(i){t.style.getPropertyValue(We)&&t.setAttribute(Zi,"");return}let o=Ac(t,e);if(o==null){t.style.removeProperty(We);return}t.style.setProperty(We,`${o}px`),t.setAttribute(Zi,"")}var ya=new WeakMap;function Ac(t,e){if(ut())return null;let n=G(e,".aia-grid");if(!n||t.offsetWidth===0)return null;let i=G(e,"[data-aia-pillbar]"),o=[n.style.gridTemplateColumns,i?.textContent??"",...Array.from(n.querySelectorAll("[data-aia-option]"),s=>s.textContent)].join("\0"),r=ya.get(t);if(r?.key===o)return r.width;let a=Ic(t,e,n);return ya.set(t,{key:o,width:a}),a}function Ic(t,e,n){let i=ct(n);if(!i||i.rowWidths.some(s=>s<=0))return null;let o=Math.ceil(Math.max(...i.rowWidths)),r=Math.max(1,qi(n.style.gridTemplateColumns)),a=Ta(n,t,r-1)+r*(o+Lc);return Math.ceil(Math.max(a,Oc(e,t)))}function Oc(t,e){let n=G(t,"[data-aia-pillbar]");if(!n)return 0;let i=n.querySelector("[data-aia-pill-scroll]")?.scrollWidth??0,o=n.querySelector("[data-aia-skip]")?.offsetWidth??0;return i+o===0?0:Ta(n,e,i>0&&o>0?1:0)+i+o}function qi(t){let e=0,n=0,i=!1;for(let o of t)o==="("?e++:o===")"&&e--,e===0&&/\s/.test(o)?i=!1:i||(i=!0,n++);return n}function Ta(t,e,n){let i=0;for(let o=t;o;o=o.parentElement){let r=getComputedStyle(o);if(i+=(Number.parseFloat(r.paddingLeft)||0)+(Number.parseFloat(r.paddingRight)||0)+(Number.parseFloat(r.borderLeftWidth)||0)+(Number.parseFloat(r.borderRightWidth)||0),o===t&&(i+=n*(Number.parseFloat(r.columnGap)||0)),o===e)break}return i}var Mc="[data-aia-products], [data-aia-datepicker], [data-aia-date-grid], [data-aia-time-wheel], [data-aia-location], [data-aia-see-all]";function kc(t){let e=!t.hasAttribute("data-aia-has-products")&&!t.hasAttribute(eo)&&G(t,".aia-grid [data-aia-option]")!==null&&G(t,Mc)===null,n=G(t,".aia-grid [data-aia-option][data-aia-loading]")!==null;e||ft(t),to(t,t,{eligible:e,loading:n})}var xa="data-aia-key";function ne(t,e,n){let i=new Map;for(let a of Array.from(t.children)){let s=a.getAttribute(xa);s!=null&&i.set(s,a)}let o=new Set,r=[];for(let a=0;a<e.length;a++){let s=e[a],l=n.keyOf(s,a);o.add(l);let d=i.get(l);d||(d=n.create(s,a),d.setAttribute(xa,l)),n.update?.(d,s,a),t.children[a]!==d&&t.insertBefore(d,t.children[a]??null),r.push(d)}for(let[a,s]of i)o.has(a)||s.remove();return r}function va(t,e){if(!e.interactive)return null;let n=e.options[be(t)];return n?.is_tappable?n:null}var Rc={itemSelector:"[data-aia-date-cell], [data-aia-date-prev], [data-aia-date-next]",onClick:(t,e)=>{if(t.hasAttribute("data-aia-date-prev")){e.callbacks.onPreviousMonth();return}if(t.hasAttribute("data-aia-date-next")){e.callbacks.onNextMonth();return}let n=va(t,e);n&&(t.classList.add("magicx-aia-date-cell--pressed"),e.callbacks.onSelect(n),setTimeout(()=>t.classList.remove("magicx-aia-date-cell--pressed"),170))},onEnter:(t,e)=>{t.hasAttribute("data-aia-date-cell")&&va(t,e)&&e.callbacks.onHighlight(be(t))},onLeave:(t,e)=>{t.hasAttribute("data-aia-date-cell")&&e.callbacks.onHighlight(-1,be(t))}};function Pa(t,e,n,i,o,r,a,s=!0){let l=t.querySelector(".magicx-aia-datepicker");if(!o||e.length===0){l?.remove();return}if(!l){l=Hc(),t.appendChild(l),z(l);for(let u of l.querySelectorAll(".magicx-aia-datepicker-nav"))u.disabled=!1}$(l,Rc,{options:e,callbacks:a,interactive:s});let d=l.querySelector(".magicx-aia-datepicker-month");d&&(d.textContent=Un(o));let c=l.querySelector(".magicx-aia-datepicker-grid");c&&_c(c,e,n,i,r)}function _c(t,e,n,i,o){let r=B(new Date),a=Oi({pendingStart:o.rangeStart,highlightedIso:j(e[n]),selected:o.selectedRange,floor:o.floor});ne(t,e,{keyOf:(s,l)=>j(s)??`pad-${l}`,create:s=>Dc(s),update:(s,l,d)=>{let c=j(l),u=Mi(c,{selectedIso:o.selectedIso,range:a,references:o.references}),g=d===n&&l.is_tappable;s.id=`${i}-option-${d}`,s.dataset.aiaIndex=String(d),s.setAttribute("aria-selected",String(g)),s.classList.toggle("magicx-aia-date-cell--past",ki(c,r,o.floor)),s.classList.toggle("magicx-aia-date-cell--highlighted",g),s.classList.toggle("magicx-aia-date-cell--today",c!=null&&c===r),s.classList.toggle("magicx-aia-date-cell--selected",u.selected),s.classList.toggle("magicx-aia-date-cell--in-range",u.inRange),s.classList.toggle("magicx-aia-date-cell--reference",u.reference)}})}function Dc(t){let e=document.createElement("div");e.setAttribute("role","option"),e.setAttribute("data-aia-option",""),e.setAttribute("data-aia-date-cell","");let n=Kn(t);if(n==null)return e.className="magicx-aia-date-cell magicx-aia-date-cell--blank",e.setAttribute("aria-hidden","true"),e.tabIndex=-1,e;e.className="magicx-aia-date-cell magicx-aia-date-cell--day",e.tabIndex=0,e.setAttribute("aria-label",t.text);let i=document.createElement("span");return i.className="magicx-aia-date-cell-number",i.textContent=String(n),e.appendChild(i),e}function Hc(){let t=document.createElement("div");t.className="magicx-aia-datepicker",t.setAttribute("data-aia-datepicker","");let e=document.createElement("div");e.className="magicx-aia-datepicker-header";let n=document.createElement("span");n.className="magicx-aia-datepicker-month",n.setAttribute("data-aia-date-month",""),n.setAttribute("aria-live","polite"),e.append(Ea("prev","Previous month","\u2039"),n,Ea("next","Next month","\u203A"));let i=document.createElement("div");i.className="magicx-aia-datepicker-weekdays",i.setAttribute("aria-hidden","true");for(let r of _t){let a=document.createElement("span");a.className="magicx-aia-datepicker-weekday",a.textContent=r,i.appendChild(a)}let o=document.createElement("div");return o.className="magicx-aia-datepicker-grid",o.setAttribute("data-aia-date-grid",""),t.append(e,i,o),t}function Ea(t,e,n){let i=document.createElement("button");return i.type="button",i.tabIndex=-1,i.className="magicx-aia-datepicker-nav",i.setAttribute(`data-aia-date-${t}`,""),i.setAttribute("aria-label",e),i.textContent=n,i.disabled=!0,i}var Nc='<svg class="magicx-aia-location-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"/><circle cx="12" cy="9.5" r="2.5"/></svg>',wa="data-aia-location-body";function Fc(t){let e=document.createElement("div");e.className="magicx-aia-location-row",e.setAttribute("data-aia-location-row",""),e.setAttribute("role","option");let n=document.createElement("span");n.className="magicx-aia-location-pin",n.innerHTML=Nc;let i=document.createElement("span");i.className="magicx-aia-location-text";let o=document.createElement("span");if(o.className="magicx-aia-location-name",o.textContent=t.name,i.appendChild(o),t.secondary){let r=document.createElement("span");r.className="magicx-aia-location-secondary",r.textContent=t.secondary,i.appendChild(r)}return e.append(n,i),e}function Wc(t,e){if(t==="loading"){let o=document.createElement("div");o.className="magicx-aia-location-loading",o.setAttribute("data-aia-location-loading","");for(let r=0;r<3;r++)o.appendChild(document.createElement("span")).className="magicx-aia-location-loading-bar";return o}if(t==="")return null;let n=document.createElement("div");if(n.className="magicx-aia-location-note",n.setAttribute("data-aia-location-note",""),t==="note-empty"){let o=document.createElement("span");o.className="magicx-aia-location-empty",o.textContent=e.locationNoResults,n.appendChild(o)}let i=document.createElement("span");return i.textContent=e.locationUseTyped,n.appendChild(i),n}function La(t,e,n,i){let o=e.places,r="";if(o.length===0&&(e.status==="loading"?r="loading":e.query.trim()&&(r=e.status==="done"?"note-empty":"note")),t.getAttribute(wa)!==r){for(let s of Array.from(t.children))s.hasAttribute("data-aia-location-row")||s.remove();let a=Wc(r,n);a&&t.appendChild(a),t.setAttribute(wa,r)}ne(t,o,{keyOf:(a,s)=>`${s}:${a.id}`,create:a=>Fc(a),update:(a,s,l)=>{let d=l===e.highlighted;a.classList.toggle("magicx-aia-location-row--highlighted",d),a.setAttribute("aria-selected",String(d)),a.setAttribute("data-aia-index",String(l)),a.id=i(l)}})}var le=new WeakMap,Bc=0,Ee=new WeakMap,Vc='<svg class="magicx-aia-location-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>',Pe=t=>Nt(t.input)===t.input;function Ca(t,e){let n=Nt(t);if(n instanceof HTMLElement&&n!==e.input&&n!==N(t).body&&!t.contains(n)&&(e.returnTo=n,e.returnRange=null,n.isContentEditable)){let i=xe(n);i&&n.contains(i.startContainer)&&(e.returnRange=i.cloneRange())}}function Uc(t,e,n){if(!(!(n instanceof HTMLElement)||n===e.returnTo||t.contains(n))&&n!==N(t).body&&(e.returnTo=n,e.returnRange=null,n.isContentEditable)){let i=xe(n);i&&n.contains(i.startContainer)&&(e.returnRange=i.cloneRange())}}function $c(t,e){if(t.focus({preventScroll:!0}),!t.isContentEditable)return;let n=ot(t);if(!n)return;let i=e;(!i||!i.startContainer.isConnected||!t.contains(i.startContainer))&&(i=N(t).createRange(),i.selectNodeContents(t),i.collapse(!1)),n.removeAllRanges(),n.addRange(i)}var Gc={itemSelector:"[data-aia-location-row]",onClick:(t,e)=>{if(!e.interactive)return;let n=t.closest("[data-aia-location]");n&&Be(n,!0),e.callbacks.onLocationCommit(Number(t.dataset.aiaIndex))}};function Be(t,e=!1){let n=Ee.get(t),i=le.get(t);if(!n||!i)return;e&&(n.declined=!0);let o=n.returnTo;o?.isConnected&&Pe(n)&&(n.returning=!0,$c(o,n.returnRange),n.returning=!1),i.callbacks.onLocationFocusChange(!1)}function qc(t){let e=Ee.get(t),n=le.get(t);if(!(!e||!n||Pe(e))){if(Ca(t,e),n.callbacks.onLocationFocusChange(!0),e.input.focus({preventScroll:!0}),!Pe(e)){e.declined=!0,n.callbacks.onLocationFocusChange(!1);return}e.input.value&&e.input.select()}}function Kc(t,e){t.className="magicx-aia-location",t.setAttribute("data-aia-location",""),t.id=`magicx-aia-location-${++Bc}`;let n=document.createElement("label");n.className="magicx-aia-location-field",n.innerHTML=Vc;let i=document.createElement("input");i.type="text",i.className="magicx-aia-location-input",i.setAttribute("data-aia-location-input",""),i.setAttribute("autocomplete","off"),i.setAttribute("autocapitalize","words"),i.setAttribute("enterkeyhint","done"),i.spellcheck=!1,i.placeholder=e.locationSearch,i.setAttribute("aria-label",e.locationSearch),n.appendChild(i);let o=document.createElement("div");o.className="magicx-aia-location-results",o.setAttribute("data-aia-location-results",""),o.setAttribute("aria-live","polite"),t.append(n,o);let r={input:i,field:n,results:o,returnTo:null,returnRange:null,returning:!1,declined:!1,widgetFocused:!1,wasReediting:!1};return t.addEventListener("mousedown",a=>{!(a.target instanceof Node)||!n.contains(a.target)||(a.stopPropagation(),Ca(t,r),le.get(t)?.callbacks.onLocationFocusChange(!0))}),i.addEventListener("input",()=>le.get(t)?.callbacks.onLocationQuery(i.value)),i.addEventListener("focus",a=>{Uc(t,r,a.relatedTarget),le.get(t)?.callbacks.onLocationFocusChange(!0)}),i.addEventListener("blur",()=>{r.returning||(r.declined=!0,le.get(t)?.callbacks.onLocationFocusChange(!1))}),i.addEventListener("keydown",a=>{let s=le.get(t);if(!(!s||a.isComposing))switch(a.key){case"ArrowDown":case"ArrowUp":a.preventDefault(),s.callbacks.onLocationMove(a.key==="ArrowDown"?1:-1);return;case"Enter":if(a.preventDefault(),!s.interactive)return;Be(t,!0),s.callbacks.onLocationCommit();return;case"Escape":a.preventDefault(),a.stopPropagation(),r.declined=!0,Be(t);return;case"Backspace":if(i.value!=="")return;a.preventDefault(),r.declined=!0,Be(t);return}}),Ee.set(t,r),r}function Aa(t){for(let e of t.querySelectorAll("[data-aia-location]")){let n=Ee.get(e);n&&(Pe(n)&&Be(e),n.declined=!1,n.input.tabIndex=-1)}}function Ia(t,e,n,i,o={}){let r=Array.from(t.children).find(l=>l.hasAttribute("data-aia-location"))??null;if(!e){if(r){let l=Ee.get(r);l&&Pe(l)&&Be(r),r.remove()}return}r||(r=document.createElement("div"),t.appendChild(r));let a=Ee.get(r)??Kc(r,n);a.input.tabIndex=0,le.set(r,{view:e,callbacks:i,interactive:o.interactive??!0}),$(a.results,Gc,le.get(r)),a.input.value!==e.query&&!Pe(a)&&(a.input.value=e.query);let s=l=>`${r?.id}-row-${l}`;if(La(a.results,e,n,s),e.highlighted>=0&&e.highlighted<e.places.length?a.input.setAttribute("aria-activedescendant",s(e.highlighted)):a.input.removeAttribute("aria-activedescendant"),o.inputFocused){let l=o.reediting??!1;l&&!a.wasReediting&&(a.declined=!1),a.wasReediting=l}if(a.widgetFocused=o.inputFocused??!1,o.inputFocused){if(o.reediting&&!a.declined&&o.interactive!==!1&&!Pe(a)){let l=r;queueMicrotask(()=>{l.isConnected&&!Ee.get(l)?.declined&&qc(l)})}}else{let l=a;setTimeout(()=>{if(l.widgetFocused)return;let d=l.returnTo;d&&Nt(d)===d||(l.declined=!1)},0)}}var zc={itemSelector:"[data-aia-pill]",onClick:(t,e)=>{if(e.loading||t.disabled)return;let n=Number.parseInt(t.dataset.aiaPillIndex??"-1",10);n>=0&&e.onSelectPill(n)},preventMousedown:!0},Oa=[125,69];function Ma(t,e){return e?1:t===0?.7:t===1?.4:.2}function pn(t,e,n,i,o=!1,r=!1,a=!1){let s=t.querySelector(".magicx-aia-pill-list");if(s||(s=document.createElement("span"),s.className="magicx-aia-pill-list",t.appendChild(s)),$(s,zc,{onSelectPill:i,loading:r}),r&&e.length===0){s.setAttribute("data-aia-pill-list-loading",""),s.innerHTML="";for(let l=0;l<Oa.length;l++){let d=Oa[l],c=document.createElement("span");c.setAttribute("data-aia-pill-skeleton",""),c.className=`magicx-aia-pill magicx-aia-pill--skeleton${o?" magicx-aia-pill--rounded":""}`,c.style.width=`${d}px`,c.style.setProperty("--aia-pill-opacity",String(Ma(l,!1))),s.appendChild(c)}return}r?s.setAttribute("data-aia-pill-list-loading",""):s.removeAttribute("data-aia-pill-list-loading");for(let l of s.querySelectorAll("[data-aia-pill-skeleton]"))l.remove();ne(s,e,{keyOf:l=>`${l.type?.kind??""}|${Ce(l)?1:0}|${l.parameter}|${l.text}`,create:l=>{let d=document.createElement("button");if(d.type="button",d.tabIndex=-1,d.setAttribute("data-aia-pill",""),d.setAttribute("contenteditable","false"),Ce(l)){d.setAttribute("data-aia-smart-suggestion",C(l)?"header":"");let c=document.createElement("span");c.className="magicx-aia-smart-suggestion-text",c.textContent=l.text;let u=document.createElement("span");u.className="magicx-aia-smart-suggestion-sparkle",u.innerHTML=Wn,d.append(c,u)}else d.textContent=l.text;return d.disabled=!0,d},update:(l,d,c)=>{let u=l,g=a&&c===n&&!r,m=["magicx-aia-pill"];o&&m.push("magicx-aia-pill--rounded"),r&&m.push("magicx-aia-pill--skeleton"),u.className=m.join(" "),u.style.width="",u.style.setProperty("--aia-pill-opacity",String(Ma(c,g))),u.dataset.aiaPillIndex=String(c),u.toggleAttribute("data-aia-pill-active",c===n),r?u.setAttribute("data-aia-loading",""):u.removeAttribute("data-aia-loading")}}),z(s);for(let l of s.querySelectorAll("[data-aia-pill]"))l.disabled=r}function no(t){t.querySelector(".magicx-aia-pill-list")?.remove()}var jc=32;function ka(t,e){if(e.ctrlKey)return null;let n=e.deltaY||0,i=e.deltaX||0;if(!n||Math.abs(i)>=Math.abs(n))return null;let o=t.scrollWidth-t.clientWidth;if(o<=1)return null;let r=t.scrollLeft,a=n;return e.deltaMode===1?a*=32:e.deltaMode===2&&(a*=t.clientWidth),Math.max(0,Math.min(o,r+a))}function io(t){let e=n=>{let i=ka(t,n);i!==null&&(n.preventDefault(),t.scrollLeft=i)};return t.addEventListener("wheel",e,{passive:!1}),()=>t.removeEventListener("wheel",e)}var Ra=Intl.Segmenter,_a=Ra?new Ra(void 0,{granularity:"grapheme"}):null;function oo(t){let e=t.trim().normalize("NFC").toUpperCase();if(_a)for(let n of _a.segment(e))return n.segment;return Array.from(e)[0]??"?"}var ro=120,Yc=360;function Qc(t){let e=t.pathname;return t.hostname==="cdn.shopify.com"&&e.startsWith("/s/files/")||e.startsWith("/cdn/shop/")?/\.png$/i.test(e)?{format:"pjpg"}:/\.webp$/i.test(e)?{format:null}:null:null}function Da(t,e){let n;try{n=new URL(t,typeof document>"u"?void 0:document.baseURI)}catch{return t}let i=Qc(n);return i?(n.searchParams.set("width",String(e)),i.format&&n.searchParams.set("format",i.format),t.startsWith("/")&&!t.startsWith("//")?`${n.pathname}${n.search}${n.hash}`:n.href):t}function ao(t,e){let n=Da(t,e);return n===t?[t]:[n,t]}function so(t,e){if(!(t>0)||!(e>0))return null;let n=t/e,i=o=>Math.round(o*1e3)/1e3;return{x:i(Math.min(n,1)),y:i(Math.min(1/n,1))}}function gn(t){let e=t?.trim();return e?ao(e,360):[]}function Xc(t){return gn(t)[0]}var fn=new WeakMap,co=new WeakMap,Na=new WeakMap;function Fa(t,e,n,i,o,r="row",a="image",s=k(),l){let d=t.querySelector(".magicx-aia-products");if(e.length===0){d?.remove();return}if(!d){d=document.createElement("section"),d.className="magicx-aia-products",d.setAttribute("data-aia-products",""),d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`${n}-products-label`);let g=document.createElement("div");g.className="magicx-aia-products-label",g.id=`${n}-products-label`,g.setAttribute("data-aia-products-label",""),g.textContent=s.products;let m=document.createElement("div");m.className="magicx-aia-products-row",m.setAttribute("data-aia-products-row",""),io(m),d.append(g,m),t.appendChild(d)}d.setAttribute("data-aia-products-layout",r);let c=d.querySelector(".magicx-aia-products-label");c&&c.textContent!==s.products&&(c.textContent=s.products);let u=d.querySelector(".magicx-aia-products-row");if(u){ne(u,e,{keyOf:g=>td(g,!!l),create:g=>nd(g,i,o,a,s,l),update:(g,m,p)=>{fn.set(g,m),Jc(g,m.price,m.compareAtPrice),g.id=`${n}-product-${p}`,g.dataset.aiaIndex=String(p),Na.get(g)?.(a);let f=g.querySelector(".magicx-aia-product-badge");f&&f.textContent!==s.soldOut&&(f.textContent=s.soldOut);let h=g.querySelector(".magicx-aia-product-cart");h&&h.setAttribute("aria-label",Wa(m,s))}}),z(u);for(let g of u.querySelectorAll("[data-aia-product]")){let m=co.get(g);m&&(co.delete(g),m())}}}function uo(t,e){let n=t.querySelectorAll("[data-aia-product], [data-aia-product-cart]");for(let i of n)Ne(i)||(i.tabIndex=e?0:-1)}function Jc(t,e,n){let i=t.querySelector(".magicx-aia-product-price");if(!e){i?.remove();return}i||(i=document.createElement("span"),i.className="magicx-aia-product-price",i.append(document.createTextNode("")),t.querySelector(".magicx-aia-product-title")?.after(i));let o=i.firstChild;o.data!==e&&(o.data=e);let r=i.querySelector(".magicx-aia-product-compare-at");if(!n){r?.remove();return}r||(r=document.createElement("s"),r.className="magicx-aia-product-compare-at",i.append(r)),r.textContent!==n&&(r.textContent=n)}function Ha(t,e){e?(t.style.setProperty("--aia-product-photo-fill-x",String(e.x)),t.style.setProperty("--aia-product-photo-fill-y",String(e.y))):(t.style.removeProperty("--aia-product-photo-fill-x"),t.style.removeProperty("--aia-product-photo-fill-y"))}function Wa(t,e){return`${e.addToCart}: ${t.title}`}var lo="http://www.w3.org/2000/svg";function Zc(){let t=document.createElementNS(lo,"svg");t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false");let e=[["magicx-aia-product-cart-glyph","M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"],["magicx-aia-product-cart-glyph","M13.5 6.5v-4M11.5 4.5h4"],["magicx-aia-product-cart-check","M5 12.5l4.5 4.5L19 7.5"],["magicx-aia-product-cart-spinner","M12 4a8 8 0 1 0 8 8"]];for(let[n,i]of e){let o=document.createElementNS(lo,"path");o.setAttribute("class",n),o.setAttribute("d",i),t.appendChild(o)}for(let n of["9","17.5"]){let i=document.createElementNS(lo,"circle");i.setAttribute("class","magicx-aia-product-cart-glyph"),i.setAttribute("cx",n),i.setAttribute("cy","20"),i.setAttribute("r","1.3"),t.appendChild(i)}return t}function ed(t,e,n,i,o){let r=document.createElement("span");r.className="magicx-aia-product-cart",r.setAttribute("data-aia-product-cart",""),r.setAttribute("role","button"),r.setAttribute("aria-label",Wa(e,o)),r.tabIndex=0,r.appendChild(Zc());let a=s=>{s.preventDefault(),s.stopPropagation(),r.getAttribute("data-aia-cart-state")!=="adding"&&(r.setAttribute("data-aia-cart-state","adding"),r.setAttribute("aria-busy","true"),n(fn.get(t)??e).then(()=>{r.removeAttribute("aria-busy"),r.setAttribute("data-aia-cart-state","added")},()=>{r.removeAttribute("aria-busy"),r.removeAttribute("data-aia-cart-state")}))};return r.addEventListener("keydown",s=>{s.key!=="Enter"&&s.key!==" "||a(s)}),r.addEventListener("focus",()=>i(!0)),r.addEventListener("blur",s=>{s.relatedTarget?.closest("[data-aia-dropdown]")||i(!1)}),{el:r,arm:()=>r.addEventListener("click",a)}}function td(t,e){return[e?"cart":"",t.id,t.title,t.url,t.imageUrl,t.vendor,t.available===!1?"sold-out":""].map(n=>n??"").join("\0")}function nd(t,e,n,i,o,r){let a=document.createElement("a");a.className="magicx-aia-product",a.setAttribute("data-aia-product",""),a.setAttribute("role","option"),a.setAttribute("aria-selected","false"),a.tabIndex=0;let s=document.createElement("span");s.className="magicx-aia-product-media",s.setAttribute("aria-hidden","true");let l=gn(t.imageUrl),d=l[0],c=!!d,u=()=>{s.replaceChildren(),s.removeAttribute("data-aia-image-loaded"),s.toggleAttribute("data-aia-product-placeholder",i==="image"),s.toggleAttribute("data-aia-product-initial",i==="initial"),i==="initial"&&(s.textContent=oo(t.title))};if(Na.set(a,f=>{f!==i&&(i=f,c||u())}),d){let f=document.createElement("img"),h=0;f.onload=()=>{s.setAttribute("data-aia-image-loaded",""),Ha(a,so(f.naturalWidth,f.naturalHeight))},f.onerror=()=>{let v=l[++h];if(v){f.src=v;return}c=!1,Ha(a,null),u()},f.className="magicx-aia-product-image",f.src=d,f.alt="",f.loading="lazy",f.decoding="async",s.appendChild(f)}else u();a.appendChild(s);let g=document.createElement("span");if(g.className="magicx-aia-product-body",t.vendor){let f=document.createElement("span");f.className="magicx-aia-product-vendor",f.textContent=t.vendor,g.appendChild(f)}let m=document.createElement("span");if(m.className="magicx-aia-product-title",m.textContent=t.title,g.appendChild(m),t.available===!1){a.setAttribute("data-aia-product-sold-out","");let f=document.createElement("span");f.className="magicx-aia-product-badge",f.textContent=o.soldOut,g.appendChild(f)}a.appendChild(g);let p=r&&t.available!==!1?ed(a,t,r,n,o):null;return p&&(a.setAttribute("data-aia-product-has-cart",""),a.appendChild(p.el)),co.set(a,()=>{p?.arm(),t.url&&(a.href=t.url),a.addEventListener("click",f=>{f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||f.button!==0||(f.preventDefault(),e(fn.get(a)??t))})}),a.addEventListener("keydown",f=>{f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),e(fn.get(a)??t))}),a.addEventListener("focus",()=>n(!0)),a.addEventListener("blur",f=>{f.relatedTarget?.closest("[data-aia-dropdown]")||n(!1)}),a}var id=10,od=44;function mo(t,e,n){if(!e||n.detail===0)return!0;let i=t.getBoundingClientRect(),o=e.getBoundingClientRect();if(t.ownerDocument.defaultView?.getComputedStyle(t).direction==="rtl"){let s=Math.min(o.left-10,i.right-44);return n.clientX>=s}let a=Math.max(o.right+10,i.left+44);return n.clientX<=a}var Ba="http://www.w3.org/2000/svg",rd=new Set(["svg","g","path","circle","ellipse","line","polyline","polygon","rect"]);function ad(t,e){let n=t.toLowerCase();return n.startsWith("on")||n.includes("href")||n==="style"||n==="xml:base"||n==="id"||n==="name"||/^\s*javascript:/i.test(e)||/url\s*\(\s*['"]?\s*[^#'"\s)]/i.test(e)}var sd=["fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","fill-rule","clip-rule","opacity","fill-opacity","stroke-opacity"],ld=/^[a-zA-Z0-9#.,%\s()-]+$/;function cd(t){let e=[];for(let n of sd){let i=t.getAttribute(n);i===null||!ld.test(i)||/url\s*\(/i.test(i)||e.push(`${n}: ${i.trim()}`)}e.length>0&&t.setAttribute("style",e.join("; "))}function Va(t){for(let e of Array.from(t.attributes))ad(e.name,e.value)&&t.removeAttribute(e.name);cd(t);for(let e of Array.from(t.childNodes))if(e.nodeType===Node.ELEMENT_NODE){let n=e;!rd.has(n.localName)||n.namespaceURI!==Ba?n.remove():Va(n)}else e.remove()}function ce(t){if(typeof DOMParser>"u"||typeof XMLSerializer>"u")return null;let e=new DOMParser().parseFromString(t,"image/svg+xml"),n=e.documentElement;return!n||n.localName!=="svg"||n.namespaceURI!==Ba||e.getElementsByTagName("parsererror").length>0?null:(Va(n),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),new XMLSerializer().serializeToString(n))}function hn(t){return t.text}function we(t){return ht(t)[0]??null}function ht(t){let e=dd(t);return e?ao(e,120):[]}function dd(t){if(!t)return null;let e=t.trim();if(e==="")return null;let n;try{n=new URL(e,typeof document>"u"?void 0:document.baseURI)}catch{return null}return n.protocol!=="http:"&&n.protocol!=="https:"?null:n.href}function bt(t){return t===void 0||!Number.isInteger(t)||t<0?null:t.toLocaleString()}var Ua={one:"item",other:"items"};function ud(t,e=Ua){let n=bt(t);if(n===null)return null;let i=typeof e=="string"?e:t===1?e.one:e.other;return i===""?n:`${n} ${i}`}function $a(t){return we(t.image_url)!==null}var bn=new Map;function md(t){let e=t.icon_svg;if(!e)return!1;let n=bn.get(e);return n===void 0&&(n=ce(e)!==null,bn.size>=256&&bn.clear(),bn.set(e,n)),n}function po(t,e,n){return!e&&!n?!1:t.every(i=>!i.is_tappable||n&&$a(i)||e&&md(i))}var Ga=new WeakMap;function pd(t,e,n){let i=e.length,o=ut(),r=Ga.get(t),a=n&&r&&Pi(r.options,e)?r.plan:null,s=!a&&!n&&vi(i,o)?ct(t):null,l=a??Ei(i,o,s?.rowWidths??null,s?.gridWidth??null);return n||Ga.set(t,{options:e,plan:l}),t.style.gridTemplateColumns=l.template,t.style.setProperty("--aia-grid-max-height",l.maxHeight),t.querySelectorAll("[data-aia-option]").forEach((d,c)=>{d.classList.toggle("magicx-aia-option--scroll-hint",!n&&l.scrollHintIndices.includes(c))}),l.cols}function qa(t,e){if(e.loading||!e.interactive)return null;let n=e.options[be(t)];return n?.is_tappable?n:null}var gd={itemSelector:"[data-aia-option]",onClick:(t,e,n)=>{let i=qa(t,e);if(!i)return;t.classList.add("magicx-aia-option--pressed");let o=t.querySelector(".magicx-aia-checkbox"),r=o!==null&&!mo(t,o,n);if(o){let a=r||t.getAttribute("aria-selected")!=="true";t.setAttribute("aria-selected",String(a)),o.dataset.checked=String(a),o.textContent=a?"\u2713":""}r?e.onSelect(i,{commit:!0}):e.onSelect(i),setTimeout(()=>t.classList.remove("magicx-aia-option--pressed"),170)},onEnter:(t,e)=>{qa(t,e)&&e.onHighlight(be(t))},onLeave:(t,e)=>e.onHighlight(-1,be(t))};function Ka(t,e,n,i,o,r,a,s="",l="below",d=!0,c=!0,u=!0,g=!0,m){let p=t.querySelector(".aia-grid");if(e.length===0){p?.remove();return}p||(p=document.createElement("div"),p.className="aia-grid magicx-aia-grid",p.setAttribute("data-scroll",""),p.style.setProperty("--aia-grid-min","250px"),p.style.setProperty("--aia-grid-max","1fr"),p.style.setProperty("--aia-grid-gap","0"),t.appendChild(p)),$(p,gd,{options:e,onSelect:i,onHighlight:o,loading:a,interactive:g});let f=p.dataset.aiaGroup!==s;p.dataset.aiaGroup=s;let h=po(e,d,c);fd(p,e,n,r,a,{showIcons:d&&h,showImages:c&&h,showCounts:u,picked:m});let v=pd(p,e,a);hd(p,e.length,v,a,l),f&&(p.scrollTop=0)}function fd(t,e,n,i,o,r){let a=o?"1":"0",s=t.dataset.aiaGroup??"",{showIcons:l,showImages:d,showCounts:c}=r,u=l?p=>p.icon??p.icon_svg??"":()=>"",g=d?p=>`${we(p.image_url)??""}${(p.imageCollage??[]).join("")}`:()=>"",m=c?p=>bt(p.item_count)??"":()=>"";ne(t,e,{keyOf:p=>`${p.text}\0${p.parameter??""}\0${p.parameterLabel??""}\0${u(p)}\0${g(p)}\0${m(p)}\0${a}\0${s}`,create:(p,f)=>{let h=bd(p,o,r);return o||(h.dataset.aiaEntering=""),h},update:(p,f,h)=>{if(go.get(p)!==(f.matchedText??"")){let S=p.querySelector(".magicx-aia-option-text");S&&za(S,f),go.set(p,f.matchedText??"")}let v=h===n&&!o;p.id=`${i}-option-${h}`,p.dataset.aiaIndex=String(h),p.setAttribute("aria-selected",String(r.picked?r.picked.includes(f.text):v));let y=p.querySelector(".magicx-aia-checkbox");r.picked&&f.is_tappable?(y||(y=document.createElement("span"),y.className="magicx-aia-checkbox",y.setAttribute("aria-hidden","true"),p.querySelector(".magicx-aia-option-content")?.prepend(y)),y.dataset.checked=String(r.picked.includes(f.text)),y.textContent=r.picked.includes(f.text)?"\u2713":""):y?.remove(),p.classList.toggle("magicx-aia-option--highlighted",v),p.classList.toggle("magicx-aia-option--live-match",!!f.liveMatch&&!o)}})}function hd(t,e,n,i,o){for(let r of t.querySelectorAll("[data-aia-entering]")){if(!i){let a=Number.parseInt(r.dataset.aiaIndex??"-1",10);a>=0&&r.style.setProperty(Wi,`${Bi(a,n,e,o)}ms`)}delete r.dataset.aiaEntering}}var go=new WeakMap;function za(t,e){if(t.replaceChildren(),e.matchedText)for(let n of Ai(hn(e),e.matchedText))if(n.bold){let i=document.createElement("strong");i.className="magicx-aia-option-match",i.textContent=n.text,t.appendChild(i)}else t.appendChild(document.createTextNode(n.text));else t.appendChild(document.createTextNode(hn(e)));if(e.parameterLabel){t.appendChild(document.createTextNode(" "));let n=document.createElement("span");n.className="magicx-aia-option-parameter",n.textContent=e.parameterLabel,t.appendChild(n)}}function bd(t,e,{showIcons:n,showImages:i,showCounts:o}){let r=document.createElement("div");r.setAttribute("role","option"),r.setAttribute("data-aia-option",""),e&&r.setAttribute("data-aia-loading",""),r.tabIndex=e||!t.is_tappable?-1:0;let a=["magicx-aia-option"];t.is_tappable?a.push("magicx-aia-option--tappable"):a.push("magicx-aia-option--non-tappable"),r.className=a.join(" ");let s=document.createElement("span");s.className="magicx-aia-option-content";let l=i?ht(t.image_url):[],d=l[0];if(d){let m=document.createElement("span");m.className="magicx-aia-option-image",m.setAttribute("aria-hidden","true");let p=(t.imageCollage??[]).map(f=>ht(f)).filter(f=>f.length>0);p.length>1&&m.setAttribute("data-aia-collage",String(p.length));for(let f of p.length>1?p:[l]){let h=document.createElement("img");h.setAttribute("alt",""),h.setAttribute("loading","lazy"),h.setAttribute("decoding","async"),h.setAttribute("referrerpolicy","no-referrer"),h.setAttribute("draggable","false");let v=0;h.onload=()=>m.setAttribute("data-aia-image-loaded",""),h.onerror=()=>{let y=f[++v];y?h.src=y:h.hidden=!0},h.src=f[0],m.appendChild(h)}s.appendChild(m),r.dataset.aiaImage=""}let c=!d&&n&&t.icon_svg?ce(t.icon_svg):null;if(c){let m=document.createElement("span");m.className="magicx-aia-option-icon",m.setAttribute("aria-hidden","true"),m.innerHTML=c,s.appendChild(m),t.icon&&(r.dataset.aiaIcon=t.icon)}let u=document.createElement("span");if(u.className="magicx-aia-option-text",za(u,t),go.set(r,t.matchedText??""),s.appendChild(u),t.tag){let m=document.createElement("span");m.className="magicx-aia-option-tag",m.textContent=t.tag,s.appendChild(m)}let g=o?bt(t.item_count):null;if(g!==null){let m=document.createElement("span");m.className="magicx-aia-option-count",m.textContent=g,s.appendChild(m),r.dataset.aiaItemCount=String(t.item_count)}return r.appendChild(s),r}var Sd=120,yd={itemSelector:"[data-aia-time-row], [data-aia-time-done]",onClick:(t,e)=>{if(!e.interactive)return;if(t.hasAttribute("data-aia-time-done")){e.callbacks.onTimeCommit();return}let n=t.dataset.aiaTimeColumn;n&&e.callbacks.onTimeChange(jt(n,e.view.minutes,Number(t.dataset.aiaIndex)))}},Ya=new WeakMap,ja=new WeakMap;function Qa(t,e,n,i,o=!0){let r=t.querySelector(".magicx-aia-time-wheel");if(!e){r?.remove();return}if(!r){r=vd(),t.appendChild(r),z(r);let d=r.querySelector("[data-aia-time-done]");d&&(d.disabled=!1)}let a={view:e,callbacks:i,interactive:o};Ya.set(r,a),$(r,yd,a),r.setAttribute("aria-label",n.timeLabel);let s=r.querySelector("[data-aia-time-done]");s&&(s.textContent=n.done);let l=r.querySelector("[data-aia-time-value]");l&&(l.textContent=Gt(e.minutes));for(let d of Kt){let c=r.querySelector(`[data-aia-time-column="${d}"]`);c&&Td(c,d,e.minutes)}}function Td(t,e,n){let i=zt(e,n);for(let a of t.querySelectorAll("[data-aia-time-row]")){let s=Number(a.dataset.aiaIndex)===i;a.classList.toggle("magicx-aia-time-wheel-row--selected",s),a.setAttribute("aria-selected",String(s))}let o=Sn(t);if(o.settle)return;let r=i*qt;Math.abs(t.scrollTop-r)<1||(o.syncedTop=r,t.scrollTop=r)}function Sn(t){let e=ja.get(t);return e||(e={syncedTop:null,settle:null},ja.set(t,e)),e}function xd(t,e,n){let i=Sn(e);if(i.syncedTop!=null&&Math.abs(e.scrollTop-i.syncedTop)<1){i.syncedTop=null;return}i.syncedTop=null,i.settle&&clearTimeout(i.settle),i.settle=setTimeout(()=>Xa(t,e,n),Sd)}function Xa(t,e,n){let i=Sn(e);i.settle&&clearTimeout(i.settle),i.settle=null;let o=Ya.get(t);if(!o||!o.interactive)return;let r=ui(n,e.scrollTop);r!==zt(n,o.view.minutes)&&o.callbacks.onTimeChange(jt(n,o.view.minutes,r))}function vd(){let t=document.createElement("div");t.className="magicx-aia-time-wheel",t.setAttribute("data-aia-time-wheel",""),t.setAttribute("role","group");let e=document.createElement("span");e.className="magicx-aia-time-wheel-value",e.setAttribute("data-aia-time-value",""),e.setAttribute("aria-live","polite");let n=document.createElement("div");n.className="magicx-aia-time-wheel-columns",n.setAttribute("aria-hidden","true");let i=document.createElement("div");i.className="magicx-aia-time-wheel-band",n.appendChild(i);for(let r of Kt){if(r==="minute"){let a=document.createElement("span");a.className="magicx-aia-time-wheel-separator",a.textContent=":",n.appendChild(a)}n.appendChild(Ed(t,r))}let o=document.createElement("button");return o.type="button",o.tabIndex=-1,o.className="magicx-aia-time-wheel-done",o.setAttribute("data-aia-time-done",""),o.disabled=!0,t.append(e,n,o),t}function Ed(t,e){let n=document.createElement("div");return n.className="magicx-aia-time-wheel-column",n.setAttribute("data-aia-time-column",e),di(e).forEach((i,o)=>{let r=document.createElement("div");r.className="magicx-aia-time-wheel-row",r.setAttribute("data-aia-time-row",""),r.dataset.aiaTimeColumn=e,r.dataset.aiaIndex=String(o),r.textContent=i.label,n.appendChild(r)}),n.addEventListener("scroll",()=>xd(t,n,e),{passive:!0}),n.addEventListener("scrollend",()=>{Sn(n).settle&&Xa(t,n,e)}),n}var Ve="data-aia-fit",yn="--aia-dropdown-fit-height",Ja=8,Pd=160;function fo({dropdown:t,isOpen:e}){let n=t.ownerDocument?.defaultView??null,i=!1,o=!1,r=null,a=null,s=null,l=null,d=!1,c=()=>{t.removeAttribute(Ve),t.style.removeProperty(yn)},u=()=>{if(Se(t)){d=!0;return}d=!1,Xi(t,t.getBoundingClientRect().height)},g=y=>`${r}|${(y??t).scrollHeight}|${t.offsetWidth}`,m=y=>s?.key===g(y)?s.height:null,p=y=>{let S=g(y);if(s?.key===S)return s.height;let b=y?.scrollTop??0;t.removeAttribute(Ve);let x=t.offsetHeight;return t.setAttribute(Ve,""),y&&b&&(y.scrollTop=b),s={key:S,height:x},x},f=()=>{if(i)return;if(!e()){o=!1;return}let y=Se(t),S=y?Qi(t):null;y&&l!==y&&(l=y,y.finished.then(h,h)),!y&&d&&u(),o||(o=!0,c());let b=t.hasAttribute(Ve),x=G(t,".aia-grid")?.getAttribute("data-aia-group")??null,E=x!==r;r=x;let P=Ld(t,n);if(P===null)return;let T=wd(t);if(b){let F=y?m(T):p(T);if(F!==null&&F<=P){c(),u();return}}else if((S??t.offsetHeight)<=P)return;let L=`${Math.max(Pd,Math.floor(P))}px`,A=t.style.getPropertyValue(yn)!==L;A&&t.style.setProperty(yn,L),b?E&&T&&(T.scrollTop=0):t.setAttribute(Ve,""),(A||!b)&&u()},h=()=>{i||a!==null||!n||(a=n.requestAnimationFrame(()=>{a=null,f()}))},v=n?.visualViewport??null;return v?.addEventListener("resize",h),v?.addEventListener("scroll",h),n?.addEventListener("resize",h),n?.addEventListener("scroll",h,{capture:!0,passive:!0}),f(),{update:f,destroy(){i||(i=!0,a!==null&&n?.cancelAnimationFrame(a),v?.removeEventListener("resize",h),v?.removeEventListener("scroll",h),n?.removeEventListener("resize",h),n?.removeEventListener("scroll",h,{capture:!0}))}}}function wd(t){for(let e of Array.from(t.children))if(e.classList.contains("aia-stack"))return e;return null}function Ld(t,e){if(!e)return null;let n=e.visualViewport,i=n?n.offsetTop:0,o=n?n.height:e.innerHeight;if(!o)return null;let r=t.offsetParent,a=r?r.getBoundingClientRect().top:0,s=r?a+t.offsetTop:t.getBoundingClientRect().top;return t.closest("[data-options-position]")?.getAttribute("data-options-position")==="above"?(r?s+t.offsetHeight:t.getBoundingClientRect().bottom)-i-Ja:i+o-s-Ja}var Cd=[159,119,164];function vn(t){let e=document.createElement("div");return e.id=t,e.setAttribute("role","listbox"),e.setAttribute("data-aia-dropdown",""),e.className="magicx-aia-dropdown",e.addEventListener("mousedown",n=>n.preventDefault()),Hi(e),e}var Tn=new WeakMap;function Ad(t,e,n){let i=Tn.get(t);if(i||(i={button:ca(t.ownerDocument,n),grid:null,controller:null},t.appendChild(i.button),Tn.set(t,i)),i.button.getAttribute("aria-label")!==n.scrollArrow&&i.button.setAttribute("aria-label",n.scrollArrow),i.grid!==e&&(i.controller?.destroy(),i.controller=null,i.grid=e,e)){i.controller=Gi({dropdown:t,grid:e,button:i.button});return}i.controller?.update()}var xn=new WeakMap;function Za(t){let e=xn.get(t);if(e){e.update();return}xn.set(t,fo({dropdown:t,isOpen:()=>t.classList.contains("magicx-aia-dropdown--visible")}))}function ho(t){xn.get(t)?.destroy(),xn.delete(t),Ji(t);let e=Tn.get(t);e&&(e.controller?.destroy(),Tn.delete(t))}function En(t,e){let n=e.strings??k(),{filteredOptions:i,activeIndex:o,isOpen:r,isLoading:a,showPills:s,isActivePillSelected:l,onSelect:d,onHighlight:c,onPillClick:u,onSkip:g}=e,m=Fn(e.pills,n.keepTyping),p=Bn(m),f=s&&m.length>0,h=i.length>0,v=e.products.length>0,y=e.formatType==="time"&&e.timeView!=null,S=e.formatType==="location"&&e.locationView!=null,b=r&&(h||f||a||v||y||S);if(b?t.classList.add("magicx-aia-dropdown--visible"):t.classList.remove("magicx-aia-dropdown--visible"),a?t.setAttribute("data-aia-loading",""):t.removeAttribute("data-aia-loading"),!b){uo(t,!1),Aa(t),Za(t),mn(t,null,{visible:!1});return}v?t.setAttribute("data-aia-has-products",""):t.removeAttribute("data-aia-has-products"),t.toggleAttribute(eo,e.fullWidth===!0),ft(t),t.toggleAttribute("data-aia-skeleton-exiting",!!e.skeletonExiting);let x=t.querySelector(".aia-stack");x||(x=document.createElement("div"),x.className="aia-stack",x.style.setProperty("--aia-stack-space","8px"),t.appendChild(x));let E=e.showSkipButton&&p&&!e.isInputEmpty,P=f||a&&s||E,T=x.querySelector(".magicx-aia-pill-bar");if(P){T||(T=document.createElement("div"),T.className="magicx-aia-pill-bar aia-cluster",T.setAttribute("data-nowrap",""),T.setAttribute("data-aia-pillbar",""),x.insertBefore(T,x.firstChild));let ie=f||a&&s,D=T.querySelector(".magicx-aia-pill-scroll");ie?(D||(D=document.createElement("span"),D.className="magicx-aia-pill-scroll",D.setAttribute("data-aia-pill-scroll",""),T.insertBefore(D,T.firstChild)),pn(D,m,0,u,!0,a,l)):D&&D.remove(),Md(T,E,a||e.skipDisabled,m[0],g,n)}else T&&T.remove();let L=e.suggestions[0],A=L?`${L.parameter} ${L.text}`:"",F=_(e.formatType),R=F&&!a;Ka(x,F?[]:i,o,d,c,e.listboxId,a,A,e.optionsPosition??"below",e.showOptionIcons??!0,e.showOptionImages??!0,e.showOptionCounts??!0,!e.skipDisabled,e.multiSelectView?.picked),t.setAttribute("aria-multiselectable",String(!!e.multiSelectView)),Nd(x,!!e.multiSelectView,e.skipDisabled||a,e.onMultiSelectCommit,n.done),Ad(t,x.querySelector(".aia-grid"),n),Pa(x,R?i:[],o,e.listboxId,R?e.dateView:null,{selectedIso:e.selectedDateIso,selectedRange:e.selectedDateRange,rangeStart:e.dateRangeStart,floor:Ri(e.formatType,e.dateRangeStart),references:e.dateReferences??[]},{onSelect:d,onHighlight:c,onPreviousMonth:e.onPreviousMonth,onNextMonth:e.onNextMonth},!e.skipDisabled),Qa(x,e.formatType==="time"&&!a?e.timeView:null,n,{onTimeChange:e.onTimeChange,onTimeCommit:e.onTimeCommit},!e.skipDisabled),Ia(x,e.formatType==="location"&&!a?e.locationView:null,n,{onLocationQuery:e.onLocationQuery,onLocationMove:e.onLocationMove,onLocationCommit:e.onLocationCommit,onLocationFocusChange:e.onLocationFocusChange},{interactive:!e.skipDisabled,inputFocused:e.isFocused??!1,reediting:e.isReediting??!1});let q=x.querySelector(".magicx-aia-skeleton-bars");if(a&&(!h||H(e.formatType))){if(!q){q=document.createElement("div"),q.className="magicx-aia-skeleton-bars",q.setAttribute("data-aia-skeleton-bars","");for(let ie of Cd){let D=document.createElement("span");D.className="magicx-aia-skeleton-bar",D.style.width=`${ie}px`,q.appendChild(D)}x.appendChild(q)}}else q&&q.remove();Fa(x,e.products,e.listboxId,e.onProductSelect,e.onProductFocusChange,e.productsLayout??"row",e.productImageFallback??"image",n,e.onProductAddToCart),uo(t,!a),Dd(x,e.onSeeAllResults,n.seeAllResults);let I=x.querySelector(".magicx-aia-footer")??Rd(n),Q=o>=0&&!!i[o]?.is_tappable;kd(I,Di(Q,e.isInputEmpty,n)),I.isConnected||x.appendChild(I),Id(x,[".magicx-aia-pill-bar",".aia-grid","[data-aia-multi-actions]",".magicx-aia-datepicker",".magicx-aia-time-wheel","[data-aia-location]",".magicx-aia-skeleton-bars",".magicx-aia-products","[data-aia-see-all]",".magicx-aia-footer"]),Fi(x,x.querySelector(".magicx-aia-multi-done")),to(t,x,{eligible:h&&!v&&!F&&!y&&!S&&!e.onSeeAllResults&&!e.fullWidth,loading:a}),Za(t),mn(t,Yi(s?m:[]),{visible:!0,anchorBottom:e.optionsPosition==="above"})}function Id(t,e){let n=e.map(i=>t.querySelector(`:scope > ${i}`)).filter(i=>i!==null);for(let i=0;i<n.length;i++)t.children[i]!==n[i]&&t.insertBefore(n[i],t.children[i]??null)}var Od={itemSelector:".magicx-aia-skip",onClick:(t,e)=>{e.loading||e.onSkip()}};function Md(t,e,n,i,o,r){$(t,Od,{onSkip:o,loading:n});let a=t.querySelector(".magicx-aia-skip");if(!e){a?.remove();return}a||(a=document.createElement("button"),a.type="button",a.tabIndex=-1,a.className="magicx-aia-skip",a.setAttribute("data-aia-skip",""),a.textContent=r.skip,a.disabled=!0,t.appendChild(a),z(a)),a.textContent!==r.skip&&(a.textContent=r.skip),a.setAttribute("aria-label",i?`${r.skipLabel} ${i.text}`:r.skipLabel),a.disabled=n}function kd(t,{key:e,hint:n}){let i=t.querySelector(".magicx-aia-footer-key"),o=t.querySelector(".magicx-aia-footer-hint");!i||!o||(i.textContent!==e&&(i.textContent=e),o.textContent!==n&&(o.textContent=n))}function Rd(t){let e=document.createElement("footer");e.className="magicx-aia-footer",e.setAttribute("data-aia-footer","");let n=document.createElement("div");n.className="aia-cluster magicx-aia-footer-row",n.setAttribute("data-align","center"),n.setAttribute("data-justify","between"),n.setAttribute("data-nowrap","");let i=document.createElement("div");i.className="aia-cluster magicx-aia-footer-hint-group",i.setAttribute("data-align","center"),i.style.setProperty("--aia-cluster-gap","5px");let o=document.createElement("kbd");o.className="magicx-aia-footer-key",o.textContent="tab";let r=document.createElement("span");r.className="magicx-aia-footer-hint",r.textContent=t.select,i.append(o,r);let a=document.createElement("a");a.className="aia-cluster magicx-aia-footer-brand-link",a.setAttribute("data-align","center"),a.href=_i(),a.target="_blank",a.rel="noopener noreferrer",a.style.setProperty("--aia-cluster-gap","2px");let s=document.createElement("span");s.className="magicx-aia-footer-brand",s.textContent="AI";let l=document.createElement("span");return l.className="magicx-aia-footer-badge",l.textContent="Autocomplete",a.append(s,l),n.append(i,a),e.append(n),e}var _d={itemSelector:".magicx-aia-see-all",onClick:(t,e,n)=>{e.submit&&(n.stopPropagation(),e.submit())}};function Dd(t,e,n){let i=t.querySelector(":scope > [data-aia-see-all]");if(!e){i?.remove();return}if(!i){i=document.createElement("div"),i.className="magicx-aia-see-all-row",i.dataset.aiaSeeAll="";let r=document.createElement("button");r.type="button",r.tabIndex=-1,r.className="magicx-aia-see-all",r.disabled=!0,i.appendChild(r),t.appendChild(i),z(r)}$(i,_d,{submit:e});let o=i.querySelector("button");o&&(o.textContent!==n&&(o.textContent=n),o.disabled=!1)}var Hd={itemSelector:".magicx-aia-multi-done",onClick:(t,e)=>{e.disabled||e.commit?.()}};function Nd(t,e,n,i,o){let r=t.querySelector("[data-aia-multi-actions]");if(!e){r?.remove();return}if(!r){r=document.createElement("div"),r.dataset.aiaMultiActions="";let s=document.createElement("button");s.type="button",s.tabIndex=-1,s.className="magicx-aia-multi-done",s.setAttribute("data-aia-multi-done",""),s.disabled=!0,r.appendChild(s),t.appendChild(r),z(s)}$(r,Hd,{commit:i,disabled:n});let a=r.querySelector("button");a&&(a.textContent=o,a.disabled=n)}function es(t,e){let n=vn(e.listboxId);return t.appendChild(n),{dropdown:n}}function bo(t,e,n){let i=gt(e);En(t.dropdown,{strings:n.strings,suggestions:e.editingIdentified?[{parameter:e.editingIdentified.parameter,text:ae(e.editingIdentified.parameter),required:!0,options:e.filteredOptions}]:e.dropdownSuggestion??e.actionableSuggestions[0]?[{...e.dropdownSuggestion??e.actionableSuggestions[0],options:e.dropdownOptions}]:[],filteredOptions:e.dropdownOptions,activeIndex:e.activeDropdownIndex,isOpen:e.isDropdownOpen,isLoading:e.dropdownLoading,skeletonExiting:e.skeletonExiting,listboxId:n.listboxId,pills:e.actionableSuggestions,showPills:!0,showSkipButton:n.showSkipButton&&!e.editingParam&&!e.editingIdentified,skipDisabled:e.inSelectionAnimation,showOptionIcons:n.showOptionIcons??!0,showOptionImages:n.showOptionImages??!0,showOptionCounts:n.showOptionCounts??!0,isActivePillSelected:e.isActivePillSelected,isInputEmpty:e.text.trim().length===0,products:e.products,productsLayout:n.productsLayout??"row",productImageFallback:n.productImageFallback??"image",onProductAddToCart:n.addProductToCart,formatType:e.activeFormatType,dateView:e.dateView,selectedDateIso:i.selectedIso,selectedDateRange:i.selectedRange,dateRangeStart:i.rangeStart,dateReferences:i.references,timeView:e.timeView,multiSelectView:e.dropdownMultiSelect,locationView:e.locationView,isReediting:e.editingParam!=null,isFocused:e.isFocused||e.locationFieldFocused,optionsPosition:n.optionsPosition??"below",onSelect:n.selectOption,onHighlight:(o,r)=>{r!==void 0&&n.store.get().activeDropdownIndex!==r||n.store.set({activeDropdownIndex:o})},onPillClick:n.setActivePill,onSkip:n.skipActivePill,onPreviousMonth:n.showPreviousMonth,onNextMonth:n.showNextMonth,onTimeChange:n.setTime,onTimeCommit:n.commitTime,onMultiSelectCommit:n.commitMultiSelect,onLocationQuery:n.setLocationQuery,onLocationMove:n.moveLocationHighlight,onLocationCommit:n.commitLocation,onLocationFocusChange:n.setLocationFieldFocused,onProductSelect:n.selectProduct,onProductFocusChange:o=>n.store.set({isFocused:o})})}var Fd="[data-aia-chip-remove]";function So(t,e){let n=e;if(!n||n.nodeType===void 0)return null;let o=(n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest(Fd)??null;return o&&t.contains(o)?o:null}function yo(t,e){let n=null,i=d=>{n=null;let c=d;if(c.button)return;let u=So(t,d.target);if(!u)return;d.preventDefault(),d.stopPropagation();let g=u.dataset.aiaChipRemove,m=c.pointerType==="touch"||c.pointerType==="pen";n={id:g,x:c.clientX,y:c.clientY,pending:m},!m&&g&&e(g)},o=d=>{if(!n?.pending)return;n.pending=!1;let c=d;if(Math.hypot(c.clientX-n.x,c.clientY-n.y)>10)return;let g=t.getRootNode().elementFromPoint?.(c.clientX,c.clientY)??d.target,m=So(t,g)?.dataset.aiaChipRemove;m&&m===n.id&&e(m)},r=()=>{n&&(n.pending=!1)},a=d=>{!n&&!So(t,d.target)||(d.cancelable&&d.preventDefault(),d.type==="click"&&(d.stopImmediatePropagation(),n=null))},s={capture:!0},l={capture:!0,passive:!1};return t.addEventListener("pointerdown",i,s),t.addEventListener("pointerup",o,s),t.addEventListener("pointercancel",r,s),t.addEventListener("touchstart",a,l),t.addEventListener("mousedown",a,s),t.addEventListener("click",a,s),()=>{t.removeEventListener("pointerdown",i,s),t.removeEventListener("pointerup",o,s),t.removeEventListener("pointercancel",r,s),t.removeEventListener("touchstart",a,l),t.removeEventListener("mousedown",a,s),t.removeEventListener("click",a,s)}}var Wd=340;function To(t){let e=t.ownerDocument.defaultView;if(!e||typeof e.MutationObserver!="function")return()=>{};let n=()=>{if(!t.isConnected)return;let c=t.style.height?t.getBoundingClientRect().height:0;t.style.height="";let u=t.getBoundingClientRect().height;if(u!==0){if(c===0||Math.abs(u-c)<.5){t.style.height=`${u}px`;return}t.style.height=`${c}px`,t.getBoundingClientRect(),t.style.height=`${u}px`}},i=-1,o=typeof e.ResizeObserver=="function"?new e.ResizeObserver(c=>{for(let g of c)if(g.target!==t){n();return}let u=t.getBoundingClientRect().width;Math.abs(u-i)<.5||(i=u,n())}):null,r=()=>{for(let c of Array.from(t.children))o?.observe(c)},a=0,s=()=>{r(),n(),e.clearTimeout(a),a=e.setTimeout(n,340)},l=new e.MutationObserver(s);l.observe(t,{childList:!0,characterData:!0,subtree:!0,attributes:!0,attributeFilter:["data-placeholder","data-aia-empty"]}),o?.observe(t),r(),t.addEventListener("load",s,!0);let d=!1;return t.ownerDocument.fonts?.ready.then(()=>{d||n()}),n(),()=>{d=!0,t.removeEventListener("load",s,!0),l.disconnect(),o?.disconnect(),e.clearTimeout(a),t.style.height=""}}var os=2600,Bd=3,Po="data-aia-hint",Eo="magicx-aia-hint",rs="data-aia-hint-el",Vd={position:"absolute",pointerEvents:"none",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--aia-hint-color, #999)",userSelect:"none"},Ud=280,$d=320,Gd=380,xo="cubic-bezier(0.25, 0.1, 0.25, 1)",ts=new Set(["a","an","the","some","my"]),Ln=new WeakMap;function qd(t){return t.closest('[data-animations="off"]')?!0:!!t.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches}function ns(t,e){let n=t.text.trim(),i=e.trim(),o=[];i&&n.toLowerCase().startsWith(`${i.toLowerCase()} `)&&(n=n.slice(i.length+1).trim());let r=i?i.split(/\s+/):[],a=null;r.length>1&&ts.has(r[r.length-1].toLowerCase())&&(a=r.pop()??null);let s=r.join(" ");s&&o.push({key:`w:${s.toLowerCase()}`,text:s,icon:null});let l=null,[d,...c]=n.split(/\s+/);c.length&&d&&ts.has(d.toLowerCase())&&(l=d,n=c.join(" "));let u=l??a;u&&o.push({key:`w:${u.toLowerCase()}`,text:u,icon:null});let g=t.icon_svg?ce(t.icon_svg):null;return o.push({key:`c:${g??""}:${n}`,text:n,icon:g}),o}function Kd(t,e){let n=t.createElement("span");if(n.className=`${Eo}__word`,n.dataset.key=e.key,n.style.display="inline-block",e.icon){let i=t.createElement("span");i.className=`${Eo}__icon`,Object.assign(i.style,{display:"inline-flex",width:"1em",height:"1em",marginRight:"0.25em",verticalAlign:"-0.125em",opacity:"var(--aia-hint-icon-opacity, 0.7)"}),i.innerHTML=e.icon;let o=i.querySelector("svg");o&&(o.style.width="100%",o.style.height="100%"),n.appendChild(i)}return n.appendChild(t.createTextNode(e.text)),n}function vo(t,e,n){return typeof t.animate=="function"?t.animate(e,n):null}function Pn(t,e){let n=t.ownerDocument?.defaultView;if(!n)return;let i=n.getComputedStyle(t),o=c=>Number.parseFloat(c)||0,r=t.offsetLeft+o(i.borderLeftWidth)+o(i.paddingLeft),a=t.offsetTop+o(i.borderTopWidth)+o(i.paddingTop),s=t.clientWidth-o(i.paddingLeft)-o(i.paddingRight),l=t.offsetParent instanceof HTMLElement?t.offsetParent.clientWidth-r:0,d=Math.max(s,l);e.style.left=`${r}px`,e.style.top=`${a}px`,d>0&&(e.style.maxWidth=`${d}px`),e.style.font=i.font,e.style.lineHeight=i.lineHeight,e.style.letterSpacing=i.letterSpacing,e.style.fontWeight="var(--aia-hint-font-weight, 300)"}function is(t,e,n,i){let{el:o}=t,r=o.ownerDocument,a=new Map;for(let m of Array.from(o.children))m.dataset.leaving===void 0&&m.dataset.key&&a.set(m.dataset.key,m);let s=new Map;for(let[m,p]of a)s.set(m,p.offsetLeft);let l=new Set(e.map(m=>m.key));for(let[m,p]of a){if(l.has(m))continue;if(!n){p.remove();continue}p.dataset.leaving="",p.style.position="absolute",p.style.left=`${s.get(m)??0}px`,p.style.top=`${p.offsetTop}px`;let f=vo(p,[{opacity:1,filter:"blur(0)"},{opacity:0,filter:"blur(2px)"}],{duration:Ud,easing:xo,fill:"forwards"});f?f.onfinish=()=>p.remove():p.remove()}let d=Array.from(o.children).filter(m=>m.dataset.leaving!==void 0),c=[];if(e.forEach((m,p)=>{p>0&&c.push(r.createTextNode(" ")),c.push(a.get(m.key)??Kd(r,m))}),o.replaceChildren(...c,...d),!n)return;let u=new Map;for(let m of c)m instanceof HTMLElement&&m.dataset.key&&u.set(m.dataset.key,m);let g=0;for(let m of e){let p=u.get(m.key);if(p)if(!a.has(m.key))vo(p,[{opacity:0,filter:"blur(2px)"},{opacity:1,filter:"blur(0)"}],{duration:$d,delay:i?80*g++:180+60*g++,easing:xo,fill:"backwards"});else{let h=(s.get(m.key)??p.offsetLeft)-p.offsetLeft;Math.abs(h)>.5&&vo(p,[{transform:`translateX(${h}px)`},{transform:"none"}],{duration:Gd,easing:xo})}}}function wn(t){let e=Ln.get(t);e&&(e.timer!==null&&clearInterval(e.timer),e.resize?.disconnect(),e.el.remove(),Ln.delete(t),t.removeAttribute(Po),t.removeAttribute("aria-placeholder"))}function as(t,e,n,i){let o=i.filter(p=>p.text.trim()!=="").slice(0,Bd),r=t.parentElement;if(!e||o.length<2||!r){wn(t);return}let a=`${n}\0${o.map(p=>`${p.text}${p.icon_svg??""}`).join("\0")}`,s=Ln.get(t);if(s&&s.key===a&&s.el.isConnected){Pn(t,s.el);return}wn(t);let l=t.ownerDocument,d=l.createElement("span");d.className=Eo,d.setAttribute(rs,""),d.setAttribute("aria-hidden","true"),Object.assign(d.style,Vd),r.insertBefore(d,t),t.setAttribute(Po,""),n.trim()&&t.setAttribute("aria-placeholder",n.trim()),Pn(t,d);let c=l.defaultView,u=c?.ResizeObserver?new c.ResizeObserver(()=>{d.isConnected&&Pn(t,d)}):null;u?.observe(r);let g=qd(t),m={key:a,lead:n,options:o,index:0,el:d,timer:null,resize:u};Ln.set(t,m),is(m,ns(o[0],n),!g,!0),!g&&(m.timer=setInterval(()=>{if(!t.isConnected||!d.isConnected){wn(t);return}t.ownerDocument?.hidden||(m.index=(m.index+1)%m.options.length,Pn(t,d),is(m,ns(m.options[m.index],m.lead),!0,!1))},os))}function wo(t){wn(t)}function Lo(t){return(t.find(n=>n.type?.kind!=="traditional_autocomplete")?.options??[]).filter(n=>n.is_tappable!==!1).map(n=>({text:n.text,icon_svg:n.icon_svg}))}var zd=6,jd=.3;function ss(t){return t<=0?"0px":`${(-Math.min(jd,2*zd/t)).toFixed(3)}px`}var ls=new Map;function Yd(t,e,n){let i=ls.get(e);if(i!==void 0){t.style.setProperty("--aia-chip-image-fit",i),t.setAttribute("data-aia-image-loaded","");return}let o=n.createElement("img");o.setAttribute("referrerpolicy","no-referrer"),o.onload=()=>{if(!t.isConnected)return;t.setAttribute("data-aia-image-loaded","");let r=t.getBoundingClientRect().height,a=Number.parseFloat(getComputedStyle(t).fontSize);if(!(r>0&&a>0&&o.naturalWidth>0&&o.naturalHeight>0))return;let s=`${(r/a*(o.naturalWidth/o.naturalHeight)).toFixed(3)}em`;ls.set(e,s),t.style.setProperty("--aia-chip-image-fit",s)},o.src=e}function Co(t){let{input:e,segments:n,newParamId:i,editingParamId:o,placeholderText:r}=t,a=t.showChipIcons??!0,s=t.showChipImages??!0,l=t.showChipRemove??!1,d=n.length===0;e.dataset.aiaEmpty=d?"true":"false",Xr(e,d?r:""),as(e,d,r,t.hintOptions??[]);let c=n.map(S=>S.type==="completed"?`${S.type}:${S.value}${a?S.param.icon??S.param.icon_svg??"":""}${s?we(S.param.image_url)??"":""}${l?"x":""}`:S.type==="identified"?`${S.type}:${S.value}${S.param.id}${l?"x":""}`:`${S.type}:${S.value}`).join("\0"),u=e.dataset.segKey??"",g=e.dataset.newParamId??"",m=e.dataset.editingParamId??"";if(c===u&&(i??"")===g&&(o??"")===m)return;if(c===u){e.dataset.newParamId=i??"",e.dataset.editingParamId=o??"";for(let S of e.querySelectorAll("strong[data-param-id]")){let b=S.dataset.paramId,x=S.dataset.seg==="completed"&&b===i;S.classList.toggle("magicx-aia-shimmer-revealed",x),S.classList.toggle("magicx-aia-shimmer-sweep",x),S.classList.toggle("magicx-aia-segment--editing",b===o)}return}let p=Pr(e),f=p?Y(e):null;e.dataset.segKey=c,e.dataset.newParamId=i??"",e.dataset.editingParamId=o??"";let h=N(e),v=h.createDocumentFragment(),y=0;for(let S of n)if(y+=S.value.length,S.type==="completed"){let b=h.createElement("strong");b.dataset.seg="completed",b.dataset.paramId=S.param.id;let x=S.param.id===i,E=S.param.id===o,P=["magicx-aia-segment","magicx-aia-segment--completed"];x&&P.push("magicx-aia-shimmer-revealed","magicx-aia-shimmer-sweep"),E&&P.push("magicx-aia-segment--editing"),b.className=P.join(" "),b.style.letterSpacing=ss(S.value.length);let T=s?we(S.param.image_url):null;if(T){let A=h.createElement("span");A.className="magicx-aia-segment-image",A.setAttribute("contenteditable","false"),A.setAttribute("aria-hidden","true"),A.style.setProperty("--aia-chip-image",`url("${T}")`),Yd(A,T,h),b.appendChild(A),b.dataset.aiaImage=""}let L=!T&&a&&S.param.icon_svg?ce(S.param.icon_svg):null;if(L){let A=h.createElement("span");A.className="magicx-aia-segment-icon",A.setAttribute("contenteditable","false"),A.setAttribute("aria-hidden","true"),A.innerHTML=L,b.appendChild(A),S.param.icon&&(b.dataset.aiaIcon=S.param.icon)}b.appendChild(h.createTextNode(S.value)),l&&b.appendChild(cs(h,S.param.id)),v.appendChild(b)}else if(S.type==="identified"){let b=h.createElement("strong");b.dataset.seg="identified",b.dataset.paramId=S.param.id;let x=["magicx-aia-segment","magicx-aia-segment--completed"];S.param.id===o&&x.push("magicx-aia-segment--editing"),b.className=x.join(" "),b.style.letterSpacing=ss(S.value.length),b.textContent=S.value,l&&b.appendChild(cs(h,S.param.id)),v.appendChild(b)}else v.appendChild(h.createTextNode(S.value));e.replaceChildren(v),e.dataset.aiaTextLength=String(y),f!=null?V(e,Math.max(0,Math.min(f,y))):p&&V(e,y)}function cs(t,e){let n=t.createElement("span");return n.className="magicx-aia-segment-remove",n.setAttribute("contenteditable","false"),n.setAttribute("aria-hidden","true"),n.dataset.aiaChipRemove=e,n.innerHTML='<svg viewBox="0 0 10 10" aria-hidden="true"><path d="M2.5 2.5l5 5M7.5 2.5l-5 5"/></svg>',n}var Qd='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" role="img" aria-label="Submit"><path d="M9 14V4M9 4L4 9M9 4L14 9" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';function ds(t=k()){let e=document.createElement("button");return e.type="button",e.className="magicx-aia-submit",e.setAttribute("aria-label",t.submit),e.setAttribute("data-aia-submit",""),e.innerHTML=Qd.replace('aria-label="Submit"',`aria-label="${t.submit}"`),e}function us(t){let e=t.store.get();return(!!e.text||e.completedParams.length>0)&&!!t.onSubmit}function ms(t){if(!t.onSubmit)return;t.endTypedWord?.();let e=t.store.get();t.onSubmit(ve(e.text,e.completedParams,e.skippedParams,{identifiedParams:e.identifiedParams,isReady:e.isReady,customFields:e.customFields}))&&t.afterSubmit?.()}function Xd(){let t=document.createElement("div");return t.setAttribute("contenteditable","plaintext-only"),t.contentEditable==="plaintext-only"}function ps(t,e){let n=e.firstElementChild;if(!n){e.removeAttribute("data-aia-pill-wrapped");return}let i=n.getBoundingClientRect(),o=t.getBoundingClientRect();i.top>=o.bottom-2?e.setAttribute("data-aia-pill-wrapped",""):e.removeAttribute("data-aia-pill-wrapped")}function gs(t,e){let{listboxId:n}=e,i=vn(n);t.appendChild(i);let o=document.createElement("div");o.className="magicx-aia-input-wrapper",o.setAttribute("data-aia-input-wrapper",""),t.appendChild(o);let r=document.createElement("div");r.className="magicx-aia-editor",r.setAttribute("data-aia-editor",""),o.appendChild(r);let a=document.createElement("div");a.className="magicx-aia-input",a.setAttribute("data-aia-input",""),a.setAttribute("contenteditable",Xd()?"plaintext-only":"true"),a.setAttribute("role","combobox"),a.setAttribute("aria-autocomplete","list"),a.setAttribute("aria-haspopup","listbox"),a.setAttribute("aria-controls",n),a.setAttribute("aria-expanded","false"),a.setAttribute("spellcheck","true"),a.setAttribute("enterkeyhint","send"),r.appendChild(a);let s=document.createElement("span");s.className="magicx-aia-pill-list-container",s.setAttribute("data-aia-pill-list-container",""),r.appendChild(s);let l=null,d=null;e.submitButton===void 0?(l=ds(e.strings),o.appendChild(l),d=l):e.submitButton!==null&&(d=e.submitButton,d.hasAttribute("data-aia-submit")||d.setAttribute("data-aia-submit",""),d.setAttribute("data-aia-submit-slot",""),o.appendChild(d));let c=new AbortController,{signal:u}=c,g=!1,m=0,p=()=>{let b=Ut(a),E=b.length>0&&b[0]!==b[0].toUpperCase()?b[0].toUpperCase()+b.slice(1):b;e.handleChange(E)},f=()=>{let b=fe(a)?.node??null;if(!b||!a.contains(b))return null;let P=(b.nodeType===Node.ELEMENT_NODE?b:b.parentElement)?.closest("strong[data-param-id]")?.dataset.paramId??null;return P&&Er(a,P)?null:P};o.addEventListener("click",b=>{b.target?.closest("[data-aia-pill]")||a.getRootNode().activeElement?.closest("[data-aia-location]")||a.focus()},{signal:u});let h=null,v=()=>{let b=e.showChipRemove??!1;b!==(h!==null)&&(h?.(),h=b?yo(a,x=>e.removeParam(x)):null)};if(v(),u.addEventListener("abort",()=>{h?.(),h=null}),a.addEventListener("input",()=>{g||(m=performance.now(),p(),e.handleCaretAfterInput(Y(a)))},{signal:u}),N(a).addEventListener("selectionchange",()=>{let b=fe(a);if(!b||!a.contains(b.node))return;let x=b.collapsed?f():null,E=e.store.get(),P=E.editingParam?.id??E.editingIdentified?.id??null;if(x&&x!==P){e.startEditingParam(x);return}performance.now()-m<50||e.handleCaretMove(Y(a))},{signal:u}),a.addEventListener("click",b=>{let x=Jn(a,b.target);x&&(e.startEditingParam(x),Zn(a,x))},{signal:u}),a.addEventListener("compositionstart",()=>{g=!0,a.setAttribute("data-aia-composing","true")},{signal:u}),a.addEventListener("compositionend",()=>{g=!1,a.removeAttribute("data-aia-composing"),p()},{signal:u}),a.addEventListener("beforeinput",b=>{let x=b,E=x.inputType;if(E==="insertParagraph"||E==="insertLineBreak"||E==="insertFromDrop"){b.preventDefault();return}if(E.startsWith("insert")||E.startsWith("delete")){let P=E.startsWith("delete")?"":x.data??"";e.replaceEditingRange(P)&&b.preventDefault()}},{signal:u}),a.addEventListener("paste",b=>{b.preventDefault();let x=(b.clipboardData?.getData("text/plain")??"").replace(/\r?\n/g," ");if(!x)return;let E=N(a),P=xe(a);if(!P||!a.contains(P.startContainer))return;P.deleteContents();let T=E.createTextNode(x);P.insertNode(T),P.setStartAfter(T),rt(a,P.startContainer,P.startOffset),p()},{signal:u}),a.addEventListener("keydown",b=>e.handleKeyDown(b),{signal:u}),a.addEventListener("focus",()=>e.store.set({isFocused:!0}),{signal:u}),a.addEventListener("blur",()=>e.store.set({isFocused:!1}),{signal:u}),d&&d.addEventListener("click",b=>{us(e)&&(b.stopPropagation(),ms(e))},{signal:u}),e.autoFocus!==!1){a.focus();let b=fe(a);(!b||!a.contains(b.node))&&rt(a,a,0)}if(typeof ResizeObserver<"u"){let b=new ResizeObserver(()=>ps(a,s));b.observe(a),c.signal.addEventListener("abort",()=>b.disconnect(),{once:!0})}let S=To(r);return c.signal.addEventListener("abort",S,{once:!0}),{input:a,inlinePillContainer:s,dropdown:i,submitButton:l,abort:c,syncChipRemove:v}}function Ao(t,e,n){let{input:i,inlinePillContainer:o,dropdown:r,submitButton:a}=t,{pillPlacement:s,setActivePill:l,selectOption:d,store:c}=n;t.syncChipRemove(),i.setAttribute("aria-expanded",String(e.isDropdownOpen));let u=e.activeDropdownIndex>=0?`${n.listboxId}-option-${e.activeDropdownIndex}`:"";if(u?i.setAttribute("aria-activedescendant",u):i.removeAttribute("aria-activedescendant"),a){let v=n.strings??k();a.getAttribute("aria-label")!==v.submit&&a.setAttribute("aria-label",v.submit);let y=a.querySelector("svg");y&&y.getAttribute("aria-label")!==v.submit&&y.setAttribute("aria-label",v.submit);let S=!!e.text||e.completedParams.length>0;a.disabled=!S,a.toggleAttribute("data-aia-ready",S&&e.isReady)}let g=i.dataset.newParamId??"",m=e.newParamId!==null&&e.newParamId!==g;if(Co({input:i,segments:e.segments,newParamId:e.newParamId,editingParamId:e.editingParam?.id??null,placeholderText:e.placeholderText,isFocused:e.isFocused,showChipIcons:n.showChipIcons??!0,showChipImages:n.showChipImages??!0,hintOptions:s==="inline"?[]:Lo(e.actionableSuggestions),showChipRemove:n.showChipRemove??!1}),s==="inline"){let v=e.isLoading&&!e.editingParam&&!e.inSelectionAnimation,y=Nn(e.actionableSuggestions);v||y.length>0?pn(o,y,0,l,!1,v,e.isActivePillSelected):no(o)}else no(o);ps(i,o),m?(i.focus(),V(i,e.caretOffset??e.text.length)):e.isFocused&&Ut(i)!==e.text&&V(i,e.text.length);let p=e.editingParam?tt(e.editingParam):e.editingIdentified?{parameter:e.editingIdentified.parameter,text:ae(e.editingIdentified.parameter),required:!0,options:[]}:null,f=e.dropdownSuggestion??p??e.actionableSuggestions[0],h=gt(e);En(r,{strings:n.strings,suggestions:f?[{...f,options:e.dropdownOptions}]:[],filteredOptions:e.dropdownOptions,activeIndex:e.activeDropdownIndex,isOpen:e.isDropdownOpen,isLoading:e.dropdownLoading,skeletonExiting:e.skeletonExiting,listboxId:n.listboxId,pills:p?[p]:e.actionableSuggestions,showPills:s==="dropdown",showSkipButton:n.showSkipButton&&!e.editingParam&&!e.editingIdentified,skipDisabled:e.inSelectionAnimation,showOptionIcons:n.showOptionIcons??!0,showOptionImages:n.showOptionImages??!0,showOptionCounts:n.showOptionCounts??!0,isActivePillSelected:e.isActivePillSelected,isInputEmpty:e.text.trim().length===0,products:e.products,productsLayout:n.productsLayout??"row",productImageFallback:n.productImageFallback??"image",onProductAddToCart:n.addProductToCart,formatType:e.activeFormatType,dateView:e.dateView,selectedDateIso:h.selectedIso,selectedDateRange:h.selectedRange,dateRangeStart:h.rangeStart,dateReferences:h.references,timeView:e.timeView,multiSelectView:e.dropdownMultiSelect,locationView:e.locationView,isReediting:e.editingParam!=null,isFocused:e.isFocused||e.locationFieldFocused,optionsPosition:n.optionsPosition??"below",onSelect:d,onHighlight:(v,y)=>{y!==void 0&&c.get().activeDropdownIndex!==y||c.set({activeDropdownIndex:v})},onPillClick:l,onSkip:n.skipActivePill,onPreviousMonth:n.showPreviousMonth,onNextMonth:n.showNextMonth,onTimeChange:n.setTime,onTimeCommit:n.commitTime,onMultiSelectCommit:n.commitMultiSelect,onLocationQuery:n.setLocationQuery,onLocationMove:n.moveLocationHighlight,onLocationCommit:n.commitLocation,onLocationFocusChange:n.setLocationFieldFocused,onProductSelect:n.selectProduct,onProductFocusChange:v=>c.set({isFocused:v}),onSeeAllResults:n.seeAllResults&&e.text.trim().length>0&&us(n)?()=>ms(n):void 0,fullWidth:n.seeAllResults===!0})}function Io(t){let e=t,n=new Set,i=[],o=!1;return{get:()=>e,set:r=>{let a=typeof r=="function"?r(e):r,s=e;if(e={...e,...a},i.push([e,s]),!o){o=!0;try{let l=0;for(let d=i.shift();d;d=i.shift()){if(++l>1e4)throw i.length=0,new Error("createStore: notifications did not settle after 10000 deliveries \u2014 a listener is likely calling set() on every notification");let[c,u]=d;for(let g of n)g(c,u)}}catch(l){throw i.length=0,l}finally{o=!1}}},subscribe:r=>(n.add(r),()=>{n.delete(r)})}}function fs(t,e){let n,i,o=r=>(r!==n&&(n=r,i=e(r)),i);return{get:()=>{let r=t.get();return{...r,...o(r)}},set:r=>{typeof r=="function"?t.set(a=>{let s={...a,...o(a)};return r(s)}):t.set(r)},peek:r=>{let a={...t.get(),...r};return{...a,...e(a)}},subscribe:r=>t.subscribe((a,s)=>{let l={...s,...o(s)},d={...a,...o(a)};r(d,l)})}}var Oo=new WeakSet,hs=new WeakMap;function Ss(t){return t.nodeType===Node.DOCUMENT_NODE}function Jd(t){return Ss(t)?t:t.ownerDocument}function Zd(t){let e=hs.get(t);if(e)return e;let n=t.defaultView?.CSSStyleSheet;if(typeof n!="function")return null;try{let i=new n;return typeof i.replaceSync!="function"?null:(i.replaceSync(Ts),hs.set(t,i),i)}catch{return null}}function bs(t,e){if(e.querySelector("style[data-magicx-aia]"))return;let n=t.createElement("style");n.setAttribute("data-magicx-aia",""),n.textContent=Ts,e.appendChild(n)}function ys(t){if(typeof document>"u")return;let e=t??document;if(Oo.has(e))return;let n=Jd(e);if(Ss(e)){let r=e.head??e.documentElement;if(!r)return;bs(n,r),Oo.add(e);return}let i=Zd(n),o=e.adoptedStyleSheets;i&&Array.isArray(o)?o.includes(i)||(e.adoptedStyleSheets=[...o,i]):bs(n,e),Oo.add(e)}var Ts=`.aia-stack {
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: var(--aia-stack-space, 0.5rem);
@@ -78,7 +78,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
78
78
  /* The scroll box's reserved band (--aia-grid-scroll-* / --aia-grid-overlap-*)
79
79
  is deliberately NOT declared here \u2014 see the rule in
80
80
  appearance.css for why. */
81
- max-height: var(--aia-grid-max-height, 84px);
81
+ max-height: var(--aia-grid-max-height, 120px);
82
82
  overflow-y: auto;
83
83
  overscroll-behavior: contain;
84
84
  scrollbar-width: none;
@@ -632,15 +632,15 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
632
632
  align-items: center;
633
633
  margin-inline-start: auto;
634
634
  flex-shrink: 0;
635
- padding: 3.5px 5.6px;
635
+ padding: 5px 8px;
636
636
  border: none;
637
637
  /* Matches the completed-param chip radius, so the hover fill reads as a
638
638
  soft rectangle rather than a capsule. */
639
- border-radius: 4.2px;
639
+ border-radius: 6px;
640
640
  background: transparent;
641
641
  font-family: inherit;
642
- font-size: var(--aia-skip-font-size, 9.45px);
643
- line-height: 12.6px;
642
+ font-size: var(--aia-skip-font-size, 13.5px);
643
+ line-height: 18px;
644
644
  color: var(--aia-skip-color, var(--aia-footer-hint-color, #505050));
645
645
  cursor: pointer;
646
646
  white-space: nowrap;
@@ -698,7 +698,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
698
698
  .magicx-aia-products {
699
699
  display: flex;
700
700
  flex-direction: column;
701
- gap: 4.2px;
701
+ gap: 6px;
702
702
  /* The option text sits 10px inside the dropdown's padding edge (the
703
703
  option's own padding), so the section carries the same 10px and its
704
704
  label lands on the option text's left edge \u2014 which the dropdown in turn
@@ -709,9 +709,9 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
709
709
 
710
710
  .magicx-aia-products-label {
711
711
  font-family: inherit;
712
- font-size: var(--aia-products-label-font-size, 7.7px);
712
+ font-size: var(--aia-products-label-font-size, 11px);
713
713
  font-weight: 500;
714
- line-height: 12.6px;
714
+ line-height: 18px;
715
715
  letter-spacing: 0.02em;
716
716
  color: var(
717
717
  --aia-products-label-color,
@@ -725,16 +725,16 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
725
725
  a trackpad fling at either end from chaining out to the page. */
726
726
  .magicx-aia-products-row {
727
727
  display: flex;
728
- gap: var(--aia-product-gap, 5.6px);
728
+ gap: var(--aia-product-gap, 8px);
729
729
  min-width: 0;
730
730
  overflow-x: auto;
731
731
  overflow-y: hidden;
732
732
  overscroll-behavior-x: contain;
733
- padding-bottom: 1.4px;
733
+ padding-bottom: 2px;
734
734
  /* Pull the row out by the card's own 6px padding so the first card's
735
735
  image tile \u2014 not its hover fill \u2014 starts on the label's left edge, the
736
736
  same way the option's highlight fill hangs outside its text. */
737
- margin-inline: -4.2px;
737
+ margin-inline: -6px;
738
738
  /* Hide the scrollbar chrome across all three engines while leaving the box
739
739
  scrollable by trackpad, touch and keyboard. A mouse wheel is vertical and
740
740
  would otherwise have no way through a row with no scrollbar to grab, so
@@ -755,10 +755,10 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
755
755
  flex: 0 0 auto;
756
756
  display: flex;
757
757
  flex-direction: column;
758
- gap: 4.2px;
759
- width: var(--aia-product-card-width, 81.2px);
760
- padding: 4.2px;
761
- border-radius: 7px;
758
+ gap: 6px;
759
+ width: var(--aia-product-card-width, 116px);
760
+ padding: 6px;
761
+ border-radius: 10px;
762
762
  background: var(--aia-product-bg, transparent);
763
763
  /* Explicit, never inherited \u2014 see the section header. */
764
764
  color: var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));
@@ -791,7 +791,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
791
791
  position: relative;
792
792
  width: 100%;
793
793
  aspect-ratio: 1 / 1;
794
- border-radius: 5.6px;
794
+ border-radius: 8px;
795
795
  overflow: hidden;
796
796
  background: var(--aia-product-media-bg, var(--aia-skeleton-bg, rgba(189, 189, 189, 0.25)));
797
797
  }
@@ -816,7 +816,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
816
816
  max-width: 100%;
817
817
  height: 100%;
818
818
  margin: 0 auto;
819
- border-radius: var(--aia-product-image-radius, 5.6px);
819
+ border-radius: var(--aia-product-image-radius, 8px);
820
820
  object-fit: contain;
821
821
  }
822
822
 
@@ -829,7 +829,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
829
829
  align-items: center;
830
830
  justify-content: center;
831
831
  color: var(--aia-product-title-color, var(--aia-option-color-selected, currentColor));
832
- font-size: 16.8px;
832
+ font-size: 24px;
833
833
  font-weight: 600;
834
834
  line-height: 1;
835
835
  }
@@ -852,14 +852,14 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
852
852
  .magicx-aia-product-body {
853
853
  display: flex;
854
854
  flex-direction: column;
855
- gap: 1.4px;
855
+ gap: 2px;
856
856
  min-width: 0;
857
857
  }
858
858
 
859
859
  .magicx-aia-product-vendor {
860
860
  font-family: inherit;
861
- font-size: var(--aia-product-vendor-font-size, 7px);
862
- line-height: 9.8px;
861
+ font-size: var(--aia-product-vendor-font-size, 10px);
862
+ line-height: 14px;
863
863
  color: var(
864
864
  --aia-product-vendor-color,
865
865
  var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb))
@@ -873,9 +873,9 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
873
873
 
874
874
  .magicx-aia-product-title {
875
875
  font-family: inherit;
876
- font-size: var(--aia-product-title-font-size, 8.4px);
876
+ font-size: var(--aia-product-title-font-size, 12px);
877
877
  font-weight: 400;
878
- line-height: 11.2px;
878
+ line-height: 16px;
879
879
  /* The card's most prominent text uses the same token the *highlighted*
880
880
  option text does, so it stays legible on any --aia-surface a consumer
881
881
  sets \u2014 light or dark \u2014 without a second theming control. */
@@ -892,9 +892,9 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
892
892
 
893
893
  .magicx-aia-product-price {
894
894
  font-family: inherit;
895
- font-size: var(--aia-product-price-font-size, 7.7px);
895
+ font-size: var(--aia-product-price-font-size, 11px);
896
896
  font-weight: 500;
897
- line-height: 10.5px;
897
+ line-height: 15px;
898
898
  color: var(
899
899
  --aia-product-price-color,
900
900
  var(--aia-option-color-selected, var(--aia-color-text-default, #fff))
@@ -905,7 +905,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
905
905
  display: flex;
906
906
  flex-wrap: wrap;
907
907
  align-items: baseline;
908
- column-gap: 2.8px;
908
+ column-gap: 4px;
909
909
  }
910
910
 
911
911
  /* The price before a markdown, struck through after the price, on the same
@@ -923,10 +923,10 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
923
923
  reads on any photo, light or dark, and on either panel surface. */
924
924
  .magicx-aia-product-badge {
925
925
  position: absolute;
926
- top: var(--aia-product-badge-inset, 8.4px);
927
- left: var(--aia-product-badge-inset, 8.4px);
928
- padding: 2.1px 4.2px;
929
- border-radius: 2.8px;
926
+ top: var(--aia-product-badge-inset, 12px);
927
+ left: var(--aia-product-badge-inset, 12px);
928
+ padding: 3px 6px;
929
+ border-radius: 4px;
930
930
  background: var(--aia-product-badge-bg, rgba(255, 255, 255, 0.94));
931
931
  color: var(--aia-product-badge-color, #1f2328);
932
932
  /* A hairline ring keeps the chip's edge on a pale image or a light panel. */
@@ -934,7 +934,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
934
934
  0 0 0 1px rgba(0, 0, 0, 0.08),
935
935
  0 1px 2px rgba(0, 0, 0, 0.18);
936
936
  font-family: inherit;
937
- font-size: var(--aia-product-badge-font-size, 6.3px);
937
+ font-size: var(--aia-product-badge-font-size, 9px);
938
938
  font-weight: 600;
939
939
  line-height: 1;
940
940
  letter-spacing: 0.08em;
@@ -956,24 +956,24 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
956
956
  fill the square (--aia-product-photo-fill-x / -y, set on the card when
957
957
  the photo loads; 1, the tile's own corner, until then). */
958
958
  top: calc(
959
- var(--aia-product-card-width, 81.2px) -
960
- 8.4px -
961
- var(--aia-product-cart-size, 19.6px) -
962
- (var(--aia-product-card-width, 81.2px) - 8.4px) *
959
+ var(--aia-product-card-width, 116px) -
960
+ 12px -
961
+ var(--aia-product-cart-size, 28px) -
962
+ (var(--aia-product-card-width, 116px) - 12px) *
963
963
  (1 - var(--aia-product-photo-fill-y, 1)) /
964
964
  2
965
965
  );
966
966
  right: calc(
967
- 8.4px +
968
- (var(--aia-product-card-width, 81.2px) - 8.4px) *
967
+ 12px +
968
+ (var(--aia-product-card-width, 116px) - 12px) *
969
969
  (1 - var(--aia-product-photo-fill-x, 1)) /
970
970
  2
971
971
  );
972
972
  display: flex;
973
973
  align-items: center;
974
974
  justify-content: center;
975
- width: var(--aia-product-cart-size, 19.6px);
976
- height: var(--aia-product-cart-size, 19.6px);
975
+ width: var(--aia-product-cart-size, 28px);
976
+ height: var(--aia-product-cart-size, 28px);
977
977
  border-radius: 999px;
978
978
  background: var(--aia-product-cart-bg, rgba(255, 255, 255, 0.94));
979
979
  color: var(--aia-product-cart-color, #1f2328);
@@ -997,8 +997,8 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
997
997
 
998
998
  .magicx-aia-product-cart svg {
999
999
  display: block;
1000
- width: 11.2px;
1001
- height: 11.2px;
1000
+ width: 16px;
1001
+ height: 16px;
1002
1002
  fill: none;
1003
1003
  stroke: currentColor;
1004
1004
  stroke-width: 2;
@@ -1081,8 +1081,8 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1081
1081
  occurrence, and these selectors contain the base selectors. */
1082
1082
  .magicx-aia-products[data-aia-products-layout="list"] .magicx-aia-products-row {
1083
1083
  flex-direction: column;
1084
- gap: var(--aia-product-list-gap, 1.4px);
1085
- max-height: var(--aia-product-list-max-height, 224px);
1084
+ gap: var(--aia-product-list-gap, 2px);
1085
+ max-height: var(--aia-product-list-max-height, 320px);
1086
1086
  overflow-x: hidden;
1087
1087
  overflow-y: auto;
1088
1088
  overscroll-behavior-y: contain;
@@ -1091,17 +1091,17 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1091
1091
  .magicx-aia-products[data-aia-products-layout="list"] .magicx-aia-product {
1092
1092
  flex-direction: row;
1093
1093
  align-items: center;
1094
- gap: 7px;
1094
+ gap: 10px;
1095
1095
  width: auto;
1096
- padding: 4.2px 5.6px;
1096
+ padding: 6px 8px;
1097
1097
  }
1098
1098
 
1099
1099
  /* A fixed square thumbnail: width and height together, so the row's height
1100
1100
  is the tile's, not the card width's. */
1101
1101
  .magicx-aia-products[data-aia-products-layout="list"] .magicx-aia-product-media {
1102
1102
  flex: 0 0 auto;
1103
- width: var(--aia-product-list-media-size, 30.8px);
1104
- height: var(--aia-product-list-media-size, 30.8px);
1103
+ width: var(--aia-product-list-media-size, 44px);
1104
+ height: var(--aia-product-list-media-size, 44px);
1105
1105
  }
1106
1106
 
1107
1107
  .magicx-aia-products[data-aia-products-layout="list"] .magicx-aia-product-body {
@@ -1113,18 +1113,18 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1113
1113
  match, so its bottom edge is half a thumbnail below the card's centre; its
1114
1114
  left edge is the card's 8px inline padding. */
1115
1115
  .magicx-aia-products[data-aia-products-layout="list"] .magicx-aia-product-badge {
1116
- top: calc(50% + var(--aia-product-list-media-size, 30.8px) / 2);
1117
- left: 5.6px;
1118
- width: var(--aia-product-list-media-size, 30.8px);
1116
+ top: calc(50% + var(--aia-product-list-media-size, 44px) / 2);
1117
+ left: 8px;
1118
+ width: var(--aia-product-list-media-size, 44px);
1119
1119
  transform: translateY(-100%);
1120
- padding: 1.4px 0;
1121
- border-radius: 0 0 5.6px 5.6px;
1120
+ padding: 2px 0;
1121
+ border-radius: 0 0 8px 8px;
1122
1122
  /* A dark scrim rather than the light chip: a light banner at a tile's edge
1123
1123
  merges with a light panel and reads as a cropped photo. */
1124
1124
  background: var(--aia-product-badge-list-bg, rgba(17, 17, 17, 0.72));
1125
1125
  color: var(--aia-product-badge-list-color, #fff);
1126
1126
  box-shadow: none;
1127
- font-size: var(--aia-product-badge-list-font-size, 4.9px);
1127
+ font-size: var(--aia-product-badge-list-font-size, 7px);
1128
1128
  letter-spacing: 0.02em;
1129
1129
  text-align: center;
1130
1130
  }
@@ -1133,7 +1133,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1133
1133
  column stops short of it. */
1134
1134
  .magicx-aia-products[data-aia-products-layout="list"] .magicx-aia-product-cart {
1135
1135
  top: 50%;
1136
- right: 5.6px;
1136
+ right: 8px;
1137
1137
  transform: translateY(-50%);
1138
1138
  }
1139
1139
 
@@ -1143,7 +1143,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1143
1143
 
1144
1144
  .magicx-aia-products[data-aia-products-layout="list"]
1145
1145
  .magicx-aia-product[data-aia-product-has-cart] {
1146
- padding-right: calc(var(--aia-product-cart-size, 19.6px) + 11.2px);
1146
+ padding-right: calc(var(--aia-product-cart-size, 28px) + 16px);
1147
1147
  }
1148
1148
 
1149
1149
  /* --- "More below" scroll arrow (see render/scrollArrow.ts) ---
@@ -1451,8 +1451,8 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1451
1451
  }
1452
1452
 
1453
1453
  .magicx-aia-option-tag {
1454
- font-size: 7.7px;
1455
- margin-left: 4.2px;
1454
+ font-size: 11px;
1455
+ margin-left: 6px;
1456
1456
  opacity: 0.5;
1457
1457
  }
1458
1458
 
@@ -1461,9 +1461,9 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1461
1461
  text box, so a hanging indent never moves it. */
1462
1462
  .magicx-aia-option-parameter {
1463
1463
  display: block;
1464
- font-size: var(--aia-option-parameter-font-size, 8.4px);
1464
+ font-size: var(--aia-option-parameter-font-size, 12px);
1465
1465
  font-weight: 400;
1466
- line-height: 11.2px;
1466
+ line-height: 16px;
1467
1467
  text-indent: 0;
1468
1468
  color: var(--aia-option-parameter-color, inherit);
1469
1469
  opacity: var(--aia-option-parameter-opacity, 0.6);
@@ -1483,8 +1483,8 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1483
1483
  .magicx-aia-option-icon {
1484
1484
  display: inline-flex;
1485
1485
  align-items: center;
1486
- height: 14.7px; /* = the option's line-height */
1487
- margin-right: 5.6px;
1486
+ height: 21px; /* = the option's line-height */
1487
+ margin-right: 8px;
1488
1488
  vertical-align: top;
1489
1489
  /* Own compositing layer. The row (entrance) and the chip (promotion fade)
1490
1490
  animate on a layer WebKit drops when the animation ends; content drawn at
@@ -1507,8 +1507,8 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1507
1507
  (blockified), so text-indent applies to it directly. Skeleton rows keep
1508
1508
  it too: their icon is hidden but still occupies its column. */
1509
1509
  .magicx-aia-option-content:not(:has(.magicx-aia-option-count)):has(.magicx-aia-option-icon) {
1510
- padding-left: calc(1em + 5.6px);
1511
- text-indent: calc(-1em - 5.6px);
1510
+ padding-left: calc(1em + 8px);
1511
+ text-indent: calc(-1em - 8px);
1512
1512
  }
1513
1513
 
1514
1514
  /* --- Option pictures and counts ---
@@ -1541,15 +1541,15 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1541
1541
  loads) and stays if it never does. */
1542
1542
  .magicx-aia-option-content:has(.magicx-aia-option-image) {
1543
1543
  align-items: center;
1544
- gap: var(--aia-option-image-gap, 8.4px);
1544
+ gap: var(--aia-option-image-gap, 12px);
1545
1545
  }
1546
1546
 
1547
1547
  .magicx-aia-option-image {
1548
1548
  flex: 0 0 auto;
1549
1549
  display: block;
1550
- width: var(--aia-option-image-size, 28px);
1551
- height: var(--aia-option-image-size, 28px);
1552
- border-radius: var(--aia-option-image-radius, 8.4px);
1550
+ width: var(--aia-option-image-size, 40px);
1551
+ height: var(--aia-option-image-size, 40px);
1552
+ border-radius: var(--aia-option-image-radius, 12px);
1553
1553
  overflow: hidden;
1554
1554
  background: var(--aia-option-image-bg, var(--aia-skeleton-bg, rgba(189, 189, 189, 0.083)));
1555
1555
  }
@@ -1574,7 +1574,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1574
1574
  max-width: 100%;
1575
1575
  height: 100%;
1576
1576
  margin: 0 auto;
1577
- border-radius: var(--aia-option-picture-radius, 4.2px);
1577
+ border-radius: var(--aia-option-picture-radius, 6px);
1578
1578
  object-fit: contain;
1579
1579
  }
1580
1580
 
@@ -1591,10 +1591,10 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1591
1591
  .magicx-aia-option-count {
1592
1592
  flex: 0 0 auto;
1593
1593
  margin-left: auto;
1594
- padding-left: 8.4px;
1595
- font-size: var(--aia-option-count-font-size, 8.4px);
1594
+ padding-left: 12px;
1595
+ font-size: var(--aia-option-count-font-size, 12px);
1596
1596
  font-weight: 400;
1597
- line-height: 14.7px; /* = the option's line-height */
1597
+ line-height: 21px; /* = the option's line-height */
1598
1598
  font-variant-numeric: tabular-nums;
1599
1599
  white-space: nowrap;
1600
1600
  color: var(--aia-option-count-color, inherit);
@@ -1773,7 +1773,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1773
1773
  (\`--aia-grid-max-height\`) does not cut the last row. Before the picture rule,
1774
1774
  which wins when a group has both. */
1775
1775
  [data-aia-group]:has(.magicx-aia-option-parameter) {
1776
- --aia-option-row-height: calc(25.9px + 2 * var(--aia-option-padding-block, 5.6px));
1776
+ --aia-option-row-height: calc(37px + 2 * var(--aia-option-padding-block, 8px));
1777
1777
  }
1778
1778
 
1779
1779
  /* A grid of picture rows is taller per row: the visible-rows cap
@@ -1782,9 +1782,9 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1782
1782
  same number of rows shows before the list scrolls. */
1783
1783
  [data-aia-group]:has(.magicx-aia-option-image) {
1784
1784
  --aia-option-row-height: calc(
1785
- var(--aia-option-image-size, 28px) +
1785
+ var(--aia-option-image-size, 40px) +
1786
1786
  2 *
1787
- var(--aia-option-padding-block, 5.6px)
1787
+ var(--aia-option-padding-block, 8px)
1788
1788
  );
1789
1789
  }
1790
1790
 
@@ -1800,9 +1800,9 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1800
1800
  display: flex;
1801
1801
  flex: 1 1 auto;
1802
1802
  align-items: center;
1803
- gap: var(--aia-option-image-gap, 8.4px);
1803
+ gap: var(--aia-option-image-gap, 12px);
1804
1804
  min-width: 0;
1805
- min-height: var(--aia-option-image-size, 28px);
1805
+ min-height: var(--aia-option-image-size, 40px);
1806
1806
  padding-left: 0;
1807
1807
  text-indent: 0;
1808
1808
  }
@@ -1812,8 +1812,8 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
1812
1812
  .magicx-aia-option-icon {
1813
1813
  flex: 0 0 auto;
1814
1814
  justify-content: center;
1815
- width: var(--aia-option-image-size, 28px);
1816
- height: var(--aia-option-image-size, 28px);
1815
+ width: var(--aia-option-image-size, 40px);
1816
+ height: var(--aia-option-image-size, 40px);
1817
1817
  margin-right: 0;
1818
1818
  }
1819
1819
 
@@ -2041,16 +2041,16 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
2041
2041
  the same baseline at the top edge of the cell. */
2042
2042
  align-items: flex-start;
2043
2043
  font-family: inherit;
2044
- font-size: var(--aia-option-font-size, 11.2px);
2044
+ font-size: var(--aia-option-font-size, 16px);
2045
2045
  font-weight: 450;
2046
- line-height: 14.7px;
2046
+ line-height: 21px;
2047
2047
  color: var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));
2048
2048
  white-space: normal;
2049
2049
  word-break: break-word;
2050
- /* 5.6px radius on the highlighted fill (--aia-option-bg), matching the Figma
2051
- SuggestionItem selection at 70%. The 5.6px/10px inset is the item's own padding. */
2052
- border-radius: 5.6px;
2053
- padding: var(--aia-option-padding-block, 5.6px) 10px;
2050
+ /* 8px radius on the highlighted fill (--aia-option-bg), matching the Figma
2051
+ SuggestionItem selection. The 8px/10px inset is the item's own padding. */
2052
+ border-radius: 8px;
2053
+ padding: var(--aia-option-padding-block, 8px) 10px;
2054
2054
  /* No entrance animation on the row itself \u2014 deliberately. The row is the
2055
2055
  tappable element, and iOS Safari drops a tap on a scripted-clickable
2056
2056
  element (a div with a click handler; a native button is exempt) whose
@@ -2746,7 +2746,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
2746
2746
  .magicx-aia-option-content:has(.magicx-aia-checkbox) {
2747
2747
  display: flex;
2748
2748
  align-items: center;
2749
- gap: 7px;
2749
+ gap: 10px;
2750
2750
  }
2751
2751
 
2752
2752
  /* A checkbox row is a flex row, so its icon is a flex item beside the text,
@@ -2770,14 +2770,14 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
2770
2770
  /* The mark is text centred in the box. An indent inherited from the row
2771
2771
  (an icon row hangs its text with one) would slide it out of the box. */
2772
2772
  text-indent: 0;
2773
- flex: 0 0 12.6px;
2774
- width: 12.6px;
2775
- height: 12.6px;
2773
+ flex: 0 0 18px;
2774
+ width: 18px;
2775
+ height: 18px;
2776
2776
  border: 1px solid var(--aia-border);
2777
- border-radius: 4.2px;
2777
+ border-radius: 6px;
2778
2778
  background: var(--aia-surface);
2779
2779
  color: transparent;
2780
- font-size: 7.7px;
2780
+ font-size: 11px;
2781
2781
  line-height: 1;
2782
2782
  }
2783
2783
 
@@ -3289,7 +3289,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
3289
3289
  --aia-scrollbar-track: rgba(15, 23, 42, 0.05);
3290
3290
  --aia-scrollbar-thumb: rgba(15, 23, 42, 0.22);
3291
3291
  --aia-option-color-selected: var(--aia-primitive-neutral-0);
3292
- --aia-option-font-size: 11.2px;
3292
+ --aia-option-font-size: 16px;
3293
3293
 
3294
3294
  --aia-written-text-color: var(--aia-primitive-neutral-0);
3295
3295
  /* The typed query keeps its full size; only the options box below it is
@@ -3364,7 +3364,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
3364
3364
  --aia-scrollbar-track: rgba(255, 255, 255, 0.08);
3365
3365
  --aia-scrollbar-thumb: rgba(255, 255, 255, 0.28);
3366
3366
  --aia-option-color-selected: var(--aia-primitive-neutral-1000);
3367
- --aia-option-font-size: 11.2px;
3367
+ --aia-option-font-size: 16px;
3368
3368
 
3369
3369
  --aia-written-text-color: var(--aia-primitive-neutral-1000);
3370
3370
  --aia-written-text-font-size: 16px;
@@ -3439,7 +3439,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
3439
3439
  justify-content: flex-start;
3440
3440
  border-inline-width: 0;
3441
3441
  padding-inline: 0;
3442
- padding-block: 3.5px;
3442
+ padding-block: 5px;
3443
3443
  }
3444
3444
 
3445
3445
  /* Product strip present: the footer no longer sits on the scrolling option
@@ -3655,7 +3655,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
3655
3655
  the third row. The planned cap (--aia-grid-max-height) still wins when it
3656
3656
  is smaller: fewer than three rows of options. */
3657
3657
  [data-aia-dropdown][aria-multiselectable="true"] .aia-grid[data-scroll] {
3658
- max-height: min(var(--aia-grid-max-height, 84px), calc(3 * var(--aia-option-row-height, 25.9px)));
3658
+ max-height: min(var(--aia-grid-max-height, 120px), calc(3 * var(--aia-option-row-height, 37px)));
3659
3659
  }
3660
3660
 
3661
3661
  /* Fitted to the viewport, every other grid hands its scrolling to the panel,
@@ -3664,8 +3664,8 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
3664
3664
  so Done stays in view. */
3665
3665
  [data-aia-dropdown][data-aia-fit][aria-multiselectable="true"] .aia-grid[data-scroll] {
3666
3666
  flex-shrink: 1;
3667
- min-height: var(--aia-option-row-height, 25.9px);
3668
- max-height: min(var(--aia-grid-max-height, 84px), calc(3 * var(--aia-option-row-height, 25.9px)));
3667
+ min-height: var(--aia-option-row-height, 37px);
3668
+ max-height: min(var(--aia-grid-max-height, 120px), calc(3 * var(--aia-option-row-height, 37px)));
3669
3669
  overflow-y: auto;
3670
3670
  }
3671
3671
 
@@ -3708,7 +3708,7 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
3708
3708
  [data-aia-dropdown] [data-aia-pillbar] [data-aia-pill][data-aia-pill-active] {
3709
3709
  text-transform: none;
3710
3710
  letter-spacing: normal;
3711
- font-size: var(--aia-param-label-font-size, 12px);
3711
+ font-size: var(--aia-param-label-font-size, 17px);
3712
3712
  font-weight: 500;
3713
3713
  opacity: 1;
3714
3714
  }
@@ -3727,17 +3727,17 @@ function _(t){return t==="date"||t==="date-range"}function H(t){return t!=="opti
3727
3727
  text-transform: uppercase;
3728
3728
  }
3729
3729
  [data-aia-dropdown] [data-aia-pillbar] [data-aia-skip] {
3730
- padding-inline: 5.6px;
3731
- font-size: var(--aia-skip-font-size, 9.45px);
3730
+ padding-inline: 8px;
3731
+ font-size: var(--aia-skip-font-size, 13.5px);
3732
3732
  }
3733
- /* Roomier rows: 10.5px above and below each option instead of 5.6px. The
3733
+ /* Roomier rows: 15px above and below each option instead of 8px. The
3734
3734
  row height feeds the visible-rows cap (planOptionsGrid), so it moves with
3735
3735
  the padding; picture and parameter-line rows add the same padding to their
3736
3736
  own heights. Tokens on the themed root at zero specificity, like the rest,
3737
3737
  so a consumer's value wins and the classic block below can restore its own. */
3738
3738
  :where(.magicx-aia) {
3739
- --aia-option-padding-block: 10.5px;
3740
- --aia-option-row-height: calc(14.7px + 2 * var(--aia-option-padding-block));
3739
+ --aia-option-padding-block: 15px;
3740
+ --aia-option-row-height: calc(21px + 2 * var(--aia-option-padding-block));
3741
3741
  }
3742
3742
  /* The panel hugs its options (panelHugWidth): as wide as the widest option
3743
3743
  times the columns, plus the panel's padding and 36px of breathing room,