@magicx-eng/ai-autocomplete-react 0.45.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var yt=Object.defineProperty;var la=Object.getOwnPropertyDescriptor;var da=Object.getOwnPropertyNames;var ca=Object.prototype.hasOwnProperty;var pa=(e,a)=>{for(var t in a)yt(e,t,{get:a[t],enumerable:!0})},ha=(e,a,t,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of da(a))!ca.call(e,o)&&o!==t&&yt(e,o,{get:()=>a[o],enumerable:!(i=la(a,o))||i.enumerable});return e};var ua=e=>ha(yt({},"__esModule",{value:!0}),e);var Aa={};pa(Aa,{AIAutocomplete:()=>ea,AIAutocompleteDropdown:()=>pt,DATE_RANGE_META_END:()=>s.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>s.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>s.DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX:()=>s.PRODUCT_PATH_PREFIX,WEEKDAY_LABELS:()=>s.WEEKDAY_LABELS,buildSubmitResult:()=>s.buildSubmitResult,cellDay:()=>s.cellDay,cellIso:()=>s.cellIso,dateCellMarks:()=>s.dateCellMarks,formatDate:()=>s.formatDate,formatDateRange:()=>s.formatDateRange,formatOptionCount:()=>s.formatOptionCount,isoDate:()=>s.isoDate,monthLabel:()=>s.monthLabel,optionCountLabel:()=>s.optionCountLabel,optionHasImage:()=>s.optionHasImage,optionImageSources:()=>s.optionImageSources,optionImageSrc:()=>s.optionImageSrc,optionLabel:()=>s.optionLabel,optionsShowLeadingVisuals:()=>s.optionsShowLeadingVisuals,parseDate:()=>s.parseDate,parseLooseDate:()=>s.parseLooseDate,parseLooseDateRange:()=>s.parseLooseDateRange,productFromMatchedItem:()=>s.productFromMatchedItem,productImageSources:()=>s.productImageSources,productsFromCustomFields:()=>s.productsFromCustomFields,sanitizeOptionIconSvg:()=>s.sanitizeOptionIconSvg,selectedRangeFor:()=>s.selectedRangeFor,useAIAutocomplete:()=>ut,visibleDateRange:()=>s.visibleDateRange,withSkippedParams:()=>s.withSkippedParams});module.exports=ua(Aa);var s=require("@magicx-eng/ai-autocomplete-vanilla");var G=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
1
+ "use strict";var Tt=Object.defineProperty;var ua=Object.getOwnPropertyDescriptor;var ma=Object.getOwnPropertyNames;var ga=Object.prototype.hasOwnProperty;var fa=(e,i)=>{for(var t in i)Tt(e,t,{get:i[t],enumerable:!0})},ba=(e,i,t,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of ma(i))!ga.call(e,o)&&o!==t&&Tt(e,o,{get:()=>i[o],enumerable:!(a=ua(i,o))||a.enumerable});return e};var wa=e=>ba(Tt({},"__esModule",{value:!0}),e);var Fa={};fa(Fa,{AIAutocomplete:()=>na,AIAutocompleteDropdown:()=>wt,DATE_RANGE_META_END:()=>s.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>s.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>s.DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX:()=>s.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>s.TIME_META_KEY,WEEKDAY_LABELS:()=>s.WEEKDAY_LABELS,buildSubmitResult:()=>s.buildSubmitResult,cellDay:()=>s.cellDay,cellIso:()=>s.cellIso,dateCellMarks:()=>s.dateCellMarks,formatDate:()=>s.formatDate,formatDateRange:()=>s.formatDateRange,formatOptionCount:()=>s.formatOptionCount,formatTime:()=>s.formatTime,isoDate:()=>s.isoDate,monthLabel:()=>s.monthLabel,optionCountLabel:()=>s.optionCountLabel,optionHasImage:()=>s.optionHasImage,optionImageSources:()=>s.optionImageSources,optionImageSrc:()=>s.optionImageSrc,optionLabel:()=>s.optionLabel,optionsShowLeadingVisuals:()=>s.optionsShowLeadingVisuals,parseDate:()=>s.parseDate,parseLooseDate:()=>s.parseLooseDate,parseLooseDateRange:()=>s.parseLooseDateRange,parseTime:()=>s.parseTime,productFromMatchedItem:()=>s.productFromMatchedItem,productImageSources:()=>s.productImageSources,productsFromCustomFields:()=>s.productsFromCustomFields,sanitizeOptionIconSvg:()=>s.sanitizeOptionIconSvg,selectedRangeFor:()=>s.selectedRangeFor,useAIAutocomplete:()=>xt,visibleDateRange:()=>s.visibleDateRange,withSkippedParams:()=>s.withSkippedParams});module.exports=wa(Fa);var s=require("@magicx-eng/ai-autocomplete-vanilla");var K=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
2
2
  position: relative;
3
3
  /* Inherits the host page's font by default. Consumers can pin a specific
4
4
  font on the library via \`--aia-font-family: 'Custom Font'\` without
@@ -280,7 +280,7 @@
280
280
  opacity: 0;
281
281
  }
282
282
  }
283
- `,document.head.appendChild(e)}var Ve={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"};var re=require("@magicx-eng/ai-autocomplete-vanilla"),Q=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
283
+ `,document.head.appendChild(e)}var Je={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"};var le=require("@magicx-eng/ai-autocomplete-vanilla"),ee=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
284
284
  * Built-in appearance defaults \u2014 zero specificity via :where().
285
285
  * Consumer CSS always wins without !important.
286
286
  *
@@ -822,6 +822,15 @@
822
822
  max-height: none;
823
823
  overflow: visible;
824
824
  }
825
+
826
+ [data-aia-dropdown][aria-multiselectable="true"] {
827
+ --aia-grid-scroll-bottom: 0px;
828
+ --aia-grid-overlap-bottom: 0px;
829
+ --aia-grid-scroll-top: 0px;
830
+ --aia-grid-overlap-top: 0px;
831
+ --aia-footer-fade-lead: 0px;
832
+ --aia-footer-row-min-height: 0px;
833
+ }
825
834
  `,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 {
826
835
  position: absolute;
827
836
  left: 0;
@@ -875,6 +884,11 @@
875
884
  max-width: var(--aia-date-panel-width, 312px);
876
885
  }
877
886
 
887
+ /* The time wheel is narrower still \u2014 three short wheels and a button. */
888
+ .aia-dropdown-yz2KC:has([data-aia-time-wheel]) {
889
+ max-width: var(--aia-time-panel-width, 240px);
890
+ }
891
+
878
892
  .aia-dropdown-yz2KC[data-aia-surface="glass"] {
879
893
  background: transparent;
880
894
  border-color: transparent;
@@ -1132,7 +1146,23 @@
1132
1146
  opacity: 0.25;
1133
1147
  }
1134
1148
  }
1135
- `,document.head.appendChild(e)}var Te={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"};var H=require("@magicx-eng/ai-autocomplete-vanilla"),Ot=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
1149
+
1150
+ .aia-multiDone-y12U7 {
1151
+ display: block;
1152
+ width: auto;
1153
+ margin-left: auto;
1154
+ height: 32px;
1155
+ padding: 0 18px;
1156
+ border: none;
1157
+ border-radius: 999px;
1158
+ background: var(--aia-option-bg, transparent);
1159
+ color: var(--aia-option-color);
1160
+ font-family: inherit;
1161
+ font-size: 15px;
1162
+ font-weight: inherit;
1163
+ cursor: pointer;
1164
+ }
1165
+ `,document.head.appendChild(e)}var Ce={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q",multiDone:"aia-multiDone-y12U7"};var W=require("@magicx-eng/ai-autocomplete-vanilla"),Nt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
1136
1166
 
1137
1167
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
1138
1168
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1295,7 +1325,7 @@
1295
1325
  opacity: 0.8;
1296
1326
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1297
1327
  }
1298
- `,document.head.appendChild(e)}var F={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};var oe=require("react/jsx-runtime"),ga=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Lt({options:e,activeIndex:a,listboxId:t,view:i,selection:o,onSelect:r,onHighlight:n,onUnhighlight:p,onPreviousMonth:g,onNextMonth:m}){let v=(0,H.isoDate)(new Date),C=(0,H.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,H.cellIso)(e[a]),selected:o.selectedRange});return(0,oe.jsxs)("div",{className:F.datepicker,"data-aia-datepicker":"",children:[(0,oe.jsxs)("div",{className:F.header,children:[(0,oe.jsx)("button",{type:"button",tabIndex:-1,className:F.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:g,children:"\u2039"}),(0,oe.jsx)("span",{className:F.month,"data-aia-date-month":"","aria-live":"polite",children:(0,H.monthLabel)(i)}),(0,oe.jsx)("button",{type:"button",tabIndex:-1,className:F.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:m,children:"\u203A"})]}),(0,oe.jsx)("div",{className:F.weekdays,"aria-hidden":"true",children:H.WEEKDAY_LABELS.map((h,l)=>(0,oe.jsx)("span",{className:F.weekday,children:h},ga[l]))}),(0,oe.jsx)("div",{className:F.grid,"data-aia-date-grid":"",children:e.map((h,l)=>(0,oe.jsx)(ma,{option:h,id:`${t}-option-${l}`,index:l,isHighlighted:l===a&&h.is_tappable,isToday:(0,H.cellIso)(h)===v,isPast:(0,H.cellIso)(h)!=null&&(0,H.cellIso)(h)<v,marks:(0,H.dateCellMarks)((0,H.cellIso)(h),{selectedIso:o.selectedIso,range:C}),onSelect:r,onHighlight:n,onUnhighlight:p},(0,H.cellIso)(h)??`pad-${l}`))})]})}function ma({option:e,id:a,index:t,isHighlighted:i,isToday:o,isPast:r,marks:n,onSelect:p,onHighlight:g,onUnhighlight:m}){let[v,C]=(0,Ot.useState)(!1),h=(0,H.cellDay)(e);if(h==null)return(0,oe.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${F.cell} ${F.blank}`});let l=()=>{C(!0),p(e),setTimeout(()=>C(!1),170)},b=[F.cell,F.day,r?F.past:"",i?F.highlighted:"",o?F.today:"",n.inRange?F.inRange:"",n.selected?F.selected:"",v?F.pressed:""].filter(Boolean).join(" ");return(0,oe.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:b,onClick:l,onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),l())},onMouseEnter:()=>g(t),onMouseLeave:m?()=>m(t):void 0,children:(0,oe.jsx)("span",{className:F.number,children:h})})}var He=require("@magicx-eng/ai-autocomplete-vanilla"),st=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
1328
+ `,document.head.appendChild(e)}var N={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};var re=require("react/jsx-runtime"),va=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ht({options:e,activeIndex:i,listboxId:t,view:a,selection:o,onSelect:r,onHighlight:n,onUnhighlight:l,onPreviousMonth:u,onNextMonth:w}){let y=(0,W.isoDate)(new Date),g=(0,W.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,W.cellIso)(e[i]),selected:o.selectedRange});return(0,re.jsxs)("div",{className:N.datepicker,"data-aia-datepicker":"",children:[(0,re.jsxs)("div",{className:N.header,children:[(0,re.jsx)("button",{type:"button",tabIndex:-1,className:N.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:d=>d.preventDefault(),onClick:u,children:"\u2039"}),(0,re.jsx)("span",{className:N.month,"data-aia-date-month":"","aria-live":"polite",children:(0,W.monthLabel)(a)}),(0,re.jsx)("button",{type:"button",tabIndex:-1,className:N.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:d=>d.preventDefault(),onClick:w,children:"\u203A"})]}),(0,re.jsx)("div",{className:N.weekdays,"aria-hidden":"true",children:W.WEEKDAY_LABELS.map((d,c)=>(0,re.jsx)("span",{className:N.weekday,children:d},va[c]))}),(0,re.jsx)("div",{className:N.grid,"data-aia-date-grid":"",children:e.map((d,c)=>(0,re.jsx)(xa,{option:d,id:`${t}-option-${c}`,index:c,isHighlighted:c===i&&d.is_tappable,isToday:(0,W.cellIso)(d)===y,isPast:(0,W.cellIso)(d)!=null&&(0,W.cellIso)(d)<y,marks:(0,W.dateCellMarks)((0,W.cellIso)(d),{selectedIso:o.selectedIso,range:g}),onSelect:r,onHighlight:n,onUnhighlight:l},(0,W.cellIso)(d)??`pad-${c}`))})]})}function xa({option:e,id:i,index:t,isHighlighted:a,isToday:o,isPast:r,marks:n,onSelect:l,onHighlight:u,onUnhighlight:w}){let[y,g]=(0,Nt.useState)(!1),d=(0,W.cellDay)(e);if(d==null)return(0,re.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${N.cell} ${N.blank}`});let c=()=>{g(!0),l(e),setTimeout(()=>g(!1),170)},v=[N.cell,N.day,r?N.past:"",a?N.highlighted:"",o?N.today:"",n.inRange?N.inRange:"",n.selected?N.selected:"",y?N.pressed:""].filter(Boolean).join(" ");return(0,re.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":a,"aria-label":e.text,tabIndex:0,className:v,onClick:c,onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),c())},onMouseEnter:()=>u(t),onMouseLeave:w?()=>w(t):void 0,children:(0,re.jsx)("span",{className:N.number,children:d})})}var _e=require("@magicx-eng/ai-autocomplete-vanilla"),mt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
1299
1329
  display: flex;
1300
1330
  flex-wrap: wrap;
1301
1331
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1335,7 +1365,7 @@
1335
1365
  .aia-cluster[data-justify="around"] {
1336
1366
  justify-content: space-around;
1337
1367
  }
1338
- `,document.head.appendChild(e)}var kt=require("react/jsx-runtime");function tt({gap:e,align:a="center",justify:t="start",noWrap:i=!1,inline:o=!1,className:r,children:n,...p}){let g=e?{"--aia-cluster-gap":e}:void 0,m={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":i||void 0,"data-inline":o||void 0,style:g,...p};return o?(0,kt.jsx)("span",{...m,children:n}):(0,kt.jsx)("div",{...m,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
1368
+ `,document.head.appendChild(e)}var Pt=require("react/jsx-runtime");function lt({gap:e,align:i="center",justify:t="start",noWrap:a=!1,inline:o=!1,className:r,children:n,...l}){let u=e?{"--aia-cluster-gap":e}:void 0,w={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":i,"data-justify":t,"data-nowrap":a||void 0,"data-inline":o||void 0,style:u,...l};return o?(0,Pt.jsx)("span",{...w,children:n}):(0,Pt.jsx)("div",{...w,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
1339
1369
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
1340
1370
  room above the hint/branding row so the footer doesn't butt against the last
1341
1371
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -1482,7 +1512,7 @@
1482
1512
  justify-content: flex-end;
1483
1513
  }
1484
1514
  }
