@magicx-eng/ai-autocomplete-react 0.62.2 → 0.63.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/REFERENCE.md CHANGED
@@ -701,6 +701,7 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
701
701
  | `--aia-multi-done-width` | `100%` (classic: as wide as the widest option) | same | Width of the multi-select Done button. |
702
702
  | `--aia-panel-min-width` | `160px` | same | Narrowest the floating options box gets when it hugs its options (desktop). Set `100%` to turn the hug off: the box then stays as wide as the field, up to `--aia-dropdown-max-width`. |
703
703
  | `--aia-dropdown-max-width` | `544px` | same | Widest the floating options box gets. `none` lets it span the whole field (with `--aia-panel-min-width: 100%`, it always does). The calendar and the time wheel keep `--aia-date-panel-width` and `--aia-time-panel-width`. |
704
+ | `--aia-option-peek` | `0` | same | How much of one more option row a scrolling options list shows past its visible rows: a unitless number, 0 or more. `0.5` shows half of the next row, a hint that the list scrolls. A list where every option fits is unchanged, and a list that scrolls only because its options wrap onto more lines gets no peek (rows are counted, not measured). A negative reads as 0; a value with a unit (`0.5rem`, `50%`) is invalid and removes the list's height cap. Set it on the widget's container or any ancestor. |
704
705
  | `--aia-focus-ring` | `none` | same | Outline drawn around the whole field while it has focus, e.g. `2px solid #1668e3`. Off by default. The editor inside never draws a ring of its own, whatever your page's `:focus-visible` rule says, so this is where focus shows. |
705
706
  | `--aia-focus-ring-offset` | `0px` | same | Gap between that ring and the field's border; negative draws it over the border. |
706
707
  | `--aia-multi-done-min-width` | `120px` | `120px` | Narrowest the multi-select Done button gets. |
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Wa=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Wt=Object.prototype.hasOwnProperty;var Gt=(e,i)=>{for(var t in i)Wa(e,t,{get:i[t],enumerable:!0})},Kt=(e,i,t,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of Bt(i))!Wt.call(e,o)&&o!==t&&Wa(e,o,{get:()=>i[o],enumerable:!(n=Ht(i,o))||n.enumerable});return e};var qt=e=>Kt(Wa({},"__esModule",{value:!0}),e);var bi={};Gt(bi,{AIAutocomplete:()=>At,AIAutocompleteDropdown:()=>La,DATE_RANGE_META_END:()=>c.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>c.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>c.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>c.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>c.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>c.TIME_META_KEY,WEEKDAY_LABELS:()=>c.WEEKDAY_LABELS,buildSubmitResult:()=>c.buildSubmitResult,cellDay:()=>c.cellDay,cellIso:()=>c.cellIso,dateCellMarks:()=>c.dateCellMarks,formatDate:()=>c.formatDate,formatDateRange:()=>c.formatDateRange,formatOptionCount:()=>c.formatOptionCount,formatPlace:()=>c.formatPlace,formatTime:()=>c.formatTime,isoDate:()=>c.isoDate,monthLabel:()=>c.monthLabel,optionCountLabel:()=>c.optionCountLabel,optionHasImage:()=>c.optionHasImage,optionImageSources:()=>c.optionImageSources,optionImageSrc:()=>c.optionImageSrc,optionLabel:()=>c.optionLabel,optionsShowLeadingVisuals:()=>c.optionsShowLeadingVisuals,parseDate:()=>c.parseDate,parseLooseDate:()=>c.parseLooseDate,parseLooseDateRange:()=>c.parseLooseDateRange,parseTime:()=>c.parseTime,productFromMatchedItem:()=>c.productFromMatchedItem,productImageSources:()=>c.productImageSources,productsFromCustomFields:()=>c.productsFromCustomFields,sanitizeOptionIconSvg:()=>c.sanitizeOptionIconSvg,selectedRangeFor:()=>c.selectedRangeFor,useAIAutocomplete:()=>Ma,visibleDateRange:()=>c.visibleDateRange,withSkippedParams:()=>c.withSkippedParams});module.exports=qt(bi);var c=require("@magicx-eng/ai-autocomplete-vanilla");var j=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 Wa=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Wt=Object.prototype.hasOwnProperty;var Gt=(e,i)=>{for(var t in i)Wa(e,t,{get:i[t],enumerable:!0})},Kt=(e,i,t,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of Bt(i))!Wt.call(e,o)&&o!==t&&Wa(e,o,{get:()=>i[o],enumerable:!(n=Ft(i,o))||n.enumerable});return e};var qt=e=>Kt(Wa({},"__esModule",{value:!0}),e);var bi={};Gt(bi,{AIAutocomplete:()=>At,AIAutocompleteDropdown:()=>La,DATE_RANGE_META_END:()=>c.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>c.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>c.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>c.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>c.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>c.TIME_META_KEY,WEEKDAY_LABELS:()=>c.WEEKDAY_LABELS,buildSubmitResult:()=>c.buildSubmitResult,cellDay:()=>c.cellDay,cellIso:()=>c.cellIso,dateCellMarks:()=>c.dateCellMarks,formatDate:()=>c.formatDate,formatDateRange:()=>c.formatDateRange,formatOptionCount:()=>c.formatOptionCount,formatPlace:()=>c.formatPlace,formatTime:()=>c.formatTime,isoDate:()=>c.isoDate,monthLabel:()=>c.monthLabel,optionCountLabel:()=>c.optionCountLabel,optionHasImage:()=>c.optionHasImage,optionImageSources:()=>c.optionImageSources,optionImageSrc:()=>c.optionImageSrc,optionLabel:()=>c.optionLabel,optionsShowLeadingVisuals:()=>c.optionsShowLeadingVisuals,parseDate:()=>c.parseDate,parseLooseDate:()=>c.parseLooseDate,parseLooseDateRange:()=>c.parseLooseDateRange,parseTime:()=>c.parseTime,productFromMatchedItem:()=>c.productFromMatchedItem,productImageSources:()=>c.productImageSources,productsFromCustomFields:()=>c.productsFromCustomFields,sanitizeOptionIconSvg:()=>c.sanitizeOptionIconSvg,selectedRangeFor:()=>c.selectedRangeFor,useAIAutocomplete:()=>Ma,visibleDateRange:()=>c.visibleDateRange,withSkippedParams:()=>c.withSkippedParams});module.exports=qt(bi);var c=require("@magicx-eng/ai-autocomplete-vanilla");var Z=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
@@ -115,16 +115,26 @@
115
115
  <strong>). The completed class is stamped by the shared renderer as a global
116
116
  string, so match it via [class~=] to bypass CSS Modules' hashing. */
