@magicx-eng/ai-autocomplete-react 0.23.1 → 0.24.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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END as Vo,DATE_RANGE_META_START as Qo,dateCellMarks as Zo,formatDate as Yo,formatDateRange as Xo,isoDate as Jo,monthLabel as en,optionLabel as tn,PRODUCT_PATH_PREFIX as an,parseDate as on,parseLooseDate as nn,parseLooseDateRange as rn,productFromMatchedItem as sn,productsFromCustomFields as ln,sanitizeOptionIconSvg as dn,selectedRangeFor as cn,visibleDateRange as pn,WEEKDAY_LABELS as hn,withSkippedParams as un}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as $a,useCallback as Je,useEffect as Mt,useImperativeHandle as Va,useLayoutEffect as Qa,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=`.aia-container-KKjFU {
1
+ import{buildSubmitResult as jo,cellDay as $o,cellIso as Vo,DATE_RANGE_META_END as Qo,DATE_RANGE_META_START as Zo,dateCellMarks as Yo,formatDate as Xo,formatDateRange as Jo,isoDate as en,monthLabel as tn,optionLabel as an,PRODUCT_PATH_PREFIX as on,parseDate as nn,parseLooseDate as rn,parseLooseDateRange as sn,productFromMatchedItem as ln,productsFromCustomFields as dn,sanitizeOptionIconSvg as cn,selectedRangeFor as pn,visibleDateRange as hn,WEEKDAY_LABELS as un,withSkippedParams as fn}from"@magicx-eng/ai-autocomplete-vanilla";import{forwardRef as Va,useCallback as Je,useEffect as Mt,useImperativeHandle as Qa,useLayoutEffect as Za,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=`.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
@@ -71,6 +71,19 @@ import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END a
71
71
  vertical-align: middle;
72
72
  }
73
73
 
74
+ /* WebKit implements \`contenteditable\` as a \`-webkit-user-modify\` presentational
75
+ hint, and the consumer-isolation reset's \`all: revert\` rolls presentational
76
+ hints back \u2014 without this the editor computes to \`read-only\` there and
77
+ nothing can be typed into it (verified in WebKit 26.0 and 26.6; Chromium
78
+ keeps the attribute's effect). Pinned by class per attribute value, which
79
+ outranks the reset. Other engines ignore the property. */
80
+ .aia-input-IW-P-[contenteditable="true"] {
81
+ -webkit-user-modify: read-write;
82
+ }
83
+ .aia-input-IW-P-[contenteditable="plaintext-only"] {
84
+ -webkit-user-modify: read-write-plaintext-only;
85
+ }
86
+
74
87
  /* Completed params render as inline pills (Figma "RichTextPill") \u2014 a compact
75
88
  ~26px chip with regular-weight primary-color text on a faint-gray fill.
76
89
  inline-block gives the padding/radius a box while the text stays part of the
@@ -227,7 +240,7 @@ import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END a
227
240
  opacity: 0;
228
241
  }
229
242
  }
230
- `,document.head.appendChild(e)}var ge={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",aiaPillReveal:"aia-aiaPillReveal-wf05b"};import{attachScrollArrow as Da,isCalendarFormat as La,SCROLL_ARROW_LABEL as Ma}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as $e,useRef as Ne,useState as Oa}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
243
+ `,document.head.appendChild(e)}var ge={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",aiaPillReveal:"aia-aiaPillReveal-wf05b"};import{attachScrollArrow as La,isCalendarFormat as Ma,SCROLL_ARROW_LABEL as Oa}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as $e,useRef as Ne,useState as za}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
231
244
  * Built-in appearance defaults \u2014 zero specificity via :where().
232
245
  * Consumer CSS always wins without !important.
233
246
  *
@@ -982,7 +995,7 @@ import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END a
982
995
  opacity: 0.25;
983
996
  }
984
997
  }
985
- `,document.head.appendChild(e)}var ie={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",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q"};import{cellDay as qt,cellIso as we,dateCellMarks as Ut,isoDate as jt,monthLabel as $t,visibleDateRange as Vt,WEEKDAY_LABELS as Qt}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as Zt}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) ---
998
+ `,document.head.appendChild(e)}var re={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",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q"};import{cellDay as Ut,cellIso as we,dateCellMarks as jt,isoDate as $t,monthLabel as Vt,visibleDateRange as Qt,WEEKDAY_LABELS as Zt}from"@magicx-eng/ai-autocomplete-vanilla";import{useState as Yt}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) ---
986
999
 
987
1000
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
988
1001
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -1145,7 +1158,7 @@ import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END a
1145
1158
  opacity: 0.8;
1146
1159
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
1147
1160
  }
1148
- `,document.head.appendChild(e)}var S={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",pressed:"aia-pressed-bEyyN"};import{jsx as Z,jsxs as rt}from"react/jsx-runtime";var Yt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function st({options:e,activeIndex:r,listboxId:i,view:n,selection:s,onSelect:a,onHighlight:o,onPreviousMonth:g,onNextMonth:f}){let b=jt(new Date),w=Vt({pendingStart:s.rangeStart,highlightedIso:we(e[r]),selected:s.selectedRange});return rt("div",{className:S.datepicker,"data-aia-datepicker":"",children:[rt("div",{className:S.header,children:[Z("button",{type:"button",tabIndex:-1,className:S.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:u=>u.preventDefault(),onClick:g,children:"\u2039"}),Z("span",{className:S.month,"data-aia-date-month":"","aria-live":"polite",children:$t(n)}),Z("button",{type:"button",tabIndex:-1,className:S.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:u=>u.preventDefault(),onClick:f,children:"\u203A"})]}),Z("div",{className:S.weekdays,"aria-hidden":"true",children:Qt.map((u,x)=>Z("span",{className:S.weekday,children:u},Yt[x]))}),Z("div",{className:S.grid,"data-aia-date-grid":"",children:e.map((u,x)=>Z(Xt,{option:u,id:`${i}-option-${x}`,index:x,isHighlighted:x===r&&u.is_tappable,isToday:we(u)===b,isPast:we(u)!=null&&we(u)<b,marks:Ut(we(u),{selectedIso:s.selectedIso,range:w}),onSelect:a,onHighlight:o},we(u)??`pad-${x}`))})]})}function Xt({option:e,id:r,index:i,isHighlighted:n,isToday:s,isPast:a,marks:o,onSelect:g,onHighlight:f}){let[b,w]=Zt(!1),u=qt(e);if(u==null)return Z("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 x=()=>{w(!0),g(e),setTimeout(()=>w(!1),170)},k=[S.cell,S.day,a?S.past:"",n?S.highlighted:"",s?S.today:"",o.inRange?S.inRange:"",o.selected?S.selected:"",b?S.pressed:""].filter(Boolean).join(" ");return Z("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":n,"aria-label":e.text,tabIndex:0,className:k,onClick:x,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),x())},onMouseEnter:()=>f(i),children:Z("span",{className:S.number,children:u})})}import{ATTRIBUTION_URL as Jt,buildAttributionUrl as ea,getFooterHint as ta}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as aa,useState as ia}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 {
1161
+ `,document.head.appendChild(e)}var E={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",pressed:"aia-pressed-bEyyN"};import{jsx as Q,jsxs as rt}from"react/jsx-runtime";var Xt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function st({options:e,activeIndex:r,listboxId:a,view:n,selection:s,onSelect:i,onHighlight:o,onPreviousMonth:g,onNextMonth:b}){let p=$t(new Date),x=Qt({pendingStart:s.rangeStart,highlightedIso:we(e[r]),selected:s.selectedRange});return rt("div",{className:E.datepicker,"data-aia-datepicker":"",children:[rt("div",{className:E.header,children:[Q("button",{type:"button",tabIndex:-1,className:E.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:u=>u.preventDefault(),onClick:g,children:"\u2039"}),Q("span",{className:E.month,"data-aia-date-month":"","aria-live":"polite",children:Vt(n)}),Q("button",{type:"button",tabIndex:-1,className:E.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:u=>u.preventDefault(),onClick:b,children:"\u203A"})]}),Q("div",{className:E.weekdays,"aria-hidden":"true",children:Zt.map((u,y)=>Q("span",{className:E.weekday,children:u},Xt[y]))}),Q("div",{className:E.grid,"data-aia-date-grid":"",children:e.map((u,y)=>Q(Jt,{option:u,id:`${a}-option-${y}`,index:y,isHighlighted:y===r&&u.is_tappable,isToday:we(u)===p,isPast:we(u)!=null&&we(u)<p,marks:jt(we(u),{selectedIso:s.selectedIso,range:x}),onSelect:i,onHighlight:o},we(u)??`pad-${y}`))})]})}function Jt({option:e,id:r,index:a,isHighlighted:n,isToday:s,isPast:i,marks:o,onSelect:g,onHighlight:b}){let[p,x]=Yt(!1),u=Ut(e);if(u==null)return Q("div",{id:r,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${E.cell} ${E.blank}`});let y=()=>{x(!0),g(e),setTimeout(()=>x(!1),170)},k=[E.cell,E.day,i?E.past:"",n?E.highlighted:"",s?E.today:"",o.inRange?E.inRange:"",o.selected?E.selected:"",p?E.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:k,onClick:y,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),y())},onMouseEnter:()=>b(a),children:Q("span",{className:E.number,children:u})})}import{ATTRIBUTION_URL as ea,buildAttributionUrl as ta,getFooterHint as aa}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ia,useState as oa}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 {
1149
1162
  display: flex;
1150
1163
  flex-wrap: wrap;
1151
1164
  gap: var(--aia-cluster-gap, 0.5rem);
@@ -1185,7 +1198,7 @@ import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END a
1185
1198
  .aia-cluster[data-justify="around"] {
1186
1199
  justify-content: space-around;
1187
1200
  }
1188
- `,document.head.appendChild(e)}import{jsx as lt}from"react/jsx-runtime";function Pe({gap:e,align:r="center",justify:i="start",noWrap:n=!1,inline:s=!1,className:a,children:o,...g}){let f=e?{"--aia-cluster-gap":e}:void 0,b={className:a?`aia-cluster ${a}`:"aia-cluster","data-align":r,"data-justify":i,"data-nowrap":n||void 0,"data-inline":s||void 0,style:f,...g};return s?lt("span",{...b,children:o}):lt("div",{...b,children:o})}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
1201
+ `,document.head.appendChild(e)}import{jsx as lt}from"react/jsx-runtime";function Pe({gap:e,align:r="center",justify:a="start",noWrap:n=!1,inline:s=!1,className:i,children:o,...g}){let b=e?{"--aia-cluster-gap":e}:void 0,p={className:i?`aia-cluster ${i}`:"aia-cluster","data-align":r,"data-justify":a,"data-nowrap":n||void 0,"data-inline":s||void 0,style:b,...g};return s?lt("span",{...p,children:o}):lt("div",{...p,children:o})}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
1189
1202
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
1190
1203
  room above the hint/branding row so the footer doesn't butt against the last
1191
1204
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -1319,7 +1332,7 @@ import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END a
1319
1332
  justify-content: flex-end;
1320
1333
  }
1321
1334
  }
1322
- `,document.head.appendChild(e)}var oe={footer:"aia-footer-qQQ7x",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",row:"aia-row-BgZ6Q"};import{jsx as Se,jsxs as We}from"react/jsx-runtime";function dt({isOptionHighlighted:e=!1,isInputEmpty:r=!1}){let{key:i,hint:n}=ta(e,r),[s,a]=ia(Jt);return aa(()=>{a(ea())},[]),Se("footer",{className:oe.footer,"data-aia-footer":"",children:We(Pe,{justify:"between",noWrap:!0,className:oe.row,children:[We(Pe,{gap:"5px",className:oe.hintGroup,children:[Se("kbd",{className:oe.key,children:i}),Se("span",{className:oe.hint,children:n})]}),We("a",{className:oe.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[Se("span",{className:oe.brand,children:"AI"}),Se("span",{className:oe.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,
1335
+ `,document.head.appendChild(e)}var se={footer:"aia-footer-qQQ7x",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",row:"aia-row-BgZ6Q"};import{jsx as Se,jsxs as Ge}from"react/jsx-runtime";function dt({isOptionHighlighted:e=!1,isInputEmpty:r=!1}){let{key:a,hint:n}=aa(e,r),[s,i]=oa(ea);return ia(()=>{i(ta())},[]),Se("footer",{className:se.footer,"data-aia-footer":"",children:Ge(Pe,{justify:"between",noWrap:!0,className:se.row,children:[Ge(Pe,{gap:"5px",className:se.hintGroup,children:[Se("kbd",{className:se.key,children:a}),Se("span",{className:se.hint,children:n})]}),Ge("a",{className:se.brandLink,href:s,target:"_blank",rel:"noopener noreferrer",children:[Se("span",{className:se.brand,children:"AI"}),Se("span",{className:se.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,
1323
1336
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
1324
1337
  The border is kept as a 1px transparent line so the box stays the same size
1325
1338
  as it was when the outline was dashed. */
