@magicx-eng/ai-autocomplete-react 0.60.1 → 0.60.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -6
- 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 Da=Object.defineProperty;var zt=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var Mt=Object.prototype.hasOwnProperty;var Nt=(e,t)=>{for(var a in t)Da(e,a,{get:t[a],enumerable:!0})},
|
|
1
|
+
"use strict";var Da=Object.defineProperty;var zt=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var Mt=Object.prototype.hasOwnProperty;var Nt=(e,t)=>{for(var a in t)Da(e,a,{get:t[a],enumerable:!0})},Ht=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Dt(t))!Mt.call(e,o)&&o!==a&&Da(e,o,{get:()=>t[o],enumerable:!(i=zt(t,o))||i.enumerable});return e};var Ft=e=>Ht(Da({},"__esModule",{value:!0}),e);var hi={};Nt(hi,{AIAutocomplete:()=>Ct,AIAutocompleteDropdown:()=>Aa,DATE_RANGE_META_END:()=>d.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>d.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>d.DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY:()=>d.LOCATION_META_KEY,PRODUCT_PATH_PREFIX:()=>d.PRODUCT_PATH_PREFIX,TIME_META_KEY:()=>d.TIME_META_KEY,WEEKDAY_LABELS:()=>d.WEEKDAY_LABELS,buildSubmitResult:()=>d.buildSubmitResult,cellDay:()=>d.cellDay,cellIso:()=>d.cellIso,dateCellMarks:()=>d.dateCellMarks,formatDate:()=>d.formatDate,formatDateRange:()=>d.formatDateRange,formatOptionCount:()=>d.formatOptionCount,formatPlace:()=>d.formatPlace,formatTime:()=>d.formatTime,isoDate:()=>d.isoDate,monthLabel:()=>d.monthLabel,optionCountLabel:()=>d.optionCountLabel,optionHasImage:()=>d.optionHasImage,optionImageSources:()=>d.optionImageSources,optionImageSrc:()=>d.optionImageSrc,optionLabel:()=>d.optionLabel,optionsShowLeadingVisuals:()=>d.optionsShowLeadingVisuals,parseDate:()=>d.parseDate,parseLooseDate:()=>d.parseLooseDate,parseLooseDateRange:()=>d.parseLooseDateRange,parseTime:()=>d.parseTime,productFromMatchedItem:()=>d.productFromMatchedItem,productImageSources:()=>d.productImageSources,productsFromCustomFields:()=>d.productsFromCustomFields,sanitizeOptionIconSvg:()=>d.sanitizeOptionIconSvg,selectedRangeFor:()=>d.selectedRangeFor,useAIAutocomplete:()=>Oa,visibleDateRange:()=>d.visibleDateRange,withSkippedParams:()=>d.withSkippedParams});module.exports=Ft(hi);var d=require("@magicx-eng/ai-autocomplete-vanilla");var j=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
|
|
2
2
|
position: relative;
|
|
3
3
|
/* Inherits the host page's font by default. Consumers can pin a specific
|
|
4
4
|
font on the library via \`--aia-font-family: 'Custom Font'\` without
|
|
@@ -608,6 +608,8 @@
|
|
|
608
608
|
/* Smart Suggestion sparkle, matched text, and the shimmer's bright centre. */
|
|
609
609
|
--aia-smart-suggestion-accent: #b84549;
|
|
610
610
|
--aia-smart-suggestion-glint: #f3c4c5;
|
|
611
|
+
/* How strongly a half-built syllable at the end of a match shows the accent. */
|
|
612
|
+
--aia-option-match-partial-opacity: 0.45;
|
|
611
613
|
|
|
612
614
|
/* Completed params (Figma "RichTextPill"): compact faint-gray chip with
|
|
613
615
|
primary-color regular-weight text. -active is the hover / tapped (re-edit)
|
|
@@ -2242,7 +2244,7 @@
|
|
|
2242
2244
|
.aia-loadingBar-OLCr4:nth-child(3) {
|
|
2243
2245
|
width: 60%;
|
|
2244
2246
|
}
|
|
2245
|
-
`,document.head.appendChild(e)}var te={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 _=require("react/jsx-runtime"),Gt=0;function ya(e){return e.getRootNode().activeElement??null}function at(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Ja(e){if(!e.isContentEditable)return null;let t=at(e);if(!t||t.rangeCount===0)return null;let a=t.getRangeAt(0);return e.contains(a.startContainer)?a.cloneRange():null}function et(e,t){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let a=at(e);if(!a)return;let i=t;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),a.removeAllRanges(),a.addRange(i)}var Kt=(0,_.jsxs)("svg",{className:te.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,_.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,_.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),qt=(0,_.jsxs)("svg",{className:te.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,_.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,_.jsx)("path",{d:"m20 20-3.5-3.5"})]});function tt({view:e,searchLabel:t,noResultsLabel:a,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:v,onMove:x,onCommit:k,onFocusChange:w}){let u=(0,de.useRef)(null),h=(0,de.useRef)(null),y=(0,de.useRef)(null),R=(0,de.useRef)(null),ee=(0,de.useRef)(null),B=(0,de.useRef)(!1),D=(0,de.useRef)(!1),he=(0,de.useRef)(!1),P=(0,de.useRef)(!1),
|
|
2247
|
+
`,document.head.appendChild(e)}var te={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 _=require("react/jsx-runtime"),Gt=0;function ya(e){return e.getRootNode().activeElement??null}function at(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Ja(e){if(!e.isContentEditable)return null;let t=at(e);if(!t||t.rangeCount===0)return null;let a=t.getRangeAt(0);return e.contains(a.startContainer)?a.cloneRange():null}function et(e,t){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let a=at(e);if(!a)return;let i=t;(!i||!i.startContainer.isConnected||!e.contains(i.startContainer))&&(i=document.createRange(),i.selectNodeContents(e),i.collapse(!1)),a.removeAllRanges(),a.addRange(i)}var Kt=(0,_.jsxs)("svg",{className:te.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,_.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,_.jsx)("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),qt=(0,_.jsxs)("svg",{className:te.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[(0,_.jsx)("circle",{cx:"11",cy:"11",r:"7"}),(0,_.jsx)("path",{d:"m20 20-3.5-3.5"})]});function tt({view:e,searchLabel:t,noResultsLabel:a,useTypedLabel:i,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:v,onMove:x,onCommit:k,onFocusChange:w}){let u=(0,de.useRef)(null),h=(0,de.useRef)(null),y=(0,de.useRef)(null),R=(0,de.useRef)(null),ee=(0,de.useRef)(null),B=(0,de.useRef)(!1),D=(0,de.useRef)(!1),he=(0,de.useRef)(!1),P=(0,de.useRef)(!1),H=(0,de.useRef)(o);H.current=o;let oe=(0,de.useRef)(w);oe.current=w;let G=p=>{P.current=p,w(p)},ge=()=>{let p=u.current;return p!=null&&ya(p)===p},ne=()=>{let p=h.current;if(!p)return;let T=ya(p);T instanceof HTMLElement&&T!==u.current&&T!==document.body&&!p.contains(T)&&(R.current=T,ee.current=Ja(T))},E=p=>{let T=h.current;!T||!(p instanceof HTMLElement)||p===R.current||p===document.body||T.contains(p)||(R.current=p,ee.current=Ja(p))},Q=(0,de.useRef)(null);Q.current===null&&(Q.current=`aia-location-${++Gt}`);let Y=`${Q.current}-row-`;(0,de.useEffect)(()=>{let p=u.current;p&&p.value!==e.query&&ya(p)!==p&&(p.value=e.query)},[e.query]),(0,de.useEffect)(()=>{o&&(s&&!he.current&&(D.current=!1),he.current=s);let p=u.current;if(p){if(!r&&ge()){D.current=!0,re();return}if(!o){setTimeout(()=>{if(H.current)return;let T=R.current;T&&ya(T)===T||(D.current=!1)},0);return}if(!(!s||D.current||!l||ge())){if(ne(),G(!0),p.focus({preventScroll:!0}),!ge()){D.current=!0,G(!1);return}p.value&&p.select()}}}),(0,de.useLayoutEffect)(()=>()=>{if(!P.current)return;let p=u.current,T=R.current;T?.isConnected&&p&&ya(p)===p&&(B.current=!0,et(T,ee.current),B.current=!1),P.current=!1,oe.current(!1)},[]);let re=(p=!1)=>{p&&(D.current=!0);let T=R.current;T?.isConnected&&ge()&&(B.current=!0,et(T,ee.current),B.current=!1),G(!1)},xe=e.query.trim(),I=e.highlighted>=0&&e.highlighted<e.places.length?`${Y}${e.highlighted}`:void 0,F=null;return e.places.length>0?F=e.places.map((p,T)=>(0,_.jsxs)("div",{id:`${Y}${T}`,role:"option","aria-selected":T===e.highlighted,className:T===e.highlighted?`${te.row} ${te.highlighted}`:te.row,"data-aia-location-row":"","data-aia-index":T,onClick:()=>{l&&(re(!0),k(T))},children:[(0,_.jsx)("span",{className:te.pin,children:Kt}),(0,_.jsxs)("span",{className:te.text,children:[(0,_.jsx)("span",{className:te.name,children:p.name}),p.secondary&&(0,_.jsx)("span",{className:te.secondary,children:p.secondary})]})]},p.id)):e.status==="loading"?F=(0,_.jsxs)("div",{className:te.loading,"data-aia-location-loading":"",children:[(0,_.jsx)("span",{className:te.loadingBar}),(0,_.jsx)("span",{className:te.loadingBar}),(0,_.jsx)("span",{className:te.loadingBar})]}):xe&&(F=(0,_.jsxs)("div",{className:te.note,"data-aia-location-note":"",children:[e.status==="done"&&(0,_.jsx)("span",{className:te.empty,children:a}),(0,_.jsx)("span",{children:i})]})),(0,_.jsxs)("div",{ref:h,className:te.location,"data-aia-location":"",onMouseDown:p=>{!(p.target instanceof Node)||!y.current?.contains(p.target)||(p.stopPropagation(),ne(),G(!0))},children:[(0,_.jsxs)("label",{ref:y,className:te.field,children:[qt,(0,_.jsx)("input",{ref:u,type:"text",className:te.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:t,"aria-label":t,"aria-activedescendant":I,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:p=>v(p.target.value),onFocus:p=>{E(p.relatedTarget),G(!0)},onBlur:()=>{B.current||(D.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(),!l)return;re(!0),k();return;case"Escape":p.preventDefault(),p.stopPropagation(),D.current=!0,re();return;case"Backspace":if(p.currentTarget.value!=="")return;p.preventDefault(),D.current=!0,re();return}}})]}),(0,_.jsx)("div",{className:te.results,"data-aia-location-results":"","aria-live":"polite",children:F})]})}var Pa=require("@magicx-eng/ai-autocomplete-vanilla");var it=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,
|
|
2246
2248
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
2247
2249
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
2248
2250
|
as it was when the outline was dashed. */
|
|
@@ -2410,7 +2412,7 @@
|
|
|
2410
2412
|
align-items: center;
|
|
2411
2413
|
vertical-align: middle;
|
|
2412
2414
|
}
|
|
2413
|
-
`,document.head.appendChild(e)}var
|
|
2415
|
+
`,document.head.appendChild(e)}var Ha={list:"aia-list-qvLqO"};var ka=require("react/jsx-runtime"),_t=[125,69];function nt(e){return e===0?"first":e===1?"next":"last"}function Ia({pills:e,activePillIndex:t,onSelectPill:a,activeSelected:i,rounded:o,loading:s}){return s&&e.length===0?(0,ka.jsx)("span",{className:Ha.list,"data-aia-pill-list-loading":"",children:_t.map((r,l)=>(0,ka.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Ne.pill} ${o?Ne.rounded:""} ${Ne.skeleton}`,style:{width:r,"--aia-pill-opacity":Na[nt(l)]}},`skel-${r}`))}):(0,ka.jsx)("span",{className:Ha.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,l)=>{let v=!!i&&l===t;return(0,ka.jsx)(ot,{label:r.text,state:v?"selected":nt(l),selected:v,active:l===t,rounded:o,loading:s,smartSuggestion:(0,Pa.isSmartSuggestion)(r),completionHeader:(0,Pa.isTraditionalAutocompleteSuggestion)(r),onClick:()=>a(l)},`${r.parameter}-${r.text}`)})})}var ke=require("@magicx-eng/ai-autocomplete-vanilla"),ve=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
|
|
2414
2416
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
2415
2417
|
theming one package sees the same result in the other.
|
|
2416
2418
|
|
|
@@ -3247,6 +3249,12 @@
|
|
|
3247
3249
|
font-weight: 600;
|
|
3248
3250
|
}
|
|
3249
3251
|
|
|
3252
|
+
/* A half-built syllable at the end of the match (an IME has typed \uB140 of \uB144):
|
|
3253
|
+
the same accent, drawn fainter, since part of one glyph can not be colored. */
|
|
3254
|
+
.aia-match-pp-9v:where([data-aia-match-partial]) {
|
|
3255
|
+
opacity: var(--aia-option-match-partial-opacity, 0.45);
|
|
3256
|
+
}
|
|
3257
|
+
|
|
3250
3258
|
/* Server-provided option icon (\`icon_svg\` on the option): a box exactly one
|
|
3251
3259
|
text line tall, top-aligned, so it sits centred on the first line of a
|
|
3252
3260
|
wrapped option and never grows the line box. The glyph draws in
|
|
@@ -3567,7 +3575,7 @@
|
|
|
3567
3575
|
border-radius: 6px;
|
|
3568
3576
|
font-size: 11px;
|
|
3569
3577
|
}
|
|
3570
|
-
`,document.head.appendChild(e)}var ce={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 pe=require("react/jsx-runtime");function ct({option:e,isHighlighted:t,checked:a,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:l,showIcon:v=!0,showImage:x=!0,showCount:k=!0,scrollHint:w,enterDelayMs:u=0}){let[h]=(0,Ce.useState)(u),[y,R]=(0,Ce.useState)(!1),ee=x?(0,ue.optionImageSources)(e.image_url):[],B=ee[0]??null,[D,he]=(0,Ce.useState)([]),P=ee.find(
|
|
3578
|
+
`,document.head.appendChild(e)}var ce={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 pe=require("react/jsx-runtime");function ct({option:e,isHighlighted:t,checked:a,onSelect:i,onHighlight:o,onUnhighlight:s,id:r,loading:l,showIcon:v=!0,showImage:x=!0,showCount:k=!0,scrollHint:w,enterDelayMs:u=0}){let[h]=(0,Ce.useState)(u),[y,R]=(0,Ce.useState)(!1),ee=x?(0,ue.optionImageSources)(e.image_url):[],B=ee[0]??null,[D,he]=(0,Ce.useState)([]),P=ee.find(I=>!D.includes(I))??null,H=x?(e.imageCollage??[]).map(I=>(0,ue.optionImageSources)(I)[0]).filter(I=>I!==void 0):[],[oe,G]=(0,Ce.useState)(!1),[ge,ne]=(0,Ce.useState)(null),E=(0,Ce.useMemo)(()=>!B&&v&&e.icon_svg?(0,ue.sanitizeOptionIconSvg)(e.icon_svg):null,[B,v,e.icon_svg]),Q=k?(0,ue.formatOptionCount)(e.item_count):null,Y=(0,Ce.useRef)(void 0);(0,Ce.useEffect)(()=>()=>clearTimeout(Y.current),[]);let re=I=>{if(l||!e.is_tappable||y&&a===void 0)return;R(!0);let F=I?.currentTarget;a!==void 0&&F!==void 0&&I!==void 0&&!(0,ue.isMultiSelectToggleTap)(F,F.querySelector("[data-aia-checkbox]"),I)?i(e,{commit:!0}):i(e),clearTimeout(Y.current),Y.current=setTimeout(()=>R(!1),170)},xe=[ce.item,t&&!l?ce.highlighted:"",e.liveMatch&&!l?ce.liveMatch:"",e.is_tappable?ce.tappable:ce.nonTappable,y?ce.pressed:"",w?ce.scrollHint:""].filter(Boolean).join(" ");return(0,pe.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":E&&e.icon?e.icon:void 0,"data-aia-image":B?"":void 0,"data-aia-item-count":Q!==null?e.item_count:void 0,"aria-selected":a??t,className:xe,style:{[ue.OPTION_ENTER_DELAY_VAR]:`${h}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:re,onKeyDown:I=>{!l&&e.is_tappable&&(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),re())},onMouseEnter:!l&&e.is_tappable?o:void 0,onMouseLeave:s,children:(0,pe.jsxs)("span",{className:ce.content,children:[a!==void 0&&e.is_tappable&&(0,pe.jsx)("span",{className:ce.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":a,children:a?"\u2713":""}),B&&H.length>1&&(0,pe.jsx)("span",{className:`${ce.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":H.length,"data-aia-image-loaded":oe?"":void 0,children:H.map(I=>(0,pe.jsx)("img",{src:I,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>G(!0),onError:F=>{F.currentTarget.hidden=!0}},I))}),B&&H.length<=1&&(0,pe.jsx)("span",{className:`${ce.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":P!==null&&ge===P?"":void 0,children:(0,pe.jsx)("img",{src:P??B,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:P===null,onLoad:()=>ne(P),onError:()=>{P!==null&&he(I=>[...I,P])}})}),E&&(0,pe.jsx)("span",{className:`${ce.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:E}}),(0,pe.jsxs)("span",{className:ce.text,children:[e.matchedText?(0,ue.highlightParts)((0,ue.optionLabel)(e),e.matchedText).map((I,F)=>I.bold?(0,pe.jsx)("strong",{className:`${ce.match} magicx-aia-option-match`,"data-aia-match-partial":I.partial?"":void 0,children:I.text},F):I.text):(0,ue.optionLabel)(e),e.parameterLabel&&(0,pe.jsxs)(pe.Fragment,{children:[" ",(0,pe.jsx)("span",{className:`${ce.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&(0,pe.jsx)("span",{className:ce.tag,children:e.tag}),Q!==null&&(0,pe.jsx)("span",{className:`${ce.count} magicx-aia-option-count`,children:Q})]})})}var Fa=require("react/jsx-runtime");function jt(){let[e,t]=(0,Pe.useState)(X.isOptionsGridMobileViewport);return(0,Pe.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(X.OPTIONS_GRID_MOBILE_QUERY),i=()=>t(a.matches);return i(),a.addEventListener("change",i),()=>a.removeEventListener("change",i)},[]),e}function pt({options:e,activeIndex:t,picked:a,onSelect:i,onHighlight:o,onUnhighlight:s,listboxId:r,loading:l,groupKey:v="",optionsPosition:x="below",showIcons:k=!0,showImages:w=!0,showCounts:u=!0}){let h=jt(),y=(0,Pe.useRef)(null),[R,ee]=(0,Pe.useState)(null),B=(0,Pe.useRef)(null);(0,Pe.useLayoutEffect)(()=>{if(l&&(0,X.sameOptionRows)(B.current,e))return;B.current=l?null:e;let P=y.current,H=P&&!l&&(0,X.needsOptionsGridMeasurement)(e.length,h),oe=P?.closest("[data-aia-dropdown]");H&&oe&&(0,X.releasePanelHug)(oe);let G=H?(0,X.measureOptionsGrid)(P):null;ee(G?(0,X.planOptionsGrid)(e.length,h,G.rowWidths,G.gridWidth):null)},[e,h,l]);let D=R??(0,X.planOptionsGrid)(e.length,h,null,null);(0,Pe.useLayoutEffect)(()=>{let P=y.current?.closest("[data-aia-dropdown]");P&&(0,X.syncPanelHug)(P)},[D.template,h]);let he=(0,X.optionsShowLeadingVisuals)(e,k,w);return(0,Fa.jsx)(lt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:v,template:D.template,maxHeight:D.maxHeight,innerRef:P=>{y.current=P},"data-aia-group":v,children:e.map((P,H)=>(0,Fa.jsx)(ct,{option:P,isHighlighted:H===t,checked:a?a.includes(P.text):void 0,onSelect:i,onHighlight:()=>o(H),onUnhighlight:s?()=>s(H):void 0,id:`${r}-option-${H}`,loading:l,showIcon:k&&he,showImage:w&&he,showCount:u,scrollHint:!l&&D.scrollHintIndices.includes(H),enterDelayMs:l?0:(0,X.optionEnterDelayMs)(H,D.cols,e.length,x)},`${v}\0${P.parameter??""}\0${P.text}`))})}var me=require("@magicx-eng/ai-autocomplete-vanilla"),Ee=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) ---
|
|
3571
3579
|
|
|
3572
3580
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
3573
3581
|
time-wheel.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -3704,7 +3712,7 @@
|
|
|
3704
3712
|
align-items: end;
|
|
3705
3713
|
}
|
|
3706
3714
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
3707
|
-
`,document.head.appendChild(e)}var mt=require("react/jsx-runtime");function ut({space:e,align:t="stretch",className:a,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return(0,mt.jsx)("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":t,style:s,...o,children:i})}var V=require("react/jsx-runtime"),Xt=typeof window>"u"?J.useEffect:J.useLayoutEffect,Jt=[159,119,164],ei=()=>{},gt=()=>{},ai=e=>{},ti=()=>{},ii=e=>{},oi=e=>{},ni=e=>{},ri=e=>{};function si(e){let t=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,i]=(0,J.useState)(t);if((0,J.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>i(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function li(e,t){let a=(0,J.useRef)(null);(0,J.useEffect)(()=>{let i=e.current,o=t.current;if(!i||!o)return;let s=(0,L.queryLive)(i,".aia-grid[data-scroll]");if(a.current&&a.current.grid!==s&&(a.current.controller.destroy(),a.current=null),s&&!a.current){a.current={grid:s,controller:(0,L.attachScrollArrow)({dropdown:i,grid:s,button:o})};return}a.current?.controller.update()}),(0,J.useEffect)(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function di(e,t){let a=(0,J.useRef)(t);a.current=t;let i=(0,J.useRef)(null);(0,J.useLayoutEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,L.attachViewportFit)({dropdown:o,isOpen:()=>a.current});return}i.current.update()}}),(0,J.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function Aa({suggestions:e,activeIndex:t,onSelect:a,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:l,pills:v,onPillClick:x,showPills:k=!0,onSkip:w,showSkipButton:u=!0,showOptionIcons:h=!0,showOptionImages:y=!0,showOptionCounts:R=!0,skipDisabled:ee=!1,activeSelected:B=!1,isLoading:D=!1,skeletonExiting:he=!1,isInputEmpty:P=!1,language:
|
|
3715
|
+
`,document.head.appendChild(e)}var mt=require("react/jsx-runtime");function ut({space:e,align:t="stretch",className:a,children:i,...o}){let s=e?{"--aia-stack-space":e}:void 0;return(0,mt.jsx)("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":t,style:s,...o,children:i})}var V=require("react/jsx-runtime"),Xt=typeof window>"u"?J.useEffect:J.useLayoutEffect,Jt=[159,119,164],ei=()=>{},gt=()=>{},ai=e=>{},ti=()=>{},ii=e=>{},oi=e=>{},ni=e=>{},ri=e=>{};function si(e){let t=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,i]=(0,J.useState)(t);if((0,J.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>i(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function li(e,t){let a=(0,J.useRef)(null);(0,J.useEffect)(()=>{let i=e.current,o=t.current;if(!i||!o)return;let s=(0,L.queryLive)(i,".aia-grid[data-scroll]");if(a.current&&a.current.grid!==s&&(a.current.controller.destroy(),a.current=null),s&&!a.current){a.current={grid:s,controller:(0,L.attachScrollArrow)({dropdown:i,grid:s,button:o})};return}a.current?.controller.update()}),(0,J.useEffect)(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function di(e,t){let a=(0,J.useRef)(t);a.current=t;let i=(0,J.useRef)(null);(0,J.useLayoutEffect)(()=>{let o=e.current;if(o){if(!i.current){i.current=(0,L.attachViewportFit)({dropdown:o,isOpen:()=>a.current});return}i.current.update()}}),(0,J.useEffect)(()=>()=>{i.current?.destroy(),i.current=null},[])}function Aa({suggestions:e,activeIndex:t,onSelect:a,onHighlight:i,onUnhighlight:o,isOpen:s,id:r,className:l,pills:v,onPillClick:x,showPills:k=!0,onSkip:w,showSkipButton:u=!0,showOptionIcons:h=!0,showOptionImages:y=!0,showOptionCounts:R=!0,skipDisabled:ee=!1,activeSelected:B=!1,isLoading:D=!1,skeletonExiting:he=!1,isInputEmpty:P=!1,language:H,products:oe,onProductSelect:G,onProductAddToCart:ge,onProductFocusChange:ne,productsLayout:E="row",productImageFallback:Q="image",formatType:Y="options",dateView:re=null,selectedDateIso:xe=null,selectedDateRange:I=null,dateRangeStart:F=null,dateReferences:p,onPreviousMonth:T,onNextMonth:oa,timeView:Be=null,multiSelectView:b=null,onMultiSelectCommit:na,onSeeAllResults:We,fullWidth:$e=!1,onTimeChange:Ze,onTimeCommit:Xe,locationView:Ge=null,isReediting:f=!1,onLocationQuery:C,onLocationMove:S,onLocationCommit:O,onLocationFocusChange:N,isFocused:se=!1,optionsPosition:fe="below",mode:Re}){let Te=si(Re),ra=Te!==void 0,le=(0,J.useRef)(null),Ke=(0,J.useRef)(null);li(le,Ke),(0,J.useEffect)(()=>{if(le.current)return(0,L.containScroll)(le.current)},[]);let sa=e[0]?.options??[],fa=!!(v&&v.length>0&&x),Oe=!!(oe&&oe.length>0),ha=Y==="time"&&Be!=null,Je=Y==="location"&&Ge!=null,g=s&&(sa.length>0||k&&fa||D||Oe||ha||Je);di(le,g),Xt(()=>{let M=le.current;M&&((0,L.fitMultiSelectDone)(M,(0,L.findMultiSelectDone)(M)),(0,L.syncPanelHug)(M))});let qe={suggestions:e,activeIndex:t,pills:v,showPills:k,showSkipButton:u,showOptionIcons:h,showOptionImages:y,showOptionCounts:R,skipDisabled:ee,activeSelected:B,isLoading:D,skeletonExiting:he,isInputEmpty:P,products:oe,formatType:Y,dateView:re,selectedDateIso:xe,selectedDateRange:I,dateRangeStart:F,dateReferences:p,timeView:Be,multiSelectView:b,locationView:Ge,isReediting:f,showsSeeAll:!!We},la=(0,J.useRef)(qe);g&&(la.current=qe);let n=g?qe:la.current,m=(0,L.uiStringsFor)(H),_e=n.suggestions[0],Ve=_e?.options??[],Le=n.activeIndex>=0&&!!Ve[n.activeIndex]?.is_tappable,Ue=(0,L.labelTraditionalAutocomplete)(n.pills??[],m.keepTyping),ea=!!(Ue.length>0&&x),ze=n.showPills&&ea,ba=n.showPills&&!ea&&n.isLoading,Qe=ze||ba,De=ea&&(0,L.hasSkippablePill)(Ue)&&n.showSkipButton&&!n.isInputEmpty&&!!w,aa=Ue[0]?.text,da=(0,L.isCalendarFormat)(n.formatType)&&n.dateView!=null,ua=Ve.length>0&&!da,Ye=Ve.length>0&&da&&!n.isLoading,ca=n.formatType==="time"&&n.timeView!=null&&!n.isLoading,c=n.formatType==="location"&&n.locationView!=null&&!n.isLoading,$=n.isLoading&&!ua&&!Ye&&!ca&&!c,W=n.products??[],ma=(0,L.panelMorphKey)(ze?Ue:[]);return(0,J.useLayoutEffect)(()=>{le.current&&(0,L.settlePanelMorph)(le.current,ma,{visible:g,anchorBottom:fe==="above"})},[ma,g,fe,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,E,H]),(0,J.useEffect)(()=>{let M=le.current;return()=>{M&&(0,L.destroyPanelMorph)(M)}},[]),(0,V.jsxs)("div",{ref:le,id:r,role:"listbox","aria-multiselectable":!!n.multiSelectView,"data-aia-dropdown":"","data-options-position":fe,"data-mode":Te,"data-aia-loading":n.isLoading?"":void 0,"data-aia-skeleton-exiting":n.skeletonExiting?"":void 0,"data-aia-has-products":W.length>0?"":void 0,"data-aia-full-width":$e?"":void 0,className:`${ra?"magicx-aia ":""}${ye.dropdown} ${g?ye.visible:""} ${l??""}`,onMouseDown:M=>M.preventDefault(),children:[(0,V.jsxs)(ut,{space:"8px",children:[(Qe||De)&&(0,V.jsxs)(xa,{noWrap:!0,className:ye.pillBar,"data-aia-pillbar":"",children:[Qe&&(0,V.jsx)("span",{className:ye.pillScroll,"data-aia-pill-scroll":"",children:(0,V.jsx)(Ia,{pills:Ue,activePillIndex:0,activeSelected:n.activeSelected,onSelectPill:x??(()=>{}),rounded:!0,loading:n.isLoading})}),De&&(0,V.jsx)("button",{type:"button",tabIndex:-1,className:ye.skip,"data-aia-skip":"",disabled:n.isLoading||n.skipDisabled,"aria-label":aa?`${m.skipLabel} ${aa}`:m.skipLabel,onClick:w,children:m.skip})]}),ua&&(0,V.jsx)(pt,{options:Ve,activeIndex:n.activeIndex,onSelect:a,onHighlight:i,onUnhighlight:o,listboxId:r,loading:n.isLoading,groupKey:_e?`${_e.parameter} ${_e.text}`:"",optionsPosition:fe,showIcons:n.showOptionIcons,showImages:n.showOptionImages,showCounts:n.showOptionCounts,picked:n.multiSelectView?.picked}),n.multiSelectView&&(0,V.jsx)("div",{"data-aia-multi-actions":"",onClick:M=>{M.target.closest("[data-aia-multi-done]")&&!n.skipDisabled&&!n.isLoading&&na?.()},children:(0,V.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:ye.multiDone,ref:M=>{M&&(M.disabled=!0,M.offsetHeight,M.disabled=n.skipDisabled||n.isLoading)},children:m.done})}),Ye&&n.dateView&&(0,V.jsx)(Za,{options:Ve,activeIndex:n.activeIndex,listboxId:r,view:n.dateView,selection:{selectedIso:n.selectedDateIso??null,selectedRange:n.selectedDateRange??null,rangeStart:n.dateRangeStart??null,floor:(0,L.dateFloorFor)(n.formatType,n.dateRangeStart),references:n.dateReferences??[]},onSelect:a,onHighlight:i,onUnhighlight:o,onPreviousMonth:T??gt,onNextMonth:oa??gt}),ca&&n.timeView&&(0,V.jsx)(ht,{view:n.timeView,label:m.timeLabel,doneLabel:m.done,interactive:!n.skipDisabled,onTimeChange:Ze??ai,onTimeCommit:Xe??ti}),c&&n.locationView&&(0,V.jsx)(tt,{view:n.locationView,searchLabel:m.locationSearch,noResultsLabel:m.locationNoResults,useTypedLabel:m.locationUseTyped,widgetFocused:se&&g,reediting:n.isReediting,visible:g,interactive:!n.skipDisabled,onQuery:C??ii,onMove:S??oi,onCommit:O??ni,onFocusChange:N??ri}),$&&(0,V.jsx)("div",{className:ye.skeletonBars,"data-aia-skeleton-bars":"",children:Jt.map(M=>(0,V.jsx)("span",{className:ye.skeletonBar,style:{width:M}},`bar-${M}`))}),(0,V.jsx)(rt,{products:W,listboxId:r,onSelect:G??ei,onAddToCart:ge,onFocusChange:ne,focusable:g&&!n.isLoading,loading:n.isLoading,layout:E,imageFallback:Q,strings:m}),n.showsSeeAll&&(0,V.jsx)("div",{className:ye.seeAllRow,"data-aia-see-all":"",onClick:M=>{M.target.closest("[data-aia-see-all-button]")&&(M.stopPropagation(),!n.isLoading&&We?.())},children:(0,V.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"",className:ye.seeAll,ref:M=>{M&&(M.disabled=!0,M.offsetHeight,M.disabled=n.isLoading)},children:m.seeAllResults})}),(0,V.jsx)(Xa,{isOptionHighlighted:Le,isInputEmpty:n.isInputEmpty,strings:m})]}),(0,V.jsx)("button",{ref:Ke,type:"button",tabIndex:-1,className:ye.scrollArrow,"data-aia-scroll-arrow":"","aria-label":m.scrollArrow,"aria-hidden":"true",children:(0,V.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,V.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Fe=require("@magicx-eng/ai-autocomplete-vanilla");var bt=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 {
|
|
3708
3716
|
flex-shrink: 0;
|
|
3709
3717
|
width: 32px;
|
|
3710
3718
|
height: 32px;
|
|
@@ -3775,5 +3783,5 @@
|
|
|
3775
3783
|
transition: none;
|
|
3776
3784
|
}
|
|
3777
3785
|
}
|
|
3778
|
-
`,document.head.appendChild(e)}var ft={submitButton:"aia-submitButton-otz7H"};var Ra=require("react/jsx-runtime");function wt({disabled:e,ready:t,onClick:a,label:i=(0,bt.uiStringsFor)().submit}){return(0,Ra.jsx)("button",{type:"button","data-aia-submit":"",className:ft.submitButton,disabled:e,"data-aia-ready":t?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":i,children:(0,Ra.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Ra.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Fe=require("@magicx-eng/ai-autocomplete-vanilla"),A=require("react");var Ba=require("react");function vt(e){let t=(0,Ba.useRef)(e);t.current=e;let a=Object.keys(e??{}).sort().join("\0"),i=(0,Ba.useRef)({key:"",overrides:void 0});if(i.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,v,x)=>{let k=t.current?.[s];return k?k(l,v,x):[]};o[s]=r}i.current={key:a,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:a}}var Wa=require("react");function xt(e){let t=(0,Wa.useRef)(e);t.current=e;let a=(0,Wa.useRef)(null);a.current===null&&(a.current={fetch:(o,s)=>{let r=t.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>t.current?.transform(o)??[],get limit(){return t.current?.limit}});let i=e!==void 0;return{config:i?a.current:void 0,enabled:i}}var yt={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Oa({onSubmit:e,onResult:t,onError:a,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:v,productId:x,visitorId:k,columns:w=2,dropdownTrigger:u,optionsPosition:h,closeDropdownOnBlur:y,prependPlaceholder:R,allOption:ee,showNonTappableOptions:B,locationSearch:D,showOptionIcons:he,showOptionImages:P,showOptionCounts:F,showSkipButton:oe,showProducts:G,productImageFallback:ge="image",onFocus:ne,onBlur:I,value:Q,completedParams:Y,onChange:re,onParamsChange:xe,products:E,mapProducts:H,onProductSelect:p,onProductAddToCart:T,source:oa,setCursor:Be}){let b=(0,A.useRef)(null),[na,We]=(0,A.useState)(null),$e=(0,A.useRef)(e);$e.current=e;let Ze=(0,A.useRef)(t);Ze.current=t;let Xe=(0,A.useRef)(a);Xe.current=a;let Ge=(0,A.useRef)(re);Ge.current=re;let f=(0,A.useRef)(xe);f.current=xe;let C=(0,A.useRef)(ne);C.current=ne;let S=(0,A.useRef)(I);S.current=I;let O=(0,A.useRef)(Be);O.current=Be;let N=(0,A.useRef)(p);N.current=p;let se=(0,A.useRef)(T);se.current=T;let fe=(0,A.useRef)(k);fe.current=k;let Re=(0,A.useRef)(()=>{let c=fe.current;return typeof c=="function"?c():c}).current,Te=xt(E),ra=(0,A.useRef)(H);ra.current=H;let le=(0,A.useRef)((c,$)=>{let W=ra.current;return W?W(c,$):c}).current,Ke=H?le:void 0,sa=vt(i);(0,A.useEffect)(()=>{if(typeof document>"u")return;let c=new Fe.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:v,productId:x,visitorId:Re,optionOverrides:sa.overrides,maskCompletedText:o,columns:w,dropdownTrigger:u,optionsPosition:h,closeDropdownOnBlur:y,prependPlaceholder:R,allOption:ee,showNonTappableOptions:B,locationSearch:D,showProducts:G,source:oa,value:Q,completedParams:Y,onSubmit:(...W)=>$e.current?.(...W),onResult:(...W)=>Ze.current?.(...W),onError:(...W)=>Xe.current?.(...W),onChange:(...W)=>Ge.current?.(...W),onParamsChange:(...W)=>f.current?.(...W),onFocus:()=>C.current?.(),onBlur:()=>S.current?.(),onProductSelect:W=>N.current?.(W),onProductAddToCart:W=>se.current?.(W),setCursor:W=>O.current?.(W),products:Te.config,mapProducts:Ke});b.current=c,We(c.getState());let $=c.subscribe(W=>We(W));return()=>{$(),c.destroy(),b.current===c&&(b.current=null)}},[]),(0,A.useEffect)(()=>{Q!==void 0&&b.current?.setValue(Q)},[Q]),(0,A.useEffect)(()=>{Y!==void 0&&b.current?.setCompletedParams(Y)},[Y]);let fa=JSON.stringify(s??null),Oe;try{Oe=JSON.stringify(r??null)}catch{Oe="[unstringifiable]"}(0,A.useEffect)(()=>{b.current?.update({apiConfig:s,additionalContext:r,language:l,currency:v,productId:x,optionOverrides:sa.overrides,dropdownTrigger:u,optionsPosition:h,closeDropdownOnBlur:y,prependPlaceholder:R,allOption:ee,showNonTappableOptions:B,locationSearch:D,showProducts:G})},[fa,Oe,l,v?.code,v?.rate,v?.country,x,sa.key,u,h,y,R,ee,B,D,G]);let ha=(0,A.useRef)(!1);(0,A.useEffect)(()=>{if(!ha.current){ha.current=!0;return}b.current?.update({products:Te.config})},[Te.enabled]),(0,A.useEffect)(()=>{b.current?.update({mapProducts:Ke})},[Ke]);let Je=(0,A.useRef)(null);Je.current===null&&(Je.current={handleTextChange:c=>b.current?.handleTextChange(c),handleCompositionText:c=>b.current?.handleCompositionText(c),handleKeyDown:c=>{let $="nativeEvent"in c?c.nativeEvent:c;b.current?.handleKeyDown($)},setFocused:c=>b.current?.setFocused(c),startEditingParam:c=>b.current?.startEditingParam(c),removeParam:c=>b.current?.removeParam(c)??!1,exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:c=>b.current?.handleCaretAfterInput(c),handleCaretMove:c=>b.current?.handleCaretMove(c),replaceEditingRange:c=>b.current?.replaceEditingRange(c)??!1,setActivePill:c=>b.current?.setActivePill(c),skipActivePill:()=>b.current?.skipActivePill(),removeLastParam:()=>b.current?.removeLastParam(),clearNewParamId:()=>b.current?.clearNewParamId(),reset:()=>b.current?.reset(),refreshProducts:()=>b.current?.refreshProducts(),prepareSubmit:()=>b.current?.prepareSubmit(),getState:()=>b.current?.getState()??yt,recordSubmit:c=>b.current?.recordSubmit(c),selectOption:(c,$)=>b.current?.selectOption(c,$),selectProduct:c=>b.current?.selectProduct(c),addProductToCart:c=>{let $=b.current;return!$||!se.current?Promise.resolve():$.addProductToCart(c)},setActiveDropdownIndex:c=>b.current?.setActiveDropdownIndex(c),clearHighlight:c=>b.current?.clearHighlight(c),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:c=>b.current?.setTime(c),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:c=>b.current?.toggleMultiSelectOption(c),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:c=>b.current?.setLocationQuery(c),moveLocationHighlight:c=>b.current?.moveLocationHighlight(c),commitLocation:c=>b.current?.commitLocation(c),setLocationFieldFocused:c=>b.current?.setLocationFieldFocused(c),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let g=Je.current,qe=(0,A.useCallback)(c=>{let $=c.target.value,ma=$.length>0&&!c.nativeEvent?.isComposing&&$[0]!==$[0].toUpperCase()?$[0].toUpperCase()+$.slice(1):$;b.current?.handleTextChange(ma)},[]),la=(0,A.useCallback)(c=>{b.current?.handleKeyDown(c.nativeEvent)},[]),n=b.current,m=na??yt,_e=Q!==void 0?Q:m.text,Ve=Y!==void 0?Y:m.completedParams,Le=m.actionableSuggestions,Ue=Le[0],ea=(0,A.useMemo)(()=>(0,Fe.withoutTraditionalAutocomplete)(Le),[Le]),ze=n?.listboxId??"",ba=m.activeDropdownIndex>=0&&n?`${ze}-option-${m.activeDropdownIndex}`:void 0,Qe=m.editingParam,De=m.editingIdentified,aa=Qe?(0,Fe.editingSuggestion)(Qe):De?{parameter:De.parameter,text:(0,Fe.identifiedParamLabel)(De.parameter),required:!0,options:[]}:null,da=m.dropdownSuggestion??aa??Ue,ua=aa?[aa]:Le,Ye=(0,Fe.dateSelectionFor)(m),ca=!n||m.dropdownLoading;return{completedParams:Ve,multiSelectView:m.multiSelectView,toggleMultiSelectOption:g.toggleMultiSelectOption,commitMultiSelect:g.commitMultiSelect,skippedParams:m.skippedParams,identifiedParams:m.identifiedParams,suggestionPills:ea,setActivePill:g.setActivePill,skipActivePill:g.skipActivePill,removeLastParam:g.removeLastParam,segments:m.segments,newParamId:m.newParamId,clearNewParamId:g.clearNewParamId,suggestions:m.suggestions,activeIndex:m.activeDropdownIndex,isReady:m.isReady,isLoading:ca,isFocused:m.isFocused,isDropdownOpen:m.isDropdownOpen,isActivePillSelected:m.isActivePillSelected,placeholderText:m.placeholderText,listboxId:ze,error:m.error,products:m.products,customFields:m.customFields,selectProduct:g.selectProduct,addProductToCart:g.addProductToCart,handleTextChange:g.handleTextChange,handleCompositionText:g.handleCompositionText,handleKeyDown:g.handleKeyDown,setFocused:g.setFocused,editingParam:Qe,editingIdentified:De,editingAnchor:m.editingAnchor,caretOffset:m.caretOffset,startEditingParam:g.startEditingParam,removeParam:g.removeParam,exitEditMode:g.exitEditMode,handleCaretAfterInput:g.handleCaretAfterInput,handleCaretMove:g.handleCaretMove,replaceEditingRange:g.replaceEditingRange,inputProps:{value:_e,placeholder:m.placeholderText||void 0,onChange:qe,onKeyDown:la,onFocus:g.handleFocus,onBlur:g.handleBlur,role:"combobox","aria-expanded":m.isDropdownOpen,"aria-activedescendant":ba,"aria-autocomplete":"list","aria-controls":ze},reset:g.reset,refreshProducts:g.refreshProducts,prepareSubmit:g.prepareSubmit,getState:g.getState,recordSubmit:g.recordSubmit,dropdownProps:{suggestions:da?[{...da,options:m.dropdownOptions}]:[],activeIndex:m.activeDropdownIndex,onSelect:g.selectOption,onHighlight:g.setActiveDropdownIndex,onUnhighlight:g.clearHighlight,isOpen:m.isDropdownOpen,id:ze,pills:ua,activeSelected:m.isActivePillSelected,onPillClick:g.setActivePill,onSkip:g.skipActivePill,showSkipButton:(oe??!0)&&!Qe&&!De,showOptionIcons:he??!0,showOptionImages:P??!0,showOptionCounts:F??!0,skipDisabled:m.inSelectionAnimation,isLoading:ca,skeletonExiting:m.skeletonExiting,isInputEmpty:_e.trim().length===0,language:l,products:m.products,productImageFallback:ge,onProductSelect:g.selectProduct,onProductAddToCart:T?g.addProductToCart:void 0,onProductFocusChange:g.setFocused,formatType:m.activeFormatType,dateView:m.dateView,selectedDateIso:Ye.selectedIso,selectedDateRange:Ye.selectedRange,dateRangeStart:Ye.rangeStart,dateReferences:Ye.references,onPreviousMonth:g.showPreviousMonth,onNextMonth:g.showNextMonth,timeView:m.timeView,multiSelectView:m.dropdownMultiSelect,onMultiSelectCommit:g.commitMultiSelect,onTimeChange:g.setTime,onTimeCommit:g.commitTime,locationView:m.locationView,isReediting:m.editingParam!=null,onLocationQuery:g.setLocationQuery,onLocationMove:g.moveLocationHighlight,onLocationCommit:g.commitLocation,onLocationFocusChange:g.setLocationFieldFocused,isFocused:m.isFocused||m.locationFieldFocused,optionsPosition:h??"below"}}}var U=require("@magicx-eng/ai-autocomplete-vanilla"),z=require("react"),La;function ci(){if(La!==void 0)return La;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),La=e.contentEditable==="plaintext-only",La}function kt(e){let{segments:t,showChipIcons:a=!0,showChipImages:i=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:v,editingAnchor:x,caretOffset:k,placeholderText:w,hintSuggestions:u,isFocused:h,isDropdownOpen:y,listboxId:R,activeDescendantId:ee,autoFocus:B,handleTextChange:D,handleCompositionText:he,handleKeyDown:P,handleCaretAfterInput:F,handleCaretMove:oe,startEditingParam:G,replaceEditingRange:ge,setFocused:ne}=e,I=(0,z.useRef)(null),Q=(0,z.useRef)(!1),Y=(0,z.useRef)(""),re=(0,z.useRef)(""),xe=(0,z.useRef)(null),E=(0,z.useRef)(0);xe.current=k,(0,z.useEffect)(()=>{if(!B)return;let f=I.current;if(!f)return;document.activeElement===f?ne(!0):f.focus();let C=f.ownerDocument??document,S=C.getSelection(),O=S&&S.rangeCount>0&&f.contains(S.anchorNode);if(S&&!O){let N=C.createRange();N.selectNodeContents(f),N.collapse(!0),S.removeAllRanges(),S.addRange(N)}},[B,ne]),(0,z.useEffect)(()=>{let f=I.current;if(!f)return;let C=f.ownerDocument??document,S=()=>{let O=C.getSelection();if(!O||O.rangeCount===0||!O.anchorNode||!f.contains(O.anchorNode))return;let N=O.anchorNode,se=N.nodeType===Node.ELEMENT_NODE?N:N.parentElement,Re=(O.isCollapsed?se?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Te=l?.id??v?.id??null;if(Re&&Re!==Te){G(Re);return}performance.now()-E.current<50||oe((0,U.getCursorOffset)(f))};return C.addEventListener("selectionchange",S),()=>C.removeEventListener("selectionchange",S)},[l,v,G,oe]),(0,z.useEffect)(()=>{let f=I.current;if(!f)return;let C=S=>{let O=(0,U.chipIdFromTap)(f,S.target);O&&(G(O),(0,U.keepCaretOnChip)(f,O))};return f.addEventListener("click",C),()=>f.removeEventListener("click",C)},[G]),(0,z.useEffect)(()=>{let f=I.current;if(!(!f||!s||!o))return(0,U.attachChipRemove)(f,s)},[s,o]),(0,z.useLayoutEffect)(()=>{let f=I.current;f&&(0,U.renderEditableContent)({input:f,segments:t,newParamId:r,editingParamId:l?.id??null,placeholderText:w??"",isFocused:h,showChipIcons:a,showChipImages:i,showChipRemove:o,hintOptions:(0,U.startingHintOptions)(u??[])})},[t,r,l,w,u,h,a,i,o]),(0,z.useEffect)(()=>{let f=I.current;return()=>{f&&(0,U.cancelStartingHint)(f)}},[]),(0,z.useLayoutEffect)(()=>{let f=Y.current,C=r??"";if(Y.current=C,!C||C===f)return;let S=I.current;if(!S)return;S.focus();let O=xe.current??(0,U.plainTextLength)(S);(0,U.setCursorOffset)(S,O)},[r]),(0,z.useLayoutEffect)(()=>{let f=re.current,C=l?.id??"";if(re.current=C,!C||C===f||x==null)return;let S=I.current;S&&(0,U.setCursorOffset)(S,x)},[l,x]);let H=(0,z.useCallback)(()=>{let f=I.current;if(!f)return;let C=(0,U.extractPlainText)(f),O=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;if(Q.current){he(O);return}D(O)},[D,he]),p=(0,z.useCallback)(()=>{E.current=performance.now(),H();let f=I.current;f&&F((0,U.getCursorOffset)(f))},[H,F]);(0,z.useEffect)(()=>{let f=I.current;if(!f)return;let C=S=>{let O=S,N=O.inputType;if(N==="insertParagraph"||N==="insertLineBreak"||N==="insertFromDrop"){S.preventDefault();return}if(N.startsWith("insert")||N.startsWith("delete")){let se=N.startsWith("delete")?"":O.data??"";ge(se)&&S.preventDefault()}};return f.addEventListener("beforeinput",C),()=>f.removeEventListener("beforeinput",C)},[ge]);let T=(0,z.useCallback)(()=>{Q.current=!0,I.current?.setAttribute("data-aia-composing","true")},[]),oa=(0,z.useCallback)(()=>{Q.current=!1,I.current?.removeAttribute("data-aia-composing"),H()},[H]),Be=(0,z.useCallback)(f=>{f.preventDefault();let C=I.current;if(!C)return;let S=(f.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!S)return;let O=C.ownerDocument??document,N=O.getSelection();if(!N||N.rangeCount===0)return;let se=N.getRangeAt(0);if(!C.contains(se.startContainer))return;se.deleteContents();let fe=O.createTextNode(S);se.insertNode(fe),se.setStartAfter(fe),se.collapse(!0),N.removeAllRanges(),N.addRange(se),H()},[H]),b=(0,z.useCallback)(f=>P(f),[P]),na=(0,z.useCallback)(()=>ne(!0),[ne]),We=(0,z.useCallback)(()=>ne(!1),[ne]),$e=(0,z.useCallback)(()=>I.current?.focus(),[]),Ze=(0,z.useCallback)(()=>I.current?.blur(),[]),Xe=(0,z.useCallback)(()=>{let f=I.current;return f?(0,U.extractPlainText)(f):""},[]),Ge=ci()?"plaintext-only":"true";return{inputRef:I,editorProps:{ref:I,contentEditable:Ge,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":R,"aria-expanded":y,"aria-activedescendant":ee,spellCheck:!0,enterKeyHint:"send",onInput:p,onKeyDown:b,onCompositionStart:T,onCompositionEnd:oa,onPaste:Be,onFocus:na,onBlur:We},getPlainText:Xe,focus:$e,blur:Ze}}var Ae=require("react/jsx-runtime");function pi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Ct=(0,j.forwardRef)(function({onSubmit:t,onResult:a,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:v,language:x,currency:k,productId:w,visitorId:u,columns:h,pillPlacement:y="dropdown",mode:R="auto",optionsPosition:ee="below",animations:B=!0,optionsStyle:D="floating",dropdownTrigger:he,closeDropdownOnBlur:P,prependPlaceholder:F,allOption:oe,showNonTappableOptions:G,locationSearch:ge,showOptionIcons:ne=!0,showChipIcons:I=!0,showChipImages:Q=!0,showChipRemove:Y=!1,showOptionImages:re=!0,showOptionCounts:xe=!0,showSkipButton:E,showProducts:H,productsLayout:p,productImageFallback:T,autoFocus:oa=!0,onFocus:Be,onBlur:b,value:na,completedParams:We,onChange:$e,onParamsChange:Ze,products:Xe,mapProducts:Ge,onProductSelect:f,onProductAddToCart:C,submitButton:S,resetOnSubmit:O=!0,seeAllResults:N=!1},se){let fe=(0,j.useRef)(null),Re=(0,j.useRef)(null),Te=(0,j.useRef)(null),ra=(0,j.useRef)(()=>{}),le=(0,j.useRef)(null),Ke=(0,j.useRef)(null);(0,j.useEffect)(()=>{let K=fe.current;if(K)return le.current?le.current.setMode(R):le.current=new He.ModeController(K,R),()=>{le.current?.destroy(),le.current=null}},[R]);let sa=(0,j.useCallback)(K=>{let be=Ke.current?.current;be&&(be.focus(),(0,He.setCursorOffset)(be,K))},[]),{completedParams:fa,suggestionPills:Oe,setActivePill:ha,skipActivePill:Je,segments:g,newParamId:qe,clearNewParamId:la,placeholderText:n,isFocused:m,isDropdownOpen:_e,isActivePillSelected:Ve,isLoading:Le,isReady:Ue,activeIndex:ea,listboxId:ze,handleTextChange:ba,handleCompositionText:Qe,handleKeyDown:De,setFocused:aa,editingParam:da,editingIdentified:ua,editingAnchor:Ye,caretOffset:ca,startEditingParam:c,removeParam:$,handleCaretAfterInput:W,handleCaretMove:ma,replaceEditingRange:M,dropdownProps:Ga,reset:Ca,refreshProducts:Ka,prepareSubmit:qa,getState:_a,recordSubmit:Va}=Oa({onSubmit:K=>ra.current(K),onResult:a,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:v,language:x,currency:k,productId:w,visitorId:u,columns:h,dropdownTrigger:he,optionsPosition:ee,closeDropdownOnBlur:P,prependPlaceholder:F,allOption:oe,showNonTappableOptions:G,locationSearch:ge,showOptionIcons:ne,showOptionImages:re,showOptionCounts:xe,showSkipButton:E,showProducts:H,onFocus:Be,onBlur:b,value:na,completedParams:We,onChange:$e,onParamsChange:Ze,products:Xe,mapProducts:Ge,onProductSelect:f,onProductAddToCart:C,source:"full-sdk",setCursor:sa});(0,j.useEffect)(()=>{if(!qe)return;let K=window.setTimeout(()=>la(),650);return()=>window.clearTimeout(K)},[qe,la]);let St=ea>=0?`${ze}-option-${ea}`:void 0,{inputRef:za,editorProps:Tt,focus:Sa,blur:Ua,getPlainText:Qa}=kt({segments:g,newParamId:qe,editingParam:da,editingIdentified:ua,editingAnchor:Ye,caretOffset:ca,placeholderText:n,hintSuggestions:y==="inline"?[]:Oe,isFocused:m,showChipIcons:I,showChipImages:Q,showChipRemove:Y,removeParam:$,isDropdownOpen:_e,listboxId:ze,activeDescendantId:St,autoFocus:oa,handleTextChange:ba,handleCompositionText:Qe,handleKeyDown:De,handleCaretAfterInput:W,handleCaretMove:ma,startEditingParam:c,replaceEditingRange:M,setFocused:aa});Ke.current=za,(0,j.useLayoutEffect)(()=>{let K=Re.current,be=za.current;if(!K||!be)return;let va=()=>{let ja=K.firstElementChild;if(!ja)return;let Ot=ja.getBoundingClientRect(),Lt=be.getBoundingClientRect();Ot.top>=Lt.bottom-2?K.setAttribute("data-aia-pill-wrapped",""):K.removeAttribute("data-aia-pill-wrapped")};va();let Ya=new ResizeObserver(va);return Ya.observe(be),()=>Ya.disconnect()},[g,Oe.length,Le,za]),(0,j.useEffect)(()=>{let K=Te.current;if(K)return(0,He.watchEditorHeight)(K)},[]),(0,j.useImperativeHandle)(se,()=>({focus:Sa,blur:Ua,reset:Ca,refreshProducts:Ka,setMode:K=>le.current?.setMode(K),skipActivePill:Je}),[Sa,Ua,Ca,Ka,Je]);let ga=!!g.length||fa.length>0,wa=(0,j.useCallback)(K=>{if(!ga)return;K&&qa();let be=_a(),va=(0,He.buildSubmitResult)(Qa(),be.completedParams,be.skippedParams,{identifiedParams:be.identifiedParams,isReady:be.isReady,customFields:be.customFields});K&&Va(va),t(va),O&&Ca()},[Va,O,ga,qa,_a,t,Ca,Qa]);ra.current=()=>wa(!1);let Pt=N&&!Ga.isInputEmpty&&ga,It=(0,j.useCallback)(()=>wa(!0),[wa]),Et=(0,j.useCallback)(K=>{K.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||Sa()},[Sa]),At=y==="inline",Rt=y==="dropdown";return(0,Ae.jsxs)("div",{ref:fe,className:`magicx-aia ${pa.container} ${r??""}`,"data-pill-placement":y,"data-options-position":ee,"data-animations":B?"on":"off","data-aia-options-style":D,"data-mode":pi(R),children:[(0,Ae.jsx)(Aa,{...Ga,showPills:Rt,productsLayout:p,productImageFallback:T,onSeeAllResults:Pt?It:void 0,fullWidth:N}),(0,Ae.jsxs)("div",{className:pa.inputWrapper,"data-aia-input-wrapper":"",onClick:Et,children:[(0,Ae.jsxs)("div",{ref:Te,className:pa.editorArea,"data-aia-editor":"",children:[(0,Ae.jsx)("div",{...Tt,className:pa.input,"data-aia-input":""}),At&&(Le||Oe.length>0)&&(0,Ae.jsx)("span",{ref:Re,className:pa.pillListContainer,"data-aia-pill-list-container":"",children:(0,Ae.jsx)(Ia,{pills:Oe,activePillIndex:0,activeSelected:Ve,onSelectPill:ha,loading:Le})})]}),S===null?null:S===void 0?(0,Ae.jsx)(wt,{disabled:!ga,ready:ga&&Ue,onClick:()=>wa(!0),label:(0,He.uiStringsFor)(x).submit}):(0,Ae.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:pa.submitSlot,onClick:K=>{ga&&(K.stopPropagation(),wa(!0))},children:S})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
3786
|
+
`,document.head.appendChild(e)}var ft={submitButton:"aia-submitButton-otz7H"};var Ra=require("react/jsx-runtime");function wt({disabled:e,ready:t,onClick:a,label:i=(0,bt.uiStringsFor)().submit}){return(0,Ra.jsx)("button",{type:"button","data-aia-submit":"",className:ft.submitButton,disabled:e,"data-aia-ready":t?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":i,children:(0,Ra.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":i,children:(0,Ra.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var He=require("@magicx-eng/ai-autocomplete-vanilla"),A=require("react");var Ba=require("react");function vt(e){let t=(0,Ba.useRef)(e);t.current=e;let a=Object.keys(e??{}).sort().join("\0"),i=(0,Ba.useRef)({key:"",overrides:void 0});if(i.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,v,x)=>{let k=t.current?.[s];return k?k(l,v,x):[]};o[s]=r}i.current={key:a,overrides:e?o:void 0}}return{overrides:i.current.overrides,key:a}}var Wa=require("react");function xt(e){let t=(0,Wa.useRef)(e);t.current=e;let a=(0,Wa.useRef)(null);a.current===null&&(a.current={fetch:(o,s)=>{let r=t.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>t.current?.transform(o)??[],get limit(){return t.current?.limit}});let i=e!==void 0;return{config:i?a.current:void 0,enabled:i}}var yt={text:"",composing:null,completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Oa({onSubmit:e,onResult:t,onError:a,optionOverrides:i,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:v,productId:x,visitorId:k,columns:w=2,dropdownTrigger:u,optionsPosition:h,closeDropdownOnBlur:y,prependPlaceholder:R,allOption:ee,showNonTappableOptions:B,locationSearch:D,showOptionIcons:he,showOptionImages:P,showOptionCounts:H,showSkipButton:oe,showProducts:G,productImageFallback:ge="image",onFocus:ne,onBlur:E,value:Q,completedParams:Y,onChange:re,onParamsChange:xe,products:I,mapProducts:F,onProductSelect:p,onProductAddToCart:T,source:oa,setCursor:Be}){let b=(0,A.useRef)(null),[na,We]=(0,A.useState)(null),$e=(0,A.useRef)(e);$e.current=e;let Ze=(0,A.useRef)(t);Ze.current=t;let Xe=(0,A.useRef)(a);Xe.current=a;let Ge=(0,A.useRef)(re);Ge.current=re;let f=(0,A.useRef)(xe);f.current=xe;let C=(0,A.useRef)(ne);C.current=ne;let S=(0,A.useRef)(E);S.current=E;let O=(0,A.useRef)(Be);O.current=Be;let N=(0,A.useRef)(p);N.current=p;let se=(0,A.useRef)(T);se.current=T;let fe=(0,A.useRef)(k);fe.current=k;let Re=(0,A.useRef)(()=>{let c=fe.current;return typeof c=="function"?c():c}).current,Te=xt(I),ra=(0,A.useRef)(F);ra.current=F;let le=(0,A.useRef)((c,$)=>{let W=ra.current;return W?W(c,$):c}).current,Ke=F?le:void 0,sa=vt(i);(0,A.useEffect)(()=>{if(typeof document>"u")return;let c=new He.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:v,productId:x,visitorId:Re,optionOverrides:sa.overrides,maskCompletedText:o,columns:w,dropdownTrigger:u,optionsPosition:h,closeDropdownOnBlur:y,prependPlaceholder:R,allOption:ee,showNonTappableOptions:B,locationSearch:D,showProducts:G,source:oa,value:Q,completedParams:Y,onSubmit:(...W)=>$e.current?.(...W),onResult:(...W)=>Ze.current?.(...W),onError:(...W)=>Xe.current?.(...W),onChange:(...W)=>Ge.current?.(...W),onParamsChange:(...W)=>f.current?.(...W),onFocus:()=>C.current?.(),onBlur:()=>S.current?.(),onProductSelect:W=>N.current?.(W),onProductAddToCart:W=>se.current?.(W),setCursor:W=>O.current?.(W),products:Te.config,mapProducts:Ke});b.current=c,We(c.getState());let $=c.subscribe(W=>We(W));return()=>{$(),c.destroy(),b.current===c&&(b.current=null)}},[]),(0,A.useEffect)(()=>{Q!==void 0&&b.current?.setValue(Q)},[Q]),(0,A.useEffect)(()=>{Y!==void 0&&b.current?.setCompletedParams(Y)},[Y]);let fa=JSON.stringify(s??null),Oe;try{Oe=JSON.stringify(r??null)}catch{Oe="[unstringifiable]"}(0,A.useEffect)(()=>{b.current?.update({apiConfig:s,additionalContext:r,language:l,currency:v,productId:x,optionOverrides:sa.overrides,dropdownTrigger:u,optionsPosition:h,closeDropdownOnBlur:y,prependPlaceholder:R,allOption:ee,showNonTappableOptions:B,locationSearch:D,showProducts:G})},[fa,Oe,l,v?.code,v?.rate,v?.country,x,sa.key,u,h,y,R,ee,B,D,G]);let ha=(0,A.useRef)(!1);(0,A.useEffect)(()=>{if(!ha.current){ha.current=!0;return}b.current?.update({products:Te.config})},[Te.enabled]),(0,A.useEffect)(()=>{b.current?.update({mapProducts:Ke})},[Ke]);let Je=(0,A.useRef)(null);Je.current===null&&(Je.current={handleTextChange:c=>b.current?.handleTextChange(c),handleCompositionText:c=>b.current?.handleCompositionText(c),handleKeyDown:c=>{let $="nativeEvent"in c?c.nativeEvent:c;b.current?.handleKeyDown($)},setFocused:c=>b.current?.setFocused(c),startEditingParam:c=>b.current?.startEditingParam(c),removeParam:c=>b.current?.removeParam(c)??!1,exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:c=>b.current?.handleCaretAfterInput(c),handleCaretMove:c=>b.current?.handleCaretMove(c),replaceEditingRange:c=>b.current?.replaceEditingRange(c)??!1,setActivePill:c=>b.current?.setActivePill(c),skipActivePill:()=>b.current?.skipActivePill(),removeLastParam:()=>b.current?.removeLastParam(),clearNewParamId:()=>b.current?.clearNewParamId(),reset:()=>b.current?.reset(),refreshProducts:()=>b.current?.refreshProducts(),prepareSubmit:()=>b.current?.prepareSubmit(),getState:()=>b.current?.getState()??yt,recordSubmit:c=>b.current?.recordSubmit(c),selectOption:(c,$)=>b.current?.selectOption(c,$),selectProduct:c=>b.current?.selectProduct(c),addProductToCart:c=>{let $=b.current;return!$||!se.current?Promise.resolve():$.addProductToCart(c)},setActiveDropdownIndex:c=>b.current?.setActiveDropdownIndex(c),clearHighlight:c=>b.current?.clearHighlight(c),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:c=>b.current?.setTime(c),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:c=>b.current?.toggleMultiSelectOption(c),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:c=>b.current?.setLocationQuery(c),moveLocationHighlight:c=>b.current?.moveLocationHighlight(c),commitLocation:c=>b.current?.commitLocation(c),setLocationFieldFocused:c=>b.current?.setLocationFieldFocused(c),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let g=Je.current,qe=(0,A.useCallback)(c=>{let $=c.target.value,ma=$.length>0&&!c.nativeEvent?.isComposing&&$[0]!==$[0].toUpperCase()?$[0].toUpperCase()+$.slice(1):$;b.current?.handleTextChange(ma)},[]),la=(0,A.useCallback)(c=>{b.current?.handleKeyDown(c.nativeEvent)},[]),n=b.current,m=na??yt,_e=Q!==void 0?Q:m.text,Ve=Y!==void 0?Y:m.completedParams,Le=m.actionableSuggestions,Ue=Le[0],ea=(0,A.useMemo)(()=>(0,He.withoutTraditionalAutocomplete)(Le),[Le]),ze=n?.listboxId??"",ba=m.activeDropdownIndex>=0&&n?`${ze}-option-${m.activeDropdownIndex}`:void 0,Qe=m.editingParam,De=m.editingIdentified,aa=Qe?(0,He.editingSuggestion)(Qe):De?{parameter:De.parameter,text:(0,He.identifiedParamLabel)(De.parameter),required:!0,options:[]}:null,da=m.dropdownSuggestion??aa??Ue,ua=aa?[aa]:Le,Ye=(0,He.dateSelectionFor)(m),ca=!n||m.dropdownLoading;return{completedParams:Ve,multiSelectView:m.multiSelectView,toggleMultiSelectOption:g.toggleMultiSelectOption,commitMultiSelect:g.commitMultiSelect,skippedParams:m.skippedParams,identifiedParams:m.identifiedParams,suggestionPills:ea,setActivePill:g.setActivePill,skipActivePill:g.skipActivePill,removeLastParam:g.removeLastParam,segments:m.segments,newParamId:m.newParamId,clearNewParamId:g.clearNewParamId,suggestions:m.suggestions,activeIndex:m.activeDropdownIndex,isReady:m.isReady,isLoading:ca,isFocused:m.isFocused,isDropdownOpen:m.isDropdownOpen,isActivePillSelected:m.isActivePillSelected,placeholderText:m.placeholderText,listboxId:ze,error:m.error,products:m.products,customFields:m.customFields,selectProduct:g.selectProduct,addProductToCart:g.addProductToCart,handleTextChange:g.handleTextChange,handleCompositionText:g.handleCompositionText,handleKeyDown:g.handleKeyDown,setFocused:g.setFocused,editingParam:Qe,editingIdentified:De,editingAnchor:m.editingAnchor,caretOffset:m.caretOffset,startEditingParam:g.startEditingParam,removeParam:g.removeParam,exitEditMode:g.exitEditMode,handleCaretAfterInput:g.handleCaretAfterInput,handleCaretMove:g.handleCaretMove,replaceEditingRange:g.replaceEditingRange,inputProps:{value:_e,placeholder:m.placeholderText||void 0,onChange:qe,onKeyDown:la,onFocus:g.handleFocus,onBlur:g.handleBlur,role:"combobox","aria-expanded":m.isDropdownOpen,"aria-activedescendant":ba,"aria-autocomplete":"list","aria-controls":ze},reset:g.reset,refreshProducts:g.refreshProducts,prepareSubmit:g.prepareSubmit,getState:g.getState,recordSubmit:g.recordSubmit,dropdownProps:{suggestions:da?[{...da,options:m.dropdownOptions}]:[],activeIndex:m.activeDropdownIndex,onSelect:g.selectOption,onHighlight:g.setActiveDropdownIndex,onUnhighlight:g.clearHighlight,isOpen:m.isDropdownOpen,id:ze,pills:ua,activeSelected:m.isActivePillSelected,onPillClick:g.setActivePill,onSkip:g.skipActivePill,showSkipButton:(oe??!0)&&!Qe&&!De,showOptionIcons:he??!0,showOptionImages:P??!0,showOptionCounts:H??!0,skipDisabled:m.inSelectionAnimation,isLoading:ca,skeletonExiting:m.skeletonExiting,isInputEmpty:_e.trim().length===0,language:l,products:m.products,productImageFallback:ge,onProductSelect:g.selectProduct,onProductAddToCart:T?g.addProductToCart:void 0,onProductFocusChange:g.setFocused,formatType:m.activeFormatType,dateView:m.dateView,selectedDateIso:Ye.selectedIso,selectedDateRange:Ye.selectedRange,dateRangeStart:Ye.rangeStart,dateReferences:Ye.references,onPreviousMonth:g.showPreviousMonth,onNextMonth:g.showNextMonth,timeView:m.timeView,multiSelectView:m.dropdownMultiSelect,onMultiSelectCommit:g.commitMultiSelect,onTimeChange:g.setTime,onTimeCommit:g.commitTime,locationView:m.locationView,isReediting:m.editingParam!=null,onLocationQuery:g.setLocationQuery,onLocationMove:g.moveLocationHighlight,onLocationCommit:g.commitLocation,onLocationFocusChange:g.setLocationFieldFocused,isFocused:m.isFocused||m.locationFieldFocused,optionsPosition:h??"below"}}}var U=require("@magicx-eng/ai-autocomplete-vanilla"),z=require("react"),La;function ci(){if(La!==void 0)return La;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),La=e.contentEditable==="plaintext-only",La}function kt(e){let{segments:t,showChipIcons:a=!0,showChipImages:i=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:v,editingAnchor:x,caretOffset:k,placeholderText:w,hintSuggestions:u,isFocused:h,isDropdownOpen:y,listboxId:R,activeDescendantId:ee,autoFocus:B,handleTextChange:D,handleCompositionText:he,handleKeyDown:P,handleCaretAfterInput:H,handleCaretMove:oe,startEditingParam:G,replaceEditingRange:ge,setFocused:ne}=e,E=(0,z.useRef)(null),Q=(0,z.useRef)(!1),Y=(0,z.useRef)(""),re=(0,z.useRef)(""),xe=(0,z.useRef)(null),I=(0,z.useRef)(0);xe.current=k,(0,z.useEffect)(()=>{if(!B)return;let f=E.current;if(!f)return;document.activeElement===f?ne(!0):f.focus();let C=f.ownerDocument??document,S=C.getSelection(),O=S&&S.rangeCount>0&&f.contains(S.anchorNode);if(S&&!O){let N=C.createRange();N.selectNodeContents(f),N.collapse(!0),S.removeAllRanges(),S.addRange(N)}},[B,ne]),(0,z.useEffect)(()=>{let f=E.current;if(!f)return;let C=f.ownerDocument??document,S=()=>{let O=C.getSelection();if(!O||O.rangeCount===0||!O.anchorNode||!f.contains(O.anchorNode))return;let N=O.anchorNode,se=N.nodeType===Node.ELEMENT_NODE?N:N.parentElement,Re=(O.isCollapsed?se?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Te=l?.id??v?.id??null;if(Re&&Re!==Te){G(Re);return}performance.now()-I.current<50||oe((0,U.getCursorOffset)(f))};return C.addEventListener("selectionchange",S),()=>C.removeEventListener("selectionchange",S)},[l,v,G,oe]),(0,z.useEffect)(()=>{let f=E.current;if(!f)return;let C=S=>{let O=(0,U.chipIdFromTap)(f,S.target);O&&(G(O),(0,U.keepCaretOnChip)(f,O))};return f.addEventListener("click",C),()=>f.removeEventListener("click",C)},[G]),(0,z.useEffect)(()=>{let f=E.current;if(!(!f||!s||!o))return(0,U.attachChipRemove)(f,s)},[s,o]),(0,z.useLayoutEffect)(()=>{let f=E.current;f&&(0,U.renderEditableContent)({input:f,segments:t,newParamId:r,editingParamId:l?.id??null,placeholderText:w??"",isFocused:h,showChipIcons:a,showChipImages:i,showChipRemove:o,hintOptions:(0,U.startingHintOptions)(u??[])})},[t,r,l,w,u,h,a,i,o]),(0,z.useEffect)(()=>{let f=E.current;return()=>{f&&(0,U.cancelStartingHint)(f)}},[]),(0,z.useLayoutEffect)(()=>{let f=Y.current,C=r??"";if(Y.current=C,!C||C===f)return;let S=E.current;if(!S)return;S.focus();let O=xe.current??(0,U.plainTextLength)(S);(0,U.setCursorOffset)(S,O)},[r]),(0,z.useLayoutEffect)(()=>{let f=re.current,C=l?.id??"";if(re.current=C,!C||C===f||x==null)return;let S=E.current;S&&(0,U.setCursorOffset)(S,x)},[l,x]);let F=(0,z.useCallback)(()=>{let f=E.current;if(!f)return;let C=(0,U.extractPlainText)(f),O=C.length>0&&C[0]!==C[0].toUpperCase()?C[0].toUpperCase()+C.slice(1):C;if(Q.current){he(O);return}D(O)},[D,he]),p=(0,z.useCallback)(()=>{I.current=performance.now(),F();let f=E.current;f&&H((0,U.getCursorOffset)(f))},[F,H]);(0,z.useEffect)(()=>{let f=E.current;if(!f)return;let C=S=>{let O=S,N=O.inputType;if(N==="insertParagraph"||N==="insertLineBreak"||N==="insertFromDrop"){S.preventDefault();return}if(N.startsWith("insert")||N.startsWith("delete")){let se=N.startsWith("delete")?"":O.data??"";ge(se)&&S.preventDefault()}};return f.addEventListener("beforeinput",C),()=>f.removeEventListener("beforeinput",C)},[ge]);let T=(0,z.useCallback)(()=>{Q.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),oa=(0,z.useCallback)(()=>{Q.current=!1,E.current?.removeAttribute("data-aia-composing"),F()},[F]),Be=(0,z.useCallback)(f=>{f.preventDefault();let C=E.current;if(!C)return;let S=(f.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!S)return;let O=C.ownerDocument??document,N=O.getSelection();if(!N||N.rangeCount===0)return;let se=N.getRangeAt(0);if(!C.contains(se.startContainer))return;se.deleteContents();let fe=O.createTextNode(S);se.insertNode(fe),se.setStartAfter(fe),se.collapse(!0),N.removeAllRanges(),N.addRange(se),F()},[F]),b=(0,z.useCallback)(f=>P(f),[P]),na=(0,z.useCallback)(()=>ne(!0),[ne]),We=(0,z.useCallback)(()=>ne(!1),[ne]),$e=(0,z.useCallback)(()=>E.current?.focus(),[]),Ze=(0,z.useCallback)(()=>E.current?.blur(),[]),Xe=(0,z.useCallback)(()=>{let f=E.current;return f?(0,U.extractPlainText)(f):""},[]),Ge=ci()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:Ge,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":R,"aria-expanded":y,"aria-activedescendant":ee,spellCheck:!0,enterKeyHint:"send",onInput:p,onKeyDown:b,onCompositionStart:T,onCompositionEnd:oa,onPaste:Be,onFocus:na,onBlur:We},getPlainText:Xe,focus:$e,blur:Ze}}var Ae=require("react/jsx-runtime");function pi(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Ct=(0,j.forwardRef)(function({onSubmit:t,onResult:a,onError:i,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:v,language:x,currency:k,productId:w,visitorId:u,columns:h,pillPlacement:y="dropdown",mode:R="auto",optionsPosition:ee="below",animations:B=!0,optionsStyle:D="floating",dropdownTrigger:he,closeDropdownOnBlur:P,prependPlaceholder:H,allOption:oe,showNonTappableOptions:G,locationSearch:ge,showOptionIcons:ne=!0,showChipIcons:E=!0,showChipImages:Q=!0,showChipRemove:Y=!1,showOptionImages:re=!0,showOptionCounts:xe=!0,showSkipButton:I,showProducts:F,productsLayout:p,productImageFallback:T,autoFocus:oa=!0,onFocus:Be,onBlur:b,value:na,completedParams:We,onChange:$e,onParamsChange:Ze,products:Xe,mapProducts:Ge,onProductSelect:f,onProductAddToCart:C,submitButton:S,resetOnSubmit:O=!0,seeAllResults:N=!1},se){let fe=(0,j.useRef)(null),Re=(0,j.useRef)(null),Te=(0,j.useRef)(null),ra=(0,j.useRef)(()=>{}),le=(0,j.useRef)(null),Ke=(0,j.useRef)(null);(0,j.useEffect)(()=>{let K=fe.current;if(K)return le.current?le.current.setMode(R):le.current=new Fe.ModeController(K,R),()=>{le.current?.destroy(),le.current=null}},[R]);let sa=(0,j.useCallback)(K=>{let be=Ke.current?.current;be&&(be.focus(),(0,Fe.setCursorOffset)(be,K))},[]),{completedParams:fa,suggestionPills:Oe,setActivePill:ha,skipActivePill:Je,segments:g,newParamId:qe,clearNewParamId:la,placeholderText:n,isFocused:m,isDropdownOpen:_e,isActivePillSelected:Ve,isLoading:Le,isReady:Ue,activeIndex:ea,listboxId:ze,handleTextChange:ba,handleCompositionText:Qe,handleKeyDown:De,setFocused:aa,editingParam:da,editingIdentified:ua,editingAnchor:Ye,caretOffset:ca,startEditingParam:c,removeParam:$,handleCaretAfterInput:W,handleCaretMove:ma,replaceEditingRange:M,dropdownProps:Ga,reset:Ca,refreshProducts:Ka,prepareSubmit:qa,getState:_a,recordSubmit:Va}=Oa({onSubmit:K=>ra.current(K),onResult:a,onError:i,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:v,language:x,currency:k,productId:w,visitorId:u,columns:h,dropdownTrigger:he,optionsPosition:ee,closeDropdownOnBlur:P,prependPlaceholder:H,allOption:oe,showNonTappableOptions:G,locationSearch:ge,showOptionIcons:ne,showOptionImages:re,showOptionCounts:xe,showSkipButton:I,showProducts:F,onFocus:Be,onBlur:b,value:na,completedParams:We,onChange:$e,onParamsChange:Ze,products:Xe,mapProducts:Ge,onProductSelect:f,onProductAddToCart:C,source:"full-sdk",setCursor:sa});(0,j.useEffect)(()=>{if(!qe)return;let K=window.setTimeout(()=>la(),650);return()=>window.clearTimeout(K)},[qe,la]);let St=ea>=0?`${ze}-option-${ea}`:void 0,{inputRef:za,editorProps:Tt,focus:Sa,blur:Ua,getPlainText:Qa}=kt({segments:g,newParamId:qe,editingParam:da,editingIdentified:ua,editingAnchor:Ye,caretOffset:ca,placeholderText:n,hintSuggestions:y==="inline"?[]:Oe,isFocused:m,showChipIcons:E,showChipImages:Q,showChipRemove:Y,removeParam:$,isDropdownOpen:_e,listboxId:ze,activeDescendantId:St,autoFocus:oa,handleTextChange:ba,handleCompositionText:Qe,handleKeyDown:De,handleCaretAfterInput:W,handleCaretMove:ma,startEditingParam:c,replaceEditingRange:M,setFocused:aa});Ke.current=za,(0,j.useLayoutEffect)(()=>{let K=Re.current,be=za.current;if(!K||!be)return;let va=()=>{let ja=K.firstElementChild;if(!ja)return;let Ot=ja.getBoundingClientRect(),Lt=be.getBoundingClientRect();Ot.top>=Lt.bottom-2?K.setAttribute("data-aia-pill-wrapped",""):K.removeAttribute("data-aia-pill-wrapped")};va();let Ya=new ResizeObserver(va);return Ya.observe(be),()=>Ya.disconnect()},[g,Oe.length,Le,za]),(0,j.useEffect)(()=>{let K=Te.current;if(K)return(0,Fe.watchEditorHeight)(K)},[]),(0,j.useImperativeHandle)(se,()=>({focus:Sa,blur:Ua,reset:Ca,refreshProducts:Ka,setMode:K=>le.current?.setMode(K),skipActivePill:Je}),[Sa,Ua,Ca,Ka,Je]);let ga=!!g.length||fa.length>0,wa=(0,j.useCallback)(K=>{if(!ga)return;K&&qa();let be=_a(),va=(0,Fe.buildSubmitResult)(Qa(),be.completedParams,be.skippedParams,{identifiedParams:be.identifiedParams,isReady:be.isReady,customFields:be.customFields});K&&Va(va),t(va),O&&Ca()},[Va,O,ga,qa,_a,t,Ca,Qa]);ra.current=()=>wa(!1);let Pt=N&&!Ga.isInputEmpty&&ga,It=(0,j.useCallback)(()=>wa(!0),[wa]),Et=(0,j.useCallback)(K=>{K.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||Sa()},[Sa]),At=y==="inline",Rt=y==="dropdown";return(0,Ae.jsxs)("div",{ref:fe,className:`magicx-aia ${pa.container} ${r??""}`,"data-pill-placement":y,"data-options-position":ee,"data-animations":B?"on":"off","data-aia-options-style":D,"data-mode":pi(R),children:[(0,Ae.jsx)(Aa,{...Ga,showPills:Rt,productsLayout:p,productImageFallback:T,onSeeAllResults:Pt?It:void 0,fullWidth:N}),(0,Ae.jsxs)("div",{className:pa.inputWrapper,"data-aia-input-wrapper":"",onClick:Et,children:[(0,Ae.jsxs)("div",{ref:Te,className:pa.editorArea,"data-aia-editor":"",children:[(0,Ae.jsx)("div",{...Tt,className:pa.input,"data-aia-input":""}),At&&(Le||Oe.length>0)&&(0,Ae.jsx)("span",{ref:Re,className:pa.pillListContainer,"data-aia-pill-list-container":"",children:(0,Ae.jsx)(Ia,{pills:Oe,activePillIndex:0,activeSelected:Ve,onSelectPill:ha,loading:Le})})]}),S===null?null:S===void 0?(0,Ae.jsx)(wt,{disabled:!ga,ready:ga&&Ue,onClick:()=>wa(!0),label:(0,Fe.uiStringsFor)(x).submit}):(0,Ae.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:pa.submitSlot,onClick:K=>{ga&&(K.stopPropagation(),wa(!0))},children:S})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,LOCATION_META_KEY,PRODUCT_PATH_PREFIX,TIME_META_KEY,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,formatPlace,formatTime,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSources,optionImageSrc,optionLabel,optionsShowLeadingVisuals,parseDate,parseLooseDate,parseLooseDateRange,parseTime,productFromMatchedItem,productImageSources,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
3779
3787
|
//# sourceMappingURL=index.js.map
|