@betterstore/react 0.6.11 → 0.6.13

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.
Files changed (27) hide show
  1. package/dist/components/checkout-embed/checkout-form.d.ts.map +1 -1
  2. package/dist/components/checkout-embed/steps/customer/address-utils.d.ts.map +1 -1
  3. package/dist/components/checkout-embed/steps/payment/form.d.ts +2 -1
  4. package/dist/components/checkout-embed/steps/payment/form.d.ts.map +1 -1
  5. package/dist/components/checkout-embed/steps/payment/icons.d.ts +8 -0
  6. package/dist/components/checkout-embed/steps/payment/icons.d.ts.map +1 -0
  7. package/dist/components/checkout-embed/useFormStore.d.ts +3 -5
  8. package/dist/components/checkout-embed/useFormStore.d.ts.map +1 -1
  9. package/dist/components/compounds/form/country-input/dropdown.d.ts +26 -0
  10. package/dist/components/compounds/form/country-input/dropdown.d.ts.map +1 -0
  11. package/dist/components/compounds/form/select-group/index.d.ts +14 -0
  12. package/dist/components/compounds/form/select-group/index.d.ts.map +1 -0
  13. package/dist/components/compounds/form/select-group/select.d.ts +14 -0
  14. package/dist/components/compounds/form/select-group/select.d.ts.map +1 -0
  15. package/dist/components/payment-element/betterstore-checkout-embed-payment-element.d.ts +2 -0
  16. package/dist/components/payment-element/betterstore-checkout-embed-payment-element.d.ts.map +1 -0
  17. package/dist/components/payment-element/checkout-form.d.ts.map +1 -1
  18. package/dist/components/payment-element/useCheckout.d.ts +3 -0
  19. package/dist/components/payment-element/useCheckout.d.ts.map +1 -1
  20. package/dist/components/shadow-wrapper.d.ts +8 -0
  21. package/dist/components/shadow-wrapper.d.ts.map +1 -0
  22. package/dist/components/ui/form.d.ts.map +1 -1
  23. package/dist/index.cjs.js +678 -1212
  24. package/dist/index.mjs +683 -1217
  25. package/dist/lib/betterstore.d.ts +6 -0
  26. package/dist/lib/betterstore.d.ts.map +1 -0
  27. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -25,14 +25,14 @@ const createStoreImpl = (createState) => {
25
25
  const initialState = state = createState(setState, getState, api);
26
26
  return api;
27
27
  };
28
- const createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
28
+ const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
29
29
 
30
30
  const identity$1 = (arg) => arg;
