@magicx-eng/ai-autocomplete-react 0.17.3 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END as Ni,DATE_RANGE_META_START as zi,dateCellMarks as Bi,formatDate as Gi,formatDateRange as Fi,isoDate as Hi,monthLabel as Ki,parseDate as Wi,parseLooseDate as qi,parseLooseDateRange as Ui,selectedRangeFor as ji,visibleDateRange as $i,WEEKDAY_LABELS as Vi,withSkippedParams as Qi}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as za,useCallback as Xe,useEffect as Tt,useImperativeHandle as Ba,useLayoutEffect as Ga,useRef as Ie}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.AIAutocomplete-module_container_KKjFU {
1
+ import{buildSubmitResult as Bi,cellDay as Gi,cellIso as Fi,DATE_RANGE_META_END as Hi,DATE_RANGE_META_START as Ki,dateCellMarks as Wi,formatDate as qi,formatDateRange as Ui,isoDate as ji,monthLabel as $i,optionLabel as Vi,parseDate as Qi,parseLooseDate as Yi,parseLooseDateRange as Xi,sanitizeOptionIconSvg as Zi,selectedRangeFor as Ji,visibleDateRange as en,WEEKDAY_LABELS as tn,withSkippedParams as on}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Wo,useCallback as Ze,useEffect as Rt,useImperativeHandle as qo,useLayoutEffect as Uo,useRef as Se}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.AIAutocomplete-module_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
@@ -103,6 +103,27 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
103
103
  background: var(--aia-completed-pill-bg-active, rgba(189, 189, 189, 0.35));
104
104
  }
105
105
 
106
+ /* The picked option's icon inside a completed chip (see \`icon_svg\` on
107
+ CompletedParamState). Inline-block, one em square and sat on the text
108
+ baseline, so the chip keeps \`display: inline\` and still wraps across
109
+ lines; contentEditable is off on it (the renderer sets that) so it adds
110
+ no characters to the caret's plain text. */
111
+ :where(.AIAutocomplete-module_input_IW-P-) span[class~="magicx-aia-segment-icon"] {
112
+ display: inline-block;
113
+ width: 1em;
114
+ height: 1em;
115
+ margin-right: 4px;
116
+ vertical-align: -0.125em;
117
+ pointer-events: none;
118
+ user-select: none;
119
+ }
120
+
121
+ :where(.AIAutocomplete-module_input_IW-P-) span[class~="magicx-aia-segment-icon"] svg {
122
+ display: block;
123
+ width: 100%;
124
+ height: 100%;
125
+ }
126
+
106
127
  /* Re-edit highlight \u2014 applied to the completed pill being re-edited (after a
107
128
  tap). Reuses the exact hover fill so the highlight persists from tap until an
108
129
  option is selected. Hides the native caret; cursor switches to text since the
@@ -193,7 +214,7 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
193
214
  opacity: 0;
194
215
  }
195
216
  }
196
- `,document.head.appendChild(e)}var me={container:"AIAutocomplete-module_container_KKjFU",inputWrapper:"AIAutocomplete-module_inputWrapper_FLq1b",editorArea:"AIAutocomplete-module_editorArea_7rBWq",input:"AIAutocomplete-module_input_IW-P-",pillListContainer:"AIAutocomplete-module_pillListContainer_h92IA",submitSlot:"AIAutocomplete-module_submitSlot_GhuCM",aiaPillReveal:"AIAutocomplete-module_aiaPillReveal_wf05b"};import{attachScrollArrow as ya,isCalendarFormat as _a,SCROLL_ARROW_LABEL as ka}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ue,useRef as Le,useState as Pa}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
217
+ `,document.head.appendChild(e)}var me={container:"AIAutocomplete-module_container_KKjFU",inputWrapper:"AIAutocomplete-module_inputWrapper_FLq1b",editorArea:"AIAutocomplete-module_editorArea_7rBWq",input:"AIAutocomplete-module_input_IW-P-",pillListContainer:"AIAutocomplete-module_pillListContainer_h92IA",submitSlot:"AIAutocomplete-module_submitSlot_GhuCM",aiaPillReveal:"AIAutocomplete-module_aiaPillReveal_wf05b"};import{attachScrollArrow as Ao,isCalendarFormat as Do,SCROLL_ARROW_LABEL as Co}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as je,useRef as Me,useState as Eo}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
197
218
  * Built-in appearance defaults \u2014 zero specificity via :where().
198
219
  * Consumer CSS always wins without !important.
199
220
  *
@@ -786,7 +807,7 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
786
807
  opacity: 0.25;
787
808
  }
788
809
  }
789
- `,document.head.appendChild(e)}var ne={dropdown:"AIAutocompleteDropdown-module_dropdown_yz2KC",visible:"AIAutocompleteDropdown-module_visible_QCoXj",scrollArrow:"AIAutocompleteDropdown-module_scrollArrow_uUzV0",pillBar:"AIAutocompleteDropdown-module_pillBar_pwTXe",pillScroll:"AIAutocompleteDropdown-module_pillScroll_Tpzus",skip:"AIAutocompleteDropdown-module_skip_7-olS",skeletonBars:"AIAutocompleteDropdown-module_skeletonBars_HVr9C",skeletonBar:"AIAutocompleteDropdown-module_skeletonBar_O3xIx",aiaSkeletonPulse:"AIAutocompleteDropdown-module_aiaSkeletonPulse_G8W7q"};import{cellDay as Ft,cellIso as be,dateCellMarks as Ht,isoDate as Kt,monthLabel as Wt,visibleDateRange as qt,WEEKDAY_LABELS as Ut}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) ---
810
+ `,document.head.appendChild(e)}var ne={dropdown:"AIAutocompleteDropdown-module_dropdown_yz2KC",visible:"AIAutocompleteDropdown-module_visible_QCoXj",scrollArrow:"AIAutocompleteDropdown-module_scrollArrow_uUzV0",pillBar:"AIAutocompleteDropdown-module_pillBar_pwTXe",pillScroll:"AIAutocompleteDropdown-module_pillScroll_Tpzus",skip:"AIAutocompleteDropdown-module_skip_7-olS",skeletonBars:"AIAutocompleteDropdown-module_skeletonBars_HVr9C",skeletonBar:"AIAutocompleteDropdown-module_skeletonBar_O3xIx",aiaSkeletonPulse:"AIAutocompleteDropdown-module_aiaSkeletonPulse_G8W7q"};import{cellDay as Kt,cellIso as ve,dateCellMarks as Wt,isoDate as qt,monthLabel as Ut,visibleDateRange as jt,WEEKDAY_LABELS as $t}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as Vt}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) ---
790
811
 
791
812
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
792
813
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -949,7 +970,7 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
949
970
  opacity: 0.8;
950
971
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
951
972
  }
952
- `,document.head.appendChild(e)}var I={datepicker:"DateGrid-module_datepicker_6RrTs",header:"DateGrid-module_header_z4LRk",month:"DateGrid-module_month_urB2T",nav:"DateGrid-module_nav_ap4AN",weekdays:"DateGrid-module_weekdays_3EA3q",grid:"DateGrid-module_grid_mQCgw",weekday:"DateGrid-module_weekday_3lF4B",cell:"DateGrid-module_cell_59k0y",number:"DateGrid-module_number_aoT01",day:"DateGrid-module_day_cB3u9",blank:"DateGrid-module_blank_ivgRC",past:"DateGrid-module_past_CEZsj",highlighted:"DateGrid-module_highlighted_YIdtK",today:"DateGrid-module_today_iI3ME",inRange:"DateGrid-module_inRange_r9S2q",selected:"DateGrid-module_selected_28KDn",pressed:"DateGrid-module_pressed_bEyyN"};import{jsx as $,jsxs as it}from"react/jsx-runtime";var $t=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function nt({options:e,activeIndex:r,listboxId:a,view:i,selection:s,onSelect:o,onHighlight:n,onPreviousMonth:f,onNextMonth:g}){let v=Kt(new Date),_=qt({pendingStart:s.rangeStart,highlightedIso:be(e[r]),selected:s.selectedRange});return it("div",{className:I.datepicker,"data-aia-datepicker":"",children:[it("div",{className:I.header,children:[$("button",{type:"button",tabIndex:-1,className:I.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:p=>p.preventDefault(),onClick:f,children:"\u2039"}),$("span",{className:I.month,"data-aia-date-month":"","aria-live":"polite",children:Wt(i)}),$("button",{type:"button",tabIndex:-1,className:I.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:p=>p.preventDefault(),onClick:g,children:"\u203A"})]}),$("div",{className:I.weekdays,"aria-hidden":"true",children:Ut.map((p,w)=>$("span",{className:I.weekday,children:p},$t[w]))}),$("div",{className:I.grid,"data-aia-date-grid":"",children:e.map((p,w)=>$(Vt,{option:p,id:`${a}-option-${w}`,index:w,isHighlighted:w===r&&p.is_tappable,isToday:be(p)===v,isPast:be(p)!=null&&be(p)<v,marks:Ht(be(p),{selectedIso:s.selectedIso,range:_}),onSelect:o,onHighlight:n},be(p)??`pad-${w}`))})]})}function Vt({option:e,id:r,index:a,isHighlighted:i,isToday:s,isPast:o,marks:n,onSelect:f,onHighlight:g}){let[v,_]=jt(!1),p=Ft(e);if(p==null)return $("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${I.cell} ${I.blank}`});let w=()=>{_(!0),f(e),setTimeout(()=>_(!1),170)},y=[I.cell,I.day,o?I.past:"",i?I.highlighted:"",s?I.today:"",n.inRange?I.inRange:"",n.selected?I.selected:"",v?I.pressed:""].filter(Boolean).join(" ");return $("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:y,onClick:w,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),w())},onMouseEnter:()=>g(a),children:$("span",{className:I.number,children:p})})}import{ATTRIBUTION_URL as Qt,buildAttributionUrl as Yt,getFooterHint as Xt}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Zt,useState as Jt}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`@layer layout {
973
+ `,document.head.appendChild(e)}var S={datepicker:"DateGrid-module_datepicker_6RrTs",header:"DateGrid-module_header_z4LRk",month:"DateGrid-module_month_urB2T",nav:"DateGrid-module_nav_ap4AN",weekdays:"DateGrid-module_weekdays_3EA3q",grid:"DateGrid-module_grid_mQCgw",weekday:"DateGrid-module_weekday_3lF4B",cell:"DateGrid-module_cell_59k0y",number:"DateGrid-module_number_aoT01",day:"DateGrid-module_day_cB3u9",blank:"DateGrid-module_blank_ivgRC",past:"DateGrid-module_past_CEZsj",highlighted:"DateGrid-module_highlighted_YIdtK",today:"DateGrid-module_today_iI3ME",inRange:"DateGrid-module_inRange_r9S2q",selected:"DateGrid-module_selected_28KDn",pressed:"DateGrid-module_pressed_bEyyN"};import{jsx as Q,jsxs as nt}from"react/jsx-runtime";var Qt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function rt({options:e,activeIndex:r,listboxId:a,view:n,selection:s,onSelect:o,onHighlight:i,onPreviousMonth:g,onNextMonth:v}){let f=qt(new Date),x=jt({pendingStart:s.rangeStart,highlightedIso:ve(e[r]),selected:s.selectedRange});return nt("div",{className:S.datepicker,"data-aia-datepicker":"",children:[nt("div",{className:S.header,children:[Q("button",{type:"button",tabIndex:-1,className:S.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:h=>h.preventDefault(),onClick:g,children:"\u2039"}),Q("span",{className:S.month,"data-aia-date-month":"","aria-live":"polite",children:Ut(n)}),Q("button",{type:"button",tabIndex:-1,className:S.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:h=>h.preventDefault(),onClick:v,children:"\u203A"})]}),Q("div",{className:S.weekdays,"aria-hidden":"true",children:$t.map((h,y)=>Q("span",{className:S.weekday,children:h},Qt[y]))}),Q("div",{className:S.grid,"data-aia-date-grid":"",children:e.map((h,y)=>Q(Yt,{option:h,id:`${a}-option-${y}`,index:y,isHighlighted:y===r&&h.is_tappable,isToday:ve(h)===f,isPast:ve(h)!=null&&ve(h)<f,marks:Wt(ve(h),{selectedIso:s.selectedIso,range:x}),onSelect:o,onHighlight:i},ve(h)??`pad-${y}`))})]})}function Yt({option:e,id:r,index:a,isHighlighted:n,isToday:s,isPast:o,marks:i,onSelect:g,onHighlight:v}){let[f,x]=Vt(!1),h=Kt(e);if(h==null)return Q("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${S.cell} ${S.blank}`});let y=()=>{x(!0),g(e),setTimeout(()=>x(!1),170)},_=[S.cell,S.day,o?S.past:"",n?S.highlighted:"",s?S.today:"",i.inRange?S.inRange:"",i.selected?S.selected:"",f?S.pressed:""].filter(Boolean).join(" ");return Q("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":n,"aria-label":e.text,tabIndex:0,className:_,onClick:y,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),y())},onMouseEnter:()=>v(a),children:Q("span",{className:S.number,children:h})})}import{ATTRIBUTION_URL as Xt,buildAttributionUrl as Zt,getFooterHint as Jt}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as eo,useState as to}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`@layer layout {
953
974
  .aia-cluster {
954
975
  display: flex;
955
976
  flex-wrap: wrap;
@@ -991,7 +1012,7 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
991
1012
  justify-content: space-around;
992
1013
  }
993
1014
  }
994
- `,document.head.appendChild(e)}import{jsx as rt}from"react/jsx-runtime";function _e({gap:e,align:r="center",justify:a="start",noWrap:i=!1,inline:s=!1,className:o,children:n,...f}){let g=e?{"--aia-cluster-gap":e}:void 0,v={className:o?`aia-cluster ${o}`:"aia-cluster","data-align":r,"data-justify":a,"data-nowrap":i||void 0,"data-inline":s||void 0,style:g,...f};return s?rt("span",{...v,children:n}):rt("div",{...v,children:n})}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
1015
+ `,document.head.appendChild(e)}import{jsx as st}from"react/jsx-runtime";function ke({gap:e,align:r="center",justify:a="start",noWrap:n=!1,inline:s=!1,className:o,children:i,...g}){let v=e?{"--aia-cluster-gap":e}:void 0,f={className:o?`aia-cluster ${o}`:"aia-cluster","data-align":r,"data-justify":a,"data-nowrap":n||void 0,"data-inline":s||void 0,style:v,...g};return s?st("span",{...f,children:i}):st("div",{...f,children:i})}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
995
1016
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
996
1017
  room above the hint/branding row so the footer doesn't butt against the last
997
1018
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -1125,7 +1146,7 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
1125
1146
  justify-content: flex-end;
1126
1147
  }
1127
1148
  }
1128
- `,document.head.appendChild(e)}var re={footer:"DropdownFooter-module_footer_qQQ7x",hintGroup:"DropdownFooter-module_hintGroup_ZzbPf",brandLink:"DropdownFooter-module_brandLink_r4f3R",key:"DropdownFooter-module_key_Bz1H-",hint:"DropdownFooter-module_hint_GKEOH",brand:"DropdownFooter-module_brand_Al-lR",badge:"DropdownFooter-module_badge_Fk9vg",row:"DropdownFooter-module_row_BgZ6Q"};import{jsx as ke,jsxs as Ge}from"react/jsx-runtime";function st({isOptionHighlighted:e=!1,isInputEmpty:r=!1}){let{key:a,hint:i}=Xt(e,r),[s,o]=Jt(Qt);return Zt(()=>{o(Yt())},[]),ke("footer",{className:re.footer,"data-aia-footer":"",children:Ge(_e,{justify:"between",noWrap:!0,className:re.row,children:[Ge(_e,{gap:"5px",className:re.hintGroup,children:[ke("kbd",{className:re.key,children:a}),ke("span",{className:re.hint,children:i})]}),Ge("a",{className:re.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[ke("span",{className:re.brand,children:"AI"}),ke("span",{className:re.badge,children:"Autocomplete"})]})]})})}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,
1149
+ `,document.head.appendChild(e)}var re={footer:"DropdownFooter-module_footer_qQQ7x",hintGroup:"DropdownFooter-module_hintGroup_ZzbPf",brandLink:"DropdownFooter-module_brandLink_r4f3R",key:"DropdownFooter-module_key_Bz1H-",hint:"DropdownFooter-module_hint_GKEOH",brand:"DropdownFooter-module_brand_Al-lR",badge:"DropdownFooter-module_badge_Fk9vg",row:"DropdownFooter-module_row_BgZ6Q"};import{jsx as Pe,jsxs as He}from"react/jsx-runtime";function lt({isOptionHighlighted:e=!1,isInputEmpty:r=!1}){let{key:a,hint:n}=Jt(e,r),[s,o]=to(Xt);return eo(()=>{o(Zt())},[]),Pe("footer",{className:re.footer,"data-aia-footer":"",children:He(ke,{justify:"between",noWrap:!0,className:re.row,children:[He(ke,{gap:"5px",className:re.hintGroup,children:[Pe("kbd",{className:re.key,children:a}),Pe("span",{className:re.hint,children:n})]}),He("a",{className:re.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[Pe("span",{className:re.brand,children:"AI"}),Pe("span",{className:re.badge,children:"Autocomplete"})]})]})})}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,
1129
1150
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
1130
1151
  The border is kept as a 1px transparent line so the box stays the same size
1131
1152
  as it was when the outline was dashed. */
