@magicx-eng/ai-autocomplete-react 0.57.2 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/REFERENCE.md +5 -2
- package/dist/index.d.mts +30 -2
- package/dist/index.d.ts +30 -2
- package/dist/index.js +118 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +118 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var za=Object.defineProperty;var Lt=Object.getOwnPropertyDescriptor;var zt=Object.getOwnPropertyNames;var Dt=Object.prototype.hasOwnProperty;var Mt=(e,t)=>{for(var a in t)za(e,a,{get:t[a],enumerable:!0})},Nt=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of zt(t))!Dt.call(e,o)&&o!==a&&za(e,o,{get:()=>t[o],enumerable:!(i=Lt(t,o))||i.enumerable});return e};var Ft=e=>Nt(za({},"__esModule",{value:!0}),e);var pi={};Mt(pi,{AIAutocomplete:()=>kt,AIAutocompleteDropdown:()=>Ea,DATE_RANGE_META_END:()=>d.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>d.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>d.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>d.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>d.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>d.TIME_META_KEY,WEEKDAY_LABELS:()=>d.WEEKDAY_LABELS,buildSubmitResult:()=>d.buildSubmitResult,cellDay:()=>d.cellDay,cellIso:()=>d.cellIso,dateCellMarks:()=>d.dateCellMarks,formatDate:()=>d.formatDate,formatDateRange:()=>d.formatDateRange,formatOptionCount:()=>d.formatOptionCount,formatPlace:()=>d.formatPlace,formatTime:()=>d.formatTime,isoDate:()=>d.isoDate,monthLabel:()=>d.monthLabel,optionCountLabel:()=>d.optionCountLabel,optionHasImage:()=>d.optionHasImage,optionImageSources:()=>d.optionImageSources,optionImageSrc:()=>d.optionImageSrc,optionLabel:()=>d.optionLabel,optionsShowLeadingVisuals:()=>d.optionsShowLeadingVisuals,parseDate:()=>d.parseDate,parseLooseDate:()=>d.parseLooseDate,parseLooseDateRange:()=>d.parseLooseDateRange,parseTime:()=>d.parseTime,productFromMatchedItem:()=>d.productFromMatchedItem,productImageSources:()=>d.productImageSources,productsFromCustomFields:()=>d.productsFromCustomFields,sanitizeOptionIconSvg:()=>d.sanitizeOptionIconSvg,selectedRangeFor:()=>d.selectedRangeFor,useAIAutocomplete:()=>Ra,visibleDateRange:()=>d.visibleDateRange,withSkippedParams:()=>d.withSkippedParams});module.exports=Ft(pi);var d=require("@magicx-eng/ai-autocomplete-vanilla");var j=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
|
|
2
2
|
position: relative;
|
|
3
3
|
/* Inherits the host page's font by default. Consumers can pin a specific
|
|
4
4
|
font on the library via \`--aia-font-family: 'Custom Font'\` without
|
|
@@ -406,7 +406,7 @@
|
|
|
406
406
|
transition: none;
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
`,document.head.appendChild(e)}var
|
|
409
|
+
`,document.head.appendChild(e)}var ca={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaChipForm:"aia-aiaChipForm-tKbNc",aiaTileGrow:"aia-aiaTileGrow-j9Pat",aiaTileSpring:"aia-aiaTileSpring-FEwNg",aiaTileFade:"aia-aiaTileFade-H1LDQ",aiaImageGrow:"aia-aiaImageGrow-i9yw8"};var z=require("@magicx-eng/ai-autocomplete-vanilla"),J=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
410
410
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
411
411
|
* Consumer CSS always wins without !important.
|
|
412
412
|
*
|
|
@@ -653,6 +653,11 @@
|
|
|
653
653
|
--aia-done-bg: #e4e8f0;
|
|
654
654
|
--aia-done-bg-hover: #d8dde8;
|
|
655
655
|
--aia-done-color: #2a3150;
|
|
656
|
+
/* The opt-in "See all results" button (\`seeAllResults\`): a solid
|
|
657
|
+
near-black button under white text. */
|
|
658
|
+
--aia-see-all-bg: #2b2b2b;
|
|
659
|
+
--aia-see-all-bg-hover: #3d3d3d;
|
|
660
|
+
--aia-see-all-color: #ffffff;
|
|
656
661
|
|
|
657
662
|
--aia-footer-hint-color: var(--aia-primitive-neutral-500);
|
|
658
663
|
--aia-footer-brand-color: var(--aia-primitive-neutral-700);
|
|
@@ -719,6 +724,11 @@
|
|
|
719
724
|
--aia-done-bg: var(--aia-confirm-bg);
|
|
720
725
|
--aia-done-bg-hover: var(--aia-confirm-bg-hover);
|
|
721
726
|
--aia-done-color: var(--aia-confirm-color);
|
|
727
|
+
/* A black pill vanishes on the dark surface, so "See all results" takes the
|
|
728
|
+
dark theme's confirm colors too. */
|
|
729
|
+
--aia-see-all-bg: var(--aia-confirm-bg);
|
|
730
|
+
--aia-see-all-bg-hover: var(--aia-confirm-bg-hover);
|
|
731
|
+
--aia-see-all-color: var(--aia-confirm-color);
|
|
722
732
|
|
|
723
733
|
--aia-footer-hint-color: var(--aia-primitive-neutral-700);
|
|
724
734
|
--aia-footer-brand-color: var(--aia-primitive-neutral-500);
|
|
@@ -1107,6 +1117,37 @@
|
|
|
1107
1117
|
);
|
|
1108
1118
|
}
|
|
1109
1119
|
}
|
|
1120
|
+
/* While the panel glides wider (panelMorph.ts), its new content is laid out at
|
|
1121
|
+
the width it lands at and the panel, which clips, reveals it as it opens:
|
|
1122
|
+
squeezed into the narrow width it starts from, two columns would wrap. The
|
|
1123
|
+
leaving copy keeps its own width. */
|
|
1124
|
+
[data-aia-dropdown][data-aia-glide-width]
|
|
1125
|
+
> :not(.magicx-aia-panel-ghost):not([data-aia-scroll-arrow]) {
|
|
1126
|
+
min-width: var(--aia-glide-content-width, auto);
|
|
1127
|
+
}
|
|
1128
|
+
/* The All row's tile shows the first options' pictures together: two side by
|
|
1129
|
+
side, three as a tall half and two quarters, four in a 2x2 grid. Each is
|
|
1130
|
+
cropped to its cell, since a contained picture would leave the cells
|
|
1131
|
+
mostly empty. */
|
|
1132
|
+
[data-aia-option] [data-aia-collage] {
|
|
1133
|
+
display: grid;
|
|
1134
|
+
grid-template-columns: 1fr 1fr;
|
|
1135
|
+
gap: 1px;
|
|
1136
|
+
}
|
|
1137
|
+
[data-aia-option] [data-aia-collage="3"],
|
|
1138
|
+
[data-aia-option] [data-aia-collage="4"] {
|
|
1139
|
+
grid-template-rows: 1fr 1fr;
|
|
1140
|
+
}
|
|
1141
|
+
[data-aia-option] [data-aia-collage="3"] > img:first-child {
|
|
1142
|
+
grid-row: 1 / span 2;
|
|
1143
|
+
}
|
|
1144
|
+
[data-aia-option] [data-aia-collage] > img {
|
|
1145
|
+
width: 100%;
|
|
1146
|
+
height: 100%;
|
|
1147
|
+
min-width: 0;
|
|
1148
|
+
min-height: 0;
|
|
1149
|
+
object-fit: cover;
|
|
1150
|
+
}
|
|
1110
1151
|
/* Done spans the panel, whatever the panel's width. */
|
|
1111
1152
|
[data-aia-dropdown]:not(:where([data-aia-options-style="classic"] *)) [data-aia-multi-done] {
|
|
1112
1153
|
width: var(--aia-multi-done-width, 100%);
|
|
@@ -1317,7 +1358,7 @@
|
|
|
1317
1358
|
A bare down chevron at the bottom-centre of the option list, shown while
|
|
1318
1359
|
there is more to scroll to \u2014 no disc, border or shadow around it. It rests
|
|
1319
1360
|
just above the grid's reserved band, or \u2014 when a product strip follows the
|
|
1320
|
-
grid \u2014 centred on the strip's "
|
|
1361
|
+
grid \u2014 centred on the strip's "Items" label row, off the last option row
|
|
1321
1362
|
(--aia-scroll-arrow-bottom is measured and set inline by the controller so
|
|
1322
1363
|
it tracks the layout). It never travels with the scroll: the controller toggles
|
|
1323
1364
|
data-aia-visible and the only thing that transitions is opacity \u2014 a slow,
|
|
@@ -1541,6 +1582,45 @@
|
|
|
1541
1582
|
background: var(--aia-multi-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
|
|
1542
1583
|
}
|
|
1543
1584
|
|
|
1585
|
+
/* With a "See all results" button in the same panel, that button is the
|
|
1586
|
+
filled one: Done drops its fill so the panel does not end on two solid
|
|
1587
|
+
bars (vanilla's styles.css explains the two tokens). */
|
|
1588
|
+
.aia-dropdown-yz2KC:has([data-aia-see-all]) .aia-multiDone-y12U7:not(:hover) {
|
|
1589
|
+
background: var(--aia-multi-done-bg-beside-see-all, transparent);
|
|
1590
|
+
color: var(--aia-multi-done-color-beside-see-all, var(--aia-option-color-selected, #2a3150));
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
/* --- See all results (opt-in: \`seeAllResults\`) ---
|
|
1594
|
+
A button under the products that submits the query: near-black in light
|
|
1595
|
+
mode, the confirm gray in dark (appearance.css sets both). The same box as
|
|
1596
|
+
the multi-select Done above it. Declarations match vanilla's styles.css
|
|
1597
|
+
(seeAllResultsParity.test.ts). */
|
|
1598
|
+
.aia-seeAllRow-icrau {
|
|
1599
|
+
padding: 4px 0 0;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
.aia-seeAll-0Zbgc {
|
|
1603
|
+
display: block;
|
|
1604
|
+
width: 100%;
|
|
1605
|
+
min-height: var(--aia-see-all-height, 48px);
|
|
1606
|
+
padding: 0 16px;
|
|
1607
|
+
border: none;
|
|
1608
|
+
border-radius: var(--aia-see-all-radius, 12px);
|
|
1609
|
+
background: var(--aia-see-all-bg, #2b2b2b);
|
|
1610
|
+
color: var(--aia-see-all-color, #ffffff);
|
|
1611
|
+
font-family: inherit;
|
|
1612
|
+
font-size: var(--aia-see-all-font-size, 16px);
|
|
1613
|
+
font-weight: 700;
|
|
1614
|
+
line-height: 20px;
|
|
1615
|
+
text-align: center;
|
|
1616
|
+
cursor: pointer;
|
|
1617
|
+
transition: background-color 150ms ease-out;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
.aia-seeAll-0Zbgc:hover {
|
|
1621
|
+
background: var(--aia-see-all-bg-hover, #3d3d3d);
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1544
1624
|
/* The open panel's leaving ghost (panelMorph.ts) is a frozen copy of the
|
|
1545
1625
|
last step: the rows' own entrance must not replay in it while it fades. */
|
|
1546
1626
|
.aia-dropdown-yz2KC .magicx-aia-panel-ghost,
|
|
@@ -1607,7 +1687,29 @@
|
|
|
1607
1687
|
animation: aia-multiActionsFadeIn-zbGTG 160ms ease-out;
|
|
1608
1688
|
}
|
|
1609
1689
|
|
|
1690
|
+
/* "See all results" leaves and returns with the options the same way. */
|
|
1691
|
+
.aia-dropdown-yz2KC[data-aia-loading] [data-aia-see-all] {
|
|
1692
|
+
pointer-events: none;
|
|
1693
|
+
animation: aia-seeAllLoadingOut-THnrl 160ms ease-in forwards;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
.aia-dropdown-yz2KC:not([data-aia-loading]) [data-aia-see-all] {
|
|
1697
|
+
animation: aia-seeAllFadeIn-1GWpl 160ms ease-out;
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1610
1700
|
/* Ends and starts a hair above zero: iOS cancels a tap on an element at 0. */
|
|
1701
|
+
@keyframes aia-seeAllLoadingOut-THnrl {
|
|
1702
|
+
to {
|
|
1703
|
+
opacity: 0.01;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
@keyframes aia-seeAllFadeIn-1GWpl {
|
|
1708
|
+
from {
|
|
1709
|
+
opacity: 0.01;
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1611
1713
|
@keyframes aia-multiActionsLoadingOut-lSdMh {
|
|
1612
1714
|
to {
|
|
1613
1715
|
opacity: 0.01;
|
|
@@ -1622,7 +1724,7 @@
|
|
|
1622
1724
|
opacity: 1;
|
|
1623
1725
|
}
|
|
1624
1726
|
}
|
|
1625
|
-
`,document.head.appendChild(e)}var
|
|
1727
|
+
`,document.head.appendChild(e)}var Se={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};var ie=require("@magicx-eng/ai-autocomplete-vanilla"),ja=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
|
|
1626
1728
|
|
|
1627
1729
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1628
1730
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -1819,7 +1921,7 @@
|
|
|
1819
1921
|
opacity: 0.8;
|
|
1820
1922
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1821
1923
|
}
|
|
1822
|
-
`,document.head.appendChild(e)}var
|
|
1924
|
+
`,document.head.appendChild(e)}var Z={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"};var ye=require("react/jsx-runtime"),Ht=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function $a({options:e,activeIndex:t,listboxId:a,view:i,selection:o,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:b,onNextMonth:v}){let k=(0,ie.isoDate)(new Date),g=(0,ie.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,ie.cellIso)(e[t]),selected:o.selectedRange,floor:o.floor});return(0,ye.jsxs)("div",{className:Z.datepicker,"data-aia-datepicker":"",children:[(0,ye.jsxs)("div",{className:Z.header,children:[(0,ye.jsx)("button",{type:"button",tabIndex:-1,className:Z.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:u=>u.preventDefault(),onClick:b,children:"\u2039"}),(0,ye.jsx)("span",{className:Z.month,"data-aia-date-month":"","aria-live":"polite",children:(0,ie.monthLabel)(i)}),(0,ye.jsx)("button",{type:"button",tabIndex:-1,className:Z.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:u=>u.preventDefault(),onClick:v,children:"\u203A"})]}),(0,ye.jsx)("div",{className:Z.weekdays,"aria-hidden":"true",children:ie.WEEKDAY_LABELS.map((u,p)=>(0,ye.jsx)("span",{className:Z.weekday,children:u},Ht[p]))}),(0,ye.jsx)("div",{className:Z.grid,"data-aia-date-grid":"",children:e.map((u,p)=>(0,ye.jsx)(Bt,{option:u,id:`${a}-option-${p}`,index:p,isHighlighted:p===t&&u.is_tappable,isToday:(0,ie.cellIso)(u)===k,isPast:(0,ie.isDimmedDay)((0,ie.cellIso)(u),k,o.floor),marks:(0,ie.dateCellMarks)((0,ie.cellIso)(u),{selectedIso:o.selectedIso,range:g,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:l},(0,ie.cellIso)(u)??`pad-${p}`))})]})}function Bt({option:e,id:t,index:a,isHighlighted:i,isToday:o,isPast:s,marks:r,onSelect:l,onHighlight:b,onUnhighlight:v}){let[k,g]=(0,ja.useState)(!1),u=(0,ie.cellDay)(e);if(u==null)return(0,ye.jsx)("div",{id:t,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${Z.cell} ${Z.blank}`});let p=()=>{g(!0),l(e),setTimeout(()=>g(!1),170)},x=[Z.cell,Z.day,s?Z.past:"",i?Z.highlighted:"",o?Z.today:"",r.inRange?Z.inRange:"",r.selected?Z.selected:"",r.reference?Z.reference:"",k?Z.pressed:""].filter(Boolean).join(" ");return(0,ye.jsx)("div",{id:t,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:x,onClick:p,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),p())},onMouseEnter:()=>b(a),onMouseLeave:v?()=>v(a):void 0,children:(0,ye.jsx)("span",{className:Z.number,children:u})})}var aa=require("@magicx-eng/ai-autocomplete-vanilla"),Sa=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
|
|
1823
1925
|
display: flex;
|
|
1824
1926
|
flex-wrap: wrap;
|
|
1825
1927
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -1859,7 +1961,7 @@
|
|
|
1859
1961
|
.aia-cluster[data-justify="around"] {
|
|
1860
1962
|
justify-content: space-around;
|
|
1861
1963
|
}
|
|
1862
|
-
`,document.head.appendChild(e)}var
|
|
1964
|
+
`,document.head.appendChild(e)}var Da=require("react/jsx-runtime");function va({gap:e,align:t="center",justify:a="start",noWrap:i=!1,inline:o=!1,className:s,children:r,...l}){let b=e?{"--aia-cluster-gap":e}:void 0,v={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":t,"data-justify":a,"data-nowrap":i||void 0,"data-inline":o||void 0,style:b,...l};return o?(0,Da.jsx)("span",{...v,children:r}):(0,Da.jsx)("div",{...v,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
|
|
1863
1965
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
1864
1966
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
1865
1967
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -2006,7 +2108,7 @@
|
|
|
2006
2108
|
justify-content: flex-end;
|
|
2007
2109
|
}
|
|
2008
2110
|
}
|
|
2009
|
-
`,document.head.appendChild(e)}var
|
|
2111
|
+
`,document.head.appendChild(e)}var Ye={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};var Fe=require("react/jsx-runtime");function Za({isOptionHighlighted:e=!1,isInputEmpty:t=!1,strings:a=(0,aa.uiStringsFor)()}){let{key:i,hint:o}=(0,aa.getFooterHint)(e,t,a),[s,r]=(0,Sa.useState)(aa.ATTRIBUTION_URL);return(0,Sa.useEffect)(()=>{r((0,aa.buildAttributionUrl)())},[]),(0,Fe.jsx)("footer",{className:Ye.footer,"data-aia-footer":"",children:(0,Fe.jsxs)(va,{justify:"between",noWrap:!0,className:Ye.row,children:[(0,Fe.jsxs)(va,{gap:"5px",className:Ye.hintGroup,children:[(0,Fe.jsx)("kbd",{className:Ye.key,children:i}),(0,Fe.jsx)("span",{className:Ye.hint,children:o})]}),(0,Fe.jsxs)("a",{className:Ye.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[(0,Fe.jsx)("span",{className:Ye.brand,children:"AI"}),(0,Fe.jsx)("span",{className:Ye.badge,children:"Autocomplete"})]})]})})}var le=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-2feec02e")){let e=document.createElement("style");e.id="ac-style-2feec02e",e.textContent=`/* Location search \u2014 React copy of the vanilla rules in styles.css (and of the
|
|
2010
2112
|
Angular copy). The three are kept identical by
|
|
2011
2113
|
packages/vanilla/tests/render/locationFieldParity.test.ts. */
|
|
2012
2114
|
.aia-location-6-fsr {
|
|
@@ -2140,7 +2242,7 @@
|
|
|
2140
2242
|
.aia-loadingBar-OLCr4:nth-child(3) {
|
|
2141
2243
|
width: 60%;
|
|
2142
2244
|
}
|
|
2143
|
-
`,document.head.appendChild(e)}var oe={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};var
|
|
2245
|
+
`,document.head.appendChild(e)}var oe={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};var K=require("react/jsx-runtime"),Wt=0;function xa(e){return e.getRootNode().activeElement??null}function et(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Xa(e){if(!e.isContentEditable)return null;let t=et(e);if(!t||t.rangeCount===0)return null;let a=t.getRangeAt(0);return e.contains(a.startContainer)?a.cloneRange():null}function Ja(e,t){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let a=et(e);if(!a)return;let i=t;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),a.removeAllRanges(),a.addRange(i)}var Gt=(0,K.jsxs)("svg",{className:oe.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,K.jsx)("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),(0,K.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),Kt=(0,K.jsxs)("svg",{className:oe.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,K.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,K.jsx)("path",{d:"m20 20-3.5-3.5"})]});function at({view:e,searchLabel:t,noResultsLabel:a,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:b,onMove:v,onCommit:k,onFocusChange:g}){let u=(0,le.useRef)(null),p=(0,le.useRef)(null),x=(0,le.useRef)(null),A=(0,le.useRef)(null),ee=(0,le.useRef)(null),H=(0,le.useRef)(!1),M=(0,le.useRef)(!1),ue=(0,le.useRef)(!1),P=(0,le.useRef)(!1),F=(0,le.useRef)(o);F.current=o;let ae=(0,le.useRef)(g);ae.current=g;let q=c=>{P.current=c,g(c)},re=()=>{let c=u.current;return c!=null&&xa(c)===c},R=()=>{let c=p.current;if(!c)return;let T=xa(c);T instanceof HTMLElement&&T!==u.current&&T!==document.body&&!c.contains(T)&&(A.current=T,ee.current=Xa(T))},pe=c=>{let T=p.current;!T||!(c instanceof HTMLElement)||c===A.current||c===document.body||T.contains(c)||(A.current=c,ee.current=Xa(c))},$=(0,le.useRef)(null);$.current===null&&($.current=`aia-location-${++Wt}`);let U=`${$.current}-row-`;(0,le.useEffect)(()=>{let c=u.current;c&&c.value!==e.query&&xa(c)!==c&&(c.value=e.query)},[e.query]),(0,le.useEffect)(()=>{o&&(s&&!ue.current&&(M.current=!1),ue.current=s);let c=u.current;if(c){if(!r&&re()){M.current=!0,se();return}if(!o){setTimeout(()=>{if(F.current)return;let T=A.current;T&&xa(T)===T||(M.current=!1)},0);return}if(!(!s||M.current||!l||re())){if(R(),q(!0),c.focus({preventScroll:!0}),!re()){M.current=!0,q(!1);return}c.value&&c.select()}}}),(0,le.useLayoutEffect)(()=>()=>{if(!P.current)return;let c=u.current,T=A.current;T?.isConnected&&c&&xa(c)===c&&(H.current=!0,Ja(T,ee.current),H.current=!1),P.current=!1,ae.current(!1)},[]);let se=(c=!1)=>{c&&(M.current=!0);let T=A.current;T?.isConnected&&re()&&(H.current=!0,Ja(T,ee.current),H.current=!1),q(!1)},Ce=e.query.trim(),S=e.highlighted>=0&&e.highlighted<e.places.length?`${U}${e.highlighted}`:void 0,Q=null;return e.places.length>0?Q=e.places.map((c,T)=>(0,K.jsxs)("div",{id:`${U}${T}`,role:"option","aria-selected":T===e.highlighted,className:T===e.highlighted?`${oe.row} ${oe.highlighted}`:oe.row,"data-aia-location-row":"","data-aia-index":T,onClick:()=>{l&&(se(!0),k(T))},children:[(0,K.jsx)("span",{className:oe.pin,children:Gt}),(0,K.jsxs)("span",{className:oe.text,children:[(0,K.jsx)("span",{className:oe.name,children:c.name}),c.secondary&&(0,K.jsx)("span",{className:oe.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?Q=(0,K.jsxs)("div",{className:oe.loading,"data-aia-location-loading":"",children:[(0,K.jsx)("span",{className:oe.loadingBar}),(0,K.jsx)("span",{className:oe.loadingBar}),(0,K.jsx)("span",{className:oe.loadingBar})]}):Ce&&(Q=(0,K.jsxs)("div",{className:oe.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,K.jsx)("span",{className:oe.empty,children:a}),(0,K.jsx)("span",{children:i})]})),(0,K.jsxs)("div",{ref:p,className:oe.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!x.current?.contains(c.target)||(c.stopPropagation(),R(),q(!0))},children:[(0,K.jsxs)("label",{ref:x,className:oe.field,children:[Kt,(0,K.jsx)("input",{ref:u,type:"text",className:oe.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:t,"aria-label":t,"aria-activedescendant":S,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>b(c.target.value),onFocus:c=>{pe(c.relatedTarget),q(!0)},onBlur:()=>{H.current||(M.current=!0,q(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),v(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!l)return;se(!0),k();return;case"Escape":c.preventDefault(),c.stopPropagation(),M.current=!0,se();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),M.current=!0,se();return}}})]}),(0,K.jsx)("div",{className:oe.results,"data-aia-location-results":"","aria-live":"polite",children:Q})]})}var Ta=require("@magicx-eng/ai-autocomplete-vanilla");var tt=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
|
|
2144
2246
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
2145
2247
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
2146
2248
|
as it was when the outline was dashed. */
|
|
@@ -2298,7 +2400,7 @@
|
|
|
2298
2400
|
opacity: 0;
|
|
2299
2401
|
}
|
|
2300
2402
|
}
|
|
2301
|
-
`,document.head.appendChild(e)}var He={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};var
|
|
2403
|
+
`,document.head.appendChild(e)}var He={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};var ta=require("react/jsx-runtime"),Ma={selected:1,first:.7,next:.4,last:.2};function it({label:e,state:t,active:a,rounded:i,loading:o,smartSuggestion:s,completionHeader:r,onClick:l}){let b=[He.pill,i?He.rounded:"",o?He.skeleton:""].filter(Boolean).join(" ");return(0,ta.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":a?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:b,style:{"--aia-pill-opacity":Ma[t]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:l,disabled:o,children:s?(0,ta.jsxs)(ta.Fragment,{children:[(0,ta.jsx)("span",{className:`${He.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,ta.jsx)("span",{className:`${He.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:tt.SMART_SUGGESTION_SPARKLE_SVG}})]}):e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
|
|
2302
2404
|
position: relative;
|
|
2303
2405
|
z-index: 1;
|
|
2304
2406
|
pointer-events: auto;
|
|
@@ -2308,7 +2410,7 @@
|
|
|
2308
2410
|
align-items: center;
|
|
2309
2411
|
vertical-align: middle;
|
|
2310
2412
|
}
|
|
2311
|
-
`,document.head.appendChild(e)}var
|
|
2413
|
+
`,document.head.appendChild(e)}var Na={list:"aia-list-qvLqO"};var ya=require("react/jsx-runtime"),qt=[125,69];function ot(e){return e===0?"first":e===1?"next":"last"}function Pa({pills:e,activePillIndex:t,onSelectPill:a,activeSelected:i,rounded:o,loading:s}){return s&&e.length===0?(0,ya.jsx)("span",{className:Na.list,"data-aia-pill-list-loading":"",children:qt.map((r,l)=>(0,ya.jsx)("span",{"data-aia-pill-skeleton":"",className:`${He.pill} ${o?He.rounded:""} ${He.skeleton}`,style:{width:r,"--aia-pill-opacity":Ma[ot(l)]}},`skel-${r}`))}):(0,ya.jsx)("span",{className:Na.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,l)=>{let b=!!i&&l===t;return(0,ya.jsx)(it,{label:r.text,state:b?"selected":ot(l),selected:b,active:l===t,rounded:o,loading:s,smartSuggestion:(0,Ta.isSmartSuggestion)(r),completionHeader:(0,Ta.isTraditionalAutocompleteSuggestion)(r),onClick:()=>a(l)},`${r.parameter}-${r.text}`)})})}var Te=require("@magicx-eng/ai-autocomplete-vanilla"),ke=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
|
|
2312
2414
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
2313
2415
|
theming one package sees the same result in the other.
|
|
2314
2416
|
|
|
@@ -2901,7 +3003,7 @@
|
|
|
2901
3003
|
opacity: 0.01;
|
|
2902
3004
|
}
|
|
2903
3005
|
}
|
|
2904
|
-
`,document.head.appendChild(e)}var ne={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"};var
|
|
3006
|
+
`,document.head.appendChild(e)}var ne={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"};var G=require("react/jsx-runtime");function nt({products:e,listboxId:t,onSelect:a,onAddToCart:i,onFocusChange:o,focusable:s=!0,loading:r=!1,layout:l="row",imageFallback:b="image",strings:v=(0,Te.uiStringsFor)()}){let k=e.length>0,g=(0,ke.useRef)(null);if((0,ke.useEffect)(()=>{let p=g.current;if(!(!k||!p))return(0,Te.attachProductRowWheel)(p)},[k]),!k)return null;let u=`${t}-products-label`;return(0,G.jsxs)("section",{className:ne.section,"data-aia-products":"","data-aia-loading":r?"":void 0,"data-aia-products-layout":l,role:"group","aria-labelledby":u,children:[(0,G.jsx)("div",{className:ne.label,id:u,"data-aia-products-label":"",children:v.products}),(0,G.jsx)("div",{ref:g,className:ne.row,"data-aia-products-row":"",children:e.map((p,x)=>(0,G.jsx)(_t,{product:p,id:`${t}-product-${x}`,onSelect:a,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:b,soldOut:v.soldOut,addToCart:v.addToCart},p.id))})]})}function _t({product:e,id:t,onSelect:a,onAddToCart:i,onFocusChange:o,focusable:s,imageFallback:r,soldOut:l,addToCart:b}){let v=!!i&&e.available!==!1,[k,g]=(0,ke.useState)(null),u=x=>{x.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},p=x=>{x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||x.button!==0||(x.preventDefault(),a(e))};return(0,G.jsxs)("a",{id:t,className:ne.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":v?"":void 0,role:"option","aria-selected":!1,style:k?{"--aia-product-photo-fill-x":String(k.x),"--aia-product-photo-fill-y":String(k.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:p,onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),a(e))},onFocus:()=>o?.(!0),onBlur:u,children:[(0,G.jsx)(Qt,{sources:(0,Te.productImageSources)(e.imageUrl),title:e.title,fallback:r,onPhotoFill:g},(0,Te.productImageSrc)(e.imageUrl)??""),(0,G.jsxs)("span",{className:ne.body,children:[e.vendor?(0,G.jsx)("span",{className:ne.vendor,children:e.vendor}):null,(0,G.jsx)("span",{className:ne.title,children:e.title}),e.price?(0,G.jsxs)("span",{className:ne.price,children:[e.price,e.compareAtPrice?(0,G.jsx)("s",{className:ne.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,G.jsx)("span",{className:ne.badge,children:l}):null]}),v&&i?(0,G.jsx)(Ut,{product:e,label:`${b}: ${e.title}`,focusable:s,onAddToCart:i,onFocus:()=>o?.(!0),onBlur:u},Vt(e)):null]})}function Vt(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(t=>t??"").join("\0")}function Ut({product:e,label:t,focusable:a,onAddToCart:i,onFocus:o,onBlur:s}){let[r,l]=(0,ke.useState)(null),b=(0,ke.useRef)(null),v=(0,ke.useRef)(e);v.current=e;let k=(0,ke.useRef)(!0);(0,ke.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let g=p=>{b.current=p,k.current&&l(p)},u=p=>{if(p.preventDefault(),p.stopPropagation(),b.current==="adding")return;g("adding");let x;try{x=Promise.resolve(i(v.current))}catch(A){x=Promise.reject(A)}x.then(()=>g("added"),()=>g(null))};return(0,G.jsx)("span",{className:ne.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":t,tabIndex:a?0:-1,onClick:u,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||u(p)},onFocus:p=>{p.stopPropagation(),o()},onBlur:p=>{p.stopPropagation(),s(p)},children:(0,G.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,G.jsx)("path",{className:ne.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),(0,G.jsx)("path",{className:ne.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,G.jsx)("path",{className:ne.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,G.jsx)("path",{className:ne.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,G.jsx)("circle",{className:ne.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,G.jsx)("circle",{className:ne.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Qt({sources:e,title:t,fallback:a,onPhotoFill:i}){let[o,s]=(0,ke.useState)(0),r=e[o],l=!!r,[b,v]=(0,ke.useState)(null),k=!l&&a==="initial";return(0,ke.useEffect)(()=>()=>i(null),[i]),(0,G.jsxs)("span",{className:ne.media,"aria-hidden":"true","data-aia-product-placeholder":!l&&!k?"":void 0,"data-aia-product-initial":k?"":void 0,"data-aia-image-loaded":l&&b===r?"":void 0,children:[l?(0,G.jsx)("img",{className:ne.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:g=>{v(r),i((0,Te.productPhotoFill)(g.currentTarget.naturalWidth,g.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&i(null),s(g=>g+1)}}):null,k?(0,Te.productInitial)(t):null]})}var X=require("@magicx-eng/ai-autocomplete-vanilla"),Re=require("react");var rt=require("@magicx-eng/ai-autocomplete-vanilla"),Ia=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
|
|
2905
3007
|
display: grid;
|
|
2906
3008
|
grid-template-columns: repeat(
|
|
2907
3009
|
auto-fit,
|
|
@@ -2945,7 +3047,7 @@
|
|
|
2945
3047
|
:where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
|
|
2946
3048
|
max-height: var(--aia-grid-max-height, 120px);
|
|
2947
3049
|
}
|
|
2948
|
-
`,document.head.appendChild(e)}var
|
|
3050
|
+
`,document.head.appendChild(e)}var lt=require("react/jsx-runtime");function st({min:e="16rem",max:t,gap:a,scroll:i=!1,maxHeight:o,scrollResetKey:s,cols:r,template:l,innerRef:b,className:v,children:k,...g}){let u=(0,Ia.useRef)(null);(0,Ia.useLayoutEffect)(()=>{if(s===void 0)return;let x=u.current;x&&(x.scrollTop=0)},[s]);let p={"--aia-grid-min":e};return t&&(p["--aia-grid-max"]=t),a&&(p["--aia-grid-gap"]=a),o&&(p["--aia-grid-max-height"]=o),r&&(p.gridTemplateColumns=(0,rt.optionsGridTemplateColumns)(r)),l&&(p.gridTemplateColumns=l),(0,lt.jsx)("div",{ref:x=>{u.current=x,b?.(x)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:p,...g,children:k})}var ge=require("@magicx-eng/ai-autocomplete-vanilla"),Pe=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
|
|
2949
3051
|
position: relative;
|
|
2950
3052
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
2951
3053
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -3465,7 +3567,7 @@
|
|
|
3465
3567
|
border-radius: 6px;
|
|
3466
3568
|
font-size: 11px;
|
|
3467
3569
|
}
|
|
3468
|
-
`,document.head.appendChild(e)}var
|
|
3570
|
+
`,document.head.appendChild(e)}var de={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg"};var ce=require("react/jsx-runtime");function dt({option:e,isHighlighted:t,checked:a,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:l,showIcon:b=!0,showImage:v=!0,showCount:k=!0,scrollHint:g,enterDelayMs:u=0}){let[p]=(0,Pe.useState)(u),[x,A]=(0,Pe.useState)(!1),ee=v?(0,ge.optionImageSources)(e.image_url):[],H=ee[0]??null,[M,ue]=(0,Pe.useState)([]),P=ee.find(S=>!M.includes(S))??null,F=v?(e.imageCollage??[]).map(S=>(0,ge.optionImageSources)(S)[0]).filter(S=>S!==void 0):[],[ae,q]=(0,Pe.useState)(!1),[re,R]=(0,Pe.useState)(null),pe=(0,Pe.useMemo)(()=>!H&&b&&e.icon_svg?(0,ge.sanitizeOptionIconSvg)(e.icon_svg):null,[H,b,e.icon_svg]),$=k?(0,ge.formatOptionCount)(e.item_count):null,U=(0,Pe.useRef)(void 0);(0,Pe.useEffect)(()=>()=>clearTimeout(U.current),[]);let se=S=>{if(l||!e.is_tappable||x&&a===void 0)return;A(!0);let Q=S?.currentTarget;a!==void 0&&Q!==void 0&&S!==void 0&&!(0,ge.isMultiSelectToggleTap)(Q,Q.querySelector("[data-aia-checkbox]"),S)?i(e,{commit:!0}):i(e),clearTimeout(U.current),U.current=setTimeout(()=>A(!1),170)},Ce=[de.item,t&&!l?de.highlighted:"",e.liveMatch&&!l?de.liveMatch:"",e.is_tappable?de.tappable:de.nonTappable,x?de.pressed:"",g?de.scrollHint:""].filter(Boolean).join(" ");return(0,ce.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":pe&&e.icon?e.icon:void 0,"data-aia-image":H?"":void 0,"data-aia-item-count":$!==null?e.item_count:void 0,"aria-selected":a??t,className:Ce,style:{[ge.OPTION_ENTER_DELAY_VAR]:`${p}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:se,onKeyDown:S=>{!l&&e.is_tappable&&(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),se())},onMouseEnter:!l&&e.is_tappable?o:void 0,onMouseLeave:s,children:(0,ce.jsxs)("span",{className:de.content,children:[a!==void 0&&e.is_tappable&&(0,ce.jsx)("span",{className:de.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":a,children:a?"\u2713":""}),H&&F.length>1&&(0,ce.jsx)("span",{className:`${de.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":F.length,"data-aia-image-loaded":ae?"":void 0,children:F.map(S=>(0,ce.jsx)("img",{src:S,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>q(!0),onError:Q=>{Q.currentTarget.hidden=!0}},S))}),H&&F.length<=1&&(0,ce.jsx)("span",{className:`${de.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":P!==null&&re===P?"":void 0,children:(0,ce.jsx)("img",{src:P??H,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:P===null,onLoad:()=>R(P),onError:()=>{P!==null&&ue(S=>[...S,P])}})}),pe&&(0,ce.jsx)("span",{className:`${de.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:pe}}),(0,ce.jsxs)("span",{className:de.text,children:[e.matchedText?(0,ge.highlightParts)((0,ge.optionLabel)(e),e.matchedText).map((S,Q)=>S.bold?(0,ce.jsx)("strong",{className:`${de.match} magicx-aia-option-match`,children:S.text},Q):S.text):(0,ge.optionLabel)(e),e.parameterLabel&&(0,ce.jsxs)(ce.Fragment,{children:[" ",(0,ce.jsx)("span",{className:`${de.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,ce.jsx)("span",{className:de.tag,children:e.tag}),$!==null&&(0,ce.jsx)("span",{className:`${de.count} magicx-aia-option-count`,children:$})]})})}var Fa=require("react/jsx-runtime");function Yt(){let[e,t]=(0,Re.useState)(X.isOptionsGridMobileViewport);return(0,Re.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(X.OPTIONS_GRID_MOBILE_QUERY),i=()=>t(a.matches);return i(),a.addEventListener("change",i),()=>a.removeEventListener("change",i)},[]),e}function ct({options:e,activeIndex:t,picked:a,onSelect:i,onHighlight:o,onUnhighlight:s,listboxId:r,loading:l,groupKey:b="",optionsPosition:v="below",showIcons:k=!0,showImages:g=!0,showCounts:u=!0}){let p=Yt(),x=(0,Re.useRef)(null),[A,ee]=(0,Re.useState)(null),H=(0,Re.useRef)(null);(0,Re.useLayoutEffect)(()=>{if(l&&(0,X.sameOptionRows)(H.current,e))return;H.current=l?null:e;let P=x.current,F=P&&!l&&(0,X.needsOptionsGridMeasurement)(e.length,p),ae=P?.closest("[data-aia-dropdown]");F&&ae&&(0,X.releasePanelHug)(ae);let q=F?(0,X.measureOptionsGrid)(P):null;ee(q?(0,X.planOptionsGrid)(e.length,p,q.rowWidths,q.gridWidth):null)},[e,p,l]);let M=A??(0,X.planOptionsGrid)(e.length,p,null,null);(0,Re.useLayoutEffect)(()=>{let P=x.current?.closest("[data-aia-dropdown]");P&&(0,X.syncPanelHug)(P)},[M.template,p]);let ue=(0,X.optionsShowLeadingVisuals)(e,k,g);return(0,Fa.jsx)(st,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:b,template:M.template,maxHeight:M.maxHeight,innerRef:P=>{x.current=P},"data-aia-group":b,children:e.map((P,F)=>(0,Fa.jsx)(dt,{option:P,isHighlighted:F===t,checked:a?a.includes(P.text):void 0,onSelect:i,onHighlight:()=>o(F),onUnhighlight:s?()=>s(F):void 0,id:`${r}-option-${F}`,loading:l,showIcon:k&&ue,showImage:g&&ue,showCount:u,scrollHint:!l&&M.scrollHintIndices.includes(F),enterDelayMs:l?0:(0,X.optionEnterDelayMs)(F,M.cols,e.length,v)},`${b}\0${P.parameter??""}\0${P.text}`))})}var fe=require("@magicx-eng/ai-autocomplete-vanilla"),Le=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-52a922cb")){let e=document.createElement("style");e.id="ac-style-52a922cb",e.textContent=`/* --- Time wheel (replaces the options grid for time suggestions) ---
|
|
3469
3571
|
|
|
3470
3572
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
3471
3573
|
time-wheel.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -3587,7 +3689,7 @@
|
|
|
3587
3689
|
.aia-done-llNY5:hover {
|
|
3588
3690
|
background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
|
|
3589
3691
|
}
|
|
3590
|
-
`,document.head.appendChild(e)}var Oe={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};var
|
|
3692
|
+
`,document.head.appendChild(e)}var Oe={timeWheel:"aia-timeWheel-KdR4A",value:"aia-value--wqvm",columns:"aia-columns-TaD-f",band:"aia-band-pVy-f",column:"aia-column-lwtdd",row:"aia-row-A3pAx",selected:"aia-selected-xgOWY",separator:"aia-separator-kX9WO",done:"aia-done-llNY5"};var Ie=require("react/jsx-runtime"),jt=120;function pt({view:e,label:t,doneLabel:a,interactive:i=!0,onTimeChange:o,onTimeCommit:s}){return(0,Ie.jsxs)("div",{className:Oe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":t,onMouseDown:r=>r.preventDefault(),children:[(0,Ie.jsx)("span",{className:Oe.value,"data-aia-time-value":"","aria-live":"polite",children:(0,fe.formatTime)(e.minutes)}),(0,Ie.jsxs)("div",{className:Oe.columns,"aria-hidden":"true",children:[(0,Ie.jsx)("div",{className:Oe.band}),fe.TIME_WHEEL_COLUMNS.map(r=>(0,Ie.jsxs)(Le.Fragment,{children:[r==="minute"&&(0,Ie.jsx)("span",{className:Oe.separator,children:":"}),(0,Ie.jsx)($t,{column:r,minutes:e.minutes,interactive:i,onTimeChange:o})]},r))]}),(0,Ie.jsx)("button",{type:"button",tabIndex:-1,className:Oe.done,"data-aia-time-done":"",onClick:()=>{i&&s()},children:a})]})}function $t({column:e,minutes:t,interactive:a,onTimeChange:i}){let o=(0,Le.useRef)(null),s=(0,Le.useRef)(null),r=(0,Le.useRef)(null),l=(0,Le.useRef)({minutes:t,interactive:a,onTimeChange:i});l.current={minutes:t,interactive:a,onTimeChange:i};let b=(0,fe.timeWheelIndex)(e,t);(0,Le.useLayoutEffect)(()=>{let g=o.current;if(!g||r.current)return;let u=b*fe.TIME_WHEEL_ROW_HEIGHT;Math.abs(g.scrollTop-u)<1||(s.current=u,g.scrollTop=u)},[b]),(0,Le.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let g=o.current,u=l.current;if(!g||!u.interactive)return;let p=(0,fe.timeWheelIndexFromScroll)(e,g.scrollTop);p!==(0,fe.timeWheelIndex)(e,u.minutes)&&u.onTimeChange((0,fe.withTimeWheelIndex)(e,u.minutes,p))},k=()=>{let g=o.current;if(g){if(s.current!=null&&Math.abs(g.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,jt)}};return(0,Ie.jsx)("div",{ref:o,className:Oe.column,"data-aia-time-column":e,onScroll:k,children:(0,fe.timeWheelRows)(e).map((g,u)=>(0,Ie.jsx)("div",{className:u===b?`${Oe.row} ${Oe.selected}`:Oe.row,"data-aia-time-row":"","data-aia-index":u,onClick:()=>{l.current.interactive&&i((0,fe.withTimeWheelIndex)(e,l.current.minutes,u))},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 {
|
|
3591
3693
|
display: flex;
|
|
3592
3694
|
flex-direction: column;
|
|
3593
3695
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -3602,7 +3704,7 @@
|
|
|
3602
3704
|
align-items: end;
|
|
3603
3705
|
}
|
|
3604
3706
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
3605
|
-
`,document.head.appendChild(e)}var
|
|
3707
|
+
`,document.head.appendChild(e)}var ut=require("react/jsx-runtime");function ht({space:e,align:t="stretch",className:a,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return(0,ut.jsx)("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":t,style:s,...o,children:i})}var _=require("react/jsx-runtime"),Zt=typeof window>"u"?J.useEffect:J.useLayoutEffect,Xt=[159,119,164],Jt=()=>{},mt=()=>{},ei=e=>{},ai=()=>{},ti=e=>{},ii=e=>{},oi=e=>{},ni=e=>{};function ri(e){let t=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,i]=(0,J.useState)(t);if((0,J.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>i(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function si(e,t){let a=(0,J.useRef)(null);(0,J.useEffect)(()=>{let i=e.current,o=t.current;if(!i||!o)return;let s=(0,z.queryLive)(i,".aia-grid[data-scroll]");if(a.current&&a.current.grid!==s&&(a.current.controller.destroy(),a.current=null),s&&!a.current){a.current={grid:s,controller:(0,z.attachScrollArrow)({dropdown:i,grid:s,button:o})};return}a.current?.controller.update()}),(0,J.useEffect)(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function li(e,t){let a=(0,J.useRef)(t);a.current=t;let i=(0,J.useRef)(null);(0,J.useLayoutEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,z.attachViewportFit)({dropdown:o,isOpen:()=>a.current});return}i.current.update()}}),(0,J.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function Ea({suggestions:e,activeIndex:t,onSelect:a,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:l,pills:b,onPillClick:v,showPills:k=!0,onSkip:g,showSkipButton:u=!0,showOptionIcons:p=!0,showOptionImages:x=!0,showOptionCounts:A=!0,skipDisabled:ee=!1,activeSelected:H=!1,isLoading:M=!1,skeletonExiting:ue=!1,isInputEmpty:P=!1,language:F,products:ae,onProductSelect:q,onProductAddToCart:re,onProductFocusChange:R,productsLayout:pe="row",productImageFallback:$="image",formatType:U="options",dateView:se=null,selectedDateIso:Ce=null,selectedDateRange:S=null,dateRangeStart:Q=null,dateReferences:c,onPreviousMonth:T,onNextMonth:ia,timeView:Ge=null,multiSelectView:f=null,onMultiSelectCommit:oa,onSeeAllResults:Ke,onTimeChange:je,onTimeCommit:$e,locationView:qe=null,isReediting:m=!1,onLocationQuery:C,onLocationMove:I,onLocationCommit:O,onLocationFocusChange:N,isFocused:he=!1,optionsPosition:we="below",mode:Ee}){let _e=ri(Ee),Ze=_e!==void 0,be=(0,J.useRef)(null),Ae=(0,J.useRef)(null);si(be,Ae),(0,J.useEffect)(()=>{if(be.current)return(0,z.containScroll)(be.current)},[]);let Xe=e[0]?.options??[],na=!!(b&&b.length>0&&v),ga=!!(ae&&ae.length>0),De=U==="time"&&Ge!=null,pa=U==="location"&&qe!=null,me=s&&(Xe.length>0||k&&na||M||ga||De||pa);li(be,me),Zt(()=>{let L=be.current;L&&((0,z.fitMultiSelectDone)(L,(0,z.findMultiSelectDone)(L)),(0,z.syncPanelHug)(L))});let y={suggestions:e,activeIndex:t,pills:b,showPills:k,showSkipButton:u,showOptionIcons:p,showOptionImages:x,showOptionCounts:A,skipDisabled:ee,activeSelected:H,isLoading:M,skeletonExiting:ue,isInputEmpty:P,products:ae,formatType:U,dateView:se,selectedDateIso:Ce,selectedDateRange:S,dateRangeStart:Q,dateReferences:c,timeView:Ge,multiSelectView:f,locationView:qe,isReediting:m,showsSeeAll:!!Ke},Je=(0,J.useRef)(y);me&&(Je.current=y);let n=me?y:Je.current,te=(0,z.uiStringsFor)(F),w=n.suggestions[0],Me=w?.options??[],fa=n.activeIndex>=0&&!!Me[n.activeIndex]?.is_tappable,ve=(0,z.labelTraditionalAutocomplete)(n.pills??[],te.keepTyping),ra=!!(ve.length>0&&v),sa=n.showPills&&ra,Ve=n.showPills&&!ra&&n.isLoading,ha=sa||Ve,Ue=ra&&(0,z.hasSkippablePill)(ve)&&n.showSkipButton&&!n.isInputEmpty&&!!g,Ne=ve[0]?.text,ea=(0,z.isCalendarFormat)(n.formatType)&&n.dateView!=null,la=Me.length>0&&!ea,ua=Me.length>0&&ea&&!n.isLoading,Qe=n.formatType==="time"&&n.timeView!=null&&!n.isLoading,da=n.formatType==="location"&&n.locationView!=null&&!n.isLoading,h=n.isLoading&&!la&&!ua&&!Qe&&!da,Y=n.products??[],B=(0,z.panelMorphKey)(sa?ve:[]);return(0,J.useLayoutEffect)(()=>{be.current&&(0,z.settlePanelMorph)(be.current,B,{visible:me,anchorBottom:we==="above"})},[B,me,we,n.suggestions,n.pills,n.isLoading,n.skeletonExiting,n.isInputEmpty,n.products,n.formatType,n.dateView,n.selectedDateIso,n.selectedDateRange,n.dateRangeStart,n.dateReferences,n.timeView,n.multiSelectView,n.locationView,n.showPills,n.showSkipButton,n.showOptionIcons,n.showOptionImages,n.showOptionCounts,n.showsSeeAll,pe,F]),(0,J.useEffect)(()=>{let L=be.current;return()=>{L&&(0,z.destroyPanelMorph)(L)}},[]),(0,_.jsxs)("div",{ref:be,id:r,role:"listbox","aria-multiselectable":!!n.multiSelectView,"data-aia-dropdown":"","data-options-position":we,"data-mode":_e,"data-aia-loading":n.isLoading?"":void 0,"data-aia-skeleton-exiting":n.skeletonExiting?"":void 0,"data-aia-has-products":Y.length>0?"":void 0,className:`${Ze?"magicx-aia ":""}${Se.dropdown} ${me?Se.visible:""} ${l??""}`,onMouseDown:L=>L.preventDefault(),children:[(0,_.jsxs)(ht,{space:"8px",children:[(ha||Ue)&&(0,_.jsxs)(va,{noWrap:!0,className:Se.pillBar,"data-aia-pillbar":"",children:[ha&&(0,_.jsx)("span",{className:Se.pillScroll,"data-aia-pill-scroll":"",children:(0,_.jsx)(Pa,{pills:ve,activePillIndex:0,activeSelected:n.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:n.isLoading})}),Ue&&(0,_.jsx)("button",{type:"button",tabIndex:-1,className:Se.skip,"data-aia-skip":"",disabled:n.isLoading||n.skipDisabled,"aria-label":Ne?`${te.skipLabel} ${Ne}`:te.skipLabel,onClick:g,children:te.skip})]}),la&&(0,_.jsx)(ct,{options:Me,activeIndex:n.activeIndex,onSelect:a,onHighlight:i,onUnhighlight:o,listboxId:r,loading:n.isLoading,groupKey:w?`${w.parameter} ${w.text}`:"",optionsPosition:we,showIcons:n.showOptionIcons,showImages:n.showOptionImages,showCounts:n.showOptionCounts,picked:n.multiSelectView?.picked}),n.multiSelectView&&(0,_.jsx)("div",{"data-aia-multi-actions":"",onClick:L=>{L.target.closest("[data-aia-multi-done]")&&!n.skipDisabled&&!n.isLoading&&oa?.()},children:(0,_.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Se.multiDone,ref:L=>{L&&(L.disabled=!0,L.offsetHeight,L.disabled=n.skipDisabled||n.isLoading)},children:te.done})}),ua&&n.dateView&&(0,_.jsx)($a,{options:Me,activeIndex:n.activeIndex,listboxId:r,view:n.dateView,selection:{selectedIso:n.selectedDateIso??null,selectedRange:n.selectedDateRange??null,rangeStart:n.dateRangeStart??null,floor:(0,z.dateFloorFor)(n.formatType,n.dateRangeStart),references:n.dateReferences??[]},onSelect:a,onHighlight:i,onUnhighlight:o,onPreviousMonth:T??mt,onNextMonth:ia??mt}),Qe&&n.timeView&&(0,_.jsx)(pt,{view:n.timeView,label:te.timeLabel,doneLabel:te.done,interactive:!n.skipDisabled,onTimeChange:je??ei,onTimeCommit:$e??ai}),da&&n.locationView&&(0,_.jsx)(at,{view:n.locationView,searchLabel:te.locationSearch,noResultsLabel:te.locationNoResults,useTypedLabel:te.locationUseTyped,widgetFocused:he&&me,reediting:n.isReediting,visible:me,interactive:!n.skipDisabled,onQuery:C??ti,onMove:I??ii,onCommit:O??oi,onFocusChange:N??ni}),h&&(0,_.jsx)("div",{className:Se.skeletonBars,"data-aia-skeleton-bars":"",children:Xt.map(L=>(0,_.jsx)("span",{className:Se.skeletonBar,style:{width:L}},`bar-${L}`))}),(0,_.jsx)(nt,{products:Y,listboxId:r,onSelect:q??Jt,onAddToCart:re,onFocusChange:R,focusable:me&&!n.isLoading,loading:n.isLoading,layout:pe,imageFallback:$,strings:te}),n.showsSeeAll&&(0,_.jsx)("div",{className:Se.seeAllRow,"data-aia-see-all":"",onClick:L=>{L.target.closest("[data-aia-see-all-button]")&&(L.stopPropagation(),!n.isLoading&&Ke?.())},children:(0,_.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"",className:Se.seeAll,ref:L=>{L&&(L.disabled=!0,L.offsetHeight,L.disabled=n.isLoading)},children:te.seeAllResults})}),(0,_.jsx)(Za,{isOptionHighlighted:fa,isInputEmpty:n.isInputEmpty,strings:te})]}),(0,_.jsx)("button",{ref:Ae,type:"button",tabIndex:-1,className:Se.scrollArrow,"data-aia-scroll-arrow":"","aria-label":te.scrollArrow,"aria-hidden":"true",children:(0,_.jsx)("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,_.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var We=require("@magicx-eng/ai-autocomplete-vanilla");var ft=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.aia-submitButton-otz7H {
|
|
3606
3708
|
flex-shrink: 0;
|
|
3607
3709
|
width: 32px;
|
|
3608
3710
|
height: 32px;
|
|
@@ -3673,5 +3775,5 @@
|
|
|
3673
3775
|
transition: none;
|
|
3674
3776
|
}
|
|
3675
3777
|
}
|
|
3676
|
-
`,document.head.appendChild(e)}var ua={submitButton:"aia-submitButton-otz7H"};var It=require("react/jsx-runtime");function ga({disabled:e,ready:a,onClick:t,label:i=(0,ma.uiStringsFor)().submit}){return(0,It.jsx)("button",{type:"button","data-aia-submit":"",className:ua.submitButton,disabled:e,"data-aia-ready":a?"":void 0,onClick:o=>{o.stopPropagation(),t()},"aria-label":i,children:(0,It.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,It.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var et=require("@magicx-eng/ai-autocomplete-vanilla"),E=require("react");var Ft=require("react");function fa(e){let a=(0,Ft.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),i=(0,Ft.useRef)({key:"",overrides:void 0});if(i.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(l,b,v)=>{let k=a.current?.[s];return k?k(l,b,v):[]};o[s]=r}i.current={key:t,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:t}}var Ht=require("react");function ba(e){let a=(0,Ht.useRef)(e);a.current=e;let t=(0,Ht.useRef)(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=a.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var wa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,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 Et({onSubmit:e,onResult:a,onError:t,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,visitorId:k,columns:f=2,dropdownTrigger:u,optionsPosition:p,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:te,locationSearch:F,showOptionIcons:D,showOptionImages:he,showOptionCounts:T,showSkipButton:W,showProducts:V,productImageFallback:K="image",onFocus:U,onBlur:P,value:ae,completedParams:re,onChange:O,onParamsChange:j,products:Se,mapProducts:ue,onProductSelect:xe,onProductAddToCart:c,source:I,setCursor:qe}){let g=(0,E.useRef)(null),[tt,_e]=(0,E.useState)(null),Ve=(0,E.useRef)(e);Ve.current=e;let Ue=(0,E.useRef)(a);Ue.current=a;let We=(0,E.useRef)(t);We.current=t;let Qe=(0,E.useRef)(O);Qe.current=O;let m=(0,E.useRef)(j);m.current=j;let C=(0,E.useRef)(U);C.current=U;let S=(0,E.useRef)(P);S.current=P;let R=(0,E.useRef)(qe);R.current=qe;let M=(0,E.useRef)(xe);M.current=xe;let Q=(0,E.useRef)(c);Q.current=c;let Te=(0,E.useRef)(k);Te.current=k;let Pe=(0,E.useRef)(()=>{let h=Te.current;return typeof h=="function"?h():h}).current,ze=ba(Se),se=(0,E.useRef)(ue);se.current=ue;let at=(0,E.useRef)((h,Y)=>{let N=se.current;return N?N(h,Y):h}).current,it=ue?at:void 0,ot=fa(i);(0,E.useEffect)(()=>{if(typeof document>"u")return;let h=new et.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,visitorId:Pe,optionOverrides:ot.overrides,maskCompletedText:o,columns:f,dropdownTrigger:u,optionsPosition:p,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:te,locationSearch:F,showProducts:V,source:I,value:ae,completedParams:re,onSubmit:(...N)=>Ve.current?.(...N),onResult:(...N)=>Ue.current?.(...N),onError:(...N)=>We.current?.(...N),onChange:(...N)=>Qe.current?.(...N),onParamsChange:(...N)=>m.current?.(...N),onFocus:()=>C.current?.(),onBlur:()=>S.current?.(),onProductSelect:N=>M.current?.(N),onProductAddToCart:N=>Q.current?.(N),setCursor:N=>R.current?.(N),products:ze.config,mapProducts:it});g.current=h,_e(h.getState());let Y=h.subscribe(N=>_e(N));return()=>{Y(),h.destroy(),g.current===h&&(g.current=null)}},[]),(0,E.useEffect)(()=>{ae!==void 0&&g.current?.setValue(ae)},[ae]),(0,E.useEffect)(()=>{re!==void 0&&g.current?.setCompletedParams(re)},[re]);let Ye=JSON.stringify(s??null),nt;try{nt=JSON.stringify(r??null)}catch{nt="[unstringifiable]"}(0,E.useEffect)(()=>{g.current?.update({apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,optionOverrides:ot.overrides,dropdownTrigger:u,optionsPosition:p,closeDropdownOnBlur:x,prependPlaceholder:A,showNonTappableOptions:te,locationSearch:F,showProducts:V})},[Ye,nt,l,b?.code,b?.rate,b?.country,v,ot.key,u,p,x,A,te,F,V]);let rt=(0,E.useRef)(!1);(0,E.useEffect)(()=>{if(!rt.current){rt.current=!0;return}g.current?.update({products:ze.config})},[ze.enabled]),(0,E.useEffect)(()=>{g.current?.update({mapProducts:it})},[it]);let ce=(0,E.useRef)(null);ce.current===null&&(ce.current={handleTextChange:h=>g.current?.handleTextChange(h),handleKeyDown:h=>{let Y="nativeEvent"in h?h.nativeEvent:h;g.current?.handleKeyDown(Y)},setFocused:h=>g.current?.setFocused(h),startEditingParam:h=>g.current?.startEditingParam(h),removeParam:h=>g.current?.removeParam(h)??!1,exitEditMode:()=>g.current?.exitEditMode(),handleCaretAfterInput:h=>g.current?.handleCaretAfterInput(h),handleCaretMove:h=>g.current?.handleCaretMove(h),replaceEditingRange:h=>g.current?.replaceEditingRange(h)??!1,setActivePill:h=>g.current?.setActivePill(h),skipActivePill:()=>g.current?.skipActivePill(),removeLastParam:()=>g.current?.removeLastParam(),clearNewParamId:()=>g.current?.clearNewParamId(),reset:()=>g.current?.reset(),refreshProducts:()=>g.current?.refreshProducts(),prepareSubmit:()=>g.current?.prepareSubmit(),getState:()=>g.current?.getState()??wa,recordSubmit:h=>g.current?.recordSubmit(h),selectOption:(h,Y)=>g.current?.selectOption(h,Y),selectProduct:h=>g.current?.selectProduct(h),addProductToCart:h=>{let Y=g.current;return!Y||!Q.current?Promise.resolve():Y.addProductToCart(h)},setActiveDropdownIndex:h=>g.current?.setActiveDropdownIndex(h),clearHighlight:h=>g.current?.clearHighlight(h),showPreviousMonth:()=>g.current?.showPreviousMonth(),showNextMonth:()=>g.current?.showNextMonth(),setTime:h=>g.current?.setTime(h),commitTime:()=>g.current?.commitTime(),toggleMultiSelectOption:h=>g.current?.toggleMultiSelectOption(h),commitMultiSelect:()=>g.current?.commitMultiSelect(),setLocationQuery:h=>g.current?.setLocationQuery(h),moveLocationHighlight:h=>g.current?.moveLocationHighlight(h),commitLocation:h=>g.current?.commitLocation(h),setLocationFieldFocused:h=>g.current?.setLocationFieldFocused(h),handleFocus:()=>g.current?.setFocused(!0),handleBlur:()=>g.current?.setFocused(!1)});let y=ce.current,st=(0,E.useCallback)(h=>{let Y=h.target.value,q=Y.length>0&&!h.nativeEvent?.isComposing&&Y[0]!==Y[0].toUpperCase()?Y[0].toUpperCase()+Y.slice(1):Y;g.current?.handleTextChange(q)},[]),n=(0,E.useCallback)(h=>{g.current?.handleKeyDown(h.nativeEvent)},[]),le=g.current,w=tt??wa,De=ae!==void 0?ae:w.text,lt=re!==void 0?re:w.completedParams,ye=w.actionableSuggestions,je=ye[0],dt=(0,E.useMemo)(()=>(0,et.withoutTraditionalAutocomplete)(ye),[ye]),$e=le?.listboxId??"",ut=w.activeDropdownIndex>=0&&le?`${$e}-option-${w.activeDropdownIndex}`:void 0,Ie=w.editingParam,Me=w.editingIdentified,Ze=Ie?{parameter:Ie.suggestionParameter,text:Ie.suggestionPlaceholder,required:!0,options:Ie.options}:Me?{parameter:Me.parameter,text:(0,et.identifiedParamLabel)(Me.parameter),required:!0,options:[]}:null,ct=w.dropdownSuggestion??Ze??je,mt=Ze?[Ze]:ye,Ge=(0,et.dateSelectionFor)(w),pt=!le||w.dropdownLoading;return{completedParams:lt,multiSelectView:w.multiSelectView,toggleMultiSelectOption:y.toggleMultiSelectOption,commitMultiSelect:y.commitMultiSelect,skippedParams:w.skippedParams,identifiedParams:w.identifiedParams,suggestionPills:dt,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:w.segments,newParamId:w.newParamId,clearNewParamId:y.clearNewParamId,suggestions:w.suggestions,activeIndex:w.activeDropdownIndex,isReady:w.isReady,isLoading:pt,isFocused:w.isFocused,isDropdownOpen:w.isDropdownOpen,isActivePillSelected:w.isActivePillSelected,placeholderText:w.placeholderText,listboxId:$e,error:w.error,products:w.products,customFields:w.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:Ie,editingIdentified:Me,editingAnchor:w.editingAnchor,caretOffset:w.caretOffset,startEditingParam:y.startEditingParam,removeParam:y.removeParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:De,placeholder:w.placeholderText||void 0,onChange:st,onKeyDown:n,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":w.isDropdownOpen,"aria-activedescendant":ut,"aria-autocomplete":"list","aria-controls":$e},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:ct?[{...ct,options:w.dropdownOptions}]:[],activeIndex:w.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:w.isDropdownOpen,id:$e,pills:mt,activeSelected:w.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(W??!0)&&!Ie&&!Me,showOptionIcons:D??!0,showOptionImages:he??!0,showOptionCounts:T??!0,skipDisabled:w.inSelectionAnimation,isLoading:pt,skeletonExiting:w.skeletonExiting,isInputEmpty:De.trim().length===0,language:l,products:w.products,productImageFallback:K,onProductSelect:y.selectProduct,onProductAddToCart:c?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:w.activeFormatType,dateView:w.dateView,selectedDateIso:Ge.selectedIso,selectedDateRange:Ge.selectedRange,dateRangeStart:Ge.rangeStart,dateReferences:Ge.references,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,timeView:w.timeView,multiSelectView:w.dropdownMultiSelect,onMultiSelectCommit:y.commitMultiSelect,onTimeChange:y.setTime,onTimeCommit:y.commitTime,locationView:w.locationView,isReediting:w.editingParam!=null,onLocationQuery:y.setLocationQuery,onLocationMove:y.moveLocationHighlight,onLocationCommit:y.commitLocation,onLocationFocusChange:y.setLocationFieldFocused,isFocused:w.isFocused||w.locationFieldFocused,optionsPosition:p??"below"}}}var _=require("@magicx-eng/ai-autocomplete-vanilla"),z=require("react"),At;function ni(){if(At!==void 0)return At;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),At=e.contentEditable==="plaintext-only",At}function va(e){let{segments:a,showChipIcons:t=!0,showChipImages:i=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:b,editingAnchor:v,caretOffset:k,placeholderText:f,hintSuggestions:u,isFocused:p,isDropdownOpen:x,listboxId:A,activeDescendantId:te,autoFocus:F,handleTextChange:D,handleKeyDown:he,handleCaretAfterInput:T,handleCaretMove:W,startEditingParam:V,replaceEditingRange:K,setFocused:U}=e,P=(0,z.useRef)(null),ae=(0,z.useRef)(!1),re=(0,z.useRef)(""),O=(0,z.useRef)(""),j=(0,z.useRef)(null),Se=(0,z.useRef)(0);j.current=k,(0,z.useEffect)(()=>{if(!F)return;let m=P.current;if(!m)return;document.activeElement===m?U(!0):m.focus();let C=m.ownerDocument??document,S=C.getSelection(),R=S&&S.rangeCount>0&&m.contains(S.anchorNode);if(S&&!R){let M=C.createRange();M.selectNodeContents(m),M.collapse(!0),S.removeAllRanges(),S.addRange(M)}},[F,U]),(0,z.useEffect)(()=>{let m=P.current;if(!m)return;let C=m.ownerDocument??document,S=()=>{let R=C.getSelection();if(!R||R.rangeCount===0||!R.anchorNode||!m.contains(R.anchorNode))return;let M=R.anchorNode,Q=M.nodeType===Node.ELEMENT_NODE?M:M.parentElement,Pe=(R.isCollapsed?Q?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ze=l?.id??b?.id??null;if(Pe&&Pe!==ze){V(Pe);return}performance.now()-Se.current<50||W((0,_.getCursorOffset)(m))};return C.addEventListener("selectionchange",S),()=>C.removeEventListener("selectionchange",S)},[l,b,V,W]),(0,z.useEffect)(()=>{let m=P.current;if(!m)return;let C=S=>{let R=(0,_.chipIdFromTap)(m,S.target);R&&(V(R),(0,_.keepCaretOnChip)(m,R))};return m.addEventListener("click",C),()=>m.removeEventListener("click",C)},[V]),(0,z.useEffect)(()=>{let m=P.current;if(!(!m||!s||!o))return(0,_.attachChipRemove)(m,s)},[s,o]),(0,z.useLayoutEffect)(()=>{let m=P.current;m&&(0,_.renderEditableContent)({input:m,segments:a,newParamId:r,editingParamId:l?.id??null,placeholderText:f??"",isFocused:p,showChipIcons:t,showChipImages:i,showChipRemove:o,hintOptions:(0,_.startingHintOptions)(u??[])})},[a,r,l,f,u,p,t,i,o]),(0,z.useEffect)(()=>{let m=P.current;return()=>{m&&(0,_.cancelStartingHint)(m)}},[]),(0,z.useLayoutEffect)(()=>{let m=re.current,C=r??"";if(re.current=C,!C||C===m)return;let S=P.current;if(!S)return;S.focus();let R=j.current??(0,_.plainTextLength)(S);(0,_.setCursorOffset)(S,R)},[r]),(0,z.useLayoutEffect)(()=>{let m=O.current,C=l?.id??"";if(O.current=C,!C||C===m||v==null)return;let S=P.current;S&&(0,_.setCursorOffset)(S,v)},[l,v]);let ue=(0,z.useCallback)(()=>{if(ae.current)return;let m=P.current;if(!m)return;let C=(0,_.extractPlainText)(m),R=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;D(R)},[D]),xe=(0,z.useCallback)(()=>{Se.current=performance.now(),ue();let m=P.current;m&&T((0,_.getCursorOffset)(m))},[ue,T]);(0,z.useEffect)(()=>{let m=P.current;if(!m)return;let C=S=>{let R=S,M=R.inputType;if(M==="insertParagraph"||M==="insertLineBreak"||M==="insertFromDrop"){S.preventDefault();return}if(M.startsWith("insert")||M.startsWith("delete")){let Q=M.startsWith("delete")?"":R.data??"";K(Q)&&S.preventDefault()}};return m.addEventListener("beforeinput",C),()=>m.removeEventListener("beforeinput",C)},[K]);let c=(0,z.useCallback)(()=>{ae.current=!0,P.current?.setAttribute("data-aia-composing","true")},[]),I=(0,z.useCallback)(()=>{ae.current=!1,P.current?.removeAttribute("data-aia-composing"),ue()},[ue]),qe=(0,z.useCallback)(m=>{m.preventDefault();let C=P.current;if(!C)return;let S=(m.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!S)return;let R=C.ownerDocument??document,M=R.getSelection();if(!M||M.rangeCount===0)return;let Q=M.getRangeAt(0);if(!C.contains(Q.startContainer))return;Q.deleteContents();let Te=R.createTextNode(S);Q.insertNode(Te),Q.setStartAfter(Te),Q.collapse(!0),M.removeAllRanges(),M.addRange(Q),ue()},[ue]),g=(0,z.useCallback)(m=>he(m),[he]),tt=(0,z.useCallback)(()=>U(!0),[U]),_e=(0,z.useCallback)(()=>U(!1),[U]),Ve=(0,z.useCallback)(()=>P.current?.focus(),[]),Ue=(0,z.useCallback)(()=>P.current?.blur(),[]),We=(0,z.useCallback)(()=>{let m=P.current;return m?(0,_.extractPlainText)(m):""},[]),Qe=ni()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:Qe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":A,"aria-expanded":x,"aria-activedescendant":te,spellCheck:!0,enterKeyHint:"send",onInput:xe,onKeyDown:g,onCompositionStart:c,onCompositionEnd:I,onPaste:qe,onFocus:tt,onBlur:_e},getPlainText:We,focus:Ve,blur:Ue}}var Le=require("react/jsx-runtime");function ri(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var xa=(0,ee.forwardRef)(function({onSubmit:a,onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:b,language:v,currency:k,productId:f,visitorId:u,columns:p,pillPlacement:x="dropdown",mode:A="auto",optionsPosition:te="below",animations:F=!0,optionsStyle:D="floating",dropdownTrigger:he,closeDropdownOnBlur:T,prependPlaceholder:W,showNonTappableOptions:V,locationSearch:K,showOptionIcons:U=!0,showChipIcons:P=!0,showChipImages:ae=!0,showChipRemove:re=!1,showOptionImages:O=!0,showOptionCounts:j=!0,showSkipButton:Se,showProducts:ue,productsLayout:xe,productImageFallback:c,autoFocus:I=!0,onFocus:qe,onBlur:g,value:tt,completedParams:_e,onChange:Ve,onParamsChange:Ue,products:We,mapProducts:Qe,onProductSelect:m,onProductAddToCart:C,submitButton:S,resetOnSubmit:R=!0},M){let Q=(0,ee.useRef)(null),Te=(0,ee.useRef)(null),Pe=(0,ee.useRef)(null),ze=(0,ee.useRef)(()=>{}),se=(0,ee.useRef)(null),at=(0,ee.useRef)(null);(0,ee.useEffect)(()=>{let H=Q.current;if(H)return se.current?se.current.setMode(A):se.current=new Be.ModeController(H,A),()=>{se.current?.destroy(),se.current=null}},[A]);let it=(0,ee.useCallback)(H=>{let be=at.current?.current;be&&(be.focus(),(0,Be.setCursorOffset)(be,H))},[]),{completedParams:ot,suggestionPills:Ye,setActivePill:nt,skipActivePill:rt,segments:ce,newParamId:y,clearNewParamId:st,placeholderText:n,isFocused:le,isDropdownOpen:w,isActivePillSelected:De,isLoading:lt,isReady:ye,activeIndex:je,listboxId:dt,handleTextChange:$e,handleKeyDown:ut,setFocused:Ie,editingParam:Me,editingIdentified:Ze,editingAnchor:ct,caretOffset:mt,startEditingParam:Ge,removeParam:pt,handleCaretAfterInput:h,handleCaretMove:Y,replaceEditingRange:N,dropdownProps:q,reset:xt,refreshProducts:Bt,prepareSubmit:Wt,getState:Gt,recordSubmit:Kt}=Et({onSubmit:H=>ze.current(H),onResult:t,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:b,language:v,currency:k,productId:f,visitorId:u,columns:p,dropdownTrigger:he,optionsPosition:te,closeDropdownOnBlur:T,prependPlaceholder:W,showNonTappableOptions:V,locationSearch:K,showOptionIcons:U,showOptionImages:O,showOptionCounts:j,showSkipButton:Se,showProducts:ue,onFocus:qe,onBlur:g,value:tt,completedParams:_e,onChange:Ve,onParamsChange:Ue,products:We,mapProducts:Qe,onProductSelect:m,onProductAddToCart:C,source:"full-sdk",setCursor:it});(0,ee.useEffect)(()=>{if(!y)return;let H=window.setTimeout(()=>st(),650);return()=>window.clearTimeout(H)},[y,st]);let ya=je>=0?`${dt}-option-${je}`:void 0,{inputRef:Ot,editorProps:ka,focus:yt,blur:qt,getPlainText:_t}=va({segments:ce,newParamId:y,editingParam:Me,editingIdentified:Ze,editingAnchor:ct,caretOffset:mt,placeholderText:n,hintSuggestions:x==="inline"?[]:Ye,isFocused:le,showChipIcons:P,showChipImages:ae,showChipRemove:re,removeParam:pt,isDropdownOpen:w,listboxId:dt,activeDescendantId:ya,autoFocus:I,handleTextChange:$e,handleKeyDown:ut,handleCaretAfterInput:h,handleCaretMove:Y,startEditingParam:Ge,replaceEditingRange:N,setFocused:Ie});at.current=Ot,(0,ee.useLayoutEffect)(()=>{let H=Te.current,be=Ot.current;if(!H||!be)return;let ft=()=>{let Ut=H.firstElementChild;if(!Ut)return;let Pa=Ut.getBoundingClientRect(),Ia=be.getBoundingClientRect();Pa.top>=Ia.bottom-2?H.setAttribute("data-aia-pill-wrapped",""):H.removeAttribute("data-aia-pill-wrapped")};ft();let Vt=new ResizeObserver(ft);return Vt.observe(be),()=>Vt.disconnect()},[ce,Ye.length,lt,Ot]),(0,ee.useEffect)(()=>{let H=Pe.current;if(H)return(0,Be.watchEditorHeight)(H)},[]),(0,ee.useImperativeHandle)(M,()=>({focus:yt,blur:qt,reset:xt,refreshProducts:Bt,setMode:H=>se.current?.setMode(H),skipActivePill:rt}),[yt,qt,xt,Bt,rt]);let gt=!!ce.length||ot.length>0,Rt=(0,ee.useCallback)(H=>{if(!gt)return;H&&Wt();let be=Gt(),ft=(0,Be.buildSubmitResult)(_t(),be.completedParams,be.skippedParams,{identifiedParams:be.identifiedParams,isReady:be.isReady,customFields:be.customFields});H&&Kt(ft),a(ft),R&&xt()},[Kt,R,gt,Wt,Gt,a,xt,_t]);ze.current=()=>Rt(!1);let Ca=(0,ee.useCallback)(H=>{H.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||yt()},[yt]),Sa=x==="inline",Ta=x==="dropdown";return(0,Le.jsxs)("div",{ref:Q,className:`magicx-aia ${ht.container} ${r??""}`,"data-pill-placement":x,"data-options-position":te,"data-animations":F?"on":"off","data-aia-options-style":D,"data-mode":ri(A),children:[(0,Le.jsx)(Pt,{...q,showPills:Ta,productsLayout:xe,productImageFallback:c}),(0,Le.jsxs)("div",{className:ht.inputWrapper,"data-aia-input-wrapper":"",onClick:Ca,children:[(0,Le.jsxs)("div",{ref:Pe,className:ht.editorArea,"data-aia-editor":"",children:[(0,Le.jsx)("div",{...ka,className:ht.input,"data-aia-input":""}),Sa&&(lt||Ye.length>0)&&(0,Le.jsx)("span",{ref:Te,className:ht.pillListContainer,"data-aia-pill-list-container":"",children:(0,Le.jsx)(St,{pills:Ye,activePillIndex:0,activeSelected:De,onSelectPill:nt,loading:lt})})]}),S===null?null:S===void 0?(0,Le.jsx)(ga,{disabled:!gt,ready:gt&&ye,onClick:()=>Rt(!0),label:(0,Be.uiStringsFor)(v).submit}):(0,Le.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:ht.submitSlot,onClick:H=>{gt&&(H.stopPropagation(),Rt(!0))},children:S})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
3778
|
+
`,document.head.appendChild(e)}var gt={submitButton:"aia-submitButton-otz7H"};var Aa=require("react/jsx-runtime");function bt({disabled:e,ready:t,onClick:a,label:i=(0,ft.uiStringsFor)().submit}){return(0,Aa.jsx)("button",{type:"button","data-aia-submit":"",className:gt.submitButton,disabled:e,"data-aia-ready":t?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":i,children:(0,Aa.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Aa.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Be=require("@magicx-eng/ai-autocomplete-vanilla"),E=require("react");var Ha=require("react");function wt(e){let t=(0,Ha.useRef)(e);t.current=e;let a=Object.keys(e??{}).sort().join("\0"),i=(0,Ha.useRef)({key:"",overrides:void 0});if(i.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,b,v)=>{let k=t.current?.[s];return k?k(l,b,v):[]};o[s]=r}i.current={key:a,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:a}}var Ba=require("react");function vt(e){let t=(0,Ba.useRef)(e);t.current=e;let a=(0,Ba.useRef)(null);a.current===null&&(a.current={fetch:(o,s)=>{let r=t.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>t.current?.transform(o)??[],get limit(){return t.current?.limit}});let i=e!==void 0;return{config:i?a.current:void 0,enabled:i}}var xt={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,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 Ra({onSubmit:e,onResult:t,onError:a,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,visitorId:k,columns:g=2,dropdownTrigger:u,optionsPosition:p,closeDropdownOnBlur:x,prependPlaceholder:A,allOption:ee,showNonTappableOptions:H,locationSearch:M,showOptionIcons:ue,showOptionImages:P,showOptionCounts:F,showSkipButton:ae,showProducts:q,productImageFallback:re="image",onFocus:R,onBlur:pe,value:$,completedParams:U,onChange:se,onParamsChange:Ce,products:S,mapProducts:Q,onProductSelect:c,onProductAddToCart:T,source:ia,setCursor:Ge}){let f=(0,E.useRef)(null),[oa,Ke]=(0,E.useState)(null),je=(0,E.useRef)(e);je.current=e;let $e=(0,E.useRef)(t);$e.current=t;let qe=(0,E.useRef)(a);qe.current=a;let m=(0,E.useRef)(se);m.current=se;let C=(0,E.useRef)(Ce);C.current=Ce;let I=(0,E.useRef)(R);I.current=R;let O=(0,E.useRef)(pe);O.current=pe;let N=(0,E.useRef)(Ge);N.current=Ge;let he=(0,E.useRef)(c);he.current=c;let we=(0,E.useRef)(T);we.current=T;let Ee=(0,E.useRef)(k);Ee.current=k;let _e=(0,E.useRef)(()=>{let h=Ee.current;return typeof h=="function"?h():h}).current,Ze=vt(S),be=(0,E.useRef)(Q);be.current=Q;let Ae=(0,E.useRef)((h,Y)=>{let B=be.current;return B?B(h,Y):h}).current,Xe=Q?Ae:void 0,na=wt(i);(0,E.useEffect)(()=>{if(typeof document>"u")return;let h=new Be.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,visitorId:_e,optionOverrides:na.overrides,maskCompletedText:o,columns:g,dropdownTrigger:u,optionsPosition:p,closeDropdownOnBlur:x,prependPlaceholder:A,allOption:ee,showNonTappableOptions:H,locationSearch:M,showProducts:q,source:ia,value:$,completedParams:U,onSubmit:(...B)=>je.current?.(...B),onResult:(...B)=>$e.current?.(...B),onError:(...B)=>qe.current?.(...B),onChange:(...B)=>m.current?.(...B),onParamsChange:(...B)=>C.current?.(...B),onFocus:()=>I.current?.(),onBlur:()=>O.current?.(),onProductSelect:B=>he.current?.(B),onProductAddToCart:B=>we.current?.(B),setCursor:B=>N.current?.(B),products:Ze.config,mapProducts:Xe});f.current=h,Ke(h.getState());let Y=h.subscribe(B=>Ke(B));return()=>{Y(),h.destroy(),f.current===h&&(f.current=null)}},[]),(0,E.useEffect)(()=>{$!==void 0&&f.current?.setValue($)},[$]),(0,E.useEffect)(()=>{U!==void 0&&f.current?.setCompletedParams(U)},[U]);let ga=JSON.stringify(s??null),De;try{De=JSON.stringify(r??null)}catch{De="[unstringifiable]"}(0,E.useEffect)(()=>{f.current?.update({apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,optionOverrides:na.overrides,dropdownTrigger:u,optionsPosition:p,closeDropdownOnBlur:x,prependPlaceholder:A,allOption:ee,showNonTappableOptions:H,locationSearch:M,showProducts:q})},[ga,De,l,b?.code,b?.rate,b?.country,v,na.key,u,p,x,A,ee,H,M,q]);let pa=(0,E.useRef)(!1);(0,E.useEffect)(()=>{if(!pa.current){pa.current=!0;return}f.current?.update({products:Ze.config})},[Ze.enabled]),(0,E.useEffect)(()=>{f.current?.update({mapProducts:Xe})},[Xe]);let me=(0,E.useRef)(null);me.current===null&&(me.current={handleTextChange:h=>f.current?.handleTextChange(h),handleKeyDown:h=>{let Y="nativeEvent"in h?h.nativeEvent:h;f.current?.handleKeyDown(Y)},setFocused:h=>f.current?.setFocused(h),startEditingParam:h=>f.current?.startEditingParam(h),removeParam:h=>f.current?.removeParam(h)??!1,exitEditMode:()=>f.current?.exitEditMode(),handleCaretAfterInput:h=>f.current?.handleCaretAfterInput(h),handleCaretMove:h=>f.current?.handleCaretMove(h),replaceEditingRange:h=>f.current?.replaceEditingRange(h)??!1,setActivePill:h=>f.current?.setActivePill(h),skipActivePill:()=>f.current?.skipActivePill(),removeLastParam:()=>f.current?.removeLastParam(),clearNewParamId:()=>f.current?.clearNewParamId(),reset:()=>f.current?.reset(),refreshProducts:()=>f.current?.refreshProducts(),prepareSubmit:()=>f.current?.prepareSubmit(),getState:()=>f.current?.getState()??xt,recordSubmit:h=>f.current?.recordSubmit(h),selectOption:(h,Y)=>f.current?.selectOption(h,Y),selectProduct:h=>f.current?.selectProduct(h),addProductToCart:h=>{let Y=f.current;return!Y||!we.current?Promise.resolve():Y.addProductToCart(h)},setActiveDropdownIndex:h=>f.current?.setActiveDropdownIndex(h),clearHighlight:h=>f.current?.clearHighlight(h),showPreviousMonth:()=>f.current?.showPreviousMonth(),showNextMonth:()=>f.current?.showNextMonth(),setTime:h=>f.current?.setTime(h),commitTime:()=>f.current?.commitTime(),toggleMultiSelectOption:h=>f.current?.toggleMultiSelectOption(h),commitMultiSelect:()=>f.current?.commitMultiSelect(),setLocationQuery:h=>f.current?.setLocationQuery(h),moveLocationHighlight:h=>f.current?.moveLocationHighlight(h),commitLocation:h=>f.current?.commitLocation(h),setLocationFieldFocused:h=>f.current?.setLocationFieldFocused(h),handleFocus:()=>f.current?.setFocused(!0),handleBlur:()=>f.current?.setFocused(!1)});let y=me.current,Je=(0,E.useCallback)(h=>{let Y=h.target.value,L=Y.length>0&&!h.nativeEvent?.isComposing&&Y[0]!==Y[0].toUpperCase()?Y[0].toUpperCase()+Y.slice(1):Y;f.current?.handleTextChange(L)},[]),n=(0,E.useCallback)(h=>{f.current?.handleKeyDown(h.nativeEvent)},[]),te=f.current,w=oa??xt,Me=$!==void 0?$:w.text,fa=U!==void 0?U:w.completedParams,ve=w.actionableSuggestions,ra=ve[0],sa=(0,E.useMemo)(()=>(0,Be.withoutTraditionalAutocomplete)(ve),[ve]),Ve=te?.listboxId??"",ha=w.activeDropdownIndex>=0&&te?`${Ve}-option-${w.activeDropdownIndex}`:void 0,Ue=w.editingParam,Ne=w.editingIdentified,ea=Ue?(0,Be.editingSuggestion)(Ue):Ne?{parameter:Ne.parameter,text:(0,Be.identifiedParamLabel)(Ne.parameter),required:!0,options:[]}:null,la=w.dropdownSuggestion??ea??ra,ua=ea?[ea]:ve,Qe=(0,Be.dateSelectionFor)(w),da=!te||w.dropdownLoading;return{completedParams:fa,multiSelectView:w.multiSelectView,toggleMultiSelectOption:y.toggleMultiSelectOption,commitMultiSelect:y.commitMultiSelect,skippedParams:w.skippedParams,identifiedParams:w.identifiedParams,suggestionPills:sa,setActivePill:y.setActivePill,skipActivePill:y.skipActivePill,removeLastParam:y.removeLastParam,segments:w.segments,newParamId:w.newParamId,clearNewParamId:y.clearNewParamId,suggestions:w.suggestions,activeIndex:w.activeDropdownIndex,isReady:w.isReady,isLoading:da,isFocused:w.isFocused,isDropdownOpen:w.isDropdownOpen,isActivePillSelected:w.isActivePillSelected,placeholderText:w.placeholderText,listboxId:Ve,error:w.error,products:w.products,customFields:w.customFields,selectProduct:y.selectProduct,addProductToCart:y.addProductToCart,handleTextChange:y.handleTextChange,handleKeyDown:y.handleKeyDown,setFocused:y.setFocused,editingParam:Ue,editingIdentified:Ne,editingAnchor:w.editingAnchor,caretOffset:w.caretOffset,startEditingParam:y.startEditingParam,removeParam:y.removeParam,exitEditMode:y.exitEditMode,handleCaretAfterInput:y.handleCaretAfterInput,handleCaretMove:y.handleCaretMove,replaceEditingRange:y.replaceEditingRange,inputProps:{value:Me,placeholder:w.placeholderText||void 0,onChange:Je,onKeyDown:n,onFocus:y.handleFocus,onBlur:y.handleBlur,role:"combobox","aria-expanded":w.isDropdownOpen,"aria-activedescendant":ha,"aria-autocomplete":"list","aria-controls":Ve},reset:y.reset,refreshProducts:y.refreshProducts,prepareSubmit:y.prepareSubmit,getState:y.getState,recordSubmit:y.recordSubmit,dropdownProps:{suggestions:la?[{...la,options:w.dropdownOptions}]:[],activeIndex:w.activeDropdownIndex,onSelect:y.selectOption,onHighlight:y.setActiveDropdownIndex,onUnhighlight:y.clearHighlight,isOpen:w.isDropdownOpen,id:Ve,pills:ua,activeSelected:w.isActivePillSelected,onPillClick:y.setActivePill,onSkip:y.skipActivePill,showSkipButton:(ae??!0)&&!Ue&&!Ne,showOptionIcons:ue??!0,showOptionImages:P??!0,showOptionCounts:F??!0,skipDisabled:w.inSelectionAnimation,isLoading:da,skeletonExiting:w.skeletonExiting,isInputEmpty:Me.trim().length===0,language:l,products:w.products,productImageFallback:re,onProductSelect:y.selectProduct,onProductAddToCart:T?y.addProductToCart:void 0,onProductFocusChange:y.setFocused,formatType:w.activeFormatType,dateView:w.dateView,selectedDateIso:Qe.selectedIso,selectedDateRange:Qe.selectedRange,dateRangeStart:Qe.rangeStart,dateReferences:Qe.references,onPreviousMonth:y.showPreviousMonth,onNextMonth:y.showNextMonth,timeView:w.timeView,multiSelectView:w.dropdownMultiSelect,onMultiSelectCommit:y.commitMultiSelect,onTimeChange:y.setTime,onTimeCommit:y.commitTime,locationView:w.locationView,isReediting:w.editingParam!=null,onLocationQuery:y.setLocationQuery,onLocationMove:y.moveLocationHighlight,onLocationCommit:y.commitLocation,onLocationFocusChange:y.setLocationFieldFocused,isFocused:w.isFocused||w.locationFieldFocused,optionsPosition:p??"below"}}}var V=require("@magicx-eng/ai-autocomplete-vanilla"),D=require("react"),Oa;function di(){if(Oa!==void 0)return Oa;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Oa=e.contentEditable==="plaintext-only",Oa}function yt(e){let{segments:t,showChipIcons:a=!0,showChipImages:i=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:b,editingAnchor:v,caretOffset:k,placeholderText:g,hintSuggestions:u,isFocused:p,isDropdownOpen:x,listboxId:A,activeDescendantId:ee,autoFocus:H,handleTextChange:M,handleKeyDown:ue,handleCaretAfterInput:P,handleCaretMove:F,startEditingParam:ae,replaceEditingRange:q,setFocused:re}=e,R=(0,D.useRef)(null),pe=(0,D.useRef)(!1),$=(0,D.useRef)(""),U=(0,D.useRef)(""),se=(0,D.useRef)(null),Ce=(0,D.useRef)(0);se.current=k,(0,D.useEffect)(()=>{if(!H)return;let m=R.current;if(!m)return;document.activeElement===m?re(!0):m.focus();let C=m.ownerDocument??document,I=C.getSelection(),O=I&&I.rangeCount>0&&m.contains(I.anchorNode);if(I&&!O){let N=C.createRange();N.selectNodeContents(m),N.collapse(!0),I.removeAllRanges(),I.addRange(N)}},[H,re]),(0,D.useEffect)(()=>{let m=R.current;if(!m)return;let C=m.ownerDocument??document,I=()=>{let O=C.getSelection();if(!O||O.rangeCount===0||!O.anchorNode||!m.contains(O.anchorNode))return;let N=O.anchorNode,he=N.nodeType===Node.ELEMENT_NODE?N:N.parentElement,Ee=(O.isCollapsed?he?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,_e=l?.id??b?.id??null;if(Ee&&Ee!==_e){ae(Ee);return}performance.now()-Ce.current<50||F((0,V.getCursorOffset)(m))};return C.addEventListener("selectionchange",I),()=>C.removeEventListener("selectionchange",I)},[l,b,ae,F]),(0,D.useEffect)(()=>{let m=R.current;if(!m)return;let C=I=>{let O=(0,V.chipIdFromTap)(m,I.target);O&&(ae(O),(0,V.keepCaretOnChip)(m,O))};return m.addEventListener("click",C),()=>m.removeEventListener("click",C)},[ae]),(0,D.useEffect)(()=>{let m=R.current;if(!(!m||!s||!o))return(0,V.attachChipRemove)(m,s)},[s,o]),(0,D.useLayoutEffect)(()=>{let m=R.current;m&&(0,V.renderEditableContent)({input:m,segments:t,newParamId:r,editingParamId:l?.id??null,placeholderText:g??"",isFocused:p,showChipIcons:a,showChipImages:i,showChipRemove:o,hintOptions:(0,V.startingHintOptions)(u??[])})},[t,r,l,g,u,p,a,i,o]),(0,D.useEffect)(()=>{let m=R.current;return()=>{m&&(0,V.cancelStartingHint)(m)}},[]),(0,D.useLayoutEffect)(()=>{let m=$.current,C=r??"";if($.current=C,!C||C===m)return;let I=R.current;if(!I)return;I.focus();let O=se.current??(0,V.plainTextLength)(I);(0,V.setCursorOffset)(I,O)},[r]),(0,D.useLayoutEffect)(()=>{let m=U.current,C=l?.id??"";if(U.current=C,!C||C===m||v==null)return;let I=R.current;I&&(0,V.setCursorOffset)(I,v)},[l,v]);let S=(0,D.useCallback)(()=>{if(pe.current)return;let m=R.current;if(!m)return;let C=(0,V.extractPlainText)(m),O=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;M(O)},[M]),Q=(0,D.useCallback)(()=>{Ce.current=performance.now(),S();let m=R.current;m&&P((0,V.getCursorOffset)(m))},[S,P]);(0,D.useEffect)(()=>{let m=R.current;if(!m)return;let C=I=>{let O=I,N=O.inputType;if(N==="insertParagraph"||N==="insertLineBreak"||N==="insertFromDrop"){I.preventDefault();return}if(N.startsWith("insert")||N.startsWith("delete")){let he=N.startsWith("delete")?"":O.data??"";q(he)&&I.preventDefault()}};return m.addEventListener("beforeinput",C),()=>m.removeEventListener("beforeinput",C)},[q]);let c=(0,D.useCallback)(()=>{pe.current=!0,R.current?.setAttribute("data-aia-composing","true")},[]),T=(0,D.useCallback)(()=>{pe.current=!1,R.current?.removeAttribute("data-aia-composing"),S()},[S]),ia=(0,D.useCallback)(m=>{m.preventDefault();let C=R.current;if(!C)return;let I=(m.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let O=C.ownerDocument??document,N=O.getSelection();if(!N||N.rangeCount===0)return;let he=N.getRangeAt(0);if(!C.contains(he.startContainer))return;he.deleteContents();let we=O.createTextNode(I);he.insertNode(we),he.setStartAfter(we),he.collapse(!0),N.removeAllRanges(),N.addRange(he),S()},[S]),Ge=(0,D.useCallback)(m=>ue(m),[ue]),f=(0,D.useCallback)(()=>re(!0),[re]),oa=(0,D.useCallback)(()=>re(!1),[re]),Ke=(0,D.useCallback)(()=>R.current?.focus(),[]),je=(0,D.useCallback)(()=>R.current?.blur(),[]),$e=(0,D.useCallback)(()=>{let m=R.current;return m?(0,V.extractPlainText)(m):""},[]),qe=di()?"plaintext-only":"true";return{inputRef:R,editorProps:{ref:R,contentEditable:qe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":A,"aria-expanded":x,"aria-activedescendant":ee,spellCheck:!0,enterKeyHint:"send",onInput:Q,onKeyDown:Ge,onCompositionStart:c,onCompositionEnd:T,onPaste:ia,onFocus:f,onBlur:oa},getPlainText:$e,focus:Ke,blur:je}}var ze=require("react/jsx-runtime");function ci(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var kt=(0,j.forwardRef)(function({onSubmit:t,onResult:a,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:b,language:v,currency:k,productId:g,visitorId:u,columns:p,pillPlacement:x="dropdown",mode:A="auto",optionsPosition:ee="below",animations:H=!0,optionsStyle:M="floating",dropdownTrigger:ue,closeDropdownOnBlur:P,prependPlaceholder:F,allOption:ae,showNonTappableOptions:q,locationSearch:re,showOptionIcons:R=!0,showChipIcons:pe=!0,showChipImages:$=!0,showChipRemove:U=!1,showOptionImages:se=!0,showOptionCounts:Ce=!0,showSkipButton:S,showProducts:Q,productsLayout:c,productImageFallback:T,autoFocus:ia=!0,onFocus:Ge,onBlur:f,value:oa,completedParams:Ke,onChange:je,onParamsChange:$e,products:qe,mapProducts:m,onProductSelect:C,onProductAddToCart:I,submitButton:O,resetOnSubmit:N=!0,seeAllResults:he=!1},we){let Ee=(0,j.useRef)(null),_e=(0,j.useRef)(null),Ze=(0,j.useRef)(null),be=(0,j.useRef)(()=>{}),Ae=(0,j.useRef)(null),Xe=(0,j.useRef)(null);(0,j.useEffect)(()=>{let W=Ee.current;if(W)return Ae.current?Ae.current.setMode(A):Ae.current=new We.ModeController(W,A),()=>{Ae.current?.destroy(),Ae.current=null}},[A]);let na=(0,j.useCallback)(W=>{let xe=Xe.current?.current;xe&&(xe.focus(),(0,We.setCursorOffset)(xe,W))},[]),{completedParams:ga,suggestionPills:De,setActivePill:pa,skipActivePill:me,segments:y,newParamId:Je,clearNewParamId:n,placeholderText:te,isFocused:w,isDropdownOpen:Me,isActivePillSelected:fa,isLoading:ve,isReady:ra,activeIndex:sa,listboxId:Ve,handleTextChange:ha,handleKeyDown:Ue,setFocused:Ne,editingParam:ea,editingIdentified:la,editingAnchor:ua,caretOffset:Qe,startEditingParam:da,removeParam:h,handleCaretAfterInput:Y,handleCaretMove:B,replaceEditingRange:L,dropdownProps:Wa,reset:ka,refreshProducts:Ga,prepareSubmit:Ka,getState:qa,recordSubmit:_a}=Ra({onSubmit:W=>be.current(W),onResult:a,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:b,language:v,currency:k,productId:g,visitorId:u,columns:p,dropdownTrigger:ue,optionsPosition:ee,closeDropdownOnBlur:P,prependPlaceholder:F,allOption:ae,showNonTappableOptions:q,locationSearch:re,showOptionIcons:R,showOptionImages:se,showOptionCounts:Ce,showSkipButton:S,showProducts:Q,onFocus:Ge,onBlur:f,value:oa,completedParams:Ke,onChange:je,onParamsChange:$e,products:qe,mapProducts:m,onProductSelect:C,onProductAddToCart:I,source:"full-sdk",setCursor:na});(0,j.useEffect)(()=>{if(!Je)return;let W=window.setTimeout(()=>n(),650);return()=>window.clearTimeout(W)},[Je,n]);let Ct=sa>=0?`${Ve}-option-${sa}`:void 0,{inputRef:La,editorProps:St,focus:Ca,blur:Va,getPlainText:Ua}=yt({segments:y,newParamId:Je,editingParam:ea,editingIdentified:la,editingAnchor:ua,caretOffset:Qe,placeholderText:te,hintSuggestions:x==="inline"?[]:De,isFocused:w,showChipIcons:pe,showChipImages:$,showChipRemove:U,removeParam:h,isDropdownOpen:Me,listboxId:Ve,activeDescendantId:Ct,autoFocus:ia,handleTextChange:ha,handleKeyDown:Ue,handleCaretAfterInput:Y,handleCaretMove:B,startEditingParam:da,replaceEditingRange:L,setFocused:Ne});Xe.current=La,(0,j.useLayoutEffect)(()=>{let W=_e.current,xe=La.current;if(!W||!xe)return;let wa=()=>{let Ya=W.firstElementChild;if(!Ya)return;let Rt=Ya.getBoundingClientRect(),Ot=xe.getBoundingClientRect();Rt.top>=Ot.bottom-2?W.setAttribute("data-aia-pill-wrapped",""):W.removeAttribute("data-aia-pill-wrapped")};wa();let Qa=new ResizeObserver(wa);return Qa.observe(xe),()=>Qa.disconnect()},[y,De.length,ve,La]),(0,j.useEffect)(()=>{let W=Ze.current;if(W)return(0,We.watchEditorHeight)(W)},[]),(0,j.useImperativeHandle)(we,()=>({focus:Ca,blur:Va,reset:ka,refreshProducts:Ga,setMode:W=>Ae.current?.setMode(W),skipActivePill:me}),[Ca,Va,ka,Ga,me]);let ma=!!y.length||ga.length>0,ba=(0,j.useCallback)(W=>{if(!ma)return;W&&Ka();let xe=qa(),wa=(0,We.buildSubmitResult)(Ua(),xe.completedParams,xe.skippedParams,{identifiedParams:xe.identifiedParams,isReady:xe.isReady,customFields:xe.customFields});W&&_a(wa),t(wa),N&&ka()},[_a,N,ma,Ka,qa,t,ka,Ua]);be.current=()=>ba(!1);let Tt=he&&!Wa.isInputEmpty&&ma,Pt=(0,j.useCallback)(()=>ba(!0),[ba]),It=(0,j.useCallback)(W=>{W.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||Ca()},[Ca]),Et=x==="inline",At=x==="dropdown";return(0,ze.jsxs)("div",{ref:Ee,className:`magicx-aia ${ca.container} ${r??""}`,"data-pill-placement":x,"data-options-position":ee,"data-animations":H?"on":"off","data-aia-options-style":M,"data-mode":ci(A),children:[(0,ze.jsx)(Ea,{...Wa,showPills:At,productsLayout:c,productImageFallback:T,onSeeAllResults:Tt?Pt:void 0}),(0,ze.jsxs)("div",{className:ca.inputWrapper,"data-aia-input-wrapper":"",onClick:It,children:[(0,ze.jsxs)("div",{ref:Ze,className:ca.editorArea,"data-aia-editor":"",children:[(0,ze.jsx)("div",{...St,className:ca.input,"data-aia-input":""}),Et&&(ve||De.length>0)&&(0,ze.jsx)("span",{ref:_e,className:ca.pillListContainer,"data-aia-pill-list-container":"",children:(0,ze.jsx)(Pa,{pills:De,activePillIndex:0,activeSelected:fa,onSelectPill:pa,loading:ve})})]}),O===null?null:O===void 0?(0,ze.jsx)(bt,{disabled:!ma,ready:ma&&ra,onClick:()=>ba(!0),label:(0,We.uiStringsFor)(v).submit}):(0,ze.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:ca.submitSlot,onClick:W=>{ma&&(W.stopPropagation(),ba(!0))},children:O})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
3677
3779
|
//# sourceMappingURL=index.js.map
|