@magicx-eng/ai-autocomplete-react 0.60.3 → 0.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END as gs,DATE_RANGE_META_START as fs,DEFAULT_OPTION_COUNT_UNIT as bs,dateCellMarks as ws,formatDate as vs,formatDateRange as xs,formatOptionCount as ys,formatPlace as ks,formatTime as Cs,isoDate as Ss,LOCATION_META_KEY as Ts,monthLabel as Ps,optionCountLabel as Is,optionHasImage as Es,optionImageSources as As,optionImageSrc as Rs,optionLabel as Os,optionsShowLeadingVisuals as Ls,PRODUCT_PATH_PREFIX as zs,parseDate as Ds,parseLooseDate as Ms,parseLooseDateRange as Ns,parseTime as Hs,productFromMatchedItem as Fs,productImageSources as Bs,productsFromCustomFields as Ws,sanitizeOptionIconSvg as Gs,selectedRangeFor as Ks,TIME_META_KEY as qs,visibleDateRange as _s,WEEKDAY_LABELS as Vs,withSkippedParams as Us}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as $o,useCallback as ka,useEffect as Ha,useImperativeHandle as Zo,useLayoutEffect as Xo,useRef as ia}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 us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END as fs,DATE_RANGE_META_START as bs,DEFAULT_OPTION_COUNT_UNIT as ws,dateCellMarks as vs,formatDate as xs,formatDateRange as ys,formatOptionCount as ks,formatPlace as Cs,formatTime as Ss,isoDate as Ts,LOCATION_META_KEY as Ps,monthLabel as Is,optionCountLabel as Es,optionHasImage as As,optionImageSources as Rs,optionImageSrc as Os,optionLabel as Ls,optionsShowLeadingVisuals as zs,PRODUCT_PATH_PREFIX as Ds,parseDate as Ms,parseLooseDate as Ns,parseLooseDateRange as Hs,parseTime as Fs,productFromMatchedItem as Bs,productImageSources as Ws,productsFromCustomFields as Gs,sanitizeOptionIconSvg as Ks,selectedRangeFor as qs,TIME_META_KEY as _s,visibleDateRange as Vs,WEEKDAY_LABELS as Us,withSkippedParams as Qs}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Zo,useCallback as Ca,useEffect as Fa,useImperativeHandle as Xo,useLayoutEffect as Jo,useRef as oa}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
@@ -406,7 +406,7 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
406
406
  transition: none;
407
407
  }
408
408
  }
409
- `,document.head.appendChild(e)}var Ve={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 no,attachViewportFit as ro,containScroll as so,dateFloorFor as lo,destroyPanelMorph as co,findMultiSelectDone as po,fitMultiSelectDone as ho,hasSkippablePill as uo,isCalendarFormat as mo,labelTraditionalAutocomplete as go,panelMorphKey as fo,queryLive as bo,settlePanelMorph as wo,syncPanelHug as vo,uiStringsFor as xo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Qe,useLayoutEffect as La,useRef as Je,useState as yo}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
409
+ `,document.head.appendChild(e)}var Ue={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 ro,attachViewportFit as so,containScroll as lo,dateFloorFor as co,destroyPanelMorph as po,findMultiSelectDone as ho,fitMultiSelectDone as uo,hasSkippablePill as mo,isCalendarFormat as go,labelTraditionalAutocomplete as fo,panelMorphKey as bo,queryLive as wo,settlePanelMorph as vo,syncPanelHug as xo,uiStringsFor as yo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ye,useLayoutEffect as za,useRef as ea,useState as ko}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
410
410
  * Built-in appearance defaults \u2014 zero specificity via :where().
411
411
  * Consumer CSS always wins without !important.
412
412
  *
@@ -1726,7 +1726,7 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
1726
1726
  opacity: 1;
1727
1727
  }
1728
1728
  }
1729
- `,document.head.appendChild(e)}var se={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",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};import{cellDay as Kt,cellIso as da,dateCellMarks as qt,isDimmedDay as _t,isoDate as Vt,monthLabel as Ut,visibleDateRange as Qt,WEEKDAY_LABELS as Yt}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as jt}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) ---
1729
+ `,document.head.appendChild(e)}var se={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",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};import{cellDay as qt,cellIso as ca,dateCellMarks as _t,isDimmedDay as Vt,isoDate as Ut,monthLabel as Qt,visibleDateRange as Yt,WEEKDAY_LABELS as jt}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as $t}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) ---
1730
1730
 
1731
1731
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1732
1732
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1923,7 +1923,7 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
1923
1923
  opacity: 0.8;
1924
1924
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1925
1925
  }
1926
- `,document.head.appendChild(e)}var K={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 we,jsxs as Ya}from"react/jsx-runtime";var $t=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ja({options:e,activeIndex:n,listboxId:a,view:t,selection:o,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:w,onNextMonth:v}){let y=Vt(new Date),b=Qt({pendingStart:o.rangeStart,highlightedIso:da(e[n]),selected:o.selectedRange,floor:o.floor});return Ya("div",{className:K.datepicker,"data-aia-datepicker":"",children:[Ya("div",{className:K.header,children:[we("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:w,children:"\u2039"}),we("span",{className:K.month,"data-aia-date-month":"","aria-live":"polite",children:Ut(t)}),we("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:v,children:"\u203A"})]}),we("div",{className:K.weekdays,"aria-hidden":"true",children:Yt.map((h,p)=>we("span",{className:K.weekday,children:h},$t[p]))}),we("div",{className:K.grid,"data-aia-date-grid":"",children:e.map((h,p)=>we(Zt,{option:h,id:`${a}-option-${p}`,index:p,isHighlighted:p===n&&h.is_tappable,isToday:da(h)===y,isPast:_t(da(h),y,o.floor),marks:qt(da(h),{selectedIso:o.selectedIso,range:b,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:l},da(h)??`pad-${p}`))})]})}function Zt({option:e,id:n,index:a,isHighlighted:t,isToday:o,isPast:s,marks:r,onSelect:l,onHighlight:w,onUnhighlight:v}){let[y,b]=jt(!1),h=Kt(e);if(h==null)return we("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${K.cell} ${K.blank}`});let p=()=>{b(!0),l(e),setTimeout(()=>b(!1),170)},x=[K.cell,K.day,s?K.past:"",t?K.highlighted:"",o?K.today:"",r.inRange?K.inRange:"",r.selected?K.selected:"",r.reference?K.reference:"",y?K.pressed:""].filter(Boolean).join(" ");return we("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":t,"aria-label":e.text,tabIndex:0,className:x,onClick:p,onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),p())},onMouseEnter:()=>w(a),onMouseLeave:v?()=>v(a):void 0,children:we("span",{className:K.number,children:h})})}import{ATTRIBUTION_URL as Xt,buildAttributionUrl as Jt,getFooterHint as ei,uiStringsFor as ai}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ti,useState as ii}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 {
1926
+ `,document.head.appendChild(e)}var K={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 be,jsxs as ja}from"react/jsx-runtime";var Zt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function $a({options:e,activeIndex:n,listboxId:a,view:t,selection:o,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:w,onNextMonth:v}){let y=Ut(new Date),f=Yt({pendingStart:o.rangeStart,highlightedIso:ca(e[n]),selected:o.selectedRange,floor:o.floor});return ja("div",{className:K.datepicker,"data-aia-datepicker":"",children:[ja("div",{className:K.header,children:[be("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:w,children:"\u2039"}),be("span",{className:K.month,"data-aia-date-month":"","aria-live":"polite",children:Qt(t)}),be("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:v,children:"\u203A"})]}),be("div",{className:K.weekdays,"aria-hidden":"true",children:jt.map((h,p)=>be("span",{className:K.weekday,children:h},Zt[p]))}),be("div",{className:K.grid,"data-aia-date-grid":"",children:e.map((h,p)=>be(Xt,{option:h,id:`${a}-option-${p}`,index:p,isHighlighted:p===n&&h.is_tappable,isToday:ca(h)===y,isPast:Vt(ca(h),y,o.floor),marks:_t(ca(h),{selectedIso:o.selectedIso,range:f,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:l},ca(h)??`pad-${p}`))})]})}function Xt({option:e,id:n,index:a,isHighlighted:t,isToday:o,isPast:s,marks:r,onSelect:l,onHighlight:w,onUnhighlight:v}){let[y,f]=$t(!1),h=qt(e);if(h==null)return be("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${K.cell} ${K.blank}`});let p=()=>{f(!0),l(e),setTimeout(()=>f(!1),170)},k=[K.cell,K.day,s?K.past:"",t?K.highlighted:"",o?K.today:"",r.inRange?K.inRange:"",r.selected?K.selected:"",r.reference?K.reference:"",y?K.pressed:""].filter(Boolean).join(" ");return be("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":t,"aria-label":e.text,tabIndex:0,className:k,onClick:p,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),p())},onMouseEnter:()=>w(a),onMouseLeave:v?()=>v(a):void 0,children:be("span",{className:K.number,children:h})})}import{ATTRIBUTION_URL as Jt,buildAttributionUrl as ei,getFooterHint as ai,uiStringsFor as ti}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ii,useState as oi}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 {
1927
1927
  display: flex;
1928
1928
  flex-wrap: wrap;
1929
1929
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1963,7 +1963,7 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
1963
1963
  .aia-cluster[data-justify="around"] {
1964
1964
  justify-content: space-around;
1965
1965
  }
1966
- `,document.head.appendChild(e)}import{jsx as $a}from"react/jsx-runtime";function ca({gap:e,align:n="center",justify:a="start",noWrap:t=!1,inline:o=!1,className:s,children:r,...l}){let w=e?{"--aia-cluster-gap":e}:void 0,v={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":n,"data-justify":a,"data-nowrap":t||void 0,"data-inline":o||void 0,style:w,...l};return o?$a("span",{...v,children:r}):$a("div",{...v,children:r})}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
1966
+ `,document.head.appendChild(e)}import{jsx as Za}from"react/jsx-runtime";function pa({gap:e,align:n="center",justify:a="start",noWrap:t=!1,inline:o=!1,className:s,children:r,...l}){let w=e?{"--aia-cluster-gap":e}:void 0,v={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":n,"data-justify":a,"data-nowrap":t||void 0,"data-inline":o||void 0,style:w,...l};return o?Za("span",{...v,children:r}):Za("div",{...v,children:r})}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
1967
1967
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
1968
1968
  room above the hint/branding row so the footer doesn't butt against the last
1969
1969
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -2110,7 +2110,7 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
2110
2110
  justify-content: flex-end;
2111
2111
  }
2112
2112
  }
2113
- `,document.head.appendChild(e)}var Re={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 pa,jsxs as Sa}from"react/jsx-runtime";function Za({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:a=ai()}){let{key:t,hint:o}=ei(e,n,a),[s,r]=ii(Xt);return ti(()=>{r(Jt())},[]),pa("footer",{className:Re.footer,"data-aia-footer":"",children:Sa(ca,{justify:"between",noWrap:!0,className:Re.row,children:[Sa(ca,{gap:"5px",className:Re.hintGroup,children:[pa("kbd",{className:Re.key,children:t}),pa("span",{className:Re.hint,children:o})]}),Sa("a",{className:Re.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[pa("span",{className:Re.brand,children:"AI"}),pa("span",{className:Re.badge,children:"Autocomplete"})]})]})})}import{useEffect as Xa,useLayoutEffect as oi,useRef as le}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
2113
+ `,document.head.appendChild(e)}var Re={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 ha,jsxs as Ta}from"react/jsx-runtime";function Xa({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:a=ti()}){let{key:t,hint:o}=ai(e,n,a),[s,r]=oi(Jt);return ii(()=>{r(ei())},[]),ha("footer",{className:Re.footer,"data-aia-footer":"",children:Ta(pa,{justify:"between",noWrap:!0,className:Re.row,children:[Ta(pa,{gap:"5px",className:Re.hintGroup,children:[ha("kbd",{className:Re.key,children:t}),ha("span",{className:Re.hint,children:o})]}),Ta("a",{className:Re.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[ha("span",{className:Re.brand,children:"AI"}),ha("span",{className:Re.badge,children:"Autocomplete"})]})]})})}import{useEffect as Ja,useLayoutEffect as ni,useRef as le}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
2114
2114
  Angular copy). The three are kept identical by
2115
2115
  packages/vanilla/tests/render/locationFieldParity.test.ts. */