117
117
  :where(.aia-input-IW-P-) strong[class~="magicx-aia-segment--completed"] {
118
- /* inline (not inline-block) so a chip too wide for the line breaks across two
119
- lines; box-decoration-break: clone gives each fragment its own padding /
120
- radius / fill, so an over-long recognized phrase renders as two little
121
- rounded blocks instead of overflowing the field. */
122
- display: inline;
118
+ /* inline-block, so the chip is one unit on its line: when the line runs out
119
+ the whole chip moves to the next one instead of breaking in the middle
120
+ (between its icon and its text, or at a space). max-width keeps a chip
121
+ wider than the whole field inside it: its text then wraps within the
122
+ chip, drawn as one rounded box of several lines (white-space: normal
123
+ below; the field's overflow-wrap / word-break are inherited, so one very
124
+ long word cannot push it out either). */
125
+ display: inline-block;
126
+ box-sizing: border-box;
127
+ max-width: 100%;
123
128
  padding: 3px 6px;
129
+ /* An inline-block counts its vertical padding in the line box, where the
130
+ inline chip this replaces did not. The negative margin takes it back out,
131
+ and the baseline alignment keeps the chip's text on the surrounding
132
+ text's baseline, so rows of chips sit exactly --aia-editor-line-height
133
+ apart, as plain text does. */
134
+ margin: -3px 0;
135
+ vertical-align: baseline;
124
136
  /* Rounded rectangle, not a full capsule. */
125
137
  border-radius: 6px;
126
- -webkit-box-decoration-break: clone;
127
- box-decoration-break: clone;
128
138
  background: var(--aia-completed-pill-bg, rgba(189, 189, 189, 0.105));
129
139
  color: var(--aia-completed-pill-color, var(--aia-written-text-color, #fff));
130
140
  font-size: var(--aia-pill-font-size, 14px);
@@ -149,8 +159,8 @@
149
159
 
150
160
  /* The picked option's icon inside a completed chip (see \`icon_svg\` on
151
161
  CompletedParamState). Inline-block, one em square and sat on the text
152
- baseline, so the chip keeps \`display: inline\` and still wraps across
153
- lines; contentEditable is off on it (the renderer sets that) so it adds
162
+ baseline; the chip is one inline-block, so the icon never ends a line
163
+ apart from its text. contentEditable is off on it (the renderer sets that) so it adds
154
164
  no characters to the caret's plain text. */
155
165
  :where(.aia-input-IW-P-) span[class~="magicx-aia-segment-icon"] {
156
166
  display: inline-block;
@@ -429,7 +439,7 @@
429
439
  transition: none;
430
440
  }
431
441
  }
432
- `,document.head.appendChild(e)}var ha={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};var L=require("@magicx-eng/ai-autocomplete-vanilla"),X=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
442
+ `,document.head.appendChild(e)}var ha={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};var L=require("@magicx-eng/ai-autocomplete-vanilla"),ee=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
433
443
  * Built-in appearance defaults \u2014 zero specificity via :where().
434
444
  * Consumer CSS always wins without !important.
435
445
  *
@@ -1038,9 +1048,18 @@
1038
1048
  /* A multi-select shows three rows and scrolls the rest, in every layout (one
1039
1049
  column, two columns, phone), so its Done button always sits right under
1040
1050
  the third row. The planned cap (--aia-grid-max-height) still wins when it
1041
- is smaller: fewer than three rows of options. */
1051
+ is smaller: three rows of options or fewer. --aia-option-peek (a unitless
1052
+ number of rows, 0 or more, default 0, set by the consumer on the widget or
1053
+ any ancestor) shows that much of the next row when the list scrolls; the
1054
+ planned cap carries it too, but only for a list that scrolls, so a list of
1055
+ three or fewer is never padded out. max() reads a negative as 0. A value
1056
+ with a unit makes the calc invalid and the cap is lost: nothing here can
1057
+ catch that, and the reference says so. */
1042
1058
  [data-aia-dropdown][aria-multiselectable="true"] .aia-grid[data-scroll] {
1043
- max-height: min(var(--aia-grid-max-height, 120px), calc(3 * var(--aia-option-row-height, 37px)));
1059
+ max-height: min(
1060
+ var(--aia-grid-max-height, 120px),
1061
+ calc((3 + max(0, var(--aia-option-peek, 0))) * var(--aia-option-row-height, 37px))
1062
+ );
1044
1063
  }
1045
1064
 
1046
1065
  /* Fitted to the viewport, every other grid hands its scrolling to the panel,
@@ -1050,7 +1069,10 @@
1050
1069
  [data-aia-dropdown][data-aia-fit][aria-multiselectable="true"] .aia-grid[data-scroll] {
1051
1070
  flex-shrink: 1;
1052
1071
  min-height: var(--aia-option-row-height, 37px);
1053
- max-height: min(var(--aia-grid-max-height, 120px), calc(3 * var(--aia-option-row-height, 37px)));
1072
+ max-height: min(
1073
+ var(--aia-grid-max-height, 120px),
1074
+ calc((3 + max(0, var(--aia-option-peek, 0))) * var(--aia-option-row-height, 37px))
1075
+ );
1054
1076
  overflow-y: auto;
1055
1077
  }
1056
1078
 
@@ -1262,13 +1284,19 @@
1262
1284
  :where([data-aia-options-style="classic"])
1263
1285
  [data-aia-dropdown][aria-multiselectable="true"]
1264
1286
  .aia-grid[data-scroll] {
1265
- max-height: min(var(--aia-grid-max-height, 120px), calc(3 * var(--aia-option-row-height, 37px)));
1287
+ max-height: min(
1288
+ var(--aia-grid-max-height, 120px),
1289
+ calc((3 + max(0, var(--aia-option-peek, 0))) * var(--aia-option-row-height, 37px))
1290
+ );
1266
1291
  }
1267
1292
  :where([data-aia-options-style="classic"])
1268
1293
  [data-aia-dropdown][data-aia-fit][aria-multiselectable="true"]
1269
1294
  .aia-grid[data-scroll] {
1270
1295
  min-height: var(--aia-option-row-height, 37px);
1271
- max-height: min(var(--aia-grid-max-height, 120px), calc(3 * var(--aia-option-row-height, 37px)));
1296
+ max-height: min(
1297
+ var(--aia-grid-max-height, 120px),
1298
+ calc((3 + max(0, var(--aia-option-peek, 0))) * var(--aia-option-row-height, 37px))
1299
+ );
1272
1300
  }
1273
1301
  :where([data-aia-options-style="classic"])
1274
1302
  [data-aia-dropdown]
@@ -1783,7 +1811,7 @@
1783
1811
  opacity: 1;
1784
1812
  }
1785
1813
  }
1786
- `,document.head.appendChild(e)}var Ce={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",seeAllSpin:"aia-seeAllSpin-jlsZP",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};var J=require("@magicx-eng/ai-autocomplete-vanilla"),at=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) ---
1814
+ `,document.head.appendChild(e)}var Ce={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",seeAllSpin:"aia-seeAllSpin-jlsZP",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};var ae=require("@magicx-eng/ai-autocomplete-vanilla"),at=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) ---
1787
1815
 
1788
1816
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1789
1817
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1980,7 +2008,7 @@
1980
2008
  opacity: 0.8;
1981
2009
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1982
2010
  }
1983
- `,document.head.appendChild(e)}var $={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};var xe=require("react/jsx-runtime"),_t=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function tt({options:e,activeIndex:i,listboxId:t,view:n,selection:o,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:b,onNextMonth:v}){let x=(0,J.isoDate)(new Date),f=(0,J.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,J.cellIso)(e[i]),selected:o.selectedRange,floor:o.floor});return(0,xe.jsxs)("div",{className:$.datepicker,"data-aia-datepicker":"",children:[(0,xe.jsxs)("div",{className:$.header,children:[(0,xe.jsx)("button",{type:"button",tabIndex:-1,className:$.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:b,children:"\u2039"}),(0,xe.jsx)("span",{className:$.month,"data-aia-date-month":"","aria-live":"polite",children:(0,J.monthLabel)(n)}),(0,xe.jsx)("button",{type:"button",tabIndex:-1,className:$.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:v,children:"\u203A"})]}),(0,xe.jsx)("div",{className:$.weekdays,"aria-hidden":"true",children:J.WEEKDAY_LABELS.map((h,u)=>(0,xe.jsx)("span",{className:$.weekday,children:h},_t[u]))}),(0,xe.jsx)("div",{className:$.grid,"data-aia-date-grid":"",children:e.map((h,u)=>(0,xe.jsx)(Vt,{option:h,id:`${t}-option-${u}`,index:u,isHighlighted:u===i&&h.is_tappable,isToday:(0,J.cellIso)(h)===x,isPast:(0,J.isDimmedDay)((0,J.cellIso)(h),x,o.floor),marks:(0,J.dateCellMarks)((0,J.cellIso)(h),{selectedIso:o.selectedIso,range:f,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:l},(0,J.cellIso)(h)??`pad-${u}`))})]})}function Vt({option:e,id:i,index:t,isHighlighted:n,isToday:o,isPast:s,marks:r,onSelect:l,onHighlight:b,onUnhighlight:v}){let[x,f]=(0,at.useState)(!1),h=(0,J.cellDay)(e);if(h==null)return(0,xe.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${$.cell} ${$.blank}`});let u=()=>{f(!0),l(e),setTimeout(()=>f(!1),170)},y=[$.cell,$.day,s?$.past:"",n?$.highlighted:"",o?$.today:"",r.inRange?$.inRange:"",r.selected?$.selected:"",r.reference?$.reference:"",x?$.pressed:""].filter(Boolean).join(" ");return(0,xe.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":n,"aria-label":e.text,tabIndex:0,className:y,onClick:u,onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),u())},onMouseEnter:()=>b(t),onMouseLeave:v?()=>v(t):void 0,children:(0,xe.jsx)("span",{className:$.number,children:h})})}var sa=require("@magicx-eng/ai-autocomplete-vanilla"),Ea=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 {
2011
+ `,document.head.appendChild(e)}var J={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",reference:"aia-reference-Q5bXf",pressed:"aia-pressed-bEyyN"};var xe=require("react/jsx-runtime"),_t=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function tt({options:e,activeIndex:i,listboxId:t,view:n,selection:o,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:b,onNextMonth:v}){let y=(0,ae.isoDate)(new Date),f=(0,ae.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,ae.cellIso)(e[i]),selected:o.selectedRange,floor:o.floor});return(0,xe.jsxs)("div",{className:J.datepicker,"data-aia-datepicker":"",children:[(0,xe.jsxs)("div",{className:J.header,children:[(0,xe.jsx)("button",{type:"button",tabIndex:-1,className:J.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:b,children:"\u2039"}),(0,xe.jsx)("span",{className:J.month,"data-aia-date-month":"","aria-live":"polite",children:(0,ae.monthLabel)(n)}),(0,xe.jsx)("button",{type:"button",tabIndex:-1,className:J.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:v,children:"\u203A"})]}),(0,xe.jsx)("div",{className:J.weekdays,"aria-hidden":"true",children:ae.WEEKDAY_LABELS.map((h,u)=>(0,xe.jsx)("span",{className:J.weekday,children:h},_t[u]))}),(0,xe.jsx)("div",{className:J.grid,"data-aia-date-grid":"",children:e.map((h,u)=>(0,xe.jsx)(Vt,{option:h,id:`${t}-option-${u}`,index:u,isHighlighted:u===i&&h.is_tappable,isToday:(0,ae.cellIso)(h)===y,isPast:(0,ae.isDimmedDay)((0,ae.cellIso)(h),y,o.floor),marks:(0,ae.dateCellMarks)((0,ae.cellIso)(h),{selectedIso:o.selectedIso,range:f,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:l},(0,ae.cellIso)(h)??`pad-${u}`))})]})}function Vt({option:e,id:i,index:t,isHighlighted:n,isToday:o,isPast:s,marks:r,onSelect:l,onHighlight:b,onUnhighlight:v}){let[y,f]=(0,at.useState)(!1),h=(0,ae.cellDay)(e);if(h==null)return(0,xe.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${J.cell} ${J.blank}`});let u=()=>{f(!0),l(e),setTimeout(()=>f(!1),170)},x=[J.cell,J.day,s?J.past:"",n?J.highlighted:"",o?J.today:"",r.inRange?J.inRange:"",r.selected?J.selected:"",r.reference?J.reference:"",y?J.pressed:""].filter(Boolean).join(" ");return(0,xe.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":n,"aria-label":e.text,tabIndex:0,className:x,onClick:u,onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),u())},onMouseEnter:()=>b(t),onMouseLeave:v?()=>v(t):void 0,children:(0,xe.jsx)("span",{className:J.number,children:h})})}var sa=require("@magicx-eng/ai-autocomplete-vanilla"),Ea=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 {
1984
2012
  display: flex;
1985
2013
  flex-wrap: wrap;
1986
2014
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -2167,7 +2195,7 @@
2167
2195
  justify-content: flex-end;
2168
2196
  }
2169
2197
  }
2170
- `,document.head.appendChild(e)}var Ue={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 Be=require("react/jsx-runtime");function it({isOptionHighlighted:e=!1,isInputEmpty:i=!1,strings:t=(0,sa.uiStringsFor)()}){let{key:n,hint:o}=(0,sa.getFooterHint)(e,i,t),[s,r]=(0,Ea.useState)(sa.ATTRIBUTION_URL);return(0,Ea.useEffect)(()=>{r((0,sa.buildAttributionUrl)())},[]),(0,Be.jsx)("footer",{className:Ue.footer,"data-aia-footer":"",children:(0,Be.jsxs)(Sa,{justify:"between",noWrap:!0,className:Ue.row,children:[(0,Be.jsxs)(Sa,{gap:"5px",className:Ue.hintGroup,children:[(0,Be.jsx)("kbd",{className:Ue.key,children:n}),(0,Be.jsx)("span",{className:Ue.hint,children:o})]}),(0,Be.jsxs)("a",{className:Ue.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[(0,Be.jsx)("span",{className:Ue.brand,children:"AI"}),(0,Be.jsx)("span",{className:Ue.badge,children:"Autocomplete"})]})]})})}var re=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
2198
+ `,document.head.appendChild(e)}var Ue={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 Be=require("react/jsx-runtime");function it({isOptionHighlighted:e=!1,isInputEmpty:i=!1,strings:t=(0,sa.uiStringsFor)()}){let{key:n,hint:o}=(0,sa.getFooterHint)(e,i,t),[s,r]=(0,Ea.useState)(sa.ATTRIBUTION_URL);return(0,Ea.useEffect)(()=>{r((0,sa.buildAttributionUrl)())},[]),(0,Be.jsx)("footer",{className:Ue.footer,"data-aia-footer":"",children:(0,Be.jsxs)(Sa,{justify:"between",noWrap:!0,className:Ue.row,children:[(0,Be.jsxs)(Sa,{gap:"5px",className:Ue.hintGroup,children:[(0,Be.jsx)("kbd",{className:Ue.key,children:n}),(0,Be.jsx)("span",{className:Ue.hint,children:o})]}),(0,Be.jsxs)("a",{className:Ue.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[(0,Be.jsx)("span",{className:Ue.brand,children:"AI"}),(0,Be.jsx)("span",{className:Ue.badge,children:"Autocomplete"})]})]})})}var se=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
2171
2199
  Angular copy). The three are kept identical by
2172
2200
  packages/vanilla/tests/render/locationFieldParity.test.ts. */
2173
2201
  .aia-location-6-fsr {
@@ -2301,7 +2329,7 @@
2301
2329
  .aia-loadingBar-OLCr4:nth-child(3) {
2302
2330
  width: 60%;
2303
2331
  }
2304
- `,document.head.appendChild(e)}var ee={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};var V=require("react/jsx-runtime"),Ut=0;function Ca(e){return e.getRootNode().activeElement??null}function rt(e){return e.getRootNode().getSelection?.()??document.getSelection()}function ot(e){if(!e.isContentEditable)return null;let i=rt(e);if(!i||i.rangeCount===0)return null;let t=i.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function nt(e,i){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=rt(e);if(!t)return;let n=i;(!n||!n.startContainer.isConnected||!e.contains(n.startContainer))&&(n=document.createRange(),n.selectNodeContents(e),n.collapse(!1)),t.removeAllRanges(),t.addRange(n)}var Qt=(0,V.jsxs)("svg",{className:ee.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,V.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,V.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Yt=(0,V.jsxs)("svg",{className:ee.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,V.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,V.jsx)("path",{d:"m20 20-3.5-3.5"})]});function st({view:e,searchLabel:i,noResultsLabel:t,useTypedLabel:n,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:b,onMove:v,onCommit:x,onFocusChange:f}){let h=(0,re.useRef)(null),u=(0,re.useRef)(null),y=(0,re.useRef)(null),k=(0,re.useRef)(null),C=(0,re.useRef)(null),F=(0,re.useRef)(!1),M=(0,re.useRef)(!1),he=(0,re.useRef)(!1),A=(0,re.useRef)(!1),H=(0,re.useRef)(o);H.current=o;let oe=(0,re.useRef)(f);oe.current=f;let G=p=>{A.current=p,f(p)},de=()=>{let p=h.current;return p!=null&&Ca(p)===p},ce=()=>{let p=u.current;if(!p)return;let P=Ca(p);P instanceof HTMLElement&&P!==h.current&&P!==document.body&&!p.contains(P)&&(k.current=P,C.current=ot(P))},E=p=>{let P=u.current;!P||!(p instanceof HTMLElement)||p===k.current||p===document.body||P.contains(p)||(k.current=p,C.current=ot(p))},ne=(0,re.useRef)(null);ne.current===null&&(ne.current=`aia-location-${++Ut}`);let ue=`${ne.current}-row-`;(0,re.useEffect)(()=>{let p=h.current;p&&p.value!==e.query&&Ca(p)!==p&&(p.value=e.query)},[e.query]),(0,re.useEffect)(()=>{o&&(s&&!he.current&&(M.current=!1),he.current=s);let p=h.current;if(p){if(!r&&de()){M.current=!0,_();return}if(!o){setTimeout(()=>{if(H.current)return;let P=k.current;P&&Ca(P)===P||(M.current=!1)},0);return}if(!(!s||M.current||!l||de())){if(ce(),G(!0),p.focus({preventScroll:!0}),!de()){M.current=!0,G(!1);return}p.value&&p.select()}}}),(0,re.useLayoutEffect)(()=>()=>{if(!A.current)return;let p=h.current,P=k.current;P?.isConnected&&p&&Ca(p)===p&&(F.current=!0,nt(P,C.current),F.current=!1),A.current=!1,oe.current(!1)},[]);let _=(p=!1)=>{p&&(M.current=!0);let P=k.current;P?.isConnected&&de()&&(F.current=!0,nt(P,C.current),F.current=!1),G(!1)},pe=e.query.trim(),T=e.highlighted>=0&&e.highlighted<e.places.length?`${ue}${e.highlighted}`:void 0,W=null;return e.places.length>0?W=e.places.map((p,P)=>(0,V.jsxs)("div",{id:`${ue}${P}`,role:"option","aria-selected":P===e.highlighted,className:P===e.highlighted?`${ee.row} ${ee.highlighted}`:ee.row,"data-aia-location-row":"","data-aia-index":P,onClick:()=>{l&&(_(!0),x(P))},children:[(0,V.jsx)("span",{className:ee.pin,children:Qt}),(0,V.jsxs)("span",{className:ee.text,children:[(0,V.jsx)("span",{className:ee.name,children:p.name}),p.secondary&&(0,V.jsx)("span",{className:ee.secondary,children:p.secondary})]})]},p.id)):e.status==="loading"?W=(0,V.jsxs)("div",{className:ee.loading,"data-aia-location-loading":"",children:[(0,V.jsx)("span",{className:ee.loadingBar}),(0,V.jsx)("span",{className:ee.loadingBar}),(0,V.jsx)("span",{className:ee.loadingBar})]}):pe&&(W=(0,V.jsxs)("div",{className:ee.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,V.jsx)("span",{className:ee.empty,children:t}),(0,V.jsx)("span",{children:n})]})),(0,V.jsxs)("div",{ref:u,className:ee.location,"data-aia-location":"",onMouseDown:p=>{!(p.target instanceof Node)||!y.current?.contains(p.target)||(p.stopPropagation(),ce(),G(!0))},children:[(0,V.jsxs)("label",{ref:y,className:ee.field,children:[Yt,(0,V.jsx)("input",{ref:h,type:"text",className:ee.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:i,"aria-label":i,"aria-activedescendant":T,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:p=>b(p.target.value),onFocus:p=>{E(p.relatedTarget),G(!0)},onBlur:()=>{F.current||(M.current=!0,G(!1))},onKeyDown:p=>{if(!p.nativeEvent.isComposing)switch(p.key){case"ArrowDown":case"ArrowUp":p.preventDefault(),v(p.key==="ArrowDown"?1:-1);return;case"Enter":if(p.preventDefault(),!l)return;_(!0),x();return;case"Escape":p.preventDefault(),p.stopPropagation(),M.current=!0,_();return;case"Backspace":if(p.currentTarget.value!=="")return;p.preventDefault(),M.current=!0,_();return}}})]}),(0,V.jsx)("div",{className:ee.results,"data-aia-location-results":"","aria-live":"polite",children:W})]})}var za=require("@magicx-eng/ai-autocomplete-vanilla");var lt=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,
2332
+ `,document.head.appendChild(e)}var te={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 U=require("react/jsx-runtime"),Ut=0;function Ca(e){return e.getRootNode().activeElement??null}function rt(e){return e.getRootNode().getSelection?.()??document.getSelection()}function ot(e){if(!e.isContentEditable)return null;let i=rt(e);if(!i||i.rangeCount===0)return null;let t=i.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function nt(e,i){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=rt(e);if(!t)return;let n=i;(!n||!n.startContainer.isConnected||!e.contains(n.startContainer))&&(n=document.createRange(),n.selectNodeContents(e),n.collapse(!1)),t.removeAllRanges(),t.addRange(n)}var Qt=(0,U.jsxs)("svg",{className:te.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,U.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,U.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Yt=(0,U.jsxs)("svg",{className:te.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,U.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,U.jsx)("path",{d:"m20 20-3.5-3.5"})]});function st({view:e,searchLabel:i,noResultsLabel:t,useTypedLabel:n,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:b,onMove:v,onCommit:y,onFocusChange:f}){let h=(0,se.useRef)(null),u=(0,se.useRef)(null),x=(0,se.useRef)(null),k=(0,se.useRef)(null),C=(0,se.useRef)(null),F=(0,se.useRef)(!1),M=(0,se.useRef)(!1),he=(0,se.useRef)(!1),Q=(0,se.useRef)(!1),z=(0,se.useRef)(o);z.current=o;let W=(0,se.useRef)(f);W.current=f;let H=p=>{Q.current=p,f(p)},X=()=>{let p=h.current;return p!=null&&Ca(p)===p},ce=()=>{let p=u.current;if(!p)return;let P=Ca(p);P instanceof HTMLElement&&P!==h.current&&P!==document.body&&!p.contains(P)&&(k.current=P,C.current=ot(P))},A=p=>{let P=u.current;!P||!(p instanceof HTMLElement)||p===k.current||p===document.body||P.contains(p)||(k.current=p,C.current=ot(p))},re=(0,se.useRef)(null);re.current===null&&(re.current=`aia-location-${++Ut}`);let ue=`${re.current}-row-`;(0,se.useEffect)(()=>{let p=h.current;p&&p.value!==e.query&&Ca(p)!==p&&(p.value=e.query)},[e.query]),(0,se.useEffect)(()=>{o&&(s&&!he.current&&(M.current=!1),he.current=s);let p=h.current;if(p){if(!r&&X()){M.current=!0,V();return}if(!o){setTimeout(()=>{if(z.current)return;let P=k.current;P&&Ca(P)===P||(M.current=!1)},0);return}if(!(!s||M.current||!l||X())){if(ce(),H(!0),p.focus({preventScroll:!0}),!X()){M.current=!0,H(!1);return}p.value&&p.select()}}}),(0,se.useLayoutEffect)(()=>()=>{if(!Q.current)return;let p=h.current,P=k.current;P?.isConnected&&p&&Ca(p)===p&&(F.current=!0,nt(P,C.current),F.current=!1),Q.current=!1,W.current(!1)},[]);let V=(p=!1)=>{p&&(M.current=!0);let P=k.current;P?.isConnected&&X()&&(F.current=!0,nt(P,C.current),F.current=!1),H(!1)},pe=e.query.trim(),T=e.highlighted>=0&&e.highlighted<e.places.length?`${ue}${e.highlighted}`:void 0,G=null;return e.places.length>0?G=e.places.map((p,P)=>(0,U.jsxs)("div",{id:`${ue}${P}`,role:"option","aria-selected":P===e.highlighted,className:P===e.highlighted?`${te.row} ${te.highlighted}`:te.row,"data-aia-location-row":"","data-aia-index":P,onClick:()=>{l&&(V(!0),y(P))},children:[(0,U.jsx)("span",{className:te.pin,children:Qt}),(0,U.jsxs)("span",{className:te.text,children:[(0,U.jsx)("span",{className:te.name,children:p.name}),p.secondary&&(0,U.jsx)("span",{className:te.secondary,children:p.secondary})]})]},p.id)):e.status==="loading"?G=(0,U.jsxs)("div",{className:te.loading,"data-aia-location-loading":"",children:[(0,U.jsx)("span",{className:te.loadingBar}),(0,U.jsx)("span",{className:te.loadingBar}),(0,U.jsx)("span",{className:te.loadingBar})]}):pe&&(G=(0,U.jsxs)("div",{className:te.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,U.jsx)("span",{className:te.empty,children:t}),(0,U.jsx)("span",{children:n})]})),(0,U.jsxs)("div",{ref:u,className:te.location,"data-aia-location":"",onMouseDown:p=>{!(p.target instanceof Node)||!x.current?.contains(p.target)||(p.stopPropagation(),ce(),H(!0))},children:[(0,U.jsxs)("label",{ref:x,className:te.field,children:[Yt,(0,U.jsx)("input",{ref:h,type:"text",className:te.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:i,"aria-label":i,"aria-activedescendant":T,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:p=>b(p.target.value),onFocus:p=>{A(p.relatedTarget),H(!0)},onBlur:()=>{F.current||(M.current=!0,H(!1))},onKeyDown:p=>{if(!p.nativeEvent.isComposing)switch(p.key){case"ArrowDown":case"ArrowUp":p.preventDefault(),v(p.key==="ArrowDown"?1:-1);return;case"Enter":if(p.preventDefault(),!l)return;V(!0),y();return;case"Escape":p.preventDefault(),p.stopPropagation(),M.current=!0,V();return;case"Backspace":if(p.currentTarget.value!=="")return;p.preventDefault(),M.current=!0,V();return}}})]}),(0,U.jsx)("div",{className:te.results,"data-aia-location-results":"","aria-live":"polite",children:G})]})}var za=require("@magicx-eng/ai-autocomplete-vanilla");var lt=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,
2305
2333
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
2306
2334
  The border is kept as a 1px transparent line so the box stays the same size
2307
2335
  as it was when the outline was dashed. */
@@ -3096,7 +3124,7 @@
3096
3124
  opacity: 0.01;
3097
3125
  }
3098
3126
  }
