@magicx-eng/ai-autocomplete-react 0.53.1 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Ot=Object.defineProperty;var Pa=Object.getOwnPropertyDescriptor;var Ia=Object.getOwnPropertyNames;var Ea=Object.prototype.hasOwnProperty;var Aa=(e,a)=>{for(var t in a)Ot(e,t,{get:a[t],enumerable:!0})},Ra=(e,a,t,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of Ia(a))!Ea.call(e,o)&&o!==t&&Ot(e,o,{get:()=>a[o],enumerable:!(i=Pa(a,o))||i.enumerable});return e};var Oa=e=>Ra(Ot({},"__esModule",{value:!0}),e);var ni={};Aa(ni,{AIAutocomplete:()=>wa,AIAutocompleteDropdown:()=>Tt,DATE_RANGE_META_END:()=>l.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>l.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>l.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>l.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>l.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>l.TIME_META_KEY,WEEKDAY_LABELS:()=>l.WEEKDAY_LABELS,buildSubmitResult:()=>l.buildSubmitResult,cellDay:()=>l.cellDay,cellIso:()=>l.cellIso,dateCellMarks:()=>l.dateCellMarks,formatDate:()=>l.formatDate,formatDateRange:()=>l.formatDateRange,formatOptionCount:()=>l.formatOptionCount,formatPlace:()=>l.formatPlace,formatTime:()=>l.formatTime,isoDate:()=>l.isoDate,monthLabel:()=>l.monthLabel,optionCountLabel:()=>l.optionCountLabel,optionHasImage:()=>l.optionHasImage,optionImageSources:()=>l.optionImageSources,optionImageSrc:()=>l.optionImageSrc,optionLabel:()=>l.optionLabel,optionsShowLeadingVisuals:()=>l.optionsShowLeadingVisuals,parseDate:()=>l.parseDate,parseLooseDate:()=>l.parseLooseDate,parseLooseDateRange:()=>l.parseLooseDateRange,parseTime:()=>l.parseTime,productFromMatchedItem:()=>l.productFromMatchedItem,productImageSources:()=>l.productImageSources,productsFromCustomFields:()=>l.productsFromCustomFields,sanitizeOptionIconSvg:()=>l.sanitizeOptionIconSvg,selectedRangeFor:()=>l.selectedRangeFor,useAIAutocomplete:()=>It,visibleDateRange:()=>l.visibleDateRange,withSkippedParams:()=>l.withSkippedParams});module.exports=Oa(ni);var l=require("@magicx-eng/ai-autocomplete-vanilla");var U=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
1
+ "use strict";var Ot=Object.defineProperty;var Pa=Object.getOwnPropertyDescriptor;var Ia=Object.getOwnPropertyNames;var Ea=Object.prototype.hasOwnProperty;var Aa=(e,a)=>{for(var t in a)Ot(e,t,{get:a[t],enumerable:!0})},Ra=(e,a,t,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of Ia(a))!Ea.call(e,o)&&o!==t&&Ot(e,o,{get:()=>a[o],enumerable:!(i=Pa(a,o))||i.enumerable});return e};var Oa=e=>Ra(Ot({},"__esModule",{value:!0}),e);var ni={};Aa(ni,{AIAutocomplete:()=>wa,AIAutocompleteDropdown:()=>Tt,DATE_RANGE_META_END:()=>l.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>l.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>l.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>l.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>l.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>l.TIME_META_KEY,WEEKDAY_LABELS:()=>l.WEEKDAY_LABELS,buildSubmitResult:()=>l.buildSubmitResult,cellDay:()=>l.cellDay,cellIso:()=>l.cellIso,dateCellMarks:()=>l.dateCellMarks,formatDate:()=>l.formatDate,formatDateRange:()=>l.formatDateRange,formatOptionCount:()=>l.formatOptionCount,formatPlace:()=>l.formatPlace,formatTime:()=>l.formatTime,isoDate:()=>l.isoDate,monthLabel:()=>l.monthLabel,optionCountLabel:()=>l.optionCountLabel,optionHasImage:()=>l.optionHasImage,optionImageSources:()=>l.optionImageSources,optionImageSrc:()=>l.optionImageSrc,optionLabel:()=>l.optionLabel,optionsShowLeadingVisuals:()=>l.optionsShowLeadingVisuals,parseDate:()=>l.parseDate,parseLooseDate:()=>l.parseLooseDate,parseLooseDateRange:()=>l.parseLooseDateRange,parseTime:()=>l.parseTime,productFromMatchedItem:()=>l.productFromMatchedItem,productImageSources:()=>l.productImageSources,productsFromCustomFields:()=>l.productsFromCustomFields,sanitizeOptionIconSvg:()=>l.sanitizeOptionIconSvg,selectedRangeFor:()=>l.selectedRangeFor,useAIAutocomplete:()=>It,visibleDateRange:()=>l.visibleDateRange,withSkippedParams:()=>l.withSkippedParams});module.exports=Oa(ni);var l=require("@magicx-eng/ai-autocomplete-vanilla");var $=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
@@ -236,6 +236,18 @@
236
236
  opacity: 0;
237
237
  }
238
238
 
239
+ /* The empty box's hint (the lead word and the starting options, swapping
240
+ one at a time) is a sibling laid over the input; while it shows, the
241
+ input's own placeholder steps aside, and during IME composition the hint
242
+ steps aside for the composing text. */
243
+ .aia-input-IW-P-[data-aia-empty="true"][data-placeholder][data-aia-hint]::before {
244
+ content: none;
245
+ }
246
+
247
+ [data-aia-hint-el]:has(+ .aia-input-IW-P-[data-aia-composing]) {
248
+ visibility: hidden;
249
+ }
250
+
239
251
  @media (prefers-reduced-motion: reduce) {
240
252
  .aia-input-IW-P-[data-aia-empty="true"][data-placeholder]::before {
241
253
  transition-duration: 0s;
@@ -346,7 +358,7 @@
346
358
  transition: none;
347
359
  }
348
360
  }
349
- `,document.head.appendChild(e)}var rt={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};var D=require("@magicx-eng/ai-autocomplete-vanilla"),V=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
361
+ `,document.head.appendChild(e)}var rt={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};var z=require("@magicx-eng/ai-autocomplete-vanilla"),Q=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
350
362
  * Built-in appearance defaults \u2014 zero specificity via :where().
351
363
  * Consumer CSS always wins without !important.
352
364
  *
@@ -558,8 +570,11 @@
558
570
  --aia-completed-pill-color: var(--aia-primitive-neutral-0);
559
571
 
560
572
  --aia-option-bg: var(--aia-primitive-blue-50);
561
- /* Options read bigger + darker than the small-caps param labels above them. */
562
- --aia-option-color: var(--aia-primitive-neutral-150);
573
+ /* Option text: a softer grey than the parameter label above it. */
574
+ --aia-option-color: var(--aia-primitive-neutral-500);
575
+ /* The floating box's thin options scrollbar: track and thumb. */
576
+ --aia-scrollbar-track: rgba(15, 23, 42, 0.05);
577
+ --aia-scrollbar-thumb: rgba(15, 23, 42, 0.22);
563
578
  --aia-option-color-selected: var(--aia-primitive-neutral-0);
564
579
  --aia-option-font-size: 11.2px;
565
580
 
@@ -626,8 +641,10 @@
626
641
  --aia-completed-pill-color: var(--aia-primitive-neutral-1000);
627
642
 
628
643
  --aia-option-bg: var(--aia-primitive-neutral-250);
629
- /* Options read bigger + darker/brighter than the small-caps param labels. */
630
- --aia-option-color: var(--aia-primitive-neutral-900);
644
+ /* Option text: a softer grey than the parameter label above it. */
645
+ --aia-option-color: var(--aia-primitive-neutral-750);
646
+ --aia-scrollbar-track: rgba(255, 255, 255, 0.08);
647
+ --aia-scrollbar-thumb: rgba(255, 255, 255, 0.28);
631
648
  --aia-option-color-selected: var(--aia-primitive-neutral-1000);
632
649
  --aia-option-font-size: 11.2px;
633
650
 
@@ -955,8 +972,8 @@
955
972
  }
956
973
 
957
974
  /* Floating options box (2026-11). The panel reads as a light sheet under the
958
- text: no footer, only the parameter being asked (sentence case), and "skip"
959
- right after it behind a thin rule \u2014 "Gender | skip". With no footer there is
975
+ text: no footer, only the parameter being asked (sentence case), "skip" at
976
+ the header row's trailing edge, and roomier rows. With no footer there is
960
977
  no band for the rows to slide under, so it is zeroed in every layout.
961
978
  Declared last so it follows every rule that sets the band. Mirrored in all
962
979
  four appearance copies; floatingOptionsParity.test.ts pins them together. */
@@ -993,7 +1010,7 @@
993
1010
  [data-aia-dropdown] [data-aia-pillbar] [data-aia-pill][data-aia-pill-active] {
994
1011
  text-transform: none;
995
1012
  letter-spacing: normal;
996
- font-size: var(--aia-param-label-font-size, 9.45px);
1013
+ font-size: var(--aia-param-label-font-size, 12px);
997
1014
  font-weight: 500;
998
1015
  opacity: 1;
999
1016
  }
@@ -1015,21 +1032,83 @@
1015
1032
  padding-inline: 5.6px;
1016
1033
  font-size: var(--aia-skip-font-size, 9.45px);
1017
1034
  }
1018
- /* After the label, skip sits right beside it ("Gender | skip"). A skip-only
1019
- row (pills shown in the input, so the bar has no label) keeps the base
1020
- auto margin and stays pinned at the trailing edge, with no rule. */
1021
- [data-aia-dropdown] [data-aia-pillbar] [data-aia-pill-scroll] + [data-aia-skip] {
1022
- margin-inline-start: 0;
1035
+ /* Roomier rows: 10.5px above and below each option instead of 5.6px. The
1036
+ row height feeds the visible-rows cap (planOptionsGrid), so it moves with
1037
+ the padding; picture and parameter-line rows add the same padding to their
1038
+ own heights. Tokens on the themed root at zero specificity, like the rest,
1039
+ so a consumer's value wins and the classic block below can restore its own. */
1040
+ :where(.magicx-aia) {
1041
+ --aia-option-padding-block: 10.5px;
1042
+ --aia-option-row-height: calc(14.7px + 2 * var(--aia-option-padding-block));
1043
+ }
1044
+ /* The panel hugs its options (panelHugWidth): as wide as the widest option
1045
+ times the columns, plus the panel's padding and 36px of breathing room,
1046
+ never under the header row (the whole label and "skip") or the minimum,
1047
+ nor over the full width. Desktop only: on a phone the panel keeps the
1048
+ full width. The width is set only on a panel of plain options; pickers and
1049
+ product strips stay full width. The rules below skip optionsStyle:
1050
+ "classic", which keeps the full-width panel, the fitted Done and the
1051
+ chevron. */
1052
+ @media (min-width: 769px) {
1053
+ [data-aia-dropdown][data-aia-hug]:not(:where([data-aia-options-style="classic"] *)) {
1054
+ inset-inline-end: auto;
1055
+ width: clamp(
1056
+ min(var(--aia-panel-min-width, 160px), 100%),
1057
+ var(--aia-panel-fit-width, 100%),
1058
+ 100%
1059
+ );
1060
+ }
1061
+ }
1062
+ /* Done spans the panel, whatever the panel's width. */
1063
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *)) [data-aia-multi-done] {
1064
+ width: var(--aia-multi-done-width, 100%);
1065
+ }
1066
+ /* A long list shows a thin scrollbar on its right edge instead of the
1067
+ "more below" chevron: the same button (scrollArrow.ts), drawn as a 3px
1068
+ rounded thumb on a faint track, placed and sized by the inline
1069
+ --aia-scroll-track-* / --aia-scroll-thumb-* vars. Shown whenever the list
1070
+ overflows (data-aia-scrollable), at the top, mid-scroll and at the end;
1071
+ it takes no clicks, the list scrolls by wheel, touch and keyboard. */
1072
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *)) [data-aia-scroll-arrow] {
1073
+ top: var(--aia-scroll-track-top, 0px);
1074
+ right: var(--aia-scroll-track-right, 0px);
1075
+ bottom: auto;
1076
+ left: auto;
1077
+ width: 3px;
1078
+ height: var(--aia-scroll-track-height, 0px);
1079
+ margin: 0 2px 0 0;
1080
+ border-radius: 3px;
1081
+ background: var(--aia-scrollbar-track, rgba(15, 23, 42, 0.05));
1082
+ pointer-events: none;
1083
+ animation: none;
1084
+ transition: opacity 200ms ease-out;
1023
1085
  }
1024
- [data-aia-dropdown] [data-aia-pillbar] [data-aia-pill-scroll] + [data-aia-skip]::before {
1086
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *)) [data-aia-scroll-arrow] svg {
1087
+ display: none;
1088
+ }
1089
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *))
1090
+ [data-aia-scroll-arrow]::after {
1025
1091
  content: "";
1026
- align-self: center;
1027
- width: 1px;
1028
- height: 0.9em;
1029
- margin-inline-end: 5.6px;
1030
- margin-inline-start: -2.8px;
1031
- background: currentColor;
1032
- opacity: 0.45;
1092
+ position: absolute;
1093
+ top: var(--aia-scroll-thumb-top, 0px);
1094
+ left: 0;
1095
+ width: 100%;
1096
+ height: var(--aia-scroll-thumb-height, 0px);
1097
+ border-radius: 3px;
1098
+ background: var(--aia-scrollbar-thumb, rgba(15, 23, 42, 0.22));
1099
+ }
1100
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *))
1101
+ [data-aia-scroll-arrow][data-aia-visible] {
1102
+ pointer-events: none;
1103
+ opacity: 0;
1104
+ }
1105
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *))
1106
+ [data-aia-scroll-arrow][data-aia-scrollable] {
1107
+ opacity: 1;
1108
+ }
1109
+ /* Room between the last row and Done, so the last line reads clear of it. */
1110
+ [data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *)) [data-aia-multi-actions] {
1111
+ padding-top: 14px;
1033
1112
  }
1034
1113
  /* End floating options box. */
1035
1114
 
@@ -1048,6 +1127,10 @@
1048
1127
  :where([data-aia-options-style="classic"] .magicx-aia[data-mode="light"]) {
1049
1128
  --aia-dropdown-border: var(--aia-primitive-neutral-900-a50);
1050
1129
  --aia-option-font-size: 16px;
1130
+ /* Full-size rows with classic's own 8px padding. The first two selectors
1131
+ match in dark mode too, so the rows hold in both. */
1132
+ --aia-option-padding-block: 8px;
1133
+ --aia-option-row-height: 37px;
1051
1134
  }
1052
1135
  :where(.magicx-aia[data-aia-options-style="classic"][data-mode="dark"]),
1053
1136
  :where([data-aia-options-style="classic"] .magicx-aia[data-mode="dark"]) {
@@ -1083,20 +1166,6 @@
1083
1166
  padding-inline: 8px;
1084
1167
  font-size: var(--aia-skip-font-size, 13.5px);
1085
1168
  }
1086
- :where([data-aia-options-style="classic"])
1087
- [data-aia-dropdown]
1088
- [data-aia-pillbar]
1089
- [data-aia-pill-scroll]
1090
- + [data-aia-skip]::before {
1091
- margin-inline-end: 8px;
1092
- margin-inline-start: -4px;
1093
- }
1094
-
1095
- /* Classic options box: full-size rows. On the element carrying the
1096
- attribute, at zero specificity, so a value the consumer sets wins. */
1097
- :where([data-aia-options-style="classic"]) {
1098
- --aia-option-row-height: 37px;
1099
- }
1100
1169
  `,document.head.appendChild(e)}if(typeof document<"u"&&!document.getElementById("ac-style-3819c762")){let e=document.createElement("style");e.id="ac-style-3819c762",e.textContent=`.aia-dropdown-yz2KC {
1101
1170
  position: absolute;
1102
1171
  left: 0;
@@ -1353,7 +1422,8 @@
1353
1422
  white-space: nowrap;
1354
1423
  transition:
1355
1424
  color 150ms ease-out,
1356
- background-color 150ms ease-out;
1425
+ background-color 150ms ease-out,
1426
+ opacity 160ms ease-out;
1357
1427
  }
1358
1428
 
1359
1429
  .aia-skip-7-olS:hover {
@@ -1364,63 +1434,30 @@
1364
1434
  background: var(--aia-skip-hover-bg, var(--aia-option-bg, transparent));
1365
1435
  }
1366
1436
 
1437
+ /* Disabled while a request is in flight (and in the press window after a
1438
+ pick, which always starts one): it fades out with the options and back in
1439
+ when the response lands. */
1367
1440
  .aia-skip-7-olS:disabled {
1368
1441
  pointer-events: none;
1369
1442
  cursor: default;
1370
- opacity: 0.5;
1443
+ /* 0.01, never 0: iOS reads exactly 0 as hidden, and this button is
1444
+ re-enabled in place, so a tap in flight would be cancelled. */
1445
+ opacity: 0.01;
1371
1446
  }
1372
1447
 
1373
- /* --- Fallback loading skeleton (only when no pills/options are cached) --- */
1448
+ /* --- Fallback loading space (only when no pills/options are cached) ---
1449
+ Holds the box's height while a request is in flight; nothing is drawn. */
1374
1450
  .aia-skeletonBars-HVr9C {
1375
1451
  display: flex;
1376
1452
  flex-direction: column;
1377
1453
  gap: 20px;
1378
1454
  padding: 7px 8px;
1379
- animation: aia-skeletonBarsIn-BdPrL 100ms ease-out;
1380
- }
1381
-
1382
- /* Fades out with the option skeleton \u2014 see SuggestionItem.module.css. */
1383
- .aia-dropdown-yz2KC[data-aia-skeleton-exiting] .aia-skeletonBars-HVr9C {
1384
- animation: aia-skeletonBarsOut-TqKeD 100ms ease-in forwards;
1385
- }
1386
-
1387
- @keyframes aia-skeletonBarsOut-TqKeD {
1388
- to {
1389
- opacity: 0;
1390
- }
1391
- }
1392
-
1393
- @keyframes aia-skeletonBarsIn-BdPrL {
1394
- from {
1395
- opacity: 0;
1396
- }
1455
+ visibility: hidden;
1397
1456
  }
1398
1457
 
