@magicx-eng/ai-autocomplete-react 0.66.3 → 0.67.1

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
- import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END as Ks,DATE_RANGE_META_START as qs,DEFAULT_OPTION_COUNT_UNIT as _s,dateCellMarks as Vs,focusesInputOnSelect as Us,formatDate as Qs,formatDateRange as Ys,formatOptionCount as js,formatPlace as $s,formatTime as Zs,isoDate as Xs,isTouchPrimary as Js,LOCATION_META_KEY as el,monthLabel as tl,optionCountLabel as al,optionHasImage as il,optionImageSources as ol,optionImageSrc as nl,optionLabel as rl,optionsShowLeadingVisuals as sl,PRODUCT_PATH_PREFIX as ll,parseDate as dl,parseLooseDate as cl,parseLooseDateRange as pl,parseTime as hl,productFromMatchedItem as ul,productImageSources as ml,productsFromCustomFields as gl,sanitizeOptionIconSvg as fl,selectedRangeFor as bl,TIME_META_KEY as wl,visibleDateRange as vl,WEEKDAY_LABELS as xl,withSkippedParams as yl}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Sn,useCallback as Dt,useEffect as Xt,useImperativeHandle as Cn,useLayoutEffect as Tn,useRef as ft}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
1
+ import{buildSubmitResult as Ks,cellDay as qs,cellIso as _s,DATE_RANGE_META_END as Vs,DATE_RANGE_META_START as Us,DEFAULT_OPTION_COUNT_UNIT as Qs,dateCellMarks as Ys,focusesInputOnSelect as js,formatDate as $s,formatDateRange as Zs,formatOptionCount as Xs,formatPlace as Js,formatTime as el,isoDate as tl,isTouchPrimary as al,LOCATION_META_KEY as il,monthLabel as ol,optionCountLabel as nl,optionHasImage as rl,optionImageSources as sl,optionImageSrc as ll,optionLabel as dl,optionsShowLeadingVisuals as cl,PRODUCT_PATH_PREFIX as pl,parseDate as hl,parseLooseDate as ul,parseLooseDateRange as ml,parseTime as gl,productFromMatchedItem as fl,productImageSources as bl,productsFromCustomFields as wl,sanitizeOptionIconSvg as vl,selectedRangeFor as xl,TIME_META_KEY as yl,visibleDateRange as kl,WEEKDAY_LABELS as Sl,withSkippedParams as Cl}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Tn,useCallback as Mt,useEffect as Jt,useImperativeHandle as Pn,useLayoutEffect as In,useMemo as An,useRef as gt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
2
2
  position: relative;
3
3
  /* Inherits the host page's font by default. Consumers can pin a specific
4
4
  font on the library via \`--aia-font-family: 'Custom Font'\` without
@@ -157,6 +157,30 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
157
157
  background: var(--aia-completed-pill-bg-active, rgba(189, 189, 189, 0.35));
158
158
  }
159
159
 
160
+ /* A chip whose removal finds items when the search found none (custom_fields.blocking_filters).
161
+ Greyed out at half opacity. After the hover rule, so it stays greyed while pointed at. */
162
+ :where(.aia-input-IW-P-) strong[class~="magicx-aia-segment--blocking"] {
163
+ opacity: var(--aia-blocking-chip-opacity, 0.5);
164
+ }
165
+
166
+ /* The \xD7 of a greyed chip keeps its normal weight: its opacity multiplies with the chip's, so it is divided back out. */
167
+ :where(.aia-input-IW-P-)
168
+ strong[class~="magicx-aia-segment--blocking"]
169
+ span[class~="magicx-aia-segment-remove"] {
170
+ opacity: calc(var(--aia-chip-remove-opacity, 0.32) / var(--aia-blocking-chip-opacity, 0.5));
171
+ }
172
+
173
+ @media (hover: hover) {
174
+ :where(.aia-input-IW-P-)
175
+ strong[class~="magicx-aia-segment--blocking"]
176
+ span[class~="magicx-aia-segment-remove"]:hover {
177
+ opacity: calc(
178
+ var(--aia-chip-remove-opacity-hover, 0.7) /
179
+ var(--aia-blocking-chip-opacity, 0.5)
180
+ );
181
+ }
182
+ }
183
+
160
184
  /* The picked option's icon inside a completed chip (see \`icon_svg\` on
161
185
  CompletedParamState). Inline-block, one em square and sat on the text
162
186
  baseline; the chip is one inline-block, so the icon never ends a line
@@ -439,7 +463,7 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
439
463
  transition: none;
440
464
  }
441
465
  }
442
- `,document.head.appendChild(e)}var Je={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};import{attachScrollArrow as Po,attachViewportFit as Io,containScroll as Ao,dateFloorFor as Eo,destroyPanelMorph as Ro,findMultiSelectDone as zo,fitMultiSelectDone as Lo,hasSkippablePill as Oo,isCalendarFormat as Do,labelTraditionalAutocomplete as Mo,panelMorphKey as No,queryLive as Fo,settlePanelMorph as Ho,syncPanelHug as Bo,uiStringsFor as Wo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as tt,useLayoutEffect as Qt,useRef as mt,useState as Go}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
466
+ `,document.head.appendChild(e)}var Je={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};import{attachScrollArrow as Ao,attachViewportFit as Eo,containScroll as Ro,dateFloorFor as zo,destroyPanelMorph as Lo,findMultiSelectDone as Oo,fitMultiSelectDone as Do,hasSkippablePill as Mo,isCalendarFormat as No,labelTraditionalAutocomplete as Fo,panelMorphKey as Ho,queryLive as Bo,settlePanelMorph as Wo,syncPanelHug as Go,uiStringsFor as Ko}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as tt,useLayoutEffect as Yt,useRef as ut,useState as qo}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
443
467
  * Built-in appearance defaults \u2014 zero specificity via :where().
444
468
  * Consumer CSS always wins without !important.
445
469
  *
@@ -1813,7 +1837,7 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
1813
1837
  opacity: 1;
1814
1838
  }
1815
1839
  }
1816
- `,document.head.appendChild(e)}var he={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",seeAllSpin:"aia-seeAllSpin-jlsZP",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};import{cellDay as ni,cellIso as yt,dateCellMarks as ri,isDimmedDay as si,isoDate as li,monthLabel as di,visibleDateRange as ci,WEEKDAY_LABELS as pi}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as hi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
1840
+ `,document.head.appendChild(e)}var me={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",seeAllSpin:"aia-seeAllSpin-jlsZP",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};import{cellDay as si,cellIso as vt,dateCellMarks as li,isDimmedDay as di,isoDate as ci,monthLabel as pi,visibleDateRange as hi,WEEKDAY_LABELS as ui}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as mi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
1817
1841
 
1818
1842
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1819
1843
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -2010,7 +2034,7 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
2010
2034
  opacity: 0.8;
2011
2035
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
2012
2036
  }
2013
- `,document.head.appendChild(e)}var q={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};import{jsx as Pe,jsxs as pa}from"react/jsx-runtime";var ui=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ha({options:e,activeIndex:r,listboxId:t,view:o,selection:n,onSelect:d,onHighlight:s,onUnhighlight:c,onPreviousMonth:f,onNextMonth:x}){let y=li(new Date),m=ci({pendingStart:n.rangeStart,highlightedIso:yt(e[r]),selected:n.selectedRange,floor:n.floor});return pa("div",{className:q.datepicker,"data-aia-datepicker":"",children:[pa("div",{className:q.header,children:[Pe("button",{type:"button",tabIndex:-1,className:q.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:f,children:"\u2039"}),Pe("span",{className:q.month,"data-aia-date-month":"","aria-live":"polite",children:di(o)}),Pe("button",{type:"button",tabIndex:-1,className:q.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:x,children:"\u203A"})]}),Pe("div",{className:q.weekdays,"aria-hidden":"true",children:pi.map((p,h)=>Pe("span",{className:q.weekday,children:p},ui[h]))}),Pe("div",{className:q.grid,"data-aia-date-grid":"",children:e.map((p,h)=>Pe(mi,{option:p,id:`${t}-option-${h}`,index:h,isHighlighted:h===r&&p.is_tappable,isToday:yt(p)===y,isPast:si(yt(p),y,n.floor),marks:ri(yt(p),{selectedIso:n.selectedIso,range:m,references:n.references}),onSelect:d,onHighlight:s,onUnhighlight:c},yt(p)??`pad-${h}`))})]})}function mi({option:e,id:r,index:t,isHighlighted:o,isToday:n,isPast:d,marks:s,onSelect:c,onHighlight:f,onUnhighlight:x}){let[y,m]=hi(!1),p=ni(e);if(p==null)return Pe("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${q.cell} ${q.blank}`});let h=()=>{m(!0),c(e),setTimeout(()=>m(!1),170)},k=[q.cell,q.day,d?q.past:"",o?q.highlighted:"",n?q.today:"",s.inRange?q.inRange:"",s.selected?q.selected:"",s.reference?q.reference:"",y?q.pressed:""].filter(Boolean).join(" ");return Pe("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":o,"aria-label":e.text,tabIndex:0,className:k,onClick:h,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),h())},onMouseEnter:()=>f(t),onMouseLeave:x?()=>x(t):void 0,children:Pe("span",{className:q.number,children:p})})}import{ATTRIBUTION_URL as gi,buildAttributionUrl as fi,getFooterHint as bi,uiStringsFor as wi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as vi,useState as xi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
2037
+ `,document.head.appendChild(e)}var _={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};import{jsx as Te,jsxs as ha}from"react/jsx-runtime";var gi=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ua({options:e,activeIndex:r,listboxId:t,view:o,selection:n,onSelect:l,onHighlight:s,onUnhighlight:c,onPreviousMonth:w,onNextMonth:v}){let y=ci(new Date),m=hi({pendingStart:n.rangeStart,highlightedIso:vt(e[r]),selected:n.selectedRange,floor:n.floor});return ha("div",{className:_.datepicker,"data-aia-datepicker":"",children:[ha("div",{className:_.header,children:[Te("button",{type:"button",tabIndex:-1,className:_.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:u=>u.preventDefault(),onClick:w,children:"\u2039"}),Te("span",{className:_.month,"data-aia-date-month":"","aria-live":"polite",children:pi(o)}),Te("button",{type:"button",tabIndex:-1,className:_.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:u=>u.preventDefault(),onClick:v,children:"\u203A"})]}),Te("div",{className:_.weekdays,"aria-hidden":"true",children:ui.map((u,p)=>Te("span",{className:_.weekday,children:u},gi[p]))}),Te("div",{className:_.grid,"data-aia-date-grid":"",children:e.map((u,p)=>Te(fi,{option:u,id:`${t}-option-${p}`,index:p,isHighlighted:p===r&&u.is_tappable,isToday:vt(u)===y,isPast:di(vt(u),y,n.floor),marks:li(vt(u),{selectedIso:n.selectedIso,range:m,references:n.references}),onSelect:l,onHighlight:s,onUnhighlight:c},vt(u)??`pad-${p}`))})]})}function fi({option:e,id:r,index:t,isHighlighted:o,isToday:n,isPast:l,marks:s,onSelect:c,onHighlight:w,onUnhighlight:v}){let[y,m]=mi(!1),u=si(e);if(u==null)return Te("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${_.cell} ${_.blank}`});let p=()=>{m(!0),c(e),setTimeout(()=>m(!1),170)},k=[_.cell,_.day,l?_.past:"",o?_.highlighted:"",n?_.today:"",s.inRange?_.inRange:"",s.selected?_.selected:"",s.reference?_.reference:"",y?_.pressed:""].filter(Boolean).join(" ");return Te("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":o,"aria-label":e.text,tabIndex:0,className:k,onClick:p,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),p())},onMouseEnter:()=>w(t),onMouseLeave:v?()=>v(t):void 0,children:Te("span",{className:_.number,children:u})})}import{ATTRIBUTION_URL as bi,buildAttributionUrl as wi,getFooterHint as vi,uiStringsFor as xi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as yi,useState as ki}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
2014
2038
  display: flex;
2015
2039
  flex-wrap: wrap;
2016
2040
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -2050,7 +2074,7 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
2050
2074
  .aia-cluster[data-justify="around"] {
2051
2075
  justify-content: space-around;
2052
2076
  }
2053
- `,document.head.appendChild(e)}import{jsx as ua}from"react/jsx-runtime";function kt({gap:e,align:r="center",justify:t="start",noWrap:o=!1,inline:n=!1,className:d,children:s,...c}){let f=e?{"--aia-cluster-gap":e}:void 0,x={className:d?`aia-cluster ${d}`:"aia-cluster","data-align":r,"data-justify":t,"data-nowrap":o||void 0,"data-inline":n||void 0,style:f,...c};return n?ua("span",{...x,children:s}):ua("div",{...x,children:s})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
2077
+ `,document.head.appendChild(e)}import{jsx as ma}from"react/jsx-runtime";function xt({gap:e,align:r="center",justify:t="start",noWrap:o=!1,inline:n=!1,className:l,children:s,...c}){let w=e?{"--aia-cluster-gap":e}:void 0,v={className:l?`aia-cluster ${l}`:"aia-cluster","data-align":r,"data-justify":t,"data-nowrap":o||void 0,"data-inline":n||void 0,style:w,...c};return n?ma("span",{...v,children:s}):ma("div",{...v,children:s})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
2054
2078
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
2055
2079
  room above the hint/branding row so the footer doesn't butt against the last
2056
2080
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -2198,7 +2222,7 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
2198
2222
  justify-content: flex-end;
2199
2223
  }
2200
2224
  }
2201
- `,document.head.appendChild(e)}var Ne={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};import{jsx as ht,jsxs as ma}from"react/jsx-runtime";function ga({isOptionHighlighted:e=!1,isInputEmpty:r=!1,strings:t=wi()}){let{key:o,hint:n}=bi(e,r,t),[d,s]=xi(gi);return vi(()=>{s(fi())},[]),ht("footer",{className:Ne.footer,"data-aia-footer":"",children:ma(kt,{justify:"between",noWrap:!0,className:Ne.row,children:[ma(kt,{gap:"5px",className:Ne.hintGroup,children:[ht("kbd",{className:Ne.key,children:o}),ht("span",{className:Ne.hint,children:n})]}),ht("a",{className:Ne.brandLink,href:d,target:"_blank",rel:"noopener noreferrer",children:ht("span",{className:Ne.badge,children:ht("span",{className:Ne.brand,children:"Powered by Intent-1"})})})]})})}import{useEffect as fa,useLayoutEffect as yi,useRef as ue}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
2225
+ `,document.head.appendChild(e)}var Me={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};import{jsx as pt,jsxs as ga}from"react/jsx-runtime";function fa({isOptionHighlighted:e=!1,isInputEmpty:r=!1,strings:t=xi()}){let{key:o,hint:n}=vi(e,r,t),[l,s]=ki(bi);return yi(()=>{s(wi())},[]),pt("footer",{className:Me.footer,"data-aia-footer":"",children:ga(xt,{justify:"between",noWrap:!0,className:Me.row,children:[ga(xt,{gap:"5px",className:Me.hintGroup,children:[pt("kbd",{className:Me.key,children:o}),pt("span",{className:Me.hint,children:n})]}),pt("a",{className:Me.brandLink,href:l,target:"_blank",rel:"noopener noreferrer",children:pt("span",{className:Me.badge,children:pt("span",{className:Me.brand,children:"Powered by Intent-1"})})})]})})}import{useEffect as ba,useLayoutEffect as Si,useRef as ge}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
2202
2226
  Angular copy). The three are kept identical by
2203
2227
  packages/vanilla/tests/render/locationFieldParity.test.ts. */