1485
- `,document.head.appendChild(e)}var Ie={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};var ve=require("react/jsx-runtime");function zt({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,He.uiStringsFor)()}){let{key:i,hint:o}=(0,He.getFooterHint)(e,a,t),[r,n]=(0,st.useState)(He.ATTRIBUTION_URL);return(0,st.useEffect)(()=>{n((0,He.buildAttributionUrl)())},[]),(0,ve.jsx)("footer",{className:Ie.footer,"data-aia-footer":"",children:(0,ve.jsxs)(tt,{justify:"between",noWrap:!0,className:Ie.row,children:[(0,ve.jsxs)(tt,{gap:"5px",className:Ie.hintGroup,children:[(0,ve.jsx)("kbd",{className:Ie.key,children:i}),(0,ve.jsx)("span",{className:Ie.hint,children:o})]}),(0,ve.jsxs)("a",{className:Ie.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[(0,ve.jsx)("span",{className:Ie.brand,children:"AI"}),(0,ve.jsx)("span",{className:Ie.badge,children:"Autocomplete"})]})]})})}var lt=require("@magicx-eng/ai-autocomplete-vanilla");var Mt=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
1515
+ `,document.head.appendChild(e)}var De={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};var Te=require("react/jsx-runtime");function Ft({isOptionHighlighted:e=!1,isInputEmpty:i=!1,strings:t=(0,_e.uiStringsFor)()}){let{key:a,hint:o}=(0,_e.getFooterHint)(e,i,t),[r,n]=(0,mt.useState)(_e.ATTRIBUTION_URL);return(0,mt.useEffect)(()=>{n((0,_e.buildAttributionUrl)())},[]),(0,Te.jsx)("footer",{className:De.footer,"data-aia-footer":"",children:(0,Te.jsxs)(lt,{justify:"between",noWrap:!0,className:De.row,children:[(0,Te.jsxs)(lt,{gap:"5px",className:De.hintGroup,children:[(0,Te.jsx)("kbd",{className:De.key,children:a}),(0,Te.jsx)("span",{className:De.hint,children:o})]}),(0,Te.jsxs)("a",{className:De.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[(0,Te.jsx)("span",{className:De.brand,children:"AI"}),(0,Te.jsx)("span",{className:De.badge,children:"Autocomplete"})]})]})})}var gt=require("@magicx-eng/ai-autocomplete-vanilla");var Bt=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
1486
1516
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
1487
1517
  The border is kept as a 1px transparent line so the box stays the same size
1488
1518
  as it was when the outline was dashed. */
@@ -1662,7 +1692,7 @@
1662
1692
  opacity: 0;
1663
1693
  }
1664
1694
  }
1665
- `,document.head.appendChild(e)}var xe={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",skeletonIn:"aia-skeletonIn-54kMv",skeletonPulse:"aia-skeletonPulse-xGcUy",skeletonOut:"aia-skeletonOut-1sJ-r"};var Be=require("react/jsx-runtime"),Ct={selected:1,first:.7,next:.4,last:.2};function Nt({label:e,state:a,rounded:t,loading:i,smartSuggestion:o,completionHeader:r,onClick:n}){let p=[xe.pill,t?xe.rounded:"",i?xe.skeleton:""].filter(Boolean).join(" ");return(0,Be.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":i?"":void 0,"data-aia-smart-suggestion":o?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:p,style:{opacity:Ct[a]},onMouseDown:g=>g.preventDefault(),onClick:i?void 0:n,disabled:i,children:o?(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsx)("span",{className:`${xe.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,Be.jsx)("span",{className:`${xe.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Mt.SMART_SUGGESTION_SPARKLE_SVG}})]}):e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
1695
+ `,document.head.appendChild(e)}var Pe={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",skeletonIn:"aia-skeletonIn-54kMv",skeletonPulse:"aia-skeletonPulse-xGcUy",skeletonOut:"aia-skeletonOut-1sJ-r"};var Ue=require("react/jsx-runtime"),It={selected:1,first:.7,next:.4,last:.2};function Wt({label:e,state:i,rounded:t,loading:a,smartSuggestion:o,completionHeader:r,onClick:n}){let l=[Pe.pill,t?Pe.rounded:"",a?Pe.skeleton:""].filter(Boolean).join(" ");return(0,Ue.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":a?"":void 0,"data-aia-smart-suggestion":o?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:l,style:{opacity:It[i]},onMouseDown:u=>u.preventDefault(),onClick:a?void 0:n,disabled:a,children:o?(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsx)("span",{className:`${Pe.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,Ue.jsx)("span",{className:`${Pe.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:Bt.SMART_SUGGESTION_SPARKLE_SVG}})]}):e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
1666
1696
  position: relative;
1667
1697
  z-index: 1;
1668
1698
  pointer-events: auto;
@@ -1672,7 +1702,7 @@
1672
1702
  align-items: center;
1673
1703
  vertical-align: middle;
1674
1704
  }