1399
1458
  .aia-skeletonBar-O3xIx {
1400
1459
  display: block;
1401
1460
  height: 14px;
1402
- border-radius: 999px;
1403
- background: var(--aia-skeleton-bg, var(--aia-pill-bg, rgba(189, 189, 189, 0.25)));
1404
- opacity: 0.5;
1405
- animation: aia-aiaSkeletonPulse-G8W7q 1.4s ease-in-out infinite;
1406
- }
1407
-
1408
- .aia-skeletonBar-O3xIx:nth-child(2) {
1409
- animation-delay: 150ms;
1410
- }
1411
-
1412
- .aia-skeletonBar-O3xIx:nth-child(3) {
1413
- animation-delay: 300ms;
1414
- }
1415
-
1416
- @keyframes aia-aiaSkeletonPulse-G8W7q {
1417
- 0%,
1418
- 100% {
1419
- opacity: 0.5;
1420
- }
1421
- 50% {
1422
- opacity: 0.25;
1423
- }
1424
1461
  }
1425
1462
 
1426
1463
  /* A picker with its own Done button (multi-select, time wheel) ends on that
@@ -1509,7 +1546,7 @@
1509
1546
  transition-delay: 0s;
1510
1547
  }
1511
1548
  }
1512
- `,document.head.appendChild(e)}var Me={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q",multiDone:"aia-multiDone-y12U7"};var Z=require("@magicx-eng/ai-autocomplete-vanilla"),Vt=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) ---
1549
+ `,document.head.appendChild(e)}var He={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"};var J=require("@magicx-eng/ai-autocomplete-vanilla"),Vt=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) ---
1513
1550
 
1514
1551
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1515
1552
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1696,7 +1733,7 @@
1696
1733
  opacity: 0.8;
1697
1734
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1698
1735
  }
1699
- `,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",pressed:"aia-pressed-bEyyN"};var be=require("react/jsx-runtime"),La=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ut({options:e,activeIndex:a,listboxId:t,view:i,selection:o,onSelect:s,onHighlight:r,onUnhighlight:d,onPreviousMonth:m,onNextMonth:v}){let k=(0,Z.isoDate)(new Date),f=(0,Z.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,Z.cellIso)(e[a]),selected:o.selectedRange,floor:o.floor});return(0,be.jsxs)("div",{className:$.datepicker,"data-aia-datepicker":"",children:[(0,be.jsxs)("div",{className:$.header,children:[(0,be.jsx)("button",{type:"button",tabIndex:-1,className:$.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:m,children:"\u2039"}),(0,be.jsx)("span",{className:$.month,"data-aia-date-month":"","aria-live":"polite",children:(0,Z.monthLabel)(i)}),(0,be.jsx)("button",{type:"button",tabIndex:-1,className:$.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:v,children:"\u203A"})]}),(0,be.jsx)("div",{className:$.weekdays,"aria-hidden":"true",children:Z.WEEKDAY_LABELS.map((p,u)=>(0,be.jsx)("span",{className:$.weekday,children:p},La[u]))}),(0,be.jsx)("div",{className:$.grid,"data-aia-date-grid":"",children:e.map((p,u)=>(0,be.jsx)(za,{option:p,id:`${t}-option-${u}`,index:u,isHighlighted:u===a&&p.is_tappable,isToday:(0,Z.cellIso)(p)===k,isPast:(0,Z.isDimmedDay)((0,Z.cellIso)(p),k,o.floor),marks:(0,Z.dateCellMarks)((0,Z.cellIso)(p),{selectedIso:o.selectedIso,range:f}),onSelect:s,onHighlight:r,onUnhighlight:d},(0,Z.cellIso)(p)??`pad-${u}`))})]})}function za({option:e,id:a,index:t,isHighlighted:i,isToday:o,isPast:s,marks:r,onSelect:d,onHighlight:m,onUnhighlight:v}){let[k,f]=(0,Vt.useState)(!1),p=(0,Z.cellDay)(e);if(p==null)return(0,be.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${$.cell} ${$.blank}`});let u=()=>{f(!0),d(e),setTimeout(()=>f(!1),170)},x=[$.cell,$.day,s?$.past:"",i?$.highlighted:"",o?$.today:"",r.inRange?$.inRange:"",r.selected?$.selected:"",k?$.pressed:""].filter(Boolean).join(" ");return(0,be.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:x,onClick:u,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),u())},onMouseEnter:()=>m(t),onMouseLeave:v?()=>v(t):void 0,children:(0,be.jsx)("span",{className:$.number,children:p})})}var Je=require("@magicx-eng/ai-autocomplete-vanilla"),yt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
1736
+ `,document.head.appendChild(e)}var X={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};var be=require("react/jsx-runtime"),La=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ut({options:e,activeIndex:a,listboxId:t,view:i,selection:o,onSelect:s,onHighlight:r,onUnhighlight:d,onPreviousMonth:m,onNextMonth:v}){let C=(0,J.isoDate)(new Date),g=(0,J.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,J.cellIso)(e[a]),selected:o.selectedRange,floor:o.floor});return(0,be.jsxs)("div",{className:X.datepicker,"data-aia-datepicker":"",children:[(0,be.jsxs)("div",{className:X.header,children:[(0,be.jsx)("button",{type:"button",tabIndex:-1,className:X.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:m,children:"\u2039"}),(0,be.jsx)("span",{className:X.month,"data-aia-date-month":"","aria-live":"polite",children:(0,J.monthLabel)(i)}),(0,be.jsx)("button",{type:"button",tabIndex:-1,className:X.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:v,children:"\u203A"})]}),(0,be.jsx)("div",{className:X.weekdays,"aria-hidden":"true",children:J.WEEKDAY_LABELS.map((p,u)=>(0,be.jsx)("span",{className:X.weekday,children:p},La[u]))}),(0,be.jsx)("div",{className:X.grid,"data-aia-date-grid":"",children:e.map((p,u)=>(0,be.jsx)(za,{option:p,id:`${t}-option-${u}`,index:u,isHighlighted:u===a&&p.is_tappable,isToday:(0,J.cellIso)(p)===C,isPast:(0,J.isDimmedDay)((0,J.cellIso)(p),C,o.floor),marks:(0,J.dateCellMarks)((0,J.cellIso)(p),{selectedIso:o.selectedIso,range:g}),onSelect:s,onHighlight:r,onUnhighlight:d},(0,J.cellIso)(p)??`pad-${u}`))})]})}function za({option:e,id:a,index:t,isHighlighted:i,isToday:o,isPast:s,marks:r,onSelect:d,onHighlight:m,onUnhighlight:v}){let[C,g]=(0,Vt.useState)(!1),p=(0,J.cellDay)(e);if(p==null)return(0,be.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${X.cell} ${X.blank}`});let u=()=>{g(!0),d(e),setTimeout(()=>g(!1),170)},x=[X.cell,X.day,s?X.past:"",i?X.highlighted:"",o?X.today:"",r.inRange?X.inRange:"",r.selected?X.selected:"",C?X.pressed:""].filter(Boolean).join(" ");return(0,be.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:x,onClick:u,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),u())},onMouseEnter:()=>m(t),onMouseLeave:v?()=>v(t):void 0,children:(0,be.jsx)("span",{className:X.number,children:p})})}var Je=require("@magicx-eng/ai-autocomplete-vanilla"),yt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
1700
1737
  display: flex;
1701
1738
  flex-wrap: wrap;
1702
1739
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1883,7 +1920,7 @@
1883
1920
  justify-content: flex-end;
1884
1921
  }
1885
1922
  }
1886
- `,document.head.appendChild(e)}var _e={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 Ne=require("react/jsx-runtime");function Yt({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,Je.uiStringsFor)()}){let{key:i,hint:o}=(0,Je.getFooterHint)(e,a,t),[s,r]=(0,yt.useState)(Je.ATTRIBUTION_URL);return(0,yt.useEffect)(()=>{r((0,Je.buildAttributionUrl)())},[]),(0,Ne.jsx)("footer",{className:_e.footer,"data-aia-footer":"",children:(0,Ne.jsxs)(ft,{justify:"between",noWrap:!0,className:_e.row,children:[(0,Ne.jsxs)(ft,{gap:"5px",className:_e.hintGroup,children:[(0,Ne.jsx)("kbd",{className:_e.key,children:i}),(0,Ne.jsx)("span",{className:_e.hint,children:o})]}),(0,Ne.jsxs)("a",{className:_e.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[(0,Ne.jsx)("span",{className:_e.brand,children:"AI"}),(0,Ne.jsx)("span",{className:_e.badge,children:"Autocomplete"})]})]})})}var ne=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
1923
+ `,document.head.appendChild(e)}var Ve={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};var Fe=require("react/jsx-runtime");function Yt({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,Je.uiStringsFor)()}){let{key:i,hint:o}=(0,Je.getFooterHint)(e,a,t),[s,r]=(0,yt.useState)(Je.ATTRIBUTION_URL);return(0,yt.useEffect)(()=>{r((0,Je.buildAttributionUrl)())},[]),(0,Fe.jsx)("footer",{className:Ve.footer,"data-aia-footer":"",children:(0,Fe.jsxs)(ft,{justify:"between",noWrap:!0,className:Ve.row,children:[(0,Fe.jsxs)(ft,{gap:"5px",className:Ve.hintGroup,children:[(0,Fe.jsx)("kbd",{className:Ve.key,children:i}),(0,Fe.jsx)("span",{className:Ve.hint,children:o})]}),(0,Fe.jsxs)("a",{className:Ve.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[(0,Fe.jsx)("span",{className:Ve.brand,children:"AI"}),(0,Fe.jsx)("span",{className:Ve.badge,children:"Autocomplete"})]})]})})}var ne=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
1887
1924
  Angular copy). The three are kept identical by
1888
1925
  packages/vanilla/tests/render/locationFieldParity.test.ts. */
1889
1926
  .aia-location-6-fsr {
@@ -2017,7 +2054,7 @@
2017
2054
  .aia-loadingBar-OLCr4:nth-child(3) {
2018
2055
  width: 60%;
2019
2056
  }
2020
- `,document.head.appendChild(e)}var X={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};var W=require("react/jsx-runtime"),Da=0;function bt(e){return e.getRootNode().activeElement??null}function $t(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Qt(e){if(!e.isContentEditable)return null;let a=$t(e);if(!a||a.rangeCount===0)return null;let t=a.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function jt(e,a){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=$t(e);if(!t)return;let i=a;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}var Ma=(0,W.jsxs)("svg",{className:X.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,W.jsx)("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),(0,W.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Na=(0,W.jsxs)("svg",{className:X.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,W.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,W.jsx)("path",{d:"m20 20-3.5-3.5"})]});function Zt({view:e,searchLabel:a,noResultsLabel:t,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:d=!0,onQuery:m,onMove:v,onCommit:k,onFocusChange:f}){let p=(0,ne.useRef)(null),u=(0,ne.useRef)(null),x=(0,ne.useRef)(null),A=(0,ne.useRef)(null),q=(0,ne.useRef)(null),H=(0,ne.useRef)(!1),N=(0,ne.useRef)(!1),ae=(0,ne.useRef)(!1),O=(0,ne.useRef)(!1),F=(0,ne.useRef)(o);F.current=o;let T=(0,ne.useRef)(f);T.current=f;let Y=c=>{O.current=c,f(c)},ie=()=>{let c=p.current;return c!=null&&bt(c)===c},ce=()=>{let c=u.current;if(!c)return;let E=bt(c);E instanceof HTMLElement&&E!==p.current&&E!==document.body&&!c.contains(E)&&(A.current=E,q.current=Qt(E))},ee=c=>{let E=u.current;!E||!(c instanceof HTMLElement)||c===A.current||c===document.body||E.contains(c)||(A.current=c,q.current=Qt(c))},te=(0,ne.useRef)(null);te.current===null&&(te.current=`aia-location-${++Da}`);let P=`${te.current}-row-`;(0,ne.useEffect)(()=>{let c=p.current;c&&c.value!==e.query&&bt(c)!==c&&(c.value=e.query)},[e.query]),(0,ne.useEffect)(()=>{o&&(s&&!ae.current&&(N.current=!1),ae.current=s);let c=p.current;if(c){if(!r&&ie()){N.current=!0,Q();return}if(!o){setTimeout(()=>{if(F.current)return;let E=A.current;E&&bt(E)===E||(N.current=!1)},0);return}if(!(!s||N.current||!d||ie())){if(ce(),Y(!0),c.focus({preventScroll:!0}),!ie()){N.current=!0,Y(!1);return}c.value&&c.select()}}}),(0,ne.useLayoutEffect)(()=>()=>{if(!O.current)return;let c=p.current,E=A.current;E?.isConnected&&c&&bt(c)===c&&(H.current=!0,jt(E,q.current),H.current=!1),O.current=!1,T.current(!1)},[]);let Q=(c=!1)=>{c&&(N.current=!0);let E=A.current;E?.isConnected&&ie()&&(H.current=!0,jt(E,q.current),H.current=!1),Y(!1)},Ae=e.query.trim(),ke=e.highlighted>=0&&e.highlighted<e.places.length?`${P}${e.highlighted}`:void 0,ve=null;return e.places.length>0?ve=e.places.map((c,E)=>(0,W.jsxs)("div",{id:`${P}${E}`,role:"option","aria-selected":E===e.highlighted,className:E===e.highlighted?`${X.row} ${X.highlighted}`:X.row,"data-aia-location-row":"","data-aia-index":E,onClick:()=>{d&&(Q(!0),k(E))},children:[(0,W.jsx)("span",{className:X.pin,children:Ma}),(0,W.jsxs)("span",{className:X.text,children:[(0,W.jsx)("span",{className:X.name,children:c.name}),c.secondary&&(0,W.jsx)("span",{className:X.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?ve=(0,W.jsxs)("div",{className:X.loading,"data-aia-location-loading":"",children:[(0,W.jsx)("span",{className:X.loadingBar}),(0,W.jsx)("span",{className:X.loadingBar}),(0,W.jsx)("span",{className:X.loadingBar})]}):Ae&&(ve=(0,W.jsxs)("div",{className:X.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,W.jsx)("span",{className:X.empty,children:t}),(0,W.jsx)("span",{children:i})]})),(0,W.jsxs)("div",{ref:u,className:X.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!x.current?.contains(c.target)||(c.stopPropagation(),ce(),Y(!0))},children:[(0,W.jsxs)("label",{ref:x,className:X.field,children:[Na,(0,W.jsx)("input",{ref:p,type:"text",className:X.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:a,"aria-label":a,"aria-activedescendant":ke,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>m(c.target.value),onFocus:c=>{ee(c.relatedTarget),Y(!0)},onBlur:()=>{H.current||(N.current=!0,Y(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),v(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!d)return;Q(!0),k();return;case"Escape":c.preventDefault(),c.stopPropagation(),N.current=!0,Q();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),N.current=!0,Q();return}}})]}),(0,W.jsx)("div",{className:X.results,"data-aia-location-results":"","aria-live":"polite",children:ve})]})}var kt=require("@magicx-eng/ai-autocomplete-vanilla");var Xt=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
2057
+ `,document.head.appendChild(e)}var ee={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};var q=require("react/jsx-runtime"),Da=0;function bt(e){return e.getRootNode().activeElement??null}function $t(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Qt(e){if(!e.isContentEditable)return null;let a=$t(e);if(!a||a.rangeCount===0)return null;let t=a.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function jt(e,a){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=$t(e);if(!t)return;let i=a;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),t.removeAllRanges(),t.addRange(i)}var Ma=(0,q.jsxs)("svg",{className:ee.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,q.jsx)("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),(0,q.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Na=(0,q.jsxs)("svg",{className:ee.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,q.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,q.jsx)("path",{d:"m20 20-3.5-3.5"})]});function Zt({view:e,searchLabel:a,noResultsLabel:t,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:d=!0,onQuery:m,onMove:v,onCommit:C,onFocusChange:g}){let p=(0,ne.useRef)(null),u=(0,ne.useRef)(null),x=(0,ne.useRef)(null),A=(0,ne.useRef)(null),V=(0,ne.useRef)(null),H=(0,ne.useRef)(!1),N=(0,ne.useRef)(!1),de=(0,ne.useRef)(!1),P=(0,ne.useRef)(!1),G=(0,ne.useRef)(o);G.current=o;let K=(0,ne.useRef)(g);K.current=g;let S=c=>{P.current=c,g(c)},ae=()=>{let c=p.current;return c!=null&&bt(c)===c},ce=()=>{let c=u.current;if(!c)return;let E=bt(c);E instanceof HTMLElement&&E!==p.current&&E!==document.body&&!c.contains(E)&&(A.current=E,V.current=Qt(E))},ie=c=>{let E=u.current;!E||!(c instanceof HTMLElement)||c===A.current||c===document.body||E.contains(c)||(A.current=c,V.current=Qt(c))},oe=(0,ne.useRef)(null);oe.current===null&&(oe.current=`aia-location-${++Da}`);let L=`${oe.current}-row-`;(0,ne.useEffect)(()=>{let c=p.current;c&&c.value!==e.query&&bt(c)!==c&&(c.value=e.query)},[e.query]),(0,ne.useEffect)(()=>{o&&(s&&!de.current&&(N.current=!1),de.current=s);let c=p.current;if(c){if(!r&&ae()){N.current=!0,F();return}if(!o){setTimeout(()=>{if(G.current)return;let E=A.current;E&&bt(E)===E||(N.current=!1)},0);return}if(!(!s||N.current||!d||ae())){if(ce(),S(!0),c.focus({preventScroll:!0}),!ae()){N.current=!0,S(!1);return}c.value&&c.select()}}}),(0,ne.useLayoutEffect)(()=>()=>{if(!P.current)return;let c=p.current,E=A.current;E?.isConnected&&c&&bt(c)===c&&(H.current=!0,jt(E,V.current),H.current=!1),P.current=!1,K.current(!1)},[]);let F=(c=!1)=>{c&&(N.current=!0);let E=A.current;E?.isConnected&&ae()&&(H.current=!0,jt(E,V.current),H.current=!1),S(!1)},Le=e.query.trim(),Ce=e.highlighted>=0&&e.highlighted<e.places.length?`${L}${e.highlighted}`:void 0,ve=null;return e.places.length>0?ve=e.places.map((c,E)=>(0,q.jsxs)("div",{id:`${L}${E}`,role:"option","aria-selected":E===e.highlighted,className:E===e.highlighted?`${ee.row} ${ee.highlighted}`:ee.row,"data-aia-location-row":"","data-aia-index":E,onClick:()=>{d&&(F(!0),C(E))},children:[(0,q.jsx)("span",{className:ee.pin,children:Ma}),(0,q.jsxs)("span",{className:ee.text,children:[(0,q.jsx)("span",{className:ee.name,children:c.name}),c.secondary&&(0,q.jsx)("span",{className:ee.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?ve=(0,q.jsxs)("div",{className:ee.loading,"data-aia-location-loading":"",children:[(0,q.jsx)("span",{className:ee.loadingBar}),(0,q.jsx)("span",{className:ee.loadingBar}),(0,q.jsx)("span",{className:ee.loadingBar})]}):Le&&(ve=(0,q.jsxs)("div",{className:ee.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,q.jsx)("span",{className:ee.empty,children:t}),(0,q.jsx)("span",{children:i})]})),(0,q.jsxs)("div",{ref:u,className:ee.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!x.current?.contains(c.target)||(c.stopPropagation(),ce(),S(!0))},children:[(0,q.jsxs)("label",{ref:x,className:ee.field,children:[Na,(0,q.jsx)("input",{ref:p,type:"text",className:ee.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:a,"aria-label":a,"aria-activedescendant":Ce,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>m(c.target.value),onFocus:c=>{ie(c.relatedTarget),S(!0)},onBlur:()=>{H.current||(N.current=!0,S(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),v(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!d)return;F(!0),C();return;case"Escape":c.preventDefault(),c.stopPropagation(),N.current=!0,F();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),N.current=!0,F();return}}})]}),(0,q.jsx)("div",{className:ee.results,"data-aia-location-results":"","aria-live":"polite",children:ve})]})}var kt=require("@magicx-eng/ai-autocomplete-vanilla");var Xt=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
2021
2058
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
2022
2059
  The border is kept as a 1px transparent line so the box stays the same size
2023
2060
  as it was when the outline was dashed. */
@@ -2096,11 +2133,6 @@
2096
2133
  animation-name: aia-smartSuggestion-sparkle-small-3VsWJ;
2097
2134
  }
2098
2135
 
2099
- .aia-skeleton-57P0T .aia-smartText-R0cfw,
2100
- .aia-skeleton-57P0T .aia-smartSparkle-IVabG {
2101
- visibility: hidden;
2102
- }
2103
-
2104
2136
  @keyframes aia-smartSuggestion-shimmer-F-yoD {
2105
2137
  0% {
2106
2138
  background-position: 100% 0;
@@ -2154,44 +2186,24 @@
2154
2186
  }
2155
2187
  }
2156
2188
 
2157
- /* Loading skeleton \u2014 preserves the pill's exact box (same width and height)
2158
- and hides the text. The base pill is now transparent, so fill the interior
2159
- with the skeleton color (inside the dashed border) and pulse it so it still
2160
- reads as a loading chip. */
2189
+ /* Loading \u2014 a pill kept from the last response fades out while the next one
2190
+ is fetched; a placeholder pill (no cached pills) only holds its space. */
2161
2191
  .aia-skeleton-57P0T {
2162
2192
  pointer-events: none;
2163
2193
  cursor: default;
2164
- color: transparent;
2165
- background: var(--aia-skeleton-bg, var(--aia-pill-bg, rgba(189, 189, 189, 0.25)));
2166
- animation:
2167
- aia-skeletonIn-54kMv 100ms ease-out,
2168
- aia-skeletonPulse-xGcUy 1.4s ease-in-out infinite;
2194
+ animation: aia-loadingOut-Aj9xO 160ms ease-in forwards;
2169
2195
  }
2170
2196
 
2171
- /* Fades out with the option skeleton \u2014 see SuggestionItem.module.css. */
2172
- [data-aia-skeleton-exiting] .aia-skeleton-57P0T {
2173
- animation: aia-skeletonOut-1sJ-r 100ms ease-in forwards;
2174
- }
2175
-
2176
- @keyframes aia-skeletonIn-54kMv {
2177
- from {
2178
- opacity: 0;
2179
- }
2197
+ .aia-skeleton-57P0T[data-aia-pill-skeleton] {
2198
+ visibility: hidden;
2199
+ animation: none;
2180
2200
  }
2181
2201
 
2182
- @keyframes aia-skeletonOut-1sJ-r {
2202
+ /* Ends a hair above zero, like magicx-aia-fadeIn starts: a pill kept by key
2203
+ is re-enabled in place, and iOS cancels a tap on an element leaving 0. */
2204
+ @keyframes aia-loadingOut-Aj9xO {
2183
2205
  to {
2184
- opacity: 0;
2185
- }
2186
- }
2187
-
2188
- @keyframes aia-skeletonPulse-xGcUy {
2189
- 0%,
2190
- 100% {
2191
- filter: brightness(1);
2192
- }
2193
- 50% {
2194
- filter: brightness(0.55);
2206
+ opacity: 0.01;
2195
2207
  }
2196
2208
  }
2197
2209
 
@@ -2200,7 +2212,7 @@
2200
2212
  opacity: 0;
2201
2213
  }
2202
2214
  }
2203
- `,document.head.appendChild(e)}var Fe={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",skeletonIn:"aia-skeletonIn-54kMv",skeletonPulse:"aia-skeletonPulse-xGcUy",skeletonOut:"aia-skeletonOut-1sJ-r"};var et=require("react/jsx-runtime"),zt={selected:1,first:.7,next:.4,last:.2};function Jt({label:e,state:a,active:t,rounded:i,loading:o,smartSuggestion:s,completionHeader:r,onClick:d}){let m=[Fe.pill,i?Fe.rounded:"",o?Fe.skeleton:""].filter(Boolean).join(" ");return(0,et.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:m,style:{"--aia-pill-opacity":zt[a]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:d,disabled:o,children:s?(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)("span",{className:`${Fe.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,et.jsx)("span",{className:`${Fe.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Xt.SMART_SUGGESTION_SPARKLE_SVG}})]}):e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
2215
+ `,document.head.appendChild(e)}var Be={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};var et=require("react/jsx-runtime"),zt={selected:1,first:.7,next:.4,last:.2};function Jt({label:e,state:a,active:t,rounded:i,loading:o,smartSuggestion:s,completionHeader:r,onClick:d}){let m=[Be.pill,i?Be.rounded:"",o?Be.skeleton:""].filter(Boolean).join(" ");return(0,et.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:m,style:{"--aia-pill-opacity":zt[a]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:d,disabled:o,children:s?(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)("span",{className:`${Be.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,et.jsx)("span",{className:`${Be.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Xt.SMART_SUGGESTION_SPARKLE_SVG}})]}):e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
2204
2216
  position: relative;
2205
2217
  z-index: 1;
2206
2218
  pointer-events: auto;
@@ -2210,7 +2222,7 @@
2210
2222
  align-items: center;
2211
2223
  vertical-align: middle;
2212
2224
  }
2213
- `,document.head.appendChild(e)}var Dt={list:"aia-list-qvLqO"};var wt=require("react/jsx-runtime"),Fa=[125,69];function ea(e){return e===0?"first":e===1?"next":"last"}function Ct({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:i,rounded:o,loading:s}){return s&&e.length===0?(0,wt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":"",children:Fa.map((r,d)=>(0,wt.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Fe.pill} ${o?Fe.rounded:""} ${Fe.skeleton}`,style:{width:r,"--aia-pill-opacity":zt[ea(d)]}},`skel-${r}`))}):(0,wt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,d)=>{let m=!!i&&d===a;return(0,wt.jsx)(Jt,{label:r.text,state:m?"selected":ea(d),selected:m,active:d===a,rounded:o,loading:s,smartSuggestion:(0,kt.isSmartSuggestion)(r),completionHeader:(0,kt.isTraditionalAutocompleteSuggestion)(r),onClick:()=>t(d)},`${r.parameter}-${r.text}`)})})}var xe=require("@magicx-eng/ai-autocomplete-vanilla"),we=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
2225
+ `,document.head.appendChild(e)}var Dt={list:"aia-list-qvLqO"};var wt=require("react/jsx-runtime"),Ha=[125,69];function ea(e){return e===0?"first":e===1?"next":"last"}function Ct({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:i,rounded:o,loading:s}){return s&&e.length===0?(0,wt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":"",children:Ha.map((r,d)=>(0,wt.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Be.pill} ${o?Be.rounded:""} ${Be.skeleton}`,style:{width:r,"--aia-pill-opacity":zt[ea(d)]}},`skel-${r}`))}):(0,wt.jsx)("span",{className:Dt.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,d)=>{let m=!!i&&d===a;return(0,wt.jsx)(Jt,{label:r.text,state:m?"selected":ea(d),selected:m,active:d===a,rounded:o,loading:s,smartSuggestion:(0,kt.isSmartSuggestion)(r),completionHeader:(0,kt.isTraditionalAutocompleteSuggestion)(r),onClick:()=>t(d)},`${r.parameter}-${r.text}`)})})}var ye=require("@magicx-eng/ai-autocomplete-vanilla"),we=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
2214
2226
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
2215
2227
  theming one package sees the same result in the other.