3099
- `,document.head.appendChild(e)}var ae={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};var q=require("react/jsx-runtime");function pt({products:e,listboxId:i,onSelect:t,busyProductId:n=null,onAddToCart:o,onFocusChange:s,focusable:r=!0,loading:l=!1,layout:b="row",imageFallback:v="image",showVendor:x=!0,strings:f=(0,Te.uiStringsFor)()}){let h=e.length>0,u=(0,ye.useRef)(null);if((0,ye.useEffect)(()=>{let k=u.current;if(!(!h||!k))return(0,Te.attachProductRowWheel)(k)},[h]),!h)return null;let y=`${i}-products-label`;return(0,q.jsxs)("section",{className:ae.section,"data-aia-products":"","data-aia-loading":l?"":void 0,"data-aia-products-layout":b,role:"group","aria-labelledby":y,children:[(0,q.jsx)("div",{className:ae.label,id:y,"data-aia-products-label":"",children:f.products}),(0,q.jsx)("div",{ref:u,className:ae.row,"data-aia-products-row":"",children:e.map((k,C)=>(0,q.jsx)($t,{product:k,id:`${i}-product-${C}`,onSelect:t,busy:k.id===n,onAddToCart:o,onFocusChange:s,focusable:r,imageFallback:v,showVendor:x,soldOut:f.soldOut,addToCart:f.addToCart},k.id))})]})}function $t({product:e,id:i,onSelect:t,busy:n,onAddToCart:o,onFocusChange:s,focusable:r,imageFallback:l,showVendor:b,soldOut:v,addToCart:x}){let f=!!o&&e.available!==!1,[h,u]=(0,ye.useState)(null),y=C=>{C.relatedTarget?.closest("[data-aia-dropdown]")||s?.(!1)},k=C=>{C.metaKey||C.ctrlKey||C.shiftKey||C.altKey||C.button!==0||(C.preventDefault(),t(e))};return(0,q.jsxs)("a",{id:i,className:ae.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":f?"":void 0,"data-aia-product-state":n?"busy":void 0,"aria-busy":n?!0:void 0,role:"option","aria-selected":!1,style:h?{"--aia-product-photo-fill-x":String(h.x),"--aia-product-photo-fill-y":String(h.y)}:void 0,href:e.url,tabIndex:r?0:-1,onClick:k,onKeyDown:C=>{C.key!=="Enter"&&C.key!==" "||(C.preventDefault(),t(e))},onFocus:()=>s?.(!0),onBlur:y,children:[(0,q.jsx)(Jt,{sources:(0,Te.productImageSources)(e.imageUrl),title:e.title,fallback:l,onPhotoFill:u},(0,Te.productImageSrc)(e.imageUrl)??""),(0,q.jsxs)("span",{className:ae.body,children:[b&&e.vendor?(0,q.jsx)("span",{className:ae.vendor,children:e.vendor}):null,(0,q.jsx)("span",{className:ae.title,children:e.title}),e.price?(0,q.jsxs)("span",{className:ae.price,children:[e.price,e.compareAtPrice?(0,q.jsx)("s",{className:ae.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,q.jsx)("span",{className:ae.badge,children:v}):null]}),f&&o?(0,q.jsx)(Xt,{product:e,label:`${x}: ${e.title}`,focusable:r,onAddToCart:o,onFocus:()=>s?.(!0),onBlur:y},Zt(e)):null]})}function Zt(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(i=>i??"").join("\0")}function Xt({product:e,label:i,focusable:t,onAddToCart:n,onFocus:o,onBlur:s}){let[r,l]=(0,ye.useState)(null),b=(0,ye.useRef)(null),v=(0,ye.useRef)(e);v.current=e;let x=(0,ye.useRef)(!0);(0,ye.useEffect)(()=>(x.current=!0,()=>{x.current=!1}),[]);let f=u=>{b.current=u,x.current&&l(u)},h=u=>{if(u.preventDefault(),u.stopPropagation(),b.current==="adding")return;f("adding");let y;try{y=Promise.resolve(n(v.current))}catch(k){y=Promise.reject(k)}y.then(()=>f("added"),()=>f(null))};return(0,q.jsx)("span",{className:ae.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":i,tabIndex:t?0:-1,onClick:h,onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||h(u)},onFocus:u=>{u.stopPropagation(),o()},onBlur:u=>{u.stopPropagation(),s(u)},children:(0,q.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,q.jsx)("path",{className:ae.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,q.jsx)("path",{className:ae.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,q.jsx)("path",{className:ae.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,q.jsx)("path",{className:ae.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,q.jsx)("circle",{className:ae.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,q.jsx)("circle",{className:ae.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Jt({sources:e,title:i,fallback:t,onPhotoFill:n}){let[o,s]=(0,ye.useState)(0),r=e[o],l=!!r,[b,v]=(0,ye.useState)(null),x=!l&&t==="initial";return(0,ye.useEffect)(()=>()=>n(null),[n]),(0,q.jsxs)("span",{className:ae.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!l&&!x?"":void 0,"data-aia-product-initial":x?"":void 0,"data-aia-image-loaded":l&&b===r?"":void 0,children:[l?(0,q.jsx)("img",{className:ae.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:f=>{v(r),n((0,Te.productPhotoFill)(f.currentTarget.naturalWidth,f.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&n(null),s(f=>f+1)}}):null,x?(0,Te.productInitial)(i):null]})}var Z=require("@magicx-eng/ai-autocomplete-vanilla"),ze=require("react");var ht=require("@magicx-eng/ai-autocomplete-vanilla"),Oa=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 {
3127
+ `,document.head.appendChild(e)}var ie={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};var _=require("react/jsx-runtime");function pt({products:e,listboxId:i,onSelect:t,busyProductId:n=null,onAddToCart:o,onFocusChange:s,focusable:r=!0,loading:l=!1,layout:b="row",imageFallback:v="image",showVendor:y=!0,strings:f=(0,Te.uiStringsFor)()}){let h=e.length>0,u=(0,ye.useRef)(null);if((0,ye.useEffect)(()=>{let k=u.current;if(!(!h||!k))return(0,Te.attachProductRowWheel)(k)},[h]),!h)return null;let x=`${i}-products-label`;return(0,_.jsxs)("section",{className:ie.section,"data-aia-products":"","data-aia-loading":l?"":void 0,"data-aia-products-layout":b,role:"group","aria-labelledby":x,children:[(0,_.jsx)("div",{className:ie.label,id:x,"data-aia-products-label":"",children:f.products}),(0,_.jsx)("div",{ref:u,className:ie.row,"data-aia-products-row":"",children:e.map((k,C)=>(0,_.jsx)($t,{product:k,id:`${i}-product-${C}`,onSelect:t,busy:k.id===n,onAddToCart:o,onFocusChange:s,focusable:r,imageFallback:v,showVendor:y,soldOut:f.soldOut,addToCart:f.addToCart},k.id))})]})}function $t({product:e,id:i,onSelect:t,busy:n,onAddToCart:o,onFocusChange:s,focusable:r,imageFallback:l,showVendor:b,soldOut:v,addToCart:y}){let f=!!o&&e.available!==!1,[h,u]=(0,ye.useState)(null),x=C=>{C.relatedTarget?.closest("[data-aia-dropdown]")||s?.(!1)},k=C=>{C.metaKey||C.ctrlKey||C.shiftKey||C.altKey||C.button!==0||(C.preventDefault(),t(e))};return(0,_.jsxs)("a",{id:i,className:ie.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":f?"":void 0,"data-aia-product-state":n?"busy":void 0,"aria-busy":n?!0:void 0,role:"option","aria-selected":!1,style:h?{"--aia-product-photo-fill-x":String(h.x),"--aia-product-photo-fill-y":String(h.y)}:void 0,href:e.url,tabIndex:r?0:-1,onClick:k,onKeyDown:C=>{C.key!=="Enter"&&C.key!==" "||(C.preventDefault(),t(e))},onFocus:()=>s?.(!0),onBlur:x,children:[(0,_.jsx)(Jt,{sources:(0,Te.productImageSources)(e.imageUrl),title:e.title,fallback:l,onPhotoFill:u},(0,Te.productImageSrc)(e.imageUrl)??""),(0,_.jsxs)("span",{className:ie.body,children:[b&&e.vendor?(0,_.jsx)("span",{className:ie.vendor,children:e.vendor}):null,(0,_.jsx)("span",{className:ie.title,children:e.title}),e.price?(0,_.jsxs)("span",{className:ie.price,children:[e.price,e.compareAtPrice?(0,_.jsx)("s",{className:ie.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,_.jsx)("span",{className:ie.badge,children:v}):null]}),f&&o?(0,_.jsx)(Xt,{product:e,label:`${y}: ${e.title}`,focusable:r,onAddToCart:o,onFocus:()=>s?.(!0),onBlur:x},Zt(e)):null]})}function Zt(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(i=>i??"").join("\0")}function Xt({product:e,label:i,focusable:t,onAddToCart:n,onFocus:o,onBlur:s}){let[r,l]=(0,ye.useState)(null),b=(0,ye.useRef)(null),v=(0,ye.useRef)(e);v.current=e;let y=(0,ye.useRef)(!0);(0,ye.useEffect)(()=>(y.current=!0,()=>{y.current=!1}),[]);let f=u=>{b.current=u,y.current&&l(u)},h=u=>{if(u.preventDefault(),u.stopPropagation(),b.current==="adding")return;f("adding");let x;try{x=Promise.resolve(n(v.current))}catch(k){x=Promise.reject(k)}x.then(()=>f("added"),()=>f(null))};return(0,_.jsx)("span",{className:ie.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":i,tabIndex:t?0:-1,onClick:h,onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||h(u)},onFocus:u=>{u.stopPropagation(),o()},onBlur:u=>{u.stopPropagation(),s(u)},children:(0,_.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,_.jsx)("path",{className:ie.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,_.jsx)("path",{className:ie.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,_.jsx)("path",{className:ie.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,_.jsx)("path",{className:ie.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,_.jsx)("circle",{className:ie.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,_.jsx)("circle",{className:ie.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Jt({sources:e,title:i,fallback:t,onPhotoFill:n}){let[o,s]=(0,ye.useState)(0),r=e[o],l=!!r,[b,v]=(0,ye.useState)(null),y=!l&&t==="initial";return(0,ye.useEffect)(()=>()=>n(null),[n]),(0,_.jsxs)("span",{className:ie.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!l&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":l&&b===r?"":void 0,children:[l?(0,_.jsx)("img",{className:ie.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:f=>{v(r),n((0,Te.productPhotoFill)(f.currentTarget.naturalWidth,f.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&n(null),s(f=>f+1)}}):null,y?(0,Te.productInitial)(i):null]})}var K=require("@magicx-eng/ai-autocomplete-vanilla"),Ie=require("react");var ht=require("@magicx-eng/ai-autocomplete-vanilla"),Oa=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 {
3100
3128
  display: grid;
3101
3129
  grid-template-columns: repeat(
3102
3130
  auto-fit,
@@ -3140,7 +3168,7 @@
3140
3168
  :where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
3141
3169
  max-height: var(--aia-grid-max-height, 120px);
3142
3170
  }
3143
- `,document.head.appendChild(e)}var mt=require("react/jsx-runtime");function ut({min:e="16rem",max:i,gap:t,scroll:n=!1,maxHeight:o,scrollResetKey:s,cols:r,template:l,innerRef:b,className:v,children:x,...f}){let h=(0,Oa.useRef)(null);(0,Oa.useLayoutEffect)(()=>{if(s===void 0)return;let y=h.current;y&&(y.scrollTop=0)},[s]);let u={"--aia-grid-min":e};return i&&(u["--aia-grid-max"]=i),t&&(u["--aia-grid-gap"]=t),o&&(u["--aia-grid-max-height"]=o),r&&(u.gridTemplateColumns=(0,ht.optionsGridTemplateColumns)(r)),l&&(u.gridTemplateColumns=l),(0,mt.jsx)("div",{ref:y=>{h.current=y,b?.(y)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":n||void 0,style:u,...f,children:x})}var ge=require("@magicx-eng/ai-autocomplete-vanilla"),Pe=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 {
3171
+ `,document.head.appendChild(e)}var mt=require("react/jsx-runtime");function ut({min:e="16rem",max:i,gap:t,scroll:n=!1,maxHeight:o,scrollResetKey:s,cols:r,template:l,innerRef:b,className:v,children:y,...f}){let h=(0,Oa.useRef)(null);(0,Oa.useLayoutEffect)(()=>{if(s===void 0)return;let x=h.current;x&&(x.scrollTop=0)},[s]);let u={"--aia-grid-min":e};return i&&(u["--aia-grid-max"]=i),t&&(u["--aia-grid-gap"]=t),o&&(u["--aia-grid-max-height"]=o),r&&(u.gridTemplateColumns=(0,ht.optionsGridTemplateColumns)(r)),l&&(u.gridTemplateColumns=l),(0,mt.jsx)("div",{ref:x=>{h.current=x,b?.(x)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":n||void 0,style:u,...f,children:y})}var ge=require("@magicx-eng/ai-autocomplete-vanilla"),Pe=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 {
3144
3172
  position: relative;
3145
3173
  /* Clip, not visible: the entrance rise below runs on the inner content,
3146
3174
  and a transformed box extends its scroll container's scrollable area.
@@ -3666,7 +3694,7 @@
3666
3694
  border-radius: 6px;
3667
3695
  font-size: 11px;
3668
3696
  }
3669
- `,document.head.appendChild(e)}var se={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg"};var le=require("react/jsx-runtime");function gt({option:e,isHighlighted:i,checked:t,onSelect:n,onHighlight:o,onUnhighlight:s,id:r,loading:l,showIcon:b=!0,showImage:v=!0,showCount:x=!0,scrollHint:f,enterDelayMs:h=0}){let[u]=(0,Pe.useState)(h),[y,k]=(0,Pe.useState)(!1),C=v?(0,ge.optionImageSources)(e.image_url):[],F=C[0]??null,[M,he]=(0,Pe.useState)([]),A=C.find(T=>!M.includes(T))??null,H=v?(e.imageCollage??[]).map(T=>(0,ge.optionImageSources)(T)[0]).filter(T=>T!==void 0):[],[oe,G]=(0,Pe.useState)(!1),[de,ce]=(0,Pe.useState)(null),E=(0,Pe.useMemo)(()=>!F&&b&&e.icon_svg?(0,ge.sanitizeOptionIconSvg)(e.icon_svg):null,[F,b,e.icon_svg]),ne=x?(0,ge.formatOptionCount)(e.item_count):null,ue=(0,Pe.useRef)(void 0);(0,Pe.useEffect)(()=>()=>clearTimeout(ue.current),[]);let _=T=>{if(l||!e.is_tappable||y&&t===void 0)return;k(!0);let W=T?.currentTarget;t!==void 0&&W!==void 0&&T!==void 0&&!(0,ge.isMultiSelectToggleTap)(W,W.querySelector("[data-aia-checkbox]"),T)?n(e,{commit:!0}):n(e),clearTimeout(ue.current),ue.current=setTimeout(()=>k(!1),170)},pe=[se.item,i&&!l?se.highlighted:"",e.liveMatch&&!l?se.liveMatch:"",e.is_tappable?se.tappable:se.nonTappable,y?se.pressed:"",f?se.scrollHint:""].filter(Boolean).join(" ");return(0,le.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":E&&e.icon?e.icon:void 0,"data-aia-image":F?"":void 0,"data-aia-item-count":ne!==null?e.item_count:void 0,"aria-selected":t??i,className:pe,style:{[ge.OPTION_ENTER_DELAY_VAR]:`${u}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:_,onKeyDown:T=>{!l&&e.is_tappable&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),_())},onMouseEnter:!l&&e.is_tappable?o:void 0,onMouseLeave:s,children:(0,le.jsxs)("span",{className:se.content,children:[t!==void 0&&e.is_tappable&&(0,le.jsx)("span",{className:se.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),F&&H.length>1&&(0,le.jsx)("span",{className:`${se.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":H.length,"data-aia-image-loaded":oe?"":void 0,children:H.map(T=>(0,le.jsx)("img",{src:T,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>G(!0),onError:W=>{W.currentTarget.hidden=!0}},T))}),F&&H.length<=1&&(0,le.jsx)("span",{className:`${se.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":A!==null&&de===A?"":void 0,children:(0,le.jsx)("img",{src:A??F,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:A===null,onLoad:()=>ce(A),onError:()=>{A!==null&&he(T=>[...T,A])}})}),E&&(0,le.jsx)("span",{className:`${se.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:E}}),(0,le.jsxs)("span",{className:se.text,children:[e.matchedText?(0,ge.highlightParts)((0,ge.optionLabel)(e),e.matchedText).map((T,W)=>T.bold?(0,le.jsx)("strong",{className:`${se.match} magicx-aia-option-match`,"data-aia-match-partial":T.partial?"":void 0,children:T.text},W):T.text):(0,ge.optionLabel)(e),e.parameterLabel&&(0,le.jsxs)(le.Fragment,{children:[" ",(0,le.jsx)("span",{className:`${se.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,le.jsx)("span",{className:se.tag,children:e.tag}),ne!==null&&(0,le.jsx)("span",{className:`${se.count} magicx-aia-option-count`,children:ne})]})})}var _a=require("react/jsx-runtime");function ei(){let[e,i]=(0,ze.useState)(Z.isOptionsGridMobileViewport);return(0,ze.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(Z.OPTIONS_GRID_MOBILE_QUERY),n=()=>i(t.matches);return n(),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[]),e}function ft({options:e,activeIndex:i,picked:t,onSelect:n,onHighlight:o,onUnhighlight:s,listboxId:r,loading:l,groupKey:b="",optionsPosition:v="below",showIcons:x=!0,showImages:f=!0,showCounts:h=!0}){let u=ei(),y=(0,ze.useRef)(null),[k,C]=(0,ze.useState)(null),F=(0,ze.useRef)(null);(0,ze.useLayoutEffect)(()=>{if(l&&(0,Z.sameOptionRows)(F.current,e))return;F.current=l?null:e;let A=y.current,H=A&&!l&&(0,Z.needsOptionsGridMeasurement)(e.length,u),oe=A?.closest("[data-aia-dropdown]");H&&oe&&(0,Z.releasePanelHug)(oe);let G=H?(0,Z.measureOptionsGrid)(A):null;C(G?(0,Z.planOptionsGrid)(e.length,u,G.rowWidths,G.gridWidth):null)},[e,u,l]);let M=k??(0,Z.planOptionsGrid)(e.length,u,null,null);(0,ze.useLayoutEffect)(()=>{let A=y.current?.closest("[data-aia-dropdown]");A&&(0,Z.syncPanelHug)(A)},[M.template,u]);let he=(0,Z.optionsShowLeadingVisuals)(e,x,f);return(0,_a.jsx)(ut,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:b,template:M.template,maxHeight:M.maxHeight,innerRef:A=>{y.current=A},"data-aia-group":b,children:e.map((A,H)=>(0,_a.jsx)(gt,{option:A,isHighlighted:H===i,checked:t?t.includes(A.text):void 0,onSelect:n,onHighlight:()=>o(H),onUnhighlight:s?()=>s(H):void 0,id:`${r}-option-${H}`,loading:l,showIcon:x&&he,showImage:f&&he,showCount:h,scrollHint:!l&&M.scrollHintIndices.includes(H),enterDelayMs:l?0:(0,Z.optionEnterDelayMs)(H,M.cols,e.length,v)},`${b}\0${A.parameter??""}\0${A.text}`))})}var fe=require("@magicx-eng/ai-autocomplete-vanilla"),Oe=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) ---
3697
+ `,document.head.appendChild(e)}var le={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg"};var de=require("react/jsx-runtime");function gt({option:e,isHighlighted:i,checked:t,onSelect:n,onHighlight:o,onUnhighlight:s,id:r,loading:l,showIcon:b=!0,showImage:v=!0,showCount:y=!0,scrollHint:f,enterDelayMs:h=0}){let[u]=(0,Pe.useState)(h),[x,k]=(0,Pe.useState)(!1),C=v?(0,ge.optionImageSources)(e.image_url):[],F=C[0]??null,[M,he]=(0,Pe.useState)([]),Q=C.find(T=>!M.includes(T))??null,z=v?(e.imageCollage??[]).map(T=>(0,ge.optionImageSources)(T)[0]).filter(T=>T!==void 0):[],[W,H]=(0,Pe.useState)(!1),[X,ce]=(0,Pe.useState)(null),A=(0,Pe.useMemo)(()=>!F&&b&&e.icon_svg?(0,ge.sanitizeOptionIconSvg)(e.icon_svg):null,[F,b,e.icon_svg]),re=y?(0,ge.formatOptionCount)(e.item_count):null,ue=(0,Pe.useRef)(void 0);(0,Pe.useEffect)(()=>()=>clearTimeout(ue.current),[]);let V=T=>{if(l||!e.is_tappable||x&&t===void 0)return;k(!0);let G=T?.currentTarget;t!==void 0&&G!==void 0&&T!==void 0&&!(0,ge.isMultiSelectToggleTap)(G,G.querySelector("[data-aia-checkbox]"),T)?n(e,{commit:!0}):n(e),clearTimeout(ue.current),ue.current=setTimeout(()=>k(!1),170)},pe=[le.item,i&&!l?le.highlighted:"",e.liveMatch&&!l?le.liveMatch:"",e.is_tappable?le.tappable:le.nonTappable,x?le.pressed:"",f?le.scrollHint:""].filter(Boolean).join(" ");return(0,de.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":A&&e.icon?e.icon:void 0,"data-aia-image":F?"":void 0,"data-aia-item-count":re!==null?e.item_count:void 0,"aria-selected":t??i,className:pe,style:{[ge.OPTION_ENTER_DELAY_VAR]:`${u}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:V,onKeyDown:T=>{!l&&e.is_tappable&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),V())},onMouseEnter:!l&&e.is_tappable?o:void 0,onMouseLeave:s,children:(0,de.jsxs)("span",{className:le.content,children:[t!==void 0&&e.is_tappable&&(0,de.jsx)("span",{className:le.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),F&&z.length>1&&(0,de.jsx)("span",{className:`${le.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":z.length,"data-aia-image-loaded":W?"":void 0,children:z.map(T=>(0,de.jsx)("img",{src:T,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>H(!0),onError:G=>{G.currentTarget.hidden=!0}},T))}),F&&z.length<=1&&(0,de.jsx)("span",{className:`${le.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":Q!==null&&X===Q?"":void 0,children:(0,de.jsx)("img",{src:Q??F,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:Q===null,onLoad:()=>ce(Q),onError:()=>{Q!==null&&he(T=>[...T,Q])}})}),A&&(0,de.jsx)("span",{className:`${le.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:A}}),(0,de.jsxs)("span",{className:le.text,children:[e.matchedText?(0,ge.highlightParts)((0,ge.optionLabel)(e),e.matchedText).map((T,G)=>T.bold?(0,de.jsx)("strong",{className:`${le.match} magicx-aia-option-match`,"data-aia-match-partial":T.partial?"":void 0,children:T.text},G):T.text):(0,ge.optionLabel)(e),e.parameterLabel&&(0,de.jsxs)(de.Fragment,{children:[" ",(0,de.jsx)("span",{className:`${le.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,de.jsx)("span",{className:le.tag,children:e.tag}),re!==null&&(0,de.jsx)("span",{className:`${le.count} magicx-aia-option-count`,children:re})]})})}var _a=require("react/jsx-runtime");function ei(){let[e,i]=(0,Ie.useState)(K.isOptionsGridMobileViewport);return(0,Ie.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(K.OPTIONS_GRID_MOBILE_QUERY),n=()=>i(t.matches);return n(),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[]),e}function ft({options:e,activeIndex:i,picked:t,onSelect:n,onHighlight:o,onUnhighlight:s,listboxId:r,loading:l,groupKey:b="",optionsPosition:v="below",showIcons:y=!0,showImages:f=!0,showCounts:h=!0}){let u=ei(),x=(0,Ie.useRef)(null),[k,C]=(0,Ie.useState)(null),F=(0,Ie.useRef)(null);(0,Ie.useLayoutEffect)(()=>{if(l&&(0,K.sameOptionRows)(F.current,e))return;F.current=l?null:e;let z=x.current,W=z&&!l&&(0,K.needsOptionsGridMeasurement)(e.length,u),H=z?.closest("[data-aia-dropdown]");W&&H&&(0,K.releasePanelHug)(H);let X=W?(0,K.measureOptionsGrid)(z):null;C(X?(0,K.planOptionsGrid)(e.length,u,X.rowWidths,X.gridWidth):null)},[e,u,l]);let M=k??(0,K.planOptionsGrid)(e.length,u,null,null);(0,Ie.useLayoutEffect)(()=>{let z=x.current?.closest("[data-aia-dropdown]");z&&(0,K.syncPanelHug)(z)},[M.template,u]);let he=l?-1:i;(0,Ie.useLayoutEffect)(()=>{x.current&&(0,K.syncHighlightScroll)(x.current,he)},[he]);let Q=(0,K.optionsShowLeadingVisuals)(e,y,f);return(0,_a.jsx)(ut,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:b,template:M.template,maxHeight:M.maxHeight,innerRef:z=>{x.current=z},"data-aia-group":b,children:e.map((z,W)=>(0,_a.jsx)(gt,{option:z,isHighlighted:W===i,checked:t?t.includes(z.text):void 0,onSelect:n,onHighlight:H=>{(0,K.pointerMayHighlight)(x.current,W,H)&&o(W)},onUnhighlight:s?H=>{(0,K.pointerMayHighlight)(x.current,-1,H)&&s(W)}:void 0,id:`${r}-option-${W}`,loading:l,showIcon:y&&Q,showImage:f&&Q,showCount:h,scrollHint:!l&&M.scrollHintIndices.includes(W),enterDelayMs:l?0:(0,K.optionEnterDelayMs)(W,M.cols,e.length,v)},`${b}\0${z.parameter??""}\0${z.text}`))})}var fe=require("@magicx-eng/ai-autocomplete-vanilla"),Oe=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) ---
3670
3698
 
3671
3699
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
3672
3700
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -3788,7 +3816,7 @@
3788
3816
  .aia-done-llNY5:hover {
3789
3817
  background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
3790
3818
  }
3791
- `,document.head.appendChild(e)}var Re={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 Ie=require("react/jsx-runtime"),ai=120;function bt({view:e,label:i,doneLabel:t,interactive:n=!0,onTimeChange:o,onTimeCommit:s}){return(0,Ie.jsxs)("div",{className:Re.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":i,onMouseDown:r=>r.preventDefault(),children:[(0,Ie.jsx)("span",{className:Re.value,"data-aia-time-value":"","aria-live":"polite",children:(0,fe.formatTime)(e.minutes)}),(0,Ie.jsxs)("div",{className:Re.columns,"aria-hidden":"true",children:[(0,Ie.jsx)("div",{className:Re.band}),fe.TIME_WHEEL_COLUMNS.map(r=>(0,Ie.jsxs)(Oe.Fragment,{children:[r==="minute"&&(0,Ie.jsx)("span",{className:Re.separator,children:":"}),(0,Ie.jsx)(ti,{column:r,minutes:e.minutes,interactive:n,onTimeChange:o})]},r))]}),(0,Ie.jsx)("button",{type:"button",tabIndex:-1,className:Re.done,"data-aia-time-done":"",onClick:()=>{n&&s()},children:t})]})}function ti({column:e,minutes:i,interactive:t,onTimeChange:n}){let o=(0,Oe.useRef)(null),s=(0,Oe.useRef)(null),r=(0,Oe.useRef)(null),l=(0,Oe.useRef)({minutes:i,interactive:t,onTimeChange:n});l.current={minutes:i,interactive:t,onTimeChange:n};let b=(0,fe.timeWheelIndex)(e,i);(0,Oe.useLayoutEffect)(()=>{let f=o.current;if(!f||r.current)return;let h=b*fe.TIME_WHEEL_ROW_HEIGHT;Math.abs(f.scrollTop-h)<1||(s.current=h,f.scrollTop=h)},[b]),(0,Oe.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let f=o.current,h=l.current;if(!f||!h.interactive)return;let u=(0,fe.timeWheelIndexFromScroll)(e,f.scrollTop);u!==(0,fe.timeWheelIndex)(e,h.minutes)&&h.onTimeChange((0,fe.withTimeWheelIndex)(e,h.minutes,u))},x=()=>{let f=o.current;if(f){if(s.current!=null&&Math.abs(f.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,ai)}};return(0,Ie.jsx)("div",{ref:o,className:Re.column,"data-aia-time-column":e,onScroll:x,children:(0,fe.timeWheelRows)(e).map((f,h)=>(0,Ie.jsx)("div",{className:h===b?`${Re.row} ${Re.selected}`:Re.row,"data-aia-time-row":"","data-aia-index":h,onClick:()=>{l.current.interactive&&n((0,fe.withTimeWheelIndex)(e,l.current.minutes,h))},children:f.label},f.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3819
+ `,document.head.appendChild(e)}var Re={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 Ae=require("react/jsx-runtime"),ai=120;function bt({view:e,label:i,doneLabel:t,interactive:n=!0,onTimeChange:o,onTimeCommit:s}){return(0,Ae.jsxs)("div",{className:Re.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":i,onMouseDown:r=>r.preventDefault(),children:[(0,Ae.jsx)("span",{className:Re.value,"data-aia-time-value":"","aria-live":"polite",children:(0,fe.formatTime)(e.minutes)}),(0,Ae.jsxs)("div",{className:Re.columns,"aria-hidden":"true",children:[(0,Ae.jsx)("div",{className:Re.band}),fe.TIME_WHEEL_COLUMNS.map(r=>(0,Ae.jsxs)(Oe.Fragment,{children:[r==="minute"&&(0,Ae.jsx)("span",{className:Re.separator,children:":"}),(0,Ae.jsx)(ti,{column:r,minutes:e.minutes,interactive:n,onTimeChange:o})]},r))]}),(0,Ae.jsx)("button",{type:"button",tabIndex:-1,className:Re.done,"data-aia-time-done":"",onClick:()=>{n&&s()},children:t})]})}function ti({column:e,minutes:i,interactive:t,onTimeChange:n}){let o=(0,Oe.useRef)(null),s=(0,Oe.useRef)(null),r=(0,Oe.useRef)(null),l=(0,Oe.useRef)({minutes:i,interactive:t,onTimeChange:n});l.current={minutes:i,interactive:t,onTimeChange:n};let b=(0,fe.timeWheelIndex)(e,i);(0,Oe.useLayoutEffect)(()=>{let f=o.current;if(!f||r.current)return;let h=b*fe.TIME_WHEEL_ROW_HEIGHT;Math.abs(f.scrollTop-h)<1||(s.current=h,f.scrollTop=h)},[b]),(0,Oe.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let f=o.current,h=l.current;if(!f||!h.interactive)return;let u=(0,fe.timeWheelIndexFromScroll)(e,f.scrollTop);u!==(0,fe.timeWheelIndex)(e,h.minutes)&&h.onTimeChange((0,fe.withTimeWheelIndex)(e,h.minutes,u))},y=()=>{let f=o.current;if(f){if(s.current!=null&&Math.abs(f.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,ai)}};return(0,Ae.jsx)("div",{ref:o,className:Re.column,"data-aia-time-column":e,onScroll:y,children:(0,fe.timeWheelRows)(e).map((f,h)=>(0,Ae.jsx)("div",{className:h===b?`${Re.row} ${Re.selected}`:Re.row,"data-aia-time-row":"","data-aia-index":h,onClick:()=>{l.current.interactive&&n((0,fe.withTimeWheelIndex)(e,l.current.minutes,h))},children:f.label},f.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3792
3820
  display: flex;
3793
3821
  flex-direction: column;
3794
3822
  gap: var(--aia-stack-space, 0.5rem);
@@ -3803,7 +3831,7 @@
3803
3831
  align-items: end;
3804
3832
  }
3805
3833
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
3806
- `,document.head.appendChild(e)}var vt=require("react/jsx-runtime");function wt({space:e,align:i="stretch",className:t,children:n,...o}){let s=e?{"--aia-stack-space":e}:void 0;return(0,vt.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":i,style:s,...o,children:n})}var U=require("react/jsx-runtime"),ii=typeof window>"u"?X.useEffect:X.useLayoutEffect,oi=[159,119,164],ni=()=>{},xt=()=>{},ri=e=>{},si=()=>{},li=e=>{},di=e=>{},ci=e=>{},pi=e=>{};function hi(e){let i=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,n]=(0,X.useState)(i);if((0,X.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>n(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ui(e,i){let t=(0,X.useRef)(null);(0,X.useEffect)(()=>{let n=e.current,o=i.current;if(!n||!o)return;let s=(0,L.queryLive)(n,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==s&&(t.current.controller.destroy(),t.current=null),s&&!t.current){t.current={grid:s,controller:(0,L.attachScrollArrow)({dropdown:n,grid:s,button:o})};return}t.current?.controller.update()}),(0,X.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function mi(e,i){let t=(0,X.useRef)(i);t.current=i;let n=(0,X.useRef)(null);(0,X.useLayoutEffect)(()=>{let o=e.current;if(o){if(!n.current){n.current=(0,L.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}n.current.update()}}),(0,X.useEffect)(()=>()=>{n.current?.destroy(),n.current=null},[])}function La({suggestions:e,activeIndex:i,onSelect:t,onHighlight:n,onUnhighlight:o,isOpen:s,id:r,className:l,pills:b,onPillClick:v,showPills:x=!0,onSkip:f,showSkipButton:h=!0,showOptionIcons:u=!0,showOptionImages:y=!0,showOptionCounts:k=!0,skipDisabled:C=!1,activeSelected:F=!1,isLoading:M=!1,skeletonExiting:he=!1,isInputEmpty:A=!1,language:H,products:oe,onProductSelect:G,onProductAddToCart:de,onProductFocusChange:ce,productsLayout:E="row",productImageFallback:ne="image",showProductVendor:ue=!0,formatType:_="options",dateView:pe=null,selectedDateIso:T=null,selectedDateRange:W=null,dateRangeStart:p=null,dateReferences:P,onPreviousMonth:Qe,onNextMonth:Ke,timeView:Ye=null,multiSelectView:je=null,onMultiSelectCommit:m,onSeeAllResults:$e,seeAllBusy:De=!1,busyProductId:Ze=null,fullWidth:Xe=!1,onTimeChange:g,onTimeCommit:S,locationView:I=null,isReediting:R=!1,onLocationQuery:N,onLocationMove:te,onLocationCommit:Se,onLocationFocusChange:Ae,isFocused:qe=!1,optionsPosition:_e="below",mode:Je}){let ea=hi(Je),Me=ea!==void 0,me=(0,X.useRef)(null),aa=(0,X.useRef)(null);ui(me,aa),(0,X.useEffect)(()=>{if(me.current)return(0,L.containScroll)(me.current)},[]);let wa=e[0]?.options??[],Ne=!!(b&&b.length>0&&v),ua=!!(oe&&oe.length>0),ta=_==="time"&&Ye!=null,w=_==="location"&&I!=null,be=s&&(wa.length>0||x&&Ne||M||ua||ta||w);mi(me,be),ii(()=>{let O=me.current;O&&((0,L.fitMultiSelectDone)(O,(0,L.findMultiSelectDone)(O)),(0,L.syncPanelHug)(O))});let ia={suggestions:e,activeIndex:i,pills:b,showPills:x,showSkipButton:h,showOptionIcons:u,showOptionImages:y,showOptionCounts:k,skipDisabled:C,activeSelected:F,isLoading:M,skeletonExiting:he,isInputEmpty:A,products:oe,formatType:_,dateView:pe,selectedDateIso:T,selectedDateRange:W,dateRangeStart:p,dateReferences:P,timeView:Ye,multiSelectView:je,locationView:I,isReediting:R,showsSeeAll:!!$e},oa=(0,X.useRef)(ia);be&&(oa.current=ia);let a=be?ia:oa.current,ie=(0,L.uiStringsFor)(H),na=a.suggestions[0],we=na?.options??[],va=a.activeIndex>=0&&!!we[a.activeIndex]?.is_tappable,Fe=(0,L.labelTraditionalAutocomplete)(a.pills??[],ie.keepTyping),Ee=!!(Fe.length>0&&v),ma=a.showPills&&Ee,ra=a.showPills&&!Ee&&a.isLoading,He=ma||ra,da=Ee&&(0,L.hasSkippablePill)(Fe)&&a.showSkipButton&&!a.isInputEmpty&&!!f,ca=Fe[0]?.text,ga=(0,L.isCalendarFormat)(a.formatType)&&a.dateView!=null,Ve=we.length>0&&!ga,pa=we.length>0&&ga&&!a.isLoading,d=a.formatType==="time"&&a.timeView!=null&&!a.isLoading,Y=a.formatType==="location"&&a.locationView!=null&&!a.isLoading,K=a.isLoading&&!Ve&&!pa&&!d&&!Y,fa=a.products??[],Pa=(0,L.panelMorphKey)(ma?Fe:[]);return(0,X.useLayoutEffect)(()=>{me.current&&(0,L.settlePanelMorph)(me.current,Pa,{visible:be,anchorBottom:_e==="above"})},[Pa,be,_e,a.suggestions,a.pills,a.isLoading,a.skeletonExiting,a.isInputEmpty,a.products,a.formatType,a.dateView,a.selectedDateIso,a.selectedDateRange,a.dateRangeStart,a.dateReferences,a.timeView,a.multiSelectView,a.locationView,a.showPills,a.showSkipButton,a.showOptionIcons,a.showOptionImages,a.showOptionCounts,a.showsSeeAll,E,H]),(0,X.useEffect)(()=>{let O=me.current;return()=>{O&&(0,L.destroyPanelMorph)(O)}},[]),(0,U.jsxs)("div",{ref:me,id:r,role:"listbox","aria-multiselectable":!!a.multiSelectView,"data-aia-dropdown":"","data-options-position":_e,"data-mode":ea,"data-aia-loading":a.isLoading?"":void 0,"data-aia-skeleton-exiting":a.skeletonExiting?"":void 0,"data-aia-has-products":fa.length>0?"":void 0,"data-aia-full-width":Xe?"":void 0,className:`${Me?"magicx-aia ":""}${Ce.dropdown} ${be?Ce.visible:""} ${l??""}`,onMouseDown:O=>O.preventDefault(),children:[(0,U.jsxs)(wt,{space:"8px",children:[(He||da)&&(0,U.jsxs)(Sa,{noWrap:!0,className:Ce.pillBar,"data-aia-pillbar":"",children:[He&&(0,U.jsx)("span",{className:Ce.pillScroll,"data-aia-pill-scroll":"",children:(0,U.jsx)(Ra,{pills:Fe,activePillIndex:0,activeSelected:a.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:a.isLoading})}),da&&(0,U.jsx)("button",{type:"button",tabIndex:-1,className:Ce.skip,"data-aia-skip":"",disabled:a.isLoading||a.skipDisabled,"aria-label":ca?`${ie.skipLabel} ${ca}`:ie.skipLabel,onClick:f,children:ie.skip})]}),Ve&&(0,U.jsx)(ft,{options:we,activeIndex:a.activeIndex,onSelect:t,onHighlight:n,onUnhighlight:o,listboxId:r,loading:a.isLoading,groupKey:na?`${na.parameter} ${na.text}`:"",optionsPosition:_e,showIcons:a.showOptionIcons,showImages:a.showOptionImages,showCounts:a.showOptionCounts,picked:a.multiSelectView?.picked}),a.multiSelectView&&(0,U.jsx)("div",{"data-aia-multi-actions":"",onClick:O=>{O.target.closest("[data-aia-multi-done]")&&!a.skipDisabled&&!a.isLoading&&m?.()},children:(0,U.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Ce.multiDone,ref:O=>{O&&(O.disabled=!0,O.offsetHeight,O.disabled=a.skipDisabled||a.isLoading)},children:ie.done})}),pa&&a.dateView&&(0,U.jsx)(tt,{options:we,activeIndex:a.activeIndex,listboxId:r,view:a.dateView,selection:{selectedIso:a.selectedDateIso??null,selectedRange:a.selectedDateRange??null,rangeStart:a.dateRangeStart??null,floor:(0,L.dateFloorFor)(a.formatType,a.dateRangeStart),references:a.dateReferences??[]},onSelect:t,onHighlight:n,onUnhighlight:o,onPreviousMonth:Qe??xt,onNextMonth:Ke??xt}),d&&a.timeView&&(0,U.jsx)(bt,{view:a.timeView,label:ie.timeLabel,doneLabel:ie.done,interactive:!a.skipDisabled,onTimeChange:g??ri,onTimeCommit:S??si}),Y&&a.locationView&&(0,U.jsx)(st,{view:a.locationView,searchLabel:ie.locationSearch,noResultsLabel:ie.locationNoResults,useTypedLabel:ie.locationUseTyped,widgetFocused:qe&&be,reediting:a.isReediting,visible:be,interactive:!a.skipDisabled,onQuery:N??li,onMove:te??di,onCommit:Se??ci,onFocusChange:Ae??pi}),K&&(0,U.jsx)("div",{className:Ce.skeletonBars,"data-aia-skeleton-bars":"",children:oi.map(O=>(0,U.jsx)("span",{className:Ce.skeletonBar,style:{width:O}},`bar-${O}`))}),(0,U.jsx)(pt,{products:fa,listboxId:r,onSelect:G??ni,busyProductId:Ze,onAddToCart:de,onFocusChange:ce,focusable:be&&!a.isLoading,loading:a.isLoading,layout:E,imageFallback:ne,showVendor:ue,strings:ie}),a.showsSeeAll&&(0,U.jsx)("div",{className:Ce.seeAllRow,"data-aia-see-all":"",onClick:O=>{O.target.closest("[data-aia-see-all-button]")&&(O.stopPropagation(),!(a.isLoading||De)&&$e?.())},children:(0,U.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"","data-aia-see-all-state":De?"busy":void 0,"aria-busy":De?!0:void 0,className:Ce.seeAll,ref:O=>{O&&(O.disabled=!0,O.offsetHeight,O.disabled=a.isLoading)},children:ie.seeAllResults})}),(0,U.jsx)(it,{isOptionHighlighted:va,isInputEmpty:a.isInputEmpty,strings:ie})]}),(0,U.jsx)("button",{ref:aa,type:"button",tabIndex:-1,className:Ce.scrollArrow,"data-aia-scroll-arrow":"","aria-label":ie.scrollArrow,"aria-hidden":"true",children:(0,U.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,U.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Ge=require("@magicx-eng/ai-autocomplete-vanilla");var kt=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 {
3834
+ `,document.head.appendChild(e)}var vt=require("react/jsx-runtime");function wt({space:e,align:i="stretch",className:t,children:n,...o}){let s=e?{"--aia-stack-space":e}:void 0;return(0,vt.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":i,style:s,...o,children:n})}var Y=require("react/jsx-runtime"),ii=typeof window>"u"?ee.useEffect:ee.useLayoutEffect,oi=[159,119,164],ni=()=>{},xt=()=>{},ri=e=>{},si=()=>{},li=e=>{},di=e=>{},ci=e=>{},pi=e=>{};function hi(e){let i=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,n]=(0,ee.useState)(i);if((0,ee.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>n(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ui(e,i){let t=(0,ee.useRef)(null);(0,ee.useEffect)(()=>{let n=e.current,o=i.current;if(!n||!o)return;let s=(0,L.queryLive)(n,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==s&&(t.current.controller.destroy(),t.current=null),s&&!t.current){t.current={grid:s,controller:(0,L.attachScrollArrow)({dropdown:n,grid:s,button:o})};return}t.current?.controller.update()}),(0,ee.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function mi(e,i){let t=(0,ee.useRef)(i);t.current=i;let n=(0,ee.useRef)(null);(0,ee.useLayoutEffect)(()=>{let o=e.current;if(o){if(!n.current){n.current=(0,L.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}n.current.update()}}),(0,ee.useEffect)(()=>()=>{n.current?.destroy(),n.current=null},[])}function La({suggestions:e,activeIndex:i,onSelect:t,onHighlight:n,onUnhighlight:o,isOpen:s,id:r,className:l,pills:b,onPillClick:v,showPills:y=!0,onSkip:f,showSkipButton:h=!0,showOptionIcons:u=!0,showOptionImages:x=!0,showOptionCounts:k=!0,skipDisabled:C=!1,activeSelected:F=!1,isLoading:M=!1,skeletonExiting:he=!1,isInputEmpty:Q=!1,language:z,products:W,onProductSelect:H,onProductAddToCart:X,onProductFocusChange:ce,productsLayout:A="row",productImageFallback:re="image",showProductVendor:ue=!0,formatType:V="options",dateView:pe=null,selectedDateIso:T=null,selectedDateRange:G=null,dateRangeStart:p=null,dateReferences:P,onPreviousMonth:Qe,onNextMonth:Ke,timeView:Ye=null,multiSelectView:je=null,onMultiSelectCommit:m,onSeeAllResults:$e,seeAllBusy:De=!1,busyProductId:Ze=null,fullWidth:Xe=!1,onTimeChange:g,onTimeCommit:S,locationView:I=null,isReediting:R=!1,onLocationQuery:N,onLocationMove:oe,onLocationCommit:Se,onLocationFocusChange:Ee,isFocused:qe=!1,optionsPosition:_e="below",mode:Je}){let ea=hi(Je),Me=ea!==void 0,me=(0,ee.useRef)(null),aa=(0,ee.useRef)(null);ui(me,aa),(0,ee.useEffect)(()=>{if(me.current)return(0,L.containScroll)(me.current)},[]);let wa=e[0]?.options??[],Ne=!!(b&&b.length>0&&v),ua=!!(W&&W.length>0),ta=V==="time"&&Ye!=null,w=V==="location"&&I!=null,be=s&&(wa.length>0||y&&Ne||M||ua||ta||w);mi(me,be),ii(()=>{let O=me.current;O&&((0,L.fitMultiSelectDone)(O,(0,L.findMultiSelectDone)(O)),(0,L.syncPanelHug)(O))});let ia={suggestions:e,activeIndex:i,pills:b,showPills:y,showSkipButton:h,showOptionIcons:u,showOptionImages:x,showOptionCounts:k,skipDisabled:C,activeSelected:F,isLoading:M,skeletonExiting:he,isInputEmpty:Q,products:W,formatType:V,dateView:pe,selectedDateIso:T,selectedDateRange:G,dateRangeStart:p,dateReferences:P,timeView:Ye,multiSelectView:je,locationView:I,isReediting:R,showsSeeAll:!!$e},oa=(0,ee.useRef)(ia);be&&(oa.current=ia);let a=be?ia:oa.current,ne=(0,L.uiStringsFor)(z),na=a.suggestions[0],we=na?.options??[],va=a.activeIndex>=0&&!!we[a.activeIndex]?.is_tappable,He=(0,L.labelTraditionalAutocomplete)(a.pills??[],ne.keepTyping),ze=!!(He.length>0&&v),ma=a.showPills&&ze,ra=a.showPills&&!ze&&a.isLoading,Fe=ma||ra,da=ze&&(0,L.hasSkippablePill)(He)&&a.showSkipButton&&!a.isInputEmpty&&!!f,ca=He[0]?.text,ga=(0,L.isCalendarFormat)(a.formatType)&&a.dateView!=null,Ve=we.length>0&&!ga,pa=we.length>0&&ga&&!a.isLoading,d=a.formatType==="time"&&a.timeView!=null&&!a.isLoading,$=a.formatType==="location"&&a.locationView!=null&&!a.isLoading,q=a.isLoading&&!Ve&&!pa&&!d&&!$,fa=a.products??[],Pa=(0,L.panelMorphKey)(ma?He:[]);return(0,ee.useLayoutEffect)(()=>{me.current&&(0,L.settlePanelMorph)(me.current,Pa,{visible:be,anchorBottom:_e==="above"})},[Pa,be,_e,a.suggestions,a.pills,a.isLoading,a.skeletonExiting,a.isInputEmpty,a.products,a.formatType,a.dateView,a.selectedDateIso,a.selectedDateRange,a.dateRangeStart,a.dateReferences,a.timeView,a.multiSelectView,a.locationView,a.showPills,a.showSkipButton,a.showOptionIcons,a.showOptionImages,a.showOptionCounts,a.showsSeeAll,A,z]),(0,ee.useEffect)(()=>{let O=me.current;return()=>{O&&(0,L.destroyPanelMorph)(O)}},[]),(0,Y.jsxs)("div",{ref:me,id:r,role:"listbox","aria-multiselectable":!!a.multiSelectView,"data-aia-dropdown":"","data-options-position":_e,"data-mode":ea,"data-aia-loading":a.isLoading?"":void 0,"data-aia-skeleton-exiting":a.skeletonExiting?"":void 0,"data-aia-has-products":fa.length>0?"":void 0,"data-aia-full-width":Xe?"":void 0,className:`${Me?"magicx-aia ":""}${Ce.dropdown} ${be?Ce.visible:""} ${l??""}`,onMouseDown:O=>O.preventDefault(),children:[(0,Y.jsxs)(wt,{space:"8px",children:[(Fe||da)&&(0,Y.jsxs)(Sa,{noWrap:!0,className:Ce.pillBar,"data-aia-pillbar":"",children:[Fe&&(0,Y.jsx)("span",{className:Ce.pillScroll,"data-aia-pill-scroll":"",children:(0,Y.jsx)(Ra,{pills:He,activePillIndex:0,activeSelected:a.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:a.isLoading})}),da&&(0,Y.jsx)("button",{type:"button",tabIndex:-1,className:Ce.skip,"data-aia-skip":"",disabled:a.isLoading||a.skipDisabled,"aria-label":ca?`${ne.skipLabel} ${ca}`:ne.skipLabel,onClick:f,children:ne.skip})]}),Ve&&(0,Y.jsx)(ft,{options:we,activeIndex:a.activeIndex,onSelect:t,onHighlight:n,onUnhighlight:o,listboxId:r,loading:a.isLoading,groupKey:na?`${na.parameter} ${na.text}`:"",optionsPosition:_e,showIcons:a.showOptionIcons,showImages:a.showOptionImages,showCounts:a.showOptionCounts,picked:a.multiSelectView?.picked}),a.multiSelectView&&(0,Y.jsx)("div",{"data-aia-multi-actions":"",onClick:O=>{O.target.closest("[data-aia-multi-done]")&&!a.skipDisabled&&!a.isLoading&&m?.()},children:(0,Y.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Ce.multiDone,ref:O=>{O&&(O.disabled=!0,O.offsetHeight,O.disabled=a.skipDisabled||a.isLoading)},children:ne.done})}),pa&&a.dateView&&(0,Y.jsx)(tt,{options:we,activeIndex:a.activeIndex,listboxId:r,view:a.dateView,selection:{selectedIso:a.selectedDateIso??null,selectedRange:a.selectedDateRange??null,rangeStart:a.dateRangeStart??null,floor:(0,L.dateFloorFor)(a.formatType,a.dateRangeStart),references:a.dateReferences??[]},onSelect:t,onHighlight:n,onUnhighlight:o,onPreviousMonth:Qe??xt,onNextMonth:Ke??xt}),d&&a.timeView&&(0,Y.jsx)(bt,{view:a.timeView,label:ne.timeLabel,doneLabel:ne.done,interactive:!a.skipDisabled,onTimeChange:g??ri,onTimeCommit:S??si}),$&&a.locationView&&(0,Y.jsx)(st,{view:a.locationView,searchLabel:ne.locationSearch,noResultsLabel:ne.locationNoResults,useTypedLabel:ne.locationUseTyped,widgetFocused:qe&&be,reediting:a.isReediting,visible:be,interactive:!a.skipDisabled,onQuery:N??li,onMove:oe??di,onCommit:Se??ci,onFocusChange:Ee??pi}),q&&(0,Y.jsx)("div",{className:Ce.skeletonBars,"data-aia-skeleton-bars":"",children:oi.map(O=>(0,Y.jsx)("span",{className:Ce.skeletonBar,style:{width:O}},`bar-${O}`))}),(0,Y.jsx)(pt,{products:fa,listboxId:r,onSelect:H??ni,busyProductId:Ze,onAddToCart:X,onFocusChange:ce,focusable:be&&!a.isLoading,loading:a.isLoading,layout:A,imageFallback:re,showVendor:ue,strings:ne}),a.showsSeeAll&&(0,Y.jsx)("div",{className:Ce.seeAllRow,"data-aia-see-all":"",onClick:O=>{O.target.closest("[data-aia-see-all-button]")&&(O.stopPropagation(),!(a.isLoading||De)&&$e?.())},children:(0,Y.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"","data-aia-see-all-state":De?"busy":void 0,"aria-busy":De?!0:void 0,className:Ce.seeAll,ref:O=>{O&&(O.disabled=!0,O.offsetHeight,O.disabled=a.isLoading)},children:ne.seeAllResults})}),(0,Y.jsx)(it,{isOptionHighlighted:va,isInputEmpty:a.isInputEmpty,strings:ne})]}),(0,Y.jsx)("button",{ref:aa,type:"button",tabIndex:-1,className:Ce.scrollArrow,"data-aia-scroll-arrow":"","aria-label":ne.scrollArrow,"aria-hidden":"true",children:(0,Y.jsx)("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,Y.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Ge=require("@magicx-eng/ai-autocomplete-vanilla");var kt=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 {
3807
3835
  flex-shrink: 0;
3808
3836
  width: 32px;
3809
3837
  height: 32px;
@@ -3907,5 +3935,5 @@
3907
3935
  transition: none;
3908
3936
  }
3909
3937
  }
3910
- `,document.head.appendChild(e)}var yt={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};var Da=require("react/jsx-runtime");function St({disabled:e,ready:i,busy:t=!1,onClick:n,label:o=(0,kt.uiStringsFor)().submit}){return(0,Da.jsx)("button",{type:"button","data-aia-submit":"",className:yt.submitButton,disabled:e,"data-aia-ready":i?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:s=>{s.stopPropagation(),n()},"aria-label":o,children:(0,Da.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":o,children:(0,Da.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var ke=require("@magicx-eng/ai-autocomplete-vanilla"),z=require("react");var Va=require("react");function Ct(e){let i=(0,Va.useRef)(e);i.current=e;let t=Object.keys(e??{}).sort().join("\0"),n=(0,Va.useRef)({key:"",overrides:void 0});if(n.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(l,b,v)=>{let x=i.current?.[s];return x?x(l,b,v):[]};o[s]=r}n.current={key:t,overrides:e?o:void 0}}return{overrides:n.current.overrides,key:t}}var Ua=require("react");function Tt(e){let i=(0,Ua.useRef)(e);i.current=e;let t=(0,Ua.useRef)(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=i.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>i.current?.transform(o)??[],get limit(){return i.current?.limit}});let n=e!==void 0;return{config:n?t.current:void 0,enabled:n}}var Pt={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,isSubmitting:!1,selectingProductId:null,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Ma({onSubmit:e,onResult:i,onError:t,optionOverrides:n,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,visitorId:x,columns:f=2,dropdownTrigger:h,optionsPosition:u,closeDropdownOnBlur:y,prependPlaceholder:k,allOption:C,showNonTappableOptions:F,locationSearch:M,showOptionIcons:he,showOptionImages:A,showOptionCounts:H,showSkipButton:oe,showProducts:G,submitProgress:de,productImageFallback:ce="image",showProductVendor:E=!0,onFocus:ne,onBlur:ue,value:_,completedParams:pe,onChange:T,onParamsChange:W,products:p,mapProducts:P,onProductSelect:Qe,onProductAddToCart:Ke,source:Ye,setCursor:je}){let m=(0,z.useRef)(null),[$e,De]=(0,z.useState)(null),Ze=(0,z.useRef)(e);Ze.current=e;let Xe=(0,z.useRef)(i);Xe.current=i;let g=(0,z.useRef)(t);g.current=t;let S=(0,z.useRef)(T);S.current=T;let I=(0,z.useRef)(W);I.current=W;let R=(0,z.useRef)(ne);R.current=ne;let N=(0,z.useRef)(ue);N.current=ue;let te=(0,z.useRef)(je);te.current=je;let Se=(0,z.useRef)(Qe);Se.current=Qe;let Ae=(0,z.useRef)(Ke);Ae.current=Ke;let qe=(0,z.useRef)(x);qe.current=x;let _e=(0,z.useRef)(()=>{let d=qe.current;return typeof d=="function"?d():d}).current,Je=Tt(p),ea=(0,z.useRef)(P);ea.current=P;let Me=(0,z.useRef)((d,Y)=>{let K=ea.current;return K?K(d,Y):d}).current,me=P?Me:void 0,aa=Ct(n);(0,z.useEffect)(()=>{if(typeof document>"u")return;let d=new ke.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,visitorId:_e,optionOverrides:aa.overrides,maskCompletedText:o,columns:f,dropdownTrigger:h,optionsPosition:u,closeDropdownOnBlur:y,prependPlaceholder:k,allOption:C,showNonTappableOptions:F,locationSearch:M,showProducts:G,submitProgress:de,source:Ye,value:_,completedParams:pe,onSubmit:(...K)=>Ze.current?.(...K),onResult:(...K)=>Xe.current?.(...K),onError:(...K)=>g.current?.(...K),onChange:(...K)=>S.current?.(...K),onParamsChange:(...K)=>I.current?.(...K),onFocus:()=>R.current?.(),onBlur:()=>N.current?.(),onProductSelect:K=>Se.current?Se.current(K):ke.HANDOFF_NOT_HANDLED,onProductAddToCart:K=>Ae.current?.(K),setCursor:K=>te.current?.(K),products:Je.config,mapProducts:me});m.current=d,De(d.getState());let Y=d.subscribe(K=>De(K));return()=>{Y(),d.destroy(),m.current===d&&(m.current=null)}},[]),(0,z.useEffect)(()=>{_!==void 0&&m.current?.setValue(_)},[_]),(0,z.useEffect)(()=>{pe!==void 0&&m.current?.setCompletedParams(pe)},[pe]);let wa=JSON.stringify(s??null),Ne;try{Ne=JSON.stringify(r??null)}catch{Ne="[unstringifiable]"}(0,z.useEffect)(()=>{m.current?.update({apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,optionOverrides:aa.overrides,dropdownTrigger:h,optionsPosition:u,closeDropdownOnBlur:y,prependPlaceholder:k,allOption:C,showNonTappableOptions:F,locationSearch:M,showProducts:G,submitProgress:de})},[wa,Ne,l,b?.code,b?.rate,b?.country,v,aa.key,h,u,y,k,C,F,M,G,de]);let ua=(0,z.useRef)(!1);(0,z.useEffect)(()=>{if(!ua.current){ua.current=!0;return}m.current?.update({products:Je.config})},[Je.enabled]),(0,z.useEffect)(()=>{m.current?.update({mapProducts:me})},[me]);let ta=(0,z.useRef)(null);ta.current===null&&(ta.current={handleTextChange:d=>m.current?.handleTextChange(d),handleCompositionText:d=>m.current?.handleCompositionText(d),handleKeyDown:d=>{let Y="nativeEvent"in d?d.nativeEvent:d;m.current?.handleKeyDown(Y)},setFocused:d=>m.current?.setFocused(d),startEditingParam:d=>m.current?.startEditingParam(d),removeParam:d=>m.current?.removeParam(d)??!1,exitEditMode:()=>m.current?.exitEditMode(),handleCaretAfterInput:d=>m.current?.handleCaretAfterInput(d),handleCaretMove:d=>m.current?.handleCaretMove(d),replaceEditingRange:d=>m.current?.replaceEditingRange(d)??!1,setActivePill:d=>m.current?.setActivePill(d),skipActivePill:()=>m.current?.skipActivePill(),removeLastParam:()=>m.current?.removeLastParam(),clearNewParamId:()=>m.current?.clearNewParamId(),reset:()=>m.current?.reset(),refreshProducts:()=>m.current?.refreshProducts(),prepareSubmit:()=>m.current?.prepareSubmit(),getState:()=>m.current?.getState()??Pt,recordSubmit:d=>m.current?.recordSubmit(d),holdSubmit:d=>m.current?.holdSubmit(d),endSubmitProgress:()=>m.current?.endSubmitProgress(),selectOption:(d,Y)=>m.current?.selectOption(d,Y),selectProduct:d=>m.current?.selectProduct(d),addProductToCart:d=>{let Y=m.current;return!Y||!Ae.current?Promise.resolve():Y.addProductToCart(d)},setActiveDropdownIndex:d=>m.current?.setActiveDropdownIndex(d),clearHighlight:d=>m.current?.clearHighlight(d),showPreviousMonth:()=>m.current?.showPreviousMonth(),showNextMonth:()=>m.current?.showNextMonth(),setTime:d=>m.current?.setTime(d),commitTime:()=>m.current?.commitTime(),toggleMultiSelectOption:d=>m.current?.toggleMultiSelectOption(d),commitMultiSelect:()=>m.current?.commitMultiSelect(),setLocationQuery:d=>m.current?.setLocationQuery(d),moveLocationHighlight:d=>m.current?.moveLocationHighlight(d),commitLocation:d=>m.current?.commitLocation(d),setLocationFieldFocused:d=>m.current?.setLocationFieldFocused(d),handleFocus:()=>m.current?.setFocused(!0),handleBlur:()=>m.current?.setFocused(!1)});let w=ta.current,be=(0,z.useCallback)(d=>{let Y=d.target.value,fa=Y.length>0&&!d.nativeEvent?.isComposing&&Y[0]!==Y[0].toUpperCase()?Y[0].toUpperCase()+Y.slice(1):Y;m.current?.handleTextChange(fa)},[]),ia=(0,z.useCallback)(d=>{m.current?.handleKeyDown(d.nativeEvent)},[]),oa=m.current,a=$e??Pt,ie=_!==void 0?_:a.text,na=pe!==void 0?pe:a.completedParams,we=a.actionableSuggestions,va=we[0],Fe=(0,z.useMemo)(()=>(0,ke.withoutTraditionalAutocomplete)(we),[we]),Ee=oa?.listboxId??"",ma=a.activeDropdownIndex>=0&&oa?`${Ee}-option-${a.activeDropdownIndex}`:void 0,ra=a.editingParam,He=a.editingIdentified,da=ra?(0,ke.editingSuggestion)(ra):He?{parameter:He.parameter,text:(0,ke.identifiedParamLabel)(He.parameter),required:!0,options:[]}:null,ca=a.dropdownSuggestion??da??va,ga=(0,ke.dropdownPillsFor)(a.dropdownSuggestion,da,we),Ve=(0,ke.dateSelectionFor)(a),pa=!oa||a.dropdownLoading;return{completedParams:na,multiSelectView:a.multiSelectView,toggleMultiSelectOption:w.toggleMultiSelectOption,commitMultiSelect:w.commitMultiSelect,skippedParams:a.skippedParams,identifiedParams:a.identifiedParams,suggestionPills:Fe,setActivePill:w.setActivePill,skipActivePill:w.skipActivePill,removeLastParam:w.removeLastParam,segments:a.segments,newParamId:a.newParamId,clearNewParamId:w.clearNewParamId,suggestions:a.suggestions,activeIndex:a.activeDropdownIndex,isReady:a.isReady,isLoading:pa,isFocused:a.isFocused,isDropdownOpen:a.isDropdownOpen,isActivePillSelected:a.isActivePillSelected,placeholderText:a.placeholderText,listboxId:Ee,error:a.error,products:a.products,customFields:a.customFields,selectProduct:w.selectProduct,addProductToCart:w.addProductToCart,handleTextChange:w.handleTextChange,handleCompositionText:w.handleCompositionText,handleKeyDown:w.handleKeyDown,setFocused:w.setFocused,editingParam:ra,editingIdentified:He,editingAnchor:a.editingAnchor,caretOffset:a.caretOffset,startEditingParam:w.startEditingParam,removeParam:w.removeParam,exitEditMode:w.exitEditMode,handleCaretAfterInput:w.handleCaretAfterInput,handleCaretMove:w.handleCaretMove,replaceEditingRange:w.replaceEditingRange,inputProps:{value:ie,placeholder:a.placeholderText||void 0,onChange:be,onKeyDown:ia,onFocus:w.handleFocus,onBlur:w.handleBlur,role:"combobox","aria-expanded":a.isDropdownOpen,"aria-activedescendant":ma,"aria-autocomplete":"list","aria-controls":Ee},reset:w.reset,refreshProducts:w.refreshProducts,prepareSubmit:w.prepareSubmit,getState:w.getState,recordSubmit:w.recordSubmit,holdSubmit:w.holdSubmit,endSubmitProgress:w.endSubmitProgress,isSubmitting:a.isSubmitting,selectingProductId:a.selectingProductId,dropdownProps:{suggestions:ca?[{...ca,options:a.dropdownOptions}]:[],activeIndex:a.activeDropdownIndex,onSelect:w.selectOption,onHighlight:w.setActiveDropdownIndex,onUnhighlight:w.clearHighlight,isOpen:a.isDropdownOpen,id:Ee,pills:ga,activeSelected:a.isActivePillSelected,onPillClick:w.setActivePill,onSkip:w.skipActivePill,showSkipButton:(oe??!0)&&!ra&&!He,showOptionIcons:he??!0,showOptionImages:A??!0,showOptionCounts:H??!0,skipDisabled:a.inSelectionAnimation,isLoading:pa,skeletonExiting:a.skeletonExiting,isInputEmpty:ie.trim().length===0,language:l,products:a.products,productImageFallback:ce,showProductVendor:E,onProductSelect:w.selectProduct,busyProductId:a.selectingProductId,seeAllBusy:a.isSubmitting,onProductAddToCart:Ke?w.addProductToCart:void 0,onProductFocusChange:w.setFocused,formatType:a.activeFormatType,dateView:a.dateView,selectedDateIso:Ve.selectedIso,selectedDateRange:Ve.selectedRange,dateRangeStart:Ve.rangeStart,dateReferences:Ve.references,onPreviousMonth:w.showPreviousMonth,onNextMonth:w.showNextMonth,timeView:a.timeView,multiSelectView:a.dropdownMultiSelect,onMultiSelectCommit:w.commitMultiSelect,onTimeChange:w.setTime,onTimeCommit:w.commitTime,locationView:a.locationView,isReediting:a.editingParam!=null,onLocationQuery:w.setLocationQuery,onLocationMove:w.moveLocationHighlight,onLocationCommit:w.commitLocation,onLocationFocusChange:w.setLocationFieldFocused,isFocused:a.isFocused||a.locationFieldFocused,optionsPosition:u??"below"}}}var Q=require("@magicx-eng/ai-autocomplete-vanilla"),D=require("react"),Na;function gi(){if(Na!==void 0)return Na;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Na=e.contentEditable==="plaintext-only",Na}function It(e){let{segments:i,showChipIcons:t=!0,showChipImages:n=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:b,editingAnchor:v,caretOffset:x,placeholderText:f,hintSuggestions:h,isFocused:u,isDropdownOpen:y,listboxId:k,activeDescendantId:C,autoFocus:F,handleTextChange:M,handleCompositionText:he,handleKeyDown:A,handleCaretAfterInput:H,handleCaretMove:oe,startEditingParam:G,replaceEditingRange:de,setFocused:ce}=e,E=(0,D.useRef)(null),ne=(0,D.useRef)(!1),ue=(0,D.useRef)(""),_=(0,D.useRef)(""),pe=(0,D.useRef)(null),T=(0,D.useRef)(0);pe.current=x,(0,D.useEffect)(()=>{if(!F)return;let g=E.current;if(!g)return;document.activeElement===g?ce(!0):g.focus();let S=g.ownerDocument??document,I=S.getSelection(),R=I&&I.rangeCount>0&&g.contains(I.anchorNode);if(I&&!R){let N=S.createRange();N.selectNodeContents(g),N.collapse(!0),I.removeAllRanges(),I.addRange(N)}},[F,ce]),(0,D.useEffect)(()=>{let g=E.current;if(!g)return;let S=g.ownerDocument??document,I=()=>{let R=S.getSelection();if(!R||R.rangeCount===0||!R.anchorNode||!g.contains(R.anchorNode))return;let N=R.anchorNode,te=N.nodeType===Node.ELEMENT_NODE?N:N.parentElement,Ae=(R.isCollapsed?te?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,qe=l?.id??b?.id??null;if(Ae&&Ae!==qe){G(Ae);return}performance.now()-T.current<50||oe((0,Q.getCursorOffset)(g))};return S.addEventListener("selectionchange",I),()=>S.removeEventListener("selectionchange",I)},[l,b,G,oe]),(0,D.useEffect)(()=>{let g=E.current;if(!g)return;let S=I=>{let R=(0,Q.chipIdFromTap)(g,I.target);R&&(G(R),(0,Q.keepCaretOnChip)(g,R))};return g.addEventListener("click",S),()=>g.removeEventListener("click",S)},[G]),(0,D.useEffect)(()=>{let g=E.current;if(!(!g||!s||!o))return(0,Q.attachChipRemove)(g,s)},[s,o]),(0,D.useLayoutEffect)(()=>{let g=E.current;g&&(0,Q.renderEditableContent)({input:g,segments:i,newParamId:r,editingParamId:l?.id??null,placeholderText:f??"",isFocused:u,showChipIcons:t,showChipImages:n,showChipRemove:o,hintOptions:(0,Q.startingHintOptions)(h??[])})},[i,r,l,f,h,u,t,n,o]),(0,D.useEffect)(()=>{let g=E.current;return()=>{g&&(0,Q.cancelStartingHint)(g)}},[]),(0,D.useLayoutEffect)(()=>{let g=ue.current,S=r??"";if(ue.current=S,!S||S===g)return;let I=E.current;if(!I)return;I.focus();let R=pe.current??(0,Q.plainTextLength)(I);(0,Q.setCursorOffset)(I,R)},[r]),(0,D.useLayoutEffect)(()=>{let g=_.current,S=l?.id??"";if(_.current=S,!S||S===g||v==null)return;let I=E.current;I&&(0,Q.setCursorOffset)(I,v)},[l,v]);let W=(0,D.useCallback)(()=>{let g=E.current;if(!g)return;let S=(0,Q.extractPlainText)(g),R=S.length>0&&S[0]!==S[0].toUpperCase()?S[0].toUpperCase()+S.slice(1):S;if(ne.current){he(R);return}M(R)},[M,he]),p=(0,D.useCallback)(()=>{T.current=performance.now(),W();let g=E.current;g&&H((0,Q.getCursorOffset)(g))},[W,H]);(0,D.useEffect)(()=>{let g=E.current;if(!g)return;let S=I=>{let R=I,N=R.inputType;if(N==="insertParagraph"||N==="insertLineBreak"||N==="insertFromDrop"){I.preventDefault();return}if(N.startsWith("insert")||N.startsWith("delete")){let te=N.startsWith("delete")?"":R.data??"";de(te)&&I.preventDefault()}};return g.addEventListener("beforeinput",S),()=>g.removeEventListener("beforeinput",S)},[de]);let P=(0,D.useCallback)(()=>{ne.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),Qe=(0,D.useCallback)(()=>{ne.current=!1,E.current?.removeAttribute("data-aia-composing"),W()},[W]),Ke=(0,D.useCallback)(g=>{g.preventDefault();let S=E.current;if(!S)return;let I=(g.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let R=S.ownerDocument??document,N=R.getSelection();if(!N||N.rangeCount===0)return;let te=N.getRangeAt(0);if(!S.contains(te.startContainer))return;te.deleteContents();let Se=R.createTextNode(I);te.insertNode(Se),te.setStartAfter(Se),te.collapse(!0),N.removeAllRanges(),N.addRange(te),W()},[W]),Ye=(0,D.useCallback)(g=>A(g),[A]),je=(0,D.useCallback)(()=>ce(!0),[ce]),m=(0,D.useCallback)(()=>ce(!1),[ce]),$e=(0,D.useCallback)(()=>E.current?.focus(),[]),De=(0,D.useCallback)(()=>E.current?.blur(),[]),Ze=(0,D.useCallback)(()=>{let g=E.current;return g?(0,Q.extractPlainText)(g):""},[]),Xe=gi()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:Xe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":k,"aria-expanded":y,"aria-activedescendant":C,spellCheck:!0,enterKeyHint:"send",onInput:p,onKeyDown:Ye,onCompositionStart:P,onCompositionEnd:Qe,onPaste:Ke,onFocus:je,onBlur:m},getPlainText:Ze,focus:$e,blur:De}}var Le=require("react/jsx-runtime");function fi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var At=(0,j.forwardRef)(function({onSubmit:i,onResult:t,onError:n,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:b,language:v,currency:x,productId:f,visitorId:h,columns:u,pillPlacement:y="dropdown",mode:k="auto",optionsPosition:C="below",animations:F=!0,optionsStyle:M="floating",dropdownTrigger:he,closeDropdownOnBlur:A,prependPlaceholder:H,allOption:oe,showNonTappableOptions:G,locationSearch:de,showOptionIcons:ce=!0,showChipIcons:E=!0,showChipImages:ne=!0,showChipRemove:ue=!1,showOptionImages:_=!0,showOptionCounts:pe=!0,showSkipButton:T,showProducts:W,submitProgress:p,productsLayout:P,productImageFallback:Qe,showProductVendor:Ke,autoFocus:Ye=!0,onFocus:je,onBlur:m,value:$e,completedParams:De,onChange:Ze,onParamsChange:Xe,products:g,mapProducts:S,onProductSelect:I,onProductAddToCart:R,submitButton:N,resetOnSubmit:te=!0,seeAllResults:Se=!1},Ae){let qe=(0,j.useRef)(null),_e=(0,j.useRef)(null),Je=(0,j.useRef)(null),ea=(0,j.useRef)(()=>{}),Me=(0,j.useRef)(null),me=(0,j.useRef)(null);(0,j.useEffect)(()=>{let B=qe.current;if(B)return Me.current?Me.current.setMode(k):Me.current=new Ge.ModeController(B,k),()=>{Me.current?.destroy(),Me.current=null}},[k]);let aa=(0,j.useCallback)(B=>{let ve=me.current?.current;ve&&(ve.focus(),(0,Ge.setCursorOffset)(ve,B))},[]),{completedParams:wa,suggestionPills:Ne,setActivePill:ua,skipActivePill:ta,segments:w,newParamId:be,clearNewParamId:ia,placeholderText:oa,isFocused:a,isDropdownOpen:ie,isActivePillSelected:na,isLoading:we,isReady:va,activeIndex:Fe,listboxId:Ee,handleTextChange:ma,handleCompositionText:ra,handleKeyDown:He,setFocused:da,editingParam:ca,editingIdentified:ga,editingAnchor:Ve,caretOffset:pa,startEditingParam:d,removeParam:Y,handleCaretAfterInput:K,handleCaretMove:fa,replaceEditingRange:Pa,dropdownProps:O,reset:Ia,refreshProducts:Qa,prepareSubmit:Ya,getState:Fa,recordSubmit:ja,holdSubmit:$a,endSubmitProgress:Za,isSubmitting:Ha}=Ma({onSubmit:B=>ea.current(B),onResult:t,onError:n,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:b,language:v,currency:x,productId:f,visitorId:h,columns:u,dropdownTrigger:he,optionsPosition:C,closeDropdownOnBlur:A,prependPlaceholder:H,allOption:oe,showNonTappableOptions:G,locationSearch:de,showOptionIcons:ce,showOptionImages:_,showOptionCounts:pe,showSkipButton:T,showProducts:W,submitProgress:p,onFocus:je,onBlur:m,value:$e,completedParams:De,onChange:Ze,onParamsChange:Xe,products:g,mapProducts:S,onProductSelect:I,onProductAddToCart:R,source:"full-sdk",setCursor:aa});(0,j.useEffect)(()=>{if(!be)return;let B=window.setTimeout(()=>ia(),650);return()=>window.clearTimeout(B)},[be,ia]);let Et=Fe>=0?`${Ee}-option-${Fe}`:void 0,{inputRef:Ba,editorProps:zt,focus:Aa,blur:Xa,getPlainText:Ja}=It({segments:w,newParamId:be,editingParam:ca,editingIdentified:ga,editingAnchor:Ve,caretOffset:pa,placeholderText:oa,hintSuggestions:y==="inline"?[]:Ne,isFocused:a,showChipIcons:E,showChipImages:ne,showChipRemove:ue,removeParam:Y,isDropdownOpen:ie,listboxId:Ee,activeDescendantId:Et,autoFocus:Ye,handleTextChange:ma,handleCompositionText:ra,handleKeyDown:He,handleCaretAfterInput:K,handleCaretMove:fa,startEditingParam:d,replaceEditingRange:Pa,setFocused:da});me.current=Ba,(0,j.useLayoutEffect)(()=>{let B=_e.current,ve=Ba.current;if(!B||!ve)return;let ya=()=>{let et=B.firstElementChild;if(!et)return;let Nt=et.getBoundingClientRect(),Ft=ve.getBoundingClientRect();Nt.top>=Ft.bottom-2?B.setAttribute("data-aia-pill-wrapped",""):B.removeAttribute("data-aia-pill-wrapped")};ya();let ka=new ResizeObserver(ya);return ka.observe(ve),()=>ka.disconnect()},[w,Ne.length,we,Ba]),(0,j.useEffect)(()=>{let B=Je.current;if(B)return(0,Ge.watchEditorHeight)(B)},[]),(0,j.useImperativeHandle)(Ae,()=>({focus:Aa,blur:Xa,reset:Ia,refreshProducts:Qa,setMode:B=>Me.current?.setMode(B),skipActivePill:ta,endSubmitProgress:Za}),[Aa,Xa,Ia,Qa,ta,Za]);let ba=!!w.length||wa.length>0,xa=(0,j.useCallback)(B=>{if(!ba||B&&Fa().isSubmitting)return;B&&Ya();let ve=Fa(),ya=(0,Ge.buildSubmitResult)(Ja(),ve.completedParams,ve.skippedParams,{identifiedParams:ve.identifiedParams,isReady:ve.isReady,customFields:ve.customFields});B&&ja(ya);let ka=i(ya);return B&&!te&&$a(ka),te&&Ia(),ka},[ja,$a,te,ba,Ya,Fa,i,Ia,Ja]);ea.current=()=>xa(!1);let Rt=Se&&!O.isInputEmpty&&ba,Ot=(0,j.useCallback)(()=>xa(!0),[xa]),Lt=(0,j.useCallback)(B=>{B.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||Aa()},[Aa]),Dt=y==="inline",Mt=y==="dropdown";return(0,Le.jsxs)("div",{ref:qe,className:`magicx-aia ${ha.container} ${r??""}`,"data-pill-placement":y,"data-options-position":C,"data-animations":F?"on":"off","data-aia-options-style":M,"data-mode":fi(k),children:[(0,Le.jsx)(La,{...O,showPills:Mt,productsLayout:P,productImageFallback:Qe,showProductVendor:Ke,onSeeAllResults:Rt?Ot:void 0,fullWidth:Se}),(0,Le.jsxs)("div",{className:ha.inputWrapper,"data-aia-input-wrapper":"",onClick:Lt,children:[(0,Le.jsxs)("div",{ref:Je,className:ha.editorArea,"data-aia-editor":"",children:[(0,Le.jsx)("div",{...zt,className:ha.input,"data-aia-input":""}),Dt&&(we||Ne.length>0)&&(0,Le.jsx)("span",{ref:_e,className:ha.pillListContainer,"data-aia-pill-list-container":"",children:(0,Le.jsx)(Ra,{pills:Ne,activePillIndex:0,activeSelected:na,onSelectPill:ua,loading:we})})]}),N===null?null:N===void 0?(0,Le.jsx)(St,{disabled:!ba,ready:ba&&va,busy:Ha,onClick:()=>xa(!0),label:(0,Ge.uiStringsFor)(v).submit}):(0,Le.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Ha?"busy":void 0,"aria-busy":Ha?!0:void 0,className:ha.submitSlot,onClick:B=>{ba&&(B.stopPropagation(),xa(!0))},children:N})]})]})});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});
3938
+ `,document.head.appendChild(e)}var yt={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};var Da=require("react/jsx-runtime");function St({disabled:e,ready:i,busy:t=!1,onClick:n,label:o=(0,kt.uiStringsFor)().submit}){return(0,Da.jsx)("button",{type:"button","data-aia-submit":"",className:yt.submitButton,disabled:e,"data-aia-ready":i?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:s=>{s.stopPropagation(),n()},"aria-label":o,children:(0,Da.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":o,children:(0,Da.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var ke=require("@magicx-eng/ai-autocomplete-vanilla"),E=require("react");var Va=require("react");function Ct(e){let i=(0,Va.useRef)(e);i.current=e;let t=Object.keys(e??{}).sort().join("\0"),n=(0,Va.useRef)({key:"",overrides:void 0});if(n.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(l,b,v)=>{let y=i.current?.[s];return y?y(l,b,v):[]};o[s]=r}n.current={key:t,overrides:e?o:void 0}}return{overrides:n.current.overrides,key:t}}var Ua=require("react");function Tt(e){let i=(0,Ua.useRef)(e);i.current=e;let t=(0,Ua.useRef)(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=i.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>i.current?.transform(o)??[],get limit(){return i.current?.limit}});let n=e!==void 0;return{config:n?t.current:void 0,enabled:n}}var Pt={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,isSubmitting:!1,selectingProductId:null,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Ma({onSubmit:e,onResult:i,onError:t,optionOverrides:n,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,visitorId:y,columns:f=2,dropdownTrigger:h,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:k,allOption:C,showNonTappableOptions:F,locationSearch:M,showOptionIcons:he,showOptionImages:Q,showOptionCounts:z,showSkipButton:W,showProducts:H,submitProgress:X,productImageFallback:ce="image",showProductVendor:A=!0,onFocus:re,onBlur:ue,value:V,completedParams:pe,onChange:T,onParamsChange:G,products:p,mapProducts:P,onProductSelect:Qe,onProductAddToCart:Ke,source:Ye,setCursor:je}){let m=(0,E.useRef)(null),[$e,De]=(0,E.useState)(null),Ze=(0,E.useRef)(e);Ze.current=e;let Xe=(0,E.useRef)(i);Xe.current=i;let g=(0,E.useRef)(t);g.current=t;let S=(0,E.useRef)(T);S.current=T;let I=(0,E.useRef)(G);I.current=G;let R=(0,E.useRef)(re);R.current=re;let N=(0,E.useRef)(ue);N.current=ue;let oe=(0,E.useRef)(je);oe.current=je;let Se=(0,E.useRef)(Qe);Se.current=Qe;let Ee=(0,E.useRef)(Ke);Ee.current=Ke;let qe=(0,E.useRef)(y);qe.current=y;let _e=(0,E.useRef)(()=>{let d=qe.current;return typeof d=="function"?d():d}).current,Je=Tt(p),ea=(0,E.useRef)(P);ea.current=P;let Me=(0,E.useRef)((d,$)=>{let q=ea.current;return q?q(d,$):d}).current,me=P?Me:void 0,aa=Ct(n);(0,E.useEffect)(()=>{if(typeof document>"u")return;let d=new ke.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,visitorId:_e,optionOverrides:aa.overrides,maskCompletedText:o,columns:f,dropdownTrigger:h,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:k,allOption:C,showNonTappableOptions:F,locationSearch:M,showProducts:H,submitProgress:X,source:Ye,value:V,completedParams:pe,onSubmit:(...q)=>Ze.current?.(...q),onResult:(...q)=>Xe.current?.(...q),onError:(...q)=>g.current?.(...q),onChange:(...q)=>S.current?.(...q),onParamsChange:(...q)=>I.current?.(...q),onFocus:()=>R.current?.(),onBlur:()=>N.current?.(),onProductSelect:q=>Se.current?Se.current(q):ke.HANDOFF_NOT_HANDLED,onProductAddToCart:q=>Ee.current?.(q),setCursor:q=>oe.current?.(q),products:Je.config,mapProducts:me});m.current=d,De(d.getState());let $=d.subscribe(q=>De(q));return()=>{$(),d.destroy(),m.current===d&&(m.current=null)}},[]),(0,E.useEffect)(()=>{V!==void 0&&m.current?.setValue(V)},[V]),(0,E.useEffect)(()=>{pe!==void 0&&m.current?.setCompletedParams(pe)},[pe]);let wa=JSON.stringify(s??null),Ne;try{Ne=JSON.stringify(r??null)}catch{Ne="[unstringifiable]"}(0,E.useEffect)(()=>{m.current?.update({apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,optionOverrides:aa.overrides,dropdownTrigger:h,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:k,allOption:C,showNonTappableOptions:F,locationSearch:M,showProducts:H,submitProgress:X})},[wa,Ne,l,b?.code,b?.rate,b?.country,v,aa.key,h,u,x,k,C,F,M,H,X]);let ua=(0,E.useRef)(!1);(0,E.useEffect)(()=>{if(!ua.current){ua.current=!0;return}m.current?.update({products:Je.config})},[Je.enabled]),(0,E.useEffect)(()=>{m.current?.update({mapProducts:me})},[me]);let ta=(0,E.useRef)(null);ta.current===null&&(ta.current={handleTextChange:d=>m.current?.handleTextChange(d),handleCompositionText:d=>m.current?.handleCompositionText(d),handleKeyDown:d=>{let $="nativeEvent"in d?d.nativeEvent:d;m.current?.handleKeyDown($)},setFocused:d=>m.current?.setFocused(d),startEditingParam:d=>m.current?.startEditingParam(d),removeParam:d=>m.current?.removeParam(d)??!1,exitEditMode:()=>m.current?.exitEditMode(),handleCaretAfterInput:d=>m.current?.handleCaretAfterInput(d),handleCaretMove:d=>m.current?.handleCaretMove(d),replaceEditingRange:d=>m.current?.replaceEditingRange(d)??!1,setActivePill:d=>m.current?.setActivePill(d),skipActivePill:()=>m.current?.skipActivePill(),removeLastParam:()=>m.current?.removeLastParam(),clearNewParamId:()=>m.current?.clearNewParamId(),reset:()=>m.current?.reset(),refreshProducts:()=>m.current?.refreshProducts(),prepareSubmit:()=>m.current?.prepareSubmit(),getState:()=>m.current?.getState()??Pt,recordSubmit:d=>m.current?.recordSubmit(d),holdSubmit:d=>m.current?.holdSubmit(d),endSubmitProgress:()=>m.current?.endSubmitProgress(),selectOption:(d,$)=>m.current?.selectOption(d,$),selectProduct:d=>m.current?.selectProduct(d),addProductToCart:d=>{let $=m.current;return!$||!Ee.current?Promise.resolve():$.addProductToCart(d)},setActiveDropdownIndex:d=>m.current?.setActiveDropdownIndex(d),clearHighlight:d=>m.current?.clearHighlight(d),showPreviousMonth:()=>m.current?.showPreviousMonth(),showNextMonth:()=>m.current?.showNextMonth(),setTime:d=>m.current?.setTime(d),commitTime:()=>m.current?.commitTime(),toggleMultiSelectOption:d=>m.current?.toggleMultiSelectOption(d),commitMultiSelect:()=>m.current?.commitMultiSelect(),setLocationQuery:d=>m.current?.setLocationQuery(d),moveLocationHighlight:d=>m.current?.moveLocationHighlight(d),commitLocation:d=>m.current?.commitLocation(d),setLocationFieldFocused:d=>m.current?.setLocationFieldFocused(d),handleFocus:()=>m.current?.setFocused(!0),handleBlur:()=>m.current?.setFocused(!1)});let w=ta.current,be=(0,E.useCallback)(d=>{let $=d.target.value,fa=$.length>0&&!d.nativeEvent?.isComposing&&$[0]!==$[0].toUpperCase()?$[0].toUpperCase()+$.slice(1):$;m.current?.handleTextChange(fa)},[]),ia=(0,E.useCallback)(d=>{m.current?.handleKeyDown(d.nativeEvent)},[]),oa=m.current,a=$e??Pt,ne=V!==void 0?V:a.text,na=pe!==void 0?pe:a.completedParams,we=a.actionableSuggestions,va=we[0],He=(0,E.useMemo)(()=>(0,ke.withoutTraditionalAutocomplete)(we),[we]),ze=oa?.listboxId??"",ma=a.activeDropdownIndex>=0&&oa?`${ze}-option-${a.activeDropdownIndex}`:void 0,ra=a.editingParam,Fe=a.editingIdentified,da=ra?(0,ke.editingSuggestion)(ra):Fe?{parameter:Fe.parameter,text:(0,ke.identifiedParamLabel)(Fe.parameter),required:!0,options:[]}:null,ca=a.dropdownSuggestion??da??va,ga=(0,ke.dropdownPillsFor)(a.dropdownSuggestion,da,we),Ve=(0,ke.dateSelectionFor)(a),pa=!oa||a.dropdownLoading;return{completedParams:na,multiSelectView:a.multiSelectView,toggleMultiSelectOption:w.toggleMultiSelectOption,commitMultiSelect:w.commitMultiSelect,skippedParams:a.skippedParams,identifiedParams:a.identifiedParams,suggestionPills:He,setActivePill:w.setActivePill,skipActivePill:w.skipActivePill,removeLastParam:w.removeLastParam,segments:a.segments,newParamId:a.newParamId,clearNewParamId:w.clearNewParamId,suggestions:a.suggestions,activeIndex:a.activeDropdownIndex,isReady:a.isReady,isLoading:pa,isFocused:a.isFocused,isDropdownOpen:a.isDropdownOpen,isActivePillSelected:a.isActivePillSelected,placeholderText:a.placeholderText,listboxId:ze,error:a.error,products:a.products,customFields:a.customFields,selectProduct:w.selectProduct,addProductToCart:w.addProductToCart,handleTextChange:w.handleTextChange,handleCompositionText:w.handleCompositionText,handleKeyDown:w.handleKeyDown,setFocused:w.setFocused,editingParam:ra,editingIdentified:Fe,editingAnchor:a.editingAnchor,caretOffset:a.caretOffset,startEditingParam:w.startEditingParam,removeParam:w.removeParam,exitEditMode:w.exitEditMode,handleCaretAfterInput:w.handleCaretAfterInput,handleCaretMove:w.handleCaretMove,replaceEditingRange:w.replaceEditingRange,inputProps:{value:ne,placeholder:a.placeholderText||void 0,onChange:be,onKeyDown:ia,onFocus:w.handleFocus,onBlur:w.handleBlur,role:"combobox","aria-expanded":a.isDropdownOpen,"aria-activedescendant":ma,"aria-autocomplete":"list","aria-controls":ze},reset:w.reset,refreshProducts:w.refreshProducts,prepareSubmit:w.prepareSubmit,getState:w.getState,recordSubmit:w.recordSubmit,holdSubmit:w.holdSubmit,endSubmitProgress:w.endSubmitProgress,isSubmitting:a.isSubmitting,selectingProductId:a.selectingProductId,dropdownProps:{suggestions:ca?[{...ca,options:a.dropdownOptions}]:[],activeIndex:a.activeDropdownIndex,onSelect:w.selectOption,onHighlight:w.setActiveDropdownIndex,onUnhighlight:w.clearHighlight,isOpen:a.isDropdownOpen,id:ze,pills:ga,activeSelected:a.isActivePillSelected,onPillClick:w.setActivePill,onSkip:w.skipActivePill,showSkipButton:(W??!0)&&!ra&&!Fe,showOptionIcons:he??!0,showOptionImages:Q??!0,showOptionCounts:z??!0,skipDisabled:a.inSelectionAnimation,isLoading:pa,skeletonExiting:a.skeletonExiting,isInputEmpty:ne.trim().length===0,language:l,products:a.products,productImageFallback:ce,showProductVendor:A,onProductSelect:w.selectProduct,busyProductId:a.selectingProductId,seeAllBusy:a.isSubmitting,onProductAddToCart:Ke?w.addProductToCart:void 0,onProductFocusChange:w.setFocused,formatType:a.activeFormatType,dateView:a.dateView,selectedDateIso:Ve.selectedIso,selectedDateRange:Ve.selectedRange,dateRangeStart:Ve.rangeStart,dateReferences:Ve.references,onPreviousMonth:w.showPreviousMonth,onNextMonth:w.showNextMonth,timeView:a.timeView,multiSelectView:a.dropdownMultiSelect,onMultiSelectCommit:w.commitMultiSelect,onTimeChange:w.setTime,onTimeCommit:w.commitTime,locationView:a.locationView,isReediting:a.editingParam!=null,onLocationQuery:w.setLocationQuery,onLocationMove:w.moveLocationHighlight,onLocationCommit:w.commitLocation,onLocationFocusChange:w.setLocationFieldFocused,isFocused:a.isFocused||a.locationFieldFocused,optionsPosition:u??"below"}}}var j=require("@magicx-eng/ai-autocomplete-vanilla"),D=require("react"),Na;function gi(){if(Na!==void 0)return Na;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Na=e.contentEditable==="plaintext-only",Na}function It(e){let{segments:i,showChipIcons:t=!0,showChipImages:n=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:b,editingAnchor:v,caretOffset:y,placeholderText:f,hintSuggestions:h,isFocused:u,isDropdownOpen:x,listboxId:k,activeDescendantId:C,autoFocus:F,handleTextChange:M,handleCompositionText:he,handleKeyDown:Q,handleCaretAfterInput:z,handleCaretMove:W,startEditingParam:H,replaceEditingRange:X,setFocused:ce}=e,A=(0,D.useRef)(null),re=(0,D.useRef)(!1),ue=(0,D.useRef)(""),V=(0,D.useRef)(""),pe=(0,D.useRef)(null),T=(0,D.useRef)(0);pe.current=y,(0,D.useEffect)(()=>{if(!F)return;let g=A.current;if(!g)return;document.activeElement===g?ce(!0):g.focus();let S=g.ownerDocument??document,I=S.getSelection(),R=I&&I.rangeCount>0&&g.contains(I.anchorNode);if(I&&!R){let N=S.createRange();N.selectNodeContents(g),N.collapse(!0),I.removeAllRanges(),I.addRange(N)}},[F,ce]),(0,D.useEffect)(()=>{let g=A.current;if(!g)return;let S=g.ownerDocument??document,I=()=>{let R=S.getSelection();if(!R||R.rangeCount===0||!R.anchorNode||!g.contains(R.anchorNode))return;let N=R.anchorNode,oe=N.nodeType===Node.ELEMENT_NODE?N:N.parentElement,Ee=(R.isCollapsed?oe?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,qe=l?.id??b?.id??null;if(Ee&&Ee!==qe){H(Ee);return}performance.now()-T.current<50||W((0,j.getCursorOffset)(g))};return S.addEventListener("selectionchange",I),()=>S.removeEventListener("selectionchange",I)},[l,b,H,W]),(0,D.useEffect)(()=>{let g=A.current;if(!g)return;let S=I=>{let R=(0,j.chipIdFromTap)(g,I.target);R&&(H(R),(0,j.keepCaretOnChip)(g,R))};return g.addEventListener("click",S),()=>g.removeEventListener("click",S)},[H]),(0,D.useEffect)(()=>{let g=A.current;if(!(!g||!s||!o))return(0,j.attachChipRemove)(g,s)},[s,o]),(0,D.useLayoutEffect)(()=>{let g=A.current;g&&(0,j.renderEditableContent)({input:g,segments:i,newParamId:r,editingParamId:l?.id??null,placeholderText:f??"",isFocused:u,showChipIcons:t,showChipImages:n,showChipRemove:o,hintOptions:(0,j.startingHintOptions)(h??[])})},[i,r,l,f,h,u,t,n,o]),(0,D.useEffect)(()=>{let g=A.current;return()=>{g&&(0,j.cancelStartingHint)(g)}},[]),(0,D.useLayoutEffect)(()=>{let g=ue.current,S=r??"";if(ue.current=S,!S||S===g)return;let I=A.current;if(!I)return;I.focus();let R=pe.current??(0,j.plainTextLength)(I);(0,j.setCursorOffset)(I,R)},[r]),(0,D.useLayoutEffect)(()=>{let g=V.current,S=l?.id??"";if(V.current=S,!S||S===g||v==null)return;let I=A.current;I&&(0,j.setCursorOffset)(I,v)},[l,v]);let G=(0,D.useCallback)(()=>{let g=A.current;if(!g)return;let S=(0,j.extractPlainText)(g),R=S.length>0&&S[0]!==S[0].toUpperCase()?S[0].toUpperCase()+S.slice(1):S;if(re.current){he(R);return}M(R)},[M,he]),p=(0,D.useCallback)(()=>{T.current=performance.now(),G();let g=A.current;g&&z((0,j.getCursorOffset)(g))},[G,z]);(0,D.useEffect)(()=>{let g=A.current;if(!g)return;let S=I=>{let R=I,N=R.inputType;if(N==="insertParagraph"||N==="insertLineBreak"||N==="insertFromDrop"){I.preventDefault();return}if(N.startsWith("insert")||N.startsWith("delete")){let oe=N.startsWith("delete")?"":R.data??"";X(oe)&&I.preventDefault()}};return g.addEventListener("beforeinput",S),()=>g.removeEventListener("beforeinput",S)},[X]);let P=(0,D.useCallback)(()=>{re.current=!0,A.current?.setAttribute("data-aia-composing","true")},[]),Qe=(0,D.useCallback)(()=>{re.current=!1,A.current?.removeAttribute("data-aia-composing"),G()},[G]),Ke=(0,D.useCallback)(g=>{g.preventDefault();let S=A.current;if(!S)return;let I=(g.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let R=S.ownerDocument??document,N=R.getSelection();if(!N||N.rangeCount===0)return;let oe=N.getRangeAt(0);if(!S.contains(oe.startContainer))return;oe.deleteContents();let Se=R.createTextNode(I);oe.insertNode(Se),oe.setStartAfter(Se),oe.collapse(!0),N.removeAllRanges(),N.addRange(oe),G()},[G]),Ye=(0,D.useCallback)(g=>Q(g),[Q]),je=(0,D.useCallback)(()=>ce(!0),[ce]),m=(0,D.useCallback)(()=>ce(!1),[ce]),$e=(0,D.useCallback)(()=>A.current?.focus(),[]),De=(0,D.useCallback)(()=>A.current?.blur(),[]),Ze=(0,D.useCallback)(()=>{let g=A.current;return g?(0,j.extractPlainText)(g):""},[]),Xe=gi()?"plaintext-only":"true";return{inputRef:A,editorProps:{ref:A,contentEditable:Xe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":k,"aria-expanded":x,"aria-activedescendant":C,spellCheck:!0,enterKeyHint:"send",onInput:p,onKeyDown:Ye,onCompositionStart:P,onCompositionEnd:Qe,onPaste:Ke,onFocus:je,onBlur:m},getPlainText:Ze,focus:$e,blur:De}}var Le=require("react/jsx-runtime");function fi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var At=(0,Z.forwardRef)(function({onSubmit:i,onResult:t,onError:n,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:b,language:v,currency:y,productId:f,visitorId:h,columns:u,pillPlacement:x="dropdown",mode:k="auto",optionsPosition:C="below",animations:F=!0,optionsStyle:M="floating",dropdownTrigger:he,closeDropdownOnBlur:Q,prependPlaceholder:z,allOption:W,showNonTappableOptions:H,locationSearch:X,showOptionIcons:ce=!0,showChipIcons:A=!0,showChipImages:re=!0,showChipRemove:ue=!1,showOptionImages:V=!0,showOptionCounts:pe=!0,showSkipButton:T,showProducts:G,submitProgress:p,productsLayout:P,productImageFallback:Qe,showProductVendor:Ke,autoFocus:Ye=!0,onFocus:je,onBlur:m,value:$e,completedParams:De,onChange:Ze,onParamsChange:Xe,products:g,mapProducts:S,onProductSelect:I,onProductAddToCart:R,submitButton:N,resetOnSubmit:oe=!0,seeAllResults:Se=!1},Ee){let qe=(0,Z.useRef)(null),_e=(0,Z.useRef)(null),Je=(0,Z.useRef)(null),ea=(0,Z.useRef)(()=>{}),Me=(0,Z.useRef)(null),me=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let B=qe.current;if(B)return Me.current?Me.current.setMode(k):Me.current=new Ge.ModeController(B,k),()=>{Me.current?.destroy(),Me.current=null}},[k]);let aa=(0,Z.useCallback)(B=>{let ve=me.current?.current;ve&&(ve.focus(),(0,Ge.setCursorOffset)(ve,B))},[]),{completedParams:wa,suggestionPills:Ne,setActivePill:ua,skipActivePill:ta,segments:w,newParamId:be,clearNewParamId:ia,placeholderText:oa,isFocused:a,isDropdownOpen:ne,isActivePillSelected:na,isLoading:we,isReady:va,activeIndex:He,listboxId:ze,handleTextChange:ma,handleCompositionText:ra,handleKeyDown:Fe,setFocused:da,editingParam:ca,editingIdentified:ga,editingAnchor:Ve,caretOffset:pa,startEditingParam:d,removeParam:$,handleCaretAfterInput:q,handleCaretMove:fa,replaceEditingRange:Pa,dropdownProps:O,reset:Ia,refreshProducts:Qa,prepareSubmit:Ya,getState:Ha,recordSubmit:ja,holdSubmit:$a,endSubmitProgress:Za,isSubmitting:Fa}=Ma({onSubmit:B=>ea.current(B),onResult:t,onError:n,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:b,language:v,currency:y,productId:f,visitorId:h,columns:u,dropdownTrigger:he,optionsPosition:C,closeDropdownOnBlur:Q,prependPlaceholder:z,allOption:W,showNonTappableOptions:H,locationSearch:X,showOptionIcons:ce,showOptionImages:V,showOptionCounts:pe,showSkipButton:T,showProducts:G,submitProgress:p,onFocus:je,onBlur:m,value:$e,completedParams:De,onChange:Ze,onParamsChange:Xe,products:g,mapProducts:S,onProductSelect:I,onProductAddToCart:R,source:"full-sdk",setCursor:aa});(0,Z.useEffect)(()=>{if(!be)return;let B=window.setTimeout(()=>ia(),650);return()=>window.clearTimeout(B)},[be,ia]);let Et=He>=0?`${ze}-option-${He}`:void 0,{inputRef:Ba,editorProps:zt,focus:Aa,blur:Xa,getPlainText:Ja}=It({segments:w,newParamId:be,editingParam:ca,editingIdentified:ga,editingAnchor:Ve,caretOffset:pa,placeholderText:oa,hintSuggestions:x==="inline"?[]:Ne,isFocused:a,showChipIcons:A,showChipImages:re,showChipRemove:ue,removeParam:$,isDropdownOpen:ne,listboxId:ze,activeDescendantId:Et,autoFocus:Ye,handleTextChange:ma,handleCompositionText:ra,handleKeyDown:Fe,handleCaretAfterInput:q,handleCaretMove:fa,startEditingParam:d,replaceEditingRange:Pa,setFocused:da});me.current=Ba,(0,Z.useLayoutEffect)(()=>{let B=_e.current,ve=Ba.current;if(!B||!ve)return;let ya=()=>{let et=B.firstElementChild;if(!et)return;let Nt=et.getBoundingClientRect(),Ht=ve.getBoundingClientRect();Nt.top>=Ht.bottom-2?B.setAttribute("data-aia-pill-wrapped",""):B.removeAttribute("data-aia-pill-wrapped")};ya();let ka=new ResizeObserver(ya);return ka.observe(ve),()=>ka.disconnect()},[w,Ne.length,we,Ba]),(0,Z.useEffect)(()=>{let B=Je.current;if(B)return(0,Ge.watchEditorHeight)(B)},[]),(0,Z.useImperativeHandle)(Ee,()=>({focus:Aa,blur:Xa,reset:Ia,refreshProducts:Qa,setMode:B=>Me.current?.setMode(B),skipActivePill:ta,endSubmitProgress:Za}),[Aa,Xa,Ia,Qa,ta,Za]);let ba=!!w.length||wa.length>0,xa=(0,Z.useCallback)(B=>{if(!ba||B&&Ha().isSubmitting)return;B&&Ya();let ve=Ha(),ya=(0,Ge.buildSubmitResult)(Ja(),ve.completedParams,ve.skippedParams,{identifiedParams:ve.identifiedParams,isReady:ve.isReady,customFields:ve.customFields});B&&ja(ya);let ka=i(ya);return B&&!oe&&$a(ka),oe&&Ia(),ka},[ja,$a,oe,ba,Ya,Ha,i,Ia,Ja]);ea.current=()=>xa(!1);let Rt=Se&&!O.isInputEmpty&&ba,Ot=(0,Z.useCallback)(()=>xa(!0),[xa]),Lt=(0,Z.useCallback)(B=>{B.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||Aa()},[Aa]),Dt=x==="inline",Mt=x==="dropdown";return(0,Le.jsxs)("div",{ref:qe,className:`magicx-aia ${ha.container} ${r??""}`,"data-pill-placement":x,"data-options-position":C,"data-animations":F?"on":"off","data-aia-options-style":M,"data-mode":fi(k),children:[(0,Le.jsx)(La,{...O,showPills:Mt,productsLayout:P,productImageFallback:Qe,showProductVendor:Ke,onSeeAllResults:Rt?Ot:void 0,fullWidth:Se}),(0,Le.jsxs)("div",{className:ha.inputWrapper,"data-aia-input-wrapper":"",onClick:Lt,children:[(0,Le.jsxs)("div",{ref:Je,className:ha.editorArea,"data-aia-editor":"",children:[(0,Le.jsx)("div",{...zt,className:ha.input,"data-aia-input":""}),Dt&&(we||Ne.length>0)&&(0,Le.jsx)("span",{ref:_e,className:ha.pillListContainer,"data-aia-pill-list-container":"",children:(0,Le.jsx)(Ra,{pills:Ne,activePillIndex:0,activeSelected:na,onSelectPill:ua,loading:we})})]}),N===null?null:N===void 0?(0,Le.jsx)(St,{disabled:!ba,ready:ba&&va,busy:Fa,onClick:()=>xa(!0),label:(0,Ge.uiStringsFor)(v).submit}):(0,Le.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Fa?"busy":void 0,"aria-busy":Fa?!0:void 0,className:ha.submitSlot,onClick:B=>{ba&&(B.stopPropagation(),xa(!0))},children:N})]})]})});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});
3911
3939
  //# sourceMappingURL=index.js.map