@magicx-eng/ai-autocomplete-react 0.66.2 → 0.67.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 +2 -0
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +105 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +105 -42
- 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 jt=Object.defineProperty;var Za=Object.getOwnPropertyDescriptor;var Xa=Object.getOwnPropertyNames;var Ja=Object.prototype.hasOwnProperty;var ei=(e,a)=>{for(var t in a)jt(e,t,{get:a[t],enumerable:!0})},ti=(e,a,t,n)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of Xa(a))!Ja.call(e,o)&&o!==t&&jt(e,o,{get:()=>a[o],enumerable:!(n=Za(a,o))||n.enumerable});return e};var ai=e=>ti(jt({},"__esModule",{value:!0}),e);var Oi={};ei(Oi,{AIAutocomplete:()=>Wa,AIAutocompleteDropdown:()=>Kt,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,focusesInputOnSelect:()=>d.focusesInputOnSelect,formatDate:()=>d.formatDate,formatDateRange:()=>d.formatDateRange,formatOptionCount:()=>d.formatOptionCount,formatPlace:()=>d.formatPlace,formatTime:()=>d.formatTime,isTouchPrimary:()=>d.isTouchPrimary,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:()=>_t,visibleDateRange:()=>d.visibleDateRange,withSkippedParams:()=>d.withSkippedParams});module.exports=ai(Oi);var d=require("@magicx-eng/ai-autocomplete-vanilla");var Q=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
|
|
@@ -157,6 +157,30 @@
|
|
|
157
157
|
background: var(--aia-completed-pill-bg-active, rgba(189, 189, 189, 0.35));
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
/* A chip whose removal finds items when the search found none (custom_fields.blocking_filters).
|
|
161
|
+
Greyed out at half opacity. After the hover rule, so it stays greyed while pointed at. */
|
|
162
|
+
:where(.aia-input-IW-P-) strong[class~="magicx-aia-segment--blocking"] {
|
|
163
|
+
opacity: var(--aia-blocking-chip-opacity, 0.5);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* The \xD7 of a greyed chip keeps its normal weight: its opacity multiplies with the chip's, so it is divided back out. */
|
|
167
|
+
:where(.aia-input-IW-P-)
|
|
168
|
+
strong[class~="magicx-aia-segment--blocking"]
|
|
169
|
+
span[class~="magicx-aia-segment-remove"] {
|
|
170
|
+
opacity: calc(var(--aia-chip-remove-opacity, 0.32) / var(--aia-blocking-chip-opacity, 0.5));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@media (hover: hover) {
|
|
174
|
+
:where(.aia-input-IW-P-)
|
|
175
|
+
strong[class~="magicx-aia-segment--blocking"]
|
|
176
|
+
span[class~="magicx-aia-segment-remove"]:hover {
|
|
177
|
+
opacity: calc(
|
|
178
|
+
var(--aia-chip-remove-opacity-hover, 0.7) /
|
|
179
|
+
var(--aia-blocking-chip-opacity, 0.5)
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
160
184
|
/* The picked option's icon inside a completed chip (see \`icon_svg\` on
|
|
161
185
|
CompletedParamState). Inline-block, one em square and sat on the text
|
|
162
186
|
baseline; the chip is one inline-block, so the icon never ends a line
|
|
@@ -439,7 +463,7 @@
|
|
|
439
463
|
transition: none;
|
|
440
464
|
}
|
|
441
465
|
}
|
|
442
|
-
`,document.head.appendChild(e)}var wt={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
|
|
466
|
+
`,document.head.appendChild(e)}var wt={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 M=require("@magicx-eng/ai-autocomplete-vanilla"),te=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
443
467
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
444
468
|
* Consumer CSS always wins without !important.
|
|
445
469
|
*
|
|
@@ -1164,13 +1188,15 @@
|
|
|
1164
1188
|
);
|
|
1165
1189
|
}
|
|
1166
1190
|
}
|
|
1167
|
-
/* While the panel glides
|
|
1168
|
-
the width it lands at
|
|
1169
|
-
|
|
1170
|
-
|
|
1191
|
+
/* While the panel glides to a new width (panelMorph.ts), its new content is
|
|
1192
|
+
laid out at the width it lands at, so it never rewraps under the glide:
|
|
1193
|
+
wider, the panel, which clips, reveals it as it opens; narrower, it starts
|
|
1194
|
+
at its final width instead of squeezing frame by frame. The leaving copy
|
|
1195
|
+
keeps its own width. */
|
|
1171
1196
|
[data-aia-dropdown][data-aia-glide-width]
|
|
1172
1197
|
> :not(.magicx-aia-panel-ghost):not([data-aia-scroll-arrow]) {
|
|
1173
1198
|
min-width: var(--aia-glide-content-width, auto);
|
|
1199
|
+
max-width: var(--aia-glide-content-width, none);
|
|
1174
1200
|
}
|
|
1175
1201
|
/* The All row's tile shows the first options' pictures together: two side by
|
|
1176
1202
|
side, three as a tall half and two quarters, four in a 2x2 grid. Each is
|
|
@@ -1811,7 +1837,7 @@
|
|
|
1811
1837
|
opacity: 1;
|
|
1812
1838
|
}
|
|
1813
1839
|
}
|
|
1814
|
-
`,document.head.appendChild(e)}var
|
|
1840
|
+
`,document.head.appendChild(e)}var Re={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",seeAllSpin:"aia-seeAllSpin-jlsZP",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};var ae=require("@magicx-eng/ai-autocomplete-vanilla"),ua=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) ---
|
|
1815
1841
|
|
|
1816
1842
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1817
1843
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -2008,7 +2034,7 @@
|
|
|
2008
2034
|
opacity: 0.8;
|
|
2009
2035
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
2010
2036
|
}
|
|
2011
|
-
`,document.head.appendChild(e)}var
|
|
2037
|
+
`,document.head.appendChild(e)}var ee={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 ve=require("react/jsx-runtime"),ii=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ma({options:e,activeIndex:a,listboxId:t,view:n,selection:o,onSelect:l,onHighlight:s,onUnhighlight:p,onPreviousMonth:v,onNextMonth:x}){let k=(0,ae.isoDate)(new Date),g=(0,ae.visibleDateRange)({pendingStart:o.rangeStart,highlightedIso:(0,ae.cellIso)(e[a]),selected:o.selectedRange,floor:o.floor});return(0,ve.jsxs)("div",{className:ee.datepicker,"data-aia-datepicker":"",children:[(0,ve.jsxs)("div",{className:ee.header,children:[(0,ve.jsx)("button",{type:"button",tabIndex:-1,className:ee.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:m=>m.preventDefault(),onClick:v,children:"\u2039"}),(0,ve.jsx)("span",{className:ee.month,"data-aia-date-month":"","aria-live":"polite",children:(0,ae.monthLabel)(n)}),(0,ve.jsx)("button",{type:"button",tabIndex:-1,className:ee.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:m=>m.preventDefault(),onClick:x,children:"\u203A"})]}),(0,ve.jsx)("div",{className:ee.weekdays,"aria-hidden":"true",children:ae.WEEKDAY_LABELS.map((m,h)=>(0,ve.jsx)("span",{className:ee.weekday,children:m},ii[h]))}),(0,ve.jsx)("div",{className:ee.grid,"data-aia-date-grid":"",children:e.map((m,h)=>(0,ve.jsx)(oi,{option:m,id:`${t}-option-${h}`,index:h,isHighlighted:h===a&&m.is_tappable,isToday:(0,ae.cellIso)(m)===k,isPast:(0,ae.isDimmedDay)((0,ae.cellIso)(m),k,o.floor),marks:(0,ae.dateCellMarks)((0,ae.cellIso)(m),{selectedIso:o.selectedIso,range:g,references:o.references}),onSelect:l,onHighlight:s,onUnhighlight:p},(0,ae.cellIso)(m)??`pad-${h}`))})]})}function oi({option:e,id:a,index:t,isHighlighted:n,isToday:o,isPast:l,marks:s,onSelect:p,onHighlight:v,onUnhighlight:x}){let[k,g]=(0,ua.useState)(!1),m=(0,ae.cellDay)(e);if(m==null)return(0,ve.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${ee.cell} ${ee.blank}`});let h=()=>{g(!0),p(e),setTimeout(()=>g(!1),170)},S=[ee.cell,ee.day,l?ee.past:"",n?ee.highlighted:"",o?ee.today:"",s.inRange?ee.inRange:"",s.selected?ee.selected:"",s.reference?ee.reference:"",k?ee.pressed:""].filter(Boolean).join(" ");return(0,ve.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":n,"aria-label":e.text,tabIndex:0,className:S,onClick:h,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),h())},onMouseEnter:()=>v(t),onMouseLeave:x?()=>x(t):void 0,children:(0,ve.jsx)("span",{className:ee.number,children:m})})}var dt=require("@magicx-eng/ai-autocomplete-vanilla"),Ht=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 {
|
|
2012
2038
|
display: flex;
|
|
2013
2039
|
flex-wrap: wrap;
|
|
2014
2040
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -2048,7 +2074,7 @@
|
|
|
2048
2074
|
.aia-cluster[data-justify="around"] {
|
|
2049
2075
|
justify-content: space-around;
|
|
2050
2076
|
}
|
|
2051
|
-
`,document.head.appendChild(e)}var
|
|
2077
|
+
`,document.head.appendChild(e)}var $t=require("react/jsx-runtime");function Et({gap:e,align:a="center",justify:t="start",noWrap:n=!1,inline:o=!1,className:l,children:s,...p}){let v=e?{"--aia-cluster-gap":e}:void 0,x={className:l?`aia-cluster ${l}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":n||void 0,"data-inline":o||void 0,style:v,...p};return o?(0,$t.jsx)("span",{...x,children:s}):(0,$t.jsx)("div",{...x,children:s})}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
|
|
2052
2078
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
2053
2079
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
2054
2080
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -2196,7 +2222,7 @@
|
|
|
2196
2222
|
justify-content: flex-end;
|
|
2197
2223
|
}
|
|
2198
2224
|
}
|
|
2199
|
-
`,document.head.appendChild(e)}var et={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 _e=require("react/jsx-runtime");function
|
|
2225
|
+
`,document.head.appendChild(e)}var et={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 _e=require("react/jsx-runtime");function ga({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,dt.uiStringsFor)()}){let{key:n,hint:o}=(0,dt.getFooterHint)(e,a,t),[l,s]=(0,Ht.useState)(dt.ATTRIBUTION_URL);return(0,Ht.useEffect)(()=>{s((0,dt.buildAttributionUrl)())},[]),(0,_e.jsx)("footer",{className:et.footer,"data-aia-footer":"",children:(0,_e.jsxs)(Et,{justify:"between",noWrap:!0,className:et.row,children:[(0,_e.jsxs)(Et,{gap:"5px",className:et.hintGroup,children:[(0,_e.jsx)("kbd",{className:et.key,children:n}),(0,_e.jsx)("span",{className:et.hint,children:o})]}),(0,_e.jsx)("a",{className:et.brandLink,href:l,target:"_blank",rel:"noopener noreferrer",children:(0,_e.jsx)("span",{className:et.badge,children:(0,_e.jsx)("span",{className:et.brand,children:"Powered by Intent-1"})})})]})})}var se=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
|
|
2200
2226
|
Angular copy). The three are kept identical by
|
|
2201
2227
|
packages/vanilla/tests/render/locationFieldParity.test.ts. */
|
|
2202
2228
|
.aia-location-6-fsr {
|
|
@@ -2330,7 +2356,7 @@
|
|
|
2330
2356
|
.aia-loadingBar-OLCr4:nth-child(3) {
|
|
2331
2357
|
width: 60%;
|
|
2332
2358
|
}
|
|
2333
|
-
`,document.head.appendChild(e)}var
|
|
2359
|
+
`,document.head.appendChild(e)}var ie={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 U=require("react/jsx-runtime"),ni=0;function Rt(e){return e.getRootNode().activeElement??null}function wa(e){return e.getRootNode().getSelection?.()??document.getSelection()}function fa(e){if(!e.isContentEditable)return null;let a=wa(e);if(!a||a.rangeCount===0)return null;let t=a.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function ba(e,a){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=wa(e);if(!t)return;let n=a;(!n||!n.startContainer.isConnected||!e.contains(n.startContainer))&&(n=document.createRange(),n.selectNodeContents(e),n.collapse(!1)),t.removeAllRanges(),t.addRange(n)}var ri=(0,U.jsxs)("svg",{className:ie.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,U.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,U.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),si=(0,U.jsxs)("svg",{className:ie.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,U.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,U.jsx)("path",{d:"m20 20-3.5-3.5"})]});function va({view:e,searchLabel:a,noResultsLabel:t,useTypedLabel:n,widgetFocused:o,reediting:l=!1,visible:s=!0,interactive:p=!0,onQuery:v,onMove:x,onCommit:k,onFocusChange:g}){let m=(0,se.useRef)(null),h=(0,se.useRef)(null),S=(0,se.useRef)(null),C=(0,se.useRef)(null),I=(0,se.useRef)(null),F=(0,se.useRef)(!1),N=(0,se.useRef)(!1),re=(0,se.useRef)(!1),K=(0,se.useRef)(!1),R=(0,se.useRef)(o);R.current=o;let H=(0,se.useRef)(g);H.current=g;let _=i=>{K.current=i,g(i)},ne=()=>{let i=m.current;return i!=null&&Rt(i)===i},fe=()=>{let i=h.current;if(!i)return;let y=Rt(i);y instanceof HTMLElement&&y!==m.current&&y!==document.body&&!i.contains(y)&&(C.current=y,I.current=fa(y))},pe=i=>{let y=h.current;!y||!(i instanceof HTMLElement)||i===C.current||i===document.body||y.contains(i)||(C.current=i,I.current=fa(i))},$=(0,se.useRef)(null);$.current===null&&($.current=`aia-location-${++ni}`);let E=`${$.current}-row-`;(0,se.useEffect)(()=>{let i=m.current;i&&i.value!==e.query&&Rt(i)!==i&&(i.value=e.query)},[e.query]),(0,se.useEffect)(()=>{o&&(l&&!re.current&&(N.current=!1),re.current=l);let i=m.current;if(i){if(!s&&ne()){N.current=!0,Z();return}if(!o){setTimeout(()=>{if(R.current)return;let y=C.current;y&&Rt(y)===y||(N.current=!1)},0);return}if(!(!l||N.current||!p||ne())){if(fe(),_(!0),i.focus({preventScroll:!0}),!ne()){N.current=!0,_(!1);return}i.value&&i.select()}}}),(0,se.useLayoutEffect)(()=>()=>{if(!K.current)return;let i=m.current,y=C.current;y?.isConnected&&i&&Rt(i)===i&&(F.current=!0,ba(y,I.current),F.current=!1),K.current=!1,H.current(!1)},[]);let Z=(i=!1)=>{i&&(N.current=!0);let y=C.current;y?.isConnected&&ne()&&(F.current=!0,ba(y,I.current),F.current=!1),_(!1)},Se=e.query.trim(),Ce=e.highlighted>=0&&e.highlighted<e.places.length?`${E}${e.highlighted}`:void 0,he=null;return e.places.length>0?he=e.places.map((i,y)=>(0,U.jsxs)("div",{id:`${E}${y}`,role:"option","aria-selected":y===e.highlighted,className:y===e.highlighted?`${ie.row} ${ie.highlighted}`:ie.row,"data-aia-location-row":"","data-aia-index":y,onClick:()=>{p&&(Z(!0),k(y))},children:[(0,U.jsx)("span",{className:ie.pin,children:ri}),(0,U.jsxs)("span",{className:ie.text,children:[(0,U.jsx)("span",{className:ie.name,children:i.name}),i.secondary&&(0,U.jsx)("span",{className:ie.secondary,children:i.secondary})]})]},i.id)):e.status==="loading"?he=(0,U.jsxs)("div",{className:ie.loading,"data-aia-location-loading":"",children:[(0,U.jsx)("span",{className:ie.loadingBar}),(0,U.jsx)("span",{className:ie.loadingBar}),(0,U.jsx)("span",{className:ie.loadingBar})]}):Se&&(he=(0,U.jsxs)("div",{className:ie.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,U.jsx)("span",{className:ie.empty,children:t}),(0,U.jsx)("span",{children:n})]})),(0,U.jsxs)("div",{ref:h,className:ie.location,"data-aia-location":"",onMouseDown:i=>{!(i.target instanceof Node)||!S.current?.contains(i.target)||(i.stopPropagation(),fe(),_(!0))},children:[(0,U.jsxs)("label",{ref:S,className:ie.field,children:[si,(0,U.jsx)("input",{ref:m,type:"text",className:ie.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:a,"aria-label":a,"aria-activedescendant":Ce,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:s?0:-1,onChange:i=>v(i.target.value),onFocus:i=>{pe(i.relatedTarget),_(!0)},onBlur:()=>{F.current||(N.current=!0,_(!1))},onKeyDown:i=>{if(!i.nativeEvent.isComposing)switch(i.key){case"ArrowDown":case"ArrowUp":i.preventDefault(),x(i.key==="ArrowDown"?1:-1);return;case"Enter":if(i.preventDefault(),!p)return;Z(!0),k();return;case"Escape":i.preventDefault(),i.stopPropagation(),N.current=!0,Z();return;case"Backspace":if(i.currentTarget.value!=="")return;i.preventDefault(),N.current=!0,Z();return}}})]}),(0,U.jsx)("div",{className:ie.results,"data-aia-location-results":"","aria-live":"polite",children:he})]})}var Bt=require("@magicx-eng/ai-autocomplete-vanilla");var xa=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,
|
|
2334
2360
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
2335
2361
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
2336
2362
|
as it was when the outline was dashed. */
|
|
@@ -2488,7 +2514,7 @@
|
|
|
2488
2514
|
opacity: 0;
|
|
2489
2515
|
}
|
|
2490
2516
|
}
|
|
2491
|
-
`,document.head.appendChild(e)}var Ve={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
|
|
2517
|
+
`,document.head.appendChild(e)}var Ve={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 ct=require("react/jsx-runtime"),Zt={selected:1,first:.7,next:.4,last:.2};function ya({label:e,state:a,active:t,rounded:n,loading:o,smartSuggestion:l,completionHeader:s,onClick:p}){let v=[Ve.pill,n?Ve.rounded:"",o?Ve.skeleton:""].filter(Boolean).join(" ");return(0,ct.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":l?s?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:v,style:{"--aia-pill-opacity":Zt[a]},onMouseDown:x=>x.preventDefault(),onClick:o?void 0:p,disabled:o,children:l?(0,ct.jsxs)(ct.Fragment,{children:[(0,ct.jsx)("span",{className:`${Ve.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,ct.jsx)("span",{className:`${Ve.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:xa.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 {
|
|
2492
2518
|
position: relative;
|
|
2493
2519
|
z-index: 1;
|
|
2494
2520
|
pointer-events: auto;
|
|
@@ -2498,7 +2524,7 @@
|
|
|
2498
2524
|
align-items: center;
|
|
2499
2525
|
vertical-align: middle;
|
|
2500
2526
|
}
|
|
2501
|
-
`,document.head.appendChild(e)}var
|
|
2527
|
+
`,document.head.appendChild(e)}var Xt={list:"aia-list-qvLqO"};var zt=require("react/jsx-runtime"),li=[125,69];function ka(e){return e===0?"first":e===1?"next":"last"}function Wt({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:n,rounded:o,loading:l}){return l&&e.length===0?(0,zt.jsx)("span",{className:Xt.list,"data-aia-pill-list-loading":"",children:li.map((s,p)=>(0,zt.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Ve.pill} ${o?Ve.rounded:""} ${Ve.skeleton}`,style:{width:s,"--aia-pill-opacity":Zt[ka(p)]}},`skel-${s}`))}):(0,zt.jsx)("span",{className:Xt.list,"data-aia-pill-list-loading":l?"":void 0,children:e.map((s,p)=>{let v=!!n&&p===a;return(0,zt.jsx)(ya,{label:s.text,state:v?"selected":ka(p),selected:v,active:p===a,rounded:o,loading:l,smartSuggestion:(0,Bt.isSmartSuggestion)(s),completionHeader:(0,Bt.isTraditionalAutocompleteSuggestion)(s),onClick:()=>t(p)},`${s.parameter}-${s.text}`)})})}var ze=require("@magicx-eng/ai-autocomplete-vanilla"),xe=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
|
|
2502
2528
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
2503
2529
|
theming one package sees the same result in the other.
|
|
2504
2530
|
|
|
@@ -3125,7 +3151,7 @@
|
|
|
3125
3151
|
opacity: 0.01;
|
|
3126
3152
|
}
|
|
3127
3153
|
}
|
|
3128
|
-
`,document.head.appendChild(e)}var
|
|
3154
|
+
`,document.head.appendChild(e)}var oe={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 q=require("react/jsx-runtime");function Sa({products:e,listboxId:a,onSelect:t,busyProductId:n=null,onAddToCart:o,onFocusChange:l,focusable:s=!0,loading:p=!1,layout:v="row",imageFallback:x="image",showVendor:k=!0,strings:g=(0,ze.uiStringsFor)()}){let m=e.length>0,h=(0,xe.useRef)(null);if((0,xe.useEffect)(()=>{let C=h.current;if(!(!m||!C))return(0,ze.attachProductRowWheel)(C)},[m]),!m)return null;let S=`${a}-products-label`;return(0,q.jsxs)("section",{className:oe.section,"data-aia-products":"","data-aia-loading":p?"":void 0,"data-aia-products-layout":v,role:"group","aria-labelledby":S,children:[(0,q.jsx)("div",{className:oe.label,id:S,"data-aia-products-label":"",children:g.products}),(0,q.jsx)("div",{ref:h,className:oe.row,"data-aia-products-row":"",children:e.map((C,I)=>(0,q.jsx)(di,{product:C,id:`${a}-product-${I}`,onSelect:t,busy:C.id===n,onAddToCart:o,onFocusChange:l,focusable:s,imageFallback:x,showVendor:k,soldOut:g.soldOut,addToCart:g.addToCart},C.id))})]})}function di({product:e,id:a,onSelect:t,busy:n,onAddToCart:o,onFocusChange:l,focusable:s,imageFallback:p,showVendor:v,soldOut:x,addToCart:k}){let g=!!o&&e.available!==!1,[m,h]=(0,xe.useState)(null),S=I=>{I.relatedTarget?.closest("[data-aia-dropdown]")||l?.(!1)},C=I=>{I.metaKey||I.ctrlKey||I.shiftKey||I.altKey||I.button!==0||(I.preventDefault(),t(e))};return(0,q.jsxs)("a",{id:a,className:oe.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":g?"":void 0,"data-aia-product-state":n?"busy":void 0,"aria-busy":n?!0:void 0,role:"option","aria-selected":!1,style:m?{"--aia-product-photo-fill-x":String(m.x),"--aia-product-photo-fill-y":String(m.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:C,onKeyDown:I=>{I.key!=="Enter"&&I.key!==" "||(I.preventDefault(),t(e))},onFocus:()=>l?.(!0),onBlur:S,children:[(0,q.jsx)(hi,{sources:(0,ze.productImageSources)(e.imageUrl),title:e.title,fallback:p,onPhotoFill:h},(0,ze.productImageSrc)(e.imageUrl)??""),(0,q.jsxs)("span",{className:oe.body,children:[v&&e.vendor?(0,q.jsx)("span",{className:oe.vendor,children:e.vendor}):null,(0,q.jsx)("span",{className:oe.title,children:e.title}),e.price?(0,q.jsxs)("span",{className:oe.price,children:[e.price,e.compareAtPrice?(0,q.jsx)("s",{className:oe.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,q.jsx)("span",{className:oe.badge,children:x}):null]}),g&&o?(0,q.jsx)(pi,{product:e,label:`${k}: ${e.title}`,focusable:s,onAddToCart:o,onFocus:()=>l?.(!0),onBlur:S},ci(e)):null]})}function ci(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(a=>a??"").join("\0")}function pi({product:e,label:a,focusable:t,onAddToCart:n,onFocus:o,onBlur:l}){let[s,p]=(0,xe.useState)(null),v=(0,xe.useRef)(null),x=(0,xe.useRef)(e);x.current=e;let k=(0,xe.useRef)(!0);(0,xe.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let g=h=>{v.current=h,k.current&&p(h)},m=h=>{if(h.preventDefault(),h.stopPropagation(),v.current==="adding")return;g("adding");let S;try{S=Promise.resolve(n(x.current))}catch(C){S=Promise.reject(C)}S.then(()=>g("added"),()=>g(null))};return(0,q.jsx)("span",{className:oe.cart,"data-aia-product-cart":"","data-aia-cart-state":s??void 0,"aria-busy":s==="adding"?!0:void 0,role:"button","aria-label":a,tabIndex:t?0:-1,onClick:m,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||m(h)},onFocus:h=>{h.stopPropagation(),o()},onBlur:h=>{h.stopPropagation(),l(h)},children:(0,q.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,q.jsx)("path",{className:oe.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,q.jsx)("path",{className:oe.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,q.jsx)("path",{className:oe.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,q.jsx)("path",{className:oe.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,q.jsx)("circle",{className:oe.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,q.jsx)("circle",{className:oe.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function hi({sources:e,title:a,fallback:t,onPhotoFill:n}){let[o,l]=(0,xe.useState)(0),s=e[o],p=!!s,[v,x]=(0,xe.useState)(null),k=!p&&t==="initial";return(0,xe.useEffect)(()=>()=>n(null),[n]),(0,q.jsxs)("span",{className:oe.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!p&&!k?"":void 0,"data-aia-product-initial":k?"":void 0,"data-aia-image-loaded":p&&v===s?"":void 0,children:[p?(0,q.jsx)("img",{className:oe.image,src:s,alt:"",loading:"lazy",decoding:"async",onLoad:g=>{x(s),n((0,ze.productPhotoFill)(g.currentTarget.naturalWidth,g.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&n(null),l(g=>g+1)}}):null,k?(0,ze.productInitial)(a):null]})}var W=require("@magicx-eng/ai-autocomplete-vanilla"),Le=require("react");var Ca=require("@magicx-eng/ai-autocomplete-vanilla"),Gt=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 {
|
|
3129
3155
|
display: grid;
|
|
3130
3156
|
grid-template-columns: repeat(
|
|
3131
3157
|
auto-fit,
|
|
@@ -3169,7 +3195,7 @@
|
|
|
3169
3195
|
:where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
|
|
3170
3196
|
max-height: var(--aia-grid-max-height, 120px);
|
|
3171
3197
|
}
|
|
3172
|
-
`,document.head.appendChild(e)}var
|
|
3198
|
+
`,document.head.appendChild(e)}var Pa=require("react/jsx-runtime");function Ta({min:e="16rem",max:a,gap:t,scroll:n=!1,maxHeight:o,scrollResetKey:l,cols:s,template:p,innerRef:v,className:x,children:k,...g}){let m=(0,Gt.useRef)(null);(0,Gt.useLayoutEffect)(()=>{if(l===void 0)return;let S=m.current;S&&(S.scrollTop=0)},[l]);let h={"--aia-grid-min":e};return a&&(h["--aia-grid-max"]=a),t&&(h["--aia-grid-gap"]=t),o&&(h["--aia-grid-max-height"]=o),s&&(h.gridTemplateColumns=(0,Ca.optionsGridTemplateColumns)(s)),p&&(h.gridTemplateColumns=p),(0,Pa.jsx)("div",{ref:S=>{m.current=S,v?.(S)},className:x?`aia-grid ${x}`:"aia-grid","data-scroll":n||void 0,style:h,...g,children:k})}var ce=require("@magicx-eng/ai-autocomplete-vanilla"),ye=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 {
|
|
3173
3199
|
position: relative;
|
|
3174
3200
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
3175
3201
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -3287,31 +3313,22 @@
|
|
|
3287
3313
|
opacity: 0.5;
|
|
3288
3314
|
}
|
|
3289
3315
|
|
|
3290
|
-
/* Press feedback: the picked option
|
|
3291
|
-
|
|
3316
|
+
/* Press feedback: the picked option fills with the option background (the
|
|
3317
|
+
row's own background transition) while every other option steps back in
|
|
3318
|
+
opacity. No scale: a row that shrinks and springs back reads as a jolt,
|
|
3319
|
+
and the next question then arrives on top of it. The press stays on until
|
|
3320
|
+
the options leave, so the picked row never flashes back to normal first. */
|
|
3292
3321
|
.aia-pressed-98o-r {
|
|
3293
3322
|
color: var(--aia-option-color-selected, var(--aia-color-text-default, #fff));
|
|
3294
|
-
|
|
3323
|
+
background: var(--aia-option-bg, transparent);
|
|
3324
|
+
font-weight: 500;
|
|
3295
3325
|
}
|
|
3296
3326
|
|
|
3297
3327
|
[role="listbox"]:has(.aia-pressed-98o-r) .aia-item-d4vpD:not(.aia-pressed-98o-r) {
|
|
3298
3328
|
opacity: 0.35;
|
|
3299
|
-
transition:
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
@keyframes aia-pressCompress-ICV3q {
|
|
3303
|
-
0% {
|
|
3304
|
-
transform: scale(1);
|
|
3305
|
-
}
|
|
3306
|
-
25% {
|
|
3307
|
-
transform: scale(0.93);
|
|
3308
|
-
}
|
|
3309
|
-
60% {
|
|
3310
|
-
transform: scale(0.93);
|
|
3311
|
-
}
|
|
3312
|
-
100% {
|
|
3313
|
-
transform: scale(1);
|
|
3314
|
-
}
|
|
3329
|
+
transition:
|
|
3330
|
+
background-color 180ms ease,
|
|
3331
|
+
opacity 120ms ease;
|
|
3315
3332
|
}
|
|
3316
3333
|
|
|
3317
3334
|
/* Scroll hint \u2014 the last visible row of a scrollable web grid fades toward its
|
|
@@ -3600,8 +3617,8 @@
|
|
|
3600
3617
|
display: inline-flex;
|
|
3601
3618
|
align-items: center;
|
|
3602
3619
|
justify-content: center;
|
|
3603
|
-
/*
|
|
3604
|
-
|
|
3620
|
+
/* An indent inherited from the row (an icon row hangs its text with one)
|
|
3621
|
+
would slide the mark out of the box. */
|
|
3605
3622
|
text-indent: 0;
|
|
3606
3623
|
flex: 0 0 18px;
|
|
3607
3624
|
width: 18px;
|
|
@@ -3610,14 +3627,61 @@
|
|
|
3610
3627
|
border-radius: 6px;
|
|
3611
3628
|
background: var(--aia-surface);
|
|
3612
3629
|
color: transparent;
|
|
3613
|
-
font-size: 11px;
|
|
3614
3630
|
line-height: 1;
|
|
3631
|
+
/* A tick animates the box alone: the row stays put (no press, no dimming),
|
|
3632
|
+
since a multi-select tap keeps the list open for the next tick. */
|
|
3633
|
+
transition:
|
|
3634
|
+
background-color 140ms ease,
|
|
3635
|
+
border-color 140ms ease,
|
|
3636
|
+
color 140ms ease;
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
/* The tick is drawn, not typed: a rounded stroke with a short left leg and a
|
|
3640
|
+
long right one, shaped like Apple's SF Symbols "checkmark". The text "\u2713"
|
|
3641
|
+
it replaces changes with the font and reads thin and cheap. It is painted
|
|
3642
|
+
in the box's text colour, so it fades in with the fill. */
|
|
3643
|
+
.aia-checkbox-KGRhg::after {
|
|
3644
|
+
content: "";
|
|
3645
|
+
width: 14px;
|
|
3646
|
+
height: 14px;
|
|
3647
|
+
background: currentColor;
|
|
3648
|
+
-webkit-mask:
|
|
3649
|
+
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.2 12.6l4.6 4.6 9-10.6' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
|
|
3650
|
+
center / contain no-repeat;
|
|
3651
|
+
mask:
|
|
3652
|
+
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.2 12.6l4.6 4.6 9-10.6' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
|
|
3653
|
+
center / contain no-repeat;
|
|
3654
|
+
}
|
|
3655
|
+
|
|
3656
|
+
/* Forced colours replace backgrounds with Canvas, which would hide a tick
|
|
3657
|
+
painted as a background; draw it in the forced text colour instead. */
|
|
3658
|
+
@media (forced-colors: active) {
|
|
3659
|
+
.aia-checkbox-KGRhg[data-checked="true"]::after {
|
|
3660
|
+
forced-color-adjust: none;
|
|
3661
|
+
background: CanvasText;
|
|
3662
|
+
}
|
|
3615
3663
|
}
|
|
3616
3664
|
|
|
3617
3665
|
.aia-checkbox-KGRhg[data-checked="true"] {
|
|
3618
3666
|
background: var(--aia-confirm-bg, #262626);
|
|
3619
3667
|
border-color: var(--aia-confirm-bg, #262626);
|
|
3620
3668
|
color: var(--aia-confirm-color, #ffffff);
|
|
3669
|
+
animation: aia-checkPop-CCWRW 160ms ease-out;
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3672
|
+
@keyframes aia-checkPop-CCWRW {
|
|
3673
|
+
0% {
|
|
3674
|
+
transform: scale(0.82);
|
|
3675
|
+
}
|
|
3676
|
+
100% {
|
|
3677
|
+
transform: scale(1);
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
3680
|
+
|
|
3681
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3682
|
+
.aia-checkbox-KGRhg[data-checked="true"] {
|
|
3683
|
+
animation: none;
|
|
3684
|
+
}
|
|
3621
3685
|
}
|
|
3622
3686
|
|
|
3623
3687
|
.aia-item-d4vpD:has(.aia-checkbox-KGRhg[data-checked="true"]) {
|
|
@@ -3693,9 +3757,8 @@
|
|
|
3693
3757
|
width: 18px;
|
|
3694
3758
|
height: 18px;
|
|
3695
3759
|
border-radius: 6px;
|
|
3696
|
-
font-size: 11px;
|
|
3697
3760
|
}
|
|
3698
|
-
`,document.head.appendChild(e)}var
|
|
3761
|
+
`,document.head.appendChild(e)}var le={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",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",checkPop:"aia-checkPop-CCWRW"};var de=require("react/jsx-runtime"),ui=2e3,mi=170;function Ia({option:e,isHighlighted:a,checked:t,onSelect:n,onHighlight:o,onUnhighlight:l,id:s,loading:p,showIcon:v=!0,showImage:x=!0,showCount:k=!0,scrollHint:g,enterDelayMs:m=0}){let[h]=(0,ye.useState)(m),[S,C]=(0,ye.useState)(!1),I=x?(0,ce.optionImageSources)(e.image_url):[],F=I[0]??null,[N,re]=(0,ye.useState)([]),K=I.find(i=>!N.includes(i))??null,R=x?(e.imageCollage??[]).map(i=>(0,ce.optionImageSources)(i)[0]).filter(i=>i!==void 0):[],[H,_]=(0,ye.useState)(!1),[ne,fe]=(0,ye.useState)(null),pe=(0,ye.useMemo)(()=>!F&&v&&e.icon_svg?(0,ce.sanitizeOptionIconSvg)(e.icon_svg):null,[F,v,e.icon_svg]),$=k?(0,ce.formatOptionCount)(e.item_count):null,E=(0,ye.useRef)(void 0),Z=(0,ye.useRef)(null),Se=(0,ye.useRef)(Number.NEGATIVE_INFINITY);(0,ye.useEffect)(()=>()=>clearTimeout(E.current),[]);let Ce=i=>{if(p||!e.is_tappable)return;let y=i?.currentTarget,ue=t!==void 0&&y!==void 0&&i!==void 0&&!(0,ce.isMultiSelectToggleTap)(y,y.querySelector("[data-aia-checkbox]"),i),me=t!==void 0&&!ue;if(!me){let we=performance.now();if(we-Se.current<mi)return;Se.current=we}ue?n(e,{commit:!0}):n(e),!me&&(C(!0),clearTimeout(E.current),E.current=setTimeout(()=>{C(!1),(0,ce.clearPanelMorphPressLook)(Z.current?.closest("[data-aia-dropdown]"))},ui))},he=[le.item,a&&!p?le.highlighted:"",e.liveMatch&&!p?le.liveMatch:"",e.is_tappable?le.tappable:le.nonTappable,S?le.pressed:"",g?le.scrollHint:""].filter(Boolean).join(" ");return(0,de.jsx)("div",{ref:Z,id:s,role:"option","data-aia-option":"","data-aia-loading":p?"":void 0,"data-aia-icon":pe&&e.icon?e.icon:void 0,"data-aia-image":F?"":void 0,"data-aia-item-count":$!==null?e.item_count:void 0,"aria-selected":t??a,className:he,style:{[ce.OPTION_ENTER_DELAY_VAR]:`${h}ms`},tabIndex:p||!e.is_tappable?-1:0,onClick:Ce,onKeyDown:i=>{!p&&e.is_tappable&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),Ce())},onMouseEnter:!p&&e.is_tappable?o:void 0,onMouseLeave:l,children:(0,de.jsxs)("span",{className:le.content,children:[t!==void 0&&e.is_tappable&&(0,de.jsx)("span",{className:le.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t}),F&&R.length>1&&(0,de.jsx)("span",{className:`${le.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":R.length,"data-aia-image-loaded":H?"":void 0,children:R.map(i=>(0,de.jsx)("img",{src:i,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>_(!0),onError:y=>{y.currentTarget.hidden=!0}},i))}),F&&R.length<=1&&(0,de.jsx)("span",{className:`${le.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":K!==null&&ne===K?"":void 0,children:(0,de.jsx)("img",{src:K??F,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:K===null,onLoad:()=>fe(K),onError:()=>{K!==null&&re(i=>[...i,K])}})}),pe&&(0,de.jsx)("span",{className:`${le.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:pe}}),(0,de.jsxs)("span",{className:le.text,children:[e.matchedText?(0,ce.highlightParts)((0,ce.optionLabel)(e),e.matchedText).map((i,y)=>i.bold?(0,de.jsx)("strong",{className:`${le.match} magicx-aia-option-match`,"data-aia-match-partial":i.partial?"":void 0,children:i.text},y):i.text):(0,ce.optionLabel)(e),e.parameterLabel&&(0,de.jsxs)(de.Fragment,{children:[" ",(0,de.jsx)("span",{className:`${le.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,de.jsx)("span",{className:le.tag,children:e.tag}),$!==null&&(0,de.jsx)("span",{className:`${le.count} magicx-aia-option-count`,children:$})]})})}var Jt=require("react/jsx-runtime");function gi(){let[e,a]=(0,Le.useState)(W.isOptionsGridMobileViewport);return(0,Le.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(W.OPTIONS_GRID_MOBILE_QUERY),n=()=>a(t.matches);return n(),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[]),e}function Aa({options:e,activeIndex:a,picked:t,onSelect:n,onHighlight:o,onUnhighlight:l,listboxId:s,loading:p,groupKey:v="",optionsPosition:x="below",showIcons:k=!0,showImages:g=!0,showCounts:m=!0}){let h=gi(),S=(0,Le.useRef)(null),[C,I]=(0,Le.useState)(null),F=(0,Le.useRef)(null);(0,Le.useLayoutEffect)(()=>{if(p&&(0,W.sameOptionRows)(F.current,e))return;F.current=p?null:e;let R=S.current,H=R&&!p&&(0,W.needsOptionsGridMeasurement)(e.length,h),_=R?.closest("[data-aia-dropdown]");H&&_&&(0,W.releasePanelHug)(_);let ne=H?(0,W.measureOptionsGrid)(R):null;I(ne?(0,W.planOptionsGrid)(e.length,h,ne.rowWidths,ne.gridWidth):null)},[e,h,p]);let N=C??(0,W.planOptionsGrid)(e.length,h,null,null);(0,Le.useLayoutEffect)(()=>{let R=S.current?.closest("[data-aia-dropdown]");R&&(0,W.syncPanelHug)(R)},[N.template,h]);let re=p?-1:a;(0,Le.useLayoutEffect)(()=>{S.current&&(0,W.syncHighlightScroll)(S.current,re)},[re]);let K=(0,W.optionsShowLeadingVisuals)(e,k,g);return(0,Jt.jsx)(Ta,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:v,template:N.template,maxHeight:N.maxHeight,innerRef:R=>{S.current=R},"data-aia-group":v,children:e.map((R,H)=>(0,Jt.jsx)(Ia,{option:R,isHighlighted:H===a,checked:t?t.includes(R.text):void 0,onSelect:n,onHighlight:_=>{(0,W.pointerMayHighlight)(S.current,H,_)&&o(H)},onUnhighlight:l?_=>{(0,W.pointerMayHighlight)(S.current,-1,_)&&l(H)}:void 0,id:`${s}-option-${H}`,loading:p,showIcon:k&&K,showImage:g&&K,showCount:m,scrollHint:!p&&N.scrollHintIndices.includes(H),enterDelayMs:p?0:(0,W.optionEnterDelayMs)(H,N.cols,e.length,x)},`${v}\0${R.parameter??""}\0${R.text}`))})}var ge=require("@magicx-eng/ai-autocomplete-vanilla"),We=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) ---
|
|
3699
3762
|
|
|
3700
3763
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
3701
3764
|
time-wheel.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -3817,7 +3880,7 @@
|
|
|
3817
3880
|
.aia-done-llNY5:hover {
|
|
3818
3881
|
background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
|
|
3819
3882
|
}
|
|
3820
|
-
`,document.head.appendChild(e)}var
|
|
3883
|
+
`,document.head.appendChild(e)}var Be={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 Oe=require("react/jsx-runtime"),fi=120;function Ea({view:e,label:a,doneLabel:t,interactive:n=!0,onTimeChange:o,onTimeCommit:l}){return(0,Oe.jsxs)("div",{className:Be.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":a,onMouseDown:s=>s.preventDefault(),children:[(0,Oe.jsx)("span",{className:Be.value,"data-aia-time-value":"","aria-live":"polite",children:(0,ge.formatTime)(e.minutes)}),(0,Oe.jsxs)("div",{className:Be.columns,"aria-hidden":"true",children:[(0,Oe.jsx)("div",{className:Be.band}),ge.TIME_WHEEL_COLUMNS.map(s=>(0,Oe.jsxs)(We.Fragment,{children:[s==="minute"&&(0,Oe.jsx)("span",{className:Be.separator,children:":"}),(0,Oe.jsx)(bi,{column:s,minutes:e.minutes,interactive:n,onTimeChange:o})]},s))]}),(0,Oe.jsx)("button",{type:"button",tabIndex:-1,className:Be.done,"data-aia-time-done":"",onClick:()=>{n&&l()},children:t})]})}function bi({column:e,minutes:a,interactive:t,onTimeChange:n}){let o=(0,We.useRef)(null),l=(0,We.useRef)(null),s=(0,We.useRef)(null),p=(0,We.useRef)({minutes:a,interactive:t,onTimeChange:n});p.current={minutes:a,interactive:t,onTimeChange:n};let v=(0,ge.timeWheelIndex)(e,a);(0,We.useLayoutEffect)(()=>{let g=o.current;if(!g||s.current)return;let m=v*ge.TIME_WHEEL_ROW_HEIGHT;Math.abs(g.scrollTop-m)<1||(l.current=m,g.scrollTop=m)},[v]),(0,We.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]);let x=()=>{s.current=null;let g=o.current,m=p.current;if(!g||!m.interactive)return;let h=(0,ge.timeWheelIndexFromScroll)(e,g.scrollTop);h!==(0,ge.timeWheelIndex)(e,m.minutes)&&m.onTimeChange((0,ge.withTimeWheelIndex)(e,m.minutes,h))},k=()=>{let g=o.current;if(g){if(l.current!=null&&Math.abs(g.scrollTop-l.current)<1){l.current=null;return}l.current=null,s.current&&clearTimeout(s.current),s.current=setTimeout(x,fi)}};return(0,Oe.jsx)("div",{ref:o,className:Be.column,"data-aia-time-column":e,onScroll:k,children:(0,ge.timeWheelRows)(e).map((g,m)=>(0,Oe.jsx)("div",{className:m===v?`${Be.row} ${Be.selected}`:Be.row,"data-aia-time-row":"","data-aia-index":m,onClick:()=>{p.current.interactive&&n((0,ge.withTimeWheelIndex)(e,p.current.minutes,m))},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 {
|
|
3821
3884
|
display: flex;
|
|
3822
3885
|
flex-direction: column;
|
|
3823
3886
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -3832,7 +3895,7 @@
|
|
|
3832
3895
|
align-items: end;
|
|
3833
3896
|
}
|
|
3834
3897
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
3835
|
-
`,document.head.appendChild(e)}var
|
|
3898
|
+
`,document.head.appendChild(e)}var za=require("react/jsx-runtime");function Ra({space:e,align:a="stretch",className:t,children:n,...o}){let l=e?{"--aia-stack-space":e}:void 0;return(0,za.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:l,...o,children:n})}var j=require("react/jsx-runtime"),wi=typeof window>"u"?te.useEffect:te.useLayoutEffect,vi=[159,119,164],xi=()=>{},La=()=>{},yi=e=>{},ki=()=>{},Si=e=>{},Ci=e=>{},Ti=e=>{},Pi=e=>{};function Ii(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,n]=(0,te.useState)(a);if((0,te.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>n(o.matches);return o.addEventListener("change",l),()=>o.removeEventListener("change",l)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Ai(e,a){let t=(0,te.useRef)(null);(0,te.useEffect)(()=>{let n=e.current,o=a.current;if(!n||!o)return;let l=(0,M.queryLive)(n,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==l&&(t.current.controller.destroy(),t.current=null),l&&!t.current){t.current={grid:l,controller:(0,M.attachScrollArrow)({dropdown:n,grid:l,button:o})};return}t.current?.controller.update()}),(0,te.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ei(e,a){let t=(0,te.useRef)(a);t.current=a;let n=(0,te.useRef)(null);(0,te.useLayoutEffect)(()=>{let o=e.current;if(o){if(!n.current){n.current=(0,M.attachViewportFit)({dropdown:o,isOpen:()=>t.current});return}n.current.update()}}),(0,te.useEffect)(()=>()=>{n.current?.destroy(),n.current=null},[])}function Kt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:n,onUnhighlight:o,isOpen:l,id:s,className:p,pills:v,onPillClick:x,showPills:k=!0,onSkip:g,showSkipButton:m=!0,showOptionIcons:h=!0,showOptionImages:S=!0,showOptionCounts:C=!0,skipDisabled:I=!1,activeSelected:F=!1,isLoading:N=!1,skeletonExiting:re=!1,isInputEmpty:K=!1,language:R,products:H,onProductSelect:_,onProductAddToCart:ne,onProductFocusChange:fe,productsLayout:pe="row",productImageFallback:$="image",showProductVendor:E=!0,formatType:Z="options",dateView:Se=null,selectedDateIso:Ce=null,selectedDateRange:he=null,dateRangeStart:i=null,dateReferences:y,onPreviousMonth:ue,onNextMonth:me,timeView:we=null,multiSelectView:pt=null,onMultiSelectCommit:Ue,onSeeAllResults:Qe,seeAllBusy:Me=!1,busyProductId:ht=null,fullWidth:tt=!1,onTimeChange:u,onTimeCommit:ut,locationView:Ye=null,isReediting:at=!1,onLocationQuery:b,onLocationMove:T,onLocationCommit:z,onLocationFocusChange:D,isFocused:B=!1,optionsPosition:X="below",mode:Ie}){let Te=Ii(Ie),je=Te!==void 0,be=(0,te.useRef)(null),$e=(0,te.useRef)(null);Ai(be,$e),(0,te.useEffect)(()=>{if(be.current)return(0,M.containScroll)(be.current)},[]);let Ne=e[0]?.options??[],mt=!!(v&&v.length>0&&x),Ae=!!(H&&H.length>0),it=Z==="time"&&we!=null,vt=Z==="location"&&Ye!=null,Pe=l&&(Ne.length>0||k&&mt||N||Ae||it||vt);Ei(be,Pe),wi(()=>{let A=be.current;A&&((0,M.fitMultiSelectDone)(A,(0,M.findMultiSelectDone)(A)),(0,M.syncPanelHug)(A))});let Ee={suggestions:e,activeIndex:a,pills:v,showPills:k,showSkipButton:m,showOptionIcons:h,showOptionImages:S,showOptionCounts:C,skipDisabled:I,activeSelected:F,isLoading:N,skeletonExiting:re,isInputEmpty:K,products:H,formatType:Z,dateView:Se,selectedDateIso:Ce,selectedDateRange:he,dateRangeStart:i,dateReferences:y,timeView:we,multiSelectView:pt,locationView:Ye,isReediting:at,showsSeeAll:!!Qe},ot=(0,te.useRef)(Ee);Pe&&(ot.current=Ee);let r=Pe?Ee:ot.current,Y=(0,M.uiStringsFor)(R),Fe=r.suggestions[0],Ke=Fe?.options??[],gt=r.activeIndex>=0&&!!Ke[r.activeIndex]?.is_tappable,qe=(0,M.labelTraditionalAutocomplete)(r.pills??[],Y.keepTyping),Ze=!!(qe.length>0&&x),w=r.showPills&&Ze,xt=r.showPills&&!Ze&&r.isLoading,nt=w||xt,rt=Ze&&(0,M.hasSkippablePill)(qe)&&r.showSkipButton&&!r.isInputEmpty&&!!g,f=qe[0]?.text,st=(0,M.isCalendarFormat)(r.formatType)&&r.dateView!=null,yt=Ke.length>0&&!st,Xe=Ke.length>0&&st&&!r.isLoading,kt=r.formatType==="time"&&r.timeView!=null&&!r.isLoading,St=r.formatType==="location"&&r.locationView!=null&&!r.isLoading,lt=r.isLoading&&!yt&&!Xe&&!kt&&!St,Ct=r.products??[],Je=(0,M.panelMorphKey)(w?qe:[]);return(0,te.useLayoutEffect)(()=>{be.current&&(0,M.settlePanelMorph)(be.current,Je,{visible:Pe,anchorBottom:X==="above"})},[Je,Pe,X,r.suggestions,r.pills,r.isLoading,r.skeletonExiting,r.isInputEmpty,r.products,r.formatType,r.dateView,r.selectedDateIso,r.selectedDateRange,r.dateRangeStart,r.dateReferences,r.timeView,r.multiSelectView,r.locationView,r.showPills,r.showSkipButton,r.showOptionIcons,r.showOptionImages,r.showOptionCounts,r.showsSeeAll,pe,R]),(0,te.useEffect)(()=>{let A=be.current;return()=>{A&&(0,M.destroyPanelMorph)(A)}},[]),(0,j.jsxs)("div",{ref:be,id:s,role:"listbox","aria-multiselectable":!!r.multiSelectView,"data-aia-dropdown":"","data-options-position":X,"data-mode":Te,"data-aia-loading":r.isLoading?"":void 0,"data-aia-skeleton-exiting":r.skeletonExiting?"":void 0,"data-aia-has-products":Ct.length>0?"":void 0,"data-aia-full-width":tt?"":void 0,className:`${je?"magicx-aia ":""}${Re.dropdown} ${Pe?Re.visible:""} ${p??""}`,onMouseDown:A=>A.preventDefault(),children:[(0,j.jsxs)(Ra,{space:"8px",children:[(nt||rt)&&(0,j.jsxs)(Et,{noWrap:!0,className:Re.pillBar,"data-aia-pillbar":"",children:[nt&&(0,j.jsx)("span",{className:Re.pillScroll,"data-aia-pill-scroll":"",children:(0,j.jsx)(Wt,{pills:qe,activePillIndex:0,activeSelected:r.activeSelected,onSelectPill:x??(()=>{}),rounded:!0,loading:r.isLoading})}),rt&&(0,j.jsx)("button",{type:"button",tabIndex:-1,className:Re.skip,"data-aia-skip":"",disabled:r.isLoading||r.skipDisabled,"aria-label":f?`${Y.skipLabel} ${f}`:Y.skipLabel,onClick:g,children:Y.skip})]}),yt&&(0,j.jsx)(Aa,{options:Ke,activeIndex:r.activeIndex,onSelect:t,onHighlight:n,onUnhighlight:o,listboxId:s,loading:r.isLoading,groupKey:Fe?`${Fe.parameter} ${Fe.text}`:"",optionsPosition:X,showIcons:r.showOptionIcons,showImages:r.showOptionImages,showCounts:r.showOptionCounts,picked:r.multiSelectView?.picked}),r.multiSelectView&&(0,j.jsx)("div",{"data-aia-multi-actions":"",onClick:A=>{A.target.closest("[data-aia-multi-done]")&&!r.skipDisabled&&!r.isLoading&&Ue?.()},children:(0,j.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Re.multiDone,ref:A=>{A&&(A.disabled=!0,A.offsetHeight,A.disabled=r.skipDisabled||r.isLoading)},children:Y.done})}),Xe&&r.dateView&&(0,j.jsx)(ma,{options:Ke,activeIndex:r.activeIndex,listboxId:s,view:r.dateView,selection:{selectedIso:r.selectedDateIso??null,selectedRange:r.selectedDateRange??null,rangeStart:r.dateRangeStart??null,floor:(0,M.dateFloorFor)(r.formatType,r.dateRangeStart),references:r.dateReferences??[]},onSelect:t,onHighlight:n,onUnhighlight:o,onPreviousMonth:ue??La,onNextMonth:me??La}),kt&&r.timeView&&(0,j.jsx)(Ea,{view:r.timeView,label:Y.timeLabel,doneLabel:Y.done,interactive:!r.skipDisabled,onTimeChange:u??yi,onTimeCommit:ut??ki}),St&&r.locationView&&(0,j.jsx)(va,{view:r.locationView,searchLabel:Y.locationSearch,noResultsLabel:Y.locationNoResults,useTypedLabel:Y.locationUseTyped,widgetFocused:B&&Pe,reediting:r.isReediting,visible:Pe,interactive:!r.skipDisabled,onQuery:b??Si,onMove:T??Ci,onCommit:z??Ti,onFocusChange:D??Pi}),lt&&(0,j.jsx)("div",{className:Re.skeletonBars,"data-aia-skeleton-bars":"",children:vi.map(A=>(0,j.jsx)("span",{className:Re.skeletonBar,style:{width:A}},`bar-${A}`))}),(0,j.jsx)(Sa,{products:Ct,listboxId:s,onSelect:_??xi,busyProductId:ht,onAddToCart:ne,onFocusChange:fe,focusable:Pe&&!r.isLoading,loading:r.isLoading,layout:pe,imageFallback:$,showVendor:E,strings:Y}),r.showsSeeAll&&(0,j.jsx)("div",{className:Re.seeAllRow,"data-aia-see-all":"",onClick:A=>{A.target.closest("[data-aia-see-all-button]")&&(A.stopPropagation(),!(r.isLoading||Me)&&Qe?.())},children:(0,j.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"","data-aia-see-all-state":Me?"busy":void 0,"aria-busy":Me?!0:void 0,className:Re.seeAll,ref:A=>{A&&(A.disabled=!0,A.offsetHeight,A.disabled=r.isLoading)},children:Y.seeAllResults})}),(0,j.jsx)(ga,{isOptionHighlighted:gt,isInputEmpty:r.isInputEmpty,strings:Y})]}),(0,j.jsx)("button",{ref:$e,type:"button",tabIndex:-1,className:Re.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Y.scrollArrow,"aria-hidden":"true",children:(0,j.jsx)("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,j.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var De=require("@magicx-eng/ai-autocomplete-vanilla");var Da=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 {
|
|
3836
3899
|
flex-shrink: 0;
|
|
3837
3900
|
width: 32px;
|
|
3838
3901
|
height: 32px;
|
|
@@ -3936,5 +3999,5 @@
|
|
|
3936
3999
|
transition: none;
|
|
3937
4000
|
}
|
|
3938
4001
|
}
|
|
3939
|
-
`,document.head.appendChild(e)}var La={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};var Kt=require("react/jsx-runtime");function Da({disabled:e,ready:a,busy:t=!1,onClick:o,label:i=(0,Oa.uiStringsFor)().submit}){return(0,Kt.jsx)("button",{type:"button","data-aia-submit":"",className:La.submitButton,disabled:e,"data-aia-ready":a?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:d=>{d.stopPropagation(),o()},"aria-label":i,children:(0,Kt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Kt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var ve=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react");var Jt=require("react");function Ma(e){let a=(0,Jt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),o=(0,Jt.useRef)({key:"",overrides:void 0});if(o.current.key!==t){let i={};for(let d of Object.keys(e??{})){let r=(c,b,x)=>{let y=a.current?.[d];return y?y(c,b,x):[]};i[d]=r}o.current={key:t,overrides:e?i:void 0}}return{overrides:o.current.overrides,key:t}}var ea=require("react");function Na(e){let a=(0,ea.useRef)(e);a.current=e;let t=(0,ea.useRef)(null);t.current===null&&(t.current={fetch:(i,d)=>{let r=a.current;return r?r.fetch(i,d):Promise.reject(new Error("products config removed"))},transform:i=>a.current?.transform(i)??[],get limit(){return a.current?.limit}});let o=e!==void 0;return{config:o?t.current:void 0,enabled:o}}var Pi={query:"",raw_query:"",completed_params:[],identified_params:[],is_ready:!1},Fa={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,highlightByPointer:!1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,isSubmitting:!1,selectingProductId:null,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function qt({onSubmit:e,onResult:a,onError:t,optionOverrides:o,maskCompletedText:i,apiConfig:d,additionalContext:r,language:c,currency:b,productId:x,visitorId:y,analyticsConsent:g,columns:h=2,dropdownTrigger:u,optionsPosition:k,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:H,prependPlaceholder:F,allOption:se,showNonTappableOptions:q,locationSearch:z,showOptionIcons:B,showOptionImages:V,showOptionCounts:X,showSkipButton:xe,showProducts:J,submitProgress:A,awaitAnswerOnSubmit:le,submitAnswerTimeoutMs:ee,productImageFallback:ke="image",showProductVendor:R=!0,onFocus:$,onBlur:p,value:S,completedParams:Se,onChange:tt,onParamsChange:Le,products:lt,mapProducts:Ue,onProductSelect:Qe,onProductAddToCart:Oe,source:dt,setCursor:at}){let m=(0,P.useRef)(null),[ct,f]=(0,P.useState)(null),T=(0,P.useRef)(e);T.current=e;let L=(0,P.useRef)(a);L.current=a;let D=(0,P.useRef)(t);D.current=t;let W=(0,P.useRef)(tt);W.current=tt;let he=(0,P.useRef)(Le);he.current=Le;let We=(0,P.useRef)($);We.current=$;let ge=(0,P.useRef)(p);ge.current=p;let Ge=(0,P.useRef)(at);Ge.current=at;let Ye=(0,P.useRef)(Qe);Ye.current=Qe;let pt=(0,P.useRef)(Oe);pt.current=Oe;let fe=(0,P.useRef)(y);fe.current=y;let je=(0,P.useRef)(()=>{let s=fe.current;return typeof s=="function"?s():s}).current,De=y!==void 0,ht=(0,P.useRef)(g);ht.current=g;let Ce=(0,P.useRef)(()=>{let s=ht.current;return typeof s=="function"?s():s}).current,it=Na(lt),vt=(0,P.useRef)(Ue);vt.current=Ue;let ye=(0,P.useRef)((s,ie)=>{let U=vt.current;return U?U(s,ie):s}).current,Te=Ue?ye:void 0,ot=Ma(o);(0,P.useEffect)(()=>{if(typeof document>"u")return;let s=new ve.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:d,additionalContext:r,language:c,currency:b,productId:x,visitorId:De?je:void 0,analyticsConsent:Ce,optionOverrides:ot.overrides,maskCompletedText:i,columns:h,dropdownTrigger:u,optionsPosition:k,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:H,prependPlaceholder:F,allOption:se,showNonTappableOptions:q,locationSearch:z,showProducts:J,submitProgress:A,awaitAnswerOnSubmit:le,submitAnswerTimeoutMs:ee,source:dt,value:S,completedParams:Se,onSubmit:(...U)=>T.current?.(...U),onResult:(...U)=>L.current?.(...U),onError:(...U)=>D.current?.(...U),onChange:(...U)=>W.current?.(...U),onParamsChange:(...U)=>he.current?.(...U),onFocus:()=>We.current?.(),onBlur:()=>ge.current?.(),onProductSelect:U=>Ye.current?Ye.current(U):ve.HANDOFF_NOT_HANDLED,onProductAddToCart:U=>pt.current?.(U),setCursor:U=>Ge.current?.(U),products:it.config,mapProducts:Te});m.current=s,f(s.getState());let ie=s.subscribe(U=>f(U));return()=>{ie(),s.destroy(),m.current===s&&(m.current=null)}},[]);let n=(0,P.useRef)(De);(0,P.useEffect)(()=>{n.current!==De&&(n.current=De,m.current?.update({visitorId:De?je:void 0,analyticsConsent:Ce}))},[De,je,Ce]);let Y=typeof g=="function"?"function":g,Me=(0,P.useRef)(Y);(0,P.useEffect)(()=>{Me.current!==Y&&(Me.current=Y,m.current?.refreshAnalyticsConsent())},[Y]),(0,P.useEffect)(()=>{S!==void 0&&m.current?.setValue(S)},[S]),(0,P.useEffect)(()=>{Se!==void 0&&m.current?.setCompletedParams(Se)},[Se]);let Ke=JSON.stringify(d??null),ut;try{ut=JSON.stringify(r??null)}catch{ut="[unstringifiable]"}(0,P.useEffect)(()=>{m.current?.update({apiConfig:d,additionalContext:r,language:c,currency:b,productId:x,optionOverrides:ot.overrides,dropdownTrigger:u,optionsPosition:k,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:H,prependPlaceholder:F,allOption:se,showNonTappableOptions:q,locationSearch:z,showProducts:J,submitProgress:A,awaitAnswerOnSubmit:le,submitAnswerTimeoutMs:ee})},[Ke,ut,c,b?.code,b?.rate,b?.country,x,ot.key,u,k,C,I,H,F,se,q,z,J,A,le,ee]);let qe=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!qe.current){qe.current=!0;return}m.current?.update({products:it.config})},[it.enabled]),(0,P.useEffect)(()=>{m.current?.update({mapProducts:Te})},[Te]);let $e=(0,P.useRef)(null);$e.current===null&&($e.current={handleTextChange:s=>m.current?.handleTextChange(s),handleCompositionText:s=>m.current?.handleCompositionText(s),handleKeyDown:s=>{let ie="nativeEvent"in s?s.nativeEvent:s;m.current?.handleKeyDown(ie)},setFocused:s=>m.current?.setFocused(s),startEditingParam:s=>m.current?.startEditingParam(s),removeParam:s=>m.current?.removeParam(s)??!1,exitEditMode:()=>m.current?.exitEditMode(),handleCaretAfterInput:s=>m.current?.handleCaretAfterInput(s),handleCaretMove:s=>m.current?.handleCaretMove(s),replaceEditingRange:s=>m.current?.replaceEditingRange(s)??!1,setActivePill:s=>m.current?.setActivePill(s),skipActivePill:()=>m.current?.skipActivePill(),removeLastParam:()=>m.current?.removeLastParam(),clearNewParamId:()=>m.current?.clearNewParamId(),reset:()=>m.current?.reset(),refreshProducts:()=>m.current?.refreshProducts(),prepareSubmit:()=>m.current?.prepareSubmit(),getState:()=>m.current?.getState()??Fa,getResult:()=>m.current?.getResult()??Pi,awaitSubmitResult:()=>m.current?.awaitSubmitResult()??Promise.resolve(null),recordSubmit:s=>m.current?.recordSubmit(s),holdSubmit:s=>m.current?.holdSubmit(s),endSubmitProgress:()=>m.current?.endSubmitProgress(),getSearchId:()=>m.current?.getSearchId(),getVisitorId:()=>m.current?.getVisitorId(),refreshAnalyticsConsent:()=>m.current?.refreshAnalyticsConsent(),selectOption:(s,ie)=>m.current?.selectOption(s,ie),selectProduct:s=>m.current?.selectProduct(s),addProductToCart:s=>{let ie=m.current;return!ie||!pt.current?Promise.resolve():ie.addProductToCart(s)},setActiveDropdownIndex:s=>m.current?.setActiveDropdownIndex(s),clearHighlight:s=>m.current?.clearHighlight(s),showPreviousMonth:()=>m.current?.showPreviousMonth(),showNextMonth:()=>m.current?.showNextMonth(),setTime:s=>m.current?.setTime(s),commitTime:()=>m.current?.commitTime(),toggleMultiSelectOption:s=>m.current?.toggleMultiSelectOption(s),commitMultiSelect:()=>m.current?.commitMultiSelect(),setLocationQuery:s=>m.current?.setLocationQuery(s),moveLocationHighlight:s=>m.current?.moveLocationHighlight(s),commitLocation:s=>m.current?.commitLocation(s),setLocationFieldFocused:s=>m.current?.setLocationFieldFocused(s),handleFocus:()=>m.current?.setFocused(!0),handleBlur:()=>m.current?.setFocused(!1)});let v=$e.current,mt=(0,P.useCallback)(s=>{let ie=s.target.value,Pt=ie.length>0&&!s.nativeEvent?.isComposing&&ie[0]!==ie[0].toUpperCase()?ie[0].toUpperCase()+ie.slice(1):ie;m.current?.handleTextChange(Pt)},[]),xt=(0,P.useCallback)(s=>{m.current?.handleKeyDown(s.nativeEvent)},[]),Ze=m.current,w=ct??Fa,gt=S!==void 0?S:w.text,yt=Se!==void 0?Se:w.completedParams,Xe=w.actionableSuggestions,kt=Xe[0],St=(0,P.useMemo)(()=>(0,ve.withoutTraditionalAutocomplete)(Xe),[Xe]),nt=Ze?.listboxId??"",Ct=w.activeDropdownIndex>=0&&Ze?`${nt}-option-${w.activeDropdownIndex}`:void 0,Je=w.editingParam,E=w.editingIdentified,Dt=Je?(0,ve.editingSuggestion)(Je):E?{parameter:E.parameter,text:(0,ve.identifiedParamLabel)(E.parameter),required:!0,options:[]}:null,Mt=w.dropdownSuggestion??Dt??kt,Vt=(0,ve.dropdownPillsFor)(w.dropdownSuggestion,Dt,Xe),Tt=(0,ve.dateSelectionFor)(w),At=!Ze||w.dropdownLoading;return{completedParams:yt,multiSelectView:w.multiSelectView,toggleMultiSelectOption:v.toggleMultiSelectOption,commitMultiSelect:v.commitMultiSelect,skippedParams:w.skippedParams,identifiedParams:w.identifiedParams,suggestionPills:St,setActivePill:v.setActivePill,skipActivePill:v.skipActivePill,removeLastParam:v.removeLastParam,segments:w.segments,newParamId:w.newParamId,clearNewParamId:v.clearNewParamId,suggestions:w.suggestions,activeIndex:w.activeDropdownIndex,isReady:w.isReady,isLoading:At,isFocused:w.isFocused,isDropdownOpen:w.isDropdownOpen,isActivePillSelected:w.isActivePillSelected,placeholderText:w.placeholderText,listboxId:nt,error:w.error,products:w.products,customFields:w.customFields,selectProduct:v.selectProduct,addProductToCart:v.addProductToCart,handleTextChange:v.handleTextChange,handleCompositionText:v.handleCompositionText,handleKeyDown:v.handleKeyDown,setFocused:v.setFocused,editingParam:Je,editingIdentified:E,editingAnchor:w.editingAnchor,caretOffset:w.caretOffset,startEditingParam:v.startEditingParam,removeParam:v.removeParam,exitEditMode:v.exitEditMode,handleCaretAfterInput:v.handleCaretAfterInput,handleCaretMove:v.handleCaretMove,replaceEditingRange:v.replaceEditingRange,inputProps:{value:gt,placeholder:w.placeholderText||void 0,onChange:mt,onKeyDown:xt,onFocus:v.handleFocus,onBlur:v.handleBlur,role:"combobox","aria-expanded":w.isDropdownOpen,"aria-activedescendant":Ct,"aria-autocomplete":"list","aria-controls":nt},reset:v.reset,refreshProducts:v.refreshProducts,prepareSubmit:v.prepareSubmit,getState:v.getState,getResult:v.getResult,awaitSubmitResult:v.awaitSubmitResult,recordSubmit:v.recordSubmit,holdSubmit:v.holdSubmit,endSubmitProgress:v.endSubmitProgress,getSearchId:v.getSearchId,getVisitorId:v.getVisitorId,refreshAnalyticsConsent:v.refreshAnalyticsConsent,isSubmitting:w.isSubmitting,selectingProductId:w.selectingProductId,dropdownProps:{suggestions:Mt?[{...Mt,options:w.dropdownOptions}]:[],activeIndex:w.activeDropdownIndex,onSelect:v.selectOption,onHighlight:v.setActiveDropdownIndex,onUnhighlight:v.clearHighlight,isOpen:w.isDropdownOpen,id:nt,pills:Vt,activeSelected:w.isActivePillSelected,onPillClick:v.setActivePill,onSkip:v.skipActivePill,showSkipButton:(xe??!0)&&!Je&&!E,showOptionIcons:B??!0,showOptionImages:V??!0,showOptionCounts:X??!0,skipDisabled:w.inSelectionAnimation,isLoading:At,skeletonExiting:w.skeletonExiting,isInputEmpty:gt.trim().length===0,language:c,products:w.products,productImageFallback:ke,showProductVendor:R,onProductSelect:v.selectProduct,busyProductId:w.selectingProductId,seeAllBusy:w.isSubmitting,onProductAddToCart:Oe?v.addProductToCart:void 0,onProductFocusChange:v.setFocused,formatType:w.activeFormatType,dateView:w.dateView,selectedDateIso:Tt.selectedIso,selectedDateRange:Tt.selectedRange,dateRangeStart:Tt.rangeStart,dateReferences:Tt.references,onPreviousMonth:v.showPreviousMonth,onNextMonth:v.showNextMonth,timeView:w.timeView,multiSelectView:w.dropdownMultiSelect,onMultiSelectCommit:v.commitMultiSelect,onTimeChange:v.setTime,onTimeCommit:v.commitTime,locationView:w.locationView,isReediting:w.editingParam!=null,onLocationQuery:v.setLocationQuery,onLocationMove:v.moveLocationHighlight,onLocationCommit:v.commitLocation,onLocationFocusChange:v.setLocationFieldFocused,isFocused:w.isFocused||w.locationFieldFocused,optionsPosition:k??"below"}}}var K=require("@magicx-eng/ai-autocomplete-vanilla"),O=require("react"),_t;function Ii(){if(_t!==void 0)return _t;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),_t=e.contentEditable==="plaintext-only",_t}function Ha(e){let{segments:a,showChipIcons:t=!0,showChipImages:o=!0,showChipRemove:i=!1,focusInputOnSelect:d,removeParam:r,newParamId:c,editingParam:b,editingIdentified:x,editingAnchor:y,caretOffset:g,placeholderText:h,hintSuggestions:u,isFocused:k,isDropdownOpen:C,listboxId:I,activeDescendantId:H,autoFocus:F,handleTextChange:se,handleCompositionText:q,handleKeyDown:z,handleCaretAfterInput:B,handleCaretMove:V,startEditingParam:X,replaceEditingRange:xe,setFocused:J}=e,A=(0,O.useRef)(null),le=(0,O.useRef)(!1),ee=(0,O.useRef)(""),ke=(0,O.useRef)(""),R=(0,O.useRef)(null),$=(0,O.useRef)(0);R.current=g;let p=(0,O.useRef)(d);p.current=d,(0,O.useEffect)(()=>{if(!F)return;let f=A.current;if(!f)return;document.activeElement===f?J(!0):f.focus();let T=f.ownerDocument??document,L=T.getSelection(),D=L&&L.rangeCount>0&&f.contains(L.anchorNode);if(L&&!D){let W=T.createRange();W.selectNodeContents(f),W.collapse(!0),L.removeAllRanges(),L.addRange(W)}},[F,J]),(0,O.useEffect)(()=>{let f=A.current;if(!f)return;let T=f.ownerDocument??document,L=()=>{let D=T.getSelection();if(!D||D.rangeCount===0||!D.anchorNode||!f.contains(D.anchorNode))return;let W=D.anchorNode,he=W.nodeType===Node.ELEMENT_NODE?W:W.parentElement,ge=(D.isCollapsed?he?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Ge=b?.id??x?.id??null;if(ge&&ge!==Ge){X(ge);return}performance.now()-$.current<50||V((0,K.getCursorOffset)(f))};return T.addEventListener("selectionchange",L),()=>T.removeEventListener("selectionchange",L)},[b,x,X,V]),(0,O.useEffect)(()=>{let f=A.current;if(!f)return;let T=L=>{let D=(0,K.chipIdFromTap)(f,L.target);D&&(X(D),(0,K.keepCaretOnChip)(f,D))};return f.addEventListener("click",T),()=>f.removeEventListener("click",T)},[X]),(0,O.useEffect)(()=>{let f=A.current;if(!(!f||!r||!i))return(0,K.attachChipRemove)(f,r)},[r,i]),(0,O.useLayoutEffect)(()=>{let f=A.current;f&&(0,K.renderEditableContent)({input:f,segments:a,newParamId:c,editingParamId:b?.id??null,placeholderText:h??"",isFocused:k,showChipIcons:t,showChipImages:o,showChipRemove:i,hintOptions:(0,K.startingHintOptions)(u??[])})},[a,c,b,h,u,k,t,o,i]),(0,O.useEffect)(()=>{let f=A.current;return()=>{f&&(0,K.cancelStartingHint)(f)}},[]),(0,O.useLayoutEffect)(()=>{let f=ee.current,T=c??"";if(ee.current=T,!T||T===f)return;let L=A.current;if(!L)return;let D=R.current??(0,K.plainTextLength)(L);(0,K.settlePickFocus)(L,D,(0,K.focusesInputOnSelect)(p.current))},[c]),(0,O.useLayoutEffect)(()=>{let f=ke.current,T=b?.id??"";if(ke.current=T,!T||T===f||y==null)return;let L=A.current;L&&(0,K.setCursorOffset)(L,y)},[b,y]);let S=(0,O.useCallback)(()=>{let f=A.current;if(!f)return;let T=(0,K.extractPlainText)(f),D=T.length>0&&T[0]!==T[0].toUpperCase()?T[0].toUpperCase()+T.slice(1):T;if(le.current){q(D);return}se(D)},[se,q]),Se=(0,O.useCallback)(()=>{$.current=performance.now(),S();let f=A.current;f&&B((0,K.getCursorOffset)(f))},[S,B]);(0,O.useEffect)(()=>{let f=A.current;if(!f)return;let T=L=>{let D=L,W=D.inputType;if(W==="insertParagraph"||W==="insertLineBreak"||W==="insertFromDrop"){L.preventDefault();return}if(W.startsWith("insert")||W.startsWith("delete")){let he=W.startsWith("delete")?"":D.data??"";xe(he)&&L.preventDefault()}};return f.addEventListener("beforeinput",T),()=>f.removeEventListener("beforeinput",T)},[xe]);let tt=(0,O.useCallback)(()=>{le.current=!0,A.current?.setAttribute("data-aia-composing","true")},[]),Le=(0,O.useCallback)(()=>{le.current=!1,A.current?.removeAttribute("data-aia-composing"),S()},[S]),lt=(0,O.useCallback)(f=>{f.preventDefault();let T=A.current;if(!T)return;let L=(f.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!L)return;let D=T.ownerDocument??document,W=D.getSelection();if(!W||W.rangeCount===0)return;let he=W.getRangeAt(0);if(!T.contains(he.startContainer))return;he.deleteContents();let We=D.createTextNode(L);he.insertNode(We),he.setStartAfter(We),he.collapse(!0),W.removeAllRanges(),W.addRange(he),S()},[S]),Ue=(0,O.useCallback)(f=>z(f),[z]),Qe=(0,O.useCallback)(()=>J(!0),[J]),Oe=(0,O.useCallback)(()=>J(!1),[J]),dt=(0,O.useCallback)(()=>A.current?.focus(),[]),at=(0,O.useCallback)(()=>A.current?.blur(),[]),m=(0,O.useCallback)(()=>{let f=A.current;return f?(0,K.extractPlainText)(f):""},[]),ct=Ii()?"plaintext-only":"true";return{inputRef:A,editorProps:{ref:A,contentEditable:ct,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":I,"aria-expanded":C,"aria-activedescendant":H,spellCheck:!0,enterKeyHint:"send",onInput:Se,onKeyDown:Ue,onCompositionStart:tt,onCompositionEnd:Le,onPaste:lt,onFocus:Qe,onBlur:Oe},getPlainText:m,focus:dt,blur:at}}var Be=require("react/jsx-runtime");function Ai(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Ba=(0,Z.forwardRef)(function({onSubmit:a,onResult:t,onError:o,optionOverrides:i,maskCompletedText:d,className:r,apiConfig:c,additionalContext:b,language:x,currency:y,productId:g,visitorId:h,analyticsConsent:u,columns:k,pillPlacement:C="dropdown",mode:I="auto",optionsPosition:H="below",animations:F=!0,optionsStyle:se="floating",dropdownTrigger:q,closeDropdownOnBlur:z,focusInputOnSelect:B,startingState:V,prependPlaceholder:X,allOption:xe,showNonTappableOptions:J,locationSearch:A,showOptionIcons:le=!0,showChipIcons:ee=!0,showChipImages:ke=!0,showChipRemove:R=!1,showOptionImages:$=!0,showOptionCounts:p=!0,showSkipButton:S,showProducts:Se,submitProgress:tt,awaitAnswerOnSubmit:Le,submitAnswerTimeoutMs:lt,productsLayout:Ue,productImageFallback:Qe,showProductVendor:Oe,autoFocus:dt=!0,onFocus:at,onBlur:m,value:ct,completedParams:f,onChange:T,onParamsChange:L,products:D,mapProducts:W,onProductSelect:he,onProductAddToCart:We,submitButton:ge,resetOnSubmit:Ge=!0,seeAllResults:Ye=!1},pt){let fe=(0,Z.useRef)(null),je=(0,Z.useRef)(null),De=(0,Z.useRef)(null),ht=(0,Z.useRef)(()=>{}),Ce=(0,Z.useRef)(null),it=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let M=fe.current;if(M)return Ce.current?Ce.current.setMode(I):Ce.current=new ze.ModeController(M,I),()=>{Ce.current?.destroy(),Ce.current=null}},[I]);let vt=(0,Z.useCallback)(M=>{let Ne=it.current?.current;Ne&&(Ne.focus(),(0,ze.setCursorOffset)(Ne,M))},[]),{completedParams:ye,suggestionPills:Te,setActivePill:ot,skipActivePill:n,segments:Y,newParamId:Me,clearNewParamId:Ke,placeholderText:ut,isFocused:qe,isDropdownOpen:$e,isActivePillSelected:v,isLoading:mt,isReady:xt,activeIndex:Ze,listboxId:w,handleTextChange:gt,handleCompositionText:yt,handleKeyDown:Xe,setFocused:kt,editingParam:St,editingIdentified:nt,editingAnchor:Ct,caretOffset:Je,startEditingParam:E,removeParam:Dt,handleCaretAfterInput:Mt,handleCaretMove:Vt,replaceEditingRange:Tt,dropdownProps:At,reset:s,refreshProducts:ie,prepareSubmit:U,getState:Pt,getResult:ta,awaitSubmitResult:aa,recordSubmit:ia,holdSubmit:oa,endSubmitProgress:na,getSearchId:ra,getVisitorId:sa,refreshAnalyticsConsent:la,isSubmitting:Ut}=qt({onSubmit:M=>ht.current(M),onResult:t,onError:o,optionOverrides:i,maskCompletedText:d,apiConfig:c,additionalContext:b,language:x,currency:y,productId:g,visitorId:h,analyticsConsent:u,columns:k,dropdownTrigger:q,optionsPosition:H,closeDropdownOnBlur:z,focusInputOnSelect:B,startingState:V,prependPlaceholder:X,allOption:xe,showNonTappableOptions:J,locationSearch:A,showOptionIcons:le,showOptionImages:$,showOptionCounts:p,showSkipButton:S,showProducts:Se,submitProgress:tt,awaitAnswerOnSubmit:Le,submitAnswerTimeoutMs:lt,onFocus:at,onBlur:m,value:ct,completedParams:f,onChange:T,onParamsChange:L,products:D,mapProducts:W,onProductSelect:he,onProductAddToCart:We,source:"full-sdk",setCursor:vt});(0,Z.useEffect)(()=>{if(!Me)return;let M=window.setTimeout(()=>Ke(),650);return()=>window.clearTimeout(M)},[Me,Ke]);let Wa=Ze>=0?`${w}-option-${Ze}`:void 0,{inputRef:It,editorProps:Ga,focus:da,blur:ca,getPlainText:pa}=Ha({segments:Y,newParamId:Me,editingParam:St,editingIdentified:nt,editingAnchor:Ct,caretOffset:Je,placeholderText:ut,hintSuggestions:C==="inline"?[]:Te,isFocused:qe,showChipIcons:ee,showChipImages:ke,showChipRemove:R,removeParam:Dt,focusInputOnSelect:B,isDropdownOpen:$e,listboxId:w,activeDescendantId:Wa,autoFocus:dt,handleTextChange:gt,handleCompositionText:yt,handleKeyDown:Xe,handleCaretAfterInput:Mt,handleCaretMove:Vt,startEditingParam:E,replaceEditingRange:Tt,setFocused:kt});it.current=It,(0,Z.useLayoutEffect)(()=>{let M=je.current,Ne=It.current;if(!M||!Ne)return;let bt=()=>{let Rt=M.firstElementChild;if(!Rt)return;let Qa=Rt.getBoundingClientRect(),Ya=Ne.getBoundingClientRect();Qa.top>=Ya.bottom-2?M.setAttribute("data-aia-pill-wrapped",""):M.removeAttribute("data-aia-pill-wrapped")};bt();let Et=new ResizeObserver(bt);return Et.observe(Ne),()=>Et.disconnect()},[Y,Te.length,mt,It]),(0,Z.useEffect)(()=>{let M=De.current;if(M)return(0,ze.watchEditorHeight)(M)},[]),(0,Z.useImperativeHandle)(pt,()=>({focus:da,blur:ca,reset:s,refreshProducts:ie,setMode:M=>Ce.current?.setMode(M),skipActivePill:n,endSubmitProgress:na,getSearchId:ra,getVisitorId:sa,refreshAnalyticsConsent:la}),[da,ca,s,ie,n,na,ra,sa,la]);let ft=!!Y.length||ye.length>0,Nt=(0,Z.useCallback)((M,Ne)=>{let bt=Pt(),Et=(0,ze.buildSubmitResult)(pa(),bt.completedParams,bt.skippedParams,{identifiedParams:bt.identifiedParams,isReady:bt.isReady,customFields:Ne.custom_fields??null,customFieldsStale:Ne.custom_fields_stale===!0});M&&ia(Et);let Rt=a(Et);return M&&!Ge&&oa(Rt),Ge&&s(),Rt},[ia,oa,Ge,Pt,a,s,pa]),Qt=(0,Z.useCallback)(()=>{if(ft&&!Pt().isSubmitting){if(Le){aa().then(M=>{M&&Nt(!0,M)});return}U(),Nt(!0,ta())}},[ft,Pt,Le,aa,U,ta,Nt]);ht.current=M=>ft?Nt(!1,M):void 0;let Ka=Ye&&!At.isInputEmpty&&ft,qa=Qt,_a=(0,Z.useCallback)(M=>{M.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||It.current&&(0,ze.focusEditorFromTap)(It.current)},[It]),Va=C==="inline",Ua=C==="dropdown";return(0,Be.jsxs)("div",{ref:fe,className:`magicx-aia ${wt.container} ${r??""}`,"data-pill-placement":C,"data-options-position":H,"data-animations":F?"on":"off","data-aia-options-style":se,"data-mode":Ai(I),children:[(0,Be.jsx)(Gt,{...At,showPills:Ua,productsLayout:Ue,productImageFallback:Qe,showProductVendor:Oe,onSeeAllResults:Ka?qa:void 0,fullWidth:Ye}),(0,Be.jsxs)("div",{className:wt.inputWrapper,"data-aia-input-wrapper":"",onClick:_a,children:[(0,Be.jsxs)("div",{ref:De,className:wt.editorArea,"data-aia-editor":"",children:[(0,Be.jsx)("div",{...Ga,className:wt.input,"data-aia-input":""}),Va&&(mt||Te.length>0)&&(0,Be.jsx)("span",{ref:je,className:wt.pillListContainer,"data-aia-pill-list-container":"",children:(0,Be.jsx)(Bt,{pills:Te,activePillIndex:0,activeSelected:v,onSelectPill:ot,loading:mt})})]}),ge===null?null:ge===void 0?(0,Be.jsx)(Da,{disabled:!ft,ready:ft&&xt,busy:Ut,onClick:Qt,label:(0,ze.uiStringsFor)(x).submit}):(0,Be.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Ut?"busy":void 0,"aria-busy":Ut?!0:void 0,className:wt.submitSlot,onClick:M=>{ft&&(M.stopPropagation(),Qt())},children:ge})]})]})});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,focusesInputOnSelect,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isTouchPrimary,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
4002
|
+
`,document.head.appendChild(e)}var Oa={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};var qt=require("react/jsx-runtime");function Ma({disabled:e,ready:a,busy:t=!1,onClick:n,label:o=(0,Da.uiStringsFor)().submit}){return(0,qt.jsx)("button",{type:"button","data-aia-submit":"",className:Oa.submitButton,disabled:e,"data-aia-ready":a?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:l=>{l.stopPropagation(),n()},"aria-label":o,children:(0,qt.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":o,children:(0,qt.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var ke=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react");var ea=require("react");function Na(e){let a=(0,ea.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),n=(0,ea.useRef)({key:"",overrides:void 0});if(n.current.key!==t){let o={};for(let l of Object.keys(e??{})){let s=(p,v,x)=>{let k=a.current?.[l];return k?k(p,v,x):[]};o[l]=s}n.current={key:t,overrides:e?o:void 0}}return{overrides:n.current.overrides,key:t}}var ta=require("react");function Fa(e){let a=(0,ta.useRef)(e);a.current=e;let t=(0,ta.useRef)(null);t.current===null&&(t.current={fetch:(o,l)=>{let s=a.current;return s?s.fetch(o,l):Promise.reject(new Error("products config removed"))},transform:o=>a.current?.transform(o)??[],get limit(){return a.current?.limit}});let n=e!==void 0;return{config:n?t.current:void 0,enabled:n}}var Ri={query:"",raw_query:"",completed_params:[],identified_params:[],is_ready:!1},Ha={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,highlightByPointer:!1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,isSubmitting:!1,selectingProductId:null,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,blockingChips:[],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 _t({onSubmit:e,onResult:a,onError:t,optionOverrides:n,maskCompletedText:o,apiConfig:l,additionalContext:s,language:p,currency:v,productId:x,visitorId:k,analyticsConsent:g,columns:m=2,dropdownTrigger:h,optionsPosition:S,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:F,prependPlaceholder:N,allOption:re,showNonTappableOptions:K,locationSearch:R,showOptionIcons:H,showOptionImages:_,showOptionCounts:ne,showSkipButton:fe,showProducts:pe,submitProgress:$,awaitAnswerOnSubmit:E,submitAnswerTimeoutMs:Z,productImageFallback:Se="image",showProductVendor:Ce=!0,onFocus:he,onBlur:i,value:y,completedParams:ue,onChange:me,onParamsChange:we,products:pt,mapProducts:Ue,onProductSelect:Qe,onProductAddToCart:Me,source:ht,setCursor:tt}){let u=(0,P.useRef)(null),[ut,Ye]=(0,P.useState)(null),at=(0,P.useRef)(e);at.current=e;let b=(0,P.useRef)(a);b.current=a;let T=(0,P.useRef)(t);T.current=t;let z=(0,P.useRef)(me);z.current=me;let D=(0,P.useRef)(we);D.current=we;let B=(0,P.useRef)(he);B.current=he;let X=(0,P.useRef)(i);X.current=i;let Ie=(0,P.useRef)(tt);Ie.current=tt;let Te=(0,P.useRef)(Qe);Te.current=Qe;let je=(0,P.useRef)(Me);je.current=Me;let be=(0,P.useRef)(k);be.current=k;let $e=(0,P.useRef)(()=>{let c=be.current;return typeof c=="function"?c():c}).current,Ne=k!==void 0,mt=(0,P.useRef)(g);mt.current=g;let Ae=(0,P.useRef)(()=>{let c=mt.current;return typeof c=="function"?c():c}).current,it=Fa(pt),vt=(0,P.useRef)(Ue);vt.current=Ue;let Pe=(0,P.useRef)((c,J)=>{let V=vt.current;return V?V(c,J):c}).current,Ee=Ue?Pe:void 0,ot=Na(n);(0,P.useEffect)(()=>{if(typeof document>"u")return;let c=new ke.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:l,additionalContext:s,language:p,currency:v,productId:x,visitorId:Ne?$e:void 0,analyticsConsent:Ae,optionOverrides:ot.overrides,maskCompletedText:o,columns:m,dropdownTrigger:h,optionsPosition:S,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:F,prependPlaceholder:N,allOption:re,showNonTappableOptions:K,locationSearch:R,showProducts:pe,submitProgress:$,awaitAnswerOnSubmit:E,submitAnswerTimeoutMs:Z,source:ht,value:y,completedParams:ue,onSubmit:(...V)=>at.current?.(...V),onResult:(...V)=>b.current?.(...V),onError:(...V)=>T.current?.(...V),onChange:(...V)=>z.current?.(...V),onParamsChange:(...V)=>D.current?.(...V),onFocus:()=>B.current?.(),onBlur:()=>X.current?.(),onProductSelect:V=>Te.current?Te.current(V):ke.HANDOFF_NOT_HANDLED,onProductAddToCart:V=>je.current?.(V),setCursor:V=>Ie.current?.(V),products:it.config,mapProducts:Ee});u.current=c,Ye(c.getState());let J=c.subscribe(V=>Ye(V));return()=>{J(),c.destroy(),u.current===c&&(u.current=null)}},[]);let r=(0,P.useRef)(Ne);(0,P.useEffect)(()=>{r.current!==Ne&&(r.current=Ne,u.current?.update({visitorId:Ne?$e:void 0,analyticsConsent:Ae}))},[Ne,$e,Ae]);let Y=typeof g=="function"?"function":g,Fe=(0,P.useRef)(Y);(0,P.useEffect)(()=>{Fe.current!==Y&&(Fe.current=Y,u.current?.refreshAnalyticsConsent())},[Y]),(0,P.useEffect)(()=>{y!==void 0&&u.current?.setValue(y)},[y]),(0,P.useEffect)(()=>{ue!==void 0&&u.current?.setCompletedParams(ue)},[ue]);let Ke=JSON.stringify(l??null),gt;try{gt=JSON.stringify(s??null)}catch{gt="[unstringifiable]"}(0,P.useEffect)(()=>{u.current?.update({apiConfig:l,additionalContext:s,language:p,currency:v,productId:x,optionOverrides:ot.overrides,dropdownTrigger:h,optionsPosition:S,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:F,prependPlaceholder:N,allOption:re,showNonTappableOptions:K,locationSearch:R,showProducts:pe,submitProgress:$,awaitAnswerOnSubmit:E,submitAnswerTimeoutMs:Z})},[Ke,gt,p,v?.code,v?.rate,v?.country,x,ot.key,h,S,C,I,F,N,re,K,R,pe,$,E,Z]);let qe=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!qe.current){qe.current=!0;return}u.current?.update({products:it.config})},[it.enabled]),(0,P.useEffect)(()=>{u.current?.update({mapProducts:Ee})},[Ee]);let Ze=(0,P.useRef)(null);Ze.current===null&&(Ze.current={handleTextChange:c=>u.current?.handleTextChange(c),handleCompositionText:c=>u.current?.handleCompositionText(c),handleKeyDown:c=>{let J="nativeEvent"in c?c.nativeEvent:c;u.current?.handleKeyDown(J)},setFocused:c=>u.current?.setFocused(c),startEditingParam:c=>u.current?.startEditingParam(c),removeParam:c=>u.current?.removeParam(c)??!1,exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:c=>u.current?.handleCaretAfterInput(c),handleCaretMove:c=>u.current?.handleCaretMove(c),replaceEditingRange:c=>u.current?.replaceEditingRange(c)??!1,setActivePill:c=>u.current?.setActivePill(c),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),refreshProducts:()=>u.current?.refreshProducts(),prepareSubmit:()=>u.current?.prepareSubmit(),getState:()=>u.current?.getState()??Ha,getResult:()=>u.current?.getResult()??Ri,awaitSubmitResult:()=>u.current?.awaitSubmitResult()??Promise.resolve(null),recordSubmit:c=>u.current?.recordSubmit(c),holdSubmit:c=>u.current?.holdSubmit(c),endSubmitProgress:()=>u.current?.endSubmitProgress(),getSearchId:()=>u.current?.getSearchId(),getVisitorId:()=>u.current?.getVisitorId(),refreshAnalyticsConsent:()=>u.current?.refreshAnalyticsConsent(),selectOption:(c,J)=>u.current?.selectOption(c,J),selectProduct:c=>u.current?.selectProduct(c),addProductToCart:c=>{let J=u.current;return!J||!je.current?Promise.resolve():J.addProductToCart(c)},setActiveDropdownIndex:c=>u.current?.setActiveDropdownIndex(c),clearHighlight:c=>u.current?.clearHighlight(c),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),setTime:c=>u.current?.setTime(c),commitTime:()=>u.current?.commitTime(),toggleMultiSelectOption:c=>u.current?.toggleMultiSelectOption(c),commitMultiSelect:()=>u.current?.commitMultiSelect(),setLocationQuery:c=>u.current?.setLocationQuery(c),moveLocationHighlight:c=>u.current?.moveLocationHighlight(c),commitLocation:c=>u.current?.commitLocation(c),setLocationFieldFocused:c=>u.current?.setLocationFieldFocused(c),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let w=Ze.current,xt=(0,P.useCallback)(c=>{let J=c.target.value,Mt=J.length>0&&!c.nativeEvent?.isComposing&&J[0]!==J[0].toUpperCase()?J[0].toUpperCase()+J.slice(1):J;u.current?.handleTextChange(Mt)},[]),nt=(0,P.useCallback)(c=>{u.current?.handleKeyDown(c.nativeEvent)},[]),rt=u.current,f=ut??Ha,st=y!==void 0?y:f.text,yt=ue!==void 0?ue:f.completedParams,Xe=f.actionableSuggestions,kt=Xe[0],St=(0,P.useMemo)(()=>(0,ke.withoutTraditionalAutocomplete)(Xe),[Xe]),lt=rt?.listboxId??"",Ct=f.activeDropdownIndex>=0&&rt?`${lt}-option-${f.activeDropdownIndex}`:void 0,Je=f.editingParam,A=f.editingIdentified,Lt=Je?(0,ke.editingSuggestion)(Je):A?{parameter:A.parameter,text:(0,ke.identifiedParamLabel)(A.parameter),required:!0,options:[]}:null,Ot=f.dropdownSuggestion??Lt??kt,Ut=(0,ke.dropdownPillsFor)(f.dropdownSuggestion,Lt,Xe),Tt=(0,ke.dateSelectionFor)(f),Dt=!rt||f.dropdownLoading;return{completedParams:yt,multiSelectView:f.multiSelectView,toggleMultiSelectOption:w.toggleMultiSelectOption,commitMultiSelect:w.commitMultiSelect,skippedParams:f.skippedParams,identifiedParams:f.identifiedParams,suggestionPills:St,setActivePill:w.setActivePill,skipActivePill:w.skipActivePill,removeLastParam:w.removeLastParam,segments:f.segments,newParamId:f.newParamId,clearNewParamId:w.clearNewParamId,suggestions:f.suggestions,activeIndex:f.activeDropdownIndex,isReady:f.isReady,isLoading:Dt,isFocused:f.isFocused,isDropdownOpen:f.isDropdownOpen,isActivePillSelected:f.isActivePillSelected,blockingChips:f.blockingChips,placeholderText:f.placeholderText,listboxId:lt,error:f.error,products:f.products,customFields:f.customFields,selectProduct:w.selectProduct,addProductToCart:w.addProductToCart,handleTextChange:w.handleTextChange,handleCompositionText:w.handleCompositionText,handleKeyDown:w.handleKeyDown,setFocused:w.setFocused,editingParam:Je,editingIdentified:A,editingAnchor:f.editingAnchor,caretOffset:f.caretOffset,startEditingParam:w.startEditingParam,removeParam:w.removeParam,exitEditMode:w.exitEditMode,handleCaretAfterInput:w.handleCaretAfterInput,handleCaretMove:w.handleCaretMove,replaceEditingRange:w.replaceEditingRange,inputProps:{value:st,placeholder:f.placeholderText||void 0,onChange:xt,onKeyDown:nt,onFocus:w.handleFocus,onBlur:w.handleBlur,role:"combobox","aria-expanded":f.isDropdownOpen,"aria-activedescendant":Ct,"aria-autocomplete":"list","aria-controls":lt},reset:w.reset,refreshProducts:w.refreshProducts,prepareSubmit:w.prepareSubmit,getState:w.getState,getResult:w.getResult,awaitSubmitResult:w.awaitSubmitResult,recordSubmit:w.recordSubmit,holdSubmit:w.holdSubmit,endSubmitProgress:w.endSubmitProgress,getSearchId:w.getSearchId,getVisitorId:w.getVisitorId,refreshAnalyticsConsent:w.refreshAnalyticsConsent,isSubmitting:f.isSubmitting,selectingProductId:f.selectingProductId,dropdownProps:{suggestions:Ot?[{...Ot,options:f.dropdownOptions}]:[],activeIndex:f.activeDropdownIndex,onSelect:w.selectOption,onHighlight:w.setActiveDropdownIndex,onUnhighlight:w.clearHighlight,isOpen:f.isDropdownOpen,id:lt,pills:Ut,activeSelected:f.isActivePillSelected,onPillClick:w.setActivePill,onSkip:w.skipActivePill,showSkipButton:(fe??!0)&&!Je&&!A,showOptionIcons:H??!0,showOptionImages:_??!0,showOptionCounts:ne??!0,skipDisabled:f.inSelectionAnimation,isLoading:Dt,skeletonExiting:f.skeletonExiting,isInputEmpty:st.trim().length===0,language:p,products:f.products,productImageFallback:Se,showProductVendor:Ce,onProductSelect:w.selectProduct,busyProductId:f.selectingProductId,seeAllBusy:f.isSubmitting,onProductAddToCart:Me?w.addProductToCart:void 0,onProductFocusChange:w.setFocused,formatType:f.activeFormatType,dateView:f.dateView,selectedDateIso:Tt.selectedIso,selectedDateRange:Tt.selectedRange,dateRangeStart:Tt.rangeStart,dateReferences:Tt.references,onPreviousMonth:w.showPreviousMonth,onNextMonth:w.showNextMonth,timeView:f.timeView,multiSelectView:f.dropdownMultiSelect,onMultiSelectCommit:w.commitMultiSelect,onTimeChange:w.setTime,onTimeCommit:w.commitTime,locationView:f.locationView,isReediting:f.editingParam!=null,onLocationQuery:w.setLocationQuery,onLocationMove:w.moveLocationHighlight,onLocationCommit:w.commitLocation,onLocationFocusChange:w.setLocationFieldFocused,isFocused:f.isFocused||f.locationFieldFocused,optionsPosition:S??"below"}}}var G=require("@magicx-eng/ai-autocomplete-vanilla"),O=require("react"),Vt;function zi(){if(Vt!==void 0)return Vt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Vt=e.contentEditable==="plaintext-only",Vt}function Ba(e){let{segments:a,showChipIcons:t=!0,showChipImages:n=!0,showChipRemove:o=!1,blockingParamIds:l,focusInputOnSelect:s,removeParam:p,newParamId:v,editingParam:x,editingIdentified:k,editingAnchor:g,caretOffset:m,placeholderText:h,hintSuggestions:S,isFocused:C,isDropdownOpen:I,listboxId:F,activeDescendantId:N,autoFocus:re,handleTextChange:K,handleCompositionText:R,handleKeyDown:H,handleCaretAfterInput:_,handleCaretMove:ne,startEditingParam:fe,replaceEditingRange:pe,setFocused:$}=e,E=(0,O.useRef)(null),Z=(0,O.useRef)(!1),Se=(0,O.useRef)(""),Ce=(0,O.useRef)(""),he=(0,O.useRef)(null),i=(0,O.useRef)(0);he.current=m;let y=(0,O.useRef)(s);y.current=s,(0,O.useEffect)(()=>{if(!re)return;let b=E.current;if(!b)return;document.activeElement===b?$(!0):b.focus();let T=b.ownerDocument??document,z=T.getSelection(),D=z&&z.rangeCount>0&&b.contains(z.anchorNode);if(z&&!D){let B=T.createRange();B.selectNodeContents(b),B.collapse(!0),z.removeAllRanges(),z.addRange(B)}},[re,$]),(0,O.useEffect)(()=>{let b=E.current;if(!b)return;let T=b.ownerDocument??document,z=()=>{let D=T.getSelection();if(!D||D.rangeCount===0||!D.anchorNode||!b.contains(D.anchorNode))return;let B=D.anchorNode,X=B.nodeType===Node.ELEMENT_NODE?B:B.parentElement,Te=(D.isCollapsed?X?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,je=x?.id??k?.id??null;if(Te&&Te!==je){fe(Te);return}performance.now()-i.current<50||ne((0,G.getCursorOffset)(b))};return T.addEventListener("selectionchange",z),()=>T.removeEventListener("selectionchange",z)},[x,k,fe,ne]),(0,O.useEffect)(()=>{let b=E.current;if(!b)return;let T=z=>{let D=(0,G.chipIdFromTap)(b,z.target);D&&(fe(D),(0,G.keepCaretOnChip)(b,D))};return b.addEventListener("click",T),()=>b.removeEventListener("click",T)},[fe]);let ue=o||(l?.length??0)>0;(0,O.useEffect)(()=>{let b=E.current;if(!(!b||!p||!ue))return(0,G.attachChipRemove)(b,p)},[p,ue]),(0,O.useLayoutEffect)(()=>{let b=E.current;b&&(0,G.renderEditableContent)({input:b,segments:a,newParamId:v,editingParamId:x?.id??null,placeholderText:h??"",isFocused:C,showChipIcons:t,showChipImages:n,showChipRemove:o,blockingParamIds:l,hintOptions:(0,G.startingHintOptions)(S??[])})},[a,v,x,h,S,C,t,n,o,l]),(0,O.useEffect)(()=>{let b=E.current;return()=>{b&&(0,G.cancelStartingHint)(b)}},[]),(0,O.useLayoutEffect)(()=>{let b=Se.current,T=v??"";if(Se.current=T,!T||T===b)return;let z=E.current;if(!z)return;let D=he.current??(0,G.plainTextLength)(z);(0,G.settlePickFocus)(z,D,(0,G.focusesInputOnSelect)(y.current))},[v]),(0,O.useLayoutEffect)(()=>{let b=Ce.current,T=x?.id??"";if(Ce.current=T,!T||T===b||g==null)return;let z=E.current;z&&(0,G.setCursorOffset)(z,g)},[x,g]);let me=(0,O.useCallback)(()=>{let b=E.current;if(!b)return;let T=(0,G.extractPlainText)(b),D=T.length>0&&T[0]!==T[0].toUpperCase()?T[0].toUpperCase()+T.slice(1):T;if(Z.current){R(D);return}K(D)},[K,R]),we=(0,O.useCallback)(()=>{i.current=performance.now(),me();let b=E.current;b&&_((0,G.getCursorOffset)(b))},[me,_]);(0,O.useEffect)(()=>{let b=E.current;if(!b)return;let T=z=>{let D=z,B=D.inputType;if(B==="insertParagraph"||B==="insertLineBreak"||B==="insertFromDrop"){z.preventDefault();return}if(B.startsWith("insert")||B.startsWith("delete")){let X=B.startsWith("delete")?"":D.data??"";pe(X)&&z.preventDefault()}};return b.addEventListener("beforeinput",T),()=>b.removeEventListener("beforeinput",T)},[pe]);let pt=(0,O.useCallback)(()=>{Z.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),Ue=(0,O.useCallback)(()=>{Z.current=!1,E.current?.removeAttribute("data-aia-composing"),me()},[me]),Qe=(0,O.useCallback)(b=>{b.preventDefault();let T=E.current;if(!T)return;let z=(b.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!z)return;let D=T.ownerDocument??document,B=D.getSelection();if(!B||B.rangeCount===0)return;let X=B.getRangeAt(0);if(!T.contains(X.startContainer))return;X.deleteContents();let Ie=D.createTextNode(z);X.insertNode(Ie),X.setStartAfter(Ie),X.collapse(!0),B.removeAllRanges(),B.addRange(X),me()},[me]),Me=(0,O.useCallback)(b=>H(b),[H]),ht=(0,O.useCallback)(()=>$(!0),[$]),tt=(0,O.useCallback)(()=>$(!1),[$]),u=(0,O.useCallback)(()=>E.current?.focus(),[]),ut=(0,O.useCallback)(()=>E.current?.blur(),[]),Ye=(0,O.useCallback)(()=>{let b=E.current;return b?(0,G.extractPlainText)(b):""},[]),at=zi()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:at,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":F,"aria-expanded":I,"aria-activedescendant":N,spellCheck:!0,enterKeyHint:"send",onInput:we,onKeyDown:Me,onCompositionStart:pt,onCompositionEnd:Ue,onPaste:Qe,onFocus:ht,onBlur:tt},getPlainText:Ye,focus:u,blur:ut}}var Ge=require("react/jsx-runtime");function Li(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Wa=(0,Q.forwardRef)(function({onSubmit:a,onResult:t,onError:n,optionOverrides:o,maskCompletedText:l,className:s,apiConfig:p,additionalContext:v,language:x,currency:k,productId:g,visitorId:m,analyticsConsent:h,columns:S,pillPlacement:C="dropdown",mode:I="auto",optionsPosition:F="below",animations:N=!0,optionsStyle:re="floating",dropdownTrigger:K,closeDropdownOnBlur:R,focusInputOnSelect:H,startingState:_,prependPlaceholder:ne,allOption:fe,showNonTappableOptions:pe,locationSearch:$,showOptionIcons:E=!0,showChipIcons:Z=!0,showChipImages:Se=!0,showChipRemove:Ce=!1,showOptionImages:he=!0,showOptionCounts:i=!0,showSkipButton:y,showProducts:ue,submitProgress:me,awaitAnswerOnSubmit:we,submitAnswerTimeoutMs:pt,productsLayout:Ue,productImageFallback:Qe,showProductVendor:Me,autoFocus:ht=!0,onFocus:tt,onBlur:u,value:ut,completedParams:Ye,onChange:at,onParamsChange:b,products:T,mapProducts:z,onProductSelect:D,onProductAddToCart:B,submitButton:X,resetOnSubmit:Ie=!0,seeAllResults:Te=!1},je){let be=(0,Q.useRef)(null),$e=(0,Q.useRef)(null),Ne=(0,Q.useRef)(null),mt=(0,Q.useRef)(()=>{}),Ae=(0,Q.useRef)(null),it=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let L=be.current;if(L)return Ae.current?Ae.current.setMode(I):Ae.current=new De.ModeController(L,I),()=>{Ae.current?.destroy(),Ae.current=null}},[I]);let vt=(0,Q.useCallback)(L=>{let He=it.current?.current;He&&(He.focus(),(0,De.setCursorOffset)(He,L))},[]),{completedParams:Pe,suggestionPills:Ee,setActivePill:ot,skipActivePill:r,segments:Y,newParamId:Fe,clearNewParamId:Ke,placeholderText:gt,isFocused:qe,isDropdownOpen:Ze,isActivePillSelected:w,blockingChips:xt,isLoading:nt,isReady:rt,activeIndex:f,listboxId:st,handleTextChange:yt,handleCompositionText:Xe,handleKeyDown:kt,setFocused:St,editingParam:lt,editingIdentified:Ct,editingAnchor:Je,caretOffset:A,startEditingParam:Lt,removeParam:Ot,handleCaretAfterInput:Ut,handleCaretMove:Tt,replaceEditingRange:Dt,dropdownProps:c,reset:J,refreshProducts:V,prepareSubmit:Mt,getState:Nt,getResult:aa,awaitSubmitResult:ia,recordSubmit:oa,holdSubmit:na,endSubmitProgress:ra,getSearchId:sa,getVisitorId:la,refreshAnalyticsConsent:da,isSubmitting:Qt}=_t({onSubmit:L=>mt.current(L),onResult:t,onError:n,optionOverrides:o,maskCompletedText:l,apiConfig:p,additionalContext:v,language:x,currency:k,productId:g,visitorId:m,analyticsConsent:h,columns:S,dropdownTrigger:K,optionsPosition:F,closeDropdownOnBlur:R,focusInputOnSelect:H,startingState:_,prependPlaceholder:ne,allOption:fe,showNonTappableOptions:pe,locationSearch:$,showOptionIcons:E,showOptionImages:he,showOptionCounts:i,showSkipButton:y,showProducts:ue,submitProgress:me,awaitAnswerOnSubmit:we,submitAnswerTimeoutMs:pt,onFocus:tt,onBlur:u,value:ut,completedParams:Ye,onChange:at,onParamsChange:b,products:T,mapProducts:z,onProductSelect:D,onProductAddToCart:B,source:"full-sdk",setCursor:vt});(0,Q.useEffect)(()=>{if(!Fe)return;let L=window.setTimeout(()=>Ke(),650);return()=>window.clearTimeout(L)},[Fe,Ke]);let Ga=(0,Q.useMemo)(()=>xt.map(L=>L.paramId),[xt]),Ka=f>=0?`${st}-option-${f}`:void 0,{inputRef:Pt,editorProps:qa,focus:ca,blur:pa,getPlainText:ha}=Ba({segments:Y,newParamId:Fe,editingParam:lt,editingIdentified:Ct,editingAnchor:Je,caretOffset:A,placeholderText:gt,hintSuggestions:C==="inline"?[]:Ee,isFocused:qe,showChipIcons:Z,showChipImages:Se,showChipRemove:Ce,blockingParamIds:Ga,removeParam:Ot,focusInputOnSelect:H,isDropdownOpen:Ze,listboxId:st,activeDescendantId:Ka,autoFocus:ht,handleTextChange:yt,handleCompositionText:Xe,handleKeyDown:kt,handleCaretAfterInput:Ut,handleCaretMove:Tt,startEditingParam:Lt,replaceEditingRange:Dt,setFocused:St});it.current=Pt,(0,Q.useLayoutEffect)(()=>{let L=$e.current,He=Pt.current;if(!L||!He)return;let bt=()=>{let At=L.firstElementChild;if(!At)return;let ja=At.getBoundingClientRect(),$a=He.getBoundingClientRect();ja.top>=$a.bottom-2?L.setAttribute("data-aia-pill-wrapped",""):L.removeAttribute("data-aia-pill-wrapped")};bt();let It=new ResizeObserver(bt);return It.observe(He),()=>It.disconnect()},[Y,Ee.length,nt,Pt]),(0,Q.useEffect)(()=>{let L=Ne.current;if(L)return(0,De.watchEditorHeight)(L)},[]),(0,Q.useImperativeHandle)(je,()=>({focus:ca,blur:pa,reset:J,refreshProducts:V,setMode:L=>Ae.current?.setMode(L),skipActivePill:r,endSubmitProgress:ra,getSearchId:sa,getVisitorId:la,refreshAnalyticsConsent:da}),[ca,pa,J,V,r,ra,sa,la,da]);let ft=!!Y.length||Pe.length>0,Ft=(0,Q.useCallback)((L,He)=>{let bt=Nt(),It=(0,De.buildSubmitResult)(ha(),bt.completedParams,bt.skippedParams,{identifiedParams:bt.identifiedParams,isReady:bt.isReady,customFields:He.custom_fields??null,customFieldsStale:He.custom_fields_stale===!0});L&&oa(It);let At=a(It);return L&&!Ie&&na(At),Ie&&J(),At},[oa,na,Ie,Nt,a,J,ha]),Yt=(0,Q.useCallback)(()=>{if(ft&&!Nt().isSubmitting){if(we){ia().then(L=>{L&&Ft(!0,L)});return}Mt(),Ft(!0,aa())}},[ft,Nt,we,ia,Mt,aa,Ft]);mt.current=L=>ft?Ft(!1,L):void 0;let _a=Te&&!c.isInputEmpty&&ft,Va=Yt,Ua=(0,Q.useCallback)(L=>{L.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||Pt.current&&(0,De.focusEditorFromTap)(Pt.current)},[Pt]),Qa=C==="inline",Ya=C==="dropdown";return(0,Ge.jsxs)("div",{ref:be,className:`magicx-aia ${wt.container} ${s??""}`,"data-pill-placement":C,"data-options-position":F,"data-animations":N?"on":"off","data-aia-options-style":re,"data-mode":Li(I),children:[(0,Ge.jsx)(Kt,{...c,showPills:Ya,productsLayout:Ue,productImageFallback:Qe,showProductVendor:Me,onSeeAllResults:_a?Va:void 0,fullWidth:Te}),(0,Ge.jsxs)("div",{className:wt.inputWrapper,"data-aia-input-wrapper":"",onClick:Ua,children:[(0,Ge.jsxs)("div",{ref:Ne,className:wt.editorArea,"data-aia-editor":"",children:[(0,Ge.jsx)("div",{...qa,className:wt.input,"data-aia-input":""}),Qa&&(nt||Ee.length>0)&&(0,Ge.jsx)("span",{ref:$e,className:wt.pillListContainer,"data-aia-pill-list-container":"",children:(0,Ge.jsx)(Wt,{pills:Ee,activePillIndex:0,activeSelected:w,onSelectPill:ot,loading:nt})})]}),X===null?null:X===void 0?(0,Ge.jsx)(Ma,{disabled:!ft,ready:ft&&rt,busy:Qt,onClick:Yt,label:(0,De.uiStringsFor)(x).submit}):(0,Ge.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Qt?"busy":void 0,"aria-busy":Qt?!0:void 0,className:wt.submitSlot,onClick:L=>{ft&&(L.stopPropagation(),Yt())},children:X})]})]})});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,focusesInputOnSelect,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isTouchPrimary,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
3940
4003
|
//# sourceMappingURL=index.js.map
|