@magicx-eng/ai-autocomplete-react 0.47.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END as ur,DATE_RANGE_META_START as mr,DEFAULT_OPTION_COUNT_UNIT as gr,dateCellMarks as fr,formatDate as br,formatDateRange as wr,formatOptionCount as vr,formatTime as xr,isoDate as yr,monthLabel as kr,optionCountLabel as Cr,optionHasImage as Sr,optionImageSources as Tr,optionImageSrc as Pr,optionLabel as Ir,optionsShowLeadingVisuals as Er,PRODUCT_PATH_PREFIX as Ar,parseDate as Rr,parseLooseDate as Or,parseLooseDateRange as Dr,parseTime as Lr,productFromMatchedItem as Mr,productImageSources as zr,productsFromCustomFields as Nr,sanitizeOptionIconSvg as Hr,selectedRangeFor as Fr,TIME_META_KEY as Br,visibleDateRange as Wr,WEEKDAY_LABELS as Gr,withSkippedParams as Kr}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as eo,useCallback as Tt,useEffect as da,useImperativeHandle as to,useLayoutEffect as ao,useRef as Ze}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
1
+ import{buildSubmitResult as Br,cellDay as Wr,cellIso as Gr,DATE_RANGE_META_END as Kr,DATE_RANGE_META_START as qr,DEFAULT_OPTION_COUNT_UNIT as _r,dateCellMarks as Vr,formatDate as Ur,formatDateRange as Qr,formatOptionCount as Yr,formatPlace as jr,formatTime as $r,isoDate as Zr,LOCATION_META_KEY as Xr,monthLabel as Jr,optionCountLabel as es,optionHasImage as ts,optionImageSources as as,optionImageSrc as is,optionLabel as os,optionsShowLeadingVisuals as ns,PRODUCT_PATH_PREFIX as rs,parseDate as ss,parseLooseDate as ls,parseLooseDateRange as ds,parseTime as cs,productFromMatchedItem as ps,productImageSources as hs,productsFromCustomFields as us,sanitizeOptionIconSvg as ms,selectedRangeFor as gs,TIME_META_KEY as fs,visibleDateRange as bs,WEEKDAY_LABELS as ws,withSkippedParams as vs}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Co,useCallback as Rt,useEffect as Ot,useImperativeHandle as So,useLayoutEffect as To,useRef as Ze}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
2
2
  position: relative;
3
3
  /* Inherits the host page's font by default. Consumers can pin a specific
4
4
  font on the library via \`--aia-font-family: 'Custom Font'\` without
@@ -264,23 +264,89 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
264
264
  display: contents;
265
265
  }
266
266
 
267
- /* Promotion reveal on a newly promoted completed param. The shared renderer
268
- (core/render/renderEditable.ts) stamps the global shimmer classes onto the
269
- just-added <strong>; we match them via [class~=] to bypass CSS Modules'
270
- hashing. Completed params are now pills with a solid background, so the old
271
- text-clip gradient shimmer can't be used (background-clip: text would wipe
272
- the pill background). The reveal is a simple fade-in of the whole pill,
273
- riding on shimmer-sweep so it only plays on genuine promotions. */
267
+ /* Word \u2192 chip. A newly recognised param (renderEditable stamps shimmer-sweep
268
+ on it) keeps its text in place while the chip forms around it: the fill and
269
+ padding grow in over 300ms, and the picked option's icon or picture grows in
270
+ front of the word \u2014 its width opening the room (so the words slide over),
271
+ a small spring on its scale, a quick fade. The text itself never fades, so
272
+ a typed word turns into a chip rather than vanishing and coming back. */
274
273
  :where(.aia-input-IW-P-) strong[class~="magicx-aia-shimmer-sweep"] {
275
- animation: aia-aiaPillReveal-wf05b 400ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
274
+ animation: aia-aiaChipForm-tKbNc 300ms ease both;
276
275
  }
277
276
 
278
- @keyframes aia-aiaPillReveal-wf05b {
277
+ :where(.aia-input-IW-P-) strong[class~="magicx-aia-shimmer-sweep"] span[class~="magicx-aia-segment-icon"] {
278
+ animation:
279
+ aia-aiaTileGrow-j9Pat 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both,
280
+ aia-aiaTileSpring-FEwNg 380ms cubic-bezier(0.3, 1.5, 0.5, 1) both,
281
+ aia-aiaTileFade-H1LDQ 200ms ease both;
282
+ }
283
+
284
+ /* The picture tile is an inline box (see its own rule), which can't scale, so
285
+ it opens and fades without the spring. */
286
+ :where(.aia-input-IW-P-) strong[class~="magicx-aia-shimmer-sweep"] span[class~="magicx-aia-segment-image"] {
287
+ animation:
288
+ aia-aiaImageGrow-i9yw8 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both,
289
+ aia-aiaTileFade-H1LDQ 200ms ease both;
290
+ }
291
+
292
+ @keyframes aia-aiaChipForm-tKbNc {
279
293
  from {
280
- opacity: 0;
294
+ background-color: transparent;
295
+ padding-left: 0;
296
+ padding-right: 0;
297
+ }
298
+ }
299
+
300
+ @keyframes aia-aiaTileGrow-j9Pat {
301
+ from {
302
+ width: 0;
303
+ margin-right: 0;
304
+ }
305
+ }
306
+
307
+ @keyframes aia-aiaTileSpring-FEwNg {
308
+ from {
309
+ transform: scale(0.4);
310
+ }
311
+ }
312
+
313
+ /* A hair above zero, like the other fades \u2014 see magicx-aia-fadeIn. */
314
+ @keyframes aia-aiaTileFade-H1LDQ {
315
+ from {
316
+ opacity: 0.01;
317
+ }
318
+ }
319
+
320
+ @keyframes aia-aiaImageGrow-i9yw8 {
321
+ from {
322
+ padding-left: 0;
323
+ margin-right: 0;
281
324
  }
282
325
  }
283
- `,document.head.appendChild(e)}var De={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",aiaPillReveal:"aia-aiaPillReveal-wf05b"};import{attachScrollArrow as Ei,attachViewportFit as Ai,containScroll as Ri,hasSkippablePill as Oi,isCalendarFormat as Di,labelTraditionalAutocomplete as Li,uiStringsFor as Mi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as We,useRef as Be,useState as zi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
326
+
327
+ /* Reduced motion: a word becomes a chip at once. */
328
+ @media (prefers-reduced-motion: reduce) {
329
+ :where(.aia-input-IW-P-) strong[class~="magicx-aia-shimmer-sweep"],
330
+ :where(.aia-input-IW-P-) strong[class~="magicx-aia-shimmer-sweep"] span[class~="magicx-aia-segment-icon"],
331
+ :where(.aia-input-IW-P-) strong[class~="magicx-aia-shimmer-sweep"] span[class~="magicx-aia-segment-image"] {
332
+ animation: none;
333
+ }
334
+ }
335
+
336
+ /* --- Text box growth ---
337
+ watchEditorHeight writes the editor's height on every change, so a new line
338
+ opens over EDITOR_GROW_MS (340ms) instead of popping in. Reduced motion and
339
+ \`animations: false\` drop the slide; the height still follows the text. */
340
+ .aia-editorArea-7rBWq {
341
+ transition: height 340ms cubic-bezier(0.2, 0.8, 0.2, 1);
342
+ }
343
+
344
+ @media (prefers-reduced-motion: reduce) {
345
+ .aia-editorArea-7rBWq {
346
+ transition: none;
347
+ }
348
+ }
349
+ `,document.head.appendChild(e)}var He={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};import{attachScrollArrow as Ui,attachViewportFit as Qi,containScroll as Yi,hasSkippablePill as ji,isCalendarFormat as $i,labelTraditionalAutocomplete as Zi,uiStringsFor as Xi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ye,useRef as Qe,useState as Ji}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
284
350
  * Built-in appearance defaults \u2014 zero specificity via :where().
285
351
  * Consumer CSS always wins without !important.
286
352
  *
@@ -823,6 +889,23 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
823
889
  overflow: visible;
824
890
  }
825
891
 
892
+ /* A calendar is the exception to "sections keep their own height": a month
893
+ cut off mid-week reads as broken, and nothing shows that the rest is a
894
+ scroll away. So it gives instead: its weeks squeeze to share the space that
895
+ is left (the datepicker's weeks rule, which sets the floor), and only below
896
+ that floor does the stack scroll. */
897
+ [data-aia-dropdown][data-aia-fit] [data-aia-datepicker] {
898
+ flex-shrink: 1;
899
+ min-height: 0;
900
+ }
901
+
902
+ /* The footer goes while a calendar is fitted. Its keyboard hint and badge
903
+ would take a week and a half of rows from a month that is already short of
904
+ room, and the calendar's own bottom padding then closes the panel. */
905
+ [data-aia-dropdown][data-aia-fit]:has([data-aia-datepicker]) [data-aia-footer] {
906
+ display: none;
907
+ }
908
+
826
909
  [data-aia-dropdown][aria-multiselectable="true"] {
827
910
  --aia-grid-scroll-bottom: 0px;
828
911
  --aia-grid-overlap-bottom: 0px;
@@ -831,6 +914,25 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
831
914
  --aia-footer-fade-lead: 0px;
832
915
  --aia-footer-row-min-height: 0px;
833
916
  }
