@magicx-eng/ai-autocomplete-react 0.58.0 → 0.59.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 ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END as ps,DATE_RANGE_META_START as hs,DEFAULT_OPTION_COUNT_UNIT as us,dateCellMarks as ms,formatDate as gs,formatDateRange as fs,formatOptionCount as bs,formatPlace as ws,formatTime as vs,isoDate as xs,LOCATION_META_KEY as ys,monthLabel as ks,optionCountLabel as Cs,optionHasImage as Ss,optionImageSources as Ts,optionImageSrc as Ps,optionLabel as Is,optionsShowLeadingVisuals as Es,PRODUCT_PATH_PREFIX as As,parseDate as Os,parseLooseDate as Rs,parseLooseDateRange as Ls,parseTime as zs,productFromMatchedItem as Ds,productImageSources as Ms,productsFromCustomFields as Ns,sanitizeOptionIconSvg as Fs,selectedRangeFor as Hs,TIME_META_KEY as Bs,visibleDateRange as Ws,WEEKDAY_LABELS as Gs,withSkippedParams as Ks}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Uo,useCallback as Mt,useEffect as Nt,useImperativeHandle as Qo,useLayoutEffect as Yo,useRef as at}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 ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END as ms,DATE_RANGE_META_START as gs,DEFAULT_OPTION_COUNT_UNIT as fs,dateCellMarks as bs,formatDate as ws,formatDateRange as vs,formatOptionCount as xs,formatPlace as ys,formatTime as ks,isoDate as Cs,LOCATION_META_KEY as Ss,monthLabel as Ts,optionCountLabel as Ps,optionHasImage as Is,optionImageSources as Es,optionImageSrc as As,optionLabel as Rs,optionsShowLeadingVisuals as Os,PRODUCT_PATH_PREFIX as Ls,parseDate as zs,parseLooseDate as Ds,parseLooseDateRange as Ms,parseTime as Ns,productFromMatchedItem as Fs,productImageSources as Hs,productsFromCustomFields as Bs,sanitizeOptionIconSvg as Ws,selectedRangeFor as Gs,TIME_META_KEY as Ks,visibleDateRange as qs,WEEKDAY_LABELS as _s,withSkippedParams as Vs}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as jo,useCallback as ya,useEffect as Na,useImperativeHandle as $o,useLayoutEffect as Zo,useRef as ta}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 ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
406
406
  transition: none;
407
407
  }
408
408
  }
