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