@magicx-eng/ai-autocomplete-react 0.63.1 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/REFERENCE.md +33 -0
- package/dist/index.d.mts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var qt=Object.defineProperty;var Ka=Object.getOwnPropertyDescriptor;var qa=Object.getOwnPropertyNames;var Va=Object.prototype.hasOwnProperty;var _a=(e,a)=>{for(var t in a)qt(e,t,{get:a[t],enumerable:!0})},Ua=(e,a,t,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of qa(a))!Va.call(e,i)&&i!==t&&qt(e,i,{get:()=>a[i],enumerable:!(o=Ka(a,i))||o.enumerable});return e};var Qa=e=>Ua(qt({},"__esModule",{value:!0}),e);var yi={};_a(yi,{AIAutocomplete:()=>Oa,AIAutocompleteDropdown:()=>Ht,DATE_RANGE_META_END:()=>c.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>c.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>c.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>c.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>c.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>c.TIME_META_KEY,WEEKDAY_LABELS:()=>c.WEEKDAY_LABELS,buildSubmitResult:()=>c.buildSubmitResult,cellDay:()=>c.cellDay,cellIso:()=>c.cellIso,dateCellMarks:()=>c.dateCellMarks,formatDate:()=>c.formatDate,formatDateRange:()=>c.formatDateRange,formatOptionCount:()=>c.formatOptionCount,formatPlace:()=>c.formatPlace,formatTime:()=>c.formatTime,isoDate:()=>c.isoDate,monthLabel:()=>c.monthLabel,optionCountLabel:()=>c.optionCountLabel,optionHasImage:()=>c.optionHasImage,optionImageSources:()=>c.optionImageSources,optionImageSrc:()=>c.optionImageSrc,optionLabel:()=>c.optionLabel,optionsShowLeadingVisuals:()=>c.optionsShowLeadingVisuals,parseDate:()=>c.parseDate,parseLooseDate:()=>c.parseLooseDate,parseLooseDateRange:()=>c.parseLooseDateRange,parseTime:()=>c.parseTime,productFromMatchedItem:()=>c.productFromMatchedItem,productImageSources:()=>c.productImageSources,productsFromCustomFields:()=>c.productsFromCustomFields,sanitizeOptionIconSvg:()=>c.sanitizeOptionIconSvg,selectedRangeFor:()=>c.selectedRangeFor,useAIAutocomplete:()=>Bt,visibleDateRange:()=>c.visibleDateRange,withSkippedParams:()=>c.withSkippedParams});module.exports=Qa(yi);var c=require("@magicx-eng/ai-autocomplete-vanilla");var $=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
|
|
442
|
+
`,document.head.appendChild(e)}var ut={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 D=require("@magicx-eng/ai-autocomplete-vanilla"),J=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
443
443
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
444
444
|
* Consumer CSS always wins without !important.
|
|
445
445
|
*
|
|
@@ -1811,7 +1811,7 @@
|
|
|
1811
1811
|
opacity: 1;
|
|
1812
1812
|
}
|
|
1813
1813
|
}
|
|
1814
|
-
`,document.head.appendChild(e)}var
|
|
1814
|
+
`,document.head.appendChild(e)}var Pe={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 ie=require("@magicx-eng/ai-autocomplete-vanilla"),na=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
1815
|
|
|
1816
1816
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1817
1817
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -2008,7 +2008,7 @@
|
|
|
2008
2008
|
opacity: 0.8;
|
|
2009
2009
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
2010
2010
|
}
|
|
2011
|
-
`,document.head.appendChild(e)}var
|
|
2011
|
+
`,document.head.appendChild(e)}var X={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 xe=require("react/jsx-runtime"),Ya=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ra({options:e,activeIndex:a,listboxId:t,view:o,selection:i,onSelect:s,onHighlight:r,onUnhighlight:d,onPreviousMonth:v,onNextMonth:x}){let y=(0,ie.isoDate)(new Date),g=(0,ie.visibleDateRange)({pendingStart:i.rangeStart,highlightedIso:(0,ie.cellIso)(e[a]),selected:i.selectedRange,floor:i.floor});return(0,xe.jsxs)("div",{className:X.datepicker,"data-aia-datepicker":"",children:[(0,xe.jsxs)("div",{className:X.header,children:[(0,xe.jsx)("button",{type:"button",tabIndex:-1,className:X.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:v,children:"\u2039"}),(0,xe.jsx)("span",{className:X.month,"data-aia-date-month":"","aria-live":"polite",children:(0,ie.monthLabel)(o)}),(0,xe.jsx)("button",{type:"button",tabIndex:-1,className:X.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:x,children:"\u203A"})]}),(0,xe.jsx)("div",{className:X.weekdays,"aria-hidden":"true",children:ie.WEEKDAY_LABELS.map((h,u)=>(0,xe.jsx)("span",{className:X.weekday,children:h},Ya[u]))}),(0,xe.jsx)("div",{className:X.grid,"data-aia-date-grid":"",children:e.map((h,u)=>(0,xe.jsx)(ja,{option:h,id:`${t}-option-${u}`,index:u,isHighlighted:u===a&&h.is_tappable,isToday:(0,ie.cellIso)(h)===y,isPast:(0,ie.isDimmedDay)((0,ie.cellIso)(h),y,i.floor),marks:(0,ie.dateCellMarks)((0,ie.cellIso)(h),{selectedIso:i.selectedIso,range:g,references:i.references}),onSelect:s,onHighlight:r,onUnhighlight:d},(0,ie.cellIso)(h)??`pad-${u}`))})]})}function ja({option:e,id:a,index:t,isHighlighted:o,isToday:i,isPast:s,marks:r,onSelect:d,onHighlight:v,onUnhighlight:x}){let[y,g]=(0,na.useState)(!1),h=(0,ie.cellDay)(e);if(h==null)return(0,xe.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${X.cell} ${X.blank}`});let u=()=>{g(!0),d(e),setTimeout(()=>g(!1),170)},k=[X.cell,X.day,s?X.past:"",o?X.highlighted:"",i?X.today:"",r.inRange?X.inRange:"",r.selected?X.selected:"",r.reference?X.reference:"",y?X.pressed:""].filter(Boolean).join(" ");return(0,xe.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":o,"aria-label":e.text,tabIndex:0,className:k,onClick:u,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),u())},onMouseEnter:()=>v(t),onMouseLeave:x?()=>x(t):void 0,children:(0,xe.jsx)("span",{className:X.number,children:h})})}var ot=require("@magicx-eng/ai-autocomplete-vanilla"),Lt=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
2012
|
display: flex;
|
|
2013
2013
|
flex-wrap: wrap;
|
|
2014
2014
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -2048,7 +2048,7 @@
|
|
|
2048
2048
|
.aia-cluster[data-justify="around"] {
|
|
2049
2049
|
justify-content: space-around;
|
|
2050
2050
|
}
|
|
2051
|
-
`,document.head.appendChild(e)}var
|
|
2051
|
+
`,document.head.appendChild(e)}var Vt=require("react/jsx-runtime");function Et({gap:e,align:a="center",justify:t="start",noWrap:o=!1,inline:i=!1,className:s,children:r,...d}){let v=e?{"--aia-cluster-gap":e}:void 0,x={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":o||void 0,"data-inline":i||void 0,style:v,...d};return i?(0,Vt.jsx)("span",{...x,children:r}):(0,Vt.jsx)("div",{...x,children:r})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
|
|
2052
2052
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
2053
2053
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
2054
2054
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -2195,7 +2195,7 @@
|
|
|
2195
2195
|
justify-content: flex-end;
|
|
2196
2196
|
}
|
|
2197
2197
|
}
|
|
2198
|
-
`,document.head.appendChild(e)}var
|
|
2198
|
+
`,document.head.appendChild(e)}var Xe={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 Ge=require("react/jsx-runtime");function sa({isOptionHighlighted:e=!1,isInputEmpty:a=!1,strings:t=(0,ot.uiStringsFor)()}){let{key:o,hint:i}=(0,ot.getFooterHint)(e,a,t),[s,r]=(0,Lt.useState)(ot.ATTRIBUTION_URL);return(0,Lt.useEffect)(()=>{r((0,ot.buildAttributionUrl)())},[]),(0,Ge.jsx)("footer",{className:Xe.footer,"data-aia-footer":"",children:(0,Ge.jsxs)(Et,{justify:"between",noWrap:!0,className:Xe.row,children:[(0,Ge.jsxs)(Et,{gap:"5px",className:Xe.hintGroup,children:[(0,Ge.jsx)("kbd",{className:Xe.key,children:o}),(0,Ge.jsx)("span",{className:Xe.hint,children:i})]}),(0,Ge.jsxs)("a",{className:Xe.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[(0,Ge.jsx)("span",{className:Xe.brand,children:"AI"}),(0,Ge.jsx)("span",{className:Xe.badge,children:"Autocomplete"})]})]})})}var pe=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
|
|
2199
2199
|
Angular copy). The three are kept identical by
|
|
2200
2200
|
packages/vanilla/tests/render/locationFieldParity.test.ts. */
|
|
2201
2201
|
.aia-location-6-fsr {
|
|
@@ -2329,7 +2329,7 @@
|
|
|
2329
2329
|
.aia-loadingBar-OLCr4:nth-child(3) {
|
|
2330
2330
|
width: 60%;
|
|
2331
2331
|
}
|
|
2332
|
-
`,document.head.appendChild(e)}var
|
|
2332
|
+
`,document.head.appendChild(e)}var oe={location:"aia-location-6-fsr",field:"aia-field-xEzwi",icon:"aia-icon-czx6C",input:"aia-input-Yi9V-",results:"aia-results-C3O0V",row:"aia-row-Q9y8g",highlighted:"aia-highlighted-RJjPx",pin:"aia-pin-OjabL",text:"aia-text-Xs84O",name:"aia-name-Z-WJR",secondary:"aia-secondary-4sCT1",note:"aia-note-xCSvY",empty:"aia-empty-SYBzi",loading:"aia-loading-Ih1gi",loadingBar:"aia-loadingBar-OLCr4"};var U=require("react/jsx-runtime"),$a=0;function zt(e){return e.getRootNode().activeElement??null}function ca(e){return e.getRootNode().getSelection?.()??document.getSelection()}function la(e){if(!e.isContentEditable)return null;let a=ca(e);if(!a||a.rangeCount===0)return null;let t=a.getRangeAt(0);return e.contains(t.startContainer)?t.cloneRange():null}function da(e,a){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let t=ca(e);if(!t)return;let o=a;(!o||!o.startContainer.isConnected||!e.contains(o.startContainer))&&(o=document.createRange(),o.selectNodeContents(e),o.collapse(!1)),t.removeAllRanges(),t.addRange(o)}var Za=(0,U.jsxs)("svg",{className:oe.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,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"})]}),Xa=(0,U.jsxs)("svg",{className:oe.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 pa({view:e,searchLabel:a,noResultsLabel:t,useTypedLabel:o,widgetFocused:i,reediting:s=!1,visible:r=!0,interactive:d=!0,onQuery:v,onMove:x,onCommit:y,onFocusChange:g}){let h=(0,pe.useRef)(null),u=(0,pe.useRef)(null),k=(0,pe.useRef)(null),S=(0,pe.useRef)(null),I=(0,pe.useRef)(null),H=(0,pe.useRef)(!1),N=(0,pe.useRef)(!1),de=(0,pe.useRef)(!1),Q=(0,pe.useRef)(!1),O=(0,pe.useRef)(i);O.current=i;let W=(0,pe.useRef)(g);W.current=g;let G=p=>{Q.current=p,g(p)},Z=()=>{let p=h.current;return p!=null&&zt(p)===p},re=()=>{let p=u.current;if(!p)return;let z=zt(p);z instanceof HTMLElement&&z!==h.current&&z!==document.body&&!p.contains(z)&&(S.current=z,I.current=la(z))},R=p=>{let z=u.current;!z||!(p instanceof HTMLElement)||p===S.current||p===document.body||z.contains(p)||(S.current=p,I.current=la(p))},me=(0,pe.useRef)(null);me.current===null&&(me.current=`aia-location-${++$a}`);let fe=`${me.current}-row-`;(0,pe.useEffect)(()=>{let p=h.current;p&&p.value!==e.query&&zt(p)!==p&&(p.value=e.query)},[e.query]),(0,pe.useEffect)(()=>{i&&(s&&!de.current&&(N.current=!1),de.current=s);let p=h.current;if(p){if(!r&&Z()){N.current=!0,ee();return}if(!i){setTimeout(()=>{if(O.current)return;let z=S.current;z&&zt(z)===z||(N.current=!1)},0);return}if(!(!s||N.current||!d||Z())){if(re(),G(!0),p.focus({preventScroll:!0}),!Z()){N.current=!0,G(!1);return}p.value&&p.select()}}}),(0,pe.useLayoutEffect)(()=>()=>{if(!Q.current)return;let p=h.current,z=S.current;z?.isConnected&&p&&zt(p)===p&&(H.current=!0,da(z,I.current),H.current=!1),Q.current=!1,W.current(!1)},[]);let ee=(p=!1)=>{p&&(N.current=!0);let z=S.current;z?.isConnected&&Z()&&(H.current=!0,da(z,I.current),H.current=!1),G(!1)},ge=e.query.trim(),C=e.highlighted>=0&&e.highlighted<e.places.length?`${fe}${e.highlighted}`:void 0,K=null;return e.places.length>0?K=e.places.map((p,z)=>(0,U.jsxs)("div",{id:`${fe}${z}`,role:"option","aria-selected":z===e.highlighted,className:z===e.highlighted?`${oe.row} ${oe.highlighted}`:oe.row,"data-aia-location-row":"","data-aia-index":z,onClick:()=>{d&&(ee(!0),y(z))},children:[(0,U.jsx)("span",{className:oe.pin,children:Za}),(0,U.jsxs)("span",{className:oe.text,children:[(0,U.jsx)("span",{className:oe.name,children:p.name}),p.secondary&&(0,U.jsx)("span",{className:oe.secondary,children:p.secondary})]})]},p.id)):e.status==="loading"?K=(0,U.jsxs)("div",{className:oe.loading,"data-aia-location-loading":"",children:[(0,U.jsx)("span",{className:oe.loadingBar}),(0,U.jsx)("span",{className:oe.loadingBar}),(0,U.jsx)("span",{className:oe.loadingBar})]}):ge&&(K=(0,U.jsxs)("div",{className:oe.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,U.jsx)("span",{className:oe.empty,children:t}),(0,U.jsx)("span",{children:o})]})),(0,U.jsxs)("div",{ref:u,className:oe.location,"data-aia-location":"",onMouseDown:p=>{!(p.target instanceof Node)||!k.current?.contains(p.target)||(p.stopPropagation(),re(),G(!0))},children:[(0,U.jsxs)("label",{ref:k,className:oe.field,children:[Xa,(0,U.jsx)("input",{ref:h,type:"text",className:oe.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:a,"aria-label":a,"aria-activedescendant":C,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:p=>v(p.target.value),onFocus:p=>{R(p.relatedTarget),G(!0)},onBlur:()=>{H.current||(N.current=!0,G(!1))},onKeyDown:p=>{if(!p.nativeEvent.isComposing)switch(p.key){case"ArrowDown":case"ArrowUp":p.preventDefault(),x(p.key==="ArrowDown"?1:-1);return;case"Enter":if(p.preventDefault(),!d)return;ee(!0),y();return;case"Escape":p.preventDefault(),p.stopPropagation(),N.current=!0,ee();return;case"Backspace":if(p.currentTarget.value!=="")return;p.preventDefault(),N.current=!0,ee();return}}})]}),(0,U.jsx)("div",{className:oe.results,"data-aia-location-results":"","aria-live":"polite",children:K})]})}var Dt=require("@magicx-eng/ai-autocomplete-vanilla");var ha=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,
|
|
2333
2333
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
2334
2334
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
2335
2335
|
as it was when the outline was dashed. */
|
|
@@ -2487,7 +2487,7 @@
|
|
|
2487
2487
|
opacity: 0;
|
|
2488
2488
|
}
|
|
2489
2489
|
}
|
|
2490
|
-
`,document.head.appendChild(e)}var
|
|
2490
|
+
`,document.head.appendChild(e)}var Ke={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};var nt=require("react/jsx-runtime"),_t={selected:1,first:.7,next:.4,last:.2};function ua({label:e,state:a,active:t,rounded:o,loading:i,smartSuggestion:s,completionHeader:r,onClick:d}){let v=[Ke.pill,o?Ke.rounded:"",i?Ke.skeleton:""].filter(Boolean).join(" ");return(0,nt.jsx)("button",{type:"button","data-aia-pill":"","data-aia-pill-active":t?"":void 0,"data-aia-loading":i?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:v,style:{"--aia-pill-opacity":_t[a]},onMouseDown:x=>x.preventDefault(),onClick:i?void 0:d,disabled:i,children:s?(0,nt.jsxs)(nt.Fragment,{children:[(0,nt.jsx)("span",{className:`${Ke.smartText} magicx-aia-smart-suggestion-text`,children:e}),(0,nt.jsx)("span",{className:`${Ke.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:ha.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 {
|
|
2491
2491
|
position: relative;
|
|
2492
2492
|
z-index: 1;
|
|
2493
2493
|
pointer-events: auto;
|
|
@@ -2497,7 +2497,7 @@
|
|
|
2497
2497
|
align-items: center;
|
|
2498
2498
|
vertical-align: middle;
|
|
2499
2499
|
}
|
|
2500
|
-
`,document.head.appendChild(e)}var
|
|
2500
|
+
`,document.head.appendChild(e)}var Ut={list:"aia-list-qvLqO"};var Rt=require("react/jsx-runtime"),Ja=[125,69];function ma(e){return e===0?"first":e===1?"next":"last"}function Mt({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:o,rounded:i,loading:s}){return s&&e.length===0?(0,Rt.jsx)("span",{className:Ut.list,"data-aia-pill-list-loading":"",children:Ja.map((r,d)=>(0,Rt.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Ke.pill} ${i?Ke.rounded:""} ${Ke.skeleton}`,style:{width:r,"--aia-pill-opacity":_t[ma(d)]}},`skel-${r}`))}):(0,Rt.jsx)("span",{className:Ut.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,d)=>{let v=!!o&&d===a;return(0,Rt.jsx)(ua,{label:r.text,state:v?"selected":ma(d),selected:v,active:d===a,rounded:i,loading:s,smartSuggestion:(0,Dt.isSmartSuggestion)(r),completionHeader:(0,Dt.isTraditionalAutocompleteSuggestion)(r),onClick:()=>t(d)},`${r.parameter}-${r.text}`)})})}var Ie=require("@magicx-eng/ai-autocomplete-vanilla"),ye=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
|
|
2501
2501
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
2502
2502
|
theming one package sees the same result in the other.
|
|
2503
2503
|
|
|
@@ -3124,7 +3124,7 @@
|
|
|
3124
3124
|
opacity: 0.01;
|
|
3125
3125
|
}
|
|
3126
3126
|
}
|
|
3127
|
-
`,document.head.appendChild(e)}var
|
|
3127
|
+
`,document.head.appendChild(e)}var ne={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE",compareAt:"aia-compareAt-ewE54",badge:"aia-badge-j9Hcd",cart:"aia-cart-kSlqU",cartCheck:"aia-cartCheck-YTTQ6",cartGlyph:"aia-cartGlyph-cmqAk",cartSpinner:"aia-cartSpinner-442rc","magicx-aia-product-cart-spin":"aia-magicx-aia-product-cart-spin-x8mgr",stripLoadingOut:"aia-stripLoadingOut-0jOOQ",stripFadeIn:"aia-stripFadeIn-0p9qx"};var V=require("react/jsx-runtime");function ga({products:e,listboxId:a,onSelect:t,busyProductId:o=null,onAddToCart:i,onFocusChange:s,focusable:r=!0,loading:d=!1,layout:v="row",imageFallback:x="image",showVendor:y=!0,strings:g=(0,Ie.uiStringsFor)()}){let h=e.length>0,u=(0,ye.useRef)(null);if((0,ye.useEffect)(()=>{let S=u.current;if(!(!h||!S))return(0,Ie.attachProductRowWheel)(S)},[h]),!h)return null;let k=`${a}-products-label`;return(0,V.jsxs)("section",{className:ne.section,"data-aia-products":"","data-aia-loading":d?"":void 0,"data-aia-products-layout":v,role:"group","aria-labelledby":k,children:[(0,V.jsx)("div",{className:ne.label,id:k,"data-aia-products-label":"",children:g.products}),(0,V.jsx)("div",{ref:u,className:ne.row,"data-aia-products-row":"",children:e.map((S,I)=>(0,V.jsx)(ei,{product:S,id:`${a}-product-${I}`,onSelect:t,busy:S.id===o,onAddToCart:i,onFocusChange:s,focusable:r,imageFallback:x,showVendor:y,soldOut:g.soldOut,addToCart:g.addToCart},S.id))})]})}function ei({product:e,id:a,onSelect:t,busy:o,onAddToCart:i,onFocusChange:s,focusable:r,imageFallback:d,showVendor:v,soldOut:x,addToCart:y}){let g=!!i&&e.available!==!1,[h,u]=(0,ye.useState)(null),k=I=>{I.relatedTarget?.closest("[data-aia-dropdown]")||s?.(!1)},S=I=>{I.metaKey||I.ctrlKey||I.shiftKey||I.altKey||I.button!==0||(I.preventDefault(),t(e))};return(0,V.jsxs)("a",{id:a,className:ne.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":o?"busy":void 0,"aria-busy":o?!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:r?0:-1,onClick:S,onKeyDown:I=>{I.key!=="Enter"&&I.key!==" "||(I.preventDefault(),t(e))},onFocus:()=>s?.(!0),onBlur:k,children:[(0,V.jsx)(ii,{sources:(0,Ie.productImageSources)(e.imageUrl),title:e.title,fallback:d,onPhotoFill:u},(0,Ie.productImageSrc)(e.imageUrl)??""),(0,V.jsxs)("span",{className:ne.body,children:[v&&e.vendor?(0,V.jsx)("span",{className:ne.vendor,children:e.vendor}):null,(0,V.jsx)("span",{className:ne.title,children:e.title}),e.price?(0,V.jsxs)("span",{className:ne.price,children:[e.price,e.compareAtPrice?(0,V.jsx)("s",{className:ne.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?(0,V.jsx)("span",{className:ne.badge,children:x}):null]}),g&&i?(0,V.jsx)(ai,{product:e,label:`${y}: ${e.title}`,focusable:r,onAddToCart:i,onFocus:()=>s?.(!0),onBlur:k},ti(e)):null]})}function ti(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(a=>a??"").join("\0")}function ai({product:e,label:a,focusable:t,onAddToCart:o,onFocus:i,onBlur:s}){let[r,d]=(0,ye.useState)(null),v=(0,ye.useRef)(null),x=(0,ye.useRef)(e);x.current=e;let y=(0,ye.useRef)(!0);(0,ye.useEffect)(()=>(y.current=!0,()=>{y.current=!1}),[]);let g=u=>{v.current=u,y.current&&d(u)},h=u=>{if(u.preventDefault(),u.stopPropagation(),v.current==="adding")return;g("adding");let k;try{k=Promise.resolve(o(x.current))}catch(S){k=Promise.reject(S)}k.then(()=>g("added"),()=>g(null))};return(0,V.jsx)("span",{className:ne.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":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(),s(u)},children:(0,V.jsxs)("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[(0,V.jsx)("path",{className:ne.cartGlyph,d:"M2 3h2.2l2.4 11.2a2 2 0 0 0 2 1.6h8.9a2 2 0 0 0 1.9-1.5L21 8H6"}),(0,V.jsx)("path",{className:ne.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),(0,V.jsx)("path",{className:ne.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),(0,V.jsx)("path",{className:ne.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),(0,V.jsx)("circle",{className:ne.cartGlyph,cx:"9",cy:"20",r:"1.3"}),(0,V.jsx)("circle",{className:ne.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function ii({sources:e,title:a,fallback:t,onPhotoFill:o}){let[i,s]=(0,ye.useState)(0),r=e[i],d=!!r,[v,x]=(0,ye.useState)(null),y=!d&&t==="initial";return(0,ye.useEffect)(()=>()=>o(null),[o]),(0,V.jsxs)("span",{className:ne.media,"data-aia-product-media":"","aria-hidden":"true","data-aia-product-placeholder":!d&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":d&&v===r?"":void 0,children:[d?(0,V.jsx)("img",{className:ne.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:g=>{x(r),o((0,Ie.productPhotoFill)(g.currentTarget.naturalWidth,g.currentTarget.naturalHeight))},onError:()=>{i+1>=e.length&&o(null),s(g=>g+1)}}):null,y?(0,Ie.productInitial)(a):null]})}var q=require("@magicx-eng/ai-autocomplete-vanilla"),Ee=require("react");var fa=require("@magicx-eng/ai-autocomplete-vanilla"),Nt=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 {
|
|
3128
3128
|
display: grid;
|
|
3129
3129
|
grid-template-columns: repeat(
|
|
3130
3130
|
auto-fit,
|
|
@@ -3168,7 +3168,7 @@
|
|
|
3168
3168
|
:where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
|
|
3169
3169
|
max-height: var(--aia-grid-max-height, 120px);
|
|
3170
3170
|
}
|
|
3171
|
-
`,document.head.appendChild(e)}var
|
|
3171
|
+
`,document.head.appendChild(e)}var wa=require("react/jsx-runtime");function ba({min:e="16rem",max:a,gap:t,scroll:o=!1,maxHeight:i,scrollResetKey:s,cols:r,template:d,innerRef:v,className:x,children:y,...g}){let h=(0,Nt.useRef)(null);(0,Nt.useLayoutEffect)(()=>{if(s===void 0)return;let k=h.current;k&&(k.scrollTop=0)},[s]);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),r&&(u.gridTemplateColumns=(0,fa.optionsGridTemplateColumns)(r)),d&&(u.gridTemplateColumns=d),(0,wa.jsx)("div",{ref:k=>{h.current=k,v?.(k)},className:x?`aia-grid ${x}`:"aia-grid","data-scroll":o||void 0,style:u,...g,children:y})}var be=require("@magicx-eng/ai-autocomplete-vanilla"),Ae=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 {
|
|
3172
3172
|
position: relative;
|
|
3173
3173
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
3174
3174
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -3694,7 +3694,7 @@
|
|
|
3694
3694
|
border-radius: 6px;
|
|
3695
3695
|
font-size: 11px;
|
|
3696
3696
|
}
|
|
3697
|
-
`,document.head.appendChild(e)}var
|
|
3697
|
+
`,document.head.appendChild(e)}var he={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",liveMatch:"aia-liveMatch--eYfs",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",loadingOut:"aia-loadingOut-hI-qI",parameter:"aia-parameter-Dt2zF",match:"aia-match-pp-9v",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",text:"aia-text-yqoh9",checkbox:"aia-checkbox-KGRhg"};var ue=require("react/jsx-runtime");function va({option:e,isHighlighted:a,checked:t,onSelect:o,onHighlight:i,onUnhighlight:s,id:r,loading:d,showIcon:v=!0,showImage:x=!0,showCount:y=!0,scrollHint:g,enterDelayMs:h=0}){let[u]=(0,Ae.useState)(h),[k,S]=(0,Ae.useState)(!1),I=x?(0,be.optionImageSources)(e.image_url):[],H=I[0]??null,[N,de]=(0,Ae.useState)([]),Q=I.find(C=>!N.includes(C))??null,O=x?(e.imageCollage??[]).map(C=>(0,be.optionImageSources)(C)[0]).filter(C=>C!==void 0):[],[W,G]=(0,Ae.useState)(!1),[Z,re]=(0,Ae.useState)(null),R=(0,Ae.useMemo)(()=>!H&&v&&e.icon_svg?(0,be.sanitizeOptionIconSvg)(e.icon_svg):null,[H,v,e.icon_svg]),me=y?(0,be.formatOptionCount)(e.item_count):null,fe=(0,Ae.useRef)(void 0);(0,Ae.useEffect)(()=>()=>clearTimeout(fe.current),[]);let ee=C=>{if(d||!e.is_tappable||k&&t===void 0)return;S(!0);let K=C?.currentTarget;t!==void 0&&K!==void 0&&C!==void 0&&!(0,be.isMultiSelectToggleTap)(K,K.querySelector("[data-aia-checkbox]"),C)?o(e,{commit:!0}):o(e),clearTimeout(fe.current),fe.current=setTimeout(()=>S(!1),170)},ge=[he.item,a&&!d?he.highlighted:"",e.liveMatch&&!d?he.liveMatch:"",e.is_tappable?he.tappable:he.nonTappable,k?he.pressed:"",g?he.scrollHint:""].filter(Boolean).join(" ");return(0,ue.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":d?"":void 0,"data-aia-icon":R&&e.icon?e.icon:void 0,"data-aia-image":H?"":void 0,"data-aia-item-count":me!==null?e.item_count:void 0,"aria-selected":t??a,className:ge,style:{[be.OPTION_ENTER_DELAY_VAR]:`${u}ms`},tabIndex:d||!e.is_tappable?-1:0,onClick:ee,onKeyDown:C=>{!d&&e.is_tappable&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),ee())},onMouseEnter:!d&&e.is_tappable?i:void 0,onMouseLeave:s,children:(0,ue.jsxs)("span",{className:he.content,children:[t!==void 0&&e.is_tappable&&(0,ue.jsx)("span",{className:he.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":t,children:t?"\u2713":""}),H&&O.length>1&&(0,ue.jsx)("span",{className:`${he.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":O.length,"data-aia-image-loaded":W?"":void 0,children:O.map(C=>(0,ue.jsx)("img",{src:C,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>G(!0),onError:K=>{K.currentTarget.hidden=!0}},C))}),H&&O.length<=1&&(0,ue.jsx)("span",{className:`${he.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":Q!==null&&Z===Q?"":void 0,children:(0,ue.jsx)("img",{src:Q??H,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:Q===null,onLoad:()=>re(Q),onError:()=>{Q!==null&&de(C=>[...C,Q])}})}),R&&(0,ue.jsx)("span",{className:`${he.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:R}}),(0,ue.jsxs)("span",{className:he.text,children:[e.matchedText?(0,be.highlightParts)((0,be.optionLabel)(e),e.matchedText).map((C,K)=>C.bold?(0,ue.jsx)("strong",{className:`${he.match} magicx-aia-option-match`,"data-aia-match-partial":C.partial?"":void 0,children:C.text},K):C.text):(0,be.optionLabel)(e),e.parameterLabel&&(0,ue.jsxs)(ue.Fragment,{children:[" ",(0,ue.jsx)("span",{className:`${he.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,ue.jsx)("span",{className:he.tag,children:e.tag}),me!==null&&(0,ue.jsx)("span",{className:`${he.count} magicx-aia-option-count`,children:me})]})})}var Qt=require("react/jsx-runtime");function oi(){let[e,a]=(0,Ee.useState)(q.isOptionsGridMobileViewport);return(0,Ee.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(q.OPTIONS_GRID_MOBILE_QUERY),o=()=>a(t.matches);return o(),t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[]),e}function xa({options:e,activeIndex:a,picked:t,onSelect:o,onHighlight:i,onUnhighlight:s,listboxId:r,loading:d,groupKey:v="",optionsPosition:x="below",showIcons:y=!0,showImages:g=!0,showCounts:h=!0}){let u=oi(),k=(0,Ee.useRef)(null),[S,I]=(0,Ee.useState)(null),H=(0,Ee.useRef)(null);(0,Ee.useLayoutEffect)(()=>{if(d&&(0,q.sameOptionRows)(H.current,e))return;H.current=d?null:e;let O=k.current,W=O&&!d&&(0,q.needsOptionsGridMeasurement)(e.length,u),G=O?.closest("[data-aia-dropdown]");W&&G&&(0,q.releasePanelHug)(G);let Z=W?(0,q.measureOptionsGrid)(O):null;I(Z?(0,q.planOptionsGrid)(e.length,u,Z.rowWidths,Z.gridWidth):null)},[e,u,d]);let N=S??(0,q.planOptionsGrid)(e.length,u,null,null);(0,Ee.useLayoutEffect)(()=>{let O=k.current?.closest("[data-aia-dropdown]");O&&(0,q.syncPanelHug)(O)},[N.template,u]);let de=d?-1:a;(0,Ee.useLayoutEffect)(()=>{k.current&&(0,q.syncHighlightScroll)(k.current,de)},[de]);let Q=(0,q.optionsShowLeadingVisuals)(e,y,g);return(0,Qt.jsx)(ba,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:v,template:N.template,maxHeight:N.maxHeight,innerRef:O=>{k.current=O},"data-aia-group":v,children:e.map((O,W)=>(0,Qt.jsx)(va,{option:O,isHighlighted:W===a,checked:t?t.includes(O.text):void 0,onSelect:o,onHighlight:G=>{(0,q.pointerMayHighlight)(k.current,W,G)&&i(W)},onUnhighlight:s?G=>{(0,q.pointerMayHighlight)(k.current,-1,G)&&s(W)}:void 0,id:`${r}-option-${W}`,loading:d,showIcon:y&&Q,showImage:g&&Q,showCount:h,scrollHint:!d&&N.scrollHintIndices.includes(W),enterDelayMs:d?0:(0,q.optionEnterDelayMs)(W,N.cols,e.length,x)},`${v}\0${O.parameter??""}\0${O.text}`))})}var we=require("@magicx-eng/ai-autocomplete-vanilla"),Oe=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) ---
|
|
3698
3698
|
|
|
3699
3699
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
3700
3700
|
time-wheel.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -3816,7 +3816,7 @@
|
|
|
3816
3816
|
.aia-done-llNY5:hover {
|
|
3817
3817
|
background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
|
|
3818
3818
|
}
|
|
3819
|
-
`,document.head.appendChild(e)}var Re={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
|
|
3819
|
+
`,document.head.appendChild(e)}var Re={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"),ni=120;function ya({view:e,label:a,doneLabel:t,interactive:o=!0,onTimeChange:i,onTimeCommit:s}){return(0,ze.jsxs)("div",{className:Re.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":a,onMouseDown:r=>r.preventDefault(),children:[(0,ze.jsx)("span",{className:Re.value,"data-aia-time-value":"","aria-live":"polite",children:(0,we.formatTime)(e.minutes)}),(0,ze.jsxs)("div",{className:Re.columns,"aria-hidden":"true",children:[(0,ze.jsx)("div",{className:Re.band}),we.TIME_WHEEL_COLUMNS.map(r=>(0,ze.jsxs)(Oe.Fragment,{children:[r==="minute"&&(0,ze.jsx)("span",{className:Re.separator,children:":"}),(0,ze.jsx)(ri,{column:r,minutes:e.minutes,interactive:o,onTimeChange:i})]},r))]}),(0,ze.jsx)("button",{type:"button",tabIndex:-1,className:Re.done,"data-aia-time-done":"",onClick:()=>{o&&s()},children:t})]})}function ri({column:e,minutes:a,interactive:t,onTimeChange:o}){let i=(0,Oe.useRef)(null),s=(0,Oe.useRef)(null),r=(0,Oe.useRef)(null),d=(0,Oe.useRef)({minutes:a,interactive:t,onTimeChange:o});d.current={minutes:a,interactive:t,onTimeChange:o};let v=(0,we.timeWheelIndex)(e,a);(0,Oe.useLayoutEffect)(()=>{let g=i.current;if(!g||r.current)return;let h=v*we.TIME_WHEEL_ROW_HEIGHT;Math.abs(g.scrollTop-h)<1||(s.current=h,g.scrollTop=h)},[v]),(0,Oe.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let x=()=>{r.current=null;let g=i.current,h=d.current;if(!g||!h.interactive)return;let u=(0,we.timeWheelIndexFromScroll)(e,g.scrollTop);u!==(0,we.timeWheelIndex)(e,h.minutes)&&h.onTimeChange((0,we.withTimeWheelIndex)(e,h.minutes,u))},y=()=>{let g=i.current;if(g){if(s.current!=null&&Math.abs(g.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(x,ni)}};return(0,ze.jsx)("div",{ref:i,className:Re.column,"data-aia-time-column":e,onScroll:y,children:(0,we.timeWheelRows)(e).map((g,h)=>(0,ze.jsx)("div",{className:h===v?`${Re.row} ${Re.selected}`:Re.row,"data-aia-time-row":"","data-aia-index":h,onClick:()=>{d.current.interactive&&o((0,we.withTimeWheelIndex)(e,d.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 {
|
|
3820
3820
|
display: flex;
|
|
3821
3821
|
flex-direction: column;
|
|
3822
3822
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -3831,7 +3831,7 @@
|
|
|
3831
3831
|
align-items: end;
|
|
3832
3832
|
}
|
|
3833
3833
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
3834
|
-
`,document.head.appendChild(e)}var
|
|
3834
|
+
`,document.head.appendChild(e)}var Sa=require("react/jsx-runtime");function ka({space:e,align:a="stretch",className:t,children:o,...i}){let s=e?{"--aia-stack-space":e}:void 0;return(0,Sa.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:s,...i,children:o})}var Y=require("react/jsx-runtime"),si=typeof window>"u"?J.useEffect:J.useLayoutEffect,li=[159,119,164],di=()=>{},Ca=()=>{},ci=e=>{},pi=()=>{},hi=e=>{},ui=e=>{},mi=e=>{},gi=e=>{};function fi(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,o]=(0,J.useState)(a);if((0,J.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let i=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>o(i.matches);return i.addEventListener("change",s),()=>i.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function bi(e,a){let t=(0,J.useRef)(null);(0,J.useEffect)(()=>{let o=e.current,i=a.current;if(!o||!i)return;let s=(0,D.queryLive)(o,".aia-grid[data-scroll]");if(t.current&&t.current.grid!==s&&(t.current.controller.destroy(),t.current=null),s&&!t.current){t.current={grid:s,controller:(0,D.attachScrollArrow)({dropdown:o,grid:s,button:i})};return}t.current?.controller.update()}),(0,J.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function wi(e,a){let t=(0,J.useRef)(a);t.current=a;let o=(0,J.useRef)(null);(0,J.useLayoutEffect)(()=>{let i=e.current;if(i){if(!o.current){o.current=(0,D.attachViewportFit)({dropdown:i,isOpen:()=>t.current});return}o.current.update()}}),(0,J.useEffect)(()=>()=>{o.current?.destroy(),o.current=null},[])}function Ht({suggestions:e,activeIndex:a,onSelect:t,onHighlight:o,onUnhighlight:i,isOpen:s,id:r,className:d,pills:v,onPillClick:x,showPills:y=!0,onSkip:g,showSkipButton:h=!0,showOptionIcons:u=!0,showOptionImages:k=!0,showOptionCounts:S=!0,skipDisabled:I=!1,activeSelected:H=!1,isLoading:N=!1,skeletonExiting:de=!1,isInputEmpty:Q=!1,language:O,products:W,onProductSelect:G,onProductAddToCart:Z,onProductFocusChange:re,productsLayout:R="row",productImageFallback:me="image",showProductVendor:fe=!0,formatType:ee="options",dateView:ge=null,selectedDateIso:C=null,selectedDateRange:K=null,dateRangeStart:p=null,dateReferences:z,onPreviousMonth:Ve,onNextMonth:Je,timeView:De=null,multiSelectView:rt=null,onMultiSelectCommit:et,onSeeAllResults:m,seeAllBusy:_e=!1,busyProductId:tt=null,fullWidth:at=!1,onTimeChange:f,onTimeCommit:T,locationView:A=null,isReediting:L=!1,onLocationQuery:F,onLocationMove:se,onLocationCommit:Se,onLocationFocusChange:Ce,isFocused:Ue=!1,optionsPosition:Me="below",mode:it}){let Te=fi(it),st=Te!==void 0,te=(0,J.useRef)(null),Qe=(0,J.useRef)(null);bi(te,Qe),(0,J.useEffect)(()=>{if(te.current)return(0,D.containScroll)(te.current)},[]);let mt=e[0]?.options??[],St=!!(v&&v.length>0&&x),Ne=!!(W&&W.length>0),lt=ee==="time"&&De!=null,dt=ee==="location"&&A!=null,ce=s&&(mt.length>0||y&&St||N||Ne||lt||dt);wi(te,ce),si(()=>{let E=te.current;E&&((0,D.fitMultiSelectDone)(E,(0,D.findMultiSelectDone)(E)),(0,D.syncPanelHug)(E))});let He={suggestions:e,activeIndex:a,pills:v,showPills:y,showSkipButton:h,showOptionIcons:u,showOptionImages:k,showOptionCounts:S,skipDisabled:I,activeSelected:H,isLoading:N,skeletonExiting:de,isInputEmpty:Q,products:W,formatType:ee,dateView:ge,selectedDateIso:C,selectedDateRange:K,dateRangeStart:p,dateReferences:z,timeView:De,multiSelectView:rt,locationView:A,isReediting:L,showsSeeAll:!!m},ct=(0,J.useRef)(He);ce&&(ct.current=He);let n=ce?He:ct.current,le=(0,D.uiStringsFor)(O),Fe=n.suggestions[0],b=Fe?.options??[],pt=n.activeIndex>=0&&!!b[n.activeIndex]?.is_tappable,Ye=(0,D.labelTraditionalAutocomplete)(n.pills??[],le.keepTyping),Be=!!(Ye.length>0&&x),w=n.showPills&&Be,gt=n.showPills&&!Be&&n.isLoading,ft=w||gt,je=Be&&(0,D.hasSkippablePill)(Ye)&&n.showSkipButton&&!n.isInputEmpty&&!!g,bt=Ye[0]?.text,wt=(0,D.isCalendarFormat)(n.formatType)&&n.dateView!=null,$e=b.length>0&&!wt,vt=b.length>0&&wt&&!n.isLoading,Ze=n.formatType==="time"&&n.timeView!=null&&!n.isLoading,We=n.formatType==="location"&&n.locationView!=null&&!n.isLoading,xt=n.isLoading&&!$e&&!vt&&!Ze&&!We,ht=n.products??[],yt=(0,D.panelMorphKey)(w?Ye:[]);return(0,J.useLayoutEffect)(()=>{te.current&&(0,D.settlePanelMorph)(te.current,yt,{visible:ce,anchorBottom:Me==="above"})},[yt,ce,Me,n.suggestions,n.pills,n.isLoading,n.skeletonExiting,n.isInputEmpty,n.products,n.formatType,n.dateView,n.selectedDateIso,n.selectedDateRange,n.dateRangeStart,n.dateReferences,n.timeView,n.multiSelectView,n.locationView,n.showPills,n.showSkipButton,n.showOptionIcons,n.showOptionImages,n.showOptionCounts,n.showsSeeAll,R,O]),(0,J.useEffect)(()=>{let E=te.current;return()=>{E&&(0,D.destroyPanelMorph)(E)}},[]),(0,Y.jsxs)("div",{ref:te,id:r,role:"listbox","aria-multiselectable":!!n.multiSelectView,"data-aia-dropdown":"","data-options-position":Me,"data-mode":Te,"data-aia-loading":n.isLoading?"":void 0,"data-aia-skeleton-exiting":n.skeletonExiting?"":void 0,"data-aia-has-products":ht.length>0?"":void 0,"data-aia-full-width":at?"":void 0,className:`${st?"magicx-aia ":""}${Pe.dropdown} ${ce?Pe.visible:""} ${d??""}`,onMouseDown:E=>E.preventDefault(),children:[(0,Y.jsxs)(ka,{space:"8px",children:[(ft||je)&&(0,Y.jsxs)(Et,{noWrap:!0,className:Pe.pillBar,"data-aia-pillbar":"",children:[ft&&(0,Y.jsx)("span",{className:Pe.pillScroll,"data-aia-pill-scroll":"",children:(0,Y.jsx)(Mt,{pills:Ye,activePillIndex:0,activeSelected:n.activeSelected,onSelectPill:x??(()=>{}),rounded:!0,loading:n.isLoading})}),je&&(0,Y.jsx)("button",{type:"button",tabIndex:-1,className:Pe.skip,"data-aia-skip":"",disabled:n.isLoading||n.skipDisabled,"aria-label":bt?`${le.skipLabel} ${bt}`:le.skipLabel,onClick:g,children:le.skip})]}),$e&&(0,Y.jsx)(xa,{options:b,activeIndex:n.activeIndex,onSelect:t,onHighlight:o,onUnhighlight:i,listboxId:r,loading:n.isLoading,groupKey:Fe?`${Fe.parameter} ${Fe.text}`:"",optionsPosition:Me,showIcons:n.showOptionIcons,showImages:n.showOptionImages,showCounts:n.showOptionCounts,picked:n.multiSelectView?.picked}),n.multiSelectView&&(0,Y.jsx)("div",{"data-aia-multi-actions":"",onClick:E=>{E.target.closest("[data-aia-multi-done]")&&!n.skipDisabled&&!n.isLoading&&et?.()},children:(0,Y.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:Pe.multiDone,ref:E=>{E&&(E.disabled=!0,E.offsetHeight,E.disabled=n.skipDisabled||n.isLoading)},children:le.done})}),vt&&n.dateView&&(0,Y.jsx)(ra,{options:b,activeIndex:n.activeIndex,listboxId:r,view:n.dateView,selection:{selectedIso:n.selectedDateIso??null,selectedRange:n.selectedDateRange??null,rangeStart:n.dateRangeStart??null,floor:(0,D.dateFloorFor)(n.formatType,n.dateRangeStart),references:n.dateReferences??[]},onSelect:t,onHighlight:o,onUnhighlight:i,onPreviousMonth:Ve??Ca,onNextMonth:Je??Ca}),Ze&&n.timeView&&(0,Y.jsx)(ya,{view:n.timeView,label:le.timeLabel,doneLabel:le.done,interactive:!n.skipDisabled,onTimeChange:f??ci,onTimeCommit:T??pi}),We&&n.locationView&&(0,Y.jsx)(pa,{view:n.locationView,searchLabel:le.locationSearch,noResultsLabel:le.locationNoResults,useTypedLabel:le.locationUseTyped,widgetFocused:Ue&&ce,reediting:n.isReediting,visible:ce,interactive:!n.skipDisabled,onQuery:F??hi,onMove:se??ui,onCommit:Se??mi,onFocusChange:Ce??gi}),xt&&(0,Y.jsx)("div",{className:Pe.skeletonBars,"data-aia-skeleton-bars":"",children:li.map(E=>(0,Y.jsx)("span",{className:Pe.skeletonBar,style:{width:E}},`bar-${E}`))}),(0,Y.jsx)(ga,{products:ht,listboxId:r,onSelect:G??di,busyProductId:tt,onAddToCart:Z,onFocusChange:re,focusable:ce&&!n.isLoading,loading:n.isLoading,layout:R,imageFallback:me,showVendor:fe,strings:le}),n.showsSeeAll&&(0,Y.jsx)("div",{className:Pe.seeAllRow,"data-aia-see-all":"",onClick:E=>{E.target.closest("[data-aia-see-all-button]")&&(E.stopPropagation(),!(n.isLoading||_e)&&m?.())},children:(0,Y.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"","data-aia-see-all-state":_e?"busy":void 0,"aria-busy":_e?!0:void 0,className:Pe.seeAll,ref:E=>{E&&(E.disabled=!0,E.offsetHeight,E.disabled=n.isLoading)},children:le.seeAllResults})}),(0,Y.jsx)(sa,{isOptionHighlighted:pt,isInputEmpty:n.isInputEmpty,strings:le})]}),(0,Y.jsx)("button",{ref:Qe,type:"button",tabIndex:-1,className:Pe.scrollArrow,"data-aia-scroll-arrow":"","aria-label":le.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 qe=require("@magicx-eng/ai-autocomplete-vanilla");var Pa=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 {
|
|
3835
3835
|
flex-shrink: 0;
|
|
3836
3836
|
width: 32px;
|
|
3837
3837
|
height: 32px;
|
|
@@ -3935,5 +3935,5 @@
|
|
|
3935
3935
|
transition: none;
|
|
3936
3936
|
}
|
|
3937
3937
|
}
|
|
3938
|
-
`,document.head.appendChild(e)}var yt={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};var Da=require("react/jsx-runtime");function St({disabled:e,ready:i,busy:t=!1,onClick:n,label:o=(0,kt.uiStringsFor)().submit}){return(0,Da.jsx)("button",{type:"button","data-aia-submit":"",className:yt.submitButton,disabled:e,"data-aia-ready":i?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:s=>{s.stopPropagation(),n()},"aria-label":o,children:(0,Da.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":o,children:(0,Da.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var ke=require("@magicx-eng/ai-autocomplete-vanilla"),E=require("react");var Va=require("react");function Ct(e){let i=(0,Va.useRef)(e);i.current=e;let t=Object.keys(e??{}).sort().join("\0"),n=(0,Va.useRef)({key:"",overrides:void 0});if(n.current.key!==t){let o={};for(let s of Object.keys(e??{})){let r=(l,b,v)=>{let y=i.current?.[s];return y?y(l,b,v):[]};o[s]=r}n.current={key:t,overrides:e?o:void 0}}return{overrides:n.current.overrides,key:t}}var Ua=require("react");function Tt(e){let i=(0,Ua.useRef)(e);i.current=e;let t=(0,Ua.useRef)(null);t.current===null&&(t.current={fetch:(o,s)=>{let r=i.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>i.current?.transform(o)??[],get limit(){return i.current?.limit}});let n=e!==void 0;return{config:n?t.current:void 0,enabled:n}}var Pt={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,isSubmitting:!1,selectingProductId:null,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Ma({onSubmit:e,onResult:i,onError:t,optionOverrides:n,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,visitorId:y,columns:f=2,dropdownTrigger:h,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:k,allOption:C,showNonTappableOptions:F,locationSearch:M,showOptionIcons:he,showOptionImages:Q,showOptionCounts:z,showSkipButton:W,showProducts:H,submitProgress:X,productImageFallback:ce="image",showProductVendor:A=!0,onFocus:re,onBlur:ue,value:V,completedParams:pe,onChange:T,onParamsChange:G,products:p,mapProducts:P,onProductSelect:Qe,onProductAddToCart:Ke,source:Ye,setCursor:je}){let m=(0,E.useRef)(null),[$e,De]=(0,E.useState)(null),Ze=(0,E.useRef)(e);Ze.current=e;let Xe=(0,E.useRef)(i);Xe.current=i;let g=(0,E.useRef)(t);g.current=t;let S=(0,E.useRef)(T);S.current=T;let I=(0,E.useRef)(G);I.current=G;let R=(0,E.useRef)(re);R.current=re;let N=(0,E.useRef)(ue);N.current=ue;let oe=(0,E.useRef)(je);oe.current=je;let Se=(0,E.useRef)(Qe);Se.current=Qe;let Ee=(0,E.useRef)(Ke);Ee.current=Ke;let qe=(0,E.useRef)(y);qe.current=y;let _e=(0,E.useRef)(()=>{let d=qe.current;return typeof d=="function"?d():d}).current,Je=Tt(p),ea=(0,E.useRef)(P);ea.current=P;let Me=(0,E.useRef)((d,$)=>{let q=ea.current;return q?q(d,$):d}).current,me=P?Me:void 0,aa=Ct(n);(0,E.useEffect)(()=>{if(typeof document>"u")return;let d=new ke.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,visitorId:_e,optionOverrides:aa.overrides,maskCompletedText:o,columns:f,dropdownTrigger:h,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:k,allOption:C,showNonTappableOptions:F,locationSearch:M,showProducts:H,submitProgress:X,source:Ye,value:V,completedParams:pe,onSubmit:(...q)=>Ze.current?.(...q),onResult:(...q)=>Xe.current?.(...q),onError:(...q)=>g.current?.(...q),onChange:(...q)=>S.current?.(...q),onParamsChange:(...q)=>I.current?.(...q),onFocus:()=>R.current?.(),onBlur:()=>N.current?.(),onProductSelect:q=>Se.current?Se.current(q):ke.HANDOFF_NOT_HANDLED,onProductAddToCart:q=>Ee.current?.(q),setCursor:q=>oe.current?.(q),products:Je.config,mapProducts:me});m.current=d,De(d.getState());let $=d.subscribe(q=>De(q));return()=>{$(),d.destroy(),m.current===d&&(m.current=null)}},[]),(0,E.useEffect)(()=>{V!==void 0&&m.current?.setValue(V)},[V]),(0,E.useEffect)(()=>{pe!==void 0&&m.current?.setCompletedParams(pe)},[pe]);let wa=JSON.stringify(s??null),Ne;try{Ne=JSON.stringify(r??null)}catch{Ne="[unstringifiable]"}(0,E.useEffect)(()=>{m.current?.update({apiConfig:s,additionalContext:r,language:l,currency:b,productId:v,optionOverrides:aa.overrides,dropdownTrigger:h,optionsPosition:u,closeDropdownOnBlur:x,prependPlaceholder:k,allOption:C,showNonTappableOptions:F,locationSearch:M,showProducts:H,submitProgress:X})},[wa,Ne,l,b?.code,b?.rate,b?.country,v,aa.key,h,u,x,k,C,F,M,H,X]);let ua=(0,E.useRef)(!1);(0,E.useEffect)(()=>{if(!ua.current){ua.current=!0;return}m.current?.update({products:Je.config})},[Je.enabled]),(0,E.useEffect)(()=>{m.current?.update({mapProducts:me})},[me]);let ta=(0,E.useRef)(null);ta.current===null&&(ta.current={handleTextChange:d=>m.current?.handleTextChange(d),handleCompositionText:d=>m.current?.handleCompositionText(d),handleKeyDown:d=>{let $="nativeEvent"in d?d.nativeEvent:d;m.current?.handleKeyDown($)},setFocused:d=>m.current?.setFocused(d),startEditingParam:d=>m.current?.startEditingParam(d),removeParam:d=>m.current?.removeParam(d)??!1,exitEditMode:()=>m.current?.exitEditMode(),handleCaretAfterInput:d=>m.current?.handleCaretAfterInput(d),handleCaretMove:d=>m.current?.handleCaretMove(d),replaceEditingRange:d=>m.current?.replaceEditingRange(d)??!1,setActivePill:d=>m.current?.setActivePill(d),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()??Pt,recordSubmit:d=>m.current?.recordSubmit(d),holdSubmit:d=>m.current?.holdSubmit(d),endSubmitProgress:()=>m.current?.endSubmitProgress(),selectOption:(d,$)=>m.current?.selectOption(d,$),selectProduct:d=>m.current?.selectProduct(d),addProductToCart:d=>{let $=m.current;return!$||!Ee.current?Promise.resolve():$.addProductToCart(d)},setActiveDropdownIndex:d=>m.current?.setActiveDropdownIndex(d),clearHighlight:d=>m.current?.clearHighlight(d),showPreviousMonth:()=>m.current?.showPreviousMonth(),showNextMonth:()=>m.current?.showNextMonth(),setTime:d=>m.current?.setTime(d),commitTime:()=>m.current?.commitTime(),toggleMultiSelectOption:d=>m.current?.toggleMultiSelectOption(d),commitMultiSelect:()=>m.current?.commitMultiSelect(),setLocationQuery:d=>m.current?.setLocationQuery(d),moveLocationHighlight:d=>m.current?.moveLocationHighlight(d),commitLocation:d=>m.current?.commitLocation(d),setLocationFieldFocused:d=>m.current?.setLocationFieldFocused(d),handleFocus:()=>m.current?.setFocused(!0),handleBlur:()=>m.current?.setFocused(!1)});let w=ta.current,be=(0,E.useCallback)(d=>{let $=d.target.value,fa=$.length>0&&!d.nativeEvent?.isComposing&&$[0]!==$[0].toUpperCase()?$[0].toUpperCase()+$.slice(1):$;m.current?.handleTextChange(fa)},[]),ia=(0,E.useCallback)(d=>{m.current?.handleKeyDown(d.nativeEvent)},[]),oa=m.current,a=$e??Pt,ne=V!==void 0?V:a.text,na=pe!==void 0?pe:a.completedParams,we=a.actionableSuggestions,va=we[0],He=(0,E.useMemo)(()=>(0,ke.withoutTraditionalAutocomplete)(we),[we]),ze=oa?.listboxId??"",ma=a.activeDropdownIndex>=0&&oa?`${ze}-option-${a.activeDropdownIndex}`:void 0,ra=a.editingParam,Fe=a.editingIdentified,da=ra?(0,ke.editingSuggestion)(ra):Fe?{parameter:Fe.parameter,text:(0,ke.identifiedParamLabel)(Fe.parameter),required:!0,options:[]}:null,ca=a.dropdownSuggestion??da??va,ga=(0,ke.dropdownPillsFor)(a.dropdownSuggestion,da,we),Ve=(0,ke.dateSelectionFor)(a),pa=!oa||a.dropdownLoading;return{completedParams:na,multiSelectView:a.multiSelectView,toggleMultiSelectOption:w.toggleMultiSelectOption,commitMultiSelect:w.commitMultiSelect,skippedParams:a.skippedParams,identifiedParams:a.identifiedParams,suggestionPills:He,setActivePill:w.setActivePill,skipActivePill:w.skipActivePill,removeLastParam:w.removeLastParam,segments:a.segments,newParamId:a.newParamId,clearNewParamId:w.clearNewParamId,suggestions:a.suggestions,activeIndex:a.activeDropdownIndex,isReady:a.isReady,isLoading:pa,isFocused:a.isFocused,isDropdownOpen:a.isDropdownOpen,isActivePillSelected:a.isActivePillSelected,placeholderText:a.placeholderText,listboxId:ze,error:a.error,products:a.products,customFields:a.customFields,selectProduct:w.selectProduct,addProductToCart:w.addProductToCart,handleTextChange:w.handleTextChange,handleCompositionText:w.handleCompositionText,handleKeyDown:w.handleKeyDown,setFocused:w.setFocused,editingParam:ra,editingIdentified:Fe,editingAnchor:a.editingAnchor,caretOffset:a.caretOffset,startEditingParam:w.startEditingParam,removeParam:w.removeParam,exitEditMode:w.exitEditMode,handleCaretAfterInput:w.handleCaretAfterInput,handleCaretMove:w.handleCaretMove,replaceEditingRange:w.replaceEditingRange,inputProps:{value:ne,placeholder:a.placeholderText||void 0,onChange:be,onKeyDown:ia,onFocus:w.handleFocus,onBlur:w.handleBlur,role:"combobox","aria-expanded":a.isDropdownOpen,"aria-activedescendant":ma,"aria-autocomplete":"list","aria-controls":ze},reset:w.reset,refreshProducts:w.refreshProducts,prepareSubmit:w.prepareSubmit,getState:w.getState,recordSubmit:w.recordSubmit,holdSubmit:w.holdSubmit,endSubmitProgress:w.endSubmitProgress,isSubmitting:a.isSubmitting,selectingProductId:a.selectingProductId,dropdownProps:{suggestions:ca?[{...ca,options:a.dropdownOptions}]:[],activeIndex:a.activeDropdownIndex,onSelect:w.selectOption,onHighlight:w.setActiveDropdownIndex,onUnhighlight:w.clearHighlight,isOpen:a.isDropdownOpen,id:ze,pills:ga,activeSelected:a.isActivePillSelected,onPillClick:w.setActivePill,onSkip:w.skipActivePill,showSkipButton:(W??!0)&&!ra&&!Fe,showOptionIcons:he??!0,showOptionImages:Q??!0,showOptionCounts:z??!0,skipDisabled:a.inSelectionAnimation,isLoading:pa,skeletonExiting:a.skeletonExiting,isInputEmpty:ne.trim().length===0,language:l,products:a.products,productImageFallback:ce,showProductVendor:A,onProductSelect:w.selectProduct,busyProductId:a.selectingProductId,seeAllBusy:a.isSubmitting,onProductAddToCart:Ke?w.addProductToCart:void 0,onProductFocusChange:w.setFocused,formatType:a.activeFormatType,dateView:a.dateView,selectedDateIso:Ve.selectedIso,selectedDateRange:Ve.selectedRange,dateRangeStart:Ve.rangeStart,dateReferences:Ve.references,onPreviousMonth:w.showPreviousMonth,onNextMonth:w.showNextMonth,timeView:a.timeView,multiSelectView:a.dropdownMultiSelect,onMultiSelectCommit:w.commitMultiSelect,onTimeChange:w.setTime,onTimeCommit:w.commitTime,locationView:a.locationView,isReediting:a.editingParam!=null,onLocationQuery:w.setLocationQuery,onLocationMove:w.moveLocationHighlight,onLocationCommit:w.commitLocation,onLocationFocusChange:w.setLocationFieldFocused,isFocused:a.isFocused||a.locationFieldFocused,optionsPosition:u??"below"}}}var j=require("@magicx-eng/ai-autocomplete-vanilla"),D=require("react"),Na;function gi(){if(Na!==void 0)return Na;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Na=e.contentEditable==="plaintext-only",Na}function It(e){let{segments:i,showChipIcons:t=!0,showChipImages:n=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:b,editingAnchor:v,caretOffset:y,placeholderText:f,hintSuggestions:h,isFocused:u,isDropdownOpen:x,listboxId:k,activeDescendantId:C,autoFocus:F,handleTextChange:M,handleCompositionText:he,handleKeyDown:Q,handleCaretAfterInput:z,handleCaretMove:W,startEditingParam:H,replaceEditingRange:X,setFocused:ce}=e,A=(0,D.useRef)(null),re=(0,D.useRef)(!1),ue=(0,D.useRef)(""),V=(0,D.useRef)(""),pe=(0,D.useRef)(null),T=(0,D.useRef)(0);pe.current=y,(0,D.useEffect)(()=>{if(!F)return;let g=A.current;if(!g)return;document.activeElement===g?ce(!0):g.focus();let S=g.ownerDocument??document,I=S.getSelection(),R=I&&I.rangeCount>0&&g.contains(I.anchorNode);if(I&&!R){let N=S.createRange();N.selectNodeContents(g),N.collapse(!0),I.removeAllRanges(),I.addRange(N)}},[F,ce]),(0,D.useEffect)(()=>{let g=A.current;if(!g)return;let S=g.ownerDocument??document,I=()=>{let R=S.getSelection();if(!R||R.rangeCount===0||!R.anchorNode||!g.contains(R.anchorNode))return;let N=R.anchorNode,oe=N.nodeType===Node.ELEMENT_NODE?N:N.parentElement,Ee=(R.isCollapsed?oe?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,qe=l?.id??b?.id??null;if(Ee&&Ee!==qe){H(Ee);return}performance.now()-T.current<50||W((0,j.getCursorOffset)(g))};return S.addEventListener("selectionchange",I),()=>S.removeEventListener("selectionchange",I)},[l,b,H,W]),(0,D.useEffect)(()=>{let g=A.current;if(!g)return;let S=I=>{let R=(0,j.chipIdFromTap)(g,I.target);R&&(H(R),(0,j.keepCaretOnChip)(g,R))};return g.addEventListener("click",S),()=>g.removeEventListener("click",S)},[H]),(0,D.useEffect)(()=>{let g=A.current;if(!(!g||!s||!o))return(0,j.attachChipRemove)(g,s)},[s,o]),(0,D.useLayoutEffect)(()=>{let g=A.current;g&&(0,j.renderEditableContent)({input:g,segments:i,newParamId:r,editingParamId:l?.id??null,placeholderText:f??"",isFocused:u,showChipIcons:t,showChipImages:n,showChipRemove:o,hintOptions:(0,j.startingHintOptions)(h??[])})},[i,r,l,f,h,u,t,n,o]),(0,D.useEffect)(()=>{let g=A.current;return()=>{g&&(0,j.cancelStartingHint)(g)}},[]),(0,D.useLayoutEffect)(()=>{let g=ue.current,S=r??"";if(ue.current=S,!S||S===g)return;let I=A.current;if(!I)return;I.focus();let R=pe.current??(0,j.plainTextLength)(I);(0,j.setCursorOffset)(I,R)},[r]),(0,D.useLayoutEffect)(()=>{let g=V.current,S=l?.id??"";if(V.current=S,!S||S===g||v==null)return;let I=A.current;I&&(0,j.setCursorOffset)(I,v)},[l,v]);let G=(0,D.useCallback)(()=>{let g=A.current;if(!g)return;let S=(0,j.extractPlainText)(g),R=S.length>0&&S[0]!==S[0].toUpperCase()?S[0].toUpperCase()+S.slice(1):S;if(re.current){he(R);return}M(R)},[M,he]),p=(0,D.useCallback)(()=>{T.current=performance.now(),G();let g=A.current;g&&z((0,j.getCursorOffset)(g))},[G,z]);(0,D.useEffect)(()=>{let g=A.current;if(!g)return;let S=I=>{let R=I,N=R.inputType;if(N==="insertParagraph"||N==="insertLineBreak"||N==="insertFromDrop"){I.preventDefault();return}if(N.startsWith("insert")||N.startsWith("delete")){let oe=N.startsWith("delete")?"":R.data??"";X(oe)&&I.preventDefault()}};return g.addEventListener("beforeinput",S),()=>g.removeEventListener("beforeinput",S)},[X]);let P=(0,D.useCallback)(()=>{re.current=!0,A.current?.setAttribute("data-aia-composing","true")},[]),Qe=(0,D.useCallback)(()=>{re.current=!1,A.current?.removeAttribute("data-aia-composing"),G()},[G]),Ke=(0,D.useCallback)(g=>{g.preventDefault();let S=A.current;if(!S)return;let I=(g.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!I)return;let R=S.ownerDocument??document,N=R.getSelection();if(!N||N.rangeCount===0)return;let oe=N.getRangeAt(0);if(!S.contains(oe.startContainer))return;oe.deleteContents();let Se=R.createTextNode(I);oe.insertNode(Se),oe.setStartAfter(Se),oe.collapse(!0),N.removeAllRanges(),N.addRange(oe),G()},[G]),Ye=(0,D.useCallback)(g=>Q(g),[Q]),je=(0,D.useCallback)(()=>ce(!0),[ce]),m=(0,D.useCallback)(()=>ce(!1),[ce]),$e=(0,D.useCallback)(()=>A.current?.focus(),[]),De=(0,D.useCallback)(()=>A.current?.blur(),[]),Ze=(0,D.useCallback)(()=>{let g=A.current;return g?(0,j.extractPlainText)(g):""},[]),Xe=gi()?"plaintext-only":"true";return{inputRef:A,editorProps:{ref:A,contentEditable:Xe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":k,"aria-expanded":x,"aria-activedescendant":C,spellCheck:!0,enterKeyHint:"send",onInput:p,onKeyDown:Ye,onCompositionStart:P,onCompositionEnd:Qe,onPaste:Ke,onFocus:je,onBlur:m},getPlainText:Ze,focus:$e,blur:De}}var Le=require("react/jsx-runtime");function fi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var At=(0,Z.forwardRef)(function({onSubmit:i,onResult:t,onError:n,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:b,language:v,currency:y,productId:f,visitorId:h,columns:u,pillPlacement:x="dropdown",mode:k="auto",optionsPosition:C="below",animations:F=!0,optionsStyle:M="floating",dropdownTrigger:he,closeDropdownOnBlur:Q,prependPlaceholder:z,allOption:W,showNonTappableOptions:H,locationSearch:X,showOptionIcons:ce=!0,showChipIcons:A=!0,showChipImages:re=!0,showChipRemove:ue=!1,showOptionImages:V=!0,showOptionCounts:pe=!0,showSkipButton:T,showProducts:G,submitProgress:p,productsLayout:P,productImageFallback:Qe,showProductVendor:Ke,autoFocus:Ye=!0,onFocus:je,onBlur:m,value:$e,completedParams:De,onChange:Ze,onParamsChange:Xe,products:g,mapProducts:S,onProductSelect:I,onProductAddToCart:R,submitButton:N,resetOnSubmit:oe=!0,seeAllResults:Se=!1},Ee){let qe=(0,Z.useRef)(null),_e=(0,Z.useRef)(null),Je=(0,Z.useRef)(null),ea=(0,Z.useRef)(()=>{}),Me=(0,Z.useRef)(null),me=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let B=qe.current;if(B)return Me.current?Me.current.setMode(k):Me.current=new Ge.ModeController(B,k),()=>{Me.current?.destroy(),Me.current=null}},[k]);let aa=(0,Z.useCallback)(B=>{let ve=me.current?.current;ve&&(ve.focus(),(0,Ge.setCursorOffset)(ve,B))},[]),{completedParams:wa,suggestionPills:Ne,setActivePill:ua,skipActivePill:ta,segments:w,newParamId:be,clearNewParamId:ia,placeholderText:oa,isFocused:a,isDropdownOpen:ne,isActivePillSelected:na,isLoading:we,isReady:va,activeIndex:He,listboxId:ze,handleTextChange:ma,handleCompositionText:ra,handleKeyDown:Fe,setFocused:da,editingParam:ca,editingIdentified:ga,editingAnchor:Ve,caretOffset:pa,startEditingParam:d,removeParam:$,handleCaretAfterInput:q,handleCaretMove:fa,replaceEditingRange:Pa,dropdownProps:O,reset:Ia,refreshProducts:Qa,prepareSubmit:Ya,getState:Ha,recordSubmit:ja,holdSubmit:$a,endSubmitProgress:Za,isSubmitting:Fa}=Ma({onSubmit:B=>ea.current(B),onResult:t,onError:n,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:b,language:v,currency:y,productId:f,visitorId:h,columns:u,dropdownTrigger:he,optionsPosition:C,closeDropdownOnBlur:Q,prependPlaceholder:z,allOption:W,showNonTappableOptions:H,locationSearch:X,showOptionIcons:ce,showOptionImages:V,showOptionCounts:pe,showSkipButton:T,showProducts:G,submitProgress:p,onFocus:je,onBlur:m,value:$e,completedParams:De,onChange:Ze,onParamsChange:Xe,products:g,mapProducts:S,onProductSelect:I,onProductAddToCart:R,source:"full-sdk",setCursor:aa});(0,Z.useEffect)(()=>{if(!be)return;let B=window.setTimeout(()=>ia(),650);return()=>window.clearTimeout(B)},[be,ia]);let Et=He>=0?`${ze}-option-${He}`:void 0,{inputRef:Ba,editorProps:zt,focus:Aa,blur:Xa,getPlainText:Ja}=It({segments:w,newParamId:be,editingParam:ca,editingIdentified:ga,editingAnchor:Ve,caretOffset:pa,placeholderText:oa,hintSuggestions:x==="inline"?[]:Ne,isFocused:a,showChipIcons:A,showChipImages:re,showChipRemove:ue,removeParam:$,isDropdownOpen:ne,listboxId:ze,activeDescendantId:Et,autoFocus:Ye,handleTextChange:ma,handleCompositionText:ra,handleKeyDown:Fe,handleCaretAfterInput:q,handleCaretMove:fa,startEditingParam:d,replaceEditingRange:Pa,setFocused:da});me.current=Ba,(0,Z.useLayoutEffect)(()=>{let B=_e.current,ve=Ba.current;if(!B||!ve)return;let ya=()=>{let et=B.firstElementChild;if(!et)return;let Nt=et.getBoundingClientRect(),Ht=ve.getBoundingClientRect();Nt.top>=Ht.bottom-2?B.setAttribute("data-aia-pill-wrapped",""):B.removeAttribute("data-aia-pill-wrapped")};ya();let ka=new ResizeObserver(ya);return ka.observe(ve),()=>ka.disconnect()},[w,Ne.length,we,Ba]),(0,Z.useEffect)(()=>{let B=Je.current;if(B)return(0,Ge.watchEditorHeight)(B)},[]),(0,Z.useImperativeHandle)(Ee,()=>({focus:Aa,blur:Xa,reset:Ia,refreshProducts:Qa,setMode:B=>Me.current?.setMode(B),skipActivePill:ta,endSubmitProgress:Za}),[Aa,Xa,Ia,Qa,ta,Za]);let ba=!!w.length||wa.length>0,xa=(0,Z.useCallback)(B=>{if(!ba||B&&Ha().isSubmitting)return;B&&Ya();let ve=Ha(),ya=(0,Ge.buildSubmitResult)(Ja(),ve.completedParams,ve.skippedParams,{identifiedParams:ve.identifiedParams,isReady:ve.isReady,customFields:ve.customFields});B&&ja(ya);let ka=i(ya);return B&&!oe&&$a(ka),oe&&Ia(),ka},[ja,$a,oe,ba,Ya,Ha,i,Ia,Ja]);ea.current=()=>xa(!1);let Rt=Se&&!O.isInputEmpty&&ba,Ot=(0,Z.useCallback)(()=>xa(!0),[xa]),Lt=(0,Z.useCallback)(B=>{B.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||Aa()},[Aa]),Dt=x==="inline",Mt=x==="dropdown";return(0,Le.jsxs)("div",{ref:qe,className:`magicx-aia ${ha.container} ${r??""}`,"data-pill-placement":x,"data-options-position":C,"data-animations":F?"on":"off","data-aia-options-style":M,"data-mode":fi(k),children:[(0,Le.jsx)(La,{...O,showPills:Mt,productsLayout:P,productImageFallback:Qe,showProductVendor:Ke,onSeeAllResults:Rt?Ot:void 0,fullWidth:Se}),(0,Le.jsxs)("div",{className:ha.inputWrapper,"data-aia-input-wrapper":"",onClick:Lt,children:[(0,Le.jsxs)("div",{ref:Je,className:ha.editorArea,"data-aia-editor":"",children:[(0,Le.jsx)("div",{...zt,className:ha.input,"data-aia-input":""}),Dt&&(we||Ne.length>0)&&(0,Le.jsx)("span",{ref:_e,className:ha.pillListContainer,"data-aia-pill-list-container":"",children:(0,Le.jsx)(Ra,{pills:Ne,activePillIndex:0,activeSelected:na,onSelectPill:ua,loading:we})})]}),N===null?null:N===void 0?(0,Le.jsx)(St,{disabled:!ba,ready:ba&&va,busy:Fa,onClick:()=>xa(!0),label:(0,Ge.uiStringsFor)(v).submit}):(0,Le.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Fa?"busy":void 0,"aria-busy":Fa?!0:void 0,className:ha.submitSlot,onClick:B=>{ba&&(B.stopPropagation(),xa(!0))},children:N})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
3938
|
+
`,document.head.appendChild(e)}var Ta={submitButton:"aia-submitButton-otz7H",submitSpin:"aia-submitSpin-0llcF"};var Ft=require("react/jsx-runtime");function Ia({disabled:e,ready:a,busy:t=!1,onClick:o,label:i=(0,Pa.uiStringsFor)().submit}){return(0,Ft.jsx)("button",{type:"button","data-aia-submit":"",className:Ta.submitButton,disabled:e,"data-aia-ready":a?"":void 0,"data-aia-submit-state":t?"busy":void 0,"aria-busy":t?!0:void 0,onClick:s=>{s.stopPropagation(),o()},"aria-label":i,children:(0,Ft.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Ft.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var ke=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react");var Yt=require("react");function Aa(e){let a=(0,Yt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),o=(0,Yt.useRef)({key:"",overrides:void 0});if(o.current.key!==t){let i={};for(let s of Object.keys(e??{})){let r=(d,v,x)=>{let y=a.current?.[s];return y?y(d,v,x):[]};i[s]=r}o.current={key:t,overrides:e?i:void 0}}return{overrides:o.current.overrides,key:t}}var jt=require("react");function Ea(e){let a=(0,jt.useRef)(e);a.current=e;let t=(0,jt.useRef)(null);t.current===null&&(t.current={fetch:(i,s)=>{let r=a.current;return r?r.fetch(i,s):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 za={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,isSubmitting:!1,selectingProductId:null,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Bt({onSubmit:e,onResult:a,onError:t,optionOverrides:o,maskCompletedText:i,apiConfig:s,additionalContext:r,language:d,currency:v,productId:x,visitorId:y,analyticsConsent:g,columns:h=2,dropdownTrigger:u,optionsPosition:k,closeDropdownOnBlur:S,prependPlaceholder:I,allOption:H,showNonTappableOptions:N,locationSearch:de,showOptionIcons:Q,showOptionImages:O,showOptionCounts:W,showSkipButton:G,showProducts:Z,submitProgress:re,productImageFallback:R="image",showProductVendor:me=!0,onFocus:fe,onBlur:ee,value:ge,completedParams:C,onChange:K,onParamsChange:p,products:z,mapProducts:Ve,onProductSelect:Je,onProductAddToCart:De,source:rt,setCursor:et}){let m=(0,P.useRef)(null),[_e,tt]=(0,P.useState)(null),at=(0,P.useRef)(e);at.current=e;let f=(0,P.useRef)(a);f.current=a;let T=(0,P.useRef)(t);T.current=t;let A=(0,P.useRef)(K);A.current=K;let L=(0,P.useRef)(p);L.current=p;let F=(0,P.useRef)(fe);F.current=fe;let se=(0,P.useRef)(ee);se.current=ee;let Se=(0,P.useRef)(et);Se.current=et;let Ce=(0,P.useRef)(Je);Ce.current=Je;let Ue=(0,P.useRef)(De);Ue.current=De;let Me=(0,P.useRef)(y);Me.current=y;let it=(0,P.useRef)(()=>{let l=Me.current;return typeof l=="function"?l():l}).current,Te=y!==void 0,st=(0,P.useRef)(g);st.current=g;let te=(0,P.useRef)(()=>{let l=st.current;return typeof l=="function"?l():l}).current,Qe=Ea(z),mt=(0,P.useRef)(Ve);mt.current=Ve;let St=(0,P.useRef)((l,ae)=>{let _=mt.current;return _?_(l,ae):l}).current,Ne=Ve?St:void 0,lt=Aa(o);(0,P.useEffect)(()=>{if(typeof document>"u")return;let l=new ke.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:d,currency:v,productId:x,visitorId:Te?it:void 0,analyticsConsent:te,optionOverrides:lt.overrides,maskCompletedText:i,columns:h,dropdownTrigger:u,optionsPosition:k,closeDropdownOnBlur:S,prependPlaceholder:I,allOption:H,showNonTappableOptions:N,locationSearch:de,showProducts:Z,submitProgress:re,source:rt,value:ge,completedParams:C,onSubmit:(..._)=>at.current?.(..._),onResult:(..._)=>f.current?.(..._),onError:(..._)=>T.current?.(..._),onChange:(..._)=>A.current?.(..._),onParamsChange:(..._)=>L.current?.(..._),onFocus:()=>F.current?.(),onBlur:()=>se.current?.(),onProductSelect:_=>Ce.current?Ce.current(_):ke.HANDOFF_NOT_HANDLED,onProductAddToCart:_=>Ue.current?.(_),setCursor:_=>Se.current?.(_),products:Qe.config,mapProducts:Ne});m.current=l,tt(l.getState());let ae=l.subscribe(_=>tt(_));return()=>{ae(),l.destroy(),m.current===l&&(m.current=null)}},[]);let dt=(0,P.useRef)(Te);(0,P.useEffect)(()=>{dt.current!==Te&&(dt.current=Te,m.current?.update({visitorId:Te?it:void 0,analyticsConsent:te}))},[Te,it,te]);let ce=typeof g=="function"?"function":g,He=(0,P.useRef)(ce);(0,P.useEffect)(()=>{He.current!==ce&&(He.current=ce,m.current?.refreshAnalyticsConsent())},[ce]),(0,P.useEffect)(()=>{ge!==void 0&&m.current?.setValue(ge)},[ge]),(0,P.useEffect)(()=>{C!==void 0&&m.current?.setCompletedParams(C)},[C]);let ct=JSON.stringify(s??null),n;try{n=JSON.stringify(r??null)}catch{n="[unstringifiable]"}(0,P.useEffect)(()=>{m.current?.update({apiConfig:s,additionalContext:r,language:d,currency:v,productId:x,optionOverrides:lt.overrides,dropdownTrigger:u,optionsPosition:k,closeDropdownOnBlur:S,prependPlaceholder:I,allOption:H,showNonTappableOptions:N,locationSearch:de,showProducts:Z,submitProgress:re})},[ct,n,d,v?.code,v?.rate,v?.country,x,lt.key,u,k,S,I,H,N,de,Z,re]);let le=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!le.current){le.current=!0;return}m.current?.update({products:Qe.config})},[Qe.enabled]),(0,P.useEffect)(()=>{m.current?.update({mapProducts:Ne})},[Ne]);let Fe=(0,P.useRef)(null);Fe.current===null&&(Fe.current={handleTextChange:l=>m.current?.handleTextChange(l),handleCompositionText:l=>m.current?.handleCompositionText(l),handleKeyDown:l=>{let ae="nativeEvent"in l?l.nativeEvent:l;m.current?.handleKeyDown(ae)},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()??za,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,ae)=>m.current?.selectOption(l,ae),selectProduct:l=>m.current?.selectProduct(l),addProductToCart:l=>{let ae=m.current;return!ae||!Ue.current?Promise.resolve():ae.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 b=Fe.current,pt=(0,P.useCallback)(l=>{let ae=l.target.value,Tt=ae.length>0&&!l.nativeEvent?.isComposing&&ae[0]!==ae[0].toUpperCase()?ae[0].toUpperCase()+ae.slice(1):ae;m.current?.handleTextChange(Tt)},[]),Ye=(0,P.useCallback)(l=>{m.current?.handleKeyDown(l.nativeEvent)},[]),Be=m.current,w=_e??za,gt=ge!==void 0?ge:w.text,ft=C!==void 0?C:w.completedParams,je=w.actionableSuggestions,bt=je[0],wt=(0,P.useMemo)(()=>(0,ke.withoutTraditionalAutocomplete)(je),[je]),$e=Be?.listboxId??"",vt=w.activeDropdownIndex>=0&&Be?`${$e}-option-${w.activeDropdownIndex}`:void 0,Ze=w.editingParam,We=w.editingIdentified,xt=Ze?(0,ke.editingSuggestion)(Ze):We?{parameter:We.parameter,text:(0,ke.identifiedParamLabel)(We.parameter),required:!0,options:[]}:null,ht=w.dropdownSuggestion??xt??bt,yt=(0,ke.dropdownPillsFor)(w.dropdownSuggestion,xt,je),E=(0,ke.dateSelectionFor)(w),Ct=!Be||w.dropdownLoading;return{completedParams:ft,multiSelectView:w.multiSelectView,toggleMultiSelectOption:b.toggleMultiSelectOption,commitMultiSelect:b.commitMultiSelect,skippedParams:w.skippedParams,identifiedParams:w.identifiedParams,suggestionPills:wt,setActivePill:b.setActivePill,skipActivePill:b.skipActivePill,removeLastParam:b.removeLastParam,segments:w.segments,newParamId:w.newParamId,clearNewParamId:b.clearNewParamId,suggestions:w.suggestions,activeIndex:w.activeDropdownIndex,isReady:w.isReady,isLoading:Ct,isFocused:w.isFocused,isDropdownOpen:w.isDropdownOpen,isActivePillSelected:w.isActivePillSelected,placeholderText:w.placeholderText,listboxId:$e,error:w.error,products:w.products,customFields:w.customFields,selectProduct:b.selectProduct,addProductToCart:b.addProductToCart,handleTextChange:b.handleTextChange,handleCompositionText:b.handleCompositionText,handleKeyDown:b.handleKeyDown,setFocused:b.setFocused,editingParam:Ze,editingIdentified:We,editingAnchor:w.editingAnchor,caretOffset:w.caretOffset,startEditingParam:b.startEditingParam,removeParam:b.removeParam,exitEditMode:b.exitEditMode,handleCaretAfterInput:b.handleCaretAfterInput,handleCaretMove:b.handleCaretMove,replaceEditingRange:b.replaceEditingRange,inputProps:{value:gt,placeholder:w.placeholderText||void 0,onChange:pt,onKeyDown:Ye,onFocus:b.handleFocus,onBlur:b.handleBlur,role:"combobox","aria-expanded":w.isDropdownOpen,"aria-activedescendant":vt,"aria-autocomplete":"list","aria-controls":$e},reset:b.reset,refreshProducts:b.refreshProducts,prepareSubmit:b.prepareSubmit,getState:b.getState,recordSubmit:b.recordSubmit,holdSubmit:b.holdSubmit,endSubmitProgress:b.endSubmitProgress,getSearchId:b.getSearchId,getVisitorId:b.getVisitorId,refreshAnalyticsConsent:b.refreshAnalyticsConsent,isSubmitting:w.isSubmitting,selectingProductId:w.selectingProductId,dropdownProps:{suggestions:ht?[{...ht,options:w.dropdownOptions}]:[],activeIndex:w.activeDropdownIndex,onSelect:b.selectOption,onHighlight:b.setActiveDropdownIndex,onUnhighlight:b.clearHighlight,isOpen:w.isDropdownOpen,id:$e,pills:yt,activeSelected:w.isActivePillSelected,onPillClick:b.setActivePill,onSkip:b.skipActivePill,showSkipButton:(G??!0)&&!Ze&&!We,showOptionIcons:Q??!0,showOptionImages:O??!0,showOptionCounts:W??!0,skipDisabled:w.inSelectionAnimation,isLoading:Ct,skeletonExiting:w.skeletonExiting,isInputEmpty:gt.trim().length===0,language:d,products:w.products,productImageFallback:R,showProductVendor:me,onProductSelect:b.selectProduct,busyProductId:w.selectingProductId,seeAllBusy:w.isSubmitting,onProductAddToCart:De?b.addProductToCart:void 0,onProductFocusChange:b.setFocused,formatType:w.activeFormatType,dateView:w.dateView,selectedDateIso:E.selectedIso,selectedDateRange:E.selectedRange,dateRangeStart:E.rangeStart,dateReferences:E.references,onPreviousMonth:b.showPreviousMonth,onNextMonth:b.showNextMonth,timeView:w.timeView,multiSelectView:w.dropdownMultiSelect,onMultiSelectCommit:b.commitMultiSelect,onTimeChange:b.setTime,onTimeCommit:b.commitTime,locationView:w.locationView,isReediting:w.editingParam!=null,onLocationQuery:b.setLocationQuery,onLocationMove:b.moveLocationHighlight,onLocationCommit:b.commitLocation,onLocationFocusChange:b.setLocationFieldFocused,isFocused:w.isFocused||w.locationFieldFocused,optionsPosition:k??"below"}}}var j=require("@magicx-eng/ai-autocomplete-vanilla"),M=require("react"),Wt;function vi(){if(Wt!==void 0)return Wt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Wt=e.contentEditable==="plaintext-only",Wt}function Ra(e){let{segments:a,showChipIcons:t=!0,showChipImages:o=!0,showChipRemove:i=!1,removeParam:s,newParamId:r,editingParam:d,editingIdentified:v,editingAnchor:x,caretOffset:y,placeholderText:g,hintSuggestions:h,isFocused:u,isDropdownOpen:k,listboxId:S,activeDescendantId:I,autoFocus:H,handleTextChange:N,handleCompositionText:de,handleKeyDown:Q,handleCaretAfterInput:O,handleCaretMove:W,startEditingParam:G,replaceEditingRange:Z,setFocused:re}=e,R=(0,M.useRef)(null),me=(0,M.useRef)(!1),fe=(0,M.useRef)(""),ee=(0,M.useRef)(""),ge=(0,M.useRef)(null),C=(0,M.useRef)(0);ge.current=y,(0,M.useEffect)(()=>{if(!H)return;let f=R.current;if(!f)return;document.activeElement===f?re(!0):f.focus();let T=f.ownerDocument??document,A=T.getSelection(),L=A&&A.rangeCount>0&&f.contains(A.anchorNode);if(A&&!L){let F=T.createRange();F.selectNodeContents(f),F.collapse(!0),A.removeAllRanges(),A.addRange(F)}},[H,re]),(0,M.useEffect)(()=>{let f=R.current;if(!f)return;let T=f.ownerDocument??document,A=()=>{let L=T.getSelection();if(!L||L.rangeCount===0||!L.anchorNode||!f.contains(L.anchorNode))return;let F=L.anchorNode,se=F.nodeType===Node.ELEMENT_NODE?F:F.parentElement,Ce=(L.isCollapsed?se?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Ue=d?.id??v?.id??null;if(Ce&&Ce!==Ue){G(Ce);return}performance.now()-C.current<50||W((0,j.getCursorOffset)(f))};return T.addEventListener("selectionchange",A),()=>T.removeEventListener("selectionchange",A)},[d,v,G,W]),(0,M.useEffect)(()=>{let f=R.current;if(!f)return;let T=A=>{let L=(0,j.chipIdFromTap)(f,A.target);L&&(G(L),(0,j.keepCaretOnChip)(f,L))};return f.addEventListener("click",T),()=>f.removeEventListener("click",T)},[G]),(0,M.useEffect)(()=>{let f=R.current;if(!(!f||!s||!i))return(0,j.attachChipRemove)(f,s)},[s,i]),(0,M.useLayoutEffect)(()=>{let f=R.current;f&&(0,j.renderEditableContent)({input:f,segments:a,newParamId:r,editingParamId:d?.id??null,placeholderText:g??"",isFocused:u,showChipIcons:t,showChipImages:o,showChipRemove:i,hintOptions:(0,j.startingHintOptions)(h??[])})},[a,r,d,g,h,u,t,o,i]),(0,M.useEffect)(()=>{let f=R.current;return()=>{f&&(0,j.cancelStartingHint)(f)}},[]),(0,M.useLayoutEffect)(()=>{let f=fe.current,T=r??"";if(fe.current=T,!T||T===f)return;let A=R.current;if(!A)return;A.focus();let L=ge.current??(0,j.plainTextLength)(A);(0,j.setCursorOffset)(A,L)},[r]),(0,M.useLayoutEffect)(()=>{let f=ee.current,T=d?.id??"";if(ee.current=T,!T||T===f||x==null)return;let A=R.current;A&&(0,j.setCursorOffset)(A,x)},[d,x]);let K=(0,M.useCallback)(()=>{let f=R.current;if(!f)return;let T=(0,j.extractPlainText)(f),L=T.length>0&&T[0]!==T[0].toUpperCase()?T[0].toUpperCase()+T.slice(1):T;if(me.current){de(L);return}N(L)},[N,de]),p=(0,M.useCallback)(()=>{C.current=performance.now(),K();let f=R.current;f&&O((0,j.getCursorOffset)(f))},[K,O]);(0,M.useEffect)(()=>{let f=R.current;if(!f)return;let T=A=>{let L=A,F=L.inputType;if(F==="insertParagraph"||F==="insertLineBreak"||F==="insertFromDrop"){A.preventDefault();return}if(F.startsWith("insert")||F.startsWith("delete")){let se=F.startsWith("delete")?"":L.data??"";Z(se)&&A.preventDefault()}};return f.addEventListener("beforeinput",T),()=>f.removeEventListener("beforeinput",T)},[Z]);let z=(0,M.useCallback)(()=>{me.current=!0,R.current?.setAttribute("data-aia-composing","true")},[]),Ve=(0,M.useCallback)(()=>{me.current=!1,R.current?.removeAttribute("data-aia-composing"),K()},[K]),Je=(0,M.useCallback)(f=>{f.preventDefault();let T=R.current;if(!T)return;let A=(f.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!A)return;let L=T.ownerDocument??document,F=L.getSelection();if(!F||F.rangeCount===0)return;let se=F.getRangeAt(0);if(!T.contains(se.startContainer))return;se.deleteContents();let Se=L.createTextNode(A);se.insertNode(Se),se.setStartAfter(Se),se.collapse(!0),F.removeAllRanges(),F.addRange(se),K()},[K]),De=(0,M.useCallback)(f=>Q(f),[Q]),rt=(0,M.useCallback)(()=>re(!0),[re]),et=(0,M.useCallback)(()=>re(!1),[re]),m=(0,M.useCallback)(()=>R.current?.focus(),[]),_e=(0,M.useCallback)(()=>R.current?.blur(),[]),tt=(0,M.useCallback)(()=>{let f=R.current;return f?(0,j.extractPlainText)(f):""},[]),at=vi()?"plaintext-only":"true";return{inputRef:R,editorProps:{ref:R,contentEditable:at,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":S,"aria-expanded":k,"aria-activedescendant":I,spellCheck:!0,enterKeyHint:"send",onInput:p,onKeyDown:De,onCompositionStart:z,onCompositionEnd:Ve,onPaste:Je,onFocus:rt,onBlur:et},getPlainText:tt,focus:m,blur:_e}}var Le=require("react/jsx-runtime");function xi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Oa=(0,$.forwardRef)(function({onSubmit:a,onResult:t,onError:o,optionOverrides:i,maskCompletedText:s,className:r,apiConfig:d,additionalContext:v,language:x,currency:y,productId:g,visitorId:h,analyticsConsent:u,columns:k,pillPlacement:S="dropdown",mode:I="auto",optionsPosition:H="below",animations:N=!0,optionsStyle:de="floating",dropdownTrigger:Q,closeDropdownOnBlur:O,prependPlaceholder:W,allOption:G,showNonTappableOptions:Z,locationSearch:re,showOptionIcons:R=!0,showChipIcons:me=!0,showChipImages:fe=!0,showChipRemove:ee=!1,showOptionImages:ge=!0,showOptionCounts:C=!0,showSkipButton:K,showProducts:p,submitProgress:z,productsLayout:Ve,productImageFallback:Je,showProductVendor:De,autoFocus:rt=!0,onFocus:et,onBlur:m,value:_e,completedParams:tt,onChange:at,onParamsChange:f,products:T,mapProducts:A,onProductSelect:L,onProductAddToCart:F,submitButton:se,resetOnSubmit:Se=!0,seeAllResults:Ce=!1},Ue){let Me=(0,$.useRef)(null),it=(0,$.useRef)(null),Te=(0,$.useRef)(null),st=(0,$.useRef)(()=>{}),te=(0,$.useRef)(null),Qe=(0,$.useRef)(null);(0,$.useEffect)(()=>{let B=Me.current;if(B)return te.current?te.current.setMode(I):te.current=new qe.ModeController(B,I),()=>{te.current?.destroy(),te.current=null}},[I]);let mt=(0,$.useCallback)(B=>{let ve=Qe.current?.current;ve&&(ve.focus(),(0,qe.setCursorOffset)(ve,B))},[]),{completedParams:St,suggestionPills:Ne,setActivePill:lt,skipActivePill:dt,segments:ce,newParamId:He,clearNewParamId:ct,placeholderText:n,isFocused:le,isDropdownOpen:Fe,isActivePillSelected:b,isLoading:pt,isReady:Ye,activeIndex:Be,listboxId:w,handleTextChange:gt,handleCompositionText:ft,handleKeyDown:je,setFocused:bt,editingParam:wt,editingIdentified:$e,editingAnchor:vt,caretOffset:Ze,startEditingParam:We,removeParam:xt,handleCaretAfterInput:ht,handleCaretMove:yt,replaceEditingRange:E,dropdownProps:Ct,reset:l,refreshProducts:ae,prepareSubmit:_,getState:Tt,recordSubmit:$t,holdSubmit:Zt,endSubmitProgress:Xt,getSearchId:Jt,getVisitorId:ea,refreshAnalyticsConsent:ta,isSubmitting:Gt}=Bt({onSubmit:B=>st.current(B),onResult:t,onError:o,optionOverrides:i,maskCompletedText:s,apiConfig:d,additionalContext:v,language:x,currency:y,productId:g,visitorId:h,analyticsConsent:u,columns:k,dropdownTrigger:Q,optionsPosition:H,closeDropdownOnBlur:O,prependPlaceholder:W,allOption:G,showNonTappableOptions:Z,locationSearch:re,showOptionIcons:R,showOptionImages:ge,showOptionCounts:C,showSkipButton:K,showProducts:p,submitProgress:z,onFocus:et,onBlur:m,value:_e,completedParams:tt,onChange:at,onParamsChange:f,products:T,mapProducts:A,onProductSelect:L,onProductAddToCart:F,source:"full-sdk",setCursor:mt});(0,$.useEffect)(()=>{if(!He)return;let B=window.setTimeout(()=>ct(),650);return()=>window.clearTimeout(B)},[He,ct]);let La=Be>=0?`${w}-option-${Be}`:void 0,{inputRef:Kt,editorProps:Da,focus:Ot,blur:aa,getPlainText:ia}=Ra({segments:ce,newParamId:He,editingParam:wt,editingIdentified:$e,editingAnchor:vt,caretOffset:Ze,placeholderText:n,hintSuggestions:S==="inline"?[]:Ne,isFocused:le,showChipIcons:me,showChipImages:fe,showChipRemove:ee,removeParam:xt,isDropdownOpen:Fe,listboxId:w,activeDescendantId:La,autoFocus:rt,handleTextChange:gt,handleCompositionText:ft,handleKeyDown:je,handleCaretAfterInput:ht,handleCaretMove:yt,startEditingParam:We,replaceEditingRange:E,setFocused:bt});Qe.current=Kt,(0,$.useLayoutEffect)(()=>{let B=it.current,ve=Kt.current;if(!B||!ve)return;let It=()=>{let oa=B.firstElementChild;if(!oa)return;let Wa=oa.getBoundingClientRect(),Ga=ve.getBoundingClientRect();Wa.top>=Ga.bottom-2?B.setAttribute("data-aia-pill-wrapped",""):B.removeAttribute("data-aia-pill-wrapped")};It();let At=new ResizeObserver(It);return At.observe(ve),()=>At.disconnect()},[ce,Ne.length,pt,Kt]),(0,$.useEffect)(()=>{let B=Te.current;if(B)return(0,qe.watchEditorHeight)(B)},[]),(0,$.useImperativeHandle)(Ue,()=>({focus:Ot,blur:aa,reset:l,refreshProducts:ae,setMode:B=>te.current?.setMode(B),skipActivePill:dt,endSubmitProgress:Xt,getSearchId:Jt,getVisitorId:ea,refreshAnalyticsConsent:ta}),[Ot,aa,l,ae,dt,Xt,Jt,ea,ta]);let kt=!!ce.length||St.length>0,Pt=(0,$.useCallback)(B=>{if(!kt||B&&Tt().isSubmitting)return;B&&_();let ve=Tt(),It=(0,qe.buildSubmitResult)(ia(),ve.completedParams,ve.skippedParams,{identifiedParams:ve.identifiedParams,isReady:ve.isReady,customFields:ve.customFields});B&&$t(It);let At=a(It);return B&&!Se&&Zt(At),Se&&l(),At},[$t,Zt,Se,kt,_,Tt,a,l,ia]);st.current=()=>Pt(!1);let Ma=Ce&&!Ct.isInputEmpty&&kt,Na=(0,$.useCallback)(()=>Pt(!0),[Pt]),Ha=(0,$.useCallback)(B=>{B.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||Ot()},[Ot]),Fa=S==="inline",Ba=S==="dropdown";return(0,Le.jsxs)("div",{ref:Me,className:`magicx-aia ${ut.container} ${r??""}`,"data-pill-placement":S,"data-options-position":H,"data-animations":N?"on":"off","data-aia-options-style":de,"data-mode":xi(I),children:[(0,Le.jsx)(Ht,{...Ct,showPills:Ba,productsLayout:Ve,productImageFallback:Je,showProductVendor:De,onSeeAllResults:Ma?Na:void 0,fullWidth:Ce}),(0,Le.jsxs)("div",{className:ut.inputWrapper,"data-aia-input-wrapper":"",onClick:Ha,children:[(0,Le.jsxs)("div",{ref:Te,className:ut.editorArea,"data-aia-editor":"",children:[(0,Le.jsx)("div",{...Da,className:ut.input,"data-aia-input":""}),Fa&&(pt||Ne.length>0)&&(0,Le.jsx)("span",{ref:it,className:ut.pillListContainer,"data-aia-pill-list-container":"",children:(0,Le.jsx)(Mt,{pills:Ne,activePillIndex:0,activeSelected:b,onSelectPill:lt,loading:pt})})]}),se===null?null:se===void 0?(0,Le.jsx)(Ia,{disabled:!kt,ready:kt&&Ye,busy:Gt,onClick:()=>Pt(!0),label:(0,qe.uiStringsFor)(x).submit}):(0,Le.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"","data-aia-submit-state":Gt?"busy":void 0,"aria-busy":Gt?!0:void 0,className:ut.submitSlot,onClick:B=>{kt&&(B.stopPropagation(),Pt(!0))},children:se})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
3939
3939
|
//# sourceMappingURL=index.js.map
|