2116
2116
  .aia-location-6-fsr {
@@ -2244,7 +2244,7 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
2244
2244
  .aia-loadingBar-OLCr4:nth-child(3) {
2245
2245
  width: 60%;
2246
2246
  }
2247
- `,document.head.appendChild(e)}var _={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 He}from"react/jsx-runtime";var ni=0;function ha(e){return e.getRootNode().activeElement??null}function at(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Ja(e){if(!e.isContentEditable)return null;let n=at(e);if(!n||n.rangeCount===0)return null;let a=n.getRangeAt(0);return e.contains(a.startContainer)?a.cloneRange():null}function et(e,n){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let a=at(e);if(!a)return;let t=n;(!t||!t.startContainer.isConnected||!e.contains(t.startContainer))&&(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1)),a.removeAllRanges(),a.addRange(t)}var ri=He("svg",{className:_.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"})]}),si=He("svg",{className:_.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 tt({view:e,searchLabel:n,noResultsLabel:a,useTypedLabel:t,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:w,onMove:v,onCommit:y,onFocusChange:b}){let h=le(null),p=le(null),x=le(null),E=le(null),q=le(null),M=le(!1),R=le(!1),ae=le(!1),T=le(!1),z=le(o);z.current=o;let U=le(b);U.current=b;let H=c=>{T.current=c,b(c)},te=()=>{let c=h.current;return c!=null&&ha(c)===c},Q=()=>{let c=p.current;if(!c)return;let S=ha(c);S instanceof HTMLElement&&S!==h.current&&S!==document.body&&!c.contains(S)&&(E.current=S,q.current=Ja(S))},I=c=>{let S=p.current;!S||!(c instanceof HTMLElement)||c===E.current||c===document.body||S.contains(c)||(E.current=c,q.current=Ja(c))},B=le(null);B.current===null&&(B.current=`aia-location-${++ni}`);let W=`${B.current}-row-`;Xa(()=>{let c=h.current;c&&c.value!==e.query&&ha(c)!==c&&(c.value=e.query)},[e.query]),Xa(()=>{o&&(s&&!ae.current&&(R.current=!1),ae.current=s);let c=h.current;if(c){if(!r&&te()){R.current=!0,Y();return}if(!o){setTimeout(()=>{if(z.current)return;let S=E.current;S&&ha(S)===S||(R.current=!1)},0);return}if(!(!s||R.current||!l||te())){if(Q(),H(!0),c.focus({preventScroll:!0}),!te()){R.current=!0,H(!1);return}c.value&&c.select()}}}),oi(()=>()=>{if(!T.current)return;let c=h.current,S=E.current;S?.isConnected&&c&&ha(c)===c&&(M.current=!0,et(S,q.current),M.current=!1),T.current=!1,U.current(!1)},[]);let Y=(c=!1)=>{c&&(R.current=!0);let S=E.current;S?.isConnected&&te()&&(M.current=!0,et(S,q.current),M.current=!1),H(!1)},re=e.query.trim(),P=e.highlighted>=0&&e.highlighted<e.places.length?`${W}${e.highlighted}`:void 0,D=null;return e.places.length>0?D=e.places.map((c,S)=>He("div",{id:`${W}${S}`,role:"option","aria-selected":S===e.highlighted,className:S===e.highlighted?`${_.row} ${_.highlighted}`:_.row,"data-aia-location-row":"","data-aia-index":S,onClick:()=>{l&&(Y(!0),y(S))},children:[ne("span",{className:_.pin,children:ri}),He("span",{className:_.text,children:[ne("span",{className:_.name,children:c.name}),c.secondary&&ne("span",{className:_.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?D=He("div",{className:_.loading,"data-aia-location-loading":"",children:[ne("span",{className:_.loadingBar}),ne("span",{className:_.loadingBar}),ne("span",{className:_.loadingBar})]}):re&&(D=He("div",{className:_.note,"data-aia-location-note":"",children:[e.status==="done"&&ne("span",{className:_.empty,children:a}),ne("span",{children:t})]})),He("div",{ref:p,className:_.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!x.current?.contains(c.target)||(c.stopPropagation(),Q(),H(!0))},children:[He("label",{ref:x,className:_.field,children:[si,ne("input",{ref:h,type:"text",className:_.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:n,"aria-label":n,"aria-activedescendant":P,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>w(c.target.value),onFocus:c=>{I(c.relatedTarget),H(!0)},onBlur:()=>{M.current||(R.current=!0,H(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),v(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!l)return;Y(!0),y();return;case"Escape":c.preventDefault(),c.stopPropagation(),R.current=!0,Y();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),R.current=!0,Y();return}}})]}),ne("div",{className:_.results,"data-aia-location-results":"","aria-live":"polite",children:D})]})}import{isSmartSuggestion as pi,isTraditionalAutocompleteSuggestion as hi}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as li}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,
2247
+ `,document.head.appendChild(e)}var _={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 Fe}from"react/jsx-runtime";var ri=0;function ua(e){return e.getRootNode().activeElement??null}function tt(e){return e.getRootNode().getSelection?.()??document.getSelection()}function et(e){if(!e.isContentEditable)return null;let n=tt(e);if(!n||n.rangeCount===0)return null;let a=n.getRangeAt(0);return e.contains(a.startContainer)?a.cloneRange():null}function at(e,n){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let a=tt(e);if(!a)return;let t=n;(!t||!t.startContainer.isConnected||!e.contains(t.startContainer))&&(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1)),a.removeAllRanges(),a.addRange(t)}var si=Fe("svg",{className:_.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"})]}),li=Fe("svg",{className:_.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 it({view:e,searchLabel:n,noResultsLabel:a,useTypedLabel:t,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:w,onMove:v,onCommit:y,onFocusChange:f}){let h=le(null),p=le(null),k=le(null),x=le(null),W=le(null),D=le(!1),R=le(!1),ae=le(!1),T=le(!1),z=le(o);z.current=o;let U=le(f);U.current=f;let N=d=>{T.current=d,f(d)},te=()=>{let d=h.current;return d!=null&&ua(d)===d},X=()=>{let d=p.current;if(!d)return;let P=ua(d);P instanceof HTMLElement&&P!==h.current&&P!==document.body&&!d.contains(P)&&(x.current=P,W.current=et(P))},E=d=>{let P=p.current;!P||!(d instanceof HTMLElement)||d===x.current||d===document.body||P.contains(d)||(x.current=d,W.current=et(d))},Q=le(null);Q.current===null&&(Q.current=`aia-location-${++ri}`);let q=`${Q.current}-row-`;Ja(()=>{let d=h.current;d&&d.value!==e.query&&ua(d)!==d&&(d.value=e.query)},[e.query]),Ja(()=>{o&&(s&&!ae.current&&(R.current=!1),ae.current=s);let d=h.current;if(d){if(!r&&te()){R.current=!0,B();return}if(!o){setTimeout(()=>{if(z.current)return;let P=x.current;P&&ua(P)===P||(R.current=!1)},0);return}if(!(!s||R.current||!l||te())){if(X(),N(!0),d.focus({preventScroll:!0}),!te()){R.current=!0,N(!1);return}d.value&&d.select()}}}),ni(()=>()=>{if(!T.current)return;let d=h.current,P=x.current;P?.isConnected&&d&&ua(d)===d&&(D.current=!0,at(P,W.current),D.current=!1),T.current=!1,U.current(!1)},[]);let B=(d=!1)=>{d&&(R.current=!0);let P=x.current;P?.isConnected&&te()&&(D.current=!0,at(P,W.current),D.current=!1),N(!1)},re=e.query.trim(),S=e.highlighted>=0&&e.highlighted<e.places.length?`${q}${e.highlighted}`:void 0,H=null;return e.places.length>0?H=e.places.map((d,P)=>Fe("div",{id:`${q}${P}`,role:"option","aria-selected":P===e.highlighted,className:P===e.highlighted?`${_.row} ${_.highlighted}`:_.row,"data-aia-location-row":"","data-aia-index":P,onClick:()=>{l&&(B(!0),y(P))},children:[ne("span",{className:_.pin,children:si}),Fe("span",{className:_.text,children:[ne("span",{className:_.name,children:d.name}),d.secondary&&ne("span",{className:_.secondary,children:d.secondary})]})]},d.id)):e.status==="loading"?H=Fe("div",{className:_.loading,"data-aia-location-loading":"",children:[ne("span",{className:_.loadingBar}),ne("span",{className:_.loadingBar}),ne("span",{className:_.loadingBar})]}):re&&(H=Fe("div",{className:_.note,"data-aia-location-note":"",children:[e.status==="done"&&ne("span",{className:_.empty,children:a}),ne("span",{children:t})]})),Fe("div",{ref:p,className:_.location,"data-aia-location":"",onMouseDown:d=>{!(d.target instanceof Node)||!k.current?.contains(d.target)||(d.stopPropagation(),X(),N(!0))},children:[Fe("label",{ref:k,className:_.field,children:[li,ne("input",{ref:h,type:"text",className:_.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:n,"aria-label":n,"aria-activedescendant":S,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:d=>w(d.target.value),onFocus:d=>{E(d.relatedTarget),N(!0)},onBlur:()=>{D.current||(R.current=!0,N(!1))},onKeyDown:d=>{if(!d.nativeEvent.isComposing)switch(d.key){case"ArrowDown":case"ArrowUp":d.preventDefault(),v(d.key==="ArrowDown"?1:-1);return;case"Enter":if(d.preventDefault(),!l)return;B(!0),y();return;case"Escape":d.preventDefault(),d.stopPropagation(),R.current=!0,B();return;case"Backspace":if(d.currentTarget.value!=="")return;d.preventDefault(),R.current=!0,B();return}}})]}),ne("div",{className:_.results,"data-aia-location-results":"","aria-live":"polite",children:H})]})}import{isSmartSuggestion as hi,isTraditionalAutocompleteSuggestion as ui}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as di}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,
2248
2248
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
2249
2249
  The border is kept as a 1px transparent line so the box stays the same size
2250
2250
  as it was when the outline was dashed. */
@@ -2402,7 +2402,7 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
2402
2402
  opacity: 0;
2403
2403
  }
2404
2404
  }
2405
- `,document.head.appendChild(e)}var ve={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 di,jsx as Ta,jsxs as ci}from"react/jsx-runtime";var Pa={selected:1,first:.7,next:.4,last:.2};function it({label:e,state:n,active:a,rounded:t,loading:o,smartSuggestion:s,completionHeader:r,onClick:l}){let w=[ve.pill,t?ve.rounded:"",o?ve.skeleton:""].filter(Boolean).join(" ");return Ta("button",{type:"button","data-aia-pill":"","data-aia-pill-active":a?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:w,style:{"--aia-pill-opacity":Pa[n]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:l,disabled:o,children:s?ci(di,{children:[Ta("span",{className:`${ve.smartText} magicx-aia-smart-suggestion-text`,children:e}),Ta("span",{className:`${ve.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:li}})]}):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 {
2405
+ `,document.head.appendChild(e)}var we={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 ci,jsx as Pa,jsxs as pi}from"react/jsx-runtime";var Ia={selected:1,first:.7,next:.4,last:.2};function ot({label:e,state:n,active:a,rounded:t,loading:o,smartSuggestion:s,completionHeader:r,onClick:l}){let w=[we.pill,t?we.rounded:"",o?we.skeleton:""].filter(Boolean).join(" ");return Pa("button",{type:"button","data-aia-pill":"","data-aia-pill-active":a?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:w,style:{"--aia-pill-opacity":Ia[n]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:l,disabled:o,children:s?pi(ci,{children:[Pa("span",{className:`${we.smartText} magicx-aia-smart-suggestion-text`,children:e}),Pa("span",{className:`${we.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:di}})]}):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 {
2406
2406
  position: relative;
2407
2407
  z-index: 1;
2408
2408
  pointer-events: auto;
@@ -2412,7 +2412,7 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
2412
2412
  align-items: center;
2413
2413
  vertical-align: middle;
2414
2414
  }
