@magicx-eng/ai-autocomplete-react 0.55.0 → 0.56.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/REFERENCE.md CHANGED
@@ -587,6 +587,7 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
587
587
  | `--aia-date-today-ring` | `--aia-option-color` | `--aia-option-color` | Outline drawn around today's date. |
588
588
  | `--aia-date-selected-bg` | white at 12% | white at 12% | Fill behind the date a re-edited parameter already holds. |
589
589
  | `--aia-date-range-bg` | white at 6% | white at 6% | Band across the days between the two ends of a picked date range. The ends themselves use `--aia-date-selected-bg`. |
590
+ | `--aia-date-reference-bg` | white at 7% | white at 7% | Soft fill behind a day another answer already holds (the pickup date while the return date is asked), shown for reference; the day stays pickable. |
590
591
  | `--aia-time-panel-width` | `240px` | `240px` | Max width of the whole dropdown panel while the time wheel is up. |
591
592
  | `--aia-time-font-size` | `15px` | `15px` | The time wheel's numbers and its `:` separator. |
592
593
  | `--aia-time-band-bg` | white at 8% | white at 8% | The band behind the wheels' top rows — the chosen time. |
package/dist/index.d.mts CHANGED
@@ -682,6 +682,8 @@ interface AIAutocompleteDropdownProps {
682
682
  selectedDateRange?: DateRange | null;
683
683
  /** The first end of a range picked so far, while the user chooses the second. On a single-date question (`formatType: "date"`) it is the known start of the range whose end is asked: days before it are dimmed and cannot be picked. Provided by `dropdownProps` from the hook. */
684
684
  dateRangeStart?: string | null;
685
+ /** Days other answers already hold, boxed on the calendar for reference and still pickable. Provided by `dropdownProps` from the hook. */
686
+ dateReferences?: readonly string[];
685
687
  /** Page the calendar back a month. Provided by `dropdownProps` from the hook. */
686
688
  onPreviousMonth?: () => void;
687
689
  /** Page the calendar forward a month. Provided by `dropdownProps` from the hook. */
@@ -728,7 +730,7 @@ interface AIAutocompleteDropdownProps {
728
730
 
729
731
  declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProps & react.RefAttributes<AIAutocompleteHandle>>;
730
732
 
731
- declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, onUnhighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, showOptionImages, showOptionCounts, skipDisabled, activeSelected, isLoading, skeletonExiting, isInputEmpty, language, products, onProductSelect, onProductAddToCart, onProductFocusChange, productsLayout, productImageFallback, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, onPreviousMonth, onNextMonth, timeView, multiSelectView, onMultiSelectCommit, onTimeChange, onTimeCommit, locationView, isReediting, onLocationQuery, onLocationMove, onLocationCommit, onLocationFocusChange, isFocused, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
733
+ declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, onUnhighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, showOptionImages, showOptionCounts, skipDisabled, activeSelected, isLoading, skeletonExiting, isInputEmpty, language, products, onProductSelect, onProductAddToCart, onProductFocusChange, productsLayout, productImageFallback, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, dateReferences, onPreviousMonth, onNextMonth, timeView, multiSelectView, onMultiSelectCommit, onTimeChange, onTimeCommit, locationView, isReediting, onLocationQuery, onLocationMove, onLocationCommit, onLocationFocusChange, isFocused, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
732
734
 
733
735
  declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, language, currency, productId, visitorId, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, prependPlaceholder, showNonTappableOptions, locationSearch, showOptionIcons, showOptionImages, showOptionCounts, showSkipButton, showProducts, productImageFallback, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, mapProducts, onProductSelect, onProductAddToCart, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
734
736
 
package/dist/index.d.ts CHANGED
@@ -682,6 +682,8 @@ interface AIAutocompleteDropdownProps {
682
682
  selectedDateRange?: DateRange | null;
683
683
  /** The first end of a range picked so far, while the user chooses the second. On a single-date question (`formatType: "date"`) it is the known start of the range whose end is asked: days before it are dimmed and cannot be picked. Provided by `dropdownProps` from the hook. */
684
684
  dateRangeStart?: string | null;
685
+ /** Days other answers already hold, boxed on the calendar for reference and still pickable. Provided by `dropdownProps` from the hook. */
686
+ dateReferences?: readonly string[];
685
687
  /** Page the calendar back a month. Provided by `dropdownProps` from the hook. */
686
688
  onPreviousMonth?: () => void;
687
689
  /** Page the calendar forward a month. Provided by `dropdownProps` from the hook. */
@@ -728,7 +730,7 @@ interface AIAutocompleteDropdownProps {
728
730
 
729
731
  declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProps & react.RefAttributes<AIAutocompleteHandle>>;
730
732
 
731
- declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, onUnhighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, showOptionImages, showOptionCounts, skipDisabled, activeSelected, isLoading, skeletonExiting, isInputEmpty, language, products, onProductSelect, onProductAddToCart, onProductFocusChange, productsLayout, productImageFallback, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, onPreviousMonth, onNextMonth, timeView, multiSelectView, onMultiSelectCommit, onTimeChange, onTimeCommit, locationView, isReediting, onLocationQuery, onLocationMove, onLocationCommit, onLocationFocusChange, isFocused, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
733
+ declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, onUnhighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, showOptionImages, showOptionCounts, skipDisabled, activeSelected, isLoading, skeletonExiting, isInputEmpty, language, products, onProductSelect, onProductAddToCart, onProductFocusChange, productsLayout, productImageFallback, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, dateReferences, onPreviousMonth, onNextMonth, timeView, multiSelectView, onMultiSelectCommit, onTimeChange, onTimeCommit, locationView, isReediting, onLocationQuery, onLocationMove, onLocationCommit, onLocationFocusChange, isFocused, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
732
734
 
733
735
  declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, language, currency, productId, visitorId, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, prependPlaceholder, showNonTappableOptions, locationSearch, showOptionIcons, showOptionImages, showOptionCounts, showSkipButton, showProducts, productImageFallback, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, mapProducts, onProductSelect, onProductAddToCart, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
734
736
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Ot=Object.defineProperty;var Pa=Object.getOwnPropertyDescriptor;var Ia=Object.getOwnPropertyNames;var Ea=Object.prototype.hasOwnProperty;var Aa=(e,a)=>{for(var t in a)Ot(e,t,{get:a[t],enumerable:!0})},Ra=(e,a,t,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of Ia(a))!Ea.call(e,o)&&o!==t&&Ot(e,o,{get:()=>a[o],enumerable:!(i=Pa(a,o))||i.enumerable});return e};var Oa=e=>Ra(Ot({},"__esModule",{value:!0}),e);var ni={};Aa(ni,{AIAutocomplete:()=>wa,AIAutocompleteDropdown:()=>Tt,DATE_RANGE_META_END:()=>l.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>l.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>l.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>l.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>l.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>l.TIME_META_KEY,WEEKDAY_LABELS:()=>l.WEEKDAY_LABELS,buildSubmitResult:()=>l.buildSubmitResult,cellDay:()=>l.cellDay,cellIso:()=>l.cellIso,dateCellMarks:()=>l.dateCellMarks,formatDate:()=>l.formatDate,formatDateRange:()=>l.formatDateRange,formatOptionCount:()=>l.formatOptionCount,formatPlace:()=>l.formatPlace,formatTime:()=>l.formatTime,isoDate:()=>l.isoDate,monthLabel:()=>l.monthLabel,optionCountLabel:()=>l.optionCountLabel,optionHasImage:()=>l.optionHasImage,optionImageSources:()=>l.optionImageSources,optionImageSrc:()=>l.optionImageSrc,optionLabel:()=>l.optionLabel,optionsShowLeadingVisuals:()=>l.optionsShowLeadingVisuals,parseDate:()=>l.parseDate,parseLooseDate:()=>l.parseLooseDate,parseLooseDateRange:()=>l.parseLooseDateRange,parseTime:()=>l.parseTime,productFromMatchedItem:()=>l.productFromMatchedItem,productImageSources:()=>l.productImageSources,productsFromCustomFields:()=>l.productsFromCustomFields,sanitizeOptionIconSvg:()=>l.sanitizeOptionIconSvg,selectedRangeFor:()=>l.selectedRangeFor,useAIAutocomplete:()=>It,visibleDateRange:()=>l.visibleDateRange,withSkippedParams:()=>l.withSkippedParams});module.exports=Oa(ni);var l=require("@magicx-eng/ai-autocomplete-vanilla");var $=require("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
+ "use strict";var Ot=Object.defineProperty;var Pa=Object.getOwnPropertyDescriptor;var Ia=Object.getOwnPropertyNames;var Ea=Object.prototype.hasOwnProperty;var Aa=(e,a)=>{for(var t in a)Ot(e,t,{get:a[t],enumerable:!0})},Ra=(e,a,t,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of Ia(a))!Ea.call(e,o)&&o!==t&&Ot(e,o,{get:()=>a[o],enumerable:!(i=Pa(a,o))||i.enumerable});return e};var Oa=e=>Ra(Ot({},"__esModule",{value:!0}),e);var ni={};Aa(ni,{AIAutocomplete:()=>wa,AIAutocompleteDropdown:()=>Tt,DATE_RANGE_META_END:()=>l.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>l.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>l.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>l.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>l.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>l.TIME_META_KEY,WEEKDAY_LABELS:()=>l.WEEKDAY_LABELS,buildSubmitResult:()=>l.buildSubmitResult,cellDay:()=>l.cellDay,cellIso:()=>l.cellIso,dateCellMarks:()=>l.dateCellMarks,formatDate:()=>l.formatDate,formatDateRange:()=>l.formatDateRange,formatOptionCount:()=>l.formatOptionCount,formatPlace:()=>l.formatPlace,formatTime:()=>l.formatTime,isoDate:()=>l.isoDate,monthLabel:()=>l.monthLabel,optionCountLabel:()=>l.optionCountLabel,optionHasImage:()=>l.optionHasImage,optionImageSources:()=>l.optionImageSources,optionImageSrc:()=>l.optionImageSrc,optionLabel:()=>l.optionLabel,optionsShowLeadingVisuals:()=>l.optionsShowLeadingVisuals,parseDate:()=>l.parseDate,parseLooseDate:()=>l.parseLooseDate,parseLooseDateRange:()=>l.parseLooseDateRange,parseTime:()=>l.parseTime,productFromMatchedItem:()=>l.productFromMatchedItem,productImageSources:()=>l.productImageSources,productsFromCustomFields:()=>l.productsFromCustomFields,sanitizeOptionIconSvg:()=>l.sanitizeOptionIconSvg,selectedRangeFor:()=>l.selectedRangeFor,useAIAutocomplete:()=>It,visibleDateRange:()=>l.visibleDateRange,withSkippedParams:()=>l.withSkippedParams});module.exports=Oa(ni);var l=require("@magicx-eng/ai-autocomplete-vanilla");var X=require("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
@@ -358,7 +358,7 @@
358
358
  transition: none;
359
359
  }
360
360
  }
361
- `,document.head.appendChild(e)}var rt={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"};var z=require("@magicx-eng/ai-autocomplete-vanilla"),Q=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
361
+ `,document.head.appendChild(e)}var st={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"};var L=require("@magicx-eng/ai-autocomplete-vanilla"),$=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
362
362
  * Built-in appearance defaults \u2014 zero specificity via :where().
363
363
  * Consumer CSS always wins without !important.
364
364
  *
@@ -1729,11 +1729,18 @@
1729
1729
  font-weight: 500;
1730
1730
  }
1731
1731
 
1732
+ /* A day another answer already holds (the pickup date while the return date is
1733
+ asked): a soft box for reference, lighter than the picked fill, and still
1734
+ pickable. */
1735
+ .aia-reference-Q5bXf .aia-number-aoT01 {
1736
+ background: var(--aia-date-reference-bg, rgba(var(--aia-streak-rgb, 255, 255, 255), 0.07));
1737
+ }
1738
+
1732
1739
  .aia-pressed-bEyyN .aia-number-aoT01 {
1733
1740
  opacity: 0.8;
1734
1741
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1735
1742
  }
1736
- `,document.head.appendChild(e)}var X={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",pressed:"aia-pressed-bEyyN"};var be=require("react/jsx-runtime"),La=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ut({options:e,activeIndex:a,listboxId:t,view:i,selection:o,onSelect:s,onHighlight:r,onUnhighlight:d,onPreviousMonth:m,onNextMonth:v}){let C=(0,J.isoDate)(new Date),g=(0,J.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,J.cellIso)(e[a]),selected:o.selectedRange,floor:o.floor});return(0,be.jsxs)("div",{className:X.datepicker,"data-aia-datepicker":"",children:[(0,be.jsxs)("div",{className:X.header,children:[(0,be.jsx)("button",{type:"button",tabIndex:-1,className:X.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:m,children:"\u2039"}),(0,be.jsx)("span",{className:X.month,"data-aia-date-month":"","aria-live":"polite",children:(0,J.monthLabel)(i)}),(0,be.jsx)("button",{type:"button",tabIndex:-1,className:X.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:v,children:"\u203A"})]}),(0,be.jsx)("div",{className:X.weekdays,"aria-hidden":"true",children:J.WEEKDAY_LABELS.map((p,u)=>(0,be.jsx)("span",{className:X.weekday,children:p},La[u]))}),(0,be.jsx)("div",{className:X.grid,"data-aia-date-grid":"",children:e.map((p,u)=>(0,be.jsx)(za,{option:p,id:`${t}-option-${u}`,index:u,isHighlighted:u===a&&p.is_tappable,isToday:(0,J.cellIso)(p)===C,isPast:(0,J.isDimmedDay)((0,J.cellIso)(p),C,o.floor),marks:(0,J.dateCellMarks)((0,J.cellIso)(p),{selectedIso:o.selectedIso,range:g}),onSelect:s,onHighlight:r,onUnhighlight:d},(0,J.cellIso)(p)??`pad-${u}`))})]})}function za({option:e,id:a,index:t,isHighlighted:i,isToday:o,isPast:s,marks:r,onSelect:d,onHighlight:m,onUnhighlight:v}){let[C,g]=(0,Vt.useState)(!1),p=(0,J.cellDay)(e);if(p==null)return(0,be.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${X.cell} ${X.blank}`});let u=()=>{g(!0),d(e),setTimeout(()=>g(!1),170)},x=[X.cell,X.day,s?X.past:"",i?X.highlighted:"",o?X.today:"",r.inRange?X.inRange:"",r.selected?X.selected:"",C?X.pressed:""].filter(Boolean).join(" ");return(0,be.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:x,onClick:u,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),u())},onMouseEnter:()=>m(t),onMouseLeave:v?()=>v(t):void 0,children:(0,be.jsx)("span",{className:X.number,children:p})})}var Je=require("@magicx-eng/ai-autocomplete-vanilla"),yt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
1743
+ `,document.head.appendChild(e)}var Q={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};var we=require("react/jsx-runtime"),La=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ut({options:e,activeIndex:a,listboxId:t,view:i,selection:o,onSelect:s,onHighlight:r,onUnhighlight:d,onPreviousMonth:g,onNextMonth:v}){let k=(0,J.isoDate)(new Date),f=(0,J.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,J.cellIso)(e[a]),selected:o.selectedRange,floor:o.floor});return(0,we.jsxs)("div",{className:Q.datepicker,"data-aia-datepicker":"",children:[(0,we.jsxs)("div",{className:Q.header,children:[(0,we.jsx)("button",{type:"button",tabIndex:-1,className:Q.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:g,children:"\u2039"}),(0,we.jsx)("span",{className:Q.month,"data-aia-date-month":"","aria-live":"polite",children:(0,J.monthLabel)(i)}),(0,we.jsx)("button",{type:"button",tabIndex:-1,className:Q.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:v,children:"\u203A"})]}),(0,we.jsx)("div",{className:Q.weekdays,"aria-hidden":"true",children:J.WEEKDAY_LABELS.map((p,u)=>(0,we.jsx)("span",{className:Q.weekday,children:p},La[u]))}),(0,we.jsx)("div",{className:Q.grid,"data-aia-date-grid":"",children:e.map((p,u)=>(0,we.jsx)(za,{option:p,id:`${t}-option-${u}`,index:u,isHighlighted:u===a&&p.is_tappable,isToday:(0,J.cellIso)(p)===k,isPast:(0,J.isDimmedDay)((0,J.cellIso)(p),k,o.floor),marks:(0,J.dateCellMarks)((0,J.cellIso)(p),{selectedIso:o.selectedIso,range:f,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:d},(0,J.cellIso)(p)??`pad-${u}`))})]})}function za({option:e,id:a,index:t,isHighlighted:i,isToday:o,isPast:s,marks:r,onSelect:d,onHighlight:g,onUnhighlight:v}){let[k,f]=(0,Vt.useState)(!1),p=(0,J.cellDay)(e);if(p==null)return(0,we.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${Q.cell} ${Q.blank}`});let u=()=>{f(!0),d(e),setTimeout(()=>f(!1),170)},x=[Q.cell,Q.day,s?Q.past:"",i?Q.highlighted:"",o?Q.today:"",r.inRange?Q.inRange:"",r.selected?Q.selected:"",r.reference?Q.reference:"",k?Q.pressed:""].filter(Boolean).join(" ");return(0,we.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:x,onClick:u,onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),u())},onMouseEnter:()=>g(t),onMouseLeave:v?()=>v(t):void 0,children:(0,we.jsx)("span",{className:Q.number,children:p})})}var Je=require("@magicx-eng/ai-autocomplete-vanilla"),yt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
1737
1744
  display: flex;