2204
2228
  .aia-location-6-fsr {
@@ -2332,7 +2356,7 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
2332
2356
  .aia-loadingBar-OLCr4:nth-child(3) {
2333
2357
  width: 60%;
2334
2358
  }
2335
- `,document.head.appendChild(e)}var U={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};import{jsx as ne,jsxs as Ge}from"react/jsx-runtime";var ki=0;function St(e){return e.getRootNode().activeElement??null}function va(e){return e.getRootNode().getSelection?.()??document.getSelection()}function ba(e){if(!e.isContentEditable)return null;let r=va(e);if(!r||r.rangeCount===0)return null;let t=r.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function wa(e,r){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=va(e);if(!t)return;let o=r;(!o||!o.startContainer.isConnected||!e.contains(o.startContainer))&&(o=document.createRange(),o.selectNodeContents(e),o.collapse(!1)),t.removeAllRanges(),t.addRange(o)}var Si=Ge("svg",{className:U.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[ne("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),ne("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Ci=Ge("svg",{className:U.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[ne("circle",{cx:"11",cy:"11",r:"7"}),ne("path",{d:"m20 20-3.5-3.5"})]});function xa({view:e,searchLabel:r,noResultsLabel:t,useTypedLabel:o,widgetFocused:n,reediting:d=!1,visible:s=!0,interactive:c=!0,onQuery:f,onMove:x,onCommit:y,onFocusChange:m}){let p=ue(null),h=ue(null),k=ue(null),S=ue(null),T=ue(null),O=ue(!1),L=ue(!1),Y=ue(!1),N=ue(!1),A=ue(n);A.current=n;let D=ue(m);D.current=m;let F=a=>{N.current=a,m(a)},W=()=>{let a=p.current;return a!=null&&St(a)===a},re=()=>{let a=h.current;if(!a)return;let v=St(a);v instanceof HTMLElement&&v!==p.current&&v!==document.body&&!a.contains(v)&&(S.current=v,T.current=ba(v))},G=a=>{let v=h.current;!v||!(a instanceof HTMLElement)||a===S.current||a===document.body||v.contains(a)||(S.current=a,T.current=ba(a))},P=ue(null);P.current===null&&(P.current=`aia-location-${++ki}`);let j=`${P.current}-row-`;fa(()=>{let a=p.current;a&&a.value!==e.query&&St(a)!==a&&(a.value=e.query)},[e.query]),fa(()=>{n&&(d&&!Y.current&&(L.current=!1),Y.current=d);let a=p.current;if(a){if(!s&&W()){L.current=!0,K();return}if(!n){setTimeout(()=>{if(A.current)return;let v=S.current;v&&St(v)===v||(L.current=!1)},0);return}if(!(!d||L.current||!c||W())){if(re(),F(!0),a.focus({preventScroll:!0}),!W()){L.current=!0,F(!1);return}a.value&&a.select()}}}),yi(()=>()=>{if(!N.current)return;let a=p.current,v=S.current;v?.isConnected&&a&&St(a)===a&&(O.current=!0,wa(v,T.current),O.current=!1),N.current=!1,D.current(!1)},[]);let K=(a=!1)=>{a&&(L.current=!0);let v=S.current;v?.isConnected&&W()&&(O.current=!0,wa(v,T.current),O.current=!1),F(!1)},se=e.query.trim(),le=e.highlighted>=0&&e.highlighted<e.places.length?`${j}${e.highlighted}`:void 0,ee=null;return e.places.length>0?ee=e.places.map((a,v)=>Ge("div",{id:`${j}${v}`,role:"option","aria-selected":v===e.highlighted,className:v===e.highlighted?`${U.row} ${U.highlighted}`:U.row,"data-aia-location-row":"","data-aia-index":v,onClick:()=>{c&&(K(!0),y(v))},children:[ne("span",{className:U.pin,children:Si}),Ge("span",{className:U.text,children:[ne("span",{className:U.name,children:a.name}),a.secondary&&ne("span",{className:U.secondary,children:a.secondary})]})]},a.id)):e.status==="loading"?ee=Ge("div",{className:U.loading,"data-aia-location-loading":"",children:[ne("span",{className:U.loadingBar}),ne("span",{className:U.loadingBar}),ne("span",{className:U.loadingBar})]}):se&&(ee=Ge("div",{className:U.note,"data-aia-location-note":"",children:[e.status==="done"&&ne("span",{className:U.empty,children:t}),ne("span",{children:o})]})),Ge("div",{ref:h,className:U.location,"data-aia-location":"",onMouseDown:a=>{!(a.target instanceof Node)||!k.current?.contains(a.target)||(a.stopPropagation(),re(),F(!0))},children:[Ge("label",{ref:k,className:U.field,children:[Ci,ne("input",{ref:p,type:"text",className:U.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:r,"aria-label":r,"aria-activedescendant":le,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:s?0:-1,onChange:a=>f(a.target.value),onFocus:a=>{G(a.relatedTarget),F(!0)},onBlur:()=>{O.current||(L.current=!0,F(!1))},onKeyDown:a=>{if(!a.nativeEvent.isComposing)switch(a.key){case"ArrowDown":case"ArrowUp":a.preventDefault(),x(a.key==="ArrowDown"?1:-1);return;case"Enter":if(a.preventDefault(),!c)return;K(!0),y();return;case"Escape":a.preventDefault(),a.stopPropagation(),L.current=!0,K();return;case"Backspace":if(a.currentTarget.value!=="")return;a.preventDefault(),L.current=!0,K();return}}})]}),ne("div",{className:U.results,"data-aia-location-results":"","aria-live":"polite",children:ee})]})}import{isSmartSuggestion as Ai,isTraditionalAutocompleteSuggestion as Ei}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as Ti}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
2359
+ `,document.head.appendChild(e)}var U={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};import{jsx as re,jsxs as _e}from"react/jsx-runtime";var Ci=0;function yt(e){return e.getRootNode().activeElement??null}function xa(e){return e.getRootNode().getSelection?.()??document.getSelection()}function wa(e){if(!e.isContentEditable)return null;let r=xa(e);if(!r||r.rangeCount===0)return null;let t=r.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function va(e,r){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=xa(e);if(!t)return;let o=r;(!o||!o.startContainer.isConnected||!e.contains(o.startContainer))&&(o=document.createRange(),o.selectNodeContents(e),o.collapse(!1)),t.removeAllRanges(),t.addRange(o)}var Ti=_e("svg",{className:U.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[re("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),re("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Pi=_e("svg",{className:U.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[re("circle",{cx:"11",cy:"11",r:"7"}),re("path",{d:"m20 20-3.5-3.5"})]});function ya({view:e,searchLabel:r,noResultsLabel:t,useTypedLabel:o,widgetFocused:n,reediting:l=!1,visible:s=!0,interactive:c=!0,onQuery:w,onMove:v,onCommit:y,onFocusChange:m}){let u=ge(null),p=ge(null),k=ge(null),S=ge(null),T=ge(null),O=ge(!1),L=ge(!1),j=ge(!1),N=ge(!1),A=ge(n);A.current=n;let D=ge(m);D.current=m;let F=a=>{N.current=a,m(a)},Y=()=>{let a=u.current;return a!=null&&yt(a)===a},ie=()=>{let a=p.current;if(!a)return;let x=yt(a);x instanceof HTMLElement&&x!==u.current&&x!==document.body&&!a.contains(x)&&(S.current=x,T.current=wa(x))},X=a=>{let x=p.current;!x||!(a instanceof HTMLElement)||a===S.current||a===document.body||x.contains(a)||(S.current=a,T.current=wa(a))},W=ge(null);W.current===null&&(W.current=`aia-location-${++Ci}`);let I=`${W.current}-row-`;ba(()=>{let a=u.current;a&&a.value!==e.query&&yt(a)!==a&&(a.value=e.query)},[e.query]),ba(()=>{n&&(l&&!j.current&&(L.current=!1),j.current=l);let a=u.current;if(a){if(!s&&Y()){L.current=!0,G();return}if(!n){setTimeout(()=>{if(A.current)return;let x=S.current;x&&yt(x)===x||(L.current=!1)},0);return}if(!(!l||L.current||!c||Y())){if(ie(),F(!0),a.focus({preventScroll:!0}),!Y()){L.current=!0,F(!1);return}a.value&&a.select()}}}),Si(()=>()=>{if(!N.current)return;let a=u.current,x=S.current;x?.isConnected&&a&&yt(a)===a&&(O.current=!0,va(x,T.current),O.current=!1),N.current=!1,D.current(!1)},[]);let G=(a=!1)=>{a&&(L.current=!0);let x=S.current;x?.isConnected&&Y()&&(O.current=!0,va(x,T.current),O.current=!1),F(!1)},se=e.query.trim(),le=e.highlighted>=0&&e.highlighted<e.places.length?`${I}${e.highlighted}`:void 0,ee=null;return e.places.length>0?ee=e.places.map((a,x)=>_e("div",{id:`${I}${x}`,role:"option","aria-selected":x===e.highlighted,className:x===e.highlighted?`${U.row} ${U.highlighted}`:U.row,"data-aia-location-row":"","data-aia-index":x,onClick:()=>{c&&(G(!0),y(x))},children:[re("span",{className:U.pin,children:Ti}),_e("span",{className:U.text,children:[re("span",{className:U.name,children:a.name}),a.secondary&&re("span",{className:U.secondary,children:a.secondary})]})]},a.id)):e.status==="loading"?ee=_e("div",{className:U.loading,"data-aia-location-loading":"",children:[re("span",{className:U.loadingBar}),re("span",{className:U.loadingBar}),re("span",{className:U.loadingBar})]}):se&&(ee=_e("div",{className:U.note,"data-aia-location-note":"",children:[e.status==="done"&&re("span",{className:U.empty,children:t}),re("span",{children:o})]})),_e("div",{ref:p,className:U.location,"data-aia-location":"",onMouseDown:a=>{!(a.target instanceof Node)||!k.current?.contains(a.target)||(a.stopPropagation(),ie(),F(!0))},children:[_e("label",{ref:k,className:U.field,children:[Pi,re("input",{ref:u,type:"text",className:U.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:r,"aria-label":r,"aria-activedescendant":le,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:s?0:-1,onChange:a=>w(a.target.value),onFocus:a=>{X(a.relatedTarget),F(!0)},onBlur:()=>{O.current||(L.current=!0,F(!1))},onKeyDown:a=>{if(!a.nativeEvent.isComposing)switch(a.key){case"ArrowDown":case"ArrowUp":a.preventDefault(),v(a.key==="ArrowDown"?1:-1);return;case"Enter":if(a.preventDefault(),!c)return;G(!0),y();return;case"Escape":a.preventDefault(),a.stopPropagation(),L.current=!0,G();return;case"Backspace":if(a.currentTarget.value!=="")return;a.preventDefault(),L.current=!0,G();return}}})]}),re("div",{className:U.results,"data-aia-location-results":"","aria-live":"polite",children:ee})]})}import{isSmartSuggestion as Ri,isTraditionalAutocompleteSuggestion as zi}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as Ii}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
2336
2360
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
2337
2361
  The border is kept as a 1px transparent line so the box stays the same size
2338
2362
  as it was when the outline was dashed. */
@@ -2490,7 +2514,7 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
2490
2514
  opacity: 0;
2491
2515
  }
2492
2516
  }
2493
- `,document.head.appendChild(e)}var Ie={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};import{Fragment as Pi,jsx as Ht,jsxs as Ii}from"react/jsx-runtime";var Bt={selected:1,first:.7,next:.4,last:.2};function ya({label:e,state:r,active:t,rounded:o,loading:n,smartSuggestion:d,completionHeader:s,onClick:c}){let f=[Ie.pill,o?Ie.rounded:"",n?Ie.skeleton:""].filter(Boolean).join(" ");return Ht("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":n?"":void 0,"data-aia-smart-suggestion":d?s?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:f,style:{"--aia-pill-opacity":Bt[r]},onMouseDown:x=>x.preventDefault(),onClick:n?void 0:c,disabled:n,children:d?Ii(Pi,{children:[Ht("span",{className:`${Ie.smartText} magicx-aia-smart-suggestion-text`,children:e}),Ht("span",{className:`${Ie.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Ti}})]}):e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
2517
+ `,document.head.appendChild(e)}var Pe={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};import{Fragment as Ai,jsx as Bt,jsxs as Ei}from"react/jsx-runtime";var Wt={selected:1,first:.7,next:.4,last:.2};function ka({label:e,state:r,active:t,rounded:o,loading:n,smartSuggestion:l,completionHeader:s,onClick:c}){let w=[Pe.pill,o?Pe.rounded:"",n?Pe.skeleton:""].filter(Boolean).join(" ");return Bt("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":n?"":void 0,"data-aia-smart-suggestion":l?s?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:w,style:{"--aia-pill-opacity":Wt[r]},onMouseDown:v=>v.preventDefault(),onClick:n?void 0:c,disabled:n,children:l?Ei(Ai,{children:[Bt("span",{className:`${Pe.smartText} magicx-aia-smart-suggestion-text`,children:e}),Bt("span",{className:`${Pe.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Ii}})]}):e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
2494
2518
  position: relative;
2495
2519
  z-index: 1;
2496
2520
  pointer-events: auto;
@@ -2500,7 +2524,7 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
2500
2524
  align-items: center;
2501
2525
  vertical-align: middle;
2502
2526
  }
2503
- `,document.head.appendChild(e)}var Wt={list:"aia-list-qvLqO"};import{jsx as At}from"react/jsx-runtime";var Ri=[125,69];function ka(e){return e===0?"first":e===1?"next":"last"}function Et({pills:e,activePillIndex:r,onSelectPill:t,activeSelected:o,rounded:n,loading:d}){return d&&e.length===0?At("span",{className:Wt.list,"data-aia-pill-list-loading":"",children:Ri.map((s,c)=>At("span",{"data-aia-pill-skeleton":"",className:`${Ie.pill} ${n?Ie.rounded:""} ${Ie.skeleton}`,style:{width:s,"--aia-pill-opacity":Bt[ka(c)]}},`skel-${s}`))}):At("span",{className:Wt.list,"data-aia-pill-list-loading":d?"":void 0,children:e.map((s,c)=>{let f=!!o&&c===r;return At(ya,{label:s.text,state:f?"selected":ka(c),selected:f,active:c===r,rounded:n,loading:d,smartSuggestion:Ai(s),completionHeader:Ei(s),onClick:()=>t(c)},`${s.parameter}-${s.text}`)})})}import{attachProductRowWheel as zi,productImageSources as Li,productImageSrc as Oi,productInitial as Di,productPhotoFill as Mi,uiStringsFor as Ni}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Gt,useRef as Rt,useState as zt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
2527
+ `,document.head.appendChild(e)}var Gt={list:"aia-list-qvLqO"};import{jsx as Et}from"react/jsx-runtime";var Li=[125,69];function Sa(e){return e===0?"first":e===1?"next":"last"}function Rt({pills:e,activePillIndex:r,onSelectPill:t,activeSelected:o,rounded:n,loading:l}){return l&&e.length===0?Et("span",{className:Gt.list,"data-aia-pill-list-loading":"",children:Li.map((s,c)=>Et("span",{"data-aia-pill-skeleton":"",className:`${Pe.pill} ${n?Pe.rounded:""} ${Pe.skeleton}`,style:{width:s,"--aia-pill-opacity":Wt[Sa(c)]}},`skel-${s}`))}):Et("span",{className:Gt.list,"data-aia-pill-list-loading":l?"":void 0,children:e.map((s,c)=>{let w=!!o&&c===r;return Et(ka,{label:s.text,state:w?"selected":Sa(c),selected:w,active:c===r,rounded:n,loading:l,smartSuggestion:Ri(s),completionHeader:zi(s),onClick:()=>t(c)},`${s.parameter}-${s.text}`)})})}import{attachProductRowWheel as Oi,productImageSources as Di,productImageSrc as Mi,productInitial as Ni,productPhotoFill as Fi,uiStringsFor as Hi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Kt,useRef as zt,useState as Lt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
2504
2528
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
2505
2529
  theming one package sees the same result in the other.
2506
2530
 
@@ -3127,7 +3151,7 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
3127
3151
  opacity: 0.01;
3128
3152
  }
3129
3153
  }