@@ -1376,7 +1389,7 @@ import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END a
1376
1389
  opacity: 0;
1377
1390
  }
1378
1391
  }
1379
- `,document.head.appendChild(e)}var me={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",skeleton:"aia-skeleton-57P0T",skeletonPulse:"aia-skeletonPulse-xGcUy"};import{jsx as oa}from"react/jsx-runtime";var _e={selected:1,first:.7,next:.4,last:.2};function ct({label:e,state:r,rounded:i,loading:n,onClick:s}){let a=[me.pill,i?me.rounded:"",n?me.skeleton:""].filter(Boolean).join(" ");return oa("button",{type:"button","data-aia-pill":"","data-aia-loading":n?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:a,style:{opacity:_e[r]},onMouseDown:o=>o.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=`.aia-list-qvLqO {
1392
+ `,document.head.appendChild(e)}var ue={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",skeleton:"aia-skeleton-57P0T",skeletonPulse:"aia-skeletonPulse-xGcUy"};import{jsx as na}from"react/jsx-runtime";var _e={selected:1,first:.7,next:.4,last:.2};function ct({label:e,state:r,rounded:a,loading:n,onClick:s}){let i=[ue.pill,a?ue.rounded:"",n?ue.skeleton:""].filter(Boolean).join(" ");return na("button",{type:"button","data-aia-pill":"","data-aia-loading":n?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:i,style:{opacity:_e[r]},onMouseDown:o=>o.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=`.aia-list-qvLqO {
1380
1393
  position: relative;
1381
1394
  z-index: 1;
1382
1395
  pointer-events: auto;
@@ -1386,7 +1399,7 @@ import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END a
1386
1399
  align-items: center;
1387
1400
  vertical-align: middle;
1388
1401
  }
1389
- `,document.head.appendChild(e)}var qe={list:"aia-list-qvLqO"};import{jsx as Me}from"react/jsx-runtime";var na=[125,69];function pt(e){return e===0?"first":e===1?"next":"last"}function Oe({pills:e,activePillIndex:r,onSelectPill:i,activeSelected:n,rounded:s,loading:a}){return a&&e.length===0?Me("span",{className:qe.list,"data-aia-pill-list-loading":"",children:na.map((o,g)=>Me("span",{"data-aia-pill-skeleton":"",className:`${me.pill} ${s?me.rounded:""} ${me.skeleton}`,style:{width:o,opacity:_e[pt(g)]}},`skel-${o}`))}):Me("span",{className:qe.list,"data-aia-pill-list-loading":a?"":void 0,children:e.map((o,g)=>{let f=!!n&&g===r;return Me(ct,{label:o.text,state:f?"selected":pt(g),selected:f,rounded:s,loading:a,onClick:()=>i(g)},`${o.type}-${o.text}`)})})}import{attachProductRowWheel as ra}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as sa,useRef as la}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
1402
+ `,document.head.appendChild(e)}var qe={list:"aia-list-qvLqO"};import{jsx as Me}from"react/jsx-runtime";var ra=[125,69];function pt(e){return e===0?"first":e===1?"next":"last"}function Oe({pills:e,activePillIndex:r,onSelectPill:a,activeSelected:n,rounded:s,loading:i}){return i&&e.length===0?Me("span",{className:qe.list,"data-aia-pill-list-loading":"",children:ra.map((o,g)=>Me("span",{"data-aia-pill-skeleton":"",className:`${ue.pill} ${s?ue.rounded:""} ${ue.skeleton}`,style:{width:o,opacity:_e[pt(g)]}},`skel-${o}`))}):Me("span",{className:qe.list,"data-aia-pill-list-loading":i?"":void 0,children:e.map((o,g)=>{let b=!!n&&g===r;return Me(ct,{label:o.text,state:b?"selected":pt(g),selected:b,rounded:s,loading:i,onClick:()=>a(g)},`${o.type}-${o.text}`)})})}import{attachProductRowWheel as sa}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as la,useRef as da}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
1390
1403
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
1391
1404
  theming one package sees the same result in the other.
1392
1405
 
@@ -1567,7 +1580,44 @@ import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END a
1567
1580
  var(--aia-option-color-selected, var(--aia-color-text-default, #fff))
1568
1581
  );
1569
1582
  }
