@websolutespa/bom-llm 0.0.38 → 0.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/umd/index.js CHANGED
@@ -8127,7 +8127,7 @@
8127
8127
  }
8128
8128
  return context;
8129
8129
  };
8130
- return [useGenericContext, genericContext.Provider];
8130
+ return [useGenericContext, genericContext.Provider, genericContext];
8131
8131
  };
8132
8132
 
8133
8133
  const [useLayout, LayoutContextProvider] = createGenericContext();
@@ -8143,6 +8143,15 @@
8143
8143
  });
8144
8144
  }
8145
8145
 
8146
+ function useAutosizeTextArea(textAreaRef, value) {
8147
+ reactExports.useEffect(() => {
8148
+ if (textAreaRef) {
8149
+ textAreaRef.style.height = '0px';
8150
+ textAreaRef.style.height = textAreaRef.scrollHeight + 1 + 'px';
8151
+ }
8152
+ }, [textAreaRef, value]);
8153
+ }
8154
+
8146
8155
  const useIsomorphicLayoutEffect$2 = isBrowser$1 ? reactExports.useLayoutEffect : reactExports.useEffect;
8147
8156
 
8148
8157
  // Window Event based useEventListener interface
@@ -8199,70 +8208,6 @@
8199
8208
  return windowSize;
8200
8209
  }
8201
8210
 
8202
- function useNumber(options, locale) {
8203
- const layout = useLayout();
8204
- const currentLocale = locale || layout.locale;
8205
- const flatOptions = options ? Object.entries(options).map(_ref => {
8206
- let [k, v] = _ref;
8207
- return `${k}:${v}`;
8208
- }).join('') : undefined;
8209
- const formatter = reactExports.useMemo(() => {
8210
- const formatter = new Intl.NumberFormat(currentLocale, options).format;
8211
- return formatter;
8212
- // eslint-disable-next-line react-hooks/exhaustive-deps
8213
- }, [currentLocale, flatOptions]);
8214
- return formatter;
8215
- }
8216
-
8217
- function useCurrency(currency, locale) {
8218
- if (currency === void 0) {
8219
- currency = 'EUR';
8220
- }
8221
- return useNumber({
8222
- style: 'currency',
8223
- currency,
8224
- minimumFractionDigits: 2,
8225
- maximumFractionDigits: 2
8226
- }, locale);
8227
- }
8228
-
8229
- /*
8230
- import { useMemo } from 'react';
8231
- import { useNumber } from '../useNumber/useNumber';
8232
- import { useLayout } from '../useLayout/useLayout';
8233
-
8234
- export function useCurrency(currency: string = 'EUR', locale?: string): (value: number) => string {
8235
- const layout = useLayout();
8236
- const currentLocale = locale || layout.locale;
8237
-
8238
- const formatter = useMemo(() => {
8239
- const options = { style: 'currency', currency };
8240
- const formatter = new Intl.NumberFormat(currentLocale, options).format;
8241
- return formatter;
8242
- }, [currency, currentLocale]);
8243
-
8244
- return formatter;
8245
- }
8246
-
8247
- */
8248
-
8249
- /*
8250
-
8251
- export function useCurrency(value: number, currency: string = 'EUR', locale?: string): string {
8252
-
8253
- const layout = useLayout();
8254
-
8255
- const currentLocale = locale || layout.locale;
8256
-
8257
- return useMemo(() => {
8258
- const options = { style: 'currency', currency };
8259
- const formattedValue = new Intl.NumberFormat(currentLocale, options).format(value);
8260
- return formattedValue;
8261
- }, [value, currency, currentLocale]);
8262
- }
8263
-
8264
- */
8265
-
8266
8211
  const createStoreImpl = (createState) => {
8267
8212
  let state;
8268
8213
  const listeners = /* @__PURE__ */ new Set();
@@ -8466,542 +8411,977 @@
8466
8411
  return slice;
8467
8412
  }
8468
8413
 
8469
- const [useExtra, ExtraContextProvider] = createGenericContext({});
8470
- function ExtraProvider(_ref) {
8471
- let {
8472
- children,
8473
- extra
8474
- } = _ref;
8475
- return /*#__PURE__*/jsxRuntimeExports.jsx(ExtraContextProvider, {
8476
- value: extra,
8477
- children: children
8478
- });
8414
+ function createJSONStorage(getStorage, options) {
8415
+ let storage;
8416
+ try {
8417
+ storage = getStorage();
8418
+ } catch (e) {
8419
+ return;
8420
+ }
8421
+ const persistStorage = {
8422
+ getItem: (name) => {
8423
+ var _a;
8424
+ const parse = (str2) => {
8425
+ if (str2 === null) {
8426
+ return null;
8427
+ }
8428
+ return JSON.parse(str2, options == null ? void 0 : options.reviver);
8429
+ };
8430
+ const str = (_a = storage.getItem(name)) != null ? _a : null;
8431
+ if (str instanceof Promise) {
8432
+ return str.then(parse);
8433
+ }
8434
+ return parse(str);
8435
+ },
8436
+ setItem: (name, newValue) => storage.setItem(
8437
+ name,
8438
+ JSON.stringify(newValue, options == null ? void 0 : options.replacer)
8439
+ ),
8440
+ removeItem: (name) => storage.removeItem(name)
8441
+ };
8442
+ return persistStorage;
8479
8443
  }
8480
-
8481
- /**
8482
- * KeyBinding Codes
8483
- * The content of this file is based on the design of the open source project "microsoft/vscode",
8484
- * Copyright (c) Microsoft Corporation. All rights reserved.
8485
- *
8486
- * We inherit the KeyMod values from "microsoft/vscode",
8487
- * but use the Browser's KeyboardEvent event implementation, and all values are used only as identification.
8488
- */
8489
-
8490
- let KeyCode = /*#__PURE__*/function (KeyCode) {
8491
- KeyCode[KeyCode["Unknown"] = 0] = "Unknown";
8492
- KeyCode[KeyCode["Backspace"] = 8] = "Backspace";
8493
- KeyCode[KeyCode["Tab"] = 9] = "Tab";
8494
- KeyCode[KeyCode["Enter"] = 13] = "Enter";
8495
- KeyCode[KeyCode["Shift"] = 16] = "Shift";
8496
- KeyCode[KeyCode["Ctrl"] = 17] = "Ctrl";
8497
- KeyCode[KeyCode["Alt"] = 18] = "Alt";
8498
- KeyCode[KeyCode["PauseBreak"] = 19] = "PauseBreak";
8499
- KeyCode[KeyCode["CapsLock"] = 20] = "CapsLock";
8500
- KeyCode[KeyCode["Escape"] = 27] = "Escape";
8501
- KeyCode[KeyCode["Space"] = 32] = "Space";
8502
- KeyCode[KeyCode["PageUp"] = 33] = "PageUp";
8503
- KeyCode[KeyCode["PageDown"] = 34] = "PageDown";
8504
- KeyCode[KeyCode["End"] = 35] = "End";
8505
- KeyCode[KeyCode["Home"] = 36] = "Home";
8506
- KeyCode[KeyCode["LeftArrow"] = 37] = "LeftArrow";
8507
- KeyCode[KeyCode["UpArrow"] = 38] = "UpArrow";
8508
- KeyCode[KeyCode["RightArrow"] = 39] = "RightArrow";
8509
- KeyCode[KeyCode["DownArrow"] = 40] = "DownArrow";
8510
- KeyCode[KeyCode["Insert"] = 45] = "Insert";
8511
- KeyCode[KeyCode["Delete"] = 46] = "Delete";
8512
- KeyCode[KeyCode["KEY_0"] = 48] = "KEY_0";
8513
- KeyCode[KeyCode["KEY_1"] = 49] = "KEY_1";
8514
- KeyCode[KeyCode["KEY_2"] = 50] = "KEY_2";
8515
- KeyCode[KeyCode["KEY_3"] = 51] = "KEY_3";
8516
- KeyCode[KeyCode["KEY_4"] = 52] = "KEY_4";
8517
- KeyCode[KeyCode["KEY_5"] = 53] = "KEY_5";
8518
- KeyCode[KeyCode["KEY_6"] = 54] = "KEY_6";
8519
- KeyCode[KeyCode["KEY_7"] = 55] = "KEY_7";
8520
- KeyCode[KeyCode["KEY_8"] = 56] = "KEY_8";
8521
- KeyCode[KeyCode["KEY_9"] = 57] = "KEY_9";
8522
- KeyCode[KeyCode["KEY_A"] = 65] = "KEY_A";
8523
- KeyCode[KeyCode["KEY_B"] = 66] = "KEY_B";
8524
- KeyCode[KeyCode["KEY_C"] = 67] = "KEY_C";
8525
- KeyCode[KeyCode["KEY_D"] = 68] = "KEY_D";
8526
- KeyCode[KeyCode["KEY_E"] = 69] = "KEY_E";
8527
- KeyCode[KeyCode["KEY_F"] = 70] = "KEY_F";
8528
- KeyCode[KeyCode["KEY_G"] = 71] = "KEY_G";
8529
- KeyCode[KeyCode["KEY_H"] = 72] = "KEY_H";
8530
- KeyCode[KeyCode["KEY_I"] = 73] = "KEY_I";
8531
- KeyCode[KeyCode["KEY_J"] = 74] = "KEY_J";
8532
- KeyCode[KeyCode["KEY_K"] = 75] = "KEY_K";
8533
- KeyCode[KeyCode["KEY_L"] = 76] = "KEY_L";
8534
- KeyCode[KeyCode["KEY_M"] = 77] = "KEY_M";
8535
- KeyCode[KeyCode["KEY_N"] = 78] = "KEY_N";
8536
- KeyCode[KeyCode["KEY_O"] = 79] = "KEY_O";
8537
- KeyCode[KeyCode["KEY_P"] = 80] = "KEY_P";
8538
- KeyCode[KeyCode["KEY_Q"] = 81] = "KEY_Q";
8539
- KeyCode[KeyCode["KEY_R"] = 82] = "KEY_R";
8540
- KeyCode[KeyCode["KEY_S"] = 83] = "KEY_S";
8541
- KeyCode[KeyCode["KEY_T"] = 84] = "KEY_T";
8542
- KeyCode[KeyCode["KEY_U"] = 85] = "KEY_U";
8543
- KeyCode[KeyCode["KEY_V"] = 86] = "KEY_V";
8544
- KeyCode[KeyCode["KEY_W"] = 87] = "KEY_W";
8545
- KeyCode[KeyCode["KEY_X"] = 88] = "KEY_X";
8546
- KeyCode[KeyCode["KEY_Y"] = 89] = "KEY_Y";
8547
- KeyCode[KeyCode["KEY_Z"] = 90] = "KEY_Z";
8548
- KeyCode[KeyCode["Meta"] = 91] = "Meta";
8549
- KeyCode[KeyCode["F1"] = 112] = "F1";
8550
- KeyCode[KeyCode["F2"] = 113] = "F2";
8551
- KeyCode[KeyCode["F3"] = 114] = "F3";
8552
- KeyCode[KeyCode["F4"] = 115] = "F4";
8553
- KeyCode[KeyCode["F5"] = 116] = "F5";
8554
- KeyCode[KeyCode["F6"] = 117] = "F6";
8555
- KeyCode[KeyCode["F7"] = 118] = "F7";
8556
- KeyCode[KeyCode["F8"] = 119] = "F8";
8557
- KeyCode[KeyCode["F9"] = 120] = "F9";
8558
- KeyCode[KeyCode["F10"] = 121] = "F10";
8559
- KeyCode[KeyCode["F11"] = 122] = "F11";
8560
- KeyCode[KeyCode["F12"] = 123] = "F12";
8561
- KeyCode[KeyCode["NumLock"] = 144] = "NumLock";
8562
- KeyCode[KeyCode["ScrollLock"] = 145] = "ScrollLock";
8563
- KeyCode[KeyCode["Equal"] = 187] = "Equal";
8564
- KeyCode[KeyCode["Minus"] = 189] = "Minus";
8565
- KeyCode[KeyCode["Backquote"] = 192] = "Backquote";
8566
- KeyCode[KeyCode["Backslash"] = 220] = "Backslash";
8567
- return KeyCode;
8568
- }({});
8569
- let KeyMod = /*#__PURE__*/function (KeyMod) {
8570
- KeyMod[KeyMod["CtrlCmd"] = 2048] = "CtrlCmd";
8571
- KeyMod[KeyMod["Shift"] = 1024] = "Shift";
8572
- KeyMod[KeyMod["Alt"] = 512] = "Alt";
8573
- KeyMod[KeyMod["WinCtrl"] = 256] = "WinCtrl";
8574
- return KeyMod;
8575
- }({});
8576
-
8577
- const detectIsBrowser = () => {
8578
- return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
8444
+ const toThenable = (fn) => (input) => {
8445
+ try {
8446
+ const result = fn(input);
8447
+ if (result instanceof Promise) {
8448
+ return result;
8449
+ }
8450
+ return {
8451
+ then(onFulfilled) {
8452
+ return toThenable(onFulfilled)(result);
8453
+ },
8454
+ catch(_onRejected) {
8455
+ return this;
8456
+ }
8457
+ };
8458
+ } catch (e) {
8459
+ return {
8460
+ then(_onFulfilled) {
8461
+ return this;
8462
+ },
8463
+ catch(onRejected) {
8464
+ return toThenable(onRejected)(e);
8465
+ }
8466
+ };
8467
+ }
8579
8468
  };
8580
- function useSSR() {
8581
- const [browser, setBrowser] = reactExports.useState(false);
8582
- reactExports.useEffect(() => {
8583
- setBrowser(detectIsBrowser());
8584
- }, []);
8585
- return {
8586
- isBrowser: browser,
8587
- isServer: !browser
8469
+ const oldImpl = (config, baseOptions) => (set, get, api) => {
8470
+ let options = {
8471
+ getStorage: () => localStorage,
8472
+ serialize: JSON.stringify,
8473
+ deserialize: JSON.parse,
8474
+ partialize: (state) => state,
8475
+ version: 0,
8476
+ merge: (persistedState, currentState) => ({
8477
+ ...currentState,
8478
+ ...persistedState
8479
+ }),
8480
+ ...baseOptions
8588
8481
  };
8589
- }
8590
-
8591
- function getCtrlKeysByPlatform() {
8592
- return {
8593
- CtrlCmd: isMac() ? 'metaKey' : 'ctrlKey',
8594
- WinCtrl: isMac() ? 'ctrlKey' : 'metaKey'
8595
- };
8596
- }
8597
- function getActiveModMap(bindings) {
8598
- const modBindings = bindings.filter(item => !!KeyMod[item]);
8599
- const activeModMap = {
8600
- CtrlCmd: false,
8601
- Shift: false,
8602
- Alt: false,
8603
- WinCtrl: false
8604
- };
8605
- modBindings.forEach(code => {
8606
- const modKey = KeyMod[code];
8607
- activeModMap[modKey] = true;
8608
- });
8609
- return activeModMap;
8610
- }
8611
- function isMac() {
8612
- if (!detectIsBrowser()) {
8613
- return false;
8482
+ let hasHydrated = false;
8483
+ const hydrationListeners = /* @__PURE__ */ new Set();
8484
+ const finishHydrationListeners = /* @__PURE__ */ new Set();
8485
+ let storage;
8486
+ try {
8487
+ storage = options.getStorage();
8488
+ } catch (e) {
8614
8489
  }
8615
- return navigator.platform.toUpperCase().indexOf('MAC') >= 0;
8616
- }
8617
-
8618
- const useKeyboard = function (handler, keyBindings, options) {
8619
- if (options === void 0) {
8620
- options = {};
8490
+ if (!storage) {
8491
+ return config(
8492
+ (...args) => {
8493
+ console.warn(
8494
+ `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
8495
+ );
8496
+ set(...args);
8497
+ },
8498
+ get,
8499
+ api
8500
+ );
8621
8501
  }
8622
- const bindings = Array.isArray(keyBindings) ? keyBindings : [keyBindings];
8623
- const {
8624
- disableGlobalEvent = false,
8625
- capture = false,
8626
- stopPropagation = false,
8627
- preventDefault = true,
8628
- event = 'keydown'
8629
- } = options;
8630
- const activeModMap = getActiveModMap(bindings);
8631
- const keyCode = bindings.filter(item => !KeyMod[item]);
8632
- const {
8633
- CtrlCmd,
8634
- WinCtrl
8635
- } = getCtrlKeysByPlatform();
8636
- const eventHandler = event => {
8637
- if (activeModMap.Shift && !event.shiftKey) return;
8638
- if (activeModMap.Alt && !event.altKey) return;
8639
- if (activeModMap.CtrlCmd && !event[CtrlCmd]) return;
8640
- if (activeModMap.WinCtrl && !event[WinCtrl]) return;
8641
- const hitOne = keyCode.find(k => k === event.keyCode);
8642
- if (keyCode && !hitOne) return;
8643
- if (stopPropagation) {
8644
- event.stopPropagation();
8645
- }
8646
- if (preventDefault) {
8647
- event.preventDefault();
8502
+ const thenableSerialize = toThenable(options.serialize);
8503
+ const setItem = () => {
8504
+ const state = options.partialize({ ...get() });
8505
+ let errorInSync;
8506
+ const thenable = thenableSerialize({ state, version: options.version }).then(
8507
+ (serializedValue) => storage.setItem(options.name, serializedValue)
8508
+ ).catch((e) => {
8509
+ errorInSync = e;
8510
+ });
8511
+ if (errorInSync) {
8512
+ throw errorInSync;
8648
8513
  }
8649
- handler && handler(event);
8514
+ return thenable;
8650
8515
  };
8651
- reactExports.useEffect(() => {
8652
- if (!disableGlobalEvent) {
8653
- document.addEventListener(event, eventHandler);
8654
- }
8655
- return () => {
8656
- document.removeEventListener(event, eventHandler);
8657
- };
8658
- }, [disableGlobalEvent]);
8659
- const elementBindingHandler = function (elementEventType, isCapture) {
8660
- if (isCapture === void 0) {
8661
- isCapture = false;
8662
- }
8663
- if (elementEventType !== event) return () => {};
8664
- if (isCapture !== capture) return () => {};
8665
- return e => eventHandler(e);
8516
+ const savedSetState = api.setState;
8517
+ api.setState = (state, replace) => {
8518
+ savedSetState(state, replace);
8519
+ void setItem();
8666
8520
  };
8667
- return {
8668
- bindings: {
8669
- onKeyDown: elementBindingHandler('keydown'),
8670
- onKeyDownCapture: elementBindingHandler('keydown', true),
8671
- onKeyPress: elementBindingHandler('keypress'),
8672
- onKeyPressCapture: elementBindingHandler('keypress', true),
8673
- onKeyUp: elementBindingHandler('keyup'),
8674
- onKeyUpCapture: elementBindingHandler('keyup', true)
8521
+ const configResult = config(
8522
+ (...args) => {
8523
+ set(...args);
8524
+ void setItem();
8525
+ },
8526
+ get,
8527
+ api
8528
+ );
8529
+ let stateFromStorage;
8530
+ const hydrate = () => {
8531
+ var _a;
8532
+ if (!storage)
8533
+ return;
8534
+ hasHydrated = false;
8535
+ hydrationListeners.forEach((cb) => cb(get()));
8536
+ const postRehydrationCallback = ((_a = options.onRehydrateStorage) == null ? void 0 : _a.call(options, get())) || void 0;
8537
+ return toThenable(storage.getItem.bind(storage))(options.name).then((storageValue) => {
8538
+ if (storageValue) {
8539
+ return options.deserialize(storageValue);
8540
+ }
8541
+ }).then((deserializedStorageValue) => {
8542
+ if (deserializedStorageValue) {
8543
+ if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
8544
+ if (options.migrate) {
8545
+ return options.migrate(
8546
+ deserializedStorageValue.state,
8547
+ deserializedStorageValue.version
8548
+ );
8549
+ }
8550
+ console.error(
8551
+ `State loaded from storage couldn't be migrated since no migrate function was provided`
8552
+ );
8553
+ } else {
8554
+ return deserializedStorageValue.state;
8555
+ }
8556
+ }
8557
+ }).then((migratedState) => {
8558
+ var _a2;
8559
+ stateFromStorage = options.merge(
8560
+ migratedState,
8561
+ (_a2 = get()) != null ? _a2 : configResult
8562
+ );
8563
+ set(stateFromStorage, true);
8564
+ return setItem();
8565
+ }).then(() => {
8566
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
8567
+ hasHydrated = true;
8568
+ finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
8569
+ }).catch((e) => {
8570
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
8571
+ });
8572
+ };
8573
+ api.persist = {
8574
+ setOptions: (newOptions) => {
8575
+ options = {
8576
+ ...options,
8577
+ ...newOptions
8578
+ };
8579
+ if (newOptions.getStorage) {
8580
+ storage = newOptions.getStorage();
8581
+ }
8582
+ },
8583
+ clearStorage: () => {
8584
+ storage == null ? void 0 : storage.removeItem(options.name);
8585
+ },
8586
+ getOptions: () => options,
8587
+ rehydrate: () => hydrate(),
8588
+ hasHydrated: () => hasHydrated,
8589
+ onHydrate: (cb) => {
8590
+ hydrationListeners.add(cb);
8591
+ return () => {
8592
+ hydrationListeners.delete(cb);
8593
+ };
8594
+ },
8595
+ onFinishHydration: (cb) => {
8596
+ finishHydrationListeners.add(cb);
8597
+ return () => {
8598
+ finishHydrationListeners.delete(cb);
8599
+ };
8675
8600
  }
8676
8601
  };
8602
+ hydrate();
8603
+ return stateFromStorage || configResult;
8677
8604
  };
8678
-
8679
- const [useLabel, LabelContextProvider] = createGenericContext();
8680
- function LabelProvider(_ref) {
8681
- let {
8682
- children
8683
- } = _ref;
8684
- const {
8685
- labels
8686
- } = useLayout();
8687
- // console.log('LabelProvider', labels);
8688
- const labelService = new LabelService(labels);
8689
- const getLabel = (key, params) => {
8690
- return labelService.getLabel(key, params);
8605
+ const newImpl = (config, baseOptions) => (set, get, api) => {
8606
+ let options = {
8607
+ storage: createJSONStorage(() => localStorage),
8608
+ partialize: (state) => state,
8609
+ version: 0,
8610
+ merge: (persistedState, currentState) => ({
8611
+ ...currentState,
8612
+ ...persistedState
8613
+ }),
8614
+ ...baseOptions
8691
8615
  };
8692
- return /*#__PURE__*/jsxRuntimeExports.jsx(LabelContextProvider, {
8693
- value: getLabel,
8694
- children: children
8695
- });
8696
- }
8697
- class LabelService {
8698
- constructor(labels) {
8699
- this.labels = labels;
8700
- this.dictionary = Object.fromEntries(labels.map(l => [l.id, l.text]));
8701
- }
8702
- getLabel(key, params) {
8703
- return parseLabel(this.dictionary, key, params);
8704
- }
8705
- }
8706
- function parseLabel(dictionary, key, params) {
8707
- const label = dictionary[key] != null ? dictionary[key] : key;
8708
- if (params) {
8709
- return parseParams(label, params);
8616
+ let hasHydrated = false;
8617
+ const hydrationListeners = /* @__PURE__ */ new Set();
8618
+ const finishHydrationListeners = /* @__PURE__ */ new Set();
8619
+ let storage = options.storage;
8620
+ if (!storage) {
8621
+ return config(
8622
+ (...args) => {
8623
+ console.warn(
8624
+ `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
8625
+ );
8626
+ set(...args);
8627
+ },
8628
+ get,
8629
+ api
8630
+ );
8710
8631
  }
8711
- return label;
8712
- }
8713
- function parseParams(label, params) {
8714
- const TEMPLATE_REGEXP = /@(\w+)/g;
8715
- return label.replace(TEMPLATE_REGEXP, (text, key) => {
8716
- const replacer = params[key];
8717
- return typeof replacer !== 'undefined' ? String(replacer) : text;
8718
- });
8632
+ const setItem = () => {
8633
+ const state = options.partialize({ ...get() });
8634
+ return storage.setItem(options.name, {
8635
+ state,
8636
+ version: options.version
8637
+ });
8638
+ };
8639
+ const savedSetState = api.setState;
8640
+ api.setState = (state, replace) => {
8641
+ savedSetState(state, replace);
8642
+ void setItem();
8643
+ };
8644
+ const configResult = config(
8645
+ (...args) => {
8646
+ set(...args);
8647
+ void setItem();
8648
+ },
8649
+ get,
8650
+ api
8651
+ );
8652
+ api.getInitialState = () => configResult;
8653
+ let stateFromStorage;
8654
+ const hydrate = () => {
8655
+ var _a, _b;
8656
+ if (!storage)
8657
+ return;
8658
+ hasHydrated = false;
8659
+ hydrationListeners.forEach((cb) => {
8660
+ var _a2;
8661
+ return cb((_a2 = get()) != null ? _a2 : configResult);
8662
+ });
8663
+ const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;
8664
+ return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
8665
+ if (deserializedStorageValue) {
8666
+ if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
8667
+ if (options.migrate) {
8668
+ return options.migrate(
8669
+ deserializedStorageValue.state,
8670
+ deserializedStorageValue.version
8671
+ );
8672
+ }
8673
+ console.error(
8674
+ `State loaded from storage couldn't be migrated since no migrate function was provided`
8675
+ );
8676
+ } else {
8677
+ return deserializedStorageValue.state;
8678
+ }
8679
+ }
8680
+ }).then((migratedState) => {
8681
+ var _a2;
8682
+ stateFromStorage = options.merge(
8683
+ migratedState,
8684
+ (_a2 = get()) != null ? _a2 : configResult
8685
+ );
8686
+ set(stateFromStorage, true);
8687
+ return setItem();
8688
+ }).then(() => {
8689
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
8690
+ stateFromStorage = get();
8691
+ hasHydrated = true;
8692
+ finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
8693
+ }).catch((e) => {
8694
+ postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
8695
+ });
8696
+ };
8697
+ api.persist = {
8698
+ setOptions: (newOptions) => {
8699
+ options = {
8700
+ ...options,
8701
+ ...newOptions
8702
+ };
8703
+ if (newOptions.storage) {
8704
+ storage = newOptions.storage;
8705
+ }
8706
+ },
8707
+ clearStorage: () => {
8708
+ storage == null ? void 0 : storage.removeItem(options.name);
8709
+ },
8710
+ getOptions: () => options,
8711
+ rehydrate: () => hydrate(),
8712
+ hasHydrated: () => hasHydrated,
8713
+ onHydrate: (cb) => {
8714
+ hydrationListeners.add(cb);
8715
+ return () => {
8716
+ hydrationListeners.delete(cb);
8717
+ };
8718
+ },
8719
+ onFinishHydration: (cb) => {
8720
+ finishHydrationListeners.add(cb);
8721
+ return () => {
8722
+ finishHydrationListeners.delete(cb);
8723
+ };
8724
+ }
8725
+ };
8726
+ if (!options.skipHydration) {
8727
+ hydrate();
8728
+ }
8729
+ return stateFromStorage || configResult;
8730
+ };
8731
+ const persistImpl = (config, baseOptions) => {
8732
+ if ("getStorage" in baseOptions || "serialize" in baseOptions || "deserialize" in baseOptions) {
8733
+ if ((undefined ? undefined.MODE : void 0) !== "production") {
8734
+ console.warn(
8735
+ "[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."
8736
+ );
8737
+ }
8738
+ return oldImpl(config, baseOptions);
8739
+ }
8740
+ return newImpl(config, baseOptions);
8741
+ };
8742
+ const persist = persistImpl;
8743
+
8744
+ function useNumber(options, locale) {
8745
+ const layout = useLayout();
8746
+ const currentLocale = locale || layout.locale;
8747
+ const flatOptions = options ? Object.entries(options).map(_ref => {
8748
+ let [k, v] = _ref;
8749
+ return `${k}:${v}`;
8750
+ }).join('') : undefined;
8751
+ const formatter = reactExports.useMemo(() => {
8752
+ const formatter = new Intl.NumberFormat(currentLocale, options).format;
8753
+ return formatter;
8754
+ // eslint-disable-next-line react-hooks/exhaustive-deps
8755
+ }, [currentLocale, flatOptions]);
8756
+ return formatter;
8757
+ }
8758
+
8759
+ function useCurrency(currency, locale) {
8760
+ if (currency === void 0) {
8761
+ currency = 'EUR';
8762
+ }
8763
+ return useNumber({
8764
+ style: 'currency',
8765
+ currency,
8766
+ minimumFractionDigits: 2,
8767
+ maximumFractionDigits: 2
8768
+ }, locale);
8719
8769
  }
8720
8770
 
8721
8771
  /*
8722
- import { useCallback, useEffect, useRef } from 'react';
8772
+ import { useMemo } from 'react';
8773
+ import { useNumber } from '../useNumber/useNumber';
8774
+ import { useLayout } from '../useLayout/useLayout';
8723
8775
 
8724
- export function useMounted(): () => boolean {
8725
- const ref = useRef<boolean>(false);
8726
- const get = useCallback(() => ref.current, []);
8727
- useEffect(() => {
8728
- ref.current = true;
8729
- return () => {
8730
- ref.current = false;
8731
- };
8732
- }, []);
8733
- return get;
8776
+ export function useCurrency(currency: string = 'EUR', locale?: string): (value: number) => string {
8777
+ const layout = useLayout();
8778
+ const currentLocale = locale || layout.locale;
8779
+
8780
+ const formatter = useMemo(() => {
8781
+ const options = { style: 'currency', currency };
8782
+ const formatter = new Intl.NumberFormat(currentLocale, options).format;
8783
+ return formatter;
8784
+ }, [currency, currentLocale]);
8785
+
8786
+ return formatter;
8734
8787
  }
8788
+
8735
8789
  */
8736
8790
 
8737
- function useMounted() {
8738
- const [mounted, setMounted] = reactExports.useState(false);
8739
- reactExports.useEffect(() => {
8740
- setMounted(true);
8741
- }, []); // at init only
8742
- return mounted;
8743
- }
8791
+ /*
8792
+
8793
+ export function useCurrency(value: number, currency: string = 'EUR', locale?: string): string {
8794
+
8795
+ const layout = useLayout();
8796
+
8797
+ const currentLocale = locale || layout.locale;
8798
+
8799
+ return useMemo(() => {
8800
+ const options = { style: 'currency', currency };
8801
+ const formattedValue = new Intl.NumberFormat(currentLocale, options).format(value);
8802
+ return formattedValue;
8803
+ }, [value, currency, currentLocale]);
8804
+ }
8805
+
8806
+ */
8744
8807
 
8745
- const [usePage, PageContextProvider] = createGenericContext();
8746
- function PageProvider(_ref) {
8808
+ const [useExtra, ExtraContextProvider] = createGenericContext({});
8809
+ function ExtraProvider(_ref) {
8747
8810
  let {
8748
8811
  children,
8749
- page
8812
+ extra
8750
8813
  } = _ref;
8751
- // console.log('PageProvider.context', context);
8752
- return /*#__PURE__*/jsxRuntimeExports.jsx(PageContextProvider, {
8753
- value: page,
8814
+ return /*#__PURE__*/jsxRuntimeExports.jsx(ExtraContextProvider, {
8815
+ value: extra,
8754
8816
  children: children
8755
8817
  });
8756
8818
  }
8757
8819
 
8758
- const namespace = 'theme';
8759
- function usePortal(name, getContainer) {
8760
- if (name === void 0) {
8761
- name = getUID();
8820
+ function useFocusTrap(ref, options) {
8821
+ if (options === void 0) {
8822
+ options = {};
8762
8823
  }
8763
- const {
8764
- isBrowser
8765
- } = useSSR();
8766
- const id = `${namespace}-${name}`;
8767
- const [portal, setPortal] = reactExports.useState(isBrowser ? createElementWithId(id) : null);
8768
- reactExports.useEffect(() => {
8769
- const container = typeof getContainer === 'function' ? getContainer() : null;
8770
- const parentElement = container || document.body;
8771
- const element = parentElement.querySelector(`#${id}`) || createElementWithId(id);
8772
- if (!element.parentElement) {
8773
- parentElement.appendChild(element);
8824
+ const selectors = options.selectors || 'a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])';
8825
+ const [state, setState] = reactExports.useState(!options.disabled);
8826
+ useIsomorphicLayoutEffect$2(() => {
8827
+ const element = ref.current;
8828
+ if (element) {
8829
+ const elements = element.querySelectorAll(selectors);
8830
+ const first = elements[0];
8831
+ const last = elements[elements.length - 1];
8832
+ const onKeyDown = event => {
8833
+ // console.log(event.key, event.code, event.keyCode);
8834
+ const isTabPressed = event.key === 'Tab';
8835
+ if (!isTabPressed) {
8836
+ return;
8837
+ }
8838
+ if (event.shiftKey) {
8839
+ // shift + tab
8840
+ if (document.activeElement === first) {
8841
+ last.focus();
8842
+ event.preventDefault();
8843
+ }
8844
+ } else {
8845
+ // tab
8846
+ if (document.activeElement === last) {
8847
+ first.focus();
8848
+ event.preventDefault();
8849
+ }
8850
+ }
8851
+ };
8852
+ element.addEventListener('keydown', onKeyDown);
8853
+ return () => {
8854
+ element.removeEventListener('keydown', onKeyDown);
8855
+ };
8774
8856
  }
8775
- setPortal(element);
8776
- }, []);
8777
- return portal;
8778
- }
8779
- function createElementWithId(id) {
8780
- const element = document.createElement('div');
8781
- element.setAttribute('id', id);
8782
- return element;
8783
- }
8784
- function getUID() {
8785
- return Math.random().toString(32).slice(2, 10);
8786
- }
8787
-
8788
- /**
8789
- * @public
8790
- */
8791
- const MotionConfigContext = reactExports.createContext({
8792
- transformPagePoint: (p) => p,
8793
- isStatic: false,
8794
- reducedMotion: "never",
8795
- });
8796
-
8797
- const MotionContext = reactExports.createContext({});
8798
- function useVisualElementContext() {
8799
- return reactExports.useContext(MotionContext).visualElement;
8857
+ return () => {};
8858
+ }, [ref.current]);
8859
+ return [state, setState];
8800
8860
  }
8801
8861
 
8802
- /**
8803
- * @public
8862
+ /**
8863
+ * KeyBinding Codes
8864
+ * The content of this file is based on the design of the open source project "microsoft/vscode",
8865
+ * Copyright (c) Microsoft Corporation. All rights reserved.
8866
+ *
8867
+ * We inherit the KeyMod values from "microsoft/vscode",
8868
+ * but use the Browser's KeyboardEvent event implementation, and all values are used only as identification.
8804
8869
  */
8805
- const PresenceContext = reactExports.createContext(null);
8806
-
8807
- const isBrowser = typeof document !== "undefined";
8808
-
8809
- const useIsomorphicLayoutEffect$1 = isBrowser ? reactExports.useLayoutEffect : reactExports.useEffect;
8810
-
8811
- const LazyContext = reactExports.createContext({ strict: false });
8812
-
8813
- function useVisualElement(Component, visualState, props, createVisualElement) {
8814
- const parent = useVisualElementContext();
8815
- const lazyContext = reactExports.useContext(LazyContext);
8816
- const presenceContext = reactExports.useContext(PresenceContext);
8817
- const reducedMotionConfig = reactExports.useContext(MotionConfigContext).reducedMotion;
8818
- const visualElementRef = reactExports.useRef();
8819
- /**
8820
- * If we haven't preloaded a renderer, check to see if we have one lazy-loaded
8821
- */
8822
- createVisualElement = createVisualElement || lazyContext.renderer;
8823
- if (!visualElementRef.current && createVisualElement) {
8824
- visualElementRef.current = createVisualElement(Component, {
8825
- visualState,
8826
- parent,
8827
- props,
8828
- presenceId: presenceContext ? presenceContext.id : undefined,
8829
- blockInitialAnimation: presenceContext
8830
- ? presenceContext.initial === false
8831
- : false,
8832
- reducedMotionConfig,
8833
- });
8834
- }
8835
- const visualElement = visualElementRef.current;
8836
- useIsomorphicLayoutEffect$1(() => {
8837
- visualElement && visualElement.render();
8838
- });
8839
- /**
8840
- * If we have optimised appear animations to handoff from, trigger animateChanges
8841
- * from a synchronous useLayoutEffect to ensure there's no flash of incorrectly
8842
- * styled component in the event of a hydration error.
8843
- */
8844
- useIsomorphicLayoutEffect$1(() => {
8845
- if (visualElement && visualElement.animationState) {
8846
- visualElement.animationState.animateChanges();
8847
- }
8848
- });
8849
- useIsomorphicLayoutEffect$1(() => () => visualElement && visualElement.notify("Unmount"), []);
8850
- return visualElement;
8851
- }
8852
-
8853
- function isRefObject(ref) {
8854
- return (typeof ref === "object" &&
8855
- Object.prototype.hasOwnProperty.call(ref, "current"));
8856
- }
8857
8870
 
8858
- /**
8859
- * Creates a ref function that, when called, hydrates the provided
8860
- * external ref and VisualElement.
8861
- */
8862
- function useMotionRef(visualState, visualElement, externalRef) {
8863
- return reactExports.useCallback((instance) => {
8864
- instance && visualState.mount && visualState.mount(instance);
8865
- if (visualElement) {
8866
- instance
8867
- ? visualElement.mount(instance)
8868
- : visualElement.unmount();
8869
- }
8870
- if (externalRef) {
8871
- if (typeof externalRef === "function") {
8872
- externalRef(instance);
8873
- }
8874
- else if (isRefObject(externalRef)) {
8875
- externalRef.current = instance;
8876
- }
8877
- }
8878
- },
8879
- /**
8880
- * Only pass a new ref callback to React if we've received a visual element
8881
- * factory. Otherwise we'll be mounting/remounting every time externalRef
8882
- * or other dependencies change.
8883
- */
8884
- [visualElement]);
8885
- }
8871
+ let KeyCode = /*#__PURE__*/function (KeyCode) {
8872
+ KeyCode[KeyCode["Unknown"] = 0] = "Unknown";
8873
+ KeyCode[KeyCode["Backspace"] = 8] = "Backspace";
8874
+ KeyCode[KeyCode["Tab"] = 9] = "Tab";
8875
+ KeyCode[KeyCode["Enter"] = 13] = "Enter";
8876
+ KeyCode[KeyCode["Shift"] = 16] = "Shift";
8877
+ KeyCode[KeyCode["Ctrl"] = 17] = "Ctrl";
8878
+ KeyCode[KeyCode["Alt"] = 18] = "Alt";
8879
+ KeyCode[KeyCode["PauseBreak"] = 19] = "PauseBreak";
8880
+ KeyCode[KeyCode["CapsLock"] = 20] = "CapsLock";
8881
+ KeyCode[KeyCode["Escape"] = 27] = "Escape";
8882
+ KeyCode[KeyCode["Space"] = 32] = "Space";
8883
+ KeyCode[KeyCode["PageUp"] = 33] = "PageUp";
8884
+ KeyCode[KeyCode["PageDown"] = 34] = "PageDown";
8885
+ KeyCode[KeyCode["End"] = 35] = "End";
8886
+ KeyCode[KeyCode["Home"] = 36] = "Home";
8887
+ KeyCode[KeyCode["LeftArrow"] = 37] = "LeftArrow";
8888
+ KeyCode[KeyCode["UpArrow"] = 38] = "UpArrow";
8889
+ KeyCode[KeyCode["RightArrow"] = 39] = "RightArrow";
8890
+ KeyCode[KeyCode["DownArrow"] = 40] = "DownArrow";
8891
+ KeyCode[KeyCode["Insert"] = 45] = "Insert";
8892
+ KeyCode[KeyCode["Delete"] = 46] = "Delete";
8893
+ KeyCode[KeyCode["KEY_0"] = 48] = "KEY_0";
8894
+ KeyCode[KeyCode["KEY_1"] = 49] = "KEY_1";
8895
+ KeyCode[KeyCode["KEY_2"] = 50] = "KEY_2";
8896
+ KeyCode[KeyCode["KEY_3"] = 51] = "KEY_3";
8897
+ KeyCode[KeyCode["KEY_4"] = 52] = "KEY_4";
8898
+ KeyCode[KeyCode["KEY_5"] = 53] = "KEY_5";
8899
+ KeyCode[KeyCode["KEY_6"] = 54] = "KEY_6";
8900
+ KeyCode[KeyCode["KEY_7"] = 55] = "KEY_7";
8901
+ KeyCode[KeyCode["KEY_8"] = 56] = "KEY_8";
8902
+ KeyCode[KeyCode["KEY_9"] = 57] = "KEY_9";
8903
+ KeyCode[KeyCode["KEY_A"] = 65] = "KEY_A";
8904
+ KeyCode[KeyCode["KEY_B"] = 66] = "KEY_B";
8905
+ KeyCode[KeyCode["KEY_C"] = 67] = "KEY_C";
8906
+ KeyCode[KeyCode["KEY_D"] = 68] = "KEY_D";
8907
+ KeyCode[KeyCode["KEY_E"] = 69] = "KEY_E";
8908
+ KeyCode[KeyCode["KEY_F"] = 70] = "KEY_F";
8909
+ KeyCode[KeyCode["KEY_G"] = 71] = "KEY_G";
8910
+ KeyCode[KeyCode["KEY_H"] = 72] = "KEY_H";
8911
+ KeyCode[KeyCode["KEY_I"] = 73] = "KEY_I";
8912
+ KeyCode[KeyCode["KEY_J"] = 74] = "KEY_J";
8913
+ KeyCode[KeyCode["KEY_K"] = 75] = "KEY_K";
8914
+ KeyCode[KeyCode["KEY_L"] = 76] = "KEY_L";
8915
+ KeyCode[KeyCode["KEY_M"] = 77] = "KEY_M";
8916
+ KeyCode[KeyCode["KEY_N"] = 78] = "KEY_N";
8917
+ KeyCode[KeyCode["KEY_O"] = 79] = "KEY_O";
8918
+ KeyCode[KeyCode["KEY_P"] = 80] = "KEY_P";
8919
+ KeyCode[KeyCode["KEY_Q"] = 81] = "KEY_Q";
8920
+ KeyCode[KeyCode["KEY_R"] = 82] = "KEY_R";
8921
+ KeyCode[KeyCode["KEY_S"] = 83] = "KEY_S";
8922
+ KeyCode[KeyCode["KEY_T"] = 84] = "KEY_T";
8923
+ KeyCode[KeyCode["KEY_U"] = 85] = "KEY_U";
8924
+ KeyCode[KeyCode["KEY_V"] = 86] = "KEY_V";
8925
+ KeyCode[KeyCode["KEY_W"] = 87] = "KEY_W";
8926
+ KeyCode[KeyCode["KEY_X"] = 88] = "KEY_X";
8927
+ KeyCode[KeyCode["KEY_Y"] = 89] = "KEY_Y";
8928
+ KeyCode[KeyCode["KEY_Z"] = 90] = "KEY_Z";
8929
+ KeyCode[KeyCode["Meta"] = 91] = "Meta";
8930
+ KeyCode[KeyCode["F1"] = 112] = "F1";
8931
+ KeyCode[KeyCode["F2"] = 113] = "F2";
8932
+ KeyCode[KeyCode["F3"] = 114] = "F3";
8933
+ KeyCode[KeyCode["F4"] = 115] = "F4";
8934
+ KeyCode[KeyCode["F5"] = 116] = "F5";
8935
+ KeyCode[KeyCode["F6"] = 117] = "F6";
8936
+ KeyCode[KeyCode["F7"] = 118] = "F7";
8937
+ KeyCode[KeyCode["F8"] = 119] = "F8";
8938
+ KeyCode[KeyCode["F9"] = 120] = "F9";
8939
+ KeyCode[KeyCode["F10"] = 121] = "F10";
8940
+ KeyCode[KeyCode["F11"] = 122] = "F11";
8941
+ KeyCode[KeyCode["F12"] = 123] = "F12";
8942
+ KeyCode[KeyCode["NumLock"] = 144] = "NumLock";
8943
+ KeyCode[KeyCode["ScrollLock"] = 145] = "ScrollLock";
8944
+ KeyCode[KeyCode["Equal"] = 187] = "Equal";
8945
+ KeyCode[KeyCode["Minus"] = 189] = "Minus";
8946
+ KeyCode[KeyCode["Backquote"] = 192] = "Backquote";
8947
+ KeyCode[KeyCode["Backslash"] = 220] = "Backslash";
8948
+ return KeyCode;
8949
+ }({});
8950
+ let KeyMod = /*#__PURE__*/function (KeyMod) {
8951
+ KeyMod[KeyMod["CtrlCmd"] = 2048] = "CtrlCmd";
8952
+ KeyMod[KeyMod["Shift"] = 1024] = "Shift";
8953
+ KeyMod[KeyMod["Alt"] = 512] = "Alt";
8954
+ KeyMod[KeyMod["WinCtrl"] = 256] = "WinCtrl";
8955
+ return KeyMod;
8956
+ }({});
8886
8957
 
8887
- /**
8888
- * Decides if the supplied variable is variant label
8889
- */
8890
- function isVariantLabel(v) {
8891
- return typeof v === "string" || Array.isArray(v);
8958
+ const detectIsBrowser = () => {
8959
+ return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
8960
+ };
8961
+ function useSSR() {
8962
+ const [browser, setBrowser] = reactExports.useState(false);
8963
+ reactExports.useEffect(() => {
8964
+ setBrowser(detectIsBrowser());
8965
+ }, []);
8966
+ return {
8967
+ isBrowser: browser,
8968
+ isServer: !browser
8969
+ };
8892
8970
  }
8893
8971
 
8894
- function isAnimationControls(v) {
8895
- return typeof v === "object" && typeof v.start === "function";
8972
+ function getCtrlKeysByPlatform() {
8973
+ return {
8974
+ CtrlCmd: isMac() ? 'metaKey' : 'ctrlKey',
8975
+ WinCtrl: isMac() ? 'ctrlKey' : 'metaKey'
8976
+ };
8896
8977
  }
8897
-
8898
- const variantProps$1 = [
8899
- "initial",
8900
- "animate",
8901
- "exit",
8902
- "whileHover",
8903
- "whileDrag",
8904
- "whileTap",
8905
- "whileFocus",
8906
- "whileInView",
8907
- ];
8908
- function isControllingVariants(props) {
8909
- return (isAnimationControls(props.animate) ||
8910
- variantProps$1.some((name) => isVariantLabel(props[name])));
8978
+ function getActiveModMap(bindings) {
8979
+ const modBindings = bindings.filter(item => !!KeyMod[item]);
8980
+ const activeModMap = {
8981
+ CtrlCmd: false,
8982
+ Shift: false,
8983
+ Alt: false,
8984
+ WinCtrl: false
8985
+ };
8986
+ modBindings.forEach(code => {
8987
+ const modKey = KeyMod[code];
8988
+ activeModMap[modKey] = true;
8989
+ });
8990
+ return activeModMap;
8911
8991
  }
8912
- function isVariantNode(props) {
8913
- return Boolean(isControllingVariants(props) || props.variants);
8992
+ function isMac() {
8993
+ if (!detectIsBrowser()) {
8994
+ return false;
8995
+ }
8996
+ return navigator.platform.toUpperCase().indexOf('MAC') >= 0;
8914
8997
  }
8915
8998
 
8916
- function getCurrentTreeVariants(props, context) {
8917
- if (isControllingVariants(props)) {
8918
- const { initial, animate } = props;
8919
- return {
8920
- initial: initial === false || isVariantLabel(initial)
8921
- ? initial
8922
- : undefined,
8923
- animate: isVariantLabel(animate) ? animate : undefined,
8924
- };
8999
+ const useKeyboard = function (handler, keyBindings, options) {
9000
+ if (options === void 0) {
9001
+ options = {};
9002
+ }
9003
+ const bindings = Array.isArray(keyBindings) ? keyBindings : [keyBindings];
9004
+ const {
9005
+ disableGlobalEvent = false,
9006
+ capture = false,
9007
+ stopPropagation = false,
9008
+ preventDefault = true,
9009
+ event = 'keydown'
9010
+ } = options;
9011
+ const activeModMap = getActiveModMap(bindings);
9012
+ const keyCode = bindings.filter(item => !KeyMod[item]);
9013
+ const {
9014
+ CtrlCmd,
9015
+ WinCtrl
9016
+ } = getCtrlKeysByPlatform();
9017
+ const eventHandler = event => {
9018
+ if (activeModMap.Shift && !event.shiftKey) return;
9019
+ if (activeModMap.Alt && !event.altKey) return;
9020
+ if (activeModMap.CtrlCmd && !event[CtrlCmd]) return;
9021
+ if (activeModMap.WinCtrl && !event[WinCtrl]) return;
9022
+ const hitOne = keyCode.find(k => k === event.keyCode);
9023
+ if (keyCode && !hitOne) return;
9024
+ if (stopPropagation) {
9025
+ event.stopPropagation();
8925
9026
  }
8926
- return props.inherit !== false ? context : {};
8927
- }
9027
+ if (preventDefault) {
9028
+ event.preventDefault();
9029
+ }
9030
+ handler && handler(event);
9031
+ };
9032
+ reactExports.useEffect(() => {
9033
+ if (!disableGlobalEvent) {
9034
+ document.addEventListener(event, eventHandler);
9035
+ }
9036
+ return () => {
9037
+ document.removeEventListener(event, eventHandler);
9038
+ };
9039
+ }, [disableGlobalEvent]);
9040
+ const elementBindingHandler = function (elementEventType, isCapture) {
9041
+ if (isCapture === void 0) {
9042
+ isCapture = false;
9043
+ }
9044
+ if (elementEventType !== event) return () => {};
9045
+ if (isCapture !== capture) return () => {};
9046
+ return e => eventHandler(e);
9047
+ };
9048
+ return {
9049
+ bindings: {
9050
+ onKeyDown: elementBindingHandler('keydown'),
9051
+ onKeyDownCapture: elementBindingHandler('keydown', true),
9052
+ onKeyPress: elementBindingHandler('keypress'),
9053
+ onKeyPressCapture: elementBindingHandler('keypress', true),
9054
+ onKeyUp: elementBindingHandler('keyup'),
9055
+ onKeyUpCapture: elementBindingHandler('keyup', true)
9056
+ }
9057
+ };
9058
+ };
8928
9059
 
8929
- function useCreateMotionContext(props) {
8930
- const { initial, animate } = getCurrentTreeVariants(props, reactExports.useContext(MotionContext));
8931
- return reactExports.useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
9060
+ const [useLabel, LabelContextProvider] = createGenericContext();
9061
+ function LabelProvider(_ref) {
9062
+ let {
9063
+ children
9064
+ } = _ref;
9065
+ const {
9066
+ labels
9067
+ } = useLayout();
9068
+ // console.log('LabelProvider', labels);
9069
+ const labelService = new LabelService(labels);
9070
+ const getLabel = (key, params) => {
9071
+ return labelService.getLabel(key, params);
9072
+ };
9073
+ return /*#__PURE__*/jsxRuntimeExports.jsx(LabelContextProvider, {
9074
+ value: getLabel,
9075
+ children: children
9076
+ });
8932
9077
  }
8933
- function variantLabelsAsDependency(prop) {
8934
- return Array.isArray(prop) ? prop.join(" ") : prop;
9078
+ class LabelService {
9079
+ constructor(labels) {
9080
+ this.labels = labels;
9081
+ this.dictionary = Object.fromEntries(labels.map(l => [l.id, l.text]));
9082
+ }
9083
+ getLabel(key, params) {
9084
+ return parseLabel(this.dictionary, key, params);
9085
+ }
9086
+ }
9087
+ function parseLabel(dictionary, key, params) {
9088
+ const label = dictionary[key] != null ? dictionary[key] : key;
9089
+ if (params) {
9090
+ return parseParams(label, params);
9091
+ }
9092
+ return label;
9093
+ }
9094
+ function parseParams(label, params) {
9095
+ const TEMPLATE_REGEXP = /@(\w+)/g;
9096
+ return label.replace(TEMPLATE_REGEXP, (text, key) => {
9097
+ const replacer = params[key];
9098
+ return typeof replacer !== 'undefined' ? String(replacer) : text;
9099
+ });
8935
9100
  }
8936
9101
 
8937
- const createDefinition = (propNames) => ({
8938
- isEnabled: (props) => propNames.some((name) => !!props[name]),
8939
- });
8940
- const featureDefinitions = {
8941
- measureLayout: createDefinition(["layout", "layoutId", "drag"]),
8942
- animation: createDefinition([
8943
- "animate",
8944
- "exit",
8945
- "variants",
8946
- "whileHover",
8947
- "whileTap",
8948
- "whileFocus",
8949
- "whileDrag",
8950
- "whileInView",
8951
- ]),
8952
- exit: createDefinition(["exit"]),
8953
- drag: createDefinition(["drag", "dragControls"]),
8954
- focus: createDefinition(["whileFocus"]),
8955
- hover: createDefinition(["whileHover", "onHoverStart", "onHoverEnd"]),
8956
- tap: createDefinition(["whileTap", "onTap", "onTapStart", "onTapCancel"]),
8957
- pan: createDefinition([
8958
- "onPan",
8959
- "onPanStart",
8960
- "onPanSessionStart",
8961
- "onPanEnd",
8962
- ]),
8963
- inView: createDefinition([
8964
- "whileInView",
8965
- "onViewportEnter",
8966
- "onViewportLeave",
8967
- ]),
8968
- };
9102
+ /*
9103
+ import { useCallback, useEffect, useRef } from 'react';
9104
+
9105
+ export function useMounted(): () => boolean {
9106
+ const ref = useRef<boolean>(false);
9107
+ const get = useCallback(() => ref.current, []);
9108
+ useEffect(() => {
9109
+ ref.current = true;
9110
+ return () => {
9111
+ ref.current = false;
9112
+ };
9113
+ }, []);
9114
+ return get;
9115
+ }
9116
+ */
8969
9117
 
8970
- function loadFeatures(features) {
8971
- for (const key in features) {
8972
- if (key === "projectionNodeConstructor") {
8973
- featureDefinitions.projectionNodeConstructor = features[key];
8974
- }
8975
- else {
8976
- featureDefinitions[key].Component = features[key];
8977
- }
9118
+ function useMounted() {
9119
+ const [mounted, setMounted] = reactExports.useState(false);
9120
+ reactExports.useEffect(() => {
9121
+ setMounted(true);
9122
+ }, []); // at init only
9123
+ return mounted;
9124
+ }
9125
+
9126
+ const [usePage, PageContextProvider] = createGenericContext();
9127
+ function PageProvider(_ref) {
9128
+ let {
9129
+ children,
9130
+ page
9131
+ } = _ref;
9132
+ return /*#__PURE__*/jsxRuntimeExports.jsx(PageContextProvider, {
9133
+ value: page,
9134
+ children: children
9135
+ });
9136
+ }
9137
+
9138
+ const namespace = 'theme';
9139
+ function usePortal(name, getContainer) {
9140
+ if (name === void 0) {
9141
+ name = getUID();
9142
+ }
9143
+ const {
9144
+ isBrowser
9145
+ } = useSSR();
9146
+ const id = `${namespace}-${name}`;
9147
+ const [portal, setPortal] = reactExports.useState(isBrowser ? createElementWithId(id) : null);
9148
+ reactExports.useEffect(() => {
9149
+ const container = typeof getContainer === 'function' ? getContainer() : null;
9150
+ const parentElement = container || document.body;
9151
+ const element = parentElement.querySelector(`#${id}`) || createElementWithId(id);
9152
+ if (!element.parentElement) {
9153
+ parentElement.appendChild(element);
8978
9154
  }
9155
+ setPortal(element);
9156
+ }, []);
9157
+ return portal;
9158
+ }
9159
+ function createElementWithId(id) {
9160
+ const element = document.createElement('div');
9161
+ element.setAttribute('id', id);
9162
+ return element;
9163
+ }
9164
+ function getUID() {
9165
+ return Math.random().toString(32).slice(2, 10);
8979
9166
  }
8980
9167
 
8981
9168
  /**
8982
- * Creates a constant value over the lifecycle of a component.
8983
- *
8984
- * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer
8985
- * a guarantee that it won't re-run for performance reasons later on. By using `useConstant`
8986
- * you can ensure that initialisers don't execute twice or more.
9169
+ * @public
8987
9170
  */
8988
- function useConstant(init) {
8989
- const ref = reactExports.useRef(null);
8990
- if (ref.current === null) {
8991
- ref.current = init();
8992
- }
8993
- return ref.current;
9171
+ const MotionConfigContext = reactExports.createContext({
9172
+ transformPagePoint: (p) => p,
9173
+ isStatic: false,
9174
+ reducedMotion: "never",
9175
+ });
9176
+
9177
+ const MotionContext = reactExports.createContext({});
9178
+ function useVisualElementContext() {
9179
+ return reactExports.useContext(MotionContext).visualElement;
8994
9180
  }
8995
9181
 
8996
9182
  /**
8997
- * This should only ever be modified on the client otherwise it'll
8998
- * persist through server requests. If we need instanced states we
8999
- * could lazy-init via root.
9183
+ * @public
9000
9184
  */
9001
- const globalProjectionState = {
9185
+ const PresenceContext = reactExports.createContext(null);
9186
+
9187
+ const isBrowser = typeof document !== "undefined";
9188
+
9189
+ const useIsomorphicLayoutEffect$1 = isBrowser ? reactExports.useLayoutEffect : reactExports.useEffect;
9190
+
9191
+ const LazyContext = reactExports.createContext({ strict: false });
9192
+
9193
+ function useVisualElement(Component, visualState, props, createVisualElement) {
9194
+ const parent = useVisualElementContext();
9195
+ const lazyContext = reactExports.useContext(LazyContext);
9196
+ const presenceContext = reactExports.useContext(PresenceContext);
9197
+ const reducedMotionConfig = reactExports.useContext(MotionConfigContext).reducedMotion;
9198
+ const visualElementRef = reactExports.useRef();
9002
9199
  /**
9003
- * Global flag as to whether the tree has animated since the last time
9004
- * we resized the window
9200
+ * If we haven't preloaded a renderer, check to see if we have one lazy-loaded
9201
+ */
9202
+ createVisualElement = createVisualElement || lazyContext.renderer;
9203
+ if (!visualElementRef.current && createVisualElement) {
9204
+ visualElementRef.current = createVisualElement(Component, {
9205
+ visualState,
9206
+ parent,
9207
+ props,
9208
+ presenceId: presenceContext ? presenceContext.id : undefined,
9209
+ blockInitialAnimation: presenceContext
9210
+ ? presenceContext.initial === false
9211
+ : false,
9212
+ reducedMotionConfig,
9213
+ });
9214
+ }
9215
+ const visualElement = visualElementRef.current;
9216
+ useIsomorphicLayoutEffect$1(() => {
9217
+ visualElement && visualElement.render();
9218
+ });
9219
+ /**
9220
+ * If we have optimised appear animations to handoff from, trigger animateChanges
9221
+ * from a synchronous useLayoutEffect to ensure there's no flash of incorrectly
9222
+ * styled component in the event of a hydration error.
9223
+ */
9224
+ useIsomorphicLayoutEffect$1(() => {
9225
+ if (visualElement && visualElement.animationState) {
9226
+ visualElement.animationState.animateChanges();
9227
+ }
9228
+ });
9229
+ useIsomorphicLayoutEffect$1(() => () => visualElement && visualElement.notify("Unmount"), []);
9230
+ return visualElement;
9231
+ }
9232
+
9233
+ function isRefObject(ref) {
9234
+ return (typeof ref === "object" &&
9235
+ Object.prototype.hasOwnProperty.call(ref, "current"));
9236
+ }
9237
+
9238
+ /**
9239
+ * Creates a ref function that, when called, hydrates the provided
9240
+ * external ref and VisualElement.
9241
+ */
9242
+ function useMotionRef(visualState, visualElement, externalRef) {
9243
+ return reactExports.useCallback((instance) => {
9244
+ instance && visualState.mount && visualState.mount(instance);
9245
+ if (visualElement) {
9246
+ instance
9247
+ ? visualElement.mount(instance)
9248
+ : visualElement.unmount();
9249
+ }
9250
+ if (externalRef) {
9251
+ if (typeof externalRef === "function") {
9252
+ externalRef(instance);
9253
+ }
9254
+ else if (isRefObject(externalRef)) {
9255
+ externalRef.current = instance;
9256
+ }
9257
+ }
9258
+ },
9259
+ /**
9260
+ * Only pass a new ref callback to React if we've received a visual element
9261
+ * factory. Otherwise we'll be mounting/remounting every time externalRef
9262
+ * or other dependencies change.
9263
+ */
9264
+ [visualElement]);
9265
+ }
9266
+
9267
+ /**
9268
+ * Decides if the supplied variable is variant label
9269
+ */
9270
+ function isVariantLabel(v) {
9271
+ return typeof v === "string" || Array.isArray(v);
9272
+ }
9273
+
9274
+ function isAnimationControls(v) {
9275
+ return typeof v === "object" && typeof v.start === "function";
9276
+ }
9277
+
9278
+ const variantProps$1 = [
9279
+ "initial",
9280
+ "animate",
9281
+ "exit",
9282
+ "whileHover",
9283
+ "whileDrag",
9284
+ "whileTap",
9285
+ "whileFocus",
9286
+ "whileInView",
9287
+ ];
9288
+ function isControllingVariants(props) {
9289
+ return (isAnimationControls(props.animate) ||
9290
+ variantProps$1.some((name) => isVariantLabel(props[name])));
9291
+ }
9292
+ function isVariantNode(props) {
9293
+ return Boolean(isControllingVariants(props) || props.variants);
9294
+ }
9295
+
9296
+ function getCurrentTreeVariants(props, context) {
9297
+ if (isControllingVariants(props)) {
9298
+ const { initial, animate } = props;
9299
+ return {
9300
+ initial: initial === false || isVariantLabel(initial)
9301
+ ? initial
9302
+ : undefined,
9303
+ animate: isVariantLabel(animate) ? animate : undefined,
9304
+ };
9305
+ }
9306
+ return props.inherit !== false ? context : {};
9307
+ }
9308
+
9309
+ function useCreateMotionContext(props) {
9310
+ const { initial, animate } = getCurrentTreeVariants(props, reactExports.useContext(MotionContext));
9311
+ return reactExports.useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
9312
+ }
9313
+ function variantLabelsAsDependency(prop) {
9314
+ return Array.isArray(prop) ? prop.join(" ") : prop;
9315
+ }
9316
+
9317
+ const createDefinition = (propNames) => ({
9318
+ isEnabled: (props) => propNames.some((name) => !!props[name]),
9319
+ });
9320
+ const featureDefinitions = {
9321
+ measureLayout: createDefinition(["layout", "layoutId", "drag"]),
9322
+ animation: createDefinition([
9323
+ "animate",
9324
+ "exit",
9325
+ "variants",
9326
+ "whileHover",
9327
+ "whileTap",
9328
+ "whileFocus",
9329
+ "whileDrag",
9330
+ "whileInView",
9331
+ ]),
9332
+ exit: createDefinition(["exit"]),
9333
+ drag: createDefinition(["drag", "dragControls"]),
9334
+ focus: createDefinition(["whileFocus"]),
9335
+ hover: createDefinition(["whileHover", "onHoverStart", "onHoverEnd"]),
9336
+ tap: createDefinition(["whileTap", "onTap", "onTapStart", "onTapCancel"]),
9337
+ pan: createDefinition([
9338
+ "onPan",
9339
+ "onPanStart",
9340
+ "onPanSessionStart",
9341
+ "onPanEnd",
9342
+ ]),
9343
+ inView: createDefinition([
9344
+ "whileInView",
9345
+ "onViewportEnter",
9346
+ "onViewportLeave",
9347
+ ]),
9348
+ };
9349
+
9350
+ function loadFeatures(features) {
9351
+ for (const key in features) {
9352
+ if (key === "projectionNodeConstructor") {
9353
+ featureDefinitions.projectionNodeConstructor = features[key];
9354
+ }
9355
+ else {
9356
+ featureDefinitions[key].Component = features[key];
9357
+ }
9358
+ }
9359
+ }
9360
+
9361
+ /**
9362
+ * Creates a constant value over the lifecycle of a component.
9363
+ *
9364
+ * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer
9365
+ * a guarantee that it won't re-run for performance reasons later on. By using `useConstant`
9366
+ * you can ensure that initialisers don't execute twice or more.
9367
+ */
9368
+ function useConstant(init) {
9369
+ const ref = reactExports.useRef(null);
9370
+ if (ref.current === null) {
9371
+ ref.current = init();
9372
+ }
9373
+ return ref.current;
9374
+ }
9375
+
9376
+ /**
9377
+ * This should only ever be modified on the client otherwise it'll
9378
+ * persist through server requests. If we need instanced states we
9379
+ * could lazy-init via root.
9380
+ */
9381
+ const globalProjectionState = {
9382
+ /**
9383
+ * Global flag as to whether the tree has animated since the last time
9384
+ * we resized the window
9005
9385
  */
9006
9386
  hasAnimatedSinceResize: true,
9007
9387
  /**
@@ -17315,448 +17695,118 @@
17315
17695
  * animate={{ opacity: 1 }}
17316
17696
  * exit={{ opacity: 0 }}
17317
17697
  * />
17318
- * ))}
17319
- * </AnimatePresence>
17320
- * )
17321
- * ```
17322
- *
17323
- * You can sequence exit animations throughout a tree using variants.
17324
- *
17325
- * If a child contains multiple `motion` components with `exit` props, it will only unmount the child
17326
- * once all `motion` components have finished animating out. Likewise, any components using
17327
- * `usePresence` all need to call `safeToRemove`.
17328
- *
17329
- * @public
17330
- */
17331
- const AnimatePresence = ({ children, custom, initial = true, onExitComplete, exitBeforeEnter, presenceAffectsLayout = true, mode = "sync", }) => {
17332
- // Support deprecated exitBeforeEnter prop
17333
- if (exitBeforeEnter) {
17334
- mode = "wait";
17335
- warnOnce(false, "Replace exitBeforeEnter with mode='wait'");
17336
- }
17337
- // We want to force a re-render once all exiting animations have finished. We
17338
- // either use a local forceRender function, or one from a parent context if it exists.
17339
- let [forceRender] = useForceUpdate();
17340
- const forceRenderLayoutGroup = reactExports.useContext(LayoutGroupContext).forceRender;
17341
- if (forceRenderLayoutGroup)
17342
- forceRender = forceRenderLayoutGroup;
17343
- const isMounted = useIsMounted();
17344
- // Filter out any children that aren't ReactElements. We can only track ReactElements with a props.key
17345
- const filteredChildren = onlyElements(children);
17346
- let childrenToRender = filteredChildren;
17347
- const exiting = new Set();
17348
- // Keep a living record of the children we're actually rendering so we
17349
- // can diff to figure out which are entering and exiting
17350
- const presentChildren = reactExports.useRef(childrenToRender);
17351
- // A lookup table to quickly reference components by key
17352
- const allChildren = reactExports.useRef(new Map()).current;
17353
- // If this is the initial component render, just deal with logic surrounding whether
17354
- // we play onMount animations or not.
17355
- const isInitialRender = reactExports.useRef(true);
17356
- useIsomorphicLayoutEffect$1(() => {
17357
- isInitialRender.current = false;
17358
- updateChildLookup(filteredChildren, allChildren);
17359
- presentChildren.current = childrenToRender;
17360
- });
17361
- useUnmountEffect(() => {
17362
- isInitialRender.current = true;
17363
- allChildren.clear();
17364
- exiting.clear();
17365
- });
17366
- if (isInitialRender.current) {
17367
- return (reactExports.createElement(reactExports.Fragment, null, childrenToRender.map((child) => (reactExports.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, initial: initial ? undefined : false, presenceAffectsLayout: presenceAffectsLayout, mode: mode }, child)))));
17368
- }
17369
- // If this is a subsequent render, deal with entering and exiting children
17370
- childrenToRender = [...childrenToRender];
17371
- // Diff the keys of the currently-present and target children to update our
17372
- // exiting list.
17373
- const presentKeys = presentChildren.current.map(getChildKey);
17374
- const targetKeys = filteredChildren.map(getChildKey);
17375
- // Diff the present children with our target children and mark those that are exiting
17376
- const numPresent = presentKeys.length;
17377
- for (let i = 0; i < numPresent; i++) {
17378
- const key = presentKeys[i];
17379
- if (targetKeys.indexOf(key) === -1) {
17380
- exiting.add(key);
17381
- }
17382
- }
17383
- // If we currently have exiting children, and we're deferring rendering incoming children
17384
- // until after all current children have exiting, empty the childrenToRender array
17385
- if (mode === "wait" && exiting.size) {
17386
- childrenToRender = [];
17387
- }
17388
- // Loop through all currently exiting components and clone them to overwrite `animate`
17389
- // with any `exit` prop they might have defined.
17390
- exiting.forEach((key) => {
17391
- // If this component is actually entering again, early return
17392
- if (targetKeys.indexOf(key) !== -1)
17393
- return;
17394
- const child = allChildren.get(key);
17395
- if (!child)
17396
- return;
17397
- const insertionIndex = presentKeys.indexOf(key);
17398
- const onExit = () => {
17399
- allChildren.delete(key);
17400
- exiting.delete(key);
17401
- // Remove this child from the present children
17402
- const removeIndex = presentChildren.current.findIndex((presentChild) => presentChild.key === key);
17403
- presentChildren.current.splice(removeIndex, 1);
17404
- // Defer re-rendering until all exiting children have indeed left
17405
- if (!exiting.size) {
17406
- presentChildren.current = filteredChildren;
17407
- if (isMounted.current === false)
17408
- return;
17409
- forceRender();
17410
- onExitComplete && onExitComplete();
17411
- }
17412
- };
17413
- childrenToRender.splice(insertionIndex, 0, reactExports.createElement(PresenceChild, { key: getChildKey(child), isPresent: false, onExitComplete: onExit, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode }, child));
17414
- });
17415
- // Add `MotionContext` even to children that don't need it to ensure we're rendering
17416
- // the same tree between renders
17417
- childrenToRender = childrenToRender.map((child) => {
17418
- const key = child.key;
17419
- return exiting.has(key) ? (child) : (reactExports.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, presenceAffectsLayout: presenceAffectsLayout, mode: mode }, child));
17420
- });
17421
- if (env !== "production" &&
17422
- mode === "wait" &&
17423
- childrenToRender.length > 1) {
17424
- console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
17425
- }
17426
- return (reactExports.createElement(reactExports.Fragment, null, exiting.size
17427
- ? childrenToRender
17428
- : childrenToRender.map((child) => reactExports.cloneElement(child))));
17429
- };
17430
-
17431
- function createJSONStorage(getStorage, options) {
17432
- let storage;
17433
- try {
17434
- storage = getStorage();
17435
- } catch (e) {
17436
- return;
17437
- }
17438
- const persistStorage = {
17439
- getItem: (name) => {
17440
- var _a;
17441
- const parse = (str2) => {
17442
- if (str2 === null) {
17443
- return null;
17444
- }
17445
- return JSON.parse(str2, options == null ? void 0 : options.reviver);
17446
- };
17447
- const str = (_a = storage.getItem(name)) != null ? _a : null;
17448
- if (str instanceof Promise) {
17449
- return str.then(parse);
17450
- }
17451
- return parse(str);
17452
- },
17453
- setItem: (name, newValue) => storage.setItem(
17454
- name,
17455
- JSON.stringify(newValue, options == null ? void 0 : options.replacer)
17456
- ),
17457
- removeItem: (name) => storage.removeItem(name)
17458
- };
17459
- return persistStorage;
17460
- }
17461
- const toThenable = (fn) => (input) => {
17462
- try {
17463
- const result = fn(input);
17464
- if (result instanceof Promise) {
17465
- return result;
17466
- }
17467
- return {
17468
- then(onFulfilled) {
17469
- return toThenable(onFulfilled)(result);
17470
- },
17471
- catch(_onRejected) {
17472
- return this;
17473
- }
17474
- };
17475
- } catch (e) {
17476
- return {
17477
- then(_onFulfilled) {
17478
- return this;
17479
- },
17480
- catch(onRejected) {
17481
- return toThenable(onRejected)(e);
17482
- }
17483
- };
17484
- }
17485
- };
17486
- const oldImpl = (config, baseOptions) => (set, get, api) => {
17487
- let options = {
17488
- getStorage: () => localStorage,
17489
- serialize: JSON.stringify,
17490
- deserialize: JSON.parse,
17491
- partialize: (state) => state,
17492
- version: 0,
17493
- merge: (persistedState, currentState) => ({
17494
- ...currentState,
17495
- ...persistedState
17496
- }),
17497
- ...baseOptions
17498
- };
17499
- let hasHydrated = false;
17500
- const hydrationListeners = /* @__PURE__ */ new Set();
17501
- const finishHydrationListeners = /* @__PURE__ */ new Set();
17502
- let storage;
17503
- try {
17504
- storage = options.getStorage();
17505
- } catch (e) {
17506
- }
17507
- if (!storage) {
17508
- return config(
17509
- (...args) => {
17510
- console.warn(
17511
- `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
17512
- );
17513
- set(...args);
17514
- },
17515
- get,
17516
- api
17517
- );
17518
- }
17519
- const thenableSerialize = toThenable(options.serialize);
17520
- const setItem = () => {
17521
- const state = options.partialize({ ...get() });
17522
- let errorInSync;
17523
- const thenable = thenableSerialize({ state, version: options.version }).then(
17524
- (serializedValue) => storage.setItem(options.name, serializedValue)
17525
- ).catch((e) => {
17526
- errorInSync = e;
17527
- });
17528
- if (errorInSync) {
17529
- throw errorInSync;
17530
- }
17531
- return thenable;
17532
- };
17533
- const savedSetState = api.setState;
17534
- api.setState = (state, replace) => {
17535
- savedSetState(state, replace);
17536
- void setItem();
17537
- };
17538
- const configResult = config(
17539
- (...args) => {
17540
- set(...args);
17541
- void setItem();
17542
- },
17543
- get,
17544
- api
17545
- );
17546
- let stateFromStorage;
17547
- const hydrate = () => {
17548
- var _a;
17549
- if (!storage)
17550
- return;
17551
- hasHydrated = false;
17552
- hydrationListeners.forEach((cb) => cb(get()));
17553
- const postRehydrationCallback = ((_a = options.onRehydrateStorage) == null ? void 0 : _a.call(options, get())) || void 0;
17554
- return toThenable(storage.getItem.bind(storage))(options.name).then((storageValue) => {
17555
- if (storageValue) {
17556
- return options.deserialize(storageValue);
17557
- }
17558
- }).then((deserializedStorageValue) => {
17559
- if (deserializedStorageValue) {
17560
- if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
17561
- if (options.migrate) {
17562
- return options.migrate(
17563
- deserializedStorageValue.state,
17564
- deserializedStorageValue.version
17565
- );
17566
- }
17567
- console.error(
17568
- `State loaded from storage couldn't be migrated since no migrate function was provided`
17569
- );
17570
- } else {
17571
- return deserializedStorageValue.state;
17572
- }
17573
- }
17574
- }).then((migratedState) => {
17575
- var _a2;
17576
- stateFromStorage = options.merge(
17577
- migratedState,
17578
- (_a2 = get()) != null ? _a2 : configResult
17579
- );
17580
- set(stateFromStorage, true);
17581
- return setItem();
17582
- }).then(() => {
17583
- postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
17584
- hasHydrated = true;
17585
- finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
17586
- }).catch((e) => {
17587
- postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
17588
- });
17589
- };
17590
- api.persist = {
17591
- setOptions: (newOptions) => {
17592
- options = {
17593
- ...options,
17594
- ...newOptions
17595
- };
17596
- if (newOptions.getStorage) {
17597
- storage = newOptions.getStorage();
17598
- }
17599
- },
17600
- clearStorage: () => {
17601
- storage == null ? void 0 : storage.removeItem(options.name);
17602
- },
17603
- getOptions: () => options,
17604
- rehydrate: () => hydrate(),
17605
- hasHydrated: () => hasHydrated,
17606
- onHydrate: (cb) => {
17607
- hydrationListeners.add(cb);
17608
- return () => {
17609
- hydrationListeners.delete(cb);
17610
- };
17611
- },
17612
- onFinishHydration: (cb) => {
17613
- finishHydrationListeners.add(cb);
17614
- return () => {
17615
- finishHydrationListeners.delete(cb);
17616
- };
17617
- }
17618
- };
17619
- hydrate();
17620
- return stateFromStorage || configResult;
17621
- };
17622
- const newImpl = (config, baseOptions) => (set, get, api) => {
17623
- let options = {
17624
- storage: createJSONStorage(() => localStorage),
17625
- partialize: (state) => state,
17626
- version: 0,
17627
- merge: (persistedState, currentState) => ({
17628
- ...currentState,
17629
- ...persistedState
17630
- }),
17631
- ...baseOptions
17632
- };
17633
- let hasHydrated = false;
17634
- const hydrationListeners = /* @__PURE__ */ new Set();
17635
- const finishHydrationListeners = /* @__PURE__ */ new Set();
17636
- let storage = options.storage;
17637
- if (!storage) {
17638
- return config(
17639
- (...args) => {
17640
- console.warn(
17641
- `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
17642
- );
17643
- set(...args);
17644
- },
17645
- get,
17646
- api
17647
- );
17648
- }
17649
- const setItem = () => {
17650
- const state = options.partialize({ ...get() });
17651
- return storage.setItem(options.name, {
17652
- state,
17653
- version: options.version
17698
+ * ))}
17699
+ * </AnimatePresence>
17700
+ * )
17701
+ * ```
17702
+ *
17703
+ * You can sequence exit animations throughout a tree using variants.
17704
+ *
17705
+ * If a child contains multiple `motion` components with `exit` props, it will only unmount the child
17706
+ * once all `motion` components have finished animating out. Likewise, any components using
17707
+ * `usePresence` all need to call `safeToRemove`.
17708
+ *
17709
+ * @public
17710
+ */
17711
+ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, exitBeforeEnter, presenceAffectsLayout = true, mode = "sync", }) => {
17712
+ // Support deprecated exitBeforeEnter prop
17713
+ if (exitBeforeEnter) {
17714
+ mode = "wait";
17715
+ warnOnce(false, "Replace exitBeforeEnter with mode='wait'");
17716
+ }
17717
+ // We want to force a re-render once all exiting animations have finished. We
17718
+ // either use a local forceRender function, or one from a parent context if it exists.
17719
+ let [forceRender] = useForceUpdate();
17720
+ const forceRenderLayoutGroup = reactExports.useContext(LayoutGroupContext).forceRender;
17721
+ if (forceRenderLayoutGroup)
17722
+ forceRender = forceRenderLayoutGroup;
17723
+ const isMounted = useIsMounted();
17724
+ // Filter out any children that aren't ReactElements. We can only track ReactElements with a props.key
17725
+ const filteredChildren = onlyElements(children);
17726
+ let childrenToRender = filteredChildren;
17727
+ const exiting = new Set();
17728
+ // Keep a living record of the children we're actually rendering so we
17729
+ // can diff to figure out which are entering and exiting
17730
+ const presentChildren = reactExports.useRef(childrenToRender);
17731
+ // A lookup table to quickly reference components by key
17732
+ const allChildren = reactExports.useRef(new Map()).current;
17733
+ // If this is the initial component render, just deal with logic surrounding whether
17734
+ // we play onMount animations or not.
17735
+ const isInitialRender = reactExports.useRef(true);
17736
+ useIsomorphicLayoutEffect$1(() => {
17737
+ isInitialRender.current = false;
17738
+ updateChildLookup(filteredChildren, allChildren);
17739
+ presentChildren.current = childrenToRender;
17654
17740
  });
17655
- };
17656
- const savedSetState = api.setState;
17657
- api.setState = (state, replace) => {
17658
- savedSetState(state, replace);
17659
- void setItem();
17660
- };
17661
- const configResult = config(
17662
- (...args) => {
17663
- set(...args);
17664
- void setItem();
17665
- },
17666
- get,
17667
- api
17668
- );
17669
- api.getInitialState = () => configResult;
17670
- let stateFromStorage;
17671
- const hydrate = () => {
17672
- var _a, _b;
17673
- if (!storage)
17674
- return;
17675
- hasHydrated = false;
17676
- hydrationListeners.forEach((cb) => {
17677
- var _a2;
17678
- return cb((_a2 = get()) != null ? _a2 : configResult);
17741
+ useUnmountEffect(() => {
17742
+ isInitialRender.current = true;
17743
+ allChildren.clear();
17744
+ exiting.clear();
17679
17745
  });
17680
- const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;
17681
- return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
17682
- if (deserializedStorageValue) {
17683
- if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
17684
- if (options.migrate) {
17685
- return options.migrate(
17686
- deserializedStorageValue.state,
17687
- deserializedStorageValue.version
17688
- );
17689
- }
17690
- console.error(
17691
- `State loaded from storage couldn't be migrated since no migrate function was provided`
17692
- );
17693
- } else {
17694
- return deserializedStorageValue.state;
17746
+ if (isInitialRender.current) {
17747
+ return (reactExports.createElement(reactExports.Fragment, null, childrenToRender.map((child) => (reactExports.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, initial: initial ? undefined : false, presenceAffectsLayout: presenceAffectsLayout, mode: mode }, child)))));
17748
+ }
17749
+ // If this is a subsequent render, deal with entering and exiting children
17750
+ childrenToRender = [...childrenToRender];
17751
+ // Diff the keys of the currently-present and target children to update our
17752
+ // exiting list.
17753
+ const presentKeys = presentChildren.current.map(getChildKey);
17754
+ const targetKeys = filteredChildren.map(getChildKey);
17755
+ // Diff the present children with our target children and mark those that are exiting
17756
+ const numPresent = presentKeys.length;
17757
+ for (let i = 0; i < numPresent; i++) {
17758
+ const key = presentKeys[i];
17759
+ if (targetKeys.indexOf(key) === -1) {
17760
+ exiting.add(key);
17695
17761
  }
17696
- }
17697
- }).then((migratedState) => {
17698
- var _a2;
17699
- stateFromStorage = options.merge(
17700
- migratedState,
17701
- (_a2 = get()) != null ? _a2 : configResult
17702
- );
17703
- set(stateFromStorage, true);
17704
- return setItem();
17705
- }).then(() => {
17706
- postRehydrationCallback == null ? void 0 : postRehydrationCallback(stateFromStorage, void 0);
17707
- stateFromStorage = get();
17708
- hasHydrated = true;
17709
- finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
17710
- }).catch((e) => {
17711
- postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);
17712
- });
17713
- };
17714
- api.persist = {
17715
- setOptions: (newOptions) => {
17716
- options = {
17717
- ...options,
17718
- ...newOptions
17719
- };
17720
- if (newOptions.storage) {
17721
- storage = newOptions.storage;
17722
- }
17723
- },
17724
- clearStorage: () => {
17725
- storage == null ? void 0 : storage.removeItem(options.name);
17726
- },
17727
- getOptions: () => options,
17728
- rehydrate: () => hydrate(),
17729
- hasHydrated: () => hasHydrated,
17730
- onHydrate: (cb) => {
17731
- hydrationListeners.add(cb);
17732
- return () => {
17733
- hydrationListeners.delete(cb);
17734
- };
17735
- },
17736
- onFinishHydration: (cb) => {
17737
- finishHydrationListeners.add(cb);
17738
- return () => {
17739
- finishHydrationListeners.delete(cb);
17740
- };
17741
17762
  }
17742
- };
17743
- if (!options.skipHydration) {
17744
- hydrate();
17745
- }
17746
- return stateFromStorage || configResult;
17747
- };
17748
- const persistImpl = (config, baseOptions) => {
17749
- if ("getStorage" in baseOptions || "serialize" in baseOptions || "deserialize" in baseOptions) {
17750
- if ((undefined ? undefined.MODE : void 0) !== "production") {
17751
- console.warn(
17752
- "[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."
17753
- );
17763
+ // If we currently have exiting children, and we're deferring rendering incoming children
17764
+ // until after all current children have exiting, empty the childrenToRender array
17765
+ if (mode === "wait" && exiting.size) {
17766
+ childrenToRender = [];
17754
17767
  }
17755
- return oldImpl(config, baseOptions);
17756
- }
17757
- return newImpl(config, baseOptions);
17768
+ // Loop through all currently exiting components and clone them to overwrite `animate`
17769
+ // with any `exit` prop they might have defined.
17770
+ exiting.forEach((key) => {
17771
+ // If this component is actually entering again, early return
17772
+ if (targetKeys.indexOf(key) !== -1)
17773
+ return;
17774
+ const child = allChildren.get(key);
17775
+ if (!child)
17776
+ return;
17777
+ const insertionIndex = presentKeys.indexOf(key);
17778
+ const onExit = () => {
17779
+ allChildren.delete(key);
17780
+ exiting.delete(key);
17781
+ // Remove this child from the present children
17782
+ const removeIndex = presentChildren.current.findIndex((presentChild) => presentChild.key === key);
17783
+ presentChildren.current.splice(removeIndex, 1);
17784
+ // Defer re-rendering until all exiting children have indeed left
17785
+ if (!exiting.size) {
17786
+ presentChildren.current = filteredChildren;
17787
+ if (isMounted.current === false)
17788
+ return;
17789
+ forceRender();
17790
+ onExitComplete && onExitComplete();
17791
+ }
17792
+ };
17793
+ childrenToRender.splice(insertionIndex, 0, reactExports.createElement(PresenceChild, { key: getChildKey(child), isPresent: false, onExitComplete: onExit, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode }, child));
17794
+ });
17795
+ // Add `MotionContext` even to children that don't need it to ensure we're rendering
17796
+ // the same tree between renders
17797
+ childrenToRender = childrenToRender.map((child) => {
17798
+ const key = child.key;
17799
+ return exiting.has(key) ? (child) : (reactExports.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, presenceAffectsLayout: presenceAffectsLayout, mode: mode }, child));
17800
+ });
17801
+ if (env !== "production" &&
17802
+ mode === "wait" &&
17803
+ childrenToRender.length > 1) {
17804
+ console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
17805
+ }
17806
+ return (reactExports.createElement(reactExports.Fragment, null, exiting.size
17807
+ ? childrenToRender
17808
+ : childrenToRender.map((child) => reactExports.cloneElement(child))));
17758
17809
  };
17759
- const persist = persistImpl;
17760
17810
 
17761
17811
  var font = {
17762
17812
  primary: "Aeonik, Arial, Helvetica, sans-serif",
@@ -23862,48 +23912,6 @@ void main(void) {
23862
23912
  return /*#__PURE__*/jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
23863
23913
  };
23864
23914
 
23865
- function useFocusTrap(ref, options) {
23866
- if (options === void 0) {
23867
- options = {};
23868
- }
23869
- const selectors = options.selectors || 'a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])';
23870
- const [state, setState] = reactExports.useState(!options.disabled);
23871
- useIsomorphicLayoutEffect$2(() => {
23872
- const element = ref.current;
23873
- if (element) {
23874
- const elements = element.querySelectorAll(selectors);
23875
- const first = elements[0];
23876
- const last = elements[elements.length - 1];
23877
- const onKeyDown = event => {
23878
- // console.log(event.key, event.code, event.keyCode);
23879
- const isTabPressed = event.key === 'Tab';
23880
- if (!isTabPressed) {
23881
- return;
23882
- }
23883
- if (event.shiftKey) {
23884
- // shift + tab
23885
- if (document.activeElement === first) {
23886
- last.focus();
23887
- event.preventDefault();
23888
- }
23889
- } else {
23890
- // tab
23891
- if (document.activeElement === last) {
23892
- first.focus();
23893
- event.preventDefault();
23894
- }
23895
- }
23896
- };
23897
- element.addEventListener('keydown', onKeyDown);
23898
- return () => {
23899
- element.removeEventListener('keydown', onKeyDown);
23900
- };
23901
- }
23902
- return () => {};
23903
- }, [ref.current]);
23904
- return [state, setState];
23905
- }
23906
-
23907
23915
  function Canvas() {
23908
23916
  const ref = reactExports.useRef(null);
23909
23917
  useCanvasOffscreen(ref);
@@ -23922,7 +23930,8 @@ void main(void) {
23922
23930
  className: "icon-llm-arrow-corner-right-up",
23923
23931
  width: "1em",
23924
23932
  height: "1em",
23925
- "data-icon": "",
23933
+ "data-icon": "icon-llm-arrow-corner-right-up",
23934
+ "aria-hidden": "true",
23926
23935
  ...props,
23927
23936
  ref: ref,
23928
23937
  children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
@@ -23943,7 +23952,8 @@ void main(void) {
23943
23952
  className: "icon-llm-arrow-left",
23944
23953
  width: "1em",
23945
23954
  height: "1em",
23946
- "data-icon": "",
23955
+ "data-icon": "icon-llm-arrow-left",
23956
+ "aria-hidden": "true",
23947
23957
  ...props,
23948
23958
  ref: ref,
23949
23959
  children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
@@ -23964,7 +23974,8 @@ void main(void) {
23964
23974
  className: "icon-llm-arrow-right",
23965
23975
  width: "1em",
23966
23976
  height: "1em",
23967
- "data-icon": "",
23977
+ "data-icon": "icon-llm-arrow-right",
23978
+ "aria-hidden": "true",
23968
23979
  ...props,
23969
23980
  ref: ref,
23970
23981
  children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
@@ -23984,7 +23995,8 @@ void main(void) {
23984
23995
  className: "icon-llm-chevron-right-circle",
23985
23996
  width: "1em",
23986
23997
  height: "1em",
23987
- "data-icon": "",
23998
+ "data-icon": "icon-llm-chevron-right-circle",
23999
+ "aria-hidden": "true",
23988
24000
  ...props,
23989
24001
  ref: ref,
23990
24002
  children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
@@ -24002,7 +24014,8 @@ void main(void) {
24002
24014
  className: "icon-llm-info-circle",
24003
24015
  width: "1em",
24004
24016
  height: "1em",
24005
- "data-icon": "",
24017
+ "data-icon": "icon-llm-info-circle",
24018
+ "aria-hidden": "true",
24006
24019
  ...props,
24007
24020
  ref: ref,
24008
24021
  children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
@@ -24027,7 +24040,8 @@ void main(void) {
24027
24040
  strokeLinecap: "round",
24028
24041
  strokeLinejoin: "round",
24029
24042
  className: "icon-llm-maximize",
24030
- "data-icon": "",
24043
+ "data-icon": "icon-llm-maximize",
24044
+ "aria-hidden": "true",
24031
24045
  ...props,
24032
24046
  ref: ref,
24033
24047
  children: [/*#__PURE__*/jsxRuntimeExports.jsx("polyline", {
@@ -24057,7 +24071,8 @@ void main(void) {
24057
24071
  className: "icon-llm-microphone",
24058
24072
  width: "1em",
24059
24073
  height: "1em",
24060
- "data-icon": "",
24074
+ "data-icon": "icon-llm-microphone",
24075
+ "aria-hidden": "true",
24061
24076
  ...props,
24062
24077
  ref: ref,
24063
24078
  children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
@@ -24082,7 +24097,8 @@ void main(void) {
24082
24097
  strokeLinecap: "round",
24083
24098
  strokeLinejoin: "round",
24084
24099
  className: "icon-llm-minimize",
24085
- "data-icon": "",
24100
+ "data-icon": "icon-llm-minimize",
24101
+ "aria-hidden": "true",
24086
24102
  ...props,
24087
24103
  ref: ref,
24088
24104
  children: [/*#__PURE__*/jsxRuntimeExports.jsx("polyline", {
@@ -24112,7 +24128,8 @@ void main(void) {
24112
24128
  className: "icon-llm-pin",
24113
24129
  width: "1em",
24114
24130
  height: "1em",
24115
- "data-icon": "",
24131
+ "data-icon": "icon-llm-pin",
24132
+ "aria-hidden": "true",
24116
24133
  ...props,
24117
24134
  ref: ref,
24118
24135
  children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
@@ -24132,7 +24149,8 @@ void main(void) {
24132
24149
  className: "icon-llm-play",
24133
24150
  width: "1em",
24134
24151
  height: "1em",
24135
- "data-icon": "",
24152
+ "data-icon": "icon-llm-play",
24153
+ "aria-hidden": "true",
24136
24154
  ...props,
24137
24155
  ref: ref,
24138
24156
  children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
@@ -24151,7 +24169,8 @@ void main(void) {
24151
24169
  className: "icon-llm-send",
24152
24170
  width: "1em",
24153
24171
  height: "1em",
24154
- "data-icon": "",
24172
+ "data-icon": "icon-llm-send",
24173
+ "aria-hidden": "true",
24155
24174
  ...props,
24156
24175
  ref: ref,
24157
24176
  children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
@@ -24171,7 +24190,8 @@ void main(void) {
24171
24190
  className: "icon-llm-stop",
24172
24191
  width: "1em",
24173
24192
  height: "1em",
24174
- "data-icon": "",
24193
+ "data-icon": "icon-llm-stop",
24194
+ "aria-hidden": "true",
24175
24195
  ...props,
24176
24196
  ref: ref,
24177
24197
  children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
@@ -24189,7 +24209,8 @@ void main(void) {
24189
24209
  viewBox: "0 0 18 18",
24190
24210
  xmlns: "http://www.w3.org/2000/svg",
24191
24211
  className: "icon-llm-timetable",
24192
- "data-icon": "",
24212
+ "data-icon": "icon-llm-timetable",
24213
+ "aria-hidden": "true",
24193
24214
  ...props,
24194
24215
  ref: ref,
24195
24216
  children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
@@ -24212,7 +24233,8 @@ void main(void) {
24212
24233
  strokeLinecap: "round",
24213
24234
  strokeLinejoin: "round",
24214
24235
  className: "icon-llm-volume-x",
24215
- "data-icon": "",
24236
+ "data-icon": "icon-llm-volume-x",
24237
+ "aria-hidden": "true",
24216
24238
  ...props,
24217
24239
  ref: ref,
24218
24240
  children: [/*#__PURE__*/jsxRuntimeExports.jsx("polygon", {
@@ -24244,7 +24266,8 @@ void main(void) {
24244
24266
  strokeLinecap: "round",
24245
24267
  strokeLinejoin: "round",
24246
24268
  className: "icon-llm-volume",
24247
- "data-icon": "",
24269
+ "data-icon": "icon-llm-volume",
24270
+ "aria-hidden": "true",
24248
24271
  ...props,
24249
24272
  ref: ref,
24250
24273
  children: [/*#__PURE__*/jsxRuntimeExports.jsx("polygon", {
@@ -24270,7 +24293,8 @@ void main(void) {
24270
24293
  strokeLinecap: "round",
24271
24294
  strokeLinejoin: "round",
24272
24295
  className: "icon-websolute",
24273
- "data-icon": "",
24296
+ "data-icon": "icon-websolute",
24297
+ "aria-hidden": "true",
24274
24298
  ...props,
24275
24299
  ref: ref,
24276
24300
  children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
@@ -30106,16 +30130,6 @@ void main(void) {
30106
30130
  });
30107
30131
  };
30108
30132
 
30109
- const useAutosizeTextArea = (textAreaRef, value) => {
30110
- reactExports.useEffect(() => {
30111
- if (textAreaRef) {
30112
- textAreaRef.style.height = '0px';
30113
- textAreaRef.style.height = textAreaRef.scrollHeight + 1 + 'px';
30114
- }
30115
- }, [textAreaRef, value]);
30116
- };
30117
- var useAutosizeTextArea$1 = useAutosizeTextArea;
30118
-
30119
30133
  const Suggestions = () => {
30120
30134
  useWindowSize();
30121
30135
  const app = useLlm(state => state.app);
@@ -30174,7 +30188,7 @@ void main(void) {
30174
30188
  const {
30175
30189
  send
30176
30190
  } = useLlmView(state => state.actions);
30177
- useAutosizeTextArea$1(textArea.current, prompt);
30191
+ useAutosizeTextArea(textArea.current, prompt);
30178
30192
  const onChange = event => {
30179
30193
  const prompt = event.target?.value;
30180
30194
  setPrompt(prompt);
@@ -34114,7 +34128,8 @@ void main(void) {
34114
34128
  };
34115
34129
  }
34116
34130
  }, [locale, market]);
34117
- const endpoint = typeof props.test !== 'undefined' ? 'https://bom-sample-basic-web-git-bom-llm-actarian.vercel.app' : 'https://platform.websolute.ai';
34131
+ const defaultEndpoint = typeof props.test !== 'undefined' ? 'https://bom-sample-basic-web-git-bom-llm-actarian.vercel.app' : 'https://platform.websolute.ai';
34132
+ const endpoint = props.endpoint || defaultEndpoint;
34118
34133
  const layout = {
34119
34134
  labels: getLabels(data.locale),
34120
34135
  locale: data.locale,