@magicx-eng/ai-autocomplete-react 0.3.0 → 0.4.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.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var De=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ct=Object.prototype.hasOwnProperty;var pt=(e,t)=>{for(var o in t)De(e,o,{get:t[o],enumerable:!0})},ut=(e,t,o,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of dt(t))!ct.call(e,a)&&a!==o&&De(e,a,{get:()=>t[a],enumerable:!(l=lt(t,a))||l.enumerable});return e};var mt=e=>ut(De({},"__esModule",{value:!0}),e);var vt={};pt(vt,{AIAutocomplete:()=>et,AIAutocompleteDropdown:()=>ke,useAIAutocomplete:()=>Se});module.exports=mt(vt);var I=require("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
+ "use strict";var De=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var mt=(e,t)=>{for(var o in t)De(e,o,{get:t[o],enumerable:!0})},gt=(e,t,o,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of pt(t))!ut.call(e,a)&&a!==o&&De(e,a,{get:()=>t[a],enumerable:!(p=ct(t,a))||p.enumerable});return e};var ft=e=>gt(De({},"__esModule",{value:!0}),e);var yt={};mt(yt,{AIAutocomplete:()=>tt,AIAutocompleteDropdown:()=>Ie,useAIAutocomplete:()=>Se});module.exports=ft(yt);var S=require("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
@@ -8,24 +8,24 @@
8
8
  }
9
9
 