1570
- `,document.head.appendChild(e)}var _={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"};import{jsx as fe,jsxs as Ue}from"react/jsx-runtime";function ht({products:e,listboxId:r,onSelect:i,onFocusChange:n,focusable:s=!0}){let a=e.length>0,o=la(null);if(sa(()=>{let f=o.current;if(!(!a||!f))return ra(f)},[a]),!a)return null;let g=`${r}-products-label`;return Ue("section",{className:_.section,"data-aia-products":"",role:"group","aria-labelledby":g,children:[fe("div",{className:_.label,id:g,"data-aia-products-label":"",children:"Products"}),fe("div",{ref:o,className:_.row,"data-aia-products-row":"",children:e.map((f,b)=>fe(da,{product:f,id:`${r}-product-${b}`,onSelect:i,onFocusChange:n,focusable:s},f.id))})]})}function da({product:e,id:r,onSelect:i,onFocusChange:n,focusable:s}){let a=o=>{o.metaKey||o.ctrlKey||o.shiftKey||o.altKey||o.button!==0||(o.preventDefault(),i(e))};return Ue("a",{id:r,className:_.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:s?0:-1,onClick:a,onKeyDown:o=>{o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),i(e))},onFocus:()=>n?.(!0),onBlur:o=>{o.relatedTarget?.closest("[data-aia-dropdown]")||n?.(!1)},children:[fe("span",{className:_.media,"data-aia-product-placeholder":e.imageUrl?void 0:"",children:e.imageUrl?fe("img",{className:_.image,src:e.imageUrl,alt:"",loading:"lazy",decoding:"async"}):null}),Ue("span",{className:_.body,children:[e.vendor?fe("span",{className:_.vendor,children:e.vendor}):null,fe("span",{className:_.title,children:e.title}),e.price?fe("span",{className:_.price,children:e.price}):null]})]})}import{isOptionsGridMobileViewport as ya,measureOptionsGrid as ka,needsOptionsGridMeasurement as Ca,OPTIONS_GRID_MOBILE_QUERY as Pa,optionEnterDelayMs as Sa,planOptionsGrid as gt}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ea,useLayoutEffect as Ia,useRef as Ta,useState as vt}from"react";import{optionsGridTemplateColumns as ca}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as pa,useRef as ha}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 {
1583
+
1584
+ /* --- List layout (\`productsLayout: "list"\`) ---
1585
+ The same cards stacked as full-width rows \u2014 thumbnail on the left, text on
1586
+ the right \u2014 for results that read as a list (courses, listings, documents)
1587
+ rather than a shelf. The column scrolls vertically inside its own cap
1588
+ instead of sideways; the dropdown's \`overflow: hidden\` still contains it
1589
+ and the hidden scrollbar chrome above carries over. Appended after the row
1590
+ rules on purpose: the parity test finds each base rule by its first
1591
+ occurrence, and these selectors contain the base selectors. */
1592
+ .aia-section-Hugfg[data-aia-products-layout="list"] .aia-row-WDVBX {
1593
+ flex-direction: column;
1594
+ gap: var(--aia-product-list-gap, 2px);
1595
+ max-height: var(--aia-product-list-max-height, 320px);
1596
+ overflow-x: hidden;
1597
+ overflow-y: auto;
1598
+ overscroll-behavior-y: contain;
1599
+ }
1600
+
1601
+ .aia-section-Hugfg[data-aia-products-layout="list"] .aia-card-JBGYT {
1602
+ flex-direction: row;
1603
+ align-items: center;
1604
+ gap: 10px;
1605
+ width: auto;
1606
+ padding: 6px 8px;
1607
+ }
1608
+
1609
+ /* A fixed square thumbnail: width and height together, so the row's height
1610
+ is the tile's, not the card width's. */
1611
+ .aia-section-Hugfg[data-aia-products-layout="list"] .aia-media-RrbGe {
1612
+ flex: 0 0 auto;
1613
+ width: var(--aia-product-list-media-size, 44px);
1614
+ height: var(--aia-product-list-media-size, 44px);
1615
+ }
1616
+
1617
+ .aia-section-Hugfg[data-aia-products-layout="list"] .aia-body-ly032 {
1618
+ flex: 1 1 auto;
1619
+ }
1620
+ `,document.head.appendChild(e)}var _={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"};import{jsx as fe,jsxs as Ue}from"react/jsx-runtime";function ht({products:e,listboxId:r,onSelect:a,onFocusChange:n,focusable:s=!0,layout:i="row"}){let o=e.length>0,g=da(null);if(la(()=>{let p=g.current;if(!(!o||!p))return sa(p)},[o]),!o)return null;let b=`${r}-products-label`;return Ue("section",{className:_.section,"data-aia-products":"","data-aia-products-layout":i,role:"group","aria-labelledby":b,children:[fe("div",{className:_.label,id:b,"data-aia-products-label":"",children:"Products"}),fe("div",{ref:g,className:_.row,"data-aia-products-row":"",children:e.map((p,x)=>fe(ca,{product:p,id:`${r}-product-${x}`,onSelect:a,onFocusChange:n,focusable:s},p.id))})]})}function ca({product:e,id:r,onSelect:a,onFocusChange:n,focusable:s}){let i=o=>{o.metaKey||o.ctrlKey||o.shiftKey||o.altKey||o.button!==0||(o.preventDefault(),a(e))};return Ue("a",{id:r,className:_.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:s?0:-1,onClick:i,onKeyDown:o=>{o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),a(e))},onFocus:()=>n?.(!0),onBlur:o=>{o.relatedTarget?.closest("[data-aia-dropdown]")||n?.(!1)},children:[fe("span",{className:_.media,"data-aia-product-placeholder":e.imageUrl?void 0:"",children:e.imageUrl?fe("img",{className:_.image,src:e.imageUrl,alt:"",loading:"lazy",decoding:"async"}):null}),Ue("span",{className:_.body,children:[e.vendor?fe("span",{className:_.vendor,children:e.vendor}):null,fe("span",{className:_.title,children:e.title}),e.price?fe("span",{className:_.price,children:e.price}):null]})]})}import{isOptionsGridMobileViewport as ka,measureOptionsGrid as Ca,needsOptionsGridMeasurement as Pa,OPTIONS_GRID_MOBILE_QUERY as Sa,optionEnterDelayMs as Ea,planOptionsGrid as gt}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as Ia,useLayoutEffect as Ta,useRef as Aa,useState as vt}from"react";import{optionsGridTemplateColumns as pa}from"@magicx-eng/ai-autocomplete-vanilla";import{useLayoutEffect as ha,useRef as ua}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 {
1571
1621
  display: grid;
1572
1622
  grid-template-columns: repeat(
1573
1623
  auto-fit,
@@ -1600,7 +1650,7 @@ import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END a
1600
1650
  background: var(--aia-scrollbar-thumb, rgba(0, 0, 0, 0.3));
1601
1651
  border-radius: 3px;
1602
1652
  }
1603
- `,document.head.appendChild(e)}import{jsx as ua}from"react/jsx-runtime";function ut({min:e="16rem",max:r,gap:i,scroll:n=!1,maxHeight:s,scrollResetKey:a,cols:o,template:g,innerRef:f,className:b,children:w,...u}){let x=ha(null);pa(()=>{if(a===void 0)return;let v=x.current;v&&(v.scrollTop=0)},[a]);let k={"--aia-grid-min":e};return r&&(k["--aia-grid-max"]=r),i&&(k["--aia-grid-gap"]=i),s&&(k["--aia-grid-max-height"]=s),o&&(k.gridTemplateColumns=ca(o)),g&&(k.gridTemplateColumns=g),ua("div",{ref:v=>{x.current=v,f?.(v)},className:b?`aia-grid ${b}`:"aia-grid","data-scroll":n||void 0,style:k,...u,children:w})}import{OPTION_ENTER_DELAY_VAR as ma,optionLabel as fa,sanitizeOptionIconSvg as ga}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as ba,useMemo as va,useRef as wa,useState as mt}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 {
1653
+ `,document.head.appendChild(e)}import{jsx as fa}from"react/jsx-runtime";function ut({min:e="16rem",max:r,gap:a,scroll:n=!1,maxHeight:s,scrollResetKey:i,cols:o,template:g,innerRef:b,className:p,children:x,...u}){let y=ua(null);ha(()=>{if(i===void 0)return;let v=y.current;v&&(v.scrollTop=0)},[i]);let k={"--aia-grid-min":e};return r&&(k["--aia-grid-max"]=r),a&&(k["--aia-grid-gap"]=a),s&&(k["--aia-grid-max-height"]=s),o&&(k.gridTemplateColumns=pa(o)),g&&(k.gridTemplateColumns=g),fa("div",{ref:v=>{y.current=v,b?.(v)},className:p?`aia-grid ${p}`:"aia-grid","data-scroll":n||void 0,style:k,...u,children:x})}import{OPTION_ENTER_DELAY_VAR as ma,optionLabel as ga,sanitizeOptionIconSvg as ba}from"@magicx-eng/ai-autocomplete-vanilla";import{useEffect as va,useMemo as wa,useRef as xa,useState as ft}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 {
1604
1654
  position: relative;
1605
1655
  /* Clip, not visible: the entrance rise below runs on the inner content,
1606
1656
  and a transformed box extends its scroll container's scrollable area.
@@ -1805,7 +1855,7 @@ import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END a
1805
1855
  filter: brightness(0.55);
1806
1856
  }
1807
1857
  }
1808
- `,document.head.appendChild(e)}var q={item:"aia-item-d4vpD",fadeIn:"aia-fadeIn-I8u35",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",icon:"aia-icon-Qw938"};import{jsx as ze,jsxs as xa}from"react/jsx-runtime";function ft({option:e,isHighlighted:r,onSelect:i,onHighlight:n,id:s,loading:a,showIcon:o=!0,scrollHint:g,enterDelayMs:f=0}){let[b]=mt(f),[w,u]=mt(!1),x=va(()=>o&&e.icon_svg?ga(e.icon_svg):null,[o,e.icon_svg]),k=wa(void 0);ba(()=>()=>clearTimeout(k.current),[]);let v=()=>{a||!e.is_tappable||w||(u(!0),i(e),clearTimeout(k.current),k.current=setTimeout(()=>u(!1),170))},E=[q.item,r&&!a?q.highlighted:"",e.is_tappable?q.tappable:q.nonTappable,w?q.pressed:"",g?q.scrollHint:""].filter(Boolean).join(" ");return ze("div",{id:s,role:"option","data-aia-option":"","data-aia-loading":a?"":void 0,"data-aia-icon":x&&e.icon?e.icon:void 0,"aria-selected":r,className:E,style:{[ma]:`${b}ms`},tabIndex:a||!e.is_tappable?-1:0,onClick:v,onKeyDown:T=>{!a&&e.is_tappable&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),v())},onMouseEnter:!a&&e.is_tappable?n:void 0,children:xa("span",{className:q.content,children:[x&&ze("span",{className:`${q.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:x}}),ze("span",{className:q.text,children:fa(e)}),e.tag&&ze("span",{className:q.tag,children:e.tag})]})})}import{jsx as bt}from"react/jsx-runtime";function Aa(){let[e,r]=vt(ya);return Ea(()=>{if(typeof window>"u"||!window.matchMedia)return;let i=window.matchMedia(Pa),n=()=>r(i.matches);return n(),i.addEventListener("change",n),()=>i.removeEventListener("change",n)},[]),e}function wt({options:e,activeIndex:r,onSelect:i,onHighlight:n,listboxId:s,loading:a,groupKey:o="",optionsPosition:g="below",showIcons:f=!0}){let b=Aa(),w=Ta(null),[u,x]=vt(null);Ia(()=>{let v=w.current,T=v&&!a&&Ca(e.length,b)?ka(v):null;x(T?gt(e.length,b,T.rowWidths,T.gridWidth):null)},[e,b,a]);let k=u??gt(e.length,b,null,null);return bt(ut,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:o,template:k.template,maxHeight:k.maxHeight,innerRef:v=>{w.current=v},"data-aia-group":o,children:e.map((v,E)=>bt(ft,{option:v,isHighlighted:E===r,onSelect:i,onHighlight:()=>n(E),id:`${s}-option-${E}`,loading:a,showIcon:f,scrollHint:!a&&k.scrollHintIndices.includes(E),enterDelayMs:a?0:Sa(E,k.cols,e.length,g)},`${o}\0${v.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
1858
+ `,document.head.appendChild(e)}var q={item:"aia-item-d4vpD",fadeIn:"aia-fadeIn-I8u35",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",icon:"aia-icon-Qw938"};import{jsx as ze,jsxs as ya}from"react/jsx-runtime";function mt({option:e,isHighlighted:r,onSelect:a,onHighlight:n,id:s,loading:i,showIcon:o=!0,scrollHint:g,enterDelayMs:b=0}){let[p]=ft(b),[x,u]=ft(!1),y=wa(()=>o&&e.icon_svg?ba(e.icon_svg):null,[o,e.icon_svg]),k=xa(void 0);va(()=>()=>clearTimeout(k.current),[]);let v=()=>{i||!e.is_tappable||x||(u(!0),a(e),clearTimeout(k.current),k.current=setTimeout(()=>u(!1),170))},I=[q.item,r&&!i?q.highlighted:"",e.is_tappable?q.tappable:q.nonTappable,x?q.pressed:"",g?q.scrollHint:""].filter(Boolean).join(" ");return ze("div",{id:s,role:"option","data-aia-option":"","data-aia-loading":i?"":void 0,"data-aia-icon":y&&e.icon?e.icon:void 0,"aria-selected":r,className:I,style:{[ma]:`${p}ms`},tabIndex:i||!e.is_tappable?-1:0,onClick:v,onKeyDown:A=>{!i&&e.is_tappable&&(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),v())},onMouseEnter:!i&&e.is_tappable?n:void 0,children:ya("span",{className:q.content,children:[y&&ze("span",{className:`${q.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:y}}),ze("span",{className:q.text,children:ga(e)}),e.tag&&ze("span",{className:q.tag,children:e.tag})]})})}import{jsx as bt}from"react/jsx-runtime";function Ra(){let[e,r]=vt(ka);return Ia(()=>{if(typeof window>"u"||!window.matchMedia)return;let a=window.matchMedia(Sa),n=()=>r(a.matches);return n(),a.addEventListener("change",n),()=>a.removeEventListener("change",n)},[]),e}function wt({options:e,activeIndex:r,onSelect:a,onHighlight:n,listboxId:s,loading:i,groupKey:o="",optionsPosition:g="below",showIcons:b=!0}){let p=Ra(),x=Aa(null),[u,y]=vt(null);Ta(()=>{let v=x.current,A=v&&!i&&Pa(e.length,p)?Ca(v):null;y(A?gt(e.length,p,A.rowWidths,A.gridWidth):null)},[e,p,i]);let k=u??gt(e.length,p,null,null);return bt(ut,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:o,template:k.template,maxHeight:k.maxHeight,innerRef:v=>{x.current=v},"data-aia-group":o,children:e.map((v,I)=>bt(mt,{option:v,isHighlighted:I===r,onSelect:a,onHighlight:()=>n(I),id:`${s}-option-${I}`,loading:i,showIcon:b,scrollHint:!i&&k.scrollHintIndices.includes(I),enterDelayMs:i?0:Ea(I,k.cols,e.length,g)},`${o}\0${v.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
1809
1859
  display: flex;
1810
1860
  flex-direction: column;
1811
1861
  gap: var(--aia-stack-space, 0.5rem);
@@ -1820,7 +1870,7 @@ import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END a
1820
1870
  align-items: end;
1821
1871
  }
1822
1872
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
1823
- `,document.head.appendChild(e)}import{jsx as Ra}from"react/jsx-runtime";function xt({space:e,align:r="stretch",className:i,children:n,...s}){let a=e?{"--aia-stack-space":e}:void 0;return Ra("div",{className:i?`aia-stack ${i}`:"aia-stack","data-align":r,style:a,...s,children:n})}import{jsx as K,jsxs as je}from"react/jsx-runtime";var za=[159,119,164],Na=()=>{},yt=()=>{};function Ha(e){let r=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[i,n]=Oa(r);if($e(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let s=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>n(s.matches);return s.addEventListener("change",a),()=>s.removeEventListener("change",a)},[e]),e!==void 0)return e==="auto"?i?"dark":"light":e}function Ba(e,r){let i=Ne(null);$e(()=>{let n=e.current,s=r.current;if(!n||!s)return;let a=n.querySelector(".aia-grid[data-scroll]");if(i.current&&i.current.grid!==a&&(i.current.controller.destroy(),i.current=null),a&&!i.current){i.current={grid:a,controller:Da({dropdown:n,grid:a,button:s})};return}i.current?.controller.update()}),$e(()=>()=>{i.current?.controller.destroy(),i.current=null},[])}function Ve({suggestions:e,activeIndex:r,onSelect:i,onHighlight:n,isOpen:s,id:a,className:o,pills:g,onPillClick:f,showPills:b=!0,onSkip:w,showSkipButton:u=!0,showOptionIcons:x=!0,skipDisabled:k=!1,activeSelected:v=!1,isLoading:E=!1,isInputEmpty:T=!1,products:R,onProductSelect:O,onProductFocusChange:Y,formatType:z="options",dateView:P=null,selectedDateIso:j=null,selectedDateRange:ne=null,dateRangeStart:X=null,onPreviousMonth:p,onNextMonth:re,optionsPosition:D="below",mode:se}){let J=Ha(se),$=J!==void 0,ee=Ne(null),V=Ne(null);Ba(ee,V);let te=e[0]?.options??[],ae=!!(g&&g.length>0&&f),N=!!(R&&R.length>0),H=s&&(te.length>0||b&&ae||E||N),W={suggestions:e,activeIndex:r,pills:g,showPills:b,showSkipButton:u,showOptionIcons:x,skipDisabled:k,activeSelected:v,isLoading:E,isInputEmpty:T,products:R,formatType:z,dateView:P,selectedDateIso:j,selectedDateRange:ne,dateRangeStart:X},B=Ne(W);H&&(B.current=W);let t=H?W:B.current,c=t.suggestions[0],h=c?.options??[],y=t.activeIndex>=0&&!!h[t.activeIndex]?.is_tappable,l=!!(t.pills&&t.pills.length>0&&f),A=t.showPills&&l,Q=t.showPills&&!l&&t.isLoading,L=A||Q,d=l&&t.showSkipButton&&!t.isInputEmpty&&!!w,le=t.pills?.[0]?.text,be=La(t.formatType)&&t.dateView!=null,de=h.length>0&&!be,ve=h.length>0&&be&&!t.isLoading,ce=t.isLoading&&!de&&!ve,pe=t.products??[];return je("div",{ref:ee,id:a,role:"listbox","data-aia-dropdown":"","data-options-position":D,"data-mode":J,"data-aia-loading":t.isLoading?"":void 0,"data-aia-has-products":pe.length>0?"":void 0,className:`${$?"magicx-aia ":""}${ie.dropdown} ${H?ie.visible:""} ${o??""}`,onMouseDown:M=>M.preventDefault(),children:[je(xt,{space:"8px",children:[(L||d)&&je(Pe,{noWrap:!0,className:ie.pillBar,"data-aia-pillbar":"",children:[L&&K("span",{className:ie.pillScroll,"data-aia-pill-scroll":"",children:K(Oe,{pills:t.pills??[],activePillIndex:0,activeSelected:t.activeSelected,onSelectPill:f??(()=>{}),rounded:!0,loading:t.isLoading})}),d&&K("button",{type:"button",tabIndex:-1,className:ie.skip,"data-aia-skip":"",disabled:t.isLoading||t.skipDisabled,"aria-label":le?`Skip ${le}`:"Skip",onClick:w,children:"skip"})]}),de&&K(wt,{options:h,activeIndex:t.activeIndex,onSelect:i,onHighlight:n,listboxId:a,loading:t.isLoading,groupKey:c?`${c.type} ${c.text}`:"",optionsPosition:D,showIcons:t.showOptionIcons}),ve&&t.dateView&&K(st,{options:h,activeIndex:t.activeIndex,listboxId:a,view:t.dateView,selection:{selectedIso:t.selectedDateIso??null,selectedRange:t.selectedDateRange??null,rangeStart:t.dateRangeStart??null},onSelect:i,onHighlight:n,onPreviousMonth:p??yt,onNextMonth:re??yt}),ce&&K("div",{className:ie.skeletonBars,"data-aia-skeleton-bars":"",children:za.map(M=>K("span",{className:ie.skeletonBar,style:{width:M}},`bar-${M}`))}),K(ht,{products:pe,listboxId:a,onSelect:O??Na,onFocusChange:Y,focusable:H}),K(dt,{isOptionHighlighted:y,isInputEmpty:t.isInputEmpty})]}),K("button",{ref:V,type:"button",tabIndex:-1,className:ie.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Ma,"aria-hidden":"true",children:K("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:K("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Za,ModeController as Ya,setCursorOffset as Xa}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 {
1873
+ `,document.head.appendChild(e)}import{jsx as Da}from"react/jsx-runtime";function xt({space:e,align:r="stretch",className:a,children:n,...s}){let i=e?{"--aia-stack-space":e}:void 0;return Da("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":r,style:i,...s,children:n})}import{jsx as K,jsxs as je}from"react/jsx-runtime";var Na=[159,119,164],Ha=()=>{},yt=()=>{};function Ba(e){let r=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,n]=za(r);if($e(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let s=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>n(s.matches);return s.addEventListener("change",i),()=>s.removeEventListener("change",i)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function Fa(e,r){let a=Ne(null);$e(()=>{let n=e.current,s=r.current;if(!n||!s)return;let i=n.querySelector(".aia-grid[data-scroll]");if(a.current&&a.current.grid!==i&&(a.current.controller.destroy(),a.current=null),i&&!a.current){a.current={grid:i,controller:La({dropdown:n,grid:i,button:s})};return}a.current?.controller.update()}),$e(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function Ve({suggestions:e,activeIndex:r,onSelect:a,onHighlight:n,isOpen:s,id:i,className:o,pills:g,onPillClick:b,showPills:p=!0,onSkip:x,showSkipButton:u=!0,showOptionIcons:y=!0,skipDisabled:k=!1,activeSelected:v=!1,isLoading:I=!1,isInputEmpty:A=!1,products:R,onProductSelect:D,onProductFocusChange:Z,productsLayout:L="row",formatType:P="options",dateView:j=null,selectedDateIso:le=null,selectedDateRange:Y=null,dateRangeStart:h=null,onPreviousMonth:de,onNextMonth:M,optionsPosition:X="below",mode:ce}){let J=Ba(ce),$=J!==void 0,ee=Ne(null),V=Ne(null);Fa(ee,V);let te=e[0]?.options??[],ae=!!(g&&g.length>0&&b),O=!!(R&&R.length>0),z=s&&(te.length>0||p&&ae||I||O),G={suggestions:e,activeIndex:r,pills:g,showPills:p,showSkipButton:u,showOptionIcons:y,skipDisabled:k,activeSelected:v,isLoading:I,isInputEmpty:A,products:R,formatType:P,dateView:j,selectedDateIso:le,selectedDateRange:Y,dateRangeStart:h},c=Ne(G);z&&(c.current=G);let t=z?G:c.current,f=t.suggestions[0],w=f?.options??[],l=t.activeIndex>=0&&!!w[t.activeIndex]?.is_tappable,S=!!(t.pills&&t.pills.length>0&&b),ie=t.showPills&&S,B=t.showPills&&!S&&t.isLoading,d=ie||B,oe=S&&t.showSkipButton&&!t.isInputEmpty&&!!x,me=t.pills?.[0]?.text,pe=Ma(t.formatType)&&t.dateView!=null,be=w.length>0&&!pe,ne=w.length>0&&pe&&!t.isLoading,ke=t.isLoading&&!be&&!ne,N=t.products??[];return je("div",{ref:ee,id:i,role:"listbox","data-aia-dropdown":"","data-options-position":X,"data-mode":J,"data-aia-loading":t.isLoading?"":void 0,"data-aia-has-products":N.length>0?"":void 0,className:`${$?"magicx-aia ":""}${re.dropdown} ${z?re.visible:""} ${o??""}`,onMouseDown:H=>H.preventDefault(),children:[je(xt,{space:"8px",children:[(d||oe)&&je(Pe,{noWrap:!0,className:re.pillBar,"data-aia-pillbar":"",children:[d&&K("span",{className:re.pillScroll,"data-aia-pill-scroll":"",children:K(Oe,{pills:t.pills??[],activePillIndex:0,activeSelected:t.activeSelected,onSelectPill:b??(()=>{}),rounded:!0,loading:t.isLoading})}),oe&&K("button",{type:"button",tabIndex:-1,className:re.skip,"data-aia-skip":"",disabled:t.isLoading||t.skipDisabled,"aria-label":me?`Skip ${me}`:"Skip",onClick:x,children:"skip"})]}),be&&K(wt,{options:w,activeIndex:t.activeIndex,onSelect:a,onHighlight:n,listboxId:i,loading:t.isLoading,groupKey:f?`${f.type} ${f.text}`:"",optionsPosition:X,showIcons:t.showOptionIcons}),ne&&t.dateView&&K(st,{options:w,activeIndex:t.activeIndex,listboxId:i,view:t.dateView,selection:{selectedIso:t.selectedDateIso??null,selectedRange:t.selectedDateRange??null,rangeStart:t.dateRangeStart??null},onSelect:a,onHighlight:n,onPreviousMonth:de??yt,onNextMonth:M??yt}),ke&&K("div",{className:re.skeletonBars,"data-aia-skeleton-bars":"",children:Na.map(H=>K("span",{className:re.skeletonBar,style:{width:H}},`bar-${H}`))}),K(ht,{products:N,listboxId:i,onSelect:D??Ha,onFocusChange:Z,focusable:z,layout:L}),K(dt,{isOptionHighlighted:l,isInputEmpty:t.isInputEmpty})]}),K("button",{ref:V,type:"button",tabIndex:-1,className:re.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Oa,"aria-hidden":"true",children:K("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:K("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Ya,ModeController as Xa,setCursorOffset as Ja}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 {
1824
1874
  flex-shrink: 0;
1825
1875
  width: 32px;
1826
1876
  height: 32px;
@@ -1873,5 +1923,5 @@ import{buildSubmitResult as Uo,cellDay as jo,cellIso as $o,DATE_RANGE_META_END a
1873
1923
  );
1874
1924
  cursor: default;
1875
1925
  }
1876
- `,document.head.appendChild(e)}var kt={submitButton:"aia-submitButton-otz7H"};import{jsx as Qe}from"react/jsx-runtime";function Ct({disabled:e,onClick:r}){return Qe("button",{type:"button","data-aia-submit":"",className:kt.submitButton,disabled:e,onClick:i=>{i.stopPropagation(),r()},"aria-label":"Submit",children:Qe("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:Qe("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Fa,dateSelectionFor as Ka,identifiedParamLabel as Ga}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Tt,useEffect as Ee,useRef as G,useState as Wa}from"react";import{useRef as Pt}from"react";function St(e){let r=Pt(e);r.current=e;let i=Object.keys(e??{}).sort().join("\0"),n=Pt({key:"",overrides:void 0});if(n.current.key!==i){let s={};for(let a of Object.keys(e??{})){let o=(g,f,b)=>{let w=r.current?.[a];return w?w(g,f,b):[]};s[a]=o}n.current={key:i,overrides:e?s:void 0}}return{overrides:n.current.overrides,key:i}}import{useRef as Et}from"react";function It(e){let r=Et(e);r.current=e;let i=Et(null);i.current===null&&(i.current={fetch:(s,a)=>{let o=r.current;return o?o.fetch(s,a):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?i.current:void 0,enabled:n}}var _a={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],customFields:null,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 Ze({onSubmit:e,onResult:r,onError:i,optionOverrides:n,maskCompletedText:s,apiConfig:a,additionalContext:o,columns:g=2,dropdownTrigger:f,optionsPosition:b,closeDropdownOnBlur:w,showNonTappableOptions:u,showOptionIcons:x,showSkipButton:k,showProducts:v,onFocus:E,onBlur:T,value:R,completedParams:O,onChange:Y,onParamsChange:z,products:P,onProductSelect:j,source:ne,setCursor:X}){let p=G(null),[re,D]=Wa(null),se=G(e);se.current=e;let J=G(r);J.current=r;let $=G(i);$.current=i;let ee=G(Y);ee.current=Y;let V=G(z);V.current=z;let te=G(E);te.current=E;let ae=G(T);ae.current=T;let N=G(X);N.current=X;let H=G(j);H.current=j;let W=It(P),B=St(n);Ee(()=>{if(typeof document>"u")return;let m=new Fa(document.createElement("div"),{renderMode:"headless",apiConfig:a,additionalContext:o,optionOverrides:B.overrides,maskCompletedText:s,columns:g,dropdownTrigger:f,optionsPosition:b,closeDropdownOnBlur:w,showNonTappableOptions:u,showProducts:v,source:ne,value:R,completedParams:O,onSubmit:(...I)=>se.current?.(...I),onResult:(...I)=>J.current?.(...I),onError:(...I)=>$.current?.(...I),onChange:(...I)=>ee.current?.(...I),onParamsChange:(...I)=>V.current?.(...I),onFocus:()=>te.current?.(),onBlur:()=>ae.current?.(),onProductSelect:I=>H.current?.(I),setCursor:I=>N.current?.(I),products:W.config});p.current=m,D(m.getState());let F=m.subscribe(I=>D(I));return()=>{F(),m.destroy(),p.current===m&&(p.current=null)}},[]),Ee(()=>{R!==void 0&&p.current?.setValue(R)},[R]),Ee(()=>{O!==void 0&&p.current?.setCompletedParams(O)},[O]);let t=JSON.stringify(a??null),c;try{c=JSON.stringify(o??null)}catch{c="[unstringifiable]"}Ee(()=>{p.current?.update({apiConfig:a,additionalContext:o,optionOverrides:B.overrides,dropdownTrigger:f,optionsPosition:b,closeDropdownOnBlur:w,showNonTappableOptions:u,showProducts:v})},[t,c,B.key,f,b,w,u,v]);let h=G(!1);Ee(()=>{if(!h.current){h.current=!0;return}p.current?.update({products:W.config})},[W.enabled]);let y=G(null);y.current===null&&(y.current={handleTextChange:m=>p.current?.handleTextChange(m),handleKeyDown:m=>{let F="nativeEvent"in m?m.nativeEvent:m;p.current?.handleKeyDown(F)},setFocused:m=>p.current?.setFocused(m),startEditingParam:m=>p.current?.startEditingParam(m),exitEditMode:()=>p.current?.exitEditMode(),handleCaretAfterInput:m=>p.current?.handleCaretAfterInput(m),handleCaretMove:m=>p.current?.handleCaretMove(m),replaceEditingRange:m=>p.current?.replaceEditingRange(m)??!1,setActivePill:m=>p.current?.setActivePill(m),skipActivePill:()=>p.current?.skipActivePill(),removeLastParam:()=>p.current?.removeLastParam(),clearNewParamId:()=>p.current?.clearNewParamId(),reset:()=>p.current?.reset(),selectOption:m=>p.current?.selectOption(m),selectProduct:m=>p.current?.selectProduct(m),setActiveDropdownIndex:m=>p.current?.setActiveDropdownIndex(m),showPreviousMonth:()=>p.current?.showPreviousMonth(),showNextMonth:()=>p.current?.showNextMonth(),handleFocus:()=>p.current?.setFocused(!0),handleBlur:()=>p.current?.setFocused(!1)});let l=y.current,A=Tt(m=>{let F=m.target.value,Fe=F.length>0&&!m.nativeEvent?.isComposing&&F[0]!==F[0].toUpperCase()?F[0].toUpperCase()+F.slice(1):F;p.current?.handleTextChange(Fe)},[]),Q=Tt(m=>{p.current?.handleKeyDown(m.nativeEvent)},[]),L=p.current,d=re??_a,le=R!==void 0?R:d.text,be=O!==void 0?O:d.completedParams,de=d.actionableSuggestions,ve=de[0],ce=L?.listboxId??"",pe=d.activeDropdownIndex>=0&&L?`${ce}-option-${d.activeDropdownIndex}`:void 0,M=d.editingParam,he=d.editingIdentified,ke=M?{type:M.suggestionType,text:M.suggestionPlaceholder,required:!0,options:M.options}:he?{type:he.type,text:Ga(he.type),required:!0,options:[]}:null,Te=ke??ve,Be=ke?[ke]:de,Ce=Ka(d),Ae=!L||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation||d.isSearchingOptions;return{completedParams:be,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:Ae,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:ce,error:d.error,products:d.products,customFields:d.customFields,selectProduct:l.selectProduct,handleTextChange:l.handleTextChange,handleKeyDown:l.handleKeyDown,setFocused:l.setFocused,editingParam:M,editingIdentified:he,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:l.startEditingParam,exitEditMode:l.exitEditMode,handleCaretAfterInput:l.handleCaretAfterInput,handleCaretMove:l.handleCaretMove,replaceEditingRange:l.replaceEditingRange,inputProps:{value:le,placeholder:d.placeholderText||void 0,onChange:A,onKeyDown:Q,onFocus:l.handleFocus,onBlur:l.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":pe,"aria-autocomplete":"list","aria-controls":ce},reset:l.reset,dropdownProps:{suggestions:Te?[{...Te,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:l.selectOption,onHighlight:l.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:ce,pills:Be,activeSelected:d.isActivePillSelected,onPillClick:l.setActivePill,onSkip:l.skipActivePill,showSkipButton:(k??!0)&&!M&&!he,showOptionIcons:x??!0,skipDisabled:d.inSelectionAnimation,isLoading:Ae,isInputEmpty:le.trim().length===0,products:d.products,onProductSelect:l.selectProduct,onProductFocusChange:l.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:Ce.selectedIso,selectedDateRange:Ce.selectedRange,dateRangeStart:Ce.rangeStart,onPreviousMonth:l.showPreviousMonth,onNextMonth:l.showNextMonth,optionsPosition:b??"below"}}}import{extractPlainText as At,getCursorOffset as Rt,plainTextLength as qa,renderEditableContent as Ua,setCursorOffset as Dt}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as U,useEffect as Ye,useLayoutEffect as Xe,useRef as xe}from"react";var He;function ja(){if(He!==void 0)return He;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),He=e.contentEditable==="plaintext-only",He}function Lt(e){let{segments:r,showChipIcons:i=!0,newParamId:n,editingParam:s,editingIdentified:a,editingAnchor:o,caretOffset:g,placeholderText:f,isFocused:b,isDropdownOpen:w,listboxId:u,activeDescendantId:x,autoFocus:k,handleTextChange:v,handleKeyDown:E,handleCaretAfterInput:T,handleCaretMove:R,startEditingParam:O,replaceEditingRange:Y,setFocused:z}=e,P=xe(null),j=xe(!1),ne=xe(""),X=xe(""),p=xe(null),re=xe(0);p.current=g,Ye(()=>{if(!k)return;let t=P.current;if(!t)return;document.activeElement===t?z(!0):t.focus();let c=t.ownerDocument??document,h=c.getSelection(),y=h&&h.rangeCount>0&&t.contains(h.anchorNode);if(h&&!y){let l=c.createRange();l.selectNodeContents(t),l.collapse(!0),h.removeAllRanges(),h.addRange(l)}},[k,z]),Ye(()=>{let t=P.current;if(!t)return;let c=t.ownerDocument??document,h=()=>{let y=c.getSelection();if(!y||y.rangeCount===0||!y.anchorNode||!t.contains(y.anchorNode))return;let l=y.anchorNode,A=l.nodeType===Node.ELEMENT_NODE?l:l.parentElement,L=(y.isCollapsed?A?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,d=s?.id??a?.id??null;if(L&&L!==d){O(L);return}performance.now()-re.current<50||R(Rt(t))};return c.addEventListener("selectionchange",h),()=>c.removeEventListener("selectionchange",h)},[s,a,O,R]),Xe(()=>{let t=P.current;t&&Ua({input:t,segments:r,newParamId:n,editingParamId:s?.id??null,placeholderText:f??"",isFocused:b,showChipIcons:i})},[r,n,s,f,b,i]),Xe(()=>{let t=ne.current,c=n??"";if(ne.current=c,!c||c===t)return;let h=P.current;if(!h)return;h.focus();let y=p.current??qa(h);Dt(h,y)},[n]),Xe(()=>{let t=X.current,c=s?.id??"";if(X.current=c,!c||c===t||o==null)return;let h=P.current;h&&Dt(h,o)},[s,o]);let D=U(()=>{if(j.current)return;let t=P.current;if(!t)return;let c=At(t),y=c.length>0&&c[0]!==c[0].toUpperCase()?c[0].toUpperCase()+c.slice(1):c;v(y)},[v]),se=U(()=>{re.current=performance.now(),D();let t=P.current;t&&T(Rt(t))},[D,T]);Ye(()=>{let t=P.current;if(!t)return;let c=h=>{let y=h,l=y.inputType;if(l==="insertParagraph"||l==="insertLineBreak"||l==="insertFromDrop"){h.preventDefault();return}if(l.startsWith("insert")||l.startsWith("delete")){let A=l.startsWith("delete")?"":y.data??"";Y(A)&&h.preventDefault()}};return t.addEventListener("beforeinput",c),()=>t.removeEventListener("beforeinput",c)},[Y]);let J=U(()=>{j.current=!0},[]),$=U(()=>{j.current=!1,D()},[D]),ee=U(t=>{t.preventDefault();let c=P.current;if(!c)return;let h=(t.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!h)return;let y=c.ownerDocument??document,l=y.getSelection();if(!l||l.rangeCount===0)return;let A=l.getRangeAt(0);if(!c.contains(A.startContainer))return;A.deleteContents();let Q=y.createTextNode(h);A.insertNode(Q),A.setStartAfter(Q),A.collapse(!0),l.removeAllRanges(),l.addRange(A),D()},[D]),V=U(t=>E(t),[E]),te=U(()=>z(!0),[z]),ae=U(()=>z(!1),[z]),N=U(()=>P.current?.focus(),[]),H=U(()=>P.current?.blur(),[]),W=U(()=>{let t=P.current;return t?At(t):""},[]),B=ja()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:B,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":u,"aria-expanded":w,"aria-activedescendant":x,spellCheck:!0,enterKeyHint:"send",onInput:se,onKeyDown:V,onCompositionStart:J,onCompositionEnd:$,onPaste:ee,onFocus:te,onBlur:ae},getPlainText:W,focus:N,blur:H}}import{jsx as ye,jsxs as et}from"react/jsx-runtime";function Ja(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var ei=$a(function({onSubmit:r,onResult:i,onError:n,optionOverrides:s,maskCompletedText:a,className:o,apiConfig:g,additionalContext:f,columns:b,pillPlacement:w="dropdown",mode:u="auto",optionsPosition:x="below",animations:k=!0,dropdownTrigger:v,closeDropdownOnBlur:E,showNonTappableOptions:T,showOptionIcons:R=!0,showChipIcons:O=!0,showSkipButton:Y,showProducts:z,autoFocus:P=!0,onFocus:j,onBlur:ne,value:X,completedParams:p,onChange:re,onParamsChange:D,products:se,onProductSelect:J,submitButton:$},ee){let V=Ie(null),te=Ie(null),ae=Ie(()=>{}),N=Ie(null),H=Ie(null);Mt(()=>{let C=V.current;if(C)return N.current?N.current.setMode(u):N.current=new Ya(C,u),()=>{N.current?.destroy(),N.current=null}},[u]);let W=Je(C=>{let ue=H.current?.current;ue&&(ue.focus(),Xa(ue,C))},[]),{completedParams:B,skippedParams:t,identifiedParams:c,isReady:h,customFields:y,suggestionPills:l,setActivePill:A,skipActivePill:Q,segments:L,newParamId:d,clearNewParamId:le,placeholderText:be,isFocused:de,isDropdownOpen:ve,isActivePillSelected:ce,isLoading:pe,activeIndex:M,listboxId:he,handleTextChange:ke,handleKeyDown:Te,setFocused:Be,editingParam:Ce,editingIdentified:Ae,editingAnchor:m,caretOffset:F,startEditingParam:I,handleCaretAfterInput:Fe,handleCaretMove:Ot,replaceEditingRange:zt,dropdownProps:Nt,reset:Re}=Ze({onSubmit:C=>ae.current(C),onResult:i,onError:n,optionOverrides:s,maskCompletedText:a,apiConfig:g,additionalContext:f,columns:b,dropdownTrigger:v,optionsPosition:x,closeDropdownOnBlur:E,showNonTappableOptions:T,showOptionIcons:R,showSkipButton:Y,showProducts:z,onFocus:j,onBlur:ne,value:X,completedParams:p,onChange:re,onParamsChange:D,products:se,onProductSelect:J,source:"full-sdk",setCursor:W});Mt(()=>{if(!d)return;let C=window.setTimeout(()=>le(),650);return()=>window.clearTimeout(C)},[d,le]);let Ht=M>=0?`${he}-option-${M}`:void 0,{inputRef:Ke,editorProps:Bt,focus:De,blur:tt,getPlainText:at}=Lt({segments:L,newParamId:d,editingParam:Ce,editingIdentified:Ae,editingAnchor:m,caretOffset:F,placeholderText:be,isFocused:de,showChipIcons:O,isDropdownOpen:ve,listboxId:he,activeDescendantId:Ht,autoFocus:P,handleTextChange:ke,handleKeyDown:Te,handleCaretAfterInput:Fe,handleCaretMove:Ot,startEditingParam:I,replaceEditingRange:zt,setFocused:Be});H.current=Ke,Qa(()=>{let C=te.current,ue=Ke.current;if(!C||!ue)return;let it=()=>{let nt=C.firstElementChild;if(!nt)return;let Wt=nt.getBoundingClientRect(),_t=ue.getBoundingClientRect();Wt.top>=_t.bottom-2?C.setAttribute("data-aia-pill-wrapped",""):C.removeAttribute("data-aia-pill-wrapped")};it();let ot=new ResizeObserver(it);return ot.observe(ue),()=>ot.disconnect()},[L,l.length,pe,Ke]),Va(ee,()=>({focus:De,blur:tt,reset:Re,setMode:C=>N.current?.setMode(C),skipActivePill:Q}),[De,tt,Re,Q]);let Le=!!L.length||B.length>0,Ge=Je(()=>{if(!Le)return;let C=at();r(Za(C,B,t,{identifiedParams:c,isReady:h,customFields:y})),Re()},[Le,B,t,c,h,y,r,Re,at]);ae.current=Ge;let Ft=Je(C=>{C.target?.closest("[data-aia-pill]")||De()},[De]),Kt=w==="inline",Gt=w==="dropdown";return et("div",{ref:V,className:`magicx-aia ${ge.container} ${o??""}`,"data-pill-placement":w,"data-options-position":x,"data-animations":k?"on":"off","data-mode":Ja(u),children:[ye(Ve,{...Nt,showPills:Gt}),et("div",{className:ge.inputWrapper,"data-aia-input-wrapper":"",onClick:Ft,children:[et("div",{className:ge.editorArea,"data-aia-editor":"",children:[ye("div",{...Bt,className:ge.input,"data-aia-input":""}),Kt&&(pe||l.length>0)&&ye("span",{ref:te,className:ge.pillListContainer,"data-aia-pill-list-container":"",children:ye(Oe,{pills:l,activePillIndex:0,activeSelected:ce,onSelectPill:A,loading:pe})})]}),$===null?null:$===void 0?ye(Ct,{disabled:!Le,onClick:Ge}):ye("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:ge.submitSlot,onClick:C=>{Le&&(C.stopPropagation(),Ge())},children:$})]})]})});export{ei as AIAutocomplete,Ve as AIAutocompleteDropdown,Vo as DATE_RANGE_META_END,Qo as DATE_RANGE_META_START,an as PRODUCT_PATH_PREFIX,hn as WEEKDAY_LABELS,Uo as buildSubmitResult,jo as cellDay,$o as cellIso,Zo as dateCellMarks,Yo as formatDate,Xo as formatDateRange,Jo as isoDate,en as monthLabel,tn as optionLabel,on as parseDate,nn as parseLooseDate,rn as parseLooseDateRange,sn as productFromMatchedItem,ln as productsFromCustomFields,dn as sanitizeOptionIconSvg,cn as selectedRangeFor,Ze as useAIAutocomplete,pn as visibleDateRange,un as withSkippedParams};
1926
+ `,document.head.appendChild(e)}var kt={submitButton:"aia-submitButton-otz7H"};import{jsx as Qe}from"react/jsx-runtime";function Ct({disabled:e,onClick:r}){return Qe("button",{type:"button","data-aia-submit":"",className:kt.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),r()},"aria-label":"Submit",children:Qe("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:Qe("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Ka,dateSelectionFor as Wa,identifiedParamLabel as Ga}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as Tt,useEffect as Ee,useRef as W,useState as _a}from"react";import{useRef as Pt}from"react";function St(e){let r=Pt(e);r.current=e;let a=Object.keys(e??{}).sort().join("\0"),n=Pt({key:"",overrides:void 0});if(n.current.key!==a){let s={};for(let i of Object.keys(e??{})){let o=(g,b,p)=>{let x=r.current?.[i];return x?x(g,b,p):[]};s[i]=o}n.current={key:a,overrides:e?s:void 0}}return{overrides:n.current.overrides,key:a}}import{useRef as Et}from"react";function It(e){let r=Et(e);r.current=e;let a=Et(null);a.current===null&&(a.current={fetch:(s,i)=>{let o=r.current;return o?o.fetch(s,i):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 qa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],customFields:null,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 Ze({onSubmit:e,onResult:r,onError:a,optionOverrides:n,maskCompletedText:s,apiConfig:i,additionalContext:o,columns:g=2,dropdownTrigger:b,optionsPosition:p,closeDropdownOnBlur:x,showNonTappableOptions:u,showOptionIcons:y,showSkipButton:k,showProducts:v,onFocus:I,onBlur:A,value:R,completedParams:D,onChange:Z,onParamsChange:L,products:P,onProductSelect:j,source:le,setCursor:Y}){let h=W(null),[de,M]=_a(null),X=W(e);X.current=e;let ce=W(r);ce.current=r;let J=W(a);J.current=a;let $=W(Z);$.current=Z;let ee=W(L);ee.current=L;let V=W(I);V.current=I;let te=W(A);te.current=A;let ae=W(Y);ae.current=Y;let O=W(j);O.current=j;let z=It(P),G=St(n);Ee(()=>{if(typeof document>"u")return;let m=new Ka(document.createElement("div"),{renderMode:"headless",apiConfig:i,additionalContext:o,optionOverrides:G.overrides,maskCompletedText:s,columns:g,dropdownTrigger:b,optionsPosition:p,closeDropdownOnBlur:x,showNonTappableOptions:u,showProducts:v,source:le,value:R,completedParams:D,onSubmit:(...T)=>X.current?.(...T),onResult:(...T)=>ce.current?.(...T),onError:(...T)=>J.current?.(...T),onChange:(...T)=>$.current?.(...T),onParamsChange:(...T)=>ee.current?.(...T),onFocus:()=>V.current?.(),onBlur:()=>te.current?.(),onProductSelect:T=>O.current?.(T),setCursor:T=>ae.current?.(T),products:z.config});h.current=m,M(m.getState());let F=m.subscribe(T=>M(T));return()=>{F(),m.destroy(),h.current===m&&(h.current=null)}},[]),Ee(()=>{R!==void 0&&h.current?.setValue(R)},[R]),Ee(()=>{D!==void 0&&h.current?.setCompletedParams(D)},[D]);let c=JSON.stringify(i??null),t;try{t=JSON.stringify(o??null)}catch{t="[unstringifiable]"}Ee(()=>{h.current?.update({apiConfig:i,additionalContext:o,optionOverrides:G.overrides,dropdownTrigger:b,optionsPosition:p,closeDropdownOnBlur:x,showNonTappableOptions:u,showProducts:v})},[c,t,G.key,b,p,x,u,v]);let f=W(!1);Ee(()=>{if(!f.current){f.current=!0;return}h.current?.update({products:z.config})},[z.enabled]);let w=W(null);w.current===null&&(w.current={handleTextChange:m=>h.current?.handleTextChange(m),handleKeyDown:m=>{let F="nativeEvent"in m?m.nativeEvent:m;h.current?.handleKeyDown(F)},setFocused:m=>h.current?.setFocused(m),startEditingParam:m=>h.current?.startEditingParam(m),exitEditMode:()=>h.current?.exitEditMode(),handleCaretAfterInput:m=>h.current?.handleCaretAfterInput(m),handleCaretMove:m=>h.current?.handleCaretMove(m),replaceEditingRange:m=>h.current?.replaceEditingRange(m)??!1,setActivePill:m=>h.current?.setActivePill(m),skipActivePill:()=>h.current?.skipActivePill(),removeLastParam:()=>h.current?.removeLastParam(),clearNewParamId:()=>h.current?.clearNewParamId(),reset:()=>h.current?.reset(),selectOption:m=>h.current?.selectOption(m),selectProduct:m=>h.current?.selectProduct(m),setActiveDropdownIndex:m=>h.current?.setActiveDropdownIndex(m),showPreviousMonth:()=>h.current?.showPreviousMonth(),showNextMonth:()=>h.current?.showNextMonth(),handleFocus:()=>h.current?.setFocused(!0),handleBlur:()=>h.current?.setFocused(!1)});let l=w.current,S=Tt(m=>{let F=m.target.value,Fe=F.length>0&&!m.nativeEvent?.isComposing&&F[0]!==F[0].toUpperCase()?F[0].toUpperCase()+F.slice(1):F;h.current?.handleTextChange(Fe)},[]),ie=Tt(m=>{h.current?.handleKeyDown(m.nativeEvent)},[]),B=h.current,d=de??qa,oe=R!==void 0?R:d.text,me=D!==void 0?D:d.completedParams,pe=d.actionableSuggestions,be=pe[0],ne=B?.listboxId??"",ke=d.activeDropdownIndex>=0&&B?`${ne}-option-${d.activeDropdownIndex}`:void 0,N=d.editingParam,H=d.editingIdentified,ve=N?{type:N.suggestionType,text:N.suggestionPlaceholder,required:!0,options:N.options}:H?{type:H.type,text:Ga(H.type),required:!0,options:[]}:null,Te=ve??be,Be=ve?[ve]:pe,Ce=Wa(d),Ae=!B||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation||d.isSearchingOptions;return{completedParams:me,skippedParams:d.skippedParams,identifiedParams:d.identifiedParams,suggestionPills:pe,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:Ae,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:ne,error:d.error,products:d.products,customFields:d.customFields,selectProduct:l.selectProduct,handleTextChange:l.handleTextChange,handleKeyDown:l.handleKeyDown,setFocused:l.setFocused,editingParam:N,editingIdentified:H,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:l.startEditingParam,exitEditMode:l.exitEditMode,handleCaretAfterInput:l.handleCaretAfterInput,handleCaretMove:l.handleCaretMove,replaceEditingRange:l.replaceEditingRange,inputProps:{value:oe,placeholder:d.placeholderText||void 0,onChange:S,onKeyDown:ie,onFocus:l.handleFocus,onBlur:l.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":ke,"aria-autocomplete":"list","aria-controls":ne},reset:l.reset,dropdownProps:{suggestions:Te?[{...Te,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:l.selectOption,onHighlight:l.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:ne,pills:Be,activeSelected:d.isActivePillSelected,onPillClick:l.setActivePill,onSkip:l.skipActivePill,showSkipButton:(k??!0)&&!N&&!H,showOptionIcons:y??!0,skipDisabled:d.inSelectionAnimation,isLoading:Ae,isInputEmpty:oe.trim().length===0,products:d.products,onProductSelect:l.selectProduct,onProductFocusChange:l.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:Ce.selectedIso,selectedDateRange:Ce.selectedRange,dateRangeStart:Ce.rangeStart,onPreviousMonth:l.showPreviousMonth,onNextMonth:l.showNextMonth,optionsPosition:p??"below"}}}import{extractPlainText as At,getCursorOffset as Rt,plainTextLength as Ua,renderEditableContent as ja,setCursorOffset as Dt}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as U,useEffect as Ye,useLayoutEffect as Xe,useRef as xe}from"react";var He;function $a(){if(He!==void 0)return He;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),He=e.contentEditable==="plaintext-only",He}function Lt(e){let{segments:r,showChipIcons:a=!0,newParamId:n,editingParam:s,editingIdentified:i,editingAnchor:o,caretOffset:g,placeholderText:b,isFocused:p,isDropdownOpen:x,listboxId:u,activeDescendantId:y,autoFocus:k,handleTextChange:v,handleKeyDown:I,handleCaretAfterInput:A,handleCaretMove:R,startEditingParam:D,replaceEditingRange:Z,setFocused:L}=e,P=xe(null),j=xe(!1),le=xe(""),Y=xe(""),h=xe(null),de=xe(0);h.current=g,Ye(()=>{if(!k)return;let c=P.current;if(!c)return;document.activeElement===c?L(!0):c.focus();let t=c.ownerDocument??document,f=t.getSelection(),w=f&&f.rangeCount>0&&c.contains(f.anchorNode);if(f&&!w){let l=t.createRange();l.selectNodeContents(c),l.collapse(!0),f.removeAllRanges(),f.addRange(l)}},[k,L]),Ye(()=>{let c=P.current;if(!c)return;let t=c.ownerDocument??document,f=()=>{let w=t.getSelection();if(!w||w.rangeCount===0||!w.anchorNode||!c.contains(w.anchorNode))return;let l=w.anchorNode,S=l.nodeType===Node.ELEMENT_NODE?l:l.parentElement,B=(w.isCollapsed?S?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,d=s?.id??i?.id??null;if(B&&B!==d){D(B);return}performance.now()-de.current<50||R(Rt(c))};return t.addEventListener("selectionchange",f),()=>t.removeEventListener("selectionchange",f)},[s,i,D,R]),Xe(()=>{let c=P.current;c&&ja({input:c,segments:r,newParamId:n,editingParamId:s?.id??null,placeholderText:b??"",isFocused:p,showChipIcons:a})},[r,n,s,b,p,a]),Xe(()=>{let c=le.current,t=n??"";if(le.current=t,!t||t===c)return;let f=P.current;if(!f)return;f.focus();let w=h.current??Ua(f);Dt(f,w)},[n]),Xe(()=>{let c=Y.current,t=s?.id??"";if(Y.current=t,!t||t===c||o==null)return;let f=P.current;f&&Dt(f,o)},[s,o]);let M=U(()=>{if(j.current)return;let c=P.current;if(!c)return;let t=At(c),w=t.length>0&&t[0]!==t[0].toUpperCase()?t[0].toUpperCase()+t.slice(1):t;v(w)},[v]),X=U(()=>{de.current=performance.now(),M();let c=P.current;c&&A(Rt(c))},[M,A]);Ye(()=>{let c=P.current;if(!c)return;let t=f=>{let w=f,l=w.inputType;if(l==="insertParagraph"||l==="insertLineBreak"||l==="insertFromDrop"){f.preventDefault();return}if(l.startsWith("insert")||l.startsWith("delete")){let S=l.startsWith("delete")?"":w.data??"";Z(S)&&f.preventDefault()}};return c.addEventListener("beforeinput",t),()=>c.removeEventListener("beforeinput",t)},[Z]);let ce=U(()=>{j.current=!0},[]),J=U(()=>{j.current=!1,M()},[M]),$=U(c=>{c.preventDefault();let t=P.current;if(!t)return;let f=(c.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!f)return;let w=t.ownerDocument??document,l=w.getSelection();if(!l||l.rangeCount===0)return;let S=l.getRangeAt(0);if(!t.contains(S.startContainer))return;S.deleteContents();let ie=w.createTextNode(f);S.insertNode(ie),S.setStartAfter(ie),S.collapse(!0),l.removeAllRanges(),l.addRange(S),M()},[M]),ee=U(c=>I(c),[I]),V=U(()=>L(!0),[L]),te=U(()=>L(!1),[L]),ae=U(()=>P.current?.focus(),[]),O=U(()=>P.current?.blur(),[]),z=U(()=>{let c=P.current;return c?At(c):""},[]),G=$a()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:G,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":u,"aria-expanded":x,"aria-activedescendant":y,spellCheck:!0,enterKeyHint:"send",onInput:X,onKeyDown:ee,onCompositionStart:ce,onCompositionEnd:J,onPaste:$,onFocus:V,onBlur:te},getPlainText:z,focus:ae,blur:O}}import{jsx as ye,jsxs as et}from"react/jsx-runtime";function ei(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var ti=Va(function({onSubmit:r,onResult:a,onError:n,optionOverrides:s,maskCompletedText:i,className:o,apiConfig:g,additionalContext:b,columns:p,pillPlacement:x="dropdown",mode:u="auto",optionsPosition:y="below",animations:k=!0,dropdownTrigger:v,closeDropdownOnBlur:I,showNonTappableOptions:A,showOptionIcons:R=!0,showChipIcons:D=!0,showSkipButton:Z,showProducts:L,productsLayout:P,autoFocus:j=!0,onFocus:le,onBlur:Y,value:h,completedParams:de,onChange:M,onParamsChange:X,products:ce,onProductSelect:J,submitButton:$},ee){let V=Ie(null),te=Ie(null),ae=Ie(()=>{}),O=Ie(null),z=Ie(null);Mt(()=>{let C=V.current;if(C)return O.current?O.current.setMode(u):O.current=new Xa(C,u),()=>{O.current?.destroy(),O.current=null}},[u]);let G=Je(C=>{let he=z.current?.current;he&&(he.focus(),Ja(he,C))},[]),{completedParams:c,skippedParams:t,identifiedParams:f,isReady:w,customFields:l,suggestionPills:S,setActivePill:ie,skipActivePill:B,segments:d,newParamId:oe,clearNewParamId:me,placeholderText:pe,isFocused:be,isDropdownOpen:ne,isActivePillSelected:ke,isLoading:N,activeIndex:H,listboxId:ve,handleTextChange:Te,handleKeyDown:Be,setFocused:Ce,editingParam:Ae,editingIdentified:m,editingAnchor:F,caretOffset:T,startEditingParam:Fe,handleCaretAfterInput:Ot,handleCaretMove:zt,replaceEditingRange:Nt,dropdownProps:Ht,reset:Re}=Ze({onSubmit:C=>ae.current(C),onResult:a,onError:n,optionOverrides:s,maskCompletedText:i,apiConfig:g,additionalContext:b,columns:p,dropdownTrigger:v,optionsPosition:y,closeDropdownOnBlur:I,showNonTappableOptions:A,showOptionIcons:R,showSkipButton:Z,showProducts:L,onFocus:le,onBlur:Y,value:h,completedParams:de,onChange:M,onParamsChange:X,products:ce,onProductSelect:J,source:"full-sdk",setCursor:G});Mt(()=>{if(!oe)return;let C=window.setTimeout(()=>me(),650);return()=>window.clearTimeout(C)},[oe,me]);let Bt=H>=0?`${ve}-option-${H}`:void 0,{inputRef:Ke,editorProps:Ft,focus:De,blur:tt,getPlainText:at}=Lt({segments:d,newParamId:oe,editingParam:Ae,editingIdentified:m,editingAnchor:F,caretOffset:T,placeholderText:pe,isFocused:be,showChipIcons:D,isDropdownOpen:ne,listboxId:ve,activeDescendantId:Bt,autoFocus:j,handleTextChange:Te,handleKeyDown:Be,handleCaretAfterInput:Ot,handleCaretMove:zt,startEditingParam:Fe,replaceEditingRange:Nt,setFocused:Ce});z.current=Ke,Za(()=>{let C=te.current,he=Ke.current;if(!C||!he)return;let it=()=>{let nt=C.firstElementChild;if(!nt)return;let _t=nt.getBoundingClientRect(),qt=he.getBoundingClientRect();_t.top>=qt.bottom-2?C.setAttribute("data-aia-pill-wrapped",""):C.removeAttribute("data-aia-pill-wrapped")};it();let ot=new ResizeObserver(it);return ot.observe(he),()=>ot.disconnect()},[d,S.length,N,Ke]),Qa(ee,()=>({focus:De,blur:tt,reset:Re,setMode:C=>O.current?.setMode(C),skipActivePill:B}),[De,tt,Re,B]);let Le=!!d.length||c.length>0,We=Je(()=>{if(!Le)return;let C=at();r(Ya(C,c,t,{identifiedParams:f,isReady:w,customFields:l})),Re()},[Le,c,t,f,w,l,r,Re,at]);ae.current=We;let Kt=Je(C=>{C.target?.closest("[data-aia-pill]")||De()},[De]),Wt=x==="inline",Gt=x==="dropdown";return et("div",{ref:V,className:`magicx-aia ${ge.container} ${o??""}`,"data-pill-placement":x,"data-options-position":y,"data-animations":k?"on":"off","data-mode":ei(u),children:[ye(Ve,{...Ht,showPills:Gt,productsLayout:P}),et("div",{className:ge.inputWrapper,"data-aia-input-wrapper":"",onClick:Kt,children:[et("div",{className:ge.editorArea,"data-aia-editor":"",children:[ye("div",{...Ft,className:ge.input,"data-aia-input":""}),Wt&&(N||S.length>0)&&ye("span",{ref:te,className:ge.pillListContainer,"data-aia-pill-list-container":"",children:ye(Oe,{pills:S,activePillIndex:0,activeSelected:ke,onSelectPill:ie,loading:N})})]}),$===null?null:$===void 0?ye(Ct,{disabled:!Le,onClick:We}):ye("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:ge.submitSlot,onClick:C=>{Le&&(C.stopPropagation(),We())},children:$})]})]})});export{ti as AIAutocomplete,Ve as AIAutocompleteDropdown,Qo as DATE_RANGE_META_END,Zo as DATE_RANGE_META_START,on as PRODUCT_PATH_PREFIX,un as WEEKDAY_LABELS,jo as buildSubmitResult,$o as cellDay,Vo as cellIso,Yo as dateCellMarks,Xo as formatDate,Jo as formatDateRange,en as isoDate,tn as monthLabel,an as optionLabel,nn as parseDate,rn as parseLooseDate,sn as parseLooseDateRange,ln as productFromMatchedItem,dn as productsFromCustomFields,cn as sanitizeOptionIconSvg,pn as selectedRangeFor,Ze as useAIAutocomplete,hn as visibleDateRange,fn as withSkippedParams};
1877
1927
  //# sourceMappingURL=index.mjs.map