3130
- `,document.head.appendChild(e)}var Q={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};import{jsx as J,jsxs as ut}from"react/jsx-runtime";function Sa({products:e,listboxId:r,onSelect:t,busyProductId:o=null,onAddToCart:n,onFocusChange:d,focusable:s=!0,loading:c=!1,layout:f="row",imageFallback:x="image",showVendor:y=!0,strings:m=Ni()}){let p=e.length>0,h=Rt(null);if(Gt(()=>{let S=h.current;if(!(!p||!S))return zi(S)},[p]),!p)return null;let k=`${r}-products-label`;return ut("section",{className:Q.section,"data-aia-products":"","data-aia-loading":c?"":void 0,"data-aia-products-layout":f,role:"group","aria-labelledby":k,children:[J("div",{className:Q.label,id:k,"data-aia-products-label":"",children:m.products}),J("div",{ref:h,className:Q.row,"data-aia-products-row":"",children:e.map((S,T)=>J(Fi,{product:S,id:`${r}-product-${T}`,onSelect:t,busy:S.id===o,onAddToCart:n,onFocusChange:d,focusable:s,imageFallback:x,showVendor:y,soldOut:m.soldOut,addToCart:m.addToCart},S.id))})]})}function Fi({product:e,id:r,onSelect:t,busy:o,onAddToCart:n,onFocusChange:d,focusable:s,imageFallback:c,showVendor:f,soldOut:x,addToCart:y}){let m=!!n&&e.available!==!1,[p,h]=zt(null),k=T=>{T.relatedTarget?.closest("[data-aia-dropdown]")||d?.(!1)},S=T=>{T.metaKey||T.ctrlKey||T.shiftKey||T.altKey||T.button!==0||(T.preventDefault(),t(e))};return ut("a",{id:r,className:Q.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":m?"":void 0,"data-aia-product-state":o?"busy":void 0,"aria-busy":o?!0:void 0,role:"option","aria-selected":!1,style:p?{"--aia-product-photo-fill-x":String(p.x),"--aia-product-photo-fill-y":String(p.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:S,onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),t(e))},onFocus:()=>d?.(!0),onBlur:k,children:[J(Wi,{sources:Li(e.imageUrl),title:e.title,fallback:c,onPhotoFill:h},Oi(e.imageUrl)??""),ut("span",{className:Q.body,children:[f&&e.vendor?J("span",{className:Q.vendor,children:e.vendor}):null,J("span",{className:Q.title,children:e.title}),e.price?ut("span",{className:Q.price,children:[e.price,e.compareAtPrice?J("s",{className:Q.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?J("span",{className:Q.badge,children:x}):null]}),m&&n?J(Bi,{product:e,label:`${y}: ${e.title}`,focusable:s,onAddToCart:n,onFocus:()=>d?.(!0),onBlur:k},Hi(e)):null]})}function Hi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(r=>r??"").join("\0")}function Bi({product:e,label:r,focusable:t,onAddToCart:o,onFocus:n,onBlur:d}){let[s,c]=zt(null),f=Rt(null),x=Rt(e);x.current=e;let y=Rt(!0);Gt(()=>(y.current=!0,()=>{y.current=!1}),[]);let m=h=>{f.current=h,y.current&&c(h)},p=h=>{if(h.preventDefault(),h.stopPropagation(),f.current==="adding")return;m("adding");let k;try{k=Promise.resolve(o(x.current))}catch(S){k=Promise.reject(S)}k.then(()=>m("added"),()=>m(null))};return J("span",{className:Q.cart,"data-aia-product-cart":"","data-aia-cart-state":s??void 0,"aria-busy":s==="adding"?!0:void 0,role:"button","aria-label":r,tabIndex:t?0:-1,onClick:p,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||p(h)},onFocus:h=>{h.stopPropagation(),n()},onBlur:h=>{h.stopPropagation(),d(h)},children:ut("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[J("path",{className:Q.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),J("path",{className:Q.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),J("path",{className:Q.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),J("path",{className:Q.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),J("circle",{className:Q.cartGlyph,cx:"9",cy:"20",r:"1.3"}),J("circle",{className:Q.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Wi({sources:e,title:r,fallback:t,onPhotoFill:o}){let[n,d]=zt(0),s=e[n],c=!!s,[f,x]=zt(null),y=!c&&t==="initial";return Gt(()=>()=>o(null),[o]),ut("span",{className:Q.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!c&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":c&&f===s?"":void 0,children:[c?J("img",{className:Q.image,src:s,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{x(s),o(Mi(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{n+1>=e.length&&o(null),d(m=>m+1)}}):null,y?Di(r):null]})}import{isOptionsGridMobileViewport as ao,measureOptionsGrid as io,needsOptionsGridMeasurement as oo,OPTIONS_GRID_MOBILE_QUERY as no,optionEnterDelayMs as ro,optionsShowLeadingVisuals as so,planOptionsGrid as Aa,pointerMayHighlight as Ea,releasePanelHug as lo,sameOptionRows as co,syncHighlightScroll as po,syncPanelHug as ho}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as uo,useLayoutEffect as _t,useRef as Ra,useState as La}from"react";import{optionsGridTemplateColumns as Gi}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Ki,useRef as qi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
3154
+ `,document.head.appendChild(e)}var Q={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};import{jsx as J,jsxs as ht}from"react/jsx-runtime";function Ca({products:e,listboxId:r,onSelect:t,busyProductId:o=null,onAddToCart:n,onFocusChange:l,focusable:s=!0,loading:c=!1,layout:w="row",imageFallback:v="image",showVendor:y=!0,strings:m=Hi()}){let u=e.length>0,p=zt(null);if(Kt(()=>{let S=p.current;if(!(!u||!S))return Oi(S)},[u]),!u)return null;let k=`${r}-products-label`;return ht("section",{className:Q.section,"data-aia-products":"","data-aia-loading":c?"":void 0,"data-aia-products-layout":w,role:"group","aria-labelledby":k,children:[J("div",{className:Q.label,id:k,"data-aia-products-label":"",children:m.products}),J("div",{ref:p,className:Q.row,"data-aia-products-row":"",children:e.map((S,T)=>J(Bi,{product:S,id:`${r}-product-${T}`,onSelect:t,busy:S.id===o,onAddToCart:n,onFocusChange:l,focusable:s,imageFallback:v,showVendor:y,soldOut:m.soldOut,addToCart:m.addToCart},S.id))})]})}function Bi({product:e,id:r,onSelect:t,busy:o,onAddToCart:n,onFocusChange:l,focusable:s,imageFallback:c,showVendor:w,soldOut:v,addToCart:y}){let m=!!n&&e.available!==!1,[u,p]=Lt(null),k=T=>{T.relatedTarget?.closest("[data-aia-dropdown]")||l?.(!1)},S=T=>{T.metaKey||T.ctrlKey||T.shiftKey||T.altKey||T.button!==0||(T.preventDefault(),t(e))};return ht("a",{id:r,className:Q.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":m?"":void 0,"data-aia-product-state":o?"busy":void 0,"aria-busy":o?!0:void 0,role:"option","aria-selected":!1,style:u?{"--aia-product-photo-fill-x":String(u.x),"--aia-product-photo-fill-y":String(u.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:S,onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),t(e))},onFocus:()=>l?.(!0),onBlur:k,children:[J(Ki,{sources:Di(e.imageUrl),title:e.title,fallback:c,onPhotoFill:p},Mi(e.imageUrl)??""),ht("span",{className:Q.body,children:[w&&e.vendor?J("span",{className:Q.vendor,children:e.vendor}):null,J("span",{className:Q.title,children:e.title}),e.price?ht("span",{className:Q.price,children:[e.price,e.compareAtPrice?J("s",{className:Q.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?J("span",{className:Q.badge,children:v}):null]}),m&&n?J(Gi,{product:e,label:`${y}: ${e.title}`,focusable:s,onAddToCart:n,onFocus:()=>l?.(!0),onBlur:k},Wi(e)):null]})}function Wi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(r=>r??"").join("\0")}function Gi({product:e,label:r,focusable:t,onAddToCart:o,onFocus:n,onBlur:l}){let[s,c]=Lt(null),w=zt(null),v=zt(e);v.current=e;let y=zt(!0);Kt(()=>(y.current=!0,()=>{y.current=!1}),[]);let m=p=>{w.current=p,y.current&&c(p)},u=p=>{if(p.preventDefault(),p.stopPropagation(),w.current==="adding")return;m("adding");let k;try{k=Promise.resolve(o(v.current))}catch(S){k=Promise.reject(S)}k.then(()=>m("added"),()=>m(null))};return J("span",{className:Q.cart,"data-aia-product-cart":"","data-aia-cart-state":s??void 0,"aria-busy":s==="adding"?!0:void 0,role:"button","aria-label":r,tabIndex:t?0:-1,onClick:u,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||u(p)},onFocus:p=>{p.stopPropagation(),n()},onBlur:p=>{p.stopPropagation(),l(p)},children:ht("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[J("path",{className:Q.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),J("path",{className:Q.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),J("path",{className:Q.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),J("path",{className:Q.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),J("circle",{className:Q.cartGlyph,cx:"9",cy:"20",r:"1.3"}),J("circle",{className:Q.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ki({sources:e,title:r,fallback:t,onPhotoFill:o}){let[n,l]=Lt(0),s=e[n],c=!!s,[w,v]=Lt(null),y=!c&&t==="initial";return Kt(()=>()=>o(null),[o]),ht("span",{className:Q.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!c&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":c&&w===s?"":void 0,children:[c?J("img",{className:Q.image,src:s,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{v(s),o(Fi(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{n+1>=e.length&&o(null),l(m=>m+1)}}):null,y?Ni(r):null]})}import{isOptionsGridMobileViewport as oo,measureOptionsGrid as no,needsOptionsGridMeasurement as ro,OPTIONS_GRID_MOBILE_QUERY as so,optionEnterDelayMs as lo,optionsShowLeadingVisuals as co,planOptionsGrid as Ea,pointerMayHighlight as Ra,releasePanelHug as po,sameOptionRows as ho,syncHighlightScroll as uo,syncPanelHug as mo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as go,useLayoutEffect as Vt,useRef as za,useState as Oa}from"react";import{optionsGridTemplateColumns as qi}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as _i,useRef as Vi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
3131
3155
  display: grid;
3132
3156
  grid-template-columns: repeat(
3133
3157
  auto-fit,
@@ -3171,7 +3195,7 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
3171
3195
  :where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
3172
3196
  max-height: var(--aia-grid-max-height, 120px);
3173
3197
  }
3174
- `,document.head.appendChild(e)}import{jsx as _i}from"react/jsx-runtime";function Ca({min:e="16rem",max:r,gap:t,scroll:o=!1,maxHeight:n,scrollResetKey:d,cols:s,template:c,innerRef:f,className:x,children:y,...m}){let p=qi(null);Ki(()=>{if(d===void 0)return;let k=p.current;k&&(k.scrollTop=0)},[d]);let h={"--aia-grid-min":e};return r&&(h["--aia-grid-max"]=r),t&&(h["--aia-grid-gap"]=t),n&&(h["--aia-grid-max-height"]=n),s&&(h.gridTemplateColumns=Gi(s)),c&&(h.gridTemplateColumns=c),_i("div",{ref:k=>{p.current=k,f?.(k)},className:x?`aia-grid ${x}`:"aia-grid","data-scroll":o||void 0,style:h,...m,children:y})}import{clearPanelMorphPressLook as Vi,formatOptionCount as Ui,highlightParts as Qi,isMultiSelectToggleTap as Yi,OPTION_ENTER_DELAY_VAR as ji,optionImageSources as Ta,optionLabel as Pa,sanitizeOptionIconSvg as $i}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Zi,useMemo as Xi,useRef as Kt,useState as Ct}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
3198
+ `,document.head.appendChild(e)}import{jsx as Ui}from"react/jsx-runtime";function Ta({min:e="16rem",max:r,gap:t,scroll:o=!1,maxHeight:n,scrollResetKey:l,cols:s,template:c,innerRef:w,className:v,children:y,...m}){let u=Vi(null);_i(()=>{if(l===void 0)return;let k=u.current;k&&(k.scrollTop=0)},[l]);let p={"--aia-grid-min":e};return r&&(p["--aia-grid-max"]=r),t&&(p["--aia-grid-gap"]=t),n&&(p["--aia-grid-max-height"]=n),s&&(p.gridTemplateColumns=qi(s)),c&&(p.gridTemplateColumns=c),Ui("div",{ref:k=>{u.current=k,w?.(k)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":o||void 0,style:p,...m,children:y})}import{clearPanelMorphPressLook as Qi,formatOptionCount as Yi,highlightParts as ji,isMultiSelectToggleTap as $i,OPTION_ENTER_DELAY_VAR as Zi,optionImageSources as Pa,optionLabel as Ia,sanitizeOptionIconSvg as Xi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ji,useMemo as eo,useRef as qt,useState as kt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
3175
3199
  position: relative;
3176
3200
  /* Clip, not visible: the entrance rise below runs on the inner content,
3177
3201
  and a transformed box extends its scroll container's scrollable area.
@@ -3734,7 +3758,7 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
3734
3758
  height: 18px;
3735
3759
  border-radius: 6px;
3736
3760
  }
3737
- `,document.head.appendChild(e)}var $={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg",checkPop:"aia-checkPop-CCWRW"};import{Fragment as to,jsx as ve,jsxs as qt}from"react/jsx-runtime";var Ji=2e3,eo=170;function Ia({option:e,isHighlighted:r,checked:t,onSelect:o,onHighlight:n,onUnhighlight:d,id:s,loading:c,showIcon:f=!0,showImage:x=!0,showCount:y=!0,scrollHint:m,enterDelayMs:p=0}){let[h]=Ct(p),[k,S]=Ct(!1),T=x?Ta(e.image_url):[],O=T[0]??null,[L,Y]=Ct([]),N=T.find(a=>!L.includes(a))??null,A=x?(e.imageCollage??[]).map(a=>Ta(a)[0]).filter(a=>a!==void 0):[],[D,F]=Ct(!1),[W,re]=Ct(null),G=Xi(()=>!O&&f&&e.icon_svg?$i(e.icon_svg):null,[O,f,e.icon_svg]),P=y?Ui(e.item_count):null,j=Kt(void 0),K=Kt(null),se=Kt(Number.NEGATIVE_INFINITY);Zi(()=>()=>clearTimeout(j.current),[]);let le=a=>{if(c||!e.is_tappable)return;let v=a?.currentTarget,te=t!==void 0&&v!==void 0&&a!==void 0&&!Yi(v,v.querySelector("[data-aia-checkbox]"),a),me=t!==void 0&&!te;if(!me){let oe=performance.now();if(oe-se.current<eo)return;se.current=oe}te?o(e,{commit:!0}):o(e),!me&&(S(!0),clearTimeout(j.current),j.current=setTimeout(()=>{S(!1),Vi(K.current?.closest("[data-aia-dropdown]"))},Ji))},ee=[$.item,r&&!c?$.highlighted:"",e.liveMatch&&!c?$.liveMatch:"",e.is_tappable?$.tappable:$.nonTappable,k?$.pressed:"",m?$.scrollHint:""].filter(Boolean).join(" ");return ve("div",{ref:K,id:s,role:"option","data-aia-option":"","data-aia-loading":c?"":void 0,"data-aia-icon":G&&e.icon?e.icon:void 0,"data-aia-image":O?"":void 0,"data-aia-item-count":P!==null?e.item_count:void 0,"aria-selected":t??r,className:ee,style:{[ji]:`${h}ms`},tabIndex:c||!e.is_tappable?-1:0,onClick:le,onKeyDown:a=>{!c&&e.is_tappable&&(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),le())},onMouseEnter:!c&&e.is_tappable?n:void 0,onMouseLeave:d,children:qt("span",{className:$.content,children:[t!==void 0&&e.is_tappable&&ve("span",{className:$.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t}),O&&A.length>1&&ve("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":A.length,"data-aia-image-loaded":D?"":void 0,children:A.map(a=>ve("img",{src:a,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>F(!0),onError:v=>{v.currentTarget.hidden=!0}},a))}),O&&A.length<=1&&ve("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":N!==null&&W===N?"":void 0,children:ve("img",{src:N??O,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:N===null,onLoad:()=>re(N),onError:()=>{N!==null&&Y(a=>[...a,N])}})}),G&&ve("span",{className:`${$.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:G}}),qt("span",{className:$.text,children:[e.matchedText?Qi(Pa(e),e.matchedText).map((a,v)=>a.bold?ve("strong",{className:`${$.match} magicx-aia-option-match`,"data-aia-match-partial":a.partial?"":void 0,children:a.text},v):a.text):Pa(e),e.parameterLabel&&qt(to,{children:[" ",ve("span",{className:`${$.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&ve("span",{className:$.tag,children:e.tag}),P!==null&&ve("span",{className:`${$.count} magicx-aia-option-count`,children:P})]})})}import{jsx as za}from"react/jsx-runtime";function mo(){let[e,r]=La(ao);return uo(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(no),o=()=>r(t.matches);return o(),t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[]),e}function Oa({options:e,activeIndex:r,picked:t,onSelect:o,onHighlight:n,onUnhighlight:d,listboxId:s,loading:c,groupKey:f="",optionsPosition:x="below",showIcons:y=!0,showImages:m=!0,showCounts:p=!0}){let h=mo(),k=Ra(null),[S,T]=La(null),O=Ra(null);_t(()=>{if(c&&co(O.current,e))return;O.current=c?null:e;let A=k.current,D=A&&!c&&oo(e.length,h),F=A?.closest("[data-aia-dropdown]");D&&F&&lo(F);let W=D?io(A):null;T(W?Aa(e.length,h,W.rowWidths,W.gridWidth):null)},[e,h,c]);let L=S??Aa(e.length,h,null,null);_t(()=>{let A=k.current?.closest("[data-aia-dropdown]");A&&ho(A)},[L.template,h]);let Y=c?-1:r;_t(()=>{k.current&&po(k.current,Y)},[Y]);let N=so(e,y,m);return za(Ca,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:f,template:L.template,maxHeight:L.maxHeight,innerRef:A=>{k.current=A},"data-aia-group":f,children:e.map((A,D)=>za(Ia,{option:A,isHighlighted:D===r,checked:t?t.includes(A.text):void 0,onSelect:o,onHighlight:F=>{Ea(k.current,D,F)&&n(D)},onUnhighlight:d?F=>{Ea(k.current,-1,F)&&d(D)}:void 0,id:`${s}-option-${D}`,loading:c,showIcon:y&&N,showImage:m&&N,showCount:p,scrollHint:!c&&L.scrollHintIndices.includes(D),enterDelayMs:c?0:ro(D,L.cols,e.length,x)},`${f}\0${A.parameter??""}\0${A.text}`))})}import{formatTime as go,TIME_WHEEL_COLUMNS as fo,TIME_WHEEL_ROW_HEIGHT as bo,timeWheelIndex as Da,timeWheelIndexFromScroll as wo,timeWheelRows as vo,withTimeWheelIndex as Ma}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as xo,useEffect as yo,useLayoutEffect as ko,useRef as Lt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
3761
+ `,document.head.appendChild(e)}var $={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg",checkPop:"aia-checkPop-CCWRW"};import{Fragment as io,jsx as xe,jsxs as _t}from"react/jsx-runtime";var to=2e3,ao=170;function Aa({option:e,isHighlighted:r,checked:t,onSelect:o,onHighlight:n,onUnhighlight:l,id:s,loading:c,showIcon:w=!0,showImage:v=!0,showCount:y=!0,scrollHint:m,enterDelayMs:u=0}){let[p]=kt(u),[k,S]=kt(!1),T=v?Pa(e.image_url):[],O=T[0]??null,[L,j]=kt([]),N=T.find(a=>!L.includes(a))??null,A=v?(e.imageCollage??[]).map(a=>Pa(a)[0]).filter(a=>a!==void 0):[],[D,F]=kt(!1),[Y,ie]=kt(null),X=eo(()=>!O&&w&&e.icon_svg?Xi(e.icon_svg):null,[O,w,e.icon_svg]),W=y?Yi(e.item_count):null,I=qt(void 0),G=qt(null),se=qt(Number.NEGATIVE_INFINITY);Ji(()=>()=>clearTimeout(I.current),[]);let le=a=>{if(c||!e.is_tappable)return;let x=a?.currentTarget,te=t!==void 0&&x!==void 0&&a!==void 0&&!$i(x,x.querySelector("[data-aia-checkbox]"),a),ae=t!==void 0&&!te;if(!ae){let ne=performance.now();if(ne-se.current<ao)return;se.current=ne}te?o(e,{commit:!0}):o(e),!ae&&(S(!0),clearTimeout(I.current),I.current=setTimeout(()=>{S(!1),Qi(G.current?.closest("[data-aia-dropdown]"))},to))},ee=[$.item,r&&!c?$.highlighted:"",e.liveMatch&&!c?$.liveMatch:"",e.is_tappable?$.tappable:$.nonTappable,k?$.pressed:"",m?$.scrollHint:""].filter(Boolean).join(" ");return xe("div",{ref:G,id:s,role:"option","data-aia-option":"","data-aia-loading":c?"":void 0,"data-aia-icon":X&&e.icon?e.icon:void 0,"data-aia-image":O?"":void 0,"data-aia-item-count":W!==null?e.item_count:void 0,"aria-selected":t??r,className:ee,style:{[Zi]:`${p}ms`},tabIndex:c||!e.is_tappable?-1:0,onClick:le,onKeyDown:a=>{!c&&e.is_tappable&&(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),le())},onMouseEnter:!c&&e.is_tappable?n:void 0,onMouseLeave:l,children:_t("span",{className:$.content,children:[t!==void 0&&e.is_tappable&&xe("span",{className:$.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t}),O&&A.length>1&&xe("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":A.length,"data-aia-image-loaded":D?"":void 0,children:A.map(a=>xe("img",{src:a,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>F(!0),onError:x=>{x.currentTarget.hidden=!0}},a))}),O&&A.length<=1&&xe("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":N!==null&&Y===N?"":void 0,children:xe("img",{src:N??O,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:N===null,onLoad:()=>ie(N),onError:()=>{N!==null&&j(a=>[...a,N])}})}),X&&xe("span",{className:`${$.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:X}}),_t("span",{className:$.text,children:[e.matchedText?ji(Ia(e),e.matchedText).map((a,x)=>a.bold?xe("strong",{className:`${$.match} magicx-aia-option-match`,"data-aia-match-partial":a.partial?"":void 0,children:a.text},x):a.text):Ia(e),e.parameterLabel&&_t(io,{children:[" ",xe("span",{className:`${$.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&xe("span",{className:$.tag,children:e.tag}),W!==null&&xe("span",{className:`${$.count} magicx-aia-option-count`,children:W})]})})}import{jsx as La}from"react/jsx-runtime";function fo(){let[e,r]=Oa(oo);return go(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(so),o=()=>r(t.matches);return o(),t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[]),e}function Da({options:e,activeIndex:r,picked:t,onSelect:o,onHighlight:n,onUnhighlight:l,listboxId:s,loading:c,groupKey:w="",optionsPosition:v="below",showIcons:y=!0,showImages:m=!0,showCounts:u=!0}){let p=fo(),k=za(null),[S,T]=Oa(null),O=za(null);Vt(()=>{if(c&&ho(O.current,e))return;O.current=c?null:e;let A=k.current,D=A&&!c&&ro(e.length,p),F=A?.closest("[data-aia-dropdown]");D&&F&&po(F);let Y=D?no(A):null;T(Y?Ea(e.length,p,Y.rowWidths,Y.gridWidth):null)},[e,p,c]);let L=S??Ea(e.length,p,null,null);Vt(()=>{let A=k.current?.closest("[data-aia-dropdown]");A&&mo(A)},[L.template,p]);let j=c?-1:r;Vt(()=>{k.current&&uo(k.current,j)},[j]);let N=co(e,y,m);return La(Ta,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:w,template:L.template,maxHeight:L.maxHeight,innerRef:A=>{k.current=A},"data-aia-group":w,children:e.map((A,D)=>La(Aa,{option:A,isHighlighted:D===r,checked:t?t.includes(A.text):void 0,onSelect:o,onHighlight:F=>{Ra(k.current,D,F)&&n(D)},onUnhighlight:l?F=>{Ra(k.current,-1,F)&&l(D)}:void 0,id:`${s}-option-${D}`,loading:c,showIcon:y&&N,showImage:m&&N,showCount:u,scrollHint:!c&&L.scrollHintIndices.includes(D),enterDelayMs:c?0:lo(D,L.cols,e.length,v)},`${w}\0${A.parameter??""}\0${A.text}`))})}import{formatTime as bo,TIME_WHEEL_COLUMNS as wo,TIME_WHEEL_ROW_HEIGHT as vo,timeWheelIndex as Ma,timeWheelIndexFromScroll as xo,timeWheelRows as yo,withTimeWheelIndex as Na}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as ko,useEffect as So,useLayoutEffect as Co,useRef as Ot}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
3738
3762
 
3739
3763
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
3740
3764
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -3856,7 +3880,7 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
3856
3880
  .aia-done-llNY5:hover {
3857
3881
  background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
3858
3882
  }
3859
- `,document.head.appendChild(e)}var xe={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};import{jsx as et,jsxs as Vt}from"react/jsx-runtime";var So=120;function Na({view:e,label:r,doneLabel:t,interactive:o=!0,onTimeChange:n,onTimeCommit:d}){return Vt("div",{className:xe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":r,onMouseDown:s=>s.preventDefault(),children:[et("span",{className:xe.value,"data-aia-time-value":"","aria-live":"polite",children:go(e.minutes)}),Vt("div",{className:xe.columns,"aria-hidden":"true",children:[et("div",{className:xe.band}),fo.map(s=>Vt(xo,{children:[s==="minute"&&et("span",{className:xe.separator,children:":"}),et(Co,{column:s,minutes:e.minutes,interactive:o,onTimeChange:n})]},s))]}),et("button",{type:"button",tabIndex:-1,className:xe.done,"data-aia-time-done":"",onClick:()=>{o&&d()},children:t})]})}function Co({column:e,minutes:r,interactive:t,onTimeChange:o}){let n=Lt(null),d=Lt(null),s=Lt(null),c=Lt({minutes:r,interactive:t,onTimeChange:o});c.current={minutes:r,interactive:t,onTimeChange:o};let f=Da(e,r);ko(()=>{let m=n.current;if(!m||s.current)return;let p=f*bo;Math.abs(m.scrollTop-p)<1||(d.current=p,m.scrollTop=p)},[f]),yo(()=>()=>{s.current&&clearTimeout(s.current)},[]);let x=()=>{s.current=null;let m=n.current,p=c.current;if(!m||!p.interactive)return;let h=wo(e,m.scrollTop);h!==Da(e,p.minutes)&&p.onTimeChange(Ma(e,p.minutes,h))},y=()=>{let m=n.current;if(m){if(d.current!=null&&Math.abs(m.scrollTop-d.current)<1){d.current=null;return}d.current=null,s.current&&clearTimeout(s.current),s.current=setTimeout(x,So)}};return et("div",{ref:n,className:xe.column,"data-aia-time-column":e,onScroll:y,children:vo(e).map((m,p)=>et("div",{className:p===f?`${xe.row} ${xe.selected}`:xe.row,"data-aia-time-row":"","data-aia-index":p,onClick:()=>{c.current.interactive&&o(Ma(e,c.current.minutes,p))},children:m.label},m.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3883
+ `,document.head.appendChild(e)}var ye={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};import{jsx as et,jsxs as Ut}from"react/jsx-runtime";var To=120;function Fa({view:e,label:r,doneLabel:t,interactive:o=!0,onTimeChange:n,onTimeCommit:l}){return Ut("div",{className:ye.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":r,onMouseDown:s=>s.preventDefault(),children:[et("span",{className:ye.value,"data-aia-time-value":"","aria-live":"polite",children:bo(e.minutes)}),Ut("div",{className:ye.columns,"aria-hidden":"true",children:[et("div",{className:ye.band}),wo.map(s=>Ut(ko,{children:[s==="minute"&&et("span",{className:ye.separator,children:":"}),et(Po,{column:s,minutes:e.minutes,interactive:o,onTimeChange:n})]},s))]}),et("button",{type:"button",tabIndex:-1,className:ye.done,"data-aia-time-done":"",onClick:()=>{o&&l()},children:t})]})}function Po({column:e,minutes:r,interactive:t,onTimeChange:o}){let n=Ot(null),l=Ot(null),s=Ot(null),c=Ot({minutes:r,interactive:t,onTimeChange:o});c.current={minutes:r,interactive:t,onTimeChange:o};let w=Ma(e,r);Co(()=>{let m=n.current;if(!m||s.current)return;let u=w*vo;Math.abs(m.scrollTop-u)<1||(l.current=u,m.scrollTop=u)},[w]),So(()=>()=>{s.current&&clearTimeout(s.current)},[]);let v=()=>{s.current=null;let m=n.current,u=c.current;if(!m||!u.interactive)return;let p=xo(e,m.scrollTop);p!==Ma(e,u.minutes)&&u.onTimeChange(Na(e,u.minutes,p))},y=()=>{let m=n.current;if(m){if(l.current!=null&&Math.abs(m.scrollTop-l.current)<1){l.current=null;return}l.current=null,s.current&&clearTimeout(s.current),s.current=setTimeout(v,To)}};return et("div",{ref:n,className:ye.column,"data-aia-time-column":e,onScroll:y,children:yo(e).map((m,u)=>et("div",{className:u===w?`${ye.row} ${ye.selected}`:ye.row,"data-aia-time-row":"","data-aia-index":u,onClick:()=>{c.current.interactive&&o(Na(e,c.current.minutes,u))},children:m.label},m.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3860
3884
  display: flex;
3861
3885
  flex-direction: column;
3862
3886
  gap: var(--aia-stack-space, 0.5rem);
@@ -3871,7 +3895,7 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
3871
3895
  align-items: end;
3872
3896
  }
3873
3897
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
3874
- `,document.head.appendChild(e)}import{jsx as To}from"react/jsx-runtime";function Fa({space:e,align:r="stretch",className:t,children:o,...n}){let d=e?{"--aia-stack-space":e}:void 0;return To("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":r,style:d,...n,children:o})}import{jsx as Z,jsxs as Ut}from"react/jsx-runtime";var Ko=typeof window>"u"?tt:Qt,qo=[159,119,164],_o=()=>{},Ha=()=>{},Vo=e=>{},Uo=()=>{},Qo=e=>{},Yo=e=>{},jo=e=>{},$o=e=>{};function Zo(e){let r=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,o]=Go(r);if(tt(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia("(prefers-color-scheme: dark)"),d=()=>o(n.matches);return n.addEventListener("change",d),()=>n.removeEventListener("change",d)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Xo(e,r){let t=mt(null);tt(()=>{let o=e.current,n=r.current;if(!o||!n)return;let d=Fo(o,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==d&&(t.current.controller.destroy(),t.current=null),d&&!t.current){t.current={grid:d,controller:Po({dropdown:o,grid:d,button:n})};return}t.current?.controller.update()}),tt(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Jo(e,r){let t=mt(r);t.current=r;let o=mt(null);Qt(()=>{let n=e.current;if(n){if(!o.current){o.current=Io({dropdown:n,isOpen:()=>t.current});return}o.current.update()}}),tt(()=>()=>{o.current?.destroy(),o.current=null},[])}function Yt({suggestions:e,activeIndex:r,onSelect:t,onHighlight:o,onUnhighlight:n,isOpen:d,id:s,className:c,pills:f,onPillClick:x,showPills:y=!0,onSkip:m,showSkipButton:p=!0,showOptionIcons:h=!0,showOptionImages:k=!0,showOptionCounts:S=!0,skipDisabled:T=!1,activeSelected:O=!1,isLoading:L=!1,skeletonExiting:Y=!1,isInputEmpty:N=!1,language:A,products:D,onProductSelect:F,onProductAddToCart:W,onProductFocusChange:re,productsLayout:G="row",productImageFallback:P="image",showProductVendor:j=!0,formatType:K="options",dateView:se=null,selectedDateIso:le=null,selectedDateRange:ee=null,dateRangeStart:a=null,dateReferences:v,onPreviousMonth:te,onNextMonth:me,timeView:oe=null,multiSelectView:qe=null,onMultiSelectCommit:Ae,onSeeAllResults:Ee,seeAllBusy:ge=!1,busyProductId:_e=null,fullWidth:Fe=!1,onTimeChange:u,onTimeCommit:Ve,locationView:g=null,isReediting:C=!1,onLocationQuery:E,onLocationMove:R,onLocationCommit:M,onLocationFocusChange:X,isFocused:ke=!1,optionsPosition:ae="below",mode:Se}){let Re=Zo(Se),Ue=Re!==void 0,ie=mt(null),ze=mt(null);Xo(ie,ze),tt(()=>{if(ie.current)return Ao(ie.current)},[]);let fe=e[0]?.options??[],Qe=!!(f&&f.length>0&&x),ce=!!(D&&D.length>0),He=K==="time"&&oe!=null,it=K==="location"&&g!=null,de=d&&(fe.length>0||y&&Qe||L||ce||He||it);Jo(ie,de),Ko(()=>{let I=ie.current;I&&(Lo(I,zo(I)),Bo(I))});let pe={suggestions:e,activeIndex:r,pills:f,showPills:y,showSkipButton:p,showOptionIcons:h,showOptionImages:k,showOptionCounts:S,skipDisabled:T,activeSelected:O,isLoading:L,skeletonExiting:Y,isInputEmpty:N,products:D,formatType:K,dateView:se,selectedDateIso:le,selectedDateRange:ee,dateRangeStart:a,dateReferences:v,timeView:oe,multiSelectView:qe,locationView:g,isReediting:C,showsSeeAll:!!Ee},Be=mt(pe);de&&(Be.current=pe);let i=de?pe:Be.current,B=Wo(A),be=i.suggestions[0],Ce=be?.options??[],Ye=i.activeIndex>=0&&!!Ce[i.activeIndex]?.is_tappable,Te=Mo(i.pills??[],B.keepTyping),Le=!!(Te.length>0&&x),w=i.showPills&&Le,je=i.showPills&&!Le&&i.isLoading,ot=w||je,Oe=Le&&Oo(Te)&&i.showSkipButton&&!i.isInputEmpty&&!!m,b=Te[0]?.text,$e=Do(i.formatType)&&i.dateView!=null,nt=Ce.length>0&&!$e,De=Ce.length>0&&$e&&!i.isLoading,rt=i.formatType==="time"&&i.timeView!=null&&!i.isLoading,st=i.formatType==="location"&&i.locationView!=null&&!i.isLoading,We=i.isLoading&&!nt&&!De&&!rt&&!st,lt=i.products??[],Me=No(w?Te:[]);return Qt(()=>{ie.current&&Ho(ie.current,Me,{visible:de,anchorBottom:ae==="above"})},[Me,de,ae,i.suggestions,i.pills,i.isLoading,i.skeletonExiting,i.isInputEmpty,i.products,i.formatType,i.dateView,i.selectedDateIso,i.selectedDateRange,i.dateRangeStart,i.dateReferences,i.timeView,i.multiSelectView,i.locationView,i.showPills,i.showSkipButton,i.showOptionIcons,i.showOptionImages,i.showOptionCounts,i.showsSeeAll,G,A]),tt(()=>{let I=ie.current;return()=>{I&&Ro(I)}},[]),Ut("div",{ref:ie,id:s,role:"listbox","aria-multiselectable":!!i.multiSelectView,"data-aia-dropdown":"","data-options-position":ae,"data-mode":Re,"data-aia-loading":i.isLoading?"":void 0,"data-aia-skeleton-exiting":i.skeletonExiting?"":void 0,"data-aia-has-products":lt.length>0?"":void 0,"data-aia-full-width":Fe?"":void 0,className:`${Ue?"magicx-aia ":""}${he.dropdown} ${de?he.visible:""} ${c??""}`,onMouseDown:I=>I.preventDefault(),children:[Ut(Fa,{space:"8px",children:[(ot||Oe)&&Ut(kt,{noWrap:!0,className:he.pillBar,"data-aia-pillbar":"",children:[ot&&Z("span",{className:he.pillScroll,"data-aia-pill-scroll":"",children:Z(Et,{pills:Te,activePillIndex:0,activeSelected:i.activeSelected,onSelectPill:x??(()=>{}),rounded:!0,loading:i.isLoading})}),Oe&&Z("button",{type:"button",tabIndex:-1,className:he.skip,"data-aia-skip":"",disabled:i.isLoading||i.skipDisabled,"aria-label":b?`${B.skipLabel} ${b}`:B.skipLabel,onClick:m,children:B.skip})]}),nt&&Z(Oa,{options:Ce,activeIndex:i.activeIndex,onSelect:t,onHighlight:o,onUnhighlight:n,listboxId:s,loading:i.isLoading,groupKey:be?`${be.parameter} ${be.text}`:"",optionsPosition:ae,showIcons:i.showOptionIcons,showImages:i.showOptionImages,showCounts:i.showOptionCounts,picked:i.multiSelectView?.picked}),i.multiSelectView&&Z("div",{"data-aia-multi-actions":"",onClick:I=>{I.target.closest("[data-aia-multi-done]")&&!i.skipDisabled&&!i.isLoading&&Ae?.()},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:he.multiDone,ref:I=>{I&&(I.disabled=!0,I.offsetHeight,I.disabled=i.skipDisabled||i.isLoading)},children:B.done})}),De&&i.dateView&&Z(ha,{options:Ce,activeIndex:i.activeIndex,listboxId:s,view:i.dateView,selection:{selectedIso:i.selectedDateIso??null,selectedRange:i.selectedDateRange??null,rangeStart:i.dateRangeStart??null,floor:Eo(i.formatType,i.dateRangeStart),references:i.dateReferences??[]},onSelect:t,onHighlight:o,onUnhighlight:n,onPreviousMonth:te??Ha,onNextMonth:me??Ha}),rt&&i.timeView&&Z(Na,{view:i.timeView,label:B.timeLabel,doneLabel:B.done,interactive:!i.skipDisabled,onTimeChange:u??Vo,onTimeCommit:Ve??Uo}),st&&i.locationView&&Z(xa,{view:i.locationView,searchLabel:B.locationSearch,noResultsLabel:B.locationNoResults,useTypedLabel:B.locationUseTyped,widgetFocused:ke&&de,reediting:i.isReediting,visible:de,interactive:!i.skipDisabled,onQuery:E??Qo,onMove:R??Yo,onCommit:M??jo,onFocusChange:X??$o}),We&&Z("div",{className:he.skeletonBars,"data-aia-skeleton-bars":"",children:qo.map(I=>Z("span",{className:he.skeletonBar,style:{width:I}},`bar-${I}`))}),Z(Sa,{products:lt,listboxId:s,onSelect:F??_o,busyProductId:_e,onAddToCart:W,onFocusChange:re,focusable:de&&!i.isLoading,loading:i.isLoading,layout:G,imageFallback:P,showVendor:j,strings:B}),i.showsSeeAll&&Z("div",{className:he.seeAllRow,"data-aia-see-all":"",onClick:I=>{I.target.closest("[data-aia-see-all-button]")&&(I.stopPropagation(),!(i.isLoading||ge)&&Ee?.())},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"","data-aia-see-all-state":ge?"busy":void 0,"aria-busy":ge?!0:void 0,className:he.seeAll,ref:I=>{I&&(I.disabled=!0,I.offsetHeight,I.disabled=i.isLoading)},children:B.seeAllResults})}),Z(ga,{isOptionHighlighted:Ye,isInputEmpty:i.isInputEmpty,strings:B})]}),Z("button",{ref:ze,type:"button",tabIndex:-1,className:he.scrollArrow,"data-aia-scroll-arrow":"","aria-label":B.scrollArrow,"aria-hidden":"true",children:Z("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:Z("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Pn,focusEditorFromTap as In,ModeController as An,setCursorOffset as En,uiStringsFor as Rn,watchEditorHeight as zn}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as en}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
3898
+ `,document.head.appendChild(e)}import{jsx as Io}from"react/jsx-runtime";function Ha({space:e,align:r="stretch",className:t,children:o,...n}){let l=e?{"--aia-stack-space":e}:void 0;return Io("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":r,style:l,...n,children:o})}import{jsx as Z,jsxs as Qt}from"react/jsx-runtime";var _o=typeof window>"u"?tt:Yt,Vo=[159,119,164],Uo=()=>{},Ba=()=>{},Qo=e=>{},Yo=()=>{},jo=e=>{},$o=e=>{},Zo=e=>{},Xo=e=>{};function Jo(e){let r=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,o]=qo(r);if(tt(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>o(n.matches);return n.addEventListener("change",l),()=>n.removeEventListener("change",l)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function en(e,r){let t=ut(null);tt(()=>{let o=e.current,n=r.current;if(!o||!n)return;let l=Bo(o,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==l&&(t.current.controller.destroy(),t.current=null),l&&!t.current){t.current={grid:l,controller:Ao({dropdown:o,grid:l,button:n})};return}t.current?.controller.update()}),tt(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function tn(e,r){let t=ut(r);t.current=r;let o=ut(null);Yt(()=>{let n=e.current;if(n){if(!o.current){o.current=Eo({dropdown:n,isOpen:()=>t.current});return}o.current.update()}}),tt(()=>()=>{o.current?.destroy(),o.current=null},[])}function jt({suggestions:e,activeIndex:r,onSelect:t,onHighlight:o,onUnhighlight:n,isOpen:l,id:s,className:c,pills:w,onPillClick:v,showPills:y=!0,onSkip:m,showSkipButton:u=!0,showOptionIcons:p=!0,showOptionImages:k=!0,showOptionCounts:S=!0,skipDisabled:T=!1,activeSelected:O=!1,isLoading:L=!1,skeletonExiting:j=!1,isInputEmpty:N=!1,language:A,products:D,onProductSelect:F,onProductAddToCart:Y,onProductFocusChange:ie,productsLayout:X="row",productImageFallback:W="image",showProductVendor:I=!0,formatType:G="options",dateView:se=null,selectedDateIso:le=null,selectedDateRange:ee=null,dateRangeStart:a=null,dateReferences:x,onPreviousMonth:te,onNextMonth:ae,timeView:ne=null,multiSelectView:Ue=null,onMultiSelectCommit:Ie,onSeeAllResults:Ae,seeAllBusy:fe=!1,busyProductId:Qe=null,fullWidth:Ne=!1,onTimeChange:h,onTimeCommit:Ye,locationView:Ee=null,isReediting:Fe=!1,onLocationQuery:f,onLocationMove:C,onLocationCommit:E,onLocationFocusChange:z,isFocused:M=!1,optionsPosition:K="below",mode:pe}){let de=Jo(pe),Re=de!==void 0,oe=ut(null),ze=ut(null);en(oe,ze),tt(()=>{if(oe.current)return Ro(oe.current)},[]);let be=e[0]?.options??[],je=!!(w&&w.length>0&&v),he=!!(D&&D.length>0),He=G==="time"&&ne!=null,it=G==="location"&&Ee!=null,ce=l&&(be.length>0||y&&je||L||he||He||it);tn(oe,ce),_o(()=>{let P=oe.current;P&&(Do(P,Oo(P)),Go(P))});let ue={suggestions:e,activeIndex:r,pills:w,showPills:y,showSkipButton:u,showOptionIcons:p,showOptionImages:k,showOptionCounts:S,skipDisabled:T,activeSelected:O,isLoading:L,skeletonExiting:j,isInputEmpty:N,products:D,formatType:G,dateView:se,selectedDateIso:le,selectedDateRange:ee,dateRangeStart:a,dateReferences:x,timeView:ne,multiSelectView:Ue,locationView:Ee,isReediting:Fe,showsSeeAll:!!Ae},Be=ut(ue);ce&&(Be.current=ue);let i=ce?ue:Be.current,B=Ko(A),we=i.suggestions[0],Se=we?.options??[],$e=i.activeIndex>=0&&!!Se[i.activeIndex]?.is_tappable,Ce=Fo(i.pills??[],B.keepTyping),Le=!!(Ce.length>0&&v),b=i.showPills&&Le,ot=i.showPills&&!Le&&i.isLoading,We=b||ot,Ge=Le&&Mo(Ce)&&i.showSkipButton&&!i.isInputEmpty&&!!m,g=Ce[0]?.text,Ke=No(i.formatType)&&i.dateView!=null,nt=Se.length>0&&!Ke,Oe=Se.length>0&&Ke&&!i.isLoading,rt=i.formatType==="time"&&i.timeView!=null&&!i.isLoading,st=i.formatType==="location"&&i.locationView!=null&&!i.isLoading,qe=i.isLoading&&!nt&&!Oe&&!rt&&!st,lt=i.products??[],De=Ho(b?Ce:[]);return Yt(()=>{oe.current&&Wo(oe.current,De,{visible:ce,anchorBottom:K==="above"})},[De,ce,K,i.suggestions,i.pills,i.isLoading,i.skeletonExiting,i.isInputEmpty,i.products,i.formatType,i.dateView,i.selectedDateIso,i.selectedDateRange,i.dateRangeStart,i.dateReferences,i.timeView,i.multiSelectView,i.locationView,i.showPills,i.showSkipButton,i.showOptionIcons,i.showOptionImages,i.showOptionCounts,i.showsSeeAll,X,A]),tt(()=>{let P=oe.current;return()=>{P&&Lo(P)}},[]),Qt("div",{ref:oe,id:s,role:"listbox","aria-multiselectable":!!i.multiSelectView,"data-aia-dropdown":"","data-options-position":K,"data-mode":de,"data-aia-loading":i.isLoading?"":void 0,"data-aia-skeleton-exiting":i.skeletonExiting?"":void 0,"data-aia-has-products":lt.length>0?"":void 0,"data-aia-full-width":Ne?"":void 0,className:`${Re?"magicx-aia ":""}${me.dropdown} ${ce?me.visible:""} ${c??""}`,onMouseDown:P=>P.preventDefault(),children:[Qt(Ha,{space:"8px",children:[(We||Ge)&&Qt(xt,{noWrap:!0,className:me.pillBar,"data-aia-pillbar":"",children:[We&&Z("span",{className:me.pillScroll,"data-aia-pill-scroll":"",children:Z(Rt,{pills:Ce,activePillIndex:0,activeSelected:i.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:i.isLoading})}),Ge&&Z("button",{type:"button",tabIndex:-1,className:me.skip,"data-aia-skip":"",disabled:i.isLoading||i.skipDisabled,"aria-label":g?`${B.skipLabel} ${g}`:B.skipLabel,onClick:m,children:B.skip})]}),nt&&Z(Da,{options:Se,activeIndex:i.activeIndex,onSelect:t,onHighlight:o,onUnhighlight:n,listboxId:s,loading:i.isLoading,groupKey:we?`${we.parameter} ${we.text}`:"",optionsPosition:K,showIcons:i.showOptionIcons,showImages:i.showOptionImages,showCounts:i.showOptionCounts,picked:i.multiSelectView?.picked}),i.multiSelectView&&Z("div",{"data-aia-multi-actions":"",onClick:P=>{P.target.closest("[data-aia-multi-done]")&&!i.skipDisabled&&!i.isLoading&&Ie?.()},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:me.multiDone,ref:P=>{P&&(P.disabled=!0,P.offsetHeight,P.disabled=i.skipDisabled||i.isLoading)},children:B.done})}),Oe&&i.dateView&&Z(ua,{options:Se,activeIndex:i.activeIndex,listboxId:s,view:i.dateView,selection:{selectedIso:i.selectedDateIso??null,selectedRange:i.selectedDateRange??null,rangeStart:i.dateRangeStart??null,floor:zo(i.formatType,i.dateRangeStart),references:i.dateReferences??[]},onSelect:t,onHighlight:o,onUnhighlight:n,onPreviousMonth:te??Ba,onNextMonth:ae??Ba}),rt&&i.timeView&&Z(Fa,{view:i.timeView,label:B.timeLabel,doneLabel:B.done,interactive:!i.skipDisabled,onTimeChange:h??Qo,onTimeCommit:Ye??Yo}),st&&i.locationView&&Z(ya,{view:i.locationView,searchLabel:B.locationSearch,noResultsLabel:B.locationNoResults,useTypedLabel:B.locationUseTyped,widgetFocused:M&&ce,reediting:i.isReediting,visible:ce,interactive:!i.skipDisabled,onQuery:f??jo,onMove:C??$o,onCommit:E??Zo,onFocusChange:z??Xo}),qe&&Z("div",{className:me.skeletonBars,"data-aia-skeleton-bars":"",children:Vo.map(P=>Z("span",{className:me.skeletonBar,style:{width:P}},`bar-${P}`))}),Z(Ca,{products:lt,listboxId:s,onSelect:F??Uo,busyProductId:Qe,onAddToCart:Y,onFocusChange:ie,focusable:ce&&!i.isLoading,loading:i.isLoading,layout:X,imageFallback:W,showVendor:I,strings:B}),i.showsSeeAll&&Z("div",{className:me.seeAllRow,"data-aia-see-all":"",onClick:P=>{P.target.closest("[data-aia-see-all-button]")&&(P.stopPropagation(),!(i.isLoading||fe)&&Ae?.())},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"","data-aia-see-all-state":fe?"busy":void 0,"aria-busy":fe?!0:void 0,className:me.seeAll,ref:P=>{P&&(P.disabled=!0,P.offsetHeight,P.disabled=i.isLoading)},children:B.seeAllResults})}),Z(fa,{isOptionHighlighted:$e,isInputEmpty:i.isInputEmpty,strings:B})]}),Z("button",{ref:ze,type:"button",tabIndex:-1,className:me.scrollArrow,"data-aia-scroll-arrow":"","aria-label":B.scrollArrow,"aria-hidden":"true",children:Z("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:Z("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as En,focusEditorFromTap as Rn,ModeController as zn,setCursorOffset as Ln,uiStringsFor as On,watchEditorHeight as Dn}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as an}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
3875
3899
  flex-shrink: 0;
3876
3900
  width: 32px;
3877
3901
  height: 32px;
@@ -3975,5 +3999,5 @@ import{buildSubmitResult as Bs,cellDay as Ws,cellIso as Gs,DATE_RANGE_META_END a
3975
3999
  transition: none;
3976
4000
  }
3977
4001
  }
3978
- `,document.head.appendChild(e)}var Ba={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};import{jsx as jt}from"react/jsx-runtime";function Wa({disabled:e,ready:r,busy:t=!1,onClick:o,label:n=en().submit}){return jt("button",{type:"button","data-aia-submit":"",className:Ba.submitButton,disabled:e,"data-aia-ready":r?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:d=>{d.stopPropagation(),o()},"aria-label":n,children:jt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":n,children:jt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as tn,dateSelectionFor as an,dropdownPillsFor as on,editingSuggestion as nn,HANDOFF_NOT_HANDLED as rn,identifiedParamLabel as sn,withoutTraditionalAutocomplete as ln}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Va,useEffect as Ke,useMemo as dn,useRef as _,useState as cn}from"react";import{useRef as Ga}from"react";function Ka(e){let r=Ga(e);r.current=e;let t=Object.keys(e??{}).sort().join("\0"),o=Ga({key:"",overrides:void 0});if(o.current.key!==t){let n={};for(let d of Object.keys(e??{})){let s=(c,f,x)=>{let y=r.current?.[d];return y?y(c,f,x):[]};n[d]=s}o.current={key:t,overrides:e?n:void 0}}return{overrides:o.current.overrides,key:t}}import{useRef as qa}from"react";function _a(e){let r=qa(e);r.current=e;let t=qa(null);t.current===null&&(t.current={fetch:(n,d)=>{let s=r.current;return s?s.fetch(n,d):Promise.reject(new Error("products config removed"))},transform:n=>r.current?.transform(n)??[],get limit(){return r.current?.limit}});let o=e!==void 0;return{config:o?t.current:void 0,enabled:o}}var pn={query:"",raw_query:"",completed_params:[],identified_params:[],is_ready:!1},Ua={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,highlightByPointer:!1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,isSubmitting:!1,selectingProductId:null,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function $t({onSubmit:e,onResult:r,onError:t,optionOverrides:o,maskCompletedText:n,apiConfig:d,additionalContext:s,language:c,currency:f,productId:x,visitorId:y,analyticsConsent:m,columns:p=2,dropdownTrigger:h,optionsPosition:k,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:O,prependPlaceholder:L,allOption:Y,showNonTappableOptions:N,locationSearch:A,showOptionIcons:D,showOptionImages:F,showOptionCounts:W,showSkipButton:re,showProducts:G,submitProgress:P,awaitAnswerOnSubmit:j,submitAnswerTimeoutMs:K,productImageFallback:se="image",showProductVendor:le=!0,onFocus:ee,onBlur:a,value:v,completedParams:te,onChange:me,onParamsChange:oe,products:qe,mapProducts:Ae,onProductSelect:Ee,onProductAddToCart:ge,source:_e,setCursor:Fe}){let u=_(null),[Ve,g]=cn(null),C=_(e);C.current=e;let E=_(r);E.current=r;let R=_(t);R.current=t;let M=_(me);M.current=me;let X=_(oe);X.current=oe;let ke=_(ee);ke.current=ee;let ae=_(a);ae.current=a;let Se=_(Fe);Se.current=Fe;let Re=_(Ee);Re.current=Ee;let Ue=_(ge);Ue.current=ge;let ie=_(y);ie.current=y;let ze=_(()=>{let l=ie.current;return typeof l=="function"?l():l}).current,fe=y!==void 0,Qe=_(m);Qe.current=m;let ce=_(()=>{let l=Qe.current;return typeof l=="function"?l():l}).current,He=_a(qe),it=_(Ae);it.current=Ae;let de=_((l,V)=>{let H=it.current;return H?H(l,V):l}).current,pe=Ae?de:void 0,Be=Ka(o);Ke(()=>{if(typeof document>"u")return;let l=new tn(document.createElement("div"),{renderMode:"headless",apiConfig:d,additionalContext:s,language:c,currency:f,productId:x,visitorId:fe?ze:void 0,analyticsConsent:ce,optionOverrides:Be.overrides,maskCompletedText:n,columns:p,dropdownTrigger:h,optionsPosition:k,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:O,prependPlaceholder:L,allOption:Y,showNonTappableOptions:N,locationSearch:A,showProducts:G,submitProgress:P,awaitAnswerOnSubmit:j,submitAnswerTimeoutMs:K,source:_e,value:v,completedParams:te,onSubmit:(...H)=>C.current?.(...H),onResult:(...H)=>E.current?.(...H),onError:(...H)=>R.current?.(...H),onChange:(...H)=>M.current?.(...H),onParamsChange:(...H)=>X.current?.(...H),onFocus:()=>ke.current?.(),onBlur:()=>ae.current?.(),onProductSelect:H=>Re.current?Re.current(H):rn,onProductAddToCart:H=>Ue.current?.(H),setCursor:H=>Se.current?.(H),products:He.config,mapProducts:pe});u.current=l,g(l.getState());let V=l.subscribe(H=>g(H));return()=>{V(),l.destroy(),u.current===l&&(u.current=null)}},[]);let i=_(fe);Ke(()=>{i.current!==fe&&(i.current=fe,u.current?.update({visitorId:fe?ze:void 0,analyticsConsent:ce}))},[fe,ze,ce]);let B=typeof m=="function"?"function":m,be=_(B);Ke(()=>{be.current!==B&&(be.current=B,u.current?.refreshAnalyticsConsent())},[B]),Ke(()=>{v!==void 0&&u.current?.setValue(v)},[v]),Ke(()=>{te!==void 0&&u.current?.setCompletedParams(te)},[te]);let Ce=JSON.stringify(d??null),Ye;try{Ye=JSON.stringify(s??null)}catch{Ye="[unstringifiable]"}Ke(()=>{u.current?.update({apiConfig:d,additionalContext:s,language:c,currency:f,productId:x,optionOverrides:Be.overrides,dropdownTrigger:h,optionsPosition:k,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:O,prependPlaceholder:L,allOption:Y,showNonTappableOptions:N,locationSearch:A,showProducts:G,submitProgress:P,awaitAnswerOnSubmit:j,submitAnswerTimeoutMs:K})},[Ce,Ye,c,f?.code,f?.rate,f?.country,x,Be.key,h,k,S,T,O,L,Y,N,A,G,P,j,K]);let Te=_(!1);Ke(()=>{if(!Te.current){Te.current=!0;return}u.current?.update({products:He.config})},[He.enabled]),Ke(()=>{u.current?.update({mapProducts:pe})},[pe]);let Le=_(null);Le.current===null&&(Le.current={handleTextChange:l=>u.current?.handleTextChange(l),handleCompositionText:l=>u.current?.handleCompositionText(l),handleKeyDown:l=>{let V="nativeEvent"in l?l.nativeEvent:l;u.current?.handleKeyDown(V)},setFocused:l=>u.current?.setFocused(l),startEditingParam:l=>u.current?.startEditingParam(l),removeParam:l=>u.current?.removeParam(l)??!1,exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:l=>u.current?.handleCaretAfterInput(l),handleCaretMove:l=>u.current?.handleCaretMove(l),replaceEditingRange:l=>u.current?.replaceEditingRange(l)??!1,setActivePill:l=>u.current?.setActivePill(l),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),refreshProducts:()=>u.current?.refreshProducts(),prepareSubmit:()=>u.current?.prepareSubmit(),getState:()=>u.current?.getState()??Ua,getResult:()=>u.current?.getResult()??pn,awaitSubmitResult:()=>u.current?.awaitSubmitResult()??Promise.resolve(null),recordSubmit:l=>u.current?.recordSubmit(l),holdSubmit:l=>u.current?.holdSubmit(l),endSubmitProgress:()=>u.current?.endSubmitProgress(),getSearchId:()=>u.current?.getSearchId(),getVisitorId:()=>u.current?.getVisitorId(),refreshAnalyticsConsent:()=>u.current?.refreshAnalyticsConsent(),selectOption:(l,V)=>u.current?.selectOption(l,V),selectProduct:l=>u.current?.selectProduct(l),addProductToCart:l=>{let V=u.current;return!V||!Ue.current?Promise.resolve():V.addProductToCart(l)},setActiveDropdownIndex:l=>u.current?.setActiveDropdownIndex(l),clearHighlight:l=>u.current?.clearHighlight(l),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),setTime:l=>u.current?.setTime(l),commitTime:()=>u.current?.commitTime(),toggleMultiSelectOption:l=>u.current?.toggleMultiSelectOption(l),commitMultiSelect:()=>u.current?.commitMultiSelect(),setLocationQuery:l=>u.current?.setLocationQuery(l),moveLocationHighlight:l=>u.current?.moveLocationHighlight(l),commitLocation:l=>u.current?.commitLocation(l),setLocationFieldFocused:l=>u.current?.setLocationFieldFocused(l),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let w=Le.current,je=Va(l=>{let V=l.target.value,ct=V.length>0&&!l.nativeEvent?.isComposing&&V[0]!==V[0].toUpperCase()?V[0].toUpperCase()+V.slice(1):V;u.current?.handleTextChange(ct)},[]),ot=Va(l=>{u.current?.handleKeyDown(l.nativeEvent)},[]),Oe=u.current,b=Ve??Ua,$e=v!==void 0?v:b.text,nt=te!==void 0?te:b.completedParams,De=b.actionableSuggestions,rt=De[0],st=dn(()=>ln(De),[De]),We=Oe?.listboxId??"",lt=b.activeDropdownIndex>=0&&Oe?`${We}-option-${b.activeDropdownIndex}`:void 0,Me=b.editingParam,I=b.editingIdentified,Tt=Me?nn(Me):I?{parameter:I.parameter,text:sn(I.parameter),required:!0,options:[]}:null,Pt=b.dropdownSuggestion??Tt??rt,Mt=on(b.dropdownSuggestion,Tt,De),dt=an(b),wt=!Oe||b.dropdownLoading;return{completedParams:nt,multiSelectView:b.multiSelectView,toggleMultiSelectOption:w.toggleMultiSelectOption,commitMultiSelect:w.commitMultiSelect,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:st,setActivePill:w.setActivePill,skipActivePill:w.skipActivePill,removeLastParam:w.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:w.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:wt,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:We,error:b.error,products:b.products,customFields:b.customFields,selectProduct:w.selectProduct,addProductToCart:w.addProductToCart,handleTextChange:w.handleTextChange,handleCompositionText:w.handleCompositionText,handleKeyDown:w.handleKeyDown,setFocused:w.setFocused,editingParam:Me,editingIdentified:I,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:w.startEditingParam,removeParam:w.removeParam,exitEditMode:w.exitEditMode,handleCaretAfterInput:w.handleCaretAfterInput,handleCaretMove:w.handleCaretMove,replaceEditingRange:w.replaceEditingRange,inputProps:{value:$e,placeholder:b.placeholderText||void 0,onChange:je,onKeyDown:ot,onFocus:w.handleFocus,onBlur:w.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":lt,"aria-autocomplete":"list","aria-controls":We},reset:w.reset,refreshProducts:w.refreshProducts,prepareSubmit:w.prepareSubmit,getState:w.getState,getResult:w.getResult,awaitSubmitResult:w.awaitSubmitResult,recordSubmit:w.recordSubmit,holdSubmit:w.holdSubmit,endSubmitProgress:w.endSubmitProgress,getSearchId:w.getSearchId,getVisitorId:w.getVisitorId,refreshAnalyticsConsent:w.refreshAnalyticsConsent,isSubmitting:b.isSubmitting,selectingProductId:b.selectingProductId,dropdownProps:{suggestions:Pt?[{...Pt,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:w.selectOption,onHighlight:w.setActiveDropdownIndex,onUnhighlight:w.clearHighlight,isOpen:b.isDropdownOpen,id:We,pills:Mt,activeSelected:b.isActivePillSelected,onPillClick:w.setActivePill,onSkip:w.skipActivePill,showSkipButton:(re??!0)&&!Me&&!I,showOptionIcons:D??!0,showOptionImages:F??!0,showOptionCounts:W??!0,skipDisabled:b.inSelectionAnimation,isLoading:wt,skeletonExiting:b.skeletonExiting,isInputEmpty:$e.trim().length===0,language:c,products:b.products,productImageFallback:se,showProductVendor:le,onProductSelect:w.selectProduct,busyProductId:b.selectingProductId,seeAllBusy:b.isSubmitting,onProductAddToCart:ge?w.addProductToCart:void 0,onProductFocusChange:w.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:dt.selectedIso,selectedDateRange:dt.selectedRange,dateRangeStart:dt.rangeStart,dateReferences:dt.references,onPreviousMonth:w.showPreviousMonth,onNextMonth:w.showNextMonth,timeView:b.timeView,multiSelectView:b.dropdownMultiSelect,onMultiSelectCommit:w.commitMultiSelect,onTimeChange:w.setTime,onTimeCommit:w.commitTime,locationView:b.locationView,isReediting:b.editingParam!=null,onLocationQuery:w.setLocationQuery,onLocationMove:w.moveLocationHighlight,onLocationCommit:w.commitLocation,onLocationFocusChange:w.setLocationFieldFocused,isFocused:b.isFocused||b.locationFieldFocused,optionsPosition:k??"below"}}}import{attachChipRemove as hn,cancelStartingHint as un,chipIdFromTap as mn,extractPlainText as Qa,focusesInputOnSelect as gn,getCursorOffset as Ya,keepCaretOnChip as fn,plainTextLength as bn,renderEditableContent as wn,setCursorOffset as vn,settlePickFocus as xn,startingHintOptions as yn}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ye,useEffect as gt,useLayoutEffect as Zt,useRef as at}from"react";var Ot;function kn(){if(Ot!==void 0)return Ot;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ot=e.contentEditable==="plaintext-only",Ot}function ja(e){let{segments:r,showChipIcons:t=!0,showChipImages:o=!0,showChipRemove:n=!1,focusInputOnSelect:d,removeParam:s,newParamId:c,editingParam:f,editingIdentified:x,editingAnchor:y,caretOffset:m,placeholderText:p,hintSuggestions:h,isFocused:k,isDropdownOpen:S,listboxId:T,activeDescendantId:O,autoFocus:L,handleTextChange:Y,handleCompositionText:N,handleKeyDown:A,handleCaretAfterInput:D,handleCaretMove:F,startEditingParam:W,replaceEditingRange:re,setFocused:G}=e,P=at(null),j=at(!1),K=at(""),se=at(""),le=at(null),ee=at(0);le.current=m;let a=at(d);a.current=d,gt(()=>{if(!L)return;let g=P.current;if(!g)return;document.activeElement===g?G(!0):g.focus();let C=g.ownerDocument??document,E=C.getSelection(),R=E&&E.rangeCount>0&&g.contains(E.anchorNode);if(E&&!R){let M=C.createRange();M.selectNodeContents(g),M.collapse(!0),E.removeAllRanges(),E.addRange(M)}},[L,G]),gt(()=>{let g=P.current;if(!g)return;let C=g.ownerDocument??document,E=()=>{let R=C.getSelection();if(!R||R.rangeCount===0||!R.anchorNode||!g.contains(R.anchorNode))return;let M=R.anchorNode,X=M.nodeType===Node.ELEMENT_NODE?M:M.parentElement,ae=(R.isCollapsed?X?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Se=f?.id??x?.id??null;if(ae&&ae!==Se){W(ae);return}performance.now()-ee.current<50||F(Ya(g))};return C.addEventListener("selectionchange",E),()=>C.removeEventListener("selectionchange",E)},[f,x,W,F]),gt(()=>{let g=P.current;if(!g)return;let C=E=>{let R=mn(g,E.target);R&&(W(R),fn(g,R))};return g.addEventListener("click",C),()=>g.removeEventListener("click",C)},[W]),gt(()=>{let g=P.current;if(!(!g||!s||!n))return hn(g,s)},[s,n]),Zt(()=>{let g=P.current;g&&wn({input:g,segments:r,newParamId:c,editingParamId:f?.id??null,placeholderText:p??"",isFocused:k,showChipIcons:t,showChipImages:o,showChipRemove:n,hintOptions:yn(h??[])})},[r,c,f,p,h,k,t,o,n]),gt(()=>{let g=P.current;return()=>{g&&un(g)}},[]),Zt(()=>{let g=K.current,C=c??"";if(K.current=C,!C||C===g)return;let E=P.current;if(!E)return;let R=le.current??bn(E);xn(E,R,gn(a.current))},[c]),Zt(()=>{let g=se.current,C=f?.id??"";if(se.current=C,!C||C===g||y==null)return;let E=P.current;E&&vn(E,y)},[f,y]);let v=ye(()=>{let g=P.current;if(!g)return;let C=Qa(g),R=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;if(j.current){N(R);return}Y(R)},[Y,N]),te=ye(()=>{ee.current=performance.now(),v();let g=P.current;g&&D(Ya(g))},[v,D]);gt(()=>{let g=P.current;if(!g)return;let C=E=>{let R=E,M=R.inputType;if(M==="insertParagraph"||M==="insertLineBreak"||M==="insertFromDrop"){E.preventDefault();return}if(M.startsWith("insert")||M.startsWith("delete")){let X=M.startsWith("delete")?"":R.data??"";re(X)&&E.preventDefault()}};return g.addEventListener("beforeinput",C),()=>g.removeEventListener("beforeinput",C)},[re]);let me=ye(()=>{j.current=!0,P.current?.setAttribute("data-aia-composing","true")},[]),oe=ye(()=>{j.current=!1,P.current?.removeAttribute("data-aia-composing"),v()},[v]),qe=ye(g=>{g.preventDefault();let C=P.current;if(!C)return;let E=(g.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!E)return;let R=C.ownerDocument??document,M=R.getSelection();if(!M||M.rangeCount===0)return;let X=M.getRangeAt(0);if(!C.contains(X.startContainer))return;X.deleteContents();let ke=R.createTextNode(E);X.insertNode(ke),X.setStartAfter(ke),X.collapse(!0),M.removeAllRanges(),M.addRange(X),v()},[v]),Ae=ye(g=>A(g),[A]),Ee=ye(()=>G(!0),[G]),ge=ye(()=>G(!1),[G]),_e=ye(()=>P.current?.focus(),[]),Fe=ye(()=>P.current?.blur(),[]),u=ye(()=>{let g=P.current;return g?Qa(g):""},[]),Ve=kn()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:Ve,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":T,"aria-expanded":S,"aria-activedescendant":O,spellCheck:!0,enterKeyHint:"send",onInput:te,onKeyDown:Ae,onCompositionStart:me,onCompositionEnd:oe,onPaste:qe,onFocus:Ee,onBlur:ge},getPlainText:u,focus:_e,blur:Fe}}import{jsx as bt,jsxs as Jt}from"react/jsx-runtime";function Ln(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var On=Sn(function({onSubmit:r,onResult:t,onError:o,optionOverrides:n,maskCompletedText:d,className:s,apiConfig:c,additionalContext:f,language:x,currency:y,productId:m,visitorId:p,analyticsConsent:h,columns:k,pillPlacement:S="dropdown",mode:T="auto",optionsPosition:O="below",animations:L=!0,optionsStyle:Y="floating",dropdownTrigger:N,closeDropdownOnBlur:A,focusInputOnSelect:D,startingState:F,prependPlaceholder:W,allOption:re,showNonTappableOptions:G,locationSearch:P,showOptionIcons:j=!0,showChipIcons:K=!0,showChipImages:se=!0,showChipRemove:le=!1,showOptionImages:ee=!0,showOptionCounts:a=!0,showSkipButton:v,showProducts:te,submitProgress:me,awaitAnswerOnSubmit:oe,submitAnswerTimeoutMs:qe,productsLayout:Ae,productImageFallback:Ee,showProductVendor:ge,autoFocus:_e=!0,onFocus:Fe,onBlur:u,value:Ve,completedParams:g,onChange:C,onParamsChange:E,products:R,mapProducts:M,onProductSelect:X,onProductAddToCart:ke,submitButton:ae,resetOnSubmit:Se=!0,seeAllResults:Re=!1},Ue){let ie=ft(null),ze=ft(null),fe=ft(null),Qe=ft(()=>{}),ce=ft(null),He=ft(null);Xt(()=>{let z=ie.current;if(z)return ce.current?ce.current.setMode(T):ce.current=new An(z,T),()=>{ce.current?.destroy(),ce.current=null}},[T]);let it=Dt(z=>{let we=He.current?.current;we&&(we.focus(),En(we,z))},[]),{completedParams:de,suggestionPills:pe,setActivePill:Be,skipActivePill:i,segments:B,newParamId:be,clearNewParamId:Ce,placeholderText:Ye,isFocused:Te,isDropdownOpen:Le,isActivePillSelected:w,isLoading:je,isReady:ot,activeIndex:Oe,listboxId:b,handleTextChange:$e,handleCompositionText:nt,handleKeyDown:De,setFocused:rt,editingParam:st,editingIdentified:We,editingAnchor:lt,caretOffset:Me,startEditingParam:I,removeParam:Tt,handleCaretAfterInput:Pt,handleCaretMove:Mt,replaceEditingRange:dt,dropdownProps:wt,reset:l,refreshProducts:V,prepareSubmit:H,getState:ct,getResult:ea,awaitSubmitResult:ta,recordSubmit:aa,holdSubmit:ia,endSubmitProgress:oa,getSearchId:na,getVisitorId:ra,refreshAnalyticsConsent:sa,isSubmitting:Nt}=$t({onSubmit:z=>Qe.current(z),onResult:t,onError:o,optionOverrides:n,maskCompletedText:d,apiConfig:c,additionalContext:f,language:x,currency:y,productId:m,visitorId:p,analyticsConsent:h,columns:k,dropdownTrigger:N,optionsPosition:O,closeDropdownOnBlur:A,focusInputOnSelect:D,startingState:F,prependPlaceholder:W,allOption:re,showNonTappableOptions:G,locationSearch:P,showOptionIcons:j,showOptionImages:ee,showOptionCounts:a,showSkipButton:v,showProducts:te,submitProgress:me,awaitAnswerOnSubmit:oe,submitAnswerTimeoutMs:qe,onFocus:Fe,onBlur:u,value:Ve,completedParams:g,onChange:C,onParamsChange:E,products:R,mapProducts:M,onProductSelect:X,onProductAddToCart:ke,source:"full-sdk",setCursor:it});Xt(()=>{if(!be)return;let z=window.setTimeout(()=>Ce(),650);return()=>window.clearTimeout(z)},[be,Ce]);let $a=Oe>=0?`${b}-option-${Oe}`:void 0,{inputRef:pt,editorProps:Za,focus:la,blur:da,getPlainText:ca}=ja({segments:B,newParamId:be,editingParam:st,editingIdentified:We,editingAnchor:lt,caretOffset:Me,placeholderText:Ye,hintSuggestions:S==="inline"?[]:pe,isFocused:Te,showChipIcons:K,showChipImages:se,showChipRemove:le,removeParam:Tt,focusInputOnSelect:D,isDropdownOpen:Le,listboxId:b,activeDescendantId:$a,autoFocus:_e,handleTextChange:$e,handleCompositionText:nt,handleKeyDown:De,handleCaretAfterInput:Pt,handleCaretMove:Mt,startEditingParam:I,replaceEditingRange:dt,setFocused:rt});He.current=pt,Tn(()=>{let z=ze.current,we=pt.current;if(!z||!we)return;let Xe=()=>{let xt=z.firstElementChild;if(!xt)return;let ii=xt.getBoundingClientRect(),oi=we.getBoundingClientRect();ii.top>=oi.bottom-2?z.setAttribute("data-aia-pill-wrapped",""):z.removeAttribute("data-aia-pill-wrapped")};Xe();let vt=new ResizeObserver(Xe);return vt.observe(we),()=>vt.disconnect()},[B,pe.length,je,pt]),Xt(()=>{let z=fe.current;if(z)return zn(z)},[]),Cn(Ue,()=>({focus:la,blur:da,reset:l,refreshProducts:V,setMode:z=>ce.current?.setMode(z),skipActivePill:i,endSubmitProgress:oa,getSearchId:na,getVisitorId:ra,refreshAnalyticsConsent:sa}),[la,da,l,V,i,oa,na,ra,sa]);let Ze=!!B.length||de.length>0,It=Dt((z,we)=>{let Xe=ct(),vt=Pn(ca(),Xe.completedParams,Xe.skippedParams,{identifiedParams:Xe.identifiedParams,isReady:Xe.isReady,customFields:we.custom_fields??null,customFieldsStale:we.custom_fields_stale===!0});z&&aa(vt);let xt=r(vt);return z&&!Se&&ia(xt),Se&&l(),xt},[aa,ia,Se,ct,r,l,ca]),Ft=Dt(()=>{if(Ze&&!ct().isSubmitting){if(oe){ta().then(z=>{z&&It(!0,z)});return}H(),It(!0,ea())}},[Ze,ct,oe,ta,H,ea,It]);Qe.current=z=>Ze?It(!1,z):void 0;let Xa=Re&&!wt.isInputEmpty&&Ze,Ja=Ft,ei=Dt(z=>{z.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||pt.current&&In(pt.current)},[pt]),ti=S==="inline",ai=S==="dropdown";return Jt("div",{ref:ie,className:`magicx-aia ${Je.container} ${s??""}`,"data-pill-placement":S,"data-options-position":O,"data-animations":L?"on":"off","data-aia-options-style":Y,"data-mode":Ln(T),children:[bt(Yt,{...wt,showPills:ai,productsLayout:Ae,productImageFallback:Ee,showProductVendor:ge,onSeeAllResults:Xa?Ja:void 0,fullWidth:Re}),Jt("div",{className:Je.inputWrapper,"data-aia-input-wrapper":"",onClick:ei,children:[Jt("div",{ref:fe,className:Je.editorArea,"data-aia-editor":"",children:[bt("div",{...Za,className:Je.input,"data-aia-input":""}),ti&&(je||pe.length>0)&&bt("span",{ref:ze,className:Je.pillListContainer,"data-aia-pill-list-container":"",children:bt(Et,{pills:pe,activePillIndex:0,activeSelected:w,onSelectPill:Be,loading:je})})]}),ae===null?null:ae===void 0?bt(Wa,{disabled:!Ze,ready:Ze&&ot,busy:Nt,onClick:Ft,label:Rn(x).submit}):bt("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Nt?"busy":void 0,"aria-busy":Nt?!0:void 0,className:Je.submitSlot,onClick:z=>{Ze&&(z.stopPropagation(),Ft())},children:ae})]})]})});export{On as AIAutocomplete,Yt as AIAutocompleteDropdown,Ks as DATE_RANGE_META_END,qs as DATE_RANGE_META_START,_s as DEFAULT_OPTION_COUNT_UNIT,el as LOCATION_META_KEY,ll as PRODUCT_PATH_PREFIX,wl as TIME_META_KEY,xl as WEEKDAY_LABELS,Bs as buildSubmitResult,Ws as cellDay,Gs as cellIso,Vs as dateCellMarks,Us as focusesInputOnSelect,Qs as formatDate,Ys as formatDateRange,js as formatOptionCount,$s as formatPlace,Zs as formatTime,Js as isTouchPrimary,Xs as isoDate,tl as monthLabel,al as optionCountLabel,il as optionHasImage,ol as optionImageSources,nl as optionImageSrc,rl as optionLabel,sl as optionsShowLeadingVisuals,dl as parseDate,cl as parseLooseDate,pl as parseLooseDateRange,hl as parseTime,ul as productFromMatchedItem,ml as productImageSources,gl as productsFromCustomFields,fl as sanitizeOptionIconSvg,bl as selectedRangeFor,$t as useAIAutocomplete,vl as visibleDateRange,yl as withSkippedParams};
4002
+ `,document.head.appendChild(e)}var Wa={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};import{jsx as $t}from"react/jsx-runtime";function Ga({disabled:e,ready:r,busy:t=!1,onClick:o,label:n=an().submit}){return $t("button",{type:"button","data-aia-submit":"",className:Wa.submitButton,disabled:e,"data-aia-ready":r?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:l=>{l.stopPropagation(),o()},"aria-label":n,children:$t("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":n,children:$t("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as on,dateSelectionFor as nn,dropdownPillsFor as rn,editingSuggestion as sn,HANDOFF_NOT_HANDLED as ln,identifiedParamLabel as dn,withoutTraditionalAutocomplete as cn}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Ua,useEffect as Ve,useMemo as pn,useRef as V,useState as hn}from"react";import{useRef as Ka}from"react";function qa(e){let r=Ka(e);r.current=e;let t=Object.keys(e??{}).sort().join("\0"),o=Ka({key:"",overrides:void 0});if(o.current.key!==t){let n={};for(let l of Object.keys(e??{})){let s=(c,w,v)=>{let y=r.current?.[l];return y?y(c,w,v):[]};n[l]=s}o.current={key:t,overrides:e?n:void 0}}return{overrides:o.current.overrides,key:t}}import{useRef as _a}from"react";function Va(e){let r=_a(e);r.current=e;let t=_a(null);t.current===null&&(t.current={fetch:(n,l)=>{let s=r.current;return s?s.fetch(n,l):Promise.reject(new Error("products config removed"))},transform:n=>r.current?.transform(n)??[],get limit(){return r.current?.limit}});let o=e!==void 0;return{config:o?t.current:void 0,enabled:o}}var un={query:"",raw_query:"",completed_params:[],identified_params:[],is_ready:!1},Qa={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,highlightByPointer:!1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,isSubmitting:!1,selectingProductId:null,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,blockingChips:[],filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Zt({onSubmit:e,onResult:r,onError:t,optionOverrides:o,maskCompletedText:n,apiConfig:l,additionalContext:s,language:c,currency:w,productId:v,visitorId:y,analyticsConsent:m,columns:u=2,dropdownTrigger:p,optionsPosition:k,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:O,prependPlaceholder:L,allOption:j,showNonTappableOptions:N,locationSearch:A,showOptionIcons:D,showOptionImages:F,showOptionCounts:Y,showSkipButton:ie,showProducts:X,submitProgress:W,awaitAnswerOnSubmit:I,submitAnswerTimeoutMs:G,productImageFallback:se="image",showProductVendor:le=!0,onFocus:ee,onBlur:a,value:x,completedParams:te,onChange:ae,onParamsChange:ne,products:Ue,mapProducts:Ie,onProductSelect:Ae,onProductAddToCart:fe,source:Qe,setCursor:Ne}){let h=V(null),[Ye,Ee]=hn(null),Fe=V(e);Fe.current=e;let f=V(r);f.current=r;let C=V(t);C.current=t;let E=V(ae);E.current=ae;let z=V(ne);z.current=ne;let M=V(ee);M.current=ee;let K=V(a);K.current=a;let pe=V(Ne);pe.current=Ne;let de=V(Ae);de.current=Ae;let Re=V(fe);Re.current=fe;let oe=V(y);oe.current=y;let ze=V(()=>{let d=oe.current;return typeof d=="function"?d():d}).current,be=y!==void 0,je=V(m);je.current=m;let he=V(()=>{let d=je.current;return typeof d=="function"?d():d}).current,He=Va(Ue),it=V(Ie);it.current=Ie;let ce=V((d,q)=>{let H=it.current;return H?H(d,q):d}).current,ue=Ie?ce:void 0,Be=qa(o);Ve(()=>{if(typeof document>"u")return;let d=new on(document.createElement("div"),{renderMode:"headless",apiConfig:l,additionalContext:s,language:c,currency:w,productId:v,visitorId:be?ze:void 0,analyticsConsent:he,optionOverrides:Be.overrides,maskCompletedText:n,columns:u,dropdownTrigger:p,optionsPosition:k,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:O,prependPlaceholder:L,allOption:j,showNonTappableOptions:N,locationSearch:A,showProducts:X,submitProgress:W,awaitAnswerOnSubmit:I,submitAnswerTimeoutMs:G,source:Qe,value:x,completedParams:te,onSubmit:(...H)=>Fe.current?.(...H),onResult:(...H)=>f.current?.(...H),onError:(...H)=>C.current?.(...H),onChange:(...H)=>E.current?.(...H),onParamsChange:(...H)=>z.current?.(...H),onFocus:()=>M.current?.(),onBlur:()=>K.current?.(),onProductSelect:H=>de.current?de.current(H):ln,onProductAddToCart:H=>Re.current?.(H),setCursor:H=>pe.current?.(H),products:He.config,mapProducts:ue});h.current=d,Ee(d.getState());let q=d.subscribe(H=>Ee(H));return()=>{q(),d.destroy(),h.current===d&&(h.current=null)}},[]);let i=V(be);Ve(()=>{i.current!==be&&(i.current=be,h.current?.update({visitorId:be?ze:void 0,analyticsConsent:he}))},[be,ze,he]);let B=typeof m=="function"?"function":m,we=V(B);Ve(()=>{we.current!==B&&(we.current=B,h.current?.refreshAnalyticsConsent())},[B]),Ve(()=>{x!==void 0&&h.current?.setValue(x)},[x]),Ve(()=>{te!==void 0&&h.current?.setCompletedParams(te)},[te]);let Se=JSON.stringify(l??null),$e;try{$e=JSON.stringify(s??null)}catch{$e="[unstringifiable]"}Ve(()=>{h.current?.update({apiConfig:l,additionalContext:s,language:c,currency:w,productId:v,optionOverrides:Be.overrides,dropdownTrigger:p,optionsPosition:k,closeDropdownOnBlur:S,focusInputOnSelect:T,startingState:O,prependPlaceholder:L,allOption:j,showNonTappableOptions:N,locationSearch:A,showProducts:X,submitProgress:W,awaitAnswerOnSubmit:I,submitAnswerTimeoutMs:G})},[Se,$e,c,w?.code,w?.rate,w?.country,v,Be.key,p,k,S,T,O,L,j,N,A,X,W,I,G]);let Ce=V(!1);Ve(()=>{if(!Ce.current){Ce.current=!0;return}h.current?.update({products:He.config})},[He.enabled]),Ve(()=>{h.current?.update({mapProducts:ue})},[ue]);let Le=V(null);Le.current===null&&(Le.current={handleTextChange:d=>h.current?.handleTextChange(d),handleCompositionText:d=>h.current?.handleCompositionText(d),handleKeyDown:d=>{let q="nativeEvent"in d?d.nativeEvent:d;h.current?.handleKeyDown(q)},setFocused:d=>h.current?.setFocused(d),startEditingParam:d=>h.current?.startEditingParam(d),removeParam:d=>h.current?.removeParam(d)??!1,exitEditMode:()=>h.current?.exitEditMode(),handleCaretAfterInput:d=>h.current?.handleCaretAfterInput(d),handleCaretMove:d=>h.current?.handleCaretMove(d),replaceEditingRange:d=>h.current?.replaceEditingRange(d)??!1,setActivePill:d=>h.current?.setActivePill(d),skipActivePill:()=>h.current?.skipActivePill(),removeLastParam:()=>h.current?.removeLastParam(),clearNewParamId:()=>h.current?.clearNewParamId(),reset:()=>h.current?.reset(),refreshProducts:()=>h.current?.refreshProducts(),prepareSubmit:()=>h.current?.prepareSubmit(),getState:()=>h.current?.getState()??Qa,getResult:()=>h.current?.getResult()??un,awaitSubmitResult:()=>h.current?.awaitSubmitResult()??Promise.resolve(null),recordSubmit:d=>h.current?.recordSubmit(d),holdSubmit:d=>h.current?.holdSubmit(d),endSubmitProgress:()=>h.current?.endSubmitProgress(),getSearchId:()=>h.current?.getSearchId(),getVisitorId:()=>h.current?.getVisitorId(),refreshAnalyticsConsent:()=>h.current?.refreshAnalyticsConsent(),selectOption:(d,q)=>h.current?.selectOption(d,q),selectProduct:d=>h.current?.selectProduct(d),addProductToCart:d=>{let q=h.current;return!q||!Re.current?Promise.resolve():q.addProductToCart(d)},setActiveDropdownIndex:d=>h.current?.setActiveDropdownIndex(d),clearHighlight:d=>h.current?.clearHighlight(d),showPreviousMonth:()=>h.current?.showPreviousMonth(),showNextMonth:()=>h.current?.showNextMonth(),setTime:d=>h.current?.setTime(d),commitTime:()=>h.current?.commitTime(),toggleMultiSelectOption:d=>h.current?.toggleMultiSelectOption(d),commitMultiSelect:()=>h.current?.commitMultiSelect(),setLocationQuery:d=>h.current?.setLocationQuery(d),moveLocationHighlight:d=>h.current?.moveLocationHighlight(d),commitLocation:d=>h.current?.commitLocation(d),setLocationFieldFocused:d=>h.current?.setLocationFieldFocused(d),handleFocus:()=>h.current?.setFocused(!0),handleBlur:()=>h.current?.setFocused(!1)});let b=Le.current,ot=Ua(d=>{let q=d.target.value,Pt=q.length>0&&!d.nativeEvent?.isComposing&&q[0]!==q[0].toUpperCase()?q[0].toUpperCase()+q.slice(1):q;h.current?.handleTextChange(Pt)},[]),We=Ua(d=>{h.current?.handleKeyDown(d.nativeEvent)},[]),Ge=h.current,g=Ye??Qa,Ke=x!==void 0?x:g.text,nt=te!==void 0?te:g.completedParams,Oe=g.actionableSuggestions,rt=Oe[0],st=pn(()=>cn(Oe),[Oe]),qe=Ge?.listboxId??"",lt=g.activeDropdownIndex>=0&&Ge?`${qe}-option-${g.activeDropdownIndex}`:void 0,De=g.editingParam,P=g.editingIdentified,St=De?sn(De):P?{parameter:P.parameter,text:dn(P.parameter),required:!0,options:[]}:null,Ct=g.dropdownSuggestion??St??rt,Nt=rn(g.dropdownSuggestion,St,Oe),dt=nn(g),Tt=!Ge||g.dropdownLoading;return{completedParams:nt,multiSelectView:g.multiSelectView,toggleMultiSelectOption:b.toggleMultiSelectOption,commitMultiSelect:b.commitMultiSelect,skippedParams:g.skippedParams,identifiedParams:g.identifiedParams,suggestionPills:st,setActivePill:b.setActivePill,skipActivePill:b.skipActivePill,removeLastParam:b.removeLastParam,segments:g.segments,newParamId:g.newParamId,clearNewParamId:b.clearNewParamId,suggestions:g.suggestions,activeIndex:g.activeDropdownIndex,isReady:g.isReady,isLoading:Tt,isFocused:g.isFocused,isDropdownOpen:g.isDropdownOpen,isActivePillSelected:g.isActivePillSelected,blockingChips:g.blockingChips,placeholderText:g.placeholderText,listboxId:qe,error:g.error,products:g.products,customFields:g.customFields,selectProduct:b.selectProduct,addProductToCart:b.addProductToCart,handleTextChange:b.handleTextChange,handleCompositionText:b.handleCompositionText,handleKeyDown:b.handleKeyDown,setFocused:b.setFocused,editingParam:De,editingIdentified:P,editingAnchor:g.editingAnchor,caretOffset:g.caretOffset,startEditingParam:b.startEditingParam,removeParam:b.removeParam,exitEditMode:b.exitEditMode,handleCaretAfterInput:b.handleCaretAfterInput,handleCaretMove:b.handleCaretMove,replaceEditingRange:b.replaceEditingRange,inputProps:{value:Ke,placeholder:g.placeholderText||void 0,onChange:ot,onKeyDown:We,onFocus:b.handleFocus,onBlur:b.handleBlur,role:"combobox","aria-expanded":g.isDropdownOpen,"aria-activedescendant":lt,"aria-autocomplete":"list","aria-controls":qe},reset:b.reset,refreshProducts:b.refreshProducts,prepareSubmit:b.prepareSubmit,getState:b.getState,getResult:b.getResult,awaitSubmitResult:b.awaitSubmitResult,recordSubmit:b.recordSubmit,holdSubmit:b.holdSubmit,endSubmitProgress:b.endSubmitProgress,getSearchId:b.getSearchId,getVisitorId:b.getVisitorId,refreshAnalyticsConsent:b.refreshAnalyticsConsent,isSubmitting:g.isSubmitting,selectingProductId:g.selectingProductId,dropdownProps:{suggestions:Ct?[{...Ct,options:g.dropdownOptions}]:[],activeIndex:g.activeDropdownIndex,onSelect:b.selectOption,onHighlight:b.setActiveDropdownIndex,onUnhighlight:b.clearHighlight,isOpen:g.isDropdownOpen,id:qe,pills:Nt,activeSelected:g.isActivePillSelected,onPillClick:b.setActivePill,onSkip:b.skipActivePill,showSkipButton:(ie??!0)&&!De&&!P,showOptionIcons:D??!0,showOptionImages:F??!0,showOptionCounts:Y??!0,skipDisabled:g.inSelectionAnimation,isLoading:Tt,skeletonExiting:g.skeletonExiting,isInputEmpty:Ke.trim().length===0,language:c,products:g.products,productImageFallback:se,showProductVendor:le,onProductSelect:b.selectProduct,busyProductId:g.selectingProductId,seeAllBusy:g.isSubmitting,onProductAddToCart:fe?b.addProductToCart:void 0,onProductFocusChange:b.setFocused,formatType:g.activeFormatType,dateView:g.dateView,selectedDateIso:dt.selectedIso,selectedDateRange:dt.selectedRange,dateRangeStart:dt.rangeStart,dateReferences:dt.references,onPreviousMonth:b.showPreviousMonth,onNextMonth:b.showNextMonth,timeView:g.timeView,multiSelectView:g.dropdownMultiSelect,onMultiSelectCommit:b.commitMultiSelect,onTimeChange:b.setTime,onTimeCommit:b.commitTime,locationView:g.locationView,isReediting:g.editingParam!=null,onLocationQuery:b.setLocationQuery,onLocationMove:b.moveLocationHighlight,onLocationCommit:b.commitLocation,onLocationFocusChange:b.setLocationFieldFocused,isFocused:g.isFocused||g.locationFieldFocused,optionsPosition:k??"below"}}}import{attachChipRemove as mn,cancelStartingHint as gn,chipIdFromTap as fn,extractPlainText as Ya,focusesInputOnSelect as bn,getCursorOffset as ja,keepCaretOnChip as wn,plainTextLength as vn,renderEditableContent as xn,setCursorOffset as yn,settlePickFocus as kn,startingHintOptions as Sn}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ke,useEffect as mt,useLayoutEffect as Xt,useRef as at}from"react";var Dt;function Cn(){if(Dt!==void 0)return Dt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Dt=e.contentEditable==="plaintext-only",Dt}function $a(e){let{segments:r,showChipIcons:t=!0,showChipImages:o=!0,showChipRemove:n=!1,blockingParamIds:l,focusInputOnSelect:s,removeParam:c,newParamId:w,editingParam:v,editingIdentified:y,editingAnchor:m,caretOffset:u,placeholderText:p,hintSuggestions:k,isFocused:S,isDropdownOpen:T,listboxId:O,activeDescendantId:L,autoFocus:j,handleTextChange:N,handleCompositionText:A,handleKeyDown:D,handleCaretAfterInput:F,handleCaretMove:Y,startEditingParam:ie,replaceEditingRange:X,setFocused:W}=e,I=at(null),G=at(!1),se=at(""),le=at(""),ee=at(null),a=at(0);ee.current=u;let x=at(s);x.current=s,mt(()=>{if(!j)return;let f=I.current;if(!f)return;document.activeElement===f?W(!0):f.focus();let C=f.ownerDocument??document,E=C.getSelection(),z=E&&E.rangeCount>0&&f.contains(E.anchorNode);if(E&&!z){let M=C.createRange();M.selectNodeContents(f),M.collapse(!0),E.removeAllRanges(),E.addRange(M)}},[j,W]),mt(()=>{let f=I.current;if(!f)return;let C=f.ownerDocument??document,E=()=>{let z=C.getSelection();if(!z||z.rangeCount===0||!z.anchorNode||!f.contains(z.anchorNode))return;let M=z.anchorNode,K=M.nodeType===Node.ELEMENT_NODE?M:M.parentElement,de=(z.isCollapsed?K?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Re=v?.id??y?.id??null;if(de&&de!==Re){ie(de);return}performance.now()-a.current<50||Y(ja(f))};return C.addEventListener("selectionchange",E),()=>C.removeEventListener("selectionchange",E)},[v,y,ie,Y]),mt(()=>{let f=I.current;if(!f)return;let C=E=>{let z=fn(f,E.target);z&&(ie(z),wn(f,z))};return f.addEventListener("click",C),()=>f.removeEventListener("click",C)},[ie]);let te=n||(l?.length??0)>0;mt(()=>{let f=I.current;if(!(!f||!c||!te))return mn(f,c)},[c,te]),Xt(()=>{let f=I.current;f&&xn({input:f,segments:r,newParamId:w,editingParamId:v?.id??null,placeholderText:p??"",isFocused:S,showChipIcons:t,showChipImages:o,showChipRemove:n,blockingParamIds:l,hintOptions:Sn(k??[])})},[r,w,v,p,k,S,t,o,n,l]),mt(()=>{let f=I.current;return()=>{f&&gn(f)}},[]),Xt(()=>{let f=se.current,C=w??"";if(se.current=C,!C||C===f)return;let E=I.current;if(!E)return;let z=ee.current??vn(E);kn(E,z,bn(x.current))},[w]),Xt(()=>{let f=le.current,C=v?.id??"";if(le.current=C,!C||C===f||m==null)return;let E=I.current;E&&yn(E,m)},[v,m]);let ae=ke(()=>{let f=I.current;if(!f)return;let C=Ya(f),z=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;if(G.current){A(z);return}N(z)},[N,A]),ne=ke(()=>{a.current=performance.now(),ae();let f=I.current;f&&F(ja(f))},[ae,F]);mt(()=>{let f=I.current;if(!f)return;let C=E=>{let z=E,M=z.inputType;if(M==="insertParagraph"||M==="insertLineBreak"||M==="insertFromDrop"){E.preventDefault();return}if(M.startsWith("insert")||M.startsWith("delete")){let K=M.startsWith("delete")?"":z.data??"";X(K)&&E.preventDefault()}};return f.addEventListener("beforeinput",C),()=>f.removeEventListener("beforeinput",C)},[X]);let Ue=ke(()=>{G.current=!0,I.current?.setAttribute("data-aia-composing","true")},[]),Ie=ke(()=>{G.current=!1,I.current?.removeAttribute("data-aia-composing"),ae()},[ae]),Ae=ke(f=>{f.preventDefault();let C=I.current;if(!C)return;let E=(f.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!E)return;let z=C.ownerDocument??document,M=z.getSelection();if(!M||M.rangeCount===0)return;let K=M.getRangeAt(0);if(!C.contains(K.startContainer))return;K.deleteContents();let pe=z.createTextNode(E);K.insertNode(pe),K.setStartAfter(pe),K.collapse(!0),M.removeAllRanges(),M.addRange(K),ae()},[ae]),fe=ke(f=>D(f),[D]),Qe=ke(()=>W(!0),[W]),Ne=ke(()=>W(!1),[W]),h=ke(()=>I.current?.focus(),[]),Ye=ke(()=>I.current?.blur(),[]),Ee=ke(()=>{let f=I.current;return f?Ya(f):""},[]),Fe=Cn()?"plaintext-only":"true";return{inputRef:I,editorProps:{ref:I,contentEditable:Fe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":O,"aria-expanded":T,"aria-activedescendant":L,spellCheck:!0,enterKeyHint:"send",onInput:ne,onKeyDown:fe,onCompositionStart:Ue,onCompositionEnd:Ie,onPaste:Ae,onFocus:Qe,onBlur:Ne},getPlainText:Ee,focus:h,blur:Ye}}import{jsx as ft,jsxs as ea}from"react/jsx-runtime";function Mn(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Nn=Tn(function({onSubmit:r,onResult:t,onError:o,optionOverrides:n,maskCompletedText:l,className:s,apiConfig:c,additionalContext:w,language:v,currency:y,productId:m,visitorId:u,analyticsConsent:p,columns:k,pillPlacement:S="dropdown",mode:T="auto",optionsPosition:O="below",animations:L=!0,optionsStyle:j="floating",dropdownTrigger:N,closeDropdownOnBlur:A,focusInputOnSelect:D,startingState:F,prependPlaceholder:Y,allOption:ie,showNonTappableOptions:X,locationSearch:W,showOptionIcons:I=!0,showChipIcons:G=!0,showChipImages:se=!0,showChipRemove:le=!1,showOptionImages:ee=!0,showOptionCounts:a=!0,showSkipButton:x,showProducts:te,submitProgress:ae,awaitAnswerOnSubmit:ne,submitAnswerTimeoutMs:Ue,productsLayout:Ie,productImageFallback:Ae,showProductVendor:fe,autoFocus:Qe=!0,onFocus:Ne,onBlur:h,value:Ye,completedParams:Ee,onChange:Fe,onParamsChange:f,products:C,mapProducts:E,onProductSelect:z,onProductAddToCart:M,submitButton:K,resetOnSubmit:pe=!0,seeAllResults:de=!1},Re){let oe=gt(null),ze=gt(null),be=gt(null),je=gt(()=>{}),he=gt(null),He=gt(null);Jt(()=>{let R=oe.current;if(R)return he.current?he.current.setMode(T):he.current=new zn(R,T),()=>{he.current?.destroy(),he.current=null}},[T]);let it=Mt(R=>{let ve=He.current?.current;ve&&(ve.focus(),Ln(ve,R))},[]),{completedParams:ce,suggestionPills:ue,setActivePill:Be,skipActivePill:i,segments:B,newParamId:we,clearNewParamId:Se,placeholderText:$e,isFocused:Ce,isDropdownOpen:Le,isActivePillSelected:b,blockingChips:ot,isLoading:We,isReady:Ge,activeIndex:g,listboxId:Ke,handleTextChange:nt,handleCompositionText:Oe,handleKeyDown:rt,setFocused:st,editingParam:qe,editingIdentified:lt,editingAnchor:De,caretOffset:P,startEditingParam:St,removeParam:Ct,handleCaretAfterInput:Nt,handleCaretMove:dt,replaceEditingRange:Tt,dropdownProps:d,reset:q,refreshProducts:H,prepareSubmit:Pt,getState:It,getResult:ta,awaitSubmitResult:aa,recordSubmit:ia,holdSubmit:oa,endSubmitProgress:na,getSearchId:ra,getVisitorId:sa,refreshAnalyticsConsent:la,isSubmitting:Ft}=Zt({onSubmit:R=>je.current(R),onResult:t,onError:o,optionOverrides:n,maskCompletedText:l,apiConfig:c,additionalContext:w,language:v,currency:y,productId:m,visitorId:u,analyticsConsent:p,columns:k,dropdownTrigger:N,optionsPosition:O,closeDropdownOnBlur:A,focusInputOnSelect:D,startingState:F,prependPlaceholder:Y,allOption:ie,showNonTappableOptions:X,locationSearch:W,showOptionIcons:I,showOptionImages:ee,showOptionCounts:a,showSkipButton:x,showProducts:te,submitProgress:ae,awaitAnswerOnSubmit:ne,submitAnswerTimeoutMs:Ue,onFocus:Ne,onBlur:h,value:Ye,completedParams:Ee,onChange:Fe,onParamsChange:f,products:C,mapProducts:E,onProductSelect:z,onProductAddToCart:M,source:"full-sdk",setCursor:it});Jt(()=>{if(!we)return;let R=window.setTimeout(()=>Se(),650);return()=>window.clearTimeout(R)},[we,Se]);let Za=An(()=>ot.map(R=>R.paramId),[ot]),Xa=g>=0?`${Ke}-option-${g}`:void 0,{inputRef:ct,editorProps:Ja,focus:da,blur:ca,getPlainText:pa}=$a({segments:B,newParamId:we,editingParam:qe,editingIdentified:lt,editingAnchor:De,caretOffset:P,placeholderText:$e,hintSuggestions:S==="inline"?[]:ue,isFocused:Ce,showChipIcons:G,showChipImages:se,showChipRemove:le,blockingParamIds:Za,removeParam:Ct,focusInputOnSelect:D,isDropdownOpen:Le,listboxId:Ke,activeDescendantId:Xa,autoFocus:Qe,handleTextChange:nt,handleCompositionText:Oe,handleKeyDown:rt,handleCaretAfterInput:Nt,handleCaretMove:dt,startEditingParam:St,replaceEditingRange:Tt,setFocused:st});He.current=ct,In(()=>{let R=ze.current,ve=ct.current;if(!R||!ve)return;let Xe=()=>{let wt=R.firstElementChild;if(!wt)return;let ni=wt.getBoundingClientRect(),ri=ve.getBoundingClientRect();ni.top>=ri.bottom-2?R.setAttribute("data-aia-pill-wrapped",""):R.removeAttribute("data-aia-pill-wrapped")};Xe();let bt=new ResizeObserver(Xe);return bt.observe(ve),()=>bt.disconnect()},[B,ue.length,We,ct]),Jt(()=>{let R=be.current;if(R)return Dn(R)},[]),Pn(Re,()=>({focus:da,blur:ca,reset:q,refreshProducts:H,setMode:R=>he.current?.setMode(R),skipActivePill:i,endSubmitProgress:na,getSearchId:ra,getVisitorId:sa,refreshAnalyticsConsent:la}),[da,ca,q,H,i,na,ra,sa,la]);let Ze=!!B.length||ce.length>0,At=Mt((R,ve)=>{let Xe=It(),bt=En(pa(),Xe.completedParams,Xe.skippedParams,{identifiedParams:Xe.identifiedParams,isReady:Xe.isReady,customFields:ve.custom_fields??null,customFieldsStale:ve.custom_fields_stale===!0});R&&ia(bt);let wt=r(bt);return R&&!pe&&oa(wt),pe&&q(),wt},[ia,oa,pe,It,r,q,pa]),Ht=Mt(()=>{if(Ze&&!It().isSubmitting){if(ne){aa().then(R=>{R&&At(!0,R)});return}Pt(),At(!0,ta())}},[Ze,It,ne,aa,Pt,ta,At]);je.current=R=>Ze?At(!1,R):void 0;let ei=de&&!d.isInputEmpty&&Ze,ti=Ht,ai=Mt(R=>{R.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||ct.current&&Rn(ct.current)},[ct]),ii=S==="inline",oi=S==="dropdown";return ea("div",{ref:oe,className:`magicx-aia ${Je.container} ${s??""}`,"data-pill-placement":S,"data-options-position":O,"data-animations":L?"on":"off","data-aia-options-style":j,"data-mode":Mn(T),children:[ft(jt,{...d,showPills:oi,productsLayout:Ie,productImageFallback:Ae,showProductVendor:fe,onSeeAllResults:ei?ti:void 0,fullWidth:de}),ea("div",{className:Je.inputWrapper,"data-aia-input-wrapper":"",onClick:ai,children:[ea("div",{ref:be,className:Je.editorArea,"data-aia-editor":"",children:[ft("div",{...Ja,className:Je.input,"data-aia-input":""}),ii&&(We||ue.length>0)&&ft("span",{ref:ze,className:Je.pillListContainer,"data-aia-pill-list-container":"",children:ft(Rt,{pills:ue,activePillIndex:0,activeSelected:b,onSelectPill:Be,loading:We})})]}),K===null?null:K===void 0?ft(Ga,{disabled:!Ze,ready:Ze&&Ge,busy:Ft,onClick:Ht,label:On(v).submit}):ft("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Ft?"busy":void 0,"aria-busy":Ft?!0:void 0,className:Je.submitSlot,onClick:R=>{Ze&&(R.stopPropagation(),Ht())},children:K})]})]})});export{Nn as AIAutocomplete,jt as AIAutocompleteDropdown,Vs as DATE_RANGE_META_END,Us as DATE_RANGE_META_START,Qs as DEFAULT_OPTION_COUNT_UNIT,il as LOCATION_META_KEY,pl as PRODUCT_PATH_PREFIX,yl as TIME_META_KEY,Sl as WEEKDAY_LABELS,Ks as buildSubmitResult,qs as cellDay,_s as cellIso,Ys as dateCellMarks,js as focusesInputOnSelect,$s as formatDate,Zs as formatDateRange,Xs as formatOptionCount,Js as formatPlace,el as formatTime,al as isTouchPrimary,tl as isoDate,ol as monthLabel,nl as optionCountLabel,rl as optionHasImage,sl as optionImageSources,ll as optionImageSrc,dl as optionLabel,cl as optionsShowLeadingVisuals,hl as parseDate,ul as parseLooseDate,ml as parseLooseDateRange,gl as parseTime,fl as productFromMatchedItem,bl as productImageSources,wl as productsFromCustomFields,vl as sanitizeOptionIconSvg,xl as selectedRangeFor,Zt as useAIAutocomplete,kl as visibleDateRange,Cl as withSkippedParams};
3979
4003
  //# sourceMappingURL=index.mjs.map