1675
- `,document.head.appendChild(e)}var St={list:"aia-list-qvLqO"};var at=require("react/jsx-runtime"),fa=[125,69];function Ft(e){return e===0?"first":e===1?"next":"last"}function dt({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:i,rounded:o,loading:r}){return r&&e.length===0?(0,at.jsx)("span",{className:St.list,"data-aia-pill-list-loading":"",children:fa.map((n,p)=>(0,at.jsx)("span",{"data-aia-pill-skeleton":"",className:`${xe.pill} ${o?xe.rounded:""} ${xe.skeleton}`,style:{width:n,opacity:Ct[Ft(p)]}},`skel-${n}`))}):(0,at.jsx)("span",{className:St.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((n,p)=>{let g=!!i&&p===a;return(0,at.jsx)(Nt,{label:n.text,state:g?"selected":Ft(p),selected:g,rounded:o,loading:r,smartSuggestion:(0,lt.isSmartSuggestion)(n),completionHeader:(0,lt.isTraditionalAutocompleteSuggestion)(n),onClick:()=>t(p)},`${n.parameter}-${n.text}`)})})}var ce=require("@magicx-eng/ai-autocomplete-vanilla"),ne=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
1705
+ `,document.head.appendChild(e)}var Et={list:"aia-list-qvLqO"};var dt=require("react/jsx-runtime"),ya=[125,69];function Gt(e){return e===0?"first":e===1?"next":"last"}function ft({pills:e,activePillIndex:i,onSelectPill:t,activeSelected:a,rounded:o,loading:r}){return r&&e.length===0?(0,dt.jsx)("span",{className:Et.list,"data-aia-pill-list-loading":"",children:ya.map((n,l)=>(0,dt.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Pe.pill} ${o?Pe.rounded:""} ${Pe.skeleton}`,style:{width:n,opacity:It[Gt(l)]}},`skel-${n}`))}):(0,dt.jsx)("span",{className:Et.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((n,l)=>{let u=!!a&&l===i;return(0,dt.jsx)(Wt,{label:n.text,state:u?"selected":Gt(l),selected:u,rounded:o,loading:r,smartSuggestion:(0,gt.isSmartSuggestion)(n),completionHeader:(0,gt.isTraditionalAutocompleteSuggestion)(n),onClick:()=>t(l)},`${n.parameter}-${n.text}`)})})}var ue=require("@magicx-eng/ai-autocomplete-vanilla"),se=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
1676
1706
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
1677
1707
  theming one package sees the same result in the other.
1678
1708
 
@@ -2116,7 +2146,7 @@
2116
2146
  .aia-section-Hugfg[data-aia-products-layout="list"] .aia-card-JBGYT[data-aia-product-has-cart] {
2117
2147
  padding-right: calc(var(--aia-product-cart-size, 28px) + 16px);
2118
2148
  }
2119
- `,document.head.appendChild(e)}var B={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",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr"};var O=require("react/jsx-runtime");function Ht({products:e,listboxId:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:r=!0,layout:n="row",imageFallback:p="image",strings:g=(0,ce.uiStringsFor)()}){let m=e.length>0,v=(0,ne.useRef)(null);if((0,ne.useEffect)(()=>{let h=v.current;if(!(!m||!h))return(0,ce.attachProductRowWheel)(h)},[m]),!m)return null;let C=`${a}-products-label`;return(0,O.jsxs)("section",{className:B.section,"data-aia-products":"","data-aia-products-layout":n,role:"group","aria-labelledby":C,children:[(0,O.jsx)("div",{className:B.label,id:C,"data-aia-products-label":"",children:g.products}),(0,O.jsx)("div",{ref:v,className:B.row,"data-aia-products-row":"",children:e.map((h,l)=>(0,O.jsx)(ba,{product:h,id:`${a}-product-${l}`,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:r,imageFallback:p,soldOut:g.soldOut,addToCart:g.addToCart},h.id))})]})}function ba({product:e,id:a,onSelect:t,onAddToCart:i,onFocusChange:o,focusable:r,imageFallback:n,soldOut:p,addToCart:g}){let m=!!i&&e.available!==!1,[v,C]=(0,ne.useState)(null),h=b=>{b.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},l=b=>{b.metaKey||b.ctrlKey||b.shiftKey||b.altKey||b.button!==0||(b.preventDefault(),t(e))};return(0,O.jsxs)("a",{id:a,className:B.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":m?"":void 0,role:"option","aria-selected":!1,style:v?{"--aia-product-photo-fill-x":String(v.x),"--aia-product-photo-fill-y":String(v.y)}:void 0,href:e.url,tabIndex:r?0:-1,onClick:l,onKeyDown:b=>{b.key!=="Enter"&&b.key!==" "||(b.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:h,children:[(0,O.jsx)(xa,{sources:(0,ce.productImageSources)(e.imageUrl),title:e.title,fallback:n,onPhotoFill:C},(0,ce.productImageSrc)(e.imageUrl)??""),(0,O.jsxs)("span",{className:B.body,children:[e.vendor?(0,O.jsx)("span",{className:B.vendor,children:e.vendor}):null,(0,O.jsx)("span",{className:B.title,children:e.title}),e.price?(0,O.jsx)("span",{className:B.price,children:e.price}):null,e.available===!1?(0,O.jsx)("span",{className:B.badge,children:p}):null]}),m&&i?(0,O.jsx)(va,{product:e,label:`${g}: ${e.title}`,focusable:r,onAddToCart:i,onFocus:()=>o?.(!0),onBlur:h},wa(e)):null]})}function wa(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(a=>a??"").join("\0")}function va({product:e,label:a,focusable:t,onAddToCart:i,onFocus:o,onBlur:r}){let[n,p]=(0,ne.useState)(null),g=(0,ne.useRef)(null),m=(0,ne.useRef)(e);m.current=e;let v=(0,ne.useRef)(!0);(0,ne.useEffect)(()=>(v.current=!0,()=>{v.current=!1}),[]);let C=l=>{g.current=l,v.current&&p(l)},h=l=>{if(l.preventDefault(),l.stopPropagation(),g.current==="adding")return;C("adding");let b;try{b=Promise.resolve(i(m.current))}catch(R){b=Promise.reject(R)}b.then(()=>C("added"),()=>C(null))};return(0,O.jsx)("span",{className:B.cart,"data-aia-product-cart":"","data-aia-cart-state":n??void 0,"aria-busy":n==="adding"?!0:void 0,role:"button","aria-label":a,tabIndex:t?0:-1,onClick:h,onKeyDown:l=>{l.key!=="Enter"&&l.key!==" "||h(l)},onFocus:l=>{l.stopPropagation(),o()},onBlur:l=>{l.stopPropagation(),r(l)},children:(0,O.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,O.jsx)("path",{className:B.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),(0,O.jsx)("path",{className:B.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,O.jsx)("path",{className:B.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,O.jsx)("path",{className:B.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,O.jsx)("circle",{className:B.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,O.jsx)("circle",{className:B.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function xa({sources:e,title:a,fallback:t,onPhotoFill:i}){let[o,r]=(0,ne.useState)(0),n=e[o],p=!!n,[g,m]=(0,ne.useState)(null),v=!p&&t==="initial";return(0,ne.useEffect)(()=>()=>i(null),[i]),(0,O.jsxs)("span",{className:B.media,"aria-hidden":"true","data-aia-product-placeholder":!p&&!v?"":void 0,"data-aia-product-initial":v?"":void 0,"data-aia-image-loaded":p&&g===n?"":void 0,children:[p?(0,O.jsx)("img",{className:B.image,src:n,alt:"",loading:"lazy",decoding:"async",onLoad:C=>{m(n),i((0,ce.productPhotoFill)(C.currentTarget.naturalWidth,C.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),r(C=>C+1)}}):null,v?(0,ce.productInitial)(a):null]})}var _=require("@magicx-eng/ai-autocomplete-vanilla"),ye=require("react");var Bt=require("@magicx-eng/ai-autocomplete-vanilla"),ct=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
2149
+ `,document.head.appendChild(e)}var G={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",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr"};var L=require("react/jsx-runtime");function Kt({products:e,listboxId:i,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r=!0,layout:n="row",imageFallback:l="image",strings:u=(0,ue.uiStringsFor)()}){let w=e.length>0,y=(0,se.useRef)(null);if((0,se.useEffect)(()=>{let d=y.current;if(!(!w||!d))return(0,ue.attachProductRowWheel)(d)},[w]),!w)return null;let g=`${i}-products-label`;return(0,L.jsxs)("section",{className:G.section,"data-aia-products":"","data-aia-products-layout":n,role:"group","aria-labelledby":g,children:[(0,L.jsx)("div",{className:G.label,id:g,"data-aia-products-label":"",children:u.products}),(0,L.jsx)("div",{ref:y,className:G.row,"data-aia-products-row":"",children:e.map((d,c)=>(0,L.jsx)(ka,{product:d,id:`${i}-product-${c}`,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r,imageFallback:l,soldOut:u.soldOut,addToCart:u.addToCart},d.id))})]})}function ka({product:e,id:i,onSelect:t,onAddToCart:a,onFocusChange:o,focusable:r,imageFallback:n,soldOut:l,addToCart:u}){let w=!!a&&e.available!==!1,[y,g]=(0,se.useState)(null),d=v=>{v.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},c=v=>{v.metaKey||v.ctrlKey||v.shiftKey||v.altKey||v.button!==0||(v.preventDefault(),t(e))};return(0,L.jsxs)("a",{id:i,className:G.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":w?"":void 0,role:"option","aria-selected":!1,style:y?{"--aia-product-photo-fill-x":String(y.x),"--aia-product-photo-fill-y":String(y.y)}:void 0,href:e.url,tabIndex:r?0:-1,onClick:c,onKeyDown:v=>{v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),t(e))},onFocus:()=>o?.(!0),onBlur:d,children:[(0,L.jsx)(Ta,{sources:(0,ue.productImageSources)(e.imageUrl),title:e.title,fallback:n,onPhotoFill:g},(0,ue.productImageSrc)(e.imageUrl)??""),(0,L.jsxs)("span",{className:G.body,children:[e.vendor?(0,L.jsx)("span",{className:G.vendor,children:e.vendor}):null,(0,L.jsx)("span",{className:G.title,children:e.title}),e.price?(0,L.jsx)("span",{className:G.price,children:e.price}):null,e.available===!1?(0,L.jsx)("span",{className:G.badge,children:l}):null]}),w&&a?(0,L.jsx)(Ca,{product:e,label:`${u}: ${e.title}`,focusable:r,onAddToCart:a,onFocus:()=>o?.(!0),onBlur:d},Sa(e)):null]})}function Sa(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(i=>i??"").join("\0")}function Ca({product:e,label:i,focusable:t,onAddToCart:a,onFocus:o,onBlur:r}){let[n,l]=(0,se.useState)(null),u=(0,se.useRef)(null),w=(0,se.useRef)(e);w.current=e;let y=(0,se.useRef)(!0);(0,se.useEffect)(()=>(y.current=!0,()=>{y.current=!1}),[]);let g=c=>{u.current=c,y.current&&l(c)},d=c=>{if(c.preventDefault(),c.stopPropagation(),u.current==="adding")return;g("adding");let v;try{v=Promise.resolve(a(w.current))}catch(R){v=Promise.reject(R)}v.then(()=>g("added"),()=>g(null))};return(0,L.jsx)("span",{className:G.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:(0,L.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,L.jsx)("path",{className:G.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),(0,L.jsx)("path",{className:G.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,L.jsx)("path",{className:G.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,L.jsx)("path",{className:G.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,L.jsx)("circle",{className:G.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,L.jsx)("circle",{className:G.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ta({sources:e,title:i,fallback:t,onPhotoFill:a}){let[o,r]=(0,se.useState)(0),n=e[o],l=!!n,[u,w]=(0,se.useState)(null),y=!l&&t==="initial";return(0,se.useEffect)(()=>()=>a(null),[a]),(0,L.jsxs)("span",{className:G.media,"aria-hidden":"true","data-aia-product-placeholder":!l&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":l&&u===n?"":void 0,children:[l?(0,L.jsx)("img",{className:G.image,src:n,alt:"",loading:"lazy",decoding:"async",onLoad:g=>{w(n),a((0,ue.productPhotoFill)(g.currentTarget.naturalWidth,g.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&a(null),r(g=>g+1)}}):null,y?(0,ue.productInitial)(i):null]})}var Y=require("@magicx-eng/ai-autocomplete-vanilla"),Ie=require("react");var qt=require("@magicx-eng/ai-autocomplete-vanilla"),bt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
2120
2150
  display: grid;
2121
2151
  grid-template-columns: repeat(
2122
2152
  auto-fit,
@@ -2152,7 +2182,7 @@
2152
2182
  .aia-grid[data-scroll]::-webkit-scrollbar {
2153
2183
  display: none;
2154
2184
  }
2155
- `,document.head.appendChild(e)}var Kt=require("react/jsx-runtime");function Gt({min:e="16rem",max:a,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:r,cols:n,template:p,innerRef:g,className:m,children:v,...C}){let h=(0,ct.useRef)(null);(0,ct.useLayoutEffect)(()=>{if(r===void 0)return;let b=h.current;b&&(b.scrollTop=0)},[r]);let l={"--aia-grid-min":e};return a&&(l["--aia-grid-max"]=a),t&&(l["--aia-grid-gap"]=t),o&&(l["--aia-grid-max-height"]=o),n&&(l.gridTemplateColumns=(0,Bt.optionsGridTemplateColumns)(n)),p&&(l.gridTemplateColumns=p),(0,Kt.jsx)("div",{ref:b=>{h.current=b,g?.(b)},className:m?`aia-grid ${m}`:"aia-grid","data-scroll":i||void 0,style:l,...C,children:v})}var le=require("@magicx-eng/ai-autocomplete-vanilla"),he=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
2185
+ `,document.head.appendChild(e)}var Ut=require("react/jsx-runtime");function _t({min:e="16rem",max:i,gap:t,scroll:a=!1,maxHeight:o,scrollResetKey:r,cols:n,template:l,innerRef:u,className:w,children:y,...g}){let d=(0,bt.useRef)(null);(0,bt.useLayoutEffect)(()=>{if(r===void 0)return;let v=d.current;v&&(v.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=(0,qt.optionsGridTemplateColumns)(n)),l&&(c.gridTemplateColumns=l),(0,Ut.jsx)("div",{ref:v=>{d.current=v,u?.(v)},className:w?`aia-grid ${w}`:"aia-grid","data-scroll":a||void 0,style:c,...g,children:y})}var de=require("@magicx-eng/ai-autocomplete-vanilla"),ve=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
2156
2186
  position: relative;
2157
2187
  /* Clip, not visible: the entrance rise below runs on the inner content,
2158
2188
  and a transformed box extends its scroll container's scrollable area.
@@ -2610,7 +2640,163 @@
2610
2640
  opacity: 0;
2611
2641
  }
2612
2642
  }
2613
- `,document.head.appendChild(e)}var Z={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"};var X=require("react/jsx-runtime");function qt({option:e,isHighlighted:a,onSelect:t,onHighlight:i,onUnhighlight:o,id:r,loading:n,showIcon:p=!0,showImage:g=!0,showCount:m=!0,scrollHint:v,enterDelayMs:C=0}){let[h]=(0,he.useState)(C),[l,b]=(0,he.useState)(!1),R=g?(0,le.optionImageSources)(e.image_url):[],K=R[0]??null,[$,J]=(0,he.useState)([]),A=R.find(z=>!$.includes(z))??null,[M,q]=(0,he.useState)(null),P=(0,he.useMemo)(()=>!K&&p&&e.icon_svg?(0,le.sanitizeOptionIconSvg)(e.icon_svg):null,[K,p,e.icon_svg]),ee=m?(0,le.formatOptionCount)(e.item_count):null,U=(0,he.useRef)(void 0);(0,he.useEffect)(()=>()=>clearTimeout(U.current),[]);let Y=()=>{n||!e.is_tappable||l||(b(!0),t(e),clearTimeout(U.current),U.current=setTimeout(()=>b(!1),170))},pe=[Z.item,a&&!n?Z.highlighted:"",e.is_tappable?Z.tappable:Z.nonTappable,l?Z.pressed:"",v?Z.scrollHint:""].filter(Boolean).join(" ");return(0,X.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":n?"":void 0,"data-aia-icon":P&&e.icon?e.icon:void 0,"data-aia-image":K?"":void 0,"data-aia-item-count":ee!==null?e.item_count:void 0,"aria-selected":a,className:pe,style:{[le.OPTION_ENTER_DELAY_VAR]:`${h}ms`},tabIndex:n||!e.is_tappable?-1:0,onClick:Y,onKeyDown:z=>{!n&&e.is_tappable&&(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),Y())},onMouseEnter:!n&&e.is_tappable?i:void 0,onMouseLeave:o,children:(0,X.jsxs)("span",{className:Z.content,children:[K&&(0,X.jsx)("span",{className:`${Z.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":A!==null&&M===A?"":void 0,children:(0,X.jsx)("img",{src:A??K,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:A===null,onLoad:()=>q(A),onError:()=>{A!==null&&J(z=>[...z,A])}})}),P&&(0,X.jsx)("span",{className:`${Z.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:P}}),(0,X.jsxs)("span",{className:Z.text,children:[e.matchedText?(0,le.highlightParts)((0,le.optionLabel)(e),e.matchedText).map((z,te)=>z.bold?(0,X.jsx)("strong",{className:`${Z.match} magicx-aia-option-match`,children:z.text},te):z.text):(0,le.optionLabel)(e),e.parameterLabel&&(0,X.jsxs)(X.Fragment,{children:[" ",(0,X.jsx)("span",{className:`${Z.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,X.jsx)("span",{className:Z.tag,children:e.tag}),ee!==null&&(0,X.jsx)("span",{className:`${Z.count} magicx-aia-option-count`,children:ee})]})})}var Pt=require("react/jsx-runtime");function ya(){let[e,a]=(0,ye.useState)(_.isOptionsGridMobileViewport);return(0,ye.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(_.OPTIONS_GRID_MOBILE_QUERY),i=()=>a(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function Wt({options:e,activeIndex:a,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:r,loading:n,groupKey:p="",optionsPosition:g="below",showIcons:m=!0,showImages:v=!0,showCounts:C=!0}){let h=ya(),l=(0,ye.useRef)(null),[b,R]=(0,ye.useState)(null),K=(0,ye.useRef)(null);(0,ye.useLayoutEffect)(()=>{if(n&&(0,_.sameOptionRows)(K.current,e))return;K.current=n?null:e;let A=l.current,q=A&&!n&&(0,_.needsOptionsGridMeasurement)(e.length,h)?(0,_.measureOptionsGrid)(A):null;R(q?(0,_.planOptionsGrid)(e.length,h,q.rowWidths,q.gridWidth):null)},[e,h,n]);let $=b??(0,_.planOptionsGrid)(e.length,h,null,null),J=(0,_.optionsShowLeadingVisuals)(e,m,v);return(0,Pt.jsx)(Gt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:p,template:$.template,maxHeight:$.maxHeight,innerRef:A=>{l.current=A},"data-aia-group":p,children:e.map((A,M)=>(0,Pt.jsx)(qt,{option:A,isHighlighted:M===a,onSelect:t,onHighlight:()=>i(M),onUnhighlight:o?()=>o(M):void 0,id:`${r}-option-${M}`,loading:n,showIcon:m&&J,showImage:v&&J,showCount:C,scrollHint:!n&&$.scrollHintIndices.includes(M),enterDelayMs:n?0:(0,_.optionEnterDelayMs)(M,$.cols,e.length,g)},`${p}\0${A.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
2643
+
2644
+ .aia-content-T-Qba:has(.aia-checkbox-KGRhg) {
2645
+ display: flex;
2646
+ align-items: center;
2647
+ gap: 10px;
2648
+ }
2649
+
2650
+ .aia-checkbox-KGRhg {
2651
+ display: inline-flex;
2652
+ align-items: center;
2653
+ justify-content: center;
2654
+ flex: 0 0 18px;
2655
+ width: 18px;
2656
+ height: 18px;
2657
+ border: 1px solid var(--aia-border);
2658
+ border-radius: 6px;
2659
+ background: var(--aia-surface);
2660
+ color: transparent;
2661
+ font-size: 11px;
2662
+ line-height: 1;
2663
+ }
2664
+
2665
+ .aia-checkbox-KGRhg[data-checked="true"] {
2666
+ background: rgba(var(--aia-streak-rgb, 99, 102, 241), 0.16);
2667
+ border-color: rgba(var(--aia-streak-rgb, 99, 102, 241), 0.45);
2668
+ color: rgb(var(--aia-streak-rgb, 99, 102, 241));
2669
+ }
2670
+
2671
+ .aia-item-d4vpD:has(.aia-checkbox-KGRhg[data-checked="true"]) {
2672
+ background: var(--aia-option-bg, transparent);
2673
+ }
2674
+ `,document.head.appendChild(e)}var Z={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"};var X=require("react/jsx-runtime");function Vt({option:e,isHighlighted:i,checked:t,onSelect:a,onHighlight:o,onUnhighlight:r,id:n,loading:l,showIcon:u=!0,showImage:w=!0,showCount:y=!0,scrollHint:g,enterDelayMs:d=0}){let[c]=(0,ve.useState)(d),[v,R]=(0,ve.useState)(!1),ie=w?(0,de.optionImageSources)(e.image_url):[],_=ie[0]??null,[Q,te]=(0,ve.useState)([]),A=ie.find(O=>!Q.includes(O))??null,[M,C]=(0,ve.useState)(null),oe=(0,ve.useMemo)(()=>!_&&u&&e.icon_svg?(0,de.sanitizeOptionIconSvg)(e.icon_svg):null,[_,u,e.icon_svg]),U=y?(0,de.formatOptionCount)(e.item_count):null,V=(0,ve.useRef)(void 0);(0,ve.useEffect)(()=>()=>clearTimeout(V.current),[]);let ce=()=>{l||!e.is_tappable||v&&t===void 0||(R(!0),a(e),clearTimeout(V.current),V.current=setTimeout(()=>R(!1),170))},ge=[Z.item,i&&!l?Z.highlighted:"",e.is_tappable?Z.tappable:Z.nonTappable,v?Z.pressed:"",g?Z.scrollHint:""].filter(Boolean).join(" ");return(0,X.jsx)("div",{id:n,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":oe&&e.icon?e.icon:void 0,"data-aia-image":_?"":void 0,"data-aia-item-count":U!==null?e.item_count:void 0,"aria-selected":t??i,className:ge,style:{[de.OPTION_ENTER_DELAY_VAR]:`${c}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:ce,onKeyDown:O=>{!l&&e.is_tappable&&(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),ce())},onMouseEnter:!l&&e.is_tappable?o:void 0,onMouseLeave:r,children:(0,X.jsxs)("span",{className:Z.content,children:[t!==void 0&&(0,X.jsx)("span",{className:Z.checkbox,"aria-hidden":"true","data-checked":t,children:t?"\u2713":""}),_&&(0,X.jsx)("span",{className:`${Z.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":A!==null&&M===A?"":void 0,children:(0,X.jsx)("img",{src:A??_,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:A===null,onLoad:()=>C(A),onError:()=>{A!==null&&te(O=>[...O,A])}})}),oe&&(0,X.jsx)("span",{className:`${Z.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:oe}}),(0,X.jsxs)("span",{className:Z.text,children:[e.matchedText?(0,de.highlightParts)((0,de.optionLabel)(e),e.matchedText).map((O,fe)=>O.bold?(0,X.jsx)("strong",{className:`${Z.match} magicx-aia-option-match`,children:O.text},fe):O.text):(0,de.optionLabel)(e),e.parameterLabel&&(0,X.jsxs)(X.Fragment,{children:[" ",(0,X.jsx)("span",{className:`${Z.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,X.jsx)("span",{className:Z.tag,children:e.tag}),U!==null&&(0,X.jsx)("span",{className:`${Z.count} magicx-aia-option-count`,children:U})]})})}var At=require("react/jsx-runtime");function Pa(){let[e,i]=(0,Ie.useState)(Y.isOptionsGridMobileViewport);return(0,Ie.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(Y.OPTIONS_GRID_MOBILE_QUERY),a=()=>i(t.matches);return a(),t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[]),e}function Yt({options:e,activeIndex:i,picked:t,onSelect:a,onHighlight:o,onUnhighlight:r,listboxId:n,loading:l,groupKey:u="",optionsPosition:w="below",showIcons:y=!0,showImages:g=!0,showCounts:d=!0}){let c=Pa(),v=(0,Ie.useRef)(null),[R,ie]=(0,Ie.useState)(null),_=(0,Ie.useRef)(null);(0,Ie.useLayoutEffect)(()=>{if(l&&(0,Y.sameOptionRows)(_.current,e))return;_.current=l?null:e;let A=v.current,C=A&&!l&&(0,Y.needsOptionsGridMeasurement)(e.length,c)?(0,Y.measureOptionsGrid)(A):null;ie(C?(0,Y.planOptionsGrid)(e.length,c,C.rowWidths,C.gridWidth):null)},[e,c,l]);let Q=R??(0,Y.planOptionsGrid)(e.length,c,null,null),te=(0,Y.optionsShowLeadingVisuals)(e,y,g);return(0,At.jsx)(_t,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:u,template:Q.template,maxHeight:Q.maxHeight,innerRef:A=>{v.current=A},"data-aia-group":u,children:e.map((A,M)=>(0,At.jsx)(Vt,{option:A,isHighlighted:M===i,checked:t?t.includes(A.text):void 0,onSelect:a,onHighlight:()=>o(M),onUnhighlight:r?()=>r(M):void 0,id:`${n}-option-${M}`,loading:l,showIcon:y&&te,showImage:g&&te,showCount:d,scrollHint:!l&&Q.scrollHintIndices.includes(M),enterDelayMs:l?0:(0,Y.optionEnterDelayMs)(M,Q.cols,e.length,w)},`${u}\0${A.text}`))})}var J=require("@magicx-eng/ai-autocomplete-vanilla"),ye=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
2675
+
2676
+ One of three hand-maintained copies (vanilla styles.css, this file, Angular's
2677
+ time-wheel.component.css). Only the class-naming layer differs \u2014 the
2678
+ declarations must match, and \`timeWheelParity.test.ts\` fails the build if
2679
+ they drift. See CLAUDE.md's duplicated-stylesheet rule.
2680
+
2681
+ Colours go through the same --aia-option-* chain as the option rows and the
2682
+ calendar (see DateGrid.module.css for why). The 30px row height is
2683
+ load-bearing: the component turns a column's scroll offset into a row as
2684
+ \`scrollTop / 30\` (TIME_WHEEL_ROW_HEIGHT in the core), so it is not a token. */
2685
+ .aia-timeWheel-KdR4A {
2686
+ display: flex;
2687
+ flex-direction: column;
2688
+ align-items: center;
2689
+ gap: 8px;
2690
+ padding: 6px 6px 4px;
2691
+ }
2692
+
2693
+ /* Announces the time to AT (the wheels themselves are aria-hidden). */
2694
+ .aia-value--wqvm {
2695
+ position: absolute;
2696
+ width: 1px;
2697
+ height: 1px;
2698
+ overflow: hidden;
2699
+ clip-path: inset(50%);
2700
+ white-space: nowrap;
2701
+ }
2702
+
2703
+ .aia-columns-TaD-f {
2704
+ position: relative;
2705
+ display: flex;
2706
+ align-items: flex-start;
2707
+ justify-content: center;
2708
+ gap: 2px;
2709
+ width: 100%;
2710
+ }
2711
+
2712
+ /* The one soft band the chosen time sits in, behind the wheels' top rows. */
2713
+ .aia-band-pVy-f {
2714
+ position: absolute;
2715
+ top: 0;
2716
+ right: 0;
2717
+ left: 0;
2718
+ height: 30px;
2719
+ border-radius: 8px;
2720
+ background: var(--aia-time-band-bg, rgba(var(--aia-streak-rgb, 255, 255, 255), 0.08));
2721
+ pointer-events: none;
2722
+ }
2723
+
2724
+ .aia-column-lwtdd {
2725
+ position: relative;
2726
+ flex: 0 0 auto;
2727
+ width: 44px;
2728
+ /* Three rows show: the chosen one and the two after it. The bottom padding
2729
+ lets the last row scroll up to the top; border-box keeps it inside those
2730
+ 90px, where it only adds scroll range, rather than adding 60px of visible
2731
+ column below them. */
2732
+ height: 90px;
2733
+ padding-bottom: 60px;
2734
+ box-sizing: border-box;
2735
+ overflow-y: auto;
2736
+ overscroll-behavior: contain;
2737
+ scroll-snap-type: y mandatory;
2738
+ scrollbar-width: none;
2739
+ -webkit-mask-image: linear-gradient(to bottom, #000 34%, transparent 100%);
2740
+ mask-image: linear-gradient(to bottom, #000 34%, transparent 100%);
2741
+ }
2742
+
2743
+ .aia-column-lwtdd::-webkit-scrollbar {
2744
+ display: none;
2745
+ }
2746
+
2747
+ .aia-row-A3pAx {
2748
+ display: flex;
2749
+ align-items: center;
2750
+ justify-content: center;
2751
+ height: 30px;
2752
+ scroll-snap-align: start;
2753
+ font-family: inherit;
2754
+ font-size: var(--aia-time-font-size, 15px);
2755
+ font-variant-numeric: tabular-nums;
2756
+ font-weight: 450;
2757
+ line-height: 20px;
2758
+ color: var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));
2759
+ cursor: pointer;
2760
+ }
2761
+
2762
+ .aia-selected-xgOWY {
2763
+ color: var(--aia-option-color-selected, var(--aia-color-text-default, #fff));
2764
+ font-weight: 500;
2765
+ }
2766
+
2767
+ .aia-separator-kX9WO {
2768
+ display: flex;
2769
+ align-items: center;
2770
+ height: 30px;
2771
+ font-size: var(--aia-time-font-size, 15px);
2772
+ font-weight: 500;
2773
+ line-height: 20px;
2774
+ color: var(--aia-option-color-selected, var(--aia-color-text-default, #fff));
2775
+ }
2776
+
2777
+ .aia-done-llNY5 {
2778
+ align-self: stretch;
2779
+ height: 32px;
2780
+ padding: 0 12px;
2781
+ border: none;
2782
+ border-radius: 8px;
2783
+ background: var(--aia-time-done-bg, rgba(var(--aia-streak-rgb, 255, 255, 255), 0.1));
2784
+ font-family: inherit;
2785
+ font-size: 13px;
2786
+ font-weight: 500;
2787
+ line-height: 20px;
2788
+ color: var(
2789
+ --aia-time-done-color,
2790
+ var(--aia-option-color-selected, var(--aia-color-text-default, #fff))
2791
+ );
2792
+ cursor: pointer;
2793
+ transition: background-color 150ms ease-out;
2794
+ }
2795
+
2796
+ .aia-done-llNY5:hover {
2797
+ background: var(--aia-time-done-bg-hover, rgba(var(--aia-streak-rgb, 255, 255, 255), 0.16));
2798
+ }
2799
+ `,document.head.appendChild(e)}var xe={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};var me=require("react/jsx-runtime"),Ia=120;function jt({view:e,label:i,doneLabel:t,interactive:a=!0,onTimeChange:o,onTimeCommit:r}){return(0,me.jsxs)("div",{className:xe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":i,onMouseDown:n=>n.preventDefault(),children:[(0,me.jsx)("span",{className:xe.value,"data-aia-time-value":"","aria-live":"polite",children:(0,J.formatTime)(e.minutes)}),(0,me.jsxs)("div",{className:xe.columns,"aria-hidden":"true",children:[(0,me.jsx)("div",{className:xe.band}),J.TIME_WHEEL_COLUMNS.map(n=>(0,me.jsxs)(ye.Fragment,{children:[n==="minute"&&(0,me.jsx)("span",{className:xe.separator,children:":"}),(0,me.jsx)(Ea,{column:n,minutes:e.minutes,interactive:a,onTimeChange:o})]},n))]}),(0,me.jsx)("button",{type:"button",tabIndex:-1,className:xe.done,"data-aia-time-done":"",onClick:()=>{a&&r()},children:t})]})}function Ea({column:e,minutes:i,interactive:t,onTimeChange:a}){let o=(0,ye.useRef)(null),r=(0,ye.useRef)(null),n=(0,ye.useRef)(null),l=(0,ye.useRef)({minutes:i,interactive:t,onTimeChange:a});l.current={minutes:i,interactive:t,onTimeChange:a};let u=(0,J.timeWheelIndex)(e,i);(0,ye.useLayoutEffect)(()=>{let g=o.current;if(!g||n.current)return;let d=u*J.TIME_WHEEL_ROW_HEIGHT;Math.abs(g.scrollTop-d)<1||(r.current=d,g.scrollTop=d)},[u]),(0,ye.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]);let w=()=>{n.current=null;let g=o.current,d=l.current;if(!g||!d.interactive)return;let c=(0,J.timeWheelIndexFromScroll)(e,g.scrollTop);c!==(0,J.timeWheelIndex)(e,d.minutes)&&d.onTimeChange((0,J.withTimeWheelIndex)(e,d.minutes,c))},y=()=>{let g=o.current;if(g){if(r.current!=null&&Math.abs(g.scrollTop-r.current)<1){r.current=null;return}r.current=null,n.current&&clearTimeout(n.current),n.current=setTimeout(w,Ia)}};return(0,me.jsx)("div",{ref:o,className:xe.column,"data-aia-time-column":e,onScroll:y,children:(0,J.timeWheelRows)(e).map((g,d)=>(0,me.jsx)("div",{className:d===u?`${xe.row} ${xe.selected}`:xe.row,"data-aia-time-row":"","data-aia-index":d,onClick:()=>{l.current.interactive&&a((0,J.withTimeWheelIndex)(e,l.current.minutes,d))},children:g.label},g.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
2614
2800
  display: flex;
2615
2801
  flex-direction: column;
2616
2802
  gap: var(--aia-stack-space, 0.5rem);
@@ -2625,7 +2811,7 @@
2625
2811
  align-items: end;
2626
2812
  }
2627
2813
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
2628
- `,document.head.appendChild(e)}var _t=require("react/jsx-runtime");function Ut({space:e,align:a="stretch",className:t,children:i,...o}){let r=e?{"--aia-stack-space":e}:void 0;return(0,_t.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:r,...o,children:i})}var j=require("react/jsx-runtime"),ka=[159,119,164],Ca=()=>{},jt=()=>{};function Sa(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=(0,Q.useState)(a);if((0,Q.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>i(o.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Pa(e,a){let t=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let i=e.current,o=a.current;if(!i||!o)return;let r=i.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==r&&(t.current.controller.destroy(),t.current=null),r&&!t.current){t.current={grid:r,controller:(0,re.attachScrollArrow)({dropdown:i,grid:r,button:o})};return}t.current?.controller.update()}),(0,Q.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ta(e,a){let t=(0,Q.useRef)(a);t.current=a;let i=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,re.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),(0,Q.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function pt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:r,id:n,className:p,pills:g,onPillClick:m,showPills:v=!0,onSkip:C,showSkipButton:h=!0,showOptionIcons:l=!0,showOptionImages:b=!0,showOptionCounts:R=!0,skipDisabled:K=!1,activeSelected:$=!1,isLoading:J=!1,skeletonExiting:A=!1,isInputEmpty:M=!1,language:q,products:P,onProductSelect:ee,onProductAddToCart:U,onProductFocusChange:Y,productsLayout:pe="row",productImageFallback:z="image",formatType:te="options",dateView:ke=null,selectedDateIso:Ee=null,selectedDateRange:Ce=null,dateRangeStart:qe=null,onPreviousMonth:Ae,onNextMonth:f,optionsPosition:Re="below",mode:De}){let Se=Sa(De),Oe=Se!==void 0,de=(0,Q.useRef)(null),d=(0,Q.useRef)(null);Pa(de,d),(0,Q.useEffect)(()=>{if(de.current)return(0,re.containScroll)(de.current)},[]);let x=e[0]?.options??[],k=!!(g&&g.length>0&&m),I=!!(P&&P.length>0),S=r&&(x.length>0||v&&k||J||I);Ta(de,S);let N={suggestions:e,activeIndex:a,pills:g,showPills:v,showSkipButton:h,showOptionIcons:l,showOptionImages:b,showOptionCounts:R,skipDisabled:K,activeSelected:$,isLoading:J,skeletonExiting:A,isInputEmpty:M,products:P,formatType:te,dateView:ke,selectedDateIso:Ee,selectedDateRange:Ce,dateRangeStart:qe},se=(0,Q.useRef)(N);S&&(se.current=N);let u=S?N:se.current,ae=(0,re.uiStringsFor)(q),ge=u.suggestions[0],me=ge?.options??[],We=u.activeIndex>=0&&!!me[u.activeIndex]?.is_tappable,fe=(0,re.labelTraditionalAutocomplete)(u.pills??[],ae.keepTyping),be=!!(fe.length>0&&m),Ue=u.showPills&&be,Pe=u.showPills&&!be&&u.isLoading,Le=Ue||Pe,ze=be&&(0,re.hasSkippablePill)(fe)&&u.showSkipButton&&!u.isInputEmpty&&!!C,y=fe[0]?.text,Ye=(0,re.isCalendarFormat)(u.formatType)&&u.dateView!=null,Qe=me.length>0&&!Ye,we=me.length>0&&Ye&&!u.isLoading,w=u.isLoading&&!Qe&&!we,Me=u.products??[];return(0,j.jsxs)("div",{ref:de,id:n,role:"listbox","data-aia-dropdown":"","data-options-position":Re,"data-mode":Se,"data-aia-loading":u.isLoading?"":void 0,"data-aia-skeleton-exiting":u.skeletonExiting?"":void 0,"data-aia-has-products":Me.length>0?"":void 0,className:`${Oe?"magicx-aia ":""}${Te.dropdown} ${S?Te.visible:""} ${p??""}`,onMouseDown:Ne=>Ne.preventDefault(),children:[(0,j.jsxs)(Ut,{space:"8px",children:[(Le||ze)&&(0,j.jsxs)(tt,{noWrap:!0,className:Te.pillBar,"data-aia-pillbar":"",children:[Le&&(0,j.jsx)("span",{className:Te.pillScroll,"data-aia-pill-scroll":"",children:(0,j.jsx)(dt,{pills:fe,activePillIndex:0,activeSelected:u.activeSelected,onSelectPill:m??(()=>{}),rounded:!0,loading:u.isLoading})}),ze&&(0,j.jsx)("button",{type:"button",tabIndex:-1,className:Te.skip,"data-aia-skip":"",disabled:u.isLoading||u.skipDisabled,"aria-label":y?`${ae.skipLabel} ${y}`:ae.skipLabel,onClick:C,children:ae.skip})]}),Qe&&(0,j.jsx)(Wt,{options:me,activeIndex:u.activeIndex,onSelect:t,onHighlight:i,onUnhighlight:o,listboxId:n,loading:u.isLoading,groupKey:ge?`${ge.parameter} ${ge.text}`:"",optionsPosition:Re,showIcons:u.showOptionIcons,showImages:u.showOptionImages,showCounts:u.showOptionCounts}),we&&u.dateView&&(0,j.jsx)(Lt,{options:me,activeIndex:u.activeIndex,listboxId:n,view:u.dateView,selection:{selectedIso:u.selectedDateIso??null,selectedRange:u.selectedDateRange??null,rangeStart:u.dateRangeStart??null},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:Ae??jt,onNextMonth:f??jt}),w&&(0,j.jsx)("div",{className:Te.skeletonBars,"data-aia-skeleton-bars":"",children:ka.map(Ne=>(0,j.jsx)("span",{className:Te.skeletonBar,style:{width:Ne}},`bar-${Ne}`))}),(0,j.jsx)(Ht,{products:Me,listboxId:n,onSelect:ee??Ca,onAddToCart:U,onFocusChange:Y,focusable:S,layout:pe,imageFallback:z,strings:ae}),(0,j.jsx)(zt,{isOptionHighlighted:We,isInputEmpty:u.isInputEmpty,strings:ae})]}),(0,j.jsx)("button",{ref:d,type:"button",tabIndex:-1,className:Te.scrollArrow,"data-aia-scroll-arrow":"","aria-label":ae.scrollArrow,"aria-hidden":"true",children:(0,j.jsx)("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,j.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Ke=require("@magicx-eng/ai-autocomplete-vanilla");var Yt=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
2814
+ `,document.head.appendChild(e)}var $t=require("react/jsx-runtime");function Qt({space:e,align:i="stretch",className:t,children:a,...o}){let r=e?{"--aia-stack-space":e}:void 0;return(0,$t.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":i,style:r,...o,children:a})}var H=require("react/jsx-runtime"),Aa=[159,119,164],Ra=()=>{},Zt=()=>{},Oa=e=>{},Da=()=>{};function La(e){let i=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,a]=(0,ee.useState)(i);if((0,ee.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),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 Ma(e,i){let t=(0,ee.useRef)(null);(0,ee.useEffect)(()=>{let a=e.current,o=i.current;if(!a||!o)return;let r=a.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==r&&(t.current.controller.destroy(),t.current=null),r&&!t.current){t.current={grid:r,controller:(0,le.attachScrollArrow)({dropdown:a,grid:r,button:o})};return}t.current?.controller.update()}),(0,ee.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function za(e,i){let t=(0,ee.useRef)(i);t.current=i;let a=(0,ee.useRef)(null);(0,ee.useEffect)(()=>{let o=e.current;if(o){if(!a.current){a.current=(0,le.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}a.current.update()}}),(0,ee.useEffect)(()=>()=>{a.current?.destroy(),a.current=null},[])}function wt({suggestions:e,activeIndex:i,onSelect:t,onHighlight:a,onUnhighlight:o,isOpen:r,id:n,className:l,pills:u,onPillClick:w,showPills:y=!0,onSkip:g,showSkipButton:d=!0,showOptionIcons:c=!0,showOptionImages:v=!0,showOptionCounts:R=!0,skipDisabled:ie=!1,activeSelected:_=!1,isLoading:Q=!1,skeletonExiting:te=!1,isInputEmpty:A=!1,language:M,products:C,onProductSelect:oe,onProductAddToCart:U,onProductFocusChange:V,productsLayout:ce="row",productImageFallback:ge="image",formatType:O="options",dateView:fe=null,selectedDateIso:Le=null,selectedDateRange:Ee=null,dateRangeStart:je=null,onPreviousMonth:Me,onNextMonth:f,timeView:ze=null,multiSelectView:Ne=null,onMultiSelectCommit:He,onTimeChange:Fe,onTimeCommit:Be,optionsPosition:m="below",mode:k}){let S=La(k),I=S!==void 0,T=(0,ee.useRef)(null),F=(0,ee.useRef)(null);Ma(T,F),(0,ee.useEffect)(()=>{if(T.current)return(0,le.containScroll)(T.current)},[]);let pe=e[0]?.options??[],ae=!!(u&&u.length>0&&w),We=!!(C&&C.length>0),Qe=O==="time"&&ze!=null,Se=r&&(pe.length>0||y&&ae||Q||We||Qe);za(T,Se);let Ae={suggestions:e,activeIndex:i,pills:u,showPills:y,showSkipButton:d,showOptionIcons:c,showOptionImages:v,showOptionCounts:R,skipDisabled:ie,activeSelected:_,isLoading:Q,skeletonExiting:te,isInputEmpty:A,products:C,formatType:O,dateView:fe,selectedDateIso:Le,selectedDateRange:Ee,dateRangeStart:je,timeView:ze,multiSelectView:Ne},Ge=(0,ee.useRef)(Ae);Se&&(Ge.current=Ae);let h=Se?Ae:Ge.current,$=(0,le.uiStringsFor)(M),he=h.suggestions[0],be=he?.options??[],$e=h.activeIndex>=0&&!!be[h.activeIndex]?.is_tappable,x=(0,le.labelTraditionalAutocomplete)(h.pills??[],$.keepTyping),Ze=!!(x.length>0&&w),it=h.showPills&&Ze,Re=h.showPills&&!Ze&&h.isLoading,b=it||Re,Ke=Ze&&(0,le.hasSkippablePill)(x)&&h.showSkipButton&&!h.isInputEmpty&&!!g,et=x[0]?.text,qe=(0,le.isCalendarFormat)(h.formatType)&&h.dateView!=null,tt=be.length>0&&!qe,at=be.length>0&&qe&&!h.isLoading,Oe=h.formatType==="time"&&h.timeView!=null&&!h.isLoading,ot=h.isLoading&&!tt&&!at&&!Oe,we=h.products??[];return(0,H.jsxs)("div",{ref:T,id:n,role:"listbox","aria-multiselectable":!!h.multiSelectView,"data-aia-dropdown":"","data-options-position":m,"data-mode":S,"data-aia-loading":h.isLoading?"":void 0,"data-aia-skeleton-exiting":h.skeletonExiting?"":void 0,"data-aia-has-products":we.length>0?"":void 0,className:`${I?"magicx-aia ":""}${Ce.dropdown} ${Se?Ce.visible:""} ${l??""}`,onMouseDown:B=>B.preventDefault(),children:[(0,H.jsxs)(Qt,{space:"8px",children:[(b||Ke)&&(0,H.jsxs)(lt,{noWrap:!0,className:Ce.pillBar,"data-aia-pillbar":"",children:[b&&(0,H.jsx)("span",{className:Ce.pillScroll,"data-aia-pill-scroll":"",children:(0,H.jsx)(ft,{pills:x,activePillIndex:0,activeSelected:h.activeSelected,onSelectPill:w??(()=>{}),rounded:!0,loading:h.isLoading})}),Ke&&(0,H.jsx)("button",{type:"button",tabIndex:-1,className:Ce.skip,"data-aia-skip":"",disabled:h.isLoading||h.skipDisabled,"aria-label":et?`${$.skipLabel} ${et}`:$.skipLabel,onClick:g,children:$.skip})]}),tt&&(0,H.jsx)(Yt,{options:be,activeIndex:h.activeIndex,onSelect:t,onHighlight:a,onUnhighlight:o,listboxId:n,loading:h.isLoading,groupKey:he?`${he.parameter} ${he.text}`:"",optionsPosition:m,showIcons:h.showOptionIcons,showImages:h.showOptionImages,showCounts:h.showOptionCounts,picked:h.isLoading?void 0:h.multiSelectView?.picked}),h.multiSelectView&&!h.isLoading&&(0,H.jsx)("div",{onClick:B=>{B.target.closest("[data-aia-multi-done]")&&!h.skipDisabled&&He?.()},children:(0,H.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Ce.multiDone,ref:B=>{B&&(B.disabled=!0,B.offsetHeight,B.disabled=h.skipDisabled)},children:$.done})}),at&&h.dateView&&(0,H.jsx)(Ht,{options:be,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:Me??Zt,onNextMonth:f??Zt}),Oe&&h.timeView&&(0,H.jsx)(jt,{view:h.timeView,label:$.timeLabel,doneLabel:$.done,interactive:!h.skipDisabled,onTimeChange:Fe??Oa,onTimeCommit:Be??Da}),ot&&(0,H.jsx)("div",{className:Ce.skeletonBars,"data-aia-skeleton-bars":"",children:Aa.map(B=>(0,H.jsx)("span",{className:Ce.skeletonBar,style:{width:B}},`bar-${B}`))}),(0,H.jsx)(Kt,{products:we,listboxId:n,onSelect:oe??Ra,onAddToCart:U,onFocusChange:V,focusable:Se,layout:ce,imageFallback:ge,strings:$}),(0,H.jsx)(Ft,{isOptionHighlighted:$e,isInputEmpty:h.isInputEmpty,strings:$})]}),(0,H.jsx)("button",{ref:F,type:"button",tabIndex:-1,className:Ce.scrollArrow,"data-aia-scroll-arrow":"","aria-label":$.scrollArrow,"aria-hidden":"true",children:(0,H.jsx)("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,H.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Ye=require("@magicx-eng/ai-autocomplete-vanilla");var Jt=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
2629
2815
  flex-shrink: 0;
2630
2816
  width: 32px;
2631
2817
  height: 32px;
@@ -2678,5 +2864,5 @@
2678
2864
  );
2679
2865
  cursor: default;
2680
2866
  }
2681
- `,document.head.appendChild(e)}var Vt={submitButton:"aia-submitButton-otz7H"};var ht=require("react/jsx-runtime");function Qt({disabled:e,onClick:a,label:t=(0,Yt.uiStringsFor)().submit}){return(0,ht.jsx)("button",{type:"button","data-aia-submit":"",className:Vt.submitButton,disabled:e,onClick:i=>{i.stopPropagation(),a()},"aria-label":t,children:(0,ht.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:(0,ht.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ge=require("@magicx-eng/ai-autocomplete-vanilla"),T=require("react");var Tt=require("react");function $t(e){let a=(0,Tt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,Tt.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let r of Object.keys(e??{})){let n=(p,g,m)=>{let v=a.current?.[r];return v?v(p,g,m):[]};o[r]=n}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}var It=require("react");function Zt(e){let a=(0,It.useRef)(e);a.current=e;let t=(0,It.useRef)(null);t.current===null&&(t.current={fetch:(o,r)=>{let n=a.current;return n?n.fetch(o,r):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var Xt={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,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};function ut({onSubmit:e,onResult:a,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:r,additionalContext:n,language:p,currency:g,productId:m,visitorId:v,columns:C=2,dropdownTrigger:h,optionsPosition:l,closeDropdownOnBlur:b,showNonTappableOptions:R,showOptionIcons:K,showOptionImages:$,showOptionCounts:J,showSkipButton:A,showProducts:M,productImageFallback:q="image",onFocus:P,onBlur:ee,value:U,completedParams:Y,onChange:pe,onParamsChange:z,products:te,mapProducts:ke,onProductSelect:Ee,onProductAddToCart:Ce,source:qe,setCursor:Ae}){let f=(0,T.useRef)(null),[Re,De]=(0,T.useState)(null),Se=(0,T.useRef)(e);Se.current=e;let Oe=(0,T.useRef)(a);Oe.current=a;let de=(0,T.useRef)(t);de.current=t;let d=(0,T.useRef)(pe);d.current=pe;let x=(0,T.useRef)(z);x.current=z;let k=(0,T.useRef)(P);k.current=P;let I=(0,T.useRef)(ee);I.current=ee;let S=(0,T.useRef)(Ae);S.current=Ae;let N=(0,T.useRef)(Ee);N.current=Ee;let se=(0,T.useRef)(Ce);se.current=Ce;let u=(0,T.useRef)(v);u.current=v;let ae=(0,T.useRef)(()=>{let c=u.current;return typeof c=="function"?c():c}).current,ge=Zt(te),me=(0,T.useRef)(ke);me.current=ke;let We=(0,T.useRef)((c,W)=>{let D=me.current;return D?D(c,W):c}).current,fe=ke?We:void 0,be=$t(i);(0,T.useEffect)(()=>{if(typeof document>"u")return;let c=new Ge.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:n,language:p,currency:g,productId:m,visitorId:ae,optionOverrides:be.overrides,maskCompletedText:o,columns:C,dropdownTrigger:h,optionsPosition:l,closeDropdownOnBlur:b,showNonTappableOptions:R,showProducts:M,source:qe,value:U,completedParams:Y,onSubmit:(...D)=>Se.current?.(...D),onResult:(...D)=>Oe.current?.(...D),onError:(...D)=>de.current?.(...D),onChange:(...D)=>d.current?.(...D),onParamsChange:(...D)=>x.current?.(...D),onFocus:()=>k.current?.(),onBlur:()=>I.current?.(),onProductSelect:D=>N.current?.(D),onProductAddToCart:D=>se.current?.(D),setCursor:D=>S.current?.(D),products:ge.config,mapProducts:fe});f.current=c,De(c.getState());let W=c.subscribe(D=>De(D));return()=>{W(),c.destroy(),f.current===c&&(f.current=null)}},[]),(0,T.useEffect)(()=>{U!==void 0&&f.current?.setValue(U)},[U]),(0,T.useEffect)(()=>{Y!==void 0&&f.current?.setCompletedParams(Y)},[Y]);let Ue=JSON.stringify(r??null),Pe;try{Pe=JSON.stringify(n??null)}catch{Pe="[unstringifiable]"}(0,T.useEffect)(()=>{f.current?.update({apiConfig:r,additionalContext:n,language:p,currency:g,productId:m,optionOverrides:be.overrides,dropdownTrigger:h,optionsPosition:l,closeDropdownOnBlur:b,showNonTappableOptions:R,showProducts:M})},[Ue,Pe,p,g?.code,g?.rate,g?.country,m,be.key,h,l,b,R,M]);let Le=(0,T.useRef)(!1);(0,T.useEffect)(()=>{if(!Le.current){Le.current=!0;return}f.current?.update({products:ge.config})},[ge.enabled]),(0,T.useEffect)(()=>{f.current?.update({mapProducts:fe})},[fe]);let ze=(0,T.useRef)(null);ze.current===null&&(ze.current={handleTextChange:c=>f.current?.handleTextChange(c),handleKeyDown:c=>{let W="nativeEvent"in c?c.nativeEvent:c;f.current?.handleKeyDown(W)},setFocused:c=>f.current?.setFocused(c),startEditingParam:c=>f.current?.startEditingParam(c),exitEditMode:()=>f.current?.exitEditMode(),handleCaretAfterInput:c=>f.current?.handleCaretAfterInput(c),handleCaretMove:c=>f.current?.handleCaretMove(c),replaceEditingRange:c=>f.current?.replaceEditingRange(c)??!1,setActivePill:c=>f.current?.setActivePill(c),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()??Xt,recordSubmit:c=>f.current?.recordSubmit(c),selectOption:c=>f.current?.selectOption(c),selectProduct:c=>f.current?.selectProduct(c),addProductToCart:c=>{let W=f.current;return!W||!se.current?Promise.resolve():W.addProductToCart(c)},setActiveDropdownIndex:c=>f.current?.setActiveDropdownIndex(c),clearHighlight:c=>f.current?.clearHighlight(c),showPreviousMonth:()=>f.current?.showPreviousMonth(),showNextMonth:()=>f.current?.showNextMonth(),handleFocus:()=>f.current?.setFocused(!0),handleBlur:()=>f.current?.setFocused(!1)});let y=ze.current,Ye=(0,T.useCallback)(c=>{let W=c.target.value,ot=W.length>0&&!c.nativeEvent?.isComposing&&W[0]!==W[0].toUpperCase()?W[0].toUpperCase()+W.slice(1):W;f.current?.handleTextChange(ot)},[]),Qe=(0,T.useCallback)(c=>{f.current?.handleKeyDown(c.nativeEvent)},[]),we=f.current,w=Re??Xt,Me=U!==void 0?U:w.text,Ne=Y!==void 0?Y:w.completedParams,Ze=w.actionableSuggestions,mt=Ze[0],ft=(0,Ge.withoutTraditionalAutocomplete)(Ze),$e=we?.listboxId??"",bt=w.activeDropdownIndex>=0&&we?`${$e}-option-${w.activeDropdownIndex}`:void 0,Fe=w.editingParam,_e=w.editingIdentified,Xe=Fe?{parameter:Fe.suggestionParameter,text:Fe.suggestionPlaceholder,required:!0,options:Fe.options}:_e?{parameter:_e.parameter,text:(0,Ge.identifiedParamLabel)(_e.parameter),required:!0,options:[]}:null,it=w.dropdownSuggestion??Xe??mt,wt=Xe?[Xe]:Ze,Je=(0,Ge.dateSelectionFor)(w),je=!we||w.dropdownLoading;return{completedParams:Ne,skippedParams:w.skippedParams,identifiedParams:w.identifiedParams,suggestionPills:ft,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:w.segments,newParamId:w.newParamId,clearNewParamId:y.clearNewParamId,suggestions:w.suggestions,activeIndex:w.activeDropdownIndex,isReady:w.isReady,isLoading:je,isFocused:w.isFocused,isDropdownOpen:w.isDropdownOpen,isActivePillSelected:w.isActivePillSelected,placeholderText:w.placeholderText,listboxId:$e,error:w.error,products:w.products,customFields:w.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:Fe,editingIdentified:_e,editingAnchor:w.editingAnchor,caretOffset:w.caretOffset,startEditingParam:y.startEditingParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:Me,placeholder:w.placeholderText||void 0,onChange:Ye,onKeyDown:Qe,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":w.isDropdownOpen,"aria-activedescendant":bt,"aria-autocomplete":"list","aria-controls":$e},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:it?[{...it,options:w.dropdownOptions}]:[],activeIndex:w.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:w.isDropdownOpen,id:$e,pills:wt,activeSelected:w.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(A??!0)&&!Fe&&!_e,showOptionIcons:K??!0,showOptionImages:$??!0,showOptionCounts:J??!0,skipDisabled:w.inSelectionAnimation,isLoading:je,skeletonExiting:w.skeletonExiting,isInputEmpty:Me.trim().length===0,language:p,products:w.products,productImageFallback:q,onProductSelect:y.selectProduct,onProductAddToCart:Ce?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:w.activeFormatType,dateView:w.dateView,selectedDateIso:Je.selectedIso,selectedDateRange:Je.selectedRange,dateRangeStart:Je.rangeStart,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,optionsPosition:l??"below"}}}var V=require("@magicx-eng/ai-autocomplete-vanilla"),E=require("react"),gt;function Ia(){if(gt!==void 0)return gt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),gt=e.contentEditable==="plaintext-only",gt}function Jt(e){let{segments:a,showChipIcons:t=!0,showChipImages:i=!0,newParamId:o,editingParam:r,editingIdentified:n,editingAnchor:p,caretOffset:g,placeholderText:m,isFocused:v,isDropdownOpen:C,listboxId:h,activeDescendantId:l,autoFocus:b,handleTextChange:R,handleKeyDown:K,handleCaretAfterInput:$,handleCaretMove:J,startEditingParam:A,replaceEditingRange:M,setFocused:q}=e,P=(0,E.useRef)(null),ee=(0,E.useRef)(!1),U=(0,E.useRef)(""),Y=(0,E.useRef)(""),pe=(0,E.useRef)(null),z=(0,E.useRef)(0);pe.current=g,(0,E.useEffect)(()=>{if(!b)return;let d=P.current;if(!d)return;document.activeElement===d?q(!0):d.focus();let x=d.ownerDocument??document,k=x.getSelection(),I=k&&k.rangeCount>0&&d.contains(k.anchorNode);if(k&&!I){let S=x.createRange();S.selectNodeContents(d),S.collapse(!0),k.removeAllRanges(),k.addRange(S)}},[b,q]),(0,E.useEffect)(()=>{let d=P.current;if(!d)return;let x=d.ownerDocument??document,k=()=>{let I=x.getSelection();if(!I||I.rangeCount===0||!I.anchorNode||!d.contains(I.anchorNode))return;let S=I.anchorNode,N=S.nodeType===Node.ELEMENT_NODE?S:S.parentElement,u=(I.isCollapsed?N?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ae=r?.id??n?.id??null;if(u&&u!==ae){A(u);return}performance.now()-z.current<50||J((0,V.getCursorOffset)(d))};return x.addEventListener("selectionchange",k),()=>x.removeEventListener("selectionchange",k)},[r,n,A,J]),(0,E.useEffect)(()=>{let d=P.current;if(!d)return;let x=k=>{let I=(0,V.chipIdFromTap)(d,k.target);I&&(A(I),(0,V.keepCaretOnChip)(d,I))};return d.addEventListener("click",x),()=>d.removeEventListener("click",x)},[A]),(0,E.useLayoutEffect)(()=>{let d=P.current;d&&(0,V.renderEditableContent)({input:d,segments:a,newParamId:o,editingParamId:r?.id??null,placeholderText:m??"",isFocused:v,showChipIcons:t,showChipImages:i})},[a,o,r,m,v,t,i]),(0,E.useLayoutEffect)(()=>{let d=U.current,x=o??"";if(U.current=x,!x||x===d)return;let k=P.current;if(!k)return;k.focus();let I=pe.current??(0,V.plainTextLength)(k);(0,V.setCursorOffset)(k,I)},[o]),(0,E.useLayoutEffect)(()=>{let d=Y.current,x=r?.id??"";if(Y.current=x,!x||x===d||p==null)return;let k=P.current;k&&(0,V.setCursorOffset)(k,p)},[r,p]);let te=(0,E.useCallback)(()=>{if(ee.current)return;let d=P.current;if(!d)return;let x=(0,V.extractPlainText)(d),I=x.length>0&&x[0]!==x[0].toUpperCase()?x[0].toUpperCase()+x.slice(1):x;R(I)},[R]),ke=(0,E.useCallback)(()=>{z.current=performance.now(),te();let d=P.current;d&&$((0,V.getCursorOffset)(d))},[te,$]);(0,E.useEffect)(()=>{let d=P.current;if(!d)return;let x=k=>{let I=k,S=I.inputType;if(S==="insertParagraph"||S==="insertLineBreak"||S==="insertFromDrop"){k.preventDefault();return}if(S.startsWith("insert")||S.startsWith("delete")){let N=S.startsWith("delete")?"":I.data??"";M(N)&&k.preventDefault()}};return d.addEventListener("beforeinput",x),()=>d.removeEventListener("beforeinput",x)},[M]);let Ee=(0,E.useCallback)(()=>{ee.current=!0,P.current?.setAttribute("data-aia-composing","true")},[]),Ce=(0,E.useCallback)(()=>{ee.current=!1,P.current?.removeAttribute("data-aia-composing"),te()},[te]),qe=(0,E.useCallback)(d=>{d.preventDefault();let x=P.current;if(!x)return;let k=(d.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!k)return;let I=x.ownerDocument??document,S=I.getSelection();if(!S||S.rangeCount===0)return;let N=S.getRangeAt(0);if(!x.contains(N.startContainer))return;N.deleteContents();let se=I.createTextNode(k);N.insertNode(se),N.setStartAfter(se),N.collapse(!0),S.removeAllRanges(),S.addRange(N),te()},[te]),Ae=(0,E.useCallback)(d=>K(d),[K]),f=(0,E.useCallback)(()=>q(!0),[q]),Re=(0,E.useCallback)(()=>q(!1),[q]),De=(0,E.useCallback)(()=>P.current?.focus(),[]),Se=(0,E.useCallback)(()=>P.current?.blur(),[]),Oe=(0,E.useCallback)(()=>{let d=P.current;return d?(0,V.extractPlainText)(d):""},[]),de=Ia()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:de,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":h,"aria-expanded":C,"aria-activedescendant":l,spellCheck:!0,enterKeyHint:"send",onInput:ke,onKeyDown:Ae,onCompositionStart:Ee,onCompositionEnd:Ce,onPaste:qe,onFocus:f,onBlur:Re},getPlainText:Oe,focus:De,blur:Se}}var ue=require("react/jsx-runtime");function Ea(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var ea=(0,G.forwardRef)(function({onSubmit:a,onResult:t,onError:i,optionOverrides:o,maskCompletedText:r,className:n,apiConfig:p,additionalContext:g,language:m,currency:v,productId:C,visitorId:h,columns:l,pillPlacement:b="dropdown",mode:R="auto",optionsPosition:K="below",animations:$=!0,dropdownTrigger:J,closeDropdownOnBlur:A,showNonTappableOptions:M,showOptionIcons:q=!0,showChipIcons:P=!0,showChipImages:ee=!0,showOptionImages:U=!0,showOptionCounts:Y=!0,showSkipButton:pe,showProducts:z,productsLayout:te,productImageFallback:ke,autoFocus:Ee=!0,onFocus:Ce,onBlur:qe,value:Ae,completedParams:f,onChange:Re,onParamsChange:De,products:Se,mapProducts:Oe,onProductSelect:de,onProductAddToCart:d,submitButton:x,resetOnSubmit:k=!0},I){let S=(0,G.useRef)(null),N=(0,G.useRef)(null),se=(0,G.useRef)(()=>{}),u=(0,G.useRef)(null),ae=(0,G.useRef)(null);(0,G.useEffect)(()=>{let L=S.current;if(L)return u.current?u.current.setMode(R):u.current=new Ke.ModeController(L,R),()=>{u.current?.destroy(),u.current=null}},[R]);let ge=(0,G.useCallback)(L=>{let ie=ae.current?.current;ie&&(ie.focus(),(0,Ke.setCursorOffset)(ie,L))},[]),{completedParams:me,suggestionPills:We,setActivePill:fe,skipActivePill:be,segments:Ue,newParamId:Pe,clearNewParamId:Le,placeholderText:ze,isFocused:y,isDropdownOpen:Ye,isActivePillSelected:Qe,isLoading:we,activeIndex:w,listboxId:Me,handleTextChange:Ne,handleKeyDown:Ze,setFocused:mt,editingParam:ft,editingIdentified:$e,editingAnchor:bt,caretOffset:Fe,startEditingParam:_e,handleCaretAfterInput:Xe,handleCaretMove:it,replaceEditingRange:wt,dropdownProps:Je,reset:je,refreshProducts:c,prepareSubmit:W,getState:D,recordSubmit:ot}=ut({onSubmit:L=>se.current(L),onResult:t,onError:i,optionOverrides:o,maskCompletedText:r,apiConfig:p,additionalContext:g,language:m,currency:v,productId:C,visitorId:h,columns:l,dropdownTrigger:J,optionsPosition:K,closeDropdownOnBlur:A,showNonTappableOptions:M,showOptionIcons:q,showOptionImages:U,showOptionCounts:Y,showSkipButton:pe,showProducts:z,onFocus:Ce,onBlur:qe,value:Ae,completedParams:f,onChange:Re,onParamsChange:De,products:Se,mapProducts:Oe,onProductSelect:de,onProductAddToCart:d,source:"full-sdk",setCursor:ge});(0,G.useEffect)(()=>{if(!Pe)return;let L=window.setTimeout(()=>Le(),650);return()=>window.clearTimeout(L)},[Pe,Le]);let ta=w>=0?`${Me}-option-${w}`:void 0,{inputRef:vt,editorProps:aa,focus:nt,blur:Et,getPlainText:At}=Jt({segments:Ue,newParamId:Pe,editingParam:ft,editingIdentified:$e,editingAnchor:bt,caretOffset:Fe,placeholderText:ze,isFocused:y,showChipIcons:P,showChipImages:ee,isDropdownOpen:Ye,listboxId:Me,activeDescendantId:ta,autoFocus:Ee,handleTextChange:Ne,handleKeyDown:Ze,handleCaretAfterInput:Xe,handleCaretMove:it,startEditingParam:_e,replaceEditingRange:wt,setFocused:mt});ae.current=vt,(0,G.useLayoutEffect)(()=>{let L=N.current,ie=vt.current;if(!L||!ie)return;let et=()=>{let Dt=L.firstElementChild;if(!Dt)return;let ra=Dt.getBoundingClientRect(),sa=ie.getBoundingClientRect();ra.top>=sa.bottom-2?L.setAttribute("data-aia-pill-wrapped",""):L.removeAttribute("data-aia-pill-wrapped")};et();let Rt=new ResizeObserver(et);return Rt.observe(ie),()=>Rt.disconnect()},[Ue,We.length,we,vt]),(0,G.useImperativeHandle)(I,()=>({focus:nt,blur:Et,reset:je,refreshProducts:c,setMode:L=>u.current?.setMode(L),skipActivePill:be}),[nt,Et,je,c,be]);let rt=!!Ue.length||me.length>0,xt=(0,G.useCallback)(L=>{if(!rt)return;L&&W();let ie=D(),et=(0,Ke.buildSubmitResult)(At(),ie.completedParams,ie.skippedParams,{identifiedParams:ie.identifiedParams,isReady:ie.isReady,customFields:ie.customFields});L&&ot(et),a(et),k&&je()},[ot,k,rt,W,D,a,je,At]);se.current=()=>xt(!1);let ia=(0,G.useCallback)(L=>{L.target?.closest("[data-aia-pill]")||nt()},[nt]),oa=b==="inline",na=b==="dropdown";return(0,ue.jsxs)("div",{ref:S,className:`magicx-aia ${Ve.container} ${n??""}`,"data-pill-placement":b,"data-options-position":K,"data-animations":$?"on":"off","data-mode":Ea(R),children:[(0,ue.jsx)(pt,{...Je,showPills:na,productsLayout:te,productImageFallback:ke}),(0,ue.jsxs)("div",{className:Ve.inputWrapper,"data-aia-input-wrapper":"",onClick:ia,children:[(0,ue.jsxs)("div",{className:Ve.editorArea,"data-aia-editor":"",children:[(0,ue.jsx)("div",{...aa,className:Ve.input,"data-aia-input":""}),oa&&(we||We.length>0)&&(0,ue.jsx)("span",{ref:N,className:Ve.pillListContainer,"data-aia-pill-list-container":"",children:(0,ue.jsx)(dt,{pills:We,activePillIndex:0,activeSelected:Qe,onSelectPill:fe,loading:we})})]}),x===null?null:x===void 0?(0,ue.jsx)(Qt,{disabled:!rt,onClick:()=>xt(!0),label:(0,Ke.uiStringsFor)(m).submit}):(0,ue.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ve.submitSlot,onClick:L=>{rt&&(L.stopPropagation(),xt(!0))},children:x})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
2867
+ `,document.head.appendChild(e)}var Xt={submitButton:"aia-submitButton-otz7H"};var vt=require("react/jsx-runtime");function ea({disabled:e,onClick:i,label:t=(0,Jt.uiStringsFor)().submit}){return(0,vt.jsx)("button",{type:"button","data-aia-submit":"",className:Xt.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),i()},"aria-label":t,children:(0,vt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:(0,vt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ve=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react");var Rt=require("react");function ta(e){let i=(0,Rt.useRef)(e);i.current=e;let t=Object.keys(e??{}).sort().join("\0"),a=(0,Rt.useRef)({key:"",overrides:void 0});if(a.current.key!==t){let o={};for(let r of Object.keys(e??{})){let n=(l,u,w)=>{let y=i.current?.[r];return y?y(l,u,w):[]};o[r]=n}a.current={key:t,overrides:e?o:void 0}}return{overrides:a.current.overrides,key:t}}var Ot=require("react");function aa(e){let i=(0,Ot.useRef)(e);i.current=e;let t=(0,Ot.useRef)(null);t.current===null&&(t.current={fetch:(o,r)=>{let n=i.current;return n?n.fetch(o,r):Promise.reject(new Error("products config removed"))},transform:o=>i.current?.transform(o)??[],get limit(){return i.current?.limit}});let a=e!==void 0;return{config:a?t.current:void 0,enabled:a}}var ia={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 xt({onSubmit:e,onResult:i,onError:t,optionOverrides:a,maskCompletedText:o,apiConfig:r,additionalContext:n,language:l,currency:u,productId:w,visitorId:y,columns:g=2,dropdownTrigger:d,optionsPosition:c,closeDropdownOnBlur:v,showNonTappableOptions:R,showOptionIcons:ie,showOptionImages:_,showOptionCounts:Q,showSkipButton:te,showProducts:A,productImageFallback:M="image",onFocus:C,onBlur:oe,value:U,completedParams:V,onChange:ce,onParamsChange:ge,products:O,mapProducts:fe,onProductSelect:Le,onProductAddToCart:Ee,source:je,setCursor:Me}){let f=(0,P.useRef)(null),[ze,Ne]=(0,P.useState)(null),He=(0,P.useRef)(e);He.current=e;let Fe=(0,P.useRef)(i);Fe.current=i;let Be=(0,P.useRef)(t);Be.current=t;let m=(0,P.useRef)(ce);m.current=ce;let k=(0,P.useRef)(ge);k.current=ge;let S=(0,P.useRef)(C);S.current=C;let I=(0,P.useRef)(oe);I.current=oe;let T=(0,P.useRef)(Me);T.current=Me;let F=(0,P.useRef)(Le);F.current=Le;let pe=(0,P.useRef)(Ee);pe.current=Ee;let ae=(0,P.useRef)(y);ae.current=y;let We=(0,P.useRef)(()=>{let p=ae.current;return typeof p=="function"?p():p}).current,Qe=aa(O),Se=(0,P.useRef)(fe);Se.current=fe;let Ae=(0,P.useRef)((p,q)=>{let D=Se.current;return D?D(p,q):p}).current,Ge=fe?Ae:void 0,h=ta(a);(0,P.useEffect)(()=>{if(typeof document>"u")return;let p=new Ve.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:n,language:l,currency:u,productId:w,visitorId:We,optionOverrides:h.overrides,maskCompletedText:o,columns:g,dropdownTrigger:d,optionsPosition:c,closeDropdownOnBlur:v,showNonTappableOptions:R,showProducts:A,source:je,value:U,completedParams:V,onSubmit:(...D)=>He.current?.(...D),onResult:(...D)=>Fe.current?.(...D),onError:(...D)=>Be.current?.(...D),onChange:(...D)=>m.current?.(...D),onParamsChange:(...D)=>k.current?.(...D),onFocus:()=>S.current?.(),onBlur:()=>I.current?.(),onProductSelect:D=>F.current?.(D),onProductAddToCart:D=>pe.current?.(D),setCursor:D=>T.current?.(D),products:Qe.config,mapProducts:Ge});f.current=p,Ne(p.getState());let q=p.subscribe(D=>Ne(D));return()=>{q(),p.destroy(),f.current===p&&(f.current=null)}},[]),(0,P.useEffect)(()=>{U!==void 0&&f.current?.setValue(U)},[U]),(0,P.useEffect)(()=>{V!==void 0&&f.current?.setCompletedParams(V)},[V]);let $=JSON.stringify(r??null),he;try{he=JSON.stringify(n??null)}catch{he="[unstringifiable]"}(0,P.useEffect)(()=>{f.current?.update({apiConfig:r,additionalContext:n,language:l,currency:u,productId:w,optionOverrides:h.overrides,dropdownTrigger:d,optionsPosition:c,closeDropdownOnBlur:v,showNonTappableOptions:R,showProducts:A})},[$,he,l,u?.code,u?.rate,u?.country,w,h.key,d,c,v,R,A]);let be=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!be.current){be.current=!0;return}f.current?.update({products:Qe.config})},[Qe.enabled]),(0,P.useEffect)(()=>{f.current?.update({mapProducts:Ge})},[Ge]);let $e=(0,P.useRef)(null);$e.current===null&&($e.current={handleTextChange:p=>f.current?.handleTextChange(p),handleKeyDown:p=>{let q="nativeEvent"in p?p.nativeEvent:p;f.current?.handleKeyDown(q)},setFocused:p=>f.current?.setFocused(p),startEditingParam:p=>f.current?.startEditingParam(p),exitEditMode:()=>f.current?.exitEditMode(),handleCaretAfterInput:p=>f.current?.handleCaretAfterInput(p),handleCaretMove:p=>f.current?.handleCaretMove(p),replaceEditingRange:p=>f.current?.replaceEditingRange(p)??!1,setActivePill:p=>f.current?.setActivePill(p),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()??ia,recordSubmit:p=>f.current?.recordSubmit(p),selectOption:p=>f.current?.selectOption(p),selectProduct:p=>f.current?.selectProduct(p),addProductToCart:p=>{let q=f.current;return!q||!pe.current?Promise.resolve():q.addProductToCart(p)},setActiveDropdownIndex:p=>f.current?.setActiveDropdownIndex(p),clearHighlight:p=>f.current?.clearHighlight(p),showPreviousMonth:()=>f.current?.showPreviousMonth(),showNextMonth:()=>f.current?.showNextMonth(),setTime:p=>f.current?.setTime(p),commitTime:()=>f.current?.commitTime(),toggleMultiSelectOption:p=>f.current?.toggleMultiSelectOption(p),commitMultiSelect:()=>f.current?.commitMultiSelect(),handleFocus:()=>f.current?.setFocused(!0),handleBlur:()=>f.current?.setFocused(!1)});let x=$e.current,Ze=(0,P.useCallback)(p=>{let q=p.target.value,pt=q.length>0&&!p.nativeEvent?.isComposing&&q[0]!==q[0].toUpperCase()?q[0].toUpperCase()+q.slice(1):q;f.current?.handleTextChange(pt)},[]),it=(0,P.useCallback)(p=>{f.current?.handleKeyDown(p.nativeEvent)},[]),Re=f.current,b=ze??ia,Ke=U!==void 0?U:b.text,et=V!==void 0?V:b.completedParams,qe=b.actionableSuggestions,tt=qe[0],at=(0,Ve.withoutTraditionalAutocomplete)(qe),Oe=Re?.listboxId??"",ot=b.activeDropdownIndex>=0&&Re?`${Oe}-option-${b.activeDropdownIndex}`:void 0,we=b.editingParam,B=b.editingIdentified,nt=we?{parameter:we.suggestionParameter,text:we.suggestionPlaceholder,required:!0,options:we.options}:B?{parameter:B.parameter,text:(0,Ve.identifiedParamLabel)(B.parameter),required:!0,options:[]}:null,ct=b.dropdownSuggestion??nt??tt,kt=nt?[nt]:qe,rt=(0,Ve.dateSelectionFor)(b),Xe=!Re||b.dropdownLoading;return{completedParams:et,multiSelectView:b.multiSelectView,toggleMultiSelectOption:x.toggleMultiSelectOption,commitMultiSelect:x.commitMultiSelect,skippedParams:b.skippedParams,identifiedParams:b.identifiedParams,suggestionPills:at,setActivePill:x.setActivePill,skipActivePill:x.skipActivePill,removeLastParam:x.removeLastParam,segments:b.segments,newParamId:b.newParamId,clearNewParamId:x.clearNewParamId,suggestions:b.suggestions,activeIndex:b.activeDropdownIndex,isReady:b.isReady,isLoading:Xe,isFocused:b.isFocused,isDropdownOpen:b.isDropdownOpen,isActivePillSelected:b.isActivePillSelected,placeholderText:b.placeholderText,listboxId:Oe,error:b.error,products:b.products,customFields:b.customFields,selectProduct:x.selectProduct,addProductToCart:x.addProductToCart,handleTextChange:x.handleTextChange,handleKeyDown:x.handleKeyDown,setFocused:x.setFocused,editingParam:we,editingIdentified:B,editingAnchor:b.editingAnchor,caretOffset:b.caretOffset,startEditingParam:x.startEditingParam,exitEditMode:x.exitEditMode,handleCaretAfterInput:x.handleCaretAfterInput,handleCaretMove:x.handleCaretMove,replaceEditingRange:x.replaceEditingRange,inputProps:{value:Ke,placeholder:b.placeholderText||void 0,onChange:Ze,onKeyDown:it,onFocus:x.handleFocus,onBlur:x.handleBlur,role:"combobox","aria-expanded":b.isDropdownOpen,"aria-activedescendant":ot,"aria-autocomplete":"list","aria-controls":Oe},reset:x.reset,refreshProducts:x.refreshProducts,prepareSubmit:x.prepareSubmit,getState:x.getState,recordSubmit:x.recordSubmit,dropdownProps:{suggestions:ct?[{...ct,options:b.dropdownOptions}]:[],activeIndex:b.activeDropdownIndex,onSelect:x.selectOption,onHighlight:x.setActiveDropdownIndex,onUnhighlight:x.clearHighlight,isOpen:b.isDropdownOpen,id:Oe,pills:kt,activeSelected:b.isActivePillSelected,onPillClick:x.setActivePill,onSkip:x.skipActivePill,showSkipButton:(te??!0)&&!we&&!B,showOptionIcons:ie??!0,showOptionImages:_??!0,showOptionCounts:Q??!0,skipDisabled:b.inSelectionAnimation,isLoading:Xe,skeletonExiting:b.skeletonExiting,isInputEmpty:Ke.trim().length===0,language:l,products:b.products,productImageFallback:M,onProductSelect:x.selectProduct,onProductAddToCart:Ee?x.addProductToCart:void 0,onProductFocusChange:x.setFocused,formatType:b.activeFormatType,dateView:b.dateView,selectedDateIso:rt.selectedIso,selectedDateRange:rt.selectedRange,dateRangeStart:rt.rangeStart,onPreviousMonth:x.showPreviousMonth,onNextMonth:x.showNextMonth,timeView:b.timeView,multiSelectView:b.multiSelectView,onMultiSelectCommit:x.commitMultiSelect,onTimeChange:x.setTime,onTimeCommit:x.commitTime,optionsPosition:c??"below"}}}var j=require("@magicx-eng/ai-autocomplete-vanilla"),E=require("react"),yt;function Na(){if(yt!==void 0)return yt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),yt=e.contentEditable==="plaintext-only",yt}function oa(e){let{segments:i,showChipIcons:t=!0,showChipImages:a=!0,newParamId:o,editingParam:r,editingIdentified:n,editingAnchor:l,caretOffset:u,placeholderText:w,isFocused:y,isDropdownOpen:g,listboxId:d,activeDescendantId:c,autoFocus:v,handleTextChange:R,handleKeyDown:ie,handleCaretAfterInput:_,handleCaretMove:Q,startEditingParam:te,replaceEditingRange:A,setFocused:M}=e,C=(0,E.useRef)(null),oe=(0,E.useRef)(!1),U=(0,E.useRef)(""),V=(0,E.useRef)(""),ce=(0,E.useRef)(null),ge=(0,E.useRef)(0);ce.current=u,(0,E.useEffect)(()=>{if(!v)return;let m=C.current;if(!m)return;document.activeElement===m?M(!0):m.focus();let k=m.ownerDocument??document,S=k.getSelection(),I=S&&S.rangeCount>0&&m.contains(S.anchorNode);if(S&&!I){let T=k.createRange();T.selectNodeContents(m),T.collapse(!0),S.removeAllRanges(),S.addRange(T)}},[v,M]),(0,E.useEffect)(()=>{let m=C.current;if(!m)return;let k=m.ownerDocument??document,S=()=>{let I=k.getSelection();if(!I||I.rangeCount===0||!I.anchorNode||!m.contains(I.anchorNode))return;let T=I.anchorNode,F=T.nodeType===Node.ELEMENT_NODE?T:T.parentElement,ae=(I.isCollapsed?F?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,We=r?.id??n?.id??null;if(ae&&ae!==We){te(ae);return}performance.now()-ge.current<50||Q((0,j.getCursorOffset)(m))};return k.addEventListener("selectionchange",S),()=>k.removeEventListener("selectionchange",S)},[r,n,te,Q]),(0,E.useEffect)(()=>{let m=C.current;if(!m)return;let k=S=>{let I=(0,j.chipIdFromTap)(m,S.target);I&&(te(I),(0,j.keepCaretOnChip)(m,I))};return m.addEventListener("click",k),()=>m.removeEventListener("click",k)},[te]),(0,E.useLayoutEffect)(()=>{let m=C.current;m&&(0,j.renderEditableContent)({input:m,segments:i,newParamId:o,editingParamId:r?.id??null,placeholderText:w??"",isFocused:y,showChipIcons:t,showChipImages:a})},[i,o,r,w,y,t,a]),(0,E.useLayoutEffect)(()=>{let m=U.current,k=o??"";if(U.current=k,!k||k===m)return;let S=C.current;if(!S)return;S.focus();let I=ce.current??(0,j.plainTextLength)(S);(0,j.setCursorOffset)(S,I)},[o]),(0,E.useLayoutEffect)(()=>{let m=V.current,k=r?.id??"";if(V.current=k,!k||k===m||l==null)return;let S=C.current;S&&(0,j.setCursorOffset)(S,l)},[r,l]);let O=(0,E.useCallback)(()=>{if(oe.current)return;let m=C.current;if(!m)return;let k=(0,j.extractPlainText)(m),I=k.length>0&&k[0]!==k[0].toUpperCase()?k[0].toUpperCase()+k.slice(1):k;R(I)},[R]),fe=(0,E.useCallback)(()=>{ge.current=performance.now(),O();let m=C.current;m&&_((0,j.getCursorOffset)(m))},[O,_]);(0,E.useEffect)(()=>{let m=C.current;if(!m)return;let k=S=>{let I=S,T=I.inputType;if(T==="insertParagraph"||T==="insertLineBreak"||T==="insertFromDrop"){S.preventDefault();return}if(T.startsWith("insert")||T.startsWith("delete")){let F=T.startsWith("delete")?"":I.data??"";A(F)&&S.preventDefault()}};return m.addEventListener("beforeinput",k),()=>m.removeEventListener("beforeinput",k)},[A]);let Le=(0,E.useCallback)(()=>{oe.current=!0,C.current?.setAttribute("data-aia-composing","true")},[]),Ee=(0,E.useCallback)(()=>{oe.current=!1,C.current?.removeAttribute("data-aia-composing"),O()},[O]),je=(0,E.useCallback)(m=>{m.preventDefault();let k=C.current;if(!k)return;let S=(m.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!S)return;let I=k.ownerDocument??document,T=I.getSelection();if(!T||T.rangeCount===0)return;let F=T.getRangeAt(0);if(!k.contains(F.startContainer))return;F.deleteContents();let pe=I.createTextNode(S);F.insertNode(pe),F.setStartAfter(pe),F.collapse(!0),T.removeAllRanges(),T.addRange(F),O()},[O]),Me=(0,E.useCallback)(m=>ie(m),[ie]),f=(0,E.useCallback)(()=>M(!0),[M]),ze=(0,E.useCallback)(()=>M(!1),[M]),Ne=(0,E.useCallback)(()=>C.current?.focus(),[]),He=(0,E.useCallback)(()=>C.current?.blur(),[]),Fe=(0,E.useCallback)(()=>{let m=C.current;return m?(0,j.extractPlainText)(m):""},[]),Be=Na()?"plaintext-only":"true";return{inputRef:C,editorProps:{ref:C,contentEditable:Be,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":d,"aria-expanded":g,"aria-activedescendant":c,spellCheck:!0,enterKeyHint:"send",onInput:fe,onKeyDown:Me,onCompositionStart:Le,onCompositionEnd:Ee,onPaste:je,onFocus:f,onBlur:ze},getPlainText:Fe,focus:Ne,blur:He}}var ke=require("react/jsx-runtime");function Ha(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var na=(0,K.forwardRef)(function({onSubmit:i,onResult:t,onError:a,optionOverrides:o,maskCompletedText:r,className:n,apiConfig:l,additionalContext:u,language:w,currency:y,productId:g,visitorId:d,columns:c,pillPlacement:v="dropdown",mode:R="auto",optionsPosition:ie="below",animations:_=!0,dropdownTrigger:Q,closeDropdownOnBlur:te,showNonTappableOptions:A,showOptionIcons:M=!0,showChipIcons:C=!0,showChipImages:oe=!0,showOptionImages:U=!0,showOptionCounts:V=!0,showSkipButton:ce,showProducts:ge,productsLayout:O,productImageFallback:fe,autoFocus:Le=!0,onFocus:Ee,onBlur:je,value:Me,completedParams:f,onChange:ze,onParamsChange:Ne,products:He,mapProducts:Fe,onProductSelect:Be,onProductAddToCart:m,submitButton:k,resetOnSubmit:S=!0},I){let T=(0,K.useRef)(null),F=(0,K.useRef)(null),pe=(0,K.useRef)(()=>{}),ae=(0,K.useRef)(null),We=(0,K.useRef)(null);(0,K.useEffect)(()=>{let z=T.current;if(z)return ae.current?ae.current.setMode(R):ae.current=new Ye.ModeController(z,R),()=>{ae.current?.destroy(),ae.current=null}},[R]);let Qe=(0,K.useCallback)(z=>{let ne=We.current?.current;ne&&(ne.focus(),(0,Ye.setCursorOffset)(ne,z))},[]),{completedParams:Se,suggestionPills:Ae,setActivePill:Ge,skipActivePill:h,segments:$,newParamId:he,clearNewParamId:be,placeholderText:$e,isFocused:x,isDropdownOpen:Ze,isActivePillSelected:it,isLoading:Re,activeIndex:b,listboxId:Ke,handleTextChange:et,handleKeyDown:qe,setFocused:tt,editingParam:at,editingIdentified:Oe,editingAnchor:ot,caretOffset:we,startEditingParam:B,handleCaretAfterInput:nt,handleCaretMove:ct,replaceEditingRange:kt,dropdownProps:rt,reset:Xe,refreshProducts:p,prepareSubmit:q,getState:D,recordSubmit:pt}=xt({onSubmit:z=>pe.current(z),onResult:t,onError:a,optionOverrides:o,maskCompletedText:r,apiConfig:l,additionalContext:u,language:w,currency:y,productId:g,visitorId:d,columns:c,dropdownTrigger:Q,optionsPosition:ie,closeDropdownOnBlur:te,showNonTappableOptions:A,showOptionIcons:M,showOptionImages:U,showOptionCounts:V,showSkipButton:ce,showProducts:ge,onFocus:Ee,onBlur:je,value:Me,completedParams:f,onChange:ze,onParamsChange:Ne,products:He,mapProducts:Fe,onProductSelect:Be,onProductAddToCart:m,source:"full-sdk",setCursor:Qe});(0,K.useEffect)(()=>{if(!he)return;let z=window.setTimeout(()=>be(),650);return()=>window.clearTimeout(z)},[he,be]);let ra=b>=0?`${Ke}-option-${b}`:void 0,{inputRef:St,editorProps:sa,focus:ht,blur:Dt,getPlainText:Lt}=oa({segments:$,newParamId:he,editingParam:at,editingIdentified:Oe,editingAnchor:ot,caretOffset:we,placeholderText:$e,isFocused:x,showChipIcons:C,showChipImages:oe,isDropdownOpen:Ze,listboxId:Ke,activeDescendantId:ra,autoFocus:Le,handleTextChange:et,handleKeyDown:qe,handleCaretAfterInput:nt,handleCaretMove:ct,startEditingParam:B,replaceEditingRange:kt,setFocused:tt});We.current=St,(0,K.useLayoutEffect)(()=>{let z=F.current,ne=St.current;if(!z||!ne)return;let st=()=>{let zt=z.firstElementChild;if(!zt)return;let pa=zt.getBoundingClientRect(),ha=ne.getBoundingClientRect();pa.top>=ha.bottom-2?z.setAttribute("data-aia-pill-wrapped",""):z.removeAttribute("data-aia-pill-wrapped")};st();let Mt=new ResizeObserver(st);return Mt.observe(ne),()=>Mt.disconnect()},[$,Ae.length,Re,St]),(0,K.useImperativeHandle)(I,()=>({focus:ht,blur:Dt,reset:Xe,refreshProducts:p,setMode:z=>ae.current?.setMode(z),skipActivePill:h}),[ht,Dt,Xe,p,h]);let ut=!!$.length||Se.length>0,Ct=(0,K.useCallback)(z=>{if(!ut)return;z&&q();let ne=D(),st=(0,Ye.buildSubmitResult)(Lt(),ne.completedParams,ne.skippedParams,{identifiedParams:ne.identifiedParams,isReady:ne.isReady,customFields:ne.customFields});z&&pt(st),i(st),S&&Xe()},[pt,S,ut,q,D,i,Xe,Lt]);pe.current=()=>Ct(!1);let la=(0,K.useCallback)(z=>{z.target?.closest("[data-aia-pill]")||ht()},[ht]),da=v==="inline",ca=v==="dropdown";return(0,ke.jsxs)("div",{ref:T,className:`magicx-aia ${Je.container} ${n??""}`,"data-pill-placement":v,"data-options-position":ie,"data-animations":_?"on":"off","data-mode":Ha(R),children:[(0,ke.jsx)(wt,{...rt,showPills:ca,productsLayout:O,productImageFallback:fe}),(0,ke.jsxs)("div",{className:Je.inputWrapper,"data-aia-input-wrapper":"",onClick:la,children:[(0,ke.jsxs)("div",{className:Je.editorArea,"data-aia-editor":"",children:[(0,ke.jsx)("div",{...sa,className:Je.input,"data-aia-input":""}),da&&(Re||Ae.length>0)&&(0,ke.jsx)("span",{ref:F,className:Je.pillListContainer,"data-aia-pill-list-container":"",children:(0,ke.jsx)(ft,{pills:Ae,activePillIndex:0,activeSelected:it,onSelectPill:Ge,loading:Re})})]}),k===null?null:k===void 0?(0,ke.jsx)(ea,{disabled:!ut,onClick:()=>Ct(!0),label:(0,Ye.uiStringsFor)(w).submit}):(0,ke.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Je.submitSlot,onClick:z=>{ut&&(z.stopPropagation(),Ct(!0))},children:k})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
2682
2868
  //# sourceMappingURL=index.js.map