@magicx-eng/ai-autocomplete-react 0.59.2 → 0.60.1
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.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +14 -14
- 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.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{buildSubmitResult as
|
|
1
|
+
import{buildSubmitResult as hs,cellDay as us,cellIso as ms,DATE_RANGE_META_END as gs,DATE_RANGE_META_START as fs,DEFAULT_OPTION_COUNT_UNIT as bs,dateCellMarks as ws,formatDate as vs,formatDateRange as xs,formatOptionCount as ys,formatPlace as ks,formatTime as Cs,isoDate as Ss,LOCATION_META_KEY as Ts,monthLabel as Ps,optionCountLabel as Is,optionHasImage as Es,optionImageSources as As,optionImageSrc as Rs,optionLabel as Os,optionsShowLeadingVisuals as Ls,PRODUCT_PATH_PREFIX as zs,parseDate as Ds,parseLooseDate as Ms,parseLooseDateRange as Ns,parseTime as Fs,productFromMatchedItem as Hs,productImageSources as Bs,productsFromCustomFields as Ws,sanitizeOptionIconSvg as Gs,selectedRangeFor as Ks,TIME_META_KEY as qs,visibleDateRange as _s,WEEKDAY_LABELS as Vs,withSkippedParams as Us}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as $o,useCallback as ka,useEffect as Fa,useImperativeHandle as Zo,useLayoutEffect as Xo,useRef as ia}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-container-KKjFU {
|
|
2
2
|
position: relative;
|
|
3
3
|
/* Inherits the host page's font by default. Consumers can pin a specific
|
|
4
4
|
font on the library via \`--aia-font-family: 'Custom Font'\` without
|
|
@@ -406,7 +406,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
406
406
|
transition: none;
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
`,document.head.appendChild(e)}var Ve={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"};import{attachScrollArrow as
|
|
409
|
+
`,document.head.appendChild(e)}var Ve={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"};import{attachScrollArrow as no,attachViewportFit as ro,containScroll as so,dateFloorFor as lo,destroyPanelMorph as co,findMultiSelectDone as po,fitMultiSelectDone as ho,hasSkippablePill as uo,isCalendarFormat as mo,labelTraditionalAutocomplete as go,panelMorphKey as fo,queryLive as bo,settlePanelMorph as wo,syncPanelHug as vo,uiStringsFor as xo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Qe,useLayoutEffect as La,useRef as Je,useState as yo}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
410
410
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
411
411
|
* Consumer CSS always wins without !important.
|
|
412
412
|
*
|
|
@@ -1724,7 +1724,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
1724
1724
|
opacity: 1;
|
|
1725
1725
|
}
|
|
1726
1726
|
}
|
|
1727
|
-
`,document.head.appendChild(e)}var se={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};import{cellDay as
|
|
1727
|
+
`,document.head.appendChild(e)}var se={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBar:"aia-skeletonBar-O3xIx",multiDone:"aia-multiDone-y12U7",seeAllRow:"aia-seeAllRow-icrau",seeAll:"aia-seeAll-0Zbgc",multiActionsLoadingOut:"aia-multiActionsLoadingOut-lSdMh",multiActionsFadeIn:"aia-multiActionsFadeIn-zbGTG",seeAllLoadingOut:"aia-seeAllLoadingOut-THnrl",seeAllFadeIn:"aia-seeAllFadeIn-1GWpl"};import{cellDay as Kt,cellIso as da,dateCellMarks as qt,isDimmedDay as _t,isoDate as Vt,monthLabel as Ut,visibleDateRange as Qt,WEEKDAY_LABELS as Yt}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as jt}from"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) ---
|
|
1728
1728
|
|
|
1729
1729
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1730
1730
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -1921,7 +1921,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
1921
1921
|
opacity: 0.8;
|
|
1922
1922
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1923
1923
|
}
|
|
1924
|
-
`,document.head.appendChild(e)}var K={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"};import{jsx as
|
|
1924
|
+
`,document.head.appendChild(e)}var K={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"};import{jsx as we,jsxs as Ya}from"react/jsx-runtime";var $t=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ja({options:e,activeIndex:n,listboxId:a,view:t,selection:o,onSelect:s,onHighlight:r,onUnhighlight:l,onPreviousMonth:w,onNextMonth:v}){let y=Vt(new Date),b=Qt({pendingStart:o.rangeStart,highlightedIso:da(e[n]),selected:o.selectedRange,floor:o.floor});return Ya("div",{className:K.datepicker,"data-aia-datepicker":"",children:[Ya("div",{className:K.header,children:[we("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:w,children:"\u2039"}),we("span",{className:K.month,"data-aia-date-month":"","aria-live":"polite",children:Ut(t)}),we("button",{type:"button",tabIndex:-1,className:K.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:v,children:"\u203A"})]}),we("div",{className:K.weekdays,"aria-hidden":"true",children:Yt.map((h,p)=>we("span",{className:K.weekday,children:h},$t[p]))}),we("div",{className:K.grid,"data-aia-date-grid":"",children:e.map((h,p)=>we(Zt,{option:h,id:`${a}-option-${p}`,index:p,isHighlighted:p===n&&h.is_tappable,isToday:da(h)===y,isPast:_t(da(h),y,o.floor),marks:qt(da(h),{selectedIso:o.selectedIso,range:b,references:o.references}),onSelect:s,onHighlight:r,onUnhighlight:l},da(h)??`pad-${p}`))})]})}function Zt({option:e,id:n,index:a,isHighlighted:t,isToday:o,isPast:s,marks:r,onSelect:l,onHighlight:w,onUnhighlight:v}){let[y,b]=jt(!1),h=Kt(e);if(h==null)return we("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${K.cell} ${K.blank}`});let p=()=>{b(!0),l(e),setTimeout(()=>b(!1),170)},x=[K.cell,K.day,s?K.past:"",t?K.highlighted:"",o?K.today:"",r.inRange?K.inRange:"",r.selected?K.selected:"",r.reference?K.reference:"",y?K.pressed:""].filter(Boolean).join(" ");return we("div",{id:n,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":t,"aria-label":e.text,tabIndex:0,className:x,onClick:p,onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),p())},onMouseEnter:()=>w(a),onMouseLeave:v?()=>v(a):void 0,children:we("span",{className:K.number,children:h})})}import{ATTRIBUTION_URL as Xt,buildAttributionUrl as Jt,getFooterHint as ei,uiStringsFor as ai}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ti,useState as ii}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
|
|
1925
1925
|
display: flex;
|
|
1926
1926
|
flex-wrap: wrap;
|
|
1927
1927
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -1961,7 +1961,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
1961
1961
|
.aia-cluster[data-justify="around"] {
|
|
1962
1962
|
justify-content: space-around;
|
|
1963
1963
|
}
|
|
1964
|
-
`,document.head.appendChild(e)}import{jsx as
|
|
1964
|
+
`,document.head.appendChild(e)}import{jsx as $a}from"react/jsx-runtime";function ca({gap:e,align:n="center",justify:a="start",noWrap:t=!1,inline:o=!1,className:s,children:r,...l}){let w=e?{"--aia-cluster-gap":e}:void 0,v={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":n,"data-justify":a,"data-nowrap":t||void 0,"data-inline":o||void 0,style:w,...l};return o?$a("span",{...v,children:r}):$a("div",{...v,children:r})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
|
|
1965
1965
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
1966
1966
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
1967
1967
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -2108,7 +2108,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
2108
2108
|
justify-content: flex-end;
|
|
2109
2109
|
}
|
|
2110
2110
|
}
|
|
2111
|
-
`,document.head.appendChild(e)}var
|
|
2111
|
+
`,document.head.appendChild(e)}var Re={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"};import{jsx as pa,jsxs as Sa}from"react/jsx-runtime";function Za({isOptionHighlighted:e=!1,isInputEmpty:n=!1,strings:a=ai()}){let{key:t,hint:o}=ei(e,n,a),[s,r]=ii(Xt);return ti(()=>{r(Jt())},[]),pa("footer",{className:Re.footer,"data-aia-footer":"",children:Sa(ca,{justify:"between",noWrap:!0,className:Re.row,children:[Sa(ca,{gap:"5px",className:Re.hintGroup,children:[pa("kbd",{className:Re.key,children:t}),pa("span",{className:Re.hint,children:o})]}),Sa("a",{className:Re.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[pa("span",{className:Re.brand,children:"AI"}),pa("span",{className:Re.badge,children:"Autocomplete"})]})]})})}import{useEffect as Xa,useLayoutEffect as oi,useRef as le}from"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
|
|
2112
2112
|
Angular copy). The three are kept identical by
|
|
2113
2113
|
packages/vanilla/tests/render/locationFieldParity.test.ts. */
|
|
2114
2114
|
.aia-location-6-fsr {
|
|
@@ -2242,7 +2242,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
2242
2242
|
.aia-loadingBar-OLCr4:nth-child(3) {
|
|
2243
2243
|
width: 60%;
|
|
2244
2244
|
}
|
|
2245
|
-
`,document.head.appendChild(e)}var
|
|
2245
|
+
`,document.head.appendChild(e)}var _={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"};import{jsx as ne,jsxs as Fe}from"react/jsx-runtime";var ni=0;function ha(e){return e.getRootNode().activeElement??null}function at(e){return e.getRootNode().getSelection?.()??document.getSelection()}function Ja(e){if(!e.isContentEditable)return null;let n=at(e);if(!n||n.rangeCount===0)return null;let a=n.getRangeAt(0);return e.contains(a.startContainer)?a.cloneRange():null}function et(e,n){if(e.focus({preventScroll:!0}),!e.isContentEditable)return;let a=at(e);if(!a)return;let t=n;(!t||!t.startContainer.isConnected||!e.contains(t.startContainer))&&(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1)),a.removeAllRanges(),a.addRange(t)}var ri=Fe("svg",{className:_.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[ne("path",{d:"M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z"}),ne("circle",{cx:"12",cy:"9.5",r:"2.5"})]}),si=Fe("svg",{className:_.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[ne("circle",{cx:"11",cy:"11",r:"7"}),ne("path",{d:"m20 20-3.5-3.5"})]});function tt({view:e,searchLabel:n,noResultsLabel:a,useTypedLabel:t,widgetFocused:o,reediting:s=!1,visible:r=!0,interactive:l=!0,onQuery:w,onMove:v,onCommit:y,onFocusChange:b}){let h=le(null),p=le(null),x=le(null),E=le(null),q=le(null),M=le(!1),R=le(!1),ae=le(!1),T=le(!1),z=le(o);z.current=o;let U=le(b);U.current=b;let F=c=>{T.current=c,b(c)},te=()=>{let c=h.current;return c!=null&&ha(c)===c},Q=()=>{let c=p.current;if(!c)return;let S=ha(c);S instanceof HTMLElement&&S!==h.current&&S!==document.body&&!c.contains(S)&&(E.current=S,q.current=Ja(S))},P=c=>{let S=p.current;!S||!(c instanceof HTMLElement)||c===E.current||c===document.body||S.contains(c)||(E.current=c,q.current=Ja(c))},B=le(null);B.current===null&&(B.current=`aia-location-${++ni}`);let W=`${B.current}-row-`;Xa(()=>{let c=h.current;c&&c.value!==e.query&&ha(c)!==c&&(c.value=e.query)},[e.query]),Xa(()=>{o&&(s&&!ae.current&&(R.current=!1),ae.current=s);let c=h.current;if(c){if(!r&&te()){R.current=!0,Y();return}if(!o){setTimeout(()=>{if(z.current)return;let S=E.current;S&&ha(S)===S||(R.current=!1)},0);return}if(!(!s||R.current||!l||te())){if(Q(),F(!0),c.focus({preventScroll:!0}),!te()){R.current=!0,F(!1);return}c.value&&c.select()}}}),oi(()=>()=>{if(!T.current)return;let c=h.current,S=E.current;S?.isConnected&&c&&ha(c)===c&&(M.current=!0,et(S,q.current),M.current=!1),T.current=!1,U.current(!1)},[]);let Y=(c=!1)=>{c&&(R.current=!0);let S=E.current;S?.isConnected&&te()&&(M.current=!0,et(S,q.current),M.current=!1),F(!1)},re=e.query.trim(),I=e.highlighted>=0&&e.highlighted<e.places.length?`${W}${e.highlighted}`:void 0,D=null;return e.places.length>0?D=e.places.map((c,S)=>Fe("div",{id:`${W}${S}`,role:"option","aria-selected":S===e.highlighted,className:S===e.highlighted?`${_.row} ${_.highlighted}`:_.row,"data-aia-location-row":"","data-aia-index":S,onClick:()=>{l&&(Y(!0),y(S))},children:[ne("span",{className:_.pin,children:ri}),Fe("span",{className:_.text,children:[ne("span",{className:_.name,children:c.name}),c.secondary&&ne("span",{className:_.secondary,children:c.secondary})]})]},c.id)):e.status==="loading"?D=Fe("div",{className:_.loading,"data-aia-location-loading":"",children:[ne("span",{className:_.loadingBar}),ne("span",{className:_.loadingBar}),ne("span",{className:_.loadingBar})]}):re&&(D=Fe("div",{className:_.note,"data-aia-location-note":"",children:[e.status==="done"&&ne("span",{className:_.empty,children:a}),ne("span",{children:t})]})),Fe("div",{ref:p,className:_.location,"data-aia-location":"",onMouseDown:c=>{!(c.target instanceof Node)||!x.current?.contains(c.target)||(c.stopPropagation(),Q(),F(!0))},children:[Fe("label",{ref:x,className:_.field,children:[si,ne("input",{ref:h,type:"text",className:_.input,"data-aia-location-input":"",defaultValue:e.query,placeholder:n,"aria-label":n,"aria-activedescendant":I,autoComplete:"off",autoCapitalize:"words",enterKeyHint:"done",spellCheck:!1,tabIndex:r?0:-1,onChange:c=>w(c.target.value),onFocus:c=>{P(c.relatedTarget),F(!0)},onBlur:()=>{M.current||(R.current=!0,F(!1))},onKeyDown:c=>{if(!c.nativeEvent.isComposing)switch(c.key){case"ArrowDown":case"ArrowUp":c.preventDefault(),v(c.key==="ArrowDown"?1:-1);return;case"Enter":if(c.preventDefault(),!l)return;Y(!0),y();return;case"Escape":c.preventDefault(),c.stopPropagation(),R.current=!0,Y();return;case"Backspace":if(c.currentTarget.value!=="")return;c.preventDefault(),R.current=!0,Y();return}}})]}),ne("div",{className:_.results,"data-aia-location-results":"","aria-live":"polite",children:D})]})}import{isSmartSuggestion as pi,isTraditionalAutocompleteSuggestion as hi}from"@magicx-eng/ai-autocomplete-vanilla";import{SMART_SUGGESTION_SPARKLE_SVG as li}from"@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
2246
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
2247
2247
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
2248
2248
|
as it was when the outline was dashed. */
|
|
@@ -2400,7 +2400,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
2400
2400
|
opacity: 0;
|
|
2401
2401
|
}
|
|
2402
2402
|
}
|
|
2403
|
-
`,document.head.appendChild(e)}var
|
|
2403
|
+
`,document.head.appendChild(e)}var ve={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",smartText:"aia-smartText-R0cfw","smartSuggestion-shimmer":"aia-smartSuggestion-shimmer-F-yoD",smartSparkle:"aia-smartSparkle-IVabG","smartSuggestion-sparkle":"aia-smartSuggestion-sparkle-Wfj-4","smartSuggestion-sparkle-small":"aia-smartSuggestion-sparkle-small-3VsWJ",skeleton:"aia-skeleton-57P0T",loadingOut:"aia-loadingOut-Aj9xO"};import{Fragment as di,jsx as Ta,jsxs as ci}from"react/jsx-runtime";var Pa={selected:1,first:.7,next:.4,last:.2};function it({label:e,state:n,active:a,rounded:t,loading:o,smartSuggestion:s,completionHeader:r,onClick:l}){let w=[ve.pill,t?ve.rounded:"",o?ve.skeleton:""].filter(Boolean).join(" ");return Ta("button",{type:"button","data-aia-pill":"","data-aia-pill-active":a?"":void 0,"data-aia-loading":o?"":void 0,"data-aia-smart-suggestion":s?r?"header":"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:w,style:{"--aia-pill-opacity":Pa[n]},onMouseDown:v=>v.preventDefault(),onClick:o?void 0:l,disabled:o,children:s?ci(di,{children:[Ta("span",{className:`${ve.smartText} magicx-aia-smart-suggestion-text`,children:e}),Ta("span",{className:`${ve.smartSparkle} magicx-aia-smart-suggestion-sparkle`,dangerouslySetInnerHTML:{__html:li}})]}):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 {
|
|
2404
2404
|
position: relative;
|
|
2405
2405
|
z-index: 1;
|
|
2406
2406
|
pointer-events: auto;
|
|
@@ -2410,7 +2410,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
2410
2410
|
align-items: center;
|
|
2411
2411
|
vertical-align: middle;
|
|
2412
2412
|
}
|
|
2413
|
-
`,document.head.appendChild(e)}var Ia={list:"aia-list-qvLqO"};import{jsx as fa}from"react/jsx-runtime";var
|
|
2413
|
+
`,document.head.appendChild(e)}var Ia={list:"aia-list-qvLqO"};import{jsx as fa}from"react/jsx-runtime";var ui=[125,69];function ot(e){return e===0?"first":e===1?"next":"last"}function ba({pills:e,activePillIndex:n,onSelectPill:a,activeSelected:t,rounded:o,loading:s}){return s&&e.length===0?fa("span",{className:Ia.list,"data-aia-pill-list-loading":"",children:ui.map((r,l)=>fa("span",{"data-aia-pill-skeleton":"",className:`${ve.pill} ${o?ve.rounded:""} ${ve.skeleton}`,style:{width:r,"--aia-pill-opacity":Pa[ot(l)]}},`skel-${r}`))}):fa("span",{className:Ia.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((r,l)=>{let w=!!t&&l===n;return fa(it,{label:r.text,state:w?"selected":ot(l),selected:w,active:l===n,rounded:o,loading:s,smartSuggestion:pi(r),completionHeader:hi(r),onClick:()=>a(l)},`${r.parameter}-${r.text}`)})})}import{attachProductRowWheel as mi,productImageSources as gi,productImageSrc as fi,productInitial as bi,productPhotoFill as wi,uiStringsFor as vi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ea,useRef as wa,useState as va}from"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
2414
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
2415
2415
|
theming one package sees the same result in the other.
|
|
2416
2416
|
|
|
@@ -3003,7 +3003,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
3003
3003
|
opacity: 0.01;
|
|
3004
3004
|
}
|
|
3005
3005
|
}
|
|
3006
|
-
`,document.head.appendChild(e)}var
|
|
3006
|
+
`,document.head.appendChild(e)}var V={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"};import{jsx as J,jsxs as Xe}from"react/jsx-runtime";function nt({products:e,listboxId:n,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s=!0,loading:r=!1,layout:l="row",imageFallback:w="image",strings:v=vi()}){let y=e.length>0,b=wa(null);if(Ea(()=>{let p=b.current;if(!(!y||!p))return mi(p)},[y]),!y)return null;let h=`${n}-products-label`;return Xe("section",{className:V.section,"data-aia-products":"","data-aia-loading":r?"":void 0,"data-aia-products-layout":l,role:"group","aria-labelledby":h,children:[J("div",{className:V.label,id:h,"data-aia-products-label":"",children:v.products}),J("div",{ref:b,className:V.row,"data-aia-products-row":"",children:e.map((p,x)=>J(xi,{product:p,id:`${n}-product-${x}`,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s,imageFallback:w,soldOut:v.soldOut,addToCart:v.addToCart},p.id))})]})}function xi({product:e,id:n,onSelect:a,onAddToCart:t,onFocusChange:o,focusable:s,imageFallback:r,soldOut:l,addToCart:w}){let v=!!t&&e.available!==!1,[y,b]=va(null),h=x=>{x.relatedTarget?.closest("[data-aia-dropdown]")||o?.(!1)},p=x=>{x.metaKey||x.ctrlKey||x.shiftKey||x.altKey||x.button!==0||(x.preventDefault(),a(e))};return Xe("a",{id:n,className:V.card,"data-aia-product":"","data-aia-product-sold-out":e.available===!1?"":void 0,"data-aia-product-has-cart":v?"":void 0,role:"option","aria-selected":!1,style:y?{"--aia-product-photo-fill-x":String(y.x),"--aia-product-photo-fill-y":String(y.y)}:void 0,href:e.url,tabIndex:s?0:-1,onClick:p,onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),a(e))},onFocus:()=>o?.(!0),onBlur:h,children:[J(Ci,{sources:gi(e.imageUrl),title:e.title,fallback:r,onPhotoFill:b},fi(e.imageUrl)??""),Xe("span",{className:V.body,children:[e.vendor?J("span",{className:V.vendor,children:e.vendor}):null,J("span",{className:V.title,children:e.title}),e.price?Xe("span",{className:V.price,children:[e.price,e.compareAtPrice?J("s",{className:V.compareAt,children:e.compareAtPrice}):null]}):null,e.available===!1?J("span",{className:V.badge,children:l}):null]}),v&&t?J(ki,{product:e,label:`${w}: ${e.title}`,focusable:s,onAddToCart:t,onFocus:()=>o?.(!0),onBlur:h},yi(e)):null]})}function yi(e){return[e.id,e.title,e.url,e.imageUrl,e.vendor].map(n=>n??"").join("\0")}function ki({product:e,label:n,focusable:a,onAddToCart:t,onFocus:o,onBlur:s}){let[r,l]=va(null),w=wa(null),v=wa(e);v.current=e;let y=wa(!0);Ea(()=>(y.current=!0,()=>{y.current=!1}),[]);let b=p=>{w.current=p,y.current&&l(p)},h=p=>{if(p.preventDefault(),p.stopPropagation(),w.current==="adding")return;b("adding");let x;try{x=Promise.resolve(t(v.current))}catch(E){x=Promise.reject(E)}x.then(()=>b("added"),()=>b(null))};return J("span",{className:V.cart,"data-aia-product-cart":"","data-aia-cart-state":r??void 0,"aria-busy":r==="adding"?!0:void 0,role:"button","aria-label":n,tabIndex:a?0:-1,onClick:h,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||h(p)},onFocus:p=>{p.stopPropagation(),o()},onBlur:p=>{p.stopPropagation(),s(p)},children:Xe("svg",{viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[J("path",{className:V.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"}),J("path",{className:V.cartGlyph,d:"M13.5 6.5v-4M11.5 4.5h4"}),J("path",{className:V.cartCheck,d:"M5 12.5l4.5 4.5L19 7.5"}),J("path",{className:V.cartSpinner,d:"M12 4a8 8 0 1 0 8 8"}),J("circle",{className:V.cartGlyph,cx:"9",cy:"20",r:"1.3"}),J("circle",{className:V.cartGlyph,cx:"17.5",cy:"20",r:"1.3"})]})})}function Ci({sources:e,title:n,fallback:a,onPhotoFill:t}){let[o,s]=va(0),r=e[o],l=!!r,[w,v]=va(null),y=!l&&a==="initial";return Ea(()=>()=>t(null),[t]),Xe("span",{className:V.media,"aria-hidden":"true","data-aia-product-placeholder":!l&&!y?"":void 0,"data-aia-product-initial":y?"":void 0,"data-aia-image-loaded":l&&w===r?"":void 0,children:[l?J("img",{className:V.image,src:r,alt:"",loading:"lazy",decoding:"async",onLoad:b=>{v(r),t(wi(b.currentTarget.naturalWidth,b.currentTarget.naturalHeight))},onError:()=>{o+1>=e.length&&t(null),s(b=>b+1)}}):null,y?bi(n):null]})}import{isOptionsGridMobileViewport as Fi,measureOptionsGrid as Hi,needsOptionsGridMeasurement as Bi,OPTIONS_GRID_MOBILE_QUERY as Wi,optionEnterDelayMs as Gi,optionsShowLeadingVisuals as Ki,planOptionsGrid as ct,releasePanelHug as qi,sameOptionRows as _i,syncPanelHug as Vi}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ui,useLayoutEffect as pt,useRef as ht,useState as mt}from"react";import{optionsGridTemplateColumns as Si}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as Ti,useRef as Pi}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
|
|
3007
3007
|
display: grid;
|
|
3008
3008
|
grid-template-columns: repeat(
|
|
3009
3009
|
auto-fit,
|
|
@@ -3047,7 +3047,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
3047
3047
|
:where([data-aia-options-style="classic"]) .aia-grid[data-scroll] {
|
|
3048
3048
|
max-height: var(--aia-grid-max-height, 120px);
|
|
3049
3049
|
}
|
|
3050
|
-
`,document.head.appendChild(e)}import{jsx as
|
|
3050
|
+
`,document.head.appendChild(e)}import{jsx as Ii}from"react/jsx-runtime";function rt({min:e="16rem",max:n,gap:a,scroll:t=!1,maxHeight:o,scrollResetKey:s,cols:r,template:l,innerRef:w,className:v,children:y,...b}){let h=Pi(null);Ti(()=>{if(s===void 0)return;let x=h.current;x&&(x.scrollTop=0)},[s]);let p={"--aia-grid-min":e};return n&&(p["--aia-grid-max"]=n),a&&(p["--aia-grid-gap"]=a),o&&(p["--aia-grid-max-height"]=o),r&&(p.gridTemplateColumns=Si(r)),l&&(p.gridTemplateColumns=l),Ii("div",{ref:x=>{h.current=x,w?.(x)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":t||void 0,style:p,...b,children:y})}import{formatOptionCount as Ei,highlightParts as Ai,isMultiSelectToggleTap as Ri,OPTION_ENTER_DELAY_VAR as Oi,optionImageSources as st,optionLabel as lt,sanitizeOptionIconSvg as Li}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as zi,useMemo as Di,useRef as Mi,useState as ua}from"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 {
|
|
3051
3051
|
position: relative;
|
|
3052
3052
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
3053
3053
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -3567,7 +3567,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
3567
3567
|
border-radius: 6px;
|
|
3568
3568
|
font-size: 11px;
|
|
3569
3569
|
}
|
|
3570
|
-
`,document.head.appendChild(e)}var Z={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"};import{Fragment as
|
|
3570
|
+
`,document.head.appendChild(e)}var Z={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"};import{Fragment as Ni,jsx as ce,jsxs as Aa}from"react/jsx-runtime";function dt({option:e,isHighlighted:n,checked:a,onSelect:t,onHighlight:o,onUnhighlight:s,id:r,loading:l,showIcon:w=!0,showImage:v=!0,showCount:y=!0,scrollHint:b,enterDelayMs:h=0}){let[p]=ua(h),[x,E]=ua(!1),q=v?st(e.image_url):[],M=q[0]??null,[R,ae]=ua([]),T=q.find(I=>!R.includes(I))??null,z=v?(e.imageCollage??[]).map(I=>st(I)[0]).filter(I=>I!==void 0):[],[U,F]=ua(!1),[te,Q]=ua(null),P=Di(()=>!M&&w&&e.icon_svg?Li(e.icon_svg):null,[M,w,e.icon_svg]),B=y?Ei(e.item_count):null,W=Mi(void 0);zi(()=>()=>clearTimeout(W.current),[]);let Y=I=>{if(l||!e.is_tappable||x&&a===void 0)return;E(!0);let D=I?.currentTarget;a!==void 0&&D!==void 0&&I!==void 0&&!Ri(D,D.querySelector("[data-aia-checkbox]"),I)?t(e,{commit:!0}):t(e),clearTimeout(W.current),W.current=setTimeout(()=>E(!1),170)},re=[Z.item,n&&!l?Z.highlighted:"",e.liveMatch&&!l?Z.liveMatch:"",e.is_tappable?Z.tappable:Z.nonTappable,x?Z.pressed:"",b?Z.scrollHint:""].filter(Boolean).join(" ");return ce("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"data-aia-icon":P&&e.icon?e.icon:void 0,"data-aia-image":M?"":void 0,"data-aia-item-count":B!==null?e.item_count:void 0,"aria-selected":a??n,className:re,style:{[Oi]:`${p}ms`},tabIndex:l||!e.is_tappable?-1:0,onClick:Y,onKeyDown:I=>{!l&&e.is_tappable&&(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),Y())},onMouseEnter:!l&&e.is_tappable?o:void 0,onMouseLeave:s,children:Aa("span",{className:Z.content,children:[a!==void 0&&e.is_tappable&&ce("span",{className:Z.checkbox,"aria-hidden":"true","data-aia-checkbox":"","data-checked":a,children:a?"\u2713":""}),M&&z.length>1&&ce("span",{className:`${Z.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-collage":z.length,"data-aia-image-loaded":U?"":void 0,children:z.map(I=>ce("img",{src:I,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,onLoad:()=>F(!0),onError:D=>{D.currentTarget.hidden=!0}},I))}),M&&z.length<=1&&ce("span",{className:`${Z.image} magicx-aia-option-image`,"aria-hidden":"true","data-aia-image-loaded":T!==null&&te===T?"":void 0,children:ce("img",{src:T??M,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:T===null,onLoad:()=>Q(T),onError:()=>{T!==null&&ae(I=>[...I,T])}})}),P&&ce("span",{className:`${Z.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:P}}),Aa("span",{className:Z.text,children:[e.matchedText?Ai(lt(e),e.matchedText).map((I,D)=>I.bold?ce("strong",{className:`${Z.match} magicx-aia-option-match`,children:I.text},D):I.text):lt(e),e.parameterLabel&&Aa(Ni,{children:[" ",ce("span",{className:`${Z.parameter} magicx-aia-option-parameter`,children:e.parameterLabel})]})]}),e.tag&&ce("span",{className:Z.tag,children:e.tag}),B!==null&&ce("span",{className:`${Z.count} magicx-aia-option-count`,children:B})]})})}import{jsx as ut}from"react/jsx-runtime";function Qi(){let[e,n]=mt(Fi);return Ui(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(Wi),t=()=>n(a.matches);return t(),a.addEventListener("change",t),()=>a.removeEventListener("change",t)},[]),e}function gt({options:e,activeIndex:n,picked:a,onSelect:t,onHighlight:o,onUnhighlight:s,listboxId:r,loading:l,groupKey:w="",optionsPosition:v="below",showIcons:y=!0,showImages:b=!0,showCounts:h=!0}){let p=Qi(),x=ht(null),[E,q]=mt(null),M=ht(null);pt(()=>{if(l&&_i(M.current,e))return;M.current=l?null:e;let T=x.current,z=T&&!l&&Bi(e.length,p),U=T?.closest("[data-aia-dropdown]");z&&U&&qi(U);let F=z?Hi(T):null;q(F?ct(e.length,p,F.rowWidths,F.gridWidth):null)},[e,p,l]);let R=E??ct(e.length,p,null,null);pt(()=>{let T=x.current?.closest("[data-aia-dropdown]");T&&Vi(T)},[R.template,p]);let ae=Ki(e,y,b);return ut(rt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:w,template:R.template,maxHeight:R.maxHeight,innerRef:T=>{x.current=T},"data-aia-group":w,children:e.map((T,z)=>ut(dt,{option:T,isHighlighted:z===n,checked:a?a.includes(T.text):void 0,onSelect:t,onHighlight:()=>o(z),onUnhighlight:s?()=>s(z):void 0,id:`${r}-option-${z}`,loading:l,showIcon:y&&ae,showImage:b&&ae,showCount:h,scrollHint:!l&&R.scrollHintIndices.includes(z),enterDelayMs:l?0:Gi(z,R.cols,e.length,v)},`${w}\0${T.parameter??""}\0${T.text}`))})}import{formatTime as Yi,TIME_WHEEL_COLUMNS as ji,TIME_WHEEL_ROW_HEIGHT as $i,timeWheelIndex as ft,timeWheelIndexFromScroll as Zi,timeWheelRows as Xi,withTimeWheelIndex as bt}from"@magicx-eng/ai-autocomplete-vanilla";import{Fragment as Ji,useEffect as eo,useLayoutEffect as ao,useRef as xa}from"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
3571
|
|
|
3572
3572
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
3573
3573
|
time-wheel.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -3689,7 +3689,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
3689
3689
|
.aia-done-llNY5:hover {
|
|
3690
3690
|
background: var(--aia-time-done-bg-hover, var(--aia-done-bg-hover, #d8dde8));
|
|
3691
3691
|
}
|
|
3692
|
-
`,document.head.appendChild(e)}var pe={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"};import{jsx as Ue,jsxs as Ra}from"react/jsx-runtime";var
|
|
3692
|
+
`,document.head.appendChild(e)}var pe={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"};import{jsx as Ue,jsxs as Ra}from"react/jsx-runtime";var to=120;function wt({view:e,label:n,doneLabel:a,interactive:t=!0,onTimeChange:o,onTimeCommit:s}){return Ra("div",{className:pe.timeWheel,"data-aia-time-wheel":"",role:"group","aria-label":n,onMouseDown:r=>r.preventDefault(),children:[Ue("span",{className:pe.value,"data-aia-time-value":"","aria-live":"polite",children:Yi(e.minutes)}),Ra("div",{className:pe.columns,"aria-hidden":"true",children:[Ue("div",{className:pe.band}),ji.map(r=>Ra(Ji,{children:[r==="minute"&&Ue("span",{className:pe.separator,children:":"}),Ue(io,{column:r,minutes:e.minutes,interactive:t,onTimeChange:o})]},r))]}),Ue("button",{type:"button",tabIndex:-1,className:pe.done,"data-aia-time-done":"",onClick:()=>{t&&s()},children:a})]})}function io({column:e,minutes:n,interactive:a,onTimeChange:t}){let o=xa(null),s=xa(null),r=xa(null),l=xa({minutes:n,interactive:a,onTimeChange:t});l.current={minutes:n,interactive:a,onTimeChange:t};let w=ft(e,n);ao(()=>{let b=o.current;if(!b||r.current)return;let h=w*$i;Math.abs(b.scrollTop-h)<1||(s.current=h,b.scrollTop=h)},[w]),eo(()=>()=>{r.current&&clearTimeout(r.current)},[]);let v=()=>{r.current=null;let b=o.current,h=l.current;if(!b||!h.interactive)return;let p=Zi(e,b.scrollTop);p!==ft(e,h.minutes)&&h.onTimeChange(bt(e,h.minutes,p))},y=()=>{let b=o.current;if(b){if(s.current!=null&&Math.abs(b.scrollTop-s.current)<1){s.current=null;return}s.current=null,r.current&&clearTimeout(r.current),r.current=setTimeout(v,to)}};return Ue("div",{ref:o,className:pe.column,"data-aia-time-column":e,onScroll:y,children:Xi(e).map((b,h)=>Ue("div",{className:h===w?`${pe.row} ${pe.selected}`:pe.row,"data-aia-time-row":"","data-aia-index":h,onClick:()=>{l.current.interactive&&t(bt(e,l.current.minutes,h))},children:b.label},b.label))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
|
|
3693
3693
|
display: flex;
|
|
3694
3694
|
flex-direction: column;
|
|
3695
3695
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -3704,7 +3704,7 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
3704
3704
|
align-items: end;
|
|
3705
3705
|
}
|
|
3706
3706
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
3707
|
-
`,document.head.appendChild(e)}import{jsx as
|
|
3707
|
+
`,document.head.appendChild(e)}import{jsx as oo}from"react/jsx-runtime";function vt({space:e,align:n="stretch",className:a,children:t,...o}){let s=e?{"--aia-stack-space":e}:void 0;return oo("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":n,style:s,...o,children:t})}import{jsx as X,jsxs as Oa}from"react/jsx-runtime";var ko=typeof window>"u"?Qe:La,Co=[159,119,164],So=()=>{},xt=()=>{},To=e=>{},Po=()=>{},Io=e=>{},Eo=e=>{},Ao=e=>{},Ro=e=>{};function Oo(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,t]=yo(n);if(Qe(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>t(o.matches);return o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function Lo(e,n){let a=Je(null);Qe(()=>{let t=e.current,o=n.current;if(!t||!o)return;let s=bo(t,".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:no({dropdown:t,grid:s,button:o})};return}a.current?.controller.update()}),Qe(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function zo(e,n){let a=Je(n);a.current=n;let t=Je(null);La(()=>{let o=e.current;if(o){if(!t.current){t.current=ro({dropdown:o,isOpen:()=>a.current});return}t.current.update()}}),Qe(()=>()=>{t.current?.destroy(),t.current=null},[])}function za({suggestions:e,activeIndex:n,onSelect:a,onHighlight:t,onUnhighlight:o,isOpen:s,id:r,className:l,pills:w,onPillClick:v,showPills:y=!0,onSkip:b,showSkipButton:h=!0,showOptionIcons:p=!0,showOptionImages:x=!0,showOptionCounts:E=!0,skipDisabled:q=!1,activeSelected:M=!1,isLoading:R=!1,skeletonExiting:ae=!1,isInputEmpty:T=!1,language:z,products:U,onProductSelect:F,onProductAddToCart:te,onProductFocusChange:Q,productsLayout:P="row",productImageFallback:B="image",formatType:W="options",dateView:Y=null,selectedDateIso:re=null,selectedDateRange:I=null,dateRangeStart:D=null,dateReferences:c,onPreviousMonth:S,onNextMonth:He,timeView:xe=null,multiSelectView:f=null,onMultiSelectCommit:Be,onSeeAllResults:ye,fullWidth:Oe=!1,onTimeChange:Le,onTimeCommit:ze,locationView:ke=null,isReediting:g=!1,onLocationQuery:k,onLocationMove:C,onLocationCommit:A,onLocationFocusChange:L,isFocused:j=!1,optionsPosition:ie="below",mode:ue}){let de=Oo(ue),We=de!==void 0,$=Je(null),Ce=Je(null);Lo($,Ce),Qe(()=>{if($.current)return so($.current)},[]);let Ge=e[0]?.options??[],na=!!(w&&w.length>0&&v),me=!!(U&&U.length>0),Ye=W==="time"&&xe!=null,De=W==="location"&&ke!=null,m=s&&(Ge.length>0||y&&na||R||me||Ye||De);zo($,m),ko(()=>{let O=$.current;O&&(ho(O,po(O)),vo(O))});let Se={suggestions:e,activeIndex:n,pills:w,showPills:y,showSkipButton:h,showOptionIcons:p,showOptionImages:x,showOptionCounts:E,skipDisabled:q,activeSelected:M,isLoading:R,skeletonExiting:ae,isInputEmpty:T,products:U,formatType:W,dateView:Y,selectedDateIso:re,selectedDateRange:I,dateRangeStart:D,dateReferences:c,timeView:xe,multiSelectView:f,locationView:ke,isReediting:g,showsSeeAll:!!ye},Ke=Je(Se);m&&(Ke.current=Se);let i=m?Se:Ke.current,u=xo(z),Te=i.suggestions[0],Pe=Te?.options??[],ge=i.activeIndex>=0&&!!Pe[i.activeIndex]?.is_tappable,Ie=go(i.pills??[],u.keepTyping),Me=!!(Ie.length>0&&v),fe=i.showPills&&Me,ra=i.showPills&&!Me&&i.isLoading,Ee=fe||ra,be=Me&&uo(Ie)&&i.showSkipButton&&!i.isInputEmpty&&!!b,Ne=Ie[0]?.text,qe=mo(i.formatType)&&i.dateView!=null,je=Pe.length>0&&!qe,Ae=Pe.length>0&&qe&&!i.isLoading,_e=i.formatType==="time"&&i.timeView!=null&&!i.isLoading,d=i.formatType==="location"&&i.locationView!=null&&!i.isLoading,G=i.isLoading&&!je&&!Ae&&!_e&&!d,N=i.products??[],$e=fo(fe?Ie:[]);return La(()=>{$.current&&wo($.current,$e,{visible:m,anchorBottom:ie==="above"})},[$e,m,ie,i.suggestions,i.pills,i.isLoading,i.skeletonExiting,i.isInputEmpty,i.products,i.formatType,i.dateView,i.selectedDateIso,i.selectedDateRange,i.dateRangeStart,i.dateReferences,i.timeView,i.multiSelectView,i.locationView,i.showPills,i.showSkipButton,i.showOptionIcons,i.showOptionImages,i.showOptionCounts,i.showsSeeAll,P,z]),Qe(()=>{let O=$.current;return()=>{O&&co(O)}},[]),Oa("div",{ref:$,id:r,role:"listbox","aria-multiselectable":!!i.multiSelectView,"data-aia-dropdown":"","data-options-position":ie,"data-mode":de,"data-aia-loading":i.isLoading?"":void 0,"data-aia-skeleton-exiting":i.skeletonExiting?"":void 0,"data-aia-has-products":N.length>0?"":void 0,"data-aia-full-width":Oe?"":void 0,className:`${We?"magicx-aia ":""}${se.dropdown} ${m?se.visible:""} ${l??""}`,onMouseDown:O=>O.preventDefault(),children:[Oa(vt,{space:"8px",children:[(Ee||be)&&Oa(ca,{noWrap:!0,className:se.pillBar,"data-aia-pillbar":"",children:[Ee&&X("span",{className:se.pillScroll,"data-aia-pill-scroll":"",children:X(ba,{pills:Ie,activePillIndex:0,activeSelected:i.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:i.isLoading})}),be&&X("button",{type:"button",tabIndex:-1,className:se.skip,"data-aia-skip":"",disabled:i.isLoading||i.skipDisabled,"aria-label":Ne?`${u.skipLabel} ${Ne}`:u.skipLabel,onClick:b,children:u.skip})]}),je&&X(gt,{options:Pe,activeIndex:i.activeIndex,onSelect:a,onHighlight:t,onUnhighlight:o,listboxId:r,loading:i.isLoading,groupKey:Te?`${Te.parameter} ${Te.text}`:"",optionsPosition:ie,showIcons:i.showOptionIcons,showImages:i.showOptionImages,showCounts:i.showOptionCounts,picked:i.multiSelectView?.picked}),i.multiSelectView&&X("div",{"data-aia-multi-actions":"",onClick:O=>{O.target.closest("[data-aia-multi-done]")&&!i.skipDisabled&&!i.isLoading&&Be?.()},children:X("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-multi-done":"",className:se.multiDone,ref:O=>{O&&(O.disabled=!0,O.offsetHeight,O.disabled=i.skipDisabled||i.isLoading)},children:u.done})}),Ae&&i.dateView&&X(ja,{options:Pe,activeIndex:i.activeIndex,listboxId:r,view:i.dateView,selection:{selectedIso:i.selectedDateIso??null,selectedRange:i.selectedDateRange??null,rangeStart:i.dateRangeStart??null,floor:lo(i.formatType,i.dateRangeStart),references:i.dateReferences??[]},onSelect:a,onHighlight:t,onUnhighlight:o,onPreviousMonth:S??xt,onNextMonth:He??xt}),_e&&i.timeView&&X(wt,{view:i.timeView,label:u.timeLabel,doneLabel:u.done,interactive:!i.skipDisabled,onTimeChange:Le??To,onTimeCommit:ze??Po}),d&&i.locationView&&X(tt,{view:i.locationView,searchLabel:u.locationSearch,noResultsLabel:u.locationNoResults,useTypedLabel:u.locationUseTyped,widgetFocused:j&&m,reediting:i.isReediting,visible:m,interactive:!i.skipDisabled,onQuery:k??Io,onMove:C??Eo,onCommit:A??Ao,onFocusChange:L??Ro}),G&&X("div",{className:se.skeletonBars,"data-aia-skeleton-bars":"",children:Co.map(O=>X("span",{className:se.skeletonBar,style:{width:O}},`bar-${O}`))}),X(nt,{products:N,listboxId:r,onSelect:F??So,onAddToCart:te,onFocusChange:Q,focusable:m&&!i.isLoading,loading:i.isLoading,layout:P,imageFallback:B,strings:u}),i.showsSeeAll&&X("div",{className:se.seeAllRow,"data-aia-see-all":"",onClick:O=>{O.target.closest("[data-aia-see-all-button]")&&(O.stopPropagation(),!i.isLoading&&ye?.())},children:X("button",{type:"button",tabIndex:-1,disabled:!0,"data-aia-see-all-button":"",className:se.seeAll,ref:O=>{O&&(O.disabled=!0,O.offsetHeight,O.disabled=i.isLoading)},children:u.seeAllResults})}),X(Za,{isOptionHighlighted:ge,isInputEmpty:i.isInputEmpty,strings:u})]}),X("button",{ref:Ce,type:"button",tabIndex:-1,className:se.scrollArrow,"data-aia-scroll-arrow":"","aria-label":u.scrollArrow,"aria-hidden":"true",children:X("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:X("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Jo,ModeController as en,setCursorOffset as an,uiStringsFor as tn,watchEditorHeight as on}from"@magicx-eng/ai-autocomplete-vanilla";import{uiStringsFor as Do}from"@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
3708
|
flex-shrink: 0;
|
|
3709
3709
|
width: 32px;
|
|
3710
3710
|
height: 32px;
|
|
@@ -3775,5 +3775,5 @@ import{buildSubmitResult as ps,cellDay as hs,cellIso as us,DATE_RANGE_META_END a
|
|
|
3775
3775
|
transition: none;
|
|
3776
3776
|
}
|
|
3777
3777
|
}
|
|
3778
|
-
`,document.head.appendChild(e)}var xt={submitButton:"aia-submitButton-otz7H"};import{jsx as Da}from"react/jsx-runtime";function yt({disabled:e,ready:n,onClick:a,label:t=zo().submit}){return Da("button",{type:"button","data-aia-submit":"",className:xt.submitButton,disabled:e,"data-aia-ready":n?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":t,children:Da("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:Da("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Do,dateSelectionFor as Mo,editingSuggestion as No,identifiedParamLabel as Fo,withoutTraditionalAutocomplete as Ho}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Pt,useEffect as ea,useMemo as Bo,useRef as ae,useState as Wo}from"react";import{useRef as kt}from"react";function Ct(e){let n=kt(e);n.current=e;let a=Object.keys(e??{}).sort().join("\0"),t=kt({key:"",overrides:void 0});if(t.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,w,v)=>{let y=n.current?.[s];return y?y(l,w,v):[]};o[s]=r}t.current={key:a,overrides:e?o:void 0}}return{overrides:t.current.overrides,key:a}}import{useRef as St}from"react";function Tt(e){let n=St(e);n.current=e;let a=St(null);a.current===null&&(a.current={fetch:(o,s)=>{let r=n.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>n.current?.transform(o)??[],get limit(){return n.current?.limit}});let t=e!==void 0;return{config:t?a.current:void 0,enabled:t}}var It={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],traditionalAutocomplete:!1,customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,skeletonPicked:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,dateReferences:[],dateFloor:null,timeView:null,multiSelectView:null,dropdownMultiSelect:null,multiSelectDraft:null,locationView:null,locationSearch:null,locationAutocomplete:!0,locationFieldFocused:!1,placeholderText:"",leadInText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,dropdownHeld:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null,timeDraft:null};function Ma({onSubmit:e,onResult:n,onError:a,optionOverrides:t,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,visitorId:y,columns:f=2,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:x,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showOptionIcons:te,showOptionImages:T,showOptionCounts:z,showSkipButton:_,showProducts:F,productImageFallback:Q="image",onFocus:E,onBlur:J,value:W,completedParams:H,onChange:Y,onParamsChange:re,products:C,mapProducts:B,onProductSelect:d,onProductAddToCart:S,source:He,setCursor:ve}){let b=ae(null),[Be,xe]=Wo(null),Re=ae(e);Re.current=e;let Oe=ae(n);Oe.current=n;let Le=ae(a);Le.current=a;let m=ae(Y);m.current=Y;let k=ae(re);k.current=re;let P=ae(E);P.current=E;let A=ae(J);A.current=J;let L=ae(ve);L.current=ve;let j=ae(d);j.current=d;let de=ae(S);de.current=S;let ie=ae(y);ie.current=y;let ze=ae(()=>{let p=ie.current;return typeof p=="function"?p():p}).current,ye=Tt(C),We=ae(B);We.current=B;let $=ae((p,G)=>{let M=We.current;return M?M(p,G):p}).current,ke=B?$:void 0,Ge=Ct(t);ea(()=>{if(typeof document>"u")return;let p=new Do(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,visitorId:ze,optionOverrides:Ge.overrides,maskCompletedText:o,columns:f,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:x,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showProducts:F,source:He,value:W,completedParams:H,onSubmit:(...M)=>Re.current?.(...M),onResult:(...M)=>Oe.current?.(...M),onError:(...M)=>Le.current?.(...M),onChange:(...M)=>m.current?.(...M),onParamsChange:(...M)=>k.current?.(...M),onFocus:()=>P.current?.(),onBlur:()=>A.current?.(),onProductSelect:M=>j.current?.(M),onProductAddToCart:M=>de.current?.(M),setCursor:M=>L.current?.(M),products:ye.config,mapProducts:ke});b.current=p,xe(p.getState());let G=p.subscribe(M=>xe(M));return()=>{G(),p.destroy(),b.current===p&&(b.current=null)}},[]),ea(()=>{W!==void 0&&b.current?.setValue(W)},[W]),ea(()=>{H!==void 0&&b.current?.setCompletedParams(H)},[H]);let na=JSON.stringify(s??null),ue;try{ue=JSON.stringify(r??null)}catch{ue="[unstringifiable]"}ea(()=>{b.current?.update({apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,optionOverrides:Ge.overrides,dropdownTrigger:h,optionsPosition:c,closeDropdownOnBlur:x,prependPlaceholder:I,allOption:q,showNonTappableOptions:D,locationSearch:O,showProducts:F})},[na,ue,l,w?.code,w?.rate,w?.country,v,Ge.key,h,c,x,I,q,D,O,F]);let Ye=ae(!1);ea(()=>{if(!Ye.current){Ye.current=!0;return}b.current?.update({products:ye.config})},[ye.enabled]),ea(()=>{b.current?.update({mapProducts:ke})},[ke]);let De=ae(null);De.current===null&&(De.current={handleTextChange:p=>b.current?.handleTextChange(p),handleKeyDown:p=>{let G="nativeEvent"in p?p.nativeEvent:p;b.current?.handleKeyDown(G)},setFocused:p=>b.current?.setFocused(p),startEditingParam:p=>b.current?.startEditingParam(p),removeParam:p=>b.current?.removeParam(p)??!1,exitEditMode:()=>b.current?.exitEditMode(),handleCaretAfterInput:p=>b.current?.handleCaretAfterInput(p),handleCaretMove:p=>b.current?.handleCaretMove(p),replaceEditingRange:p=>b.current?.replaceEditingRange(p)??!1,setActivePill:p=>b.current?.setActivePill(p),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()??It,recordSubmit:p=>b.current?.recordSubmit(p),selectOption:(p,G)=>b.current?.selectOption(p,G),selectProduct:p=>b.current?.selectProduct(p),addProductToCart:p=>{let G=b.current;return!G||!de.current?Promise.resolve():G.addProductToCart(p)},setActiveDropdownIndex:p=>b.current?.setActiveDropdownIndex(p),clearHighlight:p=>b.current?.clearHighlight(p),showPreviousMonth:()=>b.current?.showPreviousMonth(),showNextMonth:()=>b.current?.showNextMonth(),setTime:p=>b.current?.setTime(p),commitTime:()=>b.current?.commitTime(),toggleMultiSelectOption:p=>b.current?.toggleMultiSelectOption(p),commitMultiSelect:()=>b.current?.commitMultiSelect(),setLocationQuery:p=>b.current?.setLocationQuery(p),moveLocationHighlight:p=>b.current?.moveLocationHighlight(p),commitLocation:p=>b.current?.commitLocation(p),setLocationFieldFocused:p=>b.current?.setLocationFieldFocused(p),handleFocus:()=>b.current?.setFocused(!0),handleBlur:()=>b.current?.setFocused(!1)});let g=De.current,Ce=Pt(p=>{let G=p.target.value,$e=G.length>0&&!p.nativeEvent?.isComposing&&G[0]!==G[0].toUpperCase()?G[0].toUpperCase()+G.slice(1):G;b.current?.handleTextChange($e)},[]),Ke=Pt(p=>{b.current?.handleKeyDown(p.nativeEvent)},[]),i=b.current,u=Be??It,Se=W!==void 0?W:u.text,Te=H!==void 0?H:u.completedParams,me=u.actionableSuggestions,Pe=me[0],Me=Bo(()=>Ho(me),[me]),ge=i?.listboxId??"",ra=u.activeDropdownIndex>=0&&i?`${ge}-option-${u.activeDropdownIndex}`:void 0,Ie=u.editingParam,fe=u.editingIdentified,Ne=Ie?No(Ie):fe?{parameter:fe.parameter,text:Fo(fe.parameter),required:!0,options:[]}:null,qe=u.dropdownSuggestion??Ne??Pe,je=Ne?[Ne]:me,Ee=Mo(u),_e=!i||u.dropdownLoading;return{completedParams:Te,multiSelectView:u.multiSelectView,toggleMultiSelectOption:g.toggleMultiSelectOption,commitMultiSelect:g.commitMultiSelect,skippedParams:u.skippedParams,identifiedParams:u.identifiedParams,suggestionPills:Me,setActivePill:g.setActivePill,skipActivePill:g.skipActivePill,removeLastParam:g.removeLastParam,segments:u.segments,newParamId:u.newParamId,clearNewParamId:g.clearNewParamId,suggestions:u.suggestions,activeIndex:u.activeDropdownIndex,isReady:u.isReady,isLoading:_e,isFocused:u.isFocused,isDropdownOpen:u.isDropdownOpen,isActivePillSelected:u.isActivePillSelected,placeholderText:u.placeholderText,listboxId:ge,error:u.error,products:u.products,customFields:u.customFields,selectProduct:g.selectProduct,addProductToCart:g.addProductToCart,handleTextChange:g.handleTextChange,handleKeyDown:g.handleKeyDown,setFocused:g.setFocused,editingParam:Ie,editingIdentified:fe,editingAnchor:u.editingAnchor,caretOffset:u.caretOffset,startEditingParam:g.startEditingParam,removeParam:g.removeParam,exitEditMode:g.exitEditMode,handleCaretAfterInput:g.handleCaretAfterInput,handleCaretMove:g.handleCaretMove,replaceEditingRange:g.replaceEditingRange,inputProps:{value:Se,placeholder:u.placeholderText||void 0,onChange:Ce,onKeyDown:Ke,onFocus:g.handleFocus,onBlur:g.handleBlur,role:"combobox","aria-expanded":u.isDropdownOpen,"aria-activedescendant":ra,"aria-autocomplete":"list","aria-controls":ge},reset:g.reset,refreshProducts:g.refreshProducts,prepareSubmit:g.prepareSubmit,getState:g.getState,recordSubmit:g.recordSubmit,dropdownProps:{suggestions:qe?[{...qe,options:u.dropdownOptions}]:[],activeIndex:u.activeDropdownIndex,onSelect:g.selectOption,onHighlight:g.setActiveDropdownIndex,onUnhighlight:g.clearHighlight,isOpen:u.isDropdownOpen,id:ge,pills:je,activeSelected:u.isActivePillSelected,onPillClick:g.setActivePill,onSkip:g.skipActivePill,showSkipButton:(_??!0)&&!Ie&&!fe,showOptionIcons:te??!0,showOptionImages:T??!0,showOptionCounts:z??!0,skipDisabled:u.inSelectionAnimation,isLoading:_e,skeletonExiting:u.skeletonExiting,isInputEmpty:Se.trim().length===0,language:l,products:u.products,productImageFallback:Q,onProductSelect:g.selectProduct,onProductAddToCart:S?g.addProductToCart:void 0,onProductFocusChange:g.setFocused,formatType:u.activeFormatType,dateView:u.dateView,selectedDateIso:Ee.selectedIso,selectedDateRange:Ee.selectedRange,dateRangeStart:Ee.rangeStart,dateReferences:Ee.references,onPreviousMonth:g.showPreviousMonth,onNextMonth:g.showNextMonth,timeView:u.timeView,multiSelectView:u.dropdownMultiSelect,onMultiSelectCommit:g.commitMultiSelect,onTimeChange:g.setTime,onTimeCommit:g.commitTime,locationView:u.locationView,isReediting:u.editingParam!=null,onLocationQuery:g.setLocationQuery,onLocationMove:g.moveLocationHighlight,onLocationCommit:g.commitLocation,onLocationFocusChange:g.setLocationFieldFocused,isFocused:u.isFocused||u.locationFieldFocused,optionsPosition:c??"below"}}}import{attachChipRemove as Go,cancelStartingHint as Ko,chipIdFromTap as qo,extractPlainText as Et,getCursorOffset as At,keepCaretOnChip as _o,plainTextLength as Vo,renderEditableContent as Uo,setCursorOffset as Rt,startingHintOptions as Qo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as he,useEffect as aa,useLayoutEffect as Na,useRef as ta}from"react";var ya;function Yo(){if(ya!==void 0)return ya;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),ya=e.contentEditable==="plaintext-only",ya}function Ot(e){let{segments:n,showChipIcons:a=!0,showChipImages:t=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:w,editingAnchor:v,caretOffset:y,placeholderText:f,hintSuggestions:h,isFocused:c,isDropdownOpen:x,listboxId:I,activeDescendantId:q,autoFocus:D,handleTextChange:O,handleKeyDown:te,handleCaretAfterInput:T,handleCaretMove:z,startEditingParam:_,replaceEditingRange:F,setFocused:Q}=e,E=ta(null),J=ta(!1),W=ta(""),H=ta(""),Y=ta(null),re=ta(0);Y.current=y,aa(()=>{if(!D)return;let m=E.current;if(!m)return;document.activeElement===m?Q(!0):m.focus();let k=m.ownerDocument??document,P=k.getSelection(),A=P&&P.rangeCount>0&&m.contains(P.anchorNode);if(P&&!A){let L=k.createRange();L.selectNodeContents(m),L.collapse(!0),P.removeAllRanges(),P.addRange(L)}},[D,Q]),aa(()=>{let m=E.current;if(!m)return;let k=m.ownerDocument??document,P=()=>{let A=k.getSelection();if(!A||A.rangeCount===0||!A.anchorNode||!m.contains(A.anchorNode))return;let L=A.anchorNode,j=L.nodeType===Node.ELEMENT_NODE?L:L.parentElement,ie=(A.isCollapsed?j?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ze=l?.id??w?.id??null;if(ie&&ie!==ze){_(ie);return}performance.now()-re.current<50||z(At(m))};return k.addEventListener("selectionchange",P),()=>k.removeEventListener("selectionchange",P)},[l,w,_,z]),aa(()=>{let m=E.current;if(!m)return;let k=P=>{let A=qo(m,P.target);A&&(_(A),_o(m,A))};return m.addEventListener("click",k),()=>m.removeEventListener("click",k)},[_]),aa(()=>{let m=E.current;if(!(!m||!s||!o))return Go(m,s)},[s,o]),Na(()=>{let m=E.current;m&&Uo({input:m,segments:n,newParamId:r,editingParamId:l?.id??null,placeholderText:f??"",isFocused:c,showChipIcons:a,showChipImages:t,showChipRemove:o,hintOptions:Qo(h??[])})},[n,r,l,f,h,c,a,t,o]),aa(()=>{let m=E.current;return()=>{m&&Ko(m)}},[]),Na(()=>{let m=W.current,k=r??"";if(W.current=k,!k||k===m)return;let P=E.current;if(!P)return;P.focus();let A=Y.current??Vo(P);Rt(P,A)},[r]),Na(()=>{let m=H.current,k=l?.id??"";if(H.current=k,!k||k===m||v==null)return;let P=E.current;P&&Rt(P,v)},[l,v]);let C=he(()=>{if(J.current)return;let m=E.current;if(!m)return;let k=Et(m),A=k.length>0&&k[0]!==k[0].toUpperCase()?k[0].toUpperCase()+k.slice(1):k;O(A)},[O]),B=he(()=>{re.current=performance.now(),C();let m=E.current;m&&T(At(m))},[C,T]);aa(()=>{let m=E.current;if(!m)return;let k=P=>{let A=P,L=A.inputType;if(L==="insertParagraph"||L==="insertLineBreak"||L==="insertFromDrop"){P.preventDefault();return}if(L.startsWith("insert")||L.startsWith("delete")){let j=L.startsWith("delete")?"":A.data??"";F(j)&&P.preventDefault()}};return m.addEventListener("beforeinput",k),()=>m.removeEventListener("beforeinput",k)},[F]);let d=he(()=>{J.current=!0,E.current?.setAttribute("data-aia-composing","true")},[]),S=he(()=>{J.current=!1,E.current?.removeAttribute("data-aia-composing"),C()},[C]),He=he(m=>{m.preventDefault();let k=E.current;if(!k)return;let P=(m.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!P)return;let A=k.ownerDocument??document,L=A.getSelection();if(!L||L.rangeCount===0)return;let j=L.getRangeAt(0);if(!k.contains(j.startContainer))return;j.deleteContents();let de=A.createTextNode(P);j.insertNode(de),j.setStartAfter(de),j.collapse(!0),L.removeAllRanges(),L.addRange(j),C()},[C]),ve=he(m=>te(m),[te]),b=he(()=>Q(!0),[Q]),Be=he(()=>Q(!1),[Q]),xe=he(()=>E.current?.focus(),[]),Re=he(()=>E.current?.blur(),[]),Oe=he(()=>{let m=E.current;return m?Et(m):""},[]),Le=Yo()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:Le,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":I,"aria-expanded":x,"aria-activedescendant":q,spellCheck:!0,enterKeyHint:"send",onInput:B,onKeyDown:ve,onCompositionStart:d,onCompositionEnd:S,onPaste:He,onFocus:b,onBlur:Be},getPlainText:Oe,focus:xe,blur:Re}}import{jsx as oa,jsxs as Ha}from"react/jsx-runtime";function on(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var nn=jo(function({onSubmit:n,onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:w,language:v,currency:y,productId:f,visitorId:h,columns:c,pillPlacement:x="dropdown",mode:I="auto",optionsPosition:q="below",animations:D=!0,optionsStyle:O="floating",dropdownTrigger:te,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:_,showNonTappableOptions:F,locationSearch:Q,showOptionIcons:E=!0,showChipIcons:J=!0,showChipImages:W=!0,showChipRemove:H=!1,showOptionImages:Y=!0,showOptionCounts:re=!0,showSkipButton:C,showProducts:B,productsLayout:d,productImageFallback:S,autoFocus:He=!0,onFocus:ve,onBlur:b,value:Be,completedParams:xe,onChange:Re,onParamsChange:Oe,products:Le,mapProducts:m,onProductSelect:k,onProductAddToCart:P,submitButton:A,resetOnSubmit:L=!0,seeAllResults:j=!1},de){let ie=ia(null),ze=ia(null),ye=ia(null),We=ia(()=>{}),$=ia(null),ke=ia(null);Fa(()=>{let N=ie.current;if(N)return $.current?$.current.setMode(I):$.current=new Jo(N,I),()=>{$.current?.destroy(),$.current=null}},[I]);let Ge=ka(N=>{let oe=ke.current?.current;oe&&(oe.focus(),en(oe,N))},[]),{completedParams:na,suggestionPills:ue,setActivePill:Ye,skipActivePill:De,segments:g,newParamId:Ce,clearNewParamId:Ke,placeholderText:i,isFocused:u,isDropdownOpen:Se,isActivePillSelected:Te,isLoading:me,isReady:Pe,activeIndex:Me,listboxId:ge,handleTextChange:ra,handleKeyDown:Ie,setFocused:fe,editingParam:Ne,editingIdentified:qe,editingAnchor:je,caretOffset:Ee,startEditingParam:_e,removeParam:p,handleCaretAfterInput:G,handleCaretMove:M,replaceEditingRange:$e,dropdownProps:R,reset:ma,refreshProducts:Ba,prepareSubmit:Wa,getState:Ga,recordSubmit:Ka}=Ma({onSubmit:N=>We.current(N),onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:w,language:v,currency:y,productId:f,visitorId:h,columns:c,dropdownTrigger:te,optionsPosition:q,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:_,showNonTappableOptions:F,locationSearch:Q,showOptionIcons:E,showOptionImages:Y,showOptionCounts:re,showSkipButton:C,showProducts:B,onFocus:ve,onBlur:b,value:Be,completedParams:xe,onChange:Re,onParamsChange:Oe,products:Le,mapProducts:m,onProductSelect:k,onProductAddToCart:P,source:"full-sdk",setCursor:Ge});Fa(()=>{if(!Ce)return;let N=window.setTimeout(()=>Ke(),650);return()=>window.clearTimeout(N)},[Ce,Ke]);let Lt=Me>=0?`${ge}-option-${Me}`:void 0,{inputRef:Ca,editorProps:zt,focus:ga,blur:qa,getPlainText:_a}=Ot({segments:g,newParamId:Ce,editingParam:Ne,editingIdentified:qe,editingAnchor:je,caretOffset:Ee,placeholderText:i,hintSuggestions:x==="inline"?[]:ue,isFocused:u,showChipIcons:J,showChipImages:W,showChipRemove:H,removeParam:p,isDropdownOpen:Se,listboxId:ge,activeDescendantId:Lt,autoFocus:He,handleTextChange:ra,handleKeyDown:Ie,handleCaretAfterInput:G,handleCaretMove:M,startEditingParam:_e,replaceEditingRange:$e,setFocused:fe});ke.current=Ca,Zo(()=>{let N=ze.current,oe=Ca.current;if(!N||!oe)return;let la=()=>{let Ua=N.firstElementChild;if(!Ua)return;let Bt=Ua.getBoundingClientRect(),Wt=oe.getBoundingClientRect();Bt.top>=Wt.bottom-2?N.setAttribute("data-aia-pill-wrapped",""):N.removeAttribute("data-aia-pill-wrapped")};la();let Va=new ResizeObserver(la);return Va.observe(oe),()=>Va.disconnect()},[g,ue.length,me,Ca]),Fa(()=>{let N=ye.current;if(N)return tn(N)},[]),$o(de,()=>({focus:ga,blur:qa,reset:ma,refreshProducts:Ba,setMode:N=>$.current?.setMode(N),skipActivePill:De}),[ga,qa,ma,Ba,De]);let Ze=!!g.length||na.length>0,sa=ka(N=>{if(!Ze)return;N&&Wa();let oe=Ga(),la=Xo(_a(),oe.completedParams,oe.skippedParams,{identifiedParams:oe.identifiedParams,isReady:oe.isReady,customFields:oe.customFields});N&&Ka(la),n(la),L&&ma()},[Ka,L,Ze,Wa,Ga,n,ma,_a]);We.current=()=>sa(!1);let Dt=j&&!R.isInputEmpty&&Ze,Mt=ka(()=>sa(!0),[sa]),Nt=ka(N=>{N.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||ga()},[ga]),Ft=x==="inline",Ht=x==="dropdown";return Ha("div",{ref:ie,className:`magicx-aia ${Ve.container} ${r??""}`,"data-pill-placement":x,"data-options-position":q,"data-animations":D?"on":"off","data-aia-options-style":O,"data-mode":on(I),children:[oa(za,{...R,showPills:Ht,productsLayout:d,productImageFallback:S,onSeeAllResults:Dt?Mt:void 0,fullWidth:j}),Ha("div",{className:Ve.inputWrapper,"data-aia-input-wrapper":"",onClick:Nt,children:[Ha("div",{ref:ye,className:Ve.editorArea,"data-aia-editor":"",children:[oa("div",{...zt,className:Ve.input,"data-aia-input":""}),Ft&&(me||ue.length>0)&&oa("span",{ref:ze,className:Ve.pillListContainer,"data-aia-pill-list-container":"",children:oa(ba,{pills:ue,activePillIndex:0,activeSelected:Te,onSelectPill:Ye,loading:me})})]}),A===null?null:A===void 0?oa(yt,{disabled:!Ze,ready:Ze&&Pe,onClick:()=>sa(!0),label:an(v).submit}):oa("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ve.submitSlot,onClick:N=>{Ze&&(N.stopPropagation(),sa(!0))},children:A})]})]})});export{nn as AIAutocomplete,za as AIAutocompleteDropdown,ms as DATE_RANGE_META_END,gs as DATE_RANGE_META_START,fs as DEFAULT_OPTION_COUNT_UNIT,Ss as LOCATION_META_KEY,Ls as PRODUCT_PATH_PREFIX,Ks as TIME_META_KEY,_s as WEEKDAY_LABELS,ps as buildSubmitResult,hs as cellDay,us as cellIso,bs as dateCellMarks,ws as formatDate,vs as formatDateRange,xs as formatOptionCount,ys as formatPlace,ks as formatTime,Cs as isoDate,Ts as monthLabel,Ps as optionCountLabel,Is as optionHasImage,Es as optionImageSources,As as optionImageSrc,Rs as optionLabel,Os as optionsShowLeadingVisuals,zs as parseDate,Ds as parseLooseDate,Ms as parseLooseDateRange,Ns as parseTime,Fs as productFromMatchedItem,Hs as productImageSources,Bs as productsFromCustomFields,Ws as sanitizeOptionIconSvg,Gs as selectedRangeFor,Ma as useAIAutocomplete,qs as visibleDateRange,Vs as withSkippedParams};
|
|
3778
|
+
`,document.head.appendChild(e)}var yt={submitButton:"aia-submitButton-otz7H"};import{jsx as Da}from"react/jsx-runtime";function kt({disabled:e,ready:n,onClick:a,label:t=Do().submit}){return Da("button",{type:"button","data-aia-submit":"",className:yt.submitButton,disabled:e,"data-aia-ready":n?"":void 0,onClick:o=>{o.stopPropagation(),a()},"aria-label":t,children:Da("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":t,children:Da("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Mo,dateSelectionFor as No,editingSuggestion as Fo,identifiedParamLabel as Ho,withoutTraditionalAutocomplete as Bo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as It,useEffect as ea,useMemo as Wo,useRef as ee,useState as Go}from"react";import{useRef as Ct}from"react";function St(e){let n=Ct(e);n.current=e;let a=Object.keys(e??{}).sort().join("\0"),t=Ct({key:"",overrides:void 0});if(t.current.key!==a){let o={};for(let s of Object.keys(e??{})){let r=(l,w,v)=>{let y=n.current?.[s];return y?y(l,w,v):[]};o[s]=r}t.current={key:a,overrides:e?o:void 0}}return{overrides:t.current.overrides,key:a}}import{useRef as Tt}from"react";function Pt(e){let n=Tt(e);n.current=e;let a=Tt(null);a.current===null&&(a.current={fetch:(o,s)=>{let r=n.current;return r?r.fetch(o,s):Promise.reject(new Error("products config removed"))},transform:o=>n.current?.transform(o)??[],get limit(){return n.current?.limit}});let t=e!==void 0;return{config:t?a.current:void 0,enabled:t}}var Et={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 Ma({onSubmit:e,onResult:n,onError:a,optionOverrides:t,maskCompletedText:o,apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,visitorId:y,columns:b=2,dropdownTrigger:h,optionsPosition:p,closeDropdownOnBlur:x,prependPlaceholder:E,allOption:q,showNonTappableOptions:M,locationSearch:R,showOptionIcons:ae,showOptionImages:T,showOptionCounts:z,showSkipButton:U,showProducts:F,productImageFallback:te="image",onFocus:Q,onBlur:P,value:B,completedParams:W,onChange:Y,onParamsChange:re,products:I,mapProducts:D,onProductSelect:c,onProductAddToCart:S,source:He,setCursor:xe}){let f=ee(null),[Be,ye]=Go(null),Oe=ee(e);Oe.current=e;let Le=ee(n);Le.current=n;let ze=ee(a);ze.current=a;let ke=ee(Y);ke.current=Y;let g=ee(re);g.current=re;let k=ee(Q);k.current=Q;let C=ee(P);C.current=P;let A=ee(xe);A.current=xe;let L=ee(c);L.current=c;let j=ee(S);j.current=S;let ie=ee(y);ie.current=y;let ue=ee(()=>{let d=ie.current;return typeof d=="function"?d():d}).current,de=Pt(I),We=ee(D);We.current=D;let $=ee((d,G)=>{let N=We.current;return N?N(d,G):d}).current,Ce=D?$:void 0,Ge=St(t);ea(()=>{if(typeof document>"u")return;let d=new Mo(document.createElement("div"),{renderMode:"headless",apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,visitorId:ue,optionOverrides:Ge.overrides,maskCompletedText:o,columns:b,dropdownTrigger:h,optionsPosition:p,closeDropdownOnBlur:x,prependPlaceholder:E,allOption:q,showNonTappableOptions:M,locationSearch:R,showProducts:F,source:He,value:B,completedParams:W,onSubmit:(...N)=>Oe.current?.(...N),onResult:(...N)=>Le.current?.(...N),onError:(...N)=>ze.current?.(...N),onChange:(...N)=>ke.current?.(...N),onParamsChange:(...N)=>g.current?.(...N),onFocus:()=>k.current?.(),onBlur:()=>C.current?.(),onProductSelect:N=>L.current?.(N),onProductAddToCart:N=>j.current?.(N),setCursor:N=>A.current?.(N),products:de.config,mapProducts:Ce});f.current=d,ye(d.getState());let G=d.subscribe(N=>ye(N));return()=>{G(),d.destroy(),f.current===d&&(f.current=null)}},[]),ea(()=>{B!==void 0&&f.current?.setValue(B)},[B]),ea(()=>{W!==void 0&&f.current?.setCompletedParams(W)},[W]);let na=JSON.stringify(s??null),me;try{me=JSON.stringify(r??null)}catch{me="[unstringifiable]"}ea(()=>{f.current?.update({apiConfig:s,additionalContext:r,language:l,currency:w,productId:v,optionOverrides:Ge.overrides,dropdownTrigger:h,optionsPosition:p,closeDropdownOnBlur:x,prependPlaceholder:E,allOption:q,showNonTappableOptions:M,locationSearch:R,showProducts:F})},[na,me,l,w?.code,w?.rate,w?.country,v,Ge.key,h,p,x,E,q,M,R,F]);let Ye=ee(!1);ea(()=>{if(!Ye.current){Ye.current=!0;return}f.current?.update({products:de.config})},[de.enabled]),ea(()=>{f.current?.update({mapProducts:Ce})},[Ce]);let De=ee(null);De.current===null&&(De.current={handleTextChange:d=>f.current?.handleTextChange(d),handleCompositionText:d=>f.current?.handleCompositionText(d),handleKeyDown:d=>{let G="nativeEvent"in d?d.nativeEvent:d;f.current?.handleKeyDown(G)},setFocused:d=>f.current?.setFocused(d),startEditingParam:d=>f.current?.startEditingParam(d),removeParam:d=>f.current?.removeParam(d)??!1,exitEditMode:()=>f.current?.exitEditMode(),handleCaretAfterInput:d=>f.current?.handleCaretAfterInput(d),handleCaretMove:d=>f.current?.handleCaretMove(d),replaceEditingRange:d=>f.current?.replaceEditingRange(d)??!1,setActivePill:d=>f.current?.setActivePill(d),skipActivePill:()=>f.current?.skipActivePill(),removeLastParam:()=>f.current?.removeLastParam(),clearNewParamId:()=>f.current?.clearNewParamId(),reset:()=>f.current?.reset(),refreshProducts:()=>f.current?.refreshProducts(),prepareSubmit:()=>f.current?.prepareSubmit(),getState:()=>f.current?.getState()??Et,recordSubmit:d=>f.current?.recordSubmit(d),selectOption:(d,G)=>f.current?.selectOption(d,G),selectProduct:d=>f.current?.selectProduct(d),addProductToCart:d=>{let G=f.current;return!G||!j.current?Promise.resolve():G.addProductToCart(d)},setActiveDropdownIndex:d=>f.current?.setActiveDropdownIndex(d),clearHighlight:d=>f.current?.clearHighlight(d),showPreviousMonth:()=>f.current?.showPreviousMonth(),showNextMonth:()=>f.current?.showNextMonth(),setTime:d=>f.current?.setTime(d),commitTime:()=>f.current?.commitTime(),toggleMultiSelectOption:d=>f.current?.toggleMultiSelectOption(d),commitMultiSelect:()=>f.current?.commitMultiSelect(),setLocationQuery:d=>f.current?.setLocationQuery(d),moveLocationHighlight:d=>f.current?.moveLocationHighlight(d),commitLocation:d=>f.current?.commitLocation(d),setLocationFieldFocused:d=>f.current?.setLocationFieldFocused(d),handleFocus:()=>f.current?.setFocused(!0),handleBlur:()=>f.current?.setFocused(!1)});let m=De.current,Se=It(d=>{let G=d.target.value,$e=G.length>0&&!d.nativeEvent?.isComposing&&G[0]!==G[0].toUpperCase()?G[0].toUpperCase()+G.slice(1):G;f.current?.handleTextChange($e)},[]),Ke=It(d=>{f.current?.handleKeyDown(d.nativeEvent)},[]),i=f.current,u=Be??Et,Te=B!==void 0?B:u.text,Pe=W!==void 0?W:u.completedParams,ge=u.actionableSuggestions,Ie=ge[0],Me=Wo(()=>Bo(ge),[ge]),fe=i?.listboxId??"",ra=u.activeDropdownIndex>=0&&i?`${fe}-option-${u.activeDropdownIndex}`:void 0,Ee=u.editingParam,be=u.editingIdentified,Ne=Ee?Fo(Ee):be?{parameter:be.parameter,text:Ho(be.parameter),required:!0,options:[]}:null,qe=u.dropdownSuggestion??Ne??Ie,je=Ne?[Ne]:ge,Ae=No(u),_e=!i||u.dropdownLoading;return{completedParams:Pe,multiSelectView:u.multiSelectView,toggleMultiSelectOption:m.toggleMultiSelectOption,commitMultiSelect:m.commitMultiSelect,skippedParams:u.skippedParams,identifiedParams:u.identifiedParams,suggestionPills:Me,setActivePill:m.setActivePill,skipActivePill:m.skipActivePill,removeLastParam:m.removeLastParam,segments:u.segments,newParamId:u.newParamId,clearNewParamId:m.clearNewParamId,suggestions:u.suggestions,activeIndex:u.activeDropdownIndex,isReady:u.isReady,isLoading:_e,isFocused:u.isFocused,isDropdownOpen:u.isDropdownOpen,isActivePillSelected:u.isActivePillSelected,placeholderText:u.placeholderText,listboxId:fe,error:u.error,products:u.products,customFields:u.customFields,selectProduct:m.selectProduct,addProductToCart:m.addProductToCart,handleTextChange:m.handleTextChange,handleCompositionText:m.handleCompositionText,handleKeyDown:m.handleKeyDown,setFocused:m.setFocused,editingParam:Ee,editingIdentified:be,editingAnchor:u.editingAnchor,caretOffset:u.caretOffset,startEditingParam:m.startEditingParam,removeParam:m.removeParam,exitEditMode:m.exitEditMode,handleCaretAfterInput:m.handleCaretAfterInput,handleCaretMove:m.handleCaretMove,replaceEditingRange:m.replaceEditingRange,inputProps:{value:Te,placeholder:u.placeholderText||void 0,onChange:Se,onKeyDown:Ke,onFocus:m.handleFocus,onBlur:m.handleBlur,role:"combobox","aria-expanded":u.isDropdownOpen,"aria-activedescendant":ra,"aria-autocomplete":"list","aria-controls":fe},reset:m.reset,refreshProducts:m.refreshProducts,prepareSubmit:m.prepareSubmit,getState:m.getState,recordSubmit:m.recordSubmit,dropdownProps:{suggestions:qe?[{...qe,options:u.dropdownOptions}]:[],activeIndex:u.activeDropdownIndex,onSelect:m.selectOption,onHighlight:m.setActiveDropdownIndex,onUnhighlight:m.clearHighlight,isOpen:u.isDropdownOpen,id:fe,pills:je,activeSelected:u.isActivePillSelected,onPillClick:m.setActivePill,onSkip:m.skipActivePill,showSkipButton:(U??!0)&&!Ee&&!be,showOptionIcons:ae??!0,showOptionImages:T??!0,showOptionCounts:z??!0,skipDisabled:u.inSelectionAnimation,isLoading:_e,skeletonExiting:u.skeletonExiting,isInputEmpty:Te.trim().length===0,language:l,products:u.products,productImageFallback:te,onProductSelect:m.selectProduct,onProductAddToCart:S?m.addProductToCart:void 0,onProductFocusChange:m.setFocused,formatType:u.activeFormatType,dateView:u.dateView,selectedDateIso:Ae.selectedIso,selectedDateRange:Ae.selectedRange,dateRangeStart:Ae.rangeStart,dateReferences:Ae.references,onPreviousMonth:m.showPreviousMonth,onNextMonth:m.showNextMonth,timeView:u.timeView,multiSelectView:u.dropdownMultiSelect,onMultiSelectCommit:m.commitMultiSelect,onTimeChange:m.setTime,onTimeCommit:m.commitTime,locationView:u.locationView,isReediting:u.editingParam!=null,onLocationQuery:m.setLocationQuery,onLocationMove:m.moveLocationHighlight,onLocationCommit:m.commitLocation,onLocationFocusChange:m.setLocationFieldFocused,isFocused:u.isFocused||u.locationFieldFocused,optionsPosition:p??"below"}}}import{attachChipRemove as Ko,cancelStartingHint as qo,chipIdFromTap as _o,extractPlainText as At,getCursorOffset as Rt,keepCaretOnChip as Vo,plainTextLength as Uo,renderEditableContent as Qo,setCursorOffset as Ot,startingHintOptions as Yo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as he,useEffect as aa,useLayoutEffect as Na,useRef as ta}from"react";var ya;function jo(){if(ya!==void 0)return ya;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),ya=e.contentEditable==="plaintext-only",ya}function Lt(e){let{segments:n,showChipIcons:a=!0,showChipImages:t=!0,showChipRemove:o=!1,removeParam:s,newParamId:r,editingParam:l,editingIdentified:w,editingAnchor:v,caretOffset:y,placeholderText:b,hintSuggestions:h,isFocused:p,isDropdownOpen:x,listboxId:E,activeDescendantId:q,autoFocus:M,handleTextChange:R,handleCompositionText:ae,handleKeyDown:T,handleCaretAfterInput:z,handleCaretMove:U,startEditingParam:F,replaceEditingRange:te,setFocused:Q}=e,P=ta(null),B=ta(!1),W=ta(""),Y=ta(""),re=ta(null),I=ta(0);re.current=y,aa(()=>{if(!M)return;let g=P.current;if(!g)return;document.activeElement===g?Q(!0):g.focus();let k=g.ownerDocument??document,C=k.getSelection(),A=C&&C.rangeCount>0&&g.contains(C.anchorNode);if(C&&!A){let L=k.createRange();L.selectNodeContents(g),L.collapse(!0),C.removeAllRanges(),C.addRange(L)}},[M,Q]),aa(()=>{let g=P.current;if(!g)return;let k=g.ownerDocument??document,C=()=>{let A=k.getSelection();if(!A||A.rangeCount===0||!A.anchorNode||!g.contains(A.anchorNode))return;let L=A.anchorNode,j=L.nodeType===Node.ELEMENT_NODE?L:L.parentElement,ue=(A.isCollapsed?j?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,de=l?.id??w?.id??null;if(ue&&ue!==de){F(ue);return}performance.now()-I.current<50||U(Rt(g))};return k.addEventListener("selectionchange",C),()=>k.removeEventListener("selectionchange",C)},[l,w,F,U]),aa(()=>{let g=P.current;if(!g)return;let k=C=>{let A=_o(g,C.target);A&&(F(A),Vo(g,A))};return g.addEventListener("click",k),()=>g.removeEventListener("click",k)},[F]),aa(()=>{let g=P.current;if(!(!g||!s||!o))return Ko(g,s)},[s,o]),Na(()=>{let g=P.current;g&&Qo({input:g,segments:n,newParamId:r,editingParamId:l?.id??null,placeholderText:b??"",isFocused:p,showChipIcons:a,showChipImages:t,showChipRemove:o,hintOptions:Yo(h??[])})},[n,r,l,b,h,p,a,t,o]),aa(()=>{let g=P.current;return()=>{g&&qo(g)}},[]),Na(()=>{let g=W.current,k=r??"";if(W.current=k,!k||k===g)return;let C=P.current;if(!C)return;C.focus();let A=re.current??Uo(C);Ot(C,A)},[r]),Na(()=>{let g=Y.current,k=l?.id??"";if(Y.current=k,!k||k===g||v==null)return;let C=P.current;C&&Ot(C,v)},[l,v]);let D=he(()=>{let g=P.current;if(!g)return;let k=At(g),A=k.length>0&&k[0]!==k[0].toUpperCase()?k[0].toUpperCase()+k.slice(1):k;if(B.current){ae(A);return}R(A)},[R,ae]),c=he(()=>{I.current=performance.now(),D();let g=P.current;g&&z(Rt(g))},[D,z]);aa(()=>{let g=P.current;if(!g)return;let k=C=>{let A=C,L=A.inputType;if(L==="insertParagraph"||L==="insertLineBreak"||L==="insertFromDrop"){C.preventDefault();return}if(L.startsWith("insert")||L.startsWith("delete")){let j=L.startsWith("delete")?"":A.data??"";te(j)&&C.preventDefault()}};return g.addEventListener("beforeinput",k),()=>g.removeEventListener("beforeinput",k)},[te]);let S=he(()=>{B.current=!0,P.current?.setAttribute("data-aia-composing","true")},[]),He=he(()=>{B.current=!1,P.current?.removeAttribute("data-aia-composing"),D()},[D]),xe=he(g=>{g.preventDefault();let k=P.current;if(!k)return;let C=(g.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!C)return;let A=k.ownerDocument??document,L=A.getSelection();if(!L||L.rangeCount===0)return;let j=L.getRangeAt(0);if(!k.contains(j.startContainer))return;j.deleteContents();let ie=A.createTextNode(C);j.insertNode(ie),j.setStartAfter(ie),j.collapse(!0),L.removeAllRanges(),L.addRange(j),D()},[D]),f=he(g=>T(g),[T]),Be=he(()=>Q(!0),[Q]),ye=he(()=>Q(!1),[Q]),Oe=he(()=>P.current?.focus(),[]),Le=he(()=>P.current?.blur(),[]),ze=he(()=>{let g=P.current;return g?At(g):""},[]),ke=jo()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:ke,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":E,"aria-expanded":x,"aria-activedescendant":q,spellCheck:!0,enterKeyHint:"send",onInput:c,onKeyDown:f,onCompositionStart:S,onCompositionEnd:He,onPaste:xe,onFocus:Be,onBlur:ye},getPlainText:ze,focus:Oe,blur:Le}}import{jsx as oa,jsxs as Ha}from"react/jsx-runtime";function nn(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var rn=$o(function({onSubmit:n,onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,className:r,apiConfig:l,additionalContext:w,language:v,currency:y,productId:b,visitorId:h,columns:p,pillPlacement:x="dropdown",mode:E="auto",optionsPosition:q="below",animations:M=!0,optionsStyle:R="floating",dropdownTrigger:ae,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:U,showNonTappableOptions:F,locationSearch:te,showOptionIcons:Q=!0,showChipIcons:P=!0,showChipImages:B=!0,showChipRemove:W=!1,showOptionImages:Y=!0,showOptionCounts:re=!0,showSkipButton:I,showProducts:D,productsLayout:c,productImageFallback:S,autoFocus:He=!0,onFocus:xe,onBlur:f,value:Be,completedParams:ye,onChange:Oe,onParamsChange:Le,products:ze,mapProducts:ke,onProductSelect:g,onProductAddToCart:k,submitButton:C,resetOnSubmit:A=!0,seeAllResults:L=!1},j){let ie=ia(null),ue=ia(null),de=ia(null),We=ia(()=>{}),$=ia(null),Ce=ia(null);Fa(()=>{let H=ie.current;if(H)return $.current?$.current.setMode(E):$.current=new en(H,E),()=>{$.current?.destroy(),$.current=null}},[E]);let Ge=ka(H=>{let oe=Ce.current?.current;oe&&(oe.focus(),an(oe,H))},[]),{completedParams:na,suggestionPills:me,setActivePill:Ye,skipActivePill:De,segments:m,newParamId:Se,clearNewParamId:Ke,placeholderText:i,isFocused:u,isDropdownOpen:Te,isActivePillSelected:Pe,isLoading:ge,isReady:Ie,activeIndex:Me,listboxId:fe,handleTextChange:ra,handleCompositionText:Ee,handleKeyDown:be,setFocused:Ne,editingParam:qe,editingIdentified:je,editingAnchor:Ae,caretOffset:_e,startEditingParam:d,removeParam:G,handleCaretAfterInput:N,handleCaretMove:$e,replaceEditingRange:O,dropdownProps:Ba,reset:ma,refreshProducts:Wa,prepareSubmit:Ga,getState:Ka,recordSubmit:qa}=Ma({onSubmit:H=>We.current(H),onResult:a,onError:t,optionOverrides:o,maskCompletedText:s,apiConfig:l,additionalContext:w,language:v,currency:y,productId:b,visitorId:h,columns:p,dropdownTrigger:ae,optionsPosition:q,closeDropdownOnBlur:T,prependPlaceholder:z,allOption:U,showNonTappableOptions:F,locationSearch:te,showOptionIcons:Q,showOptionImages:Y,showOptionCounts:re,showSkipButton:I,showProducts:D,onFocus:xe,onBlur:f,value:Be,completedParams:ye,onChange:Oe,onParamsChange:Le,products:ze,mapProducts:ke,onProductSelect:g,onProductAddToCart:k,source:"full-sdk",setCursor:Ge});Fa(()=>{if(!Se)return;let H=window.setTimeout(()=>Ke(),650);return()=>window.clearTimeout(H)},[Se,Ke]);let zt=Me>=0?`${fe}-option-${Me}`:void 0,{inputRef:Ca,editorProps:Dt,focus:ga,blur:_a,getPlainText:Va}=Lt({segments:m,newParamId:Se,editingParam:qe,editingIdentified:je,editingAnchor:Ae,caretOffset:_e,placeholderText:i,hintSuggestions:x==="inline"?[]:me,isFocused:u,showChipIcons:P,showChipImages:B,showChipRemove:W,removeParam:G,isDropdownOpen:Te,listboxId:fe,activeDescendantId:zt,autoFocus:He,handleTextChange:ra,handleCompositionText:Ee,handleKeyDown:be,handleCaretAfterInput:N,handleCaretMove:$e,startEditingParam:d,replaceEditingRange:O,setFocused:Ne});Ce.current=Ca,Xo(()=>{let H=ue.current,oe=Ca.current;if(!H||!oe)return;let la=()=>{let Qa=H.firstElementChild;if(!Qa)return;let Wt=Qa.getBoundingClientRect(),Gt=oe.getBoundingClientRect();Wt.top>=Gt.bottom-2?H.setAttribute("data-aia-pill-wrapped",""):H.removeAttribute("data-aia-pill-wrapped")};la();let Ua=new ResizeObserver(la);return Ua.observe(oe),()=>Ua.disconnect()},[m,me.length,ge,Ca]),Fa(()=>{let H=de.current;if(H)return on(H)},[]),Zo(j,()=>({focus:ga,blur:_a,reset:ma,refreshProducts:Wa,setMode:H=>$.current?.setMode(H),skipActivePill:De}),[ga,_a,ma,Wa,De]);let Ze=!!m.length||na.length>0,sa=ka(H=>{if(!Ze)return;H&&Ga();let oe=Ka(),la=Jo(Va(),oe.completedParams,oe.skippedParams,{identifiedParams:oe.identifiedParams,isReady:oe.isReady,customFields:oe.customFields});H&&qa(la),n(la),A&&ma()},[qa,A,Ze,Ga,Ka,n,ma,Va]);We.current=()=>sa(!1);let Mt=L&&!Ba.isInputEmpty&&Ze,Nt=ka(()=>sa(!0),[sa]),Ft=ka(H=>{H.target?.closest("[data-aia-pill]")||document.activeElement?.closest("[data-aia-location]")||ga()},[ga]),Ht=x==="inline",Bt=x==="dropdown";return Ha("div",{ref:ie,className:`magicx-aia ${Ve.container} ${r??""}`,"data-pill-placement":x,"data-options-position":q,"data-animations":M?"on":"off","data-aia-options-style":R,"data-mode":nn(E),children:[oa(za,{...Ba,showPills:Bt,productsLayout:c,productImageFallback:S,onSeeAllResults:Mt?Nt:void 0,fullWidth:L}),Ha("div",{className:Ve.inputWrapper,"data-aia-input-wrapper":"",onClick:Ft,children:[Ha("div",{ref:de,className:Ve.editorArea,"data-aia-editor":"",children:[oa("div",{...Dt,className:Ve.input,"data-aia-input":""}),Ht&&(ge||me.length>0)&&oa("span",{ref:ue,className:Ve.pillListContainer,"data-aia-pill-list-container":"",children:oa(ba,{pills:me,activePillIndex:0,activeSelected:Pe,onSelectPill:Ye,loading:ge})})]}),C===null?null:C===void 0?oa(kt,{disabled:!Ze,ready:Ze&&Ie,onClick:()=>sa(!0),label:tn(v).submit}):oa("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ve.submitSlot,onClick:H=>{Ze&&(H.stopPropagation(),sa(!0))},children:C})]})]})});export{rn as AIAutocomplete,za as AIAutocompleteDropdown,gs as DATE_RANGE_META_END,fs as DATE_RANGE_META_START,bs as DEFAULT_OPTION_COUNT_UNIT,Ts as LOCATION_META_KEY,zs as PRODUCT_PATH_PREFIX,qs as TIME_META_KEY,Vs as WEEKDAY_LABELS,hs as buildSubmitResult,us as cellDay,ms as cellIso,ws as dateCellMarks,vs as formatDate,xs as formatDateRange,ys as formatOptionCount,ks as formatPlace,Cs as formatTime,Ss as isoDate,Ps as monthLabel,Is as optionCountLabel,Es as optionHasImage,As as optionImageSources,Rs as optionImageSrc,Os as optionLabel,Ls as optionsShowLeadingVisuals,Ds as parseDate,Ms as parseLooseDate,Ns as parseLooseDateRange,Fs as parseTime,Hs as productFromMatchedItem,Bs as productImageSources,Ws as productsFromCustomFields,Gs as sanitizeOptionIconSvg,Ks as selectedRangeFor,Ma as useAIAutocomplete,_s as visibleDateRange,Us as withSkippedParams};
|
|
3779
3779
|
//# sourceMappingURL=index.mjs.map
|