409
- `,document.head.appendChild(e)}var Ke={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 to,attachViewportFit as ao,containScroll as io,dateFloorFor as oo,destroyPanelMorph as no,findMultiSelectDone as ro,fitMultiSelectDone as so,hasSkippablePill as lo,isCalendarFormat as co,labelTraditionalAutocomplete as po,panelMorphKey as ho,queryLive as uo,settlePanelMorph as mo,syncPanelHug as go,uiStringsFor as fo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as _e,useLayoutEffect as Ot,useRef as Xe,useState as bo}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 _e={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 oo,attachViewportFit as no,containScroll as ro,dateFloorFor as so,destroyPanelMorph as lo,findMultiSelectDone as co,fitMultiSelectDone as po,hasSkippablePill as ho,isCalendarFormat as uo,labelTraditionalAutocomplete as mo,panelMorphKey as go,queryLive as fo,settlePanelMorph as bo,syncPanelHug as wo,uiStringsFor as vo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ue,useLayoutEffect as Oa,useRef as Xe,useState as xo}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
  *
@@ -653,6 +653,11 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
653
653
  --aia-done-bg: #e4e8f0;
654
654
  --aia-done-bg-hover: #d8dde8;
655
655
  --aia-done-color: #2a3150;
656
+ /* The opt-in "See all results" button (\`seeAllResults\`): a solid
657
+ near-black button under white text. */
658
+ --aia-see-all-bg: #2b2b2b;
659
+ --aia-see-all-bg-hover: #3d3d3d;
660
+ --aia-see-all-color: #ffffff;
656
661
 
657
662
  --aia-footer-hint-color: var(--aia-primitive-neutral-500);
658
663
  --aia-footer-brand-color: var(--aia-primitive-neutral-700);
@@ -719,6 +724,11 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
719
724
  --aia-done-bg: var(--aia-confirm-bg);
720
725
  --aia-done-bg-hover: var(--aia-confirm-bg-hover);
721
726
  --aia-done-color: var(--aia-confirm-color);
727
+ /* A black pill vanishes on the dark surface, so "See all results" takes the
728
+ dark theme's confirm colors too. */
729
+ --aia-see-all-bg: var(--aia-confirm-bg);
730
+ --aia-see-all-bg-hover: var(--aia-confirm-bg-hover);
731
+ --aia-see-all-color: var(--aia-confirm-color);
722
732
 
723
733
  --aia-footer-hint-color: var(--aia-primitive-neutral-700);
724
734
  --aia-footer-brand-color: var(--aia-primitive-neutral-500);
@@ -1572,6 +1582,45 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
1572
1582
  background: var(--aia-multi-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
1573
1583
  }
1574
1584
 
1585
+ /* With a "See all results" button in the same panel, that button is the
1586
+ filled one: Done drops its fill so the panel does not end on two solid
1587
+ bars (vanilla's styles.css explains the two tokens). */
1588
+ .aia-dropdown-yz2KC:has([data-aia-see-all]) .aia-multiDone-y12U7:not(:hover) {
1589
+ background: var(--aia-multi-done-bg-beside-see-all, transparent);
1590
+ color: var(--aia-multi-done-color-beside-see-all, var(--aia-option-color-selected, #2a3150));
1591
+ }
1592
+
1593
+ /* --- See all results (opt-in: \`seeAllResults\`) ---
1594
+ A button under the products that submits the query: near-black in light
1595
+ mode, the confirm gray in dark (appearance.css sets both). The same box as
1596
+ the multi-select Done above it. Declarations match vanilla's styles.css
1597
+ (seeAllResultsParity.test.ts). */
1598
+ .aia-seeAllRow-icrau {
1599
+ padding: 4px 0 0;
1600
+ }
1601
+
1602
+ .aia-seeAll-0Zbgc {
1603
+ display: block;
1604
+ width: 100%;
1605
+ min-height: var(--aia-see-all-height, 48px);
1606
+ padding: 0 16px;
1607
+ border: none;
1608
+ border-radius: var(--aia-see-all-radius, 12px);
1609
+ background: var(--aia-see-all-bg, #2b2b2b);
1610
+ color: var(--aia-see-all-color, #ffffff);
1611
+ font-family: inherit;
1612
+ font-size: var(--aia-see-all-font-size, 16px);
1613
+ font-weight: 700;
1614
+ line-height: 20px;
1615
+ text-align: center;
1616
+ cursor: pointer;
1617
+ transition: background-color 150ms ease-out;
1618
+ }
1619
+
1620
+ .aia-seeAll-0Zbgc:hover {
1621
+ background: var(--aia-see-all-bg-hover, #3d3d3d);
1622
+ }
1623
+
1575
1624
  /* The open panel's leaving ghost (panelMorph.ts) is a frozen copy of the
1576
1625
  last step: the rows' own entrance must not replay in it while it fades. */
1577
1626
  .aia-dropdown-yz2KC .magicx-aia-panel-ghost,
@@ -1638,7 +1687,29 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
1638
1687
  animation: aia-multiActionsFadeIn-zbGTG 160ms ease-out;
1639
1688
  }
1640
1689
 
1690
+ /* "See all results" leaves and returns with the options the same way. */
1691
+ .aia-dropdown-yz2KC[data-aia-loading] [data-aia-see-all] {
1692
+ pointer-events: none;
1693
+ animation: aia-seeAllLoadingOut-THnrl 160ms ease-in forwards;
1694
+ }
1695
+
1696
+ .aia-dropdown-yz2KC:not([data-aia-loading]) [data-aia-see-all] {
1697
+ animation: aia-seeAllFadeIn-1GWpl 160ms ease-out;
1698
+ }
1699
+
1641
1700
  /* Ends and starts a hair above zero: iOS cancels a tap on an element at 0. */
1701
+ @keyframes aia-seeAllLoadingOut-THnrl {
1702
+ to {
1703
+ opacity: 0.01;
1704
+ }
1705
+ }
1706
+
1707
+ @keyframes aia-seeAllFadeIn-1GWpl {
1708
+ from {
1709
+ opacity: 0.01;
1710
+ }
1711
+ }
1712
+
1642
1713
  @keyframes aia-multiActionsLoadingOut-lSdMh {
1643
1714
  to {
1644
1715
  opacity: 0.01;
@@ -1653,7 +1724,7 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
1653
1724
  opacity: 1;
1654
1725
  }
1655
1726
  }
1656
- `,document.head.appendChild(e)}var ve={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",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG"};import{cellDay as Ha,cellIso as rt,dateCellMarks as Ba,isDimmedDay as Wa,isoDate as Ga,monthLabel as Ka,visibleDateRange as qa,WEEKDAY_LABELS as _a}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as Va}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) ---
1727
+ `,document.head.appendChild(e)}var ce={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 Gt,cellIso as la,dateCellMarks as Kt,isDimmedDay as qt,isoDate as _t,monthLabel as Vt,visibleDateRange as Ut,WEEKDAY_LABELS as Qt}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as Yt}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) ---
1657
1728
 
1658
1729
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1659
1730
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1850,7 +1921,7 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
1850
1921
  opacity: 0.8;
1851
1922
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1852
1923
  }
1853
- `,document.head.appendChild(e)}var G={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 xe,jsxs as Ut}from"react/jsx-runtime";var Ua=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Qt({options:e,activeIndex:o,listboxId:t,view:a,selection:i,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:b,onNextMonth:w}){let y=Ga(new Date),m=qa({pendingStart:i.rangeStart,highlightedIso:rt(e[o]),selected:i.selectedRange,floor:i.floor});return Ut("div",{className:G.datepicker,"data-aia-datepicker":"",children:[Ut("div",{className:G.header,children:[xe("button",{type:"button",tabIndex:-1,className:G.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:b,children:"\u2039"}),xe("span",{className:G.month,"data-aia-date-month":"","aria-live":"polite",children:Ka(a)}),xe("button",{type:"button",tabIndex:-1,className:G.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:w,children:"\u203A"})]}),xe("div",{className:G.weekdays,"aria-hidden":"true",children:_a.map((h,c)=>xe("span",{className:G.weekday,children:h},Ua[c]))}),xe("div",{className:G.grid,"data-aia-date-grid":"",children:e.map((h,c)=>xe(Qa,{option:h,id:`${t}-option-${c}`,index:c,isHighlighted:c===o&&h.is_tappable,isToday:rt(h)===y,isPast:Wa(rt(h),y,i.floor),marks:Ba(rt(h),{selectedIso:i.selectedIso,range:m,references:i.references}),onSelect:s,onHighlight:r,onUnhighlight:l},rt(h)??`pad-${c}`))})]})}function Qa({option:e,id:o,index:t,isHighlighted:a,isToday:i,isPast:s,marks:r,onSelect:l,onHighlight:b,onUnhighlight:w}){let[y,m]=Va(!1),h=Ha(e);if(h==null)return xe("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${G.cell} ${G.blank}`});let c=()=>{m(!0),l(e),setTimeout(()=>m(!1),170)},v=[G.cell,G.day,s?G.past:"",a?G.highlighted:"",i?G.today:"",r.inRange?G.inRange:"",r.selected?G.selected:"",r.reference?G.reference:"",y?G.pressed:""].filter(Boolean).join(" ");return xe("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":a,"aria-label":e.text,tabIndex:0,className:v,onClick:c,onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),c())},onMouseEnter:()=>b(t),onMouseLeave:w?()=>w(t):void 0,children:xe("span",{className:G.number,children:h})})}import{ATTRIBUTION_URL as Ya,buildAttributionUrl as ja,getFooterHint as $a,uiStringsFor as Za}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Xa,useState as Ja}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 {
1924
+ `,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 xe,jsxs as Qa}from"react/jsx-runtime";var jt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ya({options:e,activeIndex:n,listboxId:a,view:t,selection:o,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:f,onNextMonth:w}){let y=_t(new Date),m=Ut({pendingStart:o.rangeStart,highlightedIso:la(e[n]),selected:o.selectedRange,floor:o.floor});return Qa("div",{className:K.datepicker,"data-aia-datepicker":"",children:[Qa("div",{className:K.header,children:[xe("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:f,children:"\u2039"}),xe("span",{className:K.month,"data-aia-date-month":"","aria-live":"polite",children:Vt(t)}),xe("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:w,children:"\u203A"})]}),xe("div",{className:K.weekdays,"aria-hidden":"true",children:Qt.map((h,c)=>xe("span",{className:K.weekday,children:h},jt[c]))}),xe("div",{className:K.grid,"data-aia-date-grid":"",children:e.map((h,c)=>xe($t,{option:h,id:`${a}-option-${c}`,index:c,isHighlighted:c===n&&h.is_tappable,isToday:la(h)===y,isPast:qt(la(h),y,o.floor),marks:Kt(la(h),{selectedIso:o.selectedIso,range:m,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:l},la(h)??`pad-${c}`))})]})}function $t({option:e,id:n,index:a,isHighlighted:t,isToday:o,isPast:s,marks:r,onSelect:l,onHighlight:f,onUnhighlight:w}){let[y,m]=Yt(!1),h=Gt(e);if(h==null)return xe("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 c=()=>{m(!0),l(e),setTimeout(()=>m(!1),170)},v=[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 xe("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":t,"aria-label":e.text,tabIndex:0,className:v,onClick:c,onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),c())},onMouseEnter:()=>f(a),onMouseLeave:w?()=>w(a):void 0,children:xe("span",{className:K.number,children:h})})}import{ATTRIBUTION_URL as Zt,buildAttributionUrl as Xt,getFooterHint as Jt,uiStringsFor as ei}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ai,useState as ti}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 {
1854
1925
  display: flex;
1855
1926
  flex-wrap: wrap;
1856
1927
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1890,7 +1961,7 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
1890
1961
  .aia-cluster[data-justify="around"] {
1891
1962
  justify-content: space-around;
1892
1963
  }
1893
- `,document.head.appendChild(e)}import{jsx as Yt}from"react/jsx-runtime";function st({gap:e,align:o="center",justify:t="start",noWrap:a=!1,inline:i=!1,className:s,children:r,...l}){let b=e?{"--aia-cluster-gap":e}:void 0,w={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":o,"data-justify":t,"data-nowrap":a||void 0,"data-inline":i||void 0,style:b,...l};return i?Yt("span",{...w,children:r}):Yt("div",{...w,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
1964
+ `,document.head.appendChild(e)}import{jsx as ja}from"react/jsx-runtime";function da({gap:e,align:n="center",justify:a="start",noWrap:t=!1,inline:o=!1,className:s,children:r,...l}){let f=e?{"--aia-cluster-gap":e}:void 0,w={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":n,"data-justify":a,"data-nowrap":t||void 0,"data-inline":o||void 0,style:f,...l};return o?ja("span",{...w,children:r}):ja("div",{...w,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
1894
1965
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
1895
1966
  room above the hint/branding row so the footer doesn't butt against the last
1896
1967
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -2037,7 +2108,7 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
2037
2108
  justify-content: flex-end;
2038
2109
  }
2039
2110
  }
2040
- `,document.head.appendChild(e)}var Ie={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 lt,jsxs as kt}from"react/jsx-runtime";function jt({isOptionHighlighted:e=!1,isInputEmpty:o=!1,strings:t=Za()}){let{key:a,hint:i}=$a(e,o,t),[s,r]=Ja(Ya);return Xa(()=>{r(ja())},[]),lt("footer",{className:Ie.footer,"data-aia-footer":"",children:kt(st,{justify:"between",noWrap:!0,className:Ie.row,children:[kt(st,{gap:"5px",className:Ie.hintGroup,children:[lt("kbd",{className:Ie.key,children:a}),lt("span",{className:Ie.hint,children:i})]}),kt("a",{className:Ie.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[lt("span",{className:Ie.brand,children:"AI"}),lt("span",{className:Ie.badge,children:"Autocomplete"})]})]})})}import{useEffect as $t,useLayoutEffect as ei,useRef as ce}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
2111
+ `,document.head.appendChild(e)}var Ae={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 ca,jsxs as Ca}from"react/jsx-runtime";function $a({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:a=ei()}){let{key:t,hint:o}=Jt(e,n,a),[s,r]=ti(Zt);return ai(()=>{r(Xt())},[]),ca("footer",{className:Ae.footer,"data-aia-footer":"",children:Ca(da,{justify:"between",noWrap:!0,className:Ae.row,children:[Ca(da,{gap:"5px",className:Ae.hintGroup,children:[ca("kbd",{className:Ae.key,children:t}),ca("span",{className:Ae.hint,children:o})]}),Ca("a",{className:Ae.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[ca("span",{className:Ae.brand,children:"AI"}),ca("span",{className:Ae.badge,children:"Autocomplete"})]})]})})}import{useEffect as Za,useLayoutEffect as ii,useRef as pe}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
2041
2112
  Angular copy). The three are kept identical by
2042
2113
  packages/vanilla/tests/render/locationFieldParity.test.ts. */
2043
2114
  .aia-location-6-fsr {
@@ -2171,7 +2242,7 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
2171
2242
  .aia-loadingBar-OLCr4:nth-child(3) {
2172
2243
  width: 60%;
2173
2244
  }
2174
- `,document.head.appendChild(e)}var V={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 De}from"react/jsx-runtime";var ti=0;function dt(e){return e.getRootNode().activeElement??null}function Jt(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Zt(e){if(!e.isContentEditable)return null;let o=Jt(e);if(!o||o.rangeCount===0)return null;let t=o.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function Xt(e,o){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=Jt(e);if(!t)return;let a=o;(!a||!a.startContainer.isConnected||!e.contains(a.startContainer))&&(a=document.createRange(),a.selectNodeContents(e),a.collapse(!1)),t.removeAllRanges(),t.addRange(a)}var ai=De("svg",{className:V.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"})]}),ii=De("svg",{className:V.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 ea({view:e,searchLabel:o,noResultsLabel:t,useTypedLabel:a,widgetFocused:i,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:b,onMove:w,onCommit:y,onFocusChange:m}){let h=ce(null),c=ce(null),v=ce(null),E=ce(null),K=ce(null),D=ce(!1),R=ce(!1),ee=ce(!1),P=ce(!1),z=ce(i);z.current=i;let q=ce(m);q.current=m;let N=d=>{P.current=d,m(d)},Q=()=>{let d=h.current;return d!=null&&dt(d)===d},A=()=>{let d=c.current;if(!d)return;let T=dt(d);T instanceof HTMLElement&&T!==h.current&&T!==document.body&&!d.contains(T)&&(E.current=T,K.current=Zt(T))},$=d=>{let T=c.current;!T||!(d instanceof HTMLElement)||d===E.current||d===document.body||T.contains(d)||(E.current=d,K.current=Zt(d))},W=ce(null);W.current===null&&(W.current=`aia-location-${++ti}`);let F=`${W.current}-row-`;$t(()=>{let d=h.current;d&&d.value!==e.query&&dt(d)!==d&&(d.value=e.query)},[e.query]),$t(()=>{i&&(s&&!ee.current&&(R.current=!1),ee.current=s);let d=h.current;if(d){if(!r&&Q()){R.current=!0,Y();return}if(!i){setTimeout(()=>{if(z.current)return;let T=E.current;T&&dt(T)===T||(R.current=!1)},0);return}if(!(!s||R.current||!l||Q())){if(A(),N(!0),d.focus({preventScroll:!0}),!Q()){R.current=!0,N(!1);return}d.value&&d.select()}}}),ei(()=>()=>{if(!P.current)return;let d=h.current,T=E.current;T?.isConnected&&d&&dt(d)===d&&(D.current=!0,Xt(T,K.current),D.current=!1),P.current=!1,q.current(!1)},[]);let Y=(d=!1)=>{d&&(R.current=!0);let T=E.current;T?.isConnected&&Q()&&(D.current=!0,Xt(T,K.current),D.current=!1),N(!1)},re=e.query.trim(),S=e.highlighted>=0&&e.highlighted<e.places.length?`${F}${e.highlighted}`:void 0,H=null;return e.places.length>0?H=e.places.map((d,T)=>De("div",{id:`${F}${T}`,role:"option","aria-selected":T===e.highlighted,className:T===e.highlighted?`${V.row} ${V.highlighted}`:V.row,"data-aia-location-row":"","data-aia-index":T,onClick:()=>{l&&(Y(!0),y(T))},children:[ne("span",{className:V.pin,children:ai}),De("span",{className:V.text,children:[ne("span",{className:V.name,children:d.name}),d.secondary&&ne("span",{className:V.secondary,children:d.secondary})]})]},d.id)):e.status==="loading"?H=De("div",{className:V.loading,"data-aia-location-loading":"",children:[ne("span",{className:V.loadingBar}),ne("span",{className:V.loadingBar}),ne("span",{className:V.loadingBar})]}):re&&(H=De("div",{className:V.note,"data-aia-location-note":"",children:[e.status==="done"&&ne("span",{className:V.empty,children:t}),ne("span",{children:a})]})),De("div",{ref:c,className:V.location,"data-aia-location":"",onMouseDown:d=>{!(d.target instanceof Node)||!v.current?.contains(d.target)||(d.stopPropagation(),A(),N(!0))},children:[De("label",{ref:v,className:V.field,children:[ii,ne("input",{ref:h,type:"text",className:V.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:o,"aria-label":o,"aria-activedescendant":S,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:d=>b(d.target.value),onFocus:d=>{$(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(),w(d.key==="ArrowDown"?1:-1);return;case"Enter":if(d.preventDefault(),!l)return;Y(!0),y();return;case"Escape":d.preventDefault(),d.stopPropagation(),R.current=!0,Y();return;case"Backspace":if(d.currentTarget.value!=="")return;d.preventDefault(),R.current=!0,Y();return}}})]}),ne("div",{className:V.results,"data-aia-location-results":"","aria-live":"polite",children:H})]})}import{isSmartSuggestion as si,isTraditionalAutocompleteSuggestion as li}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as oi}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,
2245
+ `,document.head.appendChild(e)}var U={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};import{jsx as le,jsxs as Ne}from"react/jsx-runtime";var oi=0;function pa(e){return e.getRootNode().activeElement??null}function et(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Xa(e){if(!e.isContentEditable)return null;let n=et(e);if(!n||n.rangeCount===0)return null;let a=n.getRangeAt(0);return e.contains(a.startContainer)?a.cloneRange():null}function Ja(e,n){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let a=et(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 ni=Ne("svg",{className:U.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[le("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),le("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),ri=Ne("svg",{className:U.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[le("circle",{cx:"11",cy:"11",r:"7"}),le("path",{d:"m20 20-3.5-3.5"})]});function at({view:e,searchLabel:n,noResultsLabel:a,useTypedLabel:t,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:f,onMove:w,onCommit:y,onFocusChange:m}){let h=pe(null),c=pe(null),v=pe(null),I=pe(null),q=pe(null),D=pe(!1),O=pe(!1),te=pe(!1),T=pe(!1),z=pe(o);z.current=o;let _=pe(m);_.current=m;let F=d=>{T.current=d,m(d)},Y=()=>{let d=h.current;return d!=null&&pa(d)===d},E=()=>{let d=c.current;if(!d)return;let S=pa(d);S instanceof HTMLElement&&S!==h.current&&S!==document.body&&!d.contains(S)&&(I.current=S,q.current=Xa(S))},X=d=>{let S=c.current;!S||!(d instanceof HTMLElement)||d===I.current||d===document.body||S.contains(d)||(I.current=d,q.current=Xa(d))},G=pe(null);G.current===null&&(G.current=`aia-location-${++oi}`);let H=`${G.current}-row-`;Za(()=>{let d=h.current;d&&d.value!==e.query&&pa(d)!==d&&(d.value=e.query)},[e.query]),Za(()=>{o&&(s&&!te.current&&(O.current=!1),te.current=s);let d=h.current;if(d){if(!r&&Y()){O.current=!0,j();return}if(!o){setTimeout(()=>{if(z.current)return;let S=I.current;S&&pa(S)===S||(O.current=!1)},0);return}if(!(!s||O.current||!l||Y())){if(E(),F(!0),d.focus({preventScroll:!0}),!Y()){O.current=!0,F(!1);return}d.value&&d.select()}}}),ii(()=>()=>{if(!T.current)return;let d=h.current,S=I.current;S?.isConnected&&d&&pa(d)===d&&(D.current=!0,Ja(S,q.current),D.current=!1),T.current=!1,_.current(!1)},[]);let j=(d=!1)=>{d&&(O.current=!0);let S=I.current;S?.isConnected&&Y()&&(D.current=!0,Ja(S,q.current),D.current=!1),F(!1)},de=e.query.trim(),C=e.highlighted>=0&&e.highlighted<e.places.length?`${H}${e.highlighted}`:void 0,B=null;return e.places.length>0?B=e.places.map((d,S)=>Ne("div",{id:`${H}${S}`,role:"option","aria-selected":S===e.highlighted,className:S===e.highlighted?`${U.row} ${U.highlighted}`:U.row,"data-aia-location-row":"","data-aia-index":S,onClick:()=>{l&&(j(!0),y(S))},children:[le("span",{className:U.pin,children:ni}),Ne("span",{className:U.text,children:[le("span",{className:U.name,children:d.name}),d.secondary&&le("span",{className:U.secondary,children:d.secondary})]})]},d.id)):e.status==="loading"?B=Ne("div",{className:U.loading,"data-aia-location-loading":"",children:[le("span",{className:U.loadingBar}),le("span",{className:U.loadingBar}),le("span",{className:U.loadingBar})]}):de&&(B=Ne("div",{className:U.note,"data-aia-location-note":"",children:[e.status==="done"&&le("span",{className:U.empty,children:a}),le("span",{children:t})]})),Ne("div",{ref:c,className:U.location,"data-aia-location":"",onMouseDown:d=>{!(d.target instanceof Node)||!v.current?.contains(d.target)||(d.stopPropagation(),E(),F(!0))},children:[Ne("label",{ref:v,className:U.field,children:[ri,le("input",{ref:h,type:"text",className:U.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:n,"aria-label":n,"aria-activedescendant":C,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:d=>f(d.target.value),onFocus:d=>{X(d.relatedTarget),F(!0)},onBlur:()=>{D.current||(O.current=!0,F(!1))},onKeyDown:d=>{if(!d.nativeEvent.isComposing)switch(d.key){case"ArrowDown":case"ArrowUp":d.preventDefault(),w(d.key==="ArrowDown"?1:-1);return;case"Enter":if(d.preventDefault(),!l)return;j(!0),y();return;case"Escape":d.preventDefault(),d.stopPropagation(),O.current=!0,j();return;case"Backspace":if(d.currentTarget.value!=="")return;d.preventDefault(),O.current=!0,j();return}}})]}),le("div",{className:U.results,"data-aia-location-results":"","aria-live":"polite",children:B})]})}import{isSmartSuggestion as ci,isTraditionalAutocompleteSuggestion as pi}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as si}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,
2175
2246
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
2176
2247
  The border is kept as a 1px transparent line so the box stays the same size
2177
2248
  as it was when the outline was dashed. */
@@ -2329,7 +2400,7 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
2329
2400
  opacity: 0;
2330
2401
  }
2331
2402
  }
2332
- `,document.head.appendChild(e)}var ye={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 ni,jsx as Ct,jsxs as ri}from"react/jsx-runtime";var St={selected:1,first:.7,next:.4,last:.2};function ta({label:e,state:o,active:t,rounded:a,loading:i,smartSuggestion:s,completionHeader:r,onClick:l}){let b=[ye.pill,a?ye.rounded:"",i?ye.skeleton:""].filter(Boolean).join(" ");return Ct("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":i?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:b,style:{"--aia-pill-opacity":St[o]},onMouseDown:w=>w.preventDefault(),onClick:i?void 0:l,disabled:i,children:s?ri(ni,{children:[Ct("span",{className:`${ye.smartText} magicx-aia-smart-suggestion-text`,children:e}),Ct("span",{className:`${ye.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:oi}})]}):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 {
2403
+ `,document.head.appendChild(e)}var ye={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 li,jsx as Sa,jsxs as di}from"react/jsx-runtime";var Ta={selected:1,first:.7,next:.4,last:.2};function tt({label:e,state:n,active:a,rounded:t,loading:o,smartSuggestion:s,completionHeader:r,onClick:l}){let f=[ye.pill,t?ye.rounded:"",o?ye.skeleton:""].filter(Boolean).join(" ");return Sa("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:f,style:{"--aia-pill-opacity":Ta[n]},onMouseDown:w=>w.preventDefault(),onClick:o?void 0:l,disabled:o,children:s?di(li,{children:[Sa("span",{className:`${ye.smartText} magicx-aia-smart-suggestion-text`,children:e}),Sa("span",{className:`${ye.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:si}})]}):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 {
2333
2404
  position: relative;
2334
2405
  z-index: 1;
2335
2406
  pointer-events: auto;
@@ -2339,7 +2410,7 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
2339
2410
  align-items: center;
2340
2411
  vertical-align: middle;
2341
2412
  }
2342
- `,document.head.appendChild(e)}var Tt={list:"aia-list-qvLqO"};import{jsx as ut}from"react/jsx-runtime";var di=[125,69];function aa(e){return e===0?"first":e===1?"next":"last"}function mt({pills:e,activePillIndex:o,onSelectPill:t,activeSelected:a,rounded:i,loading:s}){return s&&e.length===0?ut("span",{className:Tt.list,"data-aia-pill-list-loading":"",children:di.map((r,l)=>ut("span",{"data-aia-pill-skeleton":"",className:`${ye.pill} ${i?ye.rounded:""} ${ye.skeleton}`,style:{width:r,"--aia-pill-opacity":St[aa(l)]}},`skel-${r}`))}):ut("span",{className:Tt.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,l)=>{let b=!!a&&l===o;return ut(ta,{label:r.text,state:b?"selected":aa(l),selected:b,active:l===o,rounded:i,loading:s,smartSuggestion:si(r),completionHeader:li(r),onClick:()=>t(l)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as ci,productImageSources as pi,productImageSrc as hi,productInitial as ui,productPhotoFill as mi,uiStringsFor as gi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Pt,useRef as gt,useState as ft}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
2413
+ `,document.head.appendChild(e)}var Pa={list:"aia-list-qvLqO"};import{jsx as ga}from"react/jsx-runtime";var hi=[125,69];function it(e){return e===0?"first":e===1?"next":"last"}function fa({pills:e,activePillIndex:n,onSelectPill:a,activeSelected:t,rounded:o,loading:s}){return s&&e.length===0?ga("span",{className:Pa.list,"data-aia-pill-list-loading":"",children:hi.map((r,l)=>ga("span",{"data-aia-pill-skeleton":"",className:`${ye.pill} ${o?ye.rounded:""} ${ye.skeleton}`,style:{width:r,"--aia-pill-opacity":Ta[it(l)]}},`skel-${r}`))}):ga("span",{className:Pa.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,l)=>{let f=!!t&&l===n;return ga(tt,{label:r.text,state:f?"selected":it(l),selected:f,active:l===n,rounded:o,loading:s,smartSuggestion:ci(r),completionHeader:pi(r),onClick:()=>a(l)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as ui,productImageSources as mi,productImageSrc as gi,productInitial as fi,productPhotoFill as bi,uiStringsFor as wi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ia,useRef as ba,useState as wa}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
2343
2414
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
2344
2415
  theming one package sees the same result in the other.
2345
2416
 
@@ -2932,7 +3003,7 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
2932
3003
  opacity: 0.01;
2933
3004
  }
2934
3005
  }
2935
- `,document.head.appendChild(e)}var U={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 X,jsxs as Ze}from"react/jsx-runtime";function ia({products:e,listboxId:o,onSelect:t,onAddToCart:a,onFocusChange:i,focusable:s=!0,loading:r=!1,layout:l="row",imageFallback:b="image",strings:w=gi()}){let y=e.length>0,m=gt(null);if(Pt(()=>{let c=m.current;if(!(!y||!c))return ci(c)},[y]),!y)return null;let h=`${o}-products-label`;return Ze("section",{className:U.section,"data-aia-products":"","data-aia-loading":r?"":void 0,"data-aia-products-layout":l,role:"group","aria-labelledby":h,children:[X("div",{className:U.label,id:h,"data-aia-products-label":"",children:w.products}),X("div",{ref:m,className:U.row,"data-aia-products-row":"",children:e.map((c,v)=>X(fi,{product:c,id:`${o}-product-${v}`,onSelect:t,onAddToCart:a,onFocusChange:i,focusable:s,imageFallback:b,soldOut:w.soldOut,addToCart:w.addToCart},c.id))})]})}function fi({product:e,id:o,onSelect:t,onAddToCart:a,onFocusChange:i,focusable:s,imageFallback:r,soldOut:l,addToCart:b}){let w=!!a&&e.available!==!1,[y,m]=ft(null),h=v=>{v.relatedTarget?.closest("[data-aia-dropdown]")||i?.(!1)},c=v=>{v.metaKey||v.ctrlKey||v.shiftKey||v.altKey||v.button!==0||(v.preventDefault(),t(e))};return Ze("a",{id:o,className:U.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":w?"":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:c,onKeyDown:v=>{v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),t(e))},onFocus:()=>i?.(!0),onBlur:h,children:[X(vi,{sources:pi(e.imageUrl),title:e.title,fallback:r,onPhotoFill:m},hi(e.imageUrl)??""),Ze("span",{className:U.body,children:[e.vendor?X("span",{className:U.vendor,children:e.vendor}):null,X("span",{className:U.title,children:e.title}),e.price?Ze("span",{className:U.price,children:[e.price,e.compareAtPrice?X("s",{className:U.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?X("span",{className:U.badge,children:l}):null]}),w&&a?X(wi,{product:e,label:`${b}: ${e.title}`,focusable:s,onAddToCart:a,onFocus:()=>i?.(!0),onBlur:h},bi(e)):null]})}function bi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(o=>o??"").join("\0")}function wi({product:e,label:o,focusable:t,onAddToCart:a,onFocus:i,onBlur:s}){let[r,l]=ft(null),b=gt(null),w=gt(e);w.current=e;let y=gt(!0);Pt(()=>(y.current=!0,()=>{y.current=!1}),[]);let m=c=>{b.current=c,y.current&&l(c)},h=c=>{if(c.preventDefault(),c.stopPropagation(),b.current==="adding")return;m("adding");let v;try{v=Promise.resolve(a(w.current))}catch(E){v=Promise.reject(E)}v.then(()=>m("added"),()=>m(null))};return X("span",{className:U.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":o,tabIndex:t?0:-1,onClick:h,onKeyDown:c=>{c.key!=="Enter"&&c.key!==" "||h(c)},onFocus:c=>{c.stopPropagation(),i()},onBlur:c=>{c.stopPropagation(),s(c)},children:Ze("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[X("path",{className:U.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"}),X("path",{className:U.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),X("path",{className:U.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),X("path",{className:U.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),X("circle",{className:U.cartGlyph,cx:"9",cy:"20",r:"1.3"}),X("circle",{className:U.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function vi({sources:e,title:o,fallback:t,onPhotoFill:a}){let[i,s]=ft(0),r=e[i],l=!!r,[b,w]=ft(null),y=!l&&t==="initial";return Pt(()=>()=>a(null),[a]),Ze("span",{className:U.media,"aria-hidden":"true","data-aia-product-placeholder":!l&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":l&&b===r?"":void 0,children:[l?X("img",{className:U.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{w(r),a(mi(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{i+1>=e.length&&a(null),s(m=>m+1)}}):null,y?ui(o):null]})}import{isOptionsGridMobileViewport as zi,measureOptionsGrid as Di,needsOptionsGridMeasurement as Mi,OPTIONS_GRID_MOBILE_QUERY as Ni,optionEnterDelayMs as Fi,optionsShowLeadingVisuals as Hi,planOptionsGrid as la,releasePanelHug as Bi,sameOptionRows as Wi,syncPanelHug as Gi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ki,useLayoutEffect as da,useRef as ca,useState as ha}from"react";import{optionsGridTemplateColumns as xi}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as yi,useRef as ki}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 {
3006
+ `,document.head.appendChild(e)}var Q={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};import{jsx as ee,jsxs as Ze}from"react/jsx-runtime";function ot({products:e,listboxId:n,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s=!0,loading:r=!1,layout:l="row",imageFallback:f="image",strings:w=wi()}){let y=e.length>0,m=ba(null);if(Ia(()=>{let c=m.current;if(!(!y||!c))return ui(c)},[y]),!y)return null;let h=`${n}-products-label`;return Ze("section",{className:Q.section,"data-aia-products":"","data-aia-loading":r?"":void 0,"data-aia-products-layout":l,role:"group","aria-labelledby":h,children:[ee("div",{className:Q.label,id:h,"data-aia-products-label":"",children:w.products}),ee("div",{ref:m,className:Q.row,"data-aia-products-row":"",children:e.map((c,v)=>ee(vi,{product:c,id:`${n}-product-${v}`,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s,imageFallback:f,soldOut:w.soldOut,addToCart:w.addToCart},c.id))})]})}function vi({product:e,id:n,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s,imageFallback:r,soldOut:l,addToCart:f}){let w=!!t&&e.available!==!1,[y,m]=wa(null),h=v=>{v.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},c=v=>{v.metaKey||v.ctrlKey||v.shiftKey||v.altKey||v.button!==0||(v.preventDefault(),a(e))};return Ze("a",{id:n,className:Q.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":w?"":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:c,onKeyDown:v=>{v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),a(e))},onFocus:()=>o?.(!0),onBlur:h,children:[ee(ki,{sources:mi(e.imageUrl),title:e.title,fallback:r,onPhotoFill:m},gi(e.imageUrl)??""),Ze("span",{className:Q.body,children:[e.vendor?ee("span",{className:Q.vendor,children:e.vendor}):null,ee("span",{className:Q.title,children:e.title}),e.price?Ze("span",{className:Q.price,children:[e.price,e.compareAtPrice?ee("s",{className:Q.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?ee("span",{className:Q.badge,children:l}):null]}),w&&t?ee(yi,{product:e,label:`${f}: ${e.title}`,focusable:s,onAddToCart:t,onFocus:()=>o?.(!0),onBlur:h},xi(e)):null]})}function xi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(n=>n??"").join("\0")}function yi({product:e,label:n,focusable:a,onAddToCart:t,onFocus:o,onBlur:s}){let[r,l]=wa(null),f=ba(null),w=ba(e);w.current=e;let y=ba(!0);Ia(()=>(y.current=!0,()=>{y.current=!1}),[]);let m=c=>{f.current=c,y.current&&l(c)},h=c=>{if(c.preventDefault(),c.stopPropagation(),f.current==="adding")return;m("adding");let v;try{v=Promise.resolve(t(w.current))}catch(I){v=Promise.reject(I)}v.then(()=>m("added"),()=>m(null))};return ee("span",{className:Q.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:c=>{c.key!=="Enter"&&c.key!==" "||h(c)},onFocus:c=>{c.stopPropagation(),o()},onBlur:c=>{c.stopPropagation(),s(c)},children:Ze("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[ee("path",{className:Q.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),ee("path",{className:Q.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),ee("path",{className:Q.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),ee("path",{className:Q.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),ee("circle",{className:Q.cartGlyph,cx:"9",cy:"20",r:"1.3"}),ee("circle",{className:Q.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function ki({sources:e,title:n,fallback:a,onPhotoFill:t}){let[o,s]=wa(0),r=e[o],l=!!r,[f,w]=wa(null),y=!l&&a==="initial";return Ia(()=>()=>t(null),[t]),Ze("span",{className:Q.media,"aria-hidden":"true","data-aia-product-placeholder":!l&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":l&&f===r?"":void 0,children:[l?ee("img",{className:Q.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{w(r),t(bi(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&t(null),s(m=>m+1)}}):null,y?fi(n):null]})}import{isOptionsGridMobileViewport as Ni,measureOptionsGrid as Fi,needsOptionsGridMeasurement as Hi,OPTIONS_GRID_MOBILE_QUERY as Bi,optionEnterDelayMs as Wi,optionsShowLeadingVisuals as Gi,planOptionsGrid as dt,releasePanelHug as Ki,sameOptionRows as qi,syncPanelHug as _i}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Vi,useLayoutEffect as ct,useRef as pt,useState as ut}from"react";import{optionsGridTemplateColumns as Ci}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Si,useRef as Ti}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 {
2936
3007
  display: grid;
2937
3008
  grid-template-columns: repeat(
2938
3009
  auto-fit,
@@ -2976,7 +3047,7 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
2976
3047
  :where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
2977
3048
  max-height: var(--aia-grid-max-height, 120px);
2978
3049
  }
2979
- `,document.head.appendChild(e)}import{jsx as Ci}from"react/jsx-runtime";function oa({min:e="16rem",max:o,gap:t,scroll:a=!1,maxHeight:i,scrollResetKey:s,cols:r,template:l,innerRef:b,className:w,children:y,...m}){let h=ki(null);yi(()=>{if(s===void 0)return;let v=h.current;v&&(v.scrollTop=0)},[s]);let c={"--aia-grid-min":e};return o&&(c["--aia-grid-max"]=o),t&&(c["--aia-grid-gap"]=t),i&&(c["--aia-grid-max-height"]=i),r&&(c.gridTemplateColumns=xi(r)),l&&(c.gridTemplateColumns=l),Ci("div",{ref:v=>{h.current=v,b?.(v)},className:w?`aia-grid ${w}`:"aia-grid","data-scroll":a||void 0,style:c,...m,children:y})}import{formatOptionCount as Si,highlightParts as Ti,isMultiSelectToggleTap as Pi,OPTION_ENTER_DELAY_VAR as Ii,optionImageSources as na,optionLabel as ra,sanitizeOptionIconSvg as Ei}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ai,useMemo as Oi,useRef as Ri,useState as ct}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
3050
+ `,document.head.appendChild(e)}import{jsx as Pi}from"react/jsx-runtime";function nt({min:e="16rem",max:n,gap:a,scroll:t=!1,maxHeight:o,scrollResetKey:s,cols:r,template:l,innerRef:f,className:w,children:y,...m}){let h=Ti(null);Si(()=>{if(s===void 0)return;let v=h.current;v&&(v.scrollTop=0)},[s]);let c={"--aia-grid-min":e};return n&&(c["--aia-grid-max"]=n),a&&(c["--aia-grid-gap"]=a),o&&(c["--aia-grid-max-height"]=o),r&&(c.gridTemplateColumns=Ci(r)),l&&(c.gridTemplateColumns=l),Pi("div",{ref:v=>{h.current=v,f?.(v)},className:w?`aia-grid ${w}`:"aia-grid","data-scroll":t||void 0,style:c,...m,children:y})}import{formatOptionCount as Ii,highlightParts as Ei,isMultiSelectToggleTap as Ai,OPTION_ENTER_DELAY_VAR as Ri,optionImageSources as rt,optionLabel as st,sanitizeOptionIconSvg as Oi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Li,useMemo as zi,useRef as Di,useState as ha}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 {
2980
3051
  position: relative;
2981
3052
  /* Clip, not visible: the entrance rise below runs on the inner content,
2982
3053
  and a transformed box extends its scroll container's scrollable area.
@@ -3496,7 +3567,7 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
3496
3567
  border-radius: 6px;
3497
3568
  font-size: 11px;
3498
3569
  }
3499
- `,document.head.appendChild(e)}var j={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 Li,jsx as ue,jsxs as It}from"react/jsx-runtime";function sa({option:e,isHighlighted:o,checked:t,onSelect:a,onHighlight:i,onUnhighlight:s,id:r,loading:l,showIcon:b=!0,showImage:w=!0,showCount:y=!0,scrollHint:m,enterDelayMs:h=0}){let[c]=ct(h),[v,E]=ct(!1),K=w?na(e.image_url):[],D=K[0]??null,[R,ee]=ct([]),P=K.find(S=>!R.includes(S))??null,z=w?(e.imageCollage??[]).map(S=>na(S)[0]).filter(S=>S!==void 0):[],[q,N]=ct(!1),[Q,A]=ct(null),$=Oi(()=>!D&&b&&e.icon_svg?Ei(e.icon_svg):null,[D,b,e.icon_svg]),W=y?Si(e.item_count):null,F=Ri(void 0);Ai(()=>()=>clearTimeout(F.current),[]);let Y=S=>{if(l||!e.is_tappable||v&&t===void 0)return;E(!0);let H=S?.currentTarget;t!==void 0&&H!==void 0&&S!==void 0&&!Pi(H,H.querySelector("[data-aia-checkbox]"),S)?a(e,{commit:!0}):a(e),clearTimeout(F.current),F.current=setTimeout(()=>E(!1),170)},re=[j.item,o&&!l?j.highlighted:"",e.liveMatch&&!l?j.liveMatch:"",e.is_tappable?j.tappable:j.nonTappable,v?j.pressed:"",m?j.scrollHint:""].filter(Boolean).join(" ");return ue("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":$&&e.icon?e.icon:void 0,"data-aia-image":D?"":void 0,"data-aia-item-count":W!==null?e.item_count:void 0,"aria-selected":t??o,className:re,style:{[Ii]:`${c}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:Y,onKeyDown:S=>{!l&&e.is_tappable&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),Y())},onMouseEnter:!l&&e.is_tappable?i:void 0,onMouseLeave:s,children:It("span",{className:j.content,children:[t!==void 0&&e.is_tappable&&ue("span",{className:j.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),D&&z.length>1&&ue("span",{className:`${j.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":z.length,"data-aia-image-loaded":q?"":void 0,children:z.map(S=>ue("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&&ue("span",{className:`${j.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":P!==null&&Q===P?"":void 0,children:ue("img",{src:P??D,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:P===null,onLoad:()=>A(P),onError:()=>{P!==null&&ee(S=>[...S,P])}})}),$&&ue("span",{className:`${j.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:$}}),It("span",{className:j.text,children:[e.matchedText?Ti(ra(e),e.matchedText).map((S,H)=>S.bold?ue("strong",{className:`${j.match} magicx-aia-option-match`,children:S.text},H):S.text):ra(e),e.parameterLabel&&It(Li,{children:[" ",ue("span",{className:`${j.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&ue("span",{className:j.tag,children:e.tag}),W!==null&&ue("span",{className:`${j.count} magicx-aia-option-count`,children:W})]})})}import{jsx as pa}from"react/jsx-runtime";function qi(){let[e,o]=ha(zi);return Ki(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(Ni),a=()=>o(t.matches);return a(),t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[]),e}function ua({options:e,activeIndex:o,picked:t,onSelect:a,onHighlight:i,onUnhighlight:s,listboxId:r,loading:l,groupKey:b="",optionsPosition:w="below",showIcons:y=!0,showImages:m=!0,showCounts:h=!0}){let c=qi(),v=ca(null),[E,K]=ha(null),D=ca(null);da(()=>{if(l&&Wi(D.current,e))return;D.current=l?null:e;let P=v.current,z=P&&!l&&Mi(e.length,c),q=P?.closest("[data-aia-dropdown]");z&&q&&Bi(q);let N=z?Di(P):null;K(N?la(e.length,c,N.rowWidths,N.gridWidth):null)},[e,c,l]);let R=E??la(e.length,c,null,null);da(()=>{let P=v.current?.closest("[data-aia-dropdown]");P&&Gi(P)},[R.template,c]);let ee=Hi(e,y,m);return pa(oa,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:b,template:R.template,maxHeight:R.maxHeight,innerRef:P=>{v.current=P},"data-aia-group":b,children:e.map((P,z)=>pa(sa,{option:P,isHighlighted:z===o,checked:t?t.includes(P.text):void 0,onSelect:a,onHighlight:()=>i(z),onUnhighlight:s?()=>s(z):void 0,id:`${r}-option-${z}`,loading:l,showIcon:y&&ee,showImage:m&&ee,showCount:h,scrollHint:!l&&R.scrollHintIndices.includes(z),enterDelayMs:l?0:Fi(z,R.cols,e.length,w)},`${b}\0${P.parameter??""}\0${P.text}`))})}import{formatTime as _i,TIME_WHEEL_COLUMNS as Vi,TIME_WHEEL_ROW_HEIGHT as Ui,timeWheelIndex as ma,timeWheelIndexFromScroll as Qi,timeWheelRows as Yi,withTimeWheelIndex as ga}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as ji,useEffect as $i,useLayoutEffect as Zi,useRef as bt}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) ---
3570
+ `,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 Mi,jsx as me,jsxs as Ea}from"react/jsx-runtime";function lt({option:e,isHighlighted:n,checked:a,onSelect:t,onHighlight:o,onUnhighlight:s,id:r,loading:l,showIcon:f=!0,showImage:w=!0,showCount:y=!0,scrollHint:m,enterDelayMs:h=0}){let[c]=ha(h),[v,I]=ha(!1),q=w?rt(e.image_url):[],D=q[0]??null,[O,te]=ha([]),T=q.find(C=>!O.includes(C))??null,z=w?(e.imageCollage??[]).map(C=>rt(C)[0]).filter(C=>C!==void 0):[],[_,F]=ha(!1),[Y,E]=ha(null),X=zi(()=>!D&&f&&e.icon_svg?Oi(e.icon_svg):null,[D,f,e.icon_svg]),G=y?Ii(e.item_count):null,H=Di(void 0);Li(()=>()=>clearTimeout(H.current),[]);let j=C=>{if(l||!e.is_tappable||v&&a===void 0)return;I(!0);let B=C?.currentTarget;a!==void 0&&B!==void 0&&C!==void 0&&!Ai(B,B.querySelector("[data-aia-checkbox]"),C)?t(e,{commit:!0}):t(e),clearTimeout(H.current),H.current=setTimeout(()=>I(!1),170)},de=[$.item,n&&!l?$.highlighted:"",e.liveMatch&&!l?$.liveMatch:"",e.is_tappable?$.tappable:$.nonTappable,v?$.pressed:"",m?$.scrollHint:""].filter(Boolean).join(" ");return me("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":X&&e.icon?e.icon:void 0,"data-aia-image":D?"":void 0,"data-aia-item-count":G!==null?e.item_count:void 0,"aria-selected":a??n,className:de,style:{[Ri]:`${c}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:j,onKeyDown:C=>{!l&&e.is_tappable&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),j())},onMouseEnter:!l&&e.is_tappable?o:void 0,onMouseLeave:s,children:Ea("span",{className:$.content,children:[a!==void 0&&e.is_tappable&&me("span",{className:$.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":a,children:a?"\u2713":""}),D&&z.length>1&&me("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":z.length,"data-aia-image-loaded":_?"":void 0,children:z.map(C=>me("img",{src:C,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>F(!0),onError:B=>{B.currentTarget.hidden=!0}},C))}),D&&z.length<=1&&me("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":T!==null&&Y===T?"":void 0,children:me("img",{src:T??D,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:T===null,onLoad:()=>E(T),onError:()=>{T!==null&&te(C=>[...C,T])}})}),X&&me("span",{className:`${$.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:X}}),Ea("span",{className:$.text,children:[e.matchedText?Ei(st(e),e.matchedText).map((C,B)=>C.bold?me("strong",{className:`${$.match} magicx-aia-option-match`,children:C.text},B):C.text):st(e),e.parameterLabel&&Ea(Mi,{children:[" ",me("span",{className:`${$.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&me("span",{className:$.tag,children:e.tag}),G!==null&&me("span",{className:`${$.count} magicx-aia-option-count`,children:G})]})})}import{jsx as ht}from"react/jsx-runtime";function Ui(){let[e,n]=ut(Ni);return Vi(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(Bi),t=()=>n(a.matches);return t(),a.addEventListener("change",t),()=>a.removeEventListener("change",t)},[]),e}function mt({options:e,activeIndex:n,picked:a,onSelect:t,onHighlight:o,onUnhighlight:s,listboxId:r,loading:l,groupKey:f="",optionsPosition:w="below",showIcons:y=!0,showImages:m=!0,showCounts:h=!0}){let c=Ui(),v=pt(null),[I,q]=ut(null),D=pt(null);ct(()=>{if(l&&qi(D.current,e))return;D.current=l?null:e;let T=v.current,z=T&&!l&&Hi(e.length,c),_=T?.closest("[data-aia-dropdown]");z&&_&&Ki(_);let F=z?Fi(T):null;q(F?dt(e.length,c,F.rowWidths,F.gridWidth):null)},[e,c,l]);let O=I??dt(e.length,c,null,null);ct(()=>{let T=v.current?.closest("[data-aia-dropdown]");T&&_i(T)},[O.template,c]);let te=Gi(e,y,m);return ht(nt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:f,template:O.template,maxHeight:O.maxHeight,innerRef:T=>{v.current=T},"data-aia-group":f,children:e.map((T,z)=>ht(lt,{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&&te,showImage:m&&te,showCount:h,scrollHint:!l&&O.scrollHintIndices.includes(z),enterDelayMs:l?0:Wi(z,O.cols,e.length,w)},`${f}\0${T.parameter??""}\0${T.text}`))})}import{formatTime as Qi,TIME_WHEEL_COLUMNS as Yi,TIME_WHEEL_ROW_HEIGHT as ji,timeWheelIndex as gt,timeWheelIndexFromScroll as $i,timeWheelRows as Zi,withTimeWheelIndex as ft}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as Xi,useEffect as Ji,useLayoutEffect as eo,useRef as va}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) ---
3500
3571
 
3501
3572
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
3502
3573
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -3618,7 +3689,7 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
3618
3689
  .aia-done-llNY5:hover {
3619
3690
  background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
3620
3691
  }
3621
- `,document.head.appendChild(e)}var me={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 Et}from"react/jsx-runtime";var Xi=120;function fa({view:e,label:o,doneLabel:t,interactive:a=!0,onTimeChange:i,onTimeCommit:s}){return Et("div",{className:me.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":o,onMouseDown:r=>r.preventDefault(),children:[qe("span",{className:me.value,"data-aia-time-value":"","aria-live":"polite",children:_i(e.minutes)}),Et("div",{className:me.columns,"aria-hidden":"true",children:[qe("div",{className:me.band}),Vi.map(r=>Et(ji,{children:[r==="minute"&&qe("span",{className:me.separator,children:":"}),qe(Ji,{column:r,minutes:e.minutes,interactive:a,onTimeChange:i})]},r))]}),qe("button",{type:"button",tabIndex:-1,className:me.done,"data-aia-time-done":"",onClick:()=>{a&&s()},children:t})]})}function Ji({column:e,minutes:o,interactive:t,onTimeChange:a}){let i=bt(null),s=bt(null),r=bt(null),l=bt({minutes:o,interactive:t,onTimeChange:a});l.current={minutes:o,interactive:t,onTimeChange:a};let b=ma(e,o);Zi(()=>{let m=i.current;if(!m||r.current)return;let h=b*Ui;Math.abs(m.scrollTop-h)<1||(s.current=h,m.scrollTop=h)},[b]),$i(()=>()=>{r.current&&clearTimeout(r.current)},[]);let w=()=>{r.current=null;let m=i.current,h=l.current;if(!m||!h.interactive)return;let c=Qi(e,m.scrollTop);c!==ma(e,h.minutes)&&h.onTimeChange(ga(e,h.minutes,c))},y=()=>{let m=i.current;if(m){if(s.current!=null&&Math.abs(m.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(w,Xi)}};return qe("div",{ref:i,className:me.column,"data-aia-time-column":e,onScroll:y,children:Yi(e).map((m,h)=>qe("div",{className:h===b?`${me.row} ${me.selected}`:me.row,"data-aia-time-row":"","data-aia-index":h,onClick:()=>{l.current.interactive&&a(ga(e,l.current.minutes,h))},children:m.label},m.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3692
+ `,document.head.appendChild(e)}var ge={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 Ve,jsxs as Aa}from"react/jsx-runtime";var ao=120;function bt({view:e,label:n,doneLabel:a,interactive:t=!0,onTimeChange:o,onTimeCommit:s}){return Aa("div",{className:ge.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":n,onMouseDown:r=>r.preventDefault(),children:[Ve("span",{className:ge.value,"data-aia-time-value":"","aria-live":"polite",children:Qi(e.minutes)}),Aa("div",{className:ge.columns,"aria-hidden":"true",children:[Ve("div",{className:ge.band}),Yi.map(r=>Aa(Xi,{children:[r==="minute"&&Ve("span",{className:ge.separator,children:":"}),Ve(to,{column:r,minutes:e.minutes,interactive:t,onTimeChange:o})]},r))]}),Ve("button",{type:"button",tabIndex:-1,className:ge.done,"data-aia-time-done":"",onClick:()=>{t&&s()},children:a})]})}function to({column:e,minutes:n,interactive:a,onTimeChange:t}){let o=va(null),s=va(null),r=va(null),l=va({minutes:n,interactive:a,onTimeChange:t});l.current={minutes:n,interactive:a,onTimeChange:t};let f=gt(e,n);eo(()=>{let m=o.current;if(!m||r.current)return;let h=f*ji;Math.abs(m.scrollTop-h)<1||(s.current=h,m.scrollTop=h)},[f]),Ji(()=>()=>{r.current&&clearTimeout(r.current)},[]);let w=()=>{r.current=null;let m=o.current,h=l.current;if(!m||!h.interactive)return;let c=$i(e,m.scrollTop);c!==gt(e,h.minutes)&&h.onTimeChange(ft(e,h.minutes,c))},y=()=>{let m=o.current;if(m){if(s.current!=null&&Math.abs(m.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(w,ao)}};return Ve("div",{ref:o,className:ge.column,"data-aia-time-column":e,onScroll:y,children:Zi(e).map((m,h)=>Ve("div",{className:h===f?`${ge.row} ${ge.selected}`:ge.row,"data-aia-time-row":"","data-aia-index":h,onClick:()=>{l.current.interactive&&t(ft(e,l.current.minutes,h))},children:m.label},m.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3622
3693
  display: flex;
3623
3694
  flex-direction: column;
3624
3695
  gap: var(--aia-stack-space, 0.5rem);
@@ -3633,7 +3704,7 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
3633
3704
  align-items: end;
3634
3705
  }
3635
3706
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
3636
- `,document.head.appendChild(e)}import{jsx as eo}from"react/jsx-runtime";function ba({space:e,align:o="stretch",className:t,children:a,...i}){let s=e?{"--aia-stack-space":e}:void 0;return eo("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":o,style:s,...i,children:a})}import{jsx as ae,jsxs as At}from"react/jsx-runtime";var wo=typeof window>"u"?_e:Ot,vo=[159,119,164],xo=()=>{},wa=()=>{},yo=e=>{},ko=()=>{},Co=e=>{},So=e=>{},To=e=>{},Po=e=>{};function Io(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,a]=bo(o);if(_e(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let i=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>a(i.matches);return i.addEventListener("change",s),()=>i.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Eo(e,o){let t=Xe(null);_e(()=>{let a=e.current,i=o.current;if(!a||!i)return;let s=uo(a,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==s&&(t.current.controller.destroy(),t.current=null),s&&!t.current){t.current={grid:s,controller:to({dropdown:a,grid:s,button:i})};return}t.current?.controller.update()}),_e(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ao(e,o){let t=Xe(o);t.current=o;let a=Xe(null);Ot(()=>{let i=e.current;if(i){if(!a.current){a.current=ao({dropdown:i,isOpen:()=>t.current});return}a.current.update()}}),_e(()=>()=>{a.current?.destroy(),a.current=null},[])}function Rt({suggestions:e,activeIndex:o,onSelect:t,onHighlight:a,onUnhighlight:i,isOpen:s,id:r,className:l,pills:b,onPillClick:w,showPills:y=!0,onSkip:m,showSkipButton:h=!0,showOptionIcons:c=!0,showOptionImages:v=!0,showOptionCounts:E=!0,skipDisabled:K=!1,activeSelected:D=!1,isLoading:R=!1,skeletonExiting:ee=!1,isInputEmpty:P=!1,language:z,products:q,onProductSelect:N,onProductAddToCart:Q,onProductFocusChange:A,productsLayout:$="row",productImageFallback:W="image",formatType:F="options",dateView:Y=null,selectedDateIso:re=null,selectedDateRange:S=null,dateRangeStart:H=null,dateReferences:d,onPreviousMonth:T,onNextMonth:Me,timeView:ke=null,multiSelectView:g=null,onMultiSelectCommit:Ne,onTimeChange:Ee,onTimeCommit:Ae,locationView:Ce=null,isReediting:Oe=!1,onLocationQuery:u,onLocationMove:C,onLocationCommit:I,onLocationFocusChange:O,isFocused:L=!1,optionsPosition:_="below",mode:se}){let le=Io(se),Re=le!==void 0,te=Xe(null),de=Xe(null);Eo(te,de),_e(()=>{if(te.current)return io(te.current)},[]);let Ve=e[0]?.options??[],Fe=!!(b&&b.length>0&&w),He=!!(q&&q.length>0),Le=F==="time"&&ke!=null,Be=F==="location"&&Ce!=null,ie=s&&(Ve.length>0||y&&Fe||R||He||Le||Be);Ao(te,ie),wo(()=>{let k=te.current;k&&(so(k,ro(k)),go(k))});let pe={suggestions:e,activeIndex:o,pills:b,showPills:y,showSkipButton:h,showOptionIcons:c,showOptionImages:v,showOptionCounts:E,skipDisabled:K,activeSelected:D,isLoading:R,skeletonExiting:ee,isInputEmpty:P,products:q,formatType:F,dateView:Y,selectedDateIso:re,selectedDateRange:S,dateRangeStart:H,dateReferences:d,timeView:ke,multiSelectView:g,locationView:Ce,isReediting:Oe},x=Xe(pe);ie&&(x.current=pe);let n=ie?pe:x.current,Z=fo(z),fe=n.suggestions[0],f=fe?.options??[],Ue=n.activeIndex>=0&&!!f[n.activeIndex]?.is_tappable,he=po(n.pills??[],Z.keepTyping),be=!!(he.length>0&&w),We=n.showPills&&be,Qe=n.showPills&&!be&&n.isLoading,Se=We||Qe,Ye=be&&lo(he)&&n.showSkipButton&&!n.isInputEmpty&&!!m,Te=he[0]?.text,we=co(n.formatType)&&n.dateView!=null,ze=f.length>0&&!we,Ge=f.length>0&&we&&!n.isLoading,je=n.formatType==="time"&&n.timeView!=null&&!n.isLoading,Pe=n.formatType==="location"&&n.locationView!=null&&!n.isLoading,$e=n.isLoading&&!ze&&!Ge&&!je&&!Pe,p=n.products??[],B=ho(We?he:[]);return Ot(()=>{te.current&&mo(te.current,B,{visible:ie,anchorBottom:_==="above"})},[B,ie,_,n.suggestions,n.pills,n.isLoading,n.skeletonExiting,n.isInputEmpty,n.products,n.formatType,n.dateView,n.selectedDateIso,n.selectedDateRange,n.dateRangeStart,n.dateReferences,n.timeView,n.multiSelectView,n.locationView,n.showPills,n.showSkipButton,n.showOptionIcons,n.showOptionImages,n.showOptionCounts,$,z]),_e(()=>{let k=te.current;return()=>{k&&no(k)}},[]),At("div",{ref:te,id:r,role:"listbox","aria-multiselectable":!!n.multiSelectView,"data-aia-dropdown":"","data-options-position":_,"data-mode":le,"data-aia-loading":n.isLoading?"":void 0,"data-aia-skeleton-exiting":n.skeletonExiting?"":void 0,"data-aia-has-products":p.length>0?"":void 0,className:`${Re?"magicx-aia ":""}${ve.dropdown} ${ie?ve.visible:""} ${l??""}`,onMouseDown:k=>k.preventDefault(),children:[At(ba,{space:"8px",children:[(Se||Ye)&&At(st,{noWrap:!0,className:ve.pillBar,"data-aia-pillbar":"",children:[Se&&ae("span",{className:ve.pillScroll,"data-aia-pill-scroll":"",children:ae(mt,{pills:he,activePillIndex:0,activeSelected:n.activeSelected,onSelectPill:w??(()=>{}),rounded:!0,loading:n.isLoading})}),Ye&&ae("button",{type:"button",tabIndex:-1,className:ve.skip,"data-aia-skip":"",disabled:n.isLoading||n.skipDisabled,"aria-label":Te?`${Z.skipLabel} ${Te}`:Z.skipLabel,onClick:m,children:Z.skip})]}),ze&&ae(ua,{options:f,activeIndex:n.activeIndex,onSelect:t,onHighlight:a,onUnhighlight:i,listboxId:r,loading:n.isLoading,groupKey:fe?`${fe.parameter} ${fe.text}`:"",optionsPosition:_,showIcons:n.showOptionIcons,showImages:n.showOptionImages,showCounts:n.showOptionCounts,picked:n.multiSelectView?.picked}),n.multiSelectView&&ae("div",{"data-aia-multi-actions":"",onClick:k=>{k.target.closest("[data-aia-multi-done]")&&!n.skipDisabled&&!n.isLoading&&Ne?.()},children:ae("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:ve.multiDone,ref:k=>{k&&(k.disabled=!0,k.offsetHeight,k.disabled=n.skipDisabled||n.isLoading)},children:Z.done})}),Ge&&n.dateView&&ae(Qt,{options:f,activeIndex:n.activeIndex,listboxId:r,view:n.dateView,selection:{selectedIso:n.selectedDateIso??null,selectedRange:n.selectedDateRange??null,rangeStart:n.dateRangeStart??null,floor:oo(n.formatType,n.dateRangeStart),references:n.dateReferences??[]},onSelect:t,onHighlight:a,onUnhighlight:i,onPreviousMonth:T??wa,onNextMonth:Me??wa}),je&&n.timeView&&ae(fa,{view:n.timeView,label:Z.timeLabel,doneLabel:Z.done,interactive:!n.skipDisabled,onTimeChange:Ee??yo,onTimeCommit:Ae??ko}),Pe&&n.locationView&&ae(ea,{view:n.locationView,searchLabel:Z.locationSearch,noResultsLabel:Z.locationNoResults,useTypedLabel:Z.locationUseTyped,widgetFocused:L&&ie,reediting:n.isReediting,visible:ie,interactive:!n.skipDisabled,onQuery:u??Co,onMove:C??So,onCommit:I??To,onFocusChange:O??Po}),$e&&ae("div",{className:ve.skeletonBars,"data-aia-skeleton-bars":"",children:vo.map(k=>ae("span",{className:ve.skeletonBar,style:{width:k}},`bar-${k}`))}),ae(ia,{products:p,listboxId:r,onSelect:N??xo,onAddToCart:Q,onFocusChange:A,focusable:ie&&!n.isLoading,loading:n.isLoading,layout:$,imageFallback:W,strings:Z}),ae(jt,{isOptionHighlighted:Ue,isInputEmpty:n.isInputEmpty,strings:Z})]}),ae("button",{ref:de,type:"button",tabIndex:-1,className:ve.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Z.scrollArrow,"aria-hidden":"true",children:ae("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:ae("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as jo,ModeController as $o,setCursorOffset as Zo,uiStringsFor as Xo,watchEditorHeight as Jo}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as Oo}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 {
3707
+ `,document.head.appendChild(e)}import{jsx as io}from"react/jsx-runtime";function wt({space:e,align:n="stretch",className:a,children:t,...o}){let s=e?{"--aia-stack-space":e}:void 0;return io("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":n,style:s,...o,children:t})}import{jsx as Z,jsxs as Ra}from"react/jsx-runtime";var yo=typeof window>"u"?Ue:Oa,ko=[159,119,164],Co=()=>{},vt=()=>{},So=e=>{},To=()=>{},Po=e=>{},Io=e=>{},Eo=e=>{},Ao=e=>{};function Ro(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,t]=xo(n);if(Ue(()=>{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 Oo(e,n){let a=Xe(null);Ue(()=>{let t=e.current,o=n.current;if(!t||!o)return;let s=fo(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:oo({dropdown:t,grid:s,button:o})};return}a.current?.controller.update()}),Ue(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function Lo(e,n){let a=Xe(n);a.current=n;let t=Xe(null);Oa(()=>{let o=e.current;if(o){if(!t.current){t.current=no({dropdown:o,isOpen:()=>a.current});return}t.current.update()}}),Ue(()=>()=>{t.current?.destroy(),t.current=null},[])}function La({suggestions:e,activeIndex:n,onSelect:a,onHighlight:t,onUnhighlight:o,isOpen:s,id:r,className:l,pills:f,onPillClick:w,showPills:y=!0,onSkip:m,showSkipButton:h=!0,showOptionIcons:c=!0,showOptionImages:v=!0,showOptionCounts:I=!0,skipDisabled:q=!1,activeSelected:D=!1,isLoading:O=!1,skeletonExiting:te=!1,isInputEmpty:T=!1,language:z,products:_,onProductSelect:F,onProductAddToCart:Y,onProductFocusChange:E,productsLayout:X="row",productImageFallback:G="image",formatType:H="options",dateView:j=null,selectedDateIso:de=null,selectedDateRange:C=null,dateRangeStart:B=null,dateReferences:d,onPreviousMonth:S,onNextMonth:Fe,timeView:ke=null,multiSelectView:g=null,onMultiSelectCommit:He,onSeeAllResults:Ce,onTimeChange:Re,onTimeCommit:Oe,locationView:Se=null,isReediting:u=!1,onLocationQuery:k,onLocationMove:P,onLocationCommit:A,onLocationFocusChange:L,isFocused:J=!1,optionsPosition:ne="below",mode:he}){let Te=Ro(he),Le=Te!==void 0,oe=Xe(null),ue=Xe(null);Oo(oe,ue),Ue(()=>{if(oe.current)return ro(oe.current)},[]);let ze=e[0]?.options??[],Be=!!(f&&f.length>0&&w),oa=!!(_&&_.length>0),be=H==="time"&&ke!=null,Qe=H==="location"&&Se!=null,ie=s&&(ze.length>0||y&&Be||O||oa||be||Qe);Lo(oe,ie),yo(()=>{let R=oe.current;R&&(po(R,co(R)),wo(R))});let x={suggestions:e,activeIndex:n,pills:f,showPills:y,showSkipButton:h,showOptionIcons:c,showOptionImages:v,showOptionCounts:I,skipDisabled:q,activeSelected:D,isLoading:O,skeletonExiting:te,isInputEmpty:T,products:_,formatType:H,dateView:j,selectedDateIso:de,selectedDateRange:C,dateRangeStart:B,dateReferences:d,timeView:ke,multiSelectView:g,locationView:Se,isReediting:u,showsSeeAll:!!Ce},De=Xe(x);ie&&(De.current=x);let i=ie?x:De.current,V=vo(z),b=i.suggestions[0],we=b?.options??[],na=i.activeIndex>=0&&!!we[i.activeIndex]?.is_tappable,re=mo(i.pills??[],V.keepTyping),We=!!(re.length>0&&w),Ge=i.showPills&&We,Pe=i.showPills&&!We&&i.isLoading,Ye=Ge||Pe,Ie=We&&ho(re)&&i.showSkipButton&&!i.isInputEmpty&&!!m,ve=re[0]?.text,Me=uo(i.formatType)&&i.dateView!=null,Ke=we.length>0&&!Me,je=we.length>0&&Me&&!i.isLoading,Ee=i.formatType==="time"&&i.timeView!=null&&!i.isLoading,qe=i.formatType==="location"&&i.locationView!=null&&!i.isLoading,p=i.isLoading&&!Ke&&!je&&!Ee&&!qe,W=i.products??[],M=go(Ge?re:[]);return Oa(()=>{oe.current&&bo(oe.current,M,{visible:ie,anchorBottom:ne==="above"})},[M,ie,ne,i.suggestions,i.pills,i.isLoading,i.skeletonExiting,i.isInputEmpty,i.products,i.formatType,i.dateView,i.selectedDateIso,i.selectedDateRange,i.dateRangeStart,i.dateReferences,i.timeView,i.multiSelectView,i.locationView,i.showPills,i.showSkipButton,i.showOptionIcons,i.showOptionImages,i.showOptionCounts,i.showsSeeAll,X,z]),Ue(()=>{let R=oe.current;return()=>{R&&lo(R)}},[]),Ra("div",{ref:oe,id:r,role:"listbox","aria-multiselectable":!!i.multiSelectView,"data-aia-dropdown":"","data-options-position":ne,"data-mode":Te,"data-aia-loading":i.isLoading?"":void 0,"data-aia-skeleton-exiting":i.skeletonExiting?"":void 0,"data-aia-has-products":W.length>0?"":void 0,className:`${Le?"magicx-aia ":""}${ce.dropdown} ${ie?ce.visible:""} ${l??""}`,onMouseDown:R=>R.preventDefault(),children:[Ra(wt,{space:"8px",children:[(Ye||Ie)&&Ra(da,{noWrap:!0,className:ce.pillBar,"data-aia-pillbar":"",children:[Ye&&Z("span",{className:ce.pillScroll,"data-aia-pill-scroll":"",children:Z(fa,{pills:re,activePillIndex:0,activeSelected:i.activeSelected,onSelectPill:w??(()=>{}),rounded:!0,loading:i.isLoading})}),Ie&&Z("button",{type:"button",tabIndex:-1,className:ce.skip,"data-aia-skip":"",disabled:i.isLoading||i.skipDisabled,"aria-label":ve?`${V.skipLabel} ${ve}`:V.skipLabel,onClick:m,children:V.skip})]}),Ke&&Z(mt,{options:we,activeIndex:i.activeIndex,onSelect:a,onHighlight:t,onUnhighlight:o,listboxId:r,loading:i.isLoading,groupKey:b?`${b.parameter} ${b.text}`:"",optionsPosition:ne,showIcons:i.showOptionIcons,showImages:i.showOptionImages,showCounts:i.showOptionCounts,picked:i.multiSelectView?.picked}),i.multiSelectView&&Z("div",{"data-aia-multi-actions":"",onClick:R=>{R.target.closest("[data-aia-multi-done]")&&!i.skipDisabled&&!i.isLoading&&He?.()},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:ce.multiDone,ref:R=>{R&&(R.disabled=!0,R.offsetHeight,R.disabled=i.skipDisabled||i.isLoading)},children:V.done})}),je&&i.dateView&&Z(Ya,{options:we,activeIndex:i.activeIndex,listboxId:r,view:i.dateView,selection:{selectedIso:i.selectedDateIso??null,selectedRange:i.selectedDateRange??null,rangeStart:i.dateRangeStart??null,floor:so(i.formatType,i.dateRangeStart),references:i.dateReferences??[]},onSelect:a,onHighlight:t,onUnhighlight:o,onPreviousMonth:S??vt,onNextMonth:Fe??vt}),Ee&&i.timeView&&Z(bt,{view:i.timeView,label:V.timeLabel,doneLabel:V.done,interactive:!i.skipDisabled,onTimeChange:Re??So,onTimeCommit:Oe??To}),qe&&i.locationView&&Z(at,{view:i.locationView,searchLabel:V.locationSearch,noResultsLabel:V.locationNoResults,useTypedLabel:V.locationUseTyped,widgetFocused:J&&ie,reediting:i.isReediting,visible:ie,interactive:!i.skipDisabled,onQuery:k??Po,onMove:P??Io,onCommit:A??Eo,onFocusChange:L??Ao}),p&&Z("div",{className:ce.skeletonBars,"data-aia-skeleton-bars":"",children:ko.map(R=>Z("span",{className:ce.skeletonBar,style:{width:R}},`bar-${R}`))}),Z(ot,{products:W,listboxId:r,onSelect:F??Co,onAddToCart:Y,onFocusChange:E,focusable:ie&&!i.isLoading,loading:i.isLoading,layout:X,imageFallback:G,strings:V}),i.showsSeeAll&&Z("div",{className:ce.seeAllRow,"data-aia-see-all":"",onClick:R=>{R.target.closest("[data-aia-see-all-button]")&&(R.stopPropagation(),!i.isLoading&&Ce?.())},children:Z("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"",className:ce.seeAll,ref:R=>{R&&(R.disabled=!0,R.offsetHeight,R.disabled=i.isLoading)},children:V.seeAllResults})}),Z($a,{isOptionHighlighted:na,isInputEmpty:i.isInputEmpty,strings:V})]}),Z("button",{ref:ue,type:"button",tabIndex:-1,className:ce.scrollArrow,"data-aia-scroll-arrow":"","aria-label":V.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 Xo,ModeController as Jo,setCursorOffset as en,uiStringsFor as an,watchEditorHeight as tn}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as zo}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 {
3637
3708
  flex-shrink: 0;
3638
3709
  width: 32px;
3639
3710
  height: 32px;
@@ -3704,5 +3775,5 @@ import{buildSubmitResult as ls,cellDay as ds,cellIso as cs,DATE_RANGE_META_END a
3704
3775
  transition: none;
3705
3776
  }
3706
3777
  }
3707
- `,document.head.appendChild(e)}var va={submitButton:"aia-submitButton-otz7H"};import{jsx as Lt}from"react/jsx-runtime";function xa({disabled:e,ready:o,onClick:t,label:a=Oo().submit}){return Lt("button",{type:"button","data-aia-submit":"",className:va.submitButton,disabled:e,"data-aia-ready":o?"":void 0,onClick:i=>{i.stopPropagation(),t()},"aria-label":a,children:Lt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":a,children:Lt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Ro,dateSelectionFor as Lo,editingSuggestion as zo,identifiedParamLabel as Do,withoutTraditionalAutocomplete as Mo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Ta,useEffect as Je,useMemo as No,useRef as J,useState as Fo}from"react";import{useRef as ya}from"react";function ka(e){let o=ya(e);o.current=e;let t=Object.keys(e??{}).sort().join("\0"),a=ya({key:"",overrides:void 0});if(a.current.key!==t){let i={};for(let s of Object.keys(e??{})){let r=(l,b,w)=>{let y=o.current?.[s];return y?y(l,b,w):[]};i[s]=r}a.current={key:t,overrides:e?i:void 0}}return{overrides:a.current.overrides,key:t}}import{useRef as Ca}from"react";function Sa(e){let o=Ca(e);o.current=e;let t=Ca(null);t.current===null&&(t.current={fetch:(i,s)=>{let r=o.current;return r?r.fetch(i,s):Promise.reject(new Error("products config removed"))},transform:i=>o.current?.transform(i)??[],get limit(){return o.current?.limit}});let a=e!==void 0;return{config:a?t.current:void 0,enabled:a}}var Pa={text:"",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 zt({onSubmit:e,onResult:o,onError:t,optionOverrides:a,maskCompletedText:i,apiConfig:s,additionalContext:r,language:l,currency:b,productId:w,visitorId:y,columns:m=2,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:E,allOption:K,showNonTappableOptions:D,locationSearch:R,showOptionIcons:ee,showOptionImages:P,showOptionCounts:z,showSkipButton:q,showProducts:N,productImageFallback:Q="image",onFocus:A,onBlur:$,value:W,completedParams:F,onChange:Y,onParamsChange:re,products:S,mapProducts:H,onProductSelect:d,onProductAddToCart:T,source:Me,setCursor:ke}){let g=J(null),[Ne,Ee]=Fo(null),Ae=J(e);Ae.current=e;let Ce=J(o);Ce.current=o;let Oe=J(t);Oe.current=t;let u=J(Y);u.current=Y;let C=J(re);C.current=re;let I=J(A);I.current=A;let O=J($);O.current=$;let L=J(ke);L.current=ke;let _=J(d);_.current=d;let se=J(T);se.current=T;let le=J(y);le.current=y;let Re=J(()=>{let p=le.current;return typeof p=="function"?p():p}).current,te=Sa(S),de=J(H);de.current=H;let Ve=J((p,B)=>{let k=de.current;return k?k(p,B):p}).current,Fe=H?Ve:void 0,He=ka(a);Je(()=>{if(typeof document>"u")return;let p=new Ro(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:b,productId:w,visitorId:Re,optionOverrides:He.overrides,maskCompletedText:i,columns:m,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:E,allOption:K,showNonTappableOptions:D,locationSearch:R,showProducts:N,source:Me,value:W,completedParams:F,onSubmit:(...k)=>Ae.current?.(...k),onResult:(...k)=>Ce.current?.(...k),onError:(...k)=>Oe.current?.(...k),onChange:(...k)=>u.current?.(...k),onParamsChange:(...k)=>C.current?.(...k),onFocus:()=>I.current?.(),onBlur:()=>O.current?.(),onProductSelect:k=>_.current?.(k),onProductAddToCart:k=>se.current?.(k),setCursor:k=>L.current?.(k),products:te.config,mapProducts:Fe});g.current=p,Ee(p.getState());let B=p.subscribe(k=>Ee(k));return()=>{B(),p.destroy(),g.current===p&&(g.current=null)}},[]),Je(()=>{W!==void 0&&g.current?.setValue(W)},[W]),Je(()=>{F!==void 0&&g.current?.setCompletedParams(F)},[F]);let Le=JSON.stringify(s??null),Be;try{Be=JSON.stringify(r??null)}catch{Be="[unstringifiable]"}Je(()=>{g.current?.update({apiConfig:s,additionalContext:r,language:l,currency:b,productId:w,optionOverrides:He.overrides,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:E,allOption:K,showNonTappableOptions:D,locationSearch:R,showProducts:N})},[Le,Be,l,b?.code,b?.rate,b?.country,w,He.key,h,c,v,E,K,D,R,N]);let ie=J(!1);Je(()=>{if(!ie.current){ie.current=!0;return}g.current?.update({products:te.config})},[te.enabled]),Je(()=>{g.current?.update({mapProducts:Fe})},[Fe]);let pe=J(null);pe.current===null&&(pe.current={handleTextChange:p=>g.current?.handleTextChange(p),handleKeyDown:p=>{let B="nativeEvent"in p?p.nativeEvent:p;g.current?.handleKeyDown(B)},setFocused:p=>g.current?.setFocused(p),startEditingParam:p=>g.current?.startEditingParam(p),removeParam:p=>g.current?.removeParam(p)??!1,exitEditMode:()=>g.current?.exitEditMode(),handleCaretAfterInput:p=>g.current?.handleCaretAfterInput(p),handleCaretMove:p=>g.current?.handleCaretMove(p),replaceEditingRange:p=>g.current?.replaceEditingRange(p)??!1,setActivePill:p=>g.current?.setActivePill(p),skipActivePill:()=>g.current?.skipActivePill(),removeLastParam:()=>g.current?.removeLastParam(),clearNewParamId:()=>g.current?.clearNewParamId(),reset:()=>g.current?.reset(),refreshProducts:()=>g.current?.refreshProducts(),prepareSubmit:()=>g.current?.prepareSubmit(),getState:()=>g.current?.getState()??Pa,recordSubmit:p=>g.current?.recordSubmit(p),selectOption:(p,B)=>g.current?.selectOption(p,B),selectProduct:p=>g.current?.selectProduct(p),addProductToCart:p=>{let B=g.current;return!B||!se.current?Promise.resolve():B.addProductToCart(p)},setActiveDropdownIndex:p=>g.current?.setActiveDropdownIndex(p),clearHighlight:p=>g.current?.clearHighlight(p),showPreviousMonth:()=>g.current?.showPreviousMonth(),showNextMonth:()=>g.current?.showNextMonth(),setTime:p=>g.current?.setTime(p),commitTime:()=>g.current?.commitTime(),toggleMultiSelectOption:p=>g.current?.toggleMultiSelectOption(p),commitMultiSelect:()=>g.current?.commitMultiSelect(),setLocationQuery:p=>g.current?.setLocationQuery(p),moveLocationHighlight:p=>g.current?.moveLocationHighlight(p),commitLocation:p=>g.current?.commitLocation(p),setLocationFieldFocused:p=>g.current?.setLocationFieldFocused(p),handleFocus:()=>g.current?.setFocused(!0),handleBlur:()=>g.current?.setFocused(!1)});let x=pe.current,n=Ta(p=>{let B=p.target.value,vt=B.length>0&&!p.nativeEvent?.isComposing&&B[0]!==B[0].toUpperCase()?B[0].toUpperCase()+B.slice(1):B;g.current?.handleTextChange(vt)},[]),Z=Ta(p=>{g.current?.handleKeyDown(p.nativeEvent)},[]),fe=g.current,f=Ne??Pa,Ue=W!==void 0?W:f.text,he=F!==void 0?F:f.completedParams,be=f.actionableSuggestions,We=be[0],Qe=No(()=>Mo(be),[be]),Se=fe?.listboxId??"",Ye=f.activeDropdownIndex>=0&&fe?`${Se}-option-${f.activeDropdownIndex}`:void 0,Te=f.editingParam,we=f.editingIdentified,ze=Te?zo(Te):we?{parameter:we.parameter,text:Do(we.parameter),required:!0,options:[]}:null,Ge=f.dropdownSuggestion??ze??We,je=ze?[ze]:be,Pe=Lo(f),$e=!fe||f.dropdownLoading;return{completedParams:he,multiSelectView:f.multiSelectView,toggleMultiSelectOption:x.toggleMultiSelectOption,commitMultiSelect:x.commitMultiSelect,skippedParams:f.skippedParams,identifiedParams:f.identifiedParams,suggestionPills:Qe,setActivePill:x.setActivePill,skipActivePill:x.skipActivePill,removeLastParam:x.removeLastParam,segments:f.segments,newParamId:f.newParamId,clearNewParamId:x.clearNewParamId,suggestions:f.suggestions,activeIndex:f.activeDropdownIndex,isReady:f.isReady,isLoading:$e,isFocused:f.isFocused,isDropdownOpen:f.isDropdownOpen,isActivePillSelected:f.isActivePillSelected,placeholderText:f.placeholderText,listboxId:Se,error:f.error,products:f.products,customFields:f.customFields,selectProduct:x.selectProduct,addProductToCart:x.addProductToCart,handleTextChange:x.handleTextChange,handleKeyDown:x.handleKeyDown,setFocused:x.setFocused,editingParam:Te,editingIdentified:we,editingAnchor:f.editingAnchor,caretOffset:f.caretOffset,startEditingParam:x.startEditingParam,removeParam:x.removeParam,exitEditMode:x.exitEditMode,handleCaretAfterInput:x.handleCaretAfterInput,handleCaretMove:x.handleCaretMove,replaceEditingRange:x.replaceEditingRange,inputProps:{value:Ue,placeholder:f.placeholderText||void 0,onChange:n,onKeyDown:Z,onFocus:x.handleFocus,onBlur:x.handleBlur,role:"combobox","aria-expanded":f.isDropdownOpen,"aria-activedescendant":Ye,"aria-autocomplete":"list","aria-controls":Se},reset:x.reset,refreshProducts:x.refreshProducts,prepareSubmit:x.prepareSubmit,getState:x.getState,recordSubmit:x.recordSubmit,dropdownProps:{suggestions:Ge?[{...Ge,options:f.dropdownOptions}]:[],activeIndex:f.activeDropdownIndex,onSelect:x.selectOption,onHighlight:x.setActiveDropdownIndex,onUnhighlight:x.clearHighlight,isOpen:f.isDropdownOpen,id:Se,pills:je,activeSelected:f.isActivePillSelected,onPillClick:x.setActivePill,onSkip:x.skipActivePill,showSkipButton:(q??!0)&&!Te&&!we,showOptionIcons:ee??!0,showOptionImages:P??!0,showOptionCounts:z??!0,skipDisabled:f.inSelectionAnimation,isLoading:$e,skeletonExiting:f.skeletonExiting,isInputEmpty:Ue.trim().length===0,language:l,products:f.products,productImageFallback:Q,onProductSelect:x.selectProduct,onProductAddToCart:T?x.addProductToCart:void 0,onProductFocusChange:x.setFocused,formatType:f.activeFormatType,dateView:f.dateView,selectedDateIso:Pe.selectedIso,selectedDateRange:Pe.selectedRange,dateRangeStart:Pe.rangeStart,dateReferences:Pe.references,onPreviousMonth:x.showPreviousMonth,onNextMonth:x.showNextMonth,timeView:f.timeView,multiSelectView:f.dropdownMultiSelect,onMultiSelectCommit:x.commitMultiSelect,onTimeChange:x.setTime,onTimeCommit:x.commitTime,locationView:f.locationView,isReediting:f.editingParam!=null,onLocationQuery:x.setLocationQuery,onLocationMove:x.moveLocationHighlight,onLocationCommit:x.commitLocation,onLocationFocusChange:x.setLocationFieldFocused,isFocused:f.isFocused||f.locationFieldFocused,optionsPosition:c??"below"}}}import{attachChipRemove as Ho,cancelStartingHint as Bo,chipIdFromTap as Wo,extractPlainText as Ia,getCursorOffset as Ea,keepCaretOnChip as Go,plainTextLength as Ko,renderEditableContent as qo,setCursorOffset as Aa,startingHintOptions as _o}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ge,useEffect as et,useLayoutEffect as Dt,useRef as tt}from"react";var wt;function Vo(){if(wt!==void 0)return wt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),wt=e.contentEditable==="plaintext-only",wt}function Oa(e){let{segments:o,showChipIcons:t=!0,showChipImages:a=!0,showChipRemove:i=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:b,editingAnchor:w,caretOffset:y,placeholderText:m,hintSuggestions:h,isFocused:c,isDropdownOpen:v,listboxId:E,activeDescendantId:K,autoFocus:D,handleTextChange:R,handleKeyDown:ee,handleCaretAfterInput:P,handleCaretMove:z,startEditingParam:q,replaceEditingRange:N,setFocused:Q}=e,A=tt(null),$=tt(!1),W=tt(""),F=tt(""),Y=tt(null),re=tt(0);Y.current=y,et(()=>{if(!D)return;let u=A.current;if(!u)return;document.activeElement===u?Q(!0):u.focus();let C=u.ownerDocument??document,I=C.getSelection(),O=I&&I.rangeCount>0&&u.contains(I.anchorNode);if(I&&!O){let L=C.createRange();L.selectNodeContents(u),L.collapse(!0),I.removeAllRanges(),I.addRange(L)}},[D,Q]),et(()=>{let u=A.current;if(!u)return;let C=u.ownerDocument??document,I=()=>{let O=C.getSelection();if(!O||O.rangeCount===0||!O.anchorNode||!u.contains(O.anchorNode))return;let L=O.anchorNode,_=L.nodeType===Node.ELEMENT_NODE?L:L.parentElement,le=(O.isCollapsed?_?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Re=l?.id??b?.id??null;if(le&&le!==Re){q(le);return}performance.now()-re.current<50||z(Ea(u))};return C.addEventListener("selectionchange",I),()=>C.removeEventListener("selectionchange",I)},[l,b,q,z]),et(()=>{let u=A.current;if(!u)return;let C=I=>{let O=Wo(u,I.target);O&&(q(O),Go(u,O))};return u.addEventListener("click",C),()=>u.removeEventListener("click",C)},[q]),et(()=>{let u=A.current;if(!(!u||!s||!i))return Ho(u,s)},[s,i]),Dt(()=>{let u=A.current;u&&qo({input:u,segments:o,newParamId:r,editingParamId:l?.id??null,placeholderText:m??"",isFocused:c,showChipIcons:t,showChipImages:a,showChipRemove:i,hintOptions:_o(h??[])})},[o,r,l,m,h,c,t,a,i]),et(()=>{let u=A.current;return()=>{u&&Bo(u)}},[]),Dt(()=>{let u=W.current,C=r??"";if(W.current=C,!C||C===u)return;let I=A.current;if(!I)return;I.focus();let O=Y.current??Ko(I);Aa(I,O)},[r]),Dt(()=>{let u=F.current,C=l?.id??"";if(F.current=C,!C||C===u||w==null)return;let I=A.current;I&&Aa(I,w)},[l,w]);let S=ge(()=>{if($.current)return;let u=A.current;if(!u)return;let C=Ia(u),O=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;R(O)},[R]),H=ge(()=>{re.current=performance.now(),S();let u=A.current;u&&P(Ea(u))},[S,P]);et(()=>{let u=A.current;if(!u)return;let C=I=>{let O=I,L=O.inputType;if(L==="insertParagraph"||L==="insertLineBreak"||L==="insertFromDrop"){I.preventDefault();return}if(L.startsWith("insert")||L.startsWith("delete")){let _=L.startsWith("delete")?"":O.data??"";N(_)&&I.preventDefault()}};return u.addEventListener("beforeinput",C),()=>u.removeEventListener("beforeinput",C)},[N]);let d=ge(()=>{$.current=!0,A.current?.setAttribute("data-aia-composing","true")},[]),T=ge(()=>{$.current=!1,A.current?.removeAttribute("data-aia-composing"),S()},[S]),Me=ge(u=>{u.preventDefault();let C=A.current;if(!C)return;let I=(u.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let O=C.ownerDocument??document,L=O.getSelection();if(!L||L.rangeCount===0)return;let _=L.getRangeAt(0);if(!C.contains(_.startContainer))return;_.deleteContents();let se=O.createTextNode(I);_.insertNode(se),_.setStartAfter(se),_.collapse(!0),L.removeAllRanges(),L.addRange(_),S()},[S]),ke=ge(u=>ee(u),[ee]),g=ge(()=>Q(!0),[Q]),Ne=ge(()=>Q(!1),[Q]),Ee=ge(()=>A.current?.focus(),[]),Ae=ge(()=>A.current?.blur(),[]),Ce=ge(()=>{let u=A.current;return u?Ia(u):""},[]),Oe=Vo()?"plaintext-only":"true";return{inputRef:A,editorProps:{ref:A,contentEditable:Oe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":E,"aria-expanded":v,"aria-activedescendant":K,spellCheck:!0,enterKeyHint:"send",onInput:H,onKeyDown:ke,onCompositionStart:d,onCompositionEnd:T,onPaste:Me,onFocus:g,onBlur:Ne},getPlainText:Ce,focus:Ee,blur:Ae}}import{jsx as it,jsxs as Ft}from"react/jsx-runtime";function en(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var tn=Uo(function({onSubmit:o,onResult:t,onError:a,optionOverrides:i,maskCompletedText:s,className:r,apiConfig:l,additionalContext:b,language:w,currency:y,productId:m,visitorId:h,columns:c,pillPlacement:v="dropdown",mode:E="auto",optionsPosition:K="below",animations:D=!0,optionsStyle:R="floating",dropdownTrigger:ee,closeDropdownOnBlur:P,prependPlaceholder:z,allOption:q,showNonTappableOptions:N,locationSearch:Q,showOptionIcons:A=!0,showChipIcons:$=!0,showChipImages:W=!0,showChipRemove:F=!1,showOptionImages:Y=!0,showOptionCounts:re=!0,showSkipButton:S,showProducts:H,productsLayout:d,productImageFallback:T,autoFocus:Me=!0,onFocus:ke,onBlur:g,value:Ne,completedParams:Ee,onChange:Ae,onParamsChange:Ce,products:Oe,mapProducts:u,onProductSelect:C,onProductAddToCart:I,submitButton:O,resetOnSubmit:L=!0},_){let se=at(null),le=at(null),Re=at(null),te=at(()=>{}),de=at(null),Ve=at(null);Nt(()=>{let M=se.current;if(M)return de.current?de.current.setMode(E):de.current=new $o(M,E),()=>{de.current?.destroy(),de.current=null}},[E]);let Fe=Mt(M=>{let oe=Ve.current?.current;oe&&(oe.focus(),Zo(oe,M))},[]),{completedParams:He,suggestionPills:Le,setActivePill:Be,skipActivePill:ie,segments:pe,newParamId:x,clearNewParamId:n,placeholderText:Z,isFocused:fe,isDropdownOpen:f,isActivePillSelected:Ue,isLoading:he,isReady:be,activeIndex:We,listboxId:Qe,handleTextChange:Se,handleKeyDown:Ye,setFocused:Te,editingParam:we,editingIdentified:ze,editingAnchor:Ge,caretOffset:je,startEditingParam:Pe,removeParam:$e,handleCaretAfterInput:p,handleCaretMove:B,replaceEditingRange:k,dropdownProps:vt,reset:pt,refreshProducts:Ht,prepareSubmit:Bt,getState:Wt,recordSubmit:Gt}=zt({onSubmit:M=>te.current(M),onResult:t,onError:a,optionOverrides:i,maskCompletedText:s,apiConfig:l,additionalContext:b,language:w,currency:y,productId:m,visitorId:h,columns:c,dropdownTrigger:ee,optionsPosition:K,closeDropdownOnBlur:P,prependPlaceholder:z,allOption:q,showNonTappableOptions:N,locationSearch:Q,showOptionIcons:A,showOptionImages:Y,showOptionCounts:re,showSkipButton:S,showProducts:H,onFocus:ke,onBlur:g,value:Ne,completedParams:Ee,onChange:Ae,onParamsChange:Ce,products:Oe,mapProducts:u,onProductSelect:C,onProductAddToCart:I,source:"full-sdk",setCursor:Fe});Nt(()=>{if(!x)return;let M=window.setTimeout(()=>n(),650);return()=>window.clearTimeout(M)},[x,n]);let Ra=We>=0?`${Qe}-option-${We}`:void 0,{inputRef:xt,editorProps:La,focus:ht,blur:Kt,getPlainText:qt}=Oa({segments:pe,newParamId:x,editingParam:we,editingIdentified:ze,editingAnchor:Ge,caretOffset:je,placeholderText:Z,hintSuggestions:v==="inline"?[]:Le,isFocused:fe,showChipIcons:$,showChipImages:W,showChipRemove:F,removeParam:$e,isDropdownOpen:f,listboxId:Qe,activeDescendantId:Ra,autoFocus:Me,handleTextChange:Se,handleKeyDown:Ye,handleCaretAfterInput:p,handleCaretMove:B,startEditingParam:Pe,replaceEditingRange:k,setFocused:Te});Ve.current=xt,Yo(()=>{let M=le.current,oe=xt.current;if(!M||!oe)return;let nt=()=>{let Vt=M.firstElementChild;if(!Vt)return;let Na=Vt.getBoundingClientRect(),Fa=oe.getBoundingClientRect();Na.top>=Fa.bottom-2?M.setAttribute("data-aia-pill-wrapped",""):M.removeAttribute("data-aia-pill-wrapped")};nt();let _t=new ResizeObserver(nt);return _t.observe(oe),()=>_t.disconnect()},[pe,Le.length,he,xt]),Nt(()=>{let M=Re.current;if(M)return Jo(M)},[]),Qo(_,()=>({focus:ht,blur:Kt,reset:pt,refreshProducts:Ht,setMode:M=>de.current?.setMode(M),skipActivePill:ie}),[ht,Kt,pt,Ht,ie]);let ot=!!pe.length||He.length>0,yt=Mt(M=>{if(!ot)return;M&&Bt();let oe=Wt(),nt=jo(qt(),oe.completedParams,oe.skippedParams,{identifiedParams:oe.identifiedParams,isReady:oe.isReady,customFields:oe.customFields});M&&Gt(nt),o(nt),L&&pt()},[Gt,L,ot,Bt,Wt,o,pt,qt]);te.current=()=>yt(!1);let za=Mt(M=>{M.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||ht()},[ht]),Da=v==="inline",Ma=v==="dropdown";return Ft("div",{ref:se,className:`magicx-aia ${Ke.container} ${r??""}`,"data-pill-placement":v,"data-options-position":K,"data-animations":D?"on":"off","data-aia-options-style":R,"data-mode":en(E),children:[it(Rt,{...vt,showPills:Ma,productsLayout:d,productImageFallback:T}),Ft("div",{className:Ke.inputWrapper,"data-aia-input-wrapper":"",onClick:za,children:[Ft("div",{ref:Re,className:Ke.editorArea,"data-aia-editor":"",children:[it("div",{...La,className:Ke.input,"data-aia-input":""}),Da&&(he||Le.length>0)&&it("span",{ref:le,className:Ke.pillListContainer,"data-aia-pill-list-container":"",children:it(mt,{pills:Le,activePillIndex:0,activeSelected:Ue,onSelectPill:Be,loading:he})})]}),O===null?null:O===void 0?it(xa,{disabled:!ot,ready:ot&&be,onClick:()=>yt(!0),label:Xo(w).submit}):it("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ke.submitSlot,onClick:M=>{ot&&(M.stopPropagation(),yt(!0))},children:O})]})]})});export{tn as AIAutocomplete,Rt as AIAutocompleteDropdown,ps as DATE_RANGE_META_END,hs as DATE_RANGE_META_START,us as DEFAULT_OPTION_COUNT_UNIT,ys as LOCATION_META_KEY,As as PRODUCT_PATH_PREFIX,Bs as TIME_META_KEY,Gs as WEEKDAY_LABELS,ls as buildSubmitResult,ds as cellDay,cs as cellIso,ms as dateCellMarks,gs as formatDate,fs as formatDateRange,bs as formatOptionCount,ws as formatPlace,vs as formatTime,xs as isoDate,ks as monthLabel,Cs as optionCountLabel,Ss as optionHasImage,Ts as optionImageSources,Ps as optionImageSrc,Is as optionLabel,Es as optionsShowLeadingVisuals,Os as parseDate,Rs as parseLooseDate,Ls as parseLooseDateRange,zs as parseTime,Ds as productFromMatchedItem,Ms as productImageSources,Ns as productsFromCustomFields,Fs as sanitizeOptionIconSvg,Hs as selectedRangeFor,zt as useAIAutocomplete,Ws as visibleDateRange,Ks as withSkippedParams};
3778
+ `,document.head.appendChild(e)}var xt={submitButton:"aia-submitButton-otz7H"};import{jsx as za}from"react/jsx-runtime";function yt({disabled:e,ready:n,onClick:a,label:t=zo().submit}){return za("button",{type:"button","data-aia-submit":"",className:xt.submitButton,disabled:e,"data-aia-ready":n?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":t,children:za("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:za("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Do,dateSelectionFor as Mo,editingSuggestion as No,identifiedParamLabel as Fo,withoutTraditionalAutocomplete as Ho}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Pt,useEffect as Je,useMemo as Bo,useRef as ae,useState as Wo}from"react";import{useRef as kt}from"react";function Ct(e){let n=kt(e);n.current=e;let a=Object.keys(e??{}).sort().join("\0"),t=kt({key:"",overrides:void 0});if(t.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,f,w)=>{let y=n.current?.[s];return y?y(l,f,w):[]};o[s]=r}t.current={key:a,overrides:e?o:void 0}}return{overrides:t.current.overrides,key:a}}import{useRef as St}from"react";function Tt(e){let n=St(e);n.current=e;let a=St(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 It={text:"",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 Da({onSubmit:e,onResult:n,onError:a,optionOverrides:t,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:f,productId:w,visitorId:y,columns:m=2,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showOptionIcons:te,showOptionImages:T,showOptionCounts:z,showSkipButton:_,showProducts:F,productImageFallback:Y="image",onFocus:E,onBlur:X,value:G,completedParams:H,onChange:j,onParamsChange:de,products:C,mapProducts:B,onProductSelect:d,onProductAddToCart:S,source:Fe,setCursor:ke}){let g=ae(null),[He,Ce]=Wo(null),Re=ae(e);Re.current=e;let Oe=ae(n);Oe.current=n;let Se=ae(a);Se.current=a;let u=ae(j);u.current=j;let k=ae(de);k.current=de;let P=ae(E);P.current=E;let A=ae(X);A.current=X;let L=ae(ke);L.current=ke;let J=ae(d);J.current=d;let ne=ae(S);ne.current=S;let he=ae(y);he.current=y;let Te=ae(()=>{let p=he.current;return typeof p=="function"?p():p}).current,Le=Tt(C),oe=ae(B);oe.current=B;let ue=ae((p,W)=>{let M=oe.current;return M?M(p,W):p}).current,ze=B?ue:void 0,Be=Ct(t);Je(()=>{if(typeof document>"u")return;let p=new Do(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:f,productId:w,visitorId:Te,optionOverrides:Be.overrides,maskCompletedText:o,columns:m,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showProducts:F,source:Fe,value:G,completedParams:H,onSubmit:(...M)=>Re.current?.(...M),onResult:(...M)=>Oe.current?.(...M),onError:(...M)=>Se.current?.(...M),onChange:(...M)=>u.current?.(...M),onParamsChange:(...M)=>k.current?.(...M),onFocus:()=>P.current?.(),onBlur:()=>A.current?.(),onProductSelect:M=>J.current?.(M),onProductAddToCart:M=>ne.current?.(M),setCursor:M=>L.current?.(M),products:Le.config,mapProducts:ze});g.current=p,Ce(p.getState());let W=p.subscribe(M=>Ce(M));return()=>{W(),p.destroy(),g.current===p&&(g.current=null)}},[]),Je(()=>{G!==void 0&&g.current?.setValue(G)},[G]),Je(()=>{H!==void 0&&g.current?.setCompletedParams(H)},[H]);let oa=JSON.stringify(s??null),be;try{be=JSON.stringify(r??null)}catch{be="[unstringifiable]"}Je(()=>{g.current?.update({apiConfig:s,additionalContext:r,language:l,currency:f,productId:w,optionOverrides:Be.overrides,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:v,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showProducts:F})},[oa,be,l,f?.code,f?.rate,f?.country,w,Be.key,h,c,v,I,q,D,O,F]);let Qe=ae(!1);Je(()=>{if(!Qe.current){Qe.current=!0;return}g.current?.update({products:Le.config})},[Le.enabled]),Je(()=>{g.current?.update({mapProducts:ze})},[ze]);let ie=ae(null);ie.current===null&&(ie.current={handleTextChange:p=>g.current?.handleTextChange(p),handleKeyDown:p=>{let W="nativeEvent"in p?p.nativeEvent:p;g.current?.handleKeyDown(W)},setFocused:p=>g.current?.setFocused(p),startEditingParam:p=>g.current?.startEditingParam(p),removeParam:p=>g.current?.removeParam(p)??!1,exitEditMode:()=>g.current?.exitEditMode(),handleCaretAfterInput:p=>g.current?.handleCaretAfterInput(p),handleCaretMove:p=>g.current?.handleCaretMove(p),replaceEditingRange:p=>g.current?.replaceEditingRange(p)??!1,setActivePill:p=>g.current?.setActivePill(p),skipActivePill:()=>g.current?.skipActivePill(),removeLastParam:()=>g.current?.removeLastParam(),clearNewParamId:()=>g.current?.clearNewParamId(),reset:()=>g.current?.reset(),refreshProducts:()=>g.current?.refreshProducts(),prepareSubmit:()=>g.current?.prepareSubmit(),getState:()=>g.current?.getState()??It,recordSubmit:p=>g.current?.recordSubmit(p),selectOption:(p,W)=>g.current?.selectOption(p,W),selectProduct:p=>g.current?.selectProduct(p),addProductToCart:p=>{let W=g.current;return!W||!ne.current?Promise.resolve():W.addProductToCart(p)},setActiveDropdownIndex:p=>g.current?.setActiveDropdownIndex(p),clearHighlight:p=>g.current?.clearHighlight(p),showPreviousMonth:()=>g.current?.showPreviousMonth(),showNextMonth:()=>g.current?.showNextMonth(),setTime:p=>g.current?.setTime(p),commitTime:()=>g.current?.commitTime(),toggleMultiSelectOption:p=>g.current?.toggleMultiSelectOption(p),commitMultiSelect:()=>g.current?.commitMultiSelect(),setLocationQuery:p=>g.current?.setLocationQuery(p),moveLocationHighlight:p=>g.current?.moveLocationHighlight(p),commitLocation:p=>g.current?.commitLocation(p),setLocationFieldFocused:p=>g.current?.setLocationFieldFocused(p),handleFocus:()=>g.current?.setFocused(!0),handleBlur:()=>g.current?.setFocused(!1)});let x=ie.current,De=Pt(p=>{let W=p.target.value,R=W.length>0&&!p.nativeEvent?.isComposing&&W[0]!==W[0].toUpperCase()?W[0].toUpperCase()+W.slice(1):W;g.current?.handleTextChange(R)},[]),i=Pt(p=>{g.current?.handleKeyDown(p.nativeEvent)},[]),V=g.current,b=He??It,we=G!==void 0?G:b.text,na=H!==void 0?H:b.completedParams,re=b.actionableSuggestions,We=re[0],Ge=Bo(()=>Ho(re),[re]),Pe=V?.listboxId??"",Ye=b.activeDropdownIndex>=0&&V?`${Pe}-option-${b.activeDropdownIndex}`:void 0,Ie=b.editingParam,ve=b.editingIdentified,Me=Ie?No(Ie):ve?{parameter:ve.parameter,text:Fo(ve.parameter),required:!0,options:[]}:null,Ke=b.dropdownSuggestion??Me??We,je=Me?[Me]:re,Ee=Mo(b),qe=!V||b.dropdownLoading;return{completedParams:na,multiSelectView:b.multiSelectView,toggleMultiSelectOption:x.toggleMultiSelectOption,commitMultiSelect:x.commitMultiSelect,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:Ge,setActivePill:x.setActivePill,skipActivePill:x.skipActivePill,removeLastParam:x.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:x.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:qe,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:Pe,error:b.error,products:b.products,customFields:b.customFields,selectProduct:x.selectProduct,addProductToCart:x.addProductToCart,handleTextChange:x.handleTextChange,handleKeyDown:x.handleKeyDown,setFocused:x.setFocused,editingParam:Ie,editingIdentified:ve,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:x.startEditingParam,removeParam:x.removeParam,exitEditMode:x.exitEditMode,handleCaretAfterInput:x.handleCaretAfterInput,handleCaretMove:x.handleCaretMove,replaceEditingRange:x.replaceEditingRange,inputProps:{value:we,placeholder:b.placeholderText||void 0,onChange:De,onKeyDown:i,onFocus:x.handleFocus,onBlur:x.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":Ye,"aria-autocomplete":"list","aria-controls":Pe},reset:x.reset,refreshProducts:x.refreshProducts,prepareSubmit:x.prepareSubmit,getState:x.getState,recordSubmit:x.recordSubmit,dropdownProps:{suggestions:Ke?[{...Ke,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:x.selectOption,onHighlight:x.setActiveDropdownIndex,onUnhighlight:x.clearHighlight,isOpen:b.isDropdownOpen,id:Pe,pills:je,activeSelected:b.isActivePillSelected,onPillClick:x.setActivePill,onSkip:x.skipActivePill,showSkipButton:(_??!0)&&!Ie&&!ve,showOptionIcons:te??!0,showOptionImages:T??!0,showOptionCounts:z??!0,skipDisabled:b.inSelectionAnimation,isLoading:qe,skeletonExiting:b.skeletonExiting,isInputEmpty:we.trim().length===0,language:l,products:b.products,productImageFallback:Y,onProductSelect:x.selectProduct,onProductAddToCart:S?x.addProductToCart:void 0,onProductFocusChange:x.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:Ee.selectedIso,selectedDateRange:Ee.selectedRange,dateRangeStart:Ee.rangeStart,dateReferences:Ee.references,onPreviousMonth:x.showPreviousMonth,onNextMonth:x.showNextMonth,timeView:b.timeView,multiSelectView:b.dropdownMultiSelect,onMultiSelectCommit:x.commitMultiSelect,onTimeChange:x.setTime,onTimeCommit:x.commitTime,locationView:b.locationView,isReediting:b.editingParam!=null,onLocationQuery:x.setLocationQuery,onLocationMove:x.moveLocationHighlight,onLocationCommit:x.commitLocation,onLocationFocusChange:x.setLocationFieldFocused,isFocused:b.isFocused||b.locationFieldFocused,optionsPosition:c??"below"}}}import{attachChipRemove as Go,cancelStartingHint as Ko,chipIdFromTap as qo,extractPlainText as Et,getCursorOffset as At,keepCaretOnChip as _o,plainTextLength as Vo,renderEditableContent as Uo,setCursorOffset as Rt,startingHintOptions as Qo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as fe,useEffect as ea,useLayoutEffect as Ma,useRef as aa}from"react";var xa;function Yo(){if(xa!==void 0)return xa;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),xa=e.contentEditable==="plaintext-only",xa}function Ot(e){let{segments:n,showChipIcons:a=!0,showChipImages:t=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:f,editingAnchor:w,caretOffset:y,placeholderText:m,hintSuggestions:h,isFocused:c,isDropdownOpen:v,listboxId:I,activeDescendantId:q,autoFocus:D,handleTextChange:O,handleKeyDown:te,handleCaretAfterInput:T,handleCaretMove:z,startEditingParam:_,replaceEditingRange:F,setFocused:Y}=e,E=aa(null),X=aa(!1),G=aa(""),H=aa(""),j=aa(null),de=aa(0);j.current=y,ea(()=>{if(!D)return;let u=E.current;if(!u)return;document.activeElement===u?Y(!0):u.focus();let k=u.ownerDocument??document,P=k.getSelection(),A=P&&P.rangeCount>0&&u.contains(P.anchorNode);if(P&&!A){let L=k.createRange();L.selectNodeContents(u),L.collapse(!0),P.removeAllRanges(),P.addRange(L)}},[D,Y]),ea(()=>{let u=E.current;if(!u)return;let k=u.ownerDocument??document,P=()=>{let A=k.getSelection();if(!A||A.rangeCount===0||!A.anchorNode||!u.contains(A.anchorNode))return;let L=A.anchorNode,J=L.nodeType===Node.ELEMENT_NODE?L:L.parentElement,he=(A.isCollapsed?J?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Te=l?.id??f?.id??null;if(he&&he!==Te){_(he);return}performance.now()-de.current<50||z(At(u))};return k.addEventListener("selectionchange",P),()=>k.removeEventListener("selectionchange",P)},[l,f,_,z]),ea(()=>{let u=E.current;if(!u)return;let k=P=>{let A=qo(u,P.target);A&&(_(A),_o(u,A))};return u.addEventListener("click",k),()=>u.removeEventListener("click",k)},[_]),ea(()=>{let u=E.current;if(!(!u||!s||!o))return Go(u,s)},[s,o]),Ma(()=>{let u=E.current;u&&Uo({input:u,segments:n,newParamId:r,editingParamId:l?.id??null,placeholderText:m??"",isFocused:c,showChipIcons:a,showChipImages:t,showChipRemove:o,hintOptions:Qo(h??[])})},[n,r,l,m,h,c,a,t,o]),ea(()=>{let u=E.current;return()=>{u&&Ko(u)}},[]),Ma(()=>{let u=G.current,k=r??"";if(G.current=k,!k||k===u)return;let P=E.current;if(!P)return;P.focus();let A=j.current??Vo(P);Rt(P,A)},[r]),Ma(()=>{let u=H.current,k=l?.id??"";if(H.current=k,!k||k===u||w==null)return;let P=E.current;P&&Rt(P,w)},[l,w]);let C=fe(()=>{if(X.current)return;let u=E.current;if(!u)return;let k=Et(u),A=k.length>0&&k[0]!==k[0].toUpperCase()?k[0].toUpperCase()+k.slice(1):k;O(A)},[O]),B=fe(()=>{de.current=performance.now(),C();let u=E.current;u&&T(At(u))},[C,T]);ea(()=>{let u=E.current;if(!u)return;let k=P=>{let A=P,L=A.inputType;if(L==="insertParagraph"||L==="insertLineBreak"||L==="insertFromDrop"){P.preventDefault();return}if(L.startsWith("insert")||L.startsWith("delete")){let J=L.startsWith("delete")?"":A.data??"";F(J)&&P.preventDefault()}};return u.addEventListener("beforeinput",k),()=>u.removeEventListener("beforeinput",k)},[F]);let d=fe(()=>{X.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),S=fe(()=>{X.current=!1,E.current?.removeAttribute("data-aia-composing"),C()},[C]),Fe=fe(u=>{u.preventDefault();let k=E.current;if(!k)return;let P=(u.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!P)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 ne=A.createTextNode(P);J.insertNode(ne),J.setStartAfter(ne),J.collapse(!0),L.removeAllRanges(),L.addRange(J),C()},[C]),ke=fe(u=>te(u),[te]),g=fe(()=>Y(!0),[Y]),He=fe(()=>Y(!1),[Y]),Ce=fe(()=>E.current?.focus(),[]),Re=fe(()=>E.current?.blur(),[]),Oe=fe(()=>{let u=E.current;return u?Et(u):""},[]),Se=Yo()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:Se,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":I,"aria-expanded":v,"aria-activedescendant":q,spellCheck:!0,enterKeyHint:"send",onInput:B,onKeyDown:ke,onCompositionStart:d,onCompositionEnd:S,onPaste:Fe,onFocus:g,onBlur:He},getPlainText:Oe,focus:Ce,blur:Re}}import{jsx as ia,jsxs as Fa}from"react/jsx-runtime";function on(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var nn=jo(function({onSubmit:n,onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:f,language:w,currency:y,productId:m,visitorId:h,columns:c,pillPlacement:v="dropdown",mode:I="auto",optionsPosition:q="below",animations:D=!0,optionsStyle:O="floating",dropdownTrigger:te,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:_,showNonTappableOptions:F,locationSearch:Y,showOptionIcons:E=!0,showChipIcons:X=!0,showChipImages:G=!0,showChipRemove:H=!1,showOptionImages:j=!0,showOptionCounts:de=!0,showSkipButton:C,showProducts:B,productsLayout:d,productImageFallback:S,autoFocus:Fe=!0,onFocus:ke,onBlur:g,value:He,completedParams:Ce,onChange:Re,onParamsChange:Oe,products:Se,mapProducts:u,onProductSelect:k,onProductAddToCart:P,submitButton:A,resetOnSubmit:L=!0,seeAllResults:J=!1},ne){let he=ta(null),Te=ta(null),Le=ta(null),oe=ta(()=>{}),ue=ta(null),ze=ta(null);Na(()=>{let N=he.current;if(N)return ue.current?ue.current.setMode(I):ue.current=new Jo(N,I),()=>{ue.current?.destroy(),ue.current=null}},[I]);let Be=ya(N=>{let se=ze.current?.current;se&&(se.focus(),en(se,N))},[]),{completedParams:oa,suggestionPills:be,setActivePill:Qe,skipActivePill:ie,segments:x,newParamId:De,clearNewParamId:i,placeholderText:V,isFocused:b,isDropdownOpen:we,isActivePillSelected:na,isLoading:re,isReady:We,activeIndex:Ge,listboxId:Pe,handleTextChange:Ye,handleKeyDown:Ie,setFocused:ve,editingParam:Me,editingIdentified:Ke,editingAnchor:je,caretOffset:Ee,startEditingParam:qe,removeParam:p,handleCaretAfterInput:W,handleCaretMove:M,replaceEditingRange:R,dropdownProps:Ha,reset:ua,refreshProducts:Ba,prepareSubmit:Wa,getState:Ga,recordSubmit:Ka}=Da({onSubmit:N=>oe.current(N),onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:f,language:w,currency:y,productId:m,visitorId:h,columns:c,dropdownTrigger:te,optionsPosition:q,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:_,showNonTappableOptions:F,locationSearch:Y,showOptionIcons:E,showOptionImages:j,showOptionCounts:de,showSkipButton:C,showProducts:B,onFocus:ke,onBlur:g,value:He,completedParams:Ce,onChange:Re,onParamsChange:Oe,products:Se,mapProducts:u,onProductSelect:k,onProductAddToCart:P,source:"full-sdk",setCursor:Be});Na(()=>{if(!De)return;let N=window.setTimeout(()=>i(),650);return()=>window.clearTimeout(N)},[De,i]);let Lt=Ge>=0?`${Pe}-option-${Ge}`:void 0,{inputRef:ka,editorProps:zt,focus:ma,blur:qa,getPlainText:_a}=Ot({segments:x,newParamId:De,editingParam:Me,editingIdentified:Ke,editingAnchor:je,caretOffset:Ee,placeholderText:V,hintSuggestions:v==="inline"?[]:be,isFocused:b,showChipIcons:X,showChipImages:G,showChipRemove:H,removeParam:p,isDropdownOpen:we,listboxId:Pe,activeDescendantId:Lt,autoFocus:Fe,handleTextChange:Ye,handleKeyDown:Ie,handleCaretAfterInput:W,handleCaretMove:M,startEditingParam:qe,replaceEditingRange:R,setFocused:ve});ze.current=ka,Zo(()=>{let N=Te.current,se=ka.current;if(!N||!se)return;let sa=()=>{let Ua=N.firstElementChild;if(!Ua)return;let Bt=Ua.getBoundingClientRect(),Wt=se.getBoundingClientRect();Bt.top>=Wt.bottom-2?N.setAttribute("data-aia-pill-wrapped",""):N.removeAttribute("data-aia-pill-wrapped")};sa();let Va=new ResizeObserver(sa);return Va.observe(se),()=>Va.disconnect()},[x,be.length,re,ka]),Na(()=>{let N=Le.current;if(N)return tn(N)},[]),$o(ne,()=>({focus:ma,blur:qa,reset:ua,refreshProducts:Ba,setMode:N=>ue.current?.setMode(N),skipActivePill:ie}),[ma,qa,ua,Ba,ie]);let $e=!!x.length||oa.length>0,ra=ya(N=>{if(!$e)return;N&&Wa();let se=Ga(),sa=Xo(_a(),se.completedParams,se.skippedParams,{identifiedParams:se.identifiedParams,isReady:se.isReady,customFields:se.customFields});N&&Ka(sa),n(sa),L&&ua()},[Ka,L,$e,Wa,Ga,n,ua,_a]);oe.current=()=>ra(!1);let Dt=J&&!Ha.isInputEmpty&&$e,Mt=ya(()=>ra(!0),[ra]),Nt=ya(N=>{N.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||ma()},[ma]),Ft=v==="inline",Ht=v==="dropdown";return Fa("div",{ref:he,className:`magicx-aia ${_e.container} ${r??""}`,"data-pill-placement":v,"data-options-position":q,"data-animations":D?"on":"off","data-aia-options-style":O,"data-mode":on(I),children:[ia(La,{...Ha,showPills:Ht,productsLayout:d,productImageFallback:S,onSeeAllResults:Dt?Mt:void 0}),Fa("div",{className:_e.inputWrapper,"data-aia-input-wrapper":"",onClick:Nt,children:[Fa("div",{ref:Le,className:_e.editorArea,"data-aia-editor":"",children:[ia("div",{...zt,className:_e.input,"data-aia-input":""}),Ft&&(re||be.length>0)&&ia("span",{ref:Te,className:_e.pillListContainer,"data-aia-pill-list-container":"",children:ia(fa,{pills:be,activePillIndex:0,activeSelected:na,onSelectPill:Qe,loading:re})})]}),A===null?null:A===void 0?ia(yt,{disabled:!$e,ready:$e&&We,onClick:()=>ra(!0),label:an(w).submit}):ia("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:_e.submitSlot,onClick:N=>{$e&&(N.stopPropagation(),ra(!0))},children:A})]})]})});export{nn as AIAutocomplete,La as AIAutocompleteDropdown,ms as DATE_RANGE_META_END,gs as DATE_RANGE_META_START,fs as DEFAULT_OPTION_COUNT_UNIT,Ss as LOCATION_META_KEY,Ls as PRODUCT_PATH_PREFIX,Ks as TIME_META_KEY,_s as WEEKDAY_LABELS,ps as buildSubmitResult,hs as cellDay,us as cellIso,bs as dateCellMarks,ws as formatDate,vs as formatDateRange,xs as formatOptionCount,ys as formatPlace,ks as formatTime,Cs as isoDate,Ts as monthLabel,Ps as optionCountLabel,Is as optionHasImage,Es as optionImageSources,As as optionImageSrc,Rs as optionLabel,Os as optionsShowLeadingVisuals,zs as parseDate,Ds as parseLooseDate,Ms as parseLooseDateRange,Ns as parseTime,Fs as productFromMatchedItem,Hs as productImageSources,Bs as productsFromCustomFields,Ws as sanitizeOptionIconSvg,Gs as selectedRangeFor,Da as useAIAutocomplete,qs as visibleDateRange,Vs as withSkippedParams};
3708
3779
  //# sourceMappingURL=index.mjs.map