@@ -1182,7 +1203,7 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
1182
1203
  opacity: 0;
1183
1204
  }
1184
1205
  }
1185
- `,document.head.appendChild(e)}var ue={pill:"ParamPill-module_pill_6Ga7S",fadeIn:"ParamPill-module_fadeIn_Ux4eQ",rounded:"ParamPill-module_rounded_y7xA9",skeleton:"ParamPill-module_skeleton_57P0T",skeletonPulse:"ParamPill-module_skeletonPulse_xGcUy"};import{jsx as ea}from"react/jsx-runtime";var Fe={selected:1,first:.7,next:.4,last:.2};function lt({label:e,state:r,rounded:a,loading:i,onClick:s}){let o=[ue.pill,a?ue.rounded:"",i?ue.skeleton:""].filter(Boolean).join(" ");return ea("button",{type:"button","data-aia-pill":"","data-aia-loading":i?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:o,style:{opacity:Fe[r]},onMouseDown:n=>n.preventDefault(),onClick:i?void 0:s,disabled:i,children:e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.PillList-module_list_qvLqO {
1206
+ `,document.head.appendChild(e)}var ue={pill:"ParamPill-module_pill_6Ga7S",fadeIn:"ParamPill-module_fadeIn_Ux4eQ",rounded:"ParamPill-module_rounded_y7xA9",skeleton:"ParamPill-module_skeleton_57P0T",skeletonPulse:"ParamPill-module_skeletonPulse_xGcUy"};import{jsx as oo}from"react/jsx-runtime";var Ke={selected:1,first:.7,next:.4,last:.2};function dt({label:e,state:r,rounded:a,loading:n,onClick:s}){let o=[ue.pill,a?ue.rounded:"",n?ue.skeleton:""].filter(Boolean).join(" ");return oo("button",{type:"button","data-aia-pill":"","data-aia-loading":n?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:o,style:{opacity:Ke[r]},onMouseDown:i=>i.preventDefault(),onClick:n?void 0:s,disabled:n,children:e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.PillList-module_list_qvLqO {
1186
1207
  position: relative;
1187
1208
  z-index: 1;
1188
1209
  pointer-events: auto;
@@ -1192,7 +1213,7 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
1192
1213
  align-items: center;
1193
1214
  vertical-align: middle;
1194
1215
  }
1195
- `,document.head.appendChild(e)}var He={list:"PillList-module_list_qvLqO"};import{jsx as Te}from"react/jsx-runtime";var ta=[125,69];function dt(e){return e===0?"first":e===1?"next":"last"}function Re({pills:e,activePillIndex:r,onSelectPill:a,activeSelected:i,rounded:s,loading:o}){return o&&e.length===0?Te("span",{className:He.list,"data-aia-pill-list-loading":"",children:ta.map((n,f)=>Te("span",{"data-aia-pill-skeleton":"",className:`${ue.pill} ${s?ue.rounded:""} ${ue.skeleton}`,style:{width:n,opacity:Fe[dt(f)]}},`skel-${n}`))}):Te("span",{className:He.list,"data-aia-pill-list-loading":o?"":void 0,children:e.map((n,f)=>{let g=!!i&&f===r;return Te(lt,{label:n.text,state:g?"selected":dt(f),selected:g,rounded:s,loading:o,onClick:()=>a(f)},`${n.type}-${n.text}`)})})}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
1216
+ `,document.head.appendChild(e)}var We={list:"PillList-module_list_qvLqO"};import{jsx as Re}from"react/jsx-runtime";var ao=[125,69];function ct(e){return e===0?"first":e===1?"next":"last"}function Oe({pills:e,activePillIndex:r,onSelectPill:a,activeSelected:n,rounded:s,loading:o}){return o&&e.length===0?Re("span",{className:We.list,"data-aia-pill-list-loading":"",children:ao.map((i,g)=>Re("span",{"data-aia-pill-skeleton":"",className:`${ue.pill} ${s?ue.rounded:""} ${ue.skeleton}`,style:{width:i,opacity:Ke[ct(g)]}},`skel-${i}`))}):Re("span",{className:We.list,"data-aia-pill-list-loading":o?"":void 0,children:e.map((i,g)=>{let v=!!n&&g===r;return Re(dt,{label:i.text,state:v?"selected":ct(g),selected:v,rounded:s,loading:o,onClick:()=>a(g)},`${i.type}-${i.text}`)})})}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
1196
1217
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
1197
1218
  theming one package sees the same result in the other.
1198
1219
 
@@ -1359,7 +1380,7 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
1359
1380
  var(--aia-option-color-selected, var(--aia-color-text-default, #fff))
1360
1381
  );
1361
1382
  }
1362
- `,document.head.appendChild(e)}var H={section:"ProductStrip-module_section_Hugfg",label:"ProductStrip-module_label_nuc93",row:"ProductStrip-module_row_WDVBX",card:"ProductStrip-module_card_JBGYT",media:"ProductStrip-module_media_RrbGe",image:"ProductStrip-module_image_5pNL7",body:"ProductStrip-module_body_ly032",vendor:"ProductStrip-module_vendor_Gvu7G",title:"ProductStrip-module_title_gCNmq",price:"ProductStrip-module_price_gULcE"};import{jsx as he,jsxs as Ke}from"react/jsx-runtime";function ct({products:e,listboxId:r,onSelect:a,onFocusChange:i,focusable:s=!0}){if(e.length===0)return null;let o=`${r}-products-label`;return Ke("section",{className:H.section,"data-aia-products":"",role:"group","aria-labelledby":o,children:[he("div",{className:H.label,id:o,children:"Products"}),he("div",{className:H.row,"data-aia-products-row":"",children:e.map((n,f)=>he(aa,{product:n,id:`${r}-product-${f}`,onSelect:a,onFocusChange:i,focusable:s},n.id))})]})}function aa({product:e,id:r,onSelect:a,onFocusChange:i,focusable:s}){let o=n=>{n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.button!==0||(n.preventDefault(),a(e))};return Ke("a",{id:r,className:H.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:s?0:-1,onClick:o,onKeyDown:n=>{n.key!=="Enter"&&n.key!==" "||(n.preventDefault(),a(e))},onFocus:()=>i?.(!0),onBlur:n=>{n.relatedTarget?.closest("[data-aia-dropdown]")||i?.(!1)},children:[he("span",{className:H.media,"data-aia-product-placeholder":e.imageUrl?void 0:"",children:e.imageUrl?he("img",{className:H.image,src:e.imageUrl,alt:"",loading:"lazy",decoding:"async"}):null}),Ke("span",{className:H.body,children:[e.vendor?he("span",{className:H.vendor,children:e.vendor}):null,he("span",{className:H.title,children:e.title}),e.price?he("span",{className:H.price,children:e.price}):null]})]})}import{isOptionsGridMobileViewport as pa,measureOptionsGrid as ua,needsOptionsGridMeasurement as ha,OPTIONS_GRID_MOBILE_QUERY as ma,optionEnterDelayMs as fa,planOptionsGrid as mt}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ga,useLayoutEffect as ba,useRef as va,useState as gt}from"react";import{optionsGridTemplateColumns as oa}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as ia,useRef as na}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`@layer layout {
1383
+ `,document.head.appendChild(e)}var q={section:"ProductStrip-module_section_Hugfg",label:"ProductStrip-module_label_nuc93",row:"ProductStrip-module_row_WDVBX",card:"ProductStrip-module_card_JBGYT",media:"ProductStrip-module_media_RrbGe",image:"ProductStrip-module_image_5pNL7",body:"ProductStrip-module_body_ly032",vendor:"ProductStrip-module_vendor_Gvu7G",title:"ProductStrip-module_title_gCNmq",price:"ProductStrip-module_price_gULcE"};import{jsx as he,jsxs as qe}from"react/jsx-runtime";function pt({products:e,listboxId:r,onSelect:a,onFocusChange:n,focusable:s=!0}){if(e.length===0)return null;let o=`${r}-products-label`;return qe("section",{className:q.section,"data-aia-products":"",role:"group","aria-labelledby":o,children:[he("div",{className:q.label,id:o,children:"Products"}),he("div",{className:q.row,"data-aia-products-row":"",children:e.map((i,g)=>he(io,{product:i,id:`${r}-product-${g}`,onSelect:a,onFocusChange:n,focusable:s},i.id))})]})}function io({product:e,id:r,onSelect:a,onFocusChange:n,focusable:s}){let o=i=>{i.metaKey||i.ctrlKey||i.shiftKey||i.altKey||i.button!==0||(i.preventDefault(),a(e))};return qe("a",{id:r,className:q.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:s?0:-1,onClick:o,onKeyDown:i=>{i.key!=="Enter"&&i.key!==" "||(i.preventDefault(),a(e))},onFocus:()=>n?.(!0),onBlur:i=>{i.relatedTarget?.closest("[data-aia-dropdown]")||n?.(!1)},children:[he("span",{className:q.media,"data-aia-product-placeholder":e.imageUrl?void 0:"",children:e.imageUrl?he("img",{className:q.image,src:e.imageUrl,alt:"",loading:"lazy",decoding:"async"}):null}),qe("span",{className:q.body,children:[e.vendor?he("span",{className:q.vendor,children:e.vendor}):null,he("span",{className:q.title,children:e.title}),e.price?he("span",{className:q.price,children:e.price}):null]})]})}import{isOptionsGridMobileViewport as bo,measureOptionsGrid as vo,needsOptionsGridMeasurement as wo,OPTIONS_GRID_MOBILE_QUERY as xo,optionEnterDelayMs as yo,planOptionsGrid as gt}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as _o,useLayoutEffect as ko,useRef as Po,useState as bt}from"react";import{optionsGridTemplateColumns as no}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as ro,useRef as so}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`@layer layout {
1363
1384
  .aia-grid {
1364
1385
  display: grid;
1365
1386
  grid-template-columns: repeat(
@@ -1394,7 +1415,7 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
1394
1415
  border-radius: 3px;
1395
1416
  }
1396
1417
  }
1397
- `,document.head.appendChild(e)}import{jsx as ra}from"react/jsx-runtime";function pt({min:e="16rem",max:r,gap:a,scroll:i=!1,maxHeight:s,scrollResetKey:o,cols:n,template:f,innerRef:g,className:v,children:_,...p}){let w=na(null);ia(()=>{if(o===void 0)return;let b=w.current;b&&(b.scrollTop=0)},[o]);let y={"--aia-grid-min":e};return r&&(y["--aia-grid-max"]=r),a&&(y["--aia-grid-gap"]=a),s&&(y["--aia-grid-max-height"]=s),n&&(y.gridTemplateColumns=oa(n)),f&&(y.gridTemplateColumns=f),ra("div",{ref:b=>{w.current=b,g?.(b)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:y,...p,children:_})}import{OPTION_ENTER_DELAY_VAR as sa}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as la,useRef as da,useState as ut}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.SuggestionItem-module_item_d4vpD {
1418
+ `,document.head.appendChild(e)}import{jsx as lo}from"react/jsx-runtime";function ut({min:e="16rem",max:r,gap:a,scroll:n=!1,maxHeight:s,scrollResetKey:o,cols:i,template:g,innerRef:v,className:f,children:x,...h}){let y=so(null);ro(()=>{if(o===void 0)return;let b=y.current;b&&(b.scrollTop=0)},[o]);let _={"--aia-grid-min":e};return r&&(_["--aia-grid-max"]=r),a&&(_["--aia-grid-gap"]=a),s&&(_["--aia-grid-max-height"]=s),i&&(_.gridTemplateColumns=no(i)),g&&(_.gridTemplateColumns=g),lo("div",{ref:b=>{y.current=b,v?.(b)},className:f?`aia-grid ${f}`:"aia-grid","data-scroll":n||void 0,style:_,...h,children:x})}import{OPTION_ENTER_DELAY_VAR as co,optionLabel as po,sanitizeOptionIconSvg as uo}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ho,useMemo as mo,useRef as go,useState as ht}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.SuggestionItem-module_item_d4vpD {
1398
1419
  position: relative;
1399
1420
  overflow: visible;
1400
1421
  display: flex;
@@ -1532,6 +1553,40 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
1532
1553
  display: none;
1533
1554
  }
1534
1555
 
1556
+ /* Server-provided option icon (\`icon_svg\` on the option): a box exactly one
1557
+ text line tall, top-aligned, so it sits centred on the first line of a
1558
+ wrapped option and never grows the line box. The glyph draws in
1559
+ currentColor, so it follows the option's text color through hover and
1560
+ highlight, and is sized in em so --aia-option-font-size scales it. */
1561
+ .SuggestionItem-module_icon_Qw938 {
1562
+ display: inline-flex;
1563
+ align-items: center;
1564
+ height: 21px; /* = the option's line-height */
1565
+ margin-right: 8px;
1566
+ vertical-align: top;
1567
+ }
1568
+
1569
+ .SuggestionItem-module_icon_Qw938 svg {
1570
+ display: block;
1571
+ width: 1em;
1572
+ height: 1em;
1573
+ }
1574
+
1575
+ .SuggestionItem-module_item_d4vpD[data-aia-loading] .SuggestionItem-module_icon_Qw938 {
1576
+ display: none;
1577
+ }
1578
+
1579
+ /* With an icon, the content box hangs its continuation lines: a left pad the
1580
+ width of the icon plus its gap, and a matching negative first-line indent
1581
+ that pulls the icon back into that pad. Wrapped lines then start under the
1582
+ first line's text rather than under the icon. \`.content\` is a flex item
1583
+ (blockified), so text-indent applies to it directly. Skeleton rows are
1584
+ excluded \u2014 their icon is hidden, so the pad would indent the bars. */
1585
+ .SuggestionItem-module_item_d4vpD:not([data-aia-loading]) .SuggestionItem-module_content_T-Qba:has(.SuggestionItem-module_icon_Qw938) {
1586
+ padding-left: calc(1em + 8px);
1587
+ text-indent: calc(-1em - 8px);
1588
+ }
1589
+
1535
1590
  @keyframes SuggestionItem-module_skeletonPulse_plvdD {
1536
1591
  0%,
1537
1592
  100% {
@@ -1541,7 +1596,7 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
1541
1596
  filter: brightness(0.55);
1542
1597
  }
1543
1598
  }
1544
- `,document.head.appendChild(e)}var V={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",riseIn:"SuggestionItem-module_riseIn_etXZT",content:"SuggestionItem-module_content_T-Qba",tappable:"SuggestionItem-module_tappable_70KcX",nonTappable:"SuggestionItem-module_nonTappable_xSZM-",highlighted:"SuggestionItem-module_highlighted_Hb0SU",tag:"SuggestionItem-module_tag_e3Fwe",pressed:"SuggestionItem-module_pressed_98o-r",pressCompress:"SuggestionItem-module_pressCompress_ICV3q",scrollHint:"SuggestionItem-module_scrollHint_xKXPt",skeletonPulse:"SuggestionItem-module_skeletonPulse_plvdD",text:"SuggestionItem-module_text_yqoh9"};import{jsx as We,jsxs as ca}from"react/jsx-runtime";function ht({option:e,isHighlighted:r,onSelect:a,onHighlight:i,id:s,loading:o,scrollHint:n,enterDelayMs:f=0}){let[g]=ut(f),[v,_]=ut(!1),p=da(void 0);la(()=>()=>clearTimeout(p.current),[]);let w=()=>{o||!e.is_tappable||v||(_(!0),a(e),clearTimeout(p.current),p.current=setTimeout(()=>_(!1),170))},y=[V.item,r&&!o?V.highlighted:"",e.is_tappable?V.tappable:V.nonTappable,v?V.pressed:"",n?V.scrollHint:""].filter(Boolean).join(" ");return We("div",{id:s,role:"option","data-aia-option":"","data-aia-loading":o?"":void 0,"aria-selected":r,className:y,style:{[sa]:`${g}ms`},tabIndex:o||!e.is_tappable?-1:0,onClick:w,onKeyDown:b=>{!o&&e.is_tappable&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),w())},onMouseEnter:!o&&e.is_tappable?i:void 0,children:ca("span",{className:V.content,children:[We("span",{className:V.text,children:e.icon?`${e.icon} ${e.text}`:e.text}),e.tag&&We("span",{className:V.tag,children:e.tag})]})})}import{jsx as ft}from"react/jsx-runtime";function wa(){let[e,r]=gt(pa);return ga(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(ma),i=()=>r(a.matches);return i(),a.addEventListener("change",i),()=>a.removeEventListener("change",i)},[]),e}function bt({options:e,activeIndex:r,onSelect:a,onHighlight:i,listboxId:s,loading:o,groupKey:n="",optionsPosition:f="below"}){let g=wa(),v=va(null),[_,p]=gt(null);ba(()=>{let y=v.current,D=y&&!o&&ha(e.length,g)?ua(y):null;p(D?mt(e.length,g,D.rowWidths,D.gridWidth):null)},[e,g,o]);let w=_??mt(e.length,g,null,null);return ft(pt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:n,template:w.template,maxHeight:w.maxHeight,innerRef:y=>{v.current=y},"data-aia-group":n,children:e.map((y,b)=>ft(ht,{option:y,isHighlighted:b===r,onSelect:a,onHighlight:()=>i(b),id:`${s}-option-${b}`,loading:o,scrollHint:!o&&w.scrollHintIndices.includes(b),enterDelayMs:o?0:fa(b,w.cols,e.length,f)},`${n}\0${y.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`@layer layout {
1599
+ `,document.head.appendChild(e)}var U={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",riseIn:"SuggestionItem-module_riseIn_etXZT",content:"SuggestionItem-module_content_T-Qba",tappable:"SuggestionItem-module_tappable_70KcX",nonTappable:"SuggestionItem-module_nonTappable_xSZM-",highlighted:"SuggestionItem-module_highlighted_Hb0SU",tag:"SuggestionItem-module_tag_e3Fwe",pressed:"SuggestionItem-module_pressed_98o-r",pressCompress:"SuggestionItem-module_pressCompress_ICV3q",scrollHint:"SuggestionItem-module_scrollHint_xKXPt",skeletonPulse:"SuggestionItem-module_skeletonPulse_plvdD",text:"SuggestionItem-module_text_yqoh9",icon:"SuggestionItem-module_icon_Qw938"};import{jsx as Le,jsxs as fo}from"react/jsx-runtime";function mt({option:e,isHighlighted:r,onSelect:a,onHighlight:n,id:s,loading:o,showIcon:i=!0,scrollHint:g,enterDelayMs:v=0}){let[f]=ht(v),[x,h]=ht(!1),y=mo(()=>i&&e.icon_svg?uo(e.icon_svg):null,[i,e.icon_svg]),_=go(void 0);ho(()=>()=>clearTimeout(_.current),[]);let b=()=>{o||!e.is_tappable||x||(h(!0),a(e),clearTimeout(_.current),_.current=setTimeout(()=>h(!1),170))},A=[U.item,r&&!o?U.highlighted:"",e.is_tappable?U.tappable:U.nonTappable,x?U.pressed:"",g?U.scrollHint:""].filter(Boolean).join(" ");return Le("div",{id:s,role:"option","data-aia-option":"","data-aia-loading":o?"":void 0,"data-aia-icon":y&&e.icon?e.icon:void 0,"aria-selected":r,className:A,style:{[co]:`${f}ms`},tabIndex:o||!e.is_tappable?-1:0,onClick:b,onKeyDown:k=>{!o&&e.is_tappable&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),b())},onMouseEnter:!o&&e.is_tappable?n:void 0,children:fo("span",{className:U.content,children:[y&&Le("span",{className:`${U.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:y}}),Le("span",{className:U.text,children:po(e)}),e.tag&&Le("span",{className:U.tag,children:e.tag})]})})}import{jsx as ft}from"react/jsx-runtime";function Io(){let[e,r]=bt(bo);return _o(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(xo),n=()=>r(a.matches);return n(),a.addEventListener("change",n),()=>a.removeEventListener("change",n)},[]),e}function vt({options:e,activeIndex:r,onSelect:a,onHighlight:n,listboxId:s,loading:o,groupKey:i="",optionsPosition:g="below",showIcons:v=!0}){let f=Io(),x=Po(null),[h,y]=bt(null);ko(()=>{let b=x.current,k=b&&!o&&wo(e.length,f)?vo(b):null;y(k?gt(e.length,f,k.rowWidths,k.gridWidth):null)},[e,f,o]);let _=h??gt(e.length,f,null,null);return ft(ut,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:i,template:_.template,maxHeight:_.maxHeight,innerRef:b=>{x.current=b},"data-aia-group":i,children:e.map((b,A)=>ft(mt,{option:b,isHighlighted:A===r,onSelect:a,onHighlight:()=>n(A),id:`${s}-option-${A}`,loading:o,showIcon:v,scrollHint:!o&&_.scrollHintIndices.includes(A),enterDelayMs:o?0:yo(A,_.cols,e.length,g)},`${i}\0${b.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`@layer layout {
1545
1600
  .aia-stack {
1546
1601
  display: flex;
1547
1602
  flex-direction: column;
@@ -1558,7 +1613,7 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
1558
1613
  }
1559
1614
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
1560
1615
  }
1561
- `,document.head.appendChild(e)}import{jsx as xa}from"react/jsx-runtime";function vt({space:e,align:r="stretch",className:a,children:i,...s}){let o=e?{"--aia-stack-space":e}:void 0;return xa("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":r,style:o,...s,children:i})}import{jsx as B,jsxs as qe}from"react/jsx-runtime";var Ia=[159,119,164],Aa=()=>{},wt=()=>{};function Sa(e){let r=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,i]=Pa(r);if(Ue(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let s=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>i(s.matches);return s.addEventListener("change",o),()=>s.removeEventListener("change",o)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function Da(e,r){let a=Le(null);Ue(()=>{let i=e.current,s=r.current;if(!i||!s)return;let o=i.querySelector(".aia-grid[data-scroll]");if(a.current&&a.current.grid!==o&&(a.current.controller.destroy(),a.current=null),o&&!a.current){a.current={grid:o,controller:ya({dropdown:i,grid:o,button:s})};return}a.current?.controller.update()}),Ue(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function je({suggestions:e,activeIndex:r,onSelect:a,onHighlight:i,isOpen:s,id:o,className:n,pills:f,onPillClick:g,showPills:v=!0,onSkip:_,showSkipButton:p=!0,skipDisabled:w=!1,activeSelected:y=!1,isLoading:b=!1,isInputEmpty:D=!1,products:C,onProductSelect:Q,onProductFocusChange:Y,formatType:L="options",dateView:k=null,selectedDateIso:X=null,selectedDateRange:Z=null,dateRangeStart:u=null,onPreviousMonth:se,onNextMonth:J,optionsPosition:E="below",mode:W}){let ee=Sa(W),te=ee!==void 0,q=Le(null),U=Le(null);Da(q,U);let R=e[0]?.options??[],ae=!!(f&&f.length>0&&g),le=!!(C&&C.length>0),T=s&&(R.length>0||v&&ae||b||le),O={suggestions:e,activeIndex:r,pills:f,showPills:v,showSkipButton:p,skipDisabled:w,activeSelected:y,isLoading:b,isInputEmpty:D,products:C,formatType:L,dateView:k,selectedDateIso:X,selectedDateRange:Z,dateRangeStart:u},oe=Le(O);T&&(oe.current=O);let t=T?O:oe.current,c=t.suggestions[0],h=c?.options??[],l=t.activeIndex>=0&&!!h[t.activeIndex]?.is_tappable,x=!!(t.pills&&t.pills.length>0&&g),A=t.showPills&&x,M=t.showPills&&!x&&t.isLoading,d=A||M,ie=x&&t.showSkipButton&&!t.isInputEmpty&&!!_,fe=t.pills?.[0]?.text,de=_a(t.formatType)&&t.dateView!=null,ce=h.length>0&&!de,j=h.length>0&&de&&!t.isLoading,ge=t.isLoading&&!ce&&!j,F=t.products??[];return qe("div",{ref:q,id:o,role:"listbox","data-aia-dropdown":"","data-options-position":E,"data-mode":ee,"data-aia-loading":t.isLoading?"":void 0,"data-aia-has-products":F.length>0?"":void 0,className:`${te?"magicx-aia ":""}${ne.dropdown} ${T?ne.visible:""} ${n??""}`,onMouseDown:N=>N.preventDefault(),children:[qe(vt,{space:"8px",children:[(d||ie)&&qe(_e,{noWrap:!0,className:ne.pillBar,"data-aia-pillbar":"",children:[d&&B("span",{className:ne.pillScroll,"data-aia-pill-scroll":"",children:B(Re,{pills:t.pills??[],activePillIndex:0,activeSelected:t.activeSelected,onSelectPill:g??(()=>{}),rounded:!0,loading:t.isLoading})}),ie&&B("button",{type:"button",tabIndex:-1,className:ne.skip,"data-aia-skip":"",disabled:t.isLoading||t.skipDisabled,"aria-label":fe?`Skip ${fe}`:"Skip",onClick:_,children:"skip"})]}),ce&&B(bt,{options:h,activeIndex:t.activeIndex,onSelect:a,onHighlight:i,listboxId:o,loading:t.isLoading,groupKey:c?`${c.type} ${c.text}`:"",optionsPosition:E}),j&&t.dateView&&B(nt,{options:h,activeIndex:t.activeIndex,listboxId:o,view:t.dateView,selection:{selectedIso:t.selectedDateIso??null,selectedRange:t.selectedDateRange??null,rangeStart:t.dateRangeStart??null},onSelect:a,onHighlight:i,onPreviousMonth:se??wt,onNextMonth:J??wt}),ge&&B("div",{className:ne.skeletonBars,"data-aia-skeleton-bars":"",children:Ia.map(N=>B("span",{className:ne.skeletonBar,style:{width:N}},`bar-${N}`))}),B(ct,{products:F,listboxId:o,onSelect:Q??Aa,onFocusChange:Y,focusable:T}),B(st,{isOptionHighlighted:l,isInputEmpty:t.isInputEmpty})]}),B("button",{ref:U,type:"button",tabIndex:-1,className:ne.scrollArrow,"data-aia-scroll-arrow":"","aria-label":ka,"aria-hidden":"true",children:B("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:B("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Fa,ModeController as Ha,setCursorOffset as Ka}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=`.SubmitButton-module_submitButton_otz7H {
1616
+ `,document.head.appendChild(e)}import{jsx as So}from"react/jsx-runtime";function wt({space:e,align:r="stretch",className:a,children:n,...s}){let o=e?{"--aia-stack-space":e}:void 0;return So("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":r,style:o,...s,children:n})}import{jsx as F,jsxs as Ue}from"react/jsx-runtime";var To=[159,119,164],Ro=()=>{},xt=()=>{};function Oo(e){let r=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,n]=Eo(r);if(je(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let s=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>n(s.matches);return s.addEventListener("change",o),()=>s.removeEventListener("change",o)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function Lo(e,r){let a=Me(null);je(()=>{let n=e.current,s=r.current;if(!n||!s)return;let o=n.querySelector(".aia-grid[data-scroll]");if(a.current&&a.current.grid!==o&&(a.current.controller.destroy(),a.current=null),o&&!a.current){a.current={grid:o,controller:Ao({dropdown:n,grid:o,button:s})};return}a.current?.controller.update()}),je(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function $e({suggestions:e,activeIndex:r,onSelect:a,onHighlight:n,isOpen:s,id:o,className:i,pills:g,onPillClick:v,showPills:f=!0,onSkip:x,showSkipButton:h=!0,showOptionIcons:y=!0,skipDisabled:_=!1,activeSelected:b=!1,isLoading:A=!1,isInputEmpty:k=!1,products:E,onProductSelect:Y,onProductFocusChange:X,formatType:M="options",dateView:P=null,selectedDateIso:Z=null,selectedDateRange:J=null,dateRangeStart:u=null,onPreviousMonth:se,onNextMonth:ee,optionsPosition:T="below",mode:le}){let K=Oo(le),de=K!==void 0,$=Me(null),V=Me(null);Lo($,V);let te=e[0]?.options??[],R=!!(g&&g.length>0&&v),oe=!!(E&&E.length>0),N=s&&(te.length>0||f&&R||A||oe),O={suggestions:e,activeIndex:r,pills:g,showPills:f,showSkipButton:h,showOptionIcons:y,skipDisabled:_,activeSelected:b,isLoading:A,isInputEmpty:k,products:E,formatType:M,dateView:P,selectedDateIso:Z,selectedDateRange:J,dateRangeStart:u},ae=Me(O);N&&(ae.current=O);let t=N?O:ae.current,c=t.suggestions[0],p=c?.options??[],l=t.activeIndex>=0&&!!p[t.activeIndex]?.is_tappable,w=!!(t.pills&&t.pills.length>0&&v),D=t.showPills&&w,L=t.showPills&&!w&&t.isLoading,d=D||L,ie=w&&t.showSkipButton&&!t.isInputEmpty&&!!x,ge=t.pills?.[0]?.text,ce=Do(t.formatType)&&t.dateView!=null,fe=p.length>0&&!ce,W=p.length>0&&ce&&!t.isLoading,be=t.isLoading&&!fe&&!W,z=t.products??[];return Ue("div",{ref:$,id:o,role:"listbox","data-aia-dropdown":"","data-options-position":T,"data-mode":K,"data-aia-loading":t.isLoading?"":void 0,"data-aia-has-products":z.length>0?"":void 0,className:`${de?"magicx-aia ":""}${ne.dropdown} ${N?ne.visible:""} ${i??""}`,onMouseDown:B=>B.preventDefault(),children:[Ue(wt,{space:"8px",children:[(d||ie)&&Ue(ke,{noWrap:!0,className:ne.pillBar,"data-aia-pillbar":"",children:[d&&F("span",{className:ne.pillScroll,"data-aia-pill-scroll":"",children:F(Oe,{pills:t.pills??[],activePillIndex:0,activeSelected:t.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:t.isLoading})}),ie&&F("button",{type:"button",tabIndex:-1,className:ne.skip,"data-aia-skip":"",disabled:t.isLoading||t.skipDisabled,"aria-label":ge?`Skip ${ge}`:"Skip",onClick:x,children:"skip"})]}),fe&&F(vt,{options:p,activeIndex:t.activeIndex,onSelect:a,onHighlight:n,listboxId:o,loading:t.isLoading,groupKey:c?`${c.type} ${c.text}`:"",optionsPosition:T,showIcons:t.showOptionIcons}),W&&t.dateView&&F(rt,{options:p,activeIndex:t.activeIndex,listboxId:o,view:t.dateView,selection:{selectedIso:t.selectedDateIso??null,selectedRange:t.selectedDateRange??null,rangeStart:t.dateRangeStart??null},onSelect:a,onHighlight:n,onPreviousMonth:se??xt,onNextMonth:ee??xt}),be&&F("div",{className:ne.skeletonBars,"data-aia-skeleton-bars":"",children:To.map(B=>F("span",{className:ne.skeletonBar,style:{width:B}},`bar-${B}`))}),F(pt,{products:z,listboxId:o,onSelect:Y??Ro,onFocusChange:X,focusable:N}),F(lt,{isOptionHighlighted:l,isInputEmpty:t.isInputEmpty})]}),F("button",{ref:V,type:"button",tabIndex:-1,className:ne.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Co,"aria-hidden":"true",children:F("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:F("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as jo,ModeController as $o,setCursorOffset as Vo}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=`.SubmitButton-module_submitButton_otz7H {
1562
1617
  flex-shrink: 0;
1563
1618
  width: 32px;
1564
1619
  height: 32px;
@@ -1593,5 +1648,5 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
1593
1648
  );
1594
1649
  cursor: default;
1595
1650
  }
1596
- `,document.head.appendChild(e)}var xt={submitButton:"SubmitButton-module_submitButton_otz7H"};import{jsx as $e}from"react/jsx-runtime";function yt({disabled:e,onClick:r}){return $e("button",{type:"button","data-aia-submit":"",className:xt.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),r()},"aria-label":"Submit",children:$e("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:$e("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Ca,dateSelectionFor as Ea,identifiedParamLabel as Ta}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as At,useEffect as Pe,useRef as G,useState as Ra}from"react";import{useRef as _t}from"react";function kt(e){let r=_t(e);r.current=e;let a=Object.keys(e??{}).sort().join("\0"),i=_t({key:"",overrides:void 0});if(i.current.key!==a){let s={};for(let o of Object.keys(e??{})){let n=(f,g,v)=>{let _=r.current?.[o];return _?_(f,g,v):[]};s[o]=n}i.current={key:a,overrides:e?s:void 0}}return{overrides:i.current.overrides,key:a}}import{useRef as Pt}from"react";function It(e){let r=Pt(e);r.current=e;let a=Pt(null);a.current===null&&(a.current={fetch:(s,o)=>{let n=r.current;return n?n.fetch(s,o):Promise.reject(new Error("products config removed"))},transform:s=>r.current?.transform(s)??[],get limit(){return r.current?.limit}});let i=e!==void 0;return{config:i?a.current:void 0,enabled:i}}var La={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],activeFormatType:"options",dateView:null,dateRangeStart:null,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null};function Ve({onSubmit:e,onResult:r,onError:a,optionOverrides:i,maskCompletedText:s,apiConfig:o,additionalContext:n,columns:f=2,dropdownTrigger:g,optionsPosition:v,closeDropdownOnBlur:_,showNonTappableOptions:p,showSkipButton:w,onFocus:y,onBlur:b,value:D,completedParams:C,onChange:Q,onParamsChange:Y,products:L,onProductSelect:k,source:X,setCursor:Z}){let u=G(null),[se,J]=Ra(null),E=G(e);E.current=e;let W=G(r);W.current=r;let ee=G(a);ee.current=a;let te=G(Q);te.current=Q;let q=G(Y);q.current=Y;let U=G(y);U.current=y;let R=G(b);R.current=b;let ae=G(Z);ae.current=Z;let le=G(k);le.current=k;let T=It(L),O=kt(i);Pe(()=>{if(typeof document>"u")return;let m=new Ca(document.createElement("div"),{renderMode:"headless",apiConfig:o,additionalContext:n,optionOverrides:O.overrides,maskCompletedText:s,columns:f,dropdownTrigger:g,optionsPosition:v,closeDropdownOnBlur:_,showNonTappableOptions:p,source:X,value:D,completedParams:C,onSubmit:(...S)=>E.current?.(...S),onResult:(...S)=>W.current?.(...S),onError:(...S)=>ee.current?.(...S),onChange:(...S)=>te.current?.(...S),onParamsChange:(...S)=>q.current?.(...S),onFocus:()=>U.current?.(),onBlur:()=>R.current?.(),onProductSelect:S=>le.current?.(S),setCursor:S=>ae.current?.(S),products:T.config});u.current=m,J(m.getState());let z=m.subscribe(S=>J(S));return()=>{z(),m.destroy(),u.current===m&&(u.current=null)}},[]),Pe(()=>{D!==void 0&&u.current?.setValue(D)},[D]),Pe(()=>{C!==void 0&&u.current?.setCompletedParams(C)},[C]);let oe=JSON.stringify(o??null),t;try{t=JSON.stringify(n??null)}catch{t="[unstringifiable]"}Pe(()=>{u.current?.update({apiConfig:o,additionalContext:n,optionOverrides:O.overrides,dropdownTrigger:g,optionsPosition:v,closeDropdownOnBlur:_,showNonTappableOptions:p})},[oe,t,O.key,g,v,_,p]);let c=G(!1);Pe(()=>{if(!c.current){c.current=!0;return}u.current?.update({products:T.config})},[T.enabled]);let h=G(null);h.current===null&&(h.current={handleTextChange:m=>u.current?.handleTextChange(m),handleKeyDown:m=>{let z="nativeEvent"in m?m.nativeEvent:m;u.current?.handleKeyDown(z)},setFocused:m=>u.current?.setFocused(m),startEditingParam:m=>u.current?.startEditingParam(m),exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:m=>u.current?.handleCaretAfterInput(m),handleCaretMove:m=>u.current?.handleCaretMove(m),replaceEditingRange:m=>u.current?.replaceEditingRange(m)??!1,setActivePill:m=>u.current?.setActivePill(m),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),selectOption:m=>u.current?.selectOption(m),selectProduct:m=>u.current?.selectProduct(m),setActiveDropdownIndex:m=>u.current?.setActiveDropdownIndex(m),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let l=h.current,x=At(m=>{let z=m.target.value,Ne=z.length>0&&!m.nativeEvent?.isComposing&&z[0]!==z[0].toUpperCase()?z[0].toUpperCase()+z.slice(1):z;u.current?.handleTextChange(Ne)},[]),A=At(m=>{u.current?.handleKeyDown(m.nativeEvent)},[]),M=u.current,d=se??La,ie=D!==void 0?D:d.text,fe=C!==void 0?C:d.completedParams,de=d.actionableSuggestions,ce=de[0],j=M?.listboxId??"",ge=d.activeDropdownIndex>=0&&M?`${j}-option-${d.activeDropdownIndex}`:void 0,F=d.editingParam,N=d.editingIdentified,xe=F?{type:F.suggestionType,text:F.suggestionPlaceholder,required:!0,options:F.options}:N?{type:N.type,text:Ta(N.type),required:!0,options:[]}:null,Ae=xe??ce,Me=xe?[xe]:de,ye=Ea(d),Se=!M||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation||d.isSearchingOptions;return{completedParams:fe,skippedParams:d.skippedParams,identifiedParams:d.identifiedParams,suggestionPills:de,setActivePill:l.setActivePill,skipActivePill:l.skipActivePill,removeLastParam:l.removeLastParam,segments:d.segments,newParamId:d.newParamId,clearNewParamId:l.clearNewParamId,suggestions:d.suggestions,activeIndex:d.activeDropdownIndex,isReady:d.isReady,isLoading:Se,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:j,error:d.error,products:d.products,selectProduct:l.selectProduct,handleTextChange:l.handleTextChange,handleKeyDown:l.handleKeyDown,setFocused:l.setFocused,editingParam:F,editingIdentified:N,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:l.startEditingParam,exitEditMode:l.exitEditMode,handleCaretAfterInput:l.handleCaretAfterInput,handleCaretMove:l.handleCaretMove,replaceEditingRange:l.replaceEditingRange,inputProps:{value:ie,placeholder:d.placeholderText||void 0,onChange:x,onKeyDown:A,onFocus:l.handleFocus,onBlur:l.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":ge,"aria-autocomplete":"list","aria-controls":j},reset:l.reset,dropdownProps:{suggestions:Ae?[{...Ae,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:l.selectOption,onHighlight:l.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:j,pills:Me,activeSelected:d.isActivePillSelected,onPillClick:l.setActivePill,onSkip:l.skipActivePill,showSkipButton:(w??!0)&&!F&&!N,skipDisabled:d.inSelectionAnimation,isLoading:Se,isInputEmpty:ie.trim().length===0,products:d.products,onProductSelect:l.selectProduct,onProductFocusChange:l.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:ye.selectedIso,selectedDateRange:ye.selectedRange,dateRangeStart:ye.rangeStart,onPreviousMonth:l.showPreviousMonth,onNextMonth:l.showNextMonth,optionsPosition:v??"below"}}}import{extractPlainText as St,getCursorOffset as Dt,plainTextLength as Oa,renderEditableContent as Ma,setCursorOffset as Ct}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as K,useEffect as Qe,useLayoutEffect as Ye,useRef as ve}from"react";var Oe;function Na(){if(Oe!==void 0)return Oe;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Oe=e.contentEditable==="plaintext-only",Oe}function Et(e){let{segments:r,newParamId:a,editingParam:i,editingIdentified:s,editingAnchor:o,caretOffset:n,placeholderText:f,isFocused:g,isDropdownOpen:v,listboxId:_,activeDescendantId:p,autoFocus:w,handleTextChange:y,handleKeyDown:b,handleCaretAfterInput:D,handleCaretMove:C,startEditingParam:Q,replaceEditingRange:Y,setFocused:L}=e,k=ve(null),X=ve(!1),Z=ve(""),u=ve(""),se=ve(null),J=ve(0);se.current=n,Qe(()=>{if(!w)return;let t=k.current;if(!t)return;document.activeElement===t?L(!0):t.focus();let c=t.ownerDocument??document,h=c.getSelection(),l=h&&h.rangeCount>0&&t.contains(h.anchorNode);if(h&&!l){let x=c.createRange();x.selectNodeContents(t),x.collapse(!0),h.removeAllRanges(),h.addRange(x)}},[w,L]),Qe(()=>{let t=k.current;if(!t)return;let c=t.ownerDocument??document,h=()=>{let l=c.getSelection();if(!l||l.rangeCount===0||!l.anchorNode||!t.contains(l.anchorNode))return;let x=l.anchorNode,A=x.nodeType===Node.ELEMENT_NODE?x:x.parentElement,d=(l.isCollapsed?A?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ie=i?.id??s?.id??null;if(d&&d!==ie){Q(d);return}performance.now()-J.current<50||C(Dt(t))};return c.addEventListener("selectionchange",h),()=>c.removeEventListener("selectionchange",h)},[i,s,Q,C]),Ye(()=>{let t=k.current;t&&Ma({input:t,segments:r,newParamId:a,editingParamId:i?.id??null,placeholderText:f??"",isFocused:g})},[r,a,i,f,g]),Ye(()=>{let t=Z.current,c=a??"";if(Z.current=c,!c||c===t)return;let h=k.current;if(!h)return;h.focus();let l=se.current??Oa(h);Ct(h,l)},[a]),Ye(()=>{let t=u.current,c=i?.id??"";if(u.current=c,!c||c===t||o==null)return;let h=k.current;h&&Ct(h,o)},[i,o]);let E=K(()=>{if(X.current)return;let t=k.current;if(!t)return;let c=St(t),l=c.length>0&&c[0]!==c[0].toUpperCase()?c[0].toUpperCase()+c.slice(1):c;y(l)},[y]),W=K(()=>{J.current=performance.now(),E();let t=k.current;t&&D(Dt(t))},[E,D]);Qe(()=>{let t=k.current;if(!t)return;let c=h=>{let l=h,x=l.inputType;if(x==="insertParagraph"||x==="insertLineBreak"||x==="insertFromDrop"){h.preventDefault();return}if(x.startsWith("insert")||x.startsWith("delete")){let A=x.startsWith("delete")?"":l.data??"";Y(A)&&h.preventDefault()}};return t.addEventListener("beforeinput",c),()=>t.removeEventListener("beforeinput",c)},[Y]);let ee=K(()=>{X.current=!0},[]),te=K(()=>{X.current=!1,E()},[E]),q=K(t=>{t.preventDefault();let c=k.current;if(!c)return;let h=(t.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!h)return;let l=c.ownerDocument??document,x=l.getSelection();if(!x||x.rangeCount===0)return;let A=x.getRangeAt(0);if(!c.contains(A.startContainer))return;A.deleteContents();let M=l.createTextNode(h);A.insertNode(M),A.setStartAfter(M),A.collapse(!0),x.removeAllRanges(),x.addRange(A),E()},[E]),U=K(t=>b(t),[b]),R=K(()=>L(!0),[L]),ae=K(()=>L(!1),[L]),le=K(()=>k.current?.focus(),[]),T=K(()=>k.current?.blur(),[]),O=K(()=>{let t=k.current;return t?St(t):""},[]),oe=Na()?"plaintext-only":"true";return{inputRef:k,editorProps:{ref:k,contentEditable:oe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":_,"aria-expanded":v,"aria-activedescendant":p,spellCheck:!0,enterKeyHint:"send",onInput:W,onKeyDown:U,onCompositionStart:ee,onCompositionEnd:te,onPaste:q,onFocus:R,onBlur:ae},getPlainText:O,focus:le,blur:T}}import{jsx as we,jsxs as Ze}from"react/jsx-runtime";function Wa(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var qa=za(function({onSubmit:r,onResult:a,onError:i,optionOverrides:s,maskCompletedText:o,className:n,apiConfig:f,additionalContext:g,columns:v,pillPlacement:_="dropdown",mode:p="auto",optionsPosition:w="below",animations:y=!0,dropdownTrigger:b,closeDropdownOnBlur:D,showNonTappableOptions:C,showSkipButton:Q,autoFocus:Y=!0,onFocus:L,onBlur:k,value:X,completedParams:Z,onChange:u,onParamsChange:se,products:J,onProductSelect:E,submitButton:W},ee){let te=Ie(null),q=Ie(null),U=Ie(()=>{}),R=Ie(null),ae=Ie(null);Tt(()=>{let P=te.current;if(P)return R.current?R.current.setMode(p):R.current=new Ha(P,p),()=>{R.current?.destroy(),R.current=null}},[p]);let le=Xe(P=>{let pe=ae.current?.current;pe&&(pe.focus(),Ka(pe,P))},[]),{completedParams:T,skippedParams:O,identifiedParams:oe,isReady:t,suggestionPills:c,setActivePill:h,skipActivePill:l,segments:x,newParamId:A,clearNewParamId:M,placeholderText:d,isFocused:ie,isDropdownOpen:fe,isActivePillSelected:de,isLoading:ce,activeIndex:j,listboxId:ge,handleTextChange:F,handleKeyDown:N,setFocused:xe,editingParam:Ae,editingIdentified:Me,editingAnchor:ye,caretOffset:Se,startEditingParam:m,handleCaretAfterInput:z,handleCaretMove:S,replaceEditingRange:Ne,dropdownProps:Rt,reset:De}=Ve({onSubmit:P=>U.current(P),onResult:a,onError:i,optionOverrides:s,maskCompletedText:o,apiConfig:f,additionalContext:g,columns:v,dropdownTrigger:b,optionsPosition:w,closeDropdownOnBlur:D,showNonTappableOptions:C,showSkipButton:Q,onFocus:L,onBlur:k,value:X,completedParams:Z,onChange:u,onParamsChange:se,products:J,onProductSelect:E,source:"full-sdk",setCursor:le});Tt(()=>{if(!A)return;let P=window.setTimeout(()=>M(),650);return()=>window.clearTimeout(P)},[A,M]);let Lt=j>=0?`${ge}-option-${j}`:void 0,{inputRef:ze,editorProps:Ot,focus:Ce,blur:Je,getPlainText:et}=Et({segments:x,newParamId:A,editingParam:Ae,editingIdentified:Me,editingAnchor:ye,caretOffset:Se,placeholderText:d,isFocused:ie,isDropdownOpen:fe,listboxId:ge,activeDescendantId:Lt,autoFocus:Y,handleTextChange:F,handleKeyDown:N,handleCaretAfterInput:z,handleCaretMove:S,startEditingParam:m,replaceEditingRange:Ne,setFocused:xe});ae.current=ze,Ga(()=>{let P=q.current,pe=ze.current;if(!P||!pe)return;let tt=()=>{let ot=P.firstElementChild;if(!ot)return;let Bt=ot.getBoundingClientRect(),Gt=pe.getBoundingClientRect();Bt.top>=Gt.bottom-2?P.setAttribute("data-aia-pill-wrapped",""):P.removeAttribute("data-aia-pill-wrapped")};tt();let at=new ResizeObserver(tt);return at.observe(pe),()=>at.disconnect()},[x,c.length,ce,ze]),Ba(ee,()=>({focus:Ce,blur:Je,reset:De,setMode:P=>R.current?.setMode(P),skipActivePill:l}),[Ce,Je,De,l]);let Ee=!!x.length||T.length>0,Be=Xe(()=>{if(!Ee)return;let P=et();r(Fa(P,T,O,{identifiedParams:oe,isReady:t})),De()},[Ee,T,O,oe,t,r,De,et]);U.current=Be;let Mt=Xe(P=>{P.target?.closest("[data-aia-pill]")||Ce()},[Ce]),Nt=_==="inline",zt=_==="dropdown";return Ze("div",{ref:te,className:`magicx-aia ${me.container} ${n??""}`,"data-pill-placement":_,"data-options-position":w,"data-animations":y?"on":"off","data-mode":Wa(p),children:[we(je,{...Rt,showPills:zt}),Ze("div",{className:me.inputWrapper,onClick:Mt,children:[Ze("div",{className:me.editorArea,"data-aia-editor":"",children:[we("div",{...Ot,className:me.input,"data-aia-input":""}),Nt&&(ce||c.length>0)&&we("span",{ref:q,className:me.pillListContainer,"data-aia-pill-list-container":"",children:we(Re,{pills:c,activePillIndex:0,activeSelected:de,onSelectPill:h,loading:ce})})]}),W===null?null:W===void 0?we(yt,{disabled:!Ee,onClick:Be}):we("span",{"data-aia-submit":"",className:me.submitSlot,onClick:P=>{Ee&&(P.stopPropagation(),Be())},children:W})]})]})});export{qa as AIAutocomplete,je as AIAutocompleteDropdown,Ni as DATE_RANGE_META_END,zi as DATE_RANGE_META_START,Vi as WEEKDAY_LABELS,Li as buildSubmitResult,Oi as cellDay,Mi as cellIso,Bi as dateCellMarks,Gi as formatDate,Fi as formatDateRange,Hi as isoDate,Ki as monthLabel,Wi as parseDate,qi as parseLooseDate,Ui as parseLooseDateRange,ji as selectedRangeFor,Ve as useAIAutocomplete,$i as visibleDateRange,Qi as withSkippedParams};
1651
+ `,document.head.appendChild(e)}var yt={submitButton:"SubmitButton-module_submitButton_otz7H"};import{jsx as Ve}from"react/jsx-runtime";function _t({disabled:e,onClick:r}){return Ve("button",{type:"button","data-aia-submit":"",className:yt.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),r()},"aria-label":"Submit",children:Ve("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:Ve("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Mo,dateSelectionFor as No,identifiedParamLabel as zo}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as At,useEffect as Ie,useRef as H,useState as Bo}from"react";import{useRef as kt}from"react";function Pt(e){let r=kt(e);r.current=e;let a=Object.keys(e??{}).sort().join("\0"),n=kt({key:"",overrides:void 0});if(n.current.key!==a){let s={};for(let o of Object.keys(e??{})){let i=(g,v,f)=>{let x=r.current?.[o];return x?x(g,v,f):[]};s[o]=i}n.current={key:a,overrides:e?s:void 0}}return{overrides:n.current.overrides,key:a}}import{useRef as It}from"react";function St(e){let r=It(e);r.current=e;let a=It(null);a.current===null&&(a.current={fetch:(s,o)=>{let i=r.current;return i?i.fetch(s,o):Promise.reject(new Error("products config removed"))},transform:s=>r.current?.transform(s)??[],get limit(){return r.current?.limit}});let n=e!==void 0;return{config:n?a.current:void 0,enabled:n}}var Go={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],activeFormatType:"options",dateView:null,dateRangeStart:null,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null};function Qe({onSubmit:e,onResult:r,onError:a,optionOverrides:n,maskCompletedText:s,apiConfig:o,additionalContext:i,columns:g=2,dropdownTrigger:v,optionsPosition:f,closeDropdownOnBlur:x,showNonTappableOptions:h,showOptionIcons:y,showSkipButton:_,onFocus:b,onBlur:A,value:k,completedParams:E,onChange:Y,onParamsChange:X,products:M,onProductSelect:P,source:Z,setCursor:J}){let u=H(null),[se,ee]=Bo(null),T=H(e);T.current=e;let le=H(r);le.current=r;let K=H(a);K.current=a;let de=H(Y);de.current=Y;let $=H(X);$.current=X;let V=H(b);V.current=b;let te=H(A);te.current=A;let R=H(J);R.current=J;let oe=H(P);oe.current=P;let N=St(M),O=Pt(n);Ie(()=>{if(typeof document>"u")return;let m=new Mo(document.createElement("div"),{renderMode:"headless",apiConfig:o,additionalContext:i,optionOverrides:O.overrides,maskCompletedText:s,columns:g,dropdownTrigger:v,optionsPosition:f,closeDropdownOnBlur:x,showNonTappableOptions:h,source:Z,value:k,completedParams:E,onSubmit:(...C)=>T.current?.(...C),onResult:(...C)=>le.current?.(...C),onError:(...C)=>K.current?.(...C),onChange:(...C)=>de.current?.(...C),onParamsChange:(...C)=>$.current?.(...C),onFocus:()=>V.current?.(),onBlur:()=>te.current?.(),onProductSelect:C=>oe.current?.(C),setCursor:C=>R.current?.(C),products:N.config});u.current=m,ee(m.getState());let G=m.subscribe(C=>ee(C));return()=>{G(),m.destroy(),u.current===m&&(u.current=null)}},[]),Ie(()=>{k!==void 0&&u.current?.setValue(k)},[k]),Ie(()=>{E!==void 0&&u.current?.setCompletedParams(E)},[E]);let ae=JSON.stringify(o??null),t;try{t=JSON.stringify(i??null)}catch{t="[unstringifiable]"}Ie(()=>{u.current?.update({apiConfig:o,additionalContext:i,optionOverrides:O.overrides,dropdownTrigger:v,optionsPosition:f,closeDropdownOnBlur:x,showNonTappableOptions:h})},[ae,t,O.key,v,f,x,h]);let c=H(!1);Ie(()=>{if(!c.current){c.current=!0;return}u.current?.update({products:N.config})},[N.enabled]);let p=H(null);p.current===null&&(p.current={handleTextChange:m=>u.current?.handleTextChange(m),handleKeyDown:m=>{let G="nativeEvent"in m?m.nativeEvent:m;u.current?.handleKeyDown(G)},setFocused:m=>u.current?.setFocused(m),startEditingParam:m=>u.current?.startEditingParam(m),exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:m=>u.current?.handleCaretAfterInput(m),handleCaretMove:m=>u.current?.handleCaretMove(m),replaceEditingRange:m=>u.current?.replaceEditingRange(m)??!1,setActivePill:m=>u.current?.setActivePill(m),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),selectOption:m=>u.current?.selectOption(m),selectProduct:m=>u.current?.selectProduct(m),setActiveDropdownIndex:m=>u.current?.setActiveDropdownIndex(m),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let l=p.current,w=At(m=>{let G=m.target.value,Be=G.length>0&&!m.nativeEvent?.isComposing&&G[0]!==G[0].toUpperCase()?G[0].toUpperCase()+G.slice(1):G;u.current?.handleTextChange(Be)},[]),D=At(m=>{u.current?.handleKeyDown(m.nativeEvent)},[]),L=u.current,d=se??Go,ie=k!==void 0?k:d.text,ge=E!==void 0?E:d.completedParams,ce=d.actionableSuggestions,fe=ce[0],W=L?.listboxId??"",be=d.activeDropdownIndex>=0&&L?`${W}-option-${d.activeDropdownIndex}`:void 0,z=d.editingParam,B=d.editingIdentified,ye=z?{type:z.suggestionType,text:z.suggestionPlaceholder,required:!0,options:z.options}:B?{type:B.type,text:zo(B.type),required:!0,options:[]}:null,Ae=ye??fe,ze=ye?[ye]:ce,_e=No(d),De=!L||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation||d.isSearchingOptions;return{completedParams:ge,skippedParams:d.skippedParams,identifiedParams:d.identifiedParams,suggestionPills:ce,setActivePill:l.setActivePill,skipActivePill:l.skipActivePill,removeLastParam:l.removeLastParam,segments:d.segments,newParamId:d.newParamId,clearNewParamId:l.clearNewParamId,suggestions:d.suggestions,activeIndex:d.activeDropdownIndex,isReady:d.isReady,isLoading:De,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:W,error:d.error,products:d.products,selectProduct:l.selectProduct,handleTextChange:l.handleTextChange,handleKeyDown:l.handleKeyDown,setFocused:l.setFocused,editingParam:z,editingIdentified:B,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:l.startEditingParam,exitEditMode:l.exitEditMode,handleCaretAfterInput:l.handleCaretAfterInput,handleCaretMove:l.handleCaretMove,replaceEditingRange:l.replaceEditingRange,inputProps:{value:ie,placeholder:d.placeholderText||void 0,onChange:w,onKeyDown:D,onFocus:l.handleFocus,onBlur:l.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":be,"aria-autocomplete":"list","aria-controls":W},reset:l.reset,dropdownProps:{suggestions:Ae?[{...Ae,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:l.selectOption,onHighlight:l.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:W,pills:ze,activeSelected:d.isActivePillSelected,onPillClick:l.setActivePill,onSkip:l.skipActivePill,showSkipButton:(_??!0)&&!z&&!B,showOptionIcons:y??!0,skipDisabled:d.inSelectionAnimation,isLoading:De,isInputEmpty:ie.trim().length===0,products:d.products,onProductSelect:l.selectProduct,onProductFocusChange:l.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:_e.selectedIso,selectedDateRange:_e.selectedRange,dateRangeStart:_e.rangeStart,onPreviousMonth:l.showPreviousMonth,onNextMonth:l.showNextMonth,optionsPosition:f??"below"}}}import{extractPlainText as Dt,getCursorOffset as Ct,plainTextLength as Fo,renderEditableContent as Ho,setCursorOffset as Et}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as j,useEffect as Ye,useLayoutEffect as Xe,useRef as we}from"react";var Ne;function Ko(){if(Ne!==void 0)return Ne;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ne=e.contentEditable==="plaintext-only",Ne}function Tt(e){let{segments:r,showChipIcons:a=!0,newParamId:n,editingParam:s,editingIdentified:o,editingAnchor:i,caretOffset:g,placeholderText:v,isFocused:f,isDropdownOpen:x,listboxId:h,activeDescendantId:y,autoFocus:_,handleTextChange:b,handleKeyDown:A,handleCaretAfterInput:k,handleCaretMove:E,startEditingParam:Y,replaceEditingRange:X,setFocused:M}=e,P=we(null),Z=we(!1),J=we(""),u=we(""),se=we(null),ee=we(0);se.current=g,Ye(()=>{if(!_)return;let t=P.current;if(!t)return;document.activeElement===t?M(!0):t.focus();let c=t.ownerDocument??document,p=c.getSelection(),l=p&&p.rangeCount>0&&t.contains(p.anchorNode);if(p&&!l){let w=c.createRange();w.selectNodeContents(t),w.collapse(!0),p.removeAllRanges(),p.addRange(w)}},[_,M]),Ye(()=>{let t=P.current;if(!t)return;let c=t.ownerDocument??document,p=()=>{let l=c.getSelection();if(!l||l.rangeCount===0||!l.anchorNode||!t.contains(l.anchorNode))return;let w=l.anchorNode,D=w.nodeType===Node.ELEMENT_NODE?w:w.parentElement,d=(l.isCollapsed?D?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ie=s?.id??o?.id??null;if(d&&d!==ie){Y(d);return}performance.now()-ee.current<50||E(Ct(t))};return c.addEventListener("selectionchange",p),()=>c.removeEventListener("selectionchange",p)},[s,o,Y,E]),Xe(()=>{let t=P.current;t&&Ho({input:t,segments:r,newParamId:n,editingParamId:s?.id??null,placeholderText:v??"",isFocused:f,showChipIcons:a})},[r,n,s,v,f,a]),Xe(()=>{let t=J.current,c=n??"";if(J.current=c,!c||c===t)return;let p=P.current;if(!p)return;p.focus();let l=se.current??Fo(p);Et(p,l)},[n]),Xe(()=>{let t=u.current,c=s?.id??"";if(u.current=c,!c||c===t||i==null)return;let p=P.current;p&&Et(p,i)},[s,i]);let T=j(()=>{if(Z.current)return;let t=P.current;if(!t)return;let c=Dt(t),l=c.length>0&&c[0]!==c[0].toUpperCase()?c[0].toUpperCase()+c.slice(1):c;b(l)},[b]),le=j(()=>{ee.current=performance.now(),T();let t=P.current;t&&k(Ct(t))},[T,k]);Ye(()=>{let t=P.current;if(!t)return;let c=p=>{let l=p,w=l.inputType;if(w==="insertParagraph"||w==="insertLineBreak"||w==="insertFromDrop"){p.preventDefault();return}if(w.startsWith("insert")||w.startsWith("delete")){let D=w.startsWith("delete")?"":l.data??"";X(D)&&p.preventDefault()}};return t.addEventListener("beforeinput",c),()=>t.removeEventListener("beforeinput",c)},[X]);let K=j(()=>{Z.current=!0},[]),de=j(()=>{Z.current=!1,T()},[T]),$=j(t=>{t.preventDefault();let c=P.current;if(!c)return;let p=(t.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!p)return;let l=c.ownerDocument??document,w=l.getSelection();if(!w||w.rangeCount===0)return;let D=w.getRangeAt(0);if(!c.contains(D.startContainer))return;D.deleteContents();let L=l.createTextNode(p);D.insertNode(L),D.setStartAfter(L),D.collapse(!0),w.removeAllRanges(),w.addRange(D),T()},[T]),V=j(t=>A(t),[A]),te=j(()=>M(!0),[M]),R=j(()=>M(!1),[M]),oe=j(()=>P.current?.focus(),[]),N=j(()=>P.current?.blur(),[]),O=j(()=>{let t=P.current;return t?Dt(t):""},[]),ae=Ko()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:ae,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":h,"aria-expanded":x,"aria-activedescendant":y,spellCheck:!0,enterKeyHint:"send",onInput:le,onKeyDown:V,onCompositionStart:K,onCompositionEnd:de,onPaste:$,onFocus:te,onBlur:R},getPlainText:O,focus:oe,blur:N}}import{jsx as xe,jsxs as Je}from"react/jsx-runtime";function Qo(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Yo=Wo(function({onSubmit:r,onResult:a,onError:n,optionOverrides:s,maskCompletedText:o,className:i,apiConfig:g,additionalContext:v,columns:f,pillPlacement:x="dropdown",mode:h="auto",optionsPosition:y="below",animations:_=!0,dropdownTrigger:b,closeDropdownOnBlur:A,showNonTappableOptions:k,showOptionIcons:E=!0,showChipIcons:Y=!0,showSkipButton:X,autoFocus:M=!0,onFocus:P,onBlur:Z,value:J,completedParams:u,onChange:se,onParamsChange:ee,products:T,onProductSelect:le,submitButton:K},de){let $=Se(null),V=Se(null),te=Se(()=>{}),R=Se(null),oe=Se(null);Rt(()=>{let I=$.current;if(I)return R.current?R.current.setMode(h):R.current=new $o(I,h),()=>{R.current?.destroy(),R.current=null}},[h]);let N=Ze(I=>{let pe=oe.current?.current;pe&&(pe.focus(),Vo(pe,I))},[]),{completedParams:O,skippedParams:ae,identifiedParams:t,isReady:c,suggestionPills:p,setActivePill:l,skipActivePill:w,segments:D,newParamId:L,clearNewParamId:d,placeholderText:ie,isFocused:ge,isDropdownOpen:ce,isActivePillSelected:fe,isLoading:W,activeIndex:be,listboxId:z,handleTextChange:B,handleKeyDown:ye,setFocused:Ae,editingParam:ze,editingIdentified:_e,editingAnchor:De,caretOffset:m,startEditingParam:G,handleCaretAfterInput:C,handleCaretMove:Be,replaceEditingRange:Ot,dropdownProps:Lt,reset:Ce}=Qe({onSubmit:I=>te.current(I),onResult:a,onError:n,optionOverrides:s,maskCompletedText:o,apiConfig:g,additionalContext:v,columns:f,dropdownTrigger:b,optionsPosition:y,closeDropdownOnBlur:A,showNonTappableOptions:k,showOptionIcons:E,showSkipButton:X,onFocus:P,onBlur:Z,value:J,completedParams:u,onChange:se,onParamsChange:ee,products:T,onProductSelect:le,source:"full-sdk",setCursor:N});Rt(()=>{if(!L)return;let I=window.setTimeout(()=>d(),650);return()=>window.clearTimeout(I)},[L,d]);let Mt=be>=0?`${z}-option-${be}`:void 0,{inputRef:Ge,editorProps:Nt,focus:Ee,blur:et,getPlainText:tt}=Tt({segments:D,newParamId:L,editingParam:ze,editingIdentified:_e,editingAnchor:De,caretOffset:m,placeholderText:ie,isFocused:ge,showChipIcons:Y,isDropdownOpen:ce,listboxId:z,activeDescendantId:Mt,autoFocus:M,handleTextChange:B,handleKeyDown:ye,handleCaretAfterInput:C,handleCaretMove:Be,startEditingParam:G,replaceEditingRange:Ot,setFocused:Ae});oe.current=Ge,Uo(()=>{let I=V.current,pe=Ge.current;if(!I||!pe)return;let ot=()=>{let it=I.firstElementChild;if(!it)return;let Ft=it.getBoundingClientRect(),Ht=pe.getBoundingClientRect();Ft.top>=Ht.bottom-2?I.setAttribute("data-aia-pill-wrapped",""):I.removeAttribute("data-aia-pill-wrapped")};ot();let at=new ResizeObserver(ot);return at.observe(pe),()=>at.disconnect()},[D,p.length,W,Ge]),qo(de,()=>({focus:Ee,blur:et,reset:Ce,setMode:I=>R.current?.setMode(I),skipActivePill:w}),[Ee,et,Ce,w]);let Te=!!D.length||O.length>0,Fe=Ze(()=>{if(!Te)return;let I=tt();r(jo(I,O,ae,{identifiedParams:t,isReady:c})),Ce()},[Te,O,ae,t,c,r,Ce,tt]);te.current=Fe;let zt=Ze(I=>{I.target?.closest("[data-aia-pill]")||Ee()},[Ee]),Bt=x==="inline",Gt=x==="dropdown";return Je("div",{ref:$,className:`magicx-aia ${me.container} ${i??""}`,"data-pill-placement":x,"data-options-position":y,"data-animations":_?"on":"off","data-mode":Qo(h),children:[xe($e,{...Lt,showPills:Gt}),Je("div",{className:me.inputWrapper,onClick:zt,children:[Je("div",{className:me.editorArea,"data-aia-editor":"",children:[xe("div",{...Nt,className:me.input,"data-aia-input":""}),Bt&&(W||p.length>0)&&xe("span",{ref:V,className:me.pillListContainer,"data-aia-pill-list-container":"",children:xe(Oe,{pills:p,activePillIndex:0,activeSelected:fe,onSelectPill:l,loading:W})})]}),K===null?null:K===void 0?xe(_t,{disabled:!Te,onClick:Fe}):xe("span",{"data-aia-submit":"",className:me.submitSlot,onClick:I=>{Te&&(I.stopPropagation(),Fe())},children:K})]})]})});export{Yo as AIAutocomplete,$e as AIAutocompleteDropdown,Hi as DATE_RANGE_META_END,Ki as DATE_RANGE_META_START,tn as WEEKDAY_LABELS,Bi as buildSubmitResult,Gi as cellDay,Fi as cellIso,Wi as dateCellMarks,qi as formatDate,Ui as formatDateRange,ji as isoDate,$i as monthLabel,Vi as optionLabel,Qi as parseDate,Yi as parseLooseDate,Xi as parseLooseDateRange,Zi as sanitizeOptionIconSvg,Ji as selectedRangeFor,Qe as useAIAutocomplete,en as visibleDateRange,on as withSkippedParams};
1597
1652
  //# sourceMappingURL=index.mjs.map