917
+
918
+ /* A multi-select shows three rows and scrolls the rest, in every layout (one
919
+ column, two columns, phone), so its Done button always sits right under
920
+ the third row. The planned cap (--aia-grid-max-height) still wins when it
921
+ is smaller: fewer than three rows of options. */
922
+ [data-aia-dropdown][aria-multiselectable="true"] .aia-grid[data-scroll] {
923
+ max-height: min(var(--aia-grid-max-height, 120px), calc(3 * var(--aia-option-row-height, 37px)));
924
+ }
925
+
926
+ /* Fitted to the viewport, every other grid hands its scrolling to the panel,
927
+ which would carry Done off screen with the rows. A multi-select keeps its
928
+ own three-row scroll box, and gives up rows before the panel has to scroll,
929
+ so Done stays in view. */
930
+ [data-aia-dropdown][data-aia-fit][aria-multiselectable="true"] .aia-grid[data-scroll] {
931
+ flex-shrink: 1;
932
+ min-height: var(--aia-option-row-height, 37px);
933
+ max-height: min(var(--aia-grid-max-height, 120px), calc(3 * var(--aia-option-row-height, 37px)));
934
+ overflow-y: auto;
935
+ }
834
936
  `,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 {
835
937
  position: absolute;
836
938
  left: 0;
@@ -925,7 +1027,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
925
1027
  A bare down chevron at the bottom-centre of the option list, shown while
926
1028
  there is more to scroll to \u2014 no disc, border or shadow around it. It rests
927
1029
  just above the grid's reserved band, or \u2014 when a product strip follows the
928
- grid \u2014 centred on the strip's "Products" label row, off the last option row
1030
+ grid \u2014 centred on the strip's "Best match" label row, off the last option row
929
1031
  (--aia-scroll-arrow-bottom is measured and set inline by the controller so
930
1032
  it tracks the layout). It never travels with the scroll: the controller toggles
931
1033
  data-aia-visible and the only thing that transitions is opacity \u2014 a slow,
@@ -1162,7 +1264,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
1162
1264
  font-weight: inherit;
1163
1265
  cursor: pointer;
1164
1266
  }
1165
- `,document.head.appendChild(e)}var se={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"};import{cellDay as ba,cellIso as He,dateCellMarks as wa,isoDate as va,monthLabel as xa,visibleDateRange as ya,WEEKDAY_LABELS as ka}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as Ca}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
1267
+ `,document.head.appendChild(e)}var fe={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"};import{cellDay as Aa,cellIso as Ve,dateCellMarks as La,isoDate as Ra,monthLabel as Oa,visibleDateRange as Da,WEEKDAY_LABELS as Ma}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as za}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
1166
1268
 
1167
1269
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1168
1270
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1237,6 +1339,27 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
1237
1339
  grid-template-columns: repeat(7, minmax(0, 1fr));
1238
1340
  }
1239
1341
 
1342
+ /* The weeks. A row is --aia-date-row-height tall whenever there is room, which
1343
+ keeps a month readable in a narrow dropdown without letting a 6-row month
1344
+ grow the panel past the options grid it replaces. In a panel fitted to a
1345
+ short window (data-aia-fit, see appearance.css) the calendar is the section
1346
+ that gives: the rows share what is left, down to --aia-date-row-min-height,
1347
+ so the whole month stays on screen with its bottom padding instead of the
1348
+ last week being sliced by the panel's edge. Only below that floor does the
1349
+ panel scroll. */
1350
+ .aia-grid-mQCgw {
1351
+ flex: 1 1 auto;
1352
+ /* Without it the grid's automatic minimum is its full-height rows, and
1353
+ nothing squeezes. */
1354
+ min-height: 0;
1355
+ /* The floor never exceeds the chosen height, so a host that set a row
1356
+ shorter than the floor still gets exactly its own height. */
1357
+ grid-auto-rows: minmax(
1358
+ min(var(--aia-date-row-min-height, 20px), var(--aia-date-row-height, 28px)),
1359
+ var(--aia-date-row-height, 28px)
1360
+ );
1361
+ }
1362
+
1240
1363
  .aia-weekday-3lF4B {
1241
1364
  padding: 2px 0;
1242
1365
  text-align: center;
@@ -1259,9 +1382,9 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
1259
1382
  items disagree, which makes it look like a column-count bug. The cell
1260
1383
  fills its track; the square is the number span inside it. */
1261
1384
  min-width: 0;
1262
- /* Keeps a month readable in a narrow dropdown without letting a 6-row month
1263
- grow the panel past the options grid it replaces. */
1264
- height: var(--aia-date-row-height, 28px);
1385
+ /* No height of its own: the cell fills its row, and the row's height is the
1386
+ grid's to give (see the weeks rule above), so a short window can squeeze
1387
+ the weeks instead of cutting the last one off. */
1265
1388
  font-family: inherit;
1266
1389
  font-size: var(--aia-date-cell-font-size, 13px);
1267
1390
  font-weight: 450;
@@ -1277,6 +1400,9 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
1277
1400
  justify-content: center;
1278
1401
  width: var(--aia-date-cell-size, 26px);
1279
1402
  height: var(--aia-date-cell-size, 26px);
1403
+ /* A squeezed row (see the weeks rule) is shorter than the square: it stays
1404
+ inside its own row rather than touching the week above and below. */
1405
+ max-height: 100%;
1280
1406
  border-radius: 6px;
1281
1407
  }
1282
1408
 
@@ -1325,7 +1451,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
1325
1451
  opacity: 0.8;
1326
1452
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1327
1453
  }
1328
- `,document.head.appendChild(e)}var D={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"};import{jsx as le,jsxs as Ot}from"react/jsx-runtime";var Sa=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Dt({options:e,activeIndex:n,listboxId:t,view:a,selection:i,onSelect:r,onHighlight:o,onUnhighlight:s,onPreviousMonth:h,onNextMonth:b}){let x=va(new Date),m=ya({pendingStart:i.rangeStart,highlightedIso:He(e[n]),selected:i.selectedRange});return Ot("div",{className:D.datepicker,"data-aia-datepicker":"",children:[Ot("div",{className:D.header,children:[le("button",{type:"button",tabIndex:-1,className:D.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:l=>l.preventDefault(),onClick:h,children:"\u2039"}),le("span",{className:D.month,"data-aia-date-month":"","aria-live":"polite",children:xa(a)}),le("button",{type:"button",tabIndex:-1,className:D.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:l=>l.preventDefault(),onClick:b,children:"\u203A"})]}),le("div",{className:D.weekdays,"aria-hidden":"true",children:ka.map((l,d)=>le("span",{className:D.weekday,children:l},Sa[d]))}),le("div",{className:D.grid,"data-aia-date-grid":"",children:e.map((l,d)=>le(Ta,{option:l,id:`${t}-option-${d}`,index:d,isHighlighted:d===n&&l.is_tappable,isToday:He(l)===x,isPast:He(l)!=null&&He(l)<x,marks:wa(He(l),{selectedIso:i.selectedIso,range:m}),onSelect:r,onHighlight:o,onUnhighlight:s},He(l)??`pad-${d}`))})]})}function Ta({option:e,id:n,index:t,isHighlighted:a,isToday:i,isPast:r,marks:o,onSelect:s,onHighlight:h,onUnhighlight:b}){let[x,m]=Ca(!1),l=ba(e);if(l==null)return le("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${D.cell} ${D.blank}`});let d=()=>{m(!0),s(e),setTimeout(()=>m(!1),170)},w=[D.cell,D.day,r?D.past:"",a?D.highlighted:"",i?D.today:"",o.inRange?D.inRange:"",o.selected?D.selected:"",x?D.pressed:""].filter(Boolean).join(" ");return le("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":a,"aria-label":e.text,tabIndex:0,className:w,onClick:d,onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),d())},onMouseEnter:()=>h(t),onMouseLeave:b?()=>b(t):void 0,children:le("span",{className:D.number,children:l})})}import{ATTRIBUTION_URL as Pa,buildAttributionUrl as Ia,getFooterHint as Ea,uiStringsFor as Aa}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ra,useState as Oa}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
1454
+ `,document.head.appendChild(e)}var W={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"};import{jsx as be,jsxs as Wt}from"react/jsx-runtime";var Na=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Gt({options:e,activeIndex:i,listboxId:t,view:a,selection:o,onSelect:r,onHighlight:n,onUnhighlight:s,onPreviousMonth:g,onNextMonth:v}){let x=Ra(new Date),u=Da({pendingStart:o.rangeStart,highlightedIso:Ve(e[i]),selected:o.selectedRange});return Wt("div",{className:W.datepicker,"data-aia-datepicker":"",children:[Wt("div",{className:W.header,children:[be("button",{type:"button",tabIndex:-1,className:W.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:d=>d.preventDefault(),onClick:g,children:"\u2039"}),be("span",{className:W.month,"data-aia-date-month":"","aria-live":"polite",children:Oa(a)}),be("button",{type:"button",tabIndex:-1,className:W.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:d=>d.preventDefault(),onClick:v,children:"\u203A"})]}),be("div",{className:W.weekdays,"aria-hidden":"true",children:Ma.map((d,c)=>be("span",{className:W.weekday,children:d},Na[c]))}),be("div",{className:W.grid,"data-aia-date-grid":"",children:e.map((d,c)=>be(Fa,{option:d,id:`${t}-option-${c}`,index:c,isHighlighted:c===i&&d.is_tappable,isToday:Ve(d)===x,isPast:Ve(d)!=null&&Ve(d)<x,marks:La(Ve(d),{selectedIso:o.selectedIso,range:u}),onSelect:r,onHighlight:n,onUnhighlight:s},Ve(d)??`pad-${c}`))})]})}function Fa({option:e,id:i,index:t,isHighlighted:a,isToday:o,isPast:r,marks:n,onSelect:s,onHighlight:g,onUnhighlight:v}){let[x,u]=za(!1),d=Aa(e);if(d==null)return be("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${W.cell} ${W.blank}`});let c=()=>{u(!0),s(e),setTimeout(()=>u(!1),170)},w=[W.cell,W.day,r?W.past:"",a?W.highlighted:"",o?W.today:"",n.inRange?W.inRange:"",n.selected?W.selected:"",x?W.pressed:""].filter(Boolean).join(" ");return be("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":a,"aria-label":e.text,tabIndex:0,className:w,onClick:c,onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),c())},onMouseEnter:()=>g(t),onMouseLeave:v?()=>v(t):void 0,children:be("span",{className:W.number,children:d})})}import{ATTRIBUTION_URL as Ha,buildAttributionUrl as Ba,getFooterHint as Wa,uiStringsFor as Ga}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ka,useState as qa}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
1329
1455
  display: flex;
1330
1456
  flex-wrap: wrap;
1331
1457
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1365,7 +1491,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
1365
1491
  .aia-cluster[data-justify="around"] {
1366
1492
  justify-content: space-around;
1367
1493
  }
1368
- `,document.head.appendChild(e)}import{jsx as Lt}from"react/jsx-runtime";function Qe({gap:e,align:n="center",justify:t="start",noWrap:a=!1,inline:i=!1,className:r,children:o,...s}){let h=e?{"--aia-cluster-gap":e}:void 0,b={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":n,"data-justify":t,"data-nowrap":a||void 0,"data-inline":i||void 0,style:h,...s};return i?Lt("span",{...b,children:o}):Lt("div",{...b,children:o})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
1494
+ `,document.head.appendChild(e)}import{jsx as Kt}from"react/jsx-runtime";function ot({gap:e,align:i="center",justify:t="start",noWrap:a=!1,inline:o=!1,className:r,children:n,...s}){let g=e?{"--aia-cluster-gap":e}:void 0,v={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":i,"data-justify":t,"data-nowrap":a||void 0,"data-inline":o||void 0,style:g,...s};return o?Kt("span",{...v,children:n}):Kt("div",{...v,children:n})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
1369
1495
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
1370
1496
  room above the hint/branding row so the footer doesn't butt against the last
1371
1497
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -1512,7 +1638,134 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
1512
1638
  justify-content: flex-end;
1513
1639
  }
1514
1640
  }
1515
- `,document.head.appendChild(e)}var me={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};import{jsx as $e,jsxs as ut}from"react/jsx-runtime";function Mt({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:t=Aa()}){let{key:a,hint:i}=Ea(e,n,t),[r,o]=Oa(Pa);return Ra(()=>{o(Ia())},[]),$e("footer",{className:me.footer,"data-aia-footer":"",children:ut(Qe,{justify:"between",noWrap:!0,className:me.row,children:[ut(Qe,{gap:"5px",className:me.hintGroup,children:[$e("kbd",{className:me.key,children:a}),$e("span",{className:me.hint,children:i})]}),ut("a",{className:me.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[$e("span",{className:me.brand,children:"AI"}),$e("span",{className:me.badge,children:"Autocomplete"})]})]})})}import{isSmartSuggestion as za,isTraditionalAutocompleteSuggestion as Na}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as Da}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
1641
+ `,document.head.appendChild(e)}var Se={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};import{jsx as nt,jsxs as vt}from"react/jsx-runtime";function qt({isOptionHighlighted:e=!1,isInputEmpty:i=!1,strings:t=Ga()}){let{key:a,hint:o}=Wa(e,i,t),[r,n]=qa(Ha);return Ka(()=>{n(Ba())},[]),nt("footer",{className:Se.footer,"data-aia-footer":"",children:vt(ot,{justify:"between",noWrap:!0,className:Se.row,children:[vt(ot,{gap:"5px",className:Se.hintGroup,children:[nt("kbd",{className:Se.key,children:a}),nt("span",{className:Se.hint,children:o})]}),vt("a",{className:Se.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[nt("span",{className:Se.brand,children:"AI"}),nt("span",{className:Se.badge,children:"Autocomplete"})]})]})})}import{useEffect as _t,useLayoutEffect as _a,useRef as se}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
1642
+ Angular copy). The three are kept identical by
1643
+ packages/vanilla/tests/render/locationFieldParity.test.ts. */
1644
+ .aia-location-6-fsr {
1645
+ display: flex;
1646
+ flex-direction: column;
1647
+ gap: 4px;
1648
+ padding: 6px 6px 4px;
1649
+ }
1650
+
1651
+ .aia-field-xEzwi {
1652
+ display: flex;
1653
+ align-items: center;
1654
+ gap: 8px;
1655
+ padding: 8px 10px;
1656
+ border-radius: var(--aia-location-field-radius, 10px);
1657
+ background: var(--aia-location-field-bg, rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06));
1658
+ color: var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));
1659
+ cursor: text;
1660
+ }
1661
+
1662
+ .aia-icon-czx6C {
1663
+ display: block;
1664
+ width: 15px;
1665
+ height: 15px;
1666
+ }
1667
+
1668
+ .aia-input-Yi9V- {
1669
+ flex: 1;
1670
+ min-width: 0;
1671
+ padding: 0;
1672
+ border: 0;
1673
+ outline: 0;
1674
+ background: transparent;
1675
+ font: inherit;
1676
+ /* Never under 16px: iOS Safari zooms the page into a smaller field it focuses. */
1677
+ font-size: max(16px, var(--aia-location-font-size, 15px));
1678
+ color: var(--aia-option-color-selected, var(--aia-color-text-default, #fff));
1679
+ }
1680
+
1681
+ .aia-input-Yi9V-::placeholder {
1682
+ color: var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));
1683
+ opacity: 0.7;
1684
+ }
1685
+
1686
+ .aia-results-C3O0V {
1687
+ display: flex;
1688
+ flex-direction: column;
1689
+ }
1690
+
1691
+ .aia-row-Q9y8g {
1692
+ display: flex;
1693
+ align-items: center;
1694
+ gap: 10px;
1695
+ padding: 8px 10px;
1696
+ border-radius: 8px;
1697
+ color: var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));
1698
+ cursor: pointer;
1699
+ }
1700
+
1701
+ .aia-row-Q9y8g:hover,
1702
+ .aia-highlighted-RJjPx {
1703
+ background: var(
1704
+ --aia-location-row-bg-highlighted,
1705
+ rgba(var(--aia-streak-rgb, 255, 255, 255), 0.08)
1706
+ );
1707
+ }
1708
+
1709
+ .aia-pin-OjabL {
1710
+ flex: 0 0 15px;
1711
+ }
1712
+
1713
+ .aia-text-Xs84O {
1714
+ display: flex;
1715
+ flex-direction: column;
1716
+ min-width: 0;
1717
+ }
1718
+
1719
+ .aia-name-Z-WJR {
1720
+ overflow: hidden;
1721
+ font-size: var(--aia-location-font-size, 15px);
1722
+ color: var(--aia-option-color-selected, var(--aia-color-text-default, #fff));
1723
+ text-overflow: ellipsis;
1724
+ white-space: nowrap;
1725
+ }
1726
+
1727
+ .aia-secondary-4sCT1 {
1728
+ overflow: hidden;
1729
+ font-size: 13px;
1730
+ text-overflow: ellipsis;
1731
+ white-space: nowrap;
1732
+ }
1733
+
1734
+ .aia-note-xCSvY {
1735
+ display: flex;
1736
+ flex-direction: column;
1737
+ gap: 2px;
1738
+ padding: 8px 10px;
1739
+ font-size: 13px;
1740
+ color: var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));
1741
+ }
1742
+
1743
+ .aia-empty-SYBzi {
1744
+ color: var(--aia-option-color-selected, var(--aia-color-text-default, #fff));
1745
+ }
1746
+
1747
+ .aia-loading-Ih1gi {
1748
+ display: flex;
1749
+ flex-direction: column;
1750
+ gap: 12px;
1751
+ padding: 10px;
1752
+ }
1753
+
1754
+ .aia-loadingBar-OLCr4 {
1755
+ width: 70%;
1756
+ height: 12px;
1757
+ border-radius: 6px;
1758
+ background: var(--aia-skeleton-bg, rgba(var(--aia-streak-rgb, 255, 255, 255), 0.08));
1759
+ }
1760
+
1761
+ .aia-loadingBar-OLCr4:nth-child(2) {
1762
+ width: 50%;
1763
+ }
1764
+
1765
+ .aia-loadingBar-OLCr4:nth-child(3) {
1766
+ width: 60%;
1767
+ }
1768
+ `,document.head.appendChild(e)}var G={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};import{jsx as te,jsxs as Oe}from"react/jsx-runtime";var Va=0;function rt(e){return e.getRootNode().activeElement??null}function Ut(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Ua(e){if(!e.isContentEditable)return null;let i=Ut(e);if(!i||i.rangeCount===0)return null;let t=i.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function Vt(e,i){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=Ut(e);if(!t)return;let a=i;(!a||!a.startContainer.isConnected||!e.contains(a.startContainer))&&(a=document.createRange(),a.selectNodeContents(e),a.collapse(!1)),t.removeAllRanges(),t.addRange(a)}var Qa=Oe("svg",{className:G.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[te("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),te("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Ya=Oe("svg",{className:G.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[te("circle",{cx:"11",cy:"11",r:"7"}),te("path",{d:"m20 20-3.5-3.5"})]});function Qt({view:e,searchLabel:i,noResultsLabel:t,useTypedLabel:a,widgetFocused:o,visible:r=!0,interactive:n=!0,onQuery:s,onMove:g,onCommit:v,onFocusChange:x}){let u=se(null),d=se(null),c=se(null),w=se(null),L=se(null),N=se(!1),D=se(!1),H=se(!1),q=se(o);q.current=o;let R=se(x);R.current=x;let I=p=>{H.current=p,x(p)},C=()=>{let p=u.current;return p!=null&&rt(p)===p},U=()=>{let p=d.current;if(!p)return;let E=rt(p);E instanceof HTMLElement&&E!==u.current&&E!==document.body&&!p.contains(E)&&(w.current=E,L.current=Ua(E))},Q=se(null);Q.current===null&&(Q.current=`aia-location-${++Va}`);let B=`${Q.current}-row-`;_t(()=>{let p=u.current;p&&p.value!==e.query&&rt(p)!==p&&(p.value=e.query)},[e.query]),_t(()=>{let p=u.current;if(p){if(!r&&C()){D.current=!0,F();return}if(!o){setTimeout(()=>{if(q.current)return;let E=w.current;E&&rt(E)===E||(D.current=!1)},0);return}if(!(D.current||!n||C())){if(U(),I(!0),p.focus({preventScroll:!0}),!C()){D.current=!0,I(!1);return}p.value&&p.select()}}}),_a(()=>()=>{if(!H.current)return;let p=u.current,E=w.current;E?.isConnected&&p&&rt(p)===p&&(N.current=!0,Vt(E,L.current),N.current=!1),H.current=!1,R.current(!1)},[]);let F=(p=!1)=>{p&&(D.current=!0);let E=w.current;E?.isConnected&&C()&&(N.current=!0,Vt(E,L.current),N.current=!1),I(!1)},ae=e.query.trim(),P=e.highlighted>=0&&e.highlighted<e.places.length?`${B}${e.highlighted}`:void 0,_=null;return e.places.length>0?_=e.places.map((p,E)=>Oe("div",{id:`${B}${E}`,role:"option","aria-selected":E===e.highlighted,className:E===e.highlighted?`${G.row} ${G.highlighted}`:G.row,"data-aia-location-row":"","data-aia-index":E,onClick:()=>{n&&(F(!0),v(E))},children:[te("span",{className:G.pin,children:Qa}),Oe("span",{className:G.text,children:[te("span",{className:G.name,children:p.name}),p.secondary&&te("span",{className:G.secondary,children:p.secondary})]})]},p.id)):e.status==="loading"?_=Oe("div",{className:G.loading,"data-aia-location-loading":"",children:[te("span",{className:G.loadingBar}),te("span",{className:G.loadingBar}),te("span",{className:G.loadingBar})]}):ae&&(_=Oe("div",{className:G.note,"data-aia-location-note":"",children:[e.status==="done"&&te("span",{className:G.empty,children:t}),te("span",{children:a})]})),Oe("div",{ref:d,className:G.location,"data-aia-location":"",onMouseDown:p=>{!(p.target instanceof Node)||!c.current?.contains(p.target)||(p.stopPropagation(),U(),I(!0))},children:[Oe("label",{ref:c,className:G.field,children:[Ya,te("input",{ref:u,type:"text",className:G.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:i,"aria-label":i,"aria-activedescendant":P,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:p=>s(p.target.value),onFocus:()=>I(!0),onBlur:()=>{N.current||(D.current=!0,I(!1))},onKeyDown:p=>{if(!p.nativeEvent.isComposing)switch(p.key){case"ArrowDown":case"ArrowUp":p.preventDefault(),g(p.key==="ArrowDown"?1:-1);return;case"Enter":if(p.preventDefault(),!n)return;F(!0),v();return;case"Escape":p.preventDefault(),p.stopPropagation(),D.current=!0,F();return;case"Backspace":if(p.currentTarget.value!=="")return;p.preventDefault(),D.current=!0,F();return}}})]}),te("div",{className:G.results,"data-aia-location-results":"","aria-live":"polite",children:_})]})}import{isSmartSuggestion as Xa,isTraditionalAutocompleteSuggestion as Ja}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as ja}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
1516
1769
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
1517
1770
  The border is kept as a 1px transparent line so the box stays the same size
1518
1771
  as it was when the outline was dashed. */
@@ -1692,7 +1945,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
1692
1945
  opacity: 0;
1693
1946
  }
1694
1947
  }
1695
- `,document.head.appendChild(e)}var de={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"};import{Fragment as La,jsx as mt,jsxs as Ma}from"react/jsx-runtime";var gt={selected:1,first:.7,next:.4,last:.2};function zt({label:e,state:n,rounded:t,loading:a,smartSuggestion:i,completionHeader:r,onClick:o}){let s=[de.pill,t?de.rounded:"",a?de.skeleton:""].filter(Boolean).join(" ");return mt("button",{type:"button","data-aia-pill":"","data-aia-loading":a?"":void 0,"data-aia-smart-suggestion":i?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:s,style:{opacity:gt[n]},onMouseDown:h=>h.preventDefault(),onClick:a?void 0:o,disabled:a,children:i?Ma(La,{children:[mt("span",{className:`${de.smartText} magicx-aia-smart-suggestion-text`,children:e}),mt("span",{className:`${de.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Da}})]}):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 {
1948
+ `,document.head.appendChild(e)}var we={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"};import{Fragment as $a,jsx as xt,jsxs as Za}from"react/jsx-runtime";var yt={selected:1,first:.7,next:.4,last:.2};function Yt({label:e,state:i,rounded:t,loading:a,smartSuggestion:o,completionHeader:r,onClick:n}){let s=[we.pill,t?we.rounded:"",a?we.skeleton:""].filter(Boolean).join(" ");return xt("button",{type:"button","data-aia-pill":"","data-aia-loading":a?"":void 0,"data-aia-smart-suggestion":o?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:s,style:{opacity:yt[i]},onMouseDown:g=>g.preventDefault(),onClick:a?void 0:n,disabled:a,children:o?Za($a,{children:[xt("span",{className:`${we.smartText} magicx-aia-smart-suggestion-text`,children:e}),xt("span",{className:`${we.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:ja}})]}):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 {
1696
1949
  position: relative;
1697
1950
  z-index: 1;
1698
1951
  pointer-events: auto;
@@ -1702,7 +1955,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
1702
1955
  align-items: center;
1703
1956
  vertical-align: middle;
1704
1957
  }
