@magicx-eng/ai-autocomplete-react 0.14.2 → 0.15.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/README.md CHANGED
@@ -311,6 +311,7 @@ function App() {
311
311
  | Prop | Type | Default | Description |
312
312
  |---|---|---|---|
313
313
  | `onSubmit` | `(result: AutocompleteResult) => void` | **required** | Called on Enter or submit button. |
314
+ | `onResult?` | `(result: AutocompleteResult) => void` | — | Called after every successful round-trip with the structured query as it now stands — see [Reading the query as it's built](#reading-the-query-as-its-built). |
314
315
  | `onError?` | `(error: Error) => void` | — | Called when a fetch fails. |
315
316
  | `apiConfig?` | `APIConfig` | — | Runtime API configuration (see below). |
316
317
  | `additionalContext?` | `Record<string, unknown>` | — | Optional user context. Include whatever you know about the user (a profile, preferences, workspace, anything) to personalize suggested parameters and options to them. |
@@ -497,7 +498,7 @@ The SDK handles token refresh transparently: 401 → `getAccessToken` → retry
497
498
 
498
499
  ### `useAIAutocomplete(options)`
499
500
 
500
- The headless hook for Tier 2 and Tier 3. Accepts the same options as `<AIAutocomplete />` except for the component-only rendering props: `className`, `ref`, `pillPlacement`, `mode`, `animations`, and `autoFocus` (those belong to the wrapping component — the hook doesn't own the input element). `optionsPosition` **is** accepted: it sets the arrow-key direction and flows through `dropdownProps` to the dropdown. `onFocus` and `onBlur` are forwarded and fire whenever the consumer-owned textarea's focus changes (they're driven by `inputProps.onFocus` / `inputProps.onBlur`).
501
+ The headless hook for Tier 2 and Tier 3. Accepts the same options as `<AIAutocomplete />` except for the component-only rendering props: `className`, `ref`, `pillPlacement`, `mode`, `animations`, and `autoFocus` (those belong to the wrapping component — the hook doesn't own the input element). `optionsPosition` **is** accepted: it sets the arrow-key direction and flows through `dropdownProps` to the dropdown. `onFocus` and `onBlur` are forwarded and fire whenever the consumer-owned textarea's focus changes (they're driven by `inputProps.onFocus` / `inputProps.onBlur`). `onResult` is accepted too and fires after every successful round-trip — see [Reading the query as it's built](#reading-the-query-as-its-built).
501
502
 
502
503
  #### Return Value
503
504
 
@@ -507,6 +508,7 @@ The headless hook for Tier 2 and Tier 3. Accepts the same options as `<AIAutocom
507
508
  |---|---|---|
508
509
  | `completedParams` | `CompletedParamState[]` | Filled parameters. |
509
510
  | `skippedParams` | `SkippedParamState[]` | Suggestions the user dismissed with <kbd>→</kbd>. Nothing renders them — pass them to `buildSubmitResult` for a hand-rolled submit. |
511
+ | `identifiedParams` | `IdentifiedParamState[]` | Parameters the server recognised in the user's own words. Already rendered through `segments`; pass them to `buildSubmitResult` for a hand-rolled submit so it reports the same `identified_params` the SDK's own results do. |
510
512
  | `suggestionPills` | `Suggestion[]` | Unfilled suggestions (pills). First item is the active pill. |
511
513
  | `segments` | `Segment[]` | Input text split into typed text vs completed params — completed segments render as bold `<strong>` runs inside the editor. |
512
514
  | `newParamId` | `string \| null` | ID of the most recently added param (for shimmer animation). |
@@ -571,11 +573,40 @@ The dropdown component for Tier 2. Spread `dropdownProps` from the hook (and add
571
573
 
572
574
  ### `AutocompleteResult`
573
575
 
576
+ The structured query as the SDK currently understands it. The same object is passed to `onSubmit` when the user submits and to `onResult` after every successful round-trip:
577
+
574
578
  | Field | Type | Description |
575
579
  |---|---|---|
576
- | `query` | `string` | Plain text as the user sees it. |
577
- | `raw_query` | `string` | Text with placeholder tokens (e.g. `"Create a {{TASK_1}}"`). |
578
- | `completed_params` | `CompletedParam[]` | Filled parameter values, followed by any the user skipped (see below). |
580
+ | `query` | `string` | Plain text as the user sees it, trimmed. |
581
+ | `raw_query` | `string` | `query` with each completed param replaced by its placeholder token (e.g. `"Create a {{TASK_1}}"`). |
582
+ | `completed_params` | `CompletedParam[]` | Filled parameter values in query order, followed by any the user skipped (see below). |
583
+ | `identified_params` | `IdentifiedParam[]` | Parameters the server recognised in the user's own words, as `{ type, value }` — e.g. `{ type: "due_date", value: "Friday" }` when the user typed "by Friday" instead of picking a date. They are not tokenized in `raw_query`, and they are tentative: each response replaces the set, and an entry drops out as soon as its text is edited away. |
584
+ | `is_ready` | `boolean` | Whether the server considers the query complete enough to act on. |
585
+
586
+ #### Reading the query as it's built
587
+
588
+ You don't have to wait for submit. `onResult` fires after **every** successful round-trip with the result as it now stands, so you can mirror the structured query live — a preview panel, a draft saved as the user goes, analytics on how far they got. It works on both tiers:
589
+
590
+ ```tsx
591
+ <AIAutocomplete
592
+ onResult={(result) => setPreview(result)}
593
+ onSubmit={(result) => run(result)}
594
+ />
595
+
596
+ // Tier 2 / 3
597
+ const ac = useAIAutocomplete({
598
+ onResult: (result) => saveDraft(result),
599
+ onSubmit: (result) => run(result),
600
+ });
601
+ ```
602
+
603
+ What "every successful round-trip" means in practice:
604
+
605
+ - It fires once per response the SDK applied — including the very first request on mount (an empty result) and after a response that promoted text the user had already typed into a completed param.
606
+ - It does **not** fire for a request that failed (`onError` does), was cancelled, or was superseded by a newer one before it returned.
607
+ - Keystrokes that haven't been sent yet don't fire it. Typing is debounced and only reaches the server once at least two new characters have been added, so `onResult` lags the input by a beat.
608
+ - An inline arrow function is fine — the latest one you passed is always the one called.
609
+ - A submit is the last result you saw plus whatever the user typed since. Both are built by the same exported `buildSubmitResult`, so the shapes never drift.
579
610
 
580
611
  #### Skipped parameters
581
612
 
@@ -585,7 +616,7 @@ Pressing <kbd>→</kbd> at the end of the input dismisses the active pill. The d
585
616
  { placeholder: "", type: "goal", text: "skipped", kind: null }
586
617
  ```
587
618
 
588
- Tier 2 consumers who build their own submit payload get the raw skips from the hook as `skippedParams`, and can fold them in the same way with the exported `buildSubmitResult(text, completedParams, skippedParams)`.
619
+ Tier 2 consumers who build their own submit payload get the raw skips from the hook as `skippedParams`, and can fold them in the same way with the exported `buildSubmitResult(text, completedParams, skippedParams, { identifiedParams, isReady })` — the last argument carries the hook's `identifiedParams` and `isReady` so a hand-rolled submit reports the same `identified_params` and `is_ready` the SDK's own results do.
589
620
 
590
621
  > **Reading `skippedParams` directly:** the array is append-only until `reset()`. The "drop a skip whose type got filled" rule is applied when the payload is built, not by pruning the array — so if the user skips `goal` and later fills one, the raw array still holds the `goal` entry. That's deliberate: the filter self-heals if they then delete that param's text, where pruning would discard the signal for good. `buildSubmitResult` applies the rule for you; to apply it elsewhere (say, a "you skipped X" badge), use the exported `withSkippedParams(completedParams, skippedParams)`.
591
622
 
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { AutocompleteResult, OptionOverrides, APIConfig, AppearanceMode, CompletedParamState, ProductsConfig, Product, Suggestion, SuggestionOption, FormatType, DateMonthView, SkippedParamState, Segment } from '@magicx-eng/ai-autocomplete-vanilla';
2
- export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, DateMonthView, FormatType, OptionOverrides, Product, ProductsConfig, Segment, SkippedParamState, Suggestion, SuggestionOption, TaskKind, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, formatDate, isoDate, monthLabel, parseDate, parseLooseDate, withSkippedParams } from '@magicx-eng/ai-autocomplete-vanilla';
1
+ import { AutocompleteResult, OptionOverrides, APIConfig, AppearanceMode, CompletedParamState, ProductsConfig, Product, Suggestion, SuggestionOption, FormatType, DateMonthView, SkippedParamState, IdentifiedParamState, Segment } from '@magicx-eng/ai-autocomplete-vanilla';
2
+ export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, DateMonthView, FormatType, IdentifiedParam, IdentifiedParamState, OptionOverrides, Product, ProductsConfig, Segment, SkippedParamState, SubmitResultExtras, Suggestion, SuggestionOption, TaskKind, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, formatDate, isoDate, monthLabel, parseDate, parseLooseDate, withSkippedParams } from '@magicx-eng/ai-autocomplete-vanilla';
3
3
  import * as react from 'react';
4
4
  import { ReactNode, KeyboardEvent, ChangeEvent } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -17,7 +17,21 @@ interface AIAutocompleteHandle {
17
17
  skipActivePill: () => void;
18
18
  }
19
19
  interface AIAutocompleteProps {
20
+ /** Called on Enter or submit-button click with the final structured query. */
20
21
  onSubmit: (result: AutocompleteResult) => void;
22
+ /**
23
+ * Called after every successful suggestion round-trip with the structured
24
+ * query as the SDK now understands it — the same `AutocompleteResult` shape
25
+ * `onSubmit` receives, so you can mirror the query as it is built (a live
26
+ * preview, a draft, analytics) without waiting for submit.
27
+ *
28
+ * Fires once per response that was applied, including the initial request
29
+ * on mount (an empty result). Does not fire for a request that failed, was
30
+ * aborted, or was superseded before it returned, and nothing fires for a
31
+ * keystroke that hasn't been sent yet. May be an inline arrow — the latest
32
+ * function is always the one called.
33
+ */
34
+ onResult?: (result: AutocompleteResult) => void;
21
35
  onError?: (error: Error) => void;
22
36
  optionOverrides?: OptionOverrides;
23
37
  maskCompletedText?: boolean;
@@ -102,7 +116,15 @@ interface AIAutocompleteProps {
102
116
  submitButton?: ReactNode;
103
117
  }
104
118
  interface UseAIAutocompleteOptions {
119
+ /** Called on Enter with the final structured query. */
105
120
  onSubmit?: (result: AutocompleteResult) => void;
121
+ /**
122
+ * Called after every successful suggestion round-trip with the structured
123
+ * query as the SDK now understands it — see `AIAutocompleteProps.onResult`.
124
+ * A hand-rolled submit should hand the consumer the same shape; build it
125
+ * with `buildSubmitResult(text, completedParams, skippedParams, { identifiedParams, isReady })`.
126
+ */
127
+ onResult?: (result: AutocompleteResult) => void;
106
128
  onError?: (error: Error) => void;
107
129
  optionOverrides?: OptionOverrides;
108
130
  maskCompletedText?: boolean;
@@ -189,6 +211,13 @@ interface UseAIAutocompleteReturn {
189
211
  * entries the SDK's own requests do.
190
212
  */
191
213
  skippedParams: SkippedParamState[];
214
+ /**
215
+ * Params the server identified in the user's own words. Already rendered
216
+ * through `segments`; exposed so a hand-rolled submit can pass them to
217
+ * `buildSubmitResult` and report the same `identified_params` the SDK's
218
+ * own results carry.
219
+ */
220
+ identifiedParams: IdentifiedParamState[];
192
221
  suggestionPills: Suggestion[];
193
222
  setActivePill: (index: number) => void;
194
223
  /**
@@ -373,6 +402,6 @@ declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProp
373
402
 
374
403
  declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, skipDisabled, activeSelected, isLoading, isInputEmpty, products, onProductSelect, onProductFocusChange, formatType, dateView, selectedDateIso, onPreviousMonth, onNextMonth, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
375
404
 
376
- declare function useAIAutocomplete({ onSubmit, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showSkipButton, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
405
+ declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showSkipButton, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
377
406
 
378
407
  export { AIAutocomplete, AIAutocompleteDropdown, type AIAutocompleteDropdownProps, type AIAutocompleteHandle, type AIAutocompleteProps, type UseAIAutocompleteOptions, type UseAIAutocompleteReturn, useAIAutocomplete };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { AutocompleteResult, OptionOverrides, APIConfig, AppearanceMode, CompletedParamState, ProductsConfig, Product, Suggestion, SuggestionOption, FormatType, DateMonthView, SkippedParamState, Segment } from '@magicx-eng/ai-autocomplete-vanilla';
2
- export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, DateMonthView, FormatType, OptionOverrides, Product, ProductsConfig, Segment, SkippedParamState, Suggestion, SuggestionOption, TaskKind, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, formatDate, isoDate, monthLabel, parseDate, parseLooseDate, withSkippedParams } from '@magicx-eng/ai-autocomplete-vanilla';
1
+ import { AutocompleteResult, OptionOverrides, APIConfig, AppearanceMode, CompletedParamState, ProductsConfig, Product, Suggestion, SuggestionOption, FormatType, DateMonthView, SkippedParamState, IdentifiedParamState, Segment } from '@magicx-eng/ai-autocomplete-vanilla';
2
+ export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, DateMonthView, FormatType, IdentifiedParam, IdentifiedParamState, OptionOverrides, Product, ProductsConfig, Segment, SkippedParamState, SubmitResultExtras, Suggestion, SuggestionOption, TaskKind, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, formatDate, isoDate, monthLabel, parseDate, parseLooseDate, withSkippedParams } from '@magicx-eng/ai-autocomplete-vanilla';
3
3
  import * as react from 'react';
4
4
  import { ReactNode, KeyboardEvent, ChangeEvent } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -17,7 +17,21 @@ interface AIAutocompleteHandle {
17
17
  skipActivePill: () => void;
18
18
  }
19
19
  interface AIAutocompleteProps {
20
+ /** Called on Enter or submit-button click with the final structured query. */
20
21
  onSubmit: (result: AutocompleteResult) => void;
22
+ /**
23
+ * Called after every successful suggestion round-trip with the structured
24
+ * query as the SDK now understands it — the same `AutocompleteResult` shape
25
+ * `onSubmit` receives, so you can mirror the query as it is built (a live
26
+ * preview, a draft, analytics) without waiting for submit.
27
+ *
28
+ * Fires once per response that was applied, including the initial request
29
+ * on mount (an empty result). Does not fire for a request that failed, was
30
+ * aborted, or was superseded before it returned, and nothing fires for a
31
+ * keystroke that hasn't been sent yet. May be an inline arrow — the latest
32
+ * function is always the one called.
33
+ */
34
+ onResult?: (result: AutocompleteResult) => void;
21
35
  onError?: (error: Error) => void;
22
36
  optionOverrides?: OptionOverrides;
23
37
  maskCompletedText?: boolean;
@@ -102,7 +116,15 @@ interface AIAutocompleteProps {
102
116
  submitButton?: ReactNode;
103
117
  }
104
118
  interface UseAIAutocompleteOptions {
119
+ /** Called on Enter with the final structured query. */
105
120
  onSubmit?: (result: AutocompleteResult) => void;
121
+ /**
122
+ * Called after every successful suggestion round-trip with the structured
123
+ * query as the SDK now understands it — see `AIAutocompleteProps.onResult`.
124
+ * A hand-rolled submit should hand the consumer the same shape; build it
125
+ * with `buildSubmitResult(text, completedParams, skippedParams, { identifiedParams, isReady })`.
126
+ */
127
+ onResult?: (result: AutocompleteResult) => void;
106
128
  onError?: (error: Error) => void;
107
129
  optionOverrides?: OptionOverrides;
108
130
  maskCompletedText?: boolean;
@@ -189,6 +211,13 @@ interface UseAIAutocompleteReturn {
189
211
  * entries the SDK's own requests do.
190
212
  */
191
213
  skippedParams: SkippedParamState[];
214
+ /**
215
+ * Params the server identified in the user's own words. Already rendered
216
+ * through `segments`; exposed so a hand-rolled submit can pass them to
217
+ * `buildSubmitResult` and report the same `identified_params` the SDK's
218
+ * own results carry.
219
+ */
220
+ identifiedParams: IdentifiedParamState[];
192
221
  suggestionPills: Suggestion[];
193
222
  setActivePill: (index: number) => void;
194
223
  /**
@@ -373,6 +402,6 @@ declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProp
373
402
 
374
403
  declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, skipDisabled, activeSelected, isLoading, isInputEmpty, products, onProductSelect, onProductFocusChange, formatType, dateView, selectedDateIso, onPreviousMonth, onNextMonth, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
375
404
 
376
- declare function useAIAutocomplete({ onSubmit, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showSkipButton, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
405
+ declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showSkipButton, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
377
406
 
378
407
  export { AIAutocomplete, AIAutocompleteDropdown, type AIAutocompleteDropdownProps, type AIAutocompleteHandle, type AIAutocompleteProps, type UseAIAutocompleteOptions, type UseAIAutocompleteReturn, useAIAutocomplete };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Qe=Object.defineProperty;var Nt=Object.getOwnPropertyDescriptor;var zt=Object.getOwnPropertyNames;var Ot=Object.prototype.hasOwnProperty;var Bt=(e,o)=>{for(var t in o)Qe(e,t,{get:o[t],enumerable:!0})},Ft=(e,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of zt(o))!Ot.call(e,r)&&r!==t&&Qe(e,r,{get:()=>o[r],enumerable:!(i=Nt(o,r))||i.enumerable});return e};var Gt=e=>Ft(Qe({},"__esModule",{value:!0}),e);var Jt={};Bt(Jt,{AIAutocomplete:()=>St,AIAutocompleteDropdown:()=>We,WEEKDAY_LABELS:()=>C.WEEKDAY_LABELS,buildSubmitResult:()=>C.buildSubmitResult,cellDay:()=>C.cellDay,cellIso:()=>C.cellIso,formatDate:()=>C.formatDate,isoDate:()=>C.isoDate,monthLabel:()=>C.monthLabel,parseDate:()=>C.parseDate,parseLooseDate:()=>C.parseLooseDate,useAIAutocomplete:()=>qe,withSkippedParams:()=>C.withSkippedParams});module.exports=Gt(Jt);var C=require("@magicx-eng/ai-autocomplete-vanilla");var T=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 Je=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var Ft=Object.getOwnPropertyNames;var Gt=Object.prototype.hasOwnProperty;var Ht=(e,i)=>{for(var t in i)Je(e,t,{get:i[t],enumerable:!0})},Kt=(e,i,t,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of Ft(i))!Gt.call(e,n)&&n!==t&&Je(e,n,{get:()=>i[n],enumerable:!(a=Bt(i,n))||a.enumerable});return e};var Wt=e=>Kt(Je({},"__esModule",{value:!0}),e);var aa={};Ht(aa,{AIAutocomplete:()=>Et,AIAutocompleteDropdown:()=>qe,WEEKDAY_LABELS:()=>D.WEEKDAY_LABELS,buildSubmitResult:()=>D.buildSubmitResult,cellDay:()=>D.cellDay,cellIso:()=>D.cellIso,formatDate:()=>D.formatDate,isoDate:()=>D.isoDate,monthLabel:()=>D.monthLabel,parseDate:()=>D.parseDate,parseLooseDate:()=>D.parseLooseDate,useAIAutocomplete:()=>je,withSkippedParams:()=>D.withSkippedParams});module.exports=Wt(aa);var D=require("@magicx-eng/ai-autocomplete-vanilla");var R=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
@@ -193,7 +193,7 @@
193
193
  opacity: 0;
194
194
  }
195
195
  }
196
- `,document.head.appendChild(e)}var Pe={container:"AIAutocomplete-module_container_KKjFU",inputWrapper:"AIAutocomplete-module_inputWrapper_FLq1b",editorArea:"AIAutocomplete-module_editorArea_7rBWq",input:"AIAutocomplete-module_input_IW-P-",pillListContainer:"AIAutocomplete-module_pillListContainer_h92IA",submitSlot:"AIAutocomplete-module_submitSlot_GhuCM",aiaPillReveal:"AIAutocomplete-module_aiaPillReveal_wf05b"};var Ke=require("@magicx-eng/ai-autocomplete-vanilla"),Z=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
196
+ `,document.head.appendChild(e)}var Pe={container:"AIAutocomplete-module_container_KKjFU",inputWrapper:"AIAutocomplete-module_inputWrapper_FLq1b",editorArea:"AIAutocomplete-module_editorArea_7rBWq",input:"AIAutocomplete-module_input_IW-P-",pillListContainer:"AIAutocomplete-module_pillListContainer_h92IA",submitSlot:"AIAutocomplete-module_submitSlot_GhuCM",aiaPillReveal:"AIAutocomplete-module_aiaPillReveal_wf05b"};var Ue=require("@magicx-eng/ai-autocomplete-vanilla"),Z=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
197
197
  * Built-in appearance defaults \u2014 zero specificity via :where().
198
198
  * Consumer CSS always wins without !important.
199
199
  *
@@ -780,7 +780,7 @@
780
780
  opacity: 0.25;
781
781
  }
782
782
  }
783
- `,document.head.appendChild(e)}var me={dropdown:"AIAutocompleteDropdown-module_dropdown_yz2KC",visible:"AIAutocompleteDropdown-module_visible_QCoXj",scrollArrow:"AIAutocompleteDropdown-module_scrollArrow_uUzV0",pillBar:"AIAutocompleteDropdown-module_pillBar_pwTXe",pillScroll:"AIAutocompleteDropdown-module_pillScroll_Tpzus",skip:"AIAutocompleteDropdown-module_skip_7-olS",skeletonBars:"AIAutocompleteDropdown-module_skeletonBars_HVr9C",skeletonBar:"AIAutocompleteDropdown-module_skeletonBar_O3xIx",aiaSkeletonPulse:"AIAutocompleteDropdown-module_aiaSkeletonPulse_G8W7q"};var F=require("@magicx-eng/ai-autocomplete-vanilla"),st=require("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) ---
783
+ `,document.head.appendChild(e)}var be={dropdown:"AIAutocompleteDropdown-module_dropdown_yz2KC",visible:"AIAutocompleteDropdown-module_visible_QCoXj",scrollArrow:"AIAutocompleteDropdown-module_scrollArrow_uUzV0",pillBar:"AIAutocompleteDropdown-module_pillBar_pwTXe",pillScroll:"AIAutocompleteDropdown-module_pillScroll_Tpzus",skip:"AIAutocompleteDropdown-module_skip_7-olS",skeletonBars:"AIAutocompleteDropdown-module_skeletonBars_HVr9C",skeletonBar:"AIAutocompleteDropdown-module_skeletonBar_O3xIx",aiaSkeletonPulse:"AIAutocompleteDropdown-module_aiaSkeletonPulse_G8W7q"};var F=require("@magicx-eng/ai-autocomplete-vanilla"),ct=require("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) ---
784
784
 
785
785
  One of three hand-maintained copies (vanilla styles.css, this file, Angular's
786
786
  date-grid.component.css). Only the class-naming layer differs \u2014 the
@@ -936,7 +936,7 @@
936
936
  opacity: 0.8;
937
937
  background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
938
938
  }
939
- `,document.head.appendChild(e)}var E={datepicker:"DateGrid-module_datepicker_6RrTs",header:"DateGrid-module_header_z4LRk",month:"DateGrid-module_month_urB2T",nav:"DateGrid-module_nav_ap4AN",weekdays:"DateGrid-module_weekdays_3EA3q",grid:"DateGrid-module_grid_mQCgw",weekday:"DateGrid-module_weekday_3lF4B",cell:"DateGrid-module_cell_59k0y",number:"DateGrid-module_number_aoT01",day:"DateGrid-module_day_cB3u9",blank:"DateGrid-module_blank_ivgRC",past:"DateGrid-module_past_CEZsj",highlighted:"DateGrid-module_highlighted_YIdtK",today:"DateGrid-module_today_iI3ME",selected:"DateGrid-module_selected_28KDn",pressed:"DateGrid-module_pressed_bEyyN"};var B=require("react/jsx-runtime"),Ht=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function lt({options:e,activeIndex:o,listboxId:t,view:i,selectedIso:r,onSelect:a,onHighlight:s,onPreviousMonth:g,onNextMonth:b}){let v=(0,F.isoDate)(new Date);return(0,B.jsxs)("div",{className:E.datepicker,"data-aia-datepicker":"",children:[(0,B.jsxs)("div",{className:E.header,children:[(0,B.jsx)("button",{type:"button",tabIndex:-1,className:E.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:m=>m.preventDefault(),onClick:g,children:"\u2039"}),(0,B.jsx)("span",{className:E.month,"data-aia-date-month":"","aria-live":"polite",children:(0,F.monthLabel)(i)}),(0,B.jsx)("button",{type:"button",tabIndex:-1,className:E.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:m=>m.preventDefault(),onClick:b,children:"\u203A"})]}),(0,B.jsx)("div",{className:E.weekdays,"aria-hidden":"true",children:F.WEEKDAY_LABELS.map((m,y)=>(0,B.jsx)("span",{className:E.weekday,children:m},Ht[y]))}),(0,B.jsx)("div",{className:E.grid,"data-aia-date-grid":"",children:e.map((m,y)=>(0,B.jsx)(Kt,{option:m,id:`${t}-option-${y}`,index:y,isHighlighted:y===o&&m.is_tappable,isToday:(0,F.cellIso)(m)===v,isPast:(0,F.cellIso)(m)!=null&&(0,F.cellIso)(m)<v,isSelected:r!=null&&(0,F.cellIso)(m)===r,onSelect:a,onHighlight:s},(0,F.cellIso)(m)??`pad-${y}`))})]})}function Kt({option:e,id:o,index:t,isHighlighted:i,isToday:r,isPast:a,isSelected:s,onSelect:g,onHighlight:b}){let[v,m]=(0,st.useState)(!1),y=(0,F.cellDay)(e);if(y==null)return(0,B.jsx)("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${E.cell} ${E.blank}`});let I=()=>{m(!0),g(e),setTimeout(()=>m(!1),500)},w=[E.cell,E.day,a?E.past:"",i?E.highlighted:"",r?E.today:"",s?E.selected:"",v?E.pressed:""].filter(Boolean).join(" ");return(0,B.jsx)("div",{id:o,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":i,"aria-label":e.text,tabIndex:0,className:w,onClick:I,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),I())},onMouseEnter:()=>b(t),children:(0,B.jsx)("span",{className:E.number,children:y})})}var Ce=require("@magicx-eng/ai-autocomplete-vanilla"),Fe=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`@layer layout {
939
+ `,document.head.appendChild(e)}var T={datepicker:"DateGrid-module_datepicker_6RrTs",header:"DateGrid-module_header_z4LRk",month:"DateGrid-module_month_urB2T",nav:"DateGrid-module_nav_ap4AN",weekdays:"DateGrid-module_weekdays_3EA3q",grid:"DateGrid-module_grid_mQCgw",weekday:"DateGrid-module_weekday_3lF4B",cell:"DateGrid-module_cell_59k0y",number:"DateGrid-module_number_aoT01",day:"DateGrid-module_day_cB3u9",blank:"DateGrid-module_blank_ivgRC",past:"DateGrid-module_past_CEZsj",highlighted:"DateGrid-module_highlighted_YIdtK",today:"DateGrid-module_today_iI3ME",selected:"DateGrid-module_selected_28KDn",pressed:"DateGrid-module_pressed_bEyyN"};var B=require("react/jsx-runtime"),Ut=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function pt({options:e,activeIndex:i,listboxId:t,view:a,selectedIso:n,onSelect:o,onHighlight:r,onPreviousMonth:g,onNextMonth:v}){let x=(0,F.isoDate)(new Date);return(0,B.jsxs)("div",{className:T.datepicker,"data-aia-datepicker":"",children:[(0,B.jsxs)("div",{className:T.header,children:[(0,B.jsx)("button",{type:"button",tabIndex:-1,className:T.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:m=>m.preventDefault(),onClick:g,children:"\u2039"}),(0,B.jsx)("span",{className:T.month,"data-aia-date-month":"","aria-live":"polite",children:(0,F.monthLabel)(a)}),(0,B.jsx)("button",{type:"button",tabIndex:-1,className:T.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:m=>m.preventDefault(),onClick:v,children:"\u203A"})]}),(0,B.jsx)("div",{className:T.weekdays,"aria-hidden":"true",children:F.WEEKDAY_LABELS.map((m,w)=>(0,B.jsx)("span",{className:T.weekday,children:m},Ut[w]))}),(0,B.jsx)("div",{className:T.grid,"data-aia-date-grid":"",children:e.map((m,w)=>(0,B.jsx)(qt,{option:m,id:`${t}-option-${w}`,index:w,isHighlighted:w===i&&m.is_tappable,isToday:(0,F.cellIso)(m)===x,isPast:(0,F.cellIso)(m)!=null&&(0,F.cellIso)(m)<x,isSelected:n!=null&&(0,F.cellIso)(m)===n,onSelect:o,onHighlight:r},(0,F.cellIso)(m)??`pad-${w}`))})]})}function qt({option:e,id:i,index:t,isHighlighted:a,isToday:n,isPast:o,isSelected:r,onSelect:g,onHighlight:v}){let[x,m]=(0,ct.useState)(!1),w=(0,F.cellDay)(e);if(w==null)return(0,B.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${T.cell} ${T.blank}`});let I=()=>{m(!0),g(e),setTimeout(()=>m(!1),500)},y=[T.cell,T.day,o?T.past:"",a?T.highlighted:"",n?T.today:"",r?T.selected:"",x?T.pressed:""].filter(Boolean).join(" ");return(0,B.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":a,"aria-label":e.text,tabIndex:0,className:y,onClick:I,onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),I())},onMouseEnter:()=>v(t),children:(0,B.jsx)("span",{className:T.number,children:w})})}var Ce=require("@magicx-eng/ai-autocomplete-vanilla"),He=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`@layer layout {
940
940
  .aia-cluster {
941
941
  display: flex;
942
942
  flex-wrap: wrap;
@@ -978,7 +978,7 @@
978
978
  justify-content: space-around;
979
979
  }
980
980
  }
981
- `,document.head.appendChild(e)}var Xe=require("react/jsx-runtime");function Le({gap:e,align:o="center",justify:t="start",noWrap:i=!1,inline:r=!1,className:a,children:s,...g}){let b=e?{"--aia-cluster-gap":e}:void 0,v={className:a?`aia-cluster ${a}`:"aia-cluster","data-align":o,"data-justify":t,"data-nowrap":i||void 0,"data-inline":r||void 0,style:b,...g};return r?(0,Xe.jsx)("span",{...v,children:s}):(0,Xe.jsx)("div",{...v,children:s})}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
981
+ `,document.head.appendChild(e)}var et=require("react/jsx-runtime");function Me({gap:e,align:i="center",justify:t="start",noWrap:a=!1,inline:n=!1,className:o,children:r,...g}){let v=e?{"--aia-cluster-gap":e}:void 0,x={className:o?`aia-cluster ${o}`:"aia-cluster","data-align":i,"data-justify":t,"data-nowrap":a||void 0,"data-inline":n||void 0,style:v,...g};return n?(0,et.jsx)("span",{...x,children:r}):(0,et.jsx)("div",{...x,children:r})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
982
982
  dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
983
983
  room above the hint/branding row so the footer doesn't butt against the last
984
984
  option row \u2014 additive to the dropdown's 8px section gap. */
@@ -1112,7 +1112,7 @@
1112
1112
  justify-content: flex-end;
1113
1113
  }
1114
1114
  }
1115
- `,document.head.appendChild(e)}var he={footer:"DropdownFooter-module_footer_qQQ7x",hintGroup:"DropdownFooter-module_hintGroup_ZzbPf",brandLink:"DropdownFooter-module_brandLink_r4f3R",key:"DropdownFooter-module_key_Bz1H-",hint:"DropdownFooter-module_hint_GKEOH",brand:"DropdownFooter-module_brand_Al-lR",badge:"DropdownFooter-module_badge_Fk9vg",row:"DropdownFooter-module_row_BgZ6Q"};var ne=require("react/jsx-runtime");function dt({isOptionHighlighted:e=!1,isInputEmpty:o=!1}){let{key:t,hint:i}=(0,Ce.getFooterHint)(e,o),[r,a]=(0,Fe.useState)(Ce.ATTRIBUTION_URL);return(0,Fe.useEffect)(()=>{a((0,Ce.buildAttributionUrl)())},[]),(0,ne.jsx)("footer",{className:he.footer,"data-aia-footer":"",children:(0,ne.jsxs)(Le,{justify:"between",noWrap:!0,className:he.row,children:[(0,ne.jsxs)(Le,{gap:"5px",className:he.hintGroup,children:[(0,ne.jsx)("kbd",{className:he.key,children:t}),(0,ne.jsx)("span",{className:he.hint,children:i})]}),(0,ne.jsxs)("a",{className:he.brandLink,href:r,target:"_blank",rel:"noopener noreferrer",children:[(0,ne.jsx)("span",{className:he.brand,children:"AI"}),(0,ne.jsx)("span",{className:he.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,
1115
+ `,document.head.appendChild(e)}var ve={footer:"DropdownFooter-module_footer_qQQ7x",hintGroup:"DropdownFooter-module_hintGroup_ZzbPf",brandLink:"DropdownFooter-module_brandLink_r4f3R",key:"DropdownFooter-module_key_Bz1H-",hint:"DropdownFooter-module_hint_GKEOH",brand:"DropdownFooter-module_brand_Al-lR",badge:"DropdownFooter-module_badge_Fk9vg",row:"DropdownFooter-module_row_BgZ6Q"};var oe=require("react/jsx-runtime");function ut({isOptionHighlighted:e=!1,isInputEmpty:i=!1}){let{key:t,hint:a}=(0,Ce.getFooterHint)(e,i),[n,o]=(0,He.useState)(Ce.ATTRIBUTION_URL);return(0,He.useEffect)(()=>{o((0,Ce.buildAttributionUrl)())},[]),(0,oe.jsx)("footer",{className:ve.footer,"data-aia-footer":"",children:(0,oe.jsxs)(Me,{justify:"between",noWrap:!0,className:ve.row,children:[(0,oe.jsxs)(Me,{gap:"5px",className:ve.hintGroup,children:[(0,oe.jsx)("kbd",{className:ve.key,children:t}),(0,oe.jsx)("span",{className:ve.hint,children:a})]}),(0,oe.jsxs)("a",{className:ve.brandLink,href:n,target:"_blank",rel:"noopener noreferrer",children:[(0,oe.jsx)("span",{className:ve.brand,children:"AI"}),(0,oe.jsx)("span",{className:ve.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,
1116
1116
  no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
1117
1117
  The border is kept as a 1px transparent line so the box stays the same size
1118
1118
  as it was when the outline was dashed. */
@@ -1169,7 +1169,7 @@
1169
1169
  opacity: 0;
1170
1170
  }
1171
1171
  }
1172
- `,document.head.appendChild(e)}var _e={pill:"ParamPill-module_pill_6Ga7S",fadeIn:"ParamPill-module_fadeIn_Ux4eQ",rounded:"ParamPill-module_rounded_y7xA9",skeleton:"ParamPill-module_skeleton_57P0T",skeletonPulse:"ParamPill-module_skeletonPulse_xGcUy"};var pt=require("react/jsx-runtime"),Ze={selected:1,first:.7,next:.4,last:.2};function ct({label:e,state:o,rounded:t,loading:i,onClick:r}){let a=[_e.pill,t?_e.rounded:"",i?_e.skeleton:""].filter(Boolean).join(" ");return(0,pt.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":i?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:a,style:{opacity:Ze[o]},onMouseDown:s=>s.preventDefault(),onClick:i?void 0:r,disabled:i,children:e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.PillList-module_list_qvLqO {
1172
+ `,document.head.appendChild(e)}var ye={pill:"ParamPill-module_pill_6Ga7S",fadeIn:"ParamPill-module_fadeIn_Ux4eQ",rounded:"ParamPill-module_rounded_y7xA9",skeleton:"ParamPill-module_skeleton_57P0T",skeletonPulse:"ParamPill-module_skeletonPulse_xGcUy"};var ht=require("react/jsx-runtime"),tt={selected:1,first:.7,next:.4,last:.2};function mt({label:e,state:i,rounded:t,loading:a,onClick:n}){let o=[ye.pill,t?ye.rounded:"",a?ye.skeleton:""].filter(Boolean).join(" ");return(0,ht.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":a?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:o,style:{opacity:tt[i]},onMouseDown:r=>r.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 {
1173
1173
  position: relative;
1174
1174
  z-index: 1;
1175
1175
  pointer-events: auto;
@@ -1179,7 +1179,7 @@
1179
1179
  align-items: center;
1180
1180
  vertical-align: middle;
1181
1181
  }
1182
- `,document.head.appendChild(e)}var Je={list:"PillList-module_list_qvLqO"};var Me=require("react/jsx-runtime"),Wt=[125,69];function ut(e){return e===0?"first":e===1?"next":"last"}function Ge({pills:e,activePillIndex:o,onSelectPill:t,activeSelected:i,rounded:r,loading:a}){return a&&e.length===0?(0,Me.jsx)("span",{className:Je.list,"data-aia-pill-list-loading":"",children:Wt.map((s,g)=>(0,Me.jsx)("span",{"data-aia-pill-skeleton":"",className:`${_e.pill} ${r?_e.rounded:""} ${_e.skeleton}`,style:{width:s,opacity:Ze[ut(g)]}},`skel-${s}`))}):(0,Me.jsx)("span",{className:Je.list,"data-aia-pill-list-loading":a?"":void 0,children:e.map((s,g)=>{let b=!!i&&g===o;return(0,Me.jsx)(ct,{label:s.text,state:b?"selected":ut(g),selected:b,rounded:r,loading:a,onClick:()=>t(g)},`${s.type}-${s.text}`)})})}if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
1182
+ `,document.head.appendChild(e)}var at={list:"PillList-module_list_qvLqO"};var Ne=require("react/jsx-runtime"),$t=[125,69];function ft(e){return e===0?"first":e===1?"next":"last"}function Ke({pills:e,activePillIndex:i,onSelectPill:t,activeSelected:a,rounded:n,loading:o}){return o&&e.length===0?(0,Ne.jsx)("span",{className:at.list,"data-aia-pill-list-loading":"",children:$t.map((r,g)=>(0,Ne.jsx)("span",{"data-aia-pill-skeleton":"",className:`${ye.pill} ${n?ye.rounded:""} ${ye.skeleton}`,style:{width:r,opacity:tt[ft(g)]}},`skel-${r}`))}):(0,Ne.jsx)("span",{className:at.list,"data-aia-pill-list-loading":o?"":void 0,children:e.map((r,g)=>{let v=!!a&&g===i;return(0,Ne.jsx)(mt,{label:r.text,state:v?"selected":ft(g),selected:v,rounded:n,loading:o,onClick:()=>t(g)},`${r.type}-${r.text}`)})})}if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
1183
1183
  (packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
1184
1184
  theming one package sees the same result in the other.
1185
1185
 
@@ -1346,7 +1346,7 @@
1346
1346
  var(--aia-option-color-selected, var(--aia-color-text-default, #fff))
1347
1347
  );
1348
1348
  }
1349
- `,document.head.appendChild(e)}var X={section:"ProductStrip-module_section_Hugfg",label:"ProductStrip-module_label_nuc93",row:"ProductStrip-module_row_WDVBX",card:"ProductStrip-module_card_JBGYT",media:"ProductStrip-module_media_RrbGe",image:"ProductStrip-module_image_5pNL7",body:"ProductStrip-module_body_ly032",vendor:"ProductStrip-module_vendor_Gvu7G",title:"ProductStrip-module_title_gCNmq",price:"ProductStrip-module_price_gULcE"};var K=require("react/jsx-runtime");function mt({products:e,listboxId:o,onSelect:t,onFocusChange:i,focusable:r=!0}){if(e.length===0)return null;let a=`${o}-products-label`;return(0,K.jsxs)("section",{className:X.section,"data-aia-products":"",role:"group","aria-labelledby":a,children:[(0,K.jsx)("div",{className:X.label,id:a,children:"Products"}),(0,K.jsx)("div",{className:X.row,"data-aia-products-row":"",children:e.map((s,g)=>(0,K.jsx)(Ut,{product:s,id:`${o}-product-${g}`,onSelect:t,onFocusChange:i,focusable:r},s.id))})]})}function Ut({product:e,id:o,onSelect:t,onFocusChange:i,focusable:r}){let a=s=>{s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.button!==0||(s.preventDefault(),t(e))};return(0,K.jsxs)("a",{id:o,className:X.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:r?0:-1,onClick:a,onKeyDown:s=>{s.key!=="Enter"&&s.key!==" "||(s.preventDefault(),t(e))},onFocus:()=>i?.(!0),onBlur:s=>{s.relatedTarget?.closest("[data-aia-dropdown]")||i?.(!1)},children:[(0,K.jsx)("span",{className:X.media,"data-aia-product-placeholder":e.imageUrl?void 0:"",children:e.imageUrl?(0,K.jsx)("img",{className:X.image,src:e.imageUrl,alt:"",loading:"lazy",decoding:"async"}):null}),(0,K.jsxs)("span",{className:X.body,children:[e.vendor?(0,K.jsx)("span",{className:X.vendor,children:e.vendor}):null,(0,K.jsx)("span",{className:X.title,children:e.title}),e.price?(0,K.jsx)("span",{className:X.price,children:e.price}):null]})]})}var W=require("@magicx-eng/ai-autocomplete-vanilla"),fe=require("react");var ht=require("@magicx-eng/ai-autocomplete-vanilla"),He=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 {
1349
+ `,document.head.appendChild(e)}var X={section:"ProductStrip-module_section_Hugfg",label:"ProductStrip-module_label_nuc93",row:"ProductStrip-module_row_WDVBX",card:"ProductStrip-module_card_JBGYT",media:"ProductStrip-module_media_RrbGe",image:"ProductStrip-module_image_5pNL7",body:"ProductStrip-module_body_ly032",vendor:"ProductStrip-module_vendor_Gvu7G",title:"ProductStrip-module_title_gCNmq",price:"ProductStrip-module_price_gULcE"};var K=require("react/jsx-runtime");function gt({products:e,listboxId:i,onSelect:t,onFocusChange:a,focusable:n=!0}){if(e.length===0)return null;let o=`${i}-products-label`;return(0,K.jsxs)("section",{className:X.section,"data-aia-products":"",role:"group","aria-labelledby":o,children:[(0,K.jsx)("div",{className:X.label,id:o,children:"Products"}),(0,K.jsx)("div",{className:X.row,"data-aia-products-row":"",children:e.map((r,g)=>(0,K.jsx)(jt,{product:r,id:`${i}-product-${g}`,onSelect:t,onFocusChange:a,focusable:n},r.id))})]})}function jt({product:e,id:i,onSelect:t,onFocusChange:a,focusable:n}){let o=r=>{r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.button!==0||(r.preventDefault(),t(e))};return(0,K.jsxs)("a",{id:i,className:X.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:n?0:-1,onClick:o,onKeyDown:r=>{r.key!=="Enter"&&r.key!==" "||(r.preventDefault(),t(e))},onFocus:()=>a?.(!0),onBlur:r=>{r.relatedTarget?.closest("[data-aia-dropdown]")||a?.(!1)},children:[(0,K.jsx)("span",{className:X.media,"data-aia-product-placeholder":e.imageUrl?void 0:"",children:e.imageUrl?(0,K.jsx)("img",{className:X.image,src:e.imageUrl,alt:"",loading:"lazy",decoding:"async"}):null}),(0,K.jsxs)("span",{className:X.body,children:[e.vendor?(0,K.jsx)("span",{className:X.vendor,children:e.vendor}):null,(0,K.jsx)("span",{className:X.title,children:e.title}),e.price?(0,K.jsx)("span",{className:X.price,children:e.price}):null]})]})}var W=require("@magicx-eng/ai-autocomplete-vanilla"),we=require("react");var bt=require("@magicx-eng/ai-autocomplete-vanilla"),We=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 {
1350
1350
  .aia-grid {
1351
1351
  display: grid;
1352
1352
  grid-template-columns: repeat(
@@ -1381,7 +1381,7 @@
1381
1381
  border-radius: 3px;
1382
1382
  }
1383
1383
  }
1384
- `,document.head.appendChild(e)}var gt=require("react/jsx-runtime");function ft({min:e="16rem",max:o,gap:t,scroll:i=!1,maxHeight:r,scrollResetKey:a,cols:s,template:g,innerRef:b,className:v,children:m,...y}){let I=(0,He.useRef)(null);(0,He.useLayoutEffect)(()=>{if(a===void 0)return;let f=I.current;f&&(f.scrollTop=0)},[a]);let w={"--aia-grid-min":e};return o&&(w["--aia-grid-max"]=o),t&&(w["--aia-grid-gap"]=t),r&&(w["--aia-grid-max-height"]=r),s&&(w.gridTemplateColumns=(0,ht.optionsGridTemplateColumns)(s)),g&&(w.gridTemplateColumns=g),(0,gt.jsx)("div",{ref:f=>{I.current=f,b?.(f)},className:v?`aia-grid ${v}`:"aia-grid","data-scroll":i||void 0,style:w,...y,children:m})}var bt=require("@magicx-eng/ai-autocomplete-vanilla"),Ie=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 {
1384
+ `,document.head.appendChild(e)}var wt=require("react/jsx-runtime");function vt({min:e="16rem",max:i,gap:t,scroll:a=!1,maxHeight:n,scrollResetKey:o,cols:r,template:g,innerRef:v,className:x,children:m,...w}){let I=(0,We.useRef)(null);(0,We.useLayoutEffect)(()=>{if(o===void 0)return;let b=I.current;b&&(b.scrollTop=0)},[o]);let y={"--aia-grid-min":e};return i&&(y["--aia-grid-max"]=i),t&&(y["--aia-grid-gap"]=t),n&&(y["--aia-grid-max-height"]=n),r&&(y.gridTemplateColumns=(0,bt.optionsGridTemplateColumns)(r)),g&&(y.gridTemplateColumns=g),(0,wt.jsx)("div",{ref:b=>{I.current=b,v?.(b)},className:x?`aia-grid ${x}`:"aia-grid","data-scroll":a||void 0,style:y,...w,children:m})}var xt=require("@magicx-eng/ai-autocomplete-vanilla"),Ie=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 {
1385
1385
  position: relative;
1386
1386
  overflow: visible;
1387
1387
  display: flex;
@@ -1528,7 +1528,7 @@
1528
1528
  filter: brightness(0.55);
1529
1529
  }
1530
1530
  }
1531
- `,document.head.appendChild(e)}var re={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",riseIn:"SuggestionItem-module_riseIn_etXZT",content:"SuggestionItem-module_content_T-Qba",tappable:"SuggestionItem-module_tappable_70KcX",nonTappable:"SuggestionItem-module_nonTappable_xSZM-",highlighted:"SuggestionItem-module_highlighted_Hb0SU",tag:"SuggestionItem-module_tag_e3Fwe",pressed:"SuggestionItem-module_pressed_98o-r",pressCompress:"SuggestionItem-module_pressCompress_ICV3q",scrollHint:"SuggestionItem-module_scrollHint_xKXPt",skeletonPulse:"SuggestionItem-module_skeletonPulse_plvdD",text:"SuggestionItem-module_text_yqoh9"};var De=require("react/jsx-runtime");function vt({option:e,isHighlighted:o,onSelect:t,onHighlight:i,id:r,loading:a,scrollHint:s,enterDelayMs:g=0}){let[b]=(0,Ie.useState)(g),[v,m]=(0,Ie.useState)(!1),y=(0,Ie.useRef)(void 0);(0,Ie.useEffect)(()=>()=>clearTimeout(y.current),[]);let I=()=>{a||!e.is_tappable||v||(m(!0),t(e),clearTimeout(y.current),y.current=setTimeout(()=>m(!1),500))},w=[re.item,o&&!a?re.highlighted:"",e.is_tappable?re.tappable:re.nonTappable,v?re.pressed:"",s?re.scrollHint:""].filter(Boolean).join(" ");return(0,De.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":a?"":void 0,"aria-selected":o,className:w,style:{[bt.OPTION_ENTER_DELAY_VAR]:`${b}ms`},tabIndex:a||!e.is_tappable?-1:0,onClick:I,onKeyDown:f=>{!a&&e.is_tappable&&(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),I())},onMouseEnter:!a&&e.is_tappable?i:void 0,children:(0,De.jsxs)("span",{className:re.content,children:[(0,De.jsx)("span",{className:re.text,children:e.icon?`${e.icon} ${e.text}`:e.text}),e.tag&&(0,De.jsx)("span",{className:re.tag,children:e.tag})]})})}var et=require("react/jsx-runtime");function qt(){let[e,o]=(0,fe.useState)(W.isOptionsGridMobileViewport);return(0,fe.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(W.OPTIONS_GRID_MOBILE_QUERY),i=()=>o(t.matches);return i(),t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function wt({options:e,activeIndex:o,onSelect:t,onHighlight:i,listboxId:r,loading:a,groupKey:s="",optionsPosition:g="below"}){let b=qt(),v=(0,fe.useRef)(null),[m,y]=(0,fe.useState)(null);(0,fe.useLayoutEffect)(()=>{let w=v.current,L=w&&!a&&(0,W.needsOptionsGridMeasurement)(e.length,b)?(0,W.measureOptionsGrid)(w):null;y(L?(0,W.planOptionsGrid)(e.length,b,L.rowWidths,L.gridWidth):null)},[e,b,a]);let I=m??(0,W.planOptionsGrid)(e.length,b,null,null);return(0,et.jsx)(ft,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:s,template:I.template,maxHeight:I.maxHeight,innerRef:w=>{v.current=w},"data-aia-group":s,children:e.map((w,f)=>(0,et.jsx)(vt,{option:w,isHighlighted:f===o,onSelect:t,onHighlight:()=>i(f),id:`${r}-option-${f}`,loading:a,scrollHint:!a&&I.scrollHintIndices.includes(f),enterDelayMs:a?0:(0,W.optionEnterDelayMs)(f,I.cols,e.length,g)},`${s}\0${w.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`@layer layout {
1531
+ `,document.head.appendChild(e)}var ie={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",riseIn:"SuggestionItem-module_riseIn_etXZT",content:"SuggestionItem-module_content_T-Qba",tappable:"SuggestionItem-module_tappable_70KcX",nonTappable:"SuggestionItem-module_nonTappable_xSZM-",highlighted:"SuggestionItem-module_highlighted_Hb0SU",tag:"SuggestionItem-module_tag_e3Fwe",pressed:"SuggestionItem-module_pressed_98o-r",pressCompress:"SuggestionItem-module_pressCompress_ICV3q",scrollHint:"SuggestionItem-module_scrollHint_xKXPt",skeletonPulse:"SuggestionItem-module_skeletonPulse_plvdD",text:"SuggestionItem-module_text_yqoh9"};var De=require("react/jsx-runtime");function yt({option:e,isHighlighted:i,onSelect:t,onHighlight:a,id:n,loading:o,scrollHint:r,enterDelayMs:g=0}){let[v]=(0,Ie.useState)(g),[x,m]=(0,Ie.useState)(!1),w=(0,Ie.useRef)(void 0);(0,Ie.useEffect)(()=>()=>clearTimeout(w.current),[]);let I=()=>{o||!e.is_tappable||x||(m(!0),t(e),clearTimeout(w.current),w.current=setTimeout(()=>m(!1),500))},y=[ie.item,i&&!o?ie.highlighted:"",e.is_tappable?ie.tappable:ie.nonTappable,x?ie.pressed:"",r?ie.scrollHint:""].filter(Boolean).join(" ");return(0,De.jsx)("div",{id:n,role:"option","data-aia-option":"","data-aia-loading":o?"":void 0,"aria-selected":i,className:y,style:{[xt.OPTION_ENTER_DELAY_VAR]:`${v}ms`},tabIndex:o||!e.is_tappable?-1:0,onClick:I,onKeyDown:b=>{!o&&e.is_tappable&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),I())},onMouseEnter:!o&&e.is_tappable?a:void 0,children:(0,De.jsxs)("span",{className:ie.content,children:[(0,De.jsx)("span",{className:ie.text,children:e.icon?`${e.icon} ${e.text}`:e.text}),e.tag&&(0,De.jsx)("span",{className:ie.tag,children:e.tag})]})})}var ot=require("react/jsx-runtime");function Vt(){let[e,i]=(0,we.useState)(W.isOptionsGridMobileViewport);return(0,we.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(W.OPTIONS_GRID_MOBILE_QUERY),a=()=>i(t.matches);return a(),t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[]),e}function _t({options:e,activeIndex:i,onSelect:t,onHighlight:a,listboxId:n,loading:o,groupKey:r="",optionsPosition:g="below"}){let v=Vt(),x=(0,we.useRef)(null),[m,w]=(0,we.useState)(null);(0,we.useLayoutEffect)(()=>{let y=x.current,L=y&&!o&&(0,W.needsOptionsGridMeasurement)(e.length,v)?(0,W.measureOptionsGrid)(y):null;w(L?(0,W.planOptionsGrid)(e.length,v,L.rowWidths,L.gridWidth):null)},[e,v,o]);let I=m??(0,W.planOptionsGrid)(e.length,v,null,null);return(0,ot.jsx)(vt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:r,template:I.template,maxHeight:I.maxHeight,innerRef:y=>{x.current=y},"data-aia-group":r,children:e.map((y,b)=>(0,ot.jsx)(yt,{option:y,isHighlighted:b===i,onSelect:t,onHighlight:()=>a(b),id:`${n}-option-${b}`,loading:o,scrollHint:!o&&I.scrollHintIndices.includes(b),enterDelayMs:o?0:(0,W.optionEnterDelayMs)(b,I.cols,e.length,g)},`${r}\0${y.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`@layer layout {
1532
1532
  .aia-stack {
1533
1533
  display: flex;
1534
1534
  flex-direction: column;
@@ -1545,7 +1545,7 @@
1545
1545
  }
1546
1546
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
1547
1547
  }
1548
- `,document.head.appendChild(e)}var yt=require("react/jsx-runtime");function xt({space:e,align:o="stretch",className:t,children:i,...r}){let a=e?{"--aia-stack-space":e}:void 0;return(0,yt.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":o,style:a,...r,children:i})}var M=require("react/jsx-runtime"),$t=[159,119,164],jt=()=>{},_t=()=>{};function Vt(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,i]=(0,Z.useState)(o);if((0,Z.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let r=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>i(r.matches);return r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Yt(e,o){let t=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let i=e.current,r=o.current;if(!i||!r)return;let a=i.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==a&&(t.current.controller.destroy(),t.current=null),a&&!t.current){t.current={grid:a,controller:(0,Ke.attachScrollArrow)({dropdown:i,grid:a,button:r})};return}t.current?.controller.update()}),(0,Z.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function We({suggestions:e,activeIndex:o,onSelect:t,onHighlight:i,isOpen:r,id:a,className:s,pills:g,onPillClick:b,showPills:v=!0,onSkip:m,showSkipButton:y=!0,skipDisabled:I=!1,activeSelected:w=!1,isLoading:f=!1,isInputEmpty:L=!1,products:$,onProductSelect:se,onProductFocusChange:ge,formatType:G="options",dateView:S=null,selectedDateIso:ee=null,onPreviousMonth:h,onNextMonth:be,optionsPosition:te="below",mode:le}){let N=Vt(le),ve=N!==void 0,ae=(0,Z.useRef)(null),oe=(0,Z.useRef)(null);Yt(ae,oe);let de=e[0]?.options??[],H=!!(g&&g.length>0&&b),ce=!!($&&$.length>0),q=r&&(de.length>0||v&&H||f||ce),j={suggestions:e,activeIndex:o,pills:g,showPills:v,showSkipButton:y,skipDisabled:I,activeSelected:w,isLoading:f,isInputEmpty:L,products:$,formatType:G,dateView:S,selectedDateIso:ee},V=(0,Z.useRef)(j);q&&(V.current=j);let p=q?j:V.current,Y=p.suggestions[0],l=Y?.options??[],u=p.activeIndex>=0&&!!l[p.activeIndex]?.is_tappable,n=!!(p.pills&&p.pills.length>0&&b),k=p.showPills&&n,_=p.showPills&&!n&&p.isLoading,D=k||_,d=n&&p.showSkipButton&&!p.isInputEmpty&&!!m,Q=p.pills?.[0]?.text,ie=p.formatType==="date"&&p.dateView!=null,pe=l.length>0&&!ie,ke=l.length>0&&ie,we=p.isLoading&&!pe&&!ke,Ae=p.products??[];return(0,M.jsxs)("div",{ref:ae,id:a,role:"listbox","data-aia-dropdown":"","data-options-position":te,"data-mode":N,"data-aia-loading":p.isLoading?"":void 0,"data-aia-has-products":Ae.length>0?"":void 0,className:`${ve?"magicx-aia ":""}${me.dropdown} ${q?me.visible:""} ${s??""}`,onMouseDown:O=>O.preventDefault(),children:[(0,M.jsxs)(xt,{space:"8px",children:[(D||d)&&(0,M.jsxs)(Le,{noWrap:!0,className:me.pillBar,"data-aia-pillbar":"",children:[D&&(0,M.jsx)("span",{className:me.pillScroll,"data-aia-pill-scroll":"",children:(0,M.jsx)(Ge,{pills:p.pills??[],activePillIndex:0,activeSelected:p.activeSelected,onSelectPill:b??(()=>{}),rounded:!0,loading:p.isLoading})}),d&&(0,M.jsx)("button",{type:"button",tabIndex:-1,className:me.skip,"data-aia-skip":"",disabled:p.isLoading||p.skipDisabled,"aria-label":Q?`Skip ${Q}`:"Skip",onClick:m,children:"skip"})]}),pe&&(0,M.jsx)(wt,{options:l,activeIndex:p.activeIndex,onSelect:t,onHighlight:i,listboxId:a,loading:p.isLoading,groupKey:Y?`${Y.type} ${Y.text}`:"",optionsPosition:te}),ke&&p.dateView&&(0,M.jsx)(lt,{options:l,activeIndex:p.activeIndex,listboxId:a,view:p.dateView,selectedIso:p.selectedDateIso??null,onSelect:t,onHighlight:i,onPreviousMonth:h??_t,onNextMonth:be??_t}),we&&(0,M.jsx)("div",{className:me.skeletonBars,"data-aia-skeleton-bars":"",children:$t.map(O=>(0,M.jsx)("span",{className:me.skeletonBar,style:{width:O}},`bar-${O}`))}),(0,M.jsx)(mt,{products:Ae,listboxId:a,onSelect:se??jt,onFocusChange:ge,focusable:q}),(0,M.jsx)(dt,{isOptionHighlighted:u,isInputEmpty:p.isInputEmpty})]}),(0,M.jsx)("button",{ref:oe,type:"button",tabIndex:-1,className:me.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Ke.SCROLL_ARROW_LABEL,"aria-hidden":"true",children:(0,M.jsx)("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,M.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Te=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 {
1548
+ `,document.head.appendChild(e)}var Pt=require("react/jsx-runtime");function kt({space:e,align:i="stretch",className:t,children:a,...n}){let o=e?{"--aia-stack-space":e}:void 0;return(0,Pt.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":i,style:o,...n,children:a})}var M=require("react/jsx-runtime"),Yt=[159,119,164],Qt=()=>{},It=()=>{};function Xt(e){let i=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,a]=(0,Z.useState)(i);if((0,Z.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>a(n.matches);return n.addEventListener("change",o),()=>n.removeEventListener("change",o)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Zt(e,i){let t=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let a=e.current,n=i.current;if(!a||!n)return;let o=a.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==o&&(t.current.controller.destroy(),t.current=null),o&&!t.current){t.current={grid:o,controller:(0,Ue.attachScrollArrow)({dropdown:a,grid:o,button:n})};return}t.current?.controller.update()}),(0,Z.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function qe({suggestions:e,activeIndex:i,onSelect:t,onHighlight:a,isOpen:n,id:o,className:r,pills:g,onPillClick:v,showPills:x=!0,onSkip:m,showSkipButton:w=!0,skipDisabled:I=!1,activeSelected:y=!1,isLoading:b=!1,isInputEmpty:L=!1,products:N,onProductSelect:ne,onProductFocusChange:re,formatType:q="options",dateView:A=null,selectedDateIso:se=null,onPreviousMonth:le,onNextMonth:p,optionsPosition:de="below",mode:ce}){let O=Xt(ce),ee=O!==void 0,pe=(0,Z.useRef)(null),te=(0,Z.useRef)(null);Zt(pe,te);let ue=e[0]?.options??[],me=!!(g&&g.length>0&&v),G=!!(N&&N.length>0),$=n&&(ue.length>0||x&&me||b||G),ae={suggestions:e,activeIndex:i,pills:g,showPills:x,showSkipButton:w,skipDisabled:I,activeSelected:y,isLoading:b,isInputEmpty:L,products:N,formatType:q,dateView:A,selectedDateIso:se},j=(0,Z.useRef)(ae);$&&(j.current=ae);let h=$?ae:j.current,H=h.suggestions[0],l=H?.options??[],u=h.activeIndex>=0&&!!l[h.activeIndex]?.is_tappable,f=!!(h.pills&&h.pills.length>0&&v),_=h.showPills&&f,s=h.showPills&&!f&&h.isLoading,E=_||s,Q=f&&h.showSkipButton&&!h.isInputEmpty&&!!m,V=h.pills?.[0]?.text,d=h.formatType==="date"&&h.dateView!=null,_e=l.length>0&&!d,Ae=l.length>0&&d,he=h.isLoading&&!_e&&!Ae,ke=h.products??[];return(0,M.jsxs)("div",{ref:pe,id:o,role:"listbox","data-aia-dropdown":"","data-options-position":de,"data-mode":O,"data-aia-loading":h.isLoading?"":void 0,"data-aia-has-products":ke.length>0?"":void 0,className:`${ee?"magicx-aia ":""}${be.dropdown} ${$?be.visible:""} ${r??""}`,onMouseDown:Y=>Y.preventDefault(),children:[(0,M.jsxs)(kt,{space:"8px",children:[(E||Q)&&(0,M.jsxs)(Me,{noWrap:!0,className:be.pillBar,"data-aia-pillbar":"",children:[E&&(0,M.jsx)("span",{className:be.pillScroll,"data-aia-pill-scroll":"",children:(0,M.jsx)(Ke,{pills:h.pills??[],activePillIndex:0,activeSelected:h.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:h.isLoading})}),Q&&(0,M.jsx)("button",{type:"button",tabIndex:-1,className:be.skip,"data-aia-skip":"",disabled:h.isLoading||h.skipDisabled,"aria-label":V?`Skip ${V}`:"Skip",onClick:m,children:"skip"})]}),_e&&(0,M.jsx)(_t,{options:l,activeIndex:h.activeIndex,onSelect:t,onHighlight:a,listboxId:o,loading:h.isLoading,groupKey:H?`${H.type} ${H.text}`:"",optionsPosition:de}),Ae&&h.dateView&&(0,M.jsx)(pt,{options:l,activeIndex:h.activeIndex,listboxId:o,view:h.dateView,selectedIso:h.selectedDateIso??null,onSelect:t,onHighlight:a,onPreviousMonth:le??It,onNextMonth:p??It}),he&&(0,M.jsx)("div",{className:be.skeletonBars,"data-aia-skeleton-bars":"",children:Yt.map(Y=>(0,M.jsx)("span",{className:be.skeletonBar,style:{width:Y}},`bar-${Y}`))}),(0,M.jsx)(gt,{products:ke,listboxId:o,onSelect:ne??Qt,onFocusChange:re,focusable:$}),(0,M.jsx)(ut,{isOptionHighlighted:u,isInputEmpty:h.isInputEmpty})]}),(0,M.jsx)("button",{ref:te,type:"button",tabIndex:-1,className:be.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Ue.SCROLL_ARROW_LABEL,"aria-hidden":"true",children:(0,M.jsx)("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,M.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Te=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 {
1549
1549
  flex-shrink: 0;
1550
1550
  width: 32px;
1551
1551
  height: 32px;
@@ -1580,5 +1580,5 @@
1580
1580
  );
1581
1581
  cursor: default;
1582
1582
  }
1583
- `,document.head.appendChild(e)}var kt={submitButton:"SubmitButton-module_submitButton_otz7H"};var Ue=require("react/jsx-runtime");function Pt({disabled:e,onClick:o}){return(0,Ue.jsx)("button",{type:"button","data-aia-submit":"",className:kt.submitButton,disabled:e,onClick:t=>{t.stopPropagation(),o()},"aria-label":"Submit",children:(0,Ue.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,Ue.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ee=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react");var tt=require("react");function It(e){let o=(0,tt.useRef)(e);o.current=e;let t=(0,tt.useRef)(null);t.current===null&&(t.current={fetch:(r,a)=>{let s=o.current;return s?s.fetch(r,a):Promise.reject(new Error("products config removed"))},transform:r=>o.current?.transform(r)??[],get limit(){return o.current?.limit}});let i=e!==void 0;return{config:i?t.current:void 0,enabled:i}}var Qt={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],activeFormatType:"options",dateView:null,placeholderText:"",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};function qe({onSubmit:e,onError:o,optionOverrides:t,maskCompletedText:i,apiConfig:r,additionalContext:a,columns:s=2,dropdownTrigger:g,optionsPosition:b,closeDropdownOnBlur:v,showNonTappableOptions:m,showSkipButton:y,onFocus:I,onBlur:w,value:f,completedParams:L,onChange:$,onParamsChange:se,products:ge,onProductSelect:G,source:S,setCursor:ee}){let h=(0,P.useRef)(null),[be,te]=(0,P.useState)(null),le=(0,P.useRef)(e);le.current=e;let N=(0,P.useRef)(o);N.current=o;let ve=(0,P.useRef)($);ve.current=$;let ae=(0,P.useRef)(se);ae.current=se;let oe=(0,P.useRef)(I);oe.current=I;let de=(0,P.useRef)(w);de.current=w;let H=(0,P.useRef)(ee);H.current=ee;let ce=(0,P.useRef)(G);ce.current=G;let q=It(ge);(0,P.useEffect)(()=>{if(typeof document>"u")return;let c=new Ee.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:a,optionOverrides:t,maskCompletedText:i,columns:s,dropdownTrigger:g,optionsPosition:b,closeDropdownOnBlur:v,showNonTappableOptions:m,source:S,value:f,completedParams:L,onSubmit:(...R)=>le.current?.(...R),onError:(...R)=>N.current?.(...R),onChange:(...R)=>ve.current?.(...R),onParamsChange:(...R)=>ae.current?.(...R),onFocus:()=>oe.current?.(),onBlur:()=>de.current?.(),onProductSelect:R=>ce.current?.(R),setCursor:R=>H.current?.(R),products:q.config});h.current=c,te(c.getState());let z=c.subscribe(R=>te(R));return()=>{z(),c.destroy(),h.current===c&&(h.current=null)}},[]),(0,P.useEffect)(()=>{f!==void 0&&h.current?.setValue(f)},[f]),(0,P.useEffect)(()=>{L!==void 0&&h.current?.setCompletedParams(L)},[L]);let j=JSON.stringify(r??null),V;try{V=JSON.stringify(a??null)}catch{V="[unstringifiable]"}let p=(0,P.useRef)(t),Y=(0,P.useRef)(0);if(t!==p.current){let c=p.current,z=t,R=Object.keys(c??{}),Se=Object.keys(z??{});(R.length!==Se.length||Se.some(xe=>!c?.[xe]||z[xe]!==c[xe]))&&Y.current++,p.current=t}(0,P.useEffect)(()=>{h.current?.update({apiConfig:r,additionalContext:a,optionOverrides:t,dropdownTrigger:g,optionsPosition:b,closeDropdownOnBlur:v,showNonTappableOptions:m})},[j,V,Y.current,g,b,v,m]);let l=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!l.current){l.current=!0;return}h.current?.update({products:q.config})},[q.enabled]);let u=(0,P.useRef)(null);u.current===null&&(u.current={handleTextChange:c=>h.current?.handleTextChange(c),handleKeyDown:c=>{let z="nativeEvent"in c?c.nativeEvent:c;h.current?.handleKeyDown(z)},setFocused:c=>h.current?.setFocused(c),startEditingParam:c=>h.current?.startEditingParam(c),exitEditMode:()=>h.current?.exitEditMode(),handleCaretAfterInput:c=>h.current?.handleCaretAfterInput(c),handleCaretMove:c=>h.current?.handleCaretMove(c),replaceEditingRange:c=>h.current?.replaceEditingRange(c)??!1,setActivePill:c=>h.current?.setActivePill(c),skipActivePill:()=>h.current?.skipActivePill(),removeLastParam:()=>h.current?.removeLastParam(),clearNewParamId:()=>h.current?.clearNewParamId(),reset:()=>h.current?.reset(),selectOption:c=>h.current?.selectOption(c),selectProduct:c=>h.current?.selectProduct(c),setActiveDropdownIndex:c=>h.current?.setActiveDropdownIndex(c),showPreviousMonth:()=>h.current?.showPreviousMonth(),showNextMonth:()=>h.current?.showNextMonth(),handleFocus:()=>h.current?.setFocused(!0),handleBlur:()=>h.current?.setFocused(!1)});let n=u.current,k=(0,P.useCallback)(c=>{let z=c.target.value,Se=z.length>0&&!c.nativeEvent?.isComposing&&z[0]!==z[0].toUpperCase()?z[0].toUpperCase()+z.slice(1):z;h.current?.handleTextChange(Se)},[]),_=(0,P.useCallback)(c=>{h.current?.handleKeyDown(c.nativeEvent)},[]),D=h.current,d=be??Qt,Q=f!==void 0?f:d.text,ie=L!==void 0?L:d.completedParams,pe=d.actionableSuggestions,ke=pe[0],we=D?.listboxId??"",Ae=d.activeDropdownIndex>=0&&D?`${we}-option-${d.activeDropdownIndex}`:void 0,O=d.editingParam,ue=d.editingIdentified,Re=O?{type:O.suggestionType,text:O.suggestionPlaceholder,required:!0,options:O.options}:ue?{type:ue.type,text:(0,Ee.identifiedParamLabel)(ue.type),required:!0,options:[]}:null,Ne=Re??ke,je=Re?[Re]:pe,ze=!D||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation;return{completedParams:ie,skippedParams:d.skippedParams,suggestionPills:pe,setActivePill:n.setActivePill,skipActivePill:n.skipActivePill,removeLastParam:n.removeLastParam,segments:d.segments,newParamId:d.newParamId,clearNewParamId:n.clearNewParamId,suggestions:d.suggestions,activeIndex:d.activeDropdownIndex,isReady:d.isReady,isLoading:ze,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:we,error:d.error,products:d.products,selectProduct:n.selectProduct,handleTextChange:n.handleTextChange,handleKeyDown:n.handleKeyDown,setFocused:n.setFocused,editingParam:O,editingIdentified:ue,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:n.startEditingParam,exitEditMode:n.exitEditMode,handleCaretAfterInput:n.handleCaretAfterInput,handleCaretMove:n.handleCaretMove,replaceEditingRange:n.replaceEditingRange,inputProps:{value:Q,placeholder:d.placeholderText||void 0,onChange:k,onKeyDown:_,onFocus:n.handleFocus,onBlur:n.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":Ae,"aria-autocomplete":"list","aria-controls":we},reset:n.reset,dropdownProps:{suggestions:Ne?[{...Ne,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:n.selectOption,onHighlight:n.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:we,pills:je,activeSelected:d.isActivePillSelected,onPillClick:n.setActivePill,onSkip:n.skipActivePill,showSkipButton:(y??!0)&&!O&&!ue,skipDisabled:d.inSelectionAnimation,isLoading:ze,isInputEmpty:Q.trim().length===0,products:d.products,onProductSelect:n.selectProduct,onProductFocusChange:n.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:ue?ue.iso:(0,Ee.selectedIsoFromText)(O?.text),onPreviousMonth:n.showPreviousMonth,onNextMonth:n.showNextMonth,optionsPosition:b??"below"}}}var U=require("@magicx-eng/ai-autocomplete-vanilla"),x=require("react"),$e;function Xt(){if($e!==void 0)return $e;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),$e=e.contentEditable==="plaintext-only",$e}function At(e){let{segments:o,newParamId:t,editingParam:i,editingIdentified:r,editingAnchor:a,caretOffset:s,placeholderText:g,isFocused:b,isDropdownOpen:v,listboxId:m,activeDescendantId:y,autoFocus:I,handleTextChange:w,handleKeyDown:f,handleCaretAfterInput:L,handleCaretMove:$,startEditingParam:se,replaceEditingRange:ge,setFocused:G}=e,S=(0,x.useRef)(null),ee=(0,x.useRef)(!1),h=(0,x.useRef)(""),be=(0,x.useRef)(""),te=(0,x.useRef)(null),le=(0,x.useRef)(0);te.current=s,(0,x.useEffect)(()=>{if(!I)return;let l=S.current;if(!l)return;document.activeElement===l?G(!0):l.focus();let u=l.ownerDocument??document,n=u.getSelection(),k=n&&n.rangeCount>0&&l.contains(n.anchorNode);if(n&&!k){let _=u.createRange();_.selectNodeContents(l),_.collapse(!0),n.removeAllRanges(),n.addRange(_)}},[I,G]),(0,x.useEffect)(()=>{let l=S.current;if(!l)return;let u=l.ownerDocument??document,n=()=>{let k=u.getSelection();if(!k||k.rangeCount===0||!k.anchorNode||!l.contains(k.anchorNode))return;let _=k.anchorNode,D=_.nodeType===Node.ELEMENT_NODE?_:_.parentElement,Q=(k.isCollapsed?D?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,ie=i?.id??r?.id??null;if(Q&&Q!==ie){se(Q);return}performance.now()-le.current<50||$((0,U.getCursorOffset)(l))};return u.addEventListener("selectionchange",n),()=>u.removeEventListener("selectionchange",n)},[i,r,se,$]),(0,x.useLayoutEffect)(()=>{let l=S.current;l&&(0,U.renderEditableContent)({input:l,segments:o,newParamId:t,editingParamId:i?.id??null,placeholderText:g??"",isFocused:b})},[o,t,i,g,b]),(0,x.useLayoutEffect)(()=>{let l=h.current,u=t??"";if(h.current=u,!u||u===l)return;let n=S.current;if(!n)return;n.focus();let k=te.current??(0,U.plainTextLength)(n);(0,U.setCursorOffset)(n,k)},[t]),(0,x.useLayoutEffect)(()=>{let l=be.current,u=i?.id??"";if(be.current=u,!u||u===l||a==null)return;let n=S.current;n&&(0,U.setCursorOffset)(n,a)},[i,a]);let N=(0,x.useCallback)(()=>{if(ee.current)return;let l=S.current;if(!l)return;let u=(0,U.extractPlainText)(l),k=u.length>0&&u[0]!==u[0].toUpperCase()?u[0].toUpperCase()+u.slice(1):u;w(k)},[w]),ve=(0,x.useCallback)(()=>{le.current=performance.now(),N();let l=S.current;l&&L((0,U.getCursorOffset)(l))},[N,L]);(0,x.useEffect)(()=>{let l=S.current;if(!l)return;let u=n=>{let k=n,_=k.inputType;if(_==="insertParagraph"||_==="insertLineBreak"||_==="insertFromDrop"){n.preventDefault();return}if(_.startsWith("insert")||_.startsWith("delete")){let D=_.startsWith("delete")?"":k.data??"";ge(D)&&n.preventDefault()}};return l.addEventListener("beforeinput",u),()=>l.removeEventListener("beforeinput",u)},[ge]);let ae=(0,x.useCallback)(()=>{ee.current=!0},[]),oe=(0,x.useCallback)(()=>{ee.current=!1,N()},[N]),de=(0,x.useCallback)(l=>{l.preventDefault();let u=S.current;if(!u)return;let n=(l.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!n)return;let k=u.ownerDocument??document,_=k.getSelection();if(!_||_.rangeCount===0)return;let D=_.getRangeAt(0);if(!u.contains(D.startContainer))return;D.deleteContents();let d=k.createTextNode(n);D.insertNode(d),D.setStartAfter(d),D.collapse(!0),_.removeAllRanges(),_.addRange(D),N()},[N]),H=(0,x.useCallback)(l=>f(l),[f]),ce=(0,x.useCallback)(()=>G(!0),[G]),q=(0,x.useCallback)(()=>G(!1),[G]),j=(0,x.useCallback)(()=>S.current?.focus(),[]),V=(0,x.useCallback)(()=>S.current?.blur(),[]),p=(0,x.useCallback)(()=>{let l=S.current;return l?(0,U.extractPlainText)(l):""},[]),Y=Xt()?"plaintext-only":"true";return{inputRef:S,editorProps:{ref:S,contentEditable:Y,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":m,"aria-expanded":v,"aria-activedescendant":y,spellCheck:!0,enterKeyHint:"send",onInput:ve,onKeyDown:H,onCompositionStart:ae,onCompositionEnd:oe,onPaste:de,onFocus:ce,onBlur:q},getPlainText:p,focus:j,blur:V}}var J=require("react/jsx-runtime");function Zt(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var St=(0,T.forwardRef)(function({onSubmit:o,onError:t,optionOverrides:i,maskCompletedText:r,className:a,apiConfig:s,additionalContext:g,columns:b,pillPlacement:v="dropdown",mode:m="auto",optionsPosition:y="below",animations:I=!0,dropdownTrigger:w,closeDropdownOnBlur:f,showNonTappableOptions:L,showSkipButton:$,autoFocus:se=!0,onFocus:ge,onBlur:G,value:S,completedParams:ee,onChange:h,onParamsChange:be,products:te,onProductSelect:le,submitButton:N},ve){let ae=(0,T.useRef)(null),oe=(0,T.useRef)(null),de=(0,T.useRef)(()=>{}),H=(0,T.useRef)(null),ce=(0,T.useRef)(null);(0,T.useEffect)(()=>{let A=ae.current;if(A)return H.current?H.current.setMode(m):H.current=new Te.ModeController(A,m),()=>{H.current?.destroy(),H.current=null}},[m]);let q=(0,T.useCallback)(A=>{let ye=ce.current?.current;ye&&(ye.focus(),(0,Te.setCursorOffset)(ye,A))},[]),{completedParams:j,skippedParams:V,suggestionPills:p,setActivePill:Y,skipActivePill:l,segments:u,newParamId:n,clearNewParamId:k,placeholderText:_,isFocused:D,isDropdownOpen:d,isActivePillSelected:Q,isLoading:ie,activeIndex:pe,listboxId:ke,handleTextChange:we,handleKeyDown:Ae,setFocused:O,editingParam:ue,editingIdentified:Re,editingAnchor:Ne,caretOffset:je,startEditingParam:ze,handleCaretAfterInput:c,handleCaretMove:z,replaceEditingRange:R,dropdownProps:Se,reset:xe}=qe({onSubmit:A=>de.current(A),onError:t,optionOverrides:i,maskCompletedText:r,apiConfig:s,additionalContext:g,columns:b,dropdownTrigger:w,optionsPosition:y,closeDropdownOnBlur:f,showNonTappableOptions:L,showSkipButton:$,onFocus:ge,onBlur:G,value:S,completedParams:ee,onChange:h,onParamsChange:be,products:te,onProductSelect:le,source:"full-sdk",setCursor:q});(0,T.useEffect)(()=>{if(!n)return;let A=window.setTimeout(()=>k(),650);return()=>window.clearTimeout(A)},[n,k]);let Ct=pe>=0?`${ke}-option-${pe}`:void 0,{inputRef:Ve,editorProps:Dt,focus:Oe,blur:at,getPlainText:ot}=At({segments:u,newParamId:n,editingParam:ue,editingIdentified:Re,editingAnchor:Ne,caretOffset:je,placeholderText:_,isFocused:D,isDropdownOpen:d,listboxId:ke,activeDescendantId:Ct,autoFocus:se,handleTextChange:we,handleKeyDown:Ae,handleCaretAfterInput:c,handleCaretMove:z,startEditingParam:ze,replaceEditingRange:R,setFocused:O});ce.current=Ve,(0,T.useLayoutEffect)(()=>{let A=oe.current,ye=Ve.current;if(!A||!ye)return;let it=()=>{let rt=A.firstElementChild;if(!rt)return;let Lt=rt.getBoundingClientRect(),Mt=ye.getBoundingClientRect();Lt.top>=Mt.bottom-2?A.setAttribute("data-aia-pill-wrapped",""):A.removeAttribute("data-aia-pill-wrapped")};it();let nt=new ResizeObserver(it);return nt.observe(ye),()=>nt.disconnect()},[u,p.length,ie,Ve]),(0,T.useImperativeHandle)(ve,()=>({focus:Oe,blur:at,reset:xe,setMode:A=>H.current?.setMode(A),skipActivePill:l}),[Oe,at,xe,l]);let Be=!!u.length||j.length>0,Ye=(0,T.useCallback)(()=>{if(!Be)return;let A=ot();o((0,Te.buildSubmitResult)(A,j,V)),xe()},[Be,j,V,o,xe,ot]);de.current=Ye;let Et=(0,T.useCallback)(A=>{A.target?.closest("[data-aia-pill]")||Oe()},[Oe]),Tt=v==="inline",Rt=v==="dropdown";return(0,J.jsxs)("div",{ref:ae,className:`magicx-aia ${Pe.container} ${a??""}`,"data-pill-placement":v,"data-options-position":y,"data-animations":I?"on":"off","data-mode":Zt(m),children:[(0,J.jsx)(We,{...Se,showPills:Rt}),(0,J.jsxs)("div",{className:Pe.inputWrapper,onClick:Et,children:[(0,J.jsxs)("div",{className:Pe.editorArea,"data-aia-editor":"",children:[(0,J.jsx)("div",{...Dt,className:Pe.input,"data-aia-input":""}),Tt&&(ie||p.length>0)&&(0,J.jsx)("span",{ref:oe,className:Pe.pillListContainer,"data-aia-pill-list-container":"",children:(0,J.jsx)(Ge,{pills:p,activePillIndex:0,activeSelected:Q,onSelectPill:Y,loading:ie})})]}),N===null?null:N===void 0?(0,J.jsx)(Pt,{disabled:!Be,onClick:Ye}):(0,J.jsx)("span",{"data-aia-submit":"",className:Pe.submitSlot,onClick:A=>{Be&&(A.stopPropagation(),Ye())},children:N})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,formatDate,isoDate,monthLabel,parseDate,parseLooseDate,useAIAutocomplete,withSkippedParams});
1583
+ `,document.head.appendChild(e)}var At={submitButton:"SubmitButton-module_submitButton_otz7H"};var $e=require("react/jsx-runtime");function St({disabled:e,onClick:i}){return(0,$e.jsx)("button",{type:"button","data-aia-submit":"",className:At.submitButton,disabled:e,onClick:t=>{t.stopPropagation(),i()},"aria-label":"Submit",children:(0,$e.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,$e.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ee=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react");var it=require("react");function Ct(e){let i=(0,it.useRef)(e);i.current=e;let t=(0,it.useRef)(null);t.current===null&&(t.current={fetch:(n,o)=>{let r=i.current;return r?r.fetch(n,o):Promise.reject(new Error("products config removed"))},transform:n=>i.current?.transform(n)??[],get limit(){return i.current?.limit}});let a=e!==void 0;return{config:a?t.current:void 0,enabled:a}}var Jt={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],activeFormatType:"options",dateView:null,placeholderText:"",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};function je({onSubmit:e,onResult:i,onError:t,optionOverrides:a,maskCompletedText:n,apiConfig:o,additionalContext:r,columns:g=2,dropdownTrigger:v,optionsPosition:x,closeDropdownOnBlur:m,showNonTappableOptions:w,showSkipButton:I,onFocus:y,onBlur:b,value:L,completedParams:N,onChange:ne,onParamsChange:re,products:q,onProductSelect:A,source:se,setCursor:le}){let p=(0,P.useRef)(null),[de,ce]=(0,P.useState)(null),O=(0,P.useRef)(e);O.current=e;let ee=(0,P.useRef)(i);ee.current=i;let pe=(0,P.useRef)(t);pe.current=t;let te=(0,P.useRef)(ne);te.current=ne;let ue=(0,P.useRef)(re);ue.current=re;let me=(0,P.useRef)(y);me.current=y;let G=(0,P.useRef)(b);G.current=b;let $=(0,P.useRef)(le);$.current=le;let ae=(0,P.useRef)(A);ae.current=A;let j=Ct(q);(0,P.useEffect)(()=>{if(typeof document>"u")return;let c=new Ee.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:o,additionalContext:r,optionOverrides:a,maskCompletedText:n,columns:g,dropdownTrigger:v,optionsPosition:x,closeDropdownOnBlur:m,showNonTappableOptions:w,source:se,value:L,completedParams:N,onSubmit:(...C)=>O.current?.(...C),onResult:(...C)=>ee.current?.(...C),onError:(...C)=>pe.current?.(...C),onChange:(...C)=>te.current?.(...C),onParamsChange:(...C)=>ue.current?.(...C),onFocus:()=>me.current?.(),onBlur:()=>G.current?.(),onProductSelect:C=>ae.current?.(C),setCursor:C=>$.current?.(C),products:j.config});p.current=c,ce(c.getState());let z=c.subscribe(C=>ce(C));return()=>{z(),c.destroy(),p.current===c&&(p.current=null)}},[]),(0,P.useEffect)(()=>{L!==void 0&&p.current?.setValue(L)},[L]),(0,P.useEffect)(()=>{N!==void 0&&p.current?.setCompletedParams(N)},[N]);let h=JSON.stringify(o??null),H;try{H=JSON.stringify(r??null)}catch{H="[unstringifiable]"}let l=(0,P.useRef)(a),u=(0,P.useRef)(0);if(a!==l.current){let c=l.current,z=a,C=Object.keys(c??{}),Se=Object.keys(z??{});(C.length!==Se.length||Se.some(Le=>!c?.[Le]||z[Le]!==c[Le]))&&u.current++,l.current=a}(0,P.useEffect)(()=>{p.current?.update({apiConfig:o,additionalContext:r,optionOverrides:a,dropdownTrigger:v,optionsPosition:x,closeDropdownOnBlur:m,showNonTappableOptions:w})},[h,H,u.current,v,x,m,w]);let f=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!f.current){f.current=!0;return}p.current?.update({products:j.config})},[j.enabled]);let _=(0,P.useRef)(null);_.current===null&&(_.current={handleTextChange:c=>p.current?.handleTextChange(c),handleKeyDown:c=>{let z="nativeEvent"in c?c.nativeEvent:c;p.current?.handleKeyDown(z)},setFocused:c=>p.current?.setFocused(c),startEditingParam:c=>p.current?.startEditingParam(c),exitEditMode:()=>p.current?.exitEditMode(),handleCaretAfterInput:c=>p.current?.handleCaretAfterInput(c),handleCaretMove:c=>p.current?.handleCaretMove(c),replaceEditingRange:c=>p.current?.replaceEditingRange(c)??!1,setActivePill:c=>p.current?.setActivePill(c),skipActivePill:()=>p.current?.skipActivePill(),removeLastParam:()=>p.current?.removeLastParam(),clearNewParamId:()=>p.current?.clearNewParamId(),reset:()=>p.current?.reset(),selectOption:c=>p.current?.selectOption(c),selectProduct:c=>p.current?.selectProduct(c),setActiveDropdownIndex:c=>p.current?.setActiveDropdownIndex(c),showPreviousMonth:()=>p.current?.showPreviousMonth(),showNextMonth:()=>p.current?.showNextMonth(),handleFocus:()=>p.current?.setFocused(!0),handleBlur:()=>p.current?.setFocused(!1)});let s=_.current,E=(0,P.useCallback)(c=>{let z=c.target.value,Se=z.length>0&&!c.nativeEvent?.isComposing&&z[0]!==z[0].toUpperCase()?z[0].toUpperCase()+z.slice(1):z;p.current?.handleTextChange(Se)},[]),Q=(0,P.useCallback)(c=>{p.current?.handleKeyDown(c.nativeEvent)},[]),V=p.current,d=de??Jt,_e=L!==void 0?L:d.text,Ae=N!==void 0?N:d.completedParams,he=d.actionableSuggestions,ke=he[0],Y=V?.listboxId??"",Ye=d.activeDropdownIndex>=0&&V?`${Y}-option-${d.activeDropdownIndex}`:void 0,fe=d.editingParam,ge=d.editingIdentified,Re=fe?{type:fe.suggestionType,text:fe.suggestionPlaceholder,required:!0,options:fe.options}:ge?{type:ge.type,text:(0,Ee.identifiedParamLabel)(ge.type),required:!0,options:[]}:null,ze=Re??ke,Qe=Re?[Re]:he,Oe=!V||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation;return{completedParams:Ae,skippedParams:d.skippedParams,identifiedParams:d.identifiedParams,suggestionPills:he,setActivePill:s.setActivePill,skipActivePill:s.skipActivePill,removeLastParam:s.removeLastParam,segments:d.segments,newParamId:d.newParamId,clearNewParamId:s.clearNewParamId,suggestions:d.suggestions,activeIndex:d.activeDropdownIndex,isReady:d.isReady,isLoading:Oe,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:Y,error:d.error,products:d.products,selectProduct:s.selectProduct,handleTextChange:s.handleTextChange,handleKeyDown:s.handleKeyDown,setFocused:s.setFocused,editingParam:fe,editingIdentified:ge,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:s.startEditingParam,exitEditMode:s.exitEditMode,handleCaretAfterInput:s.handleCaretAfterInput,handleCaretMove:s.handleCaretMove,replaceEditingRange:s.replaceEditingRange,inputProps:{value:_e,placeholder:d.placeholderText||void 0,onChange:E,onKeyDown:Q,onFocus:s.handleFocus,onBlur:s.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":Ye,"aria-autocomplete":"list","aria-controls":Y},reset:s.reset,dropdownProps:{suggestions:ze?[{...ze,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:s.selectOption,onHighlight:s.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:Y,pills:Qe,activeSelected:d.isActivePillSelected,onPillClick:s.setActivePill,onSkip:s.skipActivePill,showSkipButton:(I??!0)&&!fe&&!ge,skipDisabled:d.inSelectionAnimation,isLoading:Oe,isInputEmpty:_e.trim().length===0,products:d.products,onProductSelect:s.selectProduct,onProductFocusChange:s.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:ge?ge.iso:(0,Ee.selectedIsoFromText)(fe?.text),onPreviousMonth:s.showPreviousMonth,onNextMonth:s.showNextMonth,optionsPosition:x??"below"}}}var U=require("@magicx-eng/ai-autocomplete-vanilla"),k=require("react"),Ve;function ea(){if(Ve!==void 0)return Ve;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ve=e.contentEditable==="plaintext-only",Ve}function Dt(e){let{segments:i,newParamId:t,editingParam:a,editingIdentified:n,editingAnchor:o,caretOffset:r,placeholderText:g,isFocused:v,isDropdownOpen:x,listboxId:m,activeDescendantId:w,autoFocus:I,handleTextChange:y,handleKeyDown:b,handleCaretAfterInput:L,handleCaretMove:N,startEditingParam:ne,replaceEditingRange:re,setFocused:q}=e,A=(0,k.useRef)(null),se=(0,k.useRef)(!1),le=(0,k.useRef)(""),p=(0,k.useRef)(""),de=(0,k.useRef)(null),ce=(0,k.useRef)(0);de.current=r,(0,k.useEffect)(()=>{if(!I)return;let l=A.current;if(!l)return;document.activeElement===l?q(!0):l.focus();let u=l.ownerDocument??document,f=u.getSelection(),_=f&&f.rangeCount>0&&l.contains(f.anchorNode);if(f&&!_){let s=u.createRange();s.selectNodeContents(l),s.collapse(!0),f.removeAllRanges(),f.addRange(s)}},[I,q]),(0,k.useEffect)(()=>{let l=A.current;if(!l)return;let u=l.ownerDocument??document,f=()=>{let _=u.getSelection();if(!_||_.rangeCount===0||!_.anchorNode||!l.contains(_.anchorNode))return;let s=_.anchorNode,E=s.nodeType===Node.ELEMENT_NODE?s:s.parentElement,V=(_.isCollapsed?E?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,d=a?.id??n?.id??null;if(V&&V!==d){ne(V);return}performance.now()-ce.current<50||N((0,U.getCursorOffset)(l))};return u.addEventListener("selectionchange",f),()=>u.removeEventListener("selectionchange",f)},[a,n,ne,N]),(0,k.useLayoutEffect)(()=>{let l=A.current;l&&(0,U.renderEditableContent)({input:l,segments:i,newParamId:t,editingParamId:a?.id??null,placeholderText:g??"",isFocused:v})},[i,t,a,g,v]),(0,k.useLayoutEffect)(()=>{let l=le.current,u=t??"";if(le.current=u,!u||u===l)return;let f=A.current;if(!f)return;f.focus();let _=de.current??(0,U.plainTextLength)(f);(0,U.setCursorOffset)(f,_)},[t]),(0,k.useLayoutEffect)(()=>{let l=p.current,u=a?.id??"";if(p.current=u,!u||u===l||o==null)return;let f=A.current;f&&(0,U.setCursorOffset)(f,o)},[a,o]);let O=(0,k.useCallback)(()=>{if(se.current)return;let l=A.current;if(!l)return;let u=(0,U.extractPlainText)(l),_=u.length>0&&u[0]!==u[0].toUpperCase()?u[0].toUpperCase()+u.slice(1):u;y(_)},[y]),ee=(0,k.useCallback)(()=>{ce.current=performance.now(),O();let l=A.current;l&&L((0,U.getCursorOffset)(l))},[O,L]);(0,k.useEffect)(()=>{let l=A.current;if(!l)return;let u=f=>{let _=f,s=_.inputType;if(s==="insertParagraph"||s==="insertLineBreak"||s==="insertFromDrop"){f.preventDefault();return}if(s.startsWith("insert")||s.startsWith("delete")){let E=s.startsWith("delete")?"":_.data??"";re(E)&&f.preventDefault()}};return l.addEventListener("beforeinput",u),()=>l.removeEventListener("beforeinput",u)},[re]);let pe=(0,k.useCallback)(()=>{se.current=!0},[]),te=(0,k.useCallback)(()=>{se.current=!1,O()},[O]),ue=(0,k.useCallback)(l=>{l.preventDefault();let u=A.current;if(!u)return;let f=(l.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!f)return;let _=u.ownerDocument??document,s=_.getSelection();if(!s||s.rangeCount===0)return;let E=s.getRangeAt(0);if(!u.contains(E.startContainer))return;E.deleteContents();let Q=_.createTextNode(f);E.insertNode(Q),E.setStartAfter(Q),E.collapse(!0),s.removeAllRanges(),s.addRange(E),O()},[O]),me=(0,k.useCallback)(l=>b(l),[b]),G=(0,k.useCallback)(()=>q(!0),[q]),$=(0,k.useCallback)(()=>q(!1),[q]),ae=(0,k.useCallback)(()=>A.current?.focus(),[]),j=(0,k.useCallback)(()=>A.current?.blur(),[]),h=(0,k.useCallback)(()=>{let l=A.current;return l?(0,U.extractPlainText)(l):""},[]),H=ea()?"plaintext-only":"true";return{inputRef:A,editorProps:{ref:A,contentEditable:H,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":m,"aria-expanded":x,"aria-activedescendant":w,spellCheck:!0,enterKeyHint:"send",onInput:ee,onKeyDown:me,onCompositionStart:pe,onCompositionEnd:te,onPaste:ue,onFocus:G,onBlur:$},getPlainText:h,focus:ae,blur:j}}var J=require("react/jsx-runtime");function ta(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Et=(0,R.forwardRef)(function({onSubmit:i,onResult:t,onError:a,optionOverrides:n,maskCompletedText:o,className:r,apiConfig:g,additionalContext:v,columns:x,pillPlacement:m="dropdown",mode:w="auto",optionsPosition:I="below",animations:y=!0,dropdownTrigger:b,closeDropdownOnBlur:L,showNonTappableOptions:N,showSkipButton:ne,autoFocus:re=!0,onFocus:q,onBlur:A,value:se,completedParams:le,onChange:p,onParamsChange:de,products:ce,onProductSelect:O,submitButton:ee},pe){let te=(0,R.useRef)(null),ue=(0,R.useRef)(null),me=(0,R.useRef)(()=>{}),G=(0,R.useRef)(null),$=(0,R.useRef)(null);(0,R.useEffect)(()=>{let S=te.current;if(S)return G.current?G.current.setMode(w):G.current=new Te.ModeController(S,w),()=>{G.current?.destroy(),G.current=null}},[w]);let ae=(0,R.useCallback)(S=>{let xe=$.current?.current;xe&&(xe.focus(),(0,Te.setCursorOffset)(xe,S))},[]),{completedParams:j,skippedParams:h,identifiedParams:H,isReady:l,suggestionPills:u,setActivePill:f,skipActivePill:_,segments:s,newParamId:E,clearNewParamId:Q,placeholderText:V,isFocused:d,isDropdownOpen:_e,isActivePillSelected:Ae,isLoading:he,activeIndex:ke,listboxId:Y,handleTextChange:Ye,handleKeyDown:fe,setFocused:ge,editingParam:Re,editingIdentified:ze,editingAnchor:Qe,caretOffset:Oe,startEditingParam:c,handleCaretAfterInput:z,handleCaretMove:C,replaceEditingRange:Se,dropdownProps:Le,reset:Be}=je({onSubmit:S=>me.current(S),onResult:t,onError:a,optionOverrides:n,maskCompletedText:o,apiConfig:g,additionalContext:v,columns:x,dropdownTrigger:b,optionsPosition:I,closeDropdownOnBlur:L,showNonTappableOptions:N,showSkipButton:ne,onFocus:q,onBlur:A,value:se,completedParams:le,onChange:p,onParamsChange:de,products:ce,onProductSelect:O,source:"full-sdk",setCursor:ae});(0,R.useEffect)(()=>{if(!E)return;let S=window.setTimeout(()=>Q(),650);return()=>window.clearTimeout(S)},[E,Q]);let Tt=ke>=0?`${Y}-option-${ke}`:void 0,{inputRef:Xe,editorProps:Rt,focus:Fe,blur:nt,getPlainText:rt}=Dt({segments:s,newParamId:E,editingParam:Re,editingIdentified:ze,editingAnchor:Qe,caretOffset:Oe,placeholderText:V,isFocused:d,isDropdownOpen:_e,listboxId:Y,activeDescendantId:Tt,autoFocus:re,handleTextChange:Ye,handleKeyDown:fe,handleCaretAfterInput:z,handleCaretMove:C,startEditingParam:c,replaceEditingRange:Se,setFocused:ge});$.current=Xe,(0,R.useLayoutEffect)(()=>{let S=ue.current,xe=Xe.current;if(!S||!xe)return;let st=()=>{let dt=S.firstElementChild;if(!dt)return;let zt=dt.getBoundingClientRect(),Ot=xe.getBoundingClientRect();zt.top>=Ot.bottom-2?S.setAttribute("data-aia-pill-wrapped",""):S.removeAttribute("data-aia-pill-wrapped")};st();let lt=new ResizeObserver(st);return lt.observe(xe),()=>lt.disconnect()},[s,u.length,he,Xe]),(0,R.useImperativeHandle)(pe,()=>({focus:Fe,blur:nt,reset:Be,setMode:S=>G.current?.setMode(S),skipActivePill:_}),[Fe,nt,Be,_]);let Ge=!!s.length||j.length>0,Ze=(0,R.useCallback)(()=>{if(!Ge)return;let S=rt();i((0,Te.buildSubmitResult)(S,j,h,{identifiedParams:H,isReady:l})),Be()},[Ge,j,h,H,l,i,Be,rt]);me.current=Ze;let Lt=(0,R.useCallback)(S=>{S.target?.closest("[data-aia-pill]")||Fe()},[Fe]),Mt=m==="inline",Nt=m==="dropdown";return(0,J.jsxs)("div",{ref:te,className:`magicx-aia ${Pe.container} ${r??""}`,"data-pill-placement":m,"data-options-position":I,"data-animations":y?"on":"off","data-mode":ta(w),children:[(0,J.jsx)(qe,{...Le,showPills:Nt}),(0,J.jsxs)("div",{className:Pe.inputWrapper,onClick:Lt,children:[(0,J.jsxs)("div",{className:Pe.editorArea,"data-aia-editor":"",children:[(0,J.jsx)("div",{...Rt,className:Pe.input,"data-aia-input":""}),Mt&&(he||u.length>0)&&(0,J.jsx)("span",{ref:ue,className:Pe.pillListContainer,"data-aia-pill-list-container":"",children:(0,J.jsx)(Ke,{pills:u,activePillIndex:0,activeSelected:Ae,onSelectPill:f,loading:he})})]}),ee===null?null:ee===void 0?(0,J.jsx)(St,{disabled:!Ge,onClick:Ze}):(0,J.jsx)("span",{"data-aia-submit":"",className:Pe.submitSlot,onClick:S=>{Ge&&(S.stopPropagation(),Ze())},children:ee})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,formatDate,isoDate,monthLabel,parseDate,parseLooseDate,useAIAutocomplete,withSkippedParams});
1584
1584
  //# sourceMappingURL=index.js.map