@magicx-eng/ai-autocomplete-react 0.61.1 → 0.62.1
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/README.md +11 -5
- package/REFERENCE.md +100 -1
- package/dist/index.d.mts +79 -9
- package/dist/index.d.ts +79 -9
- package/dist/index.js +140 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +140 -16
- 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 vs,cellDay as xs,cellIso as ys,DATE_RANGE_META_END as ks,DATE_RANGE_META_START as Ss,DEFAULT_OPTION_COUNT_UNIT as Cs,dateCellMarks as Ts,formatDate as Ps,formatDateRange as Is,formatOptionCount as As,formatPlace as Es,formatTime as zs,isoDate as Rs,LOCATION_META_KEY as Os,monthLabel as Ls,optionCountLabel as Ds,optionHasImage as Ms,optionImageSources as Ns,optionImageSrc as Fs,optionLabel as Hs,optionsShowLeadingVisuals as Bs,PRODUCT_PATH_PREFIX as Ws,parseDate as Gs,parseLooseDate as Ks,parseLooseDateRange as qs,parseTime as _s,productFromMatchedItem as Vs,productImageSources as Us,productsFromCustomFields as Qs,sanitizeOptionIconSvg as Ys,selectedRangeFor as js,TIME_META_KEY as $s,visibleDateRange as Zs,WEEKDAY_LABELS as Xs,withSkippedParams as Js}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as on,useCallback as Pa,useEffect as qa,useImperativeHandle as nn,useLayoutEffect as rn,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
|
|
@@ -29,6 +29,16 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
29
29
|
gap: 12px;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/* Opt-in focus ring on the whole field while the editor (or anything else in
|
|
33
|
+
it) has focus. Off by default: set --aia-focus-ring to an outline value
|
|
34
|
+
(\`2px solid #1668e3\`) and --aia-focus-ring-offset to pull it inside the
|
|
35
|
+
border (negative) or push it out. An outline, not a shadow, so it never
|
|
36
|
+
replaces --aia-shadow, and it follows the field's corner radius. */
|
|
37
|
+
.aia-inputWrapper-FLq1b:focus-within {
|
|
38
|
+
outline: var(--aia-focus-ring, none);
|
|
39
|
+
outline-offset: var(--aia-focus-ring-offset, 0px);
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
.aia-editorArea-7rBWq {
|
|
33
43
|
position: relative;
|
|
34
44
|
flex: 1;
|
|
@@ -85,6 +95,19 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
85
95
|
-webkit-user-modify: read-write-plaintext-only;
|
|
86
96
|
}
|
|
87
97
|
|
|
98
|
+
/* The editor never draws a focus ring of its own; the field shows focus
|
|
99
|
+
instead (--aia-focus-ring above). A page-wide \`:focus-visible { outline \u2026 }\`
|
|
100
|
+
names a pseudo-class, so the consumer-isolation reset can't stop it, and it
|
|
101
|
+
ties with the editor's \`outline: none\` \u2014 whichever stylesheet loaded last
|
|
102
|
+
wins, and the page's loads last under a dev server, CSS-in-JS or
|
|
103
|
+
route-split CSS. The ring then outlines the bare editor: a blue bar beside
|
|
104
|
+
the caret while it is empty, a box around the text once it isn't. Pinned at
|
|
105
|
+
(0,3,0) so the editor stays bare whatever the load order. */
|
|
106
|
+
.aia-input-IW-P-[contenteditable]:focus,
|
|
107
|
+
.aia-input-IW-P-[contenteditable]:focus-visible {
|
|
108
|
+
outline: none;
|
|
109
|
+
}
|
|
110
|
+
|
|
88
111
|
/* Completed params render as inline pills (Figma "RichTextPill") \u2014 a compact
|
|
89
112
|
~26px chip with regular-weight primary-color text on a faint-gray fill.
|
|
90
113
|
inline-block gives the padding/radius a box while the text stays part of the
|
|
@@ -406,7 +429,7 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
406
429
|
transition: none;
|
|
407
430
|
}
|
|
408
431
|
}
|
|
409
|
-
`,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
|
|
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 po,attachViewportFit as ho,containScroll as uo,dateFloorFor as mo,destroyPanelMorph as go,findMultiSelectDone as fo,fitMultiSelectDone as bo,hasSkippablePill as wo,isCalendarFormat as vo,labelTraditionalAutocomplete as xo,panelMorphKey as yo,queryLive as ko,settlePanelMorph as So,syncPanelHug as Co,uiStringsFor as To}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ye,useLayoutEffect as Ha,useRef as aa,useState as Po}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
410
433
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
411
434
|
* Consumer CSS always wins without !important.
|
|
412
435
|
*
|
|
@@ -1262,7 +1285,8 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
1262
1285
|
left: 0;
|
|
1263
1286
|
right: 0;
|
|
1264
1287
|
top: 100%;
|
|
1265
|
-
|
|
1288
|
+
/* Widest the panel gets; \`none\` lets it span the whole field. */
|
|
1289
|
+
max-width: var(--aia-dropdown-max-width, 544px);
|
|
1266
1290
|
/* Gap between the input box and the dropdown. Tunable via --aia-dropdown-offset. */
|
|
1267
1291
|
margin-top: var(--aia-dropdown-offset, 13px);
|
|
1268
1292
|
display: flex;
|
|
@@ -1623,6 +1647,39 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
1623
1647
|
background: var(--aia-see-all-bg-hover, #3d3d3d);
|
|
1624
1648
|
}
|
|
1625
1649
|
|
|
1650
|
+
/* A submit in progress: the add-to-cart button's spinning arc turns beside
|
|
1651
|
+
the label, in the label's colour, until the page the submit opens takes
|
|
1652
|
+
over. Its margins cancel its width and its height at any
|
|
1653
|
+
--aia-spinner-size, so it takes no room in the line: the label stays where
|
|
1654
|
+
it was and the button keeps its size. A slower turn under reduced motion. The state sits
|
|
1655
|
+
in :where(), so a page's own rule on the attribute restyles or hides it. */
|
|
1656
|
+
.aia-seeAll-0Zbgc:where([data-aia-see-all-state="busy"])::after {
|
|
1657
|
+
content: "";
|
|
1658
|
+
display: inline-block;
|
|
1659
|
+
margin: calc(var(--aia-spinner-size, 16px) / -2) calc(-8px - var(--aia-spinner-size, 16px))
|
|
1660
|
+
calc(var(--aia-spinner-size, 16px) / -2) 8px;
|
|
1661
|
+
vertical-align: middle;
|
|
1662
|
+
box-sizing: border-box;
|
|
1663
|
+
width: var(--aia-spinner-size, 16px);
|
|
1664
|
+
height: var(--aia-spinner-size, 16px);
|
|
1665
|
+
border: var(--aia-spinner-width, 2px) solid var(--aia-see-all-spinner-color, currentColor);
|
|
1666
|
+
border-right-color: transparent;
|
|
1667
|
+
border-radius: 50%;
|
|
1668
|
+
animation: aia-seeAllSpin-jlsZP 0.8s linear infinite;
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
@keyframes aia-seeAllSpin-jlsZP {
|
|
1672
|
+
to {
|
|
1673
|
+
transform: rotate(360deg);
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1678
|
+
.aia-seeAll-0Zbgc:where([data-aia-see-all-state="busy"])::after {
|
|
1679
|
+
animation-duration: 2s;
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1626
1683
|
/* The open panel's leaving ghost (panelMorph.ts) is a frozen copy of the
|
|
1627
1684
|
last step: the rows' own entrance must not replay in it while it fades. */
|
|
1628
1685
|
.aia-dropdown-yz2KC .magicx-aia-panel-ghost,
|
|
@@ -1726,7 +1783,7 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
1726
1783
|
opacity: 1;
|
|
1727
1784
|
}
|
|
1728
1785
|
}
|
|
1729
|
-
`,document.head.appendChild(e)}var
|
|
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 Qt,cellIso as ha,dateCellMarks as Yt,isDimmedDay as jt,isoDate as $t,monthLabel as Zt,visibleDateRange as Xt,WEEKDAY_LABELS as Jt}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as ei}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) ---
|
|
1730
1787
|
|
|
1731
1788
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1732
1789
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -1923,7 +1980,7 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
1923
1980
|
opacity: 0.8;
|
|
1924
1981
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1925
1982
|
}
|
|
1926
|
-
`,document.head.appendChild(e)}var
|
|
1983
|
+
`,document.head.appendChild(e)}var G={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 Ja}from"react/jsx-runtime";var ai=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function et({options:e,activeIndex:n,listboxId:t,view:i,selection:o,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:f,onNextMonth:w}){let v=$t(new Date),g=Xt({pendingStart:o.rangeStart,highlightedIso:ha(e[n]),selected:o.selectedRange,floor:o.floor});return Ja("div",{className:G.datepicker,"data-aia-datepicker":"",children:[Ja("div",{className:G.header,children:[ye("button",{type:"button",tabIndex:-1,className:G.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:f,children:"\u2039"}),ye("span",{className:G.month,"data-aia-date-month":"","aria-live":"polite",children:Zt(i)}),ye("button",{type:"button",tabIndex:-1,className:G.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:w,children:"\u203A"})]}),ye("div",{className:G.weekdays,"aria-hidden":"true",children:Jt.map((p,h)=>ye("span",{className:G.weekday,children:p},ai[h]))}),ye("div",{className:G.grid,"data-aia-date-grid":"",children:e.map((p,h)=>ye(ti,{option:p,id:`${t}-option-${h}`,index:h,isHighlighted:h===n&&p.is_tappable,isToday:ha(p)===v,isPast:jt(ha(p),v,o.floor),marks:Yt(ha(p),{selectedIso:o.selectedIso,range:g,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:l},ha(p)??`pad-${h}`))})]})}function ti({option:e,id:n,index:t,isHighlighted:i,isToday:o,isPast:s,marks:r,onSelect:l,onHighlight:f,onUnhighlight:w}){let[v,g]=ei(!1),p=Qt(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:`${G.cell} ${G.blank}`});let h=()=>{g(!0),l(e),setTimeout(()=>g(!1),170)},x=[G.cell,G.day,s?G.past:"",i?G.highlighted:"",o?G.today:"",r.inRange?G.inRange:"",r.selected?G.selected:"",r.reference?G.reference:"",v?G.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:x,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:G.number,children:p})})}import{ATTRIBUTION_URL as ii,buildAttributionUrl as oi,getFooterHint as ni,uiStringsFor as ri}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as si,useState as li}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 {
|
|
1927
1984
|
display: flex;
|
|
1928
1985
|
flex-wrap: wrap;
|
|
1929
1986
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -1963,7 +2020,7 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
1963
2020
|
.aia-cluster[data-justify="around"] {
|
|
1964
2021
|
justify-content: space-around;
|
|
1965
2022
|
}
|
|
1966
|
-
`,document.head.appendChild(e)}import{jsx as
|
|
2023
|
+
`,document.head.appendChild(e)}import{jsx as at}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?at("span",{...w,children:r}):at("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
|
|
1967
2024
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
1968
2025
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
1969
2026
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -2110,7 +2167,7 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
2110
2167
|
justify-content: flex-end;
|
|
2111
2168
|
}
|
|
2112
2169
|
}
|
|
2113
|
-
`,document.head.appendChild(e)}var
|
|
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 tt({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:t=ri()}){let{key:i,hint:o}=ni(e,n,t),[s,r]=li(ii);return si(()=>{r(oi())},[]),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 it,useLayoutEffect as di,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
|
|
2114
2171
|
Angular copy). The three are kept identical by
|
|
2115
2172
|
packages/vanilla/tests/render/locationFieldParity.test.ts. */
|
|
2116
2173
|
.aia-location-6-fsr {
|
|
@@ -2244,7 +2301,7 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
2244
2301
|
.aia-loadingBar-OLCr4:nth-child(3) {
|
|
2245
2302
|
width: 60%;
|
|
2246
2303
|
}
|
|
2247
|
-
`,document.head.appendChild(e)}var
|
|
2304
|
+
`,document.head.appendChild(e)}var K={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 ci=0;function ga(e){return e.getRootNode().activeElement??null}function rt(e){return e.getRootNode().getSelection?.()??document.getSelection()}function ot(e){if(!e.isContentEditable)return null;let n=rt(e);if(!n||n.rangeCount===0)return null;let t=n.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function nt(e,n){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=rt(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 pi=Ke("svg",{className:K.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"})]}),hi=Ke("svg",{className:K.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 st({view:e,searchLabel:n,noResultsLabel:t,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:f,onMove:w,onCommit:v,onFocusChange:g}){let p=ce(null),h=ce(null),x=ce(null),y=ce(null),S=ce(null),L=ce(!1),R=ce(!1),ae=ce(!1),I=ce(!1),D=ce(o);D.current=o;let U=ce(g);U.current=g;let F=c=>{I.current=c,g(c)},$=()=>{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=ot(T))},A=c=>{let T=h.current;!T||!(c instanceof HTMLElement)||c===y.current||c===document.body||T.contains(c)||(y.current=c,S.current=ot(c))},Q=ce(null);Q.current===null&&(Q.current=`aia-location-${++ci}`);let te=`${Q.current}-row-`;it(()=>{let c=p.current;c&&c.value!==e.query&&ga(c)!==c&&(c.value=e.query)},[e.query]),it(()=>{o&&(s&&!ae.current&&(R.current=!1),ae.current=s);let c=p.current;if(c){if(!r&&$()){R.current=!0,B();return}if(!o){setTimeout(()=>{if(D.current)return;let T=y.current;T&&ga(T)===T||(R.current=!1)},0);return}if(!(!s||R.current||!l||$())){if(Z(),F(!0),c.focus({preventScroll:!0}),!$()){R.current=!0,F(!1);return}c.value&&c.select()}}}),di(()=>()=>{if(!I.current)return;let c=p.current,T=y.current;T?.isConnected&&c&&ga(c)===c&&(L.current=!0,nt(T,S.current),L.current=!1),I.current=!1,U.current(!1)},[]);let B=(c=!1)=>{c&&(R.current=!0);let T=y.current;T?.isConnected&&$()&&(L.current=!0,nt(T,S.current),L.current=!1),F(!1)},X=e.query.trim(),C=e.highlighted>=0&&e.highlighted<e.places.length?`${te}${e.highlighted}`:void 0,N=null;return e.places.length>0?N=e.places.map((c,T)=>Ke("div",{id:`${te}${T}`,role:"option","aria-selected":T===e.highlighted,className:T===e.highlighted?`${K.row} ${K.highlighted}`:K.row,"data-aia-location-row":"","data-aia-index":T,onClick:()=>{l&&(B(!0),v(T))},children:[se("span",{className:K.pin,children:pi}),Ke("span",{className:K.text,children:[se("span",{className:K.name,children:c.name}),c.secondary&&se("span",{className:K.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?N=Ke("div",{className:K.loading,"data-aia-location-loading":"",children:[se("span",{className:K.loadingBar}),se("span",{className:K.loadingBar}),se("span",{className:K.loadingBar})]}):X&&(N=Ke("div",{className:K.note,"data-aia-location-note":"",children:[e.status==="done"&&se("span",{className:K.empty,children:t}),se("span",{children:i})]})),Ke("div",{ref:h,className:K.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!x.current?.contains(c.target)||(c.stopPropagation(),Z(),F(!0))},children:[Ke("label",{ref:x,className:K.field,children:[hi,se("input",{ref:p,type:"text",className:K.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=>{A(c.relatedTarget),F(!0)},onBlur:()=>{L.current||(R.current=!0,F(!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),v();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:K.results,"data-aia-location-results":"","aria-live":"polite",children:N})]})}import{isSmartSuggestion as fi,isTraditionalAutocompleteSuggestion as bi}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as ui}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,
|
|
2248
2305
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
2249
2306
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
2250
2307
|
as it was when the outline was dashed. */
|
|
@@ -2402,7 +2459,7 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
2402
2459
|
opacity: 0;
|
|
2403
2460
|
}
|
|
2404
2461
|
}
|
|
2405
|
-
`,document.head.appendChild(e)}var
|
|
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 mi,jsx as Ra,jsxs as gi}from"react/jsx-runtime";var Oa={selected:1,first:.7,next:.4,last:.2};function lt({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?gi(mi,{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:ui}})]}):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 {
|
|
2406
2463
|
position: relative;
|
|
2407
2464
|
z-index: 1;
|
|
2408
2465
|
pointer-events: auto;
|
|
@@ -2412,7 +2469,7 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
2412
2469
|
align-items: center;
|
|
2413
2470
|
vertical-align: middle;
|
|
2414
2471
|
}
|
|
2415
|
-
`,document.head.appendChild(e)}var
|
|
2472
|
+
`,document.head.appendChild(e)}var La={list:"aia-list-qvLqO"};import{jsx as xa}from"react/jsx-runtime";var wi=[125,69];function dt(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:wi.map((r,l)=>xa("span",{"data-aia-pill-skeleton":"",className:`${ke.pill} ${o?ke.rounded:""} ${ke.skeleton}`,style:{width:r,"--aia-pill-opacity":Oa[dt(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(lt,{label:r.text,state:f?"selected":dt(l),selected:f,active:l===n,rounded:o,loading:s,smartSuggestion:fi(r),completionHeader:bi(r),onClick:()=>t(l)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as vi,productImageSources as xi,productImageSrc as yi,productInitial as ki,productPhotoFill as Si,uiStringsFor as Ci}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
|
|
2416
2473
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
2417
2474
|
theming one package sees the same result in the other.
|
|
2418
2475
|
|
|
@@ -2788,6 +2845,40 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
2788
2845
|
}
|
|
2789
2846
|
}
|
|
2790
2847
|
|
|
2848
|
+
/* A selection in progress (\`onProductSelect\` ran, its page has not taken
|
|
2849
|
+
over): the add-to-cart button's disc and spinning arc sit on the middle of
|
|
2850
|
+
the tapped card's picture. The disc is the arc's own fill and spread, so
|
|
2851
|
+
the turn moves only the arc, and nothing in the card changes size. A slower
|
|
2852
|
+
turn under reduced motion: it is the only sign the tap took. The state
|
|
2853
|
+
sits in :where(), so a page's own rule on the attribute restyles or hides
|
|
2854
|
+
it. */
|
|
2855
|
+
.aia-card-JBGYT:where([data-aia-product-state="busy"]) .aia-media-RrbGe::before {
|
|
2856
|
+
content: "";
|
|
2857
|
+
position: absolute;
|
|
2858
|
+
top: 50%;
|
|
2859
|
+
left: 50%;
|
|
2860
|
+
z-index: 1;
|
|
2861
|
+
margin: calc(var(--aia-spinner-size, 16px) / -2) 0 0 calc(var(--aia-spinner-size, 16px) / -2);
|
|
2862
|
+
box-sizing: border-box;
|
|
2863
|
+
width: var(--aia-spinner-size, 16px);
|
|
2864
|
+
height: var(--aia-spinner-size, 16px);
|
|
2865
|
+
border: var(--aia-spinner-width, 2px) solid
|
|
2866
|
+
var(--aia-product-spinner-color, var(--aia-product-cart-color, #1f2328));
|
|
2867
|
+
border-right-color: transparent;
|
|
2868
|
+
border-radius: 50%;
|
|
2869
|
+
animation: aia-magicx-aia-product-cart-spin-x8mgr 0.8s linear infinite;
|
|
2870
|
+
background: var(--aia-product-spinner-bg, var(--aia-product-cart-bg, rgba(255, 255, 255, 0.94)));
|
|
2871
|
+
box-shadow:
|
|
2872
|
+
0 0 0 6px var(--aia-product-spinner-bg, var(--aia-product-cart-bg, rgba(255, 255, 255, 0.94))),
|
|
2873
|
+
0 0 0 7px rgba(0, 0, 0, 0.08);
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2877
|
+
.aia-card-JBGYT:where([data-aia-product-state="busy"]) .aia-media-RrbGe::before {
|
|
2878
|
+
animation-duration: 2s;
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2791
2882
|
/* A sold-out product's image steps back, so the badge is not the only cue.
|
|
2792
2883
|
Desaturated rather than faded: opacity lets the panel show through, which
|
|
2793
2884
|
muddies a photo on a dark surface. */
|
|
@@ -3005,7 +3096,7 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
3005
3096
|
opacity: 0.01;
|
|
3006
3097
|
}
|
|
3007
3098
|
}
|
|
3008
|
-
`,document.head.appendChild(e)}var
|
|
3099
|
+
`,document.head.appendChild(e)}var q={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 ct({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:v=!0,strings:g=Ci()}){let p=e.length>0,h=ka(null);if(Da(()=>{let y=h.current;if(!(!p||!y))return vi(y)},[p]),!p)return null;let x=`${n}-products-label`;return ea("section",{className:q.section,"data-aia-products":"","data-aia-loading":l?"":void 0,"data-aia-products-layout":f,role:"group","aria-labelledby":x,children:[J("div",{className:q.label,id:x,"data-aia-products-label":"",children:g.products}),J("div",{ref:h,className:q.row,"data-aia-products-row":"",children:e.map((y,S)=>J(Ti,{product:y,id:`${n}-product-${S}`,onSelect:t,busy:y.id===i,onAddToCart:o,onFocusChange:s,focusable:r,imageFallback:w,showVendor:v,soldOut:g.soldOut,addToCart:g.addToCart},y.id))})]})}function Ti({product:e,id:n,onSelect:t,busy:i,onAddToCart:o,onFocusChange:s,focusable:r,imageFallback:l,showVendor:f,soldOut:w,addToCart:v}){let g=!!o&&e.available!==!1,[p,h]=Sa(null),x=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:q.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:x,children:[J(Ai,{sources:xi(e.imageUrl),title:e.title,fallback:l,onPhotoFill:h},yi(e.imageUrl)??""),ea("span",{className:q.body,children:[f&&e.vendor?J("span",{className:q.vendor,children:e.vendor}):null,J("span",{className:q.title,children:e.title}),e.price?ea("span",{className:q.price,children:[e.price,e.compareAtPrice?J("s",{className:q.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?J("span",{className:q.badge,children:w}):null]}),g&&o?J(Ii,{product:e,label:`${v}: ${e.title}`,focusable:r,onAddToCart:o,onFocus:()=>s?.(!0),onBlur:x},Pi(e)):null]})}function Pi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(n=>n??"").join("\0")}function Ii({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 v=ka(!0);Da(()=>(v.current=!0,()=>{v.current=!1}),[]);let g=h=>{f.current=h,v.current&&l(h)},p=h=>{if(h.preventDefault(),h.stopPropagation(),f.current==="adding")return;g("adding");let x;try{x=Promise.resolve(i(w.current))}catch(y){x=Promise.reject(y)}x.then(()=>g("added"),()=>g(null))};return J("span",{className:q.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:q.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:q.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),J("path",{className:q.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),J("path",{className:q.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),J("circle",{className:q.cartGlyph,cx:"9",cy:"20",r:"1.3"}),J("circle",{className:q.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ai({sources:e,title:n,fallback:t,onPhotoFill:i}){let[o,s]=Sa(0),r=e[o],l=!!r,[f,w]=Sa(null),v=!l&&t==="initial";return Da(()=>()=>i(null),[i]),ea("span",{className:q.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!l&&!v?"":void 0,"data-aia-product-initial":v?"":void 0,"data-aia-image-loaded":l&&f===r?"":void 0,children:[l?J("img",{className:q.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:g=>{w(r),i(Si(g.currentTarget.naturalWidth,g.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),s(g=>g+1)}}):null,v?ki(n):null]})}import{isOptionsGridMobileViewport as Ki,measureOptionsGrid as qi,needsOptionsGridMeasurement as _i,OPTIONS_GRID_MOBILE_QUERY as Vi,optionEnterDelayMs as Ui,optionsShowLeadingVisuals as Qi,planOptionsGrid as gt,releasePanelHug as Yi,sameOptionRows as ji,syncPanelHug as $i}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Zi,useLayoutEffect as ft,useRef as bt,useState as vt}from"react";import{optionsGridTemplateColumns as Ei}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as zi,useRef as Ri}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 {
|
|
3009
3100
|
display: grid;
|
|
3010
3101
|
grid-template-columns: repeat(
|
|
3011
3102
|
auto-fit,
|
|
@@ -3049,7 +3140,7 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
3049
3140
|
:where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
|
|
3050
3141
|
max-height: var(--aia-grid-max-height, 120px);
|
|
3051
3142
|
}
|
|
3052
|
-
`,document.head.appendChild(e)}import{jsx as
|
|
3143
|
+
`,document.head.appendChild(e)}import{jsx as Oi}from"react/jsx-runtime";function pt({min:e="16rem",max:n,gap:t,scroll:i=!1,maxHeight:o,scrollResetKey:s,cols:r,template:l,innerRef:f,className:w,children:v,...g}){let p=Ri(null);zi(()=>{if(s===void 0)return;let x=p.current;x&&(x.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=Ei(r)),l&&(h.gridTemplateColumns=l),Oi("div",{ref:x=>{p.current=x,f?.(x)},className:w?`aia-grid ${w}`:"aia-grid","data-scroll":i||void 0,style:h,...g,children:v})}import{formatOptionCount as Li,highlightParts as Di,isMultiSelectToggleTap as Mi,OPTION_ENTER_DELAY_VAR as Ni,optionImageSources as ht,optionLabel as ut,sanitizeOptionIconSvg as Fi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Hi,useMemo as Bi,useRef as Wi,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 {
|
|
3053
3144
|
position: relative;
|
|
3054
3145
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
3055
3146
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -3575,7 +3666,7 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
3575
3666
|
border-radius: 6px;
|
|
3576
3667
|
font-size: 11px;
|
|
3577
3668
|
}
|
|
3578
|
-
`,document.head.appendChild(e)}var
|
|
3669
|
+
`,document.head.appendChild(e)}var Y={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 Gi,jsx as ue,jsxs as Ma}from"react/jsx-runtime";function mt({option:e,isHighlighted:n,checked:t,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:l,showIcon:f=!0,showImage:w=!0,showCount:v=!0,scrollHint:g,enterDelayMs:p=0}){let[h]=fa(p),[x,y]=fa(!1),S=w?ht(e.image_url):[],L=S[0]??null,[R,ae]=fa([]),I=S.find(C=>!R.includes(C))??null,D=w?(e.imageCollage??[]).map(C=>ht(C)[0]).filter(C=>C!==void 0):[],[U,F]=fa(!1),[$,Z]=fa(null),A=Bi(()=>!L&&f&&e.icon_svg?Fi(e.icon_svg):null,[L,f,e.icon_svg]),Q=v?Li(e.item_count):null,te=Wi(void 0);Hi(()=>()=>clearTimeout(te.current),[]);let B=C=>{if(l||!e.is_tappable||x&&t===void 0)return;y(!0);let N=C?.currentTarget;t!==void 0&&N!==void 0&&C!==void 0&&!Mi(N,N.querySelector("[data-aia-checkbox]"),C)?i(e,{commit:!0}):i(e),clearTimeout(te.current),te.current=setTimeout(()=>y(!1),170)},X=[Y.item,n&&!l?Y.highlighted:"",e.liveMatch&&!l?Y.liveMatch:"",e.is_tappable?Y.tappable:Y.nonTappable,x?Y.pressed:"",g?Y.scrollHint:""].filter(Boolean).join(" ");return ue("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":A&&e.icon?e.icon:void 0,"data-aia-image":L?"":void 0,"data-aia-item-count":Q!==null?e.item_count:void 0,"aria-selected":t??n,className:X,style:{[Ni]:`${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:Y.content,children:[t!==void 0&&e.is_tappable&&ue("span",{className:Y.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),L&&D.length>1&&ue("span",{className:`${Y.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":D.length,"data-aia-image-loaded":U?"":void 0,children:D.map(C=>ue("img",{src:C,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>F(!0),onError:N=>{N.currentTarget.hidden=!0}},C))}),L&&D.length<=1&&ue("span",{className:`${Y.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":I!==null&&$===I?"":void 0,children:ue("img",{src:I??L,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:I===null,onLoad:()=>Z(I),onError:()=>{I!==null&&ae(C=>[...C,I])}})}),A&&ue("span",{className:`${Y.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:A}}),Ma("span",{className:Y.text,children:[e.matchedText?Di(ut(e),e.matchedText).map((C,N)=>C.bold?ue("strong",{className:`${Y.match} magicx-aia-option-match`,"data-aia-match-partial":C.partial?"":void 0,children:C.text},N):C.text):ut(e),e.parameterLabel&&Ma(Gi,{children:[" ",ue("span",{className:`${Y.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&ue("span",{className:Y.tag,children:e.tag}),Q!==null&&ue("span",{className:`${Y.count} magicx-aia-option-count`,children:Q})]})})}import{jsx as wt}from"react/jsx-runtime";function Xi(){let[e,n]=vt(Ki);return Zi(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(Vi),i=()=>n(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function xt({options:e,activeIndex:n,picked:t,onSelect:i,onHighlight:o,onUnhighlight:s,listboxId:r,loading:l,groupKey:f="",optionsPosition:w="below",showIcons:v=!0,showImages:g=!0,showCounts:p=!0}){let h=Xi(),x=bt(null),[y,S]=vt(null),L=bt(null);ft(()=>{if(l&&ji(L.current,e))return;L.current=l?null:e;let I=x.current,D=I&&!l&&_i(e.length,h),U=I?.closest("[data-aia-dropdown]");D&&U&&Yi(U);let F=D?qi(I):null;S(F?gt(e.length,h,F.rowWidths,F.gridWidth):null)},[e,h,l]);let R=y??gt(e.length,h,null,null);ft(()=>{let I=x.current?.closest("[data-aia-dropdown]");I&&$i(I)},[R.template,h]);let ae=Qi(e,v,g);return wt(pt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:f,template:R.template,maxHeight:R.maxHeight,innerRef:I=>{x.current=I},"data-aia-group":f,children:e.map((I,D)=>wt(mt,{option:I,isHighlighted:D===n,checked:t?t.includes(I.text):void 0,onSelect:i,onHighlight:()=>o(D),onUnhighlight:s?()=>s(D):void 0,id:`${r}-option-${D}`,loading:l,showIcon:v&&ae,showImage:g&&ae,showCount:p,scrollHint:!l&&R.scrollHintIndices.includes(D),enterDelayMs:l?0:Ui(D,R.cols,e.length,w)},`${f}\0${I.parameter??""}\0${I.text}`))})}import{formatTime as Ji,TIME_WHEEL_COLUMNS as eo,TIME_WHEEL_ROW_HEIGHT as ao,timeWheelIndex as yt,timeWheelIndexFromScroll as to,timeWheelRows as io,withTimeWheelIndex as kt}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as oo,useEffect as no,useLayoutEffect as ro,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) ---
|
|
3579
3670
|
|
|
3580
3671
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
3581
3672
|
time-wheel.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -3697,7 +3788,7 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
3697
3788
|
.aia-done-llNY5:hover {
|
|
3698
3789
|
background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
|
|
3699
3790
|
}
|
|
3700
|
-
`,document.head.appendChild(e)}var
|
|
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 Na}from"react/jsx-runtime";var so=120;function St({view:e,label:n,doneLabel:t,interactive:i=!0,onTimeChange:o,onTimeCommit:s}){return Na("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:Ji(e.minutes)}),Na("div",{className:me.columns,"aria-hidden":"true",children:[Qe("div",{className:me.band}),eo.map(r=>Na(oo,{children:[r==="minute"&&Qe("span",{className:me.separator,children:":"}),Qe(lo,{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 lo({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=yt(e,n);ro(()=>{let g=o.current;if(!g||r.current)return;let p=f*ao;Math.abs(g.scrollTop-p)<1||(s.current=p,g.scrollTop=p)},[f]),no(()=>()=>{r.current&&clearTimeout(r.current)},[]);let w=()=>{r.current=null;let g=o.current,p=l.current;if(!g||!p.interactive)return;let h=to(e,g.scrollTop);h!==yt(e,p.minutes)&&p.onTimeChange(kt(e,p.minutes,h))},v=()=>{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,so)}};return Qe("div",{ref:o,className:me.column,"data-aia-time-column":e,onScroll:v,children:io(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(kt(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 {
|
|
3701
3792
|
display: flex;
|
|
3702
3793
|
flex-direction: column;
|
|
3703
3794
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -3712,7 +3803,7 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
3712
3803
|
align-items: end;
|
|
3713
3804
|
}
|
|
3714
3805
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
3715
|
-
`,document.head.appendChild(e)}import{jsx as
|
|
3806
|
+
`,document.head.appendChild(e)}import{jsx as co}from"react/jsx-runtime";function Ct({space:e,align:n="stretch",className:t,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return co("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":n,style:s,...o,children:i})}import{jsx as j,jsxs as Fa}from"react/jsx-runtime";var Io=typeof window>"u"?Ye:Ha,Ao=[159,119,164],Eo=()=>{},Tt=()=>{},zo=e=>{},Ro=()=>{},Oo=e=>{},Lo=e=>{},Do=e=>{},Mo=e=>{};function No(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=Po(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 Fo(e,n){let t=aa(null);Ye(()=>{let i=e.current,o=n.current;if(!i||!o)return;let s=ko(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:po({dropdown:i,grid:s,button:o})};return}t.current?.controller.update()}),Ye(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ho(e,n){let t=aa(n);t.current=n;let i=aa(null);Ha(()=>{let o=e.current;if(o){if(!i.current){i.current=ho({dropdown:o,isOpen:()=>t.current});return}i.current.update()}}),Ye(()=>()=>{i.current?.destroy(),i.current=null},[])}function Ba({suggestions:e,activeIndex:n,onSelect:t,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:l,pills:f,onPillClick:w,showPills:v=!0,onSkip:g,showSkipButton:p=!0,showOptionIcons:h=!0,showOptionImages:x=!0,showOptionCounts:y=!0,skipDisabled:S=!1,activeSelected:L=!1,isLoading:R=!1,skeletonExiting:ae=!1,isInputEmpty:I=!1,language:D,products:U,onProductSelect:F,onProductAddToCart:$,onProductFocusChange:Z,productsLayout:A="row",productImageFallback:Q="image",showProductVendor:te=!0,formatType:B="options",dateView:X=null,selectedDateIso:C=null,selectedDateRange:N=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:_,onLocationCommit:le,onLocationFocusChange:pe,isFocused:Ce=!1,optionsPosition:Te="below",mode:De}){let Me=No(De),be=Me!==void 0,ie=aa(null),Ne=aa(null);Fo(ie,Ne),Ye(()=>{if(ie.current)return uo(ie.current)},[]);let sa=e[0]?.options??[],we=!!(f&&f.length>0&&w),je=!!(U&&U.length>0),Fe=B==="time"&&Ee!=null,b=B==="location"&&P!=null,oe=s&&(sa.length>0||v&&we||R||je||Fe||b);Ho(ie,oe),Io(()=>{let z=ie.current;z&&(bo(z,fo(z)),Co(z))});let He={suggestions:e,activeIndex:n,pills:f,showPills:v,showSkipButton:p,showOptionIcons:h,showOptionImages:x,showOptionCounts:y,skipDisabled:S,activeSelected:L,isLoading:R,skeletonExiting:ae,isInputEmpty:I,products:U,formatType:B,dateView:X,selectedDateIso:C,selectedDateRange:N,dateRangeStart:c,dateReferences:T,timeView:Ee,multiSelectView:ze,locationView:P,isReediting:E,showsSeeAll:!!Re},Be=aa(He);oe&&(Be.current=He);let a=oe?He:Be.current,V=To(D),We=a.suggestions[0],ne=We?.options??[],la=a.activeIndex>=0&&!!ne[a.activeIndex]?.is_tappable,ve=xo(a.pills??[],V.keepTyping),he=!!(ve.length>0&&w),$e=a.showPills&&he,Ge=a.showPills&&!he&&a.isLoading,xe=$e||Ge,qe=he&&wo(ve)&&a.showSkipButton&&!a.isInputEmpty&&!!g,_e=ve[0]?.text,Ze=vo(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,W=a.formatType==="location"&&a.locationView!=null&&!a.isLoading,H=a.isLoading&&!Pe&&!Ve&&!d&&!W,Xe=a.products??[],ba=yo($e?ve:[]);return Ha(()=>{ie.current&&So(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,A,D]),Ye(()=>{let z=ie.current;return()=>{z&&go(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(Ct,{space:"8px",children:[(xe||qe)&&Fa(ua,{noWrap:!0,className:de.pillBar,"data-aia-pillbar":"",children:[xe&&j("span",{className:de.pillScroll,"data-aia-pill-scroll":"",children:j(ya,{pills:ve,activePillIndex:0,activeSelected:a.activeSelected,onSelectPill:w??(()=>{}),rounded:!0,loading:a.isLoading})}),qe&&j("button",{type:"button",tabIndex:-1,className:de.skip,"data-aia-skip":"",disabled:a.isLoading||a.skipDisabled,"aria-label":_e?`${V.skipLabel} ${_e}`:V.skipLabel,onClick:g,children:V.skip})]}),Pe&&j(xt,{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&&j("div",{"data-aia-multi-actions":"",onClick:z=>{z.target.closest("[data-aia-multi-done]")&&!a.skipDisabled&&!a.isLoading&&u?.()},children:j("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:V.done})}),Ve&&a.dateView&&j(et,{options:ne,activeIndex:a.activeIndex,listboxId:r,view:a.dateView,selection:{selectedIso:a.selectedDateIso??null,selectedRange:a.selectedDateRange??null,rangeStart:a.dateRangeStart??null,floor:mo(a.formatType,a.dateRangeStart),references:a.dateReferences??[]},onSelect:t,onHighlight:i,onUnhighlight:o,onPreviousMonth:Ae??Tt,onNextMonth:Se??Tt}),d&&a.timeView&&j(St,{view:a.timeView,label:V.timeLabel,doneLabel:V.done,interactive:!a.skipDisabled,onTimeChange:m??zo,onTimeCommit:k??Ro}),W&&a.locationView&&j(st,{view:a.locationView,searchLabel:V.locationSearch,noResultsLabel:V.locationNoResults,useTypedLabel:V.locationUseTyped,widgetFocused:Ce&&oe,reediting:a.isReediting,visible:oe,interactive:!a.skipDisabled,onQuery:O??Oo,onMove:_??Lo,onCommit:le??Do,onFocusChange:pe??Mo}),H&&j("div",{className:de.skeletonBars,"data-aia-skeleton-bars":"",children:Ao.map(z=>j("span",{className:de.skeletonBar,style:{width:z}},`bar-${z}`))}),j(ct,{products:Xe,listboxId:r,onSelect:F??Eo,busyProductId:Oe,onAddToCart:$,onFocusChange:Z,focusable:oe&&!a.isLoading,loading:a.isLoading,layout:A,imageFallback:Q,showVendor:te,strings:V}),a.showsSeeAll&&j("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:j("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:V.seeAllResults})}),j(tt,{isOptionHighlighted:la,isInputEmpty:a.isInputEmpty,strings:V})]}),j("button",{ref:Ne,type:"button",tabIndex:-1,className:de.scrollArrow,"data-aia-scroll-arrow":"","aria-label":V.scrollArrow,"aria-hidden":"true",children:j("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:j("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as sn,ModeController as ln,setCursorOffset as dn,uiStringsFor as cn,watchEditorHeight as pn}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as Bo}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 {
|
|
3716
3807
|
flex-shrink: 0;
|
|
3717
3808
|
width: 32px;
|
|
3718
3809
|
height: 32px;
|
|
@@ -3778,10 +3869,43 @@ import{buildSubmitResult as us,cellDay as ms,cellIso as gs,DATE_RANGE_META_END a
|
|
|
3778
3869
|
transform: scale(1.08);
|
|
3779
3870
|
}
|
|
3780
3871
|
|
|
3872
|
+
/* A submit in progress (Enter, this button, "See all results"): the arrow
|
|
3873
|
+
gives way to the spinning arc the add-to-cart button shows, in the arrow's
|
|
3874
|
+
colour, until the page the submit opens takes over. The button keeps its
|
|
3875
|
+
size and stays enabled; a press is ignored. A slower turn under reduced
|
|
3876
|
+
motion: it is the only sign the submit took. The state sits in :where(),
|
|
3877
|
+
so a page's own rule on the attribute restyles or hides it. */
|
|
3878
|
+
.aia-submitButton-otz7H:where([data-aia-submit-state="busy"]) svg {
|
|
3879
|
+
display: none;
|
|
3880
|
+
}
|
|
3881
|
+
|
|
3882
|
+
.aia-submitButton-otz7H:where([data-aia-submit-state="busy"])::after {
|
|
3883
|
+
content: "";
|
|
3884
|
+
box-sizing: border-box;
|
|
3885
|
+
width: var(--aia-spinner-size, 16px);
|
|
3886
|
+
height: var(--aia-spinner-size, 16px);
|
|
3887
|
+
border: var(--aia-spinner-width, 2px) solid var(--aia-submit-spinner-color, currentColor);
|
|
3888
|
+
border-right-color: transparent;
|
|
3889
|
+
border-radius: 50%;
|
|
3890
|
+
animation: aia-submitSpin-0llcF 0.8s linear infinite;
|
|
3891
|
+
}
|
|
3892
|
+
|
|
3893
|
+
@keyframes aia-submitSpin-0llcF {
|
|
3894
|
+
to {
|
|
3895
|
+
transform: rotate(360deg);
|
|
3896
|
+
}
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3899
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3900
|
+
.aia-submitButton-otz7H:where([data-aia-submit-state="busy"])::after {
|
|
3901
|
+
animation-duration: 2s;
|
|
3902
|
+
}
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3781
3905
|
@media (prefers-reduced-motion: reduce) {
|
|
3782
3906
|
.aia-submitButton-otz7H {
|
|
3783
3907
|
transition: none;
|
|
3784
3908
|
}
|
|
3785
3909
|
}
|
|
3786
|
-
`,document.head.appendChild(e)}var kt={submitButton:"aia-submitButton-otz7H"};import{jsx as Ma}from"react/jsx-runtime";function Ct({disabled:e,ready:n,onClick:a,label:t=Mo().submit}){return Ma("button",{type:"button","data-aia-submit":"",className:kt.submitButton,disabled:e,"data-aia-ready":n?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":t,children:Ma("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:Ma("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as No,dateSelectionFor as Ho,editingSuggestion as Fo,identifiedParamLabel as Bo,withoutTraditionalAutocomplete as Wo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Et,useEffect as aa,useMemo as Go,useRef as ee,useState as Ko}from"react";import{useRef as St}from"react";function Tt(e){let n=St(e);n.current=e;let a=Object.keys(e??{}).sort().join("\0"),t=St({key:"",overrides:void 0});if(t.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,w,v)=>{let y=n.current?.[s];return y?y(l,w,v):[]};o[s]=r}t.current={key:a,overrides:e?o:void 0}}return{overrides:t.current.overrides,key:a}}import{useRef as Pt}from"react";function It(e){let n=Pt(e);n.current=e;let a=Pt(null);a.current===null&&(a.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 t=e!==void 0;return{config:t?a.current:void 0,enabled:t}}var At={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,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 Na({onSubmit:e,onResult:n,onError:a,optionOverrides:t,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,visitorId:y,columns:f=2,dropdownTrigger:h,optionsPosition:p,closeDropdownOnBlur:k,prependPlaceholder:x,allOption:W,showNonTappableOptions:D,locationSearch:R,showOptionIcons:ae,showOptionImages:T,showOptionCounts:z,showSkipButton:U,showProducts:N,productImageFallback:te="image",showProductVendor:X=!0,onFocus:E,onBlur:Q,value:q,completedParams:B,onChange:re,onParamsChange:S,products:H,mapProducts:d,onProductSelect:P,onProductAddToCart:ve,source:Be,setCursor:xe}){let b=ee(null),[We,ye]=Ko(null),Oe=ee(e);Oe.current=e;let Le=ee(n);Le.current=n;let ze=ee(a);ze.current=a;let m=ee(re);m.current=re;let C=ee(S);C.current=S;let I=ee(E);I.current=E;let A=ee(Q);A.current=Q;let L=ee(xe);L.current=xe;let Y=ee(P);Y.current=P;let de=ee(ve);de.current=ve;let ie=ee(y);ie.current=y;let De=ee(()=>{let c=ie.current;return typeof c=="function"?c():c}).current,ke=It(H),Ge=ee(d);Ge.current=d;let j=ee((c,G)=>{let M=Ge.current;return M?M(c,G):c}).current,Ce=d?j:void 0,Ke=Tt(t);aa(()=>{if(typeof document>"u")return;let c=new No(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,visitorId:De,optionOverrides:Ke.overrides,maskCompletedText:o,columns:f,dropdownTrigger:h,optionsPosition:p,closeDropdownOnBlur:k,prependPlaceholder:x,allOption:W,showNonTappableOptions:D,locationSearch:R,showProducts:N,source:Be,value:q,completedParams:B,onSubmit:(...M)=>Oe.current?.(...M),onResult:(...M)=>Le.current?.(...M),onError:(...M)=>ze.current?.(...M),onChange:(...M)=>m.current?.(...M),onParamsChange:(...M)=>C.current?.(...M),onFocus:()=>I.current?.(),onBlur:()=>A.current?.(),onProductSelect:M=>Y.current?.(M),onProductAddToCart:M=>de.current?.(M),setCursor:M=>L.current?.(M),products:ke.config,mapProducts:Ce});b.current=c,ye(c.getState());let G=c.subscribe(M=>ye(M));return()=>{G(),c.destroy(),b.current===c&&(b.current=null)}},[]),aa(()=>{q!==void 0&&b.current?.setValue(q)},[q]),aa(()=>{B!==void 0&&b.current?.setCompletedParams(B)},[B]);let ra=JSON.stringify(s??null),ue;try{ue=JSON.stringify(r??null)}catch{ue="[unstringifiable]"}aa(()=>{b.current?.update({apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,optionOverrides:Ke.overrides,dropdownTrigger:h,optionsPosition:p,closeDropdownOnBlur:k,prependPlaceholder:x,allOption:W,showNonTappableOptions:D,locationSearch:R,showProducts:N})},[ra,ue,l,w?.code,w?.rate,w?.country,v,Ke.key,h,p,k,x,W,D,R,N]);let je=ee(!1);aa(()=>{if(!je.current){je.current=!0;return}b.current?.update({products:ke.config})},[ke.enabled]),aa(()=>{b.current?.update({mapProducts:Ce})},[Ce]);let Me=ee(null);Me.current===null&&(Me.current={handleTextChange:c=>b.current?.handleTextChange(c),handleCompositionText:c=>b.current?.handleCompositionText(c),handleKeyDown:c=>{let G="nativeEvent"in c?c.nativeEvent:c;b.current?.handleKeyDown(G)},setFocused:c=>b.current?.setFocused(c),startEditingParam:c=>b.current?.startEditingParam(c),removeParam:c=>b.current?.removeParam(c)??!1,exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:c=>b.current?.handleCaretAfterInput(c),handleCaretMove:c=>b.current?.handleCaretMove(c),replaceEditingRange:c=>b.current?.replaceEditingRange(c)??!1,setActivePill:c=>b.current?.setActivePill(c),skipActivePill:()=>b.current?.skipActivePill(),removeLastParam:()=>b.current?.removeLastParam(),clearNewParamId:()=>b.current?.clearNewParamId(),reset:()=>b.current?.reset(),refreshProducts:()=>b.current?.refreshProducts(),prepareSubmit:()=>b.current?.prepareSubmit(),getState:()=>b.current?.getState()??At,recordSubmit:c=>b.current?.recordSubmit(c),selectOption:(c,G)=>b.current?.selectOption(c,G),selectProduct:c=>b.current?.selectProduct(c),addProductToCart:c=>{let G=b.current;return!G||!de.current?Promise.resolve():G.addProductToCart(c)},setActiveDropdownIndex:c=>b.current?.setActiveDropdownIndex(c),clearHighlight:c=>b.current?.clearHighlight(c),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:c=>b.current?.setTime(c),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:c=>b.current?.toggleMultiSelectOption(c),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:c=>b.current?.setLocationQuery(c),moveLocationHighlight:c=>b.current?.moveLocationHighlight(c),commitLocation:c=>b.current?.commitLocation(c),setLocationFieldFocused:c=>b.current?.setLocationFieldFocused(c),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let g=Me.current,Se=Et(c=>{let G=c.target.value,Ze=G.length>0&&!c.nativeEvent?.isComposing&&G[0]!==G[0].toUpperCase()?G[0].toUpperCase()+G.slice(1):G;b.current?.handleTextChange(Ze)},[]),qe=Et(c=>{b.current?.handleKeyDown(c.nativeEvent)},[]),i=b.current,u=We??At,Te=q!==void 0?q:u.text,Pe=B!==void 0?B:u.completedParams,me=u.actionableSuggestions,Ie=me[0],Ne=Go(()=>Wo(me),[me]),ge=i?.listboxId??"",sa=u.activeDropdownIndex>=0&&i?`${ge}-option-${u.activeDropdownIndex}`:void 0,Ee=u.editingParam,fe=u.editingIdentified,He=Ee?Fo(Ee):fe?{parameter:fe.parameter,text:Bo(fe.parameter),required:!0,options:[]}:null,_e=u.dropdownSuggestion??He??Ie,$e=He?[He]:me,Ae=Ho(u),Ve=!i||u.dropdownLoading;return{completedParams:Pe,multiSelectView:u.multiSelectView,toggleMultiSelectOption:g.toggleMultiSelectOption,commitMultiSelect:g.commitMultiSelect,skippedParams:u.skippedParams,identifiedParams:u.identifiedParams,suggestionPills:Ne,setActivePill:g.setActivePill,skipActivePill:g.skipActivePill,removeLastParam:g.removeLastParam,segments:u.segments,newParamId:u.newParamId,clearNewParamId:g.clearNewParamId,suggestions:u.suggestions,activeIndex:u.activeDropdownIndex,isReady:u.isReady,isLoading:Ve,isFocused:u.isFocused,isDropdownOpen:u.isDropdownOpen,isActivePillSelected:u.isActivePillSelected,placeholderText:u.placeholderText,listboxId:ge,error:u.error,products:u.products,customFields:u.customFields,selectProduct:g.selectProduct,addProductToCart:g.addProductToCart,handleTextChange:g.handleTextChange,handleCompositionText:g.handleCompositionText,handleKeyDown:g.handleKeyDown,setFocused:g.setFocused,editingParam:Ee,editingIdentified:fe,editingAnchor:u.editingAnchor,caretOffset:u.caretOffset,startEditingParam:g.startEditingParam,removeParam:g.removeParam,exitEditMode:g.exitEditMode,handleCaretAfterInput:g.handleCaretAfterInput,handleCaretMove:g.handleCaretMove,replaceEditingRange:g.replaceEditingRange,inputProps:{value:Te,placeholder:u.placeholderText||void 0,onChange:Se,onKeyDown:qe,onFocus:g.handleFocus,onBlur:g.handleBlur,role:"combobox","aria-expanded":u.isDropdownOpen,"aria-activedescendant":sa,"aria-autocomplete":"list","aria-controls":ge},reset:g.reset,refreshProducts:g.refreshProducts,prepareSubmit:g.prepareSubmit,getState:g.getState,recordSubmit:g.recordSubmit,dropdownProps:{suggestions:_e?[{..._e,options:u.dropdownOptions}]:[],activeIndex:u.activeDropdownIndex,onSelect:g.selectOption,onHighlight:g.setActiveDropdownIndex,onUnhighlight:g.clearHighlight,isOpen:u.isDropdownOpen,id:ge,pills:$e,activeSelected:u.isActivePillSelected,onPillClick:g.setActivePill,onSkip:g.skipActivePill,showSkipButton:(U??!0)&&!Ee&&!fe,showOptionIcons:ae??!0,showOptionImages:T??!0,showOptionCounts:z??!0,skipDisabled:u.inSelectionAnimation,isLoading:Ve,skeletonExiting:u.skeletonExiting,isInputEmpty:Te.trim().length===0,language:l,products:u.products,productImageFallback:te,showProductVendor:X,onProductSelect:g.selectProduct,onProductAddToCart:ve?g.addProductToCart:void 0,onProductFocusChange:g.setFocused,formatType:u.activeFormatType,dateView:u.dateView,selectedDateIso:Ae.selectedIso,selectedDateRange:Ae.selectedRange,dateRangeStart:Ae.rangeStart,dateReferences:Ae.references,onPreviousMonth:g.showPreviousMonth,onNextMonth:g.showNextMonth,timeView:u.timeView,multiSelectView:u.dropdownMultiSelect,onMultiSelectCommit:g.commitMultiSelect,onTimeChange:g.setTime,onTimeCommit:g.commitTime,locationView:u.locationView,isReediting:u.editingParam!=null,onLocationQuery:g.setLocationQuery,onLocationMove:g.moveLocationHighlight,onLocationCommit:g.commitLocation,onLocationFocusChange:g.setLocationFieldFocused,isFocused:u.isFocused||u.locationFieldFocused,optionsPosition:p??"below"}}}import{attachChipRemove as qo,cancelStartingHint as _o,chipIdFromTap as Vo,extractPlainText as Rt,getCursorOffset as Ot,keepCaretOnChip as Uo,plainTextLength as Qo,renderEditableContent as Yo,setCursorOffset as Lt,startingHintOptions as jo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as he,useEffect as ta,useLayoutEffect as Ha,useRef as ia}from"react";var ka;function $o(){if(ka!==void 0)return ka;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),ka=e.contentEditable==="plaintext-only",ka}function zt(e){let{segments:n,showChipIcons:a=!0,showChipImages:t=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:w,editingAnchor:v,caretOffset:y,placeholderText:f,hintSuggestions:h,isFocused:p,isDropdownOpen:k,listboxId:x,activeDescendantId:W,autoFocus:D,handleTextChange:R,handleCompositionText:ae,handleKeyDown:T,handleCaretAfterInput:z,handleCaretMove:U,startEditingParam:N,replaceEditingRange:te,setFocused:X}=e,E=ia(null),Q=ia(!1),q=ia(""),B=ia(""),re=ia(null),S=ia(0);re.current=y,ta(()=>{if(!D)return;let m=E.current;if(!m)return;document.activeElement===m?X(!0):m.focus();let C=m.ownerDocument??document,I=C.getSelection(),A=I&&I.rangeCount>0&&m.contains(I.anchorNode);if(I&&!A){let L=C.createRange();L.selectNodeContents(m),L.collapse(!0),I.removeAllRanges(),I.addRange(L)}},[D,X]),ta(()=>{let m=E.current;if(!m)return;let C=m.ownerDocument??document,I=()=>{let A=C.getSelection();if(!A||A.rangeCount===0||!A.anchorNode||!m.contains(A.anchorNode))return;let L=A.anchorNode,Y=L.nodeType===Node.ELEMENT_NODE?L:L.parentElement,ie=(A.isCollapsed?Y?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,De=l?.id??w?.id??null;if(ie&&ie!==De){N(ie);return}performance.now()-S.current<50||U(Ot(m))};return C.addEventListener("selectionchange",I),()=>C.removeEventListener("selectionchange",I)},[l,w,N,U]),ta(()=>{let m=E.current;if(!m)return;let C=I=>{let A=Vo(m,I.target);A&&(N(A),Uo(m,A))};return m.addEventListener("click",C),()=>m.removeEventListener("click",C)},[N]),ta(()=>{let m=E.current;if(!(!m||!s||!o))return qo(m,s)},[s,o]),Ha(()=>{let m=E.current;m&&Yo({input:m,segments:n,newParamId:r,editingParamId:l?.id??null,placeholderText:f??"",isFocused:p,showChipIcons:a,showChipImages:t,showChipRemove:o,hintOptions:jo(h??[])})},[n,r,l,f,h,p,a,t,o]),ta(()=>{let m=E.current;return()=>{m&&_o(m)}},[]),Ha(()=>{let m=q.current,C=r??"";if(q.current=C,!C||C===m)return;let I=E.current;if(!I)return;I.focus();let A=re.current??Qo(I);Lt(I,A)},[r]),Ha(()=>{let m=B.current,C=l?.id??"";if(B.current=C,!C||C===m||v==null)return;let I=E.current;I&&Lt(I,v)},[l,v]);let H=he(()=>{let m=E.current;if(!m)return;let C=Rt(m),A=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;if(Q.current){ae(A);return}R(A)},[R,ae]),d=he(()=>{S.current=performance.now(),H();let m=E.current;m&&z(Ot(m))},[H,z]);ta(()=>{let m=E.current;if(!m)return;let C=I=>{let A=I,L=A.inputType;if(L==="insertParagraph"||L==="insertLineBreak"||L==="insertFromDrop"){I.preventDefault();return}if(L.startsWith("insert")||L.startsWith("delete")){let Y=L.startsWith("delete")?"":A.data??"";te(Y)&&I.preventDefault()}};return m.addEventListener("beforeinput",C),()=>m.removeEventListener("beforeinput",C)},[te]);let P=he(()=>{Q.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),ve=he(()=>{Q.current=!1,E.current?.removeAttribute("data-aia-composing"),H()},[H]),Be=he(m=>{m.preventDefault();let C=E.current;if(!C)return;let I=(m.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let A=C.ownerDocument??document,L=A.getSelection();if(!L||L.rangeCount===0)return;let Y=L.getRangeAt(0);if(!C.contains(Y.startContainer))return;Y.deleteContents();let de=A.createTextNode(I);Y.insertNode(de),Y.setStartAfter(de),Y.collapse(!0),L.removeAllRanges(),L.addRange(Y),H()},[H]),xe=he(m=>T(m),[T]),b=he(()=>X(!0),[X]),We=he(()=>X(!1),[X]),ye=he(()=>E.current?.focus(),[]),Oe=he(()=>E.current?.blur(),[]),Le=he(()=>{let m=E.current;return m?Rt(m):""},[]),ze=$o()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:ze,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":x,"aria-expanded":k,"aria-activedescendant":W,spellCheck:!0,enterKeyHint:"send",onInput:d,onKeyDown:xe,onCompositionStart:P,onCompositionEnd:ve,onPaste:Be,onFocus:b,onBlur:We},getPlainText:Le,focus:ye,blur:Oe}}import{jsx as na,jsxs as Ba}from"react/jsx-runtime";function rn(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var sn=Zo(function({onSubmit:n,onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:w,language:v,currency:y,productId:f,visitorId:h,columns:p,pillPlacement:k="dropdown",mode:x="auto",optionsPosition:W="below",animations:D=!0,optionsStyle:R="floating",dropdownTrigger:ae,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:U,showNonTappableOptions:N,locationSearch:te,showOptionIcons:X=!0,showChipIcons:E=!0,showChipImages:Q=!0,showChipRemove:q=!1,showOptionImages:B=!0,showOptionCounts:re=!0,showSkipButton:S,showProducts:H,productsLayout:d,productImageFallback:P,showProductVendor:ve,autoFocus:Be=!0,onFocus:xe,onBlur:b,value:We,completedParams:ye,onChange:Oe,onParamsChange:Le,products:ze,mapProducts:m,onProductSelect:C,onProductAddToCart:I,submitButton:A,resetOnSubmit:L=!0,seeAllResults:Y=!1},de){let ie=oa(null),De=oa(null),ke=oa(null),Ge=oa(()=>{}),j=oa(null),Ce=oa(null);Fa(()=>{let F=ie.current;if(F)return j.current?j.current.setMode(x):j.current=new an(F,x),()=>{j.current?.destroy(),j.current=null}},[x]);let Ke=Ca(F=>{let oe=Ce.current?.current;oe&&(oe.focus(),tn(oe,F))},[]),{completedParams:ra,suggestionPills:ue,setActivePill:je,skipActivePill:Me,segments:g,newParamId:Se,clearNewParamId:qe,placeholderText:i,isFocused:u,isDropdownOpen:Te,isActivePillSelected:Pe,isLoading:me,isReady:Ie,activeIndex:Ne,listboxId:ge,handleTextChange:sa,handleCompositionText:Ee,handleKeyDown:fe,setFocused:He,editingParam:_e,editingIdentified:$e,editingAnchor:Ae,caretOffset:Ve,startEditingParam:c,removeParam:G,handleCaretAfterInput:M,handleCaretMove:Ze,replaceEditingRange:O,dropdownProps:Wa,reset:ga,refreshProducts:Ga,prepareSubmit:Ka,getState:qa,recordSubmit:_a}=Na({onSubmit:F=>Ge.current(F),onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:w,language:v,currency:y,productId:f,visitorId:h,columns:p,dropdownTrigger:ae,optionsPosition:W,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:U,showNonTappableOptions:N,locationSearch:te,showOptionIcons:X,showOptionImages:B,showOptionCounts:re,showSkipButton:S,showProducts:H,onFocus:xe,onBlur:b,value:We,completedParams:ye,onChange:Oe,onParamsChange:Le,products:ze,mapProducts:m,onProductSelect:C,onProductAddToCart:I,source:"full-sdk",setCursor:Ke});Fa(()=>{if(!Se)return;let F=window.setTimeout(()=>qe(),650);return()=>window.clearTimeout(F)},[Se,qe]);let Dt=Ne>=0?`${ge}-option-${Ne}`:void 0,{inputRef:Sa,editorProps:Mt,focus:fa,blur:Va,getPlainText:Ua}=zt({segments:g,newParamId:Se,editingParam:_e,editingIdentified:$e,editingAnchor:Ae,caretOffset:Ve,placeholderText:i,hintSuggestions:k==="inline"?[]:ue,isFocused:u,showChipIcons:E,showChipImages:Q,showChipRemove:q,removeParam:G,isDropdownOpen:Te,listboxId:ge,activeDescendantId:Dt,autoFocus:Be,handleTextChange:sa,handleCompositionText:Ee,handleKeyDown:fe,handleCaretAfterInput:M,handleCaretMove:Ze,startEditingParam:c,replaceEditingRange:O,setFocused:He});Ce.current=Sa,Jo(()=>{let F=De.current,oe=Sa.current;if(!F||!oe)return;let da=()=>{let Ya=F.firstElementChild;if(!Ya)return;let Gt=Ya.getBoundingClientRect(),Kt=oe.getBoundingClientRect();Gt.top>=Kt.bottom-2?F.setAttribute("data-aia-pill-wrapped",""):F.removeAttribute("data-aia-pill-wrapped")};da();let Qa=new ResizeObserver(da);return Qa.observe(oe),()=>Qa.disconnect()},[g,ue.length,me,Sa]),Fa(()=>{let F=ke.current;if(F)return nn(F)},[]),Xo(de,()=>({focus:fa,blur:Va,reset:ga,refreshProducts:Ga,setMode:F=>j.current?.setMode(F),skipActivePill:Me}),[fa,Va,ga,Ga,Me]);let Xe=!!g.length||ra.length>0,la=Ca(F=>{if(!Xe)return;F&&Ka();let oe=qa(),da=en(Ua(),oe.completedParams,oe.skippedParams,{identifiedParams:oe.identifiedParams,isReady:oe.isReady,customFields:oe.customFields});F&&_a(da),n(da),L&&ga()},[_a,L,Xe,Ka,qa,n,ga,Ua]);Ge.current=()=>la(!1);let Nt=Y&&!Wa.isInputEmpty&&Xe,Ht=Ca(()=>la(!0),[la]),Ft=Ca(F=>{F.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||fa()},[fa]),Bt=k==="inline",Wt=k==="dropdown";return Ba("div",{ref:ie,className:`magicx-aia ${Ue.container} ${r??""}`,"data-pill-placement":k,"data-options-position":W,"data-animations":D?"on":"off","data-aia-options-style":R,"data-mode":rn(x),children:[na(Da,{...Wa,showPills:Wt,productsLayout:d,productImageFallback:P,showProductVendor:ve,onSeeAllResults:Nt?Ht:void 0,fullWidth:Y}),Ba("div",{className:Ue.inputWrapper,"data-aia-input-wrapper":"",onClick:Ft,children:[Ba("div",{ref:ke,className:Ue.editorArea,"data-aia-editor":"",children:[na("div",{...Mt,className:Ue.input,"data-aia-input":""}),Bt&&(me||ue.length>0)&&na("span",{ref:De,className:Ue.pillListContainer,"data-aia-pill-list-container":"",children:na(wa,{pills:ue,activePillIndex:0,activeSelected:Pe,onSelectPill:je,loading:me})})]}),A===null?null:A===void 0?na(Ct,{disabled:!Xe,ready:Xe&&Ie,onClick:()=>la(!0),label:on(v).submit}):na("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ue.submitSlot,onClick:F=>{Xe&&(F.stopPropagation(),la(!0))},children:A})]})]})});export{sn as AIAutocomplete,Da as AIAutocompleteDropdown,fs as DATE_RANGE_META_END,bs as DATE_RANGE_META_START,ws as DEFAULT_OPTION_COUNT_UNIT,Ps as LOCATION_META_KEY,Ds as PRODUCT_PATH_PREFIX,_s as TIME_META_KEY,Us as WEEKDAY_LABELS,us as buildSubmitResult,ms as cellDay,gs as cellIso,vs as dateCellMarks,xs as formatDate,ys as formatDateRange,ks as formatOptionCount,Cs as formatPlace,Ss as formatTime,Ts as isoDate,Is as monthLabel,Es as optionCountLabel,As as optionHasImage,Rs as optionImageSources,Os as optionImageSrc,Ls as optionLabel,zs as optionsShowLeadingVisuals,Ms as parseDate,Ns as parseLooseDate,Hs as parseLooseDateRange,Fs as parseTime,Bs as productFromMatchedItem,Ws as productImageSources,Gs as productsFromCustomFields,Ks as sanitizeOptionIconSvg,qs as selectedRangeFor,Na as useAIAutocomplete,Vs as visibleDateRange,Qs as withSkippedParams};
|
|
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};
|
|
3787
3911
|
//# sourceMappingURL=index.mjs.map
|