1705
- `,document.head.appendChild(e)}var ft={list:"aia-list-qvLqO"};import{jsx as at}from"react/jsx-runtime";var Ha=[125,69];function Nt(e){return e===0?"first":e===1?"next":"last"}function it({pills:e,activePillIndex:n,onSelectPill:t,activeSelected:a,rounded:i,loading:r}){return r&&e.length===0?at("span",{className:ft.list,"data-aia-pill-list-loading":"",children:Ha.map((o,s)=>at("span",{"data-aia-pill-skeleton":"",className:`${de.pill} ${i?de.rounded:""} ${de.skeleton}`,style:{width:o,opacity:gt[Nt(s)]}},`skel-${o}`))}):at("span",{className:ft.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((o,s)=>{let h=!!a&&s===n;return at(zt,{label:o.text,state:h?"selected":Nt(s),selected:h,rounded:i,loading:r,smartSuggestion:za(o),completionHeader:Na(o),onClick:()=>t(s)},`${o.parameter}-${o.text}`)})})}import{attachProductRowWheel as Fa,productImageSources as Ba,productImageSrc as Wa,productInitial as Ga,productPhotoFill as Ka,uiStringsFor as qa}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as bt,useRef as ot,useState as nt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
1958
+ `,document.head.appendChild(e)}var kt={list:"aia-list-qvLqO"};import{jsx as dt}from"react/jsx-runtime";var ei=[125,69];function jt(e){return e===0?"first":e===1?"next":"last"}function ct({pills:e,activePillIndex:i,onSelectPill:t,activeSelected:a,rounded:o,loading:r}){return r&&e.length===0?dt("span",{className:kt.list,"data-aia-pill-list-loading":"",children:ei.map((n,s)=>dt("span",{"data-aia-pill-skeleton":"",className:`${we.pill} ${o?we.rounded:""} ${we.skeleton}`,style:{width:n,opacity:yt[jt(s)]}},`skel-${n}`))}):dt("span",{className:kt.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((n,s)=>{let g=!!a&&s===i;return dt(Yt,{label:n.text,state:g?"selected":jt(s),selected:g,rounded:o,loading:r,smartSuggestion:Xa(n),completionHeader:Ja(n),onClick:()=>t(s)},`${n.parameter}-${n.text}`)})})}import{attachProductRowWheel as ti,productImageSources as ai,productImageSrc as ii,productInitial as oi,productPhotoFill as ni,uiStringsFor as ri}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ct,useRef as pt,useState as ht}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
1706
1959
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
1707
1960
  theming one package sees the same result in the other.
1708
1961
 
@@ -2038,12 +2291,8 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
2038
2291
  }
2039
2292
 
2040
2293
  /* While the integration's promise is in flight the button ignores presses
2041
- and shows a spinner (below); once it resolves the cart turns into a check,
2042
- which stays. */
2043
- .aia-cart-kSlqU[data-aia-cart-state="adding"] {
2044
- cursor: progress;
2045
- }
2046
-
2294
+ and shows a spinner (below) \u2014 the only cue: the pointer stays as it is.
2295
+ Once it resolves the cart turns into a check, which stays. */
2047
2296
  .aia-cart-kSlqU[data-aia-cart-state="added"] .aia-cartGlyph-cmqAk {
2048
2297
  display: none;
2049
2298
  }
@@ -2162,7 +2411,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
2162
2411
  .aia-section-Hugfg[data-aia-products-layout="list"] .aia-card-JBGYT[data-aia-product-has-cart] {
2163
2412
  padding-right: calc(var(--aia-product-cart-size, 28px) + 16px);
2164
2413
  }