2415
- `,document.head.appendChild(e)}var Ia={list:"aia-list-qvLqO"};import{jsx as fa}from"react/jsx-runtime";var ui=[125,69];function ot(e){return e===0?"first":e===1?"next":"last"}function ba({pills:e,activePillIndex:n,onSelectPill:a,activeSelected:t,rounded:o,loading:s}){return s&&e.length===0?fa("span",{className:Ia.list,"data-aia-pill-list-loading":"",children:ui.map((r,l)=>fa("span",{"data-aia-pill-skeleton":"",className:`${ve.pill} ${o?ve.rounded:""} ${ve.skeleton}`,style:{width:r,"--aia-pill-opacity":Pa[ot(l)]}},`skel-${r}`))}):fa("span",{className:Ia.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,l)=>{let w=!!t&&l===n;return fa(it,{label:r.text,state:w?"selected":ot(l),selected:w,active:l===n,rounded:o,loading:s,smartSuggestion:pi(r),completionHeader:hi(r),onClick:()=>a(l)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as mi,productImageSources as gi,productImageSrc as fi,productInitial as bi,productPhotoFill as wi,uiStringsFor as vi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ea,useRef as wa,useState as va}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
2415
+ `,document.head.appendChild(e)}var Ea={list:"aia-list-qvLqO"};import{jsx as ba}from"react/jsx-runtime";var mi=[125,69];function nt(e){return e===0?"first":e===1?"next":"last"}function wa({pills:e,activePillIndex:n,onSelectPill:a,activeSelected:t,rounded:o,loading:s}){return s&&e.length===0?ba("span",{className:Ea.list,"data-aia-pill-list-loading":"",children:mi.map((r,l)=>ba("span",{"data-aia-pill-skeleton":"",className:`${we.pill} ${o?we.rounded:""} ${we.skeleton}`,style:{width:r,"--aia-pill-opacity":Ia[nt(l)]}},`skel-${r}`))}):ba("span",{className:Ea.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,l)=>{let w=!!t&&l===n;return ba(ot,{label:r.text,state:w?"selected":nt(l),selected:w,active:l===n,rounded:o,loading:s,smartSuggestion:hi(r),completionHeader:ui(r),onClick:()=>a(l)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as gi,productImageSources as fi,productImageSrc as bi,productInitial as wi,productPhotoFill as vi,uiStringsFor as xi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Aa,useRef as va,useState as xa}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
2416
2416
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
2417
2417
  theming one package sees the same result in the other.
2418
2418
 
@@ -3005,7 +3005,7 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
3005
3005
  opacity: 0.01;
3006
3006
  }
3007
3007
  }
3008
- `,document.head.appendChild(e)}var V={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 Xe}from"react/jsx-runtime";function nt({products:e,listboxId:n,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s=!0,loading:r=!1,layout:l="row",imageFallback:w="image",strings:v=vi()}){let y=e.length>0,b=wa(null);if(Ea(()=>{let p=b.current;if(!(!y||!p))return mi(p)},[y]),!y)return null;let h=`${n}-products-label`;return Xe("section",{className:V.section,"data-aia-products":"","data-aia-loading":r?"":void 0,"data-aia-products-layout":l,role:"group","aria-labelledby":h,children:[J("div",{className:V.label,id:h,"data-aia-products-label":"",children:v.products}),J("div",{ref:b,className:V.row,"data-aia-products-row":"",children:e.map((p,x)=>J(xi,{product:p,id:`${n}-product-${x}`,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s,imageFallback:w,soldOut:v.soldOut,addToCart:v.addToCart},p.id))})]})}function xi({product:e,id:n,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s,imageFallback:r,soldOut:l,addToCart:w}){let v=!!t&&e.available!==!1,[y,b]=va(null),h=x=>{x.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},p=x=>{x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||x.button!==0||(x.preventDefault(),a(e))};return Xe("a",{id:n,className:V.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":v?"":void 0,role:"option","aria-selected":!1,style:y?{"--aia-product-photo-fill-x":String(y.x),"--aia-product-photo-fill-y":String(y.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:p,onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),a(e))},onFocus:()=>o?.(!0),onBlur:h,children:[J(Ci,{sources:gi(e.imageUrl),title:e.title,fallback:r,onPhotoFill:b},fi(e.imageUrl)??""),Xe("span",{className:V.body,children:[e.vendor?J("span",{className:V.vendor,children:e.vendor}):null,J("span",{className:V.title,children:e.title}),e.price?Xe("span",{className:V.price,children:[e.price,e.compareAtPrice?J("s",{className:V.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?J("span",{className:V.badge,children:l}):null]}),v&&t?J(ki,{product:e,label:`${w}: ${e.title}`,focusable:s,onAddToCart:t,onFocus:()=>o?.(!0),onBlur:h},yi(e)):null]})}function yi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(n=>n??"").join("\0")}function ki({product:e,label:n,focusable:a,onAddToCart:t,onFocus:o,onBlur:s}){let[r,l]=va(null),w=wa(null),v=wa(e);v.current=e;let y=wa(!0);Ea(()=>(y.current=!0,()=>{y.current=!1}),[]);let b=p=>{w.current=p,y.current&&l(p)},h=p=>{if(p.preventDefault(),p.stopPropagation(),w.current==="adding")return;b("adding");let x;try{x=Promise.resolve(t(v.current))}catch(E){x=Promise.reject(E)}x.then(()=>b("added"),()=>b(null))};return J("span",{className:V.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":n,tabIndex:a?0:-1,onClick:h,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||h(p)},onFocus:p=>{p.stopPropagation(),o()},onBlur:p=>{p.stopPropagation(),s(p)},children:Xe("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[J("path",{className:V.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:V.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),J("path",{className:V.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),J("path",{className:V.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),J("circle",{className:V.cartGlyph,cx:"9",cy:"20",r:"1.3"}),J("circle",{className:V.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ci({sources:e,title:n,fallback:a,onPhotoFill:t}){let[o,s]=va(0),r=e[o],l=!!r,[w,v]=va(null),y=!l&&a==="initial";return Ea(()=>()=>t(null),[t]),Xe("span",{className:V.media,"aria-hidden":"true","data-aia-product-placeholder":!l&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":l&&w===r?"":void 0,children:[l?J("img",{className:V.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:b=>{v(r),t(wi(b.currentTarget.naturalWidth,b.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&t(null),s(b=>b+1)}}):null,y?bi(n):null]})}import{isOptionsGridMobileViewport as Hi,measureOptionsGrid as Fi,needsOptionsGridMeasurement as Bi,OPTIONS_GRID_MOBILE_QUERY as Wi,optionEnterDelayMs as Gi,optionsShowLeadingVisuals as Ki,planOptionsGrid as ct,releasePanelHug as qi,sameOptionRows as _i,syncPanelHug as Vi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ui,useLayoutEffect as pt,useRef as ht,useState as mt}from"react";import{optionsGridTemplateColumns as Si}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Ti,useRef as Pi}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 {
3008
+ `,document.head.appendChild(e)}var V={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 Je}from"react/jsx-runtime";function rt({products:e,listboxId:n,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s=!0,loading:r=!1,layout:l="row",imageFallback:w="image",showVendor:v=!0,strings:y=xi()}){let f=e.length>0,h=va(null);if(Aa(()=>{let k=h.current;if(!(!f||!k))return gi(k)},[f]),!f)return null;let p=`${n}-products-label`;return Je("section",{className:V.section,"data-aia-products":"","data-aia-loading":r?"":void 0,"data-aia-products-layout":l,role:"group","aria-labelledby":p,children:[J("div",{className:V.label,id:p,"data-aia-products-label":"",children:y.products}),J("div",{ref:h,className:V.row,"data-aia-products-row":"",children:e.map((k,x)=>J(yi,{product:k,id:`${n}-product-${x}`,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s,imageFallback:w,showVendor:v,soldOut:y.soldOut,addToCart:y.addToCart},k.id))})]})}function yi({product:e,id:n,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s,imageFallback:r,showVendor:l,soldOut:w,addToCart:v}){let y=!!t&&e.available!==!1,[f,h]=xa(null),p=x=>{x.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},k=x=>{x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||x.button!==0||(x.preventDefault(),a(e))};return Je("a",{id:n,className:V.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":y?"":void 0,role:"option","aria-selected":!1,style:f?{"--aia-product-photo-fill-x":String(f.x),"--aia-product-photo-fill-y":String(f.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:k,onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),a(e))},onFocus:()=>o?.(!0),onBlur:p,children:[J(Si,{sources:fi(e.imageUrl),title:e.title,fallback:r,onPhotoFill:h},bi(e.imageUrl)??""),Je("span",{className:V.body,children:[l&&e.vendor?J("span",{className:V.vendor,children:e.vendor}):null,J("span",{className:V.title,children:e.title}),e.price?Je("span",{className:V.price,children:[e.price,e.compareAtPrice?J("s",{className:V.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?J("span",{className:V.badge,children:w}):null]}),y&&t?J(Ci,{product:e,label:`${v}: ${e.title}`,focusable:s,onAddToCart:t,onFocus:()=>o?.(!0),onBlur:p},ki(e)):null]})}function ki(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(n=>n??"").join("\0")}function Ci({product:e,label:n,focusable:a,onAddToCart:t,onFocus:o,onBlur:s}){let[r,l]=xa(null),w=va(null),v=va(e);v.current=e;let y=va(!0);Aa(()=>(y.current=!0,()=>{y.current=!1}),[]);let f=p=>{w.current=p,y.current&&l(p)},h=p=>{if(p.preventDefault(),p.stopPropagation(),w.current==="adding")return;f("adding");let k;try{k=Promise.resolve(t(v.current))}catch(x){k=Promise.reject(x)}k.then(()=>f("added"),()=>f(null))};return J("span",{className:V.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":n,tabIndex:a?0:-1,onClick:h,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||h(p)},onFocus:p=>{p.stopPropagation(),o()},onBlur:p=>{p.stopPropagation(),s(p)},children:Je("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[J("path",{className:V.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:V.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),J("path",{className:V.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),J("path",{className:V.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),J("circle",{className:V.cartGlyph,cx:"9",cy:"20",r:"1.3"}),J("circle",{className:V.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Si({sources:e,title:n,fallback:a,onPhotoFill:t}){let[o,s]=xa(0),r=e[o],l=!!r,[w,v]=xa(null),y=!l&&a==="initial";return Aa(()=>()=>t(null),[t]),Je("span",{className:V.media,"aria-hidden":"true","data-aia-product-placeholder":!l&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":l&&w===r?"":void 0,children:[l?J("img",{className:V.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:f=>{v(r),t(vi(f.currentTarget.naturalWidth,f.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&t(null),s(f=>f+1)}}):null,y?wi(n):null]})}import{isOptionsGridMobileViewport as Fi,measureOptionsGrid as Bi,needsOptionsGridMeasurement as Wi,OPTIONS_GRID_MOBILE_QUERY as Gi,optionEnterDelayMs as Ki,optionsShowLeadingVisuals as qi,planOptionsGrid as pt,releasePanelHug as _i,sameOptionRows as Vi,syncPanelHug as Ui}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Qi,useLayoutEffect as ht,useRef as ut,useState as gt}from"react";import{optionsGridTemplateColumns as Ti}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Pi,useRef as Ii}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 {
3009
3009
  display: grid;
3010
3010
  grid-template-columns: repeat(
3011
3011
  auto-fit,
@@ -3049,7 +3049,7 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
3049
3049
  :where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
3050
3050
  max-height: var(--aia-grid-max-height, 120px);
3051
3051
  }
3052
- `,document.head.appendChild(e)}import{jsx as Ii}from"react/jsx-runtime";function rt({min:e="16rem",max:n,gap:a,scroll:t=!1,maxHeight:o,scrollResetKey:s,cols:r,template:l,innerRef:w,className:v,children:y,...b}){let h=Pi(null);Ti(()=>{if(s===void 0)return;let x=h.current;x&&(x.scrollTop=0)},[s]);let p={"--aia-grid-min":e};return n&&(p["--aia-grid-max"]=n),a&&(p["--aia-grid-gap"]=a),o&&(p["--aia-grid-max-height"]=o),r&&(p.gridTemplateColumns=Si(r)),l&&(p.gridTemplateColumns=l),Ii("div",{ref:x=>{h.current=x,w?.(x)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":t||void 0,style:p,...b,children:y})}import{formatOptionCount as Ei,highlightParts as Ai,isMultiSelectToggleTap as Ri,OPTION_ENTER_DELAY_VAR as Oi,optionImageSources as st,optionLabel as lt,sanitizeOptionIconSvg as Li}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as zi,useMemo as Di,useRef as Mi,useState as ua}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 {
3052
+ `,document.head.appendChild(e)}import{jsx as Ei}from"react/jsx-runtime";function st({min:e="16rem",max:n,gap:a,scroll:t=!1,maxHeight:o,scrollResetKey:s,cols:r,template:l,innerRef:w,className:v,children:y,...f}){let h=Ii(null);Pi(()=>{if(s===void 0)return;let k=h.current;k&&(k.scrollTop=0)},[s]);let p={"--aia-grid-min":e};return n&&(p["--aia-grid-max"]=n),a&&(p["--aia-grid-gap"]=a),o&&(p["--aia-grid-max-height"]=o),r&&(p.gridTemplateColumns=Ti(r)),l&&(p.gridTemplateColumns=l),Ei("div",{ref:k=>{h.current=k,w?.(k)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":t||void 0,style:p,...f,children:y})}import{formatOptionCount as Ai,highlightParts as Ri,isMultiSelectToggleTap as Oi,OPTION_ENTER_DELAY_VAR as Li,optionImageSources as lt,optionLabel as dt,sanitizeOptionIconSvg as zi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Di,useMemo as Mi,useRef as Ni,useState as ma}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 {
3053
3053
  position: relative;
3054
3054
  /* Clip, not visible: the entrance rise below runs on the inner content,
3055
3055
  and a transformed box extends its scroll container's scrollable area.
@@ -3575,7 +3575,7 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
3575
3575
  border-radius: 6px;
3576
3576
  font-size: 11px;
3577
3577
  }
3578
- `,document.head.appendChild(e)}var Z={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",pressCompress:"aia-pressCompress-ICV3q",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"};import{Fragment as Ni,jsx as ce,jsxs as Aa}from"react/jsx-runtime";function dt({option:e,isHighlighted:n,checked:a,onSelect:t,onHighlight:o,onUnhighlight:s,id:r,loading:l,showIcon:w=!0,showImage:v=!0,showCount:y=!0,scrollHint:b,enterDelayMs:h=0}){let[p]=ua(h),[x,E]=ua(!1),q=v?st(e.image_url):[],M=q[0]??null,[R,ae]=ua([]),T=q.find(P=>!R.includes(P))??null,z=v?(e.imageCollage??[]).map(P=>st(P)[0]).filter(P=>P!==void 0):[],[U,H]=ua(!1),[te,Q]=ua(null),I=Di(()=>!M&&w&&e.icon_svg?Li(e.icon_svg):null,[M,w,e.icon_svg]),B=y?Ei(e.item_count):null,W=Mi(void 0);zi(()=>()=>clearTimeout(W.current),[]);let Y=P=>{if(l||!e.is_tappable||x&&a===void 0)return;E(!0);let D=P?.currentTarget;a!==void 0&&D!==void 0&&P!==void 0&&!Ri(D,D.querySelector("[data-aia-checkbox]"),P)?t(e,{commit:!0}):t(e),clearTimeout(W.current),W.current=setTimeout(()=>E(!1),170)},re=[Z.item,n&&!l?Z.highlighted:"",e.liveMatch&&!l?Z.liveMatch:"",e.is_tappable?Z.tappable:Z.nonTappable,x?Z.pressed:"",b?Z.scrollHint:""].filter(Boolean).join(" ");return ce("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":I&&e.icon?e.icon:void 0,"data-aia-image":M?"":void 0,"data-aia-item-count":B!==null?e.item_count:void 0,"aria-selected":a??n,className:re,style:{[Oi]:`${p}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:Y,onKeyDown:P=>{!l&&e.is_tappable&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),Y())},onMouseEnter:!l&&e.is_tappable?o:void 0,onMouseLeave:s,children:Aa("span",{className:Z.content,children:[a!==void 0&&e.is_tappable&&ce("span",{className:Z.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":a,children:a?"\u2713":""}),M&&z.length>1&&ce("span",{className:`${Z.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":z.length,"data-aia-image-loaded":U?"":void 0,children:z.map(P=>ce("img",{src:P,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>H(!0),onError:D=>{D.currentTarget.hidden=!0}},P))}),M&&z.length<=1&&ce("span",{className:`${Z.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":T!==null&&te===T?"":void 0,children:ce("img",{src:T??M,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:T===null,onLoad:()=>Q(T),onError:()=>{T!==null&&ae(P=>[...P,T])}})}),I&&ce("span",{className:`${Z.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:I}}),Aa("span",{className:Z.text,children:[e.matchedText?Ai(lt(e),e.matchedText).map((P,D)=>P.bold?ce("strong",{className:`${Z.match} magicx-aia-option-match`,"data-aia-match-partial":P.partial?"":void 0,children:P.text},D):P.text):lt(e),e.parameterLabel&&Aa(Ni,{children:[" ",ce("span",{className:`${Z.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&ce("span",{className:Z.tag,children:e.tag}),B!==null&&ce("span",{className:`${Z.count} magicx-aia-option-count`,children:B})]})})}import{jsx as ut}from"react/jsx-runtime";function Qi(){let[e,n]=mt(Hi);return Ui(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(Wi),t=()=>n(a.matches);return t(),a.addEventListener("change",t),()=>a.removeEventListener("change",t)},[]),e}function gt({options:e,activeIndex:n,picked:a,onSelect:t,onHighlight:o,onUnhighlight:s,listboxId:r,loading:l,groupKey:w="",optionsPosition:v="below",showIcons:y=!0,showImages:b=!0,showCounts:h=!0}){let p=Qi(),x=ht(null),[E,q]=mt(null),M=ht(null);pt(()=>{if(l&&_i(M.current,e))return;M.current=l?null:e;let T=x.current,z=T&&!l&&Bi(e.length,p),U=T?.closest("[data-aia-dropdown]");z&&U&&qi(U);let H=z?Fi(T):null;q(H?ct(e.length,p,H.rowWidths,H.gridWidth):null)},[e,p,l]);let R=E??ct(e.length,p,null,null);pt(()=>{let T=x.current?.closest("[data-aia-dropdown]");T&&Vi(T)},[R.template,p]);let ae=Ki(e,y,b);return ut(rt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:w,template:R.template,maxHeight:R.maxHeight,innerRef:T=>{x.current=T},"data-aia-group":w,children:e.map((T,z)=>ut(dt,{option:T,isHighlighted:z===n,checked:a?a.includes(T.text):void 0,onSelect:t,onHighlight:()=>o(z),onUnhighlight:s?()=>s(z):void 0,id:`${r}-option-${z}`,loading:l,showIcon:y&&ae,showImage:b&&ae,showCount:h,scrollHint:!l&&R.scrollHintIndices.includes(z),enterDelayMs:l?0:Gi(z,R.cols,e.length,v)},`${w}\0${T.parameter??""}\0${T.text}`))})}import{formatTime as Yi,TIME_WHEEL_COLUMNS as ji,TIME_WHEEL_ROW_HEIGHT as $i,timeWheelIndex as ft,timeWheelIndexFromScroll as Zi,timeWheelRows as Xi,withTimeWheelIndex as bt}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as Ji,useEffect as eo,useLayoutEffect as ao,useRef as xa}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) ---
3578
+ `,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",pressCompress:"aia-pressCompress-ICV3q",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"};import{Fragment as Hi,jsx as ce,jsxs as Ra}from"react/jsx-runtime";function ct({option:e,isHighlighted:n,checked:a,onSelect:t,onHighlight:o,onUnhighlight:s,id:r,loading:l,showIcon:w=!0,showImage:v=!0,showCount:y=!0,scrollHint:f,enterDelayMs:h=0}){let[p]=ma(h),[k,x]=ma(!1),W=v?lt(e.image_url):[],D=W[0]??null,[R,ae]=ma([]),T=W.find(S=>!R.includes(S))??null,z=v?(e.imageCollage??[]).map(S=>lt(S)[0]).filter(S=>S!==void 0):[],[U,N]=ma(!1),[te,X]=ma(null),E=Mi(()=>!D&&w&&e.icon_svg?zi(e.icon_svg):null,[D,w,e.icon_svg]),Q=y?Ai(e.item_count):null,q=Ni(void 0);Di(()=>()=>clearTimeout(q.current),[]);let B=S=>{if(l||!e.is_tappable||k&&a===void 0)return;x(!0);let H=S?.currentTarget;a!==void 0&&H!==void 0&&S!==void 0&&!Oi(H,H.querySelector("[data-aia-checkbox]"),S)?t(e,{commit:!0}):t(e),clearTimeout(q.current),q.current=setTimeout(()=>x(!1),170)},re=[$.item,n&&!l?$.highlighted:"",e.liveMatch&&!l?$.liveMatch:"",e.is_tappable?$.tappable:$.nonTappable,k?$.pressed:"",f?$.scrollHint:""].filter(Boolean).join(" ");return ce("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":E&&e.icon?e.icon:void 0,"data-aia-image":D?"":void 0,"data-aia-item-count":Q!==null?e.item_count:void 0,"aria-selected":a??n,className:re,style:{[Li]:`${p}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:B,onKeyDown:S=>{!l&&e.is_tappable&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),B())},onMouseEnter:!l&&e.is_tappable?o:void 0,onMouseLeave:s,children:Ra("span",{className:$.content,children:[a!==void 0&&e.is_tappable&&ce("span",{className:$.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":a,children:a?"\u2713":""}),D&&z.length>1&&ce("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":z.length,"data-aia-image-loaded":U?"":void 0,children:z.map(S=>ce("img",{src:S,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>N(!0),onError:H=>{H.currentTarget.hidden=!0}},S))}),D&&z.length<=1&&ce("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":T!==null&&te===T?"":void 0,children:ce("img",{src:T??D,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:T===null,onLoad:()=>X(T),onError:()=>{T!==null&&ae(S=>[...S,T])}})}),E&&ce("span",{className:`${$.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:E}}),Ra("span",{className:$.text,children:[e.matchedText?Ri(dt(e),e.matchedText).map((S,H)=>S.bold?ce("strong",{className:`${$.match} magicx-aia-option-match`,"data-aia-match-partial":S.partial?"":void 0,children:S.text},H):S.text):dt(e),e.parameterLabel&&Ra(Hi,{children:[" ",ce("span",{className:`${$.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&ce("span",{className:$.tag,children:e.tag}),Q!==null&&ce("span",{className:`${$.count} magicx-aia-option-count`,children:Q})]})})}import{jsx as mt}from"react/jsx-runtime";function Yi(){let[e,n]=gt(Fi);return Qi(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(Gi),t=()=>n(a.matches);return t(),a.addEventListener("change",t),()=>a.removeEventListener("change",t)},[]),e}function ft({options:e,activeIndex:n,picked:a,onSelect:t,onHighlight:o,onUnhighlight:s,listboxId:r,loading:l,groupKey:w="",optionsPosition:v="below",showIcons:y=!0,showImages:f=!0,showCounts:h=!0}){let p=Yi(),k=ut(null),[x,W]=gt(null),D=ut(null);ht(()=>{if(l&&Vi(D.current,e))return;D.current=l?null:e;let T=k.current,z=T&&!l&&Wi(e.length,p),U=T?.closest("[data-aia-dropdown]");z&&U&&_i(U);let N=z?Bi(T):null;W(N?pt(e.length,p,N.rowWidths,N.gridWidth):null)},[e,p,l]);let R=x??pt(e.length,p,null,null);ht(()=>{let T=k.current?.closest("[data-aia-dropdown]");T&&Ui(T)},[R.template,p]);let ae=qi(e,y,f);return mt(st,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:w,template:R.template,maxHeight:R.maxHeight,innerRef:T=>{k.current=T},"data-aia-group":w,children:e.map((T,z)=>mt(ct,{option:T,isHighlighted:z===n,checked:a?a.includes(T.text):void 0,onSelect:t,onHighlight:()=>o(z),onUnhighlight:s?()=>s(z):void 0,id:`${r}-option-${z}`,loading:l,showIcon:y&&ae,showImage:f&&ae,showCount:h,scrollHint:!l&&R.scrollHintIndices.includes(z),enterDelayMs:l?0:Ki(z,R.cols,e.length,v)},`${w}\0${T.parameter??""}\0${T.text}`))})}import{formatTime as ji,TIME_WHEEL_COLUMNS as $i,TIME_WHEEL_ROW_HEIGHT as Zi,timeWheelIndex as bt,timeWheelIndexFromScroll as Xi,timeWheelRows as Ji,withTimeWheelIndex as wt}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as eo,useEffect as ao,useLayoutEffect as to,useRef as ya}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) ---
3579
3579
 
3580
3580
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
3581
3581
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -3697,7 +3697,7 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
3697
3697
  .aia-done-llNY5:hover {
3698
3698
  background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
3699
3699
  }
3700
- `,document.head.appendChild(e)}var pe={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 Ue,jsxs as Ra}from"react/jsx-runtime";var to=120;function wt({view:e,label:n,doneLabel:a,interactive:t=!0,onTimeChange:o,onTimeCommit:s}){return Ra("div",{className:pe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":n,onMouseDown:r=>r.preventDefault(),children:[Ue("span",{className:pe.value,"data-aia-time-value":"","aria-live":"polite",children:Yi(e.minutes)}),Ra("div",{className:pe.columns,"aria-hidden":"true",children:[Ue("div",{className:pe.band}),ji.map(r=>Ra(Ji,{children:[r==="minute"&&Ue("span",{className:pe.separator,children:":"}),Ue(io,{column:r,minutes:e.minutes,interactive:t,onTimeChange:o})]},r))]}),Ue("button",{type:"button",tabIndex:-1,className:pe.done,"data-aia-time-done":"",onClick:()=>{t&&s()},children:a})]})}function io({column:e,minutes:n,interactive:a,onTimeChange:t}){let o=xa(null),s=xa(null),r=xa(null),l=xa({minutes:n,interactive:a,onTimeChange:t});l.current={minutes:n,interactive:a,onTimeChange:t};let w=ft(e,n);ao(()=>{let b=o.current;if(!b||r.current)return;let h=w*$i;Math.abs(b.scrollTop-h)<1||(s.current=h,b.scrollTop=h)},[w]),eo(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let b=o.current,h=l.current;if(!b||!h.interactive)return;let p=Zi(e,b.scrollTop);p!==ft(e,h.minutes)&&h.onTimeChange(bt(e,h.minutes,p))},y=()=>{let b=o.current;if(b){if(s.current!=null&&Math.abs(b.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,to)}};return Ue("div",{ref:o,className:pe.column,"data-aia-time-column":e,onScroll:y,children:Xi(e).map((b,h)=>Ue("div",{className:h===w?`${pe.row} ${pe.selected}`:pe.row,"data-aia-time-row":"","data-aia-index":h,onClick:()=>{l.current.interactive&&t(bt(e,l.current.minutes,h))},children:b.label},b.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3700
+ `,document.head.appendChild(e)}var pe={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 Qe,jsxs as Oa}from"react/jsx-runtime";var io=120;function vt({view:e,label:n,doneLabel:a,interactive:t=!0,onTimeChange:o,onTimeCommit:s}){return Oa("div",{className:pe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":n,onMouseDown:r=>r.preventDefault(),children:[Qe("span",{className:pe.value,"data-aia-time-value":"","aria-live":"polite",children:ji(e.minutes)}),Oa("div",{className:pe.columns,"aria-hidden":"true",children:[Qe("div",{className:pe.band}),$i.map(r=>Oa(eo,{children:[r==="minute"&&Qe("span",{className:pe.separator,children:":"}),Qe(oo,{column:r,minutes:e.minutes,interactive:t,onTimeChange:o})]},r))]}),Qe("button",{type:"button",tabIndex:-1,className:pe.done,"data-aia-time-done":"",onClick:()=>{t&&s()},children:a})]})}function oo({column:e,minutes:n,interactive:a,onTimeChange:t}){let o=ya(null),s=ya(null),r=ya(null),l=ya({minutes:n,interactive:a,onTimeChange:t});l.current={minutes:n,interactive:a,onTimeChange:t};let w=bt(e,n);to(()=>{let f=o.current;if(!f||r.current)return;let h=w*Zi;Math.abs(f.scrollTop-h)<1||(s.current=h,f.scrollTop=h)},[w]),ao(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let f=o.current,h=l.current;if(!f||!h.interactive)return;let p=Xi(e,f.scrollTop);p!==bt(e,h.minutes)&&h.onTimeChange(wt(e,h.minutes,p))},y=()=>{let f=o.current;if(f){if(s.current!=null&&Math.abs(f.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,io)}};return Qe("div",{ref:o,className:pe.column,"data-aia-time-column":e,onScroll:y,children:Ji(e).map((f,h)=>Qe("div",{className:h===w?`${pe.row} ${pe.selected}`:pe.row,"data-aia-time-row":"","data-aia-index":h,onClick:()=>{l.current.interactive&&t(wt(e,l.current.minutes,h))},children:f.label},f.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3701
3701
  display: flex;
3702
3702
  flex-direction: column;
3703
3703
  gap: var(--aia-stack-space, 0.5rem);
@@ -3712,7 +3712,7 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
3712
3712
  align-items: end;
3713
3713
  }
3714
3714
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
3715
- `,document.head.appendChild(e)}import{jsx as oo}from"react/jsx-runtime";function vt({space:e,align:n="stretch",className:a,children:t,...o}){let s=e?{"--aia-stack-space":e}:void 0;return oo("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":n,style:s,...o,children:t})}import{jsx as X,jsxs as Oa}from"react/jsx-runtime";var ko=typeof window>"u"?Qe:La,Co=[159,119,164],So=()=>{},xt=()=>{},To=e=>{},Po=()=>{},Io=e=>{},Eo=e=>{},Ao=e=>{},Ro=e=>{};function Oo(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,t]=yo(n);if(Qe(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>t(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function Lo(e,n){let a=Je(null);Qe(()=>{let t=e.current,o=n.current;if(!t||!o)return;let s=bo(t,".aia-grid[data-scroll]");if(a.current&&a.current.grid!==s&&(a.current.controller.destroy(),a.current=null),s&&!a.current){a.current={grid:s,controller:no({dropdown:t,grid:s,button:o})};return}a.current?.controller.update()}),Qe(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function zo(e,n){let a=Je(n);a.current=n;let t=Je(null);La(()=>{let o=e.current;if(o){if(!t.current){t.current=ro({dropdown:o,isOpen:()=>a.current});return}t.current.update()}}),Qe(()=>()=>{t.current?.destroy(),t.current=null},[])}function za({suggestions:e,activeIndex:n,onSelect:a,onHighlight:t,onUnhighlight:o,isOpen:s,id:r,className:l,pills:w,onPillClick:v,showPills:y=!0,onSkip:b,showSkipButton:h=!0,showOptionIcons:p=!0,showOptionImages:x=!0,showOptionCounts:E=!0,skipDisabled:q=!1,activeSelected:M=!1,isLoading:R=!1,skeletonExiting:ae=!1,isInputEmpty:T=!1,language:z,products:U,onProductSelect:H,onProductAddToCart:te,onProductFocusChange:Q,productsLayout:I="row",productImageFallback:B="image",formatType:W="options",dateView:Y=null,selectedDateIso:re=null,selectedDateRange:P=null,dateRangeStart:D=null,dateReferences:c,onPreviousMonth:S,onNextMonth:Fe,timeView:xe=null,multiSelectView:f=null,onMultiSelectCommit:Be,onSeeAllResults:ye,fullWidth:Oe=!1,onTimeChange:Le,onTimeCommit:ze,locationView:ke=null,isReediting:g=!1,onLocationQuery:k,onLocationMove:C,onLocationCommit:A,onLocationFocusChange:L,isFocused:j=!1,optionsPosition:ie="below",mode:ue}){let de=Oo(ue),We=de!==void 0,$=Je(null),Ce=Je(null);Lo($,Ce),Qe(()=>{if($.current)return so($.current)},[]);let Ge=e[0]?.options??[],na=!!(w&&w.length>0&&v),me=!!(U&&U.length>0),Ye=W==="time"&&xe!=null,De=W==="location"&&ke!=null,m=s&&(Ge.length>0||y&&na||R||me||Ye||De);zo($,m),ko(()=>{let O=$.current;O&&(ho(O,po(O)),vo(O))});let Se={suggestions:e,activeIndex:n,pills:w,showPills:y,showSkipButton:h,showOptionIcons:p,showOptionImages:x,showOptionCounts:E,skipDisabled:q,activeSelected:M,isLoading:R,skeletonExiting:ae,isInputEmpty:T,products:U,formatType:W,dateView:Y,selectedDateIso:re,selectedDateRange:P,dateRangeStart:D,dateReferences:c,timeView:xe,multiSelectView:f,locationView:ke,isReediting:g,showsSeeAll:!!ye},Ke=Je(Se);m&&(Ke.current=Se);let i=m?Se:Ke.current,u=xo(z),Te=i.suggestions[0],Pe=Te?.options??[],ge=i.activeIndex>=0&&!!Pe[i.activeIndex]?.is_tappable,Ie=go(i.pills??[],u.keepTyping),Me=!!(Ie.length>0&&v),fe=i.showPills&&Me,ra=i.showPills&&!Me&&i.isLoading,Ee=fe||ra,be=Me&&uo(Ie)&&i.showSkipButton&&!i.isInputEmpty&&!!b,Ne=Ie[0]?.text,qe=mo(i.formatType)&&i.dateView!=null,je=Pe.length>0&&!qe,Ae=Pe.length>0&&qe&&!i.isLoading,_e=i.formatType==="time"&&i.timeView!=null&&!i.isLoading,d=i.formatType==="location"&&i.locationView!=null&&!i.isLoading,G=i.isLoading&&!je&&!Ae&&!_e&&!d,N=i.products??[],$e=fo(fe?Ie:[]);return La(()=>{$.current&&wo($.current,$e,{visible:m,anchorBottom:ie==="above"})},[$e,m,ie,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,I,z]),Qe(()=>{let O=$.current;return()=>{O&&co(O)}},[]),Oa("div",{ref:$,id:r,role:"listbox","aria-multiselectable":!!i.multiSelectView,"data-aia-dropdown":"","data-options-position":ie,"data-mode":de,"data-aia-loading":i.isLoading?"":void 0,"data-aia-skeleton-exiting":i.skeletonExiting?"":void 0,"data-aia-has-products":N.length>0?"":void 0,"data-aia-full-width":Oe?"":void 0,className:`${We?"magicx-aia ":""}${se.dropdown} ${m?se.visible:""} ${l??""}`,onMouseDown:O=>O.preventDefault(),children:[Oa(vt,{space:"8px",children:[(Ee||be)&&Oa(ca,{noWrap:!0,className:se.pillBar,"data-aia-pillbar":"",children:[Ee&&X("span",{className:se.pillScroll,"data-aia-pill-scroll":"",children:X(ba,{pills:Ie,activePillIndex:0,activeSelected:i.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:i.isLoading})}),be&&X("button",{type:"button",tabIndex:-1,className:se.skip,"data-aia-skip":"",disabled:i.isLoading||i.skipDisabled,"aria-label":Ne?`${u.skipLabel} ${Ne}`:u.skipLabel,onClick:b,children:u.skip})]}),je&&X(gt,{options:Pe,activeIndex:i.activeIndex,onSelect:a,onHighlight:t,onUnhighlight:o,listboxId:r,loading:i.isLoading,groupKey:Te?`${Te.parameter} ${Te.text}`:"",optionsPosition:ie,showIcons:i.showOptionIcons,showImages:i.showOptionImages,showCounts:i.showOptionCounts,picked:i.multiSelectView?.picked}),i.multiSelectView&&X("div",{"data-aia-multi-actions":"",onClick:O=>{O.target.closest("[data-aia-multi-done]")&&!i.skipDisabled&&!i.isLoading&&Be?.()},children:X("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:se.multiDone,ref:O=>{O&&(O.disabled=!0,O.offsetHeight,O.disabled=i.skipDisabled||i.isLoading)},children:u.done})}),Ae&&i.dateView&&X(ja,{options:Pe,activeIndex:i.activeIndex,listboxId:r,view:i.dateView,selection:{selectedIso:i.selectedDateIso??null,selectedRange:i.selectedDateRange??null,rangeStart:i.dateRangeStart??null,floor:lo(i.formatType,i.dateRangeStart),references:i.dateReferences??[]},onSelect:a,onHighlight:t,onUnhighlight:o,onPreviousMonth:S??xt,onNextMonth:Fe??xt}),_e&&i.timeView&&X(wt,{view:i.timeView,label:u.timeLabel,doneLabel:u.done,interactive:!i.skipDisabled,onTimeChange:Le??To,onTimeCommit:ze??Po}),d&&i.locationView&&X(tt,{view:i.locationView,searchLabel:u.locationSearch,noResultsLabel:u.locationNoResults,useTypedLabel:u.locationUseTyped,widgetFocused:j&&m,reediting:i.isReediting,visible:m,interactive:!i.skipDisabled,onQuery:k??Io,onMove:C??Eo,onCommit:A??Ao,onFocusChange:L??Ro}),G&&X("div",{className:se.skeletonBars,"data-aia-skeleton-bars":"",children:Co.map(O=>X("span",{className:se.skeletonBar,style:{width:O}},`bar-${O}`))}),X(nt,{products:N,listboxId:r,onSelect:H??So,onAddToCart:te,onFocusChange:Q,focusable:m&&!i.isLoading,loading:i.isLoading,layout:I,imageFallback:B,strings:u}),i.showsSeeAll&&X("div",{className:se.seeAllRow,"data-aia-see-all":"",onClick:O=>{O.target.closest("[data-aia-see-all-button]")&&(O.stopPropagation(),!i.isLoading&&ye?.())},children:X("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"",className:se.seeAll,ref:O=>{O&&(O.disabled=!0,O.offsetHeight,O.disabled=i.isLoading)},children:u.seeAllResults})}),X(Za,{isOptionHighlighted:ge,isInputEmpty:i.isInputEmpty,strings:u})]}),X("button",{ref:Ce,type:"button",tabIndex:-1,className:se.scrollArrow,"data-aia-scroll-arrow":"","aria-label":u.scrollArrow,"aria-hidden":"true",children:X("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:X("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Jo,ModeController as en,setCursorOffset as an,uiStringsFor as tn,watchEditorHeight as on}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as Do}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 {
3715
+ `,document.head.appendChild(e)}import{jsx as no}from"react/jsx-runtime";function xt({space:e,align:n="stretch",className:a,children:t,...o}){let s=e?{"--aia-stack-space":e}:void 0;return no("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":n,style:s,...o,children:t})}import{jsx as Z,jsxs as La}from"react/jsx-runtime";var Co=typeof window>"u"?Ye:za,So=[159,119,164],To=()=>{},yt=()=>{},Po=e=>{},Io=()=>{},Eo=e=>{},Ao=e=>{},Ro=e=>{},Oo=e=>{};function Lo(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,t]=ko(n);if(Ye(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>t(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function zo(e,n){let a=ea(null);Ye(()=>{let t=e.current,o=n.current;if(!t||!o)return;let s=wo(t,".aia-grid[data-scroll]");if(a.current&&a.current.grid!==s&&(a.current.controller.destroy(),a.current=null),s&&!a.current){a.current={grid:s,controller:ro({dropdown:t,grid:s,button:o})};return}a.current?.controller.update()}),Ye(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function Do(e,n){let a=ea(n);a.current=n;let t=ea(null);za(()=>{let o=e.current;if(o){if(!t.current){t.current=so({dropdown:o,isOpen:()=>a.current});return}t.current.update()}}),Ye(()=>()=>{t.current?.destroy(),t.current=null},[])}function Da({suggestions:e,activeIndex:n,onSelect:a,onHighlight:t,onUnhighlight:o,isOpen:s,id:r,className:l,pills:w,onPillClick:v,showPills:y=!0,onSkip:f,showSkipButton:h=!0,showOptionIcons:p=!0,showOptionImages:k=!0,showOptionCounts:x=!0,skipDisabled:W=!1,activeSelected:D=!1,isLoading:R=!1,skeletonExiting:ae=!1,isInputEmpty:T=!1,language:z,products:U,onProductSelect:N,onProductAddToCart:te,onProductFocusChange:X,productsLayout:E="row",productImageFallback:Q="image",showProductVendor:q=!0,formatType:B="options",dateView:re=null,selectedDateIso:S=null,selectedDateRange:H=null,dateRangeStart:d=null,dateReferences:P,onPreviousMonth:ve,onNextMonth:Be,timeView:xe=null,multiSelectView:b=null,onMultiSelectCommit:We,onSeeAllResults:ye,fullWidth:Oe=!1,onTimeChange:Le,onTimeCommit:ze,locationView:m=null,isReediting:C=!1,onLocationQuery:I,onLocationMove:A,onLocationCommit:L,onLocationFocusChange:Y,isFocused:de=!1,optionsPosition:ie="below",mode:De}){let ke=Lo(De),Ge=ke!==void 0,j=ea(null),Ce=ea(null);zo(j,Ce),Ye(()=>{if(j.current)return lo(j.current)},[]);let Ke=e[0]?.options??[],ra=!!(w&&w.length>0&&v),ue=!!(U&&U.length>0),je=B==="time"&&xe!=null,Me=B==="location"&&m!=null,g=s&&(Ke.length>0||y&&ra||R||ue||je||Me);Do(j,g),Co(()=>{let O=j.current;O&&(uo(O,ho(O)),xo(O))});let Se={suggestions:e,activeIndex:n,pills:w,showPills:y,showSkipButton:h,showOptionIcons:p,showOptionImages:k,showOptionCounts:x,skipDisabled:W,activeSelected:D,isLoading:R,skeletonExiting:ae,isInputEmpty:T,products:U,formatType:B,dateView:re,selectedDateIso:S,selectedDateRange:H,dateRangeStart:d,dateReferences:P,timeView:xe,multiSelectView:b,locationView:m,isReediting:C,showsSeeAll:!!ye},qe=ea(Se);g&&(qe.current=Se);let i=g?Se:qe.current,u=yo(z),Te=i.suggestions[0],Pe=Te?.options??[],me=i.activeIndex>=0&&!!Pe[i.activeIndex]?.is_tappable,Ie=fo(i.pills??[],u.keepTyping),Ne=!!(Ie.length>0&&v),ge=i.showPills&&Ne,sa=i.showPills&&!Ne&&i.isLoading,Ee=ge||sa,fe=Ne&&mo(Ie)&&i.showSkipButton&&!i.isInputEmpty&&!!f,He=Ie[0]?.text,_e=go(i.formatType)&&i.dateView!=null,$e=Pe.length>0&&!_e,Ae=Pe.length>0&&_e&&!i.isLoading,Ve=i.formatType==="time"&&i.timeView!=null&&!i.isLoading,c=i.formatType==="location"&&i.locationView!=null&&!i.isLoading,G=i.isLoading&&!$e&&!Ae&&!Ve&&!c,M=i.products??[],Ze=bo(ge?Ie:[]);return za(()=>{j.current&&vo(j.current,Ze,{visible:g,anchorBottom:ie==="above"})},[Ze,g,ie,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,E,z]),Ye(()=>{let O=j.current;return()=>{O&&po(O)}},[]),La("div",{ref:j,id:r,role:"listbox","aria-multiselectable":!!i.multiSelectView,"data-aia-dropdown":"","data-options-position":ie,"data-mode":ke,"data-aia-loading":i.isLoading?"":void 0,"data-aia-skeleton-exiting":i.skeletonExiting?"":void 0,"data-aia-has-products":M.length>0?"":void 0,"data-aia-full-width":Oe?"":void 0,className:`${Ge?"magicx-aia ":""}${se.dropdown} ${g?se.visible:""} ${l??""}`,onMouseDown:O=>O.preventDefault(),children:[La(xt,{space:"8px",children:[(Ee||fe)&&La(pa,{noWrap:!0,className:se.pillBar,"data-aia-pillbar":"",children:[Ee&&Z("span",{className:se.pillScroll,"data-aia-pill-scroll":"",children:Z(wa,{pills:Ie,activePillIndex:0,activeSelected:i.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:i.isLoading})}),fe&&Z("button",{type:"button",tabIndex:-1,className:se.skip,"data-aia-skip":"",disabled:i.isLoading||i.skipDisabled,"aria-label":He?`${u.skipLabel} ${He}`:u.skipLabel,onClick:f,children:u.skip})]}),$e&&Z(ft,{options:Pe,activeIndex:i.activeIndex,onSelect:a,onHighlight:t,onUnhighlight:o,listboxId:r,loading:i.isLoading,groupKey:Te?`${Te.parameter} ${Te.text}`:"",optionsPosition:ie,showIcons:i.showOptionIcons,showImages:i.showOptionImages,showCounts:i.showOptionCounts,picked:i.multiSelectView?.picked}),i.multiSelectView&&Z("div",{"data-aia-multi-actions":"",onClick:O=>{O.target.closest("[data-aia-multi-done]")&&!i.skipDisabled&&!i.isLoading&&We?.()},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:se.multiDone,ref:O=>{O&&(O.disabled=!0,O.offsetHeight,O.disabled=i.skipDisabled||i.isLoading)},children:u.done})}),Ae&&i.dateView&&Z($a,{options:Pe,activeIndex:i.activeIndex,listboxId:r,view:i.dateView,selection:{selectedIso:i.selectedDateIso??null,selectedRange:i.selectedDateRange??null,rangeStart:i.dateRangeStart??null,floor:co(i.formatType,i.dateRangeStart),references:i.dateReferences??[]},onSelect:a,onHighlight:t,onUnhighlight:o,onPreviousMonth:ve??yt,onNextMonth:Be??yt}),Ve&&i.timeView&&Z(vt,{view:i.timeView,label:u.timeLabel,doneLabel:u.done,interactive:!i.skipDisabled,onTimeChange:Le??Po,onTimeCommit:ze??Io}),c&&i.locationView&&Z(it,{view:i.locationView,searchLabel:u.locationSearch,noResultsLabel:u.locationNoResults,useTypedLabel:u.locationUseTyped,widgetFocused:de&&g,reediting:i.isReediting,visible:g,interactive:!i.skipDisabled,onQuery:I??Eo,onMove:A??Ao,onCommit:L??Ro,onFocusChange:Y??Oo}),G&&Z("div",{className:se.skeletonBars,"data-aia-skeleton-bars":"",children:So.map(O=>Z("span",{className:se.skeletonBar,style:{width:O}},`bar-${O}`))}),Z(rt,{products:M,listboxId:r,onSelect:N??To,onAddToCart:te,onFocusChange:X,focusable:g&&!i.isLoading,loading:i.isLoading,layout:E,imageFallback:Q,showVendor:q,strings:u}),i.showsSeeAll&&Z("div",{className:se.seeAllRow,"data-aia-see-all":"",onClick:O=>{O.target.closest("[data-aia-see-all-button]")&&(O.stopPropagation(),!i.isLoading&&ye?.())},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"",className:se.seeAll,ref:O=>{O&&(O.disabled=!0,O.offsetHeight,O.disabled=i.isLoading)},children:u.seeAllResults})}),Z(Xa,{isOptionHighlighted:me,isInputEmpty:i.isInputEmpty,strings:u})]}),Z("button",{ref:Ce,type:"button",tabIndex:-1,className:se.scrollArrow,"data-aia-scroll-arrow":"","aria-label":u.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,ModeController as an,setCursorOffset as tn,uiStringsFor as on,watchEditorHeight as nn}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as Mo}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 {
3716
3716
  flex-shrink: 0;
3717
3717
  width: 32px;
3718
3718
  height: 32px;
@@ -3783,5 +3783,5 @@ import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END a
3783
3783
  transition: none;
3784
3784
  }
3785
3785
  }
3786
- `,document.head.appendChild(e)}var yt={submitButton:"aia-submitButton-otz7H"};import{jsx as Da}from"react/jsx-runtime";function kt({disabled:e,ready:n,onClick:a,label:t=Do().submit}){return Da("button",{type:"button","data-aia-submit":"",className:yt.submitButton,disabled:e,"data-aia-ready":n?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":t,children:Da("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:Da("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Mo,dateSelectionFor as No,editingSuggestion as Ho,identifiedParamLabel as Fo,withoutTraditionalAutocomplete as Bo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as It,useEffect as ea,useMemo as Wo,useRef as ee,useState as Go}from"react";import{useRef as Ct}from"react";function St(e){let n=Ct(e);n.current=e;let a=Object.keys(e??{}).sort().join("\0"),t=Ct({key:"",overrides:void 0});if(t.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,w,v)=>{let y=n.current?.[s];return y?y(l,w,v):[]};o[s]=r}t.current={key:a,overrides:e?o:void 0}}return{overrides:t.current.overrides,key:a}}import{useRef as Tt}from"react";function Pt(e){let n=Tt(e);n.current=e;let a=Tt(null);a.current===null&&(a.current={fetch:(o,s)=>{let r=n.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>n.current?.transform(o)??[],get limit(){return n.current?.limit}});let t=e!==void 0;return{config:t?a.current:void 0,enabled:t}}var Et={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-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,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 Ma({onSubmit:e,onResult:n,onError:a,optionOverrides:t,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,visitorId:y,columns:b=2,dropdownTrigger:h,optionsPosition:p,closeDropdownOnBlur:x,prependPlaceholder:E,allOption:q,showNonTappableOptions:M,locationSearch:R,showOptionIcons:ae,showOptionImages:T,showOptionCounts:z,showSkipButton:U,showProducts:H,productImageFallback:te="image",onFocus:Q,onBlur:I,value:B,completedParams:W,onChange:Y,onParamsChange:re,products:P,mapProducts:D,onProductSelect:c,onProductAddToCart:S,source:Fe,setCursor:xe}){let f=ee(null),[Be,ye]=Go(null),Oe=ee(e);Oe.current=e;let Le=ee(n);Le.current=n;let ze=ee(a);ze.current=a;let ke=ee(Y);ke.current=Y;let g=ee(re);g.current=re;let k=ee(Q);k.current=Q;let C=ee(I);C.current=I;let A=ee(xe);A.current=xe;let L=ee(c);L.current=c;let j=ee(S);j.current=S;let ie=ee(y);ie.current=y;let ue=ee(()=>{let d=ie.current;return typeof d=="function"?d():d}).current,de=Pt(P),We=ee(D);We.current=D;let $=ee((d,G)=>{let N=We.current;return N?N(d,G):d}).current,Ce=D?$:void 0,Ge=St(t);ea(()=>{if(typeof document>"u")return;let d=new Mo(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,visitorId:ue,optionOverrides:Ge.overrides,maskCompletedText:o,columns:b,dropdownTrigger:h,optionsPosition:p,closeDropdownOnBlur:x,prependPlaceholder:E,allOption:q,showNonTappableOptions:M,locationSearch:R,showProducts:H,source:Fe,value:B,completedParams:W,onSubmit:(...N)=>Oe.current?.(...N),onResult:(...N)=>Le.current?.(...N),onError:(...N)=>ze.current?.(...N),onChange:(...N)=>ke.current?.(...N),onParamsChange:(...N)=>g.current?.(...N),onFocus:()=>k.current?.(),onBlur:()=>C.current?.(),onProductSelect:N=>L.current?.(N),onProductAddToCart:N=>j.current?.(N),setCursor:N=>A.current?.(N),products:de.config,mapProducts:Ce});f.current=d,ye(d.getState());let G=d.subscribe(N=>ye(N));return()=>{G(),d.destroy(),f.current===d&&(f.current=null)}},[]),ea(()=>{B!==void 0&&f.current?.setValue(B)},[B]),ea(()=>{W!==void 0&&f.current?.setCompletedParams(W)},[W]);let na=JSON.stringify(s??null),me;try{me=JSON.stringify(r??null)}catch{me="[unstringifiable]"}ea(()=>{f.current?.update({apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,optionOverrides:Ge.overrides,dropdownTrigger:h,optionsPosition:p,closeDropdownOnBlur:x,prependPlaceholder:E,allOption:q,showNonTappableOptions:M,locationSearch:R,showProducts:H})},[na,me,l,w?.code,w?.rate,w?.country,v,Ge.key,h,p,x,E,q,M,R,H]);let Ye=ee(!1);ea(()=>{if(!Ye.current){Ye.current=!0;return}f.current?.update({products:de.config})},[de.enabled]),ea(()=>{f.current?.update({mapProducts:Ce})},[Ce]);let De=ee(null);De.current===null&&(De.current={handleTextChange:d=>f.current?.handleTextChange(d),handleCompositionText:d=>f.current?.handleCompositionText(d),handleKeyDown:d=>{let G="nativeEvent"in d?d.nativeEvent:d;f.current?.handleKeyDown(G)},setFocused:d=>f.current?.setFocused(d),startEditingParam:d=>f.current?.startEditingParam(d),removeParam:d=>f.current?.removeParam(d)??!1,exitEditMode:()=>f.current?.exitEditMode(),handleCaretAfterInput:d=>f.current?.handleCaretAfterInput(d),handleCaretMove:d=>f.current?.handleCaretMove(d),replaceEditingRange:d=>f.current?.replaceEditingRange(d)??!1,setActivePill:d=>f.current?.setActivePill(d),skipActivePill:()=>f.current?.skipActivePill(),removeLastParam:()=>f.current?.removeLastParam(),clearNewParamId:()=>f.current?.clearNewParamId(),reset:()=>f.current?.reset(),refreshProducts:()=>f.current?.refreshProducts(),prepareSubmit:()=>f.current?.prepareSubmit(),getState:()=>f.current?.getState()??Et,recordSubmit:d=>f.current?.recordSubmit(d),selectOption:(d,G)=>f.current?.selectOption(d,G),selectProduct:d=>f.current?.selectProduct(d),addProductToCart:d=>{let G=f.current;return!G||!j.current?Promise.resolve():G.addProductToCart(d)},setActiveDropdownIndex:d=>f.current?.setActiveDropdownIndex(d),clearHighlight:d=>f.current?.clearHighlight(d),showPreviousMonth:()=>f.current?.showPreviousMonth(),showNextMonth:()=>f.current?.showNextMonth(),setTime:d=>f.current?.setTime(d),commitTime:()=>f.current?.commitTime(),toggleMultiSelectOption:d=>f.current?.toggleMultiSelectOption(d),commitMultiSelect:()=>f.current?.commitMultiSelect(),setLocationQuery:d=>f.current?.setLocationQuery(d),moveLocationHighlight:d=>f.current?.moveLocationHighlight(d),commitLocation:d=>f.current?.commitLocation(d),setLocationFieldFocused:d=>f.current?.setLocationFieldFocused(d),handleFocus:()=>f.current?.setFocused(!0),handleBlur:()=>f.current?.setFocused(!1)});let m=De.current,Se=It(d=>{let G=d.target.value,$e=G.length>0&&!d.nativeEvent?.isComposing&&G[0]!==G[0].toUpperCase()?G[0].toUpperCase()+G.slice(1):G;f.current?.handleTextChange($e)},[]),Ke=It(d=>{f.current?.handleKeyDown(d.nativeEvent)},[]),i=f.current,u=Be??Et,Te=B!==void 0?B:u.text,Pe=W!==void 0?W:u.completedParams,ge=u.actionableSuggestions,Ie=ge[0],Me=Wo(()=>Bo(ge),[ge]),fe=i?.listboxId??"",ra=u.activeDropdownIndex>=0&&i?`${fe}-option-${u.activeDropdownIndex}`:void 0,Ee=u.editingParam,be=u.editingIdentified,Ne=Ee?Ho(Ee):be?{parameter:be.parameter,text:Fo(be.parameter),required:!0,options:[]}:null,qe=u.dropdownSuggestion??Ne??Ie,je=Ne?[Ne]:ge,Ae=No(u),_e=!i||u.dropdownLoading;return{completedParams:Pe,multiSelectView:u.multiSelectView,toggleMultiSelectOption:m.toggleMultiSelectOption,commitMultiSelect:m.commitMultiSelect,skippedParams:u.skippedParams,identifiedParams:u.identifiedParams,suggestionPills:Me,setActivePill:m.setActivePill,skipActivePill:m.skipActivePill,removeLastParam:m.removeLastParam,segments:u.segments,newParamId:u.newParamId,clearNewParamId:m.clearNewParamId,suggestions:u.suggestions,activeIndex:u.activeDropdownIndex,isReady:u.isReady,isLoading:_e,isFocused:u.isFocused,isDropdownOpen:u.isDropdownOpen,isActivePillSelected:u.isActivePillSelected,placeholderText:u.placeholderText,listboxId:fe,error:u.error,products:u.products,customFields:u.customFields,selectProduct:m.selectProduct,addProductToCart:m.addProductToCart,handleTextChange:m.handleTextChange,handleCompositionText:m.handleCompositionText,handleKeyDown:m.handleKeyDown,setFocused:m.setFocused,editingParam:Ee,editingIdentified:be,editingAnchor:u.editingAnchor,caretOffset:u.caretOffset,startEditingParam:m.startEditingParam,removeParam:m.removeParam,exitEditMode:m.exitEditMode,handleCaretAfterInput:m.handleCaretAfterInput,handleCaretMove:m.handleCaretMove,replaceEditingRange:m.replaceEditingRange,inputProps:{value:Te,placeholder:u.placeholderText||void 0,onChange:Se,onKeyDown:Ke,onFocus:m.handleFocus,onBlur:m.handleBlur,role:"combobox","aria-expanded":u.isDropdownOpen,"aria-activedescendant":ra,"aria-autocomplete":"list","aria-controls":fe},reset:m.reset,refreshProducts:m.refreshProducts,prepareSubmit:m.prepareSubmit,getState:m.getState,recordSubmit:m.recordSubmit,dropdownProps:{suggestions:qe?[{...qe,options:u.dropdownOptions}]:[],activeIndex:u.activeDropdownIndex,onSelect:m.selectOption,onHighlight:m.setActiveDropdownIndex,onUnhighlight:m.clearHighlight,isOpen:u.isDropdownOpen,id:fe,pills:je,activeSelected:u.isActivePillSelected,onPillClick:m.setActivePill,onSkip:m.skipActivePill,showSkipButton:(U??!0)&&!Ee&&!be,showOptionIcons:ae??!0,showOptionImages:T??!0,showOptionCounts:z??!0,skipDisabled:u.inSelectionAnimation,isLoading:_e,skeletonExiting:u.skeletonExiting,isInputEmpty:Te.trim().length===0,language:l,products:u.products,productImageFallback:te,onProductSelect:m.selectProduct,onProductAddToCart:S?m.addProductToCart:void 0,onProductFocusChange:m.setFocused,formatType:u.activeFormatType,dateView:u.dateView,selectedDateIso:Ae.selectedIso,selectedDateRange:Ae.selectedRange,dateRangeStart:Ae.rangeStart,dateReferences:Ae.references,onPreviousMonth:m.showPreviousMonth,onNextMonth:m.showNextMonth,timeView:u.timeView,multiSelectView:u.dropdownMultiSelect,onMultiSelectCommit:m.commitMultiSelect,onTimeChange:m.setTime,onTimeCommit:m.commitTime,locationView:u.locationView,isReediting:u.editingParam!=null,onLocationQuery:m.setLocationQuery,onLocationMove:m.moveLocationHighlight,onLocationCommit:m.commitLocation,onLocationFocusChange:m.setLocationFieldFocused,isFocused:u.isFocused||u.locationFieldFocused,optionsPosition:p??"below"}}}import{attachChipRemove as Ko,cancelStartingHint as qo,chipIdFromTap as _o,extractPlainText as At,getCursorOffset as Rt,keepCaretOnChip as Vo,plainTextLength as Uo,renderEditableContent as Qo,setCursorOffset as Ot,startingHintOptions as Yo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as he,useEffect as aa,useLayoutEffect as Na,useRef as ta}from"react";var ya;function jo(){if(ya!==void 0)return ya;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),ya=e.contentEditable==="plaintext-only",ya}function Lt(e){let{segments:n,showChipIcons:a=!0,showChipImages:t=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:w,editingAnchor:v,caretOffset:y,placeholderText:b,hintSuggestions:h,isFocused:p,isDropdownOpen:x,listboxId:E,activeDescendantId:q,autoFocus:M,handleTextChange:R,handleCompositionText:ae,handleKeyDown:T,handleCaretAfterInput:z,handleCaretMove:U,startEditingParam:H,replaceEditingRange:te,setFocused:Q}=e,I=ta(null),B=ta(!1),W=ta(""),Y=ta(""),re=ta(null),P=ta(0);re.current=y,aa(()=>{if(!M)return;let g=I.current;if(!g)return;document.activeElement===g?Q(!0):g.focus();let k=g.ownerDocument??document,C=k.getSelection(),A=C&&C.rangeCount>0&&g.contains(C.anchorNode);if(C&&!A){let L=k.createRange();L.selectNodeContents(g),L.collapse(!0),C.removeAllRanges(),C.addRange(L)}},[M,Q]),aa(()=>{let g=I.current;if(!g)return;let k=g.ownerDocument??document,C=()=>{let A=k.getSelection();if(!A||A.rangeCount===0||!A.anchorNode||!g.contains(A.anchorNode))return;let L=A.anchorNode,j=L.nodeType===Node.ELEMENT_NODE?L:L.parentElement,ue=(A.isCollapsed?j?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,de=l?.id??w?.id??null;if(ue&&ue!==de){H(ue);return}performance.now()-P.current<50||U(Rt(g))};return k.addEventListener("selectionchange",C),()=>k.removeEventListener("selectionchange",C)},[l,w,H,U]),aa(()=>{let g=I.current;if(!g)return;let k=C=>{let A=_o(g,C.target);A&&(H(A),Vo(g,A))};return g.addEventListener("click",k),()=>g.removeEventListener("click",k)},[H]),aa(()=>{let g=I.current;if(!(!g||!s||!o))return Ko(g,s)},[s,o]),Na(()=>{let g=I.current;g&&Qo({input:g,segments:n,newParamId:r,editingParamId:l?.id??null,placeholderText:b??"",isFocused:p,showChipIcons:a,showChipImages:t,showChipRemove:o,hintOptions:Yo(h??[])})},[n,r,l,b,h,p,a,t,o]),aa(()=>{let g=I.current;return()=>{g&&qo(g)}},[]),Na(()=>{let g=W.current,k=r??"";if(W.current=k,!k||k===g)return;let C=I.current;if(!C)return;C.focus();let A=re.current??Uo(C);Ot(C,A)},[r]),Na(()=>{let g=Y.current,k=l?.id??"";if(Y.current=k,!k||k===g||v==null)return;let C=I.current;C&&Ot(C,v)},[l,v]);let D=he(()=>{let g=I.current;if(!g)return;let k=At(g),A=k.length>0&&k[0]!==k[0].toUpperCase()?k[0].toUpperCase()+k.slice(1):k;if(B.current){ae(A);return}R(A)},[R,ae]),c=he(()=>{P.current=performance.now(),D();let g=I.current;g&&z(Rt(g))},[D,z]);aa(()=>{let g=I.current;if(!g)return;let k=C=>{let A=C,L=A.inputType;if(L==="insertParagraph"||L==="insertLineBreak"||L==="insertFromDrop"){C.preventDefault();return}if(L.startsWith("insert")||L.startsWith("delete")){let j=L.startsWith("delete")?"":A.data??"";te(j)&&C.preventDefault()}};return g.addEventListener("beforeinput",k),()=>g.removeEventListener("beforeinput",k)},[te]);let S=he(()=>{B.current=!0,I.current?.setAttribute("data-aia-composing","true")},[]),Fe=he(()=>{B.current=!1,I.current?.removeAttribute("data-aia-composing"),D()},[D]),xe=he(g=>{g.preventDefault();let k=I.current;if(!k)return;let C=(g.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!C)return;let A=k.ownerDocument??document,L=A.getSelection();if(!L||L.rangeCount===0)return;let j=L.getRangeAt(0);if(!k.contains(j.startContainer))return;j.deleteContents();let ie=A.createTextNode(C);j.insertNode(ie),j.setStartAfter(ie),j.collapse(!0),L.removeAllRanges(),L.addRange(j),D()},[D]),f=he(g=>T(g),[T]),Be=he(()=>Q(!0),[Q]),ye=he(()=>Q(!1),[Q]),Oe=he(()=>I.current?.focus(),[]),Le=he(()=>I.current?.blur(),[]),ze=he(()=>{let g=I.current;return g?At(g):""},[]),ke=jo()?"plaintext-only":"true";return{inputRef:I,editorProps:{ref:I,contentEditable:ke,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":E,"aria-expanded":x,"aria-activedescendant":q,spellCheck:!0,enterKeyHint:"send",onInput:c,onKeyDown:f,onCompositionStart:S,onCompositionEnd:Fe,onPaste:xe,onFocus:Be,onBlur:ye},getPlainText:ze,focus:Oe,blur:Le}}import{jsx as oa,jsxs as Fa}from"react/jsx-runtime";function nn(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var rn=$o(function({onSubmit:n,onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:w,language:v,currency:y,productId:b,visitorId:h,columns:p,pillPlacement:x="dropdown",mode:E="auto",optionsPosition:q="below",animations:M=!0,optionsStyle:R="floating",dropdownTrigger:ae,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:U,showNonTappableOptions:H,locationSearch:te,showOptionIcons:Q=!0,showChipIcons:I=!0,showChipImages:B=!0,showChipRemove:W=!1,showOptionImages:Y=!0,showOptionCounts:re=!0,showSkipButton:P,showProducts:D,productsLayout:c,productImageFallback:S,autoFocus:Fe=!0,onFocus:xe,onBlur:f,value:Be,completedParams:ye,onChange:Oe,onParamsChange:Le,products:ze,mapProducts:ke,onProductSelect:g,onProductAddToCart:k,submitButton:C,resetOnSubmit:A=!0,seeAllResults:L=!1},j){let ie=ia(null),ue=ia(null),de=ia(null),We=ia(()=>{}),$=ia(null),Ce=ia(null);Ha(()=>{let F=ie.current;if(F)return $.current?$.current.setMode(E):$.current=new en(F,E),()=>{$.current?.destroy(),$.current=null}},[E]);let Ge=ka(F=>{let oe=Ce.current?.current;oe&&(oe.focus(),an(oe,F))},[]),{completedParams:na,suggestionPills:me,setActivePill:Ye,skipActivePill:De,segments:m,newParamId:Se,clearNewParamId:Ke,placeholderText:i,isFocused:u,isDropdownOpen:Te,isActivePillSelected:Pe,isLoading:ge,isReady:Ie,activeIndex:Me,listboxId:fe,handleTextChange:ra,handleCompositionText:Ee,handleKeyDown:be,setFocused:Ne,editingParam:qe,editingIdentified:je,editingAnchor:Ae,caretOffset:_e,startEditingParam:d,removeParam:G,handleCaretAfterInput:N,handleCaretMove:$e,replaceEditingRange:O,dropdownProps:Ba,reset:ma,refreshProducts:Wa,prepareSubmit:Ga,getState:Ka,recordSubmit:qa}=Ma({onSubmit:F=>We.current(F),onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:w,language:v,currency:y,productId:b,visitorId:h,columns:p,dropdownTrigger:ae,optionsPosition:q,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:U,showNonTappableOptions:H,locationSearch:te,showOptionIcons:Q,showOptionImages:Y,showOptionCounts:re,showSkipButton:P,showProducts:D,onFocus:xe,onBlur:f,value:Be,completedParams:ye,onChange:Oe,onParamsChange:Le,products:ze,mapProducts:ke,onProductSelect:g,onProductAddToCart:k,source:"full-sdk",setCursor:Ge});Ha(()=>{if(!Se)return;let F=window.setTimeout(()=>Ke(),650);return()=>window.clearTimeout(F)},[Se,Ke]);let zt=Me>=0?`${fe}-option-${Me}`:void 0,{inputRef:Ca,editorProps:Dt,focus:ga,blur:_a,getPlainText:Va}=Lt({segments:m,newParamId:Se,editingParam:qe,editingIdentified:je,editingAnchor:Ae,caretOffset:_e,placeholderText:i,hintSuggestions:x==="inline"?[]:me,isFocused:u,showChipIcons:I,showChipImages:B,showChipRemove:W,removeParam:G,isDropdownOpen:Te,listboxId:fe,activeDescendantId:zt,autoFocus:Fe,handleTextChange:ra,handleCompositionText:Ee,handleKeyDown:be,handleCaretAfterInput:N,handleCaretMove:$e,startEditingParam:d,replaceEditingRange:O,setFocused:Ne});Ce.current=Ca,Xo(()=>{let F=ue.current,oe=Ca.current;if(!F||!oe)return;let la=()=>{let Qa=F.firstElementChild;if(!Qa)return;let Wt=Qa.getBoundingClientRect(),Gt=oe.getBoundingClientRect();Wt.top>=Gt.bottom-2?F.setAttribute("data-aia-pill-wrapped",""):F.removeAttribute("data-aia-pill-wrapped")};la();let Ua=new ResizeObserver(la);return Ua.observe(oe),()=>Ua.disconnect()},[m,me.length,ge,Ca]),Ha(()=>{let F=de.current;if(F)return on(F)},[]),Zo(j,()=>({focus:ga,blur:_a,reset:ma,refreshProducts:Wa,setMode:F=>$.current?.setMode(F),skipActivePill:De}),[ga,_a,ma,Wa,De]);let Ze=!!m.length||na.length>0,sa=ka(F=>{if(!Ze)return;F&&Ga();let oe=Ka(),la=Jo(Va(),oe.completedParams,oe.skippedParams,{identifiedParams:oe.identifiedParams,isReady:oe.isReady,customFields:oe.customFields});F&&qa(la),n(la),A&&ma()},[qa,A,Ze,Ga,Ka,n,ma,Va]);We.current=()=>sa(!1);let Mt=L&&!Ba.isInputEmpty&&Ze,Nt=ka(()=>sa(!0),[sa]),Ht=ka(F=>{F.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||ga()},[ga]),Ft=x==="inline",Bt=x==="dropdown";return Fa("div",{ref:ie,className:`magicx-aia ${Ve.container} ${r??""}`,"data-pill-placement":x,"data-options-position":q,"data-animations":M?"on":"off","data-aia-options-style":R,"data-mode":nn(E),children:[oa(za,{...Ba,showPills:Bt,productsLayout:c,productImageFallback:S,onSeeAllResults:Mt?Nt:void 0,fullWidth:L}),Fa("div",{className:Ve.inputWrapper,"data-aia-input-wrapper":"",onClick:Ht,children:[Fa("div",{ref:de,className:Ve.editorArea,"data-aia-editor":"",children:[oa("div",{...Dt,className:Ve.input,"data-aia-input":""}),Ft&&(ge||me.length>0)&&oa("span",{ref:ue,className:Ve.pillListContainer,"data-aia-pill-list-container":"",children:oa(ba,{pills:me,activePillIndex:0,activeSelected:Pe,onSelectPill:Ye,loading:ge})})]}),C===null?null:C===void 0?oa(kt,{disabled:!Ze,ready:Ze&&Ie,onClick:()=>sa(!0),label:tn(v).submit}):oa("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ve.submitSlot,onClick:F=>{Ze&&(F.stopPropagation(),sa(!0))},children:C})]})]})});export{rn as AIAutocomplete,za as AIAutocompleteDropdown,gs as DATE_RANGE_META_END,fs as DATE_RANGE_META_START,bs as DEFAULT_OPTION_COUNT_UNIT,Ts as LOCATION_META_KEY,zs as PRODUCT_PATH_PREFIX,qs as TIME_META_KEY,Vs as WEEKDAY_LABELS,hs as buildSubmitResult,us as cellDay,ms as cellIso,ws as dateCellMarks,vs as formatDate,xs as formatDateRange,ys as formatOptionCount,ks as formatPlace,Cs as formatTime,Ss as isoDate,Ps as monthLabel,Is as optionCountLabel,Es as optionHasImage,As as optionImageSources,Rs as optionImageSrc,Os as optionLabel,Ls as optionsShowLeadingVisuals,Ds as parseDate,Ms as parseLooseDate,Ns as parseLooseDateRange,Hs as parseTime,Fs as productFromMatchedItem,Bs as productImageSources,Ws as productsFromCustomFields,Gs as sanitizeOptionIconSvg,Ks as selectedRangeFor,Ma as useAIAutocomplete,_s as visibleDateRange,Us as withSkippedParams};
3786
+ `,document.head.appendChild(e)}var kt={submitButton:"aia-submitButton-otz7H"};import{jsx as Ma}from"react/jsx-runtime";function Ct({disabled:e,ready:n,onClick:a,label:t=Mo().submit}){return Ma("button",{type:"button","data-aia-submit":"",className:kt.submitButton,disabled:e,"data-aia-ready":n?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":t,children:Ma("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:Ma("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as No,dateSelectionFor as Ho,editingSuggestion as Fo,identifiedParamLabel as Bo,withoutTraditionalAutocomplete as Wo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Et,useEffect as aa,useMemo as Go,useRef as ee,useState as Ko}from"react";import{useRef as St}from"react";function Tt(e){let n=St(e);n.current=e;let a=Object.keys(e??{}).sort().join("\0"),t=St({key:"",overrides:void 0});if(t.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,w,v)=>{let y=n.current?.[s];return y?y(l,w,v):[]};o[s]=r}t.current={key:a,overrides:e?o:void 0}}return{overrides:t.current.overrides,key:a}}import{useRef as Pt}from"react";function It(e){let n=Pt(e);n.current=e;let a=Pt(null);a.current===null&&(a.current={fetch:(o,s)=>{let r=n.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>n.current?.transform(o)??[],get limit(){return n.current?.limit}});let t=e!==void 0;return{config:t?a.current:void 0,enabled:t}}var At={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-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,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 Na({onSubmit:e,onResult:n,onError:a,optionOverrides:t,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,visitorId:y,columns:f=2,dropdownTrigger:h,optionsPosition:p,closeDropdownOnBlur:k,prependPlaceholder:x,allOption:W,showNonTappableOptions:D,locationSearch:R,showOptionIcons:ae,showOptionImages:T,showOptionCounts:z,showSkipButton:U,showProducts:N,productImageFallback:te="image",showProductVendor:X=!0,onFocus:E,onBlur:Q,value:q,completedParams:B,onChange:re,onParamsChange:S,products:H,mapProducts:d,onProductSelect:P,onProductAddToCart:ve,source:Be,setCursor:xe}){let b=ee(null),[We,ye]=Ko(null),Oe=ee(e);Oe.current=e;let Le=ee(n);Le.current=n;let ze=ee(a);ze.current=a;let m=ee(re);m.current=re;let C=ee(S);C.current=S;let I=ee(E);I.current=E;let A=ee(Q);A.current=Q;let L=ee(xe);L.current=xe;let Y=ee(P);Y.current=P;let de=ee(ve);de.current=ve;let ie=ee(y);ie.current=y;let De=ee(()=>{let c=ie.current;return typeof c=="function"?c():c}).current,ke=It(H),Ge=ee(d);Ge.current=d;let j=ee((c,G)=>{let M=Ge.current;return M?M(c,G):c}).current,Ce=d?j:void 0,Ke=Tt(t);aa(()=>{if(typeof document>"u")return;let c=new No(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,visitorId:De,optionOverrides:Ke.overrides,maskCompletedText:o,columns:f,dropdownTrigger:h,optionsPosition:p,closeDropdownOnBlur:k,prependPlaceholder:x,allOption:W,showNonTappableOptions:D,locationSearch:R,showProducts:N,source:Be,value:q,completedParams:B,onSubmit:(...M)=>Oe.current?.(...M),onResult:(...M)=>Le.current?.(...M),onError:(...M)=>ze.current?.(...M),onChange:(...M)=>m.current?.(...M),onParamsChange:(...M)=>C.current?.(...M),onFocus:()=>I.current?.(),onBlur:()=>A.current?.(),onProductSelect:M=>Y.current?.(M),onProductAddToCart:M=>de.current?.(M),setCursor:M=>L.current?.(M),products:ke.config,mapProducts:Ce});b.current=c,ye(c.getState());let G=c.subscribe(M=>ye(M));return()=>{G(),c.destroy(),b.current===c&&(b.current=null)}},[]),aa(()=>{q!==void 0&&b.current?.setValue(q)},[q]),aa(()=>{B!==void 0&&b.current?.setCompletedParams(B)},[B]);let ra=JSON.stringify(s??null),ue;try{ue=JSON.stringify(r??null)}catch{ue="[unstringifiable]"}aa(()=>{b.current?.update({apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,optionOverrides:Ke.overrides,dropdownTrigger:h,optionsPosition:p,closeDropdownOnBlur:k,prependPlaceholder:x,allOption:W,showNonTappableOptions:D,locationSearch:R,showProducts:N})},[ra,ue,l,w?.code,w?.rate,w?.country,v,Ke.key,h,p,k,x,W,D,R,N]);let je=ee(!1);aa(()=>{if(!je.current){je.current=!0;return}b.current?.update({products:ke.config})},[ke.enabled]),aa(()=>{b.current?.update({mapProducts:Ce})},[Ce]);let Me=ee(null);Me.current===null&&(Me.current={handleTextChange:c=>b.current?.handleTextChange(c),handleCompositionText:c=>b.current?.handleCompositionText(c),handleKeyDown:c=>{let G="nativeEvent"in c?c.nativeEvent:c;b.current?.handleKeyDown(G)},setFocused:c=>b.current?.setFocused(c),startEditingParam:c=>b.current?.startEditingParam(c),removeParam:c=>b.current?.removeParam(c)??!1,exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:c=>b.current?.handleCaretAfterInput(c),handleCaretMove:c=>b.current?.handleCaretMove(c),replaceEditingRange:c=>b.current?.replaceEditingRange(c)??!1,setActivePill:c=>b.current?.setActivePill(c),skipActivePill:()=>b.current?.skipActivePill(),removeLastParam:()=>b.current?.removeLastParam(),clearNewParamId:()=>b.current?.clearNewParamId(),reset:()=>b.current?.reset(),refreshProducts:()=>b.current?.refreshProducts(),prepareSubmit:()=>b.current?.prepareSubmit(),getState:()=>b.current?.getState()??At,recordSubmit:c=>b.current?.recordSubmit(c),selectOption:(c,G)=>b.current?.selectOption(c,G),selectProduct:c=>b.current?.selectProduct(c),addProductToCart:c=>{let G=b.current;return!G||!de.current?Promise.resolve():G.addProductToCart(c)},setActiveDropdownIndex:c=>b.current?.setActiveDropdownIndex(c),clearHighlight:c=>b.current?.clearHighlight(c),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:c=>b.current?.setTime(c),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:c=>b.current?.toggleMultiSelectOption(c),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:c=>b.current?.setLocationQuery(c),moveLocationHighlight:c=>b.current?.moveLocationHighlight(c),commitLocation:c=>b.current?.commitLocation(c),setLocationFieldFocused:c=>b.current?.setLocationFieldFocused(c),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let g=Me.current,Se=Et(c=>{let G=c.target.value,Ze=G.length>0&&!c.nativeEvent?.isComposing&&G[0]!==G[0].toUpperCase()?G[0].toUpperCase()+G.slice(1):G;b.current?.handleTextChange(Ze)},[]),qe=Et(c=>{b.current?.handleKeyDown(c.nativeEvent)},[]),i=b.current,u=We??At,Te=q!==void 0?q:u.text,Pe=B!==void 0?B:u.completedParams,me=u.actionableSuggestions,Ie=me[0],Ne=Go(()=>Wo(me),[me]),ge=i?.listboxId??"",sa=u.activeDropdownIndex>=0&&i?`${ge}-option-${u.activeDropdownIndex}`:void 0,Ee=u.editingParam,fe=u.editingIdentified,He=Ee?Fo(Ee):fe?{parameter:fe.parameter,text:Bo(fe.parameter),required:!0,options:[]}:null,_e=u.dropdownSuggestion??He??Ie,$e=He?[He]:me,Ae=Ho(u),Ve=!i||u.dropdownLoading;return{completedParams:Pe,multiSelectView:u.multiSelectView,toggleMultiSelectOption:g.toggleMultiSelectOption,commitMultiSelect:g.commitMultiSelect,skippedParams:u.skippedParams,identifiedParams:u.identifiedParams,suggestionPills:Ne,setActivePill:g.setActivePill,skipActivePill:g.skipActivePill,removeLastParam:g.removeLastParam,segments:u.segments,newParamId:u.newParamId,clearNewParamId:g.clearNewParamId,suggestions:u.suggestions,activeIndex:u.activeDropdownIndex,isReady:u.isReady,isLoading:Ve,isFocused:u.isFocused,isDropdownOpen:u.isDropdownOpen,isActivePillSelected:u.isActivePillSelected,placeholderText:u.placeholderText,listboxId:ge,error:u.error,products:u.products,customFields:u.customFields,selectProduct:g.selectProduct,addProductToCart:g.addProductToCart,handleTextChange:g.handleTextChange,handleCompositionText:g.handleCompositionText,handleKeyDown:g.handleKeyDown,setFocused:g.setFocused,editingParam:Ee,editingIdentified:fe,editingAnchor:u.editingAnchor,caretOffset:u.caretOffset,startEditingParam:g.startEditingParam,removeParam:g.removeParam,exitEditMode:g.exitEditMode,handleCaretAfterInput:g.handleCaretAfterInput,handleCaretMove:g.handleCaretMove,replaceEditingRange:g.replaceEditingRange,inputProps:{value:Te,placeholder:u.placeholderText||void 0,onChange:Se,onKeyDown:qe,onFocus:g.handleFocus,onBlur:g.handleBlur,role:"combobox","aria-expanded":u.isDropdownOpen,"aria-activedescendant":sa,"aria-autocomplete":"list","aria-controls":ge},reset:g.reset,refreshProducts:g.refreshProducts,prepareSubmit:g.prepareSubmit,getState:g.getState,recordSubmit:g.recordSubmit,dropdownProps:{suggestions:_e?[{..._e,options:u.dropdownOptions}]:[],activeIndex:u.activeDropdownIndex,onSelect:g.selectOption,onHighlight:g.setActiveDropdownIndex,onUnhighlight:g.clearHighlight,isOpen:u.isDropdownOpen,id:ge,pills:$e,activeSelected:u.isActivePillSelected,onPillClick:g.setActivePill,onSkip:g.skipActivePill,showSkipButton:(U??!0)&&!Ee&&!fe,showOptionIcons:ae??!0,showOptionImages:T??!0,showOptionCounts:z??!0,skipDisabled:u.inSelectionAnimation,isLoading:Ve,skeletonExiting:u.skeletonExiting,isInputEmpty:Te.trim().length===0,language:l,products:u.products,productImageFallback:te,showProductVendor:X,onProductSelect:g.selectProduct,onProductAddToCart:ve?g.addProductToCart:void 0,onProductFocusChange:g.setFocused,formatType:u.activeFormatType,dateView:u.dateView,selectedDateIso:Ae.selectedIso,selectedDateRange:Ae.selectedRange,dateRangeStart:Ae.rangeStart,dateReferences:Ae.references,onPreviousMonth:g.showPreviousMonth,onNextMonth:g.showNextMonth,timeView:u.timeView,multiSelectView:u.dropdownMultiSelect,onMultiSelectCommit:g.commitMultiSelect,onTimeChange:g.setTime,onTimeCommit:g.commitTime,locationView:u.locationView,isReediting:u.editingParam!=null,onLocationQuery:g.setLocationQuery,onLocationMove:g.moveLocationHighlight,onLocationCommit:g.commitLocation,onLocationFocusChange:g.setLocationFieldFocused,isFocused:u.isFocused||u.locationFieldFocused,optionsPosition:p??"below"}}}import{attachChipRemove as qo,cancelStartingHint as _o,chipIdFromTap as Vo,extractPlainText as Rt,getCursorOffset as Ot,keepCaretOnChip as Uo,plainTextLength as Qo,renderEditableContent as Yo,setCursorOffset as Lt,startingHintOptions as jo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as he,useEffect as ta,useLayoutEffect as Ha,useRef as ia}from"react";var ka;function $o(){if(ka!==void 0)return ka;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),ka=e.contentEditable==="plaintext-only",ka}function zt(e){let{segments:n,showChipIcons:a=!0,showChipImages:t=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:w,editingAnchor:v,caretOffset:y,placeholderText:f,hintSuggestions:h,isFocused:p,isDropdownOpen:k,listboxId:x,activeDescendantId:W,autoFocus:D,handleTextChange:R,handleCompositionText:ae,handleKeyDown:T,handleCaretAfterInput:z,handleCaretMove:U,startEditingParam:N,replaceEditingRange:te,setFocused:X}=e,E=ia(null),Q=ia(!1),q=ia(""),B=ia(""),re=ia(null),S=ia(0);re.current=y,ta(()=>{if(!D)return;let m=E.current;if(!m)return;document.activeElement===m?X(!0):m.focus();let C=m.ownerDocument??document,I=C.getSelection(),A=I&&I.rangeCount>0&&m.contains(I.anchorNode);if(I&&!A){let L=C.createRange();L.selectNodeContents(m),L.collapse(!0),I.removeAllRanges(),I.addRange(L)}},[D,X]),ta(()=>{let m=E.current;if(!m)return;let C=m.ownerDocument??document,I=()=>{let A=C.getSelection();if(!A||A.rangeCount===0||!A.anchorNode||!m.contains(A.anchorNode))return;let L=A.anchorNode,Y=L.nodeType===Node.ELEMENT_NODE?L:L.parentElement,ie=(A.isCollapsed?Y?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,De=l?.id??w?.id??null;if(ie&&ie!==De){N(ie);return}performance.now()-S.current<50||U(Ot(m))};return C.addEventListener("selectionchange",I),()=>C.removeEventListener("selectionchange",I)},[l,w,N,U]),ta(()=>{let m=E.current;if(!m)return;let C=I=>{let A=Vo(m,I.target);A&&(N(A),Uo(m,A))};return m.addEventListener("click",C),()=>m.removeEventListener("click",C)},[N]),ta(()=>{let m=E.current;if(!(!m||!s||!o))return qo(m,s)},[s,o]),Ha(()=>{let m=E.current;m&&Yo({input:m,segments:n,newParamId:r,editingParamId:l?.id??null,placeholderText:f??"",isFocused:p,showChipIcons:a,showChipImages:t,showChipRemove:o,hintOptions:jo(h??[])})},[n,r,l,f,h,p,a,t,o]),ta(()=>{let m=E.current;return()=>{m&&_o(m)}},[]),Ha(()=>{let m=q.current,C=r??"";if(q.current=C,!C||C===m)return;let I=E.current;if(!I)return;I.focus();let A=re.current??Qo(I);Lt(I,A)},[r]),Ha(()=>{let m=B.current,C=l?.id??"";if(B.current=C,!C||C===m||v==null)return;let I=E.current;I&&Lt(I,v)},[l,v]);let H=he(()=>{let m=E.current;if(!m)return;let C=Rt(m),A=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;if(Q.current){ae(A);return}R(A)},[R,ae]),d=he(()=>{S.current=performance.now(),H();let m=E.current;m&&z(Ot(m))},[H,z]);ta(()=>{let m=E.current;if(!m)return;let C=I=>{let A=I,L=A.inputType;if(L==="insertParagraph"||L==="insertLineBreak"||L==="insertFromDrop"){I.preventDefault();return}if(L.startsWith("insert")||L.startsWith("delete")){let Y=L.startsWith("delete")?"":A.data??"";te(Y)&&I.preventDefault()}};return m.addEventListener("beforeinput",C),()=>m.removeEventListener("beforeinput",C)},[te]);let P=he(()=>{Q.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),ve=he(()=>{Q.current=!1,E.current?.removeAttribute("data-aia-composing"),H()},[H]),Be=he(m=>{m.preventDefault();let C=E.current;if(!C)return;let I=(m.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let A=C.ownerDocument??document,L=A.getSelection();if(!L||L.rangeCount===0)return;let Y=L.getRangeAt(0);if(!C.contains(Y.startContainer))return;Y.deleteContents();let de=A.createTextNode(I);Y.insertNode(de),Y.setStartAfter(de),Y.collapse(!0),L.removeAllRanges(),L.addRange(Y),H()},[H]),xe=he(m=>T(m),[T]),b=he(()=>X(!0),[X]),We=he(()=>X(!1),[X]),ye=he(()=>E.current?.focus(),[]),Oe=he(()=>E.current?.blur(),[]),Le=he(()=>{let m=E.current;return m?Rt(m):""},[]),ze=$o()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:ze,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":x,"aria-expanded":k,"aria-activedescendant":W,spellCheck:!0,enterKeyHint:"send",onInput:d,onKeyDown:xe,onCompositionStart:P,onCompositionEnd:ve,onPaste:Be,onFocus:b,onBlur:We},getPlainText:Le,focus:ye,blur:Oe}}import{jsx as na,jsxs as Ba}from"react/jsx-runtime";function rn(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var sn=Zo(function({onSubmit:n,onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:w,language:v,currency:y,productId:f,visitorId:h,columns:p,pillPlacement:k="dropdown",mode:x="auto",optionsPosition:W="below",animations:D=!0,optionsStyle:R="floating",dropdownTrigger:ae,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:U,showNonTappableOptions:N,locationSearch:te,showOptionIcons:X=!0,showChipIcons:E=!0,showChipImages:Q=!0,showChipRemove:q=!1,showOptionImages:B=!0,showOptionCounts:re=!0,showSkipButton:S,showProducts:H,productsLayout:d,productImageFallback:P,showProductVendor:ve,autoFocus:Be=!0,onFocus:xe,onBlur:b,value:We,completedParams:ye,onChange:Oe,onParamsChange:Le,products:ze,mapProducts:m,onProductSelect:C,onProductAddToCart:I,submitButton:A,resetOnSubmit:L=!0,seeAllResults:Y=!1},de){let ie=oa(null),De=oa(null),ke=oa(null),Ge=oa(()=>{}),j=oa(null),Ce=oa(null);Fa(()=>{let F=ie.current;if(F)return j.current?j.current.setMode(x):j.current=new an(F,x),()=>{j.current?.destroy(),j.current=null}},[x]);let Ke=Ca(F=>{let oe=Ce.current?.current;oe&&(oe.focus(),tn(oe,F))},[]),{completedParams:ra,suggestionPills:ue,setActivePill:je,skipActivePill:Me,segments:g,newParamId:Se,clearNewParamId:qe,placeholderText:i,isFocused:u,isDropdownOpen:Te,isActivePillSelected:Pe,isLoading:me,isReady:Ie,activeIndex:Ne,listboxId:ge,handleTextChange:sa,handleCompositionText:Ee,handleKeyDown:fe,setFocused:He,editingParam:_e,editingIdentified:$e,editingAnchor:Ae,caretOffset:Ve,startEditingParam:c,removeParam:G,handleCaretAfterInput:M,handleCaretMove:Ze,replaceEditingRange:O,dropdownProps:Wa,reset:ga,refreshProducts:Ga,prepareSubmit:Ka,getState:qa,recordSubmit:_a}=Na({onSubmit:F=>Ge.current(F),onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:w,language:v,currency:y,productId:f,visitorId:h,columns:p,dropdownTrigger:ae,optionsPosition:W,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:U,showNonTappableOptions:N,locationSearch:te,showOptionIcons:X,showOptionImages:B,showOptionCounts:re,showSkipButton:S,showProducts:H,onFocus:xe,onBlur:b,value:We,completedParams:ye,onChange:Oe,onParamsChange:Le,products:ze,mapProducts:m,onProductSelect:C,onProductAddToCart:I,source:"full-sdk",setCursor:Ke});Fa(()=>{if(!Se)return;let F=window.setTimeout(()=>qe(),650);return()=>window.clearTimeout(F)},[Se,qe]);let Dt=Ne>=0?`${ge}-option-${Ne}`:void 0,{inputRef:Sa,editorProps:Mt,focus:fa,blur:Va,getPlainText:Ua}=zt({segments:g,newParamId:Se,editingParam:_e,editingIdentified:$e,editingAnchor:Ae,caretOffset:Ve,placeholderText:i,hintSuggestions:k==="inline"?[]:ue,isFocused:u,showChipIcons:E,showChipImages:Q,showChipRemove:q,removeParam:G,isDropdownOpen:Te,listboxId:ge,activeDescendantId:Dt,autoFocus:Be,handleTextChange:sa,handleCompositionText:Ee,handleKeyDown:fe,handleCaretAfterInput:M,handleCaretMove:Ze,startEditingParam:c,replaceEditingRange:O,setFocused:He});Ce.current=Sa,Jo(()=>{let F=De.current,oe=Sa.current;if(!F||!oe)return;let da=()=>{let Ya=F.firstElementChild;if(!Ya)return;let Gt=Ya.getBoundingClientRect(),Kt=oe.getBoundingClientRect();Gt.top>=Kt.bottom-2?F.setAttribute("data-aia-pill-wrapped",""):F.removeAttribute("data-aia-pill-wrapped")};da();let Qa=new ResizeObserver(da);return Qa.observe(oe),()=>Qa.disconnect()},[g,ue.length,me,Sa]),Fa(()=>{let F=ke.current;if(F)return nn(F)},[]),Xo(de,()=>({focus:fa,blur:Va,reset:ga,refreshProducts:Ga,setMode:F=>j.current?.setMode(F),skipActivePill:Me}),[fa,Va,ga,Ga,Me]);let Xe=!!g.length||ra.length>0,la=Ca(F=>{if(!Xe)return;F&&Ka();let oe=qa(),da=en(Ua(),oe.completedParams,oe.skippedParams,{identifiedParams:oe.identifiedParams,isReady:oe.isReady,customFields:oe.customFields});F&&_a(da),n(da),L&&ga()},[_a,L,Xe,Ka,qa,n,ga,Ua]);Ge.current=()=>la(!1);let Nt=Y&&!Wa.isInputEmpty&&Xe,Ht=Ca(()=>la(!0),[la]),Ft=Ca(F=>{F.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||fa()},[fa]),Bt=k==="inline",Wt=k==="dropdown";return Ba("div",{ref:ie,className:`magicx-aia ${Ue.container} ${r??""}`,"data-pill-placement":k,"data-options-position":W,"data-animations":D?"on":"off","data-aia-options-style":R,"data-mode":rn(x),children:[na(Da,{...Wa,showPills:Wt,productsLayout:d,productImageFallback:P,showProductVendor:ve,onSeeAllResults:Nt?Ht:void 0,fullWidth:Y}),Ba("div",{className:Ue.inputWrapper,"data-aia-input-wrapper":"",onClick:Ft,children:[Ba("div",{ref:ke,className:Ue.editorArea,"data-aia-editor":"",children:[na("div",{...Mt,className:Ue.input,"data-aia-input":""}),Bt&&(me||ue.length>0)&&na("span",{ref:De,className:Ue.pillListContainer,"data-aia-pill-list-container":"",children:na(wa,{pills:ue,activePillIndex:0,activeSelected:Pe,onSelectPill:je,loading:me})})]}),A===null?null:A===void 0?na(Ct,{disabled:!Xe,ready:Xe&&Ie,onClick:()=>la(!0),label:on(v).submit}):na("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ue.submitSlot,onClick:F=>{Xe&&(F.stopPropagation(),la(!0))},children:A})]})]})});export{sn as AIAutocomplete,Da as AIAutocompleteDropdown,fs as DATE_RANGE_META_END,bs as DATE_RANGE_META_START,ws as DEFAULT_OPTION_COUNT_UNIT,Ps as LOCATION_META_KEY,Ds as PRODUCT_PATH_PREFIX,_s as TIME_META_KEY,Us as WEEKDAY_LABELS,us as buildSubmitResult,ms as cellDay,gs as cellIso,vs as dateCellMarks,xs as formatDate,ys as formatDateRange,ks as formatOptionCount,Cs as formatPlace,Ss as formatTime,Ts as isoDate,Is as monthLabel,Es as optionCountLabel,As as optionHasImage,Rs as optionImageSources,Os as optionImageSrc,Ls as optionLabel,zs as optionsShowLeadingVisuals,Ms as parseDate,Ns as parseLooseDate,Hs as parseLooseDateRange,Fs as parseTime,Bs as productFromMatchedItem,Ws as productImageSources,Gs as productsFromCustomFields,Ks as sanitizeOptionIconSvg,qs as selectedRangeFor,Na as useAIAutocomplete,Vs as visibleDateRange,Qs as withSkippedParams};
3787
3787
  //# sourceMappingURL=index.mjs.map