10
10
  .AIAutocomplete-module_inputWrapper_FLq1b {
11
- padding: 19px 15px 20px 25px;
11
+ padding: 12px 10px;
12
12
  border: 1px solid var(--aia-border, #b0b0b0);
13
- border-radius: 30px;
13
+ border-radius: 24px;
14
14
  background: var(--aia-surface, #ffffff);
15
15
  overflow: hidden;
16
16
  display: flex;
17
17
  align-items: center;
18
- gap: 4px;
18
+ gap: 12px;
19
19
  }
20
20
 
21
21
  .AIAutocomplete-module_editorArea_7rBWq {
22
22
  position: relative;
23
23
  flex: 1;
24
24
  min-width: 0;
25
- min-height: 26.6px;
26
- line-height: 26.6px;
25
+ min-height: 19px;
26
+ line-height: 19px;
27
27
  font-family: inherit;
28
- font-size: var(--aia-written-text-font-size, 19px);
28
+ font-size: var(--aia-written-text-font-size, 14px);
29
29
  white-space: pre-wrap;
30
30
  word-break: break-word;
31
31
  overflow-wrap: anywhere;
@@ -40,7 +40,7 @@
40
40
  --aia-caret-color,
41
41
  var(--aia-written-text-color, var(--aia-color-text-default, #fff))
42
42
  );
43
- font-weight: 250;
43
+ font-weight: 300;
44
44
  /* Align the text's inline box with the pill list (also vertical-align: middle)
45
45
  so they share a vertical center when pills stretch the line box to ~36px. */
46
46
  vertical-align: middle;
@@ -49,7 +49,7 @@
49
49
  /* Completed params render as inline bold runs. \`:where()\` keeps specificity
50
50
  at (0,2,0) so consumers can override without \`!important\`. */
51
51
  :where(.AIAutocomplete-module_input_IW-P-) strong {
52
- font-weight: 500;
52
+ font-weight: 600;
53
53
  letter-spacing: -0.01em;
54
54
  }
55
55
 
@@ -145,17 +145,149 @@
145
145
  background-position: -50% 0;
146
146
  }
147
147
  }
148
- `,document.head.appendChild(e)}var se={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",textShimmer:"AIAutocomplete-module_textShimmer_eCLdq"};if(typeof document<"u"&&!document.getElementById("ac-style-3819c762")){let e=document.createElement("style");e.id="ac-style-3819c762",e.textContent=`.AIAutocompleteDropdown-module_dropdown_yz2KC {
148
+ `,document.head.appendChild(e)}var le={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",textShimmer:"AIAutocomplete-module_textShimmer_eCLdq"};var Xe=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
149
+ * Built-in appearance defaults \u2014 zero specificity via :where().
150
+ * Consumer CSS always wins without !important.
151
+ *
152
+ * Resolution priority (highest wins):
153
+ * 1. Consumer CSS targeting new vars (--aia-pill-bg, etc.)
154
+ * 2. Consumer CSS targeting legacy vars (--aia-color-*, via fallback chain)
155
+ * 3. These built-in defaults
156
+ */
157
+
158
+ /*
159
+ * Library-scoped box-sizing reset. The SDK's pill / option / wrapper styles
160
+ * mix explicit dimensions with padding (e.g. .magicx-aia-pill has height:36px
161
+ * + padding:13px) and were authored assuming \`border-box\`. In consumer apps
162
+ * without a global \`* { box-sizing: border-box }\` reset the pill rendered
163
+ * ~62px tall instead of 36px. Scoping the reset to \`.magicx-aia\` descendants
164
+ * keeps the library self-contained without leaking onto consumer markup.
165
+ */
166
+ :where(.magicx-aia, .magicx-aia *, .magicx-aia *::before, .magicx-aia *::after) {
167
+ box-sizing: border-box;
168
+ }
169
+
170
+ /* Light mode defaults (base) */
171
+ :where(.magicx-aia),
172
+ :where(.magicx-aia[data-mode="light"]) {
173
+ --aia-surface: #ffffff;
174
+ --aia-border: #b0b0b0;
175
+ --aia-dropdown-border: #e5e7eb;
176
+ --aia-dropdown-shadow: 0 8px 12px rgba(0, 0, 0, 0.12);
177
+ --aia-pill-bg: #bdbdbd;
178
+ --aia-pill-color: #333539;
179
+ --aia-pill-font-size: 14px;
180
+
181
+ --aia-option-bg: #eef2ff;
182
+ --aia-option-color: #505050;
183
+ --aia-option-color-selected: #000000;
184
+ --aia-option-font-size: 14px;
185
+
186
+ --aia-written-text-color: #000000;
187
+ --aia-written-text-font-size: 14px;
188
+ --aia-caret-color: var(--aia-written-text-color, #000000);
189
+
190
+ --aia-submit-bg: #000000;
191
+ --aia-submit-color: #ffffff;
192
+
193
+ --aia-color-text-muted: #6b7280;
194
+
195
+ --aia-skeleton-bg: rgba(189, 189, 189, 0.51);
196
+
197
+ --aia-streak-rgb: 99, 102, 241;
198
+ --aia-streak-glass-bg: rgba(99, 102, 241, 0.1);
199
+
200
+ --aia-footer-divider: rgba(176, 176, 176, 0.4);
201
+ --aia-footer-hint-color: #505050;
202
+ --aia-footer-brand-color: #b0b0b0;
203
+ --aia-footer-badge-border: rgba(189, 189, 189, 0.51);
204
+ }
205
+
206
+ /* Dark mode defaults */
207
+ :where(.magicx-aia[data-mode="dark"]) {
208
+ --aia-surface: #000000;
209
+ --aia-border: #505050;
210
+ --aia-dropdown-border: #484848;
211
+ --aia-dropdown-shadow: 0 8px 12px rgba(0, 0, 0, 0.12);
212
+ --aia-pill-bg: #bdbdbd;
213
+ --aia-pill-color: #b0b0b0;
214
+ --aia-pill-font-size: 14px;
215
+
216
+ --aia-option-bg: transparent;
217
+ --aia-option-color: #b0b0b0;
218
+ --aia-option-color-selected: #ffffff;
219
+ --aia-option-font-size: 14px;
220
+
221
+ --aia-written-text-color: #ffffff;
222
+ --aia-written-text-font-size: 14px;
223
+ --aia-caret-color: var(--aia-written-text-color, #ffffff);
224
+
225
+ --aia-submit-bg: #ffffff;
226
+ --aia-submit-color: #000000;
227
+
228
+ --aia-color-text-muted: #c1c4cb;
229
+
230
+ --aia-skeleton-bg: #333539;
231
+
232
+ --aia-streak-rgb: 255, 255, 255;
233
+ --aia-streak-glass-bg: rgba(255, 255, 255, 0.1);
234
+
235
+ --aia-footer-divider: rgba(255, 255, 255, 0.15);
236
+ --aia-footer-hint-color: #b0b0b0;
237
+ --aia-footer-brand-color: #505050;
238
+ --aia-footer-badge-border: #505050;
239
+ }
240
+
241
+ /* optionsPosition: dropdown above the input. The sections live inside the
242
+ dropdown's .aia-stack, so the reversal targets the stack (not the dropdown,
243
+ whose only child is the stack).
244
+ Two forms are supported:
245
+ 1. ancestor form \u2014 Tier 1 sets data-options-position on the .magicx-aia
246
+ container and the dropdown is a descendant.
247
+ 2. self form \u2014 headless consumers spread \`optionsPosition\` from the hook's
248
+ dropdownProps, so the attribute lands on the dropdown element itself.
249
+ This lets the dropdown position above with NO wrapper attribute and no
250
+ hand-copied CSS. */
251
+ :where(.magicx-aia[data-options-position="above"]) [data-aia-dropdown],
252
+ [data-aia-dropdown][data-options-position="above"] {
253
+ top: auto;
254
+ bottom: 100%;
255
+ margin-top: 0;
256
+ margin-bottom: 6px;
257
+ }
258
+
259
+ :where(.magicx-aia[data-options-position="above"]) [data-aia-dropdown] .aia-stack,
260
+ [data-aia-dropdown][data-options-position="above"] .aia-stack {
261
+ flex-direction: column-reverse;
262
+ }
263
+
264
+ /* The footer sits at the top when the dropdown is above, so flip its own
265
+ internal stack too \u2014 the divider should sit BELOW the hint/branding row
266
+ (between the footer and the options beneath it), not above it. The footer's
267
+ own class is CSS-module-scoped, so target the stable data attribute. */
268
+ :where(.magicx-aia[data-options-position="above"]) [data-aia-dropdown] [data-aia-footer],
269
+ [data-aia-dropdown][data-options-position="above"] [data-aia-footer] {
270
+ flex-direction: column-reverse;
271
+ }
272
+
273
+ /* Disable all animations when data-animations="off" */
274
+ :where(.magicx-aia[data-animations="off"]) *,
275
+ :where(.magicx-aia[data-animations="off"]) *::before,
276
+ :where(.magicx-aia[data-animations="off"]) *::after {
277
+ animation-duration: 0s !important;
278
+ transition-duration: 0s !important;
279
+ }
280
+ `,document.head.appendChild(e)}if(typeof document<"u"&&!document.getElementById("ac-style-3819c762")){let e=document.createElement("style");e.id="ac-style-3819c762",e.textContent=`.AIAutocompleteDropdown-module_dropdown_yz2KC {
149
281
  position: absolute;
150
282
  left: 0;
151
283
  right: 0;
152
284
  top: 100%;
153
- max-width: 516px;
285
+ max-width: 544px;
154
286
  margin-top: 6px;
155
287
  display: flex;
156
288
  flex-direction: column;
157
289
  box-sizing: border-box;
158
- padding: 15px 0;
290
+ padding: 4px;
159
291
  overflow: hidden;
160
292
  container-type: inline-size;
161
293
  z-index: 10;
@@ -165,8 +297,9 @@
165
297
  /* Solid surface is the default (matches the Figma components). Opt into the
166
298
  frosted-glass look with data-aia-surface="glass". */
167
299
  background: var(--aia-surface, #ffffff);
168
- border: 1px solid var(--aia-border, #b0b0b0);
300
+ border: 1px solid var(--aia-dropdown-border, #e5e7eb);
169
301
  border-radius: 25px;
302
+ box-shadow: var(--aia-dropdown-shadow, 0 8px 12px rgba(0, 0, 0, 0.12));
170
303
  }
171
304
 
172
305
  .AIAutocompleteDropdown-module_dropdown_yz2KC[data-aia-surface="glass"] {
@@ -191,10 +324,10 @@
191
324
  pointer-events: auto;
192
325
  }
193
326
 
194
- /* The dropdown owns only vertical (15px) padding; each child insets its own
195
- 15px horizontally so option highlights can span the full dropdown width. */
327
+ /* The dropdown owns a uniform 4px pad; each section adds its own 7px/8px inset
328
+ (matches the Figma PillList). */
196
329
  .AIAutocompleteDropdown-module_pillBar_pwTXe {
197
- padding: 0 15px;
330
+ padding: 7px 8px;
198
331
  overflow-x: auto;
199
332
  overflow-y: hidden;
200
333
  scrollbar-width: none;
@@ -211,12 +344,12 @@
211
344
  display: flex;
212
345
  flex-direction: column;
213
346
  gap: 20px;
214
- padding: 10px 15px;
347
+ padding: 7px 8px;
215
348
  }
216
349
 
217
350
  .AIAutocompleteDropdown-module_skeletonBar_O3xIx {
218
351
  display: block;
219
- height: 19px;
352
+ height: 14px;
220
353
  border-radius: 999px;
221
354
  background: var(--aia-skeleton-bg, var(--aia-pill-bg, rgba(189, 189, 189, 0.51)));
222
355
  opacity: 0.5;
@@ -282,14 +415,14 @@
282
415
  justify-content: space-around;
283
416
  }
284
417
  }
285
- `,document.head.appendChild(e)}var Re=require("react/jsx-runtime");function ge({gap:e,align:t="center",justify:o="start",noWrap:l=!1,inline:a=!1,className:n,children:d,...m}){let y=e?{"--aia-cluster-gap":e}:void 0,h={className:n?`aia-cluster ${n}`:"aia-cluster","data-align":t,"data-justify":o,"data-nowrap":l||void 0,"data-inline":a||void 0,style:y,...m};return a?(0,Re.jsx)("span",{...h,children:d}):(0,Re.jsx)("div",{...h,children:d})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer insets its own 15px horizontally (the dropdown only pads
286
- vertically), so the divider spans the full footer width yet still stays clear
287
- of the dropdown's rounded edges. */
418
+ `,document.head.appendChild(e)}var Re=require("react/jsx-runtime");function ge({gap:e,align:t="center",justify:o="start",noWrap:p=!1,inline:a=!1,className:s,children:l,...d}){let f=e?{"--aia-cluster-gap":e}:void 0,x={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":t,"data-justify":o,"data-nowrap":p||void 0,"data-inline":a||void 0,style:f,...d};return a?(0,Re.jsx)("span",{...x,children:l}):(0,Re.jsx)("div",{...x,children:l})}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 7px/8px inset (the dropdown owns a uniform 4px pad),
419
+ so the divider spans the full footer width yet still stays clear of the
420
+ dropdown's rounded edges. */
288
421
  .DropdownFooter-module_footer_qQQ7x {
289
422
  display: flex;
290
423
  flex-direction: column;
291
- gap: 12px;
292
- padding: 0 15px;
424
+ gap: 8px;
425
+ padding: 7px 8px;
293
426
  }
294
427
 
295
428
  .DropdownFooter-module_divider_FlX4C {
@@ -323,14 +456,14 @@
323
456
  border: 0.5px solid var(--aia-footer-hint-color, #505050);
324
457
  border-radius: 5px;
325
458
  font-family: inherit;
326
- font-size: 12px;
459
+ font-size: 11px;
327
460
  line-height: 18px;
328
461
  color: var(--aia-footer-hint-color, #505050);
329
462
  }
330
463
 
331
464
  .DropdownFooter-module_hint_GKEOH {
332
465
  font-family: inherit;
333
- font-size: 12px;
466
+ font-size: 11px;
334
467
  line-height: 18px;
335
468
  color: var(--aia-footer-hint-color, #505050);
336
469
  }
@@ -347,19 +480,18 @@
347
480
  align-items: center;
348
481
  height: 23px;
349
482
  padding: 2.5px 5.5px;
350
- border: 0.36px solid var(--aia-footer-badge-border, rgba(189, 189, 189, 0.51));
483
+ border: 0.5px solid var(--aia-footer-badge-border, rgba(189, 189, 189, 0.51));
351
484
  border-radius: 999px;
352
485
  font-family: inherit;
353
486
  font-size: 10px;
354
487
  line-height: 18px;
355
488
  color: var(--aia-footer-brand-color, #b0b0b0);
356
489
  }
357
- `,document.head.appendChild(e)}var U={footer:"DropdownFooter-module_footer_qQQ7x",divider:"DropdownFooter-module_divider_FlX4C",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"};var M=require("react/jsx-runtime");function Ke({hasTabbedToHighlight:e=!1,isOptionHighlighted:t=!1}){let{key:o,hint:l}=(0,Ne.getFooterHint)(e,t);return(0,M.jsxs)("footer",{className:U.footer,"data-aia-footer":"",children:[(0,M.jsx)("div",{className:U.divider}),(0,M.jsxs)(ge,{justify:"between",noWrap:!0,children:[(0,M.jsxs)(ge,{gap:"5px",className:U.hintGroup,children:[(0,M.jsx)("kbd",{className:U.key,children:o}),(0,M.jsx)("span",{className:U.hint,children:l})]}),(0,M.jsxs)("a",{className:U.brandLink,href:"https://ai-autocomplete.com",target:"_blank",rel:"noopener noreferrer",children:[(0,M.jsx)("span",{className:U.brand,children:"AI"}),(0,M.jsx)("span",{className:U.badge,children:"Autocomplete"})]})]})]})}if(typeof document<"u"&&!document.getElementById("ac-style-04fef8d6")){let e=document.createElement("style");e.id="ac-style-04fef8d6",e.textContent=`.Pill-module_pill_3Rkw- {
490
+ `,document.head.appendChild(e)}var ee={footer:"DropdownFooter-module_footer_qQQ7x",divider:"DropdownFooter-module_divider_FlX4C",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"};var G=require("react/jsx-runtime");function Ke({hasTabbedToHighlight:e=!1,isOptionHighlighted:t=!1,isInputEmpty:o=!1}){let{key:p,hint:a}=(0,Ne.getFooterHint)(e,t,o);return(0,G.jsxs)("footer",{className:ee.footer,"data-aia-footer":"",children:[(0,G.jsx)("div",{className:ee.divider}),(0,G.jsxs)(ge,{justify:"between",noWrap:!0,children:[(0,G.jsxs)(ge,{gap:"5px",className:ee.hintGroup,children:[(0,G.jsx)("kbd",{className:ee.key,children:p}),(0,G.jsx)("span",{className:ee.hint,children:a})]}),(0,G.jsxs)("a",{className:ee.brandLink,href:"https://ai-autocomplete.com",target:"_blank",rel:"noopener noreferrer",children:[(0,G.jsx)("span",{className:ee.brand,children:"AI"}),(0,G.jsx)("span",{className:ee.badge,children:"Autocomplete"})]})]})]})}if(typeof document<"u"&&!document.getElementById("ac-style-04fef8d6")){let e=document.createElement("style");e.id="ac-style-04fef8d6",e.textContent=`.Pill-module_pill_3Rkw- {
358
491
  display: inline-flex;
359
492
  align-items: center;
360
493
  justify-content: center;
361
- height: 38px;
362
- padding: 10px 12px;
494
+ padding: 7px 8px;
363
495
  border: none;
364
496
  border-radius: 999px;
365
497
  background: rgba(49, 50, 85, 0.25);
@@ -370,8 +502,9 @@
370
502
  );
371
503
  color: var(--aia-pill-color, var(--aia-color-text-muted, #c1c4cb));
372
504
  font-family: inherit;
373
- font-size: var(--aia-pill-font-size, 19px);
374
- line-height: 30px;
505
+ font-size: var(--aia-pill-font-size, 14px);
506
+ font-weight: 500;
507
+ line-height: normal;
375
508
  cursor: pointer;
376
509
  white-space: nowrap;
377
510
  animation: Pill-module_fadeIn_Bbqtz 400ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
@@ -406,7 +539,7 @@
406
539
  opacity: 0;
407
540
  }
408
541
  }
409
- `,document.head.appendChild(e)}var Q={pill:"Pill-module_pill_3Rkw-",fadeIn:"Pill-module_fadeIn_Bbqtz",rounded:"Pill-module_rounded_6WMps",skeleton:"Pill-module_skeleton_-u9-j",skeletonPulse:"Pill-module_skeletonPulse_xHh-7"};var Ge=require("react/jsx-runtime"),Te={active:1,upcoming:.4,disabled:.2};function We({label:e,state:t,selected:o,rounded:l,loading:a,onClick:n}){let d=[Q.pill,l?Q.rounded:"",o&&!a?Q.active:"",a?Q.skeleton:""].filter(Boolean).join(" ");return(0,Ge.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":a?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:d,style:{opacity:Te[t]},onMouseDown:m=>m.preventDefault(),onClick:a?void 0:n,disabled:a,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 {
542
+ `,document.head.appendChild(e)}var te={pill:"Pill-module_pill_3Rkw-",fadeIn:"Pill-module_fadeIn_Bbqtz",rounded:"Pill-module_rounded_6WMps",skeleton:"Pill-module_skeleton_-u9-j",skeletonPulse:"Pill-module_skeletonPulse_xHh-7"};var Ge=require("react/jsx-runtime"),Te={selected:1,first:.7,next:.4,last:.2};function We({label:e,state:t,selected:o,rounded:p,loading:a,onClick:s}){let l=[te.pill,p?te.rounded:"",o&&!a?te.active:"",a?te.skeleton:""].filter(Boolean).join(" ");return(0,Ge.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":a?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:l,style:{opacity:Te[t]},onMouseDown:d=>d.preventDefault(),onClick:a?void 0:s,disabled:a,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 {
410
543
  position: relative;
411
544
  z-index: 1;
412
545
  pointer-events: auto;
@@ -415,7 +548,7 @@
415
548
  align-items: center;
416
549
  vertical-align: middle;
417
550
  }
418
- `,document.head.appendChild(e)}var Le={list:"PillList-module_list_qvLqO"};var fe=require("react/jsx-runtime"),gt=[125,69];function je(e){return e===0?"active":e===1?"upcoming":"disabled"}function _e({pills:e,activePillIndex:t,onSelectPill:o,rounded:l,loading:a}){return a&&e.length===0?(0,fe.jsx)("span",{className:Le.list,"data-aia-pill-list-loading":"",children:gt.map((n,d)=>(0,fe.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Q.pill} ${l?Q.rounded:""} ${Q.skeleton}`,style:{width:n,opacity:Te[je(d)]}},`skel-${n}`))}):(0,fe.jsx)("span",{className:Le.list,"data-aia-pill-list-loading":a?"":void 0,children:e.map((n,d)=>(0,fe.jsx)(We,{label:n.text,state:je(d),selected:d===t,rounded:l,loading:a,onClick:()=>o(d)},`${n.type}-${n.text}`))})}var ee=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`@layer layout {
551
+ `,document.head.appendChild(e)}var Le={list:"PillList-module_list_qvLqO"};var fe=require("react/jsx-runtime"),ht=[125,69];function je(e){return e===0?"first":e===1?"next":"last"}function _e({pills:e,activePillIndex:t,onSelectPill:o,activeSelected:p,rounded:a,loading:s}){return s&&e.length===0?(0,fe.jsx)("span",{className:Le.list,"data-aia-pill-list-loading":"",children:ht.map((l,d)=>(0,fe.jsx)("span",{"data-aia-pill-skeleton":"",className:`${te.pill} ${a?te.rounded:""} ${te.skeleton}`,style:{width:l,opacity:Te[je(d)]}},`skel-${l}`))}):(0,fe.jsx)("span",{className:Le.list,"data-aia-pill-list-loading":s?"":void 0,children:e.map((l,d)=>{let f=!!p&&d===t;return(0,fe.jsx)(We,{label:l.text,state:f?"selected":je(d),selected:f,rounded:a,loading:s,onClick:()=>o(d)},`${l.type}-${l.text}`)})})}var ne=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`@layer layout {
419
552
  .aia-grid {
420
553
  display: grid;
421
554
  grid-template-columns: repeat(
@@ -469,7 +602,7 @@
469
602
  opacity: 1;
470
603
  }
471
604
  }
472
- `,document.head.appendChild(e)}var ze=require("react/jsx-runtime");function Ve({min:e="16rem",max:t,gap:o,scroll:l=!1,maxHeight:a,fade:n=!1,className:d,children:m,...y}){let h=(0,ee.useRef)(null),[S,P]=(0,ee.useState)(!1);(0,ee.useEffect)(()=>{if(!n)return;let b=h.current;if(!b)return;let R=()=>{P(b.scrollHeight-b.scrollTop-b.clientHeight>1)};b.addEventListener("scroll",R,{passive:!0});let B=new ResizeObserver(R);return B.observe(b),()=>{b.removeEventListener("scroll",R),B.disconnect()}},[n]),(0,ee.useLayoutEffect)(()=>{let b=h.current;!n||!b||P(b.scrollHeight-b.scrollTop-b.clientHeight>1)},[n,m]);let C={"--aia-grid-min":e};t&&(C["--aia-grid-max"]=t),o&&(C["--aia-grid-gap"]=o),a&&(C["--aia-grid-max-height"]=a);let A=(0,ze.jsx)("div",{ref:h,className:!n&&d?`aia-grid ${d}`:"aia-grid","data-scroll":l||void 0,style:C,...n?{}:y,children:m});return n?(0,ze.jsx)("div",{className:d?`aia-grid-fade ${d}`:"aia-grid-fade","data-fade":S?"":void 0,...y,children:A}):A}var pe=require("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 {
605
+ `,document.head.appendChild(e)}var Be=require("react/jsx-runtime");function Ve({min:e="16rem",max:t,gap:o,scroll:p=!1,maxHeight:a,fade:s=!1,className:l,children:d,...f}){let x=(0,ne.useRef)(null),[L,P]=(0,ne.useState)(!1);(0,ne.useEffect)(()=>{if(!s)return;let v=x.current;if(!v)return;let B=()=>{P(v.scrollHeight-v.scrollTop-v.clientHeight>1)};v.addEventListener("scroll",B,{passive:!0});let M=new ResizeObserver(B);return M.observe(v),()=>{v.removeEventListener("scroll",B),M.disconnect()}},[s]),(0,ne.useLayoutEffect)(()=>{let v=x.current;!s||!v||P(v.scrollHeight-v.scrollTop-v.clientHeight>1)},[s,d]);let A={"--aia-grid-min":e};t&&(A["--aia-grid-max"]=t),o&&(A["--aia-grid-gap"]=o),a&&(A["--aia-grid-max-height"]=a);let C=(0,Be.jsx)("div",{ref:x,className:!s&&l?`aia-grid ${l}`:"aia-grid","data-scroll":p||void 0,style:A,...s?{}:f,children:d});return s?(0,Be.jsx)("div",{className:l?`aia-grid-fade ${l}`:"aia-grid-fade","data-fade":L?"":void 0,...f,children:C}):C}var pe=require("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 {
473
606
  position: relative;
474
607
  overflow: visible;
475
608
  display: flex;
@@ -477,17 +610,16 @@
477
610
  the same baseline at the top edge of the cell. */
478
611
  align-items: flex-start;
479
612
  font-family: inherit;
480
- font-size: var(--aia-option-font-size, 19px);
481
- font-weight: 250;
482
- line-height: 24px;
613
+ font-size: var(--aia-option-font-size, 14px);
614
+ font-weight: 300;
615
+ line-height: 18px;
483
616
  color: var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));
484
617
  white-space: normal;
485
618
  word-break: break-word;
486
- border-radius: 12px;
487
- /* Symmetric 15px inset (matches Figma). The dropdown pads only vertically, so
488
- the option fills the full cell width \u2014 its highlight/border-streak animation
489
- reaches the dropdown edges while the text stays inset 15px. */
490
- padding: 10px 15px;
619
+ /* 8px radius on the highlighted fill (--aia-option-bg), matching the Figma
620
+ SuggestionItem selection. The 7px/8px inset is the item's own padding. */
621
+ border-radius: 8px;
622
+ padding: 7px 8px;
491
623
  animation: SuggestionItem-module_fadeIn_I8u35 500ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
492
624
  }
493
625
 
@@ -517,6 +649,7 @@
517
649
  .SuggestionItem-module_highlighted_Hb0SU {
518
650
  color: var(--aia-option-color-selected, var(--aia-color-text-default, #fff));
519
651
  background: var(--aia-option-bg, transparent);
652
+ font-weight: 700;
520
653
  }
521
654
 
522
655
  .SuggestionItem-module_tag_e3Fwe {
@@ -819,7 +952,7 @@
819
952
  filter: brightness(0.55);
820
953
  }
821
954
  }
822
- `,document.head.appendChild(e)}var N={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",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",glassFade:"SuggestionItem-module_glassFade_oyiSj",tapDown:"SuggestionItem-module_tapDown_G3WGz",streaks:"SuggestionItem-module_streaks_d9PEB",streaksVert:"SuggestionItem-module_streaksVert_ERlV1",streakHorizRight:"SuggestionItem-module_streakHorizRight_aboGz",streakHorizLeft:"SuggestionItem-module_streakHorizLeft_BreWJ",streakVertUp:"SuggestionItem-module_streakVertUp_to1GD",streakVertDown:"SuggestionItem-module_streakVertDown_OrcLh",skeletonPulse:"SuggestionItem-module_skeletonPulse_plvdD",text:"SuggestionItem-module_text_yqoh9"};var te=require("react/jsx-runtime");function qe({option:e,isHighlighted:t,onSelect:o,onHighlight:l,id:a,loading:n}){let[d,m]=(0,pe.useState)(!1),y=(0,pe.useRef)(void 0);(0,pe.useEffect)(()=>()=>clearTimeout(y.current),[]);let h=()=>{n||!e.is_tappable||d||(m(!0),o(e),clearTimeout(y.current),y.current=setTimeout(()=>m(!1),500))},S=[N.item,t&&!n?N.highlighted:"",e.is_tappable?N.tappable:N.nonTappable,d?N.pressed:""].filter(Boolean).join(" ");return(0,te.jsxs)("div",{id:a,role:"option","data-aia-option":"","data-aia-loading":n?"":void 0,"aria-selected":t,className:S,tabIndex:n||!e.is_tappable?-1:0,onClick:h,onKeyDown:P=>{!n&&e.is_tappable&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),h())},onMouseEnter:!n&&e.is_tappable?l:void 0,children:[(0,te.jsx)("div",{className:N.streaks}),(0,te.jsx)("div",{className:N.streaksVert}),(0,te.jsxs)("span",{className:N.content,children:[(0,te.jsx)("span",{className:N.text,children:e.icon?`${e.icon} ${e.text}`:e.text}),e.tag&&(0,te.jsx)("span",{className:N.tag,children:e.tag})]})]})}var Be=require("react/jsx-runtime");function $e({options:e,activeIndex:t,onSelect:o,onHighlight:l,listboxId:a,loading:n}){return(0,Be.jsx)(Ve,{min:"250px",max:"250px",gap:"0",scroll:!0,fade:!0,children:e.map((d,m)=>(0,Be.jsx)(qe,{option:d,isHighlighted:m===t,onSelect:o,onHighlight:()=>l(m),id:`${a}-option-${m}`,loading:n},d.text))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`@layer layout {
955
+ `,document.head.appendChild(e)}var j={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",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",glassFade:"SuggestionItem-module_glassFade_oyiSj",tapDown:"SuggestionItem-module_tapDown_G3WGz",streaks:"SuggestionItem-module_streaks_d9PEB",streaksVert:"SuggestionItem-module_streaksVert_ERlV1",streakHorizRight:"SuggestionItem-module_streakHorizRight_aboGz",streakHorizLeft:"SuggestionItem-module_streakHorizLeft_BreWJ",streakVertUp:"SuggestionItem-module_streakVertUp_to1GD",streakVertDown:"SuggestionItem-module_streakVertDown_OrcLh",skeletonPulse:"SuggestionItem-module_skeletonPulse_plvdD",text:"SuggestionItem-module_text_yqoh9"};var ie=require("react/jsx-runtime");function qe({option:e,isHighlighted:t,onSelect:o,onHighlight:p,id:a,loading:s}){let[l,d]=(0,pe.useState)(!1),f=(0,pe.useRef)(void 0);(0,pe.useEffect)(()=>()=>clearTimeout(f.current),[]);let x=()=>{s||!e.is_tappable||l||(d(!0),o(e),clearTimeout(f.current),f.current=setTimeout(()=>d(!1),500))},L=[j.item,t&&!s?j.highlighted:"",e.is_tappable?j.tappable:j.nonTappable,l?j.pressed:""].filter(Boolean).join(" ");return(0,ie.jsxs)("div",{id:a,role:"option","data-aia-option":"","data-aia-loading":s?"":void 0,"aria-selected":t,className:L,tabIndex:s||!e.is_tappable?-1:0,onClick:x,onKeyDown:P=>{!s&&e.is_tappable&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),x())},onMouseEnter:!s&&e.is_tappable?p:void 0,children:[(0,ie.jsx)("div",{className:j.streaks}),(0,ie.jsx)("div",{className:j.streaksVert}),(0,ie.jsxs)("span",{className:j.content,children:[(0,ie.jsx)("span",{className:j.text,children:e.icon?`${e.icon} ${e.text}`:e.text}),e.tag&&(0,ie.jsx)("span",{className:j.tag,children:e.tag})]})]})}var ze=require("react/jsx-runtime");function $e({options:e,activeIndex:t,onSelect:o,onHighlight:p,listboxId:a,loading:s}){return(0,ze.jsx)(Ve,{min:"250px",max:"250px",gap:"0",scroll:!0,fade:!0,children:e.map((l,d)=>(0,ze.jsx)(qe,{option:l,isHighlighted:d===t,onSelect:o,onHighlight:()=>p(d),id:`${a}-option-${d}`,loading:s},l.text))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`@layer layout {
823
956
  .aia-stack {
824
957
  display: flex;
825
958
  flex-direction: column;
@@ -836,128 +969,10 @@
836
969
  }
837
970
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
838
971
  }
839
- `,document.head.appendChild(e)}var Qe=require("react/jsx-runtime");function Ue({space:e,align:t="stretch",className:o,children:l,...a}){let n=e?{"--aia-stack-space":e}:void 0;return(0,Qe.jsx)("div",{className:o?`aia-stack ${o}`:"aia-stack","data-align":t,style:n,...a,children:l})}var j=require("react/jsx-runtime"),ft=[159,119,164];function ke({suggestions:e,activeIndex:t,onSelect:o,onHighlight:l,isOpen:a,id:n,className:d,pills:m,onPillClick:y,showPills:h=!0,isLoading:S=!1,hasTabbedToHighlight:P=!1}){let A=e[0]?.options??[],b=t>=0&&!!A[t]?.is_tappable,R=!!(m&&m.length>0&&y),B=h&&R,s=B||h&&!R&&S,x=A.length>0,W=S&&!x,V=a&&(x||B||S);return(0,j.jsx)("div",{id:n,role:"listbox","data-aia-dropdown":"","data-aia-loading":S?"":void 0,className:`${ce.dropdown} ${V?ce.visible:""} ${d??""}`,onMouseDown:T=>T.preventDefault(),children:(0,j.jsxs)(Ue,{space:"14px",children:[s&&(0,j.jsx)(ge,{noWrap:!0,className:ce.pillBar,"data-aia-pillbar":"",children:(0,j.jsx)(_e,{pills:m??[],activePillIndex:0,onSelectPill:y??(()=>{}),rounded:!0,loading:S})}),x&&(0,j.jsx)($e,{options:A,activeIndex:t,onSelect:o,onHighlight:l,listboxId:n,loading:S}),W&&(0,j.jsx)("div",{className:ce.skeletonBars,"data-aia-skeleton-bars":"",children:ft.map(T=>(0,j.jsx)("span",{className:ce.skeletonBar,style:{width:T}},`bar-${T}`))}),(0,j.jsx)(Ke,{hasTabbedToHighlight:P,isOptionHighlighted:b})]})})}if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
840
- * Built-in appearance defaults \u2014 zero specificity via :where().
841
- * Consumer CSS always wins without !important.
842
- *
843
- * Resolution priority (highest wins):
844
- * 1. Consumer CSS targeting new vars (--aia-pill-bg, etc.)
845
- * 2. Consumer CSS targeting legacy vars (--aia-color-*, via fallback chain)
846
- * 3. These built-in defaults
847
- */
848
-
849
- /*
850
- * Library-scoped box-sizing reset. The SDK's pill / option / wrapper styles
851
- * mix explicit dimensions with padding (e.g. .magicx-aia-pill has height:36px
852
- * + padding:13px) and were authored assuming \`border-box\`. In consumer apps
853
- * without a global \`* { box-sizing: border-box }\` reset the pill rendered
854
- * ~62px tall instead of 36px. Scoping the reset to \`.magicx-aia\` descendants
855
- * keeps the library self-contained without leaking onto consumer markup.
856
- */
857
- :where(.magicx-aia, .magicx-aia *, .magicx-aia *::before, .magicx-aia *::after) {
858
- box-sizing: border-box;
859
- }
860
-
861
- /* Light mode defaults (base) */
862
- :where(.magicx-aia),
863
- :where(.magicx-aia[data-mode="light"]) {
864
- --aia-surface: #ffffff;
865
- --aia-border: #b0b0b0;
866
- --aia-pill-bg: #bdbdbd;
867
- --aia-pill-color: #333539;
868
- --aia-pill-font-size: 18px;
869
-
870
- --aia-option-bg: transparent;
871
- --aia-option-color: #505050;
872
- --aia-option-color-selected: #000000;
873
- --aia-option-font-size: 18px;
874
-
875
- --aia-written-text-color: #000000;
876
- --aia-written-text-font-size: 20px;
877
- --aia-caret-color: var(--aia-written-text-color, #000000);
878
-
879
- --aia-submit-bg: #000000;
880
- --aia-submit-color: #ffffff;
881
-
882
- --aia-color-text-muted: #6b7280;
883
-
884
- --aia-skeleton-bg: rgba(189, 189, 189, 0.51);
885
-
886
- --aia-streak-rgb: 99, 102, 241;
887
- --aia-streak-glass-bg: rgba(99, 102, 241, 0.1);
888
-
889
- --aia-footer-divider: rgba(176, 176, 176, 0.4);
890
- --aia-footer-hint-color: #505050;
891
- --aia-footer-brand-color: #b0b0b0;
892
- --aia-footer-badge-border: rgba(189, 189, 189, 0.51);
893
- }
894
-
895
- /* Dark mode defaults */
896
- :where(.magicx-aia[data-mode="dark"]) {
897
- --aia-surface: #000000;
898
- --aia-border: #505050;
899
- --aia-pill-bg: #bdbdbd;
900
- --aia-pill-color: #b0b0b0;
901
- --aia-pill-font-size: 18px;
902
-
903
- --aia-option-bg: transparent;
904
- --aia-option-color: #b0b0b0;
905
- --aia-option-color-selected: #ffffff;
906
- --aia-option-font-size: 18px;
907
-
908
- --aia-written-text-color: #ffffff;
909
- --aia-written-text-font-size: 20px;
910
- --aia-caret-color: var(--aia-written-text-color, #ffffff);
911
-
912
- --aia-submit-bg: #ffffff;
913
- --aia-submit-color: #000000;
914
-
915
- --aia-color-text-muted: #c1c4cb;
916
-
917
- --aia-skeleton-bg: #333539;
918
-
919
- --aia-streak-rgb: 255, 255, 255;
920
- --aia-streak-glass-bg: rgba(255, 255, 255, 0.1);
921
-
922
- --aia-footer-divider: rgba(255, 255, 255, 0.15);
923
- --aia-footer-hint-color: #b0b0b0;
924
- --aia-footer-brand-color: #505050;
925
- --aia-footer-badge-border: #505050;
926
- }
927
-
928
- /* optionsPosition: dropdown above the input. The sections live inside the
929
- dropdown's .aia-stack, so the reversal targets the stack (not the dropdown,
930
- whose only child is the stack). */
931
- :where(.magicx-aia[data-options-position="above"]) [data-aia-dropdown] {
932
- top: auto;
933
- bottom: 100%;
934
- margin-top: 0;
935
- margin-bottom: 6px;
936
- }
937
-
938
- :where(.magicx-aia[data-options-position="above"]) [data-aia-dropdown] .aia-stack {
939
- flex-direction: column-reverse;
940
- }
941
-
942
- /* The footer sits at the top when the dropdown is above, so flip its own
943
- internal stack too \u2014 the divider should sit BELOW the hint/branding row
944
- (between the footer and the options beneath it), not above it. The footer's
945
- own class is CSS-module-scoped, so target the stable data attribute. */
946
- :where(.magicx-aia[data-options-position="above"]) [data-aia-dropdown] [data-aia-footer] {
947
- flex-direction: column-reverse;
948
- }
949
-
950
- /* Disable all animations when data-animations="off" */
951
- :where(.magicx-aia[data-animations="off"]) *,
952
- :where(.magicx-aia[data-animations="off"]) *::before,
953
- :where(.magicx-aia[data-animations="off"]) *::after {
954
- animation-duration: 0s !important;
955
- transition-duration: 0s !important;
956
- }
957
- `,document.head.appendChild(e)}var ue=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.SubmitButton-module_submitButton_otz7H {
972
+ `,document.head.appendChild(e)}var Qe=require("react/jsx-runtime");function Ue({space:e,align:t="stretch",className:o,children:p,...a}){let s=e?{"--aia-stack-space":e}:void 0;return(0,Qe.jsx)("div",{className:o?`aia-stack ${o}`:"aia-stack","data-align":t,style:s,...a,children:p})}var $=require("react/jsx-runtime"),bt=[159,119,164];function Ie({suggestions:e,activeIndex:t,onSelect:o,onHighlight:p,isOpen:a,id:s,className:l,pills:d,onPillClick:f,showPills:x=!0,activeSelected:L=!1,isLoading:P=!1,hasTabbedToHighlight:A=!1,isInputEmpty:C=!1,optionsPosition:v="below"}){let B=e[0]?.options??[],M=!!(d&&d.length>0&&f),N=a&&(B.length>0||x&&M||P),n={suggestions:e,activeIndex:t,pills:d,showPills:x,activeSelected:L,isLoading:P,hasTabbedToHighlight:A,isInputEmpty:C},_=(0,Xe.useRef)(n);N&&(_.current=n);let g=N?n:_.current,z=g.suggestions[0]?.options??[],U=g.activeIndex>=0&&!!z[g.activeIndex]?.is_tappable,K=!!(g.pills&&g.pills.length>0&&f),R=g.showPills&&K,Q=g.showPills&&!K&&g.isLoading,F=R||Q,X=z.length>0,J=g.isLoading&&!X;return(0,$.jsx)("div",{id:s,role:"listbox","data-aia-dropdown":"","data-options-position":v,"data-aia-loading":g.isLoading?"":void 0,className:`${ce.dropdown} ${N?ce.visible:""} ${l??""}`,onMouseDown:H=>H.preventDefault(),children:(0,$.jsxs)(Ue,{space:"2px",children:[F&&(0,$.jsx)(ge,{noWrap:!0,className:ce.pillBar,"data-aia-pillbar":"",children:(0,$.jsx)(_e,{pills:g.pills??[],activePillIndex:0,activeSelected:g.activeSelected,onSelectPill:f??(()=>{}),rounded:!0,loading:g.isLoading})}),X&&(0,$.jsx)($e,{options:z,activeIndex:g.activeIndex,onSelect:o,onHighlight:p,listboxId:s,loading:g.isLoading}),J&&(0,$.jsx)("div",{className:ce.skeletonBars,"data-aia-skeleton-bars":"",children:bt.map(H=>(0,$.jsx)("span",{className:ce.skeletonBar,style:{width:H}},`bar-${H}`))}),(0,$.jsx)(Ke,{hasTabbedToHighlight:g.hasTabbedToHighlight,isOptionHighlighted:U,isInputEmpty:g.isInputEmpty})]})})}var ue=require("@magicx-eng/ai-autocomplete-vanilla");if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.SubmitButton-module_submitButton_otz7H {
958
973
  flex-shrink: 0;
959
- width: 36px;
960
- height: 36px;
974
+ width: 32px;
975
+ height: 32px;
961
976
  border-radius: 50%;
962
977
  border: none;
963
978
  background: var(--aia-submit-bg, var(--aia-color-text-default, #fff));
@@ -978,5 +993,5 @@
978
993
  opacity: 0.4;
979
994
  cursor: default;
980
995
  }
981
- `,document.head.appendChild(e)}var Xe={submitButton:"SubmitButton-module_submitButton_otz7H"};var Ie=require("react/jsx-runtime");function Je({disabled:e,onClick:t}){return(0,Ie.jsx)("button",{type:"button","data-aia-submit":"",className:Xe.submitButton,disabled:e,onClick:o=>{o.stopPropagation(),t()},"aria-label":"Submit",children:(0,Ie.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,Ie.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ze=require("@magicx-eng/ai-autocomplete-vanilla"),w=require("react"),ht={text:"",completedParams:[],suggestions:[],activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],placeholderText:"",isDropdownOpen:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,hasTabbedToHighlight:!1};function Se({onSubmit:e,onError:t,optionOverrides:o,maskCompletedText:l,apiConfig:a,columns:n=2,dropdownTrigger:d,optionsPosition:m,closeDropdownOnBlur:y,showNonTappableOptions:h,onFocus:S,onBlur:P,value:C,completedParams:A,onChange:b,onParamsChange:R,source:B,setCursor:X}){let s=(0,w.useRef)(null),[x,W]=(0,w.useState)(null),V=(0,w.useRef)(e);V.current=e;let T=(0,w.useRef)(t);T.current=t;let oe=(0,w.useRef)(b);oe.current=b;let J=(0,w.useRef)(R);J.current=R;let F=(0,w.useRef)(S);F.current=S;let ae=(0,w.useRef)(P);ae.current=P;let H=(0,w.useRef)(X);H.current=X,(0,w.useEffect)(()=>{if(typeof document>"u")return;let r=new Ze.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:a,optionOverrides:o,maskCompletedText:l,columns:n,dropdownTrigger:d,optionsPosition:m,closeDropdownOnBlur:y,showNonTappableOptions:h,source:B,value:C,completedParams:A,onSubmit:(...E)=>V.current?.(...E),onError:(...E)=>T.current?.(...E),onChange:(...E)=>oe.current?.(...E),onParamsChange:(...E)=>J.current?.(...E),onFocus:()=>F.current?.(),onBlur:()=>ae.current?.(),setCursor:E=>H.current?.(E)});s.current=r,W(r.getState());let D=r.subscribe(E=>W(E));return()=>{D(),r.destroy(),s.current===r&&(s.current=null)}},[]),(0,w.useEffect)(()=>{C!==void 0&&s.current?.setValue(C)},[C]),(0,w.useEffect)(()=>{A!==void 0&&s.current?.setCompletedParams(A)},[A]);let le=JSON.stringify(a??null),ne=(0,w.useRef)(o),Z=(0,w.useRef)(0);if(o!==ne.current){let r=ne.current,D=o,E=Object.keys(r??{}),de=Object.keys(D??{});(E.length!==de.length||de.some(me=>!r?.[me]||D[me]!==r[me]))&&Z.current++,ne.current=o}(0,w.useEffect)(()=>{s.current?.update({apiConfig:a,optionOverrides:o,dropdownTrigger:d,optionsPosition:m,closeDropdownOnBlur:y,showNonTappableOptions:h})},[le,Z.current,d,m,y,h]);let q=(0,w.useRef)(null);q.current===null&&(q.current={handleTextChange:r=>s.current?.handleTextChange(r),handleKeyDown:r=>{let D="nativeEvent"in r?r.nativeEvent:r;s.current?.handleKeyDown(D)},setFocused:r=>s.current?.setFocused(r),startEditingParam:r=>s.current?.startEditingParam(r),exitEditMode:()=>s.current?.exitEditMode(),handleCaretAfterInput:r=>s.current?.handleCaretAfterInput(r),handleCaretMove:r=>s.current?.handleCaretMove(r),replaceEditingRange:r=>s.current?.replaceEditingRange(r)??!1,setActivePill:r=>s.current?.setActivePill(r),removeLastParam:()=>s.current?.removeLastParam(),clearNewParamId:()=>s.current?.clearNewParamId(),reset:()=>s.current?.reset(),selectOption:r=>s.current?.selectOption(r),setActiveDropdownIndex:r=>s.current?.setActiveDropdownIndex(r),handleFocus:()=>s.current?.setFocused(!0),handleBlur:()=>s.current?.setFocused(!1)});let _=q.current,re=(0,w.useCallback)(r=>{let D=r.target.value,de=D.length>0&&!r.nativeEvent?.isComposing&&D[0]!==D[0].toUpperCase()?D[0].toUpperCase()+D.slice(1):D;s.current?.handleTextChange(de)},[]),ie=(0,w.useCallback)(r=>{s.current?.handleKeyDown(r.nativeEvent)},[]),Y=s.current,c=x??ht,i=C!==void 0?C:c.text,p=A!==void 0?A:c.completedParams,g=c.actionableSuggestions,k=g[0],f=Y?.listboxId??"",L=c.activeDropdownIndex>=0&&Y?`${f}-option-${c.activeDropdownIndex}`:void 0,O=c.editingParam,$=O?{type:O.suggestionType,text:O.suggestionPlaceholder,required:!0,options:O.options}:null,he=$??k,Ce=$?[$]:g,be=!Y||c.isLoading&&!c.editingParam&&!c.inSelectionAnimation;return{completedParams:p,suggestionPills:g,setActivePill:_.setActivePill,removeLastParam:_.removeLastParam,segments:c.segments,newParamId:c.newParamId,clearNewParamId:_.clearNewParamId,suggestions:c.suggestions,activeIndex:c.activeDropdownIndex,isReady:c.isReady,isLoading:be,isFocused:c.isFocused,isDropdownOpen:c.isDropdownOpen,placeholderText:c.placeholderText,listboxId:f,error:c.error,handleTextChange:_.handleTextChange,handleKeyDown:_.handleKeyDown,setFocused:_.setFocused,editingParam:O,editingAnchor:c.editingAnchor,caretOffset:c.caretOffset,startEditingParam:_.startEditingParam,exitEditMode:_.exitEditMode,handleCaretAfterInput:_.handleCaretAfterInput,handleCaretMove:_.handleCaretMove,replaceEditingRange:_.replaceEditingRange,inputProps:{value:i,placeholder:c.placeholderText||void 0,onChange:re,onKeyDown:ie,onFocus:_.handleFocus,onBlur:_.handleBlur,role:"combobox","aria-expanded":c.isDropdownOpen,"aria-activedescendant":L,"aria-autocomplete":"list","aria-controls":f},reset:_.reset,dropdownProps:{suggestions:he?[{...he,options:c.filteredOptions}]:[],activeIndex:c.activeDropdownIndex,onSelect:_.selectOption,onHighlight:_.setActiveDropdownIndex,isOpen:c.isDropdownOpen,id:f,pills:Ce,onPillClick:_.setActivePill,isLoading:be,hasTabbedToHighlight:c.hasTabbedToHighlight}}}var z=require("@magicx-eng/ai-autocomplete-vanilla"),u=require("react"),Ae;function bt(){if(Ae!==void 0)return Ae;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ae=e.contentEditable==="plaintext-only",Ae}function Ye(e){let{segments:t,newParamId:o,editingParam:l,editingAnchor:a,caretOffset:n,placeholderText:d,isFocused:m,isDropdownOpen:y,listboxId:h,activeDescendantId:S,autoFocus:P,handleTextChange:C,handleKeyDown:A,handleCaretAfterInput:b,handleCaretMove:R,startEditingParam:B,replaceEditingRange:X,setFocused:s}=e,x=(0,u.useRef)(null),W=(0,u.useRef)(!1),V=(0,u.useRef)(""),T=(0,u.useRef)(""),oe=(0,u.useRef)(null),J=(0,u.useRef)(0);oe.current=n,(0,u.useEffect)(()=>{if(!P)return;let i=x.current;i&&(document.activeElement===i?s(!0):i.focus())},[P,s]),(0,u.useEffect)(()=>{let i=x.current;if(!i)return;let p=i.ownerDocument??document,g=()=>{let k=p.getSelection();if(!k||k.rangeCount===0||!k.anchorNode||!i.contains(k.anchorNode))return;let f=k.anchorNode,$=(f.nodeType===Node.ELEMENT_NODE?f:f.parentElement)?.closest('strong[data-seg="completed"][data-param-id]')?.dataset.paramId??null;if($&&$!==l?.id){B($);return}performance.now()-J.current<50||R((0,z.getCursorOffset)(i))};return p.addEventListener("selectionchange",g),()=>p.removeEventListener("selectionchange",g)},[l,B,R]),(0,u.useLayoutEffect)(()=>{let i=x.current;i&&(0,z.renderEditableContent)({input:i,segments:t,newParamId:o,editingParamId:l?.id??null,placeholderText:d??"",isFocused:m})},[t,o,l,d,m]),(0,u.useLayoutEffect)(()=>{let i=V.current,p=o??"";if(V.current=p,!p||p===i)return;let g=x.current;if(!g)return;g.focus();let k=oe.current??(0,z.plainTextLength)(g);(0,z.setCursorOffset)(g,k)},[o]),(0,u.useLayoutEffect)(()=>{let i=T.current,p=l?.id??"";if(T.current=p,!p||p===i||a==null)return;let g=x.current;g&&(0,z.setCursorOffset)(g,a)},[l,a]);let F=(0,u.useCallback)(()=>{if(W.current)return;let i=x.current;if(!i)return;let p=(0,z.extractPlainText)(i),k=p.length>0&&p[0]!==p[0].toUpperCase()?p[0].toUpperCase()+p.slice(1):p;C(k)},[C]),ae=(0,u.useCallback)(()=>{J.current=performance.now(),F();let i=x.current;i&&b((0,z.getCursorOffset)(i))},[F,b]);(0,u.useEffect)(()=>{let i=x.current;if(!i)return;let p=g=>{let k=g,f=k.inputType;if(f==="insertParagraph"||f==="insertLineBreak"||f==="insertFromDrop"){g.preventDefault();return}if(f.startsWith("insert")||f.startsWith("delete")){let L=f.startsWith("delete")?"":k.data??"";X(L)&&g.preventDefault()}};return i.addEventListener("beforeinput",p),()=>i.removeEventListener("beforeinput",p)},[X]);let H=(0,u.useCallback)(()=>{W.current=!0},[]),le=(0,u.useCallback)(()=>{W.current=!1,F()},[F]),ne=(0,u.useCallback)(i=>{i.preventDefault();let p=x.current;if(!p)return;let g=(i.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!g)return;let k=p.ownerDocument??document,f=k.getSelection();if(!f||f.rangeCount===0)return;let L=f.getRangeAt(0);if(!p.contains(L.startContainer))return;L.deleteContents();let O=k.createTextNode(g);L.insertNode(O),L.setStartAfter(O),L.collapse(!0),f.removeAllRanges(),f.addRange(L),F()},[F]),Z=(0,u.useCallback)(i=>A(i),[A]),q=(0,u.useCallback)(()=>s(!0),[s]),_=(0,u.useCallback)(()=>s(!1),[s]),re=(0,u.useCallback)(()=>x.current?.focus(),[]),ie=(0,u.useCallback)(()=>x.current?.blur(),[]),Y=(0,u.useCallback)(()=>{let i=x.current;return i?(0,z.extractPlainText)(i):""},[]),c=bt()?"plaintext-only":"true";return{inputRef:x,editorProps:{ref:x,contentEditable:c,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":h,"aria-expanded":y,"aria-activedescendant":S,spellCheck:!0,enterKeyHint:"send",onInput:ae,onKeyDown:Z,onCompositionStart:H,onCompositionEnd:le,onPaste:ne,onFocus:q,onBlur:_},getPlainText:Y,focus:re,blur:ie}}var K=require("react/jsx-runtime");function xt(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var et=(0,I.forwardRef)(function({onSubmit:t,onError:o,optionOverrides:l,maskCompletedText:a,className:n,apiConfig:d,columns:m,pillPlacement:y="inline",mode:h="auto",optionsPosition:S="below",animations:P=!0,dropdownTrigger:C,closeDropdownOnBlur:A,showNonTappableOptions:b,autoFocus:R=!0,onFocus:B,onBlur:X,value:s,completedParams:x,onChange:W,onParamsChange:V,submitButton:T},oe){let J=(0,I.useRef)(null),F=(0,I.useRef)(null),ae=(0,I.useRef)(()=>{}),H=(0,I.useRef)(null),le=(0,I.useRef)(null);(0,I.useEffect)(()=>{let v=J.current;if(v)return H.current?H.current.setMode(h):H.current=new ue.ModeController(v,h),()=>{H.current?.destroy(),H.current=null}},[h]);let ne=(0,I.useCallback)(v=>{let G=le.current?.current;G&&(G.focus(),(0,ue.setCursorOffset)(G,v))},[]),{completedParams:Z,suggestionPills:q,setActivePill:_,segments:re,newParamId:ie,clearNewParamId:Y,placeholderText:c,isFocused:i,isDropdownOpen:p,isLoading:g,activeIndex:k,listboxId:f,handleTextChange:L,handleKeyDown:O,setFocused:$,editingParam:he,editingAnchor:Ce,caretOffset:be,startEditingParam:r,handleCaretAfterInput:D,handleCaretMove:E,replaceEditingRange:de,dropdownProps:me,reset:xe}=Se({onSubmit:v=>ae.current(v),onError:o,optionOverrides:l,maskCompletedText:a,apiConfig:d,columns:m,dropdownTrigger:C,optionsPosition:S,closeDropdownOnBlur:A,showNonTappableOptions:b,onFocus:B,onBlur:X,value:s,completedParams:x,onChange:W,onParamsChange:V,source:"full-sdk",setCursor:ne});(0,I.useEffect)(()=>{if(!ie)return;let v=window.setTimeout(()=>Y(),650);return()=>window.clearTimeout(v)},[ie,Y]);let tt=k>=0?`${f}-option-${k}`:void 0,{inputRef:Pe,editorProps:ot,focus:ve,blur:Fe,getPlainText:He}=Ye({segments:re,newParamId:ie,editingParam:he,editingAnchor:Ce,caretOffset:be,placeholderText:c,isFocused:i,isDropdownOpen:p,listboxId:f,activeDescendantId:tt,autoFocus:R,handleTextChange:L,handleKeyDown:O,handleCaretAfterInput:D,handleCaretMove:E,startEditingParam:r,replaceEditingRange:de,setFocused:$});le.current=Pe,(0,I.useLayoutEffect)(()=>{let v=F.current,G=Pe.current;if(!v||!G)return;let ye=()=>{let Me=v.firstElementChild;if(!Me)return;let it=Me.getBoundingClientRect(),st=G.getBoundingClientRect();it.top>=st.bottom-2?v.setAttribute("data-aia-pill-wrapped",""):v.removeAttribute("data-aia-pill-wrapped")};ye();let Oe=new ResizeObserver(ye);return Oe.observe(G),()=>Oe.disconnect()},[re,q.length,g,Pe]),(0,I.useImperativeHandle)(oe,()=>({focus:ve,blur:Fe,reset:xe,setMode:v=>H.current?.setMode(v)}),[ve,Fe,xe]);let we=!!re.length||Z.length>0,Ee=(0,I.useCallback)(()=>{if(!we)return;let v=He(),{rawQuery:G,completedParams:ye}=(0,ue.buildQuery)(v,Z);t({query:v.trim(),raw_query:G,completed_params:ye}),xe()},[we,Z,t,xe,He]);ae.current=Ee;let at=(0,I.useCallback)(v=>{v.target?.closest("[data-aia-pill]")||ve()},[ve]),nt=y==="inline",rt=y==="dropdown";return(0,K.jsxs)("div",{ref:J,className:`magicx-aia ${se.container} ${n??""}`,"data-pill-placement":y,"data-options-position":S,"data-animations":P?"on":"off","data-mode":xt(h),children:[(0,K.jsx)(ke,{...me,showPills:rt}),(0,K.jsxs)("div",{className:se.inputWrapper,onClick:at,children:[(0,K.jsxs)("div",{className:se.editorArea,"data-aia-editor":"",children:[(0,K.jsx)("div",{...ot,className:se.input,"data-aia-input":""}),nt&&(g||q.length>0)&&(0,K.jsx)("span",{ref:F,className:se.pillListContainer,"data-aia-pill-list-container":"",children:(0,K.jsx)(_e,{pills:q,activePillIndex:0,onSelectPill:_,loading:g})})]}),T===null?null:T===void 0?(0,K.jsx)(Je,{disabled:!we,onClick:Ee}):(0,K.jsx)("span",{"data-aia-submit":"",className:se.submitSlot,onClick:v=>{we&&(v.stopPropagation(),Ee())},children:T})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,useAIAutocomplete});
996
+ `,document.head.appendChild(e)}var Je={submitButton:"SubmitButton-module_submitButton_otz7H"};var ke=require("react/jsx-runtime");function Ze({disabled:e,onClick:t}){return(0,ke.jsx)("button",{type:"button","data-aia-submit":"",className:Je.submitButton,disabled:e,onClick:o=>{o.stopPropagation(),t()},"aria-label":"Submit",children:(0,ke.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,ke.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ye=require("@magicx-eng/ai-autocomplete-vanilla"),y=require("react"),xt={text:"",completedParams:[],suggestions:[],activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],placeholderText:"",isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,hasTabbedToHighlight:!1};function Se({onSubmit:e,onError:t,optionOverrides:o,maskCompletedText:p,apiConfig:a,columns:s=2,dropdownTrigger:l,optionsPosition:d,closeDropdownOnBlur:f,showNonTappableOptions:x,onFocus:L,onBlur:P,value:A,completedParams:C,onChange:v,onParamsChange:B,source:M,setCursor:N}){let n=(0,y.useRef)(null),[_,g]=(0,y.useState)(null),oe=(0,y.useRef)(e);oe.current=e;let z=(0,y.useRef)(t);z.current=t;let U=(0,y.useRef)(v);U.current=v;let K=(0,y.useRef)(B);K.current=B;let R=(0,y.useRef)(L);R.current=L;let Q=(0,y.useRef)(P);Q.current=P;let F=(0,y.useRef)(N);F.current=N,(0,y.useEffect)(()=>{if(typeof document>"u")return;let r=new Ye.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:a,optionOverrides:o,maskCompletedText:p,columns:s,dropdownTrigger:l,optionsPosition:d,closeDropdownOnBlur:f,showNonTappableOptions:x,source:M,value:A,completedParams:C,onSubmit:(...E)=>oe.current?.(...E),onError:(...E)=>z.current?.(...E),onChange:(...E)=>U.current?.(...E),onParamsChange:(...E)=>K.current?.(...E),onFocus:()=>R.current?.(),onBlur:()=>Q.current?.(),setCursor:E=>F.current?.(E)});n.current=r,g(r.getState());let D=r.subscribe(E=>g(E));return()=>{D(),r.destroy(),n.current===r&&(n.current=null)}},[]),(0,y.useEffect)(()=>{A!==void 0&&n.current?.setValue(A)},[A]),(0,y.useEffect)(()=>{C!==void 0&&n.current?.setCompletedParams(C)},[C]);let X=JSON.stringify(a??null),J=(0,y.useRef)(o),H=(0,y.useRef)(0);if(o!==J.current){let r=J.current,D=o,E=Object.keys(r??{}),de=Object.keys(D??{});(E.length!==de.length||de.some(me=>!r?.[me]||D[me]!==r[me]))&&H.current++,J.current=o}(0,y.useEffect)(()=>{n.current?.update({apiConfig:a,optionOverrides:o,dropdownTrigger:l,optionsPosition:d,closeDropdownOnBlur:f,showNonTappableOptions:x})},[X,H.current,l,d,f,x]);let Z=(0,y.useRef)(null);Z.current===null&&(Z.current={handleTextChange:r=>n.current?.handleTextChange(r),handleKeyDown:r=>{let D="nativeEvent"in r?r.nativeEvent:r;n.current?.handleKeyDown(D)},setFocused:r=>n.current?.setFocused(r),startEditingParam:r=>n.current?.startEditingParam(r),exitEditMode:()=>n.current?.exitEditMode(),handleCaretAfterInput:r=>n.current?.handleCaretAfterInput(r),handleCaretMove:r=>n.current?.handleCaretMove(r),replaceEditingRange:r=>n.current?.replaceEditingRange(r)??!1,setActivePill:r=>n.current?.setActivePill(r),removeLastParam:()=>n.current?.removeLastParam(),clearNewParamId:()=>n.current?.clearNewParamId(),reset:()=>n.current?.reset(),selectOption:r=>n.current?.selectOption(r),setActiveDropdownIndex:r=>n.current?.setActiveDropdownIndex(r),handleFocus:()=>n.current?.setFocused(!0),handleBlur:()=>n.current?.setFocused(!1)});let I=Z.current,re=(0,y.useCallback)(r=>{let D=r.target.value,de=D.length>0&&!r.nativeEvent?.isComposing&&D[0]!==D[0].toUpperCase()?D[0].toUpperCase()+D.slice(1):D;n.current?.handleTextChange(de)},[]),se=(0,y.useCallback)(r=>{n.current?.handleKeyDown(r.nativeEvent)},[]),ae=n.current,c=_??xt,i=A!==void 0?A:c.text,u=C!==void 0?C:c.completedParams,h=c.actionableSuggestions,k=h[0],b=ae?.listboxId??"",T=c.activeDropdownIndex>=0&&ae?`${b}-option-${c.activeDropdownIndex}`:void 0,W=c.editingParam,Y=W?{type:W.suggestionType,text:W.suggestionPlaceholder,required:!0,options:W.options}:null,he=Y??k,Pe=Y?[Y]:h,be=!ae||c.isLoading&&!c.editingParam&&!c.inSelectionAnimation;return{completedParams:u,suggestionPills:h,setActivePill:I.setActivePill,removeLastParam:I.removeLastParam,segments:c.segments,newParamId:c.newParamId,clearNewParamId:I.clearNewParamId,suggestions:c.suggestions,activeIndex:c.activeDropdownIndex,isReady:c.isReady,isLoading:be,isFocused:c.isFocused,isDropdownOpen:c.isDropdownOpen,isActivePillSelected:c.isActivePillSelected,placeholderText:c.placeholderText,listboxId:b,error:c.error,handleTextChange:I.handleTextChange,handleKeyDown:I.handleKeyDown,setFocused:I.setFocused,editingParam:W,editingAnchor:c.editingAnchor,caretOffset:c.caretOffset,startEditingParam:I.startEditingParam,exitEditMode:I.exitEditMode,handleCaretAfterInput:I.handleCaretAfterInput,handleCaretMove:I.handleCaretMove,replaceEditingRange:I.replaceEditingRange,inputProps:{value:i,placeholder:c.placeholderText||void 0,onChange:re,onKeyDown:se,onFocus:I.handleFocus,onBlur:I.handleBlur,role:"combobox","aria-expanded":c.isDropdownOpen,"aria-activedescendant":T,"aria-autocomplete":"list","aria-controls":b},reset:I.reset,dropdownProps:{suggestions:he?[{...he,options:c.filteredOptions}]:[],activeIndex:c.activeDropdownIndex,onSelect:I.selectOption,onHighlight:I.setActiveDropdownIndex,isOpen:c.isDropdownOpen,id:b,pills:Pe,activeSelected:c.isActivePillSelected,onPillClick:I.setActivePill,isLoading:be,hasTabbedToHighlight:c.hasTabbedToHighlight,isInputEmpty:i.trim().length===0,optionsPosition:d??"below"}}}var O=require("@magicx-eng/ai-autocomplete-vanilla"),m=require("react"),Ae;function vt(){if(Ae!==void 0)return Ae;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ae=e.contentEditable==="plaintext-only",Ae}function et(e){let{segments:t,newParamId:o,editingParam:p,editingAnchor:a,caretOffset:s,placeholderText:l,isFocused:d,isDropdownOpen:f,listboxId:x,activeDescendantId:L,autoFocus:P,handleTextChange:A,handleKeyDown:C,handleCaretAfterInput:v,handleCaretMove:B,startEditingParam:M,replaceEditingRange:N,setFocused:n}=e,_=(0,m.useRef)(null),g=(0,m.useRef)(!1),oe=(0,m.useRef)(""),z=(0,m.useRef)(""),U=(0,m.useRef)(null),K=(0,m.useRef)(0);U.current=s,(0,m.useEffect)(()=>{if(!P)return;let i=_.current;i&&(document.activeElement===i?n(!0):i.focus())},[P,n]),(0,m.useEffect)(()=>{let i=_.current;if(!i)return;let u=i.ownerDocument??document,h=()=>{let k=u.getSelection();if(!k||k.rangeCount===0||!k.anchorNode||!i.contains(k.anchorNode))return;let b=k.anchorNode,Y=(b.nodeType===Node.ELEMENT_NODE?b:b.parentElement)?.closest('strong[data-seg="completed"][data-param-id]')?.dataset.paramId??null;if(Y&&Y!==p?.id){M(Y);return}performance.now()-K.current<50||B((0,O.getCursorOffset)(i))};return u.addEventListener("selectionchange",h),()=>u.removeEventListener("selectionchange",h)},[p,M,B]),(0,m.useLayoutEffect)(()=>{let i=_.current;i&&(0,O.renderEditableContent)({input:i,segments:t,newParamId:o,editingParamId:p?.id??null,placeholderText:l??"",isFocused:d})},[t,o,p,l,d]),(0,m.useLayoutEffect)(()=>{let i=oe.current,u=o??"";if(oe.current=u,!u||u===i)return;let h=_.current;if(!h)return;h.focus();let k=U.current??(0,O.plainTextLength)(h);(0,O.setCursorOffset)(h,k)},[o]),(0,m.useLayoutEffect)(()=>{let i=z.current,u=p?.id??"";if(z.current=u,!u||u===i||a==null)return;let h=_.current;h&&(0,O.setCursorOffset)(h,a)},[p,a]);let R=(0,m.useCallback)(()=>{if(g.current)return;let i=_.current;if(!i)return;let u=(0,O.extractPlainText)(i),k=u.length>0&&u[0]!==u[0].toUpperCase()?u[0].toUpperCase()+u.slice(1):u;A(k)},[A]),Q=(0,m.useCallback)(()=>{K.current=performance.now(),R();let i=_.current;i&&v((0,O.getCursorOffset)(i))},[R,v]);(0,m.useEffect)(()=>{let i=_.current;if(!i)return;let u=h=>{let k=h,b=k.inputType;if(b==="insertParagraph"||b==="insertLineBreak"||b==="insertFromDrop"){h.preventDefault();return}if(b.startsWith("insert")||b.startsWith("delete")){let T=b.startsWith("delete")?"":k.data??"";N(T)&&h.preventDefault()}};return i.addEventListener("beforeinput",u),()=>i.removeEventListener("beforeinput",u)},[N]);let F=(0,m.useCallback)(()=>{g.current=!0},[]),X=(0,m.useCallback)(()=>{g.current=!1,R()},[R]),J=(0,m.useCallback)(i=>{i.preventDefault();let u=_.current;if(!u)return;let h=(i.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!h)return;let k=u.ownerDocument??document,b=k.getSelection();if(!b||b.rangeCount===0)return;let T=b.getRangeAt(0);if(!u.contains(T.startContainer))return;T.deleteContents();let W=k.createTextNode(h);T.insertNode(W),T.setStartAfter(W),T.collapse(!0),b.removeAllRanges(),b.addRange(T),R()},[R]),H=(0,m.useCallback)(i=>C(i),[C]),Z=(0,m.useCallback)(()=>n(!0),[n]),I=(0,m.useCallback)(()=>n(!1),[n]),re=(0,m.useCallback)(()=>_.current?.focus(),[]),se=(0,m.useCallback)(()=>_.current?.blur(),[]),ae=(0,m.useCallback)(()=>{let i=_.current;return i?(0,O.extractPlainText)(i):""},[]),c=vt()?"plaintext-only":"true";return{inputRef:_,editorProps:{ref:_,contentEditable:c,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":x,"aria-expanded":f,"aria-activedescendant":L,spellCheck:!0,enterKeyHint:"send",onInput:Q,onKeyDown:H,onCompositionStart:F,onCompositionEnd:X,onPaste:J,onFocus:Z,onBlur:I},getPlainText:ae,focus:re,blur:se}}var V=require("react/jsx-runtime");function wt(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var tt=(0,S.forwardRef)(function({onSubmit:t,onError:o,optionOverrides:p,maskCompletedText:a,className:s,apiConfig:l,columns:d,pillPlacement:f="inline",mode:x="auto",optionsPosition:L="below",animations:P=!0,dropdownTrigger:A,closeDropdownOnBlur:C,showNonTappableOptions:v,autoFocus:B=!0,onFocus:M,onBlur:N,value:n,completedParams:_,onChange:g,onParamsChange:oe,submitButton:z},U){let K=(0,S.useRef)(null),R=(0,S.useRef)(null),Q=(0,S.useRef)(()=>{}),F=(0,S.useRef)(null),X=(0,S.useRef)(null);(0,S.useEffect)(()=>{let w=K.current;if(w)return F.current?F.current.setMode(x):F.current=new ue.ModeController(w,x),()=>{F.current?.destroy(),F.current=null}},[x]);let J=(0,S.useCallback)(w=>{let q=X.current?.current;q&&(q.focus(),(0,ue.setCursorOffset)(q,w))},[]),{completedParams:H,suggestionPills:Z,setActivePill:I,segments:re,newParamId:se,clearNewParamId:ae,placeholderText:c,isFocused:i,isDropdownOpen:u,isActivePillSelected:h,isLoading:k,activeIndex:b,listboxId:T,handleTextChange:W,handleKeyDown:Y,setFocused:he,editingParam:Pe,editingAnchor:be,caretOffset:r,startEditingParam:D,handleCaretAfterInput:E,handleCaretMove:de,replaceEditingRange:me,dropdownProps:ot,reset:xe}=Se({onSubmit:w=>Q.current(w),onError:o,optionOverrides:p,maskCompletedText:a,apiConfig:l,columns:d,dropdownTrigger:A,optionsPosition:L,closeDropdownOnBlur:C,showNonTappableOptions:v,onFocus:M,onBlur:N,value:n,completedParams:_,onChange:g,onParamsChange:oe,source:"full-sdk",setCursor:J});(0,S.useEffect)(()=>{if(!se)return;let w=window.setTimeout(()=>ae(),650);return()=>window.clearTimeout(w)},[se,ae]);let at=b>=0?`${T}-option-${b}`:void 0,{inputRef:Ce,editorProps:nt,focus:ve,blur:Fe,getPlainText:He}=et({segments:re,newParamId:se,editingParam:Pe,editingAnchor:be,caretOffset:r,placeholderText:c,isFocused:i,isDropdownOpen:u,listboxId:T,activeDescendantId:at,autoFocus:B,handleTextChange:W,handleKeyDown:Y,handleCaretAfterInput:E,handleCaretMove:de,startEditingParam:D,replaceEditingRange:me,setFocused:he});X.current=Ce,(0,S.useLayoutEffect)(()=>{let w=R.current,q=Ce.current;if(!w||!q)return;let ye=()=>{let Me=w.firstElementChild;if(!Me)return;let lt=Me.getBoundingClientRect(),dt=q.getBoundingClientRect();lt.top>=dt.bottom-2?w.setAttribute("data-aia-pill-wrapped",""):w.removeAttribute("data-aia-pill-wrapped")};ye();let Oe=new ResizeObserver(ye);return Oe.observe(q),()=>Oe.disconnect()},[re,Z.length,k,Ce]),(0,S.useImperativeHandle)(U,()=>({focus:ve,blur:Fe,reset:xe,setMode:w=>F.current?.setMode(w)}),[ve,Fe,xe]);let we=!!re.length||H.length>0,Ee=(0,S.useCallback)(()=>{if(!we)return;let w=He(),{rawQuery:q,completedParams:ye}=(0,ue.buildQuery)(w,H);t({query:w.trim(),raw_query:q,completed_params:ye}),xe()},[we,H,t,xe,He]);Q.current=Ee;let it=(0,S.useCallback)(w=>{w.target?.closest("[data-aia-pill]")||ve()},[ve]),rt=f==="inline",st=f==="dropdown";return(0,V.jsxs)("div",{ref:K,className:`magicx-aia ${le.container} ${s??""}`,"data-pill-placement":f,"data-options-position":L,"data-animations":P?"on":"off","data-mode":wt(x),children:[(0,V.jsx)(Ie,{...ot,showPills:st}),(0,V.jsxs)("div",{className:le.inputWrapper,onClick:it,children:[(0,V.jsxs)("div",{className:le.editorArea,"data-aia-editor":"",children:[(0,V.jsx)("div",{...nt,className:le.input,"data-aia-input":""}),rt&&(k||Z.length>0)&&(0,V.jsx)("span",{ref:R,className:le.pillListContainer,"data-aia-pill-list-container":"",children:(0,V.jsx)(_e,{pills:Z,activePillIndex:0,activeSelected:h,onSelectPill:I,loading:k})})]}),z===null?null:z===void 0?(0,V.jsx)(Ze,{disabled:!we,onClick:Ee}):(0,V.jsx)("span",{"data-aia-submit":"",className:le.submitSlot,onClick:w=>{we&&(w.stopPropagation(),Ee())},children:z})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,useAIAutocomplete});
982
997
  //# sourceMappingURL=index.js.map