@magicx-eng/ai-autocomplete-react 0.66.2 → 0.66.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +81 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -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 Yt=Object.defineProperty;var ja=Object.getOwnPropertyDescriptor;var $a=Object.getOwnPropertyNames;var Za=Object.prototype.hasOwnProperty;var Xa=(e,a)=>{for(var t in a)Yt(e,t,{get:a[t],enumerable:!0})},Ja=(e,a,t,
|
|
1
|
+
"use strict";var Yt=Object.defineProperty;var ja=Object.getOwnPropertyDescriptor;var $a=Object.getOwnPropertyNames;var Za=Object.prototype.hasOwnProperty;var Xa=(e,a)=>{for(var t in a)Yt(e,t,{get:a[t],enumerable:!0})},Ja=(e,a,t,n)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of $a(a))!Za.call(e,i)&&i!==t&&Yt(e,i,{get:()=>a[i],enumerable:!(n=ja(a,i))||n.enumerable});return e};var ei=e=>Ja(Yt({},"__esModule",{value:!0}),e);var zi={};Xa(zi,{AIAutocomplete:()=>Ba,AIAutocompleteDropdown:()=>Gt,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:()=>qt,visibleDateRange:()=>d.visibleDateRange,withSkippedParams:()=>d.withSkippedParams});module.exports=ei(zi);var d=require("@magicx-eng/ai-autocomplete-vanilla");var j=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
|
|
2
2
|
position: relative;
|
|
3
3
|
/* Inherits the host page's font by default. Consumers can pin a specific
|
|
4
4
|
font on the library via \`--aia-font-family: 'Custom Font'\` without
|
|
@@ -439,7 +439,7 @@
|
|
|
439
439
|
transition: none;
|
|
440
440
|
}
|
|
441
441
|
}
|
|
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
|
|
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 M=require("@magicx-eng/ai-autocomplete-vanilla"),ee=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
443
443
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
444
444
|
* Consumer CSS always wins without !important.
|
|
445
445
|
*
|
|
@@ -1164,13 +1164,15 @@
|
|
|
1164
1164
|
);
|
|
1165
1165
|
}
|
|
1166
1166
|
}
|
|
1167
|
-
/* While the panel glides
|
|
1168
|
-
the width it lands at
|
|
1169
|
-
|
|
1170
|
-
|
|
1167
|
+
/* While the panel glides to a new width (panelMorph.ts), its new content is
|
|
1168
|
+
laid out at the width it lands at, so it never rewraps under the glide:
|
|
1169
|
+
wider, the panel, which clips, reveals it as it opens; narrower, it starts
|
|
1170
|
+
at its final width instead of squeezing frame by frame. The leaving copy
|
|
1171
|
+
keeps its own width. */
|
|
1171
1172
|
[data-aia-dropdown][data-aia-glide-width]
|
|
1172
1173
|
> :not(.magicx-aia-panel-ghost):not([data-aia-scroll-arrow]) {
|
|
1173
1174
|
min-width: var(--aia-glide-content-width, auto);
|
|
1175
|
+
max-width: var(--aia-glide-content-width, none);
|
|
1174
1176
|
}
|
|
1175
1177
|
/* The All row's tile shows the first options' pictures together: two side by
|
|
1176
1178
|
side, three as a tall half and two quarters, four in a 2x2 grid. Each is
|
|
@@ -1811,7 +1813,7 @@
|
|
|
1811
1813
|
opacity: 1;
|
|
1812
1814
|
}
|
|
1813
1815
|
}
|
|
1814
|
-
`,document.head.appendChild(e)}var
|
|
1816
|
+
`,document.head.appendChild(e)}var Ae={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"),ha=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
1817
|
|
|
1816
1818
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1817
1819
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -2008,7 +2010,7 @@
|
|
|
2008
2010
|
opacity: 0.8;
|
|
2009
2011
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
2010
2012
|
}
|
|
2011
|
-
`,document.head.appendChild(e)}var
|
|
2013
|
+
`,document.head.appendChild(e)}var J={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 we=require("react/jsx-runtime"),ti=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ua({options:e,activeIndex:a,listboxId:t,view:n,selection:i,onSelect:c,onHighlight:s,onUnhighlight:p,onPreviousMonth:b,onNextMonth:y}){let k=(0,ae.isoDate)(new Date),g=(0,ae.visibleDateRange)({pendingStart:i.rangeStart,highlightedIso:(0,ae.cellIso)(e[a]),selected:i.selectedRange,floor:i.floor});return(0,we.jsxs)("div",{className:J.datepicker,"data-aia-datepicker":"",children:[(0,we.jsxs)("div",{className:J.header,children:[(0,we.jsx)("button",{type:"button",tabIndex:-1,className:J.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:b,children:"\u2039"}),(0,we.jsx)("span",{className:J.month,"data-aia-date-month":"","aria-live":"polite",children:(0,ae.monthLabel)(n)}),(0,we.jsx)("button",{type:"button",tabIndex:-1,className:J.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:y,children:"\u203A"})]}),(0,we.jsx)("div",{className:J.weekdays,"aria-hidden":"true",children:ae.WEEKDAY_LABELS.map((h,u)=>(0,we.jsx)("span",{className:J.weekday,children:h},ti[u]))}),(0,we.jsx)("div",{className:J.grid,"data-aia-date-grid":"",children:e.map((h,u)=>(0,we.jsx)(ai,{option:h,id:`${t}-option-${u}`,index:u,isHighlighted:u===a&&h.is_tappable,isToday:(0,ae.cellIso)(h)===k,isPast:(0,ae.isDimmedDay)((0,ae.cellIso)(h),k,i.floor),marks:(0,ae.dateCellMarks)((0,ae.cellIso)(h),{selectedIso:i.selectedIso,range:g,references:i.references}),onSelect:c,onHighlight:s,onUnhighlight:p},(0,ae.cellIso)(h)??`pad-${u}`))})]})}function ai({option:e,id:a,index:t,isHighlighted:n,isToday:i,isPast:c,marks:s,onSelect:p,onHighlight:b,onUnhighlight:y}){let[k,g]=(0,ha.useState)(!1),h=(0,ae.cellDay)(e);if(h==null)return(0,we.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${J.cell} ${J.blank}`});let u=()=>{g(!0),p(e),setTimeout(()=>g(!1),170)},S=[J.cell,J.day,c?J.past:"",n?J.highlighted:"",i?J.today:"",s.inRange?J.inRange:"",s.selected?J.selected:"",s.reference?J.reference:"",k?J.pressed:""].filter(Boolean).join(" ");return(0,we.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:u,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),u())},onMouseEnter:()=>b(t),onMouseLeave:y?()=>y(t):void 0,children:(0,we.jsx)("span",{className:J.number,children:h})})}var rt=require("@magicx-eng/ai-autocomplete-vanilla"),Ft=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
2014
|
display: flex;
|
|
2013
2015
|
flex-wrap: wrap;
|
|
2014
2016
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -2048,7 +2050,7 @@
|
|
|
2048
2050
|
.aia-cluster[data-justify="around"] {
|
|
2049
2051
|
justify-content: space-around;
|
|
2050
2052
|
}
|
|
2051
|
-
`,document.head.appendChild(e)}var jt=require("react/jsx-runtime");function zt({gap:e,align:a="center",justify:t="start",noWrap:
|
|
2053
|
+
`,document.head.appendChild(e)}var jt=require("react/jsx-runtime");function zt({gap:e,align:a="center",justify:t="start",noWrap:n=!1,inline:i=!1,className:c,children:s,...p}){let b=e?{"--aia-cluster-gap":e}:void 0,y={className:c?`aia-cluster ${c}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":n||void 0,"data-inline":i||void 0,style:b,...p};return i?(0,jt.jsx)("span",{...y,children:s}):(0,jt.jsx)("div",{...y,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
2054
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
2053
2055
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
2054
2056
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -2196,7 +2198,7 @@
|
|
|
2196
2198
|
justify-content: flex-end;
|
|
2197
2199
|
}
|
|
2198
2200
|
}
|
|
2199
|
-
`,document.head.appendChild(e)}var
|
|
2201
|
+
`,document.head.appendChild(e)}var tt={footer:"aia-footer-qQQ7x",row:"aia-row-BgZ6Q",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg"};var Ve=require("react/jsx-runtime");function ma({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,rt.uiStringsFor)()}){let{key:n,hint:i}=(0,rt.getFooterHint)(e,a,t),[c,s]=(0,Ft.useState)(rt.ATTRIBUTION_URL);return(0,Ft.useEffect)(()=>{s((0,rt.buildAttributionUrl)())},[]),(0,Ve.jsx)("footer",{className:tt.footer,"data-aia-footer":"",children:(0,Ve.jsxs)(zt,{justify:"between",noWrap:!0,className:tt.row,children:[(0,Ve.jsxs)(zt,{gap:"5px",className:tt.hintGroup,children:[(0,Ve.jsx)("kbd",{className:tt.key,children:n}),(0,Ve.jsx)("span",{className:tt.hint,children:i})]}),(0,Ve.jsx)("a",{className:tt.brandLink,href:c,target:"_blank",rel:"noopener noreferrer",children:(0,Ve.jsx)("span",{className:tt.badge,children:(0,Ve.jsx)("span",{className:tt.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
2202
|
Angular copy). The three are kept identical by
|
|
2201
2203
|
packages/vanilla/tests/render/locationFieldParity.test.ts. */
|
|
2202
2204
|
.aia-location-6-fsr {
|
|
@@ -2330,7 +2332,7 @@
|
|
|
2330
2332
|
.aia-loadingBar-OLCr4:nth-child(3) {
|
|
2331
2333
|
width: 60%;
|
|
2332
2334
|
}
|
|
2333
|
-
`,document.head.appendChild(e)}var
|
|
2335
|
+
`,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"),ii=0;function Lt(e){return e.getRootNode().activeElement??null}function ba(e){return e.getRootNode().getSelection?.()??document.getSelection()}function ga(e){if(!e.isContentEditable)return null;let a=ba(e);if(!a||a.rangeCount===0)return null;let t=a.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function fa(e,a){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=ba(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 oi=(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"})]}),ni=(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 wa({view:e,searchLabel:a,noResultsLabel:t,useTypedLabel:n,widgetFocused:i,reediting:c=!1,visible:s=!0,interactive:p=!0,onQuery:b,onMove:y,onCommit:k,onFocusChange:g}){let h=(0,se.useRef)(null),u=(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),ne=(0,se.useRef)(!1),K=(0,se.useRef)(!1),R=(0,se.useRef)(i);R.current=i;let H=(0,se.useRef)(g);H.current=g;let _=o=>{K.current=o,g(o)},$=()=>{let o=h.current;return o!=null&&Lt(o)===o},ke=()=>{let o=u.current;if(!o)return;let x=Lt(o);x instanceof HTMLElement&&x!==h.current&&x!==document.body&&!o.contains(x)&&(C.current=x,I.current=ga(x))},Z=o=>{let x=u.current;!x||!(o instanceof HTMLElement)||o===C.current||o===document.body||x.contains(o)||(C.current=o,I.current=ga(o))},A=(0,se.useRef)(null);A.current===null&&(A.current=`aia-location-${++ii}`);let re=`${A.current}-row-`;(0,se.useEffect)(()=>{let o=h.current;o&&o.value!==e.query&&Lt(o)!==o&&(o.value=e.query)},[e.query]),(0,se.useEffect)(()=>{i&&(c&&!ne.current&&(N.current=!1),ne.current=c);let o=h.current;if(o){if(!s&&$()){N.current=!0,X();return}if(!i){setTimeout(()=>{if(R.current)return;let x=C.current;x&&Lt(x)===x||(N.current=!1)},0);return}if(!(!c||N.current||!p||$())){if(ke(),_(!0),o.focus({preventScroll:!0}),!$()){N.current=!0,_(!1);return}o.value&&o.select()}}}),(0,se.useLayoutEffect)(()=>()=>{if(!K.current)return;let o=h.current,x=C.current;x?.isConnected&&o&&Lt(o)===o&&(F.current=!0,fa(x,I.current),F.current=!1),K.current=!1,H.current(!1)},[]);let X=(o=!1)=>{o&&(N.current=!0);let x=C.current;x?.isConnected&&$()&&(F.current=!0,fa(x,I.current),F.current=!1),_(!1)},Se=e.query.trim(),Ce=e.highlighted>=0&&e.highlighted<e.places.length?`${re}${e.highlighted}`:void 0,he=null;return e.places.length>0?he=e.places.map((o,x)=>(0,U.jsxs)("div",{id:`${re}${x}`,role:"option","aria-selected":x===e.highlighted,className:x===e.highlighted?`${ie.row} ${ie.highlighted}`:ie.row,"data-aia-location-row":"","data-aia-index":x,onClick:()=>{p&&(X(!0),k(x))},children:[(0,U.jsx)("span",{className:ie.pin,children:oi}),(0,U.jsxs)("span",{className:ie.text,children:[(0,U.jsx)("span",{className:ie.name,children:o.name}),o.secondary&&(0,U.jsx)("span",{className:ie.secondary,children:o.secondary})]})]},o.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:u,className:ie.location,"data-aia-location":"",onMouseDown:o=>{!(o.target instanceof Node)||!S.current?.contains(o.target)||(o.stopPropagation(),ke(),_(!0))},children:[(0,U.jsxs)("label",{ref:S,className:ie.field,children:[ni,(0,U.jsx)("input",{ref:h,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:o=>b(o.target.value),onFocus:o=>{Z(o.relatedTarget),_(!0)},onBlur:()=>{F.current||(N.current=!0,_(!1))},onKeyDown:o=>{if(!o.nativeEvent.isComposing)switch(o.key){case"ArrowDown":case"ArrowUp":o.preventDefault(),y(o.key==="ArrowDown"?1:-1);return;case"Enter":if(o.preventDefault(),!p)return;X(!0),k();return;case"Escape":o.preventDefault(),o.stopPropagation(),N.current=!0,X();return;case"Backspace":if(o.currentTarget.value!=="")return;o.preventDefault(),N.current=!0,X();return}}})]}),(0,U.jsx)("div",{className:ie.results,"data-aia-location-results":"","aria-live":"polite",children:he})]})}var Ht=require("@magicx-eng/ai-autocomplete-vanilla");var va=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
2336
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
2335
2337
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
2336
2338
|
as it was when the outline was dashed. */
|
|
@@ -2488,7 +2490,7 @@
|
|
|
2488
2490
|
opacity: 0;
|
|
2489
2491
|
}
|
|
2490
2492
|
}
|
|
2491
|
-
`,document.head.appendChild(e)}var
|
|
2493
|
+
`,document.head.appendChild(e)}var Ue={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 st=require("react/jsx-runtime"),$t={selected:1,first:.7,next:.4,last:.2};function xa({label:e,state:a,active:t,rounded:n,loading:i,smartSuggestion:c,completionHeader:s,onClick:p}){let b=[Ue.pill,n?Ue.rounded:"",i?Ue.skeleton:""].filter(Boolean).join(" ");return(0,st.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":i?"":void 0,"data-aia-smart-suggestion":c?s?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:b,style:{"--aia-pill-opacity":$t[a]},onMouseDown:y=>y.preventDefault(),onClick:i?void 0:p,disabled:i,children:c?(0,st.jsxs)(st.Fragment,{children:[(0,st.jsx)("span",{className:`${Ue.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,st.jsx)("span",{className:`${Ue.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:va.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
2494
|
position: relative;
|
|
2493
2495
|
z-index: 1;
|
|
2494
2496
|
pointer-events: auto;
|
|
@@ -2498,7 +2500,7 @@
|
|
|
2498
2500
|
align-items: center;
|
|
2499
2501
|
vertical-align: middle;
|
|
2500
2502
|
}
|
|
2501
|
-
`,document.head.appendChild(e)}var Zt={list:"aia-list-qvLqO"};var Ot=require("react/jsx-runtime"),ri=[125,69];function ya(e){return e===0?"first":e===1?"next":"last"}function Bt({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:
|
|
2503
|
+
`,document.head.appendChild(e)}var Zt={list:"aia-list-qvLqO"};var Ot=require("react/jsx-runtime"),ri=[125,69];function ya(e){return e===0?"first":e===1?"next":"last"}function Bt({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:n,rounded:i,loading:c}){return c&&e.length===0?(0,Ot.jsx)("span",{className:Zt.list,"data-aia-pill-list-loading":"",children:ri.map((s,p)=>(0,Ot.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Ue.pill} ${i?Ue.rounded:""} ${Ue.skeleton}`,style:{width:s,"--aia-pill-opacity":$t[ya(p)]}},`skel-${s}`))}):(0,Ot.jsx)("span",{className:Zt.list,"data-aia-pill-list-loading":c?"":void 0,children:e.map((s,p)=>{let b=!!n&&p===a;return(0,Ot.jsx)(xa,{label:s.text,state:b?"selected":ya(p),selected:b,active:p===a,rounded:i,loading:c,smartSuggestion:(0,Ht.isSmartSuggestion)(s),completionHeader:(0,Ht.isTraditionalAutocompleteSuggestion)(s),onClick:()=>t(p)},`${s.parameter}-${s.text}`)})})}var Ee=require("@magicx-eng/ai-autocomplete-vanilla"),ve=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
2504
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
2503
2505
|
theming one package sees the same result in the other.
|
|
2504
2506
|
|
|
@@ -3125,7 +3127,7 @@
|
|
|
3125
3127
|
opacity: 0.01;
|
|
3126
3128
|
}
|
|
3127
3129
|
}
|
|
3128
|
-
`,document.head.appendChild(e)}var
|
|
3130
|
+
`,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 ka({products:e,listboxId:a,onSelect:t,busyProductId:n=null,onAddToCart:i,onFocusChange:c,focusable:s=!0,loading:p=!1,layout:b="row",imageFallback:y="image",showVendor:k=!0,strings:g=(0,Ee.uiStringsFor)()}){let h=e.length>0,u=(0,ve.useRef)(null);if((0,ve.useEffect)(()=>{let C=u.current;if(!(!h||!C))return(0,Ee.attachProductRowWheel)(C)},[h]),!h)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":b,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:u,className:oe.row,"data-aia-products-row":"",children:e.map((C,I)=>(0,q.jsx)(si,{product:C,id:`${a}-product-${I}`,onSelect:t,busy:C.id===n,onAddToCart:i,onFocusChange:c,focusable:s,imageFallback:y,showVendor:k,soldOut:g.soldOut,addToCart:g.addToCart},C.id))})]})}function si({product:e,id:a,onSelect:t,busy:n,onAddToCart:i,onFocusChange:c,focusable:s,imageFallback:p,showVendor:b,soldOut:y,addToCart:k}){let g=!!i&&e.available!==!1,[h,u]=(0,ve.useState)(null),S=I=>{I.relatedTarget?.closest("[data-aia-dropdown]")||c?.(!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:h?{"--aia-product-photo-fill-x":String(h.x),"--aia-product-photo-fill-y":String(h.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:C,onKeyDown:I=>{I.key!=="Enter"&&I.key!==" "||(I.preventDefault(),t(e))},onFocus:()=>c?.(!0),onBlur:S,children:[(0,q.jsx)(ci,{sources:(0,Ee.productImageSources)(e.imageUrl),title:e.title,fallback:p,onPhotoFill:u},(0,Ee.productImageSrc)(e.imageUrl)??""),(0,q.jsxs)("span",{className:oe.body,children:[b&&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:y}):null]}),g&&i?(0,q.jsx)(di,{product:e,label:`${k}: ${e.title}`,focusable:s,onAddToCart:i,onFocus:()=>c?.(!0),onBlur:S},li(e)):null]})}function li(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(a=>a??"").join("\0")}function di({product:e,label:a,focusable:t,onAddToCart:n,onFocus:i,onBlur:c}){let[s,p]=(0,ve.useState)(null),b=(0,ve.useRef)(null),y=(0,ve.useRef)(e);y.current=e;let k=(0,ve.useRef)(!0);(0,ve.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let g=u=>{b.current=u,k.current&&p(u)},h=u=>{if(u.preventDefault(),u.stopPropagation(),b.current==="adding")return;g("adding");let S;try{S=Promise.resolve(n(y.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:h,onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||h(u)},onFocus:u=>{u.stopPropagation(),i()},onBlur:u=>{u.stopPropagation(),c(u)},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 ci({sources:e,title:a,fallback:t,onPhotoFill:n}){let[i,c]=(0,ve.useState)(0),s=e[i],p=!!s,[b,y]=(0,ve.useState)(null),k=!p&&t==="initial";return(0,ve.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&&b===s?"":void 0,children:[p?(0,q.jsx)("img",{className:oe.image,src:s,alt:"",loading:"lazy",decoding:"async",onLoad:g=>{y(s),n((0,Ee.productPhotoFill)(g.currentTarget.naturalWidth,g.currentTarget.naturalHeight))},onError:()=>{i+1>=e.length&&n(null),c(g=>g+1)}}):null,k?(0,Ee.productInitial)(a):null]})}var W=require("@magicx-eng/ai-autocomplete-vanilla"),Re=require("react");var Sa=require("@magicx-eng/ai-autocomplete-vanilla"),Wt=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
3131
|
display: grid;
|
|
3130
3132
|
grid-template-columns: repeat(
|
|
3131
3133
|
auto-fit,
|
|
@@ -3169,7 +3171,7 @@
|
|
|
3169
3171
|
:where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
|
|
3170
3172
|
max-height: var(--aia-grid-max-height, 120px);
|
|
3171
3173
|
}
|
|
3172
|
-
`,document.head.appendChild(e)}var Ta=require("react/jsx-runtime");function Ca({min:e="16rem",max:a,gap:t,scroll:
|
|
3174
|
+
`,document.head.appendChild(e)}var Ta=require("react/jsx-runtime");function Ca({min:e="16rem",max:a,gap:t,scroll:n=!1,maxHeight:i,scrollResetKey:c,cols:s,template:p,innerRef:b,className:y,children:k,...g}){let h=(0,Wt.useRef)(null);(0,Wt.useLayoutEffect)(()=>{if(c===void 0)return;let S=h.current;S&&(S.scrollTop=0)},[c]);let u={"--aia-grid-min":e};return a&&(u["--aia-grid-max"]=a),t&&(u["--aia-grid-gap"]=t),i&&(u["--aia-grid-max-height"]=i),s&&(u.gridTemplateColumns=(0,Sa.optionsGridTemplateColumns)(s)),p&&(u.gridTemplateColumns=p),(0,Ta.jsx)("div",{ref:S=>{h.current=S,b?.(S)},className:y?`aia-grid ${y}`:"aia-grid","data-scroll":n||void 0,style:u,...g,children:k})}var ce=require("@magicx-eng/ai-autocomplete-vanilla"),xe=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
3175
|
position: relative;
|
|
3174
3176
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
3175
3177
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -3287,31 +3289,22 @@
|
|
|
3287
3289
|
opacity: 0.5;
|
|
3288
3290
|
}
|
|
3289
3291
|
|
|
3290
|
-
/* Press feedback: the picked option
|
|
3291
|
-
|
|
3292
|
+
/* Press feedback: the picked option fills with the option background (the
|
|
3293
|
+
row's own background transition) while every other option steps back in
|
|
3294
|
+
opacity. No scale: a row that shrinks and springs back reads as a jolt,
|
|
3295
|
+
and the next question then arrives on top of it. The press stays on until
|
|
3296
|
+
the options leave, so the picked row never flashes back to normal first. */
|
|
3292
3297
|
.aia-pressed-98o-r {
|
|
3293
3298
|
color: var(--aia-option-color-selected, var(--aia-color-text-default, #fff));
|
|
3294
|
-
|
|
3299
|
+
background: var(--aia-option-bg, transparent);
|
|
3300
|
+
font-weight: 500;
|
|
3295
3301
|
}
|
|
3296
3302
|
|
|
3297
3303
|
[role="listbox"]:has(.aia-pressed-98o-r) .aia-item-d4vpD:not(.aia-pressed-98o-r) {
|
|
3298
3304
|
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
|
-
}
|
|
3305
|
+
transition:
|
|
3306
|
+
background-color 180ms ease,
|
|
3307
|
+
opacity 120ms ease;
|
|
3315
3308
|
}
|
|
3316
3309
|
|
|
3317
3310
|
/* Scroll hint \u2014 the last visible row of a scrollable web grid fades toward its
|
|
@@ -3600,8 +3593,8 @@
|
|
|
3600
3593
|
display: inline-flex;
|
|
3601
3594
|
align-items: center;
|
|
3602
3595
|
justify-content: center;
|
|
3603
|
-
/*
|
|
3604
|
-
|
|
3596
|
+
/* An indent inherited from the row (an icon row hangs its text with one)
|
|
3597
|
+
would slide the mark out of the box. */
|
|
3605
3598
|
text-indent: 0;
|
|
3606
3599
|
flex: 0 0 18px;
|
|
3607
3600
|
width: 18px;
|
|
@@ -3610,14 +3603,61 @@
|
|
|
3610
3603
|
border-radius: 6px;
|
|
3611
3604
|
background: var(--aia-surface);
|
|
3612
3605
|
color: transparent;
|
|
3613
|
-
font-size: 11px;
|
|
3614
3606
|
line-height: 1;
|
|
3607
|
+
/* A tick animates the box alone: the row stays put (no press, no dimming),
|
|
3608
|
+
since a multi-select tap keeps the list open for the next tick. */
|
|
3609
|
+
transition:
|
|
3610
|
+
background-color 140ms ease,
|
|
3611
|
+
border-color 140ms ease,
|
|
3612
|
+
color 140ms ease;
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
/* The tick is drawn, not typed: a rounded stroke with a short left leg and a
|
|
3616
|
+
long right one, shaped like Apple's SF Symbols "checkmark". The text "\u2713"
|
|
3617
|
+
it replaces changes with the font and reads thin and cheap. It is painted
|
|
3618
|
+
in the box's text colour, so it fades in with the fill. */
|
|
3619
|
+
.aia-checkbox-KGRhg::after {
|
|
3620
|
+
content: "";
|
|
3621
|
+
width: 14px;
|
|
3622
|
+
height: 14px;
|
|
3623
|
+
background: currentColor;
|
|
3624
|
+
-webkit-mask:
|
|
3625
|
+
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")
|
|
3626
|
+
center / contain no-repeat;
|
|
3627
|
+
mask:
|
|
3628
|
+
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")
|
|
3629
|
+
center / contain no-repeat;
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3632
|
+
/* Forced colours replace backgrounds with Canvas, which would hide a tick
|
|
3633
|
+
painted as a background; draw it in the forced text colour instead. */
|
|
3634
|
+
@media (forced-colors: active) {
|
|
3635
|
+
.aia-checkbox-KGRhg[data-checked="true"]::after {
|
|
3636
|
+
forced-color-adjust: none;
|
|
3637
|
+
background: CanvasText;
|
|
3638
|
+
}
|
|
3615
3639
|
}
|
|
3616
3640
|
|
|
3617
3641
|
.aia-checkbox-KGRhg[data-checked="true"] {
|
|
3618
3642
|
background: var(--aia-confirm-bg, #262626);
|
|
3619
3643
|
border-color: var(--aia-confirm-bg, #262626);
|
|
3620
3644
|
color: var(--aia-confirm-color, #ffffff);
|
|
3645
|
+
animation: aia-checkPop-CCWRW 160ms ease-out;
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3648
|
+
@keyframes aia-checkPop-CCWRW {
|
|
3649
|
+
0% {
|
|
3650
|
+
transform: scale(0.82);
|
|
3651
|
+
}
|
|
3652
|
+
100% {
|
|
3653
|
+
transform: scale(1);
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3656
|
+
|
|
3657
|
+
@media (prefers-reduced-motion: reduce) {
|
|
3658
|
+
.aia-checkbox-KGRhg[data-checked="true"] {
|
|
3659
|
+
animation: none;
|
|
3660
|
+
}
|
|
3621
3661
|
}
|
|
3622
3662
|
|
|
3623
3663
|
.aia-item-d4vpD:has(.aia-checkbox-KGRhg[data-checked="true"]) {
|
|
@@ -3693,9 +3733,8 @@
|
|
|
3693
3733
|
width: 18px;
|
|
3694
3734
|
height: 18px;
|
|
3695
3735
|
border-radius: 6px;
|
|
3696
|
-
font-size: 11px;
|
|
3697
3736
|
}
|
|
3698
|
-
`,document.head.appendChild(e)}var
|
|
3737
|
+
`,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"),pi=2e3,hi=170;function Pa({option:e,isHighlighted:a,checked:t,onSelect:n,onHighlight:i,onUnhighlight:c,id:s,loading:p,showIcon:b=!0,showImage:y=!0,showCount:k=!0,scrollHint:g,enterDelayMs:h=0}){let[u]=(0,xe.useState)(h),[S,C]=(0,xe.useState)(!1),I=y?(0,ce.optionImageSources)(e.image_url):[],F=I[0]??null,[N,ne]=(0,xe.useState)([]),K=I.find(o=>!N.includes(o))??null,R=y?(e.imageCollage??[]).map(o=>(0,ce.optionImageSources)(o)[0]).filter(o=>o!==void 0):[],[H,_]=(0,xe.useState)(!1),[$,ke]=(0,xe.useState)(null),Z=(0,xe.useMemo)(()=>!F&&b&&e.icon_svg?(0,ce.sanitizeOptionIconSvg)(e.icon_svg):null,[F,b,e.icon_svg]),A=k?(0,ce.formatOptionCount)(e.item_count):null,re=(0,xe.useRef)(void 0),X=(0,xe.useRef)(null),Se=(0,xe.useRef)(Number.NEGATIVE_INFINITY);(0,xe.useEffect)(()=>()=>clearTimeout(re.current),[]);let Ce=o=>{if(p||!e.is_tappable)return;let x=o?.currentTarget,me=t!==void 0&&x!==void 0&&o!==void 0&&!(0,ce.isMultiSelectToggleTap)(x,x.querySelector("[data-aia-checkbox]"),o),Oe=t!==void 0&&!me;if(!Oe){let be=performance.now();if(be-Se.current<hi)return;Se.current=be}me?n(e,{commit:!0}):n(e),!Oe&&(C(!0),clearTimeout(re.current),re.current=setTimeout(()=>{C(!1),(0,ce.clearPanelMorphPressLook)(X.current?.closest("[data-aia-dropdown]"))},pi))},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:X,id:s,role:"option","data-aia-option":"","data-aia-loading":p?"":void 0,"data-aia-icon":Z&&e.icon?e.icon:void 0,"data-aia-image":F?"":void 0,"data-aia-item-count":A!==null?e.item_count:void 0,"aria-selected":t??a,className:he,style:{[ce.OPTION_ENTER_DELAY_VAR]:`${u}ms`},tabIndex:p||!e.is_tappable?-1:0,onClick:Ce,onKeyDown:o=>{!p&&e.is_tappable&&(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),Ce())},onMouseEnter:!p&&e.is_tappable?i:void 0,onMouseLeave:c,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(o=>(0,de.jsx)("img",{src:o,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>_(!0),onError:x=>{x.currentTarget.hidden=!0}},o))}),F&&R.length<=1&&(0,de.jsx)("span",{className:`${le.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":K!==null&&$===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:()=>ke(K),onError:()=>{K!==null&&ne(o=>[...o,K])}})}),Z&&(0,de.jsx)("span",{className:`${le.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:Z}}),(0,de.jsxs)("span",{className:le.text,children:[e.matchedText?(0,ce.highlightParts)((0,ce.optionLabel)(e),e.matchedText).map((o,x)=>o.bold?(0,de.jsx)("strong",{className:`${le.match} magicx-aia-option-match`,"data-aia-match-partial":o.partial?"":void 0,children:o.text},x):o.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}),A!==null&&(0,de.jsx)("span",{className:`${le.count} magicx-aia-option-count`,children:A})]})})}var Xt=require("react/jsx-runtime");function ui(){let[e,a]=(0,Re.useState)(W.isOptionsGridMobileViewport);return(0,Re.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 Ia({options:e,activeIndex:a,picked:t,onSelect:n,onHighlight:i,onUnhighlight:c,listboxId:s,loading:p,groupKey:b="",optionsPosition:y="below",showIcons:k=!0,showImages:g=!0,showCounts:h=!0}){let u=ui(),S=(0,Re.useRef)(null),[C,I]=(0,Re.useState)(null),F=(0,Re.useRef)(null);(0,Re.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,u),_=R?.closest("[data-aia-dropdown]");H&&_&&(0,W.releasePanelHug)(_);let $=H?(0,W.measureOptionsGrid)(R):null;I($?(0,W.planOptionsGrid)(e.length,u,$.rowWidths,$.gridWidth):null)},[e,u,p]);let N=C??(0,W.planOptionsGrid)(e.length,u,null,null);(0,Re.useLayoutEffect)(()=>{let R=S.current?.closest("[data-aia-dropdown]");R&&(0,W.syncPanelHug)(R)},[N.template,u]);let ne=p?-1:a;(0,Re.useLayoutEffect)(()=>{S.current&&(0,W.syncHighlightScroll)(S.current,ne)},[ne]);let K=(0,W.optionsShowLeadingVisuals)(e,k,g);return(0,Xt.jsx)(Ca,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:b,template:N.template,maxHeight:N.maxHeight,innerRef:R=>{S.current=R},"data-aia-group":b,children:e.map((R,H)=>(0,Xt.jsx)(Pa,{option:R,isHighlighted:H===a,checked:t?t.includes(R.text):void 0,onSelect:n,onHighlight:_=>{(0,W.pointerMayHighlight)(S.current,H,_)&&i(H)},onUnhighlight:c?_=>{(0,W.pointerMayHighlight)(S.current,-1,_)&&c(H)}:void 0,id:`${s}-option-${H}`,loading:p,showIcon:k&&K,showImage:g&&K,showCount:h,scrollHint:!p&&N.scrollHintIndices.includes(H),enterDelayMs:p?0:(0,W.optionEnterDelayMs)(H,N.cols,e.length,y)},`${b}\0${R.parameter??""}\0${R.text}`))})}var ue=require("@magicx-eng/ai-autocomplete-vanilla"),Be=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
3738
|
|
|
3700
3739
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
3701
3740
|
time-wheel.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -3817,7 +3856,7 @@
|
|
|
3817
3856
|
.aia-done-llNY5:hover {
|
|
3818
3857
|
background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
|
|
3819
3858
|
}
|
|
3820
|
-
`,document.head.appendChild(e)}var
|
|
3859
|
+
`,document.head.appendChild(e)}var He={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 ze=require("react/jsx-runtime"),mi=120;function Aa({view:e,label:a,doneLabel:t,interactive:n=!0,onTimeChange:i,onTimeCommit:c}){return(0,ze.jsxs)("div",{className:He.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":a,onMouseDown:s=>s.preventDefault(),children:[(0,ze.jsx)("span",{className:He.value,"data-aia-time-value":"","aria-live":"polite",children:(0,ue.formatTime)(e.minutes)}),(0,ze.jsxs)("div",{className:He.columns,"aria-hidden":"true",children:[(0,ze.jsx)("div",{className:He.band}),ue.TIME_WHEEL_COLUMNS.map(s=>(0,ze.jsxs)(Be.Fragment,{children:[s==="minute"&&(0,ze.jsx)("span",{className:He.separator,children:":"}),(0,ze.jsx)(gi,{column:s,minutes:e.minutes,interactive:n,onTimeChange:i})]},s))]}),(0,ze.jsx)("button",{type:"button",tabIndex:-1,className:He.done,"data-aia-time-done":"",onClick:()=>{n&&c()},children:t})]})}function gi({column:e,minutes:a,interactive:t,onTimeChange:n}){let i=(0,Be.useRef)(null),c=(0,Be.useRef)(null),s=(0,Be.useRef)(null),p=(0,Be.useRef)({minutes:a,interactive:t,onTimeChange:n});p.current={minutes:a,interactive:t,onTimeChange:n};let b=(0,ue.timeWheelIndex)(e,a);(0,Be.useLayoutEffect)(()=>{let g=i.current;if(!g||s.current)return;let h=b*ue.TIME_WHEEL_ROW_HEIGHT;Math.abs(g.scrollTop-h)<1||(c.current=h,g.scrollTop=h)},[b]),(0,Be.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]);let y=()=>{s.current=null;let g=i.current,h=p.current;if(!g||!h.interactive)return;let u=(0,ue.timeWheelIndexFromScroll)(e,g.scrollTop);u!==(0,ue.timeWheelIndex)(e,h.minutes)&&h.onTimeChange((0,ue.withTimeWheelIndex)(e,h.minutes,u))},k=()=>{let g=i.current;if(g){if(c.current!=null&&Math.abs(g.scrollTop-c.current)<1){c.current=null;return}c.current=null,s.current&&clearTimeout(s.current),s.current=setTimeout(y,mi)}};return(0,ze.jsx)("div",{ref:i,className:He.column,"data-aia-time-column":e,onScroll:k,children:(0,ue.timeWheelRows)(e).map((g,h)=>(0,ze.jsx)("div",{className:h===b?`${He.row} ${He.selected}`:He.row,"data-aia-time-row":"","data-aia-index":h,onClick:()=>{p.current.interactive&&n((0,ue.withTimeWheelIndex)(e,p.current.minutes,h))},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
3860
|
display: flex;
|
|
3822
3861
|
flex-direction: column;
|
|
3823
3862
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -3832,7 +3871,7 @@
|
|
|
3832
3871
|
align-items: end;
|
|
3833
3872
|
}
|
|
3834
3873
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
3835
|
-
`,document.head.appendChild(e)}var Ra=require("react/jsx-runtime");function Ea({space:e,align:a="stretch",className:t,children:
|
|
3874
|
+
`,document.head.appendChild(e)}var Ra=require("react/jsx-runtime");function Ea({space:e,align:a="stretch",className:t,children:n,...i}){let c=e?{"--aia-stack-space":e}:void 0;return(0,Ra.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:c,...i,children:n})}var Y=require("react/jsx-runtime"),fi=typeof window>"u"?ee.useEffect:ee.useLayoutEffect,bi=[159,119,164],wi=()=>{},za=()=>{},vi=e=>{},xi=()=>{},yi=e=>{},ki=e=>{},Si=e=>{},Ci=e=>{};function Ti(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,n]=(0,ee.useState)(a);if((0,ee.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let i=window.matchMedia("(prefers-color-scheme: dark)"),c=()=>n(i.matches);return i.addEventListener("change",c),()=>i.removeEventListener("change",c)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Pi(e,a){let t=(0,ee.useRef)(null);(0,ee.useEffect)(()=>{let n=e.current,i=a.current;if(!n||!i)return;let c=(0,M.queryLive)(n,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==c&&(t.current.controller.destroy(),t.current=null),c&&!t.current){t.current={grid:c,controller:(0,M.attachScrollArrow)({dropdown:n,grid:c,button:i})};return}t.current?.controller.update()}),(0,ee.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ii(e,a){let t=(0,ee.useRef)(a);t.current=a;let n=(0,ee.useRef)(null);(0,ee.useLayoutEffect)(()=>{let i=e.current;if(i){if(!n.current){n.current=(0,M.attachViewportFit)({dropdown:i,isOpen:()=>t.current});return}n.current.update()}}),(0,ee.useEffect)(()=>()=>{n.current?.destroy(),n.current=null},[])}function Gt({suggestions:e,activeIndex:a,onSelect:t,onHighlight:n,onUnhighlight:i,isOpen:c,id:s,className:p,pills:b,onPillClick:y,showPills:k=!0,onSkip:g,showSkipButton:h=!0,showOptionIcons:u=!0,showOptionImages:S=!0,showOptionCounts:C=!0,skipDisabled:I=!1,activeSelected:F=!1,isLoading:N=!1,skeletonExiting:ne=!1,isInputEmpty:K=!1,language:R,products:H,onProductSelect:_,onProductAddToCart:$,onProductFocusChange:ke,productsLayout:Z="row",productImageFallback:A="image",showProductVendor:re=!0,formatType:X="options",dateView:Se=null,selectedDateIso:Ce=null,selectedDateRange:he=null,dateRangeStart:o=null,dateReferences:x,onPreviousMonth:me,onNextMonth:Oe,timeView:be=null,multiSelectView:lt=null,onMultiSelectCommit:Qe,onSeeAllResults:Ye,seeAllBusy:De=!1,busyProductId:dt=null,fullWidth:at=!1,onTimeChange:m,onTimeCommit:ct,locationView:f=null,isReediting:T=!1,onLocationQuery:z,onLocationMove:O,onLocationCommit:B,onLocationFocusChange:pe,isFocused:Ge=!1,optionsPosition:ge="below",mode:Ke}){let je=Ti(Ke),pt=je!==void 0,fe=(0,ee.useRef)(null),$e=(0,ee.useRef)(null);Pi(fe,$e),(0,ee.useEffect)(()=>{if(fe.current)return(0,M.containScroll)(fe.current)},[]);let Me=e[0]?.options??[],ht=!!(b&&b.length>0&&y),Pe=!!(H&&H.length>0),it=X==="time"&&be!=null,vt=X==="location"&&f!=null,Te=c&&(Me.length>0||k&&ht||N||Pe||it||vt);Ii(fe,Te),fi(()=>{let E=fe.current;E&&((0,M.fitMultiSelectDone)(E,(0,M.findMultiSelectDone)(E)),(0,M.syncPanelHug)(E))});let Ie={suggestions:e,activeIndex:a,pills:b,showPills:k,showSkipButton:h,showOptionIcons:u,showOptionImages:S,showOptionCounts:C,skipDisabled:I,activeSelected:F,isLoading:N,skeletonExiting:ne,isInputEmpty:K,products:H,formatType:X,dateView:Se,selectedDateIso:Ce,selectedDateRange:he,dateRangeStart:o,dateReferences:x,timeView:be,multiSelectView:lt,locationView:f,isReediting:T,showsSeeAll:!!Ye},ot=(0,ee.useRef)(Ie);Te&&(ot.current=Ie);let r=Te?Ie:ot.current,Q=(0,M.uiStringsFor)(R),Ne=r.suggestions[0],qe=Ne?.options??[],ut=r.activeIndex>=0&&!!qe[r.activeIndex]?.is_tappable,_e=(0,M.labelTraditionalAutocomplete)(r.pills??[],Q.keepTyping),Ze=!!(_e.length>0&&y),v=r.showPills&&Ze,mt=r.showPills&&!Ze&&r.isLoading,xt=v||mt,Xe=Ze&&(0,M.hasSkippablePill)(_e)&&r.showSkipButton&&!r.isInputEmpty&&!!g,w=_e[0]?.text,gt=(0,M.isCalendarFormat)(r.formatType)&&r.dateView!=null,yt=qe.length>0&&!gt,Je=qe.length>0&>&&!r.isLoading,kt=r.formatType==="time"&&r.timeView!=null&&!r.isLoading,St=r.formatType==="location"&&r.locationView!=null&&!r.isLoading,nt=r.isLoading&&!yt&&!Je&&!kt&&!St,Ct=r.products??[],et=(0,M.panelMorphKey)(v?_e:[]);return(0,ee.useLayoutEffect)(()=>{fe.current&&(0,M.settlePanelMorph)(fe.current,et,{visible:Te,anchorBottom:ge==="above"})},[et,Te,ge,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,Z,R]),(0,ee.useEffect)(()=>{let E=fe.current;return()=>{E&&(0,M.destroyPanelMorph)(E)}},[]),(0,Y.jsxs)("div",{ref:fe,id:s,role:"listbox","aria-multiselectable":!!r.multiSelectView,"data-aia-dropdown":"","data-options-position":ge,"data-mode":je,"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":at?"":void 0,className:`${pt?"magicx-aia ":""}${Ae.dropdown} ${Te?Ae.visible:""} ${p??""}`,onMouseDown:E=>E.preventDefault(),children:[(0,Y.jsxs)(Ea,{space:"8px",children:[(xt||Xe)&&(0,Y.jsxs)(zt,{noWrap:!0,className:Ae.pillBar,"data-aia-pillbar":"",children:[xt&&(0,Y.jsx)("span",{className:Ae.pillScroll,"data-aia-pill-scroll":"",children:(0,Y.jsx)(Bt,{pills:_e,activePillIndex:0,activeSelected:r.activeSelected,onSelectPill:y??(()=>{}),rounded:!0,loading:r.isLoading})}),Xe&&(0,Y.jsx)("button",{type:"button",tabIndex:-1,className:Ae.skip,"data-aia-skip":"",disabled:r.isLoading||r.skipDisabled,"aria-label":w?`${Q.skipLabel} ${w}`:Q.skipLabel,onClick:g,children:Q.skip})]}),yt&&(0,Y.jsx)(Ia,{options:qe,activeIndex:r.activeIndex,onSelect:t,onHighlight:n,onUnhighlight:i,listboxId:s,loading:r.isLoading,groupKey:Ne?`${Ne.parameter} ${Ne.text}`:"",optionsPosition:ge,showIcons:r.showOptionIcons,showImages:r.showOptionImages,showCounts:r.showOptionCounts,picked:r.multiSelectView?.picked}),r.multiSelectView&&(0,Y.jsx)("div",{"data-aia-multi-actions":"",onClick:E=>{E.target.closest("[data-aia-multi-done]")&&!r.skipDisabled&&!r.isLoading&&Qe?.()},children:(0,Y.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Ae.multiDone,ref:E=>{E&&(E.disabled=!0,E.offsetHeight,E.disabled=r.skipDisabled||r.isLoading)},children:Q.done})}),Je&&r.dateView&&(0,Y.jsx)(ua,{options:qe,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:i,onPreviousMonth:me??za,onNextMonth:Oe??za}),kt&&r.timeView&&(0,Y.jsx)(Aa,{view:r.timeView,label:Q.timeLabel,doneLabel:Q.done,interactive:!r.skipDisabled,onTimeChange:m??vi,onTimeCommit:ct??xi}),St&&r.locationView&&(0,Y.jsx)(wa,{view:r.locationView,searchLabel:Q.locationSearch,noResultsLabel:Q.locationNoResults,useTypedLabel:Q.locationUseTyped,widgetFocused:Ge&&Te,reediting:r.isReediting,visible:Te,interactive:!r.skipDisabled,onQuery:z??yi,onMove:O??ki,onCommit:B??Si,onFocusChange:pe??Ci}),nt&&(0,Y.jsx)("div",{className:Ae.skeletonBars,"data-aia-skeleton-bars":"",children:bi.map(E=>(0,Y.jsx)("span",{className:Ae.skeletonBar,style:{width:E}},`bar-${E}`))}),(0,Y.jsx)(ka,{products:Ct,listboxId:s,onSelect:_??wi,busyProductId:dt,onAddToCart:$,onFocusChange:ke,focusable:Te&&!r.isLoading,loading:r.isLoading,layout:Z,imageFallback:A,showVendor:re,strings:Q}),r.showsSeeAll&&(0,Y.jsx)("div",{className:Ae.seeAllRow,"data-aia-see-all":"",onClick:E=>{E.target.closest("[data-aia-see-all-button]")&&(E.stopPropagation(),!(r.isLoading||De)&&Ye?.())},children:(0,Y.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"","data-aia-see-all-state":De?"busy":void 0,"aria-busy":De?!0:void 0,className:Ae.seeAll,ref:E=>{E&&(E.disabled=!0,E.offsetHeight,E.disabled=r.isLoading)},children:Q.seeAllResults})}),(0,Y.jsx)(ma,{isOptionHighlighted:ut,isInputEmpty:r.isInputEmpty,strings:Q})]}),(0,Y.jsx)("button",{ref:$e,type:"button",tabIndex:-1,className:Ae.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Q.scrollArrow,"aria-hidden":"true",children:(0,Y.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,Y.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Le=require("@magicx-eng/ai-autocomplete-vanilla");var Oa=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
3875
|
flex-shrink: 0;
|
|
3837
3876
|
width: 32px;
|
|
3838
3877
|
height: 32px;
|
|
@@ -3936,5 +3975,5 @@
|
|
|
3936
3975
|
transition: none;
|
|
3937
3976
|
}
|
|
3938
3977
|
}
|
|
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});
|
|
3978
|
+
`,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:n,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:c=>{c.stopPropagation(),n()},"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 ye=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"),n=(0,Jt.useRef)({key:"",overrides:void 0});if(n.current.key!==t){let i={};for(let c of Object.keys(e??{})){let s=(p,b,y)=>{let k=a.current?.[c];return k?k(p,b,y):[]};i[c]=s}n.current={key:t,overrides:e?i:void 0}}return{overrides:n.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,c)=>{let s=a.current;return s?s.fetch(i,c):Promise.reject(new Error("products config removed"))},transform:i=>a.current?.transform(i)??[],get limit(){return a.current?.limit}});let n=e!==void 0;return{config:n?t.current:void 0,enabled:n}}var Ai={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:n,maskCompletedText:i,apiConfig:c,additionalContext:s,language:p,currency:b,productId:y,visitorId:k,analyticsConsent:g,columns:h=2,dropdownTrigger:u,optionsPosition:S,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:F,prependPlaceholder:N,allOption:ne,showNonTappableOptions:K,locationSearch:R,showOptionIcons:H,showOptionImages:_,showOptionCounts:$,showSkipButton:ke,showProducts:Z,submitProgress:A,awaitAnswerOnSubmit:re,submitAnswerTimeoutMs:X,productImageFallback:Se="image",showProductVendor:Ce=!0,onFocus:he,onBlur:o,value:x,completedParams:me,onChange:Oe,onParamsChange:be,products:lt,mapProducts:Qe,onProductSelect:Ye,onProductAddToCart:De,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 z=(0,P.useRef)(a);z.current=a;let O=(0,P.useRef)(t);O.current=t;let B=(0,P.useRef)(Oe);B.current=Oe;let pe=(0,P.useRef)(be);pe.current=be;let Ge=(0,P.useRef)(he);Ge.current=he;let ge=(0,P.useRef)(o);ge.current=o;let Ke=(0,P.useRef)(at);Ke.current=at;let je=(0,P.useRef)(Ye);je.current=Ye;let pt=(0,P.useRef)(De);pt.current=De;let fe=(0,P.useRef)(k);fe.current=k;let $e=(0,P.useRef)(()=>{let l=fe.current;return typeof l=="function"?l():l}).current,Me=k!==void 0,ht=(0,P.useRef)(g);ht.current=g;let Pe=(0,P.useRef)(()=>{let l=ht.current;return typeof l=="function"?l():l}).current,it=Na(lt),vt=(0,P.useRef)(Qe);vt.current=Qe;let Te=(0,P.useRef)((l,te)=>{let V=vt.current;return V?V(l,te):l}).current,Ie=Qe?Te:void 0,ot=Ma(n);(0,P.useEffect)(()=>{if(typeof document>"u")return;let l=new ye.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:c,additionalContext:s,language:p,currency:b,productId:y,visitorId:Me?$e:void 0,analyticsConsent:Pe,optionOverrides:ot.overrides,maskCompletedText:i,columns:h,dropdownTrigger:u,optionsPosition:S,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:F,prependPlaceholder:N,allOption:ne,showNonTappableOptions:K,locationSearch:R,showProducts:Z,submitProgress:A,awaitAnswerOnSubmit:re,submitAnswerTimeoutMs:X,source:dt,value:x,completedParams:me,onSubmit:(...V)=>T.current?.(...V),onResult:(...V)=>z.current?.(...V),onError:(...V)=>O.current?.(...V),onChange:(...V)=>B.current?.(...V),onParamsChange:(...V)=>pe.current?.(...V),onFocus:()=>Ge.current?.(),onBlur:()=>ge.current?.(),onProductSelect:V=>je.current?je.current(V):ye.HANDOFF_NOT_HANDLED,onProductAddToCart:V=>pt.current?.(V),setCursor:V=>Ke.current?.(V),products:it.config,mapProducts:Ie});m.current=l,f(l.getState());let te=l.subscribe(V=>f(V));return()=>{te(),l.destroy(),m.current===l&&(m.current=null)}},[]);let r=(0,P.useRef)(Me);(0,P.useEffect)(()=>{r.current!==Me&&(r.current=Me,m.current?.update({visitorId:Me?$e:void 0,analyticsConsent:Pe}))},[Me,$e,Pe]);let Q=typeof g=="function"?"function":g,Ne=(0,P.useRef)(Q);(0,P.useEffect)(()=>{Ne.current!==Q&&(Ne.current=Q,m.current?.refreshAnalyticsConsent())},[Q]),(0,P.useEffect)(()=>{x!==void 0&&m.current?.setValue(x)},[x]),(0,P.useEffect)(()=>{me!==void 0&&m.current?.setCompletedParams(me)},[me]);let qe=JSON.stringify(c??null),ut;try{ut=JSON.stringify(s??null)}catch{ut="[unstringifiable]"}(0,P.useEffect)(()=>{m.current?.update({apiConfig:c,additionalContext:s,language:p,currency:b,productId:y,optionOverrides:ot.overrides,dropdownTrigger:u,optionsPosition:S,closeDropdownOnBlur:C,focusInputOnSelect:I,startingState:F,prependPlaceholder:N,allOption:ne,showNonTappableOptions:K,locationSearch:R,showProducts:Z,submitProgress:A,awaitAnswerOnSubmit:re,submitAnswerTimeoutMs:X})},[qe,ut,p,b?.code,b?.rate,b?.country,y,ot.key,u,S,C,I,F,N,ne,K,R,Z,A,re,X]);let _e=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!_e.current){_e.current=!0;return}m.current?.update({products:it.config})},[it.enabled]),(0,P.useEffect)(()=>{m.current?.update({mapProducts:Ie})},[Ie]);let Ze=(0,P.useRef)(null);Ze.current===null&&(Ze.current={handleTextChange:l=>m.current?.handleTextChange(l),handleCompositionText:l=>m.current?.handleCompositionText(l),handleKeyDown:l=>{let te="nativeEvent"in l?l.nativeEvent:l;m.current?.handleKeyDown(te)},setFocused:l=>m.current?.setFocused(l),startEditingParam:l=>m.current?.startEditingParam(l),removeParam:l=>m.current?.removeParam(l)??!1,exitEditMode:()=>m.current?.exitEditMode(),handleCaretAfterInput:l=>m.current?.handleCaretAfterInput(l),handleCaretMove:l=>m.current?.handleCaretMove(l),replaceEditingRange:l=>m.current?.replaceEditingRange(l)??!1,setActivePill:l=>m.current?.setActivePill(l),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()??Ai,awaitSubmitResult:()=>m.current?.awaitSubmitResult()??Promise.resolve(null),recordSubmit:l=>m.current?.recordSubmit(l),holdSubmit:l=>m.current?.holdSubmit(l),endSubmitProgress:()=>m.current?.endSubmitProgress(),getSearchId:()=>m.current?.getSearchId(),getVisitorId:()=>m.current?.getVisitorId(),refreshAnalyticsConsent:()=>m.current?.refreshAnalyticsConsent(),selectOption:(l,te)=>m.current?.selectOption(l,te),selectProduct:l=>m.current?.selectProduct(l),addProductToCart:l=>{let te=m.current;return!te||!pt.current?Promise.resolve():te.addProductToCart(l)},setActiveDropdownIndex:l=>m.current?.setActiveDropdownIndex(l),clearHighlight:l=>m.current?.clearHighlight(l),showPreviousMonth:()=>m.current?.showPreviousMonth(),showNextMonth:()=>m.current?.showNextMonth(),setTime:l=>m.current?.setTime(l),commitTime:()=>m.current?.commitTime(),toggleMultiSelectOption:l=>m.current?.toggleMultiSelectOption(l),commitMultiSelect:()=>m.current?.commitMultiSelect(),setLocationQuery:l=>m.current?.setLocationQuery(l),moveLocationHighlight:l=>m.current?.moveLocationHighlight(l),commitLocation:l=>m.current?.commitLocation(l),setLocationFieldFocused:l=>m.current?.setLocationFieldFocused(l),handleFocus:()=>m.current?.setFocused(!0),handleBlur:()=>m.current?.setFocused(!1)});let v=Ze.current,mt=(0,P.useCallback)(l=>{let te=l.target.value,Pt=te.length>0&&!l.nativeEvent?.isComposing&&te[0]!==te[0].toUpperCase()?te[0].toUpperCase()+te.slice(1):te;m.current?.handleTextChange(Pt)},[]),xt=(0,P.useCallback)(l=>{m.current?.handleKeyDown(l.nativeEvent)},[]),Xe=m.current,w=ct??Fa,gt=x!==void 0?x:w.text,yt=me!==void 0?me:w.completedParams,Je=w.actionableSuggestions,kt=Je[0],St=(0,P.useMemo)(()=>(0,ye.withoutTraditionalAutocomplete)(Je),[Je]),nt=Xe?.listboxId??"",Ct=w.activeDropdownIndex>=0&&Xe?`${nt}-option-${w.activeDropdownIndex}`:void 0,et=w.editingParam,E=w.editingIdentified,Dt=et?(0,ye.editingSuggestion)(et):E?{parameter:E.parameter,text:(0,ye.identifiedParamLabel)(E.parameter),required:!0,options:[]}:null,Mt=w.dropdownSuggestion??Dt??kt,Vt=(0,ye.dropdownPillsFor)(w.dropdownSuggestion,Dt,Je),Tt=(0,ye.dateSelectionFor)(w),At=!Xe||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:et,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:(ke??!0)&&!et&&!E,showOptionIcons:H??!0,showOptionImages:_??!0,showOptionCounts:$??!0,skipDisabled:w.inSelectionAnimation,isLoading:At,skeletonExiting:w.skeletonExiting,isInputEmpty:gt.trim().length===0,language:p,products:w.products,productImageFallback:Se,showProductVendor:Ce,onProductSelect:v.selectProduct,busyProductId:w.selectingProductId,seeAllBusy:w.isSubmitting,onProductAddToCart:De?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:S??"below"}}}var G=require("@magicx-eng/ai-autocomplete-vanilla"),L=require("react"),_t;function Ei(){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:n=!0,showChipRemove:i=!1,focusInputOnSelect:c,removeParam:s,newParamId:p,editingParam:b,editingIdentified:y,editingAnchor:k,caretOffset:g,placeholderText:h,hintSuggestions:u,isFocused:S,isDropdownOpen:C,listboxId:I,activeDescendantId:F,autoFocus:N,handleTextChange:ne,handleCompositionText:K,handleKeyDown:R,handleCaretAfterInput:H,handleCaretMove:_,startEditingParam:$,replaceEditingRange:ke,setFocused:Z}=e,A=(0,L.useRef)(null),re=(0,L.useRef)(!1),X=(0,L.useRef)(""),Se=(0,L.useRef)(""),Ce=(0,L.useRef)(null),he=(0,L.useRef)(0);Ce.current=g;let o=(0,L.useRef)(c);o.current=c,(0,L.useEffect)(()=>{if(!N)return;let f=A.current;if(!f)return;document.activeElement===f?Z(!0):f.focus();let T=f.ownerDocument??document,z=T.getSelection(),O=z&&z.rangeCount>0&&f.contains(z.anchorNode);if(z&&!O){let B=T.createRange();B.selectNodeContents(f),B.collapse(!0),z.removeAllRanges(),z.addRange(B)}},[N,Z]),(0,L.useEffect)(()=>{let f=A.current;if(!f)return;let T=f.ownerDocument??document,z=()=>{let O=T.getSelection();if(!O||O.rangeCount===0||!O.anchorNode||!f.contains(O.anchorNode))return;let B=O.anchorNode,pe=B.nodeType===Node.ELEMENT_NODE?B:B.parentElement,ge=(O.isCollapsed?pe?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Ke=b?.id??y?.id??null;if(ge&&ge!==Ke){$(ge);return}performance.now()-he.current<50||_((0,G.getCursorOffset)(f))};return T.addEventListener("selectionchange",z),()=>T.removeEventListener("selectionchange",z)},[b,y,$,_]),(0,L.useEffect)(()=>{let f=A.current;if(!f)return;let T=z=>{let O=(0,G.chipIdFromTap)(f,z.target);O&&($(O),(0,G.keepCaretOnChip)(f,O))};return f.addEventListener("click",T),()=>f.removeEventListener("click",T)},[$]),(0,L.useEffect)(()=>{let f=A.current;if(!(!f||!s||!i))return(0,G.attachChipRemove)(f,s)},[s,i]),(0,L.useLayoutEffect)(()=>{let f=A.current;f&&(0,G.renderEditableContent)({input:f,segments:a,newParamId:p,editingParamId:b?.id??null,placeholderText:h??"",isFocused:S,showChipIcons:t,showChipImages:n,showChipRemove:i,hintOptions:(0,G.startingHintOptions)(u??[])})},[a,p,b,h,u,S,t,n,i]),(0,L.useEffect)(()=>{let f=A.current;return()=>{f&&(0,G.cancelStartingHint)(f)}},[]),(0,L.useLayoutEffect)(()=>{let f=X.current,T=p??"";if(X.current=T,!T||T===f)return;let z=A.current;if(!z)return;let O=Ce.current??(0,G.plainTextLength)(z);(0,G.settlePickFocus)(z,O,(0,G.focusesInputOnSelect)(o.current))},[p]),(0,L.useLayoutEffect)(()=>{let f=Se.current,T=b?.id??"";if(Se.current=T,!T||T===f||k==null)return;let z=A.current;z&&(0,G.setCursorOffset)(z,k)},[b,k]);let x=(0,L.useCallback)(()=>{let f=A.current;if(!f)return;let T=(0,G.extractPlainText)(f),O=T.length>0&&T[0]!==T[0].toUpperCase()?T[0].toUpperCase()+T.slice(1):T;if(re.current){K(O);return}ne(O)},[ne,K]),me=(0,L.useCallback)(()=>{he.current=performance.now(),x();let f=A.current;f&&H((0,G.getCursorOffset)(f))},[x,H]);(0,L.useEffect)(()=>{let f=A.current;if(!f)return;let T=z=>{let O=z,B=O.inputType;if(B==="insertParagraph"||B==="insertLineBreak"||B==="insertFromDrop"){z.preventDefault();return}if(B.startsWith("insert")||B.startsWith("delete")){let pe=B.startsWith("delete")?"":O.data??"";ke(pe)&&z.preventDefault()}};return f.addEventListener("beforeinput",T),()=>f.removeEventListener("beforeinput",T)},[ke]);let Oe=(0,L.useCallback)(()=>{re.current=!0,A.current?.setAttribute("data-aia-composing","true")},[]),be=(0,L.useCallback)(()=>{re.current=!1,A.current?.removeAttribute("data-aia-composing"),x()},[x]),lt=(0,L.useCallback)(f=>{f.preventDefault();let T=A.current;if(!T)return;let z=(f.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!z)return;let O=T.ownerDocument??document,B=O.getSelection();if(!B||B.rangeCount===0)return;let pe=B.getRangeAt(0);if(!T.contains(pe.startContainer))return;pe.deleteContents();let Ge=O.createTextNode(z);pe.insertNode(Ge),pe.setStartAfter(Ge),pe.collapse(!0),B.removeAllRanges(),B.addRange(pe),x()},[x]),Qe=(0,L.useCallback)(f=>R(f),[R]),Ye=(0,L.useCallback)(()=>Z(!0),[Z]),De=(0,L.useCallback)(()=>Z(!1),[Z]),dt=(0,L.useCallback)(()=>A.current?.focus(),[]),at=(0,L.useCallback)(()=>A.current?.blur(),[]),m=(0,L.useCallback)(()=>{let f=A.current;return f?(0,G.extractPlainText)(f):""},[]),ct=Ei()?"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":F,spellCheck:!0,enterKeyHint:"send",onInput:me,onKeyDown:Qe,onCompositionStart:Oe,onCompositionEnd:be,onPaste:lt,onFocus:Ye,onBlur:De},getPlainText:m,focus:dt,blur:at}}var We=require("react/jsx-runtime");function Ri(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Ba=(0,j.forwardRef)(function({onSubmit:a,onResult:t,onError:n,optionOverrides:i,maskCompletedText:c,className:s,apiConfig:p,additionalContext:b,language:y,currency:k,productId:g,visitorId:h,analyticsConsent:u,columns:S,pillPlacement:C="dropdown",mode:I="auto",optionsPosition:F="below",animations:N=!0,optionsStyle:ne="floating",dropdownTrigger:K,closeDropdownOnBlur:R,focusInputOnSelect:H,startingState:_,prependPlaceholder:$,allOption:ke,showNonTappableOptions:Z,locationSearch:A,showOptionIcons:re=!0,showChipIcons:X=!0,showChipImages:Se=!0,showChipRemove:Ce=!1,showOptionImages:he=!0,showOptionCounts:o=!0,showSkipButton:x,showProducts:me,submitProgress:Oe,awaitAnswerOnSubmit:be,submitAnswerTimeoutMs:lt,productsLayout:Qe,productImageFallback:Ye,showProductVendor:De,autoFocus:dt=!0,onFocus:at,onBlur:m,value:ct,completedParams:f,onChange:T,onParamsChange:z,products:O,mapProducts:B,onProductSelect:pe,onProductAddToCart:Ge,submitButton:ge,resetOnSubmit:Ke=!0,seeAllResults:je=!1},pt){let fe=(0,j.useRef)(null),$e=(0,j.useRef)(null),Me=(0,j.useRef)(null),ht=(0,j.useRef)(()=>{}),Pe=(0,j.useRef)(null),it=(0,j.useRef)(null);(0,j.useEffect)(()=>{let D=fe.current;if(D)return Pe.current?Pe.current.setMode(I):Pe.current=new Le.ModeController(D,I),()=>{Pe.current?.destroy(),Pe.current=null}},[I]);let vt=(0,j.useCallback)(D=>{let Fe=it.current?.current;Fe&&(Fe.focus(),(0,Le.setCursorOffset)(Fe,D))},[]),{completedParams:Te,suggestionPills:Ie,setActivePill:ot,skipActivePill:r,segments:Q,newParamId:Ne,clearNewParamId:qe,placeholderText:ut,isFocused:_e,isDropdownOpen:Ze,isActivePillSelected:v,isLoading:mt,isReady:xt,activeIndex:Xe,listboxId:w,handleTextChange:gt,handleCompositionText:yt,handleKeyDown:Je,setFocused:kt,editingParam:St,editingIdentified:nt,editingAnchor:Ct,caretOffset:et,startEditingParam:E,removeParam:Dt,handleCaretAfterInput:Mt,handleCaretMove:Vt,replaceEditingRange:Tt,dropdownProps:At,reset:l,refreshProducts:te,prepareSubmit:V,getState:Pt,getResult:ta,awaitSubmitResult:aa,recordSubmit:ia,holdSubmit:oa,endSubmitProgress:na,getSearchId:ra,getVisitorId:sa,refreshAnalyticsConsent:la,isSubmitting:Ut}=qt({onSubmit:D=>ht.current(D),onResult:t,onError:n,optionOverrides:i,maskCompletedText:c,apiConfig:p,additionalContext:b,language:y,currency:k,productId:g,visitorId:h,analyticsConsent:u,columns:S,dropdownTrigger:K,optionsPosition:F,closeDropdownOnBlur:R,focusInputOnSelect:H,startingState:_,prependPlaceholder:$,allOption:ke,showNonTappableOptions:Z,locationSearch:A,showOptionIcons:re,showOptionImages:he,showOptionCounts:o,showSkipButton:x,showProducts:me,submitProgress:Oe,awaitAnswerOnSubmit:be,submitAnswerTimeoutMs:lt,onFocus:at,onBlur:m,value:ct,completedParams:f,onChange:T,onParamsChange:z,products:O,mapProducts:B,onProductSelect:pe,onProductAddToCart:Ge,source:"full-sdk",setCursor:vt});(0,j.useEffect)(()=>{if(!Ne)return;let D=window.setTimeout(()=>qe(),650);return()=>window.clearTimeout(D)},[Ne,qe]);let Wa=Xe>=0?`${w}-option-${Xe}`:void 0,{inputRef:It,editorProps:Ga,focus:da,blur:ca,getPlainText:pa}=Ha({segments:Q,newParamId:Ne,editingParam:St,editingIdentified:nt,editingAnchor:Ct,caretOffset:et,placeholderText:ut,hintSuggestions:C==="inline"?[]:Ie,isFocused:_e,showChipIcons:X,showChipImages:Se,showChipRemove:Ce,removeParam:Dt,focusInputOnSelect:H,isDropdownOpen:Ze,listboxId:w,activeDescendantId:Wa,autoFocus:dt,handleTextChange:gt,handleCompositionText:yt,handleKeyDown:Je,handleCaretAfterInput:Mt,handleCaretMove:Vt,startEditingParam:E,replaceEditingRange:Tt,setFocused:kt});it.current=It,(0,j.useLayoutEffect)(()=>{let D=$e.current,Fe=It.current;if(!D||!Fe)return;let bt=()=>{let Rt=D.firstElementChild;if(!Rt)return;let Qa=Rt.getBoundingClientRect(),Ya=Fe.getBoundingClientRect();Qa.top>=Ya.bottom-2?D.setAttribute("data-aia-pill-wrapped",""):D.removeAttribute("data-aia-pill-wrapped")};bt();let Et=new ResizeObserver(bt);return Et.observe(Fe),()=>Et.disconnect()},[Q,Ie.length,mt,It]),(0,j.useEffect)(()=>{let D=Me.current;if(D)return(0,Le.watchEditorHeight)(D)},[]),(0,j.useImperativeHandle)(pt,()=>({focus:da,blur:ca,reset:l,refreshProducts:te,setMode:D=>Pe.current?.setMode(D),skipActivePill:r,endSubmitProgress:na,getSearchId:ra,getVisitorId:sa,refreshAnalyticsConsent:la}),[da,ca,l,te,r,na,ra,sa,la]);let ft=!!Q.length||Te.length>0,Nt=(0,j.useCallback)((D,Fe)=>{let bt=Pt(),Et=(0,Le.buildSubmitResult)(pa(),bt.completedParams,bt.skippedParams,{identifiedParams:bt.identifiedParams,isReady:bt.isReady,customFields:Fe.custom_fields??null,customFieldsStale:Fe.custom_fields_stale===!0});D&&ia(Et);let Rt=a(Et);return D&&!Ke&&oa(Rt),Ke&&l(),Rt},[ia,oa,Ke,Pt,a,l,pa]),Qt=(0,j.useCallback)(()=>{if(ft&&!Pt().isSubmitting){if(be){aa().then(D=>{D&&Nt(!0,D)});return}V(),Nt(!0,ta())}},[ft,Pt,be,aa,V,ta,Nt]);ht.current=D=>ft?Nt(!1,D):void 0;let Ka=je&&!At.isInputEmpty&&ft,qa=Qt,_a=(0,j.useCallback)(D=>{D.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||It.current&&(0,Le.focusEditorFromTap)(It.current)},[It]),Va=C==="inline",Ua=C==="dropdown";return(0,We.jsxs)("div",{ref:fe,className:`magicx-aia ${wt.container} ${s??""}`,"data-pill-placement":C,"data-options-position":F,"data-animations":N?"on":"off","data-aia-options-style":ne,"data-mode":Ri(I),children:[(0,We.jsx)(Gt,{...At,showPills:Ua,productsLayout:Qe,productImageFallback:Ye,showProductVendor:De,onSeeAllResults:Ka?qa:void 0,fullWidth:je}),(0,We.jsxs)("div",{className:wt.inputWrapper,"data-aia-input-wrapper":"",onClick:_a,children:[(0,We.jsxs)("div",{ref:Me,className:wt.editorArea,"data-aia-editor":"",children:[(0,We.jsx)("div",{...Ga,className:wt.input,"data-aia-input":""}),Va&&(mt||Ie.length>0)&&(0,We.jsx)("span",{ref:$e,className:wt.pillListContainer,"data-aia-pill-list-container":"",children:(0,We.jsx)(Bt,{pills:Ie,activePillIndex:0,activeSelected:v,onSelectPill:ot,loading:mt})})]}),ge===null?null:ge===void 0?(0,We.jsx)(Da,{disabled:!ft,ready:ft&&xt,busy:Ut,onClick:Qt,label:(0,Le.uiStringsFor)(y).submit}):(0,We.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:D=>{ft&&(D.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});
|
|
3940
3979
|
//# sourceMappingURL=index.js.map
|