1738
1745
  flex-wrap: wrap;
1739
1746
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1773,7 +1780,7 @@
1773
1780
  .aia-cluster[data-justify="around"] {
1774
1781
  justify-content: space-around;
1775
1782
  }
1776
- `,document.head.appendChild(e)}var Lt=require("react/jsx-runtime");function ft({gap:e,align:a="center",justify:t="start",noWrap:i=!1,inline:o=!1,className:s,children:r,...d}){let m=e?{"--aia-cluster-gap":e}:void 0,v={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":i||void 0,"data-inline":o||void 0,style:m,...d};return o?(0,Lt.jsx)("span",{...v,children:r}):(0,Lt.jsx)("div",{...v,children:r})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
1783
+ `,document.head.appendChild(e)}var Lt=require("react/jsx-runtime");function bt({gap:e,align:a="center",justify:t="start",noWrap:i=!1,inline:o=!1,className:s,children:r,...d}){let g=e?{"--aia-cluster-gap":e}:void 0,v={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":i||void 0,"data-inline":o||void 0,style:g,...d};return o?(0,Lt.jsx)("span",{...v,children:r}):(0,Lt.jsx)("div",{...v,children:r})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
1777
1784
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
1778
1785
  room above the hint/branding row so the footer doesn't butt against the last
1779
1786
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -1920,7 +1927,7 @@
1920
1927
  justify-content: flex-end;
1921
1928
  }
1922
1929
  }
1923
- `,document.head.appendChild(e)}var Ve={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"};var Fe=require("react/jsx-runtime");function Yt({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,Je.uiStringsFor)()}){let{key:i,hint:o}=(0,Je.getFooterHint)(e,a,t),[s,r]=(0,yt.useState)(Je.ATTRIBUTION_URL);return(0,yt.useEffect)(()=>{r((0,Je.buildAttributionUrl)())},[]),(0,Fe.jsx)("footer",{className:Ve.footer,"data-aia-footer":"",children:(0,Fe.jsxs)(ft,{justify:"between",noWrap:!0,className:Ve.row,children:[(0,Fe.jsxs)(ft,{gap:"5px",className:Ve.hintGroup,children:[(0,Fe.jsx)("kbd",{className:Ve.key,children:i}),(0,Fe.jsx)("span",{className:Ve.hint,children:o})]}),(0,Fe.jsxs)("a",{className:Ve.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[(0,Fe.jsx)("span",{className:Ve.brand,children:"AI"}),(0,Fe.jsx)("span",{className:Ve.badge,children:"Autocomplete"})]})]})})}var ne=require("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
1930
+ `,document.head.appendChild(e)}var qe={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"};var Fe=require("react/jsx-runtime");function Qt({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,Je.uiStringsFor)()}){let{key:i,hint:o}=(0,Je.getFooterHint)(e,a,t),[s,r]=(0,yt.useState)(Je.ATTRIBUTION_URL);return(0,yt.useEffect)(()=>{r((0,Je.buildAttributionUrl)())},[]),(0,Fe.jsx)("footer",{className:qe.footer,"data-aia-footer":"",children:(0,Fe.jsxs)(bt,{justify:"between",noWrap:!0,className:qe.row,children:[(0,Fe.jsxs)(bt,{gap:"5px",className:qe.hintGroup,children:[(0,Fe.jsx)("kbd",{className:qe.key,children:i}),(0,Fe.jsx)("span",{className:qe.hint,children:o})]}),(0,Fe.jsxs)("a",{className:qe.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[(0,Fe.jsx)("span",{className:qe.brand,children:"AI"}),(0,Fe.jsx)("span",{className:qe.badge,children:"Autocomplete"})]})]})})}var re=require("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
1924
1931
  Angular copy). The three are kept identical by
1925
1932
  packages/vanilla/tests/render/locationFieldParity.test.ts. */
1926
1933
  .aia-location-6-fsr {
@@ -2054,7 +2061,7 @@
2054
2061
  .aia-loadingBar-OLCr4:nth-child(3) {
2055
2062
  width: 60%;
2056
2063
  }
2057
- `,document.head.appendChild(e)}var ee={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"};var q=require("react/jsx-runtime"),Da=0;function bt(e){return e.getRootNode().activeElement??null}function $t(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Qt(e){if(!e.isContentEditable)return null;let a=$t(e);if(!a||a.rangeCount===0)return null;let t=a.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function jt(e,a){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=$t(e);if(!t)return;let i=a;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}var Ma=(0,q.jsxs)("svg",{className:ee.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,q.jsx)("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),(0,q.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Na=(0,q.jsxs)("svg",{className:ee.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,q.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,q.jsx)("path",{d:"m20 20-3.5-3.5"})]});function Zt({view:e,searchLabel:a,noResultsLabel:t,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:d=!0,onQuery:m,onMove:v,onCommit:C,onFocusChange:g}){let p=(0,ne.useRef)(null),u=(0,ne.useRef)(null),x=(0,ne.useRef)(null),A=(0,ne.useRef)(null),V=(0,ne.useRef)(null),H=(0,ne.useRef)(!1),N=(0,ne.useRef)(!1),de=(0,ne.useRef)(!1),P=(0,ne.useRef)(!1),G=(0,ne.useRef)(o);G.current=o;let K=(0,ne.useRef)(g);K.current=g;let S=c=>{P.current=c,g(c)},ae=()=>{let c=p.current;return c!=null&&bt(c)===c},ce=()=>{let c=u.current;if(!c)return;let E=bt(c);E instanceof HTMLElement&&E!==p.current&&E!==document.body&&!c.contains(E)&&(A.current=E,V.current=Qt(E))},ie=c=>{let E=u.current;!E||!(c instanceof HTMLElement)||c===A.current||c===document.body||E.contains(c)||(A.current=c,V.current=Qt(c))},oe=(0,ne.useRef)(null);oe.current===null&&(oe.current=`aia-location-${++Da}`);let L=`${oe.current}-row-`;(0,ne.useEffect)(()=>{let c=p.current;c&&c.value!==e.query&&bt(c)!==c&&(c.value=e.query)},[e.query]),(0,ne.useEffect)(()=>{o&&(s&&!de.current&&(N.current=!1),de.current=s);let c=p.current;if(c){if(!r&&ae()){N.current=!0,F();return}if(!o){setTimeout(()=>{if(G.current)return;let E=A.current;E&&bt(E)===E||(N.current=!1)},0);return}if(!(!s||N.current||!d||ae())){if(ce(),S(!0),c.focus({preventScroll:!0}),!ae()){N.current=!0,S(!1);return}c.value&&c.select()}}}),(0,ne.useLayoutEffect)(()=>()=>{if(!P.current)return;let c=p.current,E=A.current;E?.isConnected&&c&&bt(c)===c&&(H.current=!0,jt(E,V.current),H.current=!1),P.current=!1,K.current(!1)},[]);let F=(c=!1)=>{c&&(N.current=!0);let E=A.current;E?.isConnected&&ae()&&(H.current=!0,jt(E,V.current),H.current=!1),S(!1)},Le=e.query.trim(),Ce=e.highlighted>=0&&e.highlighted<e.places.length?`${L}${e.highlighted}`:void 0,ve=null;return e.places.length>0?ve=e.places.map((c,E)=>(0,q.jsxs)("div",{id:`${L}${E}`,role:"option","aria-selected":E===e.highlighted,className:E===e.highlighted?`${ee.row} ${ee.highlighted}`:ee.row,"data-aia-location-row":"","data-aia-index":E,onClick:()=>{d&&(F(!0),C(E))},children:[(0,q.jsx)("span",{className:ee.pin,children:Ma}),(0,q.jsxs)("span",{className:ee.text,children:[(0,q.jsx)("span",{className:ee.name,children:c.name}),c.secondary&&(0,q.jsx)("span",{className:ee.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?ve=(0,q.jsxs)("div",{className:ee.loading,"data-aia-location-loading":"",children:[(0,q.jsx)("span",{className:ee.loadingBar}),(0,q.jsx)("span",{className:ee.loadingBar}),(0,q.jsx)("span",{className:ee.loadingBar})]}):Le&&(ve=(0,q.jsxs)("div",{className:ee.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,q.jsx)("span",{className:ee.empty,children:t}),(0,q.jsx)("span",{children:i})]})),(0,q.jsxs)("div",{ref:u,className:ee.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!x.current?.contains(c.target)||(c.stopPropagation(),ce(),S(!0))},children:[(0,q.jsxs)("label",{ref:x,className:ee.field,children:[Na,(0,q.jsx)("input",{ref:p,type:"text",className:ee.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:a,"aria-label":a,"aria-activedescendant":Ce,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>m(c.target.value),onFocus:c=>{ie(c.relatedTarget),S(!0)},onBlur:()=>{H.current||(N.current=!0,S(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),v(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!d)return;F(!0),C();return;case"Escape":c.preventDefault(),c.stopPropagation(),N.current=!0,F();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),N.current=!0,F();return}}})]}),(0,q.jsx)("div",{className:ee.results,"data-aia-location-results":"","aria-live":"polite",children:ve})]})}var kt=require("@magicx-eng/ai-autocomplete-vanilla");var Xt=require("@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,
2064
+ `,document.head.appendChild(e)}var ee={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"};var _=require("react/jsx-runtime"),Da=0;function wt(e){return e.getRootNode().activeElement??null}function $t(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Yt(e){if(!e.isContentEditable)return null;let a=$t(e);if(!a||a.rangeCount===0)return null;let t=a.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function jt(e,a){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=$t(e);if(!t)return;let i=a;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}var Ma=(0,_.jsxs)("svg",{className:ee.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,_.jsx)("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),(0,_.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Na=(0,_.jsxs)("svg",{className:ee.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,_.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,_.jsx)("path",{d:"m20 20-3.5-3.5"})]});function Zt({view:e,searchLabel:a,noResultsLabel:t,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:d=!0,onQuery:g,onMove:v,onCommit:k,onFocusChange:f}){let p=(0,re.useRef)(null),u=(0,re.useRef)(null),x=(0,re.useRef)(null),E=(0,re.useRef)(null),U=(0,re.useRef)(null),H=(0,re.useRef)(!1),N=(0,re.useRef)(!1),ce=(0,re.useRef)(!1),T=(0,re.useRef)(!1),G=(0,re.useRef)(o);G.current=o;let K=(0,re.useRef)(f);K.current=f;let C=c=>{T.current=c,f(c)},ae=()=>{let c=p.current;return c!=null&&wt(c)===c},pe=()=>{let c=u.current;if(!c)return;let I=wt(c);I instanceof HTMLElement&&I!==p.current&&I!==document.body&&!c.contains(I)&&(E.current=I,U.current=Yt(I))},ie=c=>{let I=u.current;!I||!(c instanceof HTMLElement)||c===E.current||c===document.body||I.contains(c)||(E.current=c,U.current=Yt(c))},oe=(0,re.useRef)(null);oe.current===null&&(oe.current=`aia-location-${++Da}`);let O=`${oe.current}-row-`;(0,re.useEffect)(()=>{let c=p.current;c&&c.value!==e.query&&wt(c)!==c&&(c.value=e.query)},[e.query]),(0,re.useEffect)(()=>{o&&(s&&!ce.current&&(N.current=!1),ce.current=s);let c=p.current;if(c){if(!r&&ae()){N.current=!0,F();return}if(!o){setTimeout(()=>{if(G.current)return;let I=E.current;I&&wt(I)===I||(N.current=!1)},0);return}if(!(!s||N.current||!d||ae())){if(pe(),C(!0),c.focus({preventScroll:!0}),!ae()){N.current=!0,C(!1);return}c.value&&c.select()}}}),(0,re.useLayoutEffect)(()=>()=>{if(!T.current)return;let c=p.current,I=E.current;I?.isConnected&&c&&wt(c)===c&&(H.current=!0,jt(I,U.current),H.current=!1),T.current=!1,K.current(!1)},[]);let F=(c=!1)=>{c&&(N.current=!0);let I=E.current;I?.isConnected&&ae()&&(H.current=!0,jt(I,U.current),H.current=!1),C(!1)},De=e.query.trim(),Pe=e.highlighted>=0&&e.highlighted<e.places.length?`${O}${e.highlighted}`:void 0,xe=null;return e.places.length>0?xe=e.places.map((c,I)=>(0,_.jsxs)("div",{id:`${O}${I}`,role:"option","aria-selected":I===e.highlighted,className:I===e.highlighted?`${ee.row} ${ee.highlighted}`:ee.row,"data-aia-location-row":"","data-aia-index":I,onClick:()=>{d&&(F(!0),k(I))},children:[(0,_.jsx)("span",{className:ee.pin,children:Ma}),(0,_.jsxs)("span",{className:ee.text,children:[(0,_.jsx)("span",{className:ee.name,children:c.name}),c.secondary&&(0,_.jsx)("span",{className:ee.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?xe=(0,_.jsxs)("div",{className:ee.loading,"data-aia-location-loading":"",children:[(0,_.jsx)("span",{className:ee.loadingBar}),(0,_.jsx)("span",{className:ee.loadingBar}),(0,_.jsx)("span",{className:ee.loadingBar})]}):De&&(xe=(0,_.jsxs)("div",{className:ee.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,_.jsx)("span",{className:ee.empty,children:t}),(0,_.jsx)("span",{children:i})]})),(0,_.jsxs)("div",{ref:u,className:ee.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!x.current?.contains(c.target)||(c.stopPropagation(),pe(),C(!0))},children:[(0,_.jsxs)("label",{ref:x,className:ee.field,children:[Na,(0,_.jsx)("input",{ref:p,type:"text",className:ee.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:a,"aria-label":a,"aria-activedescendant":Pe,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>g(c.target.value),onFocus:c=>{ie(c.relatedTarget),C(!0)},onBlur:()=>{H.current||(N.current=!0,C(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),v(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!d)return;F(!0),k();return;case"Escape":c.preventDefault(),c.stopPropagation(),N.current=!0,F();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),N.current=!0,F();return}}})]}),(0,_.jsx)("div",{className:ee.results,"data-aia-location-results":"","aria-live":"polite",children:xe})]})}var kt=require("@magicx-eng/ai-autocomplete-vanilla");var Xt=require("@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,
2058
2065
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
2059
2066
  The border is kept as a 1px transparent line so the box stays the same size
2060
2067
  as it was when the outline was dashed. */
@@ -2212,7 +2219,7 @@
2212
2219
  opacity: 0;
2213
2220
  }
2214
2221
  }
2215
- `,document.head.appendChild(e)}var Be={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"};var et=require("react/jsx-runtime"),zt={selected:1,first:.7,next:.4,last:.2};function Jt({label:e,state:a,active:t,rounded:i,loading:o,smartSuggestion:s,completionHeader:r,onClick:d}){let m=[Be.pill,i?Be.rounded:"",o?Be.skeleton:""].filter(Boolean).join(" ");return(0,et.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:m,style:{"--aia-pill-opacity":zt[a]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:d,disabled:o,children:s?(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)("span",{className:`${Be.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,et.jsx)("span",{className:`${Be.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Xt.SMART_SUGGESTION_SPARKLE_SVG}})]}):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 {
2222
+ `,document.head.appendChild(e)}var Be={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"};var et=require("react/jsx-runtime"),zt={selected:1,first:.7,next:.4,last:.2};function Jt({label:e,state:a,active:t,rounded:i,loading:o,smartSuggestion:s,completionHeader:r,onClick:d}){let g=[Be.pill,i?Be.rounded:"",o?Be.skeleton:""].filter(Boolean).join(" ");return(0,et.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:g,style:{"--aia-pill-opacity":zt[a]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:d,disabled:o,children:s?(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)("span",{className:`${Be.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,et.jsx)("span",{className:`${Be.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Xt.SMART_SUGGESTION_SPARKLE_SVG}})]}):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 {
2216
2223
  position: relative;
2217
2224
  z-index: 1;
2218
2225
  pointer-events: auto;
@@ -2222,7 +2229,7 @@
2222
2229
  align-items: center;
2223
2230
  vertical-align: middle;
2224
2231
  }
2225
- `,document.head.appendChild(e)}var Dt={list:"aia-list-qvLqO"};var wt=require("react/jsx-runtime"),Ha=[125,69];function ea(e){return e===0?"first":e===1?"next":"last"}function Ct({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:i,rounded:o,loading:s}){return s&&e.length===0?(0,wt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":"",children:Ha.map((r,d)=>(0,wt.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Be.pill} ${o?Be.rounded:""} ${Be.skeleton}`,style:{width:r,"--aia-pill-opacity":zt[ea(d)]}},`skel-${r}`))}):(0,wt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,d)=>{let m=!!i&&d===a;return(0,wt.jsx)(Jt,{label:r.text,state:m?"selected":ea(d),selected:m,active:d===a,rounded:o,loading:s,smartSuggestion:(0,kt.isSmartSuggestion)(r),completionHeader:(0,kt.isTraditionalAutocompleteSuggestion)(r),onClick:()=>t(d)},`${r.parameter}-${r.text}`)})})}var ye=require("@magicx-eng/ai-autocomplete-vanilla"),we=require("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
2232
+ `,document.head.appendChild(e)}var Dt={list:"aia-list-qvLqO"};var vt=require("react/jsx-runtime"),Ha=[125,69];function ea(e){return e===0?"first":e===1?"next":"last"}function Ct({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:i,rounded:o,loading:s}){return s&&e.length===0?(0,vt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":"",children:Ha.map((r,d)=>(0,vt.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Be.pill} ${o?Be.rounded:""} ${Be.skeleton}`,style:{width:r,"--aia-pill-opacity":zt[ea(d)]}},`skel-${r}`))}):(0,vt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,d)=>{let g=!!i&&d===a;return(0,vt.jsx)(Jt,{label:r.text,state:g?"selected":ea(d),selected:g,active:d===a,rounded:o,loading:s,smartSuggestion:(0,kt.isSmartSuggestion)(r),completionHeader:(0,kt.isTraditionalAutocompleteSuggestion)(r),onClick:()=>t(d)},`${r.parameter}-${r.text}`)})})}var Se=require("@magicx-eng/ai-autocomplete-vanilla"),ve=require("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
2226
2233
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
2227
2234
  theming one package sees the same result in the other.
2228
2235
 
@@ -2791,7 +2798,7 @@
2791
2798
  .aia-card-JBGYT[data-aia-product-has-cart] {
2792
2799
  padding-right: calc(var(--aia-product-cart-size, 28px) + 16px);
2793
2800
  }
2794
- `,document.head.appendChild(e)}var te={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"};var W=require("react/jsx-runtime");function ta({products:e,listboxId:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s=!0,layout:r="row",imageFallback:d="image",strings:m=(0,ye.uiStringsFor)()}){let v=e.length>0,C=(0,we.useRef)(null);if((0,we.useEffect)(()=>{let p=C.current;if(!(!v||!p))return(0,ye.attachProductRowWheel)(p)},[v]),!v)return null;let g=`${a}-products-label`;return(0,W.jsxs)("section",{className:te.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":g,children:[(0,W.jsx)("div",{className:te.label,id:g,"data-aia-products-label":"",children:m.products}),(0,W.jsx)("div",{ref:C,className:te.row,"data-aia-products-row":"",children:e.map((p,u)=>(0,W.jsx)(Fa,{product:p,id:`${a}-product-${u}`,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:d,soldOut:m.soldOut,addToCart:m.addToCart},p.id))})]})}function Fa({product:e,id:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:r,soldOut:d,addToCart:m}){let v=!!i&&e.available!==!1,[C,g]=(0,we.useState)(null),p=x=>{x.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},u=x=>{x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||x.button!==0||(x.preventDefault(),t(e))};return(0,W.jsxs)("a",{id:a,className:te.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":v?"":void 0,role:"option","aria-selected":!1,style:C?{"--aia-product-photo-fill-x":String(C.x),"--aia-product-photo-fill-y":String(C.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:u,onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:p,children:[(0,W.jsx)(Ga,{sources:(0,ye.productImageSources)(e.imageUrl),title:e.title,fallback:r,onPhotoFill:g},(0,ye.productImageSrc)(e.imageUrl)??""),(0,W.jsxs)("span",{className:te.body,children:[e.vendor?(0,W.jsx)("span",{className:te.vendor,children:e.vendor}):null,(0,W.jsx)("span",{className:te.title,children:e.title}),e.price?(0,W.jsxs)("span",{className:te.price,children:[e.price,e.compareAtPrice?(0,W.jsx)("s",{className:te.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,W.jsx)("span",{className:te.badge,children:d}):null]}),v&&i?(0,W.jsx)(Wa,{product:e,label:`${m}: ${e.title}`,focusable:s,onAddToCart:i,onFocus:()=>o?.(!0),onBlur:p},Ba(e)):null]})}function Ba(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(a=>a??"").join("\0")}function Wa({product:e,label:a,focusable:t,onAddToCart:i,onFocus:o,onBlur:s}){let[r,d]=(0,we.useState)(null),m=(0,we.useRef)(null),v=(0,we.useRef)(e);v.current=e;let C=(0,we.useRef)(!0);(0,we.useEffect)(()=>(C.current=!0,()=>{C.current=!1}),[]);let g=u=>{m.current=u,C.current&&d(u)},p=u=>{if(u.preventDefault(),u.stopPropagation(),m.current==="adding")return;g("adding");let x;try{x=Promise.resolve(i(v.current))}catch(A){x=Promise.reject(A)}x.then(()=>g("added"),()=>g(null))};return(0,W.jsx)("span",{className:te.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":a,tabIndex:t?0:-1,onClick:p,onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||p(u)},onFocus:u=>{u.stopPropagation(),o()},onBlur:u=>{u.stopPropagation(),s(u)},children:(0,W.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,W.jsx)("path",{className:te.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"}),(0,W.jsx)("path",{className:te.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,W.jsx)("path",{className:te.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,W.jsx)("path",{className:te.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,W.jsx)("circle",{className:te.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,W.jsx)("circle",{className:te.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ga({sources:e,title:a,fallback:t,onPhotoFill:i}){let[o,s]=(0,we.useState)(0),r=e[o],d=!!r,[m,v]=(0,we.useState)(null),C=!d&&t==="initial";return(0,we.useEffect)(()=>()=>i(null),[i]),(0,W.jsxs)("span",{className:te.media,"aria-hidden":"true","data-aia-product-placeholder":!d&&!C?"":void 0,"data-aia-product-initial":C?"":void 0,"data-aia-image-loaded":d&&m===r?"":void 0,children:[d?(0,W.jsx)("img",{className:te.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:g=>{v(r),i((0,ye.productPhotoFill)(g.currentTarget.naturalWidth,g.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),s(g=>g+1)}}):null,C?(0,ye.productInitial)(a):null]})}var U=require("@magicx-eng/ai-autocomplete-vanilla"),Ee=require("react");var aa=require("@magicx-eng/ai-autocomplete-vanilla"),St=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
2801
+ `,document.head.appendChild(e)}var te={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"};var W=require("react/jsx-runtime");function ta({products:e,listboxId:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s=!0,layout:r="row",imageFallback:d="image",strings:g=(0,Se.uiStringsFor)()}){let v=e.length>0,k=(0,ve.useRef)(null);if((0,ve.useEffect)(()=>{let p=k.current;if(!(!v||!p))return(0,Se.attachProductRowWheel)(p)},[v]),!v)return null;let f=`${a}-products-label`;return(0,W.jsxs)("section",{className:te.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":f,children:[(0,W.jsx)("div",{className:te.label,id:f,"data-aia-products-label":"",children:g.products}),(0,W.jsx)("div",{ref:k,className:te.row,"data-aia-products-row":"",children:e.map((p,u)=>(0,W.jsx)(Fa,{product:p,id:`${a}-product-${u}`,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:d,soldOut:g.soldOut,addToCart:g.addToCart},p.id))})]})}function Fa({product:e,id:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:r,soldOut:d,addToCart:g}){let v=!!i&&e.available!==!1,[k,f]=(0,ve.useState)(null),p=x=>{x.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},u=x=>{x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||x.button!==0||(x.preventDefault(),t(e))};return(0,W.jsxs)("a",{id:a,className:te.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":v?"":void 0,role:"option","aria-selected":!1,style:k?{"--aia-product-photo-fill-x":String(k.x),"--aia-product-photo-fill-y":String(k.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:u,onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:p,children:[(0,W.jsx)(Ga,{sources:(0,Se.productImageSources)(e.imageUrl),title:e.title,fallback:r,onPhotoFill:f},(0,Se.productImageSrc)(e.imageUrl)??""),(0,W.jsxs)("span",{className:te.body,children:[e.vendor?(0,W.jsx)("span",{className:te.vendor,children:e.vendor}):null,(0,W.jsx)("span",{className:te.title,children:e.title}),e.price?(0,W.jsxs)("span",{className:te.price,children:[e.price,e.compareAtPrice?(0,W.jsx)("s",{className:te.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,W.jsx)("span",{className:te.badge,children:d}):null]}),v&&i?(0,W.jsx)(Wa,{product:e,label:`${g}: ${e.title}`,focusable:s,onAddToCart:i,onFocus:()=>o?.(!0),onBlur:p},Ba(e)):null]})}function Ba(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(a=>a??"").join("\0")}function Wa({product:e,label:a,focusable:t,onAddToCart:i,onFocus:o,onBlur:s}){let[r,d]=(0,ve.useState)(null),g=(0,ve.useRef)(null),v=(0,ve.useRef)(e);v.current=e;let k=(0,ve.useRef)(!0);(0,ve.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let f=u=>{g.current=u,k.current&&d(u)},p=u=>{if(u.preventDefault(),u.stopPropagation(),g.current==="adding")return;f("adding");let x;try{x=Promise.resolve(i(v.current))}catch(E){x=Promise.reject(E)}x.then(()=>f("added"),()=>f(null))};return(0,W.jsx)("span",{className:te.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":a,tabIndex:t?0:-1,onClick:p,onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||p(u)},onFocus:u=>{u.stopPropagation(),o()},onBlur:u=>{u.stopPropagation(),s(u)},children:(0,W.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,W.jsx)("path",{className:te.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"}),(0,W.jsx)("path",{className:te.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,W.jsx)("path",{className:te.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,W.jsx)("path",{className:te.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,W.jsx)("circle",{className:te.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,W.jsx)("circle",{className:te.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ga({sources:e,title:a,fallback:t,onPhotoFill:i}){let[o,s]=(0,ve.useState)(0),r=e[o],d=!!r,[g,v]=(0,ve.useState)(null),k=!d&&t==="initial";return(0,ve.useEffect)(()=>()=>i(null),[i]),(0,W.jsxs)("span",{className:te.media,"aria-hidden":"true","data-aia-product-placeholder":!d&&!k?"":void 0,"data-aia-product-initial":k?"":void 0,"data-aia-image-loaded":d&&g===r?"":void 0,children:[d?(0,W.jsx)("img",{className:te.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:f=>{v(r),i((0,Se.productPhotoFill)(f.currentTarget.naturalWidth,f.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),s(f=>f+1)}}):null,k?(0,Se.productInitial)(a):null]})}var Y=require("@magicx-eng/ai-autocomplete-vanilla"),Re=require("react");var aa=require("@magicx-eng/ai-autocomplete-vanilla"),St=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
2795
2802
  display: grid;
2796
2803
  grid-template-columns: repeat(
2797
2804
  auto-fit,
@@ -2835,7 +2842,7 @@
2835
2842
  :where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
2836
2843
  max-height: var(--aia-grid-max-height, 120px);
2837
2844
  }
2838
- `,document.head.appendChild(e)}var oa=require("react/jsx-runtime");function ia({min:e="16rem",max:a,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:s,cols:r,template:d,innerRef:m,className:v,children:C,...g}){let p=(0,St.useRef)(null);(0,St.useLayoutEffect)(()=>{if(s===void 0)return;let x=p.current;x&&(x.scrollTop=0)},[s]);let u={"--aia-grid-min":e};return a&&(u["--aia-grid-max"]=a),t&&(u["--aia-grid-gap"]=t),o&&(u["--aia-grid-max-height"]=o),r&&(u.gridTemplateColumns=(0,aa.optionsGridTemplateColumns)(r)),d&&(u.gridTemplateColumns=d),(0,oa.jsx)("div",{ref:x=>{p.current=x,m?.(x)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:u,...g,children:C})}var me=require("@magicx-eng/ai-autocomplete-vanilla"),Ie=require("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 {
2845
+ `,document.head.appendChild(e)}var oa=require("react/jsx-runtime");function ia({min:e="16rem",max:a,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:s,cols:r,template:d,innerRef:g,className:v,children:k,...f}){let p=(0,St.useRef)(null);(0,St.useLayoutEffect)(()=>{if(s===void 0)return;let x=p.current;x&&(x.scrollTop=0)},[s]);let u={"--aia-grid-min":e};return a&&(u["--aia-grid-max"]=a),t&&(u["--aia-grid-gap"]=t),o&&(u["--aia-grid-max-height"]=o),r&&(u.gridTemplateColumns=(0,aa.optionsGridTemplateColumns)(r)),d&&(u.gridTemplateColumns=d),(0,oa.jsx)("div",{ref:x=>{p.current=x,g?.(x)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:u,...f,children:k})}var fe=require("@magicx-eng/ai-autocomplete-vanilla"),Ae=require("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 {
2839
2846
  position: relative;
2840
2847
  /* Clip, not visible: the entrance rise below runs on the inner content,
2841
2848
  and a transformed box extends its scroll container's scrollable area.
@@ -3355,7 +3362,7 @@
3355
3362
  border-radius: 6px;
3356
3363
  font-size: 11px;
3357
3364
  }
3358
- `,document.head.appendChild(e)}var le={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"};var he=require("react/jsx-runtime");function na({option:e,isHighlighted:a,checked:t,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:d,showIcon:m=!0,showImage:v=!0,showCount:C=!0,scrollHint:g,enterDelayMs:p=0}){let[u]=(0,Ie.useState)(p),[x,A]=(0,Ie.useState)(!1),V=v?(0,me.optionImageSources)(e.image_url):[],H=V[0]??null,[N,de]=(0,Ie.useState)([]),P=V.find(L=>!N.includes(L))??null,[G,K]=(0,Ie.useState)(null),S=(0,Ie.useMemo)(()=>!H&&m&&e.icon_svg?(0,me.sanitizeOptionIconSvg)(e.icon_svg):null,[H,m,e.icon_svg]),ae=C?(0,me.formatOptionCount)(e.item_count):null,ce=(0,Ie.useRef)(void 0);(0,Ie.useEffect)(()=>()=>clearTimeout(ce.current),[]);let ie=L=>{if(d||!e.is_tappable||x&&t===void 0)return;A(!0);let F=L?.currentTarget;t!==void 0&&F!==void 0&&L!==void 0&&!(0,me.isMultiSelectToggleTap)(F,F.querySelector("[data-aia-checkbox]"),L)?i(e,{commit:!0}):i(e),clearTimeout(ce.current),ce.current=setTimeout(()=>A(!1),170)},oe=[le.item,a&&!d?le.highlighted:"",e.liveMatch&&!d?le.liveMatch:"",e.is_tappable?le.tappable:le.nonTappable,x?le.pressed:"",g?le.scrollHint:""].filter(Boolean).join(" ");return(0,he.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":d?"":void 0,"data-aia-icon":S&&e.icon?e.icon:void 0,"data-aia-image":H?"":void 0,"data-aia-item-count":ae!==null?e.item_count:void 0,"aria-selected":t??a,className:oe,style:{[me.OPTION_ENTER_DELAY_VAR]:`${u}ms`},tabIndex:d||!e.is_tappable?-1:0,onClick:ie,onKeyDown:L=>{!d&&e.is_tappable&&(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),ie())},onMouseEnter:!d&&e.is_tappable?o:void 0,onMouseLeave:s,children:(0,he.jsxs)("span",{className:le.content,children:[t!==void 0&&e.is_tappable&&(0,he.jsx)("span",{className:le.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),H&&(0,he.jsx)("span",{className:`${le.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":P!==null&&G===P?"":void 0,children:(0,he.jsx)("img",{src:P??H,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:P===null,onLoad:()=>K(P),onError:()=>{P!==null&&de(L=>[...L,P])}})}),S&&(0,he.jsx)("span",{className:`${le.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:S}}),(0,he.jsxs)("span",{className:le.text,children:[e.matchedText?(0,me.highlightParts)((0,me.optionLabel)(e),e.matchedText).map((L,F)=>L.bold?(0,he.jsx)("strong",{className:`${le.match} magicx-aia-option-match`,children:L.text},F):L.text):(0,me.optionLabel)(e),e.parameterLabel&&(0,he.jsxs)(he.Fragment,{children:[" ",(0,he.jsx)("span",{className:`${le.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,he.jsx)("span",{className:le.tag,children:e.tag}),ae!==null&&(0,he.jsx)("span",{className:`${le.count} magicx-aia-option-count`,children:ae})]})})}var Mt=require("react/jsx-runtime");function Ka(){let[e,a]=(0,Ee.useState)(U.isOptionsGridMobileViewport);return(0,Ee.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(U.OPTIONS_GRID_MOBILE_QUERY),i=()=>a(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function ra({options:e,activeIndex:a,picked:t,onSelect:i,onHighlight:o,onUnhighlight:s,listboxId:r,loading:d,groupKey:m="",optionsPosition:v="below",showIcons:C=!0,showImages:g=!0,showCounts:p=!0}){let u=Ka(),x=(0,Ee.useRef)(null),[A,V]=(0,Ee.useState)(null),H=(0,Ee.useRef)(null);(0,Ee.useLayoutEffect)(()=>{if(d&&(0,U.sameOptionRows)(H.current,e))return;H.current=d?null:e;let P=x.current,G=P&&!d&&(0,U.needsOptionsGridMeasurement)(e.length,u),K=P?.closest("[data-aia-dropdown]");G&&K&&(0,U.releasePanelHug)(K);let S=G?(0,U.measureOptionsGrid)(P):null;V(S?(0,U.planOptionsGrid)(e.length,u,S.rowWidths,S.gridWidth):null)},[e,u,d]);let N=A??(0,U.planOptionsGrid)(e.length,u,null,null);(0,Ee.useLayoutEffect)(()=>{let P=x.current?.closest("[data-aia-dropdown]");P&&(0,U.syncPanelHug)(P)},[N.template,u]);let de=(0,U.optionsShowLeadingVisuals)(e,C,g);return(0,Mt.jsx)(ia,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:m,template:N.template,maxHeight:N.maxHeight,innerRef:P=>{x.current=P},"data-aia-group":m,children:e.map((P,G)=>(0,Mt.jsx)(na,{option:P,isHighlighted:G===a,checked:t?t.includes(P.text):void 0,onSelect:i,onHighlight:()=>o(G),onUnhighlight:s?()=>s(G):void 0,id:`${r}-option-${G}`,loading:d,showIcon:C&&de,showImage:g&&de,showCount:p,scrollHint:!d&&N.scrollHintIndices.includes(G),enterDelayMs:d?0:(0,U.optionEnterDelayMs)(G,N.cols,e.length,v)},`${m}\0${P.text}`))})}var ue=require("@magicx-eng/ai-autocomplete-vanilla"),Re=require("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) ---
3365
+ `,document.head.appendChild(e)}var de={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"};var he=require("react/jsx-runtime");function na({option:e,isHighlighted:a,checked:t,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:d,showIcon:g=!0,showImage:v=!0,showCount:k=!0,scrollHint:f,enterDelayMs:p=0}){let[u]=(0,Ae.useState)(p),[x,E]=(0,Ae.useState)(!1),U=v?(0,fe.optionImageSources)(e.image_url):[],H=U[0]??null,[N,ce]=(0,Ae.useState)([]),T=U.find(O=>!N.includes(O))??null,[G,K]=(0,Ae.useState)(null),C=(0,Ae.useMemo)(()=>!H&&g&&e.icon_svg?(0,fe.sanitizeOptionIconSvg)(e.icon_svg):null,[H,g,e.icon_svg]),ae=k?(0,fe.formatOptionCount)(e.item_count):null,pe=(0,Ae.useRef)(void 0);(0,Ae.useEffect)(()=>()=>clearTimeout(pe.current),[]);let ie=O=>{if(d||!e.is_tappable||x&&t===void 0)return;E(!0);let F=O?.currentTarget;t!==void 0&&F!==void 0&&O!==void 0&&!(0,fe.isMultiSelectToggleTap)(F,F.querySelector("[data-aia-checkbox]"),O)?i(e,{commit:!0}):i(e),clearTimeout(pe.current),pe.current=setTimeout(()=>E(!1),170)},oe=[de.item,a&&!d?de.highlighted:"",e.liveMatch&&!d?de.liveMatch:"",e.is_tappable?de.tappable:de.nonTappable,x?de.pressed:"",f?de.scrollHint:""].filter(Boolean).join(" ");return(0,he.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":d?"":void 0,"data-aia-icon":C&&e.icon?e.icon:void 0,"data-aia-image":H?"":void 0,"data-aia-item-count":ae!==null?e.item_count:void 0,"aria-selected":t??a,className:oe,style:{[fe.OPTION_ENTER_DELAY_VAR]:`${u}ms`},tabIndex:d||!e.is_tappable?-1:0,onClick:ie,onKeyDown:O=>{!d&&e.is_tappable&&(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),ie())},onMouseEnter:!d&&e.is_tappable?o:void 0,onMouseLeave:s,children:(0,he.jsxs)("span",{className:de.content,children:[t!==void 0&&e.is_tappable&&(0,he.jsx)("span",{className:de.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),H&&(0,he.jsx)("span",{className:`${de.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":T!==null&&G===T?"":void 0,children:(0,he.jsx)("img",{src:T??H,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:T===null,onLoad:()=>K(T),onError:()=>{T!==null&&ce(O=>[...O,T])}})}),C&&(0,he.jsx)("span",{className:`${de.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:C}}),(0,he.jsxs)("span",{className:de.text,children:[e.matchedText?(0,fe.highlightParts)((0,fe.optionLabel)(e),e.matchedText).map((O,F)=>O.bold?(0,he.jsx)("strong",{className:`${de.match} magicx-aia-option-match`,children:O.text},F):O.text):(0,fe.optionLabel)(e),e.parameterLabel&&(0,he.jsxs)(he.Fragment,{children:[" ",(0,he.jsx)("span",{className:`${de.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,he.jsx)("span",{className:de.tag,children:e.tag}),ae!==null&&(0,he.jsx)("span",{className:`${de.count} magicx-aia-option-count`,children:ae})]})})}var Mt=require("react/jsx-runtime");function Ka(){let[e,a]=(0,Re.useState)(Y.isOptionsGridMobileViewport);return(0,Re.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(Y.OPTIONS_GRID_MOBILE_QUERY),i=()=>a(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function ra({options:e,activeIndex:a,picked:t,onSelect:i,onHighlight:o,onUnhighlight:s,listboxId:r,loading:d,groupKey:g="",optionsPosition:v="below",showIcons:k=!0,showImages:f=!0,showCounts:p=!0}){let u=Ka(),x=(0,Re.useRef)(null),[E,U]=(0,Re.useState)(null),H=(0,Re.useRef)(null);(0,Re.useLayoutEffect)(()=>{if(d&&(0,Y.sameOptionRows)(H.current,e))return;H.current=d?null:e;let T=x.current,G=T&&!d&&(0,Y.needsOptionsGridMeasurement)(e.length,u),K=T?.closest("[data-aia-dropdown]");G&&K&&(0,Y.releasePanelHug)(K);let C=G?(0,Y.measureOptionsGrid)(T):null;U(C?(0,Y.planOptionsGrid)(e.length,u,C.rowWidths,C.gridWidth):null)},[e,u,d]);let N=E??(0,Y.planOptionsGrid)(e.length,u,null,null);(0,Re.useLayoutEffect)(()=>{let T=x.current?.closest("[data-aia-dropdown]");T&&(0,Y.syncPanelHug)(T)},[N.template,u]);let ce=(0,Y.optionsShowLeadingVisuals)(e,k,f);return(0,Mt.jsx)(ia,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:g,template:N.template,maxHeight:N.maxHeight,innerRef:T=>{x.current=T},"data-aia-group":g,children:e.map((T,G)=>(0,Mt.jsx)(na,{option:T,isHighlighted:G===a,checked:t?t.includes(T.text):void 0,onSelect:i,onHighlight:()=>o(G),onUnhighlight:s?()=>s(G):void 0,id:`${r}-option-${G}`,loading:d,showIcon:k&&ce,showImage:f&&ce,showCount:p,scrollHint:!d&&N.scrollHintIndices.includes(G),enterDelayMs:d?0:(0,Y.optionEnterDelayMs)(G,N.cols,e.length,v)},`${g}\0${T.text}`))})}var ue=require("@magicx-eng/ai-autocomplete-vanilla"),Le=require("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) ---
3359
3366
 
3360
3367
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
3361
3368
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -3477,7 +3484,7 @@
3477
3484
  .aia-done-llNY5:hover {
3478
3485
  background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
3479
3486
  }
3480
- `,document.head.appendChild(e)}var Ae={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"};var ke=require("react/jsx-runtime"),qa=120;function sa({view:e,label:a,doneLabel:t,interactive:i=!0,onTimeChange:o,onTimeCommit:s}){return(0,ke.jsxs)("div",{className:Ae.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":a,onMouseDown:r=>r.preventDefault(),children:[(0,ke.jsx)("span",{className:Ae.value,"data-aia-time-value":"","aria-live":"polite",children:(0,ue.formatTime)(e.minutes)}),(0,ke.jsxs)("div",{className:Ae.columns,"aria-hidden":"true",children:[(0,ke.jsx)("div",{className:Ae.band}),ue.TIME_WHEEL_COLUMNS.map(r=>(0,ke.jsxs)(Re.Fragment,{children:[r==="minute"&&(0,ke.jsx)("span",{className:Ae.separator,children:":"}),(0,ke.jsx)(_a,{column:r,minutes:e.minutes,interactive:i,onTimeChange:o})]},r))]}),(0,ke.jsx)("button",{type:"button",tabIndex:-1,className:Ae.done,"data-aia-time-done":"",onClick:()=>{i&&s()},children:t})]})}function _a({column:e,minutes:a,interactive:t,onTimeChange:i}){let o=(0,Re.useRef)(null),s=(0,Re.useRef)(null),r=(0,Re.useRef)(null),d=(0,Re.useRef)({minutes:a,interactive:t,onTimeChange:i});d.current={minutes:a,interactive:t,onTimeChange:i};let m=(0,ue.timeWheelIndex)(e,a);(0,Re.useLayoutEffect)(()=>{let g=o.current;if(!g||r.current)return;let p=m*ue.TIME_WHEEL_ROW_HEIGHT;Math.abs(g.scrollTop-p)<1||(s.current=p,g.scrollTop=p)},[m]),(0,Re.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let g=o.current,p=d.current;if(!g||!p.interactive)return;let u=(0,ue.timeWheelIndexFromScroll)(e,g.scrollTop);u!==(0,ue.timeWheelIndex)(e,p.minutes)&&p.onTimeChange((0,ue.withTimeWheelIndex)(e,p.minutes,u))},C=()=>{let g=o.current;if(g){if(s.current!=null&&Math.abs(g.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,qa)}};return(0,ke.jsx)("div",{ref:o,className:Ae.column,"data-aia-time-column":e,onScroll:C,children:(0,ue.timeWheelRows)(e).map((g,p)=>(0,ke.jsx)("div",{className:p===m?`${Ae.row} ${Ae.selected}`:Ae.row,"data-aia-time-row":"","data-aia-index":p,onClick:()=>{d.current.interactive&&i((0,ue.withTimeWheelIndex)(e,d.current.minutes,p))},children:g.label},g.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3487
+ `,document.head.appendChild(e)}var Oe={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"};var Te=require("react/jsx-runtime"),qa=120;function sa({view:e,label:a,doneLabel:t,interactive:i=!0,onTimeChange:o,onTimeCommit:s}){return(0,Te.jsxs)("div",{className:Oe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":a,onMouseDown:r=>r.preventDefault(),children:[(0,Te.jsx)("span",{className:Oe.value,"data-aia-time-value":"","aria-live":"polite",children:(0,ue.formatTime)(e.minutes)}),(0,Te.jsxs)("div",{className:Oe.columns,"aria-hidden":"true",children:[(0,Te.jsx)("div",{className:Oe.band}),ue.TIME_WHEEL_COLUMNS.map(r=>(0,Te.jsxs)(Le.Fragment,{children:[r==="minute"&&(0,Te.jsx)("span",{className:Oe.separator,children:":"}),(0,Te.jsx)(_a,{column:r,minutes:e.minutes,interactive:i,onTimeChange:o})]},r))]}),(0,Te.jsx)("button",{type:"button",tabIndex:-1,className:Oe.done,"data-aia-time-done":"",onClick:()=>{i&&s()},children:t})]})}function _a({column:e,minutes:a,interactive:t,onTimeChange:i}){let o=(0,Le.useRef)(null),s=(0,Le.useRef)(null),r=(0,Le.useRef)(null),d=(0,Le.useRef)({minutes:a,interactive:t,onTimeChange:i});d.current={minutes:a,interactive:t,onTimeChange:i};let g=(0,ue.timeWheelIndex)(e,a);(0,Le.useLayoutEffect)(()=>{let f=o.current;if(!f||r.current)return;let p=g*ue.TIME_WHEEL_ROW_HEIGHT;Math.abs(f.scrollTop-p)<1||(s.current=p,f.scrollTop=p)},[g]),(0,Le.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let f=o.current,p=d.current;if(!f||!p.interactive)return;let u=(0,ue.timeWheelIndexFromScroll)(e,f.scrollTop);u!==(0,ue.timeWheelIndex)(e,p.minutes)&&p.onTimeChange((0,ue.withTimeWheelIndex)(e,p.minutes,u))},k=()=>{let f=o.current;if(f){if(s.current!=null&&Math.abs(f.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,qa)}};return(0,Te.jsx)("div",{ref:o,className:Oe.column,"data-aia-time-column":e,onScroll:k,children:(0,ue.timeWheelRows)(e).map((f,p)=>(0,Te.jsx)("div",{className:p===g?`${Oe.row} ${Oe.selected}`:Oe.row,"data-aia-time-row":"","data-aia-index":p,onClick:()=>{d.current.interactive&&i((0,ue.withTimeWheelIndex)(e,d.current.minutes,p))},children:f.label},f.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3481
3488
  display: flex;
3482
3489
  flex-direction: column;
3483
3490
  gap: var(--aia-stack-space, 0.5rem);
@@ -3492,7 +3499,7 @@
3492
3499
  align-items: end;
3493
3500
  }
3494
3501
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
3495
- `,document.head.appendChild(e)}var da=require("react/jsx-runtime");function la({space:e,align:a="stretch",className:t,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return(0,da.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:s,...o,children:i})}var Y=require("react/jsx-runtime"),Va=typeof window>"u"?Q.useEffect:Q.useLayoutEffect,Ua=[159,119,164],Ya=()=>{},ca=()=>{},Qa=e=>{},ja=()=>{},$a=e=>{},Za=e=>{},Xa=e=>{},Ja=e=>{};function ei(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=(0,Q.useState)(a);if((0,Q.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>i(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ti(e,a){let t=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let i=e.current,o=a.current;if(!i||!o)return;let s=(0,z.queryLive)(i,".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:(0,z.attachScrollArrow)({dropdown:i,grid:s,button:o})};return}t.current?.controller.update()}),(0,Q.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function ai(e,a){let t=(0,Q.useRef)(a);t.current=a;let i=(0,Q.useRef)(null);(0,Q.useLayoutEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,z.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),(0,Q.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function Tt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:d,pills:m,onPillClick:v,showPills:C=!0,onSkip:g,showSkipButton:p=!0,showOptionIcons:u=!0,showOptionImages:x=!0,showOptionCounts:A=!0,skipDisabled:V=!1,activeSelected:H=!1,isLoading:N=!1,skeletonExiting:de=!1,isInputEmpty:P=!1,language:G,products:K,onProductSelect:S,onProductAddToCart:ae,onProductFocusChange:ce,productsLayout:ie="row",productImageFallback:oe="image",formatType:L="options",dateView:F=null,selectedDateIso:Le=null,selectedDateRange:Ce=null,dateRangeStart:ve=null,onPreviousMonth:c,onNextMonth:E,timeView:Ge=null,multiSelectView:w=null,onMultiSelectCommit:at,onTimeChange:Ue,onTimeCommit:Ye,locationView:Ke=null,isReediting:f=!1,onLocationQuery:T,onLocationMove:I,onLocationCommit:O,onLocationFocusChange:M,isFocused:re=!1,optionsPosition:ge="below",mode:xe}){let ze=ei(xe),st=ze!==void 0,Z=(0,Q.useRef)(null),Qe=(0,Q.useRef)(null);ti(Z,Qe),(0,Q.useEffect)(()=>{if(Z.current)return(0,z.containScroll)(Z.current)},[]);let pt=e[0]?.options??[],it=!!(m&&m.length>0&&v),De=!!(K&&K.length>0),ht=L==="time"&&Ge!=null,je=L==="location"&&Ke!=null,pe=s&&(pt.length>0||C&&it||N||De||ht||je);ai(Z,pe),Va(()=>{let k=Z.current;k&&((0,z.fitMultiSelectDone)(k,(0,z.findMultiSelectDone)(k)),(0,z.syncPanelHug)(k))});let Se={suggestions:e,activeIndex:a,pills:m,showPills:C,showSkipButton:p,showOptionIcons:u,showOptionImages:x,showOptionCounts:A,skipDisabled:V,activeSelected:H,isLoading:N,skeletonExiting:de,isInputEmpty:P,products:K,formatType:L,dateView:F,selectedDateIso:Le,selectedDateRange:Ce,dateRangeStart:ve,timeView:Ge,multiSelectView:w,locationView:Ke,isReediting:f},y=(0,Q.useRef)(Se);pe&&(y.current=Se);let n=pe?Se:y.current,se=(0,z.uiStringsFor)(G),Me=n.suggestions[0],b=Me?.options??[],$e=n.activeIndex>=0&&!!b[n.activeIndex]?.is_tappable,qe=(0,z.labelTraditionalAutocomplete)(n.pills??[],se.keepTyping),Te=!!(qe.length>0&&v),ot=n.showPills&&Te,ut=n.showPills&&!Te&&n.isLoading,_e=ot||ut,lt=Te&&(0,z.hasSkippablePill)(qe)&&n.showSkipButton&&!n.isInputEmpty&&!!g,Pe=qe[0]?.text,Ne=(0,z.isCalendarFormat)(n.formatType)&&n.dateView!=null,Ze=b.length>0&&!Ne,nt=b.length>0&&Ne&&!n.isLoading,dt=n.formatType==="time"&&n.timeView!=null&&!n.isLoading,Xe=n.formatType==="location"&&n.locationView!=null&&!n.isLoading,ct=n.isLoading&&!Ze&&!nt&&!dt&&!Xe,h=n.products??[],_=(0,z.panelMorphKey)(ot?qe:[]);return(0,Q.useLayoutEffect)(()=>{Z.current&&(0,z.settlePanelMorph)(Z.current,_,{visible:pe,anchorBottom:ge==="above"})},[_,pe,ge,n.suggestions,n.pills,n.isLoading,n.skeletonExiting,n.isInputEmpty,n.products,n.formatType,n.dateView,n.selectedDateIso,n.selectedDateRange,n.dateRangeStart,n.timeView,n.multiSelectView,n.locationView,n.showPills,n.showSkipButton,n.showOptionIcons,n.showOptionImages,n.showOptionCounts,ie,G]),(0,Q.useEffect)(()=>{let k=Z.current;return()=>{k&&(0,z.destroyPanelMorph)(k)}},[]),(0,Y.jsxs)("div",{ref:Z,id:r,role:"listbox","aria-multiselectable":!!n.multiSelectView,"data-aia-dropdown":"","data-options-position":ge,"data-mode":ze,"data-aia-loading":n.isLoading?"":void 0,"data-aia-skeleton-exiting":n.skeletonExiting?"":void 0,"data-aia-has-products":h.length>0?"":void 0,className:`${st?"magicx-aia ":""}${He.dropdown} ${pe?He.visible:""} ${d??""}`,onMouseDown:k=>k.preventDefault(),children:[(0,Y.jsxs)(la,{space:"8px",children:[(_e||lt)&&(0,Y.jsxs)(ft,{noWrap:!0,className:He.pillBar,"data-aia-pillbar":"",children:[_e&&(0,Y.jsx)("span",{className:He.pillScroll,"data-aia-pill-scroll":"",children:(0,Y.jsx)(Ct,{pills:qe,activePillIndex:0,activeSelected:n.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:n.isLoading})}),lt&&(0,Y.jsx)("button",{type:"button",tabIndex:-1,className:He.skip,"data-aia-skip":"",disabled:n.isLoading||n.skipDisabled,"aria-label":Pe?`${se.skipLabel} ${Pe}`:se.skipLabel,onClick:g,children:se.skip})]}),Ze&&(0,Y.jsx)(ra,{options:b,activeIndex:n.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:n.isLoading,groupKey:Me?`${Me.parameter} ${Me.text}`:"",optionsPosition:ge,showIcons:n.showOptionIcons,showImages:n.showOptionImages,showCounts:n.showOptionCounts,picked:n.isLoading?void 0:n.multiSelectView?.picked}),n.multiSelectView&&!n.isLoading&&(0,Y.jsx)("div",{"data-aia-multi-actions":"",onClick:k=>{k.target.closest("[data-aia-multi-done]")&&!n.skipDisabled&&at?.()},children:(0,Y.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:He.multiDone,ref:k=>{k&&(k.disabled=!0,k.offsetHeight,k.disabled=n.skipDisabled)},children:se.done})}),nt&&n.dateView&&(0,Y.jsx)(Ut,{options:b,activeIndex:n.activeIndex,listboxId:r,view:n.dateView,selection:{selectedIso:n.selectedDateIso??null,selectedRange:n.selectedDateRange??null,rangeStart:n.dateRangeStart??null,floor:(0,z.dateFloorFor)(n.formatType,n.dateRangeStart)},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:c??ca,onNextMonth:E??ca}),dt&&n.timeView&&(0,Y.jsx)(sa,{view:n.timeView,label:se.timeLabel,doneLabel:se.done,interactive:!n.skipDisabled,onTimeChange:Ue??Qa,onTimeCommit:Ye??ja}),Xe&&n.locationView&&(0,Y.jsx)(Zt,{view:n.locationView,searchLabel:se.locationSearch,noResultsLabel:se.locationNoResults,useTypedLabel:se.locationUseTyped,widgetFocused:re&&pe,reediting:n.isReediting,visible:pe,interactive:!n.skipDisabled,onQuery:T??$a,onMove:I??Za,onCommit:O??Xa,onFocusChange:M??Ja}),ct&&(0,Y.jsx)("div",{className:He.skeletonBars,"data-aia-skeleton-bars":"",children:Ua.map(k=>(0,Y.jsx)("span",{className:He.skeletonBar,style:{width:k}},`bar-${k}`))}),(0,Y.jsx)(ta,{products:h,listboxId:r,onSelect:S??Ya,onAddToCart:ae,onFocusChange:ce,focusable:pe,layout:ie,imageFallback:oe,strings:se}),(0,Y.jsx)(Yt,{isOptionHighlighted:$e,isInputEmpty:n.isInputEmpty,strings:se})]}),(0,Y.jsx)("button",{ref:Qe,type:"button",tabIndex:-1,className:He.scrollArrow,"data-aia-scroll-arrow":"","aria-label":se.scrollArrow,"aria-hidden":"true",children:(0,Y.jsx)("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:(0,Y.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var We=require("@magicx-eng/ai-autocomplete-vanilla");var ha=require("@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 {
3502
+ `,document.head.appendChild(e)}var da=require("react/jsx-runtime");function la({space:e,align:a="stretch",className:t,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return(0,da.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:s,...o,children:i})}var j=require("react/jsx-runtime"),Va=typeof window>"u"?$.useEffect:$.useLayoutEffect,Ua=[159,119,164],Qa=()=>{},ca=()=>{},Ya=e=>{},ja=()=>{},$a=e=>{},Za=e=>{},Xa=e=>{},Ja=e=>{};function ei(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=(0,$.useState)(a);if((0,$.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>i(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ti(e,a){let t=(0,$.useRef)(null);(0,$.useEffect)(()=>{let i=e.current,o=a.current;if(!i||!o)return;let s=(0,L.queryLive)(i,".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:(0,L.attachScrollArrow)({dropdown:i,grid:s,button:o})};return}t.current?.controller.update()}),(0,$.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function ai(e,a){let t=(0,$.useRef)(a);t.current=a;let i=(0,$.useRef)(null);(0,$.useLayoutEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,L.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),(0,$.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function Tt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:d,pills:g,onPillClick:v,showPills:k=!0,onSkip:f,showSkipButton:p=!0,showOptionIcons:u=!0,showOptionImages:x=!0,showOptionCounts:E=!0,skipDisabled:U=!1,activeSelected:H=!1,isLoading:N=!1,skeletonExiting:ce=!1,isInputEmpty:T=!1,language:G,products:K,onProductSelect:C,onProductAddToCart:ae,onProductFocusChange:pe,productsLayout:ie="row",productImageFallback:oe="image",formatType:O="options",dateView:F=null,selectedDateIso:De=null,selectedDateRange:Pe=null,dateRangeStart:xe=null,dateReferences:c,onPreviousMonth:I,onNextMonth:_e,timeView:b=null,multiSelectView:at=null,onMultiSelectCommit:Ve,onTimeChange:Ue,onTimeCommit:Qe,locationView:m=null,isReediting:S=!1,onLocationQuery:P,onLocationMove:R,onLocationCommit:M,onLocationFocusChange:se,isFocused:Ie=!1,optionsPosition:me="below",mode:Ge}){let it=ei(Ge),ke=it!==void 0,ge=(0,$.useRef)(null),lt=(0,$.useRef)(null);ti(ge,lt),(0,$.useEffect)(()=>{if(ge.current)return(0,L.containScroll)(ge.current)},[]);let ot=e[0]?.options??[],Me=!!(g&&g.length>0&&v),ut=!!(K&&K.length>0),Ye=O==="time"&&b!=null,je=O==="location"&&m!=null,le=s&&(ot.length>0||k&&Me||N||ut||Ye||je);ai(ge,le),Va(()=>{let q=ge.current;q&&((0,L.fitMultiSelectDone)(q,(0,L.findMultiSelectDone)(q)),(0,L.syncPanelHug)(q))});let y={suggestions:e,activeIndex:a,pills:g,showPills:k,showSkipButton:p,showOptionIcons:u,showOptionImages:x,showOptionCounts:E,skipDisabled:U,activeSelected:H,isLoading:N,skeletonExiting:ce,isInputEmpty:T,products:K,formatType:O,dateView:F,selectedDateIso:De,selectedDateRange:Pe,dateRangeStart:xe,dateReferences:c,timeView:b,multiSelectView:at,locationView:m,isReediting:S},dt=(0,$.useRef)(y);le&&(dt.current=y);let n=le?y:dt.current,ne=(0,L.uiStringsFor)(G),w=n.suggestions[0],Ce=w?.options??[],mt=n.activeIndex>=0&&!!Ce[n.activeIndex]?.is_tappable,ye=(0,L.labelTraditionalAutocomplete)(n.pills??[],ne.keepTyping),$e=!!(ye.length>0&&v),ct=n.showPills&&$e,Ze=n.showPills&&!$e&&n.isLoading,pt=ct||Ze,Ee=$e&&(0,L.hasSkippablePill)(ye)&&n.showSkipButton&&!n.isInputEmpty&&!!f,Ne=ye[0]?.text,Xe=(0,L.isCalendarFormat)(n.formatType)&&n.dateView!=null,nt=Ce.length>0&&!Xe,ht=Ce.length>0&&Xe&&!n.isLoading,Ke=n.formatType==="time"&&n.timeView!=null&&!n.isLoading,rt=n.formatType==="location"&&n.locationView!=null&&!n.isLoading,h=n.isLoading&&!nt&&!ht&&!Ke&&!rt,V=n.products??[],z=(0,L.panelMorphKey)(ct?ye:[]);return(0,$.useLayoutEffect)(()=>{ge.current&&(0,L.settlePanelMorph)(ge.current,z,{visible:le,anchorBottom:me==="above"})},[z,le,me,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,ie,G]),(0,$.useEffect)(()=>{let q=ge.current;return()=>{q&&(0,L.destroyPanelMorph)(q)}},[]),(0,j.jsxs)("div",{ref:ge,id:r,role:"listbox","aria-multiselectable":!!n.multiSelectView,"data-aia-dropdown":"","data-options-position":me,"data-mode":it,"data-aia-loading":n.isLoading?"":void 0,"data-aia-skeleton-exiting":n.skeletonExiting?"":void 0,"data-aia-has-products":V.length>0?"":void 0,className:`${ke?"magicx-aia ":""}${He.dropdown} ${le?He.visible:""} ${d??""}`,onMouseDown:q=>q.preventDefault(),children:[(0,j.jsxs)(la,{space:"8px",children:[(pt||Ee)&&(0,j.jsxs)(bt,{noWrap:!0,className:He.pillBar,"data-aia-pillbar":"",children:[pt&&(0,j.jsx)("span",{className:He.pillScroll,"data-aia-pill-scroll":"",children:(0,j.jsx)(Ct,{pills:ye,activePillIndex:0,activeSelected:n.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:n.isLoading})}),Ee&&(0,j.jsx)("button",{type:"button",tabIndex:-1,className:He.skip,"data-aia-skip":"",disabled:n.isLoading||n.skipDisabled,"aria-label":Ne?`${ne.skipLabel} ${Ne}`:ne.skipLabel,onClick:f,children:ne.skip})]}),nt&&(0,j.jsx)(ra,{options:Ce,activeIndex:n.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:n.isLoading,groupKey:w?`${w.parameter} ${w.text}`:"",optionsPosition:me,showIcons:n.showOptionIcons,showImages:n.showOptionImages,showCounts:n.showOptionCounts,picked:n.isLoading?void 0:n.multiSelectView?.picked}),n.multiSelectView&&!n.isLoading&&(0,j.jsx)("div",{"data-aia-multi-actions":"",onClick:q=>{q.target.closest("[data-aia-multi-done]")&&!n.skipDisabled&&Ve?.()},children:(0,j.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:He.multiDone,ref:q=>{q&&(q.disabled=!0,q.offsetHeight,q.disabled=n.skipDisabled)},children:ne.done})}),ht&&n.dateView&&(0,j.jsx)(Ut,{options:Ce,activeIndex:n.activeIndex,listboxId:r,view:n.dateView,selection:{selectedIso:n.selectedDateIso??null,selectedRange:n.selectedDateRange??null,rangeStart:n.dateRangeStart??null,floor:(0,L.dateFloorFor)(n.formatType,n.dateRangeStart),references:n.dateReferences??[]},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:I??ca,onNextMonth:_e??ca}),Ke&&n.timeView&&(0,j.jsx)(sa,{view:n.timeView,label:ne.timeLabel,doneLabel:ne.done,interactive:!n.skipDisabled,onTimeChange:Ue??Ya,onTimeCommit:Qe??ja}),rt&&n.locationView&&(0,j.jsx)(Zt,{view:n.locationView,searchLabel:ne.locationSearch,noResultsLabel:ne.locationNoResults,useTypedLabel:ne.locationUseTyped,widgetFocused:Ie&&le,reediting:n.isReediting,visible:le,interactive:!n.skipDisabled,onQuery:P??$a,onMove:R??Za,onCommit:M??Xa,onFocusChange:se??Ja}),h&&(0,j.jsx)("div",{className:He.skeletonBars,"data-aia-skeleton-bars":"",children:Ua.map(q=>(0,j.jsx)("span",{className:He.skeletonBar,style:{width:q}},`bar-${q}`))}),(0,j.jsx)(ta,{products:V,listboxId:r,onSelect:C??Qa,onAddToCart:ae,onFocusChange:pe,focusable:le,layout:ie,imageFallback:oe,strings:ne}),(0,j.jsx)(Qt,{isOptionHighlighted:mt,isInputEmpty:n.isInputEmpty,strings:ne})]}),(0,j.jsx)("button",{ref:lt,type:"button",tabIndex:-1,className:He.scrollArrow,"data-aia-scroll-arrow":"","aria-label":ne.scrollArrow,"aria-hidden":"true",children:(0,j.jsx)("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:(0,j.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var We=require("@magicx-eng/ai-autocomplete-vanilla");var ha=require("@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 {
3496
3503
  flex-shrink: 0;
3497
3504
  width: 32px;
3498
3505
  height: 32px;
@@ -3563,5 +3570,5 @@
3563
3570
  transition: none;
3564
3571
  }
3565
3572
  }
3566
- `,document.head.appendChild(e)}var pa={submitButton:"aia-submitButton-otz7H"};var Pt=require("react/jsx-runtime");function ua({disabled:e,ready:a,onClick:t,label:i=(0,ha.uiStringsFor)().submit}){return(0,Pt.jsx)("button",{type:"button","data-aia-submit":"",className:pa.submitButton,disabled:e,"data-aia-ready":a?"":void 0,onClick:o=>{o.stopPropagation(),t()},"aria-label":i,children:(0,Pt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Pt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var tt=require("@magicx-eng/ai-autocomplete-vanilla"),R=require("react");var Nt=require("react");function ma(e){let a=(0,Nt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,Nt.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(d,m,v)=>{let C=a.current?.[s];return C?C(d,m,v):[]};o[s]=r}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}var Ht=require("react");function ga(e){let a=(0,Ht.useRef)(e);a.current=e;let t=(0,Ht.useRef)(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=a.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var fa={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,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateFloor:null,timeView:null,multiSelectView: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 It({onSubmit:e,onResult:a,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,visitorId:C,columns:g=2,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:V,locationSearch:H,showOptionIcons:N,showOptionImages:de,showOptionCounts:P,showSkipButton:G,showProducts:K,productImageFallback:S="image",onFocus:ae,onBlur:ce,value:ie,completedParams:oe,onChange:L,onParamsChange:F,products:Le,mapProducts:Ce,onProductSelect:ve,onProductAddToCart:c,source:E,setCursor:Ge}){let w=(0,R.useRef)(null),[at,Ue]=(0,R.useState)(null),Ye=(0,R.useRef)(e);Ye.current=e;let Ke=(0,R.useRef)(a);Ke.current=a;let f=(0,R.useRef)(t);f.current=t;let T=(0,R.useRef)(L);T.current=L;let I=(0,R.useRef)(F);I.current=F;let O=(0,R.useRef)(ae);O.current=ae;let M=(0,R.useRef)(ce);M.current=ce;let re=(0,R.useRef)(Ge);re.current=Ge;let ge=(0,R.useRef)(ve);ge.current=ve;let xe=(0,R.useRef)(c);xe.current=c;let ze=(0,R.useRef)(C);ze.current=C;let st=(0,R.useRef)(()=>{let h=ze.current;return typeof h=="function"?h():h}).current,Z=ga(Le),Qe=(0,R.useRef)(Ce);Qe.current=Ce;let pt=(0,R.useRef)((h,_)=>{let k=Qe.current;return k?k(h,_):h}).current,it=Ce?pt:void 0,De=ma(i);(0,R.useEffect)(()=>{if(typeof document>"u")return;let h=new tt.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,visitorId:st,optionOverrides:De.overrides,maskCompletedText:o,columns:g,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:V,locationSearch:H,showProducts:K,source:E,value:ie,completedParams:oe,onSubmit:(...k)=>Ye.current?.(...k),onResult:(...k)=>Ke.current?.(...k),onError:(...k)=>f.current?.(...k),onChange:(...k)=>T.current?.(...k),onParamsChange:(...k)=>I.current?.(...k),onFocus:()=>O.current?.(),onBlur:()=>M.current?.(),onProductSelect:k=>ge.current?.(k),onProductAddToCart:k=>xe.current?.(k),setCursor:k=>re.current?.(k),products:Z.config,mapProducts:it});w.current=h,Ue(h.getState());let _=h.subscribe(k=>Ue(k));return()=>{_(),h.destroy(),w.current===h&&(w.current=null)}},[]),(0,R.useEffect)(()=>{ie!==void 0&&w.current?.setValue(ie)},[ie]),(0,R.useEffect)(()=>{oe!==void 0&&w.current?.setCompletedParams(oe)},[oe]);let ht=JSON.stringify(s??null),je;try{je=JSON.stringify(r??null)}catch{je="[unstringifiable]"}(0,R.useEffect)(()=>{w.current?.update({apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,optionOverrides:De.overrides,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:V,locationSearch:H,showProducts:K})},[ht,je,d,m?.code,m?.rate,m?.country,v,De.key,p,u,x,A,V,H,K]);let pe=(0,R.useRef)(!1);(0,R.useEffect)(()=>{if(!pe.current){pe.current=!0;return}w.current?.update({products:Z.config})},[Z.enabled]),(0,R.useEffect)(()=>{w.current?.update({mapProducts:it})},[it]);let Se=(0,R.useRef)(null);Se.current===null&&(Se.current={handleTextChange:h=>w.current?.handleTextChange(h),handleKeyDown:h=>{let _="nativeEvent"in h?h.nativeEvent:h;w.current?.handleKeyDown(_)},setFocused:h=>w.current?.setFocused(h),startEditingParam:h=>w.current?.startEditingParam(h),exitEditMode:()=>w.current?.exitEditMode(),handleCaretAfterInput:h=>w.current?.handleCaretAfterInput(h),handleCaretMove:h=>w.current?.handleCaretMove(h),replaceEditingRange:h=>w.current?.replaceEditingRange(h)??!1,setActivePill:h=>w.current?.setActivePill(h),skipActivePill:()=>w.current?.skipActivePill(),removeLastParam:()=>w.current?.removeLastParam(),clearNewParamId:()=>w.current?.clearNewParamId(),reset:()=>w.current?.reset(),refreshProducts:()=>w.current?.refreshProducts(),prepareSubmit:()=>w.current?.prepareSubmit(),getState:()=>w.current?.getState()??fa,recordSubmit:h=>w.current?.recordSubmit(h),selectOption:(h,_)=>w.current?.selectOption(h,_),selectProduct:h=>w.current?.selectProduct(h),addProductToCart:h=>{let _=w.current;return!_||!xe.current?Promise.resolve():_.addProductToCart(h)},setActiveDropdownIndex:h=>w.current?.setActiveDropdownIndex(h),clearHighlight:h=>w.current?.clearHighlight(h),showPreviousMonth:()=>w.current?.showPreviousMonth(),showNextMonth:()=>w.current?.showNextMonth(),setTime:h=>w.current?.setTime(h),commitTime:()=>w.current?.commitTime(),toggleMultiSelectOption:h=>w.current?.toggleMultiSelectOption(h),commitMultiSelect:()=>w.current?.commitMultiSelect(),setLocationQuery:h=>w.current?.setLocationQuery(h),moveLocationHighlight:h=>w.current?.moveLocationHighlight(h),commitLocation:h=>w.current?.commitLocation(h),setLocationFieldFocused:h=>w.current?.setLocationFieldFocused(h),handleFocus:()=>w.current?.setFocused(!0),handleBlur:()=>w.current?.setFocused(!1)});let y=Se.current,n=(0,R.useCallback)(h=>{let _=h.target.value,vt=_.length>0&&!h.nativeEvent?.isComposing&&_[0]!==_[0].toUpperCase()?_[0].toUpperCase()+_.slice(1):_;w.current?.handleTextChange(vt)},[]),se=(0,R.useCallback)(h=>{w.current?.handleKeyDown(h.nativeEvent)},[]),Me=w.current,b=at??fa,$e=ie!==void 0?ie:b.text,qe=oe!==void 0?oe:b.completedParams,Te=b.actionableSuggestions,ot=Te[0],ut=(0,R.useMemo)(()=>(0,tt.withoutTraditionalAutocomplete)(Te),[Te]),_e=Me?.listboxId??"",lt=b.activeDropdownIndex>=0&&Me?`${_e}-option-${b.activeDropdownIndex}`:void 0,Pe=b.editingParam,Ne=b.editingIdentified,Ze=Pe?{parameter:Pe.suggestionParameter,text:Pe.suggestionPlaceholder,required:!0,options:Pe.options}:Ne?{parameter:Ne.parameter,text:(0,tt.identifiedParamLabel)(Ne.parameter),required:!0,options:[]}:null,nt=b.dropdownSuggestion??Ze??ot,dt=Ze?[Ze]:Te,Xe=(0,tt.dateSelectionFor)(b),ct=!Me||b.dropdownLoading;return{completedParams:qe,multiSelectView:b.multiSelectView,toggleMultiSelectOption:y.toggleMultiSelectOption,commitMultiSelect:y.commitMultiSelect,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:ut,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:y.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:ct,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:_e,error:b.error,products:b.products,customFields:b.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:Pe,editingIdentified:Ne,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:$e,placeholder:b.placeholderText||void 0,onChange:n,onKeyDown:se,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":lt,"aria-autocomplete":"list","aria-controls":_e},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:nt?[{...nt,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:b.isDropdownOpen,id:_e,pills:dt,activeSelected:b.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(G??!0)&&!Pe&&!Ne,showOptionIcons:N??!0,showOptionImages:de??!0,showOptionCounts:P??!0,skipDisabled:b.inSelectionAnimation,isLoading:ct,skeletonExiting:b.skeletonExiting,isInputEmpty:$e.trim().length===0,language:d,products:b.products,productImageFallback:S,onProductSelect:y.selectProduct,onProductAddToCart:c?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:Xe.selectedIso,selectedDateRange:Xe.selectedRange,dateRangeStart:Xe.rangeStart,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,timeView:b.timeView,multiSelectView:b.multiSelectView,onMultiSelectCommit:y.commitMultiSelect,onTimeChange:y.setTime,onTimeCommit:y.commitTime,locationView:b.locationView,isReediting:b.editingParam!=null,onLocationQuery:y.setLocationQuery,onLocationMove:y.moveLocationHighlight,onLocationCommit:y.commitLocation,onLocationFocusChange:y.setLocationFieldFocused,isFocused:b.isFocused||b.locationFieldFocused,optionsPosition:u??"below"}}}var j=require("@magicx-eng/ai-autocomplete-vanilla"),D=require("react"),Et;function ii(){if(Et!==void 0)return Et;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Et=e.contentEditable==="plaintext-only",Et}function ba(e){let{segments:a,showChipIcons:t=!0,showChipImages:i=!0,newParamId:o,editingParam:s,editingIdentified:r,editingAnchor:d,caretOffset:m,placeholderText:v,hintSuggestions:C,isFocused:g,isDropdownOpen:p,listboxId:u,activeDescendantId:x,autoFocus:A,handleTextChange:V,handleKeyDown:H,handleCaretAfterInput:N,handleCaretMove:de,startEditingParam:P,replaceEditingRange:G,setFocused:K}=e,S=(0,D.useRef)(null),ae=(0,D.useRef)(!1),ce=(0,D.useRef)(""),ie=(0,D.useRef)(""),oe=(0,D.useRef)(null),L=(0,D.useRef)(0);oe.current=m,(0,D.useEffect)(()=>{if(!A)return;let f=S.current;if(!f)return;document.activeElement===f?K(!0):f.focus();let T=f.ownerDocument??document,I=T.getSelection(),O=I&&I.rangeCount>0&&f.contains(I.anchorNode);if(I&&!O){let M=T.createRange();M.selectNodeContents(f),M.collapse(!0),I.removeAllRanges(),I.addRange(M)}},[A,K]),(0,D.useEffect)(()=>{let f=S.current;if(!f)return;let T=f.ownerDocument??document,I=()=>{let O=T.getSelection();if(!O||O.rangeCount===0||!O.anchorNode||!f.contains(O.anchorNode))return;let M=O.anchorNode,re=M.nodeType===Node.ELEMENT_NODE?M:M.parentElement,xe=(O.isCollapsed?re?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ze=s?.id??r?.id??null;if(xe&&xe!==ze){P(xe);return}performance.now()-L.current<50||de((0,j.getCursorOffset)(f))};return T.addEventListener("selectionchange",I),()=>T.removeEventListener("selectionchange",I)},[s,r,P,de]),(0,D.useEffect)(()=>{let f=S.current;if(!f)return;let T=I=>{let O=(0,j.chipIdFromTap)(f,I.target);O&&(P(O),(0,j.keepCaretOnChip)(f,O))};return f.addEventListener("click",T),()=>f.removeEventListener("click",T)},[P]),(0,D.useLayoutEffect)(()=>{let f=S.current;f&&(0,j.renderEditableContent)({input:f,segments:a,newParamId:o,editingParamId:s?.id??null,placeholderText:v??"",isFocused:g,showChipIcons:t,showChipImages:i,hintOptions:(0,j.startingHintOptions)(C??[])})},[a,o,s,v,C,g,t,i]),(0,D.useEffect)(()=>{let f=S.current;return()=>{f&&(0,j.cancelStartingHint)(f)}},[]),(0,D.useLayoutEffect)(()=>{let f=ce.current,T=o??"";if(ce.current=T,!T||T===f)return;let I=S.current;if(!I)return;I.focus();let O=oe.current??(0,j.plainTextLength)(I);(0,j.setCursorOffset)(I,O)},[o]),(0,D.useLayoutEffect)(()=>{let f=ie.current,T=s?.id??"";if(ie.current=T,!T||T===f||d==null)return;let I=S.current;I&&(0,j.setCursorOffset)(I,d)},[s,d]);let F=(0,D.useCallback)(()=>{if(ae.current)return;let f=S.current;if(!f)return;let T=(0,j.extractPlainText)(f),O=T.length>0&&T[0]!==T[0].toUpperCase()?T[0].toUpperCase()+T.slice(1):T;V(O)},[V]),Le=(0,D.useCallback)(()=>{L.current=performance.now(),F();let f=S.current;f&&N((0,j.getCursorOffset)(f))},[F,N]);(0,D.useEffect)(()=>{let f=S.current;if(!f)return;let T=I=>{let O=I,M=O.inputType;if(M==="insertParagraph"||M==="insertLineBreak"||M==="insertFromDrop"){I.preventDefault();return}if(M.startsWith("insert")||M.startsWith("delete")){let re=M.startsWith("delete")?"":O.data??"";G(re)&&I.preventDefault()}};return f.addEventListener("beforeinput",T),()=>f.removeEventListener("beforeinput",T)},[G]);let Ce=(0,D.useCallback)(()=>{ae.current=!0,S.current?.setAttribute("data-aia-composing","true")},[]),ve=(0,D.useCallback)(()=>{ae.current=!1,S.current?.removeAttribute("data-aia-composing"),F()},[F]),c=(0,D.useCallback)(f=>{f.preventDefault();let T=S.current;if(!T)return;let I=(f.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let O=T.ownerDocument??document,M=O.getSelection();if(!M||M.rangeCount===0)return;let re=M.getRangeAt(0);if(!T.contains(re.startContainer))return;re.deleteContents();let ge=O.createTextNode(I);re.insertNode(ge),re.setStartAfter(ge),re.collapse(!0),M.removeAllRanges(),M.addRange(re),F()},[F]),E=(0,D.useCallback)(f=>H(f),[H]),Ge=(0,D.useCallback)(()=>K(!0),[K]),w=(0,D.useCallback)(()=>K(!1),[K]),at=(0,D.useCallback)(()=>S.current?.focus(),[]),Ue=(0,D.useCallback)(()=>S.current?.blur(),[]),Ye=(0,D.useCallback)(()=>{let f=S.current;return f?(0,j.extractPlainText)(f):""},[]),Ke=ii()?"plaintext-only":"true";return{inputRef:S,editorProps:{ref:S,contentEditable:Ke,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":u,"aria-expanded":p,"aria-activedescendant":x,spellCheck:!0,enterKeyHint:"send",onInput:Le,onKeyDown:E,onCompositionStart:Ce,onCompositionEnd:ve,onPaste:c,onFocus:Ge,onBlur:w},getPlainText:Ye,focus:at,blur:Ue}}var Oe=require("react/jsx-runtime");function oi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var wa=(0,$.forwardRef)(function({onSubmit:a,onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:d,additionalContext:m,language:v,currency:C,productId:g,visitorId:p,columns:u,pillPlacement:x="dropdown",mode:A="auto",optionsPosition:V="below",animations:H=!0,optionsStyle:N="floating",dropdownTrigger:de,closeDropdownOnBlur:P,prependPlaceholder:G,showNonTappableOptions:K,locationSearch:S,showOptionIcons:ae=!0,showChipIcons:ce=!0,showChipImages:ie=!0,showOptionImages:oe=!0,showOptionCounts:L=!0,showSkipButton:F,showProducts:Le,productsLayout:Ce,productImageFallback:ve,autoFocus:c=!0,onFocus:E,onBlur:Ge,value:w,completedParams:at,onChange:Ue,onParamsChange:Ye,products:Ke,mapProducts:f,onProductSelect:T,onProductAddToCart:I,submitButton:O,resetOnSubmit:M=!0},re){let ge=(0,$.useRef)(null),xe=(0,$.useRef)(null),ze=(0,$.useRef)(null),st=(0,$.useRef)(()=>{}),Z=(0,$.useRef)(null),Qe=(0,$.useRef)(null);(0,$.useEffect)(()=>{let B=ge.current;if(B)return Z.current?Z.current.setMode(A):Z.current=new We.ModeController(B,A),()=>{Z.current?.destroy(),Z.current=null}},[A]);let pt=(0,$.useCallback)(B=>{let fe=Qe.current?.current;fe&&(fe.focus(),(0,We.setCursorOffset)(fe,B))},[]),{completedParams:it,suggestionPills:De,setActivePill:ht,skipActivePill:je,segments:pe,newParamId:Se,clearNewParamId:y,placeholderText:n,isFocused:se,isDropdownOpen:Me,isActivePillSelected:b,isLoading:$e,isReady:qe,activeIndex:Te,listboxId:ot,handleTextChange:ut,handleKeyDown:_e,setFocused:lt,editingParam:Pe,editingIdentified:Ne,editingAnchor:Ze,caretOffset:nt,startEditingParam:dt,handleCaretAfterInput:Xe,handleCaretMove:ct,replaceEditingRange:h,dropdownProps:_,reset:k,refreshProducts:vt,prepareSubmit:Ft,getState:Bt,recordSubmit:Wt}=It({onSubmit:B=>st.current(B),onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:d,additionalContext:m,language:v,currency:C,productId:g,visitorId:p,columns:u,dropdownTrigger:de,optionsPosition:V,closeDropdownOnBlur:P,prependPlaceholder:G,showNonTappableOptions:K,locationSearch:S,showOptionIcons:ae,showOptionImages:oe,showOptionCounts:L,showSkipButton:F,showProducts:Le,onFocus:E,onBlur:Ge,value:w,completedParams:at,onChange:Ue,onParamsChange:Ye,products:Ke,mapProducts:f,onProductSelect:T,onProductAddToCart:I,source:"full-sdk",setCursor:pt});(0,$.useEffect)(()=>{if(!Se)return;let B=window.setTimeout(()=>y(),650);return()=>window.clearTimeout(B)},[Se,y]);let va=Te>=0?`${ot}-option-${Te}`:void 0,{inputRef:At,editorProps:xa,focus:xt,blur:Gt,getPlainText:Kt}=ba({segments:pe,newParamId:Se,editingParam:Pe,editingIdentified:Ne,editingAnchor:Ze,caretOffset:nt,placeholderText:n,hintSuggestions:x==="inline"?[]:De,isFocused:se,showChipIcons:ce,showChipImages:ie,isDropdownOpen:Me,listboxId:ot,activeDescendantId:va,autoFocus:c,handleTextChange:ut,handleKeyDown:_e,handleCaretAfterInput:Xe,handleCaretMove:ct,startEditingParam:dt,replaceEditingRange:h,setFocused:lt});Qe.current=At,(0,$.useLayoutEffect)(()=>{let B=xe.current,fe=At.current;if(!B||!fe)return;let gt=()=>{let _t=B.firstElementChild;if(!_t)return;let Sa=_t.getBoundingClientRect(),Ta=fe.getBoundingClientRect();Sa.top>=Ta.bottom-2?B.setAttribute("data-aia-pill-wrapped",""):B.removeAttribute("data-aia-pill-wrapped")};gt();let qt=new ResizeObserver(gt);return qt.observe(fe),()=>qt.disconnect()},[pe,De.length,$e,At]),(0,$.useEffect)(()=>{let B=ze.current;if(B)return(0,We.watchEditorHeight)(B)},[]),(0,$.useImperativeHandle)(re,()=>({focus:xt,blur:Gt,reset:k,refreshProducts:vt,setMode:B=>Z.current?.setMode(B),skipActivePill:je}),[xt,Gt,k,vt,je]);let mt=!!pe.length||it.length>0,Rt=(0,$.useCallback)(B=>{if(!mt)return;B&&Ft();let fe=Bt(),gt=(0,We.buildSubmitResult)(Kt(),fe.completedParams,fe.skippedParams,{identifiedParams:fe.identifiedParams,isReady:fe.isReady,customFields:fe.customFields});B&&Wt(gt),a(gt),M&&k()},[Wt,M,mt,Ft,Bt,a,k,Kt]);st.current=()=>Rt(!1);let ya=(0,$.useCallback)(B=>{B.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||xt()},[xt]),ka=x==="inline",Ca=x==="dropdown";return(0,Oe.jsxs)("div",{ref:ge,className:`magicx-aia ${rt.container} ${r??""}`,"data-pill-placement":x,"data-options-position":V,"data-animations":H?"on":"off","data-aia-options-style":N,"data-mode":oi(A),children:[(0,Oe.jsx)(Tt,{..._,showPills:Ca,productsLayout:Ce,productImageFallback:ve}),(0,Oe.jsxs)("div",{className:rt.inputWrapper,"data-aia-input-wrapper":"",onClick:ya,children:[(0,Oe.jsxs)("div",{ref:ze,className:rt.editorArea,"data-aia-editor":"",children:[(0,Oe.jsx)("div",{...xa,className:rt.input,"data-aia-input":""}),ka&&($e||De.length>0)&&(0,Oe.jsx)("span",{ref:xe,className:rt.pillListContainer,"data-aia-pill-list-container":"",children:(0,Oe.jsx)(Ct,{pills:De,activePillIndex:0,activeSelected:b,onSelectPill:ht,loading:$e})})]}),O===null?null:O===void 0?(0,Oe.jsx)(ua,{disabled:!mt,ready:mt&&qe,onClick:()=>Rt(!0),label:(0,We.uiStringsFor)(v).submit}):(0,Oe.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:rt.submitSlot,onClick:B=>{mt&&(B.stopPropagation(),Rt(!0))},children:O})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
3573
+ `,document.head.appendChild(e)}var pa={submitButton:"aia-submitButton-otz7H"};var Pt=require("react/jsx-runtime");function ua({disabled:e,ready:a,onClick:t,label:i=(0,ha.uiStringsFor)().submit}){return(0,Pt.jsx)("button",{type:"button","data-aia-submit":"",className:pa.submitButton,disabled:e,"data-aia-ready":a?"":void 0,onClick:o=>{o.stopPropagation(),t()},"aria-label":i,children:(0,Pt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Pt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var tt=require("@magicx-eng/ai-autocomplete-vanilla"),A=require("react");var Nt=require("react");function ma(e){let a=(0,Nt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,Nt.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(d,g,v)=>{let k=a.current?.[s];return k?k(d,g,v):[]};o[s]=r}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}var Ht=require("react");function ga(e){let a=(0,Ht.useRef)(e);a.current=e;let t=(0,Ht.useRef)(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=a.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var fa={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,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView: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 It({onSubmit:e,onResult:a,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:d,currency:g,productId:v,visitorId:k,columns:f=2,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:E,showNonTappableOptions:U,locationSearch:H,showOptionIcons:N,showOptionImages:ce,showOptionCounts:T,showSkipButton:G,showProducts:K,productImageFallback:C="image",onFocus:ae,onBlur:pe,value:ie,completedParams:oe,onChange:O,onParamsChange:F,products:De,mapProducts:Pe,onProductSelect:xe,onProductAddToCart:c,source:I,setCursor:_e}){let b=(0,A.useRef)(null),[at,Ve]=(0,A.useState)(null),Ue=(0,A.useRef)(e);Ue.current=e;let Qe=(0,A.useRef)(a);Qe.current=a;let m=(0,A.useRef)(t);m.current=t;let S=(0,A.useRef)(O);S.current=O;let P=(0,A.useRef)(F);P.current=F;let R=(0,A.useRef)(ae);R.current=ae;let M=(0,A.useRef)(pe);M.current=pe;let se=(0,A.useRef)(_e);se.current=_e;let Ie=(0,A.useRef)(xe);Ie.current=xe;let me=(0,A.useRef)(c);me.current=c;let Ge=(0,A.useRef)(k);Ge.current=k;let it=(0,A.useRef)(()=>{let h=Ge.current;return typeof h=="function"?h():h}).current,ke=ga(De),ge=(0,A.useRef)(Pe);ge.current=Pe;let lt=(0,A.useRef)((h,V)=>{let z=ge.current;return z?z(h,V):h}).current,ot=Pe?lt:void 0,Me=ma(i);(0,A.useEffect)(()=>{if(typeof document>"u")return;let h=new tt.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:d,currency:g,productId:v,visitorId:it,optionOverrides:Me.overrides,maskCompletedText:o,columns:f,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:E,showNonTappableOptions:U,locationSearch:H,showProducts:K,source:I,value:ie,completedParams:oe,onSubmit:(...z)=>Ue.current?.(...z),onResult:(...z)=>Qe.current?.(...z),onError:(...z)=>m.current?.(...z),onChange:(...z)=>S.current?.(...z),onParamsChange:(...z)=>P.current?.(...z),onFocus:()=>R.current?.(),onBlur:()=>M.current?.(),onProductSelect:z=>Ie.current?.(z),onProductAddToCart:z=>me.current?.(z),setCursor:z=>se.current?.(z),products:ke.config,mapProducts:ot});b.current=h,Ve(h.getState());let V=h.subscribe(z=>Ve(z));return()=>{V(),h.destroy(),b.current===h&&(b.current=null)}},[]),(0,A.useEffect)(()=>{ie!==void 0&&b.current?.setValue(ie)},[ie]),(0,A.useEffect)(()=>{oe!==void 0&&b.current?.setCompletedParams(oe)},[oe]);let ut=JSON.stringify(s??null),Ye;try{Ye=JSON.stringify(r??null)}catch{Ye="[unstringifiable]"}(0,A.useEffect)(()=>{b.current?.update({apiConfig:s,additionalContext:r,language:d,currency:g,productId:v,optionOverrides:Me.overrides,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:E,showNonTappableOptions:U,locationSearch:H,showProducts:K})},[ut,Ye,d,g?.code,g?.rate,g?.country,v,Me.key,p,u,x,E,U,H,K]);let je=(0,A.useRef)(!1);(0,A.useEffect)(()=>{if(!je.current){je.current=!0;return}b.current?.update({products:ke.config})},[ke.enabled]),(0,A.useEffect)(()=>{b.current?.update({mapProducts:ot})},[ot]);let le=(0,A.useRef)(null);le.current===null&&(le.current={handleTextChange:h=>b.current?.handleTextChange(h),handleKeyDown:h=>{let V="nativeEvent"in h?h.nativeEvent:h;b.current?.handleKeyDown(V)},setFocused:h=>b.current?.setFocused(h),startEditingParam:h=>b.current?.startEditingParam(h),exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:h=>b.current?.handleCaretAfterInput(h),handleCaretMove:h=>b.current?.handleCaretMove(h),replaceEditingRange:h=>b.current?.replaceEditingRange(h)??!1,setActivePill:h=>b.current?.setActivePill(h),skipActivePill:()=>b.current?.skipActivePill(),removeLastParam:()=>b.current?.removeLastParam(),clearNewParamId:()=>b.current?.clearNewParamId(),reset:()=>b.current?.reset(),refreshProducts:()=>b.current?.refreshProducts(),prepareSubmit:()=>b.current?.prepareSubmit(),getState:()=>b.current?.getState()??fa,recordSubmit:h=>b.current?.recordSubmit(h),selectOption:(h,V)=>b.current?.selectOption(h,V),selectProduct:h=>b.current?.selectProduct(h),addProductToCart:h=>{let V=b.current;return!V||!me.current?Promise.resolve():V.addProductToCart(h)},setActiveDropdownIndex:h=>b.current?.setActiveDropdownIndex(h),clearHighlight:h=>b.current?.clearHighlight(h),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:h=>b.current?.setTime(h),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:h=>b.current?.toggleMultiSelectOption(h),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:h=>b.current?.setLocationQuery(h),moveLocationHighlight:h=>b.current?.moveLocationHighlight(h),commitLocation:h=>b.current?.commitLocation(h),setLocationFieldFocused:h=>b.current?.setLocationFieldFocused(h),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let y=le.current,dt=(0,A.useCallback)(h=>{let V=h.target.value,q=V.length>0&&!h.nativeEvent?.isComposing&&V[0]!==V[0].toUpperCase()?V[0].toUpperCase()+V.slice(1):V;b.current?.handleTextChange(q)},[]),n=(0,A.useCallback)(h=>{b.current?.handleKeyDown(h.nativeEvent)},[]),ne=b.current,w=at??fa,Ce=ie!==void 0?ie:w.text,mt=oe!==void 0?oe:w.completedParams,ye=w.actionableSuggestions,$e=ye[0],ct=(0,A.useMemo)(()=>(0,tt.withoutTraditionalAutocomplete)(ye),[ye]),Ze=ne?.listboxId??"",pt=w.activeDropdownIndex>=0&&ne?`${Ze}-option-${w.activeDropdownIndex}`:void 0,Ee=w.editingParam,Ne=w.editingIdentified,Xe=Ee?{parameter:Ee.suggestionParameter,text:Ee.suggestionPlaceholder,required:!0,options:Ee.options}:Ne?{parameter:Ne.parameter,text:(0,tt.identifiedParamLabel)(Ne.parameter),required:!0,options:[]}:null,nt=w.dropdownSuggestion??Xe??$e,ht=Xe?[Xe]:ye,Ke=(0,tt.dateSelectionFor)(w),rt=!ne||w.dropdownLoading;return{completedParams:mt,multiSelectView:w.multiSelectView,toggleMultiSelectOption:y.toggleMultiSelectOption,commitMultiSelect:y.commitMultiSelect,skippedParams:w.skippedParams,identifiedParams:w.identifiedParams,suggestionPills:ct,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:w.segments,newParamId:w.newParamId,clearNewParamId:y.clearNewParamId,suggestions:w.suggestions,activeIndex:w.activeDropdownIndex,isReady:w.isReady,isLoading:rt,isFocused:w.isFocused,isDropdownOpen:w.isDropdownOpen,isActivePillSelected:w.isActivePillSelected,placeholderText:w.placeholderText,listboxId:Ze,error:w.error,products:w.products,customFields:w.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:Ee,editingIdentified:Ne,editingAnchor:w.editingAnchor,caretOffset:w.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:Ce,placeholder:w.placeholderText||void 0,onChange:dt,onKeyDown:n,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":w.isDropdownOpen,"aria-activedescendant":pt,"aria-autocomplete":"list","aria-controls":Ze},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:nt?[{...nt,options:w.dropdownOptions}]:[],activeIndex:w.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:w.isDropdownOpen,id:Ze,pills:ht,activeSelected:w.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(G??!0)&&!Ee&&!Ne,showOptionIcons:N??!0,showOptionImages:ce??!0,showOptionCounts:T??!0,skipDisabled:w.inSelectionAnimation,isLoading:rt,skeletonExiting:w.skeletonExiting,isInputEmpty:Ce.trim().length===0,language:d,products:w.products,productImageFallback:C,onProductSelect:y.selectProduct,onProductAddToCart:c?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:w.activeFormatType,dateView:w.dateView,selectedDateIso:Ke.selectedIso,selectedDateRange:Ke.selectedRange,dateRangeStart:Ke.rangeStart,dateReferences:Ke.references,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,timeView:w.timeView,multiSelectView:w.multiSelectView,onMultiSelectCommit:y.commitMultiSelect,onTimeChange:y.setTime,onTimeCommit:y.commitTime,locationView:w.locationView,isReediting:w.editingParam!=null,onLocationQuery:y.setLocationQuery,onLocationMove:y.moveLocationHighlight,onLocationCommit:y.commitLocation,onLocationFocusChange:y.setLocationFieldFocused,isFocused:w.isFocused||w.locationFieldFocused,optionsPosition:u??"below"}}}var Z=require("@magicx-eng/ai-autocomplete-vanilla"),D=require("react"),Et;function ii(){if(Et!==void 0)return Et;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Et=e.contentEditable==="plaintext-only",Et}function ba(e){let{segments:a,showChipIcons:t=!0,showChipImages:i=!0,newParamId:o,editingParam:s,editingIdentified:r,editingAnchor:d,caretOffset:g,placeholderText:v,hintSuggestions:k,isFocused:f,isDropdownOpen:p,listboxId:u,activeDescendantId:x,autoFocus:E,handleTextChange:U,handleKeyDown:H,handleCaretAfterInput:N,handleCaretMove:ce,startEditingParam:T,replaceEditingRange:G,setFocused:K}=e,C=(0,D.useRef)(null),ae=(0,D.useRef)(!1),pe=(0,D.useRef)(""),ie=(0,D.useRef)(""),oe=(0,D.useRef)(null),O=(0,D.useRef)(0);oe.current=g,(0,D.useEffect)(()=>{if(!E)return;let m=C.current;if(!m)return;document.activeElement===m?K(!0):m.focus();let S=m.ownerDocument??document,P=S.getSelection(),R=P&&P.rangeCount>0&&m.contains(P.anchorNode);if(P&&!R){let M=S.createRange();M.selectNodeContents(m),M.collapse(!0),P.removeAllRanges(),P.addRange(M)}},[E,K]),(0,D.useEffect)(()=>{let m=C.current;if(!m)return;let S=m.ownerDocument??document,P=()=>{let R=S.getSelection();if(!R||R.rangeCount===0||!R.anchorNode||!m.contains(R.anchorNode))return;let M=R.anchorNode,se=M.nodeType===Node.ELEMENT_NODE?M:M.parentElement,me=(R.isCollapsed?se?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Ge=s?.id??r?.id??null;if(me&&me!==Ge){T(me);return}performance.now()-O.current<50||ce((0,Z.getCursorOffset)(m))};return S.addEventListener("selectionchange",P),()=>S.removeEventListener("selectionchange",P)},[s,r,T,ce]),(0,D.useEffect)(()=>{let m=C.current;if(!m)return;let S=P=>{let R=(0,Z.chipIdFromTap)(m,P.target);R&&(T(R),(0,Z.keepCaretOnChip)(m,R))};return m.addEventListener("click",S),()=>m.removeEventListener("click",S)},[T]),(0,D.useLayoutEffect)(()=>{let m=C.current;m&&(0,Z.renderEditableContent)({input:m,segments:a,newParamId:o,editingParamId:s?.id??null,placeholderText:v??"",isFocused:f,showChipIcons:t,showChipImages:i,hintOptions:(0,Z.startingHintOptions)(k??[])})},[a,o,s,v,k,f,t,i]),(0,D.useEffect)(()=>{let m=C.current;return()=>{m&&(0,Z.cancelStartingHint)(m)}},[]),(0,D.useLayoutEffect)(()=>{let m=pe.current,S=o??"";if(pe.current=S,!S||S===m)return;let P=C.current;if(!P)return;P.focus();let R=oe.current??(0,Z.plainTextLength)(P);(0,Z.setCursorOffset)(P,R)},[o]),(0,D.useLayoutEffect)(()=>{let m=ie.current,S=s?.id??"";if(ie.current=S,!S||S===m||d==null)return;let P=C.current;P&&(0,Z.setCursorOffset)(P,d)},[s,d]);let F=(0,D.useCallback)(()=>{if(ae.current)return;let m=C.current;if(!m)return;let S=(0,Z.extractPlainText)(m),R=S.length>0&&S[0]!==S[0].toUpperCase()?S[0].toUpperCase()+S.slice(1):S;U(R)},[U]),De=(0,D.useCallback)(()=>{O.current=performance.now(),F();let m=C.current;m&&N((0,Z.getCursorOffset)(m))},[F,N]);(0,D.useEffect)(()=>{let m=C.current;if(!m)return;let S=P=>{let R=P,M=R.inputType;if(M==="insertParagraph"||M==="insertLineBreak"||M==="insertFromDrop"){P.preventDefault();return}if(M.startsWith("insert")||M.startsWith("delete")){let se=M.startsWith("delete")?"":R.data??"";G(se)&&P.preventDefault()}};return m.addEventListener("beforeinput",S),()=>m.removeEventListener("beforeinput",S)},[G]);let Pe=(0,D.useCallback)(()=>{ae.current=!0,C.current?.setAttribute("data-aia-composing","true")},[]),xe=(0,D.useCallback)(()=>{ae.current=!1,C.current?.removeAttribute("data-aia-composing"),F()},[F]),c=(0,D.useCallback)(m=>{m.preventDefault();let S=C.current;if(!S)return;let P=(m.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!P)return;let R=S.ownerDocument??document,M=R.getSelection();if(!M||M.rangeCount===0)return;let se=M.getRangeAt(0);if(!S.contains(se.startContainer))return;se.deleteContents();let Ie=R.createTextNode(P);se.insertNode(Ie),se.setStartAfter(Ie),se.collapse(!0),M.removeAllRanges(),M.addRange(se),F()},[F]),I=(0,D.useCallback)(m=>H(m),[H]),_e=(0,D.useCallback)(()=>K(!0),[K]),b=(0,D.useCallback)(()=>K(!1),[K]),at=(0,D.useCallback)(()=>C.current?.focus(),[]),Ve=(0,D.useCallback)(()=>C.current?.blur(),[]),Ue=(0,D.useCallback)(()=>{let m=C.current;return m?(0,Z.extractPlainText)(m):""},[]),Qe=ii()?"plaintext-only":"true";return{inputRef:C,editorProps:{ref:C,contentEditable:Qe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":u,"aria-expanded":p,"aria-activedescendant":x,spellCheck:!0,enterKeyHint:"send",onInput:De,onKeyDown:I,onCompositionStart:Pe,onCompositionEnd:xe,onPaste:c,onFocus:_e,onBlur:b},getPlainText:Ue,focus:at,blur:Ve}}var ze=require("react/jsx-runtime");function oi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var wa=(0,X.forwardRef)(function({onSubmit:a,onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:d,additionalContext:g,language:v,currency:k,productId:f,visitorId:p,columns:u,pillPlacement:x="dropdown",mode:E="auto",optionsPosition:U="below",animations:H=!0,optionsStyle:N="floating",dropdownTrigger:ce,closeDropdownOnBlur:T,prependPlaceholder:G,showNonTappableOptions:K,locationSearch:C,showOptionIcons:ae=!0,showChipIcons:pe=!0,showChipImages:ie=!0,showOptionImages:oe=!0,showOptionCounts:O=!0,showSkipButton:F,showProducts:De,productsLayout:Pe,productImageFallback:xe,autoFocus:c=!0,onFocus:I,onBlur:_e,value:b,completedParams:at,onChange:Ve,onParamsChange:Ue,products:Qe,mapProducts:m,onProductSelect:S,onProductAddToCart:P,submitButton:R,resetOnSubmit:M=!0},se){let Ie=(0,X.useRef)(null),me=(0,X.useRef)(null),Ge=(0,X.useRef)(null),it=(0,X.useRef)(()=>{}),ke=(0,X.useRef)(null),ge=(0,X.useRef)(null);(0,X.useEffect)(()=>{let B=Ie.current;if(B)return ke.current?ke.current.setMode(E):ke.current=new We.ModeController(B,E),()=>{ke.current?.destroy(),ke.current=null}},[E]);let lt=(0,X.useCallback)(B=>{let be=ge.current?.current;be&&(be.focus(),(0,We.setCursorOffset)(be,B))},[]),{completedParams:ot,suggestionPills:Me,setActivePill:ut,skipActivePill:Ye,segments:je,newParamId:le,clearNewParamId:y,placeholderText:dt,isFocused:n,isDropdownOpen:ne,isActivePillSelected:w,isLoading:Ce,isReady:mt,activeIndex:ye,listboxId:$e,handleTextChange:ct,handleKeyDown:Ze,setFocused:pt,editingParam:Ee,editingIdentified:Ne,editingAnchor:Xe,caretOffset:nt,startEditingParam:ht,handleCaretAfterInput:Ke,handleCaretMove:rt,replaceEditingRange:h,dropdownProps:V,reset:z,refreshProducts:q,prepareSubmit:Ft,getState:Bt,recordSubmit:Wt}=It({onSubmit:B=>it.current(B),onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:d,additionalContext:g,language:v,currency:k,productId:f,visitorId:p,columns:u,dropdownTrigger:ce,optionsPosition:U,closeDropdownOnBlur:T,prependPlaceholder:G,showNonTappableOptions:K,locationSearch:C,showOptionIcons:ae,showOptionImages:oe,showOptionCounts:O,showSkipButton:F,showProducts:De,onFocus:I,onBlur:_e,value:b,completedParams:at,onChange:Ve,onParamsChange:Ue,products:Qe,mapProducts:m,onProductSelect:S,onProductAddToCart:P,source:"full-sdk",setCursor:lt});(0,X.useEffect)(()=>{if(!le)return;let B=window.setTimeout(()=>y(),650);return()=>window.clearTimeout(B)},[le,y]);let va=ye>=0?`${$e}-option-${ye}`:void 0,{inputRef:At,editorProps:xa,focus:xt,blur:Gt,getPlainText:Kt}=ba({segments:je,newParamId:le,editingParam:Ee,editingIdentified:Ne,editingAnchor:Xe,caretOffset:nt,placeholderText:dt,hintSuggestions:x==="inline"?[]:Me,isFocused:n,showChipIcons:pe,showChipImages:ie,isDropdownOpen:ne,listboxId:$e,activeDescendantId:va,autoFocus:c,handleTextChange:ct,handleKeyDown:Ze,handleCaretAfterInput:Ke,handleCaretMove:rt,startEditingParam:ht,replaceEditingRange:h,setFocused:pt});ge.current=At,(0,X.useLayoutEffect)(()=>{let B=me.current,be=At.current;if(!B||!be)return;let ft=()=>{let _t=B.firstElementChild;if(!_t)return;let Sa=_t.getBoundingClientRect(),Ta=be.getBoundingClientRect();Sa.top>=Ta.bottom-2?B.setAttribute("data-aia-pill-wrapped",""):B.removeAttribute("data-aia-pill-wrapped")};ft();let qt=new ResizeObserver(ft);return qt.observe(be),()=>qt.disconnect()},[je,Me.length,Ce,At]),(0,X.useEffect)(()=>{let B=Ge.current;if(B)return(0,We.watchEditorHeight)(B)},[]),(0,X.useImperativeHandle)(se,()=>({focus:xt,blur:Gt,reset:z,refreshProducts:q,setMode:B=>ke.current?.setMode(B),skipActivePill:Ye}),[xt,Gt,z,q,Ye]);let gt=!!je.length||ot.length>0,Rt=(0,X.useCallback)(B=>{if(!gt)return;B&&Ft();let be=Bt(),ft=(0,We.buildSubmitResult)(Kt(),be.completedParams,be.skippedParams,{identifiedParams:be.identifiedParams,isReady:be.isReady,customFields:be.customFields});B&&Wt(ft),a(ft),M&&z()},[Wt,M,gt,Ft,Bt,a,z,Kt]);it.current=()=>Rt(!1);let ya=(0,X.useCallback)(B=>{B.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||xt()},[xt]),ka=x==="inline",Ca=x==="dropdown";return(0,ze.jsxs)("div",{ref:Ie,className:`magicx-aia ${st.container} ${r??""}`,"data-pill-placement":x,"data-options-position":U,"data-animations":H?"on":"off","data-aia-options-style":N,"data-mode":oi(E),children:[(0,ze.jsx)(Tt,{...V,showPills:Ca,productsLayout:Pe,productImageFallback:xe}),(0,ze.jsxs)("div",{className:st.inputWrapper,"data-aia-input-wrapper":"",onClick:ya,children:[(0,ze.jsxs)("div",{ref:Ge,className:st.editorArea,"data-aia-editor":"",children:[(0,ze.jsx)("div",{...xa,className:st.input,"data-aia-input":""}),ka&&(Ce||Me.length>0)&&(0,ze.jsx)("span",{ref:me,className:st.pillListContainer,"data-aia-pill-list-container":"",children:(0,ze.jsx)(Ct,{pills:Me,activePillIndex:0,activeSelected:w,onSelectPill:ut,loading:Ce})})]}),R===null?null:R===void 0?(0,ze.jsx)(ua,{disabled:!gt,ready:gt&&mt,onClick:()=>Rt(!0),label:(0,We.uiStringsFor)(v).submit}):(0,ze.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:st.submitSlot,onClick:B=>{gt&&(B.stopPropagation(),Rt(!0))},children:R})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
3567
3574
  //# sourceMappingURL=index.js.map