@magicx-eng/ai-autocomplete-react 0.49.1 → 0.50.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/README.md CHANGED
@@ -286,6 +286,7 @@ function App() {
286
286
  | `animations?` | `boolean` | `true` | Enable/disable all SDK animations (press + shimmer, the typed-in starting-state placeholder, the option rows' staggered entrance, and the "more below" arrow's slide). `prefers-reduced-motion` also switches the last three off. |
287
287
  | `dropdownTrigger?` | `"auto" \| "manual" \| "hidden"` | `"auto"` | When the dropdown appears. `"auto"` = when options available. `"manual"` = only on pill tap, closes after selection. `"hidden"` = never shows. |
288
288
  | `closeDropdownOnBlur?` | `boolean` | `true` | When `true`, the dropdown closes if the input loses focus. Set to `false` to keep it open whenever options are available, regardless of focus. |
289
+ | `prependPlaceholder?` | `boolean` | `true` | Set to `false` to show the starting state's lead-in text as a hint only: a picked option is not written after it. |
289
290
  | `showNonTappableOptions?` | `boolean` | `true` | When `true`, non-tappable options are rendered alongside tappable ones in the dropdown. Set to `false` to hide non-tappable options entirely. |
290
291
  | `locationSearch?` | `boolean` | `true` | When `true`, a location parameter without options searches places as the user types in its field. Set to `false` to take typed text only. See [Location search](#location-search). |
291
292
  | `showSkipButton?` | `boolean` | `true` | When `true`, the dropdown's pill bar ends in a small "skip" button that dismisses the active pill — same action as pressing <kbd>→</kbd> at the end of the input. It sits top-right when the dropdown opens below the input, bottom-right when `optionsPosition` is `"above"`, and appears once the input has text (alongside the footer's "→ to skip" hint). Set to `false` to hide it. |
@@ -656,6 +657,7 @@ How it behaves:
656
657
 
657
658
  - **Called** once the moment the parameter becomes active, with whatever the user has already typed for it (usually `""`, the request for the default list), and again on the SDK's typing debounce with each new phrase — so you can search or page a larger list. Return the same list again if the phrase is already covered.
658
659
  - **Shown as-is.** The answer is not filtered again by the phrase it was produced for, so a fuzzy match survives. Between two calls the previous answer is filtered locally by what the user types. Typing an option's full text completes the parameter, as it does for a server option.
660
+ - **Icons.** When the server has an icon saved for the parameter it sends it on the suggestion (`icon` / `icon_svg`), and each option you return that has no `icon_svg` or `image_url` of its own is drawn with it. Give an option its own `icon_svg` or `image_url` to show that instead.
659
661
  - **The server steps back.** Its own options for an overridden type are never shown, and it is not asked for suggestions while an override owns the active parameter — it is asked again when the parameter is answered or skipped. Return an empty list for a typed phrase and the SDK falls back to the server for that phrase (once), the way it does for a parameter with no matching options. An empty list for `""` leaves the parameter on screen with no options.
660
662
  - **Honour `signal`** — it is aborted when a newer phrase supersedes the call, when the parameter stops being active, and on unmount. A throw or a rejection is logged once and treated as an empty answer, never as a fetch error.
661
663
 
package/dist/index.d.mts CHANGED
@@ -85,6 +85,8 @@ interface AIAutocompleteProps {
85
85
  dropdownTrigger?: "auto" | "manual" | "hidden";
86
86
  /** When true (default), the dropdown closes when the input loses focus. Set to false to keep it open whenever options are available, regardless of focus. */
87
87
  closeDropdownOnBlur?: boolean;
88
+ /** When true (default), the starting state's lead-in text is written before the first picked option. Set to false to show it as a hint only: a pick writes just the option. */
89
+ prependPlaceholder?: boolean;
88
90
  /** When true (default), non-tappable options are rendered in the dropdown alongside tappable ones. Set to false to hide them entirely. */
89
91
  showNonTappableOptions?: boolean;
90
92
  /**
@@ -271,6 +273,8 @@ interface UseAIAutocompleteOptions {
271
273
  optionsPosition?: "above" | "below";
272
274
  /** When true (default), the dropdown closes when the input loses focus. Set to false to keep it open whenever options are available. */
273
275
  closeDropdownOnBlur?: boolean;
276
+ /** When true (default), the starting state's lead-in text is written before the first picked option. Set to false to show it as a hint only: a pick writes just the option. */
277
+ prependPlaceholder?: boolean;
274
278
  /** When true (default), non-tappable options are rendered in the dropdown alongside tappable ones. Set to false to hide them entirely. */
275
279
  showNonTappableOptions?: boolean;
276
280
  /**
@@ -717,6 +721,6 @@ declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProp
717
721
 
718
722
  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, onLocationQuery, onLocationMove, onLocationCommit, onLocationFocusChange, isFocused, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
719
723
 
720
- declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, language, currency, productId, visitorId, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, 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;
724
+ 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;
721
725
 
722
726
  export { AIAutocomplete, AIAutocompleteDropdown, type AIAutocompleteDropdownProps, type AIAutocompleteHandle, type AIAutocompleteProps, type UseAIAutocompleteOptions, type UseAIAutocompleteReturn, useAIAutocomplete };
package/dist/index.d.ts CHANGED
@@ -85,6 +85,8 @@ interface AIAutocompleteProps {
85
85
  dropdownTrigger?: "auto" | "manual" | "hidden";
86
86
  /** When true (default), the dropdown closes when the input loses focus. Set to false to keep it open whenever options are available, regardless of focus. */
87
87
  closeDropdownOnBlur?: boolean;
88
+ /** When true (default), the starting state's lead-in text is written before the first picked option. Set to false to show it as a hint only: a pick writes just the option. */
89
+ prependPlaceholder?: boolean;
88
90
  /** When true (default), non-tappable options are rendered in the dropdown alongside tappable ones. Set to false to hide them entirely. */
89
91
  showNonTappableOptions?: boolean;
90
92
  /**
@@ -271,6 +273,8 @@ interface UseAIAutocompleteOptions {
271
273
  optionsPosition?: "above" | "below";
272
274
  /** When true (default), the dropdown closes when the input loses focus. Set to false to keep it open whenever options are available. */
273
275
  closeDropdownOnBlur?: boolean;
276
+ /** When true (default), the starting state's lead-in text is written before the first picked option. Set to false to show it as a hint only: a pick writes just the option. */
277
+ prependPlaceholder?: boolean;
274
278
  /** When true (default), non-tappable options are rendered in the dropdown alongside tappable ones. Set to false to hide them entirely. */
275
279
  showNonTappableOptions?: boolean;
276
280
  /**
@@ -717,6 +721,6 @@ declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProp
717
721
 
718
722
  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, onLocationQuery, onLocationMove, onLocationCommit, onLocationFocusChange, isFocused, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
719
723
 
720
- declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, language, currency, productId, visitorId, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, 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;
724
+ 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;
721
725
 
722
726
  export { AIAutocomplete, AIAutocompleteDropdown, type AIAutocompleteDropdownProps, type AIAutocompleteHandle, type AIAutocompleteProps, type UseAIAutocompleteOptions, type UseAIAutocompleteReturn, useAIAutocomplete };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Lt=Object.defineProperty;var Ca=Object.getOwnPropertyDescriptor;var Sa=Object.getOwnPropertyNames;var Ta=Object.prototype.hasOwnProperty;var Pa=(e,i)=>{for(var t in i)Lt(e,t,{get:i[t],enumerable:!0})},Ia=(e,i,t,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of Sa(i))!Ta.call(e,o)&&o!==t&&Lt(e,o,{get:()=>i[o],enumerable:!(a=Ca(i,o))||a.enumerable});return e};var Ea=e=>Ia(Lt({},"__esModule",{value:!0}),e);var ai={};Pa(ai,{AIAutocomplete:()=>ga,AIAutocompleteDropdown:()=>St,DATE_RANGE_META_END:()=>s.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>s.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>s.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>s.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>s.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>s.TIME_META_KEY,WEEKDAY_LABELS:()=>s.WEEKDAY_LABELS,buildSubmitResult:()=>s.buildSubmitResult,cellDay:()=>s.cellDay,cellIso:()=>s.cellIso,dateCellMarks:()=>s.dateCellMarks,formatDate:()=>s.formatDate,formatDateRange:()=>s.formatDateRange,formatOptionCount:()=>s.formatOptionCount,formatPlace:()=>s.formatPlace,formatTime:()=>s.formatTime,isoDate:()=>s.isoDate,monthLabel:()=>s.monthLabel,optionCountLabel:()=>s.optionCountLabel,optionHasImage:()=>s.optionHasImage,optionImageSources:()=>s.optionImageSources,optionImageSrc:()=>s.optionImageSrc,optionLabel:()=>s.optionLabel,optionsShowLeadingVisuals:()=>s.optionsShowLeadingVisuals,parseDate:()=>s.parseDate,parseLooseDate:()=>s.parseLooseDate,parseLooseDateRange:()=>s.parseLooseDateRange,parseTime:()=>s.parseTime,productFromMatchedItem:()=>s.productFromMatchedItem,productImageSources:()=>s.productImageSources,productsFromCustomFields:()=>s.productsFromCustomFields,sanitizeOptionIconSvg:()=>s.sanitizeOptionIconSvg,selectedRangeFor:()=>s.selectedRangeFor,useAIAutocomplete:()=>Pt,visibleDateRange:()=>s.visibleDateRange,withSkippedParams:()=>s.withSkippedParams});module.exports=Ea(ai);var s=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 Rt=Object.defineProperty;var Sa=Object.getOwnPropertyDescriptor;var Ta=Object.getOwnPropertyNames;var Pa=Object.prototype.hasOwnProperty;var Ia=(e,o)=>{for(var t in o)Rt(e,t,{get:o[t],enumerable:!0})},Ea=(e,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of Ta(o))!Pa.call(e,n)&&n!==t&&Rt(e,n,{get:()=>o[n],enumerable:!(i=Sa(o,n))||i.enumerable});return e};var Aa=e=>Ea(Rt({},"__esModule",{value:!0}),e);var ii={};Ia(ii,{AIAutocomplete:()=>fa,AIAutocompleteDropdown:()=>Tt,DATE_RANGE_META_END:()=>d.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>d.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>d.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>d.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>d.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>d.TIME_META_KEY,WEEKDAY_LABELS:()=>d.WEEKDAY_LABELS,buildSubmitResult:()=>d.buildSubmitResult,cellDay:()=>d.cellDay,cellIso:()=>d.cellIso,dateCellMarks:()=>d.dateCellMarks,formatDate:()=>d.formatDate,formatDateRange:()=>d.formatDateRange,formatOptionCount:()=>d.formatOptionCount,formatPlace:()=>d.formatPlace,formatTime:()=>d.formatTime,isoDate:()=>d.isoDate,monthLabel:()=>d.monthLabel,optionCountLabel:()=>d.optionCountLabel,optionHasImage:()=>d.optionHasImage,optionImageSources:()=>d.optionImageSources,optionImageSrc:()=>d.optionImageSrc,optionLabel:()=>d.optionLabel,optionsShowLeadingVisuals:()=>d.optionsShowLeadingVisuals,parseDate:()=>d.parseDate,parseLooseDate:()=>d.parseLooseDate,parseLooseDateRange:()=>d.parseLooseDateRange,parseTime:()=>d.parseTime,productFromMatchedItem:()=>d.productFromMatchedItem,productImageSources:()=>d.productImageSources,productsFromCustomFields:()=>d.productsFromCustomFields,sanitizeOptionIconSvg:()=>d.sanitizeOptionIconSvg,selectedRangeFor:()=>d.selectedRangeFor,useAIAutocomplete:()=>It,visibleDateRange:()=>d.visibleDateRange,withSkippedParams:()=>d.withSkippedParams});module.exports=Aa(ii);var d=require("@magicx-eng/ai-autocomplete-vanilla");var q=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
@@ -346,7 +346,7 @@
346
346
  transition: none;
347
347
  }
348
348
  }
349
- `,document.head.appendChild(e)}var ot={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 ce=require("@magicx-eng/ai-autocomplete-vanilla"),de=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
349
+ `,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 ce=require("@magicx-eng/ai-autocomplete-vanilla"),de=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
350
350
  * Built-in appearance defaults \u2014 zero specificity via :where().
351
351
  * Consumer CSS always wins without !important.
352
352
  *
@@ -1287,7 +1287,7 @@
1287
1287
  .aia-multiDone-y12U7:hover {
1288
1288
  background: var(--aia-multi-done-bg-hover, var(--aia-confirm-bg-hover, #404040));
1289
1289
  }
1290
- `,document.head.appendChild(e)}var De={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q",multiDone:"aia-multiDone-y12U7"};var Y=require("@magicx-eng/ai-autocomplete-vanilla"),qt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
1290
+ `,document.head.appendChild(e)}var Le={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q",multiDone:"aia-multiDone-y12U7"};var V=require("@magicx-eng/ai-autocomplete-vanilla"),_t=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
1291
1291
 
1292
1292
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1293
1293
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1474,7 +1474,7 @@
1474
1474
  opacity: 0.8;
1475
1475
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1476
1476
  }
1477
- `,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",pressed:"aia-pressed-bEyyN"};var me=require("react/jsx-runtime"),Aa=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function _t({options:e,activeIndex:i,listboxId:t,view:a,selection:o,onSelect:r,onHighlight:n,onUnhighlight:l,onPreviousMonth:f,onNextMonth:x}){let y=(0,Y.isoDate)(new Date),m=(0,Y.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,Y.cellIso)(e[i]),selected:o.selectedRange,floor:o.floor});return(0,me.jsxs)("div",{className:Q.datepicker,"data-aia-datepicker":"",children:[(0,me.jsxs)("div",{className:Q.header,children:[(0,me.jsx)("button",{type:"button",tabIndex:-1,className:Q.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:c=>c.preventDefault(),onClick:f,children:"\u2039"}),(0,me.jsx)("span",{className:Q.month,"data-aia-date-month":"","aria-live":"polite",children:(0,Y.monthLabel)(a)}),(0,me.jsx)("button",{type:"button",tabIndex:-1,className:Q.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:c=>c.preventDefault(),onClick:x,children:"\u203A"})]}),(0,me.jsx)("div",{className:Q.weekdays,"aria-hidden":"true",children:Y.WEEKDAY_LABELS.map((c,p)=>(0,me.jsx)("span",{className:Q.weekday,children:c},Aa[p]))}),(0,me.jsx)("div",{className:Q.grid,"data-aia-date-grid":"",children:e.map((c,p)=>(0,me.jsx)(La,{option:c,id:`${t}-option-${p}`,index:p,isHighlighted:p===i&&c.is_tappable,isToday:(0,Y.cellIso)(c)===y,isPast:(0,Y.isDimmedDay)((0,Y.cellIso)(c),y,o.floor),marks:(0,Y.dateCellMarks)((0,Y.cellIso)(c),{selectedIso:o.selectedIso,range:m}),onSelect:r,onHighlight:n,onUnhighlight:l},(0,Y.cellIso)(c)??`pad-${p}`))})]})}function La({option:e,id:i,index:t,isHighlighted:a,isToday:o,isPast:r,marks:n,onSelect:l,onHighlight:f,onUnhighlight:x}){let[y,m]=(0,qt.useState)(!1),c=(0,Y.cellDay)(e);if(c==null)return(0,me.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${Q.cell} ${Q.blank}`});let p=()=>{m(!0),l(e),setTimeout(()=>m(!1),170)},v=[Q.cell,Q.day,r?Q.past:"",a?Q.highlighted:"",o?Q.today:"",n.inRange?Q.inRange:"",n.selected?Q.selected:"",y?Q.pressed:""].filter(Boolean).join(" ");return(0,me.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":a,"aria-label":e.text,tabIndex:0,className:v,onClick:p,onKeyDown:O=>{(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),p())},onMouseEnter:()=>f(t),onMouseLeave:x?()=>x(t):void 0,children:(0,me.jsx)("span",{className:Q.number,children:c})})}var $e=require("@magicx-eng/ai-autocomplete-vanilla"),xt=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 {
1477
+ `,document.head.appendChild(e)}var U={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 ge=require("react/jsx-runtime"),La=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ut({options:e,activeIndex:o,listboxId:t,view:i,selection:n,onSelect:l,onHighlight:r,onUnhighlight:c,onPreviousMonth:g,onNextMonth:x}){let y=(0,V.isoDate)(new Date),m=(0,V.visibleDateRange)({pendingStart:n.rangeStart,highlightedIso:(0,V.cellIso)(e[o]),selected:n.selectedRange,floor:n.floor});return(0,ge.jsxs)("div",{className:U.datepicker,"data-aia-datepicker":"",children:[(0,ge.jsxs)("div",{className:U.header,children:[(0,ge.jsx)("button",{type:"button",tabIndex:-1,className:U.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:g,children:"\u2039"}),(0,ge.jsx)("span",{className:U.month,"data-aia-date-month":"","aria-live":"polite",children:(0,V.monthLabel)(i)}),(0,ge.jsx)("button",{type:"button",tabIndex:-1,className:U.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:x,children:"\u203A"})]}),(0,ge.jsx)("div",{className:U.weekdays,"aria-hidden":"true",children:V.WEEKDAY_LABELS.map((p,h)=>(0,ge.jsx)("span",{className:U.weekday,children:p},La[h]))}),(0,ge.jsx)("div",{className:U.grid,"data-aia-date-grid":"",children:e.map((p,h)=>(0,ge.jsx)(Ra,{option:p,id:`${t}-option-${h}`,index:h,isHighlighted:h===o&&p.is_tappable,isToday:(0,V.cellIso)(p)===y,isPast:(0,V.isDimmedDay)((0,V.cellIso)(p),y,n.floor),marks:(0,V.dateCellMarks)((0,V.cellIso)(p),{selectedIso:n.selectedIso,range:m}),onSelect:l,onHighlight:r,onUnhighlight:c},(0,V.cellIso)(p)??`pad-${h}`))})]})}function Ra({option:e,id:o,index:t,isHighlighted:i,isToday:n,isPast:l,marks:r,onSelect:c,onHighlight:g,onUnhighlight:x}){let[y,m]=(0,_t.useState)(!1),p=(0,V.cellDay)(e);if(p==null)return(0,ge.jsx)("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${U.cell} ${U.blank}`});let h=()=>{m(!0),c(e),setTimeout(()=>m(!1),170)},v=[U.cell,U.day,l?U.past:"",i?U.highlighted:"",n?U.today:"",r.inRange?U.inRange:"",r.selected?U.selected:"",y?U.pressed:""].filter(Boolean).join(" ");return(0,ge.jsx)("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:v,onClick:h,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),h())},onMouseEnter:()=>g(t),onMouseLeave:x?()=>x(t):void 0,children:(0,ge.jsx)("span",{className:U.number,children:p})})}var $e=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 {
1478
1478
  display: flex;
1479
1479
  flex-wrap: wrap;
1480
1480
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1514,7 +1514,7 @@
1514
1514
  .aia-cluster[data-justify="around"] {
1515
1515
  justify-content: space-around;
1516
1516
  }
1517
- `,document.head.appendChild(e)}var Rt=require("react/jsx-runtime");function gt({gap:e,align:i="center",justify:t="start",noWrap:a=!1,inline:o=!1,className:r,children:n,...l}){let f=e?{"--aia-cluster-gap":e}:void 0,x={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":i,"data-justify":t,"data-nowrap":a||void 0,"data-inline":o||void 0,style:f,...l};return o?(0,Rt.jsx)("span",{...x,children:n}):(0,Rt.jsx)("div",{...x,children:n})}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
1517
+ `,document.head.appendChild(e)}var Ot=require("react/jsx-runtime");function ft({gap:e,align:o="center",justify:t="start",noWrap:i=!1,inline:n=!1,className:l,children:r,...c}){let g=e?{"--aia-cluster-gap":e}:void 0,x={className:l?`aia-cluster ${l}`:"aia-cluster","data-align":o,"data-justify":t,"data-nowrap":i||void 0,"data-inline":n||void 0,style:g,...c};return n?(0,Ot.jsx)("span",{...x,children:r}):(0,Ot.jsx)("div",{...x,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
1518
1518
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
1519
1519
  room above the hint/branding row so the footer doesn't butt against the last
1520
1520
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -1661,7 +1661,7 @@
1661
1661
  justify-content: flex-end;
1662
1662
  }
1663
1663
  }
1664
- `,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 Me=require("react/jsx-runtime");function Ut({isOptionHighlighted:e=!1,isInputEmpty:i=!1,strings:t=(0,$e.uiStringsFor)()}){let{key:a,hint:o}=(0,$e.getFooterHint)(e,i,t),[r,n]=(0,xt.useState)($e.ATTRIBUTION_URL);return(0,xt.useEffect)(()=>{n((0,$e.buildAttributionUrl)())},[]),(0,Me.jsx)("footer",{className:qe.footer,"data-aia-footer":"",children:(0,Me.jsxs)(gt,{justify:"between",noWrap:!0,className:qe.row,children:[(0,Me.jsxs)(gt,{gap:"5px",className:qe.hintGroup,children:[(0,Me.jsx)("kbd",{className:qe.key,children:a}),(0,Me.jsx)("span",{className:qe.hint,children:o})]}),(0,Me.jsxs)("a",{className:qe.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[(0,Me.jsx)("span",{className:qe.brand,children:"AI"}),(0,Me.jsx)("span",{className:qe.badge,children:"Autocomplete"})]})]})})}var ie=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
1664
+ `,document.head.appendChild(e)}var Ke={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 Re=require("react/jsx-runtime");function Vt({isOptionHighlighted:e=!1,isInputEmpty:o=!1,strings:t=(0,$e.uiStringsFor)()}){let{key:i,hint:n}=(0,$e.getFooterHint)(e,o,t),[l,r]=(0,yt.useState)($e.ATTRIBUTION_URL);return(0,yt.useEffect)(()=>{r((0,$e.buildAttributionUrl)())},[]),(0,Re.jsx)("footer",{className:Ke.footer,"data-aia-footer":"",children:(0,Re.jsxs)(ft,{justify:"between",noWrap:!0,className:Ke.row,children:[(0,Re.jsxs)(ft,{gap:"5px",className:Ke.hintGroup,children:[(0,Re.jsx)("kbd",{className:Ke.key,children:i}),(0,Re.jsx)("span",{className:Ke.hint,children:n})]}),(0,Re.jsxs)("a",{className:Ke.brandLink,href:l,target:"_blank",rel:"noopener noreferrer",children:[(0,Re.jsx)("span",{className:Ke.brand,children:"AI"}),(0,Re.jsx)("span",{className:Ke.badge,children:"Autocomplete"})]})]})})}var te=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
1665
1665
  Angular copy). The three are kept identical by
1666
1666
  packages/vanilla/tests/render/locationFieldParity.test.ts. */
1667
1667
  .aia-location-6-fsr {
@@ -1788,7 +1788,7 @@
1788
1788
  .aia-loadingBar-OLCr4:nth-child(3) {
1789
1789
  width: 60%;
1790
1790
  }
1791
- `,document.head.appendChild(e)}var j={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 W=require("react/jsx-runtime"),Ra=0;function ft(e){return e.getRootNode().activeElement??null}function Qt(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Oa(e){if(!e.isContentEditable)return null;let i=Qt(e);if(!i||i.rangeCount===0)return null;let t=i.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function Vt(e,i){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=Qt(e);if(!t)return;let a=i;(!a||!a.startContainer.isConnected||!e.contains(a.startContainer))&&(a=document.createRange(),a.selectNodeContents(e),a.collapse(!1)),t.removeAllRanges(),t.addRange(a)}var Da=(0,W.jsxs)("svg",{className:j.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,W.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,W.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Ma=(0,W.jsxs)("svg",{className:j.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,W.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,W.jsx)("path",{d:"m20 20-3.5-3.5"})]});function Yt({view:e,searchLabel:i,noResultsLabel:t,useTypedLabel:a,widgetFocused:o,visible:r=!0,interactive:n=!0,onQuery:l,onMove:f,onCommit:x,onFocusChange:y}){let m=(0,ie.useRef)(null),c=(0,ie.useRef)(null),p=(0,ie.useRef)(null),v=(0,ie.useRef)(null),O=(0,ie.useRef)(null),G=(0,ie.useRef)(!1),N=(0,ie.useRef)(!1),U=(0,ie.useRef)(!1),Z=(0,ie.useRef)(o);Z.current=o;let D=(0,ie.useRef)(y);D.current=y;let E=h=>{U.current=h,y(h)},S=()=>{let h=m.current;return h!=null&&ft(h)===h},ee=()=>{let h=c.current;if(!h)return;let A=ft(h);A instanceof HTMLElement&&A!==m.current&&A!==document.body&&!h.contains(A)&&(v.current=A,O.current=Oa(A))},te=(0,ie.useRef)(null);te.current===null&&(te.current=`aia-location-${++Ra}`);let V=`${te.current}-row-`;(0,ie.useEffect)(()=>{let h=m.current;h&&h.value!==e.query&&ft(h)!==h&&(h.value=e.query)},[e.query]),(0,ie.useEffect)(()=>{let h=m.current;if(h){if(!r&&S()){N.current=!0,K();return}if(!o){setTimeout(()=>{if(Z.current)return;let A=v.current;A&&ft(A)===A||(N.current=!1)},0);return}if(!(N.current||!n||S())){if(ee(),E(!0),h.focus({preventScroll:!0}),!S()){N.current=!0,E(!1);return}h.value&&h.select()}}}),(0,ie.useLayoutEffect)(()=>()=>{if(!U.current)return;let h=m.current,A=v.current;A?.isConnected&&h&&ft(h)===h&&(G.current=!0,Vt(A,O.current),G.current=!1),U.current=!1,D.current(!1)},[]);let K=(h=!1)=>{h&&(N.current=!0);let A=v.current;A?.isConnected&&S()&&(G.current=!0,Vt(A,O.current),G.current=!1),E(!1)},fe=e.query.trim(),I=e.highlighted>=0&&e.highlighted<e.places.length?`${V}${e.highlighted}`:void 0,X=null;return e.places.length>0?X=e.places.map((h,A)=>(0,W.jsxs)("div",{id:`${V}${A}`,role:"option","aria-selected":A===e.highlighted,className:A===e.highlighted?`${j.row} ${j.highlighted}`:j.row,"data-aia-location-row":"","data-aia-index":A,onClick:()=>{n&&(K(!0),x(A))},children:[(0,W.jsx)("span",{className:j.pin,children:Da}),(0,W.jsxs)("span",{className:j.text,children:[(0,W.jsx)("span",{className:j.name,children:h.name}),h.secondary&&(0,W.jsx)("span",{className:j.secondary,children:h.secondary})]})]},h.id)):e.status==="loading"?X=(0,W.jsxs)("div",{className:j.loading,"data-aia-location-loading":"",children:[(0,W.jsx)("span",{className:j.loadingBar}),(0,W.jsx)("span",{className:j.loadingBar}),(0,W.jsx)("span",{className:j.loadingBar})]}):fe&&(X=(0,W.jsxs)("div",{className:j.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,W.jsx)("span",{className:j.empty,children:t}),(0,W.jsx)("span",{children:a})]})),(0,W.jsxs)("div",{ref:c,className:j.location,"data-aia-location":"",onMouseDown:h=>{!(h.target instanceof Node)||!p.current?.contains(h.target)||(h.stopPropagation(),ee(),E(!0))},children:[(0,W.jsxs)("label",{ref:p,className:j.field,children:[Ma,(0,W.jsx)("input",{ref:m,type:"text",className:j.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:i,"aria-label":i,"aria-activedescendant":I,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:h=>l(h.target.value),onFocus:()=>E(!0),onBlur:()=>{G.current||(N.current=!0,E(!1))},onKeyDown:h=>{if(!h.nativeEvent.isComposing)switch(h.key){case"ArrowDown":case"ArrowUp":h.preventDefault(),f(h.key==="ArrowDown"?1:-1);return;case"Enter":if(h.preventDefault(),!n)return;K(!0),x();return;case"Escape":h.preventDefault(),h.stopPropagation(),N.current=!0,K();return;case"Backspace":if(h.currentTarget.value!=="")return;h.preventDefault(),N.current=!0,K();return}}})]}),(0,W.jsx)("div",{className:j.results,"data-aia-location-results":"","aria-live":"polite",children:X})]})}var yt=require("@magicx-eng/ai-autocomplete-vanilla");var jt=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,
1791
+ `,document.head.appendChild(e)}var Q={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 H=require("react/jsx-runtime"),Oa=0;function bt(e){return e.getRootNode().activeElement??null}function Yt(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Da(e){if(!e.isContentEditable)return null;let o=Yt(e);if(!o||o.rangeCount===0)return null;let t=o.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function Qt(e,o){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=Yt(e);if(!t)return;let i=o;(!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,H.jsxs)("svg",{className:Q.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,H.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,H.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),za=(0,H.jsxs)("svg",{className:Q.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,H.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,H.jsx)("path",{d:"m20 20-3.5-3.5"})]});function jt({view:e,searchLabel:o,noResultsLabel:t,useTypedLabel:i,widgetFocused:n,visible:l=!0,interactive:r=!0,onQuery:c,onMove:g,onCommit:x,onFocusChange:y}){let m=(0,te.useRef)(null),p=(0,te.useRef)(null),h=(0,te.useRef)(null),v=(0,te.useRef)(null),A=(0,te.useRef)(null),B=(0,te.useRef)(!1),R=(0,te.useRef)(!1),_=(0,te.useRef)(!1),$=(0,te.useRef)(n);$.current=n;let O=(0,te.useRef)(y);O.current=y;let L=u=>{_.current=u,y(u)},k=()=>{let u=m.current;return u!=null&&bt(u)===u},ne=()=>{let u=p.current;if(!u)return;let P=bt(u);P instanceof HTMLElement&&P!==m.current&&P!==document.body&&!u.contains(P)&&(v.current=P,A.current=Da(P))},Z=(0,te.useRef)(null);Z.current===null&&(Z.current=`aia-location-${++Oa}`);let re=`${Z.current}-row-`;(0,te.useEffect)(()=>{let u=m.current;u&&u.value!==e.query&&bt(u)!==u&&(u.value=e.query)},[e.query]),(0,te.useEffect)(()=>{let u=m.current;if(u){if(!l&&k()){R.current=!0,W();return}if(!n){setTimeout(()=>{if($.current)return;let P=v.current;P&&bt(P)===P||(R.current=!1)},0);return}if(!(R.current||!r||k())){if(ne(),L(!0),u.focus({preventScroll:!0}),!k()){R.current=!0,L(!1);return}u.value&&u.select()}}}),(0,te.useLayoutEffect)(()=>()=>{if(!_.current)return;let u=m.current,P=v.current;P?.isConnected&&u&&bt(u)===u&&(B.current=!0,Qt(P,A.current),B.current=!1),_.current=!1,O.current(!1)},[]);let W=(u=!1)=>{u&&(R.current=!0);let P=v.current;P?.isConnected&&k()&&(B.current=!0,Qt(P,A.current),B.current=!1),L(!1)},X=e.query.trim(),T=e.highlighted>=0&&e.highlighted<e.places.length?`${re}${e.highlighted}`:void 0,j=null;return e.places.length>0?j=e.places.map((u,P)=>(0,H.jsxs)("div",{id:`${re}${P}`,role:"option","aria-selected":P===e.highlighted,className:P===e.highlighted?`${Q.row} ${Q.highlighted}`:Q.row,"data-aia-location-row":"","data-aia-index":P,onClick:()=>{r&&(W(!0),x(P))},children:[(0,H.jsx)("span",{className:Q.pin,children:Ma}),(0,H.jsxs)("span",{className:Q.text,children:[(0,H.jsx)("span",{className:Q.name,children:u.name}),u.secondary&&(0,H.jsx)("span",{className:Q.secondary,children:u.secondary})]})]},u.id)):e.status==="loading"?j=(0,H.jsxs)("div",{className:Q.loading,"data-aia-location-loading":"",children:[(0,H.jsx)("span",{className:Q.loadingBar}),(0,H.jsx)("span",{className:Q.loadingBar}),(0,H.jsx)("span",{className:Q.loadingBar})]}):X&&(j=(0,H.jsxs)("div",{className:Q.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,H.jsx)("span",{className:Q.empty,children:t}),(0,H.jsx)("span",{children:i})]})),(0,H.jsxs)("div",{ref:p,className:Q.location,"data-aia-location":"",onMouseDown:u=>{!(u.target instanceof Node)||!h.current?.contains(u.target)||(u.stopPropagation(),ne(),L(!0))},children:[(0,H.jsxs)("label",{ref:h,className:Q.field,children:[za,(0,H.jsx)("input",{ref:m,type:"text",className:Q.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:o,"aria-label":o,"aria-activedescendant":T,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:l?0:-1,onChange:u=>c(u.target.value),onFocus:()=>L(!0),onBlur:()=>{B.current||(R.current=!0,L(!1))},onKeyDown:u=>{if(!u.nativeEvent.isComposing)switch(u.key){case"ArrowDown":case"ArrowUp":u.preventDefault(),g(u.key==="ArrowDown"?1:-1);return;case"Enter":if(u.preventDefault(),!r)return;W(!0),x();return;case"Escape":u.preventDefault(),u.stopPropagation(),R.current=!0,W();return;case"Backspace":if(u.currentTarget.value!=="")return;u.preventDefault(),R.current=!0,W();return}}})]}),(0,H.jsx)("div",{className:Q.results,"data-aia-location-results":"","aria-live":"polite",children:j})]})}var kt=require("@magicx-eng/ai-autocomplete-vanilla");var $t=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,
1792
1792
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
1793
1793
  The border is kept as a 1px transparent line so the box stays the same size
1794
1794
  as it was when the outline was dashed. */
@@ -1968,7 +1968,7 @@
1968
1968
  opacity: 0;
1969
1969
  }
1970
1970
  }
1971
- `,document.head.appendChild(e)}var ze={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",skeletonIn:"aia-skeletonIn-54kMv",skeletonPulse:"aia-skeletonPulse-xGcUy",skeletonOut:"aia-skeletonOut-1sJ-r"};var Ze=require("react/jsx-runtime"),Ot={selected:1,first:.7,next:.4,last:.2};function $t({label:e,state:i,rounded:t,loading:a,smartSuggestion:o,completionHeader:r,onClick:n}){let l=[ze.pill,t?ze.rounded:"",a?ze.skeleton:""].filter(Boolean).join(" ");return(0,Ze.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":a?"":void 0,"data-aia-smart-suggestion":o?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:l,style:{opacity:Ot[i]},onMouseDown:f=>f.preventDefault(),onClick:a?void 0:n,disabled:a,children:o?(0,Ze.jsxs)(Ze.Fragment,{children:[(0,Ze.jsx)("span",{className:`${ze.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,Ze.jsx)("span",{className:`${ze.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:jt.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 {
1971
+ `,document.head.appendChild(e)}var Oe={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",skeletonIn:"aia-skeletonIn-54kMv",skeletonPulse:"aia-skeletonPulse-xGcUy",skeletonOut:"aia-skeletonOut-1sJ-r"};var Ze=require("react/jsx-runtime"),Dt={selected:1,first:.7,next:.4,last:.2};function Zt({label:e,state:o,rounded:t,loading:i,smartSuggestion:n,completionHeader:l,onClick:r}){let c=[Oe.pill,t?Oe.rounded:"",i?Oe.skeleton:""].filter(Boolean).join(" ");return(0,Ze.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":i?"":void 0,"data-aia-smart-suggestion":n?l?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:c,style:{opacity:Dt[o]},onMouseDown:g=>g.preventDefault(),onClick:i?void 0:r,disabled:i,children:n?(0,Ze.jsxs)(Ze.Fragment,{children:[(0,Ze.jsx)("span",{className:`${Oe.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,Ze.jsx)("span",{className:`${Oe.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:$t.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 {
1972
1972
  position: relative;
1973
1973
  z-index: 1;
1974
1974
  pointer-events: auto;
@@ -1978,7 +1978,7 @@
1978
1978
  align-items: center;
1979
1979
  vertical-align: middle;
1980
1980
  }
1981
- `,document.head.appendChild(e)}var Dt={list:"aia-list-qvLqO"};var bt=require("react/jsx-runtime"),za=[125,69];function Zt(e){return e===0?"first":e===1?"next":"last"}function kt({pills:e,activePillIndex:i,onSelectPill:t,activeSelected:a,rounded:o,loading:r}){return r&&e.length===0?(0,bt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":"",children:za.map((n,l)=>(0,bt.jsx)("span",{"data-aia-pill-skeleton":"",className:`${ze.pill} ${o?ze.rounded:""} ${ze.skeleton}`,style:{width:n,opacity:Ot[Zt(l)]}},`skel-${n}`))}):(0,bt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((n,l)=>{let f=!!a&&l===i;return(0,bt.jsx)($t,{label:n.text,state:f?"selected":Zt(l),selected:f,rounded:o,loading:r,smartSuggestion:(0,yt.isSmartSuggestion)(n),completionHeader:(0,yt.isTraditionalAutocompleteSuggestion)(n),onClick:()=>t(l)},`${n.parameter}-${n.text}`)})})}var xe=require("@magicx-eng/ai-autocomplete-vanilla"),ge=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
1981
+ `,document.head.appendChild(e)}var Mt={list:"aia-list-qvLqO"};var wt=require("react/jsx-runtime"),Na=[125,69];function Xt(e){return e===0?"first":e===1?"next":"last"}function Ct({pills:e,activePillIndex:o,onSelectPill:t,activeSelected:i,rounded:n,loading:l}){return l&&e.length===0?(0,wt.jsx)("span",{className:Mt.list,"data-aia-pill-list-loading":"",children:Na.map((r,c)=>(0,wt.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Oe.pill} ${n?Oe.rounded:""} ${Oe.skeleton}`,style:{width:r,opacity:Dt[Xt(c)]}},`skel-${r}`))}):(0,wt.jsx)("span",{className:Mt.list,"data-aia-pill-list-loading":l?"":void 0,children:e.map((r,c)=>{let g=!!i&&c===o;return(0,wt.jsx)(Zt,{label:r.text,state:g?"selected":Xt(c),selected:g,rounded:n,loading:l,smartSuggestion:(0,kt.isSmartSuggestion)(r),completionHeader:(0,kt.isTraditionalAutocompleteSuggestion)(r),onClick:()=>t(c)},`${r.parameter}-${r.text}`)})})}var we=require("@magicx-eng/ai-autocomplete-vanilla"),fe=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
1982
1982
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
1983
1983
  theming one package sees the same result in the other.
1984
1984
 
@@ -2434,7 +2434,7 @@
2434
2434
  .aia-section-Hugfg[data-aia-products-layout="list"] .aia-card-JBGYT[data-aia-product-has-cart] {
2435
2435
  padding-right: calc(var(--aia-product-cart-size, 28px) + 16px);
2436
2436
  }
2437
- `,document.head.appendChild(e)}var $={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 H=require("react/jsx-runtime");function Xt({products:e,listboxId:i,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r=!0,layout:n="row",imageFallback:l="image",strings:f=(0,xe.uiStringsFor)()}){let x=e.length>0,y=(0,ge.useRef)(null);if((0,ge.useEffect)(()=>{let c=y.current;if(!(!x||!c))return(0,xe.attachProductRowWheel)(c)},[x]),!x)return null;let m=`${i}-products-label`;return(0,H.jsxs)("section",{className:$.section,"data-aia-products":"","data-aia-products-layout":n,role:"group","aria-labelledby":m,children:[(0,H.jsx)("div",{className:$.label,id:m,"data-aia-products-label":"",children:f.products}),(0,H.jsx)("div",{ref:y,className:$.row,"data-aia-products-row":"",children:e.map((c,p)=>(0,H.jsx)(Na,{product:c,id:`${i}-product-${p}`,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r,imageFallback:l,soldOut:f.soldOut,addToCart:f.addToCart},c.id))})]})}function Na({product:e,id:i,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r,imageFallback:n,soldOut:l,addToCart:f}){let x=!!a&&e.available!==!1,[y,m]=(0,ge.useState)(null),c=v=>{v.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},p=v=>{v.metaKey||v.ctrlKey||v.shiftKey||v.altKey||v.button!==0||(v.preventDefault(),t(e))};return(0,H.jsxs)("a",{id:i,className:$.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":x?"":void 0,role:"option","aria-selected":!1,style:y?{"--aia-product-photo-fill-x":String(y.x),"--aia-product-photo-fill-y":String(y.y)}:void 0,href:e.url,tabIndex:r?0:-1,onClick:p,onKeyDown:v=>{v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:c,children:[(0,H.jsx)(Ba,{sources:(0,xe.productImageSources)(e.imageUrl),title:e.title,fallback:n,onPhotoFill:m},(0,xe.productImageSrc)(e.imageUrl)??""),(0,H.jsxs)("span",{className:$.body,children:[e.vendor?(0,H.jsx)("span",{className:$.vendor,children:e.vendor}):null,(0,H.jsx)("span",{className:$.title,children:e.title}),e.price?(0,H.jsxs)("span",{className:$.price,children:[e.price,e.compareAtPrice?(0,H.jsx)("s",{className:$.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,H.jsx)("span",{className:$.badge,children:l}):null]}),x&&a?(0,H.jsx)(Ha,{product:e,label:`${f}: ${e.title}`,focusable:r,onAddToCart:a,onFocus:()=>o?.(!0),onBlur:c},Fa(e)):null]})}function Fa(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(i=>i??"").join("\0")}function Ha({product:e,label:i,focusable:t,onAddToCart:a,onFocus:o,onBlur:r}){let[n,l]=(0,ge.useState)(null),f=(0,ge.useRef)(null),x=(0,ge.useRef)(e);x.current=e;let y=(0,ge.useRef)(!0);(0,ge.useEffect)(()=>(y.current=!0,()=>{y.current=!1}),[]);let m=p=>{f.current=p,y.current&&l(p)},c=p=>{if(p.preventDefault(),p.stopPropagation(),f.current==="adding")return;m("adding");let v;try{v=Promise.resolve(a(x.current))}catch(O){v=Promise.reject(O)}v.then(()=>m("added"),()=>m(null))};return(0,H.jsx)("span",{className:$.cart,"data-aia-product-cart":"","data-aia-cart-state":n??void 0,"aria-busy":n==="adding"?!0:void 0,role:"button","aria-label":i,tabIndex:t?0:-1,onClick:c,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||c(p)},onFocus:p=>{p.stopPropagation(),o()},onBlur:p=>{p.stopPropagation(),r(p)},children:(0,H.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,H.jsx)("path",{className:$.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,H.jsx)("path",{className:$.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,H.jsx)("path",{className:$.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,H.jsx)("path",{className:$.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,H.jsx)("circle",{className:$.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,H.jsx)("circle",{className:$.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ba({sources:e,title:i,fallback:t,onPhotoFill:a}){let[o,r]=(0,ge.useState)(0),n=e[o],l=!!n,[f,x]=(0,ge.useState)(null),y=!l&&t==="initial";return(0,ge.useEffect)(()=>()=>a(null),[a]),(0,H.jsxs)("span",{className:$.media,"aria-hidden":"true","data-aia-product-placeholder":!l&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":l&&f===n?"":void 0,children:[l?(0,H.jsx)("img",{className:$.image,src:n,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{x(n),a((0,xe.productPhotoFill)(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&a(null),r(m=>m+1)}}):null,y?(0,xe.productInitial)(i):null]})}var ne=require("@magicx-eng/ai-autocomplete-vanilla"),Ne=require("react");var Jt=require("@magicx-eng/ai-autocomplete-vanilla"),Ct=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 {
2437
+ `,document.head.appendChild(e)}var Y={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 N=require("react/jsx-runtime");function Jt({products:e,listboxId:o,onSelect:t,onAddToCart:i,onFocusChange:n,focusable:l=!0,layout:r="row",imageFallback:c="image",strings:g=(0,we.uiStringsFor)()}){let x=e.length>0,y=(0,fe.useRef)(null);if((0,fe.useEffect)(()=>{let p=y.current;if(!(!x||!p))return(0,we.attachProductRowWheel)(p)},[x]),!x)return null;let m=`${o}-products-label`;return(0,N.jsxs)("section",{className:Y.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":m,children:[(0,N.jsx)("div",{className:Y.label,id:m,"data-aia-products-label":"",children:g.products}),(0,N.jsx)("div",{ref:y,className:Y.row,"data-aia-products-row":"",children:e.map((p,h)=>(0,N.jsx)(Fa,{product:p,id:`${o}-product-${h}`,onSelect:t,onAddToCart:i,onFocusChange:n,focusable:l,imageFallback:c,soldOut:g.soldOut,addToCart:g.addToCart},p.id))})]})}function Fa({product:e,id:o,onSelect:t,onAddToCart:i,onFocusChange:n,focusable:l,imageFallback:r,soldOut:c,addToCart:g}){let x=!!i&&e.available!==!1,[y,m]=(0,fe.useState)(null),p=v=>{v.relatedTarget?.closest("[data-aia-dropdown]")||n?.(!1)},h=v=>{v.metaKey||v.ctrlKey||v.shiftKey||v.altKey||v.button!==0||(v.preventDefault(),t(e))};return(0,N.jsxs)("a",{id:o,className:Y.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":x?"":void 0,role:"option","aria-selected":!1,style:y?{"--aia-product-photo-fill-x":String(y.x),"--aia-product-photo-fill-y":String(y.y)}:void 0,href:e.url,tabIndex:l?0:-1,onClick:h,onKeyDown:v=>{v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),t(e))},onFocus:()=>n?.(!0),onBlur:p,children:[(0,N.jsx)(Wa,{sources:(0,we.productImageSources)(e.imageUrl),title:e.title,fallback:r,onPhotoFill:m},(0,we.productImageSrc)(e.imageUrl)??""),(0,N.jsxs)("span",{className:Y.body,children:[e.vendor?(0,N.jsx)("span",{className:Y.vendor,children:e.vendor}):null,(0,N.jsx)("span",{className:Y.title,children:e.title}),e.price?(0,N.jsxs)("span",{className:Y.price,children:[e.price,e.compareAtPrice?(0,N.jsx)("s",{className:Y.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,N.jsx)("span",{className:Y.badge,children:c}):null]}),x&&i?(0,N.jsx)(Ba,{product:e,label:`${g}: ${e.title}`,focusable:l,onAddToCart:i,onFocus:()=>n?.(!0),onBlur:p},Ha(e)):null]})}function Ha(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(o=>o??"").join("\0")}function Ba({product:e,label:o,focusable:t,onAddToCart:i,onFocus:n,onBlur:l}){let[r,c]=(0,fe.useState)(null),g=(0,fe.useRef)(null),x=(0,fe.useRef)(e);x.current=e;let y=(0,fe.useRef)(!0);(0,fe.useEffect)(()=>(y.current=!0,()=>{y.current=!1}),[]);let m=h=>{g.current=h,y.current&&c(h)},p=h=>{if(h.preventDefault(),h.stopPropagation(),g.current==="adding")return;m("adding");let v;try{v=Promise.resolve(i(x.current))}catch(A){v=Promise.reject(A)}v.then(()=>m("added"),()=>m(null))};return(0,N.jsx)("span",{className:Y.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":o,tabIndex:t?0:-1,onClick:p,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||p(h)},onFocus:h=>{h.stopPropagation(),n()},onBlur:h=>{h.stopPropagation(),l(h)},children:(0,N.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,N.jsx)("path",{className:Y.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,N.jsx)("path",{className:Y.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,N.jsx)("path",{className:Y.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,N.jsx)("path",{className:Y.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,N.jsx)("circle",{className:Y.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,N.jsx)("circle",{className:Y.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Wa({sources:e,title:o,fallback:t,onPhotoFill:i}){let[n,l]=(0,fe.useState)(0),r=e[n],c=!!r,[g,x]=(0,fe.useState)(null),y=!c&&t==="initial";return(0,fe.useEffect)(()=>()=>i(null),[i]),(0,N.jsxs)("span",{className:Y.media,"aria-hidden":"true","data-aia-product-placeholder":!c&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":c&&g===r?"":void 0,children:[c?(0,N.jsx)("img",{className:Y.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{x(r),i((0,we.productPhotoFill)(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{n+1>=e.length&&i(null),l(m=>m+1)}}):null,y?(0,we.productInitial)(o):null]})}var ie=require("@magicx-eng/ai-autocomplete-vanilla"),De=require("react");var ea=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 {
2438
2438
  display: grid;
2439
2439
  grid-template-columns: repeat(
2440
2440
  auto-fit,
@@ -2470,7 +2470,7 @@
2470
2470
  .aia-grid[data-scroll]::-webkit-scrollbar {
2471
2471
  display: none;
2472
2472
  }
2473
- `,document.head.appendChild(e)}var ta=require("react/jsx-runtime");function ea({min:e="16rem",max:i,gap:t,scroll:a=!1,maxHeight:o,scrollResetKey:r,cols:n,template:l,innerRef:f,className:x,children:y,...m}){let c=(0,Ct.useRef)(null);(0,Ct.useLayoutEffect)(()=>{if(r===void 0)return;let v=c.current;v&&(v.scrollTop=0)},[r]);let p={"--aia-grid-min":e};return i&&(p["--aia-grid-max"]=i),t&&(p["--aia-grid-gap"]=t),o&&(p["--aia-grid-max-height"]=o),n&&(p.gridTemplateColumns=(0,Jt.optionsGridTemplateColumns)(n)),l&&(p.gridTemplateColumns=l),(0,ta.jsx)("div",{ref:v=>{c.current=v,f?.(v)},className:x?`aia-grid ${x}`:"aia-grid","data-scroll":a||void 0,style:p,...m,children:y})}var pe=require("@magicx-eng/ai-autocomplete-vanilla"),Ce=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 {
2473
+ `,document.head.appendChild(e)}var aa=require("react/jsx-runtime");function ta({min:e="16rem",max:o,gap:t,scroll:i=!1,maxHeight:n,scrollResetKey:l,cols:r,template:c,innerRef:g,className:x,children:y,...m}){let p=(0,St.useRef)(null);(0,St.useLayoutEffect)(()=>{if(l===void 0)return;let v=p.current;v&&(v.scrollTop=0)},[l]);let h={"--aia-grid-min":e};return o&&(h["--aia-grid-max"]=o),t&&(h["--aia-grid-gap"]=t),n&&(h["--aia-grid-max-height"]=n),r&&(h.gridTemplateColumns=(0,ea.optionsGridTemplateColumns)(r)),c&&(h.gridTemplateColumns=c),(0,aa.jsx)("div",{ref:v=>{p.current=v,g?.(v)},className:x?`aia-grid ${x}`:"aia-grid","data-scroll":i||void 0,style:h,...m,children:y})}var he=require("@magicx-eng/ai-autocomplete-vanilla"),Se=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 {
2474
2474
  position: relative;
2475
2475
  /* Clip, not visible: the entrance rise below runs on the inner content,
2476
2476
  and a transformed box extends its scroll container's scrollable area.
@@ -2996,7 +2996,7 @@
2996
2996
  .aia-item-d4vpD:has(.aia-checkbox-KGRhg[data-checked="true"]) {
2997
2997
  background: var(--aia-option-bg, transparent);
2998
2998
  }
2999
- `,document.head.appendChild(e)}var oe={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",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",skeletonBarIn:"aia-skeletonBarIn-ZlEM0",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd",checkbox:"aia-checkbox-KGRhg"};var se=require("react/jsx-runtime");function aa({option:e,isHighlighted:i,checked:t,onSelect:a,onHighlight:o,onUnhighlight:r,id:n,loading:l,showIcon:f=!0,showImage:x=!0,showCount:y=!0,scrollHint:m,enterDelayMs:c=0}){let[p]=(0,Ce.useState)(c),[v,O]=(0,Ce.useState)(!1),G=x?(0,pe.optionImageSources)(e.image_url):[],N=G[0]??null,[U,Z]=(0,Ce.useState)([]),D=G.find(I=>!U.includes(I))??null,[E,S]=(0,Ce.useState)(null),ee=(0,Ce.useMemo)(()=>!N&&f&&e.icon_svg?(0,pe.sanitizeOptionIconSvg)(e.icon_svg):null,[N,f,e.icon_svg]),te=y?(0,pe.formatOptionCount)(e.item_count):null,V=(0,Ce.useRef)(void 0);(0,Ce.useEffect)(()=>()=>clearTimeout(V.current),[]);let K=I=>{if(l||!e.is_tappable||v&&t===void 0)return;O(!0);let X=I?.currentTarget;t!==void 0&&X!==void 0&&I!==void 0&&!(0,pe.isMultiSelectToggleTap)(X,X.querySelector("[data-aia-checkbox]"),I)?a(e,{commit:!0}):a(e),clearTimeout(V.current),V.current=setTimeout(()=>O(!1),170)},fe=[oe.item,i&&!l?oe.highlighted:"",e.liveMatch&&!l?oe.liveMatch:"",e.is_tappable?oe.tappable:oe.nonTappable,v?oe.pressed:"",m?oe.scrollHint:""].filter(Boolean).join(" ");return(0,se.jsx)("div",{id:n,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":ee&&e.icon?e.icon:void 0,"data-aia-image":N?"":void 0,"data-aia-item-count":te!==null?e.item_count:void 0,"aria-selected":t??i,className:fe,style:{[pe.OPTION_ENTER_DELAY_VAR]:`${p}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:K,onKeyDown:I=>{!l&&e.is_tappable&&(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),K())},onMouseEnter:!l&&e.is_tappable?o:void 0,onMouseLeave:r,children:(0,se.jsxs)("span",{className:oe.content,children:[t!==void 0&&e.is_tappable&&(0,se.jsx)("span",{className:oe.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),N&&(0,se.jsx)("span",{className:`${oe.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":D!==null&&E===D?"":void 0,children:(0,se.jsx)("img",{src:D??N,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:D===null,onLoad:()=>S(D),onError:()=>{D!==null&&Z(I=>[...I,D])}})}),ee&&(0,se.jsx)("span",{className:`${oe.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:ee}}),(0,se.jsxs)("span",{className:oe.text,children:[e.matchedText?(0,pe.highlightParts)((0,pe.optionLabel)(e),e.matchedText).map((I,X)=>I.bold?(0,se.jsx)("strong",{className:`${oe.match} magicx-aia-option-match`,children:I.text},X):I.text):(0,pe.optionLabel)(e),e.parameterLabel&&(0,se.jsxs)(se.Fragment,{children:[" ",(0,se.jsx)("span",{className:`${oe.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,se.jsx)("span",{className:oe.tag,children:e.tag}),te!==null&&(0,se.jsx)("span",{className:`${oe.count} magicx-aia-option-count`,children:te})]})})}var Mt=require("react/jsx-runtime");function Wa(){let[e,i]=(0,Ne.useState)(ne.isOptionsGridMobileViewport);return(0,Ne.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(ne.OPTIONS_GRID_MOBILE_QUERY),a=()=>i(t.matches);return a(),t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[]),e}function ia({options:e,activeIndex:i,picked:t,onSelect:a,onHighlight:o,onUnhighlight:r,listboxId:n,loading:l,groupKey:f="",optionsPosition:x="below",showIcons:y=!0,showImages:m=!0,showCounts:c=!0}){let p=Wa(),v=(0,Ne.useRef)(null),[O,G]=(0,Ne.useState)(null),N=(0,Ne.useRef)(null);(0,Ne.useLayoutEffect)(()=>{if(l&&(0,ne.sameOptionRows)(N.current,e))return;N.current=l?null:e;let D=v.current,S=D&&!l&&(0,ne.needsOptionsGridMeasurement)(e.length,p)?(0,ne.measureOptionsGrid)(D):null;G(S?(0,ne.planOptionsGrid)(e.length,p,S.rowWidths,S.gridWidth):null)},[e,p,l]);let U=O??(0,ne.planOptionsGrid)(e.length,p,null,null),Z=(0,ne.optionsShowLeadingVisuals)(e,y,m);return(0,Mt.jsx)(ea,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:f,template:U.template,maxHeight:U.maxHeight,innerRef:D=>{v.current=D},"data-aia-group":f,children:e.map((D,E)=>(0,Mt.jsx)(aa,{option:D,isHighlighted:E===i,checked:t?t.includes(D.text):void 0,onSelect:a,onHighlight:()=>o(E),onUnhighlight:r?()=>r(E):void 0,id:`${n}-option-${E}`,loading:l,showIcon:y&&Z,showImage:m&&Z,showCount:c,scrollHint:!l&&U.scrollHintIndices.includes(E),enterDelayMs:l?0:(0,ne.optionEnterDelayMs)(E,U.cols,e.length,x)},`${f}\0${D.text}`))})}var le=require("@magicx-eng/ai-autocomplete-vanilla"),Te=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) ---
2999
+ `,document.head.appendChild(e)}var ae={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",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",skeletonBarIn:"aia-skeletonBarIn-ZlEM0",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd",checkbox:"aia-checkbox-KGRhg"};var se=require("react/jsx-runtime");function ia({option:e,isHighlighted:o,checked:t,onSelect:i,onHighlight:n,onUnhighlight:l,id:r,loading:c,showIcon:g=!0,showImage:x=!0,showCount:y=!0,scrollHint:m,enterDelayMs:p=0}){let[h]=(0,Se.useState)(p),[v,A]=(0,Se.useState)(!1),B=x?(0,he.optionImageSources)(e.image_url):[],R=B[0]??null,[_,$]=(0,Se.useState)([]),O=B.find(T=>!_.includes(T))??null,[L,k]=(0,Se.useState)(null),ne=(0,Se.useMemo)(()=>!R&&g&&e.icon_svg?(0,he.sanitizeOptionIconSvg)(e.icon_svg):null,[R,g,e.icon_svg]),Z=y?(0,he.formatOptionCount)(e.item_count):null,re=(0,Se.useRef)(void 0);(0,Se.useEffect)(()=>()=>clearTimeout(re.current),[]);let W=T=>{if(c||!e.is_tappable||v&&t===void 0)return;A(!0);let j=T?.currentTarget;t!==void 0&&j!==void 0&&T!==void 0&&!(0,he.isMultiSelectToggleTap)(j,j.querySelector("[data-aia-checkbox]"),T)?i(e,{commit:!0}):i(e),clearTimeout(re.current),re.current=setTimeout(()=>A(!1),170)},X=[ae.item,o&&!c?ae.highlighted:"",e.liveMatch&&!c?ae.liveMatch:"",e.is_tappable?ae.tappable:ae.nonTappable,v?ae.pressed:"",m?ae.scrollHint:""].filter(Boolean).join(" ");return(0,se.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":c?"":void 0,"data-aia-icon":ne&&e.icon?e.icon:void 0,"data-aia-image":R?"":void 0,"data-aia-item-count":Z!==null?e.item_count:void 0,"aria-selected":t??o,className:X,style:{[he.OPTION_ENTER_DELAY_VAR]:`${h}ms`},tabIndex:c||!e.is_tappable?-1:0,onClick:W,onKeyDown:T=>{!c&&e.is_tappable&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),W())},onMouseEnter:!c&&e.is_tappable?n:void 0,onMouseLeave:l,children:(0,se.jsxs)("span",{className:ae.content,children:[t!==void 0&&e.is_tappable&&(0,se.jsx)("span",{className:ae.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),R&&(0,se.jsx)("span",{className:`${ae.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":O!==null&&L===O?"":void 0,children:(0,se.jsx)("img",{src:O??R,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:O===null,onLoad:()=>k(O),onError:()=>{O!==null&&$(T=>[...T,O])}})}),ne&&(0,se.jsx)("span",{className:`${ae.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:ne}}),(0,se.jsxs)("span",{className:ae.text,children:[e.matchedText?(0,he.highlightParts)((0,he.optionLabel)(e),e.matchedText).map((T,j)=>T.bold?(0,se.jsx)("strong",{className:`${ae.match} magicx-aia-option-match`,children:T.text},j):T.text):(0,he.optionLabel)(e),e.parameterLabel&&(0,se.jsxs)(se.Fragment,{children:[" ",(0,se.jsx)("span",{className:`${ae.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,se.jsx)("span",{className:ae.tag,children:e.tag}),Z!==null&&(0,se.jsx)("span",{className:`${ae.count} magicx-aia-option-count`,children:Z})]})})}var zt=require("react/jsx-runtime");function Ga(){let[e,o]=(0,De.useState)(ie.isOptionsGridMobileViewport);return(0,De.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(ie.OPTIONS_GRID_MOBILE_QUERY),i=()=>o(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function oa({options:e,activeIndex:o,picked:t,onSelect:i,onHighlight:n,onUnhighlight:l,listboxId:r,loading:c,groupKey:g="",optionsPosition:x="below",showIcons:y=!0,showImages:m=!0,showCounts:p=!0}){let h=Ga(),v=(0,De.useRef)(null),[A,B]=(0,De.useState)(null),R=(0,De.useRef)(null);(0,De.useLayoutEffect)(()=>{if(c&&(0,ie.sameOptionRows)(R.current,e))return;R.current=c?null:e;let O=v.current,k=O&&!c&&(0,ie.needsOptionsGridMeasurement)(e.length,h)?(0,ie.measureOptionsGrid)(O):null;B(k?(0,ie.planOptionsGrid)(e.length,h,k.rowWidths,k.gridWidth):null)},[e,h,c]);let _=A??(0,ie.planOptionsGrid)(e.length,h,null,null),$=(0,ie.optionsShowLeadingVisuals)(e,y,m);return(0,zt.jsx)(ta,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:g,template:_.template,maxHeight:_.maxHeight,innerRef:O=>{v.current=O},"data-aia-group":g,children:e.map((O,L)=>(0,zt.jsx)(ia,{option:O,isHighlighted:L===o,checked:t?t.includes(O.text):void 0,onSelect:i,onHighlight:()=>n(L),onUnhighlight:l?()=>l(L):void 0,id:`${r}-option-${L}`,loading:c,showIcon:y&&$,showImage:m&&$,showCount:p,scrollHint:!c&&_.scrollHintIndices.includes(L),enterDelayMs:c?0:(0,ie.optionEnterDelayMs)(L,_.cols,e.length,x)},`${g}\0${O.text}`))})}var le=require("@magicx-eng/ai-autocomplete-vanilla"),Pe=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) ---
3000
3000
 
3001
3001
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
3002
3002
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -3118,7 +3118,7 @@
3118
3118
  .aia-done-llNY5:hover {
3119
3119
  background: var(--aia-time-done-bg-hover, var(--aia-confirm-bg-hover, #404040));
3120
3120
  }
3121
- `,document.head.appendChild(e)}var Se={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 ye=require("react/jsx-runtime"),Ga=120;function oa({view:e,label:i,doneLabel:t,interactive:a=!0,onTimeChange:o,onTimeCommit:r}){return(0,ye.jsxs)("div",{className:Se.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":i,onMouseDown:n=>n.preventDefault(),children:[(0,ye.jsx)("span",{className:Se.value,"data-aia-time-value":"","aria-live":"polite",children:(0,le.formatTime)(e.minutes)}),(0,ye.jsxs)("div",{className:Se.columns,"aria-hidden":"true",children:[(0,ye.jsx)("div",{className:Se.band}),le.TIME_WHEEL_COLUMNS.map(n=>(0,ye.jsxs)(Te.Fragment,{children:[n==="minute"&&(0,ye.jsx)("span",{className:Se.separator,children:":"}),(0,ye.jsx)(Ka,{column:n,minutes:e.minutes,interactive:a,onTimeChange:o})]},n))]}),(0,ye.jsx)("button",{type:"button",tabIndex:-1,className:Se.done,"data-aia-time-done":"",onClick:()=>{a&&r()},children:t})]})}function Ka({column:e,minutes:i,interactive:t,onTimeChange:a}){let o=(0,Te.useRef)(null),r=(0,Te.useRef)(null),n=(0,Te.useRef)(null),l=(0,Te.useRef)({minutes:i,interactive:t,onTimeChange:a});l.current={minutes:i,interactive:t,onTimeChange:a};let f=(0,le.timeWheelIndex)(e,i);(0,Te.useLayoutEffect)(()=>{let m=o.current;if(!m||n.current)return;let c=f*le.TIME_WHEEL_ROW_HEIGHT;Math.abs(m.scrollTop-c)<1||(r.current=c,m.scrollTop=c)},[f]),(0,Te.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]);let x=()=>{n.current=null;let m=o.current,c=l.current;if(!m||!c.interactive)return;let p=(0,le.timeWheelIndexFromScroll)(e,m.scrollTop);p!==(0,le.timeWheelIndex)(e,c.minutes)&&c.onTimeChange((0,le.withTimeWheelIndex)(e,c.minutes,p))},y=()=>{let m=o.current;if(m){if(r.current!=null&&Math.abs(m.scrollTop-r.current)<1){r.current=null;return}r.current=null,n.current&&clearTimeout(n.current),n.current=setTimeout(x,Ga)}};return(0,ye.jsx)("div",{ref:o,className:Se.column,"data-aia-time-column":e,onScroll:y,children:(0,le.timeWheelRows)(e).map((m,c)=>(0,ye.jsx)("div",{className:c===f?`${Se.row} ${Se.selected}`:Se.row,"data-aia-time-row":"","data-aia-index":c,onClick:()=>{l.current.interactive&&a((0,le.withTimeWheelIndex)(e,l.current.minutes,c))},children:m.label},m.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3121
+ `,document.head.appendChild(e)}var Te={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 ve=require("react/jsx-runtime"),Ka=120;function na({view:e,label:o,doneLabel:t,interactive:i=!0,onTimeChange:n,onTimeCommit:l}){return(0,ve.jsxs)("div",{className:Te.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":o,onMouseDown:r=>r.preventDefault(),children:[(0,ve.jsx)("span",{className:Te.value,"data-aia-time-value":"","aria-live":"polite",children:(0,le.formatTime)(e.minutes)}),(0,ve.jsxs)("div",{className:Te.columns,"aria-hidden":"true",children:[(0,ve.jsx)("div",{className:Te.band}),le.TIME_WHEEL_COLUMNS.map(r=>(0,ve.jsxs)(Pe.Fragment,{children:[r==="minute"&&(0,ve.jsx)("span",{className:Te.separator,children:":"}),(0,ve.jsx)(qa,{column:r,minutes:e.minutes,interactive:i,onTimeChange:n})]},r))]}),(0,ve.jsx)("button",{type:"button",tabIndex:-1,className:Te.done,"data-aia-time-done":"",onClick:()=>{i&&l()},children:t})]})}function qa({column:e,minutes:o,interactive:t,onTimeChange:i}){let n=(0,Pe.useRef)(null),l=(0,Pe.useRef)(null),r=(0,Pe.useRef)(null),c=(0,Pe.useRef)({minutes:o,interactive:t,onTimeChange:i});c.current={minutes:o,interactive:t,onTimeChange:i};let g=(0,le.timeWheelIndex)(e,o);(0,Pe.useLayoutEffect)(()=>{let m=n.current;if(!m||r.current)return;let p=g*le.TIME_WHEEL_ROW_HEIGHT;Math.abs(m.scrollTop-p)<1||(l.current=p,m.scrollTop=p)},[g]),(0,Pe.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let x=()=>{r.current=null;let m=n.current,p=c.current;if(!m||!p.interactive)return;let h=(0,le.timeWheelIndexFromScroll)(e,m.scrollTop);h!==(0,le.timeWheelIndex)(e,p.minutes)&&p.onTimeChange((0,le.withTimeWheelIndex)(e,p.minutes,h))},y=()=>{let m=n.current;if(m){if(l.current!=null&&Math.abs(m.scrollTop-l.current)<1){l.current=null;return}l.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(x,Ka)}};return(0,ve.jsx)("div",{ref:n,className:Te.column,"data-aia-time-column":e,onScroll:y,children:(0,le.timeWheelRows)(e).map((m,p)=>(0,ve.jsx)("div",{className:p===g?`${Te.row} ${Te.selected}`:Te.row,"data-aia-time-row":"","data-aia-index":p,onClick:()=>{c.current.interactive&&i((0,le.withTimeWheelIndex)(e,c.current.minutes,p))},children:m.label},m.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3122
3122
  display: flex;
3123
3123
  flex-direction: column;
3124
3124
  gap: var(--aia-stack-space, 0.5rem);
@@ -3133,7 +3133,7 @@
3133
3133
  align-items: end;
3134
3134
  }
3135
3135
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
3136
- `,document.head.appendChild(e)}var ra=require("react/jsx-runtime");function na({space:e,align:i="stretch",className:t,children:a,...o}){let r=e?{"--aia-stack-space":e}:void 0;return(0,ra.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":i,style:r,...o,children:a})}var q=require("react/jsx-runtime"),qa=[159,119,164],_a=()=>{},sa=()=>{},Ua=e=>{},Va=()=>{},Qa=e=>{},Ya=e=>{},ja=e=>{},$a=e=>{};function Za(e){let i=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,a]=(0,de.useState)(i);if((0,de.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>a(o.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Xa(e,i){let t=(0,de.useRef)(null);(0,de.useEffect)(()=>{let a=e.current,o=i.current;if(!a||!o)return;let r=a.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==r&&(t.current.controller.destroy(),t.current=null),r&&!t.current){t.current={grid:r,controller:(0,ce.attachScrollArrow)({dropdown:a,grid:r,button:o})};return}t.current?.controller.update()}),(0,de.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ja(e,i){let t=(0,de.useRef)(i);t.current=i;let a=(0,de.useRef)(null);(0,de.useEffect)(()=>{let o=e.current;if(o){if(!a.current){a.current=(0,ce.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}a.current.update()}}),(0,de.useEffect)(()=>()=>{a.current?.destroy(),a.current=null},[])}function St({suggestions:e,activeIndex:i,onSelect:t,onHighlight:a,onUnhighlight:o,isOpen:r,id:n,className:l,pills:f,onPillClick:x,showPills:y=!0,onSkip:m,showSkipButton:c=!0,showOptionIcons:p=!0,showOptionImages:v=!0,showOptionCounts:O=!0,skipDisabled:G=!1,activeSelected:N=!1,isLoading:U=!1,skeletonExiting:Z=!1,isInputEmpty:D=!1,language:E,products:S,onProductSelect:ee,onProductAddToCart:te,onProductFocusChange:V,productsLayout:K="row",productImageFallback:fe="image",formatType:I="options",dateView:X=null,selectedDateIso:h=null,selectedDateRange:A=null,dateRangeStart:He=null,onPreviousMonth:Je,onNextMonth:_e,timeView:b=null,multiSelectView:et=null,onMultiSelectCommit:Ue,onTimeChange:Ve,onTimeCommit:Qe,locationView:w=null,onLocationQuery:C,onLocationMove:T,onLocationCommit:L,onLocationFocusChange:z,isFocused:J=!1,optionsPosition:be="below",mode:we}){let Ie=Za(we),Ee=Ie!==void 0,ve=(0,de.useRef)(null),tt=(0,de.useRef)(null);Xa(ve,tt),(0,de.useEffect)(()=>{if(ve.current)return(0,ce.containScroll)(ve.current)},[]);let ct=e[0]?.options??[],Be=!!(f&&f.length>0&&x),at=!!(S&&S.length>0),nt=I==="time"&&b!=null,We=I==="location"&&w!=null,he=r&&(ct.length>0||y&&Be||U||at||nt||We);Ja(ve,he);let Ae={suggestions:e,activeIndex:i,pills:f,showPills:y,showSkipButton:c,showOptionIcons:p,showOptionImages:v,showOptionCounts:O,skipDisabled:G,activeSelected:N,isLoading:U,skeletonExiting:Z,isInputEmpty:D,products:S,formatType:I,dateView:X,selectedDateIso:h,selectedDateRange:A,dateRangeStart:He,timeView:b,multiSelectView:et,locationView:w},k=(0,de.useRef)(Ae);he&&(k.current=Ae);let u=he?Ae:k.current,ae=(0,ce.uiStringsFor)(E),Le=u.suggestions[0],g=Le?.options??[],rt=u.activeIndex>=0&&!!g[u.activeIndex]?.is_tappable,Ge=(0,ce.labelTraditionalAutocomplete)(u.pills??[],ae.keepTyping),Re=!!(Ge.length>0&&x),pt=u.showPills&&Re,ht=u.showPills&&!Re&&u.isLoading,Ke=pt||ht,st=Re&&(0,ce.hasSkippablePill)(Ge)&&u.showSkipButton&&!u.isInputEmpty&&!!m,ke=Ge[0]?.text,Oe=(0,ce.isCalendarFormat)(u.formatType)&&u.dateView!=null,Ye=g.length>0&&!Oe,it=g.length>0&&Oe&&!u.isLoading,lt=u.formatType==="time"&&u.timeView!=null&&!u.isLoading,je=u.formatType==="location"&&u.locationView!=null&&!u.isLoading,dt=u.isLoading&&!Ye&&!it&&!lt&&!je,d=u.products??[];return(0,q.jsxs)("div",{ref:ve,id:n,role:"listbox","aria-multiselectable":!!u.multiSelectView,"data-aia-dropdown":"","data-options-position":be,"data-mode":Ie,"data-aia-loading":u.isLoading?"":void 0,"data-aia-skeleton-exiting":u.skeletonExiting?"":void 0,"data-aia-has-products":d.length>0?"":void 0,className:`${Ee?"magicx-aia ":""}${De.dropdown} ${he?De.visible:""} ${l??""}`,onMouseDown:P=>P.preventDefault(),children:[(0,q.jsxs)(na,{space:"8px",children:[(Ke||st)&&(0,q.jsxs)(gt,{noWrap:!0,className:De.pillBar,"data-aia-pillbar":"",children:[Ke&&(0,q.jsx)("span",{className:De.pillScroll,"data-aia-pill-scroll":"",children:(0,q.jsx)(kt,{pills:Ge,activePillIndex:0,activeSelected:u.activeSelected,onSelectPill:x??(()=>{}),rounded:!0,loading:u.isLoading})}),st&&(0,q.jsx)("button",{type:"button",tabIndex:-1,className:De.skip,"data-aia-skip":"",disabled:u.isLoading||u.skipDisabled,"aria-label":ke?`${ae.skipLabel} ${ke}`:ae.skipLabel,onClick:m,children:ae.skip})]}),Ye&&(0,q.jsx)(ia,{options:g,activeIndex:u.activeIndex,onSelect:t,onHighlight:a,onUnhighlight:o,listboxId:n,loading:u.isLoading,groupKey:Le?`${Le.parameter} ${Le.text}`:"",optionsPosition:be,showIcons:u.showOptionIcons,showImages:u.showOptionImages,showCounts:u.showOptionCounts,picked:u.isLoading?void 0:u.multiSelectView?.picked}),u.multiSelectView&&!u.isLoading&&(0,q.jsx)("div",{onClick:P=>{P.target.closest("[data-aia-multi-done]")&&!u.skipDisabled&&Ue?.()},children:(0,q.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:De.multiDone,ref:P=>{P&&(P.disabled=!0,P.offsetHeight,P.disabled=u.skipDisabled)},children:ae.done})}),it&&u.dateView&&(0,q.jsx)(_t,{options:g,activeIndex:u.activeIndex,listboxId:n,view:u.dateView,selection:{selectedIso:u.selectedDateIso??null,selectedRange:u.selectedDateRange??null,rangeStart:u.dateRangeStart??null,floor:(0,ce.dateFloorFor)(u.formatType,u.dateRangeStart)},onSelect:t,onHighlight:a,onUnhighlight:o,onPreviousMonth:Je??sa,onNextMonth:_e??sa}),lt&&u.timeView&&(0,q.jsx)(oa,{view:u.timeView,label:ae.timeLabel,doneLabel:ae.done,interactive:!u.skipDisabled,onTimeChange:Ve??Ua,onTimeCommit:Qe??Va}),je&&u.locationView&&(0,q.jsx)(Yt,{view:u.locationView,searchLabel:ae.locationSearch,noResultsLabel:ae.locationNoResults,useTypedLabel:ae.locationUseTyped,widgetFocused:J&&he,visible:he,interactive:!u.skipDisabled,onQuery:C??Qa,onMove:T??Ya,onCommit:L??ja,onFocusChange:z??$a}),dt&&(0,q.jsx)("div",{className:De.skeletonBars,"data-aia-skeleton-bars":"",children:qa.map(P=>(0,q.jsx)("span",{className:De.skeletonBar,style:{width:P}},`bar-${P}`))}),(0,q.jsx)(Xt,{products:d,listboxId:n,onSelect:ee??_a,onAddToCart:te,onFocusChange:V,focusable:he,layout:K,imageFallback:fe,strings:ae}),(0,q.jsx)(Ut,{isOptionHighlighted:rt,isInputEmpty:u.isInputEmpty,strings:ae})]}),(0,q.jsx)("button",{ref:tt,type:"button",tabIndex:-1,className:De.scrollArrow,"data-aia-scroll-arrow":"","aria-label":ae.scrollArrow,"aria-hidden":"true",children:(0,q.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,q.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Fe=require("@magicx-eng/ai-autocomplete-vanilla");var da=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 {
3136
+ `,document.head.appendChild(e)}var sa=require("react/jsx-runtime");function ra({space:e,align:o="stretch",className:t,children:i,...n}){let l=e?{"--aia-stack-space":e}:void 0;return(0,sa.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":o,style:l,...n,children:i})}var K=require("react/jsx-runtime"),_a=[159,119,164],Ua=()=>{},la=()=>{},Va=e=>{},Qa=()=>{},Ya=e=>{},ja=e=>{},$a=e=>{},Za=e=>{};function Xa(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=(0,de.useState)(o);if((0,de.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>i(n.matches);return n.addEventListener("change",l),()=>n.removeEventListener("change",l)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Ja(e,o){let t=(0,de.useRef)(null);(0,de.useEffect)(()=>{let i=e.current,n=o.current;if(!i||!n)return;let l=i.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==l&&(t.current.controller.destroy(),t.current=null),l&&!t.current){t.current={grid:l,controller:(0,ce.attachScrollArrow)({dropdown:i,grid:l,button:n})};return}t.current?.controller.update()}),(0,de.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function ei(e,o){let t=(0,de.useRef)(o);t.current=o;let i=(0,de.useRef)(null);(0,de.useEffect)(()=>{let n=e.current;if(n){if(!i.current){i.current=(0,ce.attachViewportFit)({dropdown:n,isOpen:()=>t.current});return}i.current.update()}}),(0,de.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function Tt({suggestions:e,activeIndex:o,onSelect:t,onHighlight:i,onUnhighlight:n,isOpen:l,id:r,className:c,pills:g,onPillClick:x,showPills:y=!0,onSkip:m,showSkipButton:p=!0,showOptionIcons:h=!0,showOptionImages:v=!0,showOptionCounts:A=!0,skipDisabled:B=!1,activeSelected:R=!1,isLoading:_=!1,skeletonExiting:$=!1,isInputEmpty:O=!1,language:L,products:k,onProductSelect:ne,onProductAddToCart:Z,onProductFocusChange:re,productsLayout:W="row",productImageFallback:X="image",formatType:T="options",dateView:j=null,selectedDateIso:u=null,selectedDateRange:P=null,dateRangeStart:qe=null,onPreviousMonth:ze,onNextMonth:Je,timeView:Ne=null,multiSelectView:f=null,onMultiSelectCommit:et,onTimeChange:_e,onTimeCommit:Ue,locationView:b=null,onLocationQuery:C,onLocationMove:S,onLocationCommit:I,onLocationFocusChange:D,isFocused:J=!1,optionsPosition:be="below",mode:xe}){let ye=Xa(xe),tt=ye!==void 0,ue=(0,de.useRef)(null),Fe=(0,de.useRef)(null);Ja(ue,Fe),(0,de.useEffect)(()=>{if(ue.current)return(0,ce.containScroll)(ue.current)},[]);let st=e[0]?.options??[],ht=!!(g&&g.length>0&&x),He=!!(k&&k.length>0),at=T==="time"&&Ne!=null,lt=T==="location"&&b!=null,pe=l&&(st.length>0||y&&ht||_||He||at||lt);ei(ue,pe);let Ee={suggestions:e,activeIndex:o,pills:g,showPills:y,showSkipButton:p,showOptionIcons:h,showOptionImages:v,showOptionCounts:A,skipDisabled:B,activeSelected:R,isLoading:_,skeletonExiting:$,isInputEmpty:O,products:k,formatType:T,dateView:j,selectedDateIso:u,selectedDateRange:P,dateRangeStart:qe,timeView:Ne,multiSelectView:f,locationView:b},Be=(0,de.useRef)(Ee);pe&&(Be.current=Ee);let a=pe?Ee:Be.current,ee=(0,ce.uiStringsFor)(L),Ve=a.suggestions[0],ke=Ve?.options??[],w=a.activeIndex>=0&&!!ke[a.activeIndex]?.is_tappable,We=(0,ce.labelTraditionalAutocomplete)(a.pills??[],ee.keepTyping),Qe=!!(We.length>0&&x),Ye=a.showPills&&Qe,ut=a.showPills&&!Qe&&a.isLoading,dt=Ye||ut,Ge=Qe&&(0,ce.hasSkippablePill)(We)&&a.showSkipButton&&!a.isInputEmpty&&!!m,ct=We[0]?.text,Ce=(0,ce.isCalendarFormat)(a.formatType)&&a.dateView!=null,Ae=ke.length>0&&!Ce,je=ke.length>0&&Ce&&!a.isLoading,it=a.formatType==="time"&&a.timeView!=null&&!a.isLoading,pt=a.formatType==="location"&&a.locationView!=null&&!a.isLoading,ot=a.isLoading&&!Ae&&!je&&!it&&!pt,nt=a.products??[];return(0,K.jsxs)("div",{ref:ue,id:r,role:"listbox","aria-multiselectable":!!a.multiSelectView,"data-aia-dropdown":"","data-options-position":be,"data-mode":ye,"data-aia-loading":a.isLoading?"":void 0,"data-aia-skeleton-exiting":a.skeletonExiting?"":void 0,"data-aia-has-products":nt.length>0?"":void 0,className:`${tt?"magicx-aia ":""}${Le.dropdown} ${pe?Le.visible:""} ${c??""}`,onMouseDown:s=>s.preventDefault(),children:[(0,K.jsxs)(ra,{space:"8px",children:[(dt||Ge)&&(0,K.jsxs)(ft,{noWrap:!0,className:Le.pillBar,"data-aia-pillbar":"",children:[dt&&(0,K.jsx)("span",{className:Le.pillScroll,"data-aia-pill-scroll":"",children:(0,K.jsx)(Ct,{pills:We,activePillIndex:0,activeSelected:a.activeSelected,onSelectPill:x??(()=>{}),rounded:!0,loading:a.isLoading})}),Ge&&(0,K.jsx)("button",{type:"button",tabIndex:-1,className:Le.skip,"data-aia-skip":"",disabled:a.isLoading||a.skipDisabled,"aria-label":ct?`${ee.skipLabel} ${ct}`:ee.skipLabel,onClick:m,children:ee.skip})]}),Ae&&(0,K.jsx)(oa,{options:ke,activeIndex:a.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:n,listboxId:r,loading:a.isLoading,groupKey:Ve?`${Ve.parameter} ${Ve.text}`:"",optionsPosition:be,showIcons:a.showOptionIcons,showImages:a.showOptionImages,showCounts:a.showOptionCounts,picked:a.isLoading?void 0:a.multiSelectView?.picked}),a.multiSelectView&&!a.isLoading&&(0,K.jsx)("div",{onClick:s=>{s.target.closest("[data-aia-multi-done]")&&!a.skipDisabled&&et?.()},children:(0,K.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Le.multiDone,ref:s=>{s&&(s.disabled=!0,s.offsetHeight,s.disabled=a.skipDisabled)},children:ee.done})}),je&&a.dateView&&(0,K.jsx)(Ut,{options:ke,activeIndex:a.activeIndex,listboxId:r,view:a.dateView,selection:{selectedIso:a.selectedDateIso??null,selectedRange:a.selectedDateRange??null,rangeStart:a.dateRangeStart??null,floor:(0,ce.dateFloorFor)(a.formatType,a.dateRangeStart)},onSelect:t,onHighlight:i,onUnhighlight:n,onPreviousMonth:ze??la,onNextMonth:Je??la}),it&&a.timeView&&(0,K.jsx)(na,{view:a.timeView,label:ee.timeLabel,doneLabel:ee.done,interactive:!a.skipDisabled,onTimeChange:_e??Va,onTimeCommit:Ue??Qa}),pt&&a.locationView&&(0,K.jsx)(jt,{view:a.locationView,searchLabel:ee.locationSearch,noResultsLabel:ee.locationNoResults,useTypedLabel:ee.locationUseTyped,widgetFocused:J&&pe,visible:pe,interactive:!a.skipDisabled,onQuery:C??Ya,onMove:S??ja,onCommit:I??$a,onFocusChange:D??Za}),ot&&(0,K.jsx)("div",{className:Le.skeletonBars,"data-aia-skeleton-bars":"",children:_a.map(s=>(0,K.jsx)("span",{className:Le.skeletonBar,style:{width:s}},`bar-${s}`))}),(0,K.jsx)(Jt,{products:nt,listboxId:r,onSelect:ne??Ua,onAddToCart:Z,onFocusChange:re,focusable:pe,layout:W,imageFallback:X,strings:ee}),(0,K.jsx)(Vt,{isOptionHighlighted:w,isInputEmpty:a.isInputEmpty,strings:ee})]}),(0,K.jsx)("button",{ref:Fe,type:"button",tabIndex:-1,className:Le.scrollArrow,"data-aia-scroll-arrow":"","aria-label":ee.scrollArrow,"aria-hidden":"true",children:(0,K.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,K.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Me=require("@magicx-eng/ai-autocomplete-vanilla");var ca=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 {
3137
3137
  flex-shrink: 0;
3138
3138
  width: 32px;
3139
3139
  height: 32px;
@@ -3204,5 +3204,5 @@
3204
3204
  transition: none;
3205
3205
  }
3206
3206
  }
3207
- `,document.head.appendChild(e)}var la={submitButton:"aia-submitButton-otz7H"};var Tt=require("react/jsx-runtime");function ca({disabled:e,ready:i,onClick:t,label:a=(0,da.uiStringsFor)().submit}){return(0,Tt.jsx)("button",{type:"button","data-aia-submit":"",className:la.submitButton,disabled:e,"data-aia-ready":i?"":void 0,onClick:o=>{o.stopPropagation(),t()},"aria-label":a,children:(0,Tt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":a,children:(0,Tt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Xe=require("@magicx-eng/ai-autocomplete-vanilla"),R=require("react");var zt=require("react");function pa(e){let i=(0,zt.useRef)(e);i.current=e;let t=Object.keys(e??{}).sort().join("\0"),a=(0,zt.useRef)({key:"",overrides:void 0});if(a.current.key!==t){let o={};for(let r of Object.keys(e??{})){let n=(l,f,x)=>{let y=i.current?.[r];return y?y(l,f,x):[]};o[r]=n}a.current={key:t,overrides:e?o:void 0}}return{overrides:a.current.overrides,key:t}}var Nt=require("react");function ha(e){let i=(0,Nt.useRef)(e);i.current=e;let t=(0,Nt.useRef)(null);t.current===null&&(t.current={fetch:(o,r)=>{let n=i.current;return n?n.fetch(o,r):Promise.reject(new Error("products config removed"))},transform:o=>i.current?.transform(o)??[],get limit(){return i.current?.limit}});let a=e!==void 0;return{config:a?t.current:void 0,enabled:a}}var ua={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:"",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 Pt({onSubmit:e,onResult:i,onError:t,optionOverrides:a,maskCompletedText:o,apiConfig:r,additionalContext:n,language:l,currency:f,productId:x,visitorId:y,columns:m=2,dropdownTrigger:c,optionsPosition:p,closeDropdownOnBlur:v,showNonTappableOptions:O,locationSearch:G,showOptionIcons:N,showOptionImages:U,showOptionCounts:Z,showSkipButton:D,showProducts:E,productImageFallback:S="image",onFocus:ee,onBlur:te,value:V,completedParams:K,onChange:fe,onParamsChange:I,products:X,mapProducts:h,onProductSelect:A,onProductAddToCart:He,source:Je,setCursor:_e}){let b=(0,R.useRef)(null),[et,Ue]=(0,R.useState)(null),Ve=(0,R.useRef)(e);Ve.current=e;let Qe=(0,R.useRef)(i);Qe.current=i;let w=(0,R.useRef)(t);w.current=t;let C=(0,R.useRef)(fe);C.current=fe;let T=(0,R.useRef)(I);T.current=I;let L=(0,R.useRef)(ee);L.current=ee;let z=(0,R.useRef)(te);z.current=te;let J=(0,R.useRef)(_e);J.current=_e;let be=(0,R.useRef)(A);be.current=A;let we=(0,R.useRef)(He);we.current=He;let Ie=(0,R.useRef)(y);Ie.current=y;let Ee=(0,R.useRef)(()=>{let d=Ie.current;return typeof d=="function"?d():d}).current,ve=ha(X),tt=(0,R.useRef)(h);tt.current=h;let ct=(0,R.useRef)((d,P)=>{let B=tt.current;return B?B(d,P):d}).current,Be=h?ct:void 0,at=pa(a);(0,R.useEffect)(()=>{if(typeof document>"u")return;let d=new Xe.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:n,language:l,currency:f,productId:x,visitorId:Ee,optionOverrides:at.overrides,maskCompletedText:o,columns:m,dropdownTrigger:c,optionsPosition:p,closeDropdownOnBlur:v,showNonTappableOptions:O,locationSearch:G,showProducts:E,source:Je,value:V,completedParams:K,onSubmit:(...B)=>Ve.current?.(...B),onResult:(...B)=>Qe.current?.(...B),onError:(...B)=>w.current?.(...B),onChange:(...B)=>C.current?.(...B),onParamsChange:(...B)=>T.current?.(...B),onFocus:()=>L.current?.(),onBlur:()=>z.current?.(),onProductSelect:B=>be.current?.(B),onProductAddToCart:B=>we.current?.(B),setCursor:B=>J.current?.(B),products:ve.config,mapProducts:Be});b.current=d,Ue(d.getState());let P=d.subscribe(B=>Ue(B));return()=>{P(),d.destroy(),b.current===d&&(b.current=null)}},[]),(0,R.useEffect)(()=>{V!==void 0&&b.current?.setValue(V)},[V]),(0,R.useEffect)(()=>{K!==void 0&&b.current?.setCompletedParams(K)},[K]);let nt=JSON.stringify(r??null),We;try{We=JSON.stringify(n??null)}catch{We="[unstringifiable]"}(0,R.useEffect)(()=>{b.current?.update({apiConfig:r,additionalContext:n,language:l,currency:f,productId:x,optionOverrides:at.overrides,dropdownTrigger:c,optionsPosition:p,closeDropdownOnBlur:v,showNonTappableOptions:O,locationSearch:G,showProducts:E})},[nt,We,l,f?.code,f?.rate,f?.country,x,at.key,c,p,v,O,G,E]);let he=(0,R.useRef)(!1);(0,R.useEffect)(()=>{if(!he.current){he.current=!0;return}b.current?.update({products:ve.config})},[ve.enabled]),(0,R.useEffect)(()=>{b.current?.update({mapProducts:Be})},[Be]);let Ae=(0,R.useRef)(null);Ae.current===null&&(Ae.current={handleTextChange:d=>b.current?.handleTextChange(d),handleKeyDown:d=>{let P="nativeEvent"in d?d.nativeEvent:d;b.current?.handleKeyDown(P)},setFocused:d=>b.current?.setFocused(d),startEditingParam:d=>b.current?.startEditingParam(d),exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:d=>b.current?.handleCaretAfterInput(d),handleCaretMove:d=>b.current?.handleCaretMove(d),replaceEditingRange:d=>b.current?.replaceEditingRange(d)??!1,setActivePill:d=>b.current?.setActivePill(d),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()??ua,recordSubmit:d=>b.current?.recordSubmit(d),selectOption:(d,P)=>b.current?.selectOption(d,P),selectProduct:d=>b.current?.selectProduct(d),addProductToCart:d=>{let P=b.current;return!P||!we.current?Promise.resolve():P.addProductToCart(d)},setActiveDropdownIndex:d=>b.current?.setActiveDropdownIndex(d),clearHighlight:d=>b.current?.clearHighlight(d),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:d=>b.current?.setTime(d),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:d=>b.current?.toggleMultiSelectOption(d),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:d=>b.current?.setLocationQuery(d),moveLocationHighlight:d=>b.current?.moveLocationHighlight(d),commitLocation:d=>b.current?.commitLocation(d),setLocationFieldFocused:d=>b.current?.setLocationFieldFocused(d),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let k=Ae.current,u=(0,R.useCallback)(d=>{let P=d.target.value,wt=P.length>0&&!d.nativeEvent?.isComposing&&P[0]!==P[0].toUpperCase()?P[0].toUpperCase()+P.slice(1):P;b.current?.handleTextChange(wt)},[]),ae=(0,R.useCallback)(d=>{b.current?.handleKeyDown(d.nativeEvent)},[]),Le=b.current,g=et??ua,rt=V!==void 0?V:g.text,Ge=K!==void 0?K:g.completedParams,Re=g.actionableSuggestions,pt=Re[0],ht=(0,Xe.withoutTraditionalAutocomplete)(Re),Ke=Le?.listboxId??"",st=g.activeDropdownIndex>=0&&Le?`${Ke}-option-${g.activeDropdownIndex}`:void 0,ke=g.editingParam,Oe=g.editingIdentified,Ye=ke?{parameter:ke.suggestionParameter,text:ke.suggestionPlaceholder,required:!0,options:ke.options}:Oe?{parameter:Oe.parameter,text:(0,Xe.identifiedParamLabel)(Oe.parameter),required:!0,options:[]}:null,it=g.dropdownSuggestion??Ye??pt,lt=Ye?[Ye]:Re,je=(0,Xe.dateSelectionFor)(g),dt=!Le||g.dropdownLoading;return{completedParams:Ge,multiSelectView:g.multiSelectView,toggleMultiSelectOption:k.toggleMultiSelectOption,commitMultiSelect:k.commitMultiSelect,skippedParams:g.skippedParams,identifiedParams:g.identifiedParams,suggestionPills:ht,setActivePill:k.setActivePill,skipActivePill:k.skipActivePill,removeLastParam:k.removeLastParam,segments:g.segments,newParamId:g.newParamId,clearNewParamId:k.clearNewParamId,suggestions:g.suggestions,activeIndex:g.activeDropdownIndex,isReady:g.isReady,isLoading:dt,isFocused:g.isFocused,isDropdownOpen:g.isDropdownOpen,isActivePillSelected:g.isActivePillSelected,placeholderText:g.placeholderText,listboxId:Ke,error:g.error,products:g.products,customFields:g.customFields,selectProduct:k.selectProduct,addProductToCart:k.addProductToCart,handleTextChange:k.handleTextChange,handleKeyDown:k.handleKeyDown,setFocused:k.setFocused,editingParam:ke,editingIdentified:Oe,editingAnchor:g.editingAnchor,caretOffset:g.caretOffset,startEditingParam:k.startEditingParam,exitEditMode:k.exitEditMode,handleCaretAfterInput:k.handleCaretAfterInput,handleCaretMove:k.handleCaretMove,replaceEditingRange:k.replaceEditingRange,inputProps:{value:rt,placeholder:g.placeholderText||void 0,onChange:u,onKeyDown:ae,onFocus:k.handleFocus,onBlur:k.handleBlur,role:"combobox","aria-expanded":g.isDropdownOpen,"aria-activedescendant":st,"aria-autocomplete":"list","aria-controls":Ke},reset:k.reset,refreshProducts:k.refreshProducts,prepareSubmit:k.prepareSubmit,getState:k.getState,recordSubmit:k.recordSubmit,dropdownProps:{suggestions:it?[{...it,options:g.dropdownOptions}]:[],activeIndex:g.activeDropdownIndex,onSelect:k.selectOption,onHighlight:k.setActiveDropdownIndex,onUnhighlight:k.clearHighlight,isOpen:g.isDropdownOpen,id:Ke,pills:lt,activeSelected:g.isActivePillSelected,onPillClick:k.setActivePill,onSkip:k.skipActivePill,showSkipButton:(D??!0)&&!ke&&!Oe,showOptionIcons:N??!0,showOptionImages:U??!0,showOptionCounts:Z??!0,skipDisabled:g.inSelectionAnimation,isLoading:dt,skeletonExiting:g.skeletonExiting,isInputEmpty:rt.trim().length===0,language:l,products:g.products,productImageFallback:S,onProductSelect:k.selectProduct,onProductAddToCart:He?k.addProductToCart:void 0,onProductFocusChange:k.setFocused,formatType:g.activeFormatType,dateView:g.dateView,selectedDateIso:je.selectedIso,selectedDateRange:je.selectedRange,dateRangeStart:je.rangeStart,onPreviousMonth:k.showPreviousMonth,onNextMonth:k.showNextMonth,timeView:g.timeView,multiSelectView:g.multiSelectView,onMultiSelectCommit:k.commitMultiSelect,onTimeChange:k.setTime,onTimeCommit:k.commitTime,locationView:g.locationView,onLocationQuery:k.setLocationQuery,onLocationMove:k.moveLocationHighlight,onLocationCommit:k.commitLocation,onLocationFocusChange:k.setLocationFieldFocused,isFocused:g.isFocused||g.locationFieldFocused,optionsPosition:p??"below"}}}var re=require("@magicx-eng/ai-autocomplete-vanilla"),M=require("react"),It;function ei(){if(It!==void 0)return It;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),It=e.contentEditable==="plaintext-only",It}function ma(e){let{segments:i,showChipIcons:t=!0,showChipImages:a=!0,newParamId:o,editingParam:r,editingIdentified:n,editingAnchor:l,caretOffset:f,placeholderText:x,isFocused:y,isDropdownOpen:m,listboxId:c,activeDescendantId:p,autoFocus:v,handleTextChange:O,handleKeyDown:G,handleCaretAfterInput:N,handleCaretMove:U,startEditingParam:Z,replaceEditingRange:D,setFocused:E}=e,S=(0,M.useRef)(null),ee=(0,M.useRef)(!1),te=(0,M.useRef)(""),V=(0,M.useRef)(""),K=(0,M.useRef)(null),fe=(0,M.useRef)(0);K.current=f,(0,M.useEffect)(()=>{if(!v)return;let w=S.current;if(!w)return;document.activeElement===w?E(!0):w.focus();let C=w.ownerDocument??document,T=C.getSelection(),L=T&&T.rangeCount>0&&w.contains(T.anchorNode);if(T&&!L){let z=C.createRange();z.selectNodeContents(w),z.collapse(!0),T.removeAllRanges(),T.addRange(z)}},[v,E]),(0,M.useEffect)(()=>{let w=S.current;if(!w)return;let C=w.ownerDocument??document,T=()=>{let L=C.getSelection();if(!L||L.rangeCount===0||!L.anchorNode||!w.contains(L.anchorNode))return;let z=L.anchorNode,J=z.nodeType===Node.ELEMENT_NODE?z:z.parentElement,we=(L.isCollapsed?J?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Ie=r?.id??n?.id??null;if(we&&we!==Ie){Z(we);return}performance.now()-fe.current<50||U((0,re.getCursorOffset)(w))};return C.addEventListener("selectionchange",T),()=>C.removeEventListener("selectionchange",T)},[r,n,Z,U]),(0,M.useEffect)(()=>{let w=S.current;if(!w)return;let C=T=>{let L=(0,re.chipIdFromTap)(w,T.target);L&&(Z(L),(0,re.keepCaretOnChip)(w,L))};return w.addEventListener("click",C),()=>w.removeEventListener("click",C)},[Z]),(0,M.useLayoutEffect)(()=>{let w=S.current;w&&(0,re.renderEditableContent)({input:w,segments:i,newParamId:o,editingParamId:r?.id??null,placeholderText:x??"",isFocused:y,showChipIcons:t,showChipImages:a})},[i,o,r,x,y,t,a]),(0,M.useLayoutEffect)(()=>{let w=te.current,C=o??"";if(te.current=C,!C||C===w)return;let T=S.current;if(!T)return;T.focus();let L=K.current??(0,re.plainTextLength)(T);(0,re.setCursorOffset)(T,L)},[o]),(0,M.useLayoutEffect)(()=>{let w=V.current,C=r?.id??"";if(V.current=C,!C||C===w||l==null)return;let T=S.current;T&&(0,re.setCursorOffset)(T,l)},[r,l]);let I=(0,M.useCallback)(()=>{if(ee.current)return;let w=S.current;if(!w)return;let C=(0,re.extractPlainText)(w),L=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;O(L)},[O]),X=(0,M.useCallback)(()=>{fe.current=performance.now(),I();let w=S.current;w&&N((0,re.getCursorOffset)(w))},[I,N]);(0,M.useEffect)(()=>{let w=S.current;if(!w)return;let C=T=>{let L=T,z=L.inputType;if(z==="insertParagraph"||z==="insertLineBreak"||z==="insertFromDrop"){T.preventDefault();return}if(z.startsWith("insert")||z.startsWith("delete")){let J=z.startsWith("delete")?"":L.data??"";D(J)&&T.preventDefault()}};return w.addEventListener("beforeinput",C),()=>w.removeEventListener("beforeinput",C)},[D]);let h=(0,M.useCallback)(()=>{ee.current=!0,S.current?.setAttribute("data-aia-composing","true")},[]),A=(0,M.useCallback)(()=>{ee.current=!1,S.current?.removeAttribute("data-aia-composing"),I()},[I]),He=(0,M.useCallback)(w=>{w.preventDefault();let C=S.current;if(!C)return;let T=(w.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!T)return;let L=C.ownerDocument??document,z=L.getSelection();if(!z||z.rangeCount===0)return;let J=z.getRangeAt(0);if(!C.contains(J.startContainer))return;J.deleteContents();let be=L.createTextNode(T);J.insertNode(be),J.setStartAfter(be),J.collapse(!0),z.removeAllRanges(),z.addRange(J),I()},[I]),Je=(0,M.useCallback)(w=>G(w),[G]),_e=(0,M.useCallback)(()=>E(!0),[E]),b=(0,M.useCallback)(()=>E(!1),[E]),et=(0,M.useCallback)(()=>S.current?.focus(),[]),Ue=(0,M.useCallback)(()=>S.current?.blur(),[]),Ve=(0,M.useCallback)(()=>{let w=S.current;return w?(0,re.extractPlainText)(w):""},[]),Qe=ei()?"plaintext-only":"true";return{inputRef:S,editorProps:{ref:S,contentEditable:Qe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":c,"aria-expanded":m,"aria-activedescendant":p,spellCheck:!0,enterKeyHint:"send",onInput:X,onKeyDown:Je,onCompositionStart:h,onCompositionEnd:A,onPaste:He,onFocus:_e,onBlur:b},getPlainText:Ve,focus:et,blur:Ue}}var Pe=require("react/jsx-runtime");function ti(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var ga=(0,_.forwardRef)(function({onSubmit:i,onResult:t,onError:a,optionOverrides:o,maskCompletedText:r,className:n,apiConfig:l,additionalContext:f,language:x,currency:y,productId:m,visitorId:c,columns:p,pillPlacement:v="dropdown",mode:O="auto",optionsPosition:G="below",animations:N=!0,dropdownTrigger:U,closeDropdownOnBlur:Z,showNonTappableOptions:D,locationSearch:E,showOptionIcons:S=!0,showChipIcons:ee=!0,showChipImages:te=!0,showOptionImages:V=!0,showOptionCounts:K=!0,showSkipButton:fe,showProducts:I,productsLayout:X,productImageFallback:h,autoFocus:A=!0,onFocus:He,onBlur:Je,value:_e,completedParams:b,onChange:et,onParamsChange:Ue,products:Ve,mapProducts:Qe,onProductSelect:w,onProductAddToCart:C,submitButton:T,resetOnSubmit:L=!0},z){let J=(0,_.useRef)(null),be=(0,_.useRef)(null),we=(0,_.useRef)(null),Ie=(0,_.useRef)(()=>{}),Ee=(0,_.useRef)(null),ve=(0,_.useRef)(null);(0,_.useEffect)(()=>{let F=J.current;if(F)return Ee.current?Ee.current.setMode(O):Ee.current=new Fe.ModeController(F,O),()=>{Ee.current?.destroy(),Ee.current=null}},[O]);let tt=(0,_.useCallback)(F=>{let ue=ve.current?.current;ue&&(ue.focus(),(0,Fe.setCursorOffset)(ue,F))},[]),{completedParams:ct,suggestionPills:Be,setActivePill:at,skipActivePill:nt,segments:We,newParamId:he,clearNewParamId:Ae,placeholderText:k,isFocused:u,isDropdownOpen:ae,isActivePillSelected:Le,isLoading:g,isReady:rt,activeIndex:Ge,listboxId:Re,handleTextChange:pt,handleKeyDown:ht,setFocused:Ke,editingParam:st,editingIdentified:ke,editingAnchor:Oe,caretOffset:Ye,startEditingParam:it,handleCaretAfterInput:lt,handleCaretMove:je,replaceEditingRange:dt,dropdownProps:d,reset:P,refreshProducts:B,prepareSubmit:wt,getState:Ft,recordSubmit:Ht}=Pt({onSubmit:F=>Ie.current(F),onResult:t,onError:a,optionOverrides:o,maskCompletedText:r,apiConfig:l,additionalContext:f,language:x,currency:y,productId:m,visitorId:c,columns:p,dropdownTrigger:U,optionsPosition:G,closeDropdownOnBlur:Z,showNonTappableOptions:D,locationSearch:E,showOptionIcons:S,showOptionImages:V,showOptionCounts:K,showSkipButton:fe,showProducts:I,onFocus:He,onBlur:Je,value:_e,completedParams:b,onChange:et,onParamsChange:Ue,products:Ve,mapProducts:Qe,onProductSelect:w,onProductAddToCart:C,source:"full-sdk",setCursor:tt});(0,_.useEffect)(()=>{if(!he)return;let F=window.setTimeout(()=>Ae(),650);return()=>window.clearTimeout(F)},[he,Ae]);let fa=Ge>=0?`${Re}-option-${Ge}`:void 0,{inputRef:Et,editorProps:ba,focus:vt,blur:Bt,getPlainText:Wt}=ma({segments:We,newParamId:he,editingParam:st,editingIdentified:ke,editingAnchor:Oe,caretOffset:Ye,placeholderText:k,isFocused:u,showChipIcons:ee,showChipImages:te,isDropdownOpen:ae,listboxId:Re,activeDescendantId:fa,autoFocus:A,handleTextChange:pt,handleKeyDown:ht,handleCaretAfterInput:lt,handleCaretMove:je,startEditingParam:it,replaceEditingRange:dt,setFocused:Ke});ve.current=Et,(0,_.useLayoutEffect)(()=>{let F=be.current,ue=Et.current;if(!F||!ue)return;let mt=()=>{let Kt=F.firstElementChild;if(!Kt)return;let ya=Kt.getBoundingClientRect(),ka=ue.getBoundingClientRect();ya.top>=ka.bottom-2?F.setAttribute("data-aia-pill-wrapped",""):F.removeAttribute("data-aia-pill-wrapped")};mt();let Gt=new ResizeObserver(mt);return Gt.observe(ue),()=>Gt.disconnect()},[We,Be.length,g,Et]),(0,_.useEffect)(()=>{let F=we.current;if(F)return(0,Fe.watchEditorHeight)(F)},[]),(0,_.useImperativeHandle)(z,()=>({focus:vt,blur:Bt,reset:P,refreshProducts:B,setMode:F=>Ee.current?.setMode(F),skipActivePill:nt}),[vt,Bt,P,B,nt]);let ut=!!We.length||ct.length>0,At=(0,_.useCallback)(F=>{if(!ut)return;F&&wt();let ue=Ft(),mt=(0,Fe.buildSubmitResult)(Wt(),ue.completedParams,ue.skippedParams,{identifiedParams:ue.identifiedParams,isReady:ue.isReady,customFields:ue.customFields});F&&Ht(mt),i(mt),L&&P()},[Ht,L,ut,wt,Ft,i,P,Wt]);Ie.current=()=>At(!1);let wa=(0,_.useCallback)(F=>{F.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||vt()},[vt]),va=v==="inline",xa=v==="dropdown";return(0,Pe.jsxs)("div",{ref:J,className:`magicx-aia ${ot.container} ${n??""}`,"data-pill-placement":v,"data-options-position":G,"data-animations":N?"on":"off","data-mode":ti(O),children:[(0,Pe.jsx)(St,{...d,showPills:xa,productsLayout:X,productImageFallback:h}),(0,Pe.jsxs)("div",{className:ot.inputWrapper,"data-aia-input-wrapper":"",onClick:wa,children:[(0,Pe.jsxs)("div",{ref:we,className:ot.editorArea,"data-aia-editor":"",children:[(0,Pe.jsx)("div",{...ba,className:ot.input,"data-aia-input":""}),va&&(g||Be.length>0)&&(0,Pe.jsx)("span",{ref:be,className:ot.pillListContainer,"data-aia-pill-list-container":"",children:(0,Pe.jsx)(kt,{pills:Be,activePillIndex:0,activeSelected:Le,onSelectPill:at,loading:g})})]}),T===null?null:T===void 0?(0,Pe.jsx)(ca,{disabled:!ut,ready:ut&&rt,onClick:()=>At(!0),label:(0,Fe.uiStringsFor)(x).submit}):(0,Pe.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:ot.submitSlot,onClick:F=>{ut&&(F.stopPropagation(),At(!0))},children:T})]})]})});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});
3207
+ `,document.head.appendChild(e)}var da={submitButton:"aia-submitButton-otz7H"};var Pt=require("react/jsx-runtime");function pa({disabled:e,ready:o,onClick:t,label:i=(0,ca.uiStringsFor)().submit}){return(0,Pt.jsx)("button",{type:"button","data-aia-submit":"",className:da.submitButton,disabled:e,"data-aia-ready":o?"":void 0,onClick:n=>{n.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 Xe=require("@magicx-eng/ai-autocomplete-vanilla"),E=require("react");var Nt=require("react");function ha(e){let o=(0,Nt.useRef)(e);o.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,Nt.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let n={};for(let l of Object.keys(e??{})){let r=(c,g,x)=>{let y=o.current?.[l];return y?y(c,g,x):[]};n[l]=r}i.current={key:t,overrides:e?n:void 0}}return{overrides:i.current.overrides,key:t}}var Ft=require("react");function ua(e){let o=(0,Ft.useRef)(e);o.current=e;let t=(0,Ft.useRef)(null);t.current===null&&(t.current={fetch:(n,l)=>{let r=o.current;return r?r.fetch(n,l):Promise.reject(new Error("products config removed"))},transform:n=>o.current?.transform(n)??[],get limit(){return o.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var ma={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:o,onError:t,optionOverrides:i,maskCompletedText:n,apiConfig:l,additionalContext:r,language:c,currency:g,productId:x,visitorId:y,columns:m=2,dropdownTrigger:p,optionsPosition:h,closeDropdownOnBlur:v,prependPlaceholder:A,showNonTappableOptions:B,locationSearch:R,showOptionIcons:_,showOptionImages:$,showOptionCounts:O,showSkipButton:L,showProducts:k,productImageFallback:ne="image",onFocus:Z,onBlur:re,value:W,completedParams:X,onChange:T,onParamsChange:j,products:u,mapProducts:P,onProductSelect:qe,onProductAddToCart:ze,source:Je,setCursor:Ne}){let f=(0,E.useRef)(null),[et,_e]=(0,E.useState)(null),Ue=(0,E.useRef)(e);Ue.current=e;let b=(0,E.useRef)(o);b.current=o;let C=(0,E.useRef)(t);C.current=t;let S=(0,E.useRef)(T);S.current=T;let I=(0,E.useRef)(j);I.current=j;let D=(0,E.useRef)(Z);D.current=Z;let J=(0,E.useRef)(re);J.current=re;let be=(0,E.useRef)(Ne);be.current=Ne;let xe=(0,E.useRef)(qe);xe.current=qe;let ye=(0,E.useRef)(ze);ye.current=ze;let tt=(0,E.useRef)(y);tt.current=y;let ue=(0,E.useRef)(()=>{let s=tt.current;return typeof s=="function"?s():s}).current,Fe=ua(u),st=(0,E.useRef)(P);st.current=P;let ht=(0,E.useRef)((s,G)=>{let F=st.current;return F?F(s,G):s}).current,He=P?ht:void 0,at=ha(i);(0,E.useEffect)(()=>{if(typeof document>"u")return;let s=new Xe.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:l,additionalContext:r,language:c,currency:g,productId:x,visitorId:ue,optionOverrides:at.overrides,maskCompletedText:n,columns:m,dropdownTrigger:p,optionsPosition:h,closeDropdownOnBlur:v,prependPlaceholder:A,showNonTappableOptions:B,locationSearch:R,showProducts:k,source:Je,value:W,completedParams:X,onSubmit:(...F)=>Ue.current?.(...F),onResult:(...F)=>b.current?.(...F),onError:(...F)=>C.current?.(...F),onChange:(...F)=>S.current?.(...F),onParamsChange:(...F)=>I.current?.(...F),onFocus:()=>D.current?.(),onBlur:()=>J.current?.(),onProductSelect:F=>xe.current?.(F),onProductAddToCart:F=>ye.current?.(F),setCursor:F=>be.current?.(F),products:Fe.config,mapProducts:He});f.current=s,_e(s.getState());let G=s.subscribe(F=>_e(F));return()=>{G(),s.destroy(),f.current===s&&(f.current=null)}},[]),(0,E.useEffect)(()=>{W!==void 0&&f.current?.setValue(W)},[W]),(0,E.useEffect)(()=>{X!==void 0&&f.current?.setCompletedParams(X)},[X]);let lt=JSON.stringify(l??null),pe;try{pe=JSON.stringify(r??null)}catch{pe="[unstringifiable]"}(0,E.useEffect)(()=>{f.current?.update({apiConfig:l,additionalContext:r,language:c,currency:g,productId:x,optionOverrides:at.overrides,dropdownTrigger:p,optionsPosition:h,closeDropdownOnBlur:v,prependPlaceholder:A,showNonTappableOptions:B,locationSearch:R,showProducts:k})},[lt,pe,c,g?.code,g?.rate,g?.country,x,at.key,p,h,v,A,B,R,k]);let Ee=(0,E.useRef)(!1);(0,E.useEffect)(()=>{if(!Ee.current){Ee.current=!0;return}f.current?.update({products:Fe.config})},[Fe.enabled]),(0,E.useEffect)(()=>{f.current?.update({mapProducts:He})},[He]);let Be=(0,E.useRef)(null);Be.current===null&&(Be.current={handleTextChange:s=>f.current?.handleTextChange(s),handleKeyDown:s=>{let G="nativeEvent"in s?s.nativeEvent:s;f.current?.handleKeyDown(G)},setFocused:s=>f.current?.setFocused(s),startEditingParam:s=>f.current?.startEditingParam(s),exitEditMode:()=>f.current?.exitEditMode(),handleCaretAfterInput:s=>f.current?.handleCaretAfterInput(s),handleCaretMove:s=>f.current?.handleCaretMove(s),replaceEditingRange:s=>f.current?.replaceEditingRange(s)??!1,setActivePill:s=>f.current?.setActivePill(s),skipActivePill:()=>f.current?.skipActivePill(),removeLastParam:()=>f.current?.removeLastParam(),clearNewParamId:()=>f.current?.clearNewParamId(),reset:()=>f.current?.reset(),refreshProducts:()=>f.current?.refreshProducts(),prepareSubmit:()=>f.current?.prepareSubmit(),getState:()=>f.current?.getState()??ma,recordSubmit:s=>f.current?.recordSubmit(s),selectOption:(s,G)=>f.current?.selectOption(s,G),selectProduct:s=>f.current?.selectProduct(s),addProductToCart:s=>{let G=f.current;return!G||!ye.current?Promise.resolve():G.addProductToCart(s)},setActiveDropdownIndex:s=>f.current?.setActiveDropdownIndex(s),clearHighlight:s=>f.current?.clearHighlight(s),showPreviousMonth:()=>f.current?.showPreviousMonth(),showNextMonth:()=>f.current?.showNextMonth(),setTime:s=>f.current?.setTime(s),commitTime:()=>f.current?.commitTime(),toggleMultiSelectOption:s=>f.current?.toggleMultiSelectOption(s),commitMultiSelect:()=>f.current?.commitMultiSelect(),setLocationQuery:s=>f.current?.setLocationQuery(s),moveLocationHighlight:s=>f.current?.moveLocationHighlight(s),commitLocation:s=>f.current?.commitLocation(s),setLocationFieldFocused:s=>f.current?.setLocationFieldFocused(s),handleFocus:()=>f.current?.setFocused(!0),handleBlur:()=>f.current?.setFocused(!1)});let a=Be.current,ee=(0,E.useCallback)(s=>{let G=s.target.value,vt=G.length>0&&!s.nativeEvent?.isComposing&&G[0]!==G[0].toUpperCase()?G[0].toUpperCase()+G.slice(1):G;f.current?.handleTextChange(vt)},[]),Ve=(0,E.useCallback)(s=>{f.current?.handleKeyDown(s.nativeEvent)},[]),ke=f.current,w=et??ma,We=W!==void 0?W:w.text,Qe=X!==void 0?X:w.completedParams,Ye=w.actionableSuggestions,ut=Ye[0],dt=(0,Xe.withoutTraditionalAutocomplete)(Ye),Ge=ke?.listboxId??"",ct=w.activeDropdownIndex>=0&&ke?`${Ge}-option-${w.activeDropdownIndex}`:void 0,Ce=w.editingParam,Ae=w.editingIdentified,je=Ce?{parameter:Ce.suggestionParameter,text:Ce.suggestionPlaceholder,required:!0,options:Ce.options}:Ae?{parameter:Ae.parameter,text:(0,Xe.identifiedParamLabel)(Ae.parameter),required:!0,options:[]}:null,it=w.dropdownSuggestion??je??ut,pt=je?[je]:Ye,ot=(0,Xe.dateSelectionFor)(w),nt=!ke||w.dropdownLoading;return{completedParams:Qe,multiSelectView:w.multiSelectView,toggleMultiSelectOption:a.toggleMultiSelectOption,commitMultiSelect:a.commitMultiSelect,skippedParams:w.skippedParams,identifiedParams:w.identifiedParams,suggestionPills:dt,setActivePill:a.setActivePill,skipActivePill:a.skipActivePill,removeLastParam:a.removeLastParam,segments:w.segments,newParamId:w.newParamId,clearNewParamId:a.clearNewParamId,suggestions:w.suggestions,activeIndex:w.activeDropdownIndex,isReady:w.isReady,isLoading:nt,isFocused:w.isFocused,isDropdownOpen:w.isDropdownOpen,isActivePillSelected:w.isActivePillSelected,placeholderText:w.placeholderText,listboxId:Ge,error:w.error,products:w.products,customFields:w.customFields,selectProduct:a.selectProduct,addProductToCart:a.addProductToCart,handleTextChange:a.handleTextChange,handleKeyDown:a.handleKeyDown,setFocused:a.setFocused,editingParam:Ce,editingIdentified:Ae,editingAnchor:w.editingAnchor,caretOffset:w.caretOffset,startEditingParam:a.startEditingParam,exitEditMode:a.exitEditMode,handleCaretAfterInput:a.handleCaretAfterInput,handleCaretMove:a.handleCaretMove,replaceEditingRange:a.replaceEditingRange,inputProps:{value:We,placeholder:w.placeholderText||void 0,onChange:ee,onKeyDown:Ve,onFocus:a.handleFocus,onBlur:a.handleBlur,role:"combobox","aria-expanded":w.isDropdownOpen,"aria-activedescendant":ct,"aria-autocomplete":"list","aria-controls":Ge},reset:a.reset,refreshProducts:a.refreshProducts,prepareSubmit:a.prepareSubmit,getState:a.getState,recordSubmit:a.recordSubmit,dropdownProps:{suggestions:it?[{...it,options:w.dropdownOptions}]:[],activeIndex:w.activeDropdownIndex,onSelect:a.selectOption,onHighlight:a.setActiveDropdownIndex,onUnhighlight:a.clearHighlight,isOpen:w.isDropdownOpen,id:Ge,pills:pt,activeSelected:w.isActivePillSelected,onPillClick:a.setActivePill,onSkip:a.skipActivePill,showSkipButton:(L??!0)&&!Ce&&!Ae,showOptionIcons:_??!0,showOptionImages:$??!0,showOptionCounts:O??!0,skipDisabled:w.inSelectionAnimation,isLoading:nt,skeletonExiting:w.skeletonExiting,isInputEmpty:We.trim().length===0,language:c,products:w.products,productImageFallback:ne,onProductSelect:a.selectProduct,onProductAddToCart:ze?a.addProductToCart:void 0,onProductFocusChange:a.setFocused,formatType:w.activeFormatType,dateView:w.dateView,selectedDateIso:ot.selectedIso,selectedDateRange:ot.selectedRange,dateRangeStart:ot.rangeStart,onPreviousMonth:a.showPreviousMonth,onNextMonth:a.showNextMonth,timeView:w.timeView,multiSelectView:w.multiSelectView,onMultiSelectCommit:a.commitMultiSelect,onTimeChange:a.setTime,onTimeCommit:a.commitTime,locationView:w.locationView,onLocationQuery:a.setLocationQuery,onLocationMove:a.moveLocationHighlight,onLocationCommit:a.commitLocation,onLocationFocusChange:a.setLocationFieldFocused,isFocused:w.isFocused||w.locationFieldFocused,optionsPosition:h??"below"}}}var oe=require("@magicx-eng/ai-autocomplete-vanilla"),M=require("react"),Et;function ti(){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 ga(e){let{segments:o,showChipIcons:t=!0,showChipImages:i=!0,newParamId:n,editingParam:l,editingIdentified:r,editingAnchor:c,caretOffset:g,placeholderText:x,isFocused:y,isDropdownOpen:m,listboxId:p,activeDescendantId:h,autoFocus:v,handleTextChange:A,handleKeyDown:B,handleCaretAfterInput:R,handleCaretMove:_,startEditingParam:$,replaceEditingRange:O,setFocused:L}=e,k=(0,M.useRef)(null),ne=(0,M.useRef)(!1),Z=(0,M.useRef)(""),re=(0,M.useRef)(""),W=(0,M.useRef)(null),X=(0,M.useRef)(0);W.current=g,(0,M.useEffect)(()=>{if(!v)return;let b=k.current;if(!b)return;document.activeElement===b?L(!0):b.focus();let C=b.ownerDocument??document,S=C.getSelection(),I=S&&S.rangeCount>0&&b.contains(S.anchorNode);if(S&&!I){let D=C.createRange();D.selectNodeContents(b),D.collapse(!0),S.removeAllRanges(),S.addRange(D)}},[v,L]),(0,M.useEffect)(()=>{let b=k.current;if(!b)return;let C=b.ownerDocument??document,S=()=>{let I=C.getSelection();if(!I||I.rangeCount===0||!I.anchorNode||!b.contains(I.anchorNode))return;let D=I.anchorNode,J=D.nodeType===Node.ELEMENT_NODE?D:D.parentElement,xe=(I.isCollapsed?J?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ye=l?.id??r?.id??null;if(xe&&xe!==ye){$(xe);return}performance.now()-X.current<50||_((0,oe.getCursorOffset)(b))};return C.addEventListener("selectionchange",S),()=>C.removeEventListener("selectionchange",S)},[l,r,$,_]),(0,M.useEffect)(()=>{let b=k.current;if(!b)return;let C=S=>{let I=(0,oe.chipIdFromTap)(b,S.target);I&&($(I),(0,oe.keepCaretOnChip)(b,I))};return b.addEventListener("click",C),()=>b.removeEventListener("click",C)},[$]),(0,M.useLayoutEffect)(()=>{let b=k.current;b&&(0,oe.renderEditableContent)({input:b,segments:o,newParamId:n,editingParamId:l?.id??null,placeholderText:x??"",isFocused:y,showChipIcons:t,showChipImages:i})},[o,n,l,x,y,t,i]),(0,M.useLayoutEffect)(()=>{let b=Z.current,C=n??"";if(Z.current=C,!C||C===b)return;let S=k.current;if(!S)return;S.focus();let I=W.current??(0,oe.plainTextLength)(S);(0,oe.setCursorOffset)(S,I)},[n]),(0,M.useLayoutEffect)(()=>{let b=re.current,C=l?.id??"";if(re.current=C,!C||C===b||c==null)return;let S=k.current;S&&(0,oe.setCursorOffset)(S,c)},[l,c]);let T=(0,M.useCallback)(()=>{if(ne.current)return;let b=k.current;if(!b)return;let C=(0,oe.extractPlainText)(b),I=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;A(I)},[A]),j=(0,M.useCallback)(()=>{X.current=performance.now(),T();let b=k.current;b&&R((0,oe.getCursorOffset)(b))},[T,R]);(0,M.useEffect)(()=>{let b=k.current;if(!b)return;let C=S=>{let I=S,D=I.inputType;if(D==="insertParagraph"||D==="insertLineBreak"||D==="insertFromDrop"){S.preventDefault();return}if(D.startsWith("insert")||D.startsWith("delete")){let J=D.startsWith("delete")?"":I.data??"";O(J)&&S.preventDefault()}};return b.addEventListener("beforeinput",C),()=>b.removeEventListener("beforeinput",C)},[O]);let u=(0,M.useCallback)(()=>{ne.current=!0,k.current?.setAttribute("data-aia-composing","true")},[]),P=(0,M.useCallback)(()=>{ne.current=!1,k.current?.removeAttribute("data-aia-composing"),T()},[T]),qe=(0,M.useCallback)(b=>{b.preventDefault();let C=k.current;if(!C)return;let S=(b.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!S)return;let I=C.ownerDocument??document,D=I.getSelection();if(!D||D.rangeCount===0)return;let J=D.getRangeAt(0);if(!C.contains(J.startContainer))return;J.deleteContents();let be=I.createTextNode(S);J.insertNode(be),J.setStartAfter(be),J.collapse(!0),D.removeAllRanges(),D.addRange(J),T()},[T]),ze=(0,M.useCallback)(b=>B(b),[B]),Je=(0,M.useCallback)(()=>L(!0),[L]),Ne=(0,M.useCallback)(()=>L(!1),[L]),f=(0,M.useCallback)(()=>k.current?.focus(),[]),et=(0,M.useCallback)(()=>k.current?.blur(),[]),_e=(0,M.useCallback)(()=>{let b=k.current;return b?(0,oe.extractPlainText)(b):""},[]),Ue=ti()?"plaintext-only":"true";return{inputRef:k,editorProps:{ref:k,contentEditable:Ue,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":p,"aria-expanded":m,"aria-activedescendant":h,spellCheck:!0,enterKeyHint:"send",onInput:j,onKeyDown:ze,onCompositionStart:u,onCompositionEnd:P,onPaste:qe,onFocus:Je,onBlur:Ne},getPlainText:_e,focus:f,blur:et}}var Ie=require("react/jsx-runtime");function ai(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var fa=(0,q.forwardRef)(function({onSubmit:o,onResult:t,onError:i,optionOverrides:n,maskCompletedText:l,className:r,apiConfig:c,additionalContext:g,language:x,currency:y,productId:m,visitorId:p,columns:h,pillPlacement:v="dropdown",mode:A="auto",optionsPosition:B="below",animations:R=!0,dropdownTrigger:_,closeDropdownOnBlur:$,prependPlaceholder:O,showNonTappableOptions:L,locationSearch:k,showOptionIcons:ne=!0,showChipIcons:Z=!0,showChipImages:re=!0,showOptionImages:W=!0,showOptionCounts:X=!0,showSkipButton:T,showProducts:j,productsLayout:u,productImageFallback:P,autoFocus:qe=!0,onFocus:ze,onBlur:Je,value:Ne,completedParams:f,onChange:et,onParamsChange:_e,products:Ue,mapProducts:b,onProductSelect:C,onProductAddToCart:S,submitButton:I,resetOnSubmit:D=!0},J){let be=(0,q.useRef)(null),xe=(0,q.useRef)(null),ye=(0,q.useRef)(null),tt=(0,q.useRef)(()=>{}),ue=(0,q.useRef)(null),Fe=(0,q.useRef)(null);(0,q.useEffect)(()=>{let z=be.current;if(z)return ue.current?ue.current.setMode(A):ue.current=new Me.ModeController(z,A),()=>{ue.current?.destroy(),ue.current=null}},[A]);let st=(0,q.useCallback)(z=>{let me=Fe.current?.current;me&&(me.focus(),(0,Me.setCursorOffset)(me,z))},[]),{completedParams:ht,suggestionPills:He,setActivePill:at,skipActivePill:lt,segments:pe,newParamId:Ee,clearNewParamId:Be,placeholderText:a,isFocused:ee,isDropdownOpen:Ve,isActivePillSelected:ke,isLoading:w,isReady:We,activeIndex:Qe,listboxId:Ye,handleTextChange:ut,handleKeyDown:dt,setFocused:Ge,editingParam:ct,editingIdentified:Ce,editingAnchor:Ae,caretOffset:je,startEditingParam:it,handleCaretAfterInput:pt,handleCaretMove:ot,replaceEditingRange:nt,dropdownProps:s,reset:G,refreshProducts:F,prepareSubmit:vt,getState:Ht,recordSubmit:Bt}=It({onSubmit:z=>tt.current(z),onResult:t,onError:i,optionOverrides:n,maskCompletedText:l,apiConfig:c,additionalContext:g,language:x,currency:y,productId:m,visitorId:p,columns:h,dropdownTrigger:_,optionsPosition:B,closeDropdownOnBlur:$,prependPlaceholder:O,showNonTappableOptions:L,locationSearch:k,showOptionIcons:ne,showOptionImages:W,showOptionCounts:X,showSkipButton:T,showProducts:j,onFocus:ze,onBlur:Je,value:Ne,completedParams:f,onChange:et,onParamsChange:_e,products:Ue,mapProducts:b,onProductSelect:C,onProductAddToCart:S,source:"full-sdk",setCursor:st});(0,q.useEffect)(()=>{if(!Ee)return;let z=window.setTimeout(()=>Be(),650);return()=>window.clearTimeout(z)},[Ee,Be]);let ba=Qe>=0?`${Ye}-option-${Qe}`:void 0,{inputRef:At,editorProps:wa,focus:xt,blur:Wt,getPlainText:Gt}=ga({segments:pe,newParamId:Ee,editingParam:ct,editingIdentified:Ce,editingAnchor:Ae,caretOffset:je,placeholderText:a,isFocused:ee,showChipIcons:Z,showChipImages:re,isDropdownOpen:Ve,listboxId:Ye,activeDescendantId:ba,autoFocus:qe,handleTextChange:ut,handleKeyDown:dt,handleCaretAfterInput:pt,handleCaretMove:ot,startEditingParam:it,replaceEditingRange:nt,setFocused:Ge});Fe.current=At,(0,q.useLayoutEffect)(()=>{let z=xe.current,me=At.current;if(!z||!me)return;let gt=()=>{let qt=z.firstElementChild;if(!qt)return;let ka=qt.getBoundingClientRect(),Ca=me.getBoundingClientRect();ka.top>=Ca.bottom-2?z.setAttribute("data-aia-pill-wrapped",""):z.removeAttribute("data-aia-pill-wrapped")};gt();let Kt=new ResizeObserver(gt);return Kt.observe(me),()=>Kt.disconnect()},[pe,He.length,w,At]),(0,q.useEffect)(()=>{let z=ye.current;if(z)return(0,Me.watchEditorHeight)(z)},[]),(0,q.useImperativeHandle)(J,()=>({focus:xt,blur:Wt,reset:G,refreshProducts:F,setMode:z=>ue.current?.setMode(z),skipActivePill:lt}),[xt,Wt,G,F,lt]);let mt=!!pe.length||ht.length>0,Lt=(0,q.useCallback)(z=>{if(!mt)return;z&&vt();let me=Ht(),gt=(0,Me.buildSubmitResult)(Gt(),me.completedParams,me.skippedParams,{identifiedParams:me.identifiedParams,isReady:me.isReady,customFields:me.customFields});z&&Bt(gt),o(gt),D&&G()},[Bt,D,mt,vt,Ht,o,G,Gt]);tt.current=()=>Lt(!1);let va=(0,q.useCallback)(z=>{z.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||xt()},[xt]),xa=v==="inline",ya=v==="dropdown";return(0,Ie.jsxs)("div",{ref:be,className:`magicx-aia ${rt.container} ${r??""}`,"data-pill-placement":v,"data-options-position":B,"data-animations":R?"on":"off","data-mode":ai(A),children:[(0,Ie.jsx)(Tt,{...s,showPills:ya,productsLayout:u,productImageFallback:P}),(0,Ie.jsxs)("div",{className:rt.inputWrapper,"data-aia-input-wrapper":"",onClick:va,children:[(0,Ie.jsxs)("div",{ref:ye,className:rt.editorArea,"data-aia-editor":"",children:[(0,Ie.jsx)("div",{...wa,className:rt.input,"data-aia-input":""}),xa&&(w||He.length>0)&&(0,Ie.jsx)("span",{ref:xe,className:rt.pillListContainer,"data-aia-pill-list-container":"",children:(0,Ie.jsx)(Ct,{pills:He,activePillIndex:0,activeSelected:ke,onSelectPill:at,loading:w})})]}),I===null?null:I===void 0?(0,Ie.jsx)(pa,{disabled:!mt,ready:mt&&We,onClick:()=>Lt(!0),label:(0,Me.uiStringsFor)(x).submit}):(0,Ie.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:rt.submitSlot,onClick:z=>{mt&&(z.stopPropagation(),Lt(!0))},children:I})]})]})});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});
3208
3208
  //# sourceMappingURL=index.js.map