2216
2228
 
@@ -2779,7 +2791,7 @@
2779
2791
  .aia-card-JBGYT[data-aia-product-has-cart] {
2780
2792
  padding-right: calc(var(--aia-product-cart-size, 28px) + 16px);
2781
2793
  }
2782
- `,document.head.appendChild(e)}var J={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr"};var G=require("react/jsx-runtime");function ta({products:e,listboxId:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s=!0,layout:r="row",imageFallback:d="image",strings:m=(0,xe.uiStringsFor)()}){let v=e.length>0,k=(0,we.useRef)(null);if((0,we.useEffect)(()=>{let p=k.current;if(!(!v||!p))return(0,xe.attachProductRowWheel)(p)},[v]),!v)return null;let f=`${a}-products-label`;return(0,G.jsxs)("section",{className:J.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":f,children:[(0,G.jsx)("div",{className:J.label,id:f,"data-aia-products-label":"",children:m.products}),(0,G.jsx)("div",{ref:k,className:J.row,"data-aia-products-row":"",children:e.map((p,u)=>(0,G.jsx)(Ha,{product:p,id:`${a}-product-${u}`,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:d,soldOut:m.soldOut,addToCart:m.addToCart},p.id))})]})}function Ha({product:e,id:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:r,soldOut:d,addToCart:m}){let v=!!i&&e.available!==!1,[k,f]=(0,we.useState)(null),p=x=>{x.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},u=x=>{x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||x.button!==0||(x.preventDefault(),t(e))};return(0,G.jsxs)("a",{id:a,className:J.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":v?"":void 0,role:"option","aria-selected":!1,style:k?{"--aia-product-photo-fill-x":String(k.x),"--aia-product-photo-fill-y":String(k.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:u,onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:p,children:[(0,G.jsx)(Wa,{sources:(0,xe.productImageSources)(e.imageUrl),title:e.title,fallback:r,onPhotoFill:f},(0,xe.productImageSrc)(e.imageUrl)??""),(0,G.jsxs)("span",{className:J.body,children:[e.vendor?(0,G.jsx)("span",{className:J.vendor,children:e.vendor}):null,(0,G.jsx)("span",{className:J.title,children:e.title}),e.price?(0,G.jsxs)("span",{className:J.price,children:[e.price,e.compareAtPrice?(0,G.jsx)("s",{className:J.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,G.jsx)("span",{className:J.badge,children:d}):null]}),v&&i?(0,G.jsx)(Ga,{product:e,label:`${m}: ${e.title}`,focusable:s,onAddToCart:i,onFocus:()=>o?.(!0),onBlur:p},Ba(e)):null]})}function Ba(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(a=>a??"").join("\0")}function Ga({product:e,label:a,focusable:t,onAddToCart:i,onFocus:o,onBlur:s}){let[r,d]=(0,we.useState)(null),m=(0,we.useRef)(null),v=(0,we.useRef)(e);v.current=e;let k=(0,we.useRef)(!0);(0,we.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let f=u=>{m.current=u,k.current&&d(u)},p=u=>{if(u.preventDefault(),u.stopPropagation(),m.current==="adding")return;f("adding");let x;try{x=Promise.resolve(i(v.current))}catch(A){x=Promise.reject(A)}x.then(()=>f("added"),()=>f(null))};return(0,G.jsx)("span",{className:J.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":a,tabIndex:t?0:-1,onClick:p,onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||p(u)},onFocus:u=>{u.stopPropagation(),o()},onBlur:u=>{u.stopPropagation(),s(u)},children:(0,G.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,G.jsx)("path",{className:J.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,G.jsx)("path",{className:J.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,G.jsx)("path",{className:J.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,G.jsx)("path",{className:J.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,G.jsx)("circle",{className:J.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,G.jsx)("circle",{className:J.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Wa({sources:e,title:a,fallback:t,onPhotoFill:i}){let[o,s]=(0,we.useState)(0),r=e[o],d=!!r,[m,v]=(0,we.useState)(null),k=!d&&t==="initial";return(0,we.useEffect)(()=>()=>i(null),[i]),(0,G.jsxs)("span",{className:J.media,"aria-hidden":"true","data-aia-product-placeholder":!d&&!k?"":void 0,"data-aia-product-initial":k?"":void 0,"data-aia-image-loaded":d&&m===r?"":void 0,children:[d?(0,G.jsx)("img",{className:J.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:f=>{v(r),i((0,xe.productPhotoFill)(f.currentTarget.naturalWidth,f.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),s(f=>f+1)}}):null,k?(0,xe.productInitial)(a):null]})}var le=require("@magicx-eng/ai-autocomplete-vanilla"),He=require("react");var aa=require("@magicx-eng/ai-autocomplete-vanilla"),St=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
2794
+ `,document.head.appendChild(e)}var te={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr"};var W=require("react/jsx-runtime");function ta({products:e,listboxId:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s=!0,layout:r="row",imageFallback:d="image",strings:m=(0,ye.uiStringsFor)()}){let v=e.length>0,C=(0,we.useRef)(null);if((0,we.useEffect)(()=>{let p=C.current;if(!(!v||!p))return(0,ye.attachProductRowWheel)(p)},[v]),!v)return null;let g=`${a}-products-label`;return(0,W.jsxs)("section",{className:te.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":g,children:[(0,W.jsx)("div",{className:te.label,id:g,"data-aia-products-label":"",children:m.products}),(0,W.jsx)("div",{ref:C,className:te.row,"data-aia-products-row":"",children:e.map((p,u)=>(0,W.jsx)(Fa,{product:p,id:`${a}-product-${u}`,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:d,soldOut:m.soldOut,addToCart:m.addToCart},p.id))})]})}function Fa({product:e,id:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:r,soldOut:d,addToCart:m}){let v=!!i&&e.available!==!1,[C,g]=(0,we.useState)(null),p=x=>{x.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},u=x=>{x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||x.button!==0||(x.preventDefault(),t(e))};return(0,W.jsxs)("a",{id:a,className:te.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":v?"":void 0,role:"option","aria-selected":!1,style:C?{"--aia-product-photo-fill-x":String(C.x),"--aia-product-photo-fill-y":String(C.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:u,onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:p,children:[(0,W.jsx)(Ga,{sources:(0,ye.productImageSources)(e.imageUrl),title:e.title,fallback:r,onPhotoFill:g},(0,ye.productImageSrc)(e.imageUrl)??""),(0,W.jsxs)("span",{className:te.body,children:[e.vendor?(0,W.jsx)("span",{className:te.vendor,children:e.vendor}):null,(0,W.jsx)("span",{className:te.title,children:e.title}),e.price?(0,W.jsxs)("span",{className:te.price,children:[e.price,e.compareAtPrice?(0,W.jsx)("s",{className:te.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,W.jsx)("span",{className:te.badge,children:d}):null]}),v&&i?(0,W.jsx)(Wa,{product:e,label:`${m}: ${e.title}`,focusable:s,onAddToCart:i,onFocus:()=>o?.(!0),onBlur:p},Ba(e)):null]})}function Ba(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(a=>a??"").join("\0")}function Wa({product:e,label:a,focusable:t,onAddToCart:i,onFocus:o,onBlur:s}){let[r,d]=(0,we.useState)(null),m=(0,we.useRef)(null),v=(0,we.useRef)(e);v.current=e;let C=(0,we.useRef)(!0);(0,we.useEffect)(()=>(C.current=!0,()=>{C.current=!1}),[]);let g=u=>{m.current=u,C.current&&d(u)},p=u=>{if(u.preventDefault(),u.stopPropagation(),m.current==="adding")return;g("adding");let x;try{x=Promise.resolve(i(v.current))}catch(A){x=Promise.reject(A)}x.then(()=>g("added"),()=>g(null))};return(0,W.jsx)("span",{className:te.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":a,tabIndex:t?0:-1,onClick:p,onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||p(u)},onFocus:u=>{u.stopPropagation(),o()},onBlur:u=>{u.stopPropagation(),s(u)},children:(0,W.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,W.jsx)("path",{className:te.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),(0,W.jsx)("path",{className:te.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,W.jsx)("path",{className:te.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,W.jsx)("path",{className:te.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,W.jsx)("circle",{className:te.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,W.jsx)("circle",{className:te.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ga({sources:e,title:a,fallback:t,onPhotoFill:i}){let[o,s]=(0,we.useState)(0),r=e[o],d=!!r,[m,v]=(0,we.useState)(null),C=!d&&t==="initial";return(0,we.useEffect)(()=>()=>i(null),[i]),(0,W.jsxs)("span",{className:te.media,"aria-hidden":"true","data-aia-product-placeholder":!d&&!C?"":void 0,"data-aia-product-initial":C?"":void 0,"data-aia-image-loaded":d&&m===r?"":void 0,children:[d?(0,W.jsx)("img",{className:te.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:g=>{v(r),i((0,ye.productPhotoFill)(g.currentTarget.naturalWidth,g.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),s(g=>g+1)}}):null,C?(0,ye.productInitial)(a):null]})}var U=require("@magicx-eng/ai-autocomplete-vanilla"),Ee=require("react");var aa=require("@magicx-eng/ai-autocomplete-vanilla"),St=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
2783
2795
  display: grid;
2784
2796
  grid-template-columns: repeat(
2785
2797
  auto-fit,
@@ -2823,7 +2835,7 @@
2823
2835
  :where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
2824
2836
  max-height: var(--aia-grid-max-height, 120px);
2825
2837
  }
2826
- `,document.head.appendChild(e)}var oa=require("react/jsx-runtime");function ia({min:e="16rem",max:a,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:s,cols:r,template:d,innerRef:m,className:v,children:k,...f}){let p=(0,St.useRef)(null);(0,St.useLayoutEffect)(()=>{if(s===void 0)return;let x=p.current;x&&(x.scrollTop=0)},[s]);let u={"--aia-grid-min":e};return a&&(u["--aia-grid-max"]=a),t&&(u["--aia-grid-gap"]=t),o&&(u["--aia-grid-max-height"]=o),r&&(u.gridTemplateColumns=(0,aa.optionsGridTemplateColumns)(r)),d&&(u.gridTemplateColumns=d),(0,oa.jsx)("div",{ref:x=>{p.current=x,m?.(x)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:u,...f,children:k})}var me=require("@magicx-eng/ai-autocomplete-vanilla"),Te=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 {
2838
+ `,document.head.appendChild(e)}var oa=require("react/jsx-runtime");function ia({min:e="16rem",max:a,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:s,cols:r,template:d,innerRef:m,className:v,children:C,...g}){let p=(0,St.useRef)(null);(0,St.useLayoutEffect)(()=>{if(s===void 0)return;let x=p.current;x&&(x.scrollTop=0)},[s]);let u={"--aia-grid-min":e};return a&&(u["--aia-grid-max"]=a),t&&(u["--aia-grid-gap"]=t),o&&(u["--aia-grid-max-height"]=o),r&&(u.gridTemplateColumns=(0,aa.optionsGridTemplateColumns)(r)),d&&(u.gridTemplateColumns=d),(0,oa.jsx)("div",{ref:x=>{p.current=x,m?.(x)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:u,...g,children:C})}var me=require("@magicx-eng/ai-autocomplete-vanilla"),Ie=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
2827
2839
  position: relative;
2828
2840
  /* Clip, not visible: the entrance rise below runs on the inner content,
2829
2841
  and a transformed box extends its scroll container's scrollable area.
@@ -2850,7 +2862,7 @@
2850
2862
  /* 5.6px radius on the highlighted fill (--aia-option-bg), matching the Figma
2851
2863
  SuggestionItem selection at 70%. The 5.6px/10px inset is the item's own padding. */
2852
2864
  border-radius: 5.6px;
2853
- padding: 5.6px 10px;
2865
+ padding: var(--aia-option-padding-block, 5.6px) 10px;
2854
2866
  /* No entrance animation on the row itself \u2014 deliberately. The row is the
2855
2867
  tappable element, and iOS Safari drops a tap on a scripted-clickable
2856
2868
  element (a div with a click handler; a native button is exempt) whose
@@ -2984,36 +2996,29 @@
2984
2996
  mask-image: none;
2985
2997
  }
2986
2998
 
2987
- /* Loading state \u2014 preserve the row's exact dimensions. The content stays an
2988
- inline span so the line box and padding match the non-loading state byte
2989
- for byte. Just hide the text and apply a background as a skeleton bar; the
2990
- pulse provides the shimmer. */
2999
+ /* Loading \u2014 a row kept from the last response fades out while the next one
3000
+ is fetched, text and all; nothing else changes, so the box does not move. */
2991
3001
  .aia-item-d4vpD[data-aia-loading] {
2992
3002
  cursor: default;
2993
- animation: aia-skeletonPulse-plvdD 1.4s ease-in-out infinite;
3003
+ pointer-events: none;
3004
+ animation: aia-loadingOut-hI-qI 160ms ease-in forwards;
2994
3005
  }
2995
3006
 
2996
- /* Skeleton fill is on the inner text span (a true inline element) so multi-
2997
- line options wrap into one skeleton bar per line. The outer .content is a
2998
- flex item \u2014 blockified by spec \u2014 so painting the background there would
2999
- collapse all lines into one tall rectangle. \`box-decoration-break: clone\`
3000
- makes the radius render cleanly on each line bar. */
3001
- .aia-item-d4vpD[data-aia-loading] .aia-text-yqoh9 {
3002
- color: transparent;
3003
- background: var(--aia-skeleton-bg, var(--aia-pill-bg, rgba(189, 189, 189, 0.25)));
3004
- border-radius: 999px;
3005
- -webkit-box-decoration-break: clone;
3006
- box-decoration-break: clone;
3007
- animation: aia-skeletonBarIn-ZlEM0 100ms ease-out;
3007
+ .aia-item-d4vpD[data-aia-loading] .aia-content-T-Qba {
3008
+ animation: none;
3008
3009
  }
3009
3010
 
3010
- .aia-item-d4vpD[data-aia-loading] .aia-tag-e3Fwe {
3011
- display: none;
3011
+ /* Ends a hair above zero, like magicx-aia-fadeIn starts: a pill kept by key
3012
+ is re-enabled in place, and iOS cancels a tap on an element leaving 0. */
3013
+ @keyframes aia-loadingOut-hI-qI {
3014
+ to {
3015
+ opacity: 0.01;
3016
+ }
3012
3017
  }
3013
3018
 
3014
3019
  /* The parameter an option is a value of, under its text ("Flavor", "Subcategory"):
3015
3020
  muted and smaller, so options that read alike are told apart. Block inside the
3016
- text box, so a hanging indent never moves it; a skeleton row drops it. */
3021
+ text box, so a hanging indent never moves it. */
3017
3022
  .aia-parameter-Dt2zF {
3018
3023
  display: block;
3019
3024
  font-size: var(--aia-option-parameter-font-size, 8.4px);
@@ -3030,10 +3035,6 @@
3030
3035
  font-weight: 600;
3031
3036
  }
3032
3037
 
3033
- .aia-item-d4vpD[data-aia-loading] .aia-parameter-Dt2zF {
3034
- display: none;
3035
- }
3036
-
3037
3038
  /* Server-provided option icon (\`icon_svg\` on the option): a box exactly one
3038
3039
  text line tall, top-aligned, so it sits centred on the first line of a
3039
3040
  wrapped option and never grows the line box. The glyph draws in
@@ -3059,14 +3060,6 @@
3059
3060
  height: 1em;
3060
3061
  }
3061
3062
 
3062
- /* Skeleton rows keep the icon's column (hidden, not removed) and the
3063
- hanging indent below, so a row that flips into loading and back \u2014 the
3064
- same element in React, a rebuilt one in vanilla \u2014 draws its bar and its
3065
- text at the same x and nothing slides sideways. */
3066
- .aia-item-d4vpD[data-aia-loading] .aia-icon-Qw938 {
3067
- visibility: hidden;
3068
- }
3069
-
3070
3063
  /* With an icon, the content box hangs its continuation lines: a left pad the
3071
3064
  width of the icon plus its gap, and a matching negative first-line indent
3072
3065
  that pulls the icon back into that pad. Wrapped lines then start under the
@@ -3100,15 +3093,6 @@
3100
3093
  min-width: 0;
3101
3094
  }
3102
3095
 
3103
- /* A skeleton bar hugs its text. The rules above let the text grow to fill a
3104
- picture / count row (so the count sits at the trailing edge); a loading row
3105
- hides the count, and a growing text box would paint the bar across the
3106
- whole column. One compound deeper than those rules, so it wins in every
3107
- copy regardless of source order. */
3108
- .aia-item-d4vpD[data-aia-loading] .aia-content-T-Qba .aia-text-yqoh9 {
3109
- flex: 0 1 auto;
3110
- }
3111
-
3112
3096
  /* The picture: a square tile, centred on the text beside it (a one-line
3113
3097
  option reads as the reference row; a wrapped one keeps the tile on its
3114
3098
  vertical middle). Sized and rounded by token so a consumer can shrink it
@@ -3191,27 +3175,12 @@
3191
3175
  content: " " var(--aia-option-count-unit-one, var(--aia-option-count-unit, "item"));
3192
3176
  }
3193
3177
 
3194
- /* Skeleton rows fill the tile even when the picture has loaded (the fill
3195
- pulses with the row) and hide the picture, and drop the count like the
3196
- tag. */
3197
- .aia-item-d4vpD[data-aia-loading] .aia-image-YZAbO {
3198
- background: var(--aia-option-image-bg, var(--aia-skeleton-bg, rgba(189, 189, 189, 0.083)));
3199
- }
3200
-
3201
- .aia-item-d4vpD[data-aia-loading] .aia-image-YZAbO img {
3202
- visibility: hidden;
3203
- }
3204
-
3205
- .aia-item-d4vpD[data-aia-loading] .aia-count-IpYbQ {
3206
- display: none;
3207
- }
3208
-
3209
3178
  /* A grid of rows with a parameter line is taller per row: the row's text
3210
3179
  line and padding plus the parameter line, so the visible-rows cap
3211
3180
  (\`--aia-grid-max-height\`) does not cut the last row. Before the picture rule,
3212
3181
  which wins when a group has both. */
3213
3182
  [data-aia-group]:has(.aia-parameter-Dt2zF) {
3214
- --aia-option-row-height: 37.1px;
3183
+ --aia-option-row-height: calc(25.9px + 2 * var(--aia-option-padding-block, 5.6px));
3215
3184
  }
3216
3185
 
3217
3186
  /* A grid of picture rows is taller per row: the visible-rows cap
@@ -3219,7 +3188,11 @@
3219
3188
  planOptionsGrid) follows the tile's height plus the row's padding, so the
3220
3189
  same number of rows shows before the list scrolls. */
3221
3190
  [data-aia-group]:has(.aia-image-YZAbO) {
3222
- --aia-option-row-height: calc(var(--aia-option-image-size, 28px) + 11.2px);
3191
+ --aia-option-row-height: calc(
3192
+ var(--aia-option-image-size, 28px) +
3193
+ 2 *
3194
+ var(--aia-option-padding-block, 5.6px)
3195
+ );
3223
3196
  }
3224
3197
 
3225
3198
  /* A row without a picture, in a grid where other rows have one, lines up
@@ -3228,8 +3201,7 @@
3228
3201
  does. A row with neither a picture nor an icon is not indented to match:
3229
3202
  its text sits flush left, as it would in a grid with no pictures. Grids
3230
3203
  with no pictures keep the inline icon and hanging indent above. The text
3231
- is left to size itself: letting it grow here would out-rank the
3232
- loading-bar rule that makes a skeleton bar hug its text. */
3204
+ is left to size itself. */
3233
3205
  [data-aia-group]:has(.aia-image-YZAbO) .aia-content-T-Qba:not(:has(.aia-image-YZAbO)) {
3234
3206
  display: flex;
3235
3207
  flex: 1 1 auto;
@@ -3259,48 +3231,10 @@
3259
3231
  height: var(--aia-option-tile-icon-size, 1.5em);
3260
3232
  }
3261
3233
 
3262
- @keyframes aia-skeletonPulse-plvdD {
3263
- 0%,
3264
- 100% {
3265
- filter: brightness(1);
3266
- }
3267
- 50% {
3268
- filter: brightness(0.55);
3269
- }
3270
- }
3271
- /* --- Loading skeleton fades ---
3272
- Skeletons ease in and out over 100ms instead of popping. In: an option's
3273
- text crossfades into its bar (the row element persists in React / Angular
3274
- and is rebuilt in vanilla \u2014 a keyframe plays either way). Out: while the
3275
- dropdown carries data-aia-skeleton-exiting (the core holds the skeleton for
3276
- SKELETON_FADE_MS after the response lands) the skeleton rows and pills fade
3277
- to nothing before the response's options replace them. Keep 100ms in step
3278
- with SKELETON_FADE_MS in AIAutocomplete.ts. */
3279
- /* During the fade-out the skeleton rows play nothing but the fade: no
3280
- entrance, no text crossfade. Rows keep their identity through it (the core's
3281
- dropdownSuggestion), but if one were ever remounted here, replaying either
3282
- animation would bring the previous option's text back on screen. */
3283
- [data-aia-skeleton-exiting] .aia-item-d4vpD[data-aia-loading] .aia-content-T-Qba,
3284
- [data-aia-skeleton-exiting] .aia-item-d4vpD[data-aia-loading] .aia-text-yqoh9 {
3285
- animation: none;
3286
- }
3287
-
3288
- [data-aia-skeleton-exiting] .aia-item-d4vpD[data-aia-loading] {
3289
- animation: aia-skeletonOut-x6NRd 100ms ease-in forwards;
3290
- }
3291
-
3292
- @keyframes aia-skeletonBarIn-ZlEM0 {
3293
- from {
3294
- background-color: transparent;
3295
- color: inherit;
3296
- }
3297
- }
3298
-
3299
- @keyframes aia-skeletonOut-x6NRd {
3300
- to {
3301
- opacity: 0;
3302
- }
3303
- }
3234
+ /* --- Loading fades ---
3235
+ Nothing extra plays while the dropdown carries data-aia-skeleton-exiting:
3236
+ the loading rows have already faded out, and a second animation would
3237
+ restart the fade from full strength. */
3304
3238
 
3305
3239
  .aia-content-T-Qba:has(.aia-checkbox-KGRhg) {
3306
3240
  display: flex;
@@ -3421,7 +3355,7 @@
3421
3355
  border-radius: 6px;
3422
3356
  font-size: 11px;
3423
3357
  }
3424
- `,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",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",skeletonBarIn:"aia-skeletonBarIn-ZlEM0",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd",checkbox:"aia-checkbox-KGRhg"};var he=require("react/jsx-runtime");function na({option:e,isHighlighted:a,checked:t,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:d,showIcon:m=!0,showImage:v=!0,showCount:k=!0,scrollHint:f,enterDelayMs:p=0}){let[u]=(0,Te.useState)(p),[x,A]=(0,Te.useState)(!1),q=v?(0,me.optionImageSources)(e.image_url):[],H=q[0]??null,[N,ae]=(0,Te.useState)([]),O=q.find(P=>!N.includes(P))??null,[F,T]=(0,Te.useState)(null),Y=(0,Te.useMemo)(()=>!H&&m&&e.icon_svg?(0,me.sanitizeOptionIconSvg)(e.icon_svg):null,[H,m,e.icon_svg]),ie=k?(0,me.formatOptionCount)(e.item_count):null,ce=(0,Te.useRef)(void 0);(0,Te.useEffect)(()=>()=>clearTimeout(ce.current),[]);let ee=P=>{if(d||!e.is_tappable||x&&t===void 0)return;A(!0);let Q=P?.currentTarget;t!==void 0&&Q!==void 0&&P!==void 0&&!(0,me.isMultiSelectToggleTap)(Q,Q.querySelector("[data-aia-checkbox]"),P)?i(e,{commit:!0}):i(e),clearTimeout(ce.current),ce.current=setTimeout(()=>A(!1),170)},te=[se.item,a&&!d?se.highlighted:"",e.liveMatch&&!d?se.liveMatch:"",e.is_tappable?se.tappable:se.nonTappable,x?se.pressed:"",f?se.scrollHint:""].filter(Boolean).join(" ");return(0,he.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":d?"":void 0,"data-aia-icon":Y&&e.icon?e.icon:void 0,"data-aia-image":H?"":void 0,"data-aia-item-count":ie!==null?e.item_count:void 0,"aria-selected":t??a,className:te,style:{[me.OPTION_ENTER_DELAY_VAR]:`${u}ms`},tabIndex:d||!e.is_tappable?-1:0,onClick:ee,onKeyDown:P=>{!d&&e.is_tappable&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),ee())},onMouseEnter:!d&&e.is_tappable?o:void 0,onMouseLeave:s,children:(0,he.jsxs)("span",{className:se.content,children:[t!==void 0&&e.is_tappable&&(0,he.jsx)("span",{className:se.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),H&&(0,he.jsx)("span",{className:`${se.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":O!==null&&F===O?"":void 0,children:(0,he.jsx)("img",{src:O??H,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:O===null,onLoad:()=>T(O),onError:()=>{O!==null&&ae(P=>[...P,O])}})}),Y&&(0,he.jsx)("span",{className:`${se.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:Y}}),(0,he.jsxs)("span",{className:se.text,children:[e.matchedText?(0,me.highlightParts)((0,me.optionLabel)(e),e.matchedText).map((P,Q)=>P.bold?(0,he.jsx)("strong",{className:`${se.match} magicx-aia-option-match`,children:P.text},Q):P.text):(0,me.optionLabel)(e),e.parameterLabel&&(0,he.jsxs)(he.Fragment,{children:[" ",(0,he.jsx)("span",{className:`${se.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,he.jsx)("span",{className:se.tag,children:e.tag}),ie!==null&&(0,he.jsx)("span",{className:`${se.count} magicx-aia-option-count`,children:ie})]})})}var Mt=require("react/jsx-runtime");function Ka(){let[e,a]=(0,He.useState)(le.isOptionsGridMobileViewport);return(0,He.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(le.OPTIONS_GRID_MOBILE_QUERY),i=()=>a(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function ra({options:e,activeIndex:a,picked:t,onSelect:i,onHighlight:o,onUnhighlight:s,listboxId:r,loading:d,groupKey:m="",optionsPosition:v="below",showIcons:k=!0,showImages:f=!0,showCounts:p=!0}){let u=Ka(),x=(0,He.useRef)(null),[A,q]=(0,He.useState)(null),H=(0,He.useRef)(null);(0,He.useLayoutEffect)(()=>{if(d&&(0,le.sameOptionRows)(H.current,e))return;H.current=d?null:e;let O=x.current,T=O&&!d&&(0,le.needsOptionsGridMeasurement)(e.length,u)?(0,le.measureOptionsGrid)(O):null;q(T?(0,le.planOptionsGrid)(e.length,u,T.rowWidths,T.gridWidth):null)},[e,u,d]);let N=A??(0,le.planOptionsGrid)(e.length,u,null,null),ae=(0,le.optionsShowLeadingVisuals)(e,k,f);return(0,Mt.jsx)(ia,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:m,template:N.template,maxHeight:N.maxHeight,innerRef:O=>{x.current=O},"data-aia-group":m,children:e.map((O,F)=>(0,Mt.jsx)(na,{option:O,isHighlighted:F===a,checked:t?t.includes(O.text):void 0,onSelect:i,onHighlight:()=>o(F),onUnhighlight:s?()=>s(F):void 0,id:`${r}-option-${F}`,loading:d,showIcon:k&&ae,showImage:f&&ae,showCount:p,scrollHint:!d&&N.scrollHintIndices.includes(F),enterDelayMs:d?0:(0,le.optionEnterDelayMs)(F,N.cols,e.length,v)},`${m}\0${O.text}`))})}var ue=require("@magicx-eng/ai-autocomplete-vanilla"),Ie=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) ---
3358
+ `,document.head.appendChild(e)}var le={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg"};var he=require("react/jsx-runtime");function na({option:e,isHighlighted:a,checked:t,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:d,showIcon:m=!0,showImage:v=!0,showCount:C=!0,scrollHint:g,enterDelayMs:p=0}){let[u]=(0,Ie.useState)(p),[x,A]=(0,Ie.useState)(!1),V=v?(0,me.optionImageSources)(e.image_url):[],H=V[0]??null,[N,de]=(0,Ie.useState)([]),P=V.find(L=>!N.includes(L))??null,[G,K]=(0,Ie.useState)(null),S=(0,Ie.useMemo)(()=>!H&&m&&e.icon_svg?(0,me.sanitizeOptionIconSvg)(e.icon_svg):null,[H,m,e.icon_svg]),ae=C?(0,me.formatOptionCount)(e.item_count):null,ce=(0,Ie.useRef)(void 0);(0,Ie.useEffect)(()=>()=>clearTimeout(ce.current),[]);let ie=L=>{if(d||!e.is_tappable||x&&t===void 0)return;A(!0);let F=L?.currentTarget;t!==void 0&&F!==void 0&&L!==void 0&&!(0,me.isMultiSelectToggleTap)(F,F.querySelector("[data-aia-checkbox]"),L)?i(e,{commit:!0}):i(e),clearTimeout(ce.current),ce.current=setTimeout(()=>A(!1),170)},oe=[le.item,a&&!d?le.highlighted:"",e.liveMatch&&!d?le.liveMatch:"",e.is_tappable?le.tappable:le.nonTappable,x?le.pressed:"",g?le.scrollHint:""].filter(Boolean).join(" ");return(0,he.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":d?"":void 0,"data-aia-icon":S&&e.icon?e.icon:void 0,"data-aia-image":H?"":void 0,"data-aia-item-count":ae!==null?e.item_count:void 0,"aria-selected":t??a,className:oe,style:{[me.OPTION_ENTER_DELAY_VAR]:`${u}ms`},tabIndex:d||!e.is_tappable?-1:0,onClick:ie,onKeyDown:L=>{!d&&e.is_tappable&&(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),ie())},onMouseEnter:!d&&e.is_tappable?o:void 0,onMouseLeave:s,children:(0,he.jsxs)("span",{className:le.content,children:[t!==void 0&&e.is_tappable&&(0,he.jsx)("span",{className:le.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),H&&(0,he.jsx)("span",{className:`${le.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":P!==null&&G===P?"":void 0,children:(0,he.jsx)("img",{src:P??H,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:P===null,onLoad:()=>K(P),onError:()=>{P!==null&&de(L=>[...L,P])}})}),S&&(0,he.jsx)("span",{className:`${le.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:S}}),(0,he.jsxs)("span",{className:le.text,children:[e.matchedText?(0,me.highlightParts)((0,me.optionLabel)(e),e.matchedText).map((L,F)=>L.bold?(0,he.jsx)("strong",{className:`${le.match} magicx-aia-option-match`,children:L.text},F):L.text):(0,me.optionLabel)(e),e.parameterLabel&&(0,he.jsxs)(he.Fragment,{children:[" ",(0,he.jsx)("span",{className:`${le.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,he.jsx)("span",{className:le.tag,children:e.tag}),ae!==null&&(0,he.jsx)("span",{className:`${le.count} magicx-aia-option-count`,children:ae})]})})}var Mt=require("react/jsx-runtime");function Ka(){let[e,a]=(0,Ee.useState)(U.isOptionsGridMobileViewport);return(0,Ee.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(U.OPTIONS_GRID_MOBILE_QUERY),i=()=>a(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function ra({options:e,activeIndex:a,picked:t,onSelect:i,onHighlight:o,onUnhighlight:s,listboxId:r,loading:d,groupKey:m="",optionsPosition:v="below",showIcons:C=!0,showImages:g=!0,showCounts:p=!0}){let u=Ka(),x=(0,Ee.useRef)(null),[A,V]=(0,Ee.useState)(null),H=(0,Ee.useRef)(null);(0,Ee.useLayoutEffect)(()=>{if(d&&(0,U.sameOptionRows)(H.current,e))return;H.current=d?null:e;let P=x.current,G=P&&!d&&(0,U.needsOptionsGridMeasurement)(e.length,u),K=P?.closest("[data-aia-dropdown]");G&&K&&(0,U.releasePanelHug)(K);let S=G?(0,U.measureOptionsGrid)(P):null;V(S?(0,U.planOptionsGrid)(e.length,u,S.rowWidths,S.gridWidth):null)},[e,u,d]);let N=A??(0,U.planOptionsGrid)(e.length,u,null,null);(0,Ee.useLayoutEffect)(()=>{let P=x.current?.closest("[data-aia-dropdown]");P&&(0,U.syncPanelHug)(P)},[N.template,u]);let de=(0,U.optionsShowLeadingVisuals)(e,C,g);return(0,Mt.jsx)(ia,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:m,template:N.template,maxHeight:N.maxHeight,innerRef:P=>{x.current=P},"data-aia-group":m,children:e.map((P,G)=>(0,Mt.jsx)(na,{option:P,isHighlighted:G===a,checked:t?t.includes(P.text):void 0,onSelect:i,onHighlight:()=>o(G),onUnhighlight:s?()=>s(G):void 0,id:`${r}-option-${G}`,loading:d,showIcon:C&&de,showImage:g&&de,showCount:p,scrollHint:!d&&N.scrollHintIndices.includes(G),enterDelayMs:d?0:(0,U.optionEnterDelayMs)(G,N.cols,e.length,v)},`${m}\0${P.text}`))})}var ue=require("@magicx-eng/ai-autocomplete-vanilla"),Re=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
3425
3359
 
3426
3360
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
3427
3361
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -3543,7 +3477,7 @@
3543
3477
  .aia-done-llNY5:hover {
3544
3478
  background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
3545
3479
  }
3546
- `,document.head.appendChild(e)}var Pe={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};var ye=require("react/jsx-runtime"),qa=120;function sa({view:e,label:a,doneLabel:t,interactive:i=!0,onTimeChange:o,onTimeCommit:s}){return(0,ye.jsxs)("div",{className:Pe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":a,onMouseDown:r=>r.preventDefault(),children:[(0,ye.jsx)("span",{className:Pe.value,"data-aia-time-value":"","aria-live":"polite",children:(0,ue.formatTime)(e.minutes)}),(0,ye.jsxs)("div",{className:Pe.columns,"aria-hidden":"true",children:[(0,ye.jsx)("div",{className:Pe.band}),ue.TIME_WHEEL_COLUMNS.map(r=>(0,ye.jsxs)(Ie.Fragment,{children:[r==="minute"&&(0,ye.jsx)("span",{className:Pe.separator,children:":"}),(0,ye.jsx)(_a,{column:r,minutes:e.minutes,interactive:i,onTimeChange:o})]},r))]}),(0,ye.jsx)("button",{type:"button",tabIndex:-1,className:Pe.done,"data-aia-time-done":"",onClick:()=>{i&&s()},children:t})]})}function _a({column:e,minutes:a,interactive:t,onTimeChange:i}){let o=(0,Ie.useRef)(null),s=(0,Ie.useRef)(null),r=(0,Ie.useRef)(null),d=(0,Ie.useRef)({minutes:a,interactive:t,onTimeChange:i});d.current={minutes:a,interactive:t,onTimeChange:i};let m=(0,ue.timeWheelIndex)(e,a);(0,Ie.useLayoutEffect)(()=>{let f=o.current;if(!f||r.current)return;let p=m*ue.TIME_WHEEL_ROW_HEIGHT;Math.abs(f.scrollTop-p)<1||(s.current=p,f.scrollTop=p)},[m]),(0,Ie.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let f=o.current,p=d.current;if(!f||!p.interactive)return;let u=(0,ue.timeWheelIndexFromScroll)(e,f.scrollTop);u!==(0,ue.timeWheelIndex)(e,p.minutes)&&p.onTimeChange((0,ue.withTimeWheelIndex)(e,p.minutes,u))},k=()=>{let f=o.current;if(f){if(s.current!=null&&Math.abs(f.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,qa)}};return(0,ye.jsx)("div",{ref:o,className:Pe.column,"data-aia-time-column":e,onScroll:k,children:(0,ue.timeWheelRows)(e).map((f,p)=>(0,ye.jsx)("div",{className:p===m?`${Pe.row} ${Pe.selected}`:Pe.row,"data-aia-time-row":"","data-aia-index":p,onClick:()=>{d.current.interactive&&i((0,ue.withTimeWheelIndex)(e,d.current.minutes,p))},children:f.label},f.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3480
+ `,document.head.appendChild(e)}var Ae={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};var ke=require("react/jsx-runtime"),qa=120;function sa({view:e,label:a,doneLabel:t,interactive:i=!0,onTimeChange:o,onTimeCommit:s}){return(0,ke.jsxs)("div",{className:Ae.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":a,onMouseDown:r=>r.preventDefault(),children:[(0,ke.jsx)("span",{className:Ae.value,"data-aia-time-value":"","aria-live":"polite",children:(0,ue.formatTime)(e.minutes)}),(0,ke.jsxs)("div",{className:Ae.columns,"aria-hidden":"true",children:[(0,ke.jsx)("div",{className:Ae.band}),ue.TIME_WHEEL_COLUMNS.map(r=>(0,ke.jsxs)(Re.Fragment,{children:[r==="minute"&&(0,ke.jsx)("span",{className:Ae.separator,children:":"}),(0,ke.jsx)(_a,{column:r,minutes:e.minutes,interactive:i,onTimeChange:o})]},r))]}),(0,ke.jsx)("button",{type:"button",tabIndex:-1,className:Ae.done,"data-aia-time-done":"",onClick:()=>{i&&s()},children:t})]})}function _a({column:e,minutes:a,interactive:t,onTimeChange:i}){let o=(0,Re.useRef)(null),s=(0,Re.useRef)(null),r=(0,Re.useRef)(null),d=(0,Re.useRef)({minutes:a,interactive:t,onTimeChange:i});d.current={minutes:a,interactive:t,onTimeChange:i};let m=(0,ue.timeWheelIndex)(e,a);(0,Re.useLayoutEffect)(()=>{let g=o.current;if(!g||r.current)return;let p=m*ue.TIME_WHEEL_ROW_HEIGHT;Math.abs(g.scrollTop-p)<1||(s.current=p,g.scrollTop=p)},[m]),(0,Re.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let g=o.current,p=d.current;if(!g||!p.interactive)return;let u=(0,ue.timeWheelIndexFromScroll)(e,g.scrollTop);u!==(0,ue.timeWheelIndex)(e,p.minutes)&&p.onTimeChange((0,ue.withTimeWheelIndex)(e,p.minutes,u))},C=()=>{let g=o.current;if(g){if(s.current!=null&&Math.abs(g.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,qa)}};return(0,ke.jsx)("div",{ref:o,className:Ae.column,"data-aia-time-column":e,onScroll:C,children:(0,ue.timeWheelRows)(e).map((g,p)=>(0,ke.jsx)("div",{className:p===m?`${Ae.row} ${Ae.selected}`:Ae.row,"data-aia-time-row":"","data-aia-index":p,onClick:()=>{d.current.interactive&&i((0,ue.withTimeWheelIndex)(e,d.current.minutes,p))},children:g.label},g.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3547
3481
  display: flex;
3548
3482
  flex-direction: column;
3549
3483
  gap: var(--aia-stack-space, 0.5rem);
@@ -3558,7 +3492,7 @@
3558
3492
  align-items: end;
3559
3493
  }
3560
3494
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
3561
- `,document.head.appendChild(e)}var da=require("react/jsx-runtime");function la({space:e,align:a="stretch",className:t,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return(0,da.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:s,...o,children:i})}var _=require("react/jsx-runtime"),Va=typeof window>"u"?V.useEffect:V.useLayoutEffect,Ua=[159,119,164],Ya=()=>{},ca=()=>{},Qa=e=>{},ja=()=>{},$a=e=>{},Za=e=>{},Xa=e=>{},Ja=e=>{};function ei(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=(0,V.useState)(a);if((0,V.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>i(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ti(e,a){let t=(0,V.useRef)(null);(0,V.useEffect)(()=>{let i=e.current,o=a.current;if(!i||!o)return;let s=(0,D.queryLive)(i,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==s&&(t.current.controller.destroy(),t.current=null),s&&!t.current){t.current={grid:s,controller:(0,D.attachScrollArrow)({dropdown:i,grid:s,button:o})};return}t.current?.controller.update()}),(0,V.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function ai(e,a){let t=(0,V.useRef)(a);t.current=a;let i=(0,V.useRef)(null);(0,V.useLayoutEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,D.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),(0,V.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function Tt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:d,pills:m,onPillClick:v,showPills:k=!0,onSkip:f,showSkipButton:p=!0,showOptionIcons:u=!0,showOptionImages:x=!0,showOptionCounts:A=!0,skipDisabled:q=!1,activeSelected:H=!1,isLoading:N=!1,skeletonExiting:ae=!1,isInputEmpty:O=!1,language:F,products:T,onProductSelect:Y,onProductAddToCart:ie,onProductFocusChange:ce,productsLayout:ee="row",productImageFallback:te="image",formatType:P="options",dateView:Q=null,selectedDateIso:Ae=null,selectedDateRange:ke=null,dateRangeStart:ve=null,onPreviousMonth:c,onNextMonth:E,timeView:Ge=null,multiSelectView:b=null,onMultiSelectCommit:at,onTimeChange:Ve,onTimeCommit:Ue,locationView:w=null,isReediting:S=!1,onLocationQuery:I,onLocationMove:L,onLocationCommit:z,onLocationFocusChange:oe,isFocused:Re=!1,optionsPosition:ge="below",mode:Oe}){let Ye=ei(Oe),st=Ye!==void 0,j=(0,V.useRef)(null),Qe=(0,V.useRef)(null);ti(j,Qe),(0,V.useEffect)(()=>{if(j.current)return(0,D.containScroll)(j.current)},[]);let pt=e[0]?.options??[],it=!!(m&&m.length>0&&v),We=!!(T&&T.length>0),ht=P==="time"&&Ge!=null,je=P==="location"&&w!=null,pe=s&&(pt.length>0||k&&it||N||We||ht||je);ai(j,pe),Va(()=>{let C=j.current;C&&(0,D.fitMultiSelectDone)(C,(0,D.findMultiSelectDone)(C))});let Ce={suggestions:e,activeIndex:a,pills:m,showPills:k,showSkipButton:p,showOptionIcons:u,showOptionImages:x,showOptionCounts:A,skipDisabled:q,activeSelected:H,isLoading:N,skeletonExiting:ae,isInputEmpty:O,products:T,formatType:P,dateView:Q,selectedDateIso:Ae,selectedDateRange:ke,dateRangeStart:ve,timeView:Ge,multiSelectView:b,locationView:w,isReediting:S},y=(0,V.useRef)(Ce);pe&&(y.current=Ce);let n=pe?Ce:y.current,re=(0,D.uiStringsFor)(F),Le=n.suggestions[0],g=Le?.options??[],$e=n.activeIndex>=0&&!!g[n.activeIndex]?.is_tappable,Ke=(0,D.labelTraditionalAutocomplete)(n.pills??[],re.keepTyping),ze=!!(Ke.length>0&&v),ot=n.showPills&&ze,ut=n.showPills&&!ze&&n.isLoading,qe=ot||ut,lt=ze&&(0,D.hasSkippablePill)(Ke)&&n.showSkipButton&&!n.isInputEmpty&&!!f,Se=Ke[0]?.text,De=(0,D.isCalendarFormat)(n.formatType)&&n.dateView!=null,Ze=g.length>0&&!De,nt=g.length>0&&De&&!n.isLoading,dt=n.formatType==="time"&&n.timeView!=null&&!n.isLoading,Xe=n.formatType==="location"&&n.locationView!=null&&!n.isLoading,ct=n.isLoading&&!Ze&&!nt&&!dt&&!Xe,h=n.products??[],K=(0,D.panelMorphKey)(ot?Ke:[]);return(0,V.useLayoutEffect)(()=>{j.current&&(0,D.settlePanelMorph)(j.current,K,{visible:pe,anchorBottom:ge==="above"})},[K,pe,ge,n.suggestions,n.pills,n.isLoading,n.skeletonExiting,n.isInputEmpty,n.products,n.formatType,n.dateView,n.selectedDateIso,n.selectedDateRange,n.dateRangeStart,n.timeView,n.multiSelectView,n.locationView,n.showPills,n.showSkipButton,n.showOptionIcons,n.showOptionImages,n.showOptionCounts,ee,F]),(0,V.useEffect)(()=>{let C=j.current;return()=>{C&&(0,D.destroyPanelMorph)(C)}},[]),(0,_.jsxs)("div",{ref:j,id:r,role:"listbox","aria-multiselectable":!!n.multiSelectView,"data-aia-dropdown":"","data-options-position":ge,"data-mode":Ye,"data-aia-loading":n.isLoading?"":void 0,"data-aia-skeleton-exiting":n.skeletonExiting?"":void 0,"data-aia-has-products":h.length>0?"":void 0,className:`${st?"magicx-aia ":""}${Me.dropdown} ${pe?Me.visible:""} ${d??""}`,onMouseDown:C=>C.preventDefault(),children:[(0,_.jsxs)(la,{space:"8px",children:[(qe||lt)&&(0,_.jsxs)(ft,{noWrap:!0,className:Me.pillBar,"data-aia-pillbar":"",children:[qe&&(0,_.jsx)("span",{className:Me.pillScroll,"data-aia-pill-scroll":"",children:(0,_.jsx)(Ct,{pills:Ke,activePillIndex:0,activeSelected:n.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:n.isLoading})}),lt&&(0,_.jsx)("button",{type:"button",tabIndex:-1,className:Me.skip,"data-aia-skip":"",disabled:n.isLoading||n.skipDisabled,"aria-label":Se?`${re.skipLabel} ${Se}`:re.skipLabel,onClick:f,children:re.skip})]}),Ze&&(0,_.jsx)(ra,{options:g,activeIndex:n.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:n.isLoading,groupKey:Le?`${Le.parameter} ${Le.text}`:"",optionsPosition:ge,showIcons:n.showOptionIcons,showImages:n.showOptionImages,showCounts:n.showOptionCounts,picked:n.isLoading?void 0:n.multiSelectView?.picked}),n.multiSelectView&&!n.isLoading&&(0,_.jsx)("div",{onClick:C=>{C.target.closest("[data-aia-multi-done]")&&!n.skipDisabled&&at?.()},children:(0,_.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Me.multiDone,ref:C=>{C&&(C.disabled=!0,C.offsetHeight,C.disabled=n.skipDisabled)},children:re.done})}),nt&&n.dateView&&(0,_.jsx)(Ut,{options:g,activeIndex:n.activeIndex,listboxId:r,view:n.dateView,selection:{selectedIso:n.selectedDateIso??null,selectedRange:n.selectedDateRange??null,rangeStart:n.dateRangeStart??null,floor:(0,D.dateFloorFor)(n.formatType,n.dateRangeStart)},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:c??ca,onNextMonth:E??ca}),dt&&n.timeView&&(0,_.jsx)(sa,{view:n.timeView,label:re.timeLabel,doneLabel:re.done,interactive:!n.skipDisabled,onTimeChange:Ve??Qa,onTimeCommit:Ue??ja}),Xe&&n.locationView&&(0,_.jsx)(Zt,{view:n.locationView,searchLabel:re.locationSearch,noResultsLabel:re.locationNoResults,useTypedLabel:re.locationUseTyped,widgetFocused:Re&&pe,reediting:n.isReediting,visible:pe,interactive:!n.skipDisabled,onQuery:I??$a,onMove:L??Za,onCommit:z??Xa,onFocusChange:oe??Ja}),ct&&(0,_.jsx)("div",{className:Me.skeletonBars,"data-aia-skeleton-bars":"",children:Ua.map(C=>(0,_.jsx)("span",{className:Me.skeletonBar,style:{width:C}},`bar-${C}`))}),(0,_.jsx)(ta,{products:h,listboxId:r,onSelect:Y??Ya,onAddToCart:ie,onFocusChange:ce,focusable:pe,layout:ee,imageFallback:te,strings:re}),(0,_.jsx)(Yt,{isOptionHighlighted:$e,isInputEmpty:n.isInputEmpty,strings:re})]}),(0,_.jsx)("button",{ref:Qe,type:"button",tabIndex:-1,className:Me.scrollArrow,"data-aia-scroll-arrow":"","aria-label":re.scrollArrow,"aria-hidden":"true",children:(0,_.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,_.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Be=require("@magicx-eng/ai-autocomplete-vanilla");var ha=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
3495
+ `,document.head.appendChild(e)}var da=require("react/jsx-runtime");function la({space:e,align:a="stretch",className:t,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return(0,da.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:s,...o,children:i})}var Y=require("react/jsx-runtime"),Va=typeof window>"u"?Q.useEffect:Q.useLayoutEffect,Ua=[159,119,164],Ya=()=>{},ca=()=>{},Qa=e=>{},ja=()=>{},$a=e=>{},Za=e=>{},Xa=e=>{},Ja=e=>{};function ei(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=(0,Q.useState)(a);if((0,Q.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>i(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ti(e,a){let t=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let i=e.current,o=a.current;if(!i||!o)return;let s=(0,z.queryLive)(i,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==s&&(t.current.controller.destroy(),t.current=null),s&&!t.current){t.current={grid:s,controller:(0,z.attachScrollArrow)({dropdown:i,grid:s,button:o})};return}t.current?.controller.update()}),(0,Q.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function ai(e,a){let t=(0,Q.useRef)(a);t.current=a;let i=(0,Q.useRef)(null);(0,Q.useLayoutEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,z.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),(0,Q.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function Tt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:d,pills:m,onPillClick:v,showPills:C=!0,onSkip:g,showSkipButton:p=!0,showOptionIcons:u=!0,showOptionImages:x=!0,showOptionCounts:A=!0,skipDisabled:V=!1,activeSelected:H=!1,isLoading:N=!1,skeletonExiting:de=!1,isInputEmpty:P=!1,language:G,products:K,onProductSelect:S,onProductAddToCart:ae,onProductFocusChange:ce,productsLayout:ie="row",productImageFallback:oe="image",formatType:L="options",dateView:F=null,selectedDateIso:Le=null,selectedDateRange:Ce=null,dateRangeStart:ve=null,onPreviousMonth:c,onNextMonth:E,timeView:Ge=null,multiSelectView:w=null,onMultiSelectCommit:at,onTimeChange:Ue,onTimeCommit:Ye,locationView:Ke=null,isReediting:f=!1,onLocationQuery:T,onLocationMove:I,onLocationCommit:O,onLocationFocusChange:M,isFocused:re=!1,optionsPosition:ge="below",mode:xe}){let ze=ei(xe),st=ze!==void 0,Z=(0,Q.useRef)(null),Qe=(0,Q.useRef)(null);ti(Z,Qe),(0,Q.useEffect)(()=>{if(Z.current)return(0,z.containScroll)(Z.current)},[]);let pt=e[0]?.options??[],it=!!(m&&m.length>0&&v),De=!!(K&&K.length>0),ht=L==="time"&&Ge!=null,je=L==="location"&&Ke!=null,pe=s&&(pt.length>0||C&&it||N||De||ht||je);ai(Z,pe),Va(()=>{let k=Z.current;k&&((0,z.fitMultiSelectDone)(k,(0,z.findMultiSelectDone)(k)),(0,z.syncPanelHug)(k))});let Se={suggestions:e,activeIndex:a,pills:m,showPills:C,showSkipButton:p,showOptionIcons:u,showOptionImages:x,showOptionCounts:A,skipDisabled:V,activeSelected:H,isLoading:N,skeletonExiting:de,isInputEmpty:P,products:K,formatType:L,dateView:F,selectedDateIso:Le,selectedDateRange:Ce,dateRangeStart:ve,timeView:Ge,multiSelectView:w,locationView:Ke,isReediting:f},y=(0,Q.useRef)(Se);pe&&(y.current=Se);let n=pe?Se:y.current,se=(0,z.uiStringsFor)(G),Me=n.suggestions[0],b=Me?.options??[],$e=n.activeIndex>=0&&!!b[n.activeIndex]?.is_tappable,qe=(0,z.labelTraditionalAutocomplete)(n.pills??[],se.keepTyping),Te=!!(qe.length>0&&v),ot=n.showPills&&Te,ut=n.showPills&&!Te&&n.isLoading,_e=ot||ut,lt=Te&&(0,z.hasSkippablePill)(qe)&&n.showSkipButton&&!n.isInputEmpty&&!!g,Pe=qe[0]?.text,Ne=(0,z.isCalendarFormat)(n.formatType)&&n.dateView!=null,Ze=b.length>0&&!Ne,nt=b.length>0&&Ne&&!n.isLoading,dt=n.formatType==="time"&&n.timeView!=null&&!n.isLoading,Xe=n.formatType==="location"&&n.locationView!=null&&!n.isLoading,ct=n.isLoading&&!Ze&&!nt&&!dt&&!Xe,h=n.products??[],_=(0,z.panelMorphKey)(ot?qe:[]);return(0,Q.useLayoutEffect)(()=>{Z.current&&(0,z.settlePanelMorph)(Z.current,_,{visible:pe,anchorBottom:ge==="above"})},[_,pe,ge,n.suggestions,n.pills,n.isLoading,n.skeletonExiting,n.isInputEmpty,n.products,n.formatType,n.dateView,n.selectedDateIso,n.selectedDateRange,n.dateRangeStart,n.timeView,n.multiSelectView,n.locationView,n.showPills,n.showSkipButton,n.showOptionIcons,n.showOptionImages,n.showOptionCounts,ie,G]),(0,Q.useEffect)(()=>{let k=Z.current;return()=>{k&&(0,z.destroyPanelMorph)(k)}},[]),(0,Y.jsxs)("div",{ref:Z,id:r,role:"listbox","aria-multiselectable":!!n.multiSelectView,"data-aia-dropdown":"","data-options-position":ge,"data-mode":ze,"data-aia-loading":n.isLoading?"":void 0,"data-aia-skeleton-exiting":n.skeletonExiting?"":void 0,"data-aia-has-products":h.length>0?"":void 0,className:`${st?"magicx-aia ":""}${He.dropdown} ${pe?He.visible:""} ${d??""}`,onMouseDown:k=>k.preventDefault(),children:[(0,Y.jsxs)(la,{space:"8px",children:[(_e||lt)&&(0,Y.jsxs)(ft,{noWrap:!0,className:He.pillBar,"data-aia-pillbar":"",children:[_e&&(0,Y.jsx)("span",{className:He.pillScroll,"data-aia-pill-scroll":"",children:(0,Y.jsx)(Ct,{pills:qe,activePillIndex:0,activeSelected:n.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:n.isLoading})}),lt&&(0,Y.jsx)("button",{type:"button",tabIndex:-1,className:He.skip,"data-aia-skip":"",disabled:n.isLoading||n.skipDisabled,"aria-label":Pe?`${se.skipLabel} ${Pe}`:se.skipLabel,onClick:g,children:se.skip})]}),Ze&&(0,Y.jsx)(ra,{options:b,activeIndex:n.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:n.isLoading,groupKey:Me?`${Me.parameter} ${Me.text}`:"",optionsPosition:ge,showIcons:n.showOptionIcons,showImages:n.showOptionImages,showCounts:n.showOptionCounts,picked:n.isLoading?void 0:n.multiSelectView?.picked}),n.multiSelectView&&!n.isLoading&&(0,Y.jsx)("div",{"data-aia-multi-actions":"",onClick:k=>{k.target.closest("[data-aia-multi-done]")&&!n.skipDisabled&&at?.()},children:(0,Y.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:He.multiDone,ref:k=>{k&&(k.disabled=!0,k.offsetHeight,k.disabled=n.skipDisabled)},children:se.done})}),nt&&n.dateView&&(0,Y.jsx)(Ut,{options:b,activeIndex:n.activeIndex,listboxId:r,view:n.dateView,selection:{selectedIso:n.selectedDateIso??null,selectedRange:n.selectedDateRange??null,rangeStart:n.dateRangeStart??null,floor:(0,z.dateFloorFor)(n.formatType,n.dateRangeStart)},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:c??ca,onNextMonth:E??ca}),dt&&n.timeView&&(0,Y.jsx)(sa,{view:n.timeView,label:se.timeLabel,doneLabel:se.done,interactive:!n.skipDisabled,onTimeChange:Ue??Qa,onTimeCommit:Ye??ja}),Xe&&n.locationView&&(0,Y.jsx)(Zt,{view:n.locationView,searchLabel:se.locationSearch,noResultsLabel:se.locationNoResults,useTypedLabel:se.locationUseTyped,widgetFocused:re&&pe,reediting:n.isReediting,visible:pe,interactive:!n.skipDisabled,onQuery:T??$a,onMove:I??Za,onCommit:O??Xa,onFocusChange:M??Ja}),ct&&(0,Y.jsx)("div",{className:He.skeletonBars,"data-aia-skeleton-bars":"",children:Ua.map(k=>(0,Y.jsx)("span",{className:He.skeletonBar,style:{width:k}},`bar-${k}`))}),(0,Y.jsx)(ta,{products:h,listboxId:r,onSelect:S??Ya,onAddToCart:ae,onFocusChange:ce,focusable:pe,layout:ie,imageFallback:oe,strings:se}),(0,Y.jsx)(Yt,{isOptionHighlighted:$e,isInputEmpty:n.isInputEmpty,strings:se})]}),(0,Y.jsx)("button",{ref:Qe,type:"button",tabIndex:-1,className:He.scrollArrow,"data-aia-scroll-arrow":"","aria-label":se.scrollArrow,"aria-hidden":"true",children:(0,Y.jsx)("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,Y.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var We=require("@magicx-eng/ai-autocomplete-vanilla");var ha=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
3562
3496
  flex-shrink: 0;
3563
3497
  width: 32px;
3564
3498
  height: 32px;
@@ -3629,5 +3563,5 @@
3629
3563
  transition: none;
3630
3564
  }
3631
3565
  }
3632
- `,document.head.appendChild(e)}var pa={submitButton:"aia-submitButton-otz7H"};var Pt=require("react/jsx-runtime");function ua({disabled:e,ready:a,onClick:t,label:i=(0,ha.uiStringsFor)().submit}){return(0,Pt.jsx)("button",{type:"button","data-aia-submit":"",className:pa.submitButton,disabled:e,"data-aia-ready":a?"":void 0,onClick:o=>{o.stopPropagation(),t()},"aria-label":i,children:(0,Pt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Pt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var tt=require("@magicx-eng/ai-autocomplete-vanilla"),R=require("react");var Nt=require("react");function ma(e){let a=(0,Nt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,Nt.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(d,m,v)=>{let k=a.current?.[s];return k?k(d,m,v):[]};o[s]=r}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}var Ft=require("react");function ga(e){let a=(0,Ft.useRef)(e);a.current=e;let t=(0,Ft.useRef)(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=a.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var fa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateFloor:null,timeView:null,multiSelectView:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function It({onSubmit:e,onResult:a,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,visitorId:k,columns:f=2,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:q,locationSearch:H,showOptionIcons:N,showOptionImages:ae,showOptionCounts:O,showSkipButton:F,showProducts:T,productImageFallback:Y="image",onFocus:ie,onBlur:ce,value:ee,completedParams:te,onChange:P,onParamsChange:Q,products:Ae,mapProducts:ke,onProductSelect:ve,onProductAddToCart:c,source:E,setCursor:Ge}){let b=(0,R.useRef)(null),[at,Ve]=(0,R.useState)(null),Ue=(0,R.useRef)(e);Ue.current=e;let w=(0,R.useRef)(a);w.current=a;let S=(0,R.useRef)(t);S.current=t;let I=(0,R.useRef)(P);I.current=P;let L=(0,R.useRef)(Q);L.current=Q;let z=(0,R.useRef)(ie);z.current=ie;let oe=(0,R.useRef)(ce);oe.current=ce;let Re=(0,R.useRef)(Ge);Re.current=Ge;let ge=(0,R.useRef)(ve);ge.current=ve;let Oe=(0,R.useRef)(c);Oe.current=c;let Ye=(0,R.useRef)(k);Ye.current=k;let st=(0,R.useRef)(()=>{let h=Ye.current;return typeof h=="function"?h():h}).current,j=ga(Ae),Qe=(0,R.useRef)(ke);Qe.current=ke;let pt=(0,R.useRef)((h,K)=>{let C=Qe.current;return C?C(h,K):h}).current,it=ke?pt:void 0,We=ma(i);(0,R.useEffect)(()=>{if(typeof document>"u")return;let h=new tt.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,visitorId:st,optionOverrides:We.overrides,maskCompletedText:o,columns:f,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:q,locationSearch:H,showProducts:T,source:E,value:ee,completedParams:te,onSubmit:(...C)=>Ue.current?.(...C),onResult:(...C)=>w.current?.(...C),onError:(...C)=>S.current?.(...C),onChange:(...C)=>I.current?.(...C),onParamsChange:(...C)=>L.current?.(...C),onFocus:()=>z.current?.(),onBlur:()=>oe.current?.(),onProductSelect:C=>ge.current?.(C),onProductAddToCart:C=>Oe.current?.(C),setCursor:C=>Re.current?.(C),products:j.config,mapProducts:it});b.current=h,Ve(h.getState());let K=h.subscribe(C=>Ve(C));return()=>{K(),h.destroy(),b.current===h&&(b.current=null)}},[]),(0,R.useEffect)(()=>{ee!==void 0&&b.current?.setValue(ee)},[ee]),(0,R.useEffect)(()=>{te!==void 0&&b.current?.setCompletedParams(te)},[te]);let ht=JSON.stringify(s??null),je;try{je=JSON.stringify(r??null)}catch{je="[unstringifiable]"}(0,R.useEffect)(()=>{b.current?.update({apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,optionOverrides:We.overrides,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:q,locationSearch:H,showProducts:T})},[ht,je,d,m?.code,m?.rate,m?.country,v,We.key,p,u,x,A,q,H,T]);let pe=(0,R.useRef)(!1);(0,R.useEffect)(()=>{if(!pe.current){pe.current=!0;return}b.current?.update({products:j.config})},[j.enabled]),(0,R.useEffect)(()=>{b.current?.update({mapProducts:it})},[it]);let Ce=(0,R.useRef)(null);Ce.current===null&&(Ce.current={handleTextChange:h=>b.current?.handleTextChange(h),handleKeyDown:h=>{let K="nativeEvent"in h?h.nativeEvent:h;b.current?.handleKeyDown(K)},setFocused:h=>b.current?.setFocused(h),startEditingParam:h=>b.current?.startEditingParam(h),exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:h=>b.current?.handleCaretAfterInput(h),handleCaretMove:h=>b.current?.handleCaretMove(h),replaceEditingRange:h=>b.current?.replaceEditingRange(h)??!1,setActivePill:h=>b.current?.setActivePill(h),skipActivePill:()=>b.current?.skipActivePill(),removeLastParam:()=>b.current?.removeLastParam(),clearNewParamId:()=>b.current?.clearNewParamId(),reset:()=>b.current?.reset(),refreshProducts:()=>b.current?.refreshProducts(),prepareSubmit:()=>b.current?.prepareSubmit(),getState:()=>b.current?.getState()??fa,recordSubmit:h=>b.current?.recordSubmit(h),selectOption:(h,K)=>b.current?.selectOption(h,K),selectProduct:h=>b.current?.selectProduct(h),addProductToCart:h=>{let K=b.current;return!K||!Oe.current?Promise.resolve():K.addProductToCart(h)},setActiveDropdownIndex:h=>b.current?.setActiveDropdownIndex(h),clearHighlight:h=>b.current?.clearHighlight(h),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:h=>b.current?.setTime(h),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:h=>b.current?.toggleMultiSelectOption(h),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:h=>b.current?.setLocationQuery(h),moveLocationHighlight:h=>b.current?.moveLocationHighlight(h),commitLocation:h=>b.current?.commitLocation(h),setLocationFieldFocused:h=>b.current?.setLocationFieldFocused(h),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let y=Ce.current,n=(0,R.useCallback)(h=>{let K=h.target.value,vt=K.length>0&&!h.nativeEvent?.isComposing&&K[0]!==K[0].toUpperCase()?K[0].toUpperCase()+K.slice(1):K;b.current?.handleTextChange(vt)},[]),re=(0,R.useCallback)(h=>{b.current?.handleKeyDown(h.nativeEvent)},[]),Le=b.current,g=at??fa,$e=ee!==void 0?ee:g.text,Ke=te!==void 0?te:g.completedParams,ze=g.actionableSuggestions,ot=ze[0],ut=(0,tt.withoutTraditionalAutocomplete)(ze),qe=Le?.listboxId??"",lt=g.activeDropdownIndex>=0&&Le?`${qe}-option-${g.activeDropdownIndex}`:void 0,Se=g.editingParam,De=g.editingIdentified,Ze=Se?{parameter:Se.suggestionParameter,text:Se.suggestionPlaceholder,required:!0,options:Se.options}:De?{parameter:De.parameter,text:(0,tt.identifiedParamLabel)(De.parameter),required:!0,options:[]}:null,nt=g.dropdownSuggestion??Ze??ot,dt=Ze?[Ze]:ze,Xe=(0,tt.dateSelectionFor)(g),ct=!Le||g.dropdownLoading;return{completedParams:Ke,multiSelectView:g.multiSelectView,toggleMultiSelectOption:y.toggleMultiSelectOption,commitMultiSelect:y.commitMultiSelect,skippedParams:g.skippedParams,identifiedParams:g.identifiedParams,suggestionPills:ut,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:g.segments,newParamId:g.newParamId,clearNewParamId:y.clearNewParamId,suggestions:g.suggestions,activeIndex:g.activeDropdownIndex,isReady:g.isReady,isLoading:ct,isFocused:g.isFocused,isDropdownOpen:g.isDropdownOpen,isActivePillSelected:g.isActivePillSelected,placeholderText:g.placeholderText,listboxId:qe,error:g.error,products:g.products,customFields:g.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:Se,editingIdentified:De,editingAnchor:g.editingAnchor,caretOffset:g.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:$e,placeholder:g.placeholderText||void 0,onChange:n,onKeyDown:re,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":g.isDropdownOpen,"aria-activedescendant":lt,"aria-autocomplete":"list","aria-controls":qe},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:nt?[{...nt,options:g.dropdownOptions}]:[],activeIndex:g.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:g.isDropdownOpen,id:qe,pills:dt,activeSelected:g.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(F??!0)&&!Se&&!De,showOptionIcons:N??!0,showOptionImages:ae??!0,showOptionCounts:O??!0,skipDisabled:g.inSelectionAnimation,isLoading:ct,skeletonExiting:g.skeletonExiting,isInputEmpty:$e.trim().length===0,language:d,products:g.products,productImageFallback:Y,onProductSelect:y.selectProduct,onProductAddToCart:c?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:g.activeFormatType,dateView:g.dateView,selectedDateIso:Xe.selectedIso,selectedDateRange:Xe.selectedRange,dateRangeStart:Xe.rangeStart,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,timeView:g.timeView,multiSelectView:g.multiSelectView,onMultiSelectCommit:y.commitMultiSelect,onTimeChange:y.setTime,onTimeCommit:y.commitTime,locationView:g.locationView,isReediting:g.editingParam!=null,onLocationQuery:y.setLocationQuery,onLocationMove:y.moveLocationHighlight,onLocationCommit:y.commitLocation,onLocationFocusChange:y.setLocationFieldFocused,isFocused:g.isFocused||g.locationFieldFocused,optionsPosition:u??"below"}}}var de=require("@magicx-eng/ai-autocomplete-vanilla"),M=require("react"),Et;function ii(){if(Et!==void 0)return Et;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Et=e.contentEditable==="plaintext-only",Et}function ba(e){let{segments:a,showChipIcons:t=!0,showChipImages:i=!0,newParamId:o,editingParam:s,editingIdentified:r,editingAnchor:d,caretOffset:m,placeholderText:v,isFocused:k,isDropdownOpen:f,listboxId:p,activeDescendantId:u,autoFocus:x,handleTextChange:A,handleKeyDown:q,handleCaretAfterInput:H,handleCaretMove:N,startEditingParam:ae,replaceEditingRange:O,setFocused:F}=e,T=(0,M.useRef)(null),Y=(0,M.useRef)(!1),ie=(0,M.useRef)(""),ce=(0,M.useRef)(""),ee=(0,M.useRef)(null),te=(0,M.useRef)(0);ee.current=m,(0,M.useEffect)(()=>{if(!x)return;let w=T.current;if(!w)return;document.activeElement===w?F(!0):w.focus();let S=w.ownerDocument??document,I=S.getSelection(),L=I&&I.rangeCount>0&&w.contains(I.anchorNode);if(I&&!L){let z=S.createRange();z.selectNodeContents(w),z.collapse(!0),I.removeAllRanges(),I.addRange(z)}},[x,F]),(0,M.useEffect)(()=>{let w=T.current;if(!w)return;let S=w.ownerDocument??document,I=()=>{let L=S.getSelection();if(!L||L.rangeCount===0||!L.anchorNode||!w.contains(L.anchorNode))return;let z=L.anchorNode,oe=z.nodeType===Node.ELEMENT_NODE?z:z.parentElement,ge=(L.isCollapsed?oe?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Oe=s?.id??r?.id??null;if(ge&&ge!==Oe){ae(ge);return}performance.now()-te.current<50||N((0,de.getCursorOffset)(w))};return S.addEventListener("selectionchange",I),()=>S.removeEventListener("selectionchange",I)},[s,r,ae,N]),(0,M.useEffect)(()=>{let w=T.current;if(!w)return;let S=I=>{let L=(0,de.chipIdFromTap)(w,I.target);L&&(ae(L),(0,de.keepCaretOnChip)(w,L))};return w.addEventListener("click",S),()=>w.removeEventListener("click",S)},[ae]),(0,M.useLayoutEffect)(()=>{let w=T.current;w&&(0,de.renderEditableContent)({input:w,segments:a,newParamId:o,editingParamId:s?.id??null,placeholderText:v??"",isFocused:k,showChipIcons:t,showChipImages:i})},[a,o,s,v,k,t,i]),(0,M.useLayoutEffect)(()=>{let w=ie.current,S=o??"";if(ie.current=S,!S||S===w)return;let I=T.current;if(!I)return;I.focus();let L=ee.current??(0,de.plainTextLength)(I);(0,de.setCursorOffset)(I,L)},[o]),(0,M.useLayoutEffect)(()=>{let w=ce.current,S=s?.id??"";if(ce.current=S,!S||S===w||d==null)return;let I=T.current;I&&(0,de.setCursorOffset)(I,d)},[s,d]);let P=(0,M.useCallback)(()=>{if(Y.current)return;let w=T.current;if(!w)return;let S=(0,de.extractPlainText)(w),L=S.length>0&&S[0]!==S[0].toUpperCase()?S[0].toUpperCase()+S.slice(1):S;A(L)},[A]),Q=(0,M.useCallback)(()=>{te.current=performance.now(),P();let w=T.current;w&&H((0,de.getCursorOffset)(w))},[P,H]);(0,M.useEffect)(()=>{let w=T.current;if(!w)return;let S=I=>{let L=I,z=L.inputType;if(z==="insertParagraph"||z==="insertLineBreak"||z==="insertFromDrop"){I.preventDefault();return}if(z.startsWith("insert")||z.startsWith("delete")){let oe=z.startsWith("delete")?"":L.data??"";O(oe)&&I.preventDefault()}};return w.addEventListener("beforeinput",S),()=>w.removeEventListener("beforeinput",S)},[O]);let Ae=(0,M.useCallback)(()=>{Y.current=!0,T.current?.setAttribute("data-aia-composing","true")},[]),ke=(0,M.useCallback)(()=>{Y.current=!1,T.current?.removeAttribute("data-aia-composing"),P()},[P]),ve=(0,M.useCallback)(w=>{w.preventDefault();let S=T.current;if(!S)return;let I=(w.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let L=S.ownerDocument??document,z=L.getSelection();if(!z||z.rangeCount===0)return;let oe=z.getRangeAt(0);if(!S.contains(oe.startContainer))return;oe.deleteContents();let Re=L.createTextNode(I);oe.insertNode(Re),oe.setStartAfter(Re),oe.collapse(!0),z.removeAllRanges(),z.addRange(oe),P()},[P]),c=(0,M.useCallback)(w=>q(w),[q]),E=(0,M.useCallback)(()=>F(!0),[F]),Ge=(0,M.useCallback)(()=>F(!1),[F]),b=(0,M.useCallback)(()=>T.current?.focus(),[]),at=(0,M.useCallback)(()=>T.current?.blur(),[]),Ve=(0,M.useCallback)(()=>{let w=T.current;return w?(0,de.extractPlainText)(w):""},[]),Ue=ii()?"plaintext-only":"true";return{inputRef:T,editorProps:{ref:T,contentEditable:Ue,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":p,"aria-expanded":f,"aria-activedescendant":u,spellCheck:!0,enterKeyHint:"send",onInput:Q,onKeyDown:c,onCompositionStart:Ae,onCompositionEnd:ke,onPaste:ve,onFocus:E,onBlur:Ge},getPlainText:Ve,focus:b,blur:at}}var Ee=require("react/jsx-runtime");function oi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var wa=(0,U.forwardRef)(function({onSubmit:a,onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:d,additionalContext:m,language:v,currency:k,productId:f,visitorId:p,columns:u,pillPlacement:x="dropdown",mode:A="auto",optionsPosition:q="below",animations:H=!0,optionsStyle:N="floating",dropdownTrigger:ae,closeDropdownOnBlur:O,prependPlaceholder:F,showNonTappableOptions:T,locationSearch:Y,showOptionIcons:ie=!0,showChipIcons:ce=!0,showChipImages:ee=!0,showOptionImages:te=!0,showOptionCounts:P=!0,showSkipButton:Q,showProducts:Ae,productsLayout:ke,productImageFallback:ve,autoFocus:c=!0,onFocus:E,onBlur:Ge,value:b,completedParams:at,onChange:Ve,onParamsChange:Ue,products:w,mapProducts:S,onProductSelect:I,onProductAddToCart:L,submitButton:z,resetOnSubmit:oe=!0},Re){let ge=(0,U.useRef)(null),Oe=(0,U.useRef)(null),Ye=(0,U.useRef)(null),st=(0,U.useRef)(()=>{}),j=(0,U.useRef)(null),Qe=(0,U.useRef)(null);(0,U.useEffect)(()=>{let B=ge.current;if(B)return j.current?j.current.setMode(A):j.current=new Be.ModeController(B,A),()=>{j.current?.destroy(),j.current=null}},[A]);let pt=(0,U.useCallback)(B=>{let fe=Qe.current?.current;fe&&(fe.focus(),(0,Be.setCursorOffset)(fe,B))},[]),{completedParams:it,suggestionPills:We,setActivePill:ht,skipActivePill:je,segments:pe,newParamId:Ce,clearNewParamId:y,placeholderText:n,isFocused:re,isDropdownOpen:Le,isActivePillSelected:g,isLoading:$e,isReady:Ke,activeIndex:ze,listboxId:ot,handleTextChange:ut,handleKeyDown:qe,setFocused:lt,editingParam:Se,editingIdentified:De,editingAnchor:Ze,caretOffset:nt,startEditingParam:dt,handleCaretAfterInput:Xe,handleCaretMove:ct,replaceEditingRange:h,dropdownProps:K,reset:C,refreshProducts:vt,prepareSubmit:Ht,getState:Bt,recordSubmit:Gt}=It({onSubmit:B=>st.current(B),onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:d,additionalContext:m,language:v,currency:k,productId:f,visitorId:p,columns:u,dropdownTrigger:ae,optionsPosition:q,closeDropdownOnBlur:O,prependPlaceholder:F,showNonTappableOptions:T,locationSearch:Y,showOptionIcons:ie,showOptionImages:te,showOptionCounts:P,showSkipButton:Q,showProducts:Ae,onFocus:E,onBlur:Ge,value:b,completedParams:at,onChange:Ve,onParamsChange:Ue,products:w,mapProducts:S,onProductSelect:I,onProductAddToCart:L,source:"full-sdk",setCursor:pt});(0,U.useEffect)(()=>{if(!Ce)return;let B=window.setTimeout(()=>y(),650);return()=>window.clearTimeout(B)},[Ce,y]);let va=ze>=0?`${ot}-option-${ze}`:void 0,{inputRef:At,editorProps:xa,focus:xt,blur:Wt,getPlainText:Kt}=ba({segments:pe,newParamId:Ce,editingParam:Se,editingIdentified:De,editingAnchor:Ze,caretOffset:nt,placeholderText:n,isFocused:re,showChipIcons:ce,showChipImages:ee,isDropdownOpen:Le,listboxId:ot,activeDescendantId:va,autoFocus:c,handleTextChange:ut,handleKeyDown:qe,handleCaretAfterInput:Xe,handleCaretMove:ct,startEditingParam:dt,replaceEditingRange:h,setFocused:lt});Qe.current=At,(0,U.useLayoutEffect)(()=>{let B=Oe.current,fe=At.current;if(!B||!fe)return;let gt=()=>{let _t=B.firstElementChild;if(!_t)return;let Sa=_t.getBoundingClientRect(),Ta=fe.getBoundingClientRect();Sa.top>=Ta.bottom-2?B.setAttribute("data-aia-pill-wrapped",""):B.removeAttribute("data-aia-pill-wrapped")};gt();let qt=new ResizeObserver(gt);return qt.observe(fe),()=>qt.disconnect()},[pe,We.length,$e,At]),(0,U.useEffect)(()=>{let B=Ye.current;if(B)return(0,Be.watchEditorHeight)(B)},[]),(0,U.useImperativeHandle)(Re,()=>({focus:xt,blur:Wt,reset:C,refreshProducts:vt,setMode:B=>j.current?.setMode(B),skipActivePill:je}),[xt,Wt,C,vt,je]);let mt=!!pe.length||it.length>0,Rt=(0,U.useCallback)(B=>{if(!mt)return;B&&Ht();let fe=Bt(),gt=(0,Be.buildSubmitResult)(Kt(),fe.completedParams,fe.skippedParams,{identifiedParams:fe.identifiedParams,isReady:fe.isReady,customFields:fe.customFields});B&&Gt(gt),a(gt),oe&&C()},[Gt,oe,mt,Ht,Bt,a,C,Kt]);st.current=()=>Rt(!1);let ya=(0,U.useCallback)(B=>{B.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||xt()},[xt]),ka=x==="inline",Ca=x==="dropdown";return(0,Ee.jsxs)("div",{ref:ge,className:`magicx-aia ${rt.container} ${r??""}`,"data-pill-placement":x,"data-options-position":q,"data-animations":H?"on":"off","data-aia-options-style":N,"data-mode":oi(A),children:[(0,Ee.jsx)(Tt,{...K,showPills:Ca,productsLayout:ke,productImageFallback:ve}),(0,Ee.jsxs)("div",{className:rt.inputWrapper,"data-aia-input-wrapper":"",onClick:ya,children:[(0,Ee.jsxs)("div",{ref:Ye,className:rt.editorArea,"data-aia-editor":"",children:[(0,Ee.jsx)("div",{...xa,className:rt.input,"data-aia-input":""}),ka&&($e||We.length>0)&&(0,Ee.jsx)("span",{ref:Oe,className:rt.pillListContainer,"data-aia-pill-list-container":"",children:(0,Ee.jsx)(Ct,{pills:We,activePillIndex:0,activeSelected:g,onSelectPill:ht,loading:$e})})]}),z===null?null:z===void 0?(0,Ee.jsx)(ua,{disabled:!mt,ready:mt&&Ke,onClick:()=>Rt(!0),label:(0,Be.uiStringsFor)(v).submit}):(0,Ee.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:rt.submitSlot,onClick:B=>{mt&&(B.stopPropagation(),Rt(!0))},children:z})]})]})});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});
3566
+ `,document.head.appendChild(e)}var pa={submitButton:"aia-submitButton-otz7H"};var Pt=require("react/jsx-runtime");function ua({disabled:e,ready:a,onClick:t,label:i=(0,ha.uiStringsFor)().submit}){return(0,Pt.jsx)("button",{type:"button","data-aia-submit":"",className:pa.submitButton,disabled:e,"data-aia-ready":a?"":void 0,onClick:o=>{o.stopPropagation(),t()},"aria-label":i,children:(0,Pt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Pt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var tt=require("@magicx-eng/ai-autocomplete-vanilla"),R=require("react");var Nt=require("react");function ma(e){let a=(0,Nt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,Nt.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(d,m,v)=>{let C=a.current?.[s];return C?C(d,m,v):[]};o[s]=r}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}var Ht=require("react");function ga(e){let a=(0,Ht.useRef)(e);a.current=e;let t=(0,Ht.useRef)(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=a.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var fa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateFloor:null,timeView:null,multiSelectView:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function It({onSubmit:e,onResult:a,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,visitorId:C,columns:g=2,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:V,locationSearch:H,showOptionIcons:N,showOptionImages:de,showOptionCounts:P,showSkipButton:G,showProducts:K,productImageFallback:S="image",onFocus:ae,onBlur:ce,value:ie,completedParams:oe,onChange:L,onParamsChange:F,products:Le,mapProducts:Ce,onProductSelect:ve,onProductAddToCart:c,source:E,setCursor:Ge}){let w=(0,R.useRef)(null),[at,Ue]=(0,R.useState)(null),Ye=(0,R.useRef)(e);Ye.current=e;let Ke=(0,R.useRef)(a);Ke.current=a;let f=(0,R.useRef)(t);f.current=t;let T=(0,R.useRef)(L);T.current=L;let I=(0,R.useRef)(F);I.current=F;let O=(0,R.useRef)(ae);O.current=ae;let M=(0,R.useRef)(ce);M.current=ce;let re=(0,R.useRef)(Ge);re.current=Ge;let ge=(0,R.useRef)(ve);ge.current=ve;let xe=(0,R.useRef)(c);xe.current=c;let ze=(0,R.useRef)(C);ze.current=C;let st=(0,R.useRef)(()=>{let h=ze.current;return typeof h=="function"?h():h}).current,Z=ga(Le),Qe=(0,R.useRef)(Ce);Qe.current=Ce;let pt=(0,R.useRef)((h,_)=>{let k=Qe.current;return k?k(h,_):h}).current,it=Ce?pt:void 0,De=ma(i);(0,R.useEffect)(()=>{if(typeof document>"u")return;let h=new tt.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,visitorId:st,optionOverrides:De.overrides,maskCompletedText:o,columns:g,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:V,locationSearch:H,showProducts:K,source:E,value:ie,completedParams:oe,onSubmit:(...k)=>Ye.current?.(...k),onResult:(...k)=>Ke.current?.(...k),onError:(...k)=>f.current?.(...k),onChange:(...k)=>T.current?.(...k),onParamsChange:(...k)=>I.current?.(...k),onFocus:()=>O.current?.(),onBlur:()=>M.current?.(),onProductSelect:k=>ge.current?.(k),onProductAddToCart:k=>xe.current?.(k),setCursor:k=>re.current?.(k),products:Z.config,mapProducts:it});w.current=h,Ue(h.getState());let _=h.subscribe(k=>Ue(k));return()=>{_(),h.destroy(),w.current===h&&(w.current=null)}},[]),(0,R.useEffect)(()=>{ie!==void 0&&w.current?.setValue(ie)},[ie]),(0,R.useEffect)(()=>{oe!==void 0&&w.current?.setCompletedParams(oe)},[oe]);let ht=JSON.stringify(s??null),je;try{je=JSON.stringify(r??null)}catch{je="[unstringifiable]"}(0,R.useEffect)(()=>{w.current?.update({apiConfig:s,additionalContext:r,language:d,currency:m,productId:v,optionOverrides:De.overrides,dropdownTrigger:p,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:V,locationSearch:H,showProducts:K})},[ht,je,d,m?.code,m?.rate,m?.country,v,De.key,p,u,x,A,V,H,K]);let pe=(0,R.useRef)(!1);(0,R.useEffect)(()=>{if(!pe.current){pe.current=!0;return}w.current?.update({products:Z.config})},[Z.enabled]),(0,R.useEffect)(()=>{w.current?.update({mapProducts:it})},[it]);let Se=(0,R.useRef)(null);Se.current===null&&(Se.current={handleTextChange:h=>w.current?.handleTextChange(h),handleKeyDown:h=>{let _="nativeEvent"in h?h.nativeEvent:h;w.current?.handleKeyDown(_)},setFocused:h=>w.current?.setFocused(h),startEditingParam:h=>w.current?.startEditingParam(h),exitEditMode:()=>w.current?.exitEditMode(),handleCaretAfterInput:h=>w.current?.handleCaretAfterInput(h),handleCaretMove:h=>w.current?.handleCaretMove(h),replaceEditingRange:h=>w.current?.replaceEditingRange(h)??!1,setActivePill:h=>w.current?.setActivePill(h),skipActivePill:()=>w.current?.skipActivePill(),removeLastParam:()=>w.current?.removeLastParam(),clearNewParamId:()=>w.current?.clearNewParamId(),reset:()=>w.current?.reset(),refreshProducts:()=>w.current?.refreshProducts(),prepareSubmit:()=>w.current?.prepareSubmit(),getState:()=>w.current?.getState()??fa,recordSubmit:h=>w.current?.recordSubmit(h),selectOption:(h,_)=>w.current?.selectOption(h,_),selectProduct:h=>w.current?.selectProduct(h),addProductToCart:h=>{let _=w.current;return!_||!xe.current?Promise.resolve():_.addProductToCart(h)},setActiveDropdownIndex:h=>w.current?.setActiveDropdownIndex(h),clearHighlight:h=>w.current?.clearHighlight(h),showPreviousMonth:()=>w.current?.showPreviousMonth(),showNextMonth:()=>w.current?.showNextMonth(),setTime:h=>w.current?.setTime(h),commitTime:()=>w.current?.commitTime(),toggleMultiSelectOption:h=>w.current?.toggleMultiSelectOption(h),commitMultiSelect:()=>w.current?.commitMultiSelect(),setLocationQuery:h=>w.current?.setLocationQuery(h),moveLocationHighlight:h=>w.current?.moveLocationHighlight(h),commitLocation:h=>w.current?.commitLocation(h),setLocationFieldFocused:h=>w.current?.setLocationFieldFocused(h),handleFocus:()=>w.current?.setFocused(!0),handleBlur:()=>w.current?.setFocused(!1)});let y=Se.current,n=(0,R.useCallback)(h=>{let _=h.target.value,vt=_.length>0&&!h.nativeEvent?.isComposing&&_[0]!==_[0].toUpperCase()?_[0].toUpperCase()+_.slice(1):_;w.current?.handleTextChange(vt)},[]),se=(0,R.useCallback)(h=>{w.current?.handleKeyDown(h.nativeEvent)},[]),Me=w.current,b=at??fa,$e=ie!==void 0?ie:b.text,qe=oe!==void 0?oe:b.completedParams,Te=b.actionableSuggestions,ot=Te[0],ut=(0,R.useMemo)(()=>(0,tt.withoutTraditionalAutocomplete)(Te),[Te]),_e=Me?.listboxId??"",lt=b.activeDropdownIndex>=0&&Me?`${_e}-option-${b.activeDropdownIndex}`:void 0,Pe=b.editingParam,Ne=b.editingIdentified,Ze=Pe?{parameter:Pe.suggestionParameter,text:Pe.suggestionPlaceholder,required:!0,options:Pe.options}:Ne?{parameter:Ne.parameter,text:(0,tt.identifiedParamLabel)(Ne.parameter),required:!0,options:[]}:null,nt=b.dropdownSuggestion??Ze??ot,dt=Ze?[Ze]:Te,Xe=(0,tt.dateSelectionFor)(b),ct=!Me||b.dropdownLoading;return{completedParams:qe,multiSelectView:b.multiSelectView,toggleMultiSelectOption:y.toggleMultiSelectOption,commitMultiSelect:y.commitMultiSelect,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:ut,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:y.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:ct,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:_e,error:b.error,products:b.products,customFields:b.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:Pe,editingIdentified:Ne,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:$e,placeholder:b.placeholderText||void 0,onChange:n,onKeyDown:se,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":lt,"aria-autocomplete":"list","aria-controls":_e},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:nt?[{...nt,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:b.isDropdownOpen,id:_e,pills:dt,activeSelected:b.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(G??!0)&&!Pe&&!Ne,showOptionIcons:N??!0,showOptionImages:de??!0,showOptionCounts:P??!0,skipDisabled:b.inSelectionAnimation,isLoading:ct,skeletonExiting:b.skeletonExiting,isInputEmpty:$e.trim().length===0,language:d,products:b.products,productImageFallback:S,onProductSelect:y.selectProduct,onProductAddToCart:c?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:Xe.selectedIso,selectedDateRange:Xe.selectedRange,dateRangeStart:Xe.rangeStart,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,timeView:b.timeView,multiSelectView:b.multiSelectView,onMultiSelectCommit:y.commitMultiSelect,onTimeChange:y.setTime,onTimeCommit:y.commitTime,locationView:b.locationView,isReediting:b.editingParam!=null,onLocationQuery:y.setLocationQuery,onLocationMove:y.moveLocationHighlight,onLocationCommit:y.commitLocation,onLocationFocusChange:y.setLocationFieldFocused,isFocused:b.isFocused||b.locationFieldFocused,optionsPosition:u??"below"}}}var j=require("@magicx-eng/ai-autocomplete-vanilla"),D=require("react"),Et;function ii(){if(Et!==void 0)return Et;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Et=e.contentEditable==="plaintext-only",Et}function ba(e){let{segments:a,showChipIcons:t=!0,showChipImages:i=!0,newParamId:o,editingParam:s,editingIdentified:r,editingAnchor:d,caretOffset:m,placeholderText:v,hintSuggestions:C,isFocused:g,isDropdownOpen:p,listboxId:u,activeDescendantId:x,autoFocus:A,handleTextChange:V,handleKeyDown:H,handleCaretAfterInput:N,handleCaretMove:de,startEditingParam:P,replaceEditingRange:G,setFocused:K}=e,S=(0,D.useRef)(null),ae=(0,D.useRef)(!1),ce=(0,D.useRef)(""),ie=(0,D.useRef)(""),oe=(0,D.useRef)(null),L=(0,D.useRef)(0);oe.current=m,(0,D.useEffect)(()=>{if(!A)return;let f=S.current;if(!f)return;document.activeElement===f?K(!0):f.focus();let T=f.ownerDocument??document,I=T.getSelection(),O=I&&I.rangeCount>0&&f.contains(I.anchorNode);if(I&&!O){let M=T.createRange();M.selectNodeContents(f),M.collapse(!0),I.removeAllRanges(),I.addRange(M)}},[A,K]),(0,D.useEffect)(()=>{let f=S.current;if(!f)return;let T=f.ownerDocument??document,I=()=>{let O=T.getSelection();if(!O||O.rangeCount===0||!O.anchorNode||!f.contains(O.anchorNode))return;let M=O.anchorNode,re=M.nodeType===Node.ELEMENT_NODE?M:M.parentElement,xe=(O.isCollapsed?re?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ze=s?.id??r?.id??null;if(xe&&xe!==ze){P(xe);return}performance.now()-L.current<50||de((0,j.getCursorOffset)(f))};return T.addEventListener("selectionchange",I),()=>T.removeEventListener("selectionchange",I)},[s,r,P,de]),(0,D.useEffect)(()=>{let f=S.current;if(!f)return;let T=I=>{let O=(0,j.chipIdFromTap)(f,I.target);O&&(P(O),(0,j.keepCaretOnChip)(f,O))};return f.addEventListener("click",T),()=>f.removeEventListener("click",T)},[P]),(0,D.useLayoutEffect)(()=>{let f=S.current;f&&(0,j.renderEditableContent)({input:f,segments:a,newParamId:o,editingParamId:s?.id??null,placeholderText:v??"",isFocused:g,showChipIcons:t,showChipImages:i,hintOptions:(0,j.startingHintOptions)(C??[])})},[a,o,s,v,C,g,t,i]),(0,D.useEffect)(()=>{let f=S.current;return()=>{f&&(0,j.cancelStartingHint)(f)}},[]),(0,D.useLayoutEffect)(()=>{let f=ce.current,T=o??"";if(ce.current=T,!T||T===f)return;let I=S.current;if(!I)return;I.focus();let O=oe.current??(0,j.plainTextLength)(I);(0,j.setCursorOffset)(I,O)},[o]),(0,D.useLayoutEffect)(()=>{let f=ie.current,T=s?.id??"";if(ie.current=T,!T||T===f||d==null)return;let I=S.current;I&&(0,j.setCursorOffset)(I,d)},[s,d]);let F=(0,D.useCallback)(()=>{if(ae.current)return;let f=S.current;if(!f)return;let T=(0,j.extractPlainText)(f),O=T.length>0&&T[0]!==T[0].toUpperCase()?T[0].toUpperCase()+T.slice(1):T;V(O)},[V]),Le=(0,D.useCallback)(()=>{L.current=performance.now(),F();let f=S.current;f&&N((0,j.getCursorOffset)(f))},[F,N]);(0,D.useEffect)(()=>{let f=S.current;if(!f)return;let T=I=>{let O=I,M=O.inputType;if(M==="insertParagraph"||M==="insertLineBreak"||M==="insertFromDrop"){I.preventDefault();return}if(M.startsWith("insert")||M.startsWith("delete")){let re=M.startsWith("delete")?"":O.data??"";G(re)&&I.preventDefault()}};return f.addEventListener("beforeinput",T),()=>f.removeEventListener("beforeinput",T)},[G]);let Ce=(0,D.useCallback)(()=>{ae.current=!0,S.current?.setAttribute("data-aia-composing","true")},[]),ve=(0,D.useCallback)(()=>{ae.current=!1,S.current?.removeAttribute("data-aia-composing"),F()},[F]),c=(0,D.useCallback)(f=>{f.preventDefault();let T=S.current;if(!T)return;let I=(f.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let O=T.ownerDocument??document,M=O.getSelection();if(!M||M.rangeCount===0)return;let re=M.getRangeAt(0);if(!T.contains(re.startContainer))return;re.deleteContents();let ge=O.createTextNode(I);re.insertNode(ge),re.setStartAfter(ge),re.collapse(!0),M.removeAllRanges(),M.addRange(re),F()},[F]),E=(0,D.useCallback)(f=>H(f),[H]),Ge=(0,D.useCallback)(()=>K(!0),[K]),w=(0,D.useCallback)(()=>K(!1),[K]),at=(0,D.useCallback)(()=>S.current?.focus(),[]),Ue=(0,D.useCallback)(()=>S.current?.blur(),[]),Ye=(0,D.useCallback)(()=>{let f=S.current;return f?(0,j.extractPlainText)(f):""},[]),Ke=ii()?"plaintext-only":"true";return{inputRef:S,editorProps:{ref:S,contentEditable:Ke,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":u,"aria-expanded":p,"aria-activedescendant":x,spellCheck:!0,enterKeyHint:"send",onInput:Le,onKeyDown:E,onCompositionStart:Ce,onCompositionEnd:ve,onPaste:c,onFocus:Ge,onBlur:w},getPlainText:Ye,focus:at,blur:Ue}}var Oe=require("react/jsx-runtime");function oi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var wa=(0,$.forwardRef)(function({onSubmit:a,onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:d,additionalContext:m,language:v,currency:C,productId:g,visitorId:p,columns:u,pillPlacement:x="dropdown",mode:A="auto",optionsPosition:V="below",animations:H=!0,optionsStyle:N="floating",dropdownTrigger:de,closeDropdownOnBlur:P,prependPlaceholder:G,showNonTappableOptions:K,locationSearch:S,showOptionIcons:ae=!0,showChipIcons:ce=!0,showChipImages:ie=!0,showOptionImages:oe=!0,showOptionCounts:L=!0,showSkipButton:F,showProducts:Le,productsLayout:Ce,productImageFallback:ve,autoFocus:c=!0,onFocus:E,onBlur:Ge,value:w,completedParams:at,onChange:Ue,onParamsChange:Ye,products:Ke,mapProducts:f,onProductSelect:T,onProductAddToCart:I,submitButton:O,resetOnSubmit:M=!0},re){let ge=(0,$.useRef)(null),xe=(0,$.useRef)(null),ze=(0,$.useRef)(null),st=(0,$.useRef)(()=>{}),Z=(0,$.useRef)(null),Qe=(0,$.useRef)(null);(0,$.useEffect)(()=>{let B=ge.current;if(B)return Z.current?Z.current.setMode(A):Z.current=new We.ModeController(B,A),()=>{Z.current?.destroy(),Z.current=null}},[A]);let pt=(0,$.useCallback)(B=>{let fe=Qe.current?.current;fe&&(fe.focus(),(0,We.setCursorOffset)(fe,B))},[]),{completedParams:it,suggestionPills:De,setActivePill:ht,skipActivePill:je,segments:pe,newParamId:Se,clearNewParamId:y,placeholderText:n,isFocused:se,isDropdownOpen:Me,isActivePillSelected:b,isLoading:$e,isReady:qe,activeIndex:Te,listboxId:ot,handleTextChange:ut,handleKeyDown:_e,setFocused:lt,editingParam:Pe,editingIdentified:Ne,editingAnchor:Ze,caretOffset:nt,startEditingParam:dt,handleCaretAfterInput:Xe,handleCaretMove:ct,replaceEditingRange:h,dropdownProps:_,reset:k,refreshProducts:vt,prepareSubmit:Ft,getState:Bt,recordSubmit:Wt}=It({onSubmit:B=>st.current(B),onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:d,additionalContext:m,language:v,currency:C,productId:g,visitorId:p,columns:u,dropdownTrigger:de,optionsPosition:V,closeDropdownOnBlur:P,prependPlaceholder:G,showNonTappableOptions:K,locationSearch:S,showOptionIcons:ae,showOptionImages:oe,showOptionCounts:L,showSkipButton:F,showProducts:Le,onFocus:E,onBlur:Ge,value:w,completedParams:at,onChange:Ue,onParamsChange:Ye,products:Ke,mapProducts:f,onProductSelect:T,onProductAddToCart:I,source:"full-sdk",setCursor:pt});(0,$.useEffect)(()=>{if(!Se)return;let B=window.setTimeout(()=>y(),650);return()=>window.clearTimeout(B)},[Se,y]);let va=Te>=0?`${ot}-option-${Te}`:void 0,{inputRef:At,editorProps:xa,focus:xt,blur:Gt,getPlainText:Kt}=ba({segments:pe,newParamId:Se,editingParam:Pe,editingIdentified:Ne,editingAnchor:Ze,caretOffset:nt,placeholderText:n,hintSuggestions:x==="inline"?[]:De,isFocused:se,showChipIcons:ce,showChipImages:ie,isDropdownOpen:Me,listboxId:ot,activeDescendantId:va,autoFocus:c,handleTextChange:ut,handleKeyDown:_e,handleCaretAfterInput:Xe,handleCaretMove:ct,startEditingParam:dt,replaceEditingRange:h,setFocused:lt});Qe.current=At,(0,$.useLayoutEffect)(()=>{let B=xe.current,fe=At.current;if(!B||!fe)return;let gt=()=>{let _t=B.firstElementChild;if(!_t)return;let Sa=_t.getBoundingClientRect(),Ta=fe.getBoundingClientRect();Sa.top>=Ta.bottom-2?B.setAttribute("data-aia-pill-wrapped",""):B.removeAttribute("data-aia-pill-wrapped")};gt();let qt=new ResizeObserver(gt);return qt.observe(fe),()=>qt.disconnect()},[pe,De.length,$e,At]),(0,$.useEffect)(()=>{let B=ze.current;if(B)return(0,We.watchEditorHeight)(B)},[]),(0,$.useImperativeHandle)(re,()=>({focus:xt,blur:Gt,reset:k,refreshProducts:vt,setMode:B=>Z.current?.setMode(B),skipActivePill:je}),[xt,Gt,k,vt,je]);let mt=!!pe.length||it.length>0,Rt=(0,$.useCallback)(B=>{if(!mt)return;B&&Ft();let fe=Bt(),gt=(0,We.buildSubmitResult)(Kt(),fe.completedParams,fe.skippedParams,{identifiedParams:fe.identifiedParams,isReady:fe.isReady,customFields:fe.customFields});B&&Wt(gt),a(gt),M&&k()},[Wt,M,mt,Ft,Bt,a,k,Kt]);st.current=()=>Rt(!1);let ya=(0,$.useCallback)(B=>{B.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||xt()},[xt]),ka=x==="inline",Ca=x==="dropdown";return(0,Oe.jsxs)("div",{ref:ge,className:`magicx-aia ${rt.container} ${r??""}`,"data-pill-placement":x,"data-options-position":V,"data-animations":H?"on":"off","data-aia-options-style":N,"data-mode":oi(A),children:[(0,Oe.jsx)(Tt,{..._,showPills:Ca,productsLayout:Ce,productImageFallback:ve}),(0,Oe.jsxs)("div",{className:rt.inputWrapper,"data-aia-input-wrapper":"",onClick:ya,children:[(0,Oe.jsxs)("div",{ref:ze,className:rt.editorArea,"data-aia-editor":"",children:[(0,Oe.jsx)("div",{...xa,className:rt.input,"data-aia-input":""}),ka&&($e||De.length>0)&&(0,Oe.jsx)("span",{ref:xe,className:rt.pillListContainer,"data-aia-pill-list-container":"",children:(0,Oe.jsx)(Ct,{pills:De,activePillIndex:0,activeSelected:b,onSelectPill:ht,loading:$e})})]}),O===null?null:O===void 0?(0,Oe.jsx)(ua,{disabled:!mt,ready:mt&&qe,onClick:()=>Rt(!0),label:(0,We.uiStringsFor)(v).submit}):(0,Oe.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:rt.submitSlot,onClick:B=>{mt&&(B.stopPropagation(),Rt(!0))},children:O})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
3633
3567
  //# sourceMappingURL=index.js.map