2165
- `,document.head.appendChild(e)}var L={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"};import{jsx as W,jsxs as Fe}from"react/jsx-runtime";function Ht({products:e,listboxId:n,onSelect:t,onAddToCart:a,onFocusChange:i,focusable:r=!0,layout:o="row",imageFallback:s="image",strings:h=qa()}){let b=e.length>0,x=ot(null);if(bt(()=>{let l=x.current;if(!(!b||!l))return Fa(l)},[b]),!b)return null;let m=`${n}-products-label`;return Fe("section",{className:L.section,"data-aia-products":"","data-aia-products-layout":o,role:"group","aria-labelledby":m,children:[W("div",{className:L.label,id:m,"data-aia-products-label":"",children:h.products}),W("div",{ref:x,className:L.row,"data-aia-products-row":"",children:e.map((l,d)=>W(_a,{product:l,id:`${n}-product-${d}`,onSelect:t,onAddToCart:a,onFocusChange:i,focusable:r,imageFallback:s,soldOut:h.soldOut,addToCart:h.addToCart},l.id))})]})}function _a({product:e,id:n,onSelect:t,onAddToCart:a,onFocusChange:i,focusable:r,imageFallback:o,soldOut:s,addToCart:h}){let b=!!a&&e.available!==!1,[x,m]=nt(null),l=w=>{w.relatedTarget?.closest("[data-aia-dropdown]")||i?.(!1)},d=w=>{w.metaKey||w.ctrlKey||w.shiftKey||w.altKey||w.button!==0||(w.preventDefault(),t(e))};return Fe("a",{id:n,className:L.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":b?"":void 0,role:"option","aria-selected":!1,style:x?{"--aia-product-photo-fill-x":String(x.x),"--aia-product-photo-fill-y":String(x.y)}:void 0,href:e.url,tabIndex:r?0:-1,onClick:d,onKeyDown:w=>{w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),t(e))},onFocus:()=>i?.(!0),onBlur:l,children:[W(Ya,{sources:Ba(e.imageUrl),title:e.title,fallback:o,onPhotoFill:m},Wa(e.imageUrl)??""),Fe("span",{className:L.body,children:[e.vendor?W("span",{className:L.vendor,children:e.vendor}):null,W("span",{className:L.title,children:e.title}),e.price?Fe("span",{className:L.price,children:[e.price,e.compareAtPrice?W("s",{className:L.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?W("span",{className:L.badge,children:s}):null]}),b&&a?W(Va,{product:e,label:`${h}: ${e.title}`,focusable:r,onAddToCart:a,onFocus:()=>i?.(!0),onBlur:l},Ua(e)):null]})}function Ua(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(n=>n??"").join("\0")}function Va({product:e,label:n,focusable:t,onAddToCart:a,onFocus:i,onBlur:r}){let[o,s]=nt(null),h=ot(null),b=ot(e);b.current=e;let x=ot(!0);bt(()=>(x.current=!0,()=>{x.current=!1}),[]);let m=d=>{h.current=d,x.current&&s(d)},l=d=>{if(d.preventDefault(),d.stopPropagation(),h.current==="adding")return;m("adding");let w;try{w=Promise.resolve(a(b.current))}catch(I){w=Promise.reject(I)}w.then(()=>m("added"),()=>m(null))};return W("span",{className:L.cart,"data-aia-product-cart":"","data-aia-cart-state":o??void 0,"aria-busy":o==="adding"?!0:void 0,role:"button","aria-label":n,tabIndex:t?0:-1,onClick:l,onKeyDown:d=>{d.key!=="Enter"&&d.key!==" "||l(d)},onFocus:d=>{d.stopPropagation(),i()},onBlur:d=>{d.stopPropagation(),r(d)},children:Fe("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[W("path",{className:L.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"}),W("path",{className:L.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),W("path",{className:L.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),W("path",{className:L.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),W("circle",{className:L.cartGlyph,cx:"9",cy:"20",r:"1.3"}),W("circle",{className:L.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ya({sources:e,title:n,fallback:t,onPhotoFill:a}){let[i,r]=nt(0),o=e[i],s=!!o,[h,b]=nt(null),x=!s&&t==="initial";return bt(()=>()=>a(null),[a]),Fe("span",{className:L.media,"aria-hidden":"true","data-aia-product-placeholder":!s&&!x?"":void 0,"data-aia-product-initial":x?"":void 0,"data-aia-image-loaded":s&&h===o?"":void 0,children:[s?W("img",{className:L.image,src:o,alt:"",loading:"lazy",decoding:"async",onLoad:m=>{b(o),a(Ka(m.currentTarget.naturalWidth,m.currentTarget.naturalHeight))},onError:()=>{i+1>=e.length&&a(null),r(m=>m+1)}}):null,x?Ga(n):null]})}import{isOptionsGridMobileViewport as si,measureOptionsGrid as li,needsOptionsGridMeasurement as di,OPTIONS_GRID_MOBILE_QUERY as ci,optionEnterDelayMs as pi,optionsShowLeadingVisuals as hi,planOptionsGrid as Gt,sameOptionRows as ui}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as mi,useLayoutEffect as gi,useRef as Kt,useState as _t}from"react";import{optionsGridTemplateColumns as ja}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Qa,useRef as $a}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
2414
+ `,document.head.appendChild(e)}var K={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"};import{jsx as j,jsxs as Ue}from"react/jsx-runtime";function $t({products:e,listboxId:i,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r=!0,layout:n="row",imageFallback:s="image",strings:g=ri()}){let v=e.length>0,x=pt(null);if(Ct(()=>{let d=x.current;if(!(!v||!d))return ti(d)},[v]),!v)return null;let u=`${i}-products-label`;return Ue("section",{className:K.section,"data-aia-products":"","data-aia-products-layout":n,role:"group","aria-labelledby":u,children:[j("div",{className:K.label,id:u,"data-aia-products-label":"",children:g.products}),j("div",{ref:x,className:K.row,"data-aia-products-row":"",children:e.map((d,c)=>j(si,{product:d,id:`${i}-product-${c}`,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r,imageFallback:s,soldOut:g.soldOut,addToCart:g.addToCart},d.id))})]})}function si({product:e,id:i,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r,imageFallback:n,soldOut:s,addToCart:g}){let v=!!a&&e.available!==!1,[x,u]=ht(null),d=w=>{w.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},c=w=>{w.metaKey||w.ctrlKey||w.shiftKey||w.altKey||w.button!==0||(w.preventDefault(),t(e))};return Ue("a",{id:i,className:K.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:x?{"--aia-product-photo-fill-x":String(x.x),"--aia-product-photo-fill-y":String(x.y)}:void 0,href:e.url,tabIndex:r?0:-1,onClick:c,onKeyDown:w=>{w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:d,children:[j(ci,{sources:ai(e.imageUrl),title:e.title,fallback:n,onPhotoFill:u},ii(e.imageUrl)??""),Ue("span",{className:K.body,children:[e.vendor?j("span",{className:K.vendor,children:e.vendor}):null,j("span",{className:K.title,children:e.title}),e.price?Ue("span",{className:K.price,children:[e.price,e.compareAtPrice?j("s",{className:K.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?j("span",{className:K.badge,children:s}):null]}),v&&a?j(di,{product:e,label:`${g}: ${e.title}`,focusable:r,onAddToCart:a,onFocus:()=>o?.(!0),onBlur:d},li(e)):null]})}function li(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(i=>i??"").join("\0")}function di({product:e,label:i,focusable:t,onAddToCart:a,onFocus:o,onBlur:r}){let[n,s]=ht(null),g=pt(null),v=pt(e);v.current=e;let x=pt(!0);Ct(()=>(x.current=!0,()=>{x.current=!1}),[]);let u=c=>{g.current=c,x.current&&s(c)},d=c=>{if(c.preventDefault(),c.stopPropagation(),g.current==="adding")return;u("adding");let w;try{w=Promise.resolve(a(v.current))}catch(L){w=Promise.reject(L)}w.then(()=>u("added"),()=>u(null))};return j("span",{className:K.cart,"data-aia-product-cart":"","data-aia-cart-state":n??void 0,"aria-busy":n==="adding"?!0:void 0,role:"button","aria-label":i,tabIndex:t?0:-1,onClick:d,onKeyDown:c=>{c.key!=="Enter"&&c.key!==" "||d(c)},onFocus:c=>{c.stopPropagation(),o()},onBlur:c=>{c.stopPropagation(),r(c)},children:Ue("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[j("path",{className:K.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"}),j("path",{className:K.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),j("path",{className:K.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),j("path",{className:K.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),j("circle",{className:K.cartGlyph,cx:"9",cy:"20",r:"1.3"}),j("circle",{className:K.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function ci({sources:e,title:i,fallback:t,onPhotoFill:a}){let[o,r]=ht(0),n=e[o],s=!!n,[g,v]=ht(null),x=!s&&t==="initial";return Ct(()=>()=>a(null),[a]),Ue("span",{className:K.media,"aria-hidden":"true","data-aia-product-placeholder":!s&&!x?"":void 0,"data-aia-product-initial":x?"":void 0,"data-aia-image-loaded":s&&g===n?"":void 0,children:[s?j("img",{className:K.image,src:n,alt:"",loading:"lazy",decoding:"async",onLoad:u=>{v(n),a(ni(u.currentTarget.naturalWidth,u.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&a(null),r(u=>u+1)}}):null,x?oi(i):null]})}import{isOptionsGridMobileViewport as Ti,measureOptionsGrid as Pi,needsOptionsGridMeasurement as Ii,OPTIONS_GRID_MOBILE_QUERY as Ei,optionEnterDelayMs as Ai,optionsShowLeadingVisuals as Li,planOptionsGrid as ea,sameOptionRows as Ri}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Oi,useLayoutEffect as Di,useRef as ta,useState as ia}from"react";import{optionsGridTemplateColumns as pi}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as hi,useRef as ui}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
2166
2415
  display: grid;
2167
2416
  grid-template-columns: repeat(
2168
2417
  auto-fit,
@@ -2198,11 +2447,11 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
2198
2447
  .aia-grid[data-scroll]::-webkit-scrollbar {
2199
2448
  display: none;
2200
2449
  }
2201
- `,document.head.appendChild(e)}import{jsx as Za}from"react/jsx-runtime";function Ft({min:e="16rem",max:n,gap:t,scroll:a=!1,maxHeight:i,scrollResetKey:r,cols:o,template:s,innerRef:h,className:b,children:x,...m}){let l=$a(null);Qa(()=>{if(r===void 0)return;let w=l.current;w&&(w.scrollTop=0)},[r]);let d={"--aia-grid-min":e};return n&&(d["--aia-grid-max"]=n),t&&(d["--aia-grid-gap"]=t),i&&(d["--aia-grid-max-height"]=i),o&&(d.gridTemplateColumns=ja(o)),s&&(d.gridTemplateColumns=s),Za("div",{ref:w=>{l.current=w,h?.(w)},className:b?`aia-grid ${b}`:"aia-grid","data-scroll":a||void 0,style:d,...m,children:x})}import{formatOptionCount as Xa,highlightParts as Ja,OPTION_ENTER_DELAY_VAR as ei,optionImageSources as ti,optionLabel as Bt,sanitizeOptionIconSvg as ai}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ii,useMemo as oi,useRef as ni,useState as rt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
2450
+ `,document.head.appendChild(e)}import{jsx as mi}from"react/jsx-runtime";function Zt({min:e="16rem",max:i,gap:t,scroll:a=!1,maxHeight:o,scrollResetKey:r,cols:n,template:s,innerRef:g,className:v,children:x,...u}){let d=ui(null);hi(()=>{if(r===void 0)return;let w=d.current;w&&(w.scrollTop=0)},[r]);let c={"--aia-grid-min":e};return i&&(c["--aia-grid-max"]=i),t&&(c["--aia-grid-gap"]=t),o&&(c["--aia-grid-max-height"]=o),n&&(c.gridTemplateColumns=pi(n)),s&&(c.gridTemplateColumns=s),mi("div",{ref:w=>{d.current=w,g?.(w)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":a||void 0,style:c,...u,children:x})}import{formatOptionCount as gi,highlightParts as fi,isMultiSelectToggleTap as bi,OPTION_ENTER_DELAY_VAR as wi,optionImageSources as vi,optionLabel as Xt,sanitizeOptionIconSvg as xi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as yi,useMemo as ki,useRef as Ci,useState as ut}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
2202
2451
  position: relative;
2203
2452
  /* Clip, not visible: the entrance rise below runs on the inner content,
2204
2453
  and a transformed box extends its scroll container's scrollable area.
2205
- Unclipped, the rows rising 16px from below made the option grid overflow
2454
+ Unclipped, the rows rising 7px from below made the option grid overflow
2206
2455
  for the length of the entrance whenever nothing sat under the grid to
2207
2456
  absorb it (product strip, optionsPosition="above"), so a scrollbar
2208
2457
  flashed in and out and the columns shifted sideways by its width. The
@@ -2243,7 +2492,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
2243
2492
 
2244
2493
  @keyframes aia-riseIn-etXZT {
2245
2494
  from {
2246
- transform: translateY(16px);
2495
+ transform: translateY(7px);
2247
2496
  }
2248
2497
  }
2249
2498
 
@@ -2252,6 +2501,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
2252
2501
  .aia-content-T-Qba {
2253
2502
  animation-duration: 0s;
2254
2503
  animation-delay: 0s;
2504
+ transition-duration: 0s;
2255
2505
  }
2256
2506
  }
2257
2507
 
@@ -2267,8 +2517,8 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
2267
2517
  (see the row's own comment). The durations and distance mirror
2268
2518
  OPTION_ENTER_* in the core's derive/optionsEntrance.ts \u2014 change both together. */
2269
2519
  animation:
2270
- aia-riseIn-etXZT 280ms cubic-bezier(0.25, 0.46, 0.45, 0.94) both,
2271
- aia-fadeIn-I8u35 150ms ease-out both;
2520
+ aia-riseIn-etXZT 340ms cubic-bezier(0.2, 0.8, 0.2, 1) both,
2521
+ aia-fadeIn-I8u35 340ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
2272
2522
  animation-delay: var(--aia-option-enter-delay, 0ms);
2273
2523
  }
2274
2524
 
@@ -2284,12 +2534,31 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
2284
2534
  cursor: default;
2285
2535
  }
2286
2536
 
2287
- .aia-highlighted-Hb0SU {
2537
+ .aia-highlighted-Hb0SU,
2538
+ .aia-liveMatch--eYfs {
2288
2539
  color: var(--aia-option-color-selected, var(--aia-color-text-default, #fff));
2289
2540
  background: var(--aia-option-bg, transparent);
2290
2541
  font-weight: 500;
2291
2542
  }
2292
2543
 
2544
+ /* Live match: while a word is typed, the row it is spelling out lights up
2545
+ (the rule above) and every other row steps back, so the choice reads as
2546
+ locked in before the word is finished. The core marks the row
2547
+ (\`liveMatch\`). The step back is a filter on the inner content: on iOS a tap
2548
+ on a row whose own opacity is changing is dropped (lessons.md), and the
2549
+ content's entrance already owns its opacity. */
2550
+ .aia-item-d4vpD {
2551
+ transition: background-color 180ms ease;
2552
+ }
2553
+
2554
+ .aia-content-T-Qba {
2555
+ transition: filter 180ms ease;
2556
+ }
2557
+
2558
+ [role="listbox"]:has(.aia-liveMatch--eYfs) .aia-item-d4vpD:not(.aia-liveMatch--eYfs):not(.aia-highlighted-Hb0SU) .aia-content-T-Qba {
2559
+ filter: opacity(0.42);
2560
+ }
2561
+
2293
2562
  .aia-tag-e3Fwe {
2294
2563
  font-size: 11px;
2295
2564
  margin-left: 6px;
@@ -2663,10 +2932,27 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
2663
2932
  gap: 10px;
2664
2933
  }
2665
2934
 
2935
+ /* A checkbox row is a flex row, so its icon is a flex item beside the text,
2936
+ not an inline box hung in a left pad. Undo the hanging indent the icon rule
2937
+ sets: the pad would push the whole row right, and the negative indent,
2938
+ inherited by the text box, would pull the text back over the icon. The
2939
+ row's gap replaces the icon's own margin. */
2940
+ .aia-content-T-Qba:has(.aia-checkbox-KGRhg):has(.aia-icon-Qw938) {
2941
+ padding-left: 0;
2942
+ text-indent: 0;
2943
+ }
2944
+
2945
+ .aia-content-T-Qba:has(.aia-checkbox-KGRhg) .aia-icon-Qw938 {
2946
+ margin-right: 0;
2947
+ }
2948
+
2666
2949
  .aia-checkbox-KGRhg {
2667
2950
  display: inline-flex;
2668
2951
  align-items: center;
2669
2952
  justify-content: center;
2953
+ /* The mark is text centred in the box. An indent inherited from the row
2954
+ (an icon row hangs its text with one) would slide it out of the box. */
2955
+ text-indent: 0;
2670
2956
  flex: 0 0 18px;
2671
2957
  width: 18px;
2672
2958
  height: 18px;
@@ -2687,7 +2973,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
2687
2973
  .aia-item-d4vpD:has(.aia-checkbox-KGRhg[data-checked="true"]) {
2688
2974
  background: var(--aia-option-bg, transparent);
2689
2975
  }
2690
- `,document.head.appendChild(e)}var _={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",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"};import{Fragment as ri,jsx as ge,jsxs as wt}from"react/jsx-runtime";function Wt({option:e,isHighlighted:n,checked:t,onSelect:a,onHighlight:i,onUnhighlight:r,id:o,loading:s,showIcon:h=!0,showImage:b=!0,showCount:x=!0,scrollHint:m,enterDelayMs:l=0}){let[d]=rt(l),[w,I]=rt(!1),j=b?ti(e.image_url):[],H=j[0]??null,[K,U]=rt([]),P=j.find(E=>!K.includes(E))??null,[R,C]=rt(null),Q=oi(()=>!H&&h&&e.icon_svg?ai(e.icon_svg):null,[H,h,e.icon_svg]),F=x?Xa(e.item_count):null,B=ni(void 0);ii(()=>()=>clearTimeout(B.current),[]);let Z=()=>{s||!e.is_tappable||w&&t===void 0||(I(!0),a(e),clearTimeout(B.current),B.current=setTimeout(()=>I(!1),170))},ee=[_.item,n&&!s?_.highlighted:"",e.is_tappable?_.tappable:_.nonTappable,w?_.pressed:"",m?_.scrollHint:""].filter(Boolean).join(" ");return ge("div",{id:o,role:"option","data-aia-option":"","data-aia-loading":s?"":void 0,"data-aia-icon":Q&&e.icon?e.icon:void 0,"data-aia-image":H?"":void 0,"data-aia-item-count":F!==null?e.item_count:void 0,"aria-selected":t??n,className:ee,style:{[ei]:`${d}ms`},tabIndex:s||!e.is_tappable?-1:0,onClick:Z,onKeyDown:E=>{!s&&e.is_tappable&&(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),Z())},onMouseEnter:!s&&e.is_tappable?i:void 0,onMouseLeave:r,children:wt("span",{className:_.content,children:[t!==void 0&&ge("span",{className:_.checkbox,"aria-hidden":"true","data-checked":t,children:t?"\u2713":""}),H&&ge("span",{className:`${_.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":P!==null&&R===P?"":void 0,children:ge("img",{src:P??H,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:P===null,onLoad:()=>C(P),onError:()=>{P!==null&&U(E=>[...E,P])}})}),Q&&ge("span",{className:`${_.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:Q}}),wt("span",{className:_.text,children:[e.matchedText?Ja(Bt(e),e.matchedText).map((E,te)=>E.bold?ge("strong",{className:`${_.match} magicx-aia-option-match`,children:E.text},te):E.text):Bt(e),e.parameterLabel&&wt(ri,{children:[" ",ge("span",{className:`${_.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&ge("span",{className:_.tag,children:e.tag}),F!==null&&ge("span",{className:`${_.count} magicx-aia-option-count`,children:F})]})})}import{jsx as qt}from"react/jsx-runtime";function fi(){let[e,n]=_t(si);return mi(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(ci),a=()=>n(t.matches);return a(),t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[]),e}function Ut({options:e,activeIndex:n,picked:t,onSelect:a,onHighlight:i,onUnhighlight:r,listboxId:o,loading:s,groupKey:h="",optionsPosition:b="below",showIcons:x=!0,showImages:m=!0,showCounts:l=!0}){let d=fi(),w=Kt(null),[I,j]=_t(null),H=Kt(null);gi(()=>{if(s&&ui(H.current,e))return;H.current=s?null:e;let P=w.current,C=P&&!s&&di(e.length,d)?li(P):null;j(C?Gt(e.length,d,C.rowWidths,C.gridWidth):null)},[e,d,s]);let K=I??Gt(e.length,d,null,null),U=hi(e,x,m);return qt(Ft,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:h,template:K.template,maxHeight:K.maxHeight,innerRef:P=>{w.current=P},"data-aia-group":h,children:e.map((P,R)=>qt(Wt,{option:P,isHighlighted:R===n,checked:t?t.includes(P.text):void 0,onSelect:a,onHighlight:()=>i(R),onUnhighlight:r?()=>r(R):void 0,id:`${o}-option-${R}`,loading:s,showIcon:x&&U,showImage:m&&U,showCount:l,scrollHint:!s&&K.scrollHintIndices.includes(R),enterDelayMs:s?0:pi(R,K.cols,e.length,b)},`${h}\0${P.text}`))})}import{formatTime as bi,TIME_WHEEL_COLUMNS as wi,TIME_WHEEL_ROW_HEIGHT as vi,timeWheelIndex as Vt,timeWheelIndexFromScroll as xi,timeWheelRows as yi,withTimeWheelIndex as Yt}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as ki,useEffect as Ci,useLayoutEffect as Si,useRef as st}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
2976
+ `,document.head.appendChild(e)}var $={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",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"};import{Fragment as Si,jsx as Te,jsxs as St}from"react/jsx-runtime";function Jt({option:e,isHighlighted:i,checked:t,onSelect:a,onHighlight:o,onUnhighlight:r,id:n,loading:s,showIcon:g=!0,showImage:v=!0,showCount:x=!0,scrollHint:u,enterDelayMs:d=0}){let[c]=ut(d),[w,L]=ut(!1),N=v?vi(e.image_url):[],D=N[0]??null,[H,q]=ut([]),R=N.find(P=>!H.includes(P))??null,[I,C]=ut(null),U=ki(()=>!D&&g&&e.icon_svg?xi(e.icon_svg):null,[D,g,e.icon_svg]),Q=x?gi(e.item_count):null,B=Ci(void 0);yi(()=>()=>clearTimeout(B.current),[]);let F=P=>{if(s||!e.is_tappable||w&&t===void 0)return;L(!0);let _=P?.currentTarget;t!==void 0&&_!==void 0&&P!==void 0&&!bi(_,_.querySelector("[data-aia-checkbox]"),P)?a(e,{commit:!0}):a(e),clearTimeout(B.current),B.current=setTimeout(()=>L(!1),170)},ae=[$.item,i&&!s?$.highlighted:"",e.liveMatch&&!s?$.liveMatch:"",e.is_tappable?$.tappable:$.nonTappable,w?$.pressed:"",u?$.scrollHint:""].filter(Boolean).join(" ");return Te("div",{id:n,role:"option","data-aia-option":"","data-aia-loading":s?"":void 0,"data-aia-icon":U&&e.icon?e.icon:void 0,"data-aia-image":D?"":void 0,"data-aia-item-count":Q!==null?e.item_count:void 0,"aria-selected":t??i,className:ae,style:{[wi]:`${c}ms`},tabIndex:s||!e.is_tappable?-1:0,onClick:F,onKeyDown:P=>{!s&&e.is_tappable&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),F())},onMouseEnter:!s&&e.is_tappable?o:void 0,onMouseLeave:r,children:St("span",{className:$.content,children:[t!==void 0&&e.is_tappable&&Te("span",{className:$.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),D&&Te("span",{className:`${$.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":R!==null&&I===R?"":void 0,children:Te("img",{src:R??D,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:R===null,onLoad:()=>C(R),onError:()=>{R!==null&&q(P=>[...P,R])}})}),U&&Te("span",{className:`${$.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:U}}),St("span",{className:$.text,children:[e.matchedText?fi(Xt(e),e.matchedText).map((P,_)=>P.bold?Te("strong",{className:`${$.match} magicx-aia-option-match`,children:P.text},_):P.text):Xt(e),e.parameterLabel&&St(Si,{children:[" ",Te("span",{className:`${$.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&Te("span",{className:$.tag,children:e.tag}),Q!==null&&Te("span",{className:`${$.count} magicx-aia-option-count`,children:Q})]})})}import{jsx as aa}from"react/jsx-runtime";function Mi(){let[e,i]=ia(Ti);return Oi(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(Ei),a=()=>i(t.matches);return a(),t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[]),e}function oa({options:e,activeIndex:i,picked:t,onSelect:a,onHighlight:o,onUnhighlight:r,listboxId:n,loading:s,groupKey:g="",optionsPosition:v="below",showIcons:x=!0,showImages:u=!0,showCounts:d=!0}){let c=Mi(),w=ta(null),[L,N]=ia(null),D=ta(null);Di(()=>{if(s&&Ri(D.current,e))return;D.current=s?null:e;let R=w.current,C=R&&!s&&Ii(e.length,c)?Pi(R):null;N(C?ea(e.length,c,C.rowWidths,C.gridWidth):null)},[e,c,s]);let H=L??ea(e.length,c,null,null),q=Li(e,x,u);return aa(Zt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:g,template:H.template,maxHeight:H.maxHeight,innerRef:R=>{w.current=R},"data-aia-group":g,children:e.map((R,I)=>aa(Jt,{option:R,isHighlighted:I===i,checked:t?t.includes(R.text):void 0,onSelect:a,onHighlight:()=>o(I),onUnhighlight:r?()=>r(I):void 0,id:`${n}-option-${I}`,loading:s,showIcon:x&&q,showImage:u&&q,showCount:d,scrollHint:!s&&H.scrollHintIndices.includes(I),enterDelayMs:s?0:Ai(I,H.cols,e.length,v)},`${g}\0${R.text}`))})}import{formatTime as zi,TIME_WHEEL_COLUMNS as Ni,TIME_WHEEL_ROW_HEIGHT as Fi,timeWheelIndex as na,timeWheelIndexFromScroll as Hi,timeWheelRows as Bi,withTimeWheelIndex as ra}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as Wi,useEffect as Gi,useLayoutEffect as Ki,useRef as mt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
2691
2977
 
2692
2978
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
2693
2979
  time-wheel.component.css). Only the class-naming layer differs \u2014 the
@@ -2812,7 +3098,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
2812
3098
  .aia-done-llNY5:hover {
2813
3099
  background: var(--aia-time-done-bg-hover, rgba(var(--aia-streak-rgb, 255, 255, 255), 0.16));
2814
3100
  }
2815
- `,document.head.appendChild(e)}var oe={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};import{jsx as Le,jsxs as vt}from"react/jsx-runtime";var Ti=120;function jt({view:e,label:n,doneLabel:t,interactive:a=!0,onTimeChange:i,onTimeCommit:r}){return vt("div",{className:oe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":n,onMouseDown:o=>o.preventDefault(),children:[Le("span",{className:oe.value,"data-aia-time-value":"","aria-live":"polite",children:bi(e.minutes)}),vt("div",{className:oe.columns,"aria-hidden":"true",children:[Le("div",{className:oe.band}),wi.map(o=>vt(ki,{children:[o==="minute"&&Le("span",{className:oe.separator,children:":"}),Le(Pi,{column:o,minutes:e.minutes,interactive:a,onTimeChange:i})]},o))]}),Le("button",{type:"button",tabIndex:-1,className:oe.done,"data-aia-time-done":"",onClick:()=>{a&&r()},children:t})]})}function Pi({column:e,minutes:n,interactive:t,onTimeChange:a}){let i=st(null),r=st(null),o=st(null),s=st({minutes:n,interactive:t,onTimeChange:a});s.current={minutes:n,interactive:t,onTimeChange:a};let h=Vt(e,n);Si(()=>{let m=i.current;if(!m||o.current)return;let l=h*vi;Math.abs(m.scrollTop-l)<1||(r.current=l,m.scrollTop=l)},[h]),Ci(()=>()=>{o.current&&clearTimeout(o.current)},[]);let b=()=>{o.current=null;let m=i.current,l=s.current;if(!m||!l.interactive)return;let d=xi(e,m.scrollTop);d!==Vt(e,l.minutes)&&l.onTimeChange(Yt(e,l.minutes,d))},x=()=>{let m=i.current;if(m){if(r.current!=null&&Math.abs(m.scrollTop-r.current)<1){r.current=null;return}r.current=null,o.current&&clearTimeout(o.current),o.current=setTimeout(b,Ti)}};return Le("div",{ref:i,className:oe.column,"data-aia-time-column":e,onScroll:x,children:yi(e).map((m,l)=>Le("div",{className:l===h?`${oe.row} ${oe.selected}`:oe.row,"data-aia-time-row":"","data-aia-index":l,onClick:()=>{s.current.interactive&&a(Yt(e,s.current.minutes,l))},children:m.label},m.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
3101
+ `,document.head.appendChild(e)}var le={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};import{jsx as Be,jsxs as Tt}from"react/jsx-runtime";var qi=120;function sa({view:e,label:i,doneLabel:t,interactive:a=!0,onTimeChange:o,onTimeCommit:r}){return Tt("div",{className:le.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":i,onMouseDown:n=>n.preventDefault(),children:[Be("span",{className:le.value,"data-aia-time-value":"","aria-live":"polite",children:zi(e.minutes)}),Tt("div",{className:le.columns,"aria-hidden":"true",children:[Be("div",{className:le.band}),Ni.map(n=>Tt(Wi,{children:[n==="minute"&&Be("span",{className:le.separator,children:":"}),Be(_i,{column:n,minutes:e.minutes,interactive:a,onTimeChange:o})]},n))]}),Be("button",{type:"button",tabIndex:-1,className:le.done,"data-aia-time-done":"",onClick:()=>{a&&r()},children:t})]})}function _i({column:e,minutes:i,interactive:t,onTimeChange:a}){let o=mt(null),r=mt(null),n=mt(null),s=mt({minutes:i,interactive:t,onTimeChange:a});s.current={minutes:i,interactive:t,onTimeChange:a};let g=na(e,i);Ki(()=>{let u=o.current;if(!u||n.current)return;let d=g*Fi;Math.abs(u.scrollTop-d)<1||(r.current=d,u.scrollTop=d)},[g]),Gi(()=>()=>{n.current&&clearTimeout(n.current)},[]);let v=()=>{n.current=null;let u=o.current,d=s.current;if(!u||!d.interactive)return;let c=Hi(e,u.scrollTop);c!==na(e,d.minutes)&&d.onTimeChange(ra(e,d.minutes,c))},x=()=>{let u=o.current;if(u){if(r.current!=null&&Math.abs(u.scrollTop-r.current)<1){r.current=null;return}r.current=null,n.current&&clearTimeout(n.current),n.current=setTimeout(v,qi)}};return Be("div",{ref:o,className:le.column,"data-aia-time-column":e,onScroll:x,children:Bi(e).map((u,d)=>Be("div",{className:d===g?`${le.row} ${le.selected}`:le.row,"data-aia-time-row":"","data-aia-index":d,onClick:()=>{s.current.interactive&&a(ra(e,s.current.minutes,d))},children:u.label},u.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
2816
3102
  display: flex;
2817
3103
  flex-direction: column;
2818
3104
  gap: var(--aia-stack-space, 0.5rem);
@@ -2827,7 +3113,7 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
2827
3113
  align-items: end;
2828
3114
  }
2829
3115
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
2830
- `,document.head.appendChild(e)}import{jsx as Ii}from"react/jsx-runtime";function Qt({space:e,align:n="stretch",className:t,children:a,...i}){let r=e?{"--aia-stack-space":e}:void 0;return Ii("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":n,style:r,...i,children:a})}import{jsx as Y,jsxs as xt}from"react/jsx-runtime";var Ni=[159,119,164],Hi=()=>{},$t=()=>{},Fi=e=>{},Bi=()=>{};function Wi(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,a]=zi(n);if(We(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let i=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>a(i.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Gi(e,n){let t=Be(null);We(()=>{let a=e.current,i=n.current;if(!a||!i)return;let r=a.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==r&&(t.current.controller.destroy(),t.current=null),r&&!t.current){t.current={grid:r,controller:Ei({dropdown:a,grid:r,button:i})};return}t.current?.controller.update()}),We(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ki(e,n){let t=Be(n);t.current=n;let a=Be(null);We(()=>{let i=e.current;if(i){if(!a.current){a.current=Ai({dropdown:i,isOpen:()=>t.current});return}a.current.update()}}),We(()=>()=>{a.current?.destroy(),a.current=null},[])}function yt({suggestions:e,activeIndex:n,onSelect:t,onHighlight:a,onUnhighlight:i,isOpen:r,id:o,className:s,pills:h,onPillClick:b,showPills:x=!0,onSkip:m,showSkipButton:l=!0,showOptionIcons:d=!0,showOptionImages:w=!0,showOptionCounts:I=!0,skipDisabled:j=!1,activeSelected:H=!1,isLoading:K=!1,skeletonExiting:U=!1,isInputEmpty:P=!1,language:R,products:C,onProductSelect:Q,onProductAddToCart:F,onProductFocusChange:B,productsLayout:Z="row",productImageFallback:ee="image",formatType:E="options",dateView:te=null,selectedDateIso:fe=null,selectedDateRange:ce=null,dateRangeStart:Ie=null,onPreviousMonth:be,onNextMonth:g,timeView:we=null,multiSelectView:ve=null,onMultiSelectCommit:xe,onTimeChange:ye,onTimeCommit:ke,optionsPosition:u="below",mode:y}){let k=Wi(y),T=k!==void 0,S=Be(null),M=Be(null);Gi(S,M),We(()=>{if(S.current)return Ri(S.current)},[]);let X=e[0]?.options??[],V=!!(h&&h.length>0&&b),Ce=!!(C&&C.length>0),Ee=E==="time"&&we!=null,re=r&&(X.length>0||x&&V||K||Ce||Ee);Ki(S,re);let pe={suggestions:e,activeIndex:n,pills:h,showPills:x,showSkipButton:l,showOptionIcons:d,showOptionImages:w,showOptionCounts:I,skipDisabled:j,activeSelected:H,isLoading:K,skeletonExiting:U,isInputEmpty:P,products:C,formatType:E,dateView:te,selectedDateIso:fe,selectedDateRange:ce,dateRangeStart:Ie,timeView:we,multiSelectView:ve},Se=Be(pe);re&&(Se.current=pe);let p=re?pe:Se.current,q=Mi(R),J=p.suggestions[0],ae=J?.options??[],Ae=p.activeIndex>=0&&!!ae[p.activeIndex]?.is_tappable,v=Li(p.pills??[],q.keepTyping),Re=!!(v.length>0&&b),_e=p.showPills&&Re,he=p.showPills&&!Re&&p.isLoading,f=_e||he,Te=Re&&Oi(v)&&p.showSkipButton&&!p.isInputEmpty&&!!m,Me=v[0]?.text,Pe=Di(p.formatType)&&p.dateView!=null,ze=ae.length>0&&!Pe,Ne=ae.length>0&&Pe&&!p.isLoading,ue=p.formatType==="time"&&p.timeView!=null&&!p.isLoading,Ue=p.isLoading&&!ze&&!Ne&&!ue,ie=p.products??[];return xt("div",{ref:S,id:o,role:"listbox","aria-multiselectable":!!p.multiSelectView,"data-aia-dropdown":"","data-options-position":u,"data-mode":k,"data-aia-loading":p.isLoading?"":void 0,"data-aia-skeleton-exiting":p.skeletonExiting?"":void 0,"data-aia-has-products":ie.length>0?"":void 0,className:`${T?"magicx-aia ":""}${se.dropdown} ${re?se.visible:""} ${s??""}`,onMouseDown:z=>z.preventDefault(),children:[xt(Qt,{space:"8px",children:[(f||Te)&&xt(Qe,{noWrap:!0,className:se.pillBar,"data-aia-pillbar":"",children:[f&&Y("span",{className:se.pillScroll,"data-aia-pill-scroll":"",children:Y(it,{pills:v,activePillIndex:0,activeSelected:p.activeSelected,onSelectPill:b??(()=>{}),rounded:!0,loading:p.isLoading})}),Te&&Y("button",{type:"button",tabIndex:-1,className:se.skip,"data-aia-skip":"",disabled:p.isLoading||p.skipDisabled,"aria-label":Me?`${q.skipLabel} ${Me}`:q.skipLabel,onClick:m,children:q.skip})]}),ze&&Y(Ut,{options:ae,activeIndex:p.activeIndex,onSelect:t,onHighlight:a,onUnhighlight:i,listboxId:o,loading:p.isLoading,groupKey:J?`${J.parameter} ${J.text}`:"",optionsPosition:u,showIcons:p.showOptionIcons,showImages:p.showOptionImages,showCounts:p.showOptionCounts,picked:p.isLoading?void 0:p.multiSelectView?.picked}),p.multiSelectView&&!p.isLoading&&Y("div",{onClick:z=>{z.target.closest("[data-aia-multi-done]")&&!p.skipDisabled&&xe?.()},children:Y("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:se.multiDone,ref:z=>{z&&(z.disabled=!0,z.offsetHeight,z.disabled=p.skipDisabled)},children:q.done})}),Ne&&p.dateView&&Y(Dt,{options:ae,activeIndex:p.activeIndex,listboxId:o,view:p.dateView,selection:{selectedIso:p.selectedDateIso??null,selectedRange:p.selectedDateRange??null,rangeStart:p.dateRangeStart??null},onSelect:t,onHighlight:a,onUnhighlight:i,onPreviousMonth:be??$t,onNextMonth:g??$t}),ue&&p.timeView&&Y(jt,{view:p.timeView,label:q.timeLabel,doneLabel:q.done,interactive:!p.skipDisabled,onTimeChange:ye??Fi,onTimeCommit:ke??Bi}),Ue&&Y("div",{className:se.skeletonBars,"data-aia-skeleton-bars":"",children:Ni.map(z=>Y("span",{className:se.skeletonBar,style:{width:z}},`bar-${z}`))}),Y(Ht,{products:ie,listboxId:o,onSelect:Q??Hi,onAddToCart:F,onFocusChange:B,focusable:re,layout:Z,imageFallback:ee,strings:q}),Y(Mt,{isOptionHighlighted:Ae,isInputEmpty:p.isInputEmpty,strings:q})]}),Y("button",{ref:M,type:"button",tabIndex:-1,className:se.scrollArrow,"data-aia-scroll-arrow":"","aria-label":q.scrollArrow,"aria-hidden":"true",children:Y("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:Y("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as io,ModeController as oo,setCursorOffset as no,uiStringsFor as ro}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as qi}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
3116
+ `,document.head.appendChild(e)}import{jsx as Vi}from"react/jsx-runtime";function la({space:e,align:i="stretch",className:t,children:a,...o}){let r=e?{"--aia-stack-space":e}:void 0;return Vi("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":i,style:r,...o,children:a})}import{jsx as X,jsxs as Pt}from"react/jsx-runtime";var eo=[159,119,164],to=()=>{},da=()=>{},ao=e=>{},io=()=>{},oo=e=>{},no=e=>{},ro=e=>{},so=e=>{};function lo(e){let i=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,a]=Ji(i);if(Ye(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>a(o.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function co(e,i){let t=Qe(null);Ye(()=>{let a=e.current,o=i.current;if(!a||!o)return;let r=a.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==r&&(t.current.controller.destroy(),t.current=null),r&&!t.current){t.current={grid:r,controller:Ui({dropdown:a,grid:r,button:o})};return}t.current?.controller.update()}),Ye(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function po(e,i){let t=Qe(i);t.current=i;let a=Qe(null);Ye(()=>{let o=e.current;if(o){if(!a.current){a.current=Qi({dropdown:o,isOpen:()=>t.current});return}a.current.update()}}),Ye(()=>()=>{a.current?.destroy(),a.current=null},[])}function It({suggestions:e,activeIndex:i,onSelect:t,onHighlight:a,onUnhighlight:o,isOpen:r,id:n,className:s,pills:g,onPillClick:v,showPills:x=!0,onSkip:u,showSkipButton:d=!0,showOptionIcons:c=!0,showOptionImages:w=!0,showOptionCounts:L=!0,skipDisabled:N=!1,activeSelected:D=!1,isLoading:H=!1,skeletonExiting:q=!1,isInputEmpty:R=!1,language:I,products:C,onProductSelect:U,onProductAddToCart:Q,onProductFocusChange:B,productsLayout:F="row",productImageFallback:ae="image",formatType:P="options",dateView:_=null,selectedDateIso:p=null,selectedDateRange:E=null,dateRangeStart:ve=null,onPreviousMonth:De,onNextMonth:Pe,timeView:f=null,multiSelectView:Me=null,onMultiSelectCommit:Ie,onTimeChange:Ee,onTimeCommit:Ae,locationView:b=null,onLocationQuery:k,onLocationMove:S,onLocationCommit:A,onLocationFocusChange:O,isFocused:V=!1,optionsPosition:ie="below",mode:oe}){let ce=lo(oe),pe=ce!==void 0,ne=Qe(null),ze=Qe(null);co(ne,ze),Ye(()=>{if(ne.current)return Yi(ne.current)},[]);let Je=e[0]?.options??[],xe=!!(g&&g.length>0&&v),Ne=!!(C&&C.length>0),We=P==="time"&&f!=null,ye=P==="location"&&b!=null,J=r&&(Je.length>0||x&&xe||H||Ne||We||ye);po(ne,J);let he={suggestions:e,activeIndex:i,pills:g,showPills:x,showSkipButton:d,showOptionIcons:c,showOptionImages:w,showOptionCounts:L,skipDisabled:N,activeSelected:D,isLoading:H,skeletonExiting:q,isInputEmpty:R,products:C,formatType:P,dateView:_,selectedDateIso:p,selectedDateRange:E,dateRangeStart:ve,timeView:f,multiSelectView:Me,locationView:b},y=Qe(he);J&&(y.current=he);let h=J?he:y.current,Y=Xi(I),ue=h.suggestions[0],m=ue?.options??[],Ge=h.activeIndex>=0&&!!m[h.activeIndex]?.is_tappable,ke=Zi(h.pills??[],Y.keepTyping),me=!!(ke.length>0&&v),et=h.showPills&&me,tt=h.showPills&&!me&&h.isLoading,Ce=et||tt,Ke=me&&ji(ke)&&h.showSkipButton&&!h.isInputEmpty&&!!u,re=ke[0]?.text,ge=$i(h.formatType)&&h.dateView!=null,Le=m.length>0&&!ge,Fe=m.length>0&&ge&&!h.isLoading,qe=h.formatType==="time"&&h.timeView!=null&&!h.isLoading,Re=h.formatType==="location"&&h.locationView!=null&&!h.isLoading,_e=h.isLoading&&!Le&&!Fe&&!qe&&!Re,l=h.products??[];return Pt("div",{ref:ne,id:n,role:"listbox","aria-multiselectable":!!h.multiSelectView,"data-aia-dropdown":"","data-options-position":ie,"data-mode":ce,"data-aia-loading":h.isLoading?"":void 0,"data-aia-skeleton-exiting":h.skeletonExiting?"":void 0,"data-aia-has-products":l.length>0?"":void 0,className:`${pe?"magicx-aia ":""}${fe.dropdown} ${J?fe.visible:""} ${s??""}`,onMouseDown:T=>T.preventDefault(),children:[Pt(la,{space:"8px",children:[(Ce||Ke)&&Pt(ot,{noWrap:!0,className:fe.pillBar,"data-aia-pillbar":"",children:[Ce&&X("span",{className:fe.pillScroll,"data-aia-pill-scroll":"",children:X(ct,{pills:ke,activePillIndex:0,activeSelected:h.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:h.isLoading})}),Ke&&X("button",{type:"button",tabIndex:-1,className:fe.skip,"data-aia-skip":"",disabled:h.isLoading||h.skipDisabled,"aria-label":re?`${Y.skipLabel} ${re}`:Y.skipLabel,onClick:u,children:Y.skip})]}),Le&&X(oa,{options:m,activeIndex:h.activeIndex,onSelect:t,onHighlight:a,onUnhighlight:o,listboxId:n,loading:h.isLoading,groupKey:ue?`${ue.parameter} ${ue.text}`:"",optionsPosition:ie,showIcons:h.showOptionIcons,showImages:h.showOptionImages,showCounts:h.showOptionCounts,picked:h.isLoading?void 0:h.multiSelectView?.picked}),h.multiSelectView&&!h.isLoading&&X("div",{onClick:T=>{T.target.closest("[data-aia-multi-done]")&&!h.skipDisabled&&Ie?.()},children:X("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:fe.multiDone,ref:T=>{T&&(T.disabled=!0,T.offsetHeight,T.disabled=h.skipDisabled)},children:Y.done})}),Fe&&h.dateView&&X(Gt,{options:m,activeIndex:h.activeIndex,listboxId:n,view:h.dateView,selection:{selectedIso:h.selectedDateIso??null,selectedRange:h.selectedDateRange??null,rangeStart:h.dateRangeStart??null},onSelect:t,onHighlight:a,onUnhighlight:o,onPreviousMonth:De??da,onNextMonth:Pe??da}),qe&&h.timeView&&X(sa,{view:h.timeView,label:Y.timeLabel,doneLabel:Y.done,interactive:!h.skipDisabled,onTimeChange:Ee??ao,onTimeCommit:Ae??io}),Re&&h.locationView&&X(Qt,{view:h.locationView,searchLabel:Y.locationSearch,noResultsLabel:Y.locationNoResults,useTypedLabel:Y.locationUseTyped,widgetFocused:V&&J,visible:J,interactive:!h.skipDisabled,onQuery:k??oo,onMove:S??no,onCommit:A??ro,onFocusChange:O??so}),_e&&X("div",{className:fe.skeletonBars,"data-aia-skeleton-bars":"",children:eo.map(T=>X("span",{className:fe.skeletonBar,style:{width:T}},`bar-${T}`))}),X($t,{products:l,listboxId:n,onSelect:U??to,onAddToCart:Q,onFocusChange:B,focusable:J,layout:F,imageFallback:ae,strings:Y}),X(qt,{isOptionHighlighted:Ge,isInputEmpty:h.isInputEmpty,strings:Y})]}),X("button",{ref:ze,type:"button",tabIndex:-1,className:fe.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Y.scrollArrow,"aria-hidden":"true",children:X("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:X("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Po,ModeController as Io,setCursorOffset as Eo,uiStringsFor as Ao,watchEditorHeight as Lo}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as ho}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
2831
3117
  flex-shrink: 0;
2832
3118
  width: 32px;
2833
3119
  height: 32px;
@@ -2840,7 +3126,10 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
2840
3126
  align-items: center;
2841
3127
  justify-content: center;
2842
3128
  padding: 0;
2843
- transition: opacity 0.2s ease;
3129
+ transition:
3130
+ opacity 0.2s ease,
3131
+ background-color 250ms ease,
3132
+ transform 250ms ease;
2844
3133
  }
2845
3134
 
2846
3135
  /* Size and paint by class as well as by attribute: a presentation attribute
@@ -2880,5 +3169,20 @@ import{buildSubmitResult as cr,cellDay as pr,cellIso as hr,DATE_RANGE_META_END a
2880
3169
  );
2881
3170
  cursor: default;
2882
3171
  }
2883
- `,document.head.appendChild(e)}var Zt={submitButton:"aia-submitButton-otz7H"};import{jsx as kt}from"react/jsx-runtime";function Xt({disabled:e,onClick:n,label:t=qi().submit}){return kt("button",{type:"button","data-aia-submit":"",className:Zt.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),n()},"aria-label":t,children:kt("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:kt("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as _i,dateSelectionFor as Ui,identifiedParamLabel as Vi,withoutTraditionalAutocomplete as Yi}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ia,useEffect as Ge,useRef as G,useState as ji}from"react";import{useRef as Jt}from"react";function ea(e){let n=Jt(e);n.current=e;let t=Object.keys(e??{}).sort().join("\0"),a=Jt({key:"",overrides:void 0});if(a.current.key!==t){let i={};for(let r of Object.keys(e??{})){let o=(s,h,b)=>{let x=n.current?.[r];return x?x(s,h,b):[]};i[r]=o}a.current={key:t,overrides:e?i:void 0}}return{overrides:a.current.overrides,key:t}}import{useRef as ta}from"react";function aa(e){let n=ta(e);n.current=e;let t=ta(null);t.current===null&&(t.current={fetch:(i,r)=>{let o=n.current;return o?o.fetch(i,r):Promise.reject(new Error("products config removed"))},transform:i=>n.current?.transform(i)??[],get limit(){return n.current?.limit}});let a=e!==void 0;return{config:a?t.current:void 0,enabled:a}}var oa={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,timeView:null,multiSelectView:null,multiSelectDraft:null,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Ct({onSubmit:e,onResult:n,onError:t,optionOverrides:a,maskCompletedText:i,apiConfig:r,additionalContext:o,language:s,currency:h,productId:b,visitorId:x,columns:m=2,dropdownTrigger:l,optionsPosition:d,closeDropdownOnBlur:w,showNonTappableOptions:I,showOptionIcons:j,showOptionImages:H,showOptionCounts:K,showSkipButton:U,showProducts:P,productImageFallback:R="image",onFocus:C,onBlur:Q,value:F,completedParams:B,onChange:Z,onParamsChange:ee,products:E,mapProducts:te,onProductSelect:fe,onProductAddToCart:ce,source:Ie,setCursor:be}){let g=G(null),[we,ve]=ji(null),xe=G(e);xe.current=e;let ye=G(n);ye.current=n;let ke=G(t);ke.current=t;let u=G(Z);u.current=Z;let y=G(ee);y.current=ee;let k=G(C);k.current=C;let T=G(Q);T.current=Q;let S=G(be);S.current=be;let M=G(fe);M.current=fe;let X=G(ce);X.current=ce;let V=G(x);V.current=x;let Ce=G(()=>{let c=V.current;return typeof c=="function"?c():c}).current,Ee=aa(E),re=G(te);re.current=te;let pe=G((c,N)=>{let A=re.current;return A?A(c,N):c}).current,Se=te?pe:void 0,p=ea(a);Ge(()=>{if(typeof document>"u")return;let c=new _i(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:o,language:s,currency:h,productId:b,visitorId:Ce,optionOverrides:p.overrides,maskCompletedText:i,columns:m,dropdownTrigger:l,optionsPosition:d,closeDropdownOnBlur:w,showNonTappableOptions:I,showProducts:P,source:Ie,value:F,completedParams:B,onSubmit:(...A)=>xe.current?.(...A),onResult:(...A)=>ye.current?.(...A),onError:(...A)=>ke.current?.(...A),onChange:(...A)=>u.current?.(...A),onParamsChange:(...A)=>y.current?.(...A),onFocus:()=>k.current?.(),onBlur:()=>T.current?.(),onProductSelect:A=>M.current?.(A),onProductAddToCart:A=>X.current?.(A),setCursor:A=>S.current?.(A),products:Ee.config,mapProducts:Se});g.current=c,ve(c.getState());let N=c.subscribe(A=>ve(A));return()=>{N(),c.destroy(),g.current===c&&(g.current=null)}},[]),Ge(()=>{F!==void 0&&g.current?.setValue(F)},[F]),Ge(()=>{B!==void 0&&g.current?.setCompletedParams(B)},[B]);let q=JSON.stringify(r??null),J;try{J=JSON.stringify(o??null)}catch{J="[unstringifiable]"}Ge(()=>{g.current?.update({apiConfig:r,additionalContext:o,language:s,currency:h,productId:b,optionOverrides:p.overrides,dropdownTrigger:l,optionsPosition:d,closeDropdownOnBlur:w,showNonTappableOptions:I,showProducts:P})},[q,J,s,h?.code,h?.rate,h?.country,b,p.key,l,d,w,I,P]);let ae=G(!1);Ge(()=>{if(!ae.current){ae.current=!0;return}g.current?.update({products:Ee.config})},[Ee.enabled]),Ge(()=>{g.current?.update({mapProducts:Se})},[Se]);let Ae=G(null);Ae.current===null&&(Ae.current={handleTextChange:c=>g.current?.handleTextChange(c),handleKeyDown:c=>{let N="nativeEvent"in c?c.nativeEvent:c;g.current?.handleKeyDown(N)},setFocused:c=>g.current?.setFocused(c),startEditingParam:c=>g.current?.startEditingParam(c),exitEditMode:()=>g.current?.exitEditMode(),handleCaretAfterInput:c=>g.current?.handleCaretAfterInput(c),handleCaretMove:c=>g.current?.handleCaretMove(c),replaceEditingRange:c=>g.current?.replaceEditingRange(c)??!1,setActivePill:c=>g.current?.setActivePill(c),skipActivePill:()=>g.current?.skipActivePill(),removeLastParam:()=>g.current?.removeLastParam(),clearNewParamId:()=>g.current?.clearNewParamId(),reset:()=>g.current?.reset(),refreshProducts:()=>g.current?.refreshProducts(),prepareSubmit:()=>g.current?.prepareSubmit(),getState:()=>g.current?.getState()??oa,recordSubmit:c=>g.current?.recordSubmit(c),selectOption:c=>g.current?.selectOption(c),selectProduct:c=>g.current?.selectProduct(c),addProductToCart:c=>{let N=g.current;return!N||!X.current?Promise.resolve():N.addProductToCart(c)},setActiveDropdownIndex:c=>g.current?.setActiveDropdownIndex(c),clearHighlight:c=>g.current?.clearHighlight(c),showPreviousMonth:()=>g.current?.showPreviousMonth(),showNextMonth:()=>g.current?.showNextMonth(),setTime:c=>g.current?.setTime(c),commitTime:()=>g.current?.commitTime(),toggleMultiSelectOption:c=>g.current?.toggleMultiSelectOption(c),commitMultiSelect:()=>g.current?.commitMultiSelect(),handleFocus:()=>g.current?.setFocused(!0),handleBlur:()=>g.current?.setFocused(!1)});let v=Ae.current,Re=ia(c=>{let N=c.target.value,Je=N.length>0&&!c.nativeEvent?.isComposing&&N[0]!==N[0].toUpperCase()?N[0].toUpperCase()+N.slice(1):N;g.current?.handleTextChange(Je)},[]),_e=ia(c=>{g.current?.handleKeyDown(c.nativeEvent)},[]),he=g.current,f=we??oa,Te=F!==void 0?F:f.text,Me=B!==void 0?B:f.completedParams,Pe=f.actionableSuggestions,ze=Pe[0],Ne=Yi(Pe),ue=he?.listboxId??"",Ue=f.activeDropdownIndex>=0&&he?`${ue}-option-${f.activeDropdownIndex}`:void 0,ie=f.editingParam,z=f.editingIdentified,Ve=ie?{parameter:ie.suggestionParameter,text:ie.suggestionPlaceholder,required:!0,options:ie.options}:z?{parameter:z.parameter,text:Vi(z.parameter),required:!0,options:[]}:null,Xe=f.dropdownSuggestion??Ve??ze,ct=Ve?[Ve]:Pe,Ye=Ui(f),Oe=!he||f.dropdownLoading;return{completedParams:Me,multiSelectView:f.multiSelectView,toggleMultiSelectOption:v.toggleMultiSelectOption,commitMultiSelect:v.commitMultiSelect,skippedParams:f.skippedParams,identifiedParams:f.identifiedParams,suggestionPills:Ne,setActivePill:v.setActivePill,skipActivePill:v.skipActivePill,removeLastParam:v.removeLastParam,segments:f.segments,newParamId:f.newParamId,clearNewParamId:v.clearNewParamId,suggestions:f.suggestions,activeIndex:f.activeDropdownIndex,isReady:f.isReady,isLoading:Oe,isFocused:f.isFocused,isDropdownOpen:f.isDropdownOpen,isActivePillSelected:f.isActivePillSelected,placeholderText:f.placeholderText,listboxId:ue,error:f.error,products:f.products,customFields:f.customFields,selectProduct:v.selectProduct,addProductToCart:v.addProductToCart,handleTextChange:v.handleTextChange,handleKeyDown:v.handleKeyDown,setFocused:v.setFocused,editingParam:ie,editingIdentified:z,editingAnchor:f.editingAnchor,caretOffset:f.caretOffset,startEditingParam:v.startEditingParam,exitEditMode:v.exitEditMode,handleCaretAfterInput:v.handleCaretAfterInput,handleCaretMove:v.handleCaretMove,replaceEditingRange:v.replaceEditingRange,inputProps:{value:Te,placeholder:f.placeholderText||void 0,onChange:Re,onKeyDown:_e,onFocus:v.handleFocus,onBlur:v.handleBlur,role:"combobox","aria-expanded":f.isDropdownOpen,"aria-activedescendant":Ue,"aria-autocomplete":"list","aria-controls":ue},reset:v.reset,refreshProducts:v.refreshProducts,prepareSubmit:v.prepareSubmit,getState:v.getState,recordSubmit:v.recordSubmit,dropdownProps:{suggestions:Xe?[{...Xe,options:f.dropdownOptions}]:[],activeIndex:f.activeDropdownIndex,onSelect:v.selectOption,onHighlight:v.setActiveDropdownIndex,onUnhighlight:v.clearHighlight,isOpen:f.isDropdownOpen,id:ue,pills:ct,activeSelected:f.isActivePillSelected,onPillClick:v.setActivePill,onSkip:v.skipActivePill,showSkipButton:(U??!0)&&!ie&&!z,showOptionIcons:j??!0,showOptionImages:H??!0,showOptionCounts:K??!0,skipDisabled:f.inSelectionAnimation,isLoading:Oe,skeletonExiting:f.skeletonExiting,isInputEmpty:Te.trim().length===0,language:s,products:f.products,productImageFallback:R,onProductSelect:v.selectProduct,onProductAddToCart:ce?v.addProductToCart:void 0,onProductFocusChange:v.setFocused,formatType:f.activeFormatType,dateView:f.dateView,selectedDateIso:Ye.selectedIso,selectedDateRange:Ye.selectedRange,dateRangeStart:Ye.rangeStart,onPreviousMonth:v.showPreviousMonth,onNextMonth:v.showNextMonth,timeView:f.timeView,multiSelectView:f.multiSelectView,onMultiSelectCommit:v.commitMultiSelect,onTimeChange:v.setTime,onTimeCommit:v.commitTime,optionsPosition:d??"below"}}}import{chipIdFromTap as Qi,extractPlainText as na,getCursorOffset as ra,keepCaretOnChip as $i,plainTextLength as Zi,renderEditableContent as Xi,setCursorOffset as sa}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as ne,useEffect as lt,useLayoutEffect as St,useRef as Ke}from"react";var dt;function Ji(){if(dt!==void 0)return dt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),dt=e.contentEditable==="plaintext-only",dt}function la(e){let{segments:n,showChipIcons:t=!0,showChipImages:a=!0,newParamId:i,editingParam:r,editingIdentified:o,editingAnchor:s,caretOffset:h,placeholderText:b,isFocused:x,isDropdownOpen:m,listboxId:l,activeDescendantId:d,autoFocus:w,handleTextChange:I,handleKeyDown:j,handleCaretAfterInput:H,handleCaretMove:K,startEditingParam:U,replaceEditingRange:P,setFocused:R}=e,C=Ke(null),Q=Ke(!1),F=Ke(""),B=Ke(""),Z=Ke(null),ee=Ke(0);Z.current=h,lt(()=>{if(!w)return;let u=C.current;if(!u)return;document.activeElement===u?R(!0):u.focus();let y=u.ownerDocument??document,k=y.getSelection(),T=k&&k.rangeCount>0&&u.contains(k.anchorNode);if(k&&!T){let S=y.createRange();S.selectNodeContents(u),S.collapse(!0),k.removeAllRanges(),k.addRange(S)}},[w,R]),lt(()=>{let u=C.current;if(!u)return;let y=u.ownerDocument??document,k=()=>{let T=y.getSelection();if(!T||T.rangeCount===0||!T.anchorNode||!u.contains(T.anchorNode))return;let S=T.anchorNode,M=S.nodeType===Node.ELEMENT_NODE?S:S.parentElement,V=(T.isCollapsed?M?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Ce=r?.id??o?.id??null;if(V&&V!==Ce){U(V);return}performance.now()-ee.current<50||K(ra(u))};return y.addEventListener("selectionchange",k),()=>y.removeEventListener("selectionchange",k)},[r,o,U,K]),lt(()=>{let u=C.current;if(!u)return;let y=k=>{let T=Qi(u,k.target);T&&(U(T),$i(u,T))};return u.addEventListener("click",y),()=>u.removeEventListener("click",y)},[U]),St(()=>{let u=C.current;u&&Xi({input:u,segments:n,newParamId:i,editingParamId:r?.id??null,placeholderText:b??"",isFocused:x,showChipIcons:t,showChipImages:a})},[n,i,r,b,x,t,a]),St(()=>{let u=F.current,y=i??"";if(F.current=y,!y||y===u)return;let k=C.current;if(!k)return;k.focus();let T=Z.current??Zi(k);sa(k,T)},[i]),St(()=>{let u=B.current,y=r?.id??"";if(B.current=y,!y||y===u||s==null)return;let k=C.current;k&&sa(k,s)},[r,s]);let E=ne(()=>{if(Q.current)return;let u=C.current;if(!u)return;let y=na(u),T=y.length>0&&y[0]!==y[0].toUpperCase()?y[0].toUpperCase()+y.slice(1):y;I(T)},[I]),te=ne(()=>{ee.current=performance.now(),E();let u=C.current;u&&H(ra(u))},[E,H]);lt(()=>{let u=C.current;if(!u)return;let y=k=>{let T=k,S=T.inputType;if(S==="insertParagraph"||S==="insertLineBreak"||S==="insertFromDrop"){k.preventDefault();return}if(S.startsWith("insert")||S.startsWith("delete")){let M=S.startsWith("delete")?"":T.data??"";P(M)&&k.preventDefault()}};return u.addEventListener("beforeinput",y),()=>u.removeEventListener("beforeinput",y)},[P]);let fe=ne(()=>{Q.current=!0,C.current?.setAttribute("data-aia-composing","true")},[]),ce=ne(()=>{Q.current=!1,C.current?.removeAttribute("data-aia-composing"),E()},[E]),Ie=ne(u=>{u.preventDefault();let y=C.current;if(!y)return;let k=(u.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!k)return;let T=y.ownerDocument??document,S=T.getSelection();if(!S||S.rangeCount===0)return;let M=S.getRangeAt(0);if(!y.contains(M.startContainer))return;M.deleteContents();let X=T.createTextNode(k);M.insertNode(X),M.setStartAfter(X),M.collapse(!0),S.removeAllRanges(),S.addRange(M),E()},[E]),be=ne(u=>j(u),[j]),g=ne(()=>R(!0),[R]),we=ne(()=>R(!1),[R]),ve=ne(()=>C.current?.focus(),[]),xe=ne(()=>C.current?.blur(),[]),ye=ne(()=>{let u=C.current;return u?na(u):""},[]),ke=Ji()?"plaintext-only":"true";return{inputRef:C,editorProps:{ref:C,contentEditable:ke,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":l,"aria-expanded":m,"aria-activedescendant":d,spellCheck:!0,enterKeyHint:"send",onInput:te,onKeyDown:be,onCompositionStart:fe,onCompositionEnd:ce,onPaste:Ie,onFocus:g,onBlur:we},getPlainText:ye,focus:ve,blur:xe}}import{jsx as qe,jsxs as Pt}from"react/jsx-runtime";function so(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var lo=eo(function({onSubmit:n,onResult:t,onError:a,optionOverrides:i,maskCompletedText:r,className:o,apiConfig:s,additionalContext:h,language:b,currency:x,productId:m,visitorId:l,columns:d,pillPlacement:w="dropdown",mode:I="auto",optionsPosition:j="below",animations:H=!0,dropdownTrigger:K,closeDropdownOnBlur:U,showNonTappableOptions:P,showOptionIcons:R=!0,showChipIcons:C=!0,showChipImages:Q=!0,showOptionImages:F=!0,showOptionCounts:B=!0,showSkipButton:Z,showProducts:ee,productsLayout:E,productImageFallback:te,autoFocus:fe=!0,onFocus:ce,onBlur:Ie,value:be,completedParams:g,onChange:we,onParamsChange:ve,products:xe,mapProducts:ye,onProductSelect:ke,onProductAddToCart:u,submitButton:y,resetOnSubmit:k=!0},T){let S=Ze(null),M=Ze(null),X=Ze(()=>{}),V=Ze(null),Ce=Ze(null);da(()=>{let O=S.current;if(O)return V.current?V.current.setMode(I):V.current=new oo(O,I),()=>{V.current?.destroy(),V.current=null}},[I]);let Ee=Tt(O=>{let $=Ce.current?.current;$&&($.focus(),no($,O))},[]),{completedParams:re,suggestionPills:pe,setActivePill:Se,skipActivePill:p,segments:q,newParamId:J,clearNewParamId:ae,placeholderText:Ae,isFocused:v,isDropdownOpen:Re,isActivePillSelected:_e,isLoading:he,activeIndex:f,listboxId:Te,handleTextChange:Me,handleKeyDown:Pe,setFocused:ze,editingParam:Ne,editingIdentified:ue,editingAnchor:Ue,caretOffset:ie,startEditingParam:z,handleCaretAfterInput:Ve,handleCaretMove:Xe,replaceEditingRange:ct,dropdownProps:Ye,reset:Oe,refreshProducts:c,prepareSubmit:N,getState:A,recordSubmit:Je}=Ct({onSubmit:O=>X.current(O),onResult:t,onError:a,optionOverrides:i,maskCompletedText:r,apiConfig:s,additionalContext:h,language:b,currency:x,productId:m,visitorId:l,columns:d,dropdownTrigger:K,optionsPosition:j,closeDropdownOnBlur:U,showNonTappableOptions:P,showOptionIcons:R,showOptionImages:F,showOptionCounts:B,showSkipButton:Z,showProducts:ee,onFocus:ce,onBlur:Ie,value:be,completedParams:g,onChange:we,onParamsChange:ve,products:xe,mapProducts:ye,onProductSelect:ke,onProductAddToCart:u,source:"full-sdk",setCursor:Ee});da(()=>{if(!J)return;let O=window.setTimeout(()=>ae(),650);return()=>window.clearTimeout(O)},[J,ae]);let ca=f>=0?`${Te}-option-${f}`:void 0,{inputRef:pt,editorProps:pa,focus:et,blur:It,getPlainText:Et}=la({segments:q,newParamId:J,editingParam:Ne,editingIdentified:ue,editingAnchor:Ue,caretOffset:ie,placeholderText:Ae,isFocused:v,showChipIcons:C,showChipImages:Q,isDropdownOpen:Re,listboxId:Te,activeDescendantId:ca,autoFocus:fe,handleTextChange:Me,handleKeyDown:Pe,handleCaretAfterInput:Ve,handleCaretMove:Xe,startEditingParam:z,replaceEditingRange:ct,setFocused:ze});Ce.current=pt,ao(()=>{let O=M.current,$=pt.current;if(!O||!$)return;let je=()=>{let Rt=O.firstElementChild;if(!Rt)return;let ga=Rt.getBoundingClientRect(),fa=$.getBoundingClientRect();ga.top>=fa.bottom-2?O.setAttribute("data-aia-pill-wrapped",""):O.removeAttribute("data-aia-pill-wrapped")};je();let At=new ResizeObserver(je);return At.observe($),()=>At.disconnect()},[q,pe.length,he,pt]),to(T,()=>({focus:et,blur:It,reset:Oe,refreshProducts:c,setMode:O=>V.current?.setMode(O),skipActivePill:p}),[et,It,Oe,c,p]);let tt=!!q.length||re.length>0,ht=Tt(O=>{if(!tt)return;O&&N();let $=A(),je=io(Et(),$.completedParams,$.skippedParams,{identifiedParams:$.identifiedParams,isReady:$.isReady,customFields:$.customFields});O&&Je(je),n(je),k&&Oe()},[Je,k,tt,N,A,n,Oe,Et]);X.current=()=>ht(!1);let ha=Tt(O=>{O.target?.closest("[data-aia-pill]")||et()},[et]),ua=w==="inline",ma=w==="dropdown";return Pt("div",{ref:S,className:`magicx-aia ${De.container} ${o??""}`,"data-pill-placement":w,"data-options-position":j,"data-animations":H?"on":"off","data-mode":so(I),children:[qe(yt,{...Ye,showPills:ma,productsLayout:E,productImageFallback:te}),Pt("div",{className:De.inputWrapper,"data-aia-input-wrapper":"",onClick:ha,children:[Pt("div",{className:De.editorArea,"data-aia-editor":"",children:[qe("div",{...pa,className:De.input,"data-aia-input":""}),ua&&(he||pe.length>0)&&qe("span",{ref:M,className:De.pillListContainer,"data-aia-pill-list-container":"",children:qe(it,{pills:pe,activePillIndex:0,activeSelected:_e,onSelectPill:Se,loading:he})})]}),y===null?null:y===void 0?qe(Xt,{disabled:!tt,onClick:()=>ht(!0),label:ro(b).submit}):qe("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:De.submitSlot,onClick:O=>{tt&&(O.stopPropagation(),ht(!0))},children:y})]})]})});export{lo as AIAutocomplete,yt as AIAutocompleteDropdown,ur as DATE_RANGE_META_END,mr as DATE_RANGE_META_START,gr as DEFAULT_OPTION_COUNT_UNIT,Ar as PRODUCT_PATH_PREFIX,Br as TIME_META_KEY,Gr as WEEKDAY_LABELS,cr as buildSubmitResult,pr as cellDay,hr as cellIso,fr as dateCellMarks,br as formatDate,wr as formatDateRange,vr as formatOptionCount,xr as formatTime,yr as isoDate,kr as monthLabel,Cr as optionCountLabel,Sr as optionHasImage,Tr as optionImageSources,Pr as optionImageSrc,Ir as optionLabel,Er as optionsShowLeadingVisuals,Rr as parseDate,Or as parseLooseDate,Dr as parseLooseDateRange,Lr as parseTime,Mr as productFromMatchedItem,zr as productImageSources,Nr as productsFromCustomFields,Hr as sanitizeOptionIconSvg,Fr as selectedRangeFor,Ct as useAIAutocomplete,Wr as visibleDateRange,Kr as withSkippedParams};
3172
+
3173
+ /* Ready: the request is complete, so the button lifts slightly and takes its
3174
+ ready color (--aia-submit-bg-ready, defaulting to the normal one). The state
3175
+ sits in :where() so a theme's own \`.x .magicx-aia-submit { background }\`
3176
+ still wins. */
3177
+ .aia-submitButton-otz7H:where([data-aia-ready]:not(:disabled)) {
3178
+ background: var(--aia-submit-bg-ready, var(--aia-submit-bg, var(--aia-color-text-default, #fff)));
3179
+ transform: scale(1.08);
3180
+ }
3181
+
3182
+ @media (prefers-reduced-motion: reduce) {
3183
+ .aia-submitButton-otz7H {
3184
+ transition: none;
3185
+ }
3186
+ }
3187
+ `,document.head.appendChild(e)}var ca={submitButton:"aia-submitButton-otz7H"};import{jsx as Et}from"react/jsx-runtime";function pa({disabled:e,ready:i,onClick:t,label:a=ho().submit}){return Et("button",{type:"button","data-aia-submit":"",className:ca.submitButton,disabled:e,"data-aia-ready":i?"":void 0,onClick:o=>{o.stopPropagation(),t()},"aria-label":a,children:Et("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":a,children:Et("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as uo,dateSelectionFor as mo,identifiedParamLabel as go,withoutTraditionalAutocomplete as fo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as fa,useEffect as je,useRef as Z,useState as bo}from"react";import{useRef as ha}from"react";function ua(e){let i=ha(e);i.current=e;let t=Object.keys(e??{}).sort().join("\0"),a=ha({key:"",overrides:void 0});if(a.current.key!==t){let o={};for(let r of Object.keys(e??{})){let n=(s,g,v)=>{let x=i.current?.[r];return x?x(s,g,v):[]};o[r]=n}a.current={key:t,overrides:e?o:void 0}}return{overrides:a.current.overrides,key:t}}import{useRef as ma}from"react";function ga(e){let i=ma(e);i.current=e;let t=ma(null);t.current===null&&(t.current={fetch:(o,r)=>{let n=i.current;return n?n.fetch(o,r):Promise.reject(new Error("products config removed"))},transform:o=>i.current?.transform(o)??[],get limit(){return i.current?.limit}});let a=e!==void 0;return{config:a?t.current:void 0,enabled:a}}var ba={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,timeView:null,multiSelectView:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function At({onSubmit:e,onResult:i,onError:t,optionOverrides:a,maskCompletedText:o,apiConfig:r,additionalContext:n,language:s,currency:g,productId:v,visitorId:x,columns:u=2,dropdownTrigger:d,optionsPosition:c,closeDropdownOnBlur:w,showNonTappableOptions:L,locationSearch:N,showOptionIcons:D,showOptionImages:H,showOptionCounts:q,showSkipButton:R,showProducts:I,productImageFallback:C="image",onFocus:U,onBlur:Q,value:B,completedParams:F,onChange:ae,onParamsChange:P,products:_,mapProducts:p,onProductSelect:E,onProductAddToCart:ve,source:De,setCursor:Pe}){let f=Z(null),[Me,Ie]=bo(null),Ee=Z(e);Ee.current=e;let Ae=Z(i);Ae.current=i;let b=Z(t);b.current=t;let k=Z(ae);k.current=ae;let S=Z(P);S.current=P;let A=Z(U);A.current=U;let O=Z(Q);O.current=Q;let V=Z(Pe);V.current=Pe;let ie=Z(E);ie.current=E;let oe=Z(ve);oe.current=ve;let ce=Z(x);ce.current=x;let pe=Z(()=>{let l=ce.current;return typeof l=="function"?l():l}).current,ne=ga(_),ze=Z(p);ze.current=p;let Je=Z((l,T)=>{let z=ze.current;return z?z(l,T):l}).current,xe=p?Je:void 0,Ne=ua(a);je(()=>{if(typeof document>"u")return;let l=new uo(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:n,language:s,currency:g,productId:v,visitorId:pe,optionOverrides:Ne.overrides,maskCompletedText:o,columns:u,dropdownTrigger:d,optionsPosition:c,closeDropdownOnBlur:w,showNonTappableOptions:L,locationSearch:N,showProducts:I,source:De,value:B,completedParams:F,onSubmit:(...z)=>Ee.current?.(...z),onResult:(...z)=>Ae.current?.(...z),onError:(...z)=>b.current?.(...z),onChange:(...z)=>k.current?.(...z),onParamsChange:(...z)=>S.current?.(...z),onFocus:()=>A.current?.(),onBlur:()=>O.current?.(),onProductSelect:z=>ie.current?.(z),onProductAddToCart:z=>oe.current?.(z),setCursor:z=>V.current?.(z),products:ne.config,mapProducts:xe});f.current=l,Ie(l.getState());let T=l.subscribe(z=>Ie(z));return()=>{T(),l.destroy(),f.current===l&&(f.current=null)}},[]),je(()=>{B!==void 0&&f.current?.setValue(B)},[B]),je(()=>{F!==void 0&&f.current?.setCompletedParams(F)},[F]);let We=JSON.stringify(r??null),ye;try{ye=JSON.stringify(n??null)}catch{ye="[unstringifiable]"}je(()=>{f.current?.update({apiConfig:r,additionalContext:n,language:s,currency:g,productId:v,optionOverrides:Ne.overrides,dropdownTrigger:d,optionsPosition:c,closeDropdownOnBlur:w,showNonTappableOptions:L,locationSearch:N,showProducts:I})},[We,ye,s,g?.code,g?.rate,g?.country,v,Ne.key,d,c,w,L,N,I]);let J=Z(!1);je(()=>{if(!J.current){J.current=!0;return}f.current?.update({products:ne.config})},[ne.enabled]),je(()=>{f.current?.update({mapProducts:xe})},[xe]);let he=Z(null);he.current===null&&(he.current={handleTextChange:l=>f.current?.handleTextChange(l),handleKeyDown:l=>{let T="nativeEvent"in l?l.nativeEvent:l;f.current?.handleKeyDown(T)},setFocused:l=>f.current?.setFocused(l),startEditingParam:l=>f.current?.startEditingParam(l),exitEditMode:()=>f.current?.exitEditMode(),handleCaretAfterInput:l=>f.current?.handleCaretAfterInput(l),handleCaretMove:l=>f.current?.handleCaretMove(l),replaceEditingRange:l=>f.current?.replaceEditingRange(l)??!1,setActivePill:l=>f.current?.setActivePill(l),skipActivePill:()=>f.current?.skipActivePill(),removeLastParam:()=>f.current?.removeLastParam(),clearNewParamId:()=>f.current?.clearNewParamId(),reset:()=>f.current?.reset(),refreshProducts:()=>f.current?.refreshProducts(),prepareSubmit:()=>f.current?.prepareSubmit(),getState:()=>f.current?.getState()??ba,recordSubmit:l=>f.current?.recordSubmit(l),selectOption:(l,T)=>f.current?.selectOption(l,T),selectProduct:l=>f.current?.selectProduct(l),addProductToCart:l=>{let T=f.current;return!T||!oe.current?Promise.resolve():T.addProductToCart(l)},setActiveDropdownIndex:l=>f.current?.setActiveDropdownIndex(l),clearHighlight:l=>f.current?.clearHighlight(l),showPreviousMonth:()=>f.current?.showPreviousMonth(),showNextMonth:()=>f.current?.showNextMonth(),setTime:l=>f.current?.setTime(l),commitTime:()=>f.current?.commitTime(),toggleMultiSelectOption:l=>f.current?.toggleMultiSelectOption(l),commitMultiSelect:()=>f.current?.commitMultiSelect(),setLocationQuery:l=>f.current?.setLocationQuery(l),moveLocationHighlight:l=>f.current?.moveLocationHighlight(l),commitLocation:l=>f.current?.commitLocation(l),setLocationFieldFocused:l=>f.current?.setLocationFieldFocused(l),handleFocus:()=>f.current?.setFocused(!0),handleBlur:()=>f.current?.setFocused(!1)});let y=he.current,h=fa(l=>{let T=l.target.value,st=T.length>0&&!l.nativeEvent?.isComposing&&T[0]!==T[0].toUpperCase()?T[0].toUpperCase()+T.slice(1):T;f.current?.handleTextChange(st)},[]),Y=fa(l=>{f.current?.handleKeyDown(l.nativeEvent)},[]),ue=f.current,m=Me??ba,Ge=B!==void 0?B:m.text,ke=F!==void 0?F:m.completedParams,me=m.actionableSuggestions,et=me[0],tt=fo(me),Ce=ue?.listboxId??"",Ke=m.activeDropdownIndex>=0&&ue?`${Ce}-option-${m.activeDropdownIndex}`:void 0,re=m.editingParam,ge=m.editingIdentified,Le=re?{parameter:re.suggestionParameter,text:re.suggestionPlaceholder,required:!0,options:re.options}:ge?{parameter:ge.parameter,text:go(ge.parameter),required:!0,options:[]}:null,Fe=m.dropdownSuggestion??Le??et,qe=Le?[Le]:me,Re=mo(m),_e=!ue||m.dropdownLoading;return{completedParams:ke,multiSelectView:m.multiSelectView,toggleMultiSelectOption:y.toggleMultiSelectOption,commitMultiSelect:y.commitMultiSelect,skippedParams:m.skippedParams,identifiedParams:m.identifiedParams,suggestionPills:tt,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:m.segments,newParamId:m.newParamId,clearNewParamId:y.clearNewParamId,suggestions:m.suggestions,activeIndex:m.activeDropdownIndex,isReady:m.isReady,isLoading:_e,isFocused:m.isFocused,isDropdownOpen:m.isDropdownOpen,isActivePillSelected:m.isActivePillSelected,placeholderText:m.placeholderText,listboxId:Ce,error:m.error,products:m.products,customFields:m.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:re,editingIdentified:ge,editingAnchor:m.editingAnchor,caretOffset:m.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:Ge,placeholder:m.placeholderText||void 0,onChange:h,onKeyDown:Y,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":m.isDropdownOpen,"aria-activedescendant":Ke,"aria-autocomplete":"list","aria-controls":Ce},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:Fe?[{...Fe,options:m.dropdownOptions}]:[],activeIndex:m.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:m.isDropdownOpen,id:Ce,pills:qe,activeSelected:m.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(R??!0)&&!re&&!ge,showOptionIcons:D??!0,showOptionImages:H??!0,showOptionCounts:q??!0,skipDisabled:m.inSelectionAnimation,isLoading:_e,skeletonExiting:m.skeletonExiting,isInputEmpty:Ge.trim().length===0,language:s,products:m.products,productImageFallback:C,onProductSelect:y.selectProduct,onProductAddToCart:ve?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:m.activeFormatType,dateView:m.dateView,selectedDateIso:Re.selectedIso,selectedDateRange:Re.selectedRange,dateRangeStart:Re.rangeStart,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,timeView:m.timeView,multiSelectView:m.multiSelectView,onMultiSelectCommit:y.commitMultiSelect,onTimeChange:y.setTime,onTimeCommit:y.commitTime,locationView:m.locationView,onLocationQuery:y.setLocationQuery,onLocationMove:y.moveLocationHighlight,onLocationCommit:y.commitLocation,onLocationFocusChange:y.setLocationFieldFocused,isFocused:m.isFocused||m.locationFieldFocused,optionsPosition:c??"below"}}}import{chipIdFromTap as wo,extractPlainText as wa,getCursorOffset as va,keepCaretOnChip as vo,plainTextLength as xo,renderEditableContent as yo,setCursorOffset as xa}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as de,useEffect as gt,useLayoutEffect as Lt,useRef as $e}from"react";var ft;function ko(){if(ft!==void 0)return ft;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),ft=e.contentEditable==="plaintext-only",ft}function ya(e){let{segments:i,showChipIcons:t=!0,showChipImages:a=!0,newParamId:o,editingParam:r,editingIdentified:n,editingAnchor:s,caretOffset:g,placeholderText:v,isFocused:x,isDropdownOpen:u,listboxId:d,activeDescendantId:c,autoFocus:w,handleTextChange:L,handleKeyDown:N,handleCaretAfterInput:D,handleCaretMove:H,startEditingParam:q,replaceEditingRange:R,setFocused:I}=e,C=$e(null),U=$e(!1),Q=$e(""),B=$e(""),F=$e(null),ae=$e(0);F.current=g,gt(()=>{if(!w)return;let b=C.current;if(!b)return;document.activeElement===b?I(!0):b.focus();let k=b.ownerDocument??document,S=k.getSelection(),A=S&&S.rangeCount>0&&b.contains(S.anchorNode);if(S&&!A){let O=k.createRange();O.selectNodeContents(b),O.collapse(!0),S.removeAllRanges(),S.addRange(O)}},[w,I]),gt(()=>{let b=C.current;if(!b)return;let k=b.ownerDocument??document,S=()=>{let A=k.getSelection();if(!A||A.rangeCount===0||!A.anchorNode||!b.contains(A.anchorNode))return;let O=A.anchorNode,V=O.nodeType===Node.ELEMENT_NODE?O:O.parentElement,oe=(A.isCollapsed?V?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ce=r?.id??n?.id??null;if(oe&&oe!==ce){q(oe);return}performance.now()-ae.current<50||H(va(b))};return k.addEventListener("selectionchange",S),()=>k.removeEventListener("selectionchange",S)},[r,n,q,H]),gt(()=>{let b=C.current;if(!b)return;let k=S=>{let A=wo(b,S.target);A&&(q(A),vo(b,A))};return b.addEventListener("click",k),()=>b.removeEventListener("click",k)},[q]),Lt(()=>{let b=C.current;b&&yo({input:b,segments:i,newParamId:o,editingParamId:r?.id??null,placeholderText:v??"",isFocused:x,showChipIcons:t,showChipImages:a})},[i,o,r,v,x,t,a]),Lt(()=>{let b=Q.current,k=o??"";if(Q.current=k,!k||k===b)return;let S=C.current;if(!S)return;S.focus();let A=F.current??xo(S);xa(S,A)},[o]),Lt(()=>{let b=B.current,k=r?.id??"";if(B.current=k,!k||k===b||s==null)return;let S=C.current;S&&xa(S,s)},[r,s]);let P=de(()=>{if(U.current)return;let b=C.current;if(!b)return;let k=wa(b),A=k.length>0&&k[0]!==k[0].toUpperCase()?k[0].toUpperCase()+k.slice(1):k;L(A)},[L]),_=de(()=>{ae.current=performance.now(),P();let b=C.current;b&&D(va(b))},[P,D]);gt(()=>{let b=C.current;if(!b)return;let k=S=>{let A=S,O=A.inputType;if(O==="insertParagraph"||O==="insertLineBreak"||O==="insertFromDrop"){S.preventDefault();return}if(O.startsWith("insert")||O.startsWith("delete")){let V=O.startsWith("delete")?"":A.data??"";R(V)&&S.preventDefault()}};return b.addEventListener("beforeinput",k),()=>b.removeEventListener("beforeinput",k)},[R]);let p=de(()=>{U.current=!0,C.current?.setAttribute("data-aia-composing","true")},[]),E=de(()=>{U.current=!1,C.current?.removeAttribute("data-aia-composing"),P()},[P]),ve=de(b=>{b.preventDefault();let k=C.current;if(!k)return;let S=(b.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!S)return;let A=k.ownerDocument??document,O=A.getSelection();if(!O||O.rangeCount===0)return;let V=O.getRangeAt(0);if(!k.contains(V.startContainer))return;V.deleteContents();let ie=A.createTextNode(S);V.insertNode(ie),V.setStartAfter(ie),V.collapse(!0),O.removeAllRanges(),O.addRange(V),P()},[P]),De=de(b=>N(b),[N]),Pe=de(()=>I(!0),[I]),f=de(()=>I(!1),[I]),Me=de(()=>C.current?.focus(),[]),Ie=de(()=>C.current?.blur(),[]),Ee=de(()=>{let b=C.current;return b?wa(b):""},[]),Ae=ko()?"plaintext-only":"true";return{inputRef:C,editorProps:{ref:C,contentEditable:Ae,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":d,"aria-expanded":u,"aria-activedescendant":c,spellCheck:!0,enterKeyHint:"send",onInput:_,onKeyDown:De,onCompositionStart:p,onCompositionEnd:E,onPaste:ve,onFocus:Pe,onBlur:f},getPlainText:Ee,focus:Me,blur:Ie}}import{jsx as Xe,jsxs as Dt}from"react/jsx-runtime";function Ro(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Oo=Co(function({onSubmit:i,onResult:t,onError:a,optionOverrides:o,maskCompletedText:r,className:n,apiConfig:s,additionalContext:g,language:v,currency:x,productId:u,visitorId:d,columns:c,pillPlacement:w="dropdown",mode:L="auto",optionsPosition:N="below",animations:D=!0,dropdownTrigger:H,closeDropdownOnBlur:q,showNonTappableOptions:R,locationSearch:I,showOptionIcons:C=!0,showChipIcons:U=!0,showChipImages:Q=!0,showOptionImages:B=!0,showOptionCounts:F=!0,showSkipButton:ae,showProducts:P,productsLayout:_,productImageFallback:p,autoFocus:E=!0,onFocus:ve,onBlur:De,value:Pe,completedParams:f,onChange:Me,onParamsChange:Ie,products:Ee,mapProducts:Ae,onProductSelect:b,onProductAddToCart:k,submitButton:S,resetOnSubmit:A=!0},O){let V=Ze(null),ie=Ze(null),oe=Ze(null),ce=Ze(()=>{}),pe=Ze(null),ne=Ze(null);Ot(()=>{let M=V.current;if(M)return pe.current?pe.current.setMode(L):pe.current=new Io(M,L),()=>{pe.current?.destroy(),pe.current=null}},[L]);let ze=Rt(M=>{let ee=ne.current?.current;ee&&(ee.focus(),Eo(ee,M))},[]),{completedParams:Je,suggestionPills:xe,setActivePill:Ne,skipActivePill:We,segments:ye,newParamId:J,clearNewParamId:he,placeholderText:y,isFocused:h,isDropdownOpen:Y,isActivePillSelected:ue,isLoading:m,isReady:Ge,activeIndex:ke,listboxId:me,handleTextChange:et,handleKeyDown:tt,setFocused:Ce,editingParam:Ke,editingIdentified:re,editingAnchor:ge,caretOffset:Le,startEditingParam:Fe,handleCaretAfterInput:qe,handleCaretMove:Re,replaceEditingRange:_e,dropdownProps:l,reset:T,refreshProducts:z,prepareSubmit:st,getState:Mt,recordSubmit:zt}=At({onSubmit:M=>ce.current(M),onResult:t,onError:a,optionOverrides:o,maskCompletedText:r,apiConfig:s,additionalContext:g,language:v,currency:x,productId:u,visitorId:d,columns:c,dropdownTrigger:H,optionsPosition:N,closeDropdownOnBlur:q,showNonTappableOptions:R,locationSearch:I,showOptionIcons:C,showOptionImages:B,showOptionCounts:F,showSkipButton:ae,showProducts:P,onFocus:ve,onBlur:De,value:Pe,completedParams:f,onChange:Me,onParamsChange:Ie,products:Ee,mapProducts:Ae,onProductSelect:b,onProductAddToCart:k,source:"full-sdk",setCursor:ze});Ot(()=>{if(!J)return;let M=window.setTimeout(()=>he(),650);return()=>window.clearTimeout(M)},[J,he]);let ka=ke>=0?`${me}-option-${ke}`:void 0,{inputRef:bt,editorProps:Ca,focus:lt,blur:Nt,getPlainText:Ft}=ya({segments:ye,newParamId:J,editingParam:Ke,editingIdentified:re,editingAnchor:ge,caretOffset:Le,placeholderText:y,isFocused:h,showChipIcons:U,showChipImages:Q,isDropdownOpen:Y,listboxId:me,activeDescendantId:ka,autoFocus:E,handleTextChange:et,handleKeyDown:tt,handleCaretAfterInput:qe,handleCaretMove:Re,startEditingParam:Fe,replaceEditingRange:_e,setFocused:Ce});ne.current=bt,To(()=>{let M=ie.current,ee=bt.current;if(!M||!ee)return;let it=()=>{let Bt=M.firstElementChild;if(!Bt)return;let Ia=Bt.getBoundingClientRect(),Ea=ee.getBoundingClientRect();Ia.top>=Ea.bottom-2?M.setAttribute("data-aia-pill-wrapped",""):M.removeAttribute("data-aia-pill-wrapped")};it();let Ht=new ResizeObserver(it);return Ht.observe(ee),()=>Ht.disconnect()},[ye,xe.length,m,bt]),Ot(()=>{let M=oe.current;if(M)return Lo(M)},[]),So(O,()=>({focus:lt,blur:Nt,reset:T,refreshProducts:z,setMode:M=>pe.current?.setMode(M),skipActivePill:We}),[lt,Nt,T,z,We]);let at=!!ye.length||Je.length>0,wt=Rt(M=>{if(!at)return;M&&st();let ee=Mt(),it=Po(Ft(),ee.completedParams,ee.skippedParams,{identifiedParams:ee.identifiedParams,isReady:ee.isReady,customFields:ee.customFields});M&&zt(it),i(it),A&&T()},[zt,A,at,st,Mt,i,T,Ft]);ce.current=()=>wt(!1);let Sa=Rt(M=>{M.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||lt()},[lt]),Ta=w==="inline",Pa=w==="dropdown";return Dt("div",{ref:V,className:`magicx-aia ${He.container} ${n??""}`,"data-pill-placement":w,"data-options-position":N,"data-animations":D?"on":"off","data-mode":Ro(L),children:[Xe(It,{...l,showPills:Pa,productsLayout:_,productImageFallback:p}),Dt("div",{className:He.inputWrapper,"data-aia-input-wrapper":"",onClick:Sa,children:[Dt("div",{ref:oe,className:He.editorArea,"data-aia-editor":"",children:[Xe("div",{...Ca,className:He.input,"data-aia-input":""}),Ta&&(m||xe.length>0)&&Xe("span",{ref:ie,className:He.pillListContainer,"data-aia-pill-list-container":"",children:Xe(ct,{pills:xe,activePillIndex:0,activeSelected:ue,onSelectPill:Ne,loading:m})})]}),S===null?null:S===void 0?Xe(pa,{disabled:!at,ready:at&&Ge,onClick:()=>wt(!0),label:Ao(v).submit}):Xe("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:He.submitSlot,onClick:M=>{at&&(M.stopPropagation(),wt(!0))},children:S})]})]})});export{Oo as AIAutocomplete,It as AIAutocompleteDropdown,Kr as DATE_RANGE_META_END,qr as DATE_RANGE_META_START,_r as DEFAULT_OPTION_COUNT_UNIT,Xr as LOCATION_META_KEY,rs as PRODUCT_PATH_PREFIX,fs as TIME_META_KEY,ws as WEEKDAY_LABELS,Br as buildSubmitResult,Wr as cellDay,Gr as cellIso,Vr as dateCellMarks,Ur as formatDate,Qr as formatDateRange,Yr as formatOptionCount,jr as formatPlace,$r as formatTime,Zr as isoDate,Jr as monthLabel,es as optionCountLabel,ts as optionHasImage,as as optionImageSources,is as optionImageSrc,os as optionLabel,ns as optionsShowLeadingVisuals,ss as parseDate,ls as parseLooseDate,ds as parseLooseDateRange,cs as parseTime,ps as productFromMatchedItem,hs as productImageSources,us as productsFromCustomFields,ms as sanitizeOptionIconSvg,gs as selectedRangeFor,At as useAIAutocomplete,bs as visibleDateRange,vs as withSkippedParams};
2884
3188
  //# sourceMappingURL=index.mjs.map