31
31
  function useStore(api, selector = identity$1) {
32
32
  const slice = React__default.useSyncExternalStore(
33
33
  api.subscribe,
34
- React__default.useCallback(() => selector(api.getState()), [api, selector]),
35
- React__default.useCallback(() => selector(api.getInitialState()), [api, selector])
34
+ () => selector(api.getState()),
35
+ () => selector(api.getInitialState())
36
36
  );
37
37
  React__default.useDebugValue(slice);
38
38
  return slice;
@@ -43,7 +43,7 @@ const createImpl = (createState) => {
43
43
  Object.assign(useBoundStore, api);
44
44
  return useBoundStore;
45
45
  };
46
- const create = ((createState) => createState ? createImpl(createState) : createImpl);
46
+ const create = (createState) => createState ? createImpl(createState) : createImpl;
47
47
 
48
48
  function createJSONStorage(getStorage, options) {
49
49
  let storage;
@@ -134,12 +134,12 @@ const persistImpl = (config, baseOptions) => (set, get, api) => {
134
134
  const savedSetState = api.setState;
135
135
  api.setState = (state, replace) => {
136
136
  savedSetState(state, replace);
137
- return setItem();
137
+ void setItem();
138
138
  };
139
139
  const configResult = config(
140
140
  (...args) => {
141
141
  set(...args);
142
- return setItem();
142
+ void setItem();
143
143
  },
144
144
  get,
145
145
  api
@@ -3075,7 +3075,7 @@ const hasLoadedNamespace = (ns, i18n, options = {}) => {
3075
3075
  return i18n.hasLoadedNamespace(ns, {
3076
3076
  lng: options.lng,
3077
3077
  precheck: (i18nInstance, loadNotPending) => {
3078
- if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
3078
+ if (options.bindI18n?.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
3079
3079
  }
3080
3080
  });
3081
3081
  };
@@ -3236,7 +3236,7 @@ const useTranslation = (ns, props = {}) => {
3236
3236
  if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
3237
3237
  return () => {
3238
3238
  isMounted.current = false;
3239
- if (i18n && bindI18n) bindI18n?.split(' ').forEach(e => i18n.off(e, boundReset));
3239
+ if (i18n) bindI18n?.split(' ').forEach(e => i18n.off(e, boundReset));
3240
3240
  if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, boundReset));
3241
3241
  };
3242
3242
  }, [i18n, joinedNS]);
@@ -3306,7 +3306,12 @@ const CheckoutEmbed$2 = {
3306
3306
  loading: "Načítání ...",
3307
3307
  Payment: {
3308
3308
  back: "Zpět na výběr dopravy",
3309
- button: "Dokončit objednávku",
3309
+ button: {
3310
+ "default": "Dokončit objednávku",
3311
+ apple_pay: "Zaplatit s Apple Pay",
3312
+ paypal: "Zaplatit s PayPal",
3313
+ google_pay: "Zaplatit s Google Pay"
3314
+ },
3310
3315
  description: "Všechny transakce jsou zabezpečené a šifrované.",
3311
3316
  title: "Platba"
3312
3317
  },
@@ -3423,7 +3428,12 @@ const CheckoutEmbed$1 = {
3423
3428
  title: "Payment",
3424
3429
  description: "All transactions are secure and encrypted.",
3425
3430
  back: "Back to shipping",
3426
- button: "Buy now"
3431
+ button: {
3432
+ "default": "Buy now",
3433
+ apple_pay: "Pay with Apple Pay",
3434
+ paypal: "Pay with PayPal",
3435
+ google_pay: "Pay with Google Pay"
3436
+ }
3427
3437
  }
3428
3438
  };
3429
3439
  const Errors = {
@@ -3456,13 +3466,6 @@ const createI18nInstance = (locale) => __awaiter(void 0, void 0, void 0, functio
3456
3466
  return instance;
3457
3467
  });
3458
3468
 
3459
- /**
3460
- * Create a bound version of a function with a specified `this` context
3461
- *
3462
- * @param {Function} fn - The function to bind
3463
- * @param {*} thisArg - The value to be passed as the `this` parameter
3464
- * @returns {Function} A new function that will call the original function with the specified `this` context
3465
- */
3466
3469
  function bind(fn, thisArg) {
3467
3470
  return function wrap() {
3468
3471
  return fn.apply(thisArg, arguments);
@@ -3514,7 +3517,7 @@ const isUndefined$1 = typeOfTest('undefined');
3514
3517
  */
3515
3518
  function isBuffer(val) {
3516
3519
  return val !== null && !isUndefined$1(val) && val.constructor !== null && !isUndefined$1(val.constructor)
3517
- && isFunction$3(val.constructor.isBuffer) && val.constructor.isBuffer(val);
3520
+ && isFunction$2(val.constructor.isBuffer) && val.constructor.isBuffer(val);
3518
3521
  }
3519
3522
 
3520
3523
  /**
@@ -3559,7 +3562,7 @@ const isString$1 = typeOfTest('string');
3559
3562
  * @param {*} val The value to test
3560
3563
  * @returns {boolean} True if value is a Function, otherwise false
3561
3564
  */
3562
- const isFunction$3 = typeOfTest('function');
3565
+ const isFunction$2 = typeOfTest('function');
3563
3566
 
3564
3567
  /**
3565
3568
  * Determine if a value is a Number
@@ -3603,27 +3606,6 @@ const isPlainObject$1 = (val) => {
3603
3606
  return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
3604
3607
  };
3605
3608
 
3606
- /**
3607
- * Determine if a value is an empty object (safely handles Buffers)
3608
- *
3609
- * @param {*} val The value to test
3610
- *
3611
- * @returns {boolean} True if value is an empty object, otherwise false
3612
- */
3613
- const isEmptyObject$1 = (val) => {
3614
- // Early return for non-objects or Buffers to prevent RangeError
3615
- if (!isObject$1(val) || isBuffer(val)) {
3616
- return false;
3617
- }
3618
-
3619
- try {
3620
- return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
3621
- } catch (e) {
3622
- // Fallback for any other objects that might cause RangeError with Object.keys()
3623
- return false;
3624
- }
3625
- };
3626
-
3627
3609
  /**
3628
3610
  * Determine if a value is a Date
3629
3611
  *
@@ -3667,7 +3649,7 @@ const isFileList = kindOfTest('FileList');
3667
3649
  *
3668
3650
  * @returns {boolean} True if value is a Stream, otherwise false
3669
3651
  */
3670
- const isStream = (val) => isObject$1(val) && isFunction$3(val.pipe);
3652
+ const isStream = (val) => isObject$1(val) && isFunction$2(val.pipe);
3671
3653
 
3672
3654
  /**
3673
3655
  * Determine if a value is a FormData
@@ -3680,10 +3662,10 @@ const isFormData = (thing) => {
3680
3662
  let kind;
3681
3663
  return thing && (
3682
3664
  (typeof FormData === 'function' && thing instanceof FormData) || (
3683
- isFunction$3(thing.append) && (
3665
+ isFunction$2(thing.append) && (
3684
3666
  (kind = kindOf(thing)) === 'formdata' ||
3685
3667
  // detect form-data instance
3686
- (kind === 'object' && isFunction$3(thing.toString) && thing.toString() === '[object FormData]')
3668
+ (kind === 'object' && isFunction$2(thing.toString) && thing.toString() === '[object FormData]')
3687
3669
  )
3688
3670
  )
3689
3671
  )
@@ -3746,11 +3728,6 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
3746
3728
  fn.call(null, obj[i], i, obj);
3747
3729
  }
3748
3730
  } else {
3749
- // Buffer check
3750
- if (isBuffer(obj)) {
3751
- return;
3752
- }
3753
-
3754
3731
  // Iterate over object keys
3755
3732
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
3756
3733
  const len = keys.length;
@@ -3764,10 +3741,6 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
3764
3741
  }
3765
3742
 
3766
3743
  function findKey(obj, key) {
3767
- if (isBuffer(obj)){
3768
- return null;
3769
- }
3770
-
3771
3744
  key = key.toLowerCase();
3772
3745
  const keys = Object.keys(obj);
3773
3746
  let i = keys.length;
@@ -3808,7 +3781,7 @@ const isContextDefined = (context) => !isUndefined$1(context) && context !== _gl
3808
3781
  * @returns {Object} Result of all merge properties
3809
3782
  */
3810
3783
  function merge(/* obj1, obj2, obj3, ... */) {
3811
- const {caseless, skipUndefined} = isContextDefined(this) && this || {};
3784
+ const {caseless} = isContextDefined(this) && this || {};
3812
3785
  const result = {};
3813
3786
  const assignValue = (val, key) => {
3814
3787
  const targetKey = caseless && findKey(result, key) || key;
@@ -3818,7 +3791,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
3818
3791
  result[targetKey] = merge({}, val);
3819
3792
  } else if (isArray(val)) {
3820
3793
  result[targetKey] = val.slice();
3821
- } else if (!skipUndefined || !isUndefined$1(val)) {
3794
+ } else {
3822
3795
  result[targetKey] = val;
3823
3796
  }
3824
3797
  };
@@ -3841,7 +3814,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
3841
3814
  */
3842
3815
  const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
3843
3816
  forEach(b, (val, key) => {
3844
- if (thisArg && isFunction$3(val)) {
3817
+ if (thisArg && isFunction$2(val)) {
3845
3818
  a[key] = bind(val, thisArg);
3846
3819
  } else {
3847
3820
  a[key] = val;
@@ -4057,13 +4030,13 @@ const reduceDescriptors = (obj, reducer) => {
4057
4030
  const freezeMethods = (obj) => {
4058
4031
  reduceDescriptors(obj, (descriptor, name) => {
4059
4032
  // skip restricted props in strict mode
4060
- if (isFunction$3(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
4033
+ if (isFunction$2(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
4061
4034
  return false;
4062
4035
  }
4063
4036
 
4064
4037
  const value = obj[name];
4065
4038
 
4066
- if (!isFunction$3(value)) return;
4039
+ if (!isFunction$2(value)) return;
4067
4040
 
4068
4041
  descriptor.enumerable = false;
4069
4042
 
@@ -4100,8 +4073,6 @@ const toFiniteNumber = (value, defaultValue) => {
4100
4073
  return value != null && Number.isFinite(value = +value) ? value : defaultValue;
4101
4074
  };
4102
4075
 
4103
-
4104
-
4105
4076
  /**
4106
4077
  * If the thing is a FormData object, return true, otherwise return false.
4107
4078
  *
@@ -4110,7 +4081,7 @@ const toFiniteNumber = (value, defaultValue) => {
4110
4081
  * @returns {boolean}
4111
4082
  */
4112
4083
  function isSpecCompliantForm(thing) {
4113
- return !!(thing && isFunction$3(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
4084
+ return !!(thing && isFunction$2(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
4114
4085
  }
4115
4086
 
4116
4087
  const toJSONObject = (obj) => {
@@ -4123,11 +4094,6 @@ const toJSONObject = (obj) => {
4123
4094
  return;
4124
4095
  }
4125
4096
 
4126
- //Buffer check
4127
- if (isBuffer(source)) {
4128
- return source;
4129
- }
4130
-
4131
4097
  if(!('toJSON' in source)) {
4132
4098
  stack[i] = source;
4133
4099
  const target = isArray(source) ? [] : {};
@@ -4152,7 +4118,7 @@ const toJSONObject = (obj) => {
4152
4118
  const isAsyncFn = kindOfTest('AsyncFunction');
4153
4119
 
4154
4120
  const isThenable = (thing) =>
4155
- thing && (isObject$1(thing) || isFunction$3(thing)) && isFunction$3(thing.then) && isFunction$3(thing.catch);
4121
+ thing && (isObject$1(thing) || isFunction$2(thing)) && isFunction$2(thing.then) && isFunction$2(thing.catch);
4156
4122
 
4157
4123
  // original code
4158
4124
  // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
@@ -4176,7 +4142,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
4176
4142
  })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
4177
4143
  })(
4178
4144
  typeof setImmediate === 'function',
4179
- isFunction$3(_global.postMessage)
4145
+ isFunction$2(_global.postMessage)
4180
4146
  );
4181
4147
 
4182
4148
  const asap = typeof queueMicrotask !== 'undefined' ?
@@ -4185,7 +4151,7 @@ const asap = typeof queueMicrotask !== 'undefined' ?
4185
4151
  // *********************
4186
4152
 
4187
4153
 
4188
- const isIterable = (thing) => thing != null && isFunction$3(thing[iterator]);
4154
+ const isIterable = (thing) => thing != null && isFunction$2(thing[iterator]);
4189
4155
 
4190
4156
 
4191
4157
  var utils$1 = {
@@ -4199,7 +4165,6 @@ var utils$1 = {
4199
4165
  isBoolean: isBoolean$1,
4200
4166
  isObject: isObject$1,
4201
4167
  isPlainObject: isPlainObject$1,
4202
- isEmptyObject: isEmptyObject$1,
4203
4168
  isReadableStream,
4204
4169
  isRequest,
4205
4170
  isResponse,
@@ -4209,7 +4174,7 @@ var utils$1 = {
4209
4174
  isFile,
4210
4175
  isBlob,
4211
4176
  isRegExp,
4212
- isFunction: isFunction$3,
4177
+ isFunction: isFunction$2,
4213
4178
  isStream,
4214
4179
  isURLSearchParams,
4215
4180
  isTypedArray,
@@ -4335,18 +4300,11 @@ AxiosError$1.from = (error, code, config, request, response, customProps) => {
4335
4300
  return prop !== 'isAxiosError';
4336
4301
  });
4337
4302
 
4338
- const msg = error && error.message ? error.message : 'Error';
4303
+ AxiosError$1.call(axiosError, error.message, code, config, request, response);
4339
4304
 
4340
- // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
4341
- const errCode = code == null && error ? error.code : code;
4342
- AxiosError$1.call(axiosError, msg, errCode, config, request, response);
4305
+ axiosError.cause = error;
4343
4306
 
4344
- // Chain the original error on the standard field; non-enumerable to avoid JSON noise
4345
- if (error && axiosError.cause == null) {
4346
- Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
4347
- }
4348
-
4349
- axiosError.name = (error && error.name) || 'Error';
4307
+ axiosError.name = error.name;
4350
4308
 
4351
4309
  customProps && Object.assign(axiosError, customProps);
4352
4310
 
@@ -4637,7 +4595,9 @@ function encode(val) {
4637
4595
  replace(/%3A/gi, ':').
4638
4596
  replace(/%24/g, '$').
4639
4597
  replace(/%2C/gi, ',').
4640
- replace(/%20/g, '+');
4598
+ replace(/%20/g, '+').
4599
+ replace(/%5B/gi, '[').
4600
+ replace(/%5D/gi, ']');
4641
4601
  }
4642
4602
 
4643
4603
  /**
@@ -4715,7 +4675,7 @@ class InterceptorManager {
4715
4675
  *
4716
4676
  * @param {Number} id The ID that was returned by `use`
4717
4677
  *
4718
- * @returns {void}
4678
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
4719
4679
  */
4720
4680
  eject(id) {
4721
4681
  if (this.handlers[id]) {
@@ -4834,7 +4794,7 @@ var platform$1 = {
4834
4794
  };
4835
4795
 
4836
4796
  function toURLEncodedForm(data, options) {
4837
- return toFormData$1(data, new platform$1.classes.URLSearchParams(), {
4797
+ return toFormData$1(data, new platform$1.classes.URLSearchParams(), Object.assign({
4838
4798
  visitor: function(value, key, path, helpers) {
4839
4799
  if (platform$1.isNode && utils$1.isBuffer(value)) {
4840
4800
  this.append(key, value.toString('base64'));
@@ -4842,9 +4802,8 @@ function toURLEncodedForm(data, options) {
4842
4802
  }
4843
4803
 
4844
4804
  return helpers.defaultVisitor.apply(this, arguments);
4845
- },
4846
- ...options
4847
- });
4805
+ }
4806
+ }, options));
4848
4807
  }
4849
4808
 
4850
4809
  /**
@@ -5040,7 +4999,7 @@ const defaults = {
5040
4999
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
5041
5000
 
5042
5001
  try {
5043
- return JSON.parse(data, this.parseReviver);
5002
+ return JSON.parse(data);
5044
5003
  } catch (e) {
5045
5004
  if (strictJSONParsing) {
5046
5005
  if (e.name === 'SyntaxError') {
@@ -5593,7 +5552,7 @@ function throttle(fn, freq) {
5593
5552
  clearTimeout(timer);
5594
5553
  timer = null;
5595
5554
  }
5596
- fn(...args);
5555
+ fn.apply(null, args);
5597
5556
  };
5598
5557
 
5599
5558
  const throttled = (...args) => {
@@ -5675,38 +5634,27 @@ var cookies = platform$1.hasStandardBrowserEnv ?
5675
5634
 
5676
5635
  // Standard browser envs support document.cookie
5677
5636
  {
5678
- write(name, value, expires, path, domain, secure, sameSite) {
5679
- if (typeof document === 'undefined') return;
5637
+ write(name, value, expires, path, domain, secure) {
5638
+ const cookie = [name + '=' + encodeURIComponent(value)];
5680
5639
 
5681
- const cookie = [`${name}=${encodeURIComponent(value)}`];
5640
+ utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
5682
5641
 
5683
- if (utils$1.isNumber(expires)) {
5684
- cookie.push(`expires=${new Date(expires).toUTCString()}`);
5685
- }
5686
- if (utils$1.isString(path)) {
5687
- cookie.push(`path=${path}`);
5688
- }
5689
- if (utils$1.isString(domain)) {
5690
- cookie.push(`domain=${domain}`);
5691
- }
5692
- if (secure === true) {
5693
- cookie.push('secure');
5694
- }
5695
- if (utils$1.isString(sameSite)) {
5696
- cookie.push(`SameSite=${sameSite}`);
5697
- }
5642
+ utils$1.isString(path) && cookie.push('path=' + path);
5643
+
5644
+ utils$1.isString(domain) && cookie.push('domain=' + domain);
5645
+
5646
+ secure === true && cookie.push('secure');
5698
5647
 
5699
5648
  document.cookie = cookie.join('; ');
5700
5649
  },
5701
5650
 
5702
5651
  read(name) {
5703
- if (typeof document === 'undefined') return null;
5704
- const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
5705
- return match ? decodeURIComponent(match[1]) : null;
5652
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
5653
+ return (match ? decodeURIComponent(match[3]) : null);
5706
5654
  },
5707
5655
 
5708
5656
  remove(name) {
5709
- this.write(name, '', Date.now() - 86400000, '/');
5657
+ this.write(name, '', Date.now() - 86400000);
5710
5658
  }
5711
5659
  }
5712
5660
 
@@ -5795,11 +5743,11 @@ function mergeConfig$1(config1, config2) {
5795
5743
  }
5796
5744
 
5797
5745
  // eslint-disable-next-line consistent-return
5798
- function mergeDeepProperties(a, b, prop, caseless) {
5746
+ function mergeDeepProperties(a, b, prop , caseless) {
5799
5747
  if (!utils$1.isUndefined(b)) {
5800
- return getMergedValue(a, b, prop, caseless);
5748
+ return getMergedValue(a, b, prop , caseless);
5801
5749
  } else if (!utils$1.isUndefined(a)) {
5802
- return getMergedValue(undefined, a, prop, caseless);
5750
+ return getMergedValue(undefined, a, prop , caseless);
5803
5751
  }
5804
5752
  }
5805
5753
 
@@ -5857,10 +5805,10 @@ function mergeConfig$1(config1, config2) {
5857
5805
  socketPath: defaultToConfig2,
5858
5806
  responseEncoding: defaultToConfig2,
5859
5807
  validateStatus: mergeDirectKeys,
5860
- headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
5808
+ headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
5861
5809
  };
5862
5810
 
5863
- utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
5811
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
5864
5812
  const merge = mergeMap[prop] || mergeDeepProperties;
5865
5813
  const configValue = merge(config1[prop], config2[prop], prop);
5866
5814
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
@@ -5872,7 +5820,7 @@ function mergeConfig$1(config1, config2) {
5872
5820
  var resolveConfig = (config) => {
5873
5821
  const newConfig = mergeConfig$1({}, config);
5874
5822
 
5875
- let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
5823
+ let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
5876
5824
 
5877
5825
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
5878
5826
 
@@ -5885,21 +5833,17 @@ var resolveConfig = (config) => {
5885
5833
  );
5886
5834
  }
5887
5835
 
5836
+ let contentType;
5837
+
5888
5838
  if (utils$1.isFormData(data)) {
5889
5839
  if (platform$1.hasStandardBrowserEnv || platform$1.hasStandardBrowserWebWorkerEnv) {
5890
- headers.setContentType(undefined); // browser handles it
5891
- } else if (utils$1.isFunction(data.getHeaders)) {
5892
- // Node.js FormData (like form-data package)
5893
- const formHeaders = data.getHeaders();
5894
- // Only set safe headers to avoid overwriting security headers
5895
- const allowedHeaders = ['content-type', 'content-length'];
5896
- Object.entries(formHeaders).forEach(([key, val]) => {
5897
- if (allowedHeaders.includes(key.toLowerCase())) {
5898
- headers.set(key, val);
5899
- }
5900
- });
5840
+ headers.setContentType(undefined); // Let the browser set it
5841
+ } else if ((contentType = headers.getContentType()) !== false) {
5842
+ // fix semicolon duplication issue for ReactNative FormData implementation
5843
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
5844
+ headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
5901
5845
  }
5902
- }
5846
+ }
5903
5847
 
5904
5848
  // Add xsrf header
5905
5849
  // This is only done if running in a standard browser environment.
@@ -6016,18 +5960,15 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
6016
5960
  };
6017
5961
 
6018
5962
  // Handle low level network errors
6019
- request.onerror = function handleError(event) {
6020
- // Browsers deliver a ProgressEvent in XHR onerror
6021
- // (message may be empty; when present, surface it)
6022
- // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
6023
- const msg = event && event.message ? event.message : 'Network Error';
6024
- const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
6025
- // attach the underlying event for consumers who want details
6026
- err.event = event || null;
6027
- reject(err);
6028
- request = null;
5963
+ request.onerror = function handleError() {
5964
+ // Real errors are hidden from us by the browser
5965
+ // onerror should only fire if it's a network error
5966
+ reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request));
5967
+
5968
+ // Clean up request
5969
+ request = null;
6029
5970
  };
6030
-
5971
+
6031
5972
  // Handle timeout
6032
5973
  request.ontimeout = function handleTimeout() {
6033
5974
  let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
@@ -6241,18 +6182,14 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
6241
6182
  })
6242
6183
  };
6243
6184
 
6244
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
6245
-
6246
- const {isFunction: isFunction$2} = utils$1;
6247
-
6248
- const globalFetchAPI = (({Request, Response}) => ({
6249
- Request, Response
6250
- }))(utils$1.global);
6251
-
6252
- const {
6253
- ReadableStream: ReadableStream$1, TextEncoder
6254
- } = utils$1.global;
6185
+ const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
6186
+ const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
6255
6187
 
6188
+ // used only inside the fetch adapter
6189
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
6190
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
6191
+ async (str) => new Uint8Array(await new Response(str).arrayBuffer())
6192
+ );
6256
6193
 
6257
6194
  const test = (fn, ...args) => {
6258
6195
  try {
@@ -6262,380 +6199,278 @@ const test = (fn, ...args) => {
6262
6199
  }
6263
6200
  };
6264
6201
 
6265
- const factory = (env) => {
6266
- env = utils$1.merge.call({
6267
- skipUndefined: true
6268
- }, globalFetchAPI, env);
6269
-
6270
- const {fetch: envFetch, Request, Response} = env;
6271
- const isFetchSupported = envFetch ? isFunction$2(envFetch) : typeof fetch === 'function';
6272
- const isRequestSupported = isFunction$2(Request);
6273
- const isResponseSupported = isFunction$2(Response);
6274
-
6275
- if (!isFetchSupported) {
6276
- return false;
6277
- }
6278
-
6279
- const isReadableStreamSupported = isFetchSupported && isFunction$2(ReadableStream$1);
6280
-
6281
- const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
6282
- ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
6283
- async (str) => new Uint8Array(await new Request(str).arrayBuffer())
6284
- );
6285
-
6286
- const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
6287
- let duplexAccessed = false;
6202
+ const supportsRequestStream = isReadableStreamSupported && test(() => {
6203
+ let duplexAccessed = false;
6288
6204
 
6289
- const hasContentType = new Request(platform$1.origin, {
6290
- body: new ReadableStream$1(),
6291
- method: 'POST',
6292
- get duplex() {
6293
- duplexAccessed = true;
6294
- return 'half';
6295
- },
6296
- }).headers.has('Content-Type');
6205
+ const hasContentType = new Request(platform$1.origin, {
6206
+ body: new ReadableStream(),
6207
+ method: 'POST',
6208
+ get duplex() {
6209
+ duplexAccessed = true;
6210
+ return 'half';
6211
+ },
6212
+ }).headers.has('Content-Type');
6297
6213
 
6298
- return duplexAccessed && !hasContentType;
6299
- });
6214
+ return duplexAccessed && !hasContentType;
6215
+ });
6300
6216
 
6301
- const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
6302
- test(() => utils$1.isReadableStream(new Response('').body));
6217
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
6303
6218
 
6304
- const resolvers = {
6305
- stream: supportsResponseStream && ((res) => res.body)
6306
- };
6219
+ const supportsResponseStream = isReadableStreamSupported &&
6220
+ test(() => utils$1.isReadableStream(new Response('').body));
6307
6221
 
6308
- isFetchSupported && ((() => {
6309
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
6310
- !resolvers[type] && (resolvers[type] = (res, config) => {
6311
- let method = res && res[type];
6312
6222
 
6313
- if (method) {
6314
- return method.call(res);
6315
- }
6223
+ const resolvers = {
6224
+ stream: supportsResponseStream && ((res) => res.body)
6225
+ };
6316
6226
 
6227
+ isFetchSupported && (((res) => {
6228
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
6229
+ !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
6230
+ (_, config) => {
6317
6231
  throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
6318
6232
  });
6319
- });
6320
- })());
6321
-
6322
- const getBodyLength = async (body) => {
6323
- if (body == null) {
6324
- return 0;
6325
- }
6326
-
6327
- if (utils$1.isBlob(body)) {
6328
- return body.size;
6329
- }
6330
-
6331
- if (utils$1.isSpecCompliantForm(body)) {
6332
- const _request = new Request(platform$1.origin, {
6333
- method: 'POST',
6334
- body,
6335
- });
6336
- return (await _request.arrayBuffer()).byteLength;
6337
- }
6338
-
6339
- if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
6340
- return body.byteLength;
6341
- }
6342
-
6343
- if (utils$1.isURLSearchParams(body)) {
6344
- body = body + '';
6345
- }
6346
-
6347
- if (utils$1.isString(body)) {
6348
- return (await encodeText(body)).byteLength;
6349
- }
6350
- };
6351
-
6352
- const resolveBodyLength = async (headers, body) => {
6353
- const length = utils$1.toFiniteNumber(headers.getContentLength());
6354
-
6355
- return length == null ? getBodyLength(body) : length;
6356
- };
6357
-
6358
- return async (config) => {
6359
- let {
6360
- url,
6361
- method,
6362
- data,
6363
- signal,
6364
- cancelToken,
6365
- timeout,
6366
- onDownloadProgress,
6367
- onUploadProgress,
6368
- responseType,
6369
- headers,
6370
- withCredentials = 'same-origin',
6371
- fetchOptions
6372
- } = resolveConfig(config);
6373
-
6374
- let _fetch = envFetch || fetch;
6375
-
6376
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
6233
+ });
6234
+ })(new Response));
6377
6235
 
6378
- let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
6236
+ const getBodyLength = async (body) => {
6237
+ if (body == null) {
6238
+ return 0;
6239
+ }
6379
6240
 
6380
- let request = null;
6241
+ if(utils$1.isBlob(body)) {
6242
+ return body.size;
6243
+ }
6381
6244
 
6382
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
6383
- composedSignal.unsubscribe();
6245
+ if(utils$1.isSpecCompliantForm(body)) {
6246
+ const _request = new Request(platform$1.origin, {
6247
+ method: 'POST',
6248
+ body,
6384
6249
  });
6250
+ return (await _request.arrayBuffer()).byteLength;
6251
+ }
6385
6252
 
6386
- let requestContentLength;
6387
-
6388
- try {
6389
- if (
6390
- onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
6391
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
6392
- ) {
6393
- let _request = new Request(url, {
6394
- method: 'POST',
6395
- body: data,
6396
- duplex: "half"
6397
- });
6253
+ if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
6254
+ return body.byteLength;
6255
+ }
6398
6256
 
6399
- let contentTypeHeader;
6257
+ if(utils$1.isURLSearchParams(body)) {
6258
+ body = body + '';
6259
+ }
6400
6260
 
6401
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
6402
- headers.setContentType(contentTypeHeader);
6403
- }
6261
+ if(utils$1.isString(body)) {
6262
+ return (await encodeText(body)).byteLength;
6263
+ }
6264
+ };
6404
6265
 
6405
- if (_request.body) {
6406
- const [onProgress, flush] = progressEventDecorator(
6407
- requestContentLength,
6408
- progressEventReducer(asyncDecorator(onUploadProgress))
6409
- );
6266
+ const resolveBodyLength = async (headers, body) => {
6267
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
6410
6268
 
6411
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
6412
- }
6413
- }
6269
+ return length == null ? getBodyLength(body) : length;
6270
+ };
6414
6271
 
6415
- if (!utils$1.isString(withCredentials)) {
6416
- withCredentials = withCredentials ? 'include' : 'omit';
6417
- }
6272
+ var fetchAdapter = isFetchSupported && (async (config) => {
6273
+ let {
6274
+ url,
6275
+ method,
6276
+ data,
6277
+ signal,
6278
+ cancelToken,
6279
+ timeout,
6280
+ onDownloadProgress,
6281
+ onUploadProgress,
6282
+ responseType,
6283
+ headers,
6284
+ withCredentials = 'same-origin',
6285
+ fetchOptions
6286
+ } = resolveConfig(config);
6287
+
6288
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
6289
+
6290
+ let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
6291
+
6292
+ let request;
6293
+
6294
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
6295
+ composedSignal.unsubscribe();
6296
+ });
6418
6297
 
6419
- // Cloudflare Workers throws when credentials are defined
6420
- // see https://github.com/cloudflare/workerd/issues/902
6421
- const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
6298
+ let requestContentLength;
6422
6299
 
6423
- const resolvedOptions = {
6424
- ...fetchOptions,
6425
- signal: composedSignal,
6426
- method: method.toUpperCase(),
6427
- headers: headers.normalize().toJSON(),
6300
+ try {
6301
+ if (
6302
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
6303
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
6304
+ ) {
6305
+ let _request = new Request(url, {
6306
+ method: 'POST',
6428
6307
  body: data,
6429
- duplex: "half",
6430
- credentials: isCredentialsSupported ? withCredentials : undefined
6431
- };
6432
-
6433
- request = isRequestSupported && new Request(url, resolvedOptions);
6308
+ duplex: "half"
6309
+ });
6434
6310
 
6435
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
6311
+ let contentTypeHeader;
6436
6312
 
6437
- const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
6313
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
6314
+ headers.setContentType(contentTypeHeader);
6315
+ }
6438
6316
 
6439
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
6440
- const options = {};
6317
+ if (_request.body) {
6318
+ const [onProgress, flush] = progressEventDecorator(
6319
+ requestContentLength,
6320
+ progressEventReducer(asyncDecorator(onUploadProgress))
6321
+ );
6441
6322
 
6442
- ['status', 'statusText', 'headers'].forEach(prop => {
6443
- options[prop] = response[prop];
6444
- });
6323
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
6324
+ }
6325
+ }
6445
6326
 
6446
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
6327
+ if (!utils$1.isString(withCredentials)) {
6328
+ withCredentials = withCredentials ? 'include' : 'omit';
6329
+ }
6447
6330
 
6448
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
6449
- responseContentLength,
6450
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
6451
- ) || [];
6331
+ // Cloudflare Workers throws when credentials are defined
6332
+ // see https://github.com/cloudflare/workerd/issues/902
6333
+ const isCredentialsSupported = "credentials" in Request.prototype;
6334
+ request = new Request(url, {
6335
+ ...fetchOptions,
6336
+ signal: composedSignal,
6337
+ method: method.toUpperCase(),
6338
+ headers: headers.normalize().toJSON(),
6339
+ body: data,
6340
+ duplex: "half",
6341
+ credentials: isCredentialsSupported ? withCredentials : undefined
6342
+ });
6452
6343
 
6453
- response = new Response(
6454
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
6455
- flush && flush();
6456
- unsubscribe && unsubscribe();
6457
- }),
6458
- options
6459
- );
6460
- }
6344
+ let response = await fetch(request, fetchOptions);
6461
6345
 
6462
- responseType = responseType || 'text';
6346
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
6463
6347
 
6464
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
6348
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
6349
+ const options = {};
6465
6350
 
6466
- !isStreamResponse && unsubscribe && unsubscribe();
6351
+ ['status', 'statusText', 'headers'].forEach(prop => {
6352
+ options[prop] = response[prop];
6353
+ });
6467
6354
 
6468
- return await new Promise((resolve, reject) => {
6469
- settle(resolve, reject, {
6470
- data: responseData,
6471
- headers: AxiosHeaders$1.from(response.headers),
6472
- status: response.status,
6473
- statusText: response.statusText,
6474
- config,
6475
- request
6476
- });
6477
- })
6478
- } catch (err) {
6479
- unsubscribe && unsubscribe();
6355
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
6480
6356
 
6481
- if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
6482
- throw Object.assign(
6483
- new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
6484
- {
6485
- cause: err.cause || err
6486
- }
6487
- )
6488
- }
6357
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
6358
+ responseContentLength,
6359
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
6360
+ ) || [];
6489
6361
 
6490
- throw AxiosError$1.from(err, err && err.code, config, request);
6362
+ response = new Response(
6363
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
6364
+ flush && flush();
6365
+ unsubscribe && unsubscribe();
6366
+ }),
6367
+ options
6368
+ );
6491
6369
  }
6492
- }
6493
- };
6494
6370
 
6495
- const seedCache = new Map();
6371
+ responseType = responseType || 'text';
6496
6372
 
6497
- const getFetch = (config) => {
6498
- let env = (config && config.env) || {};
6499
- const {fetch, Request, Response} = env;
6500
- const seeds = [
6501
- Request, Response, fetch
6502
- ];
6373
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
6503
6374
 
6504
- let len = seeds.length, i = len,
6505
- seed, target, map = seedCache;
6375
+ !isStreamResponse && unsubscribe && unsubscribe();
6506
6376
 
6507
- while (i--) {
6508
- seed = seeds[i];
6509
- target = map.get(seed);
6377
+ return await new Promise((resolve, reject) => {
6378
+ settle(resolve, reject, {
6379
+ data: responseData,
6380
+ headers: AxiosHeaders$1.from(response.headers),
6381
+ status: response.status,
6382
+ statusText: response.statusText,
6383
+ config,
6384
+ request
6385
+ });
6386
+ })
6387
+ } catch (err) {
6388
+ unsubscribe && unsubscribe();
6510
6389
 
6511
- target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
6390
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
6391
+ throw Object.assign(
6392
+ new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
6393
+ {
6394
+ cause: err.cause || err
6395
+ }
6396
+ )
6397
+ }
6512
6398
 
6513
- map = target;
6399
+ throw AxiosError$1.from(err, err && err.code, config, request);
6514
6400
  }
6401
+ });
6515
6402
 
6516
- return target;
6517
- };
6518
-
6519
- getFetch();
6520
-
6521
- /**
6522
- * Known adapters mapping.
6523
- * Provides environment-specific adapters for Axios:
6524
- * - `http` for Node.js
6525
- * - `xhr` for browsers
6526
- * - `fetch` for fetch API-based requests
6527
- *
6528
- * @type {Object<string, Function|Object>}
6529
- */
6530
6403
  const knownAdapters = {
6531
6404
  http: httpAdapter,
6532
6405
  xhr: xhrAdapter,
6533
- fetch: {
6534
- get: getFetch,
6535
- }
6406
+ fetch: fetchAdapter
6536
6407
  };
6537
6408
 
6538
- // Assign adapter names for easier debugging and identification
6539
6409
  utils$1.forEach(knownAdapters, (fn, value) => {
6540
6410
  if (fn) {
6541
6411
  try {
6542
- Object.defineProperty(fn, 'name', { value });
6412
+ Object.defineProperty(fn, 'name', {value});
6543
6413
  } catch (e) {
6544
6414
  // eslint-disable-next-line no-empty
6545
6415
  }
6546
- Object.defineProperty(fn, 'adapterName', { value });
6416
+ Object.defineProperty(fn, 'adapterName', {value});
6547
6417
  }
6548
6418
  });
6549
6419
 
6550
- /**
6551
- * Render a rejection reason string for unknown or unsupported adapters
6552
- *
6553
- * @param {string} reason
6554
- * @returns {string}
6555
- */
6556
6420
  const renderReason = (reason) => `- ${reason}`;
6557
6421
 
6558
- /**
6559
- * Check if the adapter is resolved (function, null, or false)
6560
- *
6561
- * @param {Function|null|false} adapter
6562
- * @returns {boolean}
6563
- */
6564
6422
  const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
6565
6423
 
6566
- /**
6567
- * Get the first suitable adapter from the provided list.
6568
- * Tries each adapter in order until a supported one is found.
6569
- * Throws an AxiosError if no adapter is suitable.
6570
- *
6571
- * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
6572
- * @param {Object} config - Axios request configuration
6573
- * @throws {AxiosError} If no suitable adapter is available
6574
- * @returns {Function} The resolved adapter function
6575
- */
6576
- function getAdapter$1(adapters, config) {
6577
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
6424
+ var adapters = {
6425
+ getAdapter: (adapters) => {
6426
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
6578
6427
 
6579
- const { length } = adapters;
6580
- let nameOrAdapter;
6581
- let adapter;
6428
+ const {length} = adapters;
6429
+ let nameOrAdapter;
6430
+ let adapter;
6582
6431
 
6583
- const rejectedReasons = {};
6432
+ const rejectedReasons = {};
6584
6433
 
6585
- for (let i = 0; i < length; i++) {
6586
- nameOrAdapter = adapters[i];
6587
- let id;
6434
+ for (let i = 0; i < length; i++) {
6435
+ nameOrAdapter = adapters[i];
6436
+ let id;
6588
6437
 
6589
- adapter = nameOrAdapter;
6438
+ adapter = nameOrAdapter;
6590
6439
 
6591
- if (!isResolvedHandle(nameOrAdapter)) {
6592
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
6440
+ if (!isResolvedHandle(nameOrAdapter)) {
6441
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
6593
6442
 
6594
- if (adapter === undefined) {
6595
- throw new AxiosError$1(`Unknown adapter '${id}'`);
6443
+ if (adapter === undefined) {
6444
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
6445
+ }
6596
6446
  }
6597
- }
6598
-
6599
- if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
6600
- break;
6601
- }
6602
6447
 
6603
- rejectedReasons[id || '#' + i] = adapter;
6604
- }
6448
+ if (adapter) {
6449
+ break;
6450
+ }
6605
6451
 
6606
- if (!adapter) {
6607
- const reasons = Object.entries(rejectedReasons)
6608
- .map(([id, state]) => `adapter ${id} ` +
6609
- (state === false ? 'is not supported by the environment' : 'is not available in the build')
6610
- );
6452
+ rejectedReasons[id || '#' + i] = adapter;
6453
+ }
6611
6454
 
6612
- let s = length ?
6613
- (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
6614
- 'as no adapter specified';
6455
+ if (!adapter) {
6615
6456
 
6616
- throw new AxiosError$1(
6617
- `There is no suitable adapter to dispatch the request ` + s,
6618
- 'ERR_NOT_SUPPORT'
6619
- );
6620
- }
6457
+ const reasons = Object.entries(rejectedReasons)
6458
+ .map(([id, state]) => `adapter ${id} ` +
6459
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
6460
+ );
6621
6461
 
6622
- return adapter;
6623
- }
6462
+ let s = length ?
6463
+ (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
6464
+ 'as no adapter specified';
6624
6465
 
6625
- /**
6626
- * Exports Axios adapters and utility to resolve an adapter
6627
- */
6628
- var adapters = {
6629
- /**
6630
- * Resolve an adapter from a list of adapter names or functions.
6631
- * @type {Function}
6632
- */
6633
- getAdapter: getAdapter$1,
6466
+ throw new AxiosError$1(
6467
+ `There is no suitable adapter to dispatch the request ` + s,
6468
+ 'ERR_NOT_SUPPORT'
6469
+ );
6470
+ }
6634
6471
 
6635
- /**
6636
- * Exposes all known adapters
6637
- * @type {Object<string, Function|Object>}
6638
- */
6472
+ return adapter;
6473
+ },
6639
6474
  adapters: knownAdapters
6640
6475
  };
6641
6476
 
@@ -6678,7 +6513,7 @@ function dispatchRequest(config) {
6678
6513
  config.headers.setContentType('application/x-www-form-urlencoded', false);
6679
6514
  }
6680
6515
 
6681
- const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
6516
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
6682
6517
 
6683
6518
  return adapter(config).then(function onAdapterResolution(response) {
6684
6519
  throwIfCancellationRequested(config);
@@ -6712,7 +6547,7 @@ function dispatchRequest(config) {
6712
6547
  });
6713
6548
  }
6714
6549
 
6715
- const VERSION$1 = "1.13.2";
6550
+ const VERSION$1 = "1.10.0";
6716
6551
 
6717
6552
  const validators$1 = {};
6718
6553
 
@@ -6951,8 +6786,8 @@ let Axios$1 = class Axios {
6951
6786
 
6952
6787
  if (!synchronousRequestInterceptors) {
6953
6788
  const chain = [dispatchRequest.bind(this), undefined];
6954
- chain.unshift(...requestInterceptorChain);
6955
- chain.push(...responseInterceptorChain);
6789
+ chain.unshift.apply(chain, requestInterceptorChain);
6790
+ chain.push.apply(chain, responseInterceptorChain);
6956
6791
  len = chain.length;
6957
6792
 
6958
6793
  promise = Promise.resolve(config);
@@ -6968,6 +6803,8 @@ let Axios$1 = class Axios {
6968
6803
 
6969
6804
  let newConfig = config;
6970
6805
 
6806
+ i = 0;
6807
+
6971
6808
  while (i < len) {
6972
6809
  const onFulfilled = requestInterceptorChain[i++];
6973
6810
  const onRejected = requestInterceptorChain[i++];
@@ -7267,12 +7104,6 @@ const HttpStatusCode$1 = {
7267
7104
  LoopDetected: 508,
7268
7105
  NotExtended: 510,
7269
7106
  NetworkAuthenticationRequired: 511,
7270
- WebServerIsDown: 521,
7271
- ConnectionTimedOut: 522,
7272
- OriginIsUnreachable: 523,
7273
- TimeoutOccurred: 524,
7274
- SslHandshakeFailed: 525,
7275
- InvalidSslCertificate: 526,
7276
7107
  };
7277
7108
 
7278
7109
  Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
@@ -7612,9 +7443,8 @@ class ZodError extends Error {
7612
7443
  const formErrors = [];
7613
7444
  for (const sub of this.issues) {
7614
7445
  if (sub.path.length > 0) {
7615
- const firstEl = sub.path[0];
7616
- fieldErrors[firstEl] = fieldErrors[firstEl] || [];
7617
- fieldErrors[firstEl].push(mapper(sub));
7446
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
7447
+ fieldErrors[sub.path[0]].push(mapper(sub));
7618
7448
  }
7619
7449
  else {
7620
7450
  formErrors.push(mapper(sub));
@@ -7698,8 +7528,6 @@ const errorMap = (issue, _ctx) => {
7698
7528
  message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
7699
7529
  else if (issue.type === "number")
7700
7530
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
7701
- else if (issue.type === "bigint")
7702
- message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
7703
7531
  else if (issue.type === "date")
7704
7532
  message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
7705
7533
  else
@@ -8297,8 +8125,6 @@ function isValidJWT(jwt, alg) {
8297
8125
  return false;
8298
8126
  try {
8299
8127
  const [header] = jwt.split(".");
8300
- if (!header)
8301
- return false;
8302
8128
  // Convert base64url to base64
8303
8129
  const base64 = header
8304
8130
  .replace(/-/g, "+")
@@ -12263,41 +12089,29 @@ var createApiClient = (apiKey, proxy) => {
12263
12089
  baseURL: proxy ?? API_BASE_URL,
12264
12090
  headers: {
12265
12091
  "Content-Type": "application/json",
12266
- Authorization: `Bearer ${apiKey}`,
12267
- "Access-Control-Allow-Origin": "*",
12268
- "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
12269
- "Access-Control-Allow-Headers": "Content-Type, Authorization"
12092
+ Authorization: `Bearer ${apiKey}`
12270
12093
  }
12271
12094
  });
12095
+ if (process.env.NODE_ENV === "development") {
12096
+ client.interceptors.request.use((config) => {
12097
+ console.log("Request method:", config.method);
12098
+ console.log("Request URL:", config.url);
12099
+ console.log("Request headers:", config.headers);
12100
+ console.log("Request body:", config.data);
12101
+ return config;
12102
+ });
12103
+ }
12272
12104
  client.interceptors.response.use(
12273
12105
  (response) => response.data,
12274
12106
  (error) => {
12275
12107
  const apiError = {
12276
12108
  isError: true,
12277
- status: 500,
12278
- message: "An unexpected error occurred"
12109
+ status: error.response?.status ?? 500,
12110
+ message: error.response?.data?.error || error.message || "Unknown error",
12111
+ code: error.response?.data?.code,
12112
+ details: error.response?.data
12279
12113
  };
12280
- if (error.response) {
12281
- apiError.status = error.response.status;
12282
- apiError.message = error.response.data?.error || "Server error occurred";
12283
- apiError.code = error.response.data?.code;
12284
- apiError.details = error.response.data;
12285
- } else if (error.request) {
12286
- apiError.status = 503;
12287
- apiError.message = "Service unavailable - no response from server";
12288
- apiError.code = "SERVICE_UNAVAILABLE";
12289
- apiError.details = error;
12290
- } else {
12291
- apiError.status = 500;
12292
- apiError.message = "Request configuration error";
12293
- apiError.code = "REQUEST_SETUP_ERROR";
12294
- apiError.details = error;
12295
- }
12296
- console.error("API ERROR: ", apiError);
12297
- if (apiError.code === "REQUEST_SETUP_ERROR" || apiError.code === "SERVICE_UNAVAILABLE") {
12298
- throw apiError;
12299
- }
12300
- return apiError;
12114
+ throw apiError;
12301
12115
  }
12302
12116
  );
12303
12117
  return client;
@@ -12328,9 +12142,9 @@ var Client = class {
12328
12142
  */
12329
12143
  async updateCheckout(clientSecret, checkoutId, params) {
12330
12144
  const apiClient = createApiClient(clientSecret, this.proxy);
12331
- const data = await apiClient.put(
12332
- `/checkout/${checkoutId}`,
12333
- params
12145
+ const data = await apiClient.post(
12146
+ `/checkout/${checkoutId}/update`,
12147
+ { ...params }
12334
12148
  );
12335
12149
  if ("isError" in data && data.isError || !data || !("id" in data)) {
12336
12150
  console.error(`Checkout session with id ${checkoutId} not found`);
@@ -13153,7 +12967,6 @@ const Toast = (props)=>{
13153
12967
  "data-swipe-out": swipeOut,
13154
12968
  "data-swipe-direction": swipeOutDirection,
13155
12969
  "data-expanded": Boolean(expanded || expandByDefault && mounted),
13156
- "data-testid": toast.testId,
13157
12970
  style: {
13158
12971
  '--index': index,
13159
12972
  '--toasts-before': index,
@@ -13169,7 +12982,6 @@ const Toast = (props)=>{
13169
12982
  pointerStartRef.current = null;
13170
12983
  },
13171
12984
  onPointerDown: (event)=>{
13172
- if (event.button === 2) return; // Return early on right click
13173
12985
  if (disabled || !dismissible) return;
13174
12986
  dragStartTime.current = new Date();
13175
12987
  setOffsetBeforeRemove(offset.current);
@@ -13362,26 +13174,17 @@ function assignOffset(defaultOffset, mobileOffset) {
13362
13174
  return styles;
13363
13175
  }
13364
13176
  const Toaster$1 = /*#__PURE__*/ React__default.forwardRef(function Toaster(props, ref) {
13365
- const { id, invert, position = 'bottom-right', hotkey = [
13177
+ const { invert, position = 'bottom-right', hotkey = [
13366
13178
  'altKey',
13367
13179
  'KeyT'
13368
13180
  ], expand, closeButton, className, offset, mobileOffset, theme = 'light', richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = 'Notifications' } = props;
13369
13181
  const [toasts, setToasts] = React__default.useState([]);
13370
- const filteredToasts = React__default.useMemo(()=>{
13371
- if (id) {
13372
- return toasts.filter((toast)=>toast.toasterId === id);
13373
- }
13374
- return toasts.filter((toast)=>!toast.toasterId);
13375
- }, [
13376
- toasts,
13377
- id
13378
- ]);
13379
13182
  const possiblePositions = React__default.useMemo(()=>{
13380
13183
  return Array.from(new Set([
13381
13184
  position
13382
- ].concat(filteredToasts.filter((toast)=>toast.position).map((toast)=>toast.position))));
13185
+ ].concat(toasts.filter((toast)=>toast.position).map((toast)=>toast.position))));
13383
13186
  }, [
13384
- filteredToasts,
13187
+ toasts,
13385
13188
  position
13386
13189
  ]);
13387
13190
  const [heights, setHeights] = React__default.useState([]);
@@ -13536,7 +13339,7 @@ const Toaster$1 = /*#__PURE__*/ React__default.forwardRef(function Toaster(props
13536
13339
  }, possiblePositions.map((position, index)=>{
13537
13340
  var _heights_;
13538
13341
  const [y, x] = position.split('-');
13539
- if (!filteredToasts.length) return null;
13342
+ if (!toasts.length) return null;
13540
13343
  return /*#__PURE__*/ React__default.createElement("ol", {
13541
13344
  key: position,
13542
13345
  dir: dir === 'auto' ? getDocumentDirection() : dir,
@@ -13588,7 +13391,7 @@ const Toaster$1 = /*#__PURE__*/ React__default.forwardRef(function Toaster(props
13588
13391
  setInteracting(true);
13589
13392
  },
13590
13393
  onPointerUp: ()=>setInteracting(false)
13591
- }, filteredToasts.filter((toast)=>!toast.position && index === 0 || toast.position === position).map((toast, index)=>{
13394
+ }, toasts.filter((toast)=>!toast.position && index === 0 || toast.position === position).map((toast, index)=>{
13592
13395
  var _toastOptions_duration, _toastOptions_closeButton;
13593
13396
  return /*#__PURE__*/ React__default.createElement(Toast, {
13594
13397
  key: toast.id,
@@ -13611,7 +13414,7 @@ const Toaster$1 = /*#__PURE__*/ React__default.forwardRef(function Toaster(props
13611
13414
  actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
13612
13415
  closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
13613
13416
  removeToast: removeToast,
13614
- toasts: filteredToasts.filter((t)=>t.position == toast.position),
13417
+ toasts: toasts.filter((t)=>t.position == toast.position),
13615
13418
  heights: heights.filter((h)=>h.position == toast.position),
13616
13419
  setHeights: setHeights,
13617
13420
  expandByDefault: expand,
@@ -13675,16 +13478,7 @@ objectType({
13675
13478
  });
13676
13479
 
13677
13480
  const formatAddress = (address) => {
13678
- const partWithoutComma = [address.province, address.zipCode]
13679
- .filter(Boolean)
13680
- .join(" ");
13681
- const parts = [
13682
- address.line1,
13683
- address.line2,
13684
- address.city,
13685
- partWithoutComma,
13686
- address.country,
13687
- ].filter(Boolean);
13481
+ const parts = [address.line1, address.zipCode, address.country].filter(Boolean);
13688
13482
  return parts.join(", ");
13689
13483
  };
13690
13484
 
@@ -13725,24 +13519,13 @@ function useComposedRefs(...refs) {
13725
13519
  }
13726
13520
 
13727
13521
  // src/slot.tsx
13728
- var REACT_LAZY_TYPE = Symbol.for("react.lazy");
13729
- var use = React[" use ".trim().toString()];
13730
- function isPromiseLike(value) {
13731
- return typeof value === "object" && value !== null && "then" in value;
13732
- }
13733
- function isLazyComponent(element) {
13734
- return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
13735
- }
13736
13522
  // @__NO_SIDE_EFFECTS__
13737
- function createSlot$1(ownerName) {
13738
- const SlotClone = /* @__PURE__ */ createSlotClone$1(ownerName);
13523
+ function createSlot(ownerName) {
13524
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
13739
13525
  const Slot2 = React.forwardRef((props, forwardedRef) => {
13740
- let { children, ...slotProps } = props;
13741
- if (isLazyComponent(children) && typeof use === "function") {
13742
- children = use(children._payload);
13743
- }
13526
+ const { children, ...slotProps } = props;
13744
13527
  const childrenArray = React.Children.toArray(children);
13745
- const slottable = childrenArray.find(isSlottable$1);
13528
+ const slottable = childrenArray.find(isSlottable);
13746
13529
  if (slottable) {
13747
13530
  const newElement = slottable.props.children;
13748
13531
  const newChildren = childrenArray.map((child) => {
@@ -13760,17 +13543,14 @@ function createSlot$1(ownerName) {
13760
13543
  Slot2.displayName = `${ownerName}.Slot`;
13761
13544
  return Slot2;
13762
13545
  }
13763
- var Slot$2 = /* @__PURE__ */ createSlot$1("Slot");
13546
+ var Slot$2 = /* @__PURE__ */ createSlot("Slot");
13764
13547
  // @__NO_SIDE_EFFECTS__
13765
- function createSlotClone$1(ownerName) {
13548
+ function createSlotClone(ownerName) {
13766
13549
  const SlotClone = React.forwardRef((props, forwardedRef) => {
13767
- let { children, ...slotProps } = props;
13768
- if (isLazyComponent(children) && typeof use === "function") {
13769
- children = use(children._payload);
13770
- }
13550
+ const { children, ...slotProps } = props;
13771
13551
  if (React.isValidElement(children)) {
13772
- const childrenRef = getElementRef$2(children);
13773
- const props2 = mergeProps$1(slotProps, children.props);
13552
+ const childrenRef = getElementRef$1(children);
13553
+ const props2 = mergeProps(slotProps, children.props);
13774
13554
  if (children.type !== React.Fragment) {
13775
13555
  props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
13776
13556
  }
@@ -13781,11 +13561,11 @@ function createSlotClone$1(ownerName) {
13781
13561
  SlotClone.displayName = `${ownerName}.SlotClone`;
13782
13562
  return SlotClone;
13783
13563
  }
13784
- var SLOTTABLE_IDENTIFIER$1 = Symbol("radix.slottable");
13785
- function isSlottable$1(child) {
13786
- return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER$1;
13564
+ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
13565
+ function isSlottable(child) {
13566
+ return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
13787
13567
  }
13788
- function mergeProps$1(slotProps, childProps) {
13568
+ function mergeProps(slotProps, childProps) {
13789
13569
  const overrideProps = { ...childProps };
13790
13570
  for (const propName in childProps) {
13791
13571
  const slotPropValue = slotProps[propName];
@@ -13809,7 +13589,7 @@ function mergeProps$1(slotProps, childProps) {
13809
13589
  }
13810
13590
  return { ...slotProps, ...overrideProps };
13811
13591
  }
13812
- function getElementRef$2(element) {
13592
+ function getElementRef$1(element) {
13813
13593
  let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
13814
13594
  let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
13815
13595
  if (mayWarn) {
@@ -13861,9 +13641,12 @@ function cloneObject(data) {
13861
13641
  if (data instanceof Date) {
13862
13642
  copy = new Date(data);
13863
13643
  }
13644
+ else if (data instanceof Set) {
13645
+ copy = new Set(data);
13646
+ }
13864
13647
  else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&
13865
13648
  (isArray || isObject(data))) {
13866
- copy = isArray ? [] : Object.create(Object.getPrototypeOf(data));
13649
+ copy = isArray ? [] : {};
13867
13650
  if (!isArray && !isPlainObject(data)) {
13868
13651
  copy = data;
13869
13652
  }
@@ -13984,7 +13767,7 @@ HookFormContext.displayName = 'HookFormContext';
13984
13767
  */
13985
13768
  const useFormContext = () => React__default.useContext(HookFormContext);
13986
13769
  /**
13987
- * A provider component that propagates the `useForm` methods to all children components via [React Context](https://react.dev/reference/react/useContext) API. To be used with {@link useFormContext}.
13770
+ * A provider component that propagates the `useForm` methods to all children components via [React Context](https://reactjs.org/docs/context.html) API. To be used with {@link useFormContext}.
13988
13771
  *
13989
13772
  * @remarks
13990
13773
  * [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
@@ -14037,7 +13820,7 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
14037
13820
  return result;
14038
13821
  };
14039
13822
 
14040
- const useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ? React__default.useLayoutEffect : React__default.useEffect;
13823
+ const useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
14041
13824
 
14042
13825
  /**
14043
13826
  * This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.
@@ -14109,51 +13892,12 @@ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) =>
14109
13892
  return get(formValues, names, defaultValue);
14110
13893
  }
14111
13894
  if (Array.isArray(names)) {
14112
- return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName),
14113
- get(formValues, fieldName)));
13895
+ return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName), get(formValues, fieldName)));
14114
13896
  }
14115
13897
  isGlobal && (_names.watchAll = true);
14116
13898
  return formValues;
14117
13899
  };
14118
13900
 
14119
- var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
14120
-
14121
- function deepEqual$1(object1, object2, _internal_visited = new WeakSet()) {
14122
- if (isPrimitive(object1) || isPrimitive(object2)) {
14123
- return Object.is(object1, object2);
14124
- }
14125
- if (isDateObject(object1) && isDateObject(object2)) {
14126
- return object1.getTime() === object2.getTime();
14127
- }
14128
- const keys1 = Object.keys(object1);
14129
- const keys2 = Object.keys(object2);
14130
- if (keys1.length !== keys2.length) {
14131
- return false;
14132
- }
14133
- if (_internal_visited.has(object1) || _internal_visited.has(object2)) {
14134
- return true;
14135
- }
14136
- _internal_visited.add(object1);
14137
- _internal_visited.add(object2);
14138
- for (const key of keys1) {
14139
- const val1 = object1[key];
14140
- if (!keys2.includes(key)) {
14141
- return false;
14142
- }
14143
- if (key !== 'ref') {
14144
- const val2 = object2[key];
14145
- if ((isDateObject(val1) && isDateObject(val2)) ||
14146
- (isObject(val1) && isObject(val2)) ||
14147
- (Array.isArray(val1) && Array.isArray(val2))
14148
- ? !deepEqual$1(val1, val2, _internal_visited)
14149
- : !Object.is(val1, val2)) {
14150
- return false;
14151
- }
14152
- }
14153
- }
14154
- return true;
14155
- }
14156
-
14157
13901
  /**
14158
13902
  * Custom hook to subscribe to field change and isolate re-rendering at the component level.
14159
13903
  *
@@ -14172,72 +13916,20 @@ function deepEqual$1(object1, object2, _internal_visited = new WeakSet()) {
14172
13916
  */
14173
13917
  function useWatch(props) {
14174
13918
  const methods = useFormContext();
14175
- const { control = methods.control, name, defaultValue, disabled, exact, compute, } = props || {};
13919
+ const { control = methods.control, name, defaultValue, disabled, exact, } = props || {};
14176
13920
  const _defaultValue = React__default.useRef(defaultValue);
14177
- const _compute = React__default.useRef(compute);
14178
- const _computeFormValues = React__default.useRef(undefined);
14179
- const _prevControl = React__default.useRef(control);
14180
- const _prevName = React__default.useRef(name);
14181
- _compute.current = compute;
14182
- const [value, updateValue] = React__default.useState(() => {
14183
- const defaultValue = control._getWatch(name, _defaultValue.current);
14184
- return _compute.current ? _compute.current(defaultValue) : defaultValue;
14185
- });
14186
- const getCurrentOutput = React__default.useCallback((values) => {
14187
- const formValues = generateWatchOutput(name, control._names, values || control._formValues, false, _defaultValue.current);
14188
- return _compute.current ? _compute.current(formValues) : formValues;
14189
- }, [control._formValues, control._names, name]);
14190
- const refreshValue = React__default.useCallback((values) => {
14191
- if (!disabled) {
14192
- const formValues = generateWatchOutput(name, control._names, values || control._formValues, false, _defaultValue.current);
14193
- if (_compute.current) {
14194
- const computedFormValues = _compute.current(formValues);
14195
- if (!deepEqual$1(computedFormValues, _computeFormValues.current)) {
14196
- updateValue(computedFormValues);
14197
- _computeFormValues.current = computedFormValues;
14198
- }
14199
- }
14200
- else {
14201
- updateValue(formValues);
14202
- }
14203
- }
14204
- }, [control._formValues, control._names, disabled, name]);
14205
- useIsomorphicLayoutEffect$1(() => {
14206
- if (_prevControl.current !== control ||
14207
- !deepEqual$1(_prevName.current, name)) {
14208
- _prevControl.current = control;
14209
- _prevName.current = name;
14210
- refreshValue();
14211
- }
14212
- return control._subscribe({
14213
- name,
14214
- formState: {
14215
- values: true,
14216
- },
14217
- exact,
14218
- callback: (formState) => {
14219
- refreshValue(formState.values);
14220
- },
14221
- });
14222
- }, [control, exact, name, refreshValue]);
13921
+ const [value, updateValue] = React__default.useState(control._getWatch(name, _defaultValue.current));
13922
+ useIsomorphicLayoutEffect$1(() => control._subscribe({
13923
+ name,
13924
+ formState: {
13925
+ values: true,
13926
+ },
13927
+ exact,
13928
+ callback: (formState) => !disabled &&
13929
+ updateValue(generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current)),
13930
+ }), [name, control, disabled, exact]);
14223
13931
  React__default.useEffect(() => control._removeUnmounted());
14224
- // If name or control changed for this render, synchronously reflect the
14225
- // latest value so callers (like useController) see the correct value
14226
- // immediately on the same render.
14227
- // Optimize: Check control reference first before expensive deepEqual
14228
- const controlChanged = _prevControl.current !== control;
14229
- const prevName = _prevName.current;
14230
- // Cache the computed output to avoid duplicate calls within the same render
14231
- // We include shouldReturnImmediate in deps to ensure proper recomputation
14232
- const computedOutput = React__default.useMemo(() => {
14233
- if (disabled) {
14234
- return null;
14235
- }
14236
- const nameChanged = !controlChanged && !deepEqual$1(prevName, name);
14237
- const shouldReturnImmediate = controlChanged || nameChanged;
14238
- return shouldReturnImmediate ? getCurrentOutput() : null;
14239
- }, [disabled, controlChanged, name, prevName, getCurrentOutput]);
14240
- return computedOutput !== null ? computedOutput : value;
13932
+ return value;
14241
13933
  }
14242
13934
 
14243
13935
  /**
@@ -14266,13 +13958,12 @@ function useWatch(props) {
14266
13958
  */
14267
13959
  function useController(props) {
14268
13960
  const methods = useFormContext();
14269
- const { name, disabled, control = methods.control, shouldUnregister, defaultValue, } = props;
13961
+ const { name, disabled, control = methods.control, shouldUnregister } = props;
14270
13962
  const isArrayField = isNameInFieldArray(control._names.array, name);
14271
- const defaultValueMemo = React__default.useMemo(() => get(control._formValues, name, get(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
14272
13963
  const value = useWatch({
14273
13964
  control,
14274
13965
  name,
14275
- defaultValue: defaultValueMemo,
13966
+ defaultValue: get(control._formValues, name, get(control._defaultValues, name, props.defaultValue)),
14276
13967
  exact: true,
14277
13968
  });
14278
13969
  const formState = useFormState({
@@ -14281,13 +13972,11 @@ function useController(props) {
14281
13972
  exact: true,
14282
13973
  });
14283
13974
  const _props = React__default.useRef(props);
14284
- const _previousNameRef = React__default.useRef(undefined);
14285
13975
  const _registerProps = React__default.useRef(control.register(name, {
14286
13976
  ...props.rules,
14287
13977
  value,
14288
13978
  ...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
14289
13979
  }));
14290
- _props.current = props;
14291
13980
  const fieldState = React__default.useMemo(() => Object.defineProperties({}, {
14292
13981
  invalid: {
14293
13982
  enumerable: true,
@@ -14347,10 +14036,6 @@ function useController(props) {
14347
14036
  }), [name, disabled, formState.disabled, onChange, onBlur, ref, value]);
14348
14037
  React__default.useEffect(() => {
14349
14038
  const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
14350
- const previousName = _previousNameRef.current;
14351
- if (previousName && previousName !== name && !isArrayField) {
14352
- control.unregister(previousName);
14353
- }
14354
14039
  control.register(name, {
14355
14040
  ..._props.current.rules,
14356
14041
  ...(isBoolean(_props.current.disabled)
@@ -14365,14 +14050,13 @@ function useController(props) {
14365
14050
  };
14366
14051
  updateMounted(name, true);
14367
14052
  if (_shouldUnregisterField) {
14368
- const value = cloneObject(get(control._options.defaultValues, name, _props.current.defaultValue));
14053
+ const value = cloneObject(get(control._options.defaultValues, name));
14369
14054
  set(control._defaultValues, name, value);
14370
14055
  if (isUndefined(get(control._formValues, name))) {
14371
14056
  set(control._formValues, name, value);
14372
14057
  }
14373
14058
  }
14374
14059
  !isArrayField && control.register(name);
14375
- _previousNameRef.current = name;
14376
14060
  return () => {
14377
14061
  (isArrayField
14378
14062
  ? _shouldUnregisterField && !control._state.action
@@ -14478,24 +14162,42 @@ var createSubject = () => {
14478
14162
  };
14479
14163
  };
14480
14164
 
14481
- function extractFormValues(fieldsState, formValues) {
14482
- const values = {};
14483
- for (const key in fieldsState) {
14484
- if (fieldsState.hasOwnProperty(key)) {
14485
- const fieldState = fieldsState[key];
14486
- const fieldValue = formValues[key];
14487
- if (fieldState && isObject(fieldState) && fieldValue) {
14488
- const nestedFieldsState = extractFormValues(fieldState, fieldValue);
14489
- if (isObject(nestedFieldsState)) {
14490
- values[key] = nestedFieldsState;
14491
- }
14492
- }
14493
- else if (fieldsState[key]) {
14494
- values[key] = fieldValue;
14165
+ var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
14166
+
14167
+ function deepEqual$1(object1, object2, _internal_visited = new WeakSet()) {
14168
+ if (isPrimitive(object1) || isPrimitive(object2)) {
14169
+ return object1 === object2;
14170
+ }
14171
+ if (isDateObject(object1) && isDateObject(object2)) {
14172
+ return object1.getTime() === object2.getTime();
14173
+ }
14174
+ const keys1 = Object.keys(object1);
14175
+ const keys2 = Object.keys(object2);
14176
+ if (keys1.length !== keys2.length) {
14177
+ return false;
14178
+ }
14179
+ if (_internal_visited.has(object1) || _internal_visited.has(object2)) {
14180
+ return true;
14181
+ }
14182
+ _internal_visited.add(object1);
14183
+ _internal_visited.add(object2);
14184
+ for (const key of keys1) {
14185
+ const val1 = object1[key];
14186
+ if (!keys2.includes(key)) {
14187
+ return false;
14188
+ }
14189
+ if (key !== 'ref') {
14190
+ const val2 = object2[key];
14191
+ if ((isDateObject(val1) && isDateObject(val2)) ||
14192
+ (isObject(val1) && isObject(val2)) ||
14193
+ (Array.isArray(val1) && Array.isArray(val2))
14194
+ ? !deepEqual$1(val1, val2, _internal_visited)
14195
+ : val1 !== val2) {
14196
+ return false;
14495
14197
  }
14496
14198
  }
14497
14199
  }
14498
- return values;
14200
+ return true;
14499
14201
  }
14500
14202
 
14501
14203
  var isEmptyObject = (value) => isObject(value) && !Object.keys(value).length;
@@ -14566,43 +14268,46 @@ var objectHasFunction = (data) => {
14566
14268
  return false;
14567
14269
  };
14568
14270
 
14569
- function isTraversable(value) {
14570
- return Array.isArray(value) || (isObject(value) && !objectHasFunction(value));
14571
- }
14572
14271
  function markFieldsDirty(data, fields = {}) {
14573
- for (const key in data) {
14574
- const value = data[key];
14575
- if (isTraversable(value)) {
14576
- fields[key] = Array.isArray(value) ? [] : {};
14577
- markFieldsDirty(value, fields[key]);
14578
- }
14579
- else if (!isUndefined(value)) {
14580
- fields[key] = true;
14272
+ const isParentNodeArray = Array.isArray(data);
14273
+ if (isObject(data) || isParentNodeArray) {
14274
+ for (const key in data) {
14275
+ if (Array.isArray(data[key]) ||
14276
+ (isObject(data[key]) && !objectHasFunction(data[key]))) {
14277
+ fields[key] = Array.isArray(data[key]) ? [] : {};
14278
+ markFieldsDirty(data[key], fields[key]);
14279
+ }
14280
+ else if (!isNullOrUndefined(data[key])) {
14281
+ fields[key] = true;
14282
+ }
14581
14283
  }
14582
14284
  }
14583
14285
  return fields;
14584
14286
  }
14585
- function getDirtyFields(data, formValues, dirtyFieldsFromValues) {
14586
- if (!dirtyFieldsFromValues) {
14587
- dirtyFieldsFromValues = markFieldsDirty(formValues);
14588
- }
14589
- for (const key in data) {
14590
- const value = data[key];
14591
- if (isTraversable(value)) {
14592
- if (isUndefined(formValues) || isPrimitive(dirtyFieldsFromValues[key])) {
14593
- dirtyFieldsFromValues[key] = markFieldsDirty(value, Array.isArray(value) ? [] : {});
14287
+ function getDirtyFieldsFromDefaultValues(data, formValues, dirtyFieldsFromValues) {
14288
+ const isParentNodeArray = Array.isArray(data);
14289
+ if (isObject(data) || isParentNodeArray) {
14290
+ for (const key in data) {
14291
+ if (Array.isArray(data[key]) ||
14292
+ (isObject(data[key]) && !objectHasFunction(data[key]))) {
14293
+ if (isUndefined(formValues) ||
14294
+ isPrimitive(dirtyFieldsFromValues[key])) {
14295
+ dirtyFieldsFromValues[key] = Array.isArray(data[key])
14296
+ ? markFieldsDirty(data[key], [])
14297
+ : { ...markFieldsDirty(data[key]) };
14298
+ }
14299
+ else {
14300
+ getDirtyFieldsFromDefaultValues(data[key], isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);
14301
+ }
14594
14302
  }
14595
14303
  else {
14596
- getDirtyFields(value, isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);
14304
+ dirtyFieldsFromValues[key] = !deepEqual$1(data[key], formValues[key]);
14597
14305
  }
14598
14306
  }
14599
- else {
14600
- const formValue = formValues[key];
14601
- dirtyFieldsFromValues[key] = !deepEqual$1(value, formValue);
14602
- }
14603
14307
  }
14604
14308
  return dirtyFieldsFromValues;
14605
14309
  }
14310
+ var getDirtyFields = (defaultValues, formValues) => getDirtyFieldsFromDefaultValues(defaultValues, formValues, markFieldsDirty(formValues));
14606
14311
 
14607
14312
  const defaultResult = {
14608
14313
  value: false,
@@ -14836,13 +14541,15 @@ var updateFieldArrayRootError = (errors, error, name) => {
14836
14541
  return errors;
14837
14542
  };
14838
14543
 
14544
+ var isMessage = (value) => isString(value);
14545
+
14839
14546
  function getValidateError(result, ref, type = 'validate') {
14840
- if (isString(result) ||
14841
- (Array.isArray(result) && result.every(isString)) ||
14547
+ if (isMessage(result) ||
14548
+ (Array.isArray(result) && result.every(isMessage)) ||
14842
14549
  (isBoolean(result) && !result)) {
14843
14550
  return {
14844
14551
  type,
14845
- message: isString(result) ? result : '',
14552
+ message: isMessage(result) ? result : '',
14846
14553
  ref,
14847
14554
  };
14848
14555
  }
@@ -14895,7 +14602,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
14895
14602
  (isBoolean(inputValue) && !inputValue) ||
14896
14603
  (isCheckBox && !getCheckboxValue(refs).isValid) ||
14897
14604
  (isRadio && !getRadioValue(refs).isValid))) {
14898
- const { value, message } = isString(required)
14605
+ const { value, message } = isMessage(required)
14899
14606
  ? { value: !!required, message: required }
14900
14607
  : getValueAndMessage(required);
14901
14608
  if (value) {
@@ -15060,7 +14767,7 @@ function createFormControl(props = {}) {
15060
14767
  errors: _options.errors || {},
15061
14768
  disabled: _options.disabled || false,
15062
14769
  };
15063
- let _fields = {};
14770
+ const _fields = {};
15064
14771
  let _defaultValues = isObject(_options.defaultValues) || isObject(_options.values)
15065
14772
  ? cloneObject(_options.defaultValues || _options.values) || {}
15066
14773
  : {};
@@ -15193,7 +14900,7 @@ function createFormControl(props = {}) {
15193
14900
  shouldSkipSetValueAs
15194
14901
  ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f))
15195
14902
  : setFieldValue(name, defaultValue);
15196
- _state.mount && !_state.action && _setValid();
14903
+ _state.mount && _setValid();
15197
14904
  }
15198
14905
  };
15199
14906
  const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
@@ -15301,11 +15008,11 @@ function createFormControl(props = {}) {
15301
15008
  const isFieldArrayRoot = _names.array.has(_f.name);
15302
15009
  const isPromiseFunction = field._f && hasPromiseValidation(field._f);
15303
15010
  if (isPromiseFunction && _proxyFormState.validatingFields) {
15304
- _updateIsValidating([_f.name], true);
15011
+ _updateIsValidating([name], true);
15305
15012
  }
15306
15013
  const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
15307
15014
  if (isPromiseFunction && _proxyFormState.validatingFields) {
15308
- _updateIsValidating([_f.name]);
15015
+ _updateIsValidating([name]);
15309
15016
  }
15310
15017
  if (fieldError[_f.name]) {
15311
15018
  context.valid = false;
@@ -15444,7 +15151,7 @@ function createFormControl(props = {}) {
15444
15151
  ? setValues(name, cloneValue, options)
15445
15152
  : setFieldValue(name, cloneValue, options);
15446
15153
  }
15447
- isWatched(name, _names) && _subjects.state.next({ ..._formState, name });
15154
+ isWatched(name, _names) && _subjects.state.next({ ..._formState });
15448
15155
  _subjects.state.next({
15449
15156
  name: _state.mount ? name : undefined,
15450
15157
  values: cloneObject(_formValues),
@@ -15479,10 +15186,8 @@ function createFormControl(props = {}) {
15479
15186
  const watched = isWatched(name, _names, isBlurEvent);
15480
15187
  set(_formValues, name, fieldValue);
15481
15188
  if (isBlurEvent) {
15482
- if (!target || !target.readOnly) {
15483
- field._f.onBlur && field._f.onBlur(event);
15484
- delayErrorCallback && delayErrorCallback(0);
15485
- }
15189
+ field._f.onBlur && field._f.onBlur(event);
15190
+ delayErrorCallback && delayErrorCallback(0);
15486
15191
  }
15487
15192
  else if (field._f.onChange) {
15488
15193
  field._f.onChange(event);
@@ -15538,7 +15243,6 @@ function createFormControl(props = {}) {
15538
15243
  }
15539
15244
  if (isFieldValueUpdated) {
15540
15245
  field._f.deps &&
15541
- (!Array.isArray(field._f.deps) || field._f.deps.length > 0) &&
15542
15246
  trigger(field._f.deps);
15543
15247
  shouldRenderByError(name, isValid, error, fieldState);
15544
15248
  }
@@ -15586,13 +15290,10 @@ function createFormControl(props = {}) {
15586
15290
  iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
15587
15291
  return validationResult;
15588
15292
  };
15589
- const getValues = (fieldNames, config) => {
15590
- let values = {
15293
+ const getValues = (fieldNames) => {
15294
+ const values = {
15591
15295
  ...(_state.mount ? _formValues : _defaultValues),
15592
15296
  };
15593
- if (config) {
15594
- values = extractFormValues(config.dirtyFields ? _formState.dirtyFields : _formState.touchedFields, values);
15595
- }
15596
15297
  return isUndefined(fieldNames)
15597
15298
  ? values
15598
15299
  : isString(fieldNames)
@@ -15632,8 +15333,7 @@ function createFormControl(props = {}) {
15632
15333
  };
15633
15334
  const watch = (name, defaultValue) => isFunction$1(name)
15634
15335
  ? _subjects.state.subscribe({
15635
- next: (payload) => 'values' in payload &&
15636
- name(_getWatch(undefined, defaultValue), payload),
15336
+ next: (payload) => name(_getWatch(undefined, defaultValue), payload),
15637
15337
  })
15638
15338
  : _getWatch(name, defaultValue, true);
15639
15339
  const _subscribe = (props) => _subjects.state.subscribe({
@@ -15644,7 +15344,6 @@ function createFormControl(props = {}) {
15644
15344
  values: { ..._formValues },
15645
15345
  ..._formState,
15646
15346
  ...formState,
15647
- defaultValues: _defaultValues,
15648
15347
  });
15649
15348
  }
15650
15349
  },
@@ -15914,20 +15613,15 @@ function createFormControl(props = {}) {
15914
15613
  }
15915
15614
  }
15916
15615
  }
15917
- if (keepStateOptions.keepFieldsRef) {
15918
- for (const fieldName of _names.mount) {
15616
+ for (const fieldName of _names.mount) {
15617
+ const value = get(values, fieldName, get(_defaultValues, fieldName));
15618
+ if (!isUndefined(value)) {
15619
+ set(values, fieldName, value);
15919
15620
  setValue(fieldName, get(values, fieldName));
15920
15621
  }
15921
15622
  }
15922
- else {
15923
- _fields = {};
15924
- }
15925
15623
  }
15926
- _formValues = _options.shouldUnregister
15927
- ? keepStateOptions.keepDefaultValues
15928
- ? cloneObject(_defaultValues)
15929
- : {}
15930
- : cloneObject(values);
15624
+ _formValues = cloneObject(values);
15931
15625
  _subjects.array.next({
15932
15626
  values: { ...values },
15933
15627
  });
@@ -15947,8 +15641,7 @@ function createFormControl(props = {}) {
15947
15641
  _state.mount =
15948
15642
  !_proxyFormState.isValid ||
15949
15643
  !!keepStateOptions.keepIsValid ||
15950
- !!keepStateOptions.keepDirtyValues ||
15951
- (!_options.shouldUnregister && !isEmptyObject(values));
15644
+ !!keepStateOptions.keepDirtyValues;
15952
15645
  _state.watch = !!_options.shouldUnregister;
15953
15646
  _subjects.state.next({
15954
15647
  submitCount: keepStateOptions.keepSubmitCount
@@ -15982,7 +15675,6 @@ function createFormControl(props = {}) {
15982
15675
  ? _formState.isSubmitSuccessful
15983
15676
  : false,
15984
15677
  isSubmitting: false,
15985
- defaultValues: _defaultValues,
15986
15678
  });
15987
15679
  };
15988
15680
  const reset = (formValues, keepStateOptions) => _reset(isFunction$1(formValues)
@@ -16210,15 +15902,8 @@ function useForm(props = {}) {
16210
15902
  }
16211
15903
  }, [control, formState.isDirty]);
16212
15904
  React__default.useEffect(() => {
16213
- var _a;
16214
15905
  if (props.values && !deepEqual$1(props.values, _values.current)) {
16215
- control._reset(props.values, {
16216
- keepFieldsRef: true,
16217
- ...control._options.resetOptions,
16218
- });
16219
- if (!((_a = control._options.resetOptions) === null || _a === void 0 ? void 0 : _a.keepIsValid)) {
16220
- control._setValid();
16221
- }
15906
+ control._reset(props.values, control._options.resetOptions);
16222
15907
  _values.current = props.values;
16223
15908
  updateFormState((state) => ({ ...state }));
16224
15909
  }
@@ -16242,7 +15927,7 @@ function useForm(props = {}) {
16242
15927
  }
16243
15928
 
16244
15929
  // src/primitive.tsx
16245
- var NODES$1 = [
15930
+ var NODES = [
16246
15931
  "a",
16247
15932
  "button",
16248
15933
  "div",
@@ -16261,8 +15946,8 @@ var NODES$1 = [
16261
15946
  "svg",
16262
15947
  "ul"
16263
15948
  ];
16264
- var Primitive$1 = NODES$1.reduce((primitive, node) => {
16265
- const Slot = createSlot$1(`Primitive.${node}`);
15949
+ var Primitive = NODES.reduce((primitive, node) => {
15950
+ const Slot = createSlot(`Primitive.${node}`);
16266
15951
  const Node = React.forwardRef((props, forwardedRef) => {
16267
15952
  const { asChild, ...primitiveProps } = props;
16268
15953
  const Comp = asChild ? Slot : node;
@@ -16274,11 +15959,14 @@ var Primitive$1 = NODES$1.reduce((primitive, node) => {
16274
15959
  Node.displayName = `Primitive.${node}`;
16275
15960
  return { ...primitive, [node]: Node };
16276
15961
  }, {});
15962
+ function dispatchDiscreteCustomEvent(target, event) {
15963
+ if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
15964
+ }
16277
15965
 
16278
15966
  var NAME$1 = "Label";
16279
15967
  var Label$1 = React.forwardRef((props, forwardedRef) => {
16280
15968
  return /* @__PURE__ */ jsx(
16281
- Primitive$1.label,
15969
+ Primitive.label,
16282
15970
  {
16283
15971
  ...props,
16284
15972
  ref: forwardedRef,
@@ -16296,36 +15984,7 @@ var Root$2 = Label$1;
16296
15984
 
16297
15985
  function r$2(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r$2(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r$2(e))&&(n&&(n+=" "),n+=t);return n}
16298
15986
 
16299
- /**
16300
- * Concatenates two arrays faster than the array spread operator.
16301
- */
16302
- const concatArrays = (array1, array2) => {
16303
- // Pre-allocate for better V8 optimization
16304
- const combinedArray = new Array(array1.length + array2.length);
16305
- for (let i = 0; i < array1.length; i++) {
16306
- combinedArray[i] = array1[i];
16307
- }
16308
- for (let i = 0; i < array2.length; i++) {
16309
- combinedArray[array1.length + i] = array2[i];
16310
- }
16311
- return combinedArray;
16312
- };
16313
-
16314
- // Factory function ensures consistent object shapes
16315
- const createClassValidatorObject = (classGroupId, validator) => ({
16316
- classGroupId,
16317
- validator
16318
- });
16319
- // Factory ensures consistent ClassPartObject shape
16320
- const createClassPartObject = (nextPart = new Map(), validators = null, classGroupId) => ({
16321
- nextPart,
16322
- validators,
16323
- classGroupId
16324
- });
16325
15987
  const CLASS_PART_SEPARATOR = '-';
16326
- const EMPTY_CONFLICTS = [];
16327
- // I use two dots here because one dot is used as prefix for class groups in plugins
16328
- const ARBITRARY_PROPERTY_PREFIX = 'arbitrary..';
16329
15988
  const createClassGroupUtils = config => {
16330
15989
  const classMap = createClassMap(config);
16331
15990
  const {
@@ -16333,73 +15992,54 @@ const createClassGroupUtils = config => {
16333
15992
  conflictingClassGroupModifiers
16334
15993
  } = config;
16335
15994
  const getClassGroupId = className => {
16336
- if (className.startsWith('[') && className.endsWith(']')) {
16337
- return getGroupIdForArbitraryProperty(className);
16338
- }
16339
15995
  const classParts = className.split(CLASS_PART_SEPARATOR);
16340
- // Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and skip it.
16341
- const startIndex = classParts[0] === '' && classParts.length > 1 ? 1 : 0;
16342
- return getGroupRecursive(classParts, startIndex, classMap);
15996
+ // Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and remove it from classParts.
15997
+ if (classParts[0] === '' && classParts.length !== 1) {
15998
+ classParts.shift();
15999
+ }
16000
+ return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
16343
16001
  };
16344
16002
  const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
16345
- if (hasPostfixModifier) {
16346
- const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
16347
- const baseConflicts = conflictingClassGroups[classGroupId];
16348
- if (modifierConflicts) {
16349
- if (baseConflicts) {
16350
- // Merge base conflicts with modifier conflicts
16351
- return concatArrays(baseConflicts, modifierConflicts);
16352
- }
16353
- // Only modifier conflicts
16354
- return modifierConflicts;
16355
- }
16356
- // Fall back to without postfix if no modifier conflicts
16357
- return baseConflicts || EMPTY_CONFLICTS;
16003
+ const conflicts = conflictingClassGroups[classGroupId] || [];
16004
+ if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
16005
+ return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
16358
16006
  }
16359
- return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
16007
+ return conflicts;
16360
16008
  };
16361
16009
  return {
16362
16010
  getClassGroupId,
16363
16011
  getConflictingClassGroupIds
16364
16012
  };
16365
16013
  };
16366
- const getGroupRecursive = (classParts, startIndex, classPartObject) => {
16367
- const classPathsLength = classParts.length - startIndex;
16368
- if (classPathsLength === 0) {
16014
+ const getGroupRecursive = (classParts, classPartObject) => {
16015
+ if (classParts.length === 0) {
16369
16016
  return classPartObject.classGroupId;
16370
16017
  }
16371
- const currentClassPart = classParts[startIndex];
16018
+ const currentClassPart = classParts[0];
16372
16019
  const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
16373
- if (nextClassPartObject) {
16374
- const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
16375
- if (result) return result;
16020
+ const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : undefined;
16021
+ if (classGroupFromNextClassPart) {
16022
+ return classGroupFromNextClassPart;
16376
16023
  }
16377
- const validators = classPartObject.validators;
16378
- if (validators === null) {
16024
+ if (classPartObject.validators.length === 0) {
16379
16025
  return undefined;
16380
16026
  }
16381
- // Build classRest string efficiently by joining from startIndex onwards
16382
- const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
16383
- const validatorsLength = validators.length;
16384
- for (let i = 0; i < validatorsLength; i++) {
16385
- const validatorObj = validators[i];
16386
- if (validatorObj.validator(classRest)) {
16387
- return validatorObj.classGroupId;
16027
+ const classRest = classParts.join(CLASS_PART_SEPARATOR);
16028
+ return classPartObject.validators.find(({
16029
+ validator
16030
+ }) => validator(classRest))?.classGroupId;
16031
+ };
16032
+ const arbitraryPropertyRegex = /^\[(.+)\]$/;
16033
+ const getGroupIdForArbitraryProperty = className => {
16034
+ if (arbitraryPropertyRegex.test(className)) {
16035
+ const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
16036
+ const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(':'));
16037
+ if (property) {
16038
+ // I use two dots here because one dot is used as prefix for class groups in plugins
16039
+ return 'arbitrary..' + property;
16388
16040
  }
16389
16041
  }
16390
- return undefined;
16391
16042
  };
16392
- /**
16393
- * Get the class group ID for an arbitrary property.
16394
- *
16395
- * @param className - The class name to get the group ID for. Is expected to be string starting with `[` and ending with `]`.
16396
- */
16397
- const getGroupIdForArbitraryProperty = className => className.slice(1, -1).indexOf(':') === -1 ? undefined : (() => {
16398
- const content = className.slice(1, -1);
16399
- const colonIndex = content.indexOf(':');
16400
- const property = content.slice(0, colonIndex);
16401
- return property ? ARBITRARY_PROPERTY_PREFIX + property : undefined;
16402
- })();
16403
16043
  /**
16404
16044
  * Exported for testing only
16405
16045
  */
@@ -16408,77 +16048,54 @@ const createClassMap = config => {
16408
16048
  theme,
16409
16049
  classGroups
16410
16050
  } = config;
16411
- return processClassGroups(classGroups, theme);
16412
- };
16413
- // Split into separate functions to maintain monomorphic call sites
16414
- const processClassGroups = (classGroups, theme) => {
16415
- const classMap = createClassPartObject();
16051
+ const classMap = {
16052
+ nextPart: new Map(),
16053
+ validators: []
16054
+ };
16416
16055
  for (const classGroupId in classGroups) {
16417
- const group = classGroups[classGroupId];
16418
- processClassesRecursively(group, classMap, classGroupId, theme);
16056
+ processClassesRecursively(classGroups[classGroupId], classMap, classGroupId, theme);
16419
16057
  }
16420
16058
  return classMap;
16421
16059
  };
16422
16060
  const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
16423
- const len = classGroup.length;
16424
- for (let i = 0; i < len; i++) {
16425
- const classDefinition = classGroup[i];
16426
- processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
16427
- }
16428
- };
16429
- // Split into separate functions for each type to maintain monomorphic call sites
16430
- const processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
16431
- if (typeof classDefinition === 'string') {
16432
- processStringDefinition(classDefinition, classPartObject, classGroupId);
16433
- return;
16434
- }
16435
- if (typeof classDefinition === 'function') {
16436
- processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
16437
- return;
16438
- }
16439
- processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
16440
- };
16441
- const processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
16442
- const classPartObjectToEdit = classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition);
16443
- classPartObjectToEdit.classGroupId = classGroupId;
16444
- };
16445
- const processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
16446
- if (isThemeGetter(classDefinition)) {
16447
- processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
16448
- return;
16449
- }
16450
- if (classPartObject.validators === null) {
16451
- classPartObject.validators = [];
16452
- }
16453
- classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
16454
- };
16455
- const processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
16456
- const entries = Object.entries(classDefinition);
16457
- const len = entries.length;
16458
- for (let i = 0; i < len; i++) {
16459
- const [key, value] = entries[i];
16460
- processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
16461
- }
16061
+ classGroup.forEach(classDefinition => {
16062
+ if (typeof classDefinition === 'string') {
16063
+ const classPartObjectToEdit = classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition);
16064
+ classPartObjectToEdit.classGroupId = classGroupId;
16065
+ return;
16066
+ }
16067
+ if (typeof classDefinition === 'function') {
16068
+ if (isThemeGetter(classDefinition)) {
16069
+ processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
16070
+ return;
16071
+ }
16072
+ classPartObject.validators.push({
16073
+ validator: classDefinition,
16074
+ classGroupId
16075
+ });
16076
+ return;
16077
+ }
16078
+ Object.entries(classDefinition).forEach(([key, classGroup]) => {
16079
+ processClassesRecursively(classGroup, getPart(classPartObject, key), classGroupId, theme);
16080
+ });
16081
+ });
16462
16082
  };
16463
16083
  const getPart = (classPartObject, path) => {
16464
- let current = classPartObject;
16465
- const parts = path.split(CLASS_PART_SEPARATOR);
16466
- const len = parts.length;
16467
- for (let i = 0; i < len; i++) {
16468
- const part = parts[i];
16469
- let next = current.nextPart.get(part);
16470
- if (!next) {
16471
- next = createClassPartObject();
16472
- current.nextPart.set(part, next);
16084
+ let currentClassPartObject = classPartObject;
16085
+ path.split(CLASS_PART_SEPARATOR).forEach(pathPart => {
16086
+ if (!currentClassPartObject.nextPart.has(pathPart)) {
16087
+ currentClassPartObject.nextPart.set(pathPart, {
16088
+ nextPart: new Map(),
16089
+ validators: []
16090
+ });
16473
16091
  }
16474
- current = next;
16475
- }
16476
- return current;
16092
+ currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
16093
+ });
16094
+ return currentClassPartObject;
16477
16095
  };
16478
- // Type guard maintains monomorphic check
16479
- const isThemeGetter = func => 'isThemeGetter' in func && func.isThemeGetter === true;
16096
+ const isThemeGetter = func => func.isThemeGetter;
16480
16097
 
16481
- // LRU cache implementation using plain objects for simplicity
16098
+ // LRU cache inspired from hashlru (https://github.com/dominictarr/hashlru/blob/v1.0.4/index.js) but object replaced with Map to improve performance
16482
16099
  const createLruCache = maxCacheSize => {
16483
16100
  if (maxCacheSize < 1) {
16484
16101
  return {
@@ -16487,31 +16104,31 @@ const createLruCache = maxCacheSize => {
16487
16104
  };
16488
16105
  }
16489
16106
  let cacheSize = 0;
16490
- let cache = Object.create(null);
16491
- let previousCache = Object.create(null);
16107
+ let cache = new Map();
16108
+ let previousCache = new Map();
16492
16109
  const update = (key, value) => {
16493
- cache[key] = value;
16110
+ cache.set(key, value);
16494
16111
  cacheSize++;
16495
16112
  if (cacheSize > maxCacheSize) {
16496
16113
  cacheSize = 0;
16497
16114
  previousCache = cache;
16498
- cache = Object.create(null);
16115
+ cache = new Map();
16499
16116
  }
16500
16117
  };
16501
16118
  return {
16502
16119
  get(key) {
16503
- let value = cache[key];
16120
+ let value = cache.get(key);
16504
16121
  if (value !== undefined) {
16505
16122
  return value;
16506
16123
  }
16507
- if ((value = previousCache[key]) !== undefined) {
16124
+ if ((value = previousCache.get(key)) !== undefined) {
16508
16125
  update(key, value);
16509
16126
  return value;
16510
16127
  }
16511
16128
  },
16512
16129
  set(key, value) {
16513
- if (key in cache) {
16514
- cache[key] = value;
16130
+ if (cache.has(key)) {
16131
+ cache.set(key, value);
16515
16132
  } else {
16516
16133
  update(key, value);
16517
16134
  }
@@ -16520,15 +16137,7 @@ const createLruCache = maxCacheSize => {
16520
16137
  };
16521
16138
  const IMPORTANT_MODIFIER = '!';
16522
16139
  const MODIFIER_SEPARATOR = ':';
16523
- const EMPTY_MODIFIERS = [];
16524
- // Pre-allocated result object shape for consistency
16525
- const createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
16526
- modifiers,
16527
- hasImportantModifier,
16528
- baseClassName,
16529
- maybePostfixModifierPosition,
16530
- isExternal
16531
- });
16140
+ const MODIFIER_SEPARATOR_LENGTH = MODIFIER_SEPARATOR.length;
16532
16141
  const createParseClassName = config => {
16533
16142
  const {
16534
16143
  prefix,
@@ -16541,19 +16150,17 @@ const createParseClassName = config => {
16541
16150
  * @see https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js
16542
16151
  */
16543
16152
  let parseClassName = className => {
16544
- // Use simple array with push for better performance
16545
16153
  const modifiers = [];
16546
16154
  let bracketDepth = 0;
16547
16155
  let parenDepth = 0;
16548
16156
  let modifierStart = 0;
16549
16157
  let postfixModifierPosition;
16550
- const len = className.length;
16551
- for (let index = 0; index < len; index++) {
16552
- const currentCharacter = className[index];
16158
+ for (let index = 0; index < className.length; index++) {
16159
+ let currentCharacter = className[index];
16553
16160
  if (bracketDepth === 0 && parenDepth === 0) {
16554
16161
  if (currentCharacter === MODIFIER_SEPARATOR) {
16555
16162
  modifiers.push(className.slice(modifierStart, index));
16556
- modifierStart = index + 1;
16163
+ modifierStart = index + MODIFIER_SEPARATOR_LENGTH;
16557
16164
  continue;
16558
16165
  }
16559
16166
  if (currentCharacter === '/') {
@@ -16561,31 +16168,37 @@ const createParseClassName = config => {
16561
16168
  continue;
16562
16169
  }
16563
16170
  }
16564
- if (currentCharacter === '[') bracketDepth++;else if (currentCharacter === ']') bracketDepth--;else if (currentCharacter === '(') parenDepth++;else if (currentCharacter === ')') parenDepth--;
16565
- }
16566
- const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
16567
- // Inline important modifier check
16568
- let baseClassName = baseClassNameWithImportantModifier;
16569
- let hasImportantModifier = false;
16570
- if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
16571
- baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
16572
- hasImportantModifier = true;
16573
- } else if (
16574
- /**
16575
- * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
16576
- * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
16577
- */
16578
- baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)) {
16579
- baseClassName = baseClassNameWithImportantModifier.slice(1);
16580
- hasImportantModifier = true;
16171
+ if (currentCharacter === '[') {
16172
+ bracketDepth++;
16173
+ } else if (currentCharacter === ']') {
16174
+ bracketDepth--;
16175
+ } else if (currentCharacter === '(') {
16176
+ parenDepth++;
16177
+ } else if (currentCharacter === ')') {
16178
+ parenDepth--;
16179
+ }
16581
16180
  }
16181
+ const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
16182
+ const baseClassName = stripImportantModifier(baseClassNameWithImportantModifier);
16183
+ const hasImportantModifier = baseClassName !== baseClassNameWithImportantModifier;
16582
16184
  const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : undefined;
16583
- return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
16185
+ return {
16186
+ modifiers,
16187
+ hasImportantModifier,
16188
+ baseClassName,
16189
+ maybePostfixModifierPosition
16190
+ };
16584
16191
  };
16585
16192
  if (prefix) {
16586
16193
  const fullPrefix = prefix + MODIFIER_SEPARATOR;
16587
16194
  const parseClassNameOriginal = parseClassName;
16588
- parseClassName = className => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.slice(fullPrefix.length)) : createResultObject(EMPTY_MODIFIERS, false, className, undefined, true);
16195
+ parseClassName = className => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.substring(fullPrefix.length)) : {
16196
+ isExternal: true,
16197
+ modifiers: [],
16198
+ hasImportantModifier: false,
16199
+ baseClassName: className,
16200
+ maybePostfixModifierPosition: undefined
16201
+ };
16589
16202
  }
16590
16203
  if (experimentalParseClassName) {
16591
16204
  const parseClassNameOriginal = parseClassName;
@@ -16596,6 +16209,19 @@ const createParseClassName = config => {
16596
16209
  }
16597
16210
  return parseClassName;
16598
16211
  };
16212
+ const stripImportantModifier = baseClassName => {
16213
+ if (baseClassName.endsWith(IMPORTANT_MODIFIER)) {
16214
+ return baseClassName.substring(0, baseClassName.length - 1);
16215
+ }
16216
+ /**
16217
+ * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
16218
+ * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
16219
+ */
16220
+ if (baseClassName.startsWith(IMPORTANT_MODIFIER)) {
16221
+ return baseClassName.substring(1);
16222
+ }
16223
+ return baseClassName;
16224
+ };
16599
16225
 
16600
16226
  /**
16601
16227
  * Sorts modifiers according to following schema:
@@ -16603,41 +16229,26 @@ const createParseClassName = config => {
16603
16229
  * - When an arbitrary variant appears, it must be preserved which modifiers are before and after it
16604
16230
  */
16605
16231
  const createSortModifiers = config => {
16606
- // Pre-compute weights for all known modifiers for O(1) comparison
16607
- const modifierWeights = new Map();
16608
- // Assign weights to sensitive modifiers (highest priority, but preserve order)
16609
- config.orderSensitiveModifiers.forEach((mod, index) => {
16610
- modifierWeights.set(mod, 1000000 + index); // High weights for sensitive mods
16611
- });
16612
- return modifiers => {
16613
- const result = [];
16614
- let currentSegment = [];
16615
- // Process modifiers in one pass
16616
- for (let i = 0; i < modifiers.length; i++) {
16617
- const modifier = modifiers[i];
16618
- // Check if modifier is sensitive (starts with '[' or in orderSensitiveModifiers)
16619
- const isArbitrary = modifier[0] === '[';
16620
- const isOrderSensitive = modifierWeights.has(modifier);
16621
- if (isArbitrary || isOrderSensitive) {
16622
- // Sort and flush current segment alphabetically
16623
- if (currentSegment.length > 0) {
16624
- currentSegment.sort();
16625
- result.push(...currentSegment);
16626
- currentSegment = [];
16627
- }
16628
- result.push(modifier);
16232
+ const orderSensitiveModifiers = Object.fromEntries(config.orderSensitiveModifiers.map(modifier => [modifier, true]));
16233
+ const sortModifiers = modifiers => {
16234
+ if (modifiers.length <= 1) {
16235
+ return modifiers;
16236
+ }
16237
+ const sortedModifiers = [];
16238
+ let unsortedModifiers = [];
16239
+ modifiers.forEach(modifier => {
16240
+ const isPositionSensitive = modifier[0] === '[' || orderSensitiveModifiers[modifier];
16241
+ if (isPositionSensitive) {
16242
+ sortedModifiers.push(...unsortedModifiers.sort(), modifier);
16243
+ unsortedModifiers = [];
16629
16244
  } else {
16630
- // Regular modifier - add to current segment for batch sorting
16631
- currentSegment.push(modifier);
16245
+ unsortedModifiers.push(modifier);
16632
16246
  }
16633
- }
16634
- // Sort and add any remaining segment items
16635
- if (currentSegment.length > 0) {
16636
- currentSegment.sort();
16637
- result.push(...currentSegment);
16638
- }
16639
- return result;
16247
+ });
16248
+ sortedModifiers.push(...unsortedModifiers.sort());
16249
+ return sortedModifiers;
16640
16250
  };
16251
+ return sortModifiers;
16641
16252
  };
16642
16253
  const createConfigUtils = config => ({
16643
16254
  cache: createLruCache(config.cacheSize),
@@ -16692,11 +16303,10 @@ const mergeClassList = (classList, configUtils) => {
16692
16303
  }
16693
16304
  hasPostfixModifier = false;
16694
16305
  }
16695
- // Fast path: skip sorting for empty or single modifier
16696
- const variantModifier = modifiers.length === 0 ? '' : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(':');
16306
+ const variantModifier = sortModifiers(modifiers).join(':');
16697
16307
  const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
16698
16308
  const classId = modifierId + classGroupId;
16699
- if (classGroupsInConflict.indexOf(classId) > -1) {
16309
+ if (classGroupsInConflict.includes(classId)) {
16700
16310
  // Tailwind class omitted due to conflict
16701
16311
  continue;
16702
16312
  }
@@ -16721,13 +16331,13 @@ const mergeClassList = (classList, configUtils) => {
16721
16331
  *
16722
16332
  * Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
16723
16333
  */
16724
- const twJoin = (...classLists) => {
16334
+ function twJoin() {
16725
16335
  let index = 0;
16726
16336
  let argument;
16727
16337
  let resolvedValue;
16728
16338
  let string = '';
16729
- while (index < classLists.length) {
16730
- if (argument = classLists[index++]) {
16339
+ while (index < arguments.length) {
16340
+ if (argument = arguments[index++]) {
16731
16341
  if (resolvedValue = toValue(argument)) {
16732
16342
  string && (string += ' ');
16733
16343
  string += resolvedValue;
@@ -16735,9 +16345,8 @@ const twJoin = (...classLists) => {
16735
16345
  }
16736
16346
  }
16737
16347
  return string;
16738
- };
16348
+ }
16739
16349
  const toValue = mix => {
16740
- // Fast path for strings
16741
16350
  if (typeof mix === 'string') {
16742
16351
  return mix;
16743
16352
  }
@@ -16753,20 +16362,20 @@ const toValue = mix => {
16753
16362
  }
16754
16363
  return string;
16755
16364
  };
16756
- const createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
16365
+ function createTailwindMerge(createConfigFirst, ...createConfigRest) {
16757
16366
  let configUtils;
16758
16367
  let cacheGet;
16759
16368
  let cacheSet;
16760
- let functionToCall;
16761
- const initTailwindMerge = classList => {
16369
+ let functionToCall = initTailwindMerge;
16370
+ function initTailwindMerge(classList) {
16762
16371
  const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
16763
16372
  configUtils = createConfigUtils(config);
16764
16373
  cacheGet = configUtils.cache.get;
16765
16374
  cacheSet = configUtils.cache.set;
16766
16375
  functionToCall = tailwindMerge;
16767
16376
  return tailwindMerge(classList);
16768
- };
16769
- const tailwindMerge = classList => {
16377
+ }
16378
+ function tailwindMerge(classList) {
16770
16379
  const cachedResult = cacheGet(classList);
16771
16380
  if (cachedResult) {
16772
16381
  return cachedResult;
@@ -16774,13 +16383,13 @@ const createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
16774
16383
  const result = mergeClassList(classList, configUtils);
16775
16384
  cacheSet(classList, result);
16776
16385
  return result;
16386
+ }
16387
+ return function callTailwindMerge() {
16388
+ return functionToCall(twJoin.apply(null, arguments));
16777
16389
  };
16778
- functionToCall = initTailwindMerge;
16779
- return (...args) => functionToCall(twJoin(...args));
16780
- };
16781
- const fallbackThemeArr = [];
16390
+ }
16782
16391
  const fromTheme = key => {
16783
- const themeGetter = theme => theme[key] || fallbackThemeArr;
16392
+ const themeGetter = theme => theme[key] || [];
16784
16393
  themeGetter.isThemeGetter = true;
16785
16394
  return themeGetter;
16786
16395
  };
@@ -19488,7 +19097,7 @@ function Button(_a) {
19488
19097
 
19489
19098
  var U=1,Y$1=.9,H=.8,J=.17,p$2=.1,u=.999,$=.9999;var k$3=.99,m=/[\\\/_+.#"@\[\(\{&]/,B$1=/[\\\/_+.#"@\[\(\{&]/g,K$1=/[\s-]/,X$1=/[\s-]/g;function G(_,C,h,P,A,f,O){if(f===C.length)return A===_.length?U:k$3;var T=`${A},${f}`;if(O[T]!==void 0)return O[T];for(var L=P.charAt(f),c=h.indexOf(L,A),S=0,E,N,R,M;c>=0;)E=G(_,C,h,P,c+1,f+1,O),E>S&&(c===A?E*=U:m.test(_.charAt(c-1))?(E*=H,R=_.slice(A,c-1).match(B$1),R&&A>0&&(E*=Math.pow(u,R.length))):K$1.test(_.charAt(c-1))?(E*=Y$1,M=_.slice(A,c-1).match(X$1),M&&A>0&&(E*=Math.pow(u,M.length))):(E*=J,A>0&&(E*=Math.pow(u,c-A))),_.charAt(c)!==C.charAt(f)&&(E*=$)),(E<p$2&&h.charAt(c-1)===P.charAt(f+1)||P.charAt(f+1)===P.charAt(f)&&h.charAt(c-1)!==P.charAt(f))&&(N=G(_,C,h,P,c+1,f+2,O),N*p$2>E&&(E=N*p$2)),E>S&&(S=E),c=h.indexOf(L,c+1);return O[T]=S,S}function D(_){return _.toLowerCase().replace(X$1," ")}function W(_,C,h){return _=h&&h.length>0?`${_+" "+h.join(" ")}`:_,G(_,C,D(_),D(C),0,0,{})}
19490
19099
 
19491
- // src/primitive.tsx
19100
+ // packages/core/primitive/src/primitive.tsx
19492
19101
  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
19493
19102
  return function handleEvent(event) {
19494
19103
  originalEventHandler?.(event);
@@ -19654,127 +19263,6 @@ function isFunction(value) {
19654
19263
  return typeof value === "function";
19655
19264
  }
19656
19265
 
19657
- // src/slot.tsx
19658
- // @__NO_SIDE_EFFECTS__
19659
- function createSlot(ownerName) {
19660
- const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
19661
- const Slot2 = React.forwardRef((props, forwardedRef) => {
19662
- const { children, ...slotProps } = props;
19663
- const childrenArray = React.Children.toArray(children);
19664
- const slottable = childrenArray.find(isSlottable);
19665
- if (slottable) {
19666
- const newElement = slottable.props.children;
19667
- const newChildren = childrenArray.map((child) => {
19668
- if (child === slottable) {
19669
- if (React.Children.count(newElement) > 1) return React.Children.only(null);
19670
- return React.isValidElement(newElement) ? newElement.props.children : null;
19671
- } else {
19672
- return child;
19673
- }
19674
- });
19675
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
19676
- }
19677
- return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
19678
- });
19679
- Slot2.displayName = `${ownerName}.Slot`;
19680
- return Slot2;
19681
- }
19682
- // @__NO_SIDE_EFFECTS__
19683
- function createSlotClone(ownerName) {
19684
- const SlotClone = React.forwardRef((props, forwardedRef) => {
19685
- const { children, ...slotProps } = props;
19686
- if (React.isValidElement(children)) {
19687
- const childrenRef = getElementRef$1(children);
19688
- const props2 = mergeProps(slotProps, children.props);
19689
- if (children.type !== React.Fragment) {
19690
- props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
19691
- }
19692
- return React.cloneElement(children, props2);
19693
- }
19694
- return React.Children.count(children) > 1 ? React.Children.only(null) : null;
19695
- });
19696
- SlotClone.displayName = `${ownerName}.SlotClone`;
19697
- return SlotClone;
19698
- }
19699
- var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
19700
- function isSlottable(child) {
19701
- return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
19702
- }
19703
- function mergeProps(slotProps, childProps) {
19704
- const overrideProps = { ...childProps };
19705
- for (const propName in childProps) {
19706
- const slotPropValue = slotProps[propName];
19707
- const childPropValue = childProps[propName];
19708
- const isHandler = /^on[A-Z]/.test(propName);
19709
- if (isHandler) {
19710
- if (slotPropValue && childPropValue) {
19711
- overrideProps[propName] = (...args) => {
19712
- const result = childPropValue(...args);
19713
- slotPropValue(...args);
19714
- return result;
19715
- };
19716
- } else if (slotPropValue) {
19717
- overrideProps[propName] = slotPropValue;
19718
- }
19719
- } else if (propName === "style") {
19720
- overrideProps[propName] = { ...slotPropValue, ...childPropValue };
19721
- } else if (propName === "className") {
19722
- overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
19723
- }
19724
- }
19725
- return { ...slotProps, ...overrideProps };
19726
- }
19727
- function getElementRef$1(element) {
19728
- let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
19729
- let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
19730
- if (mayWarn) {
19731
- return element.ref;
19732
- }
19733
- getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
19734
- mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
19735
- if (mayWarn) {
19736
- return element.props.ref;
19737
- }
19738
- return element.props.ref || element.ref;
19739
- }
19740
-
19741
- // src/primitive.tsx
19742
- var NODES = [
19743
- "a",
19744
- "button",
19745
- "div",
19746
- "form",
19747
- "h2",
19748
- "h3",
19749
- "img",
19750
- "input",
19751
- "label",
19752
- "li",
19753
- "nav",
19754
- "ol",
19755
- "p",
19756
- "select",
19757
- "span",
19758
- "svg",
19759
- "ul"
19760
- ];
19761
- var Primitive = NODES.reduce((primitive, node) => {
19762
- const Slot = createSlot(`Primitive.${node}`);
19763
- const Node = React.forwardRef((props, forwardedRef) => {
19764
- const { asChild, ...primitiveProps } = props;
19765
- const Comp = asChild ? Slot : node;
19766
- if (typeof window !== "undefined") {
19767
- window[Symbol.for("radix-ui")] = true;
19768
- }
19769
- return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
19770
- });
19771
- Node.displayName = `Primitive.${node}`;
19772
- return { ...primitive, [node]: Node };
19773
- }, {});
19774
- function dispatchDiscreteCustomEvent(target, event) {
19775
- if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
19776
- }
19777
-
19778
19266
  // packages/react/use-callback-ref/src/use-callback-ref.tsx
19779
19267
  function useCallbackRef$1(callback) {
19780
19268
  const callbackRef = React.useRef(callback);
@@ -20278,7 +19766,7 @@ function usePresence(present) {
20278
19766
  const ownerWindow = node.ownerDocument.defaultView ?? window;
20279
19767
  const handleAnimationEnd = (event) => {
20280
19768
  const currentAnimationName = getAnimationName(stylesRef.current);
20281
- const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
19769
+ const isCurrentAnimation = currentAnimationName.includes(event.animationName);
20282
19770
  if (event.target === node && isCurrentAnimation) {
20283
19771
  send("ANIMATION_END");
20284
19772
  if (!prevPresentRef.current) {
@@ -21194,7 +20682,7 @@ var hideOthers = function (originalTarget, parentNode, markerName) {
21194
20682
  };
21195
20683
 
21196
20684
  var DIALOG_NAME = "Dialog";
21197
- var [createDialogContext] = createContextScope(DIALOG_NAME);
20685
+ var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
21198
20686
  var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
21199
20687
  var Dialog = (props) => {
21200
20688
  const {
@@ -21492,7 +20980,7 @@ var Portal = DialogPortal;
21492
20980
  var Overlay = DialogOverlay;
21493
20981
  var Content$1 = DialogContent;
21494
20982
 
21495
- var N='[cmdk-group=""]',Y='[cmdk-group-items=""]',be='[cmdk-group-heading=""]',le='[cmdk-item=""]',ce=`${le}:not([aria-disabled="true"])`,Z="cmdk-item-select",T="data-value",Re=(r,o,n)=>W(r,o,n),ue=React.createContext(void 0),K=()=>React.useContext(ue),de=React.createContext(void 0),ee=()=>React.useContext(de),fe=React.createContext(void 0),me=React.forwardRef((r,o)=>{let n=L(()=>{var e,a;return {search:"",value:(a=(e=r.value)!=null?e:r.defaultValue)!=null?a:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),u=L(()=>new Set),c=L(()=>new Map),d=L(()=>new Map),f=L(()=>new Set),p=pe(r),{label:b,children:m,value:R,onValueChange:x,filter:C,shouldFilter:S,loop:A,disablePointerSelection:ge=false,vimBindings:j=true,...O}=r,$=useId(),q=useId(),_=useId(),I=React.useRef(null),v=ke();k$2(()=>{if(R!==void 0){let e=R.trim();n.current.value=e,E.emit();}},[R]),k$2(()=>{v(6,ne);},[]);let E=React.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>n.current,setState:(e,a,s)=>{var i,l,g,y;if(!Object.is(n.current[e],a)){if(n.current[e]=a,e==="search")J(),z(),v(1,W);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let h=document.getElementById(_);h?h.focus():(i=document.getElementById($))==null||i.focus();}if(v(7,()=>{var h;n.current.selectedItemId=(h=M())==null?void 0:h.id,E.emit();}),s||v(5,ne),((l=p.current)==null?void 0:l.value)!==void 0){let h=a!=null?a:"";(y=(g=p.current).onValueChange)==null||y.call(g,h);return}}E.emit();}},emit:()=>{f.current.forEach(e=>e());}}),[]),U=React.useMemo(()=>({value:(e,a,s)=>{var i;a!==((i=d.current.get(e))==null?void 0:i.value)&&(d.current.set(e,{value:a,keywords:s}),n.current.filtered.items.set(e,te(a,s)),v(2,()=>{z(),E.emit();}));},item:(e,a)=>(u.current.add(e),a&&(c.current.has(a)?c.current.get(a).add(e):c.current.set(a,new Set([e]))),v(3,()=>{J(),z(),n.current.value||W(),E.emit();}),()=>{d.current.delete(e),u.current.delete(e),n.current.filtered.items.delete(e);let s=M();v(4,()=>{J(),(s==null?void 0:s.getAttribute("id"))===e&&W(),E.emit();});}),group:e=>(c.current.has(e)||c.current.set(e,new Set),()=>{d.current.delete(e),c.current.delete(e);}),filter:()=>p.current.shouldFilter,label:b||r["aria-label"],getDisablePointerSelection:()=>p.current.disablePointerSelection,listId:$,inputId:_,labelId:q,listInnerRef:I}),[]);function te(e,a){var i,l;let s=(l=(i=p.current)==null?void 0:i.filter)!=null?l:Re;return e?s(e,n.current.search,a):0}function z(){if(!n.current.search||p.current.shouldFilter===false)return;let e=n.current.filtered.items,a=[];n.current.filtered.groups.forEach(i=>{let l=c.current.get(i),g=0;l.forEach(y=>{let h=e.get(y);g=Math.max(h,g);}),a.push([i,g]);});let s=I.current;V().sort((i,l)=>{var h,F;let g=i.getAttribute("id"),y=l.getAttribute("id");return ((h=e.get(y))!=null?h:0)-((F=e.get(g))!=null?F:0)}).forEach(i=>{let l=i.closest(Y);l?l.appendChild(i.parentElement===l?i:i.closest(`${Y} > *`)):s.appendChild(i.parentElement===s?i:i.closest(`${Y} > *`));}),a.sort((i,l)=>l[1]-i[1]).forEach(i=>{var g;let l=(g=I.current)==null?void 0:g.querySelector(`${N}[${T}="${encodeURIComponent(i[0])}"]`);l==null||l.parentElement.appendChild(l);});}function W(){let e=V().find(s=>s.getAttribute("aria-disabled")!=="true"),a=e==null?void 0:e.getAttribute(T);E.setState("value",a||void 0);}function J(){var a,s,i,l;if(!n.current.search||p.current.shouldFilter===false){n.current.filtered.count=u.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let g of u.current){let y=(s=(a=d.current.get(g))==null?void 0:a.value)!=null?s:"",h=(l=(i=d.current.get(g))==null?void 0:i.keywords)!=null?l:[],F=te(y,h);n.current.filtered.items.set(g,F),F>0&&e++;}for(let[g,y]of c.current)for(let h of y)if(n.current.filtered.items.get(h)>0){n.current.filtered.groups.add(g);break}n.current.filtered.count=e;}function ne(){var a,s,i;let e=M();e&&(((a=e.parentElement)==null?void 0:a.firstChild)===e&&((i=(s=e.closest(N))==null?void 0:s.querySelector(be))==null||i.scrollIntoView({block:"nearest"})),e.scrollIntoView({block:"nearest"}));}function M(){var e;return (e=I.current)==null?void 0:e.querySelector(`${le}[aria-selected="true"]`)}function V(){var e;return Array.from(((e=I.current)==null?void 0:e.querySelectorAll(ce))||[])}function X(e){let s=V()[e];s&&E.setState("value",s.getAttribute(T));}function Q(e){var g;let a=M(),s=V(),i=s.findIndex(y=>y===a),l=s[i+e];(g=p.current)!=null&&g.loop&&(l=i+e<0?s[s.length-1]:i+e===s.length?s[0]:s[i+e]),l&&E.setState("value",l.getAttribute(T));}function re(e){let a=M(),s=a==null?void 0:a.closest(N),i;for(;s&&!i;)s=e>0?we(s,N):De(s,N),i=s==null?void 0:s.querySelector(ce);i?E.setState("value",i.getAttribute(T)):Q(e);}let oe=()=>X(V().length-1),ie=e=>{e.preventDefault(),e.metaKey?oe():e.altKey?re(1):Q(1);},se=e=>{e.preventDefault(),e.metaKey?X(0):e.altKey?re(-1):Q(-1);};return React.createElement(Primitive$1.div,{ref:o,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:e=>{var s;(s=O.onKeyDown)==null||s.call(O,e);let a=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||a))switch(e.key){case "n":case "j":{j&&e.ctrlKey&&ie(e);break}case "ArrowDown":{ie(e);break}case "p":case "k":{j&&e.ctrlKey&&se(e);break}case "ArrowUp":{se(e);break}case "Home":{e.preventDefault(),X(0);break}case "End":{e.preventDefault(),oe();break}case "Enter":{e.preventDefault();let i=M();if(i){let l=new Event(Z);i.dispatchEvent(l);}}}}},React.createElement("label",{"cmdk-label":"",htmlFor:U.inputId,id:U.labelId,style:Te},b),B(r,e=>React.createElement(de.Provider,{value:E},React.createElement(ue.Provider,{value:U},e))))}),he=React.forwardRef((r,o)=>{var _,I;let n=useId(),u=React.useRef(null),c=React.useContext(fe),d=K(),f=pe(r),p=(I=(_=f.current)==null?void 0:_.forceMount)!=null?I:c==null?void 0:c.forceMount;k$2(()=>{if(!p)return d.item(n,c==null?void 0:c.id)},[p]);let b=ve(n,u,[r.value,r.children,u],r.keywords),m=ee(),R=P(v=>v.value&&v.value===b.current),x=P(v=>p||d.filter()===false?true:v.search?v.filtered.items.get(n)>0:true);React.useEffect(()=>{let v=u.current;if(!(!v||r.disabled))return v.addEventListener(Z,C),()=>v.removeEventListener(Z,C)},[x,r.onSelect,r.disabled]);function C(){var v,E;S(),(E=(v=f.current).onSelect)==null||E.call(v,b.current);}function S(){m.setState("value",b.current,true);}if(!x)return null;let{disabled:A,value:ge,onSelect:j,forceMount:O,keywords:$,...q}=r;return React.createElement(Primitive$1.div,{ref:composeRefs(u,o),...q,id:n,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!R,"data-disabled":!!A,"data-selected":!!R,onPointerMove:A||d.getDisablePointerSelection()?void 0:S,onClick:A?void 0:C},r.children)}),Ee=React.forwardRef((r,o)=>{let{heading:n,children:u,forceMount:c,...d}=r,f=useId(),p=React.useRef(null),b=React.useRef(null),m=useId(),R=K(),x=P(S=>c||R.filter()===false?true:S.search?S.filtered.groups.has(f):true);k$2(()=>R.group(f),[]),ve(f,p,[r.value,r.heading,b]);let C=React.useMemo(()=>({id:f,forceMount:c}),[c]);return React.createElement(Primitive$1.div,{ref:composeRefs(p,o),...d,"cmdk-group":"",role:"presentation",hidden:x?void 0:true},n&&React.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":true,id:m},n),B(r,S=>React.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?m:void 0},React.createElement(fe.Provider,{value:C},S))))}),ye=React.forwardRef((r,o)=>{let{alwaysRender:n,...u}=r,c=React.useRef(null),d=P(f=>!f.search);return !n&&!d?null:React.createElement(Primitive$1.div,{ref:composeRefs(c,o),...u,"cmdk-separator":"",role:"separator"})}),Se=React.forwardRef((r,o)=>{let{onValueChange:n,...u}=r,c=r.value!=null,d=ee(),f=P(m=>m.search),p=P(m=>m.selectedItemId),b=K();return React.useEffect(()=>{r.value!=null&&d.setState("search",r.value);},[r.value]),React.createElement(Primitive$1.input,{ref:o,...u,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:false,"aria-autocomplete":"list",role:"combobox","aria-expanded":true,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":p,id:b.inputId,type:"text",value:c?r.value:f,onChange:m=>{c||d.setState("search",m.target.value),n==null||n(m.target.value);}})}),Ce=React.forwardRef((r,o)=>{let{children:n,label:u="Suggestions",...c}=r,d=React.useRef(null),f=React.useRef(null),p=P(m=>m.selectedItemId),b=K();return React.useEffect(()=>{if(f.current&&d.current){let m=f.current,R=d.current,x,C=new ResizeObserver(()=>{x=requestAnimationFrame(()=>{let S=m.offsetHeight;R.style.setProperty("--cmdk-list-height",S.toFixed(1)+"px");});});return C.observe(m),()=>{cancelAnimationFrame(x),C.unobserve(m);}}},[]),React.createElement(Primitive$1.div,{ref:composeRefs(d,o),...c,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":p,"aria-label":u,id:b.listId},B(r,m=>React.createElement("div",{ref:composeRefs(f,b.listInnerRef),"cmdk-list-sizer":""},m)))}),xe=React.forwardRef((r,o)=>{let{open:n,onOpenChange:u,overlayClassName:c,contentClassName:d,container:f,...p}=r;return React.createElement(Root$1,{open:n,onOpenChange:u},React.createElement(Portal,{container:f},React.createElement(Overlay,{"cmdk-overlay":"",className:c}),React.createElement(Content$1,{"aria-label":r.label,"cmdk-dialog":"",className:d},React.createElement(me,{ref:o,...p}))))}),Ie=React.forwardRef((r,o)=>P(u=>u.filtered.count===0)?React.createElement(Primitive$1.div,{ref:o,...r,"cmdk-empty":"",role:"presentation"}):null),Pe=React.forwardRef((r,o)=>{let{progress:n,children:u,label:c="Loading...",...d}=r;return React.createElement(Primitive$1.div,{ref:o,...d,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":c},B(r,f=>React.createElement("div",{"aria-hidden":true},f)))}),_e=Object.assign(me,{List:Ce,Item:he,Input:Se,Group:Ee,Separator:ye,Dialog:xe,Empty:Ie,Loading:Pe});function we(r,o){let n=r.nextElementSibling;for(;n;){if(n.matches(o))return n;n=n.nextElementSibling;}}function De(r,o){let n=r.previousElementSibling;for(;n;){if(n.matches(o))return n;n=n.previousElementSibling;}}function pe(r){let o=React.useRef(r);return k$2(()=>{o.current=r;}),o}var k$2=typeof window=="undefined"?React.useEffect:React.useLayoutEffect;function L(r){let o=React.useRef();return o.current===void 0&&(o.current=r()),o}function P(r){let o=ee(),n=()=>r(o.snapshot());return React.useSyncExternalStore(o.subscribe,n,n)}function ve(r,o,n,u=[]){let c=React.useRef(),d=K();return k$2(()=>{var b;let f=(()=>{var m;for(let R of n){if(typeof R=="string")return R.trim();if(typeof R=="object"&&"current"in R)return R.current?(m=R.current.textContent)==null?void 0:m.trim():c.current}})(),p=u.map(m=>m.trim());d.value(r,f,p),(b=o.current)==null||b.setAttribute(T,f),c.current=f;}),c}var ke=()=>{let[r,o]=React.useState(),n=L(()=>new Map);return k$2(()=>{n.current.forEach(u=>u()),n.current=new Map;},[r]),(u,c)=>{n.current.set(u,c),o({});}};function Me(r){let o=r.type;return typeof o=="function"?o(r.props):"render"in o?o.render(r.props):r}function B({asChild:r,children:o},n){return r&&React.isValidElement(o)?React.cloneElement(Me(o),{ref:o.ref},n(o.props.children)):n(o)}var Te={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};
20983
+ var N='[cmdk-group=""]',Y='[cmdk-group-items=""]',be='[cmdk-group-heading=""]',le='[cmdk-item=""]',ce=`${le}:not([aria-disabled="true"])`,Z="cmdk-item-select",T="data-value",Re=(r,o,n)=>W(r,o,n),ue=React.createContext(void 0),K=()=>React.useContext(ue),de=React.createContext(void 0),ee=()=>React.useContext(de),fe=React.createContext(void 0),me=React.forwardRef((r,o)=>{let n=L(()=>{var e,a;return {search:"",value:(a=(e=r.value)!=null?e:r.defaultValue)!=null?a:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),u=L(()=>new Set),c=L(()=>new Map),d=L(()=>new Map),f=L(()=>new Set),p=pe(r),{label:b,children:m,value:R,onValueChange:x,filter:C,shouldFilter:S,loop:A,disablePointerSelection:ge=false,vimBindings:j=true,...O}=r,$=useId(),q=useId(),_=useId(),I=React.useRef(null),v=ke();k$2(()=>{if(R!==void 0){let e=R.trim();n.current.value=e,E.emit();}},[R]),k$2(()=>{v(6,ne);},[]);let E=React.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>n.current,setState:(e,a,s)=>{var i,l,g,y;if(!Object.is(n.current[e],a)){if(n.current[e]=a,e==="search")J(),z(),v(1,W);else if(e==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let h=document.getElementById(_);h?h.focus():(i=document.getElementById($))==null||i.focus();}if(v(7,()=>{var h;n.current.selectedItemId=(h=M())==null?void 0:h.id,E.emit();}),s||v(5,ne),((l=p.current)==null?void 0:l.value)!==void 0){let h=a!=null?a:"";(y=(g=p.current).onValueChange)==null||y.call(g,h);return}}E.emit();}},emit:()=>{f.current.forEach(e=>e());}}),[]),U=React.useMemo(()=>({value:(e,a,s)=>{var i;a!==((i=d.current.get(e))==null?void 0:i.value)&&(d.current.set(e,{value:a,keywords:s}),n.current.filtered.items.set(e,te(a,s)),v(2,()=>{z(),E.emit();}));},item:(e,a)=>(u.current.add(e),a&&(c.current.has(a)?c.current.get(a).add(e):c.current.set(a,new Set([e]))),v(3,()=>{J(),z(),n.current.value||W(),E.emit();}),()=>{d.current.delete(e),u.current.delete(e),n.current.filtered.items.delete(e);let s=M();v(4,()=>{J(),(s==null?void 0:s.getAttribute("id"))===e&&W(),E.emit();});}),group:e=>(c.current.has(e)||c.current.set(e,new Set),()=>{d.current.delete(e),c.current.delete(e);}),filter:()=>p.current.shouldFilter,label:b||r["aria-label"],getDisablePointerSelection:()=>p.current.disablePointerSelection,listId:$,inputId:_,labelId:q,listInnerRef:I}),[]);function te(e,a){var i,l;let s=(l=(i=p.current)==null?void 0:i.filter)!=null?l:Re;return e?s(e,n.current.search,a):0}function z(){if(!n.current.search||p.current.shouldFilter===false)return;let e=n.current.filtered.items,a=[];n.current.filtered.groups.forEach(i=>{let l=c.current.get(i),g=0;l.forEach(y=>{let h=e.get(y);g=Math.max(h,g);}),a.push([i,g]);});let s=I.current;V().sort((i,l)=>{var h,F;let g=i.getAttribute("id"),y=l.getAttribute("id");return ((h=e.get(y))!=null?h:0)-((F=e.get(g))!=null?F:0)}).forEach(i=>{let l=i.closest(Y);l?l.appendChild(i.parentElement===l?i:i.closest(`${Y} > *`)):s.appendChild(i.parentElement===s?i:i.closest(`${Y} > *`));}),a.sort((i,l)=>l[1]-i[1]).forEach(i=>{var g;let l=(g=I.current)==null?void 0:g.querySelector(`${N}[${T}="${encodeURIComponent(i[0])}"]`);l==null||l.parentElement.appendChild(l);});}function W(){let e=V().find(s=>s.getAttribute("aria-disabled")!=="true"),a=e==null?void 0:e.getAttribute(T);E.setState("value",a||void 0);}function J(){var a,s,i,l;if(!n.current.search||p.current.shouldFilter===false){n.current.filtered.count=u.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let g of u.current){let y=(s=(a=d.current.get(g))==null?void 0:a.value)!=null?s:"",h=(l=(i=d.current.get(g))==null?void 0:i.keywords)!=null?l:[],F=te(y,h);n.current.filtered.items.set(g,F),F>0&&e++;}for(let[g,y]of c.current)for(let h of y)if(n.current.filtered.items.get(h)>0){n.current.filtered.groups.add(g);break}n.current.filtered.count=e;}function ne(){var a,s,i;let e=M();e&&(((a=e.parentElement)==null?void 0:a.firstChild)===e&&((i=(s=e.closest(N))==null?void 0:s.querySelector(be))==null||i.scrollIntoView({block:"nearest"})),e.scrollIntoView({block:"nearest"}));}function M(){var e;return (e=I.current)==null?void 0:e.querySelector(`${le}[aria-selected="true"]`)}function V(){var e;return Array.from(((e=I.current)==null?void 0:e.querySelectorAll(ce))||[])}function X(e){let s=V()[e];s&&E.setState("value",s.getAttribute(T));}function Q(e){var g;let a=M(),s=V(),i=s.findIndex(y=>y===a),l=s[i+e];(g=p.current)!=null&&g.loop&&(l=i+e<0?s[s.length-1]:i+e===s.length?s[0]:s[i+e]),l&&E.setState("value",l.getAttribute(T));}function re(e){let a=M(),s=a==null?void 0:a.closest(N),i;for(;s&&!i;)s=e>0?we(s,N):De(s,N),i=s==null?void 0:s.querySelector(ce);i?E.setState("value",i.getAttribute(T)):Q(e);}let oe=()=>X(V().length-1),ie=e=>{e.preventDefault(),e.metaKey?oe():e.altKey?re(1):Q(1);},se=e=>{e.preventDefault(),e.metaKey?X(0):e.altKey?re(-1):Q(-1);};return React.createElement(Primitive.div,{ref:o,tabIndex:-1,...O,"cmdk-root":"",onKeyDown:e=>{var s;(s=O.onKeyDown)==null||s.call(O,e);let a=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||a))switch(e.key){case "n":case "j":{j&&e.ctrlKey&&ie(e);break}case "ArrowDown":{ie(e);break}case "p":case "k":{j&&e.ctrlKey&&se(e);break}case "ArrowUp":{se(e);break}case "Home":{e.preventDefault(),X(0);break}case "End":{e.preventDefault(),oe();break}case "Enter":{e.preventDefault();let i=M();if(i){let l=new Event(Z);i.dispatchEvent(l);}}}}},React.createElement("label",{"cmdk-label":"",htmlFor:U.inputId,id:U.labelId,style:Te},b),B(r,e=>React.createElement(de.Provider,{value:E},React.createElement(ue.Provider,{value:U},e))))}),he=React.forwardRef((r,o)=>{var _,I;let n=useId(),u=React.useRef(null),c=React.useContext(fe),d=K(),f=pe(r),p=(I=(_=f.current)==null?void 0:_.forceMount)!=null?I:c==null?void 0:c.forceMount;k$2(()=>{if(!p)return d.item(n,c==null?void 0:c.id)},[p]);let b=ve(n,u,[r.value,r.children,u],r.keywords),m=ee(),R=P(v=>v.value&&v.value===b.current),x=P(v=>p||d.filter()===false?true:v.search?v.filtered.items.get(n)>0:true);React.useEffect(()=>{let v=u.current;if(!(!v||r.disabled))return v.addEventListener(Z,C),()=>v.removeEventListener(Z,C)},[x,r.onSelect,r.disabled]);function C(){var v,E;S(),(E=(v=f.current).onSelect)==null||E.call(v,b.current);}function S(){m.setState("value",b.current,true);}if(!x)return null;let{disabled:A,value:ge,onSelect:j,forceMount:O,keywords:$,...q}=r;return React.createElement(Primitive.div,{ref:composeRefs(u,o),...q,id:n,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!R,"data-disabled":!!A,"data-selected":!!R,onPointerMove:A||d.getDisablePointerSelection()?void 0:S,onClick:A?void 0:C},r.children)}),Ee=React.forwardRef((r,o)=>{let{heading:n,children:u,forceMount:c,...d}=r,f=useId(),p=React.useRef(null),b=React.useRef(null),m=useId(),R=K(),x=P(S=>c||R.filter()===false?true:S.search?S.filtered.groups.has(f):true);k$2(()=>R.group(f),[]),ve(f,p,[r.value,r.heading,b]);let C=React.useMemo(()=>({id:f,forceMount:c}),[c]);return React.createElement(Primitive.div,{ref:composeRefs(p,o),...d,"cmdk-group":"",role:"presentation",hidden:x?void 0:true},n&&React.createElement("div",{ref:b,"cmdk-group-heading":"","aria-hidden":true,id:m},n),B(r,S=>React.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?m:void 0},React.createElement(fe.Provider,{value:C},S))))}),ye=React.forwardRef((r,o)=>{let{alwaysRender:n,...u}=r,c=React.useRef(null),d=P(f=>!f.search);return !n&&!d?null:React.createElement(Primitive.div,{ref:composeRefs(c,o),...u,"cmdk-separator":"",role:"separator"})}),Se=React.forwardRef((r,o)=>{let{onValueChange:n,...u}=r,c=r.value!=null,d=ee(),f=P(m=>m.search),p=P(m=>m.selectedItemId),b=K();return React.useEffect(()=>{r.value!=null&&d.setState("search",r.value);},[r.value]),React.createElement(Primitive.input,{ref:o,...u,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:false,"aria-autocomplete":"list",role:"combobox","aria-expanded":true,"aria-controls":b.listId,"aria-labelledby":b.labelId,"aria-activedescendant":p,id:b.inputId,type:"text",value:c?r.value:f,onChange:m=>{c||d.setState("search",m.target.value),n==null||n(m.target.value);}})}),Ce=React.forwardRef((r,o)=>{let{children:n,label:u="Suggestions",...c}=r,d=React.useRef(null),f=React.useRef(null),p=P(m=>m.selectedItemId),b=K();return React.useEffect(()=>{if(f.current&&d.current){let m=f.current,R=d.current,x,C=new ResizeObserver(()=>{x=requestAnimationFrame(()=>{let S=m.offsetHeight;R.style.setProperty("--cmdk-list-height",S.toFixed(1)+"px");});});return C.observe(m),()=>{cancelAnimationFrame(x),C.unobserve(m);}}},[]),React.createElement(Primitive.div,{ref:composeRefs(d,o),...c,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":p,"aria-label":u,id:b.listId},B(r,m=>React.createElement("div",{ref:composeRefs(f,b.listInnerRef),"cmdk-list-sizer":""},m)))}),xe=React.forwardRef((r,o)=>{let{open:n,onOpenChange:u,overlayClassName:c,contentClassName:d,container:f,...p}=r;return React.createElement(Root$1,{open:n,onOpenChange:u},React.createElement(Portal,{container:f},React.createElement(Overlay,{"cmdk-overlay":"",className:c}),React.createElement(Content$1,{"aria-label":r.label,"cmdk-dialog":"",className:d},React.createElement(me,{ref:o,...p}))))}),Ie=React.forwardRef((r,o)=>P(u=>u.filtered.count===0)?React.createElement(Primitive.div,{ref:o,...r,"cmdk-empty":"",role:"presentation"}):null),Pe=React.forwardRef((r,o)=>{let{progress:n,children:u,label:c="Loading...",...d}=r;return React.createElement(Primitive.div,{ref:o,...d,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":c},B(r,f=>React.createElement("div",{"aria-hidden":true},f)))}),_e=Object.assign(me,{List:Ce,Item:he,Input:Se,Group:Ee,Separator:ye,Dialog:xe,Empty:Ie,Loading:Pe});function we(r,o){let n=r.nextElementSibling;for(;n;){if(n.matches(o))return n;n=n.nextElementSibling;}}function De(r,o){let n=r.previousElementSibling;for(;n;){if(n.matches(o))return n;n=n.previousElementSibling;}}function pe(r){let o=React.useRef(r);return k$2(()=>{o.current=r;}),o}var k$2=typeof window=="undefined"?React.useEffect:React.useLayoutEffect;function L(r){let o=React.useRef();return o.current===void 0&&(o.current=r()),o}function P(r){let o=ee(),n=()=>r(o.snapshot());return React.useSyncExternalStore(o.subscribe,n,n)}function ve(r,o,n,u=[]){let c=React.useRef(),d=K();return k$2(()=>{var b;let f=(()=>{var m;for(let R of n){if(typeof R=="string")return R.trim();if(typeof R=="object"&&"current"in R)return R.current?(m=R.current.textContent)==null?void 0:m.trim():c.current}})(),p=u.map(m=>m.trim());d.value(r,f,p),(b=o.current)==null||b.setAttribute(T,f),c.current=f;}),c}var ke=()=>{let[r,o]=React.useState(),n=L(()=>new Map);return k$2(()=>{n.current.forEach(u=>u()),n.current=new Map;},[r]),(u,c)=>{n.current.set(u,c),o({});}};function Me(r){let o=r.type;return typeof o=="function"?o(r.props):"render"in o?o.render(r.props):r}function B({asChild:r,children:o},n){return r&&React.isValidElement(o)?React.cloneElement(Me(o),{ref:o.ref},n(o.props.children)):n(o)}var Te={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};
21496
20984
 
21497
20985
  /**
21498
20986
  * @license lucide-react v0.479.0 - ISC
@@ -22224,7 +21712,7 @@ const flip$2 = function (options) {
22224
21712
  if (!ignoreCrossAxisOverflow ||
22225
21713
  // We leave the current main axis only if every placement on that axis
22226
21714
  // overflows the main axis.
22227
- overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
21715
+ overflowsData.every(d => d.overflows[0] > 0 && getSideAxis(d.placement) === initialSideAxis)) {
22228
21716
  // Try next placement and re-run the lifecycle.
22229
21717
  return {
22230
21718
  data: {
@@ -22963,9 +22451,14 @@ function getWindowScrollBarX(element, rect) {
22963
22451
  return rect.left + leftScroll;
22964
22452
  }
22965
22453
 
22966
- function getHTMLOffset(documentElement, scroll) {
22454
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
22455
+ if (ignoreScrollbarX === void 0) {
22456
+ ignoreScrollbarX = false;
22457
+ }
22967
22458
  const htmlRect = documentElement.getBoundingClientRect();
22968
- const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
22459
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
22460
+ // RTL <body> scrollbar.
22461
+ getWindowScrollBarX(documentElement, htmlRect));
22969
22462
  const y = htmlRect.top + scroll.scrollTop;
22970
22463
  return {
22971
22464
  x,
@@ -23004,7 +22497,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
23004
22497
  offsets.y = offsetRect.y + offsetParent.clientTop;
23005
22498
  }
23006
22499
  }
23007
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
22500
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
23008
22501
  return {
23009
22502
  width: rect.width * scale.x,
23010
22503
  height: rect.height * scale.y,
@@ -23038,10 +22531,6 @@ function getDocumentRect(element) {
23038
22531
  };
23039
22532
  }
23040
22533
 
23041
- // Safety check: ensure the scrollbar space is reasonable in case this
23042
- // calculation is affected by unusual styles.
23043
- // Most scrollbars leave 15-18px of space.
23044
- const SCROLLBAR_MAX = 25;
23045
22534
  function getViewportRect(element, strategy) {
23046
22535
  const win = getWindow(element);
23047
22536
  const html = getDocumentElement(element);
@@ -23059,24 +22548,6 @@ function getViewportRect(element, strategy) {
23059
22548
  y = visualViewport.offsetTop;
23060
22549
  }
23061
22550
  }
23062
- const windowScrollbarX = getWindowScrollBarX(html);
23063
- // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
23064
- // visual width of the <html> but this is not considered in the size
23065
- // of `html.clientWidth`.
23066
- if (windowScrollbarX <= 0) {
23067
- const doc = html.ownerDocument;
23068
- const body = doc.body;
23069
- const bodyStyles = getComputedStyle(body);
23070
- const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
23071
- const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
23072
- if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
23073
- width -= clippingStableScrollbarWidth;
23074
- }
23075
- } else if (windowScrollbarX <= SCROLLBAR_MAX) {
23076
- // If the <body> scrollbar is on the left, the width needs to be extended
23077
- // by the scrollbar amount so there isn't extra space on the right.
23078
- width += windowScrollbarX;
23079
- }
23080
22551
  return {
23081
22552
  width,
23082
22553
  height,
@@ -23987,13 +23458,8 @@ var PopperAnchor = React.forwardRef(
23987
23458
  const context = usePopperContext(ANCHOR_NAME$1, __scopePopper);
23988
23459
  const ref = React.useRef(null);
23989
23460
  const composedRefs = useComposedRefs(forwardedRef, ref);
23990
- const anchorRef = React.useRef(null);
23991
23461
  React.useEffect(() => {
23992
- const previousAnchor = anchorRef.current;
23993
- anchorRef.current = virtualRef?.current || ref.current;
23994
- if (previousAnchor !== anchorRef.current) {
23995
- context.onAnchorChange(anchorRef.current);
23996
- }
23462
+ context.onAnchorChange(virtualRef?.current || ref.current);
23997
23463
  });
23998
23464
  return virtualRef ? null : /* @__PURE__ */ jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
23999
23465
  }
@@ -24242,7 +23708,7 @@ var Content = PopperContent;
24242
23708
  var Arrow = PopperArrow;
24243
23709
 
24244
23710
  var POPOVER_NAME = "Popover";
24245
- var [createPopoverContext] = createContextScope(POPOVER_NAME, [
23711
+ var [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [
24246
23712
  createPopperScope
24247
23713
  ]);
24248
23714
  var usePopperScope = createPopperScope();
@@ -30343,7 +29809,7 @@ var frRawCountries = [
30343
29809
  id: 704,
30344
29810
  alpha2: "vn",
30345
29811
  alpha3: "vnm",
30346
- name: "Vietnam"
29812
+ name: "Viêt Nam"
30347
29813
  },
30348
29814
  {
30349
29815
  id: 887,
@@ -36455,10 +35921,10 @@ var hasRequiredReactStripe_umd;
36455
35921
  function requireReactStripe_umd () {
36456
35922
  if (hasRequiredReactStripe_umd) return reactStripe_umd$1.exports;
36457
35923
  hasRequiredReactStripe_umd = 1;
36458
- (function (module, exports$1) {
35924
+ (function (module, exports) {
36459
35925
  (function (global, factory) {
36460
- factory(exports$1, React__default) ;
36461
- })(reactStripe_umd, (function (exports$1, React) {
35926
+ factory(exports, React__default) ;
35927
+ })(reactStripe_umd, (function (exports, React) {
36462
35928
  function ownKeys(object, enumerableOnly) {
36463
35929
  var keys = Object.keys(object);
36464
35930
 
@@ -36893,12 +36359,12 @@ function requireReactStripe_umd () {
36893
36359
 
36894
36360
  stripe._registerWrapper({
36895
36361
  name: 'react-stripe-js',
36896
- version: "3.10.0"
36362
+ version: "3.7.0"
36897
36363
  });
36898
36364
 
36899
36365
  stripe.registerAppInfo({
36900
36366
  name: 'react-stripe-js',
36901
- version: "3.10.0",
36367
+ version: "3.7.0",
36902
36368
  url: 'https://stripe.com/docs/stripe-js/react'
36903
36369
  });
36904
36370
  };
@@ -36920,7 +36386,7 @@ function requireReactStripe_umd () {
36920
36386
  * The `loadStripe` function will asynchronously load the Stripe.js script and initialize a `Stripe` object.
36921
36387
  * Pass the returned `Promise` to `Elements`.
36922
36388
  *
36923
- * @docs https://docs.stripe.com/sdks/stripejs-react?ui=elements#elements-provider
36389
+ * @docs https://stripe.com/docs/stripe-js/react#elements-provider
36924
36390
  */
36925
36391
 
36926
36392
  var Elements = function Elements(_ref) {
@@ -37143,30 +36609,20 @@ function requireReactStripe_umd () {
37143
36609
  var prevOptions = usePrevious(options);
37144
36610
  var prevCheckoutSdk = usePrevious(ctx.checkoutSdk);
37145
36611
  React.useEffect(function () {
37146
- var _prevOptions$elements, _options$elementsOpti, _prevOptions$elements2, _options$elementsOpti2;
36612
+ var _prevOptions$elements, _options$elementsOpti;
37147
36613
 
37148
36614
  // Ignore changes while checkout sdk is not initialized.
37149
36615
  if (!ctx.checkoutSdk) {
37150
36616
  return;
37151
36617
  }
37152
36618
 
37153
- var hasSdkLoaded = Boolean(!prevCheckoutSdk && ctx.checkoutSdk); // Handle appearance changes
37154
-
37155
36619
  var previousAppearance = prevOptions === null || prevOptions === void 0 ? void 0 : (_prevOptions$elements = prevOptions.elementsOptions) === null || _prevOptions$elements === void 0 ? void 0 : _prevOptions$elements.appearance;
37156
36620
  var currentAppearance = options === null || options === void 0 ? void 0 : (_options$elementsOpti = options.elementsOptions) === null || _options$elementsOpti === void 0 ? void 0 : _options$elementsOpti.appearance;
37157
36621
  var hasAppearanceChanged = !isEqual(currentAppearance, previousAppearance);
36622
+ var hasSdkLoaded = !prevCheckoutSdk && ctx.checkoutSdk;
37158
36623
 
37159
36624
  if (currentAppearance && (hasAppearanceChanged || hasSdkLoaded)) {
37160
36625
  ctx.checkoutSdk.changeAppearance(currentAppearance);
37161
- } // Handle fonts changes
37162
-
37163
-
37164
- var previousFonts = prevOptions === null || prevOptions === void 0 ? void 0 : (_prevOptions$elements2 = prevOptions.elementsOptions) === null || _prevOptions$elements2 === void 0 ? void 0 : _prevOptions$elements2.fonts;
37165
- var currentFonts = options === null || options === void 0 ? void 0 : (_options$elementsOpti2 = options.elementsOptions) === null || _options$elementsOpti2 === void 0 ? void 0 : _options$elementsOpti2.fonts;
37166
- var hasFontsChanged = !isEqual(previousFonts, currentFonts);
37167
-
37168
- if (currentFonts && (hasFontsChanged || hasSdkLoaded)) {
37169
- ctx.checkoutSdk.loadFonts(currentFonts);
37170
36626
  }
37171
36627
  }, [options, prevOptions, ctx.checkoutSdk, prevCheckoutSdk]); // Attach react-stripe-js version to stripe.js instance
37172
36628
 
@@ -37250,9 +36706,7 @@ function requireReactStripe_umd () {
37250
36706
  onConfirm = _ref.onConfirm,
37251
36707
  onCancel = _ref.onCancel,
37252
36708
  onShippingAddressChange = _ref.onShippingAddressChange,
37253
- onShippingRateChange = _ref.onShippingRateChange,
37254
- onSavedPaymentMethodRemove = _ref.onSavedPaymentMethodRemove,
37255
- onSavedPaymentMethodUpdate = _ref.onSavedPaymentMethodUpdate;
36709
+ onShippingRateChange = _ref.onShippingRateChange;
37256
36710
  var ctx = useElementsOrCheckoutSdkContextWithUseCase("mounts <".concat(displayName, ">"));
37257
36711
  var elements = 'elements' in ctx ? ctx.elements : null;
37258
36712
  var checkoutSdk = 'checkoutSdk' in ctx ? ctx.checkoutSdk : null;
@@ -37278,8 +36732,6 @@ function requireReactStripe_umd () {
37278
36732
  useAttachEvent(element, 'cancel', onCancel);
37279
36733
  useAttachEvent(element, 'shippingaddresschange', onShippingAddressChange);
37280
36734
  useAttachEvent(element, 'shippingratechange', onShippingRateChange);
37281
- useAttachEvent(element, 'savedpaymentmethodremove', onSavedPaymentMethodRemove);
37282
- useAttachEvent(element, 'savedpaymentmethodupdate', onSavedPaymentMethodUpdate);
37283
36735
  useAttachEvent(element, 'change', onChange);
37284
36736
  var readyCallback;
37285
36737
 
@@ -37332,10 +36784,6 @@ function requireReactStripe_umd () {
37332
36784
  newElement = checkoutSdk.createCurrencySelectorElement();
37333
36785
  break;
37334
36786
 
37335
- case 'taxId':
37336
- newElement = checkoutSdk.createTaxIdElement(options);
37337
- break;
37338
-
37339
36787
  default:
37340
36788
  throw new Error("Invalid Element type ".concat(displayName, ". You must use either the <PaymentElement />, <AddressElement options={{mode: 'shipping'}} />, <AddressElement options={{mode: 'billing'}} />, or <ExpressCheckoutElement />."));
37341
36789
  }
@@ -37411,8 +36859,6 @@ function requireReactStripe_umd () {
37411
36859
  onCancel: PropTypes.func,
37412
36860
  onShippingAddressChange: PropTypes.func,
37413
36861
  onShippingRateChange: PropTypes.func,
37414
- onSavedPaymentMethodRemove: PropTypes.func,
37415
- onSavedPaymentMethodUpdate: PropTypes.func,
37416
36862
  options: PropTypes.object
37417
36863
  };
37418
36864
  Element.displayName = displayName;
@@ -37720,42 +37166,35 @@ function requireReactStripe_umd () {
37720
37166
  */
37721
37167
 
37722
37168
  var AfterpayClearpayMessageElement = createElementComponent('afterpayClearpayMessage', isServer);
37723
- /**
37724
- * Requires beta access:
37725
- * Contact [Stripe support](https://support.stripe.com/) for more information.
37726
- */
37727
37169
 
37728
- var TaxIdElement = createElementComponent('taxId', isServer);
37729
-
37730
- exports$1.AddressElement = AddressElement;
37731
- exports$1.AffirmMessageElement = AffirmMessageElement;
37732
- exports$1.AfterpayClearpayMessageElement = AfterpayClearpayMessageElement;
37733
- exports$1.AuBankAccountElement = AuBankAccountElement;
37734
- exports$1.CardCvcElement = CardCvcElement;
37735
- exports$1.CardElement = CardElement;
37736
- exports$1.CardExpiryElement = CardExpiryElement;
37737
- exports$1.CardNumberElement = CardNumberElement;
37738
- exports$1.CheckoutProvider = CheckoutProvider;
37739
- exports$1.CurrencySelectorElement = CurrencySelectorElement;
37740
- exports$1.Elements = Elements;
37741
- exports$1.ElementsConsumer = ElementsConsumer;
37742
- exports$1.EmbeddedCheckout = EmbeddedCheckout;
37743
- exports$1.EmbeddedCheckoutProvider = EmbeddedCheckoutProvider;
37744
- exports$1.EpsBankElement = EpsBankElement;
37745
- exports$1.ExpressCheckoutElement = ExpressCheckoutElement;
37746
- exports$1.FpxBankElement = FpxBankElement;
37747
- exports$1.IbanElement = IbanElement;
37748
- exports$1.IdealBankElement = IdealBankElement;
37749
- exports$1.LinkAuthenticationElement = LinkAuthenticationElement;
37750
- exports$1.P24BankElement = P24BankElement;
37751
- exports$1.PaymentElement = PaymentElement;
37752
- exports$1.PaymentMethodMessagingElement = PaymentMethodMessagingElement;
37753
- exports$1.PaymentRequestButtonElement = PaymentRequestButtonElement;
37754
- exports$1.ShippingAddressElement = ShippingAddressElement;
37755
- exports$1.TaxIdElement = TaxIdElement;
37756
- exports$1.useCheckout = useCheckout;
37757
- exports$1.useElements = useElements;
37758
- exports$1.useStripe = useStripe;
37170
+ exports.AddressElement = AddressElement;
37171
+ exports.AffirmMessageElement = AffirmMessageElement;
37172
+ exports.AfterpayClearpayMessageElement = AfterpayClearpayMessageElement;
37173
+ exports.AuBankAccountElement = AuBankAccountElement;
37174
+ exports.CardCvcElement = CardCvcElement;
37175
+ exports.CardElement = CardElement;
37176
+ exports.CardExpiryElement = CardExpiryElement;
37177
+ exports.CardNumberElement = CardNumberElement;
37178
+ exports.CheckoutProvider = CheckoutProvider;
37179
+ exports.CurrencySelectorElement = CurrencySelectorElement;
37180
+ exports.Elements = Elements;
37181
+ exports.ElementsConsumer = ElementsConsumer;
37182
+ exports.EmbeddedCheckout = EmbeddedCheckout;
37183
+ exports.EmbeddedCheckoutProvider = EmbeddedCheckoutProvider;
37184
+ exports.EpsBankElement = EpsBankElement;
37185
+ exports.ExpressCheckoutElement = ExpressCheckoutElement;
37186
+ exports.FpxBankElement = FpxBankElement;
37187
+ exports.IbanElement = IbanElement;
37188
+ exports.IdealBankElement = IdealBankElement;
37189
+ exports.LinkAuthenticationElement = LinkAuthenticationElement;
37190
+ exports.P24BankElement = P24BankElement;
37191
+ exports.PaymentElement = PaymentElement;
37192
+ exports.PaymentMethodMessagingElement = PaymentMethodMessagingElement;
37193
+ exports.PaymentRequestButtonElement = PaymentRequestButtonElement;
37194
+ exports.ShippingAddressElement = ShippingAddressElement;
37195
+ exports.useCheckout = useCheckout;
37196
+ exports.useElements = useElements;
37197
+ exports.useStripe = useStripe;
37759
37198
 
37760
37199
  }));
37761
37200
  } (reactStripe_umd$1, reactStripe_umd$1.exports));
@@ -37956,13 +37395,19 @@ var loadStripe = function loadStripe() {
37956
37395
  const useCheckout = create((set) => ({
37957
37396
  isSubmitting: false,
37958
37397
  setIsSubmitting: (isSubmitting) => set({ isSubmitting }),
37398
+ paymentMethod: null,
37399
+ setPaymentMethod: (paymentMethod) => set({ paymentMethod }),
37959
37400
  }));
37960
37401
 
37961
- const CheckoutForm$2 = ({ onSuccess, onError, children, setSubmitting, }) => {
37402
+ const CheckoutForm$1 = ({ onSuccess, onError, children, setSubmitting, }) => {
37962
37403
  const stripe = reactStripe_umdExports.useStripe();
37963
37404
  const elements = reactStripe_umdExports.useElements();
37964
- const { setIsSubmitting } = useCheckout();
37405
+ const { setIsSubmitting, setPaymentMethod } = useCheckout();
37965
37406
  const [errorMessage, setErrorMessage] = useState(undefined);
37407
+ const handlePaymentMethodChange = (event) => {
37408
+ var _a, _b;
37409
+ setPaymentMethod((_b = (_a = event === null || event === void 0 ? void 0 : event.value) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : null);
37410
+ };
37966
37411
  const handleSubmit = (event) => __awaiter(void 0, void 0, void 0, function* () {
37967
37412
  event.preventDefault();
37968
37413
  if (!stripe || !elements) {
@@ -37987,11 +37432,11 @@ const CheckoutForm$2 = ({ onSuccess, onError, children, setSubmitting, }) => {
37987
37432
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
37988
37433
  }
37989
37434
  });
37990
- return (jsxs("form", { className: "w-full pb-40 sm:pb-0", onSubmit: handleSubmit, children: [jsx(reactStripe_umdExports.PaymentElement, {}), errorMessage && (jsx("p", { className: "text-destructive -mb-2 mt-2 text-sm", children: errorMessage })), children] }));
37435
+ return (jsxs("form", { className: "w-full pb-40 sm:pb-0", onSubmit: handleSubmit, children: [jsx(reactStripe_umdExports.PaymentElement, { onChange: handlePaymentMethodChange }), errorMessage && (jsx("p", { className: "text-destructive -mb-2 mt-2 text-sm", children: errorMessage })), children] }));
37991
37436
  };
37992
- var CheckoutForm$1 = memo(CheckoutForm$2);
37437
+ var CheckoutForm$2 = memo(CheckoutForm$1);
37993
37438
 
37994
- function PaymentElement$1({ paymentSecret, publicKey, checkoutAppearance, locale, fonts, onSuccess, onError, children, setSubmitting, }) {
37439
+ function PaymentElement({ paymentSecret, publicKey, checkoutAppearance, locale, fonts, onSuccess, onError, children, setSubmitting, }) {
37995
37440
  const stripePromise = loadStripe(publicKey !== null && publicKey !== void 0 ? publicKey : "");
37996
37441
  const options = {
37997
37442
  locale: locale !== null && locale !== void 0 ? locale : "en",
@@ -37999,9 +37444,9 @@ function PaymentElement$1({ paymentSecret, publicKey, checkoutAppearance, locale
37999
37444
  clientSecret: paymentSecret,
38000
37445
  fonts: fonts,
38001
37446
  };
38002
- return (jsx(reactStripe_umdExports.Elements, { stripe: stripePromise, options: options, children: jsx(CheckoutForm$1, { onSuccess: onSuccess, onError: onError, setSubmitting: setSubmitting, children: children }) }));
37447
+ return (jsx(reactStripe_umdExports.Elements, { stripe: stripePromise, options: options, children: jsx(CheckoutForm$2, { onSuccess: onSuccess, onError: onError, setSubmitting: setSubmitting, children: children }) }));
38003
37448
  }
38004
- var PaymentElement = memo(PaymentElement$1);
37449
+ var PaymentElement$1 = memo(PaymentElement);
38005
37450
 
38006
37451
  const parseNumber = (color, len) => {
38007
37452
  if (typeof color !== 'number') return;
@@ -42660,10 +42105,30 @@ const convertCheckoutAppearanceToStripeAppearance = (appearance, fonts) => {
42660
42105
  return newAppearance;
42661
42106
  };
42662
42107
 
42663
- function PaymentForm({ paymentSecret, onSuccess, onError, onBack, onDoubleBack, contactEmail, shippingFormData, address, checkoutAppearance, fonts, locale, publicKey, paymentComponentKey, }) {
42108
+ const Icons = {
42109
+ apple: (props) => (jsxs("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, props, { role: "img", fill: "none", children: [jsxs("g", { clipPath: "url(#clip0_4418_8987)", children: [jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M19.1001 19.16C19.6901 18.26 19.9101 17.8 20.3601 16.79C17.0401 15.53 16.5101 10.8 19.7901 8.98999C18.7901 7.72999 17.3801 7 16.0501 7C15.0901 7 14.4301 7.25001 13.8401 7.48001C13.3401 7.67001 12.8901 7.84 12.3301 7.84C11.7301 7.84 11.2001 7.65001 10.6401 7.45001C10.0301 7.23001 9.39006 7 8.59006 7C7.10006 7 5.51007 7.91 4.50007 9.47C3.08007 11.67 3.33007 15.79 5.62007 19.31C6.44007 20.57 7.54007 21.98 8.97007 22C9.57007 22.01 9.96007 21.83 10.3901 21.64C10.8801 21.42 11.4101 21.18 12.3401 21.18C13.2701 21.17 13.7901 21.42 14.2801 21.64C14.7001 21.83 15.0801 22.01 15.6701 22C17.1201 21.98 18.2801 20.42 19.1001 19.16Z", fill: "currentColor" }), jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M15.8399 2C15.9999 3.1 15.5499 4.19001 14.9599 4.95001C14.3299 5.77001 13.2299 6.41 12.1699 6.37C11.9799 5.31 12.4699 4.21999 13.0699 3.48999C13.7399 2.68999 14.8699 2.07 15.8399 2Z", fill: "currentColor" })] }), jsx("defs", { children: jsx("clipPath", { id: "clip0_4418_8987", children: jsx("rect", { width: "24", height: "24", fill: "white" }) }) })] }))),
42110
+ google: (props) => (jsxs("svg", Object.assign({ viewBox: "-3 0 262 262" }, props, { role: "img", fill: "none", children: [jsx("path", { d: "M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027", fill: "#4285F4" }), jsx("path", { d: "M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1", fill: "#34A853" }), jsx("path", { d: "M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782", fill: "#FBBC05" }), jsx("path", { d: "M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251", fill: "#EB4335" })] }))),
42111
+ paypal: (props) => (jsx("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "584.798", height: "720", viewBox: "0 0 154.728 190.5" }, props, { role: "img", fill: "none", children: jsxs("g", { transform: "translate(898.192 276.071)", children: [jsx("path", { clipPath: "none", d: "M-837.663-237.968a5.49 5.49 0 0 0-5.423 4.633l-9.013 57.15-8.281 52.514-.005.044.01-.044 8.281-52.514c.421-2.669 2.719-4.633 5.42-4.633h26.404c26.573 0 49.127-19.387 53.246-45.658.314-1.996.482-3.973.52-5.924v-.003h-.003c-6.753-3.543-14.683-5.565-23.372-5.565z", fill: "#001c64" }), jsx("path", { clipPath: "none", d: "M-766.506-232.402c-.037 1.951-.207 3.93-.52 5.926-4.119 26.271-26.673 45.658-53.246 45.658h-26.404c-2.701 0-4.999 1.964-5.42 4.633l-8.281 52.514-5.197 32.947a4.46 4.46 0 0 0 4.405 5.153h28.66a5.49 5.49 0 0 0 5.423-4.633l7.55-47.881c.423-2.669 2.722-4.636 5.423-4.636h16.876c26.573 0 49.124-19.386 53.243-45.655 2.924-18.649-6.46-35.614-22.511-44.026z", fill: "#0070e0" }), jsx("path", { clipPath: "none", d: "M-870.225-276.071a5.49 5.49 0 0 0-5.423 4.636l-22.489 142.608a4.46 4.46 0 0 0 4.405 5.156h33.351l8.281-52.514 9.013-57.15a5.49 5.49 0 0 1 5.423-4.633h47.782c8.691 0 16.621 2.025 23.375 5.563.46-23.917-19.275-43.666-46.412-43.666z", fill: "#003087" })] }) }))),
42112
+ };
42113
+
42114
+ function PaymentForm({ paymentSecret, onSuccess, onError, onBack, onDoubleBack, currency, contactEmail, shippingFormData, address, checkoutAppearance, fonts, locale, publicKey, paymentComponentKey, }) {
42664
42115
  const [isSubmitting, setIsSubmitting] = useState(false);
42665
42116
  const { t } = useTranslation();
42666
- return (jsxs("div", { className: "space-y-6", children: [jsxs("div", { children: [jsx("h2", { className: "mb-2", children: t("CheckoutEmbed.Payment.title") }), jsx("p", { className: "text-muted-foreground text-sm", children: t("CheckoutEmbed.Payment.description") })] }), jsxs("div", { className: "space-y-2", children: [jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("p", { children: [jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.contact") }), " ", jsx("span", { className: "text-muted-foreground", children: contactEmail })] }), jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("p", { children: [jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.address") }), " ", jsx("span", { className: "text-muted-foreground", children: address })] }), jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("div", { className: "flex gap-1", children: [jsx("p", { className: "font-medium", children: t("CheckoutEmbed.Shipping.shipping") }), " ", jsx("div", { className: "text-muted-foreground flex flex-col gap-1", children: Object.entries(shippingFormData).map(([id, shipmentFormData]) => (jsxs("p", { children: [shipmentFormData.displayName, " \u00B7", " ", shipmentFormData.priceInCents] }, id))) })] }), jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] })] }), jsx("div", { className: "mt-8", children: paymentSecret && (jsx(PaymentElement, { fonts: fonts, checkoutAppearance: convertCheckoutAppearanceToStripeAppearance(checkoutAppearance, fonts), locale: locale, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, setSubmitting: setIsSubmitting, publicKey: publicKey, children: jsx("div", { className: "fixed bottom-0 left-0 right-0 z-50 mt-8 px-4 sm:static sm:px-0", children: jsxs("div", { className: "bg-background flex flex-col-reverse items-center justify-between gap-2 pb-4 sm:flex-row sm:bg-transparent sm:pb-0", children: [jsxs(Button, { className: "w-full sm:w-fit", type: "button", variant: "ghost", onClick: onBack, children: [jsx(ChevronLeft, {}), t("CheckoutEmbed.Payment.back")] }), jsx(SubmitButton, { className: "w-full max-sm:h-[52px] sm:w-fit", isValid: true, isSubmitting: isSubmitting, children: t("CheckoutEmbed.Payment.button") })] }) }) }, paymentComponentKey)) })] }));
42117
+ const { paymentMethod } = useCheckout();
42118
+ const submitButtonTextKey = paymentMethod === "apple_pay"
42119
+ ? "apple_pay"
42120
+ : paymentMethod === "card"
42121
+ ? "default"
42122
+ : paymentMethod === "paypal"
42123
+ ? "paypal"
42124
+ : paymentMethod === "google_pay"
42125
+ ? "google_pay"
42126
+ : "default";
42127
+ const submitButtonText = t(`CheckoutEmbed.Payment.button.${submitButtonTextKey}`);
42128
+ const renderButtonIcon = () => {
42129
+ return submitButtonTextKey === "apple_pay" ? (jsx(Icons.apple, { className: "size-5 max-sm:size-[22px]" })) : submitButtonTextKey === "google_pay" ? (jsx(Icons.google, { className: "ml-1 size-4 max-sm:size-5" })) : submitButtonTextKey === "paypal" ? (jsx(Icons.paypal, { className: "ml-1 size-4 max-sm:size-5" })) : null;
42130
+ };
42131
+ return (jsxs("div", { className: "space-y-6", children: [jsxs("div", { children: [jsx("h2", { className: "mb-2", children: t("CheckoutEmbed.Payment.title") }), jsx("p", { className: "text-muted-foreground text-sm", children: t("CheckoutEmbed.Payment.description") })] }), jsxs("div", { className: "space-y-2", children: [jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("p", { children: [jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.contact") }), " ", jsx("span", { className: "text-muted-foreground", children: contactEmail })] }), jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("p", { children: [jsx("span", { className: "font-medium", children: t("CheckoutEmbed.Shipping.address") }), " ", jsx("span", { className: "text-muted-foreground", children: address })] }), jsx(Button, { variant: "link", size: "link", onClick: onDoubleBack, children: t("CheckoutEmbed.Shipping.change") })] }), jsxs("div", { className: "flex items-center justify-between text-sm", children: [jsxs("div", { className: "flex gap-1", children: [jsx("p", { className: "font-medium", children: t("CheckoutEmbed.Shipping.shipping") }), " ", jsx("div", { className: "text-muted-foreground flex flex-col gap-1", children: Object.entries(shippingFormData).map(([id, shipmentFormData]) => (jsxs("p", { children: [shipmentFormData.displayName, " \u00B7", " ", formatPrice(shipmentFormData.priceInCents, currency)] }, id))) })] }), jsx(Button, { variant: "link", size: "link", onClick: onBack, children: t("CheckoutEmbed.Shipping.change") })] })] }), jsx("div", { className: "mt-8", children: paymentSecret && (jsx(PaymentElement$1, { fonts: fonts, checkoutAppearance: convertCheckoutAppearanceToStripeAppearance(checkoutAppearance, fonts), locale: locale, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, setSubmitting: setIsSubmitting, publicKey: publicKey, children: jsx("div", { className: "fixed bottom-0 left-0 right-0 z-50 mt-8 px-4 sm:static sm:px-0", children: jsxs("div", { className: "bg-background flex flex-col-reverse items-center justify-between gap-2 pb-4 sm:flex-row sm:bg-transparent sm:pb-0", children: [jsxs(Button, { className: "w-full max-sm:hidden sm:w-fit", type: "button", variant: "ghost", onClick: onBack, children: [jsx(ChevronLeft, {}), t("CheckoutEmbed.Payment.back")] }), jsxs(SubmitButton, { className: "w-full max-sm:h-[52px] max-sm:text-base sm:w-fit", isValid: true, isSubmitting: isSubmitting, children: [submitButtonText, renderButtonIcon()] })] }) }) }, paymentComponentKey)) })] }));
42667
42132
  }
42668
42133
 
42669
42134
  function Skeleton(_a) {
@@ -42958,6 +42423,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
42958
42423
  pickupPointId: shipmentFormData.pickupPointId,
42959
42424
  },
42960
42425
  }));
42426
+ console.log("UPDATING CHECKOUT WITH SHIPMENTS: ", shipments);
42961
42427
  yield storeClient.updateCheckout(clientSecret, checkoutId, {
42962
42428
  shipments,
42963
42429
  });
@@ -42979,7 +42445,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
42979
42445
  };
42980
42446
  const renderStep = () => {
42981
42447
  if (step === "payment" && formData.customer && formData.shipping) {
42982
- return (jsx(PaymentForm, { paymentComponentKey: paymentComponentKey, locale: locale, fonts: fonts, checkoutAppearance: checkoutAppearance, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, onBack: handleBack, onDoubleBack: handleDoubleBack, contactEmail: formData.customer.email, address: formatAddress(formData.customer.address), shippingFormData: formData.shipping, publicKey: publicKey }));
42448
+ return (jsx(PaymentForm, { paymentComponentKey: paymentComponentKey, locale: locale, fonts: fonts, checkoutAppearance: checkoutAppearance, paymentSecret: paymentSecret, onSuccess: onSuccess, onError: onError, onBack: handleBack, onDoubleBack: handleDoubleBack, contactEmail: formData.customer.email, address: formatAddress(formData.customer.address), shippingFormData: formData.shipping, publicKey: publicKey, currency: currency }));
42983
42449
  }
42984
42450
  if (step === "shipping" && formData.customer) {
42985
42451
  return (jsx(ShipmentsShippingMethodForm, { setFormData: setFormData, formData: formData, shippingRates: shippingRates, initialData: formData.shipping, onSubmit: handleShippingSubmit, onBack: handleBack, contactEmail: formData.customer.email, shippingAddress: formatAddress(formData.customer.address), currency: currency, exchangeRate: exchangeRate, locale: locale, countryCode: formData.customer.address.countryCode, shipments: shipments }));