@betterstore/react 0.6.12 → 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.
- package/dist/components/checkout-embed/checkout-form.d.ts.map +1 -1
- package/dist/components/checkout-embed/useFormStore.d.ts +3 -5
- package/dist/components/checkout-embed/useFormStore.d.ts.map +1 -1
- package/dist/components/compounds/form/country-input/dropdown.d.ts +26 -0
- package/dist/components/compounds/form/country-input/dropdown.d.ts.map +1 -0
- package/dist/components/compounds/form/select-group/index.d.ts +14 -0
- package/dist/components/compounds/form/select-group/index.d.ts.map +1 -0
- package/dist/components/compounds/form/select-group/select.d.ts +14 -0
- package/dist/components/compounds/form/select-group/select.d.ts.map +1 -0
- package/dist/components/payment-element/betterstore-checkout-embed-payment-element.d.ts +2 -0
- package/dist/components/payment-element/betterstore-checkout-embed-payment-element.d.ts.map +1 -0
- package/dist/components/shadow-wrapper.d.ts +8 -0
- package/dist/components/shadow-wrapper.d.ts.map +1 -0
- package/dist/components/ui/form.d.ts.map +1 -1
- package/dist/index.cjs.js +634 -1195
- package/dist/index.mjs +640 -1201
- package/dist/lib/betterstore.d.ts +6 -0
- package/dist/lib/betterstore.d.ts.map +1 -0
- 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 = (
|
|
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
|
-
|
|
35
|
-
|
|
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 = (
|
|
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
|
-
|
|
137
|
+
void setItem();
|
|
138
138
|
};
|
|
139
139
|
const configResult = config(
|
|
140
140
|
(...args) => {
|
|
141
141
|
set(...args);
|
|
142
|
-
|
|
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
|
|
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
|
|
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]);
|
|
@@ -3466,13 +3466,6 @@ const createI18nInstance = (locale) => __awaiter(void 0, void 0, void 0, functio
|
|
|
3466
3466
|
return instance;
|
|
3467
3467
|
});
|
|
3468
3468
|
|
|
3469
|
-
/**
|
|
3470
|
-
* Create a bound version of a function with a specified `this` context
|
|
3471
|
-
*
|
|
3472
|
-
* @param {Function} fn - The function to bind
|
|
3473
|
-
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
3474
|
-
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
3475
|
-
*/
|
|
3476
3469
|
function bind(fn, thisArg) {
|
|
3477
3470
|
return function wrap() {
|
|
3478
3471
|
return fn.apply(thisArg, arguments);
|
|
@@ -3524,7 +3517,7 @@ const isUndefined$1 = typeOfTest('undefined');
|
|
|
3524
3517
|
*/
|
|
3525
3518
|
function isBuffer(val) {
|
|
3526
3519
|
return val !== null && !isUndefined$1(val) && val.constructor !== null && !isUndefined$1(val.constructor)
|
|
3527
|
-
&& isFunction$
|
|
3520
|
+
&& isFunction$2(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
3528
3521
|
}
|
|
3529
3522
|
|
|
3530
3523
|
/**
|
|
@@ -3569,7 +3562,7 @@ const isString$1 = typeOfTest('string');
|
|
|
3569
3562
|
* @param {*} val The value to test
|
|
3570
3563
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
3571
3564
|
*/
|
|
3572
|
-
const isFunction$
|
|
3565
|
+
const isFunction$2 = typeOfTest('function');
|
|
3573
3566
|
|
|
3574
3567
|
/**
|
|
3575
3568
|
* Determine if a value is a Number
|
|
@@ -3613,27 +3606,6 @@ const isPlainObject$1 = (val) => {
|
|
|
3613
3606
|
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
|
|
3614
3607
|
};
|
|
3615
3608
|
|
|
3616
|
-
/**
|
|
3617
|
-
* Determine if a value is an empty object (safely handles Buffers)
|
|
3618
|
-
*
|
|
3619
|
-
* @param {*} val The value to test
|
|
3620
|
-
*
|
|
3621
|
-
* @returns {boolean} True if value is an empty object, otherwise false
|
|
3622
|
-
*/
|
|
3623
|
-
const isEmptyObject$1 = (val) => {
|
|
3624
|
-
// Early return for non-objects or Buffers to prevent RangeError
|
|
3625
|
-
if (!isObject$1(val) || isBuffer(val)) {
|
|
3626
|
-
return false;
|
|
3627
|
-
}
|
|
3628
|
-
|
|
3629
|
-
try {
|
|
3630
|
-
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
3631
|
-
} catch (e) {
|
|
3632
|
-
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
3633
|
-
return false;
|
|
3634
|
-
}
|
|
3635
|
-
};
|
|
3636
|
-
|
|
3637
3609
|
/**
|
|
3638
3610
|
* Determine if a value is a Date
|
|
3639
3611
|
*
|
|
@@ -3677,7 +3649,7 @@ const isFileList = kindOfTest('FileList');
|
|
|
3677
3649
|
*
|
|
3678
3650
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
3679
3651
|
*/
|
|
3680
|
-
const isStream = (val) => isObject$1(val) && isFunction$
|
|
3652
|
+
const isStream = (val) => isObject$1(val) && isFunction$2(val.pipe);
|
|
3681
3653
|
|
|
3682
3654
|
/**
|
|
3683
3655
|
* Determine if a value is a FormData
|
|
@@ -3690,10 +3662,10 @@ const isFormData = (thing) => {
|
|
|
3690
3662
|
let kind;
|
|
3691
3663
|
return thing && (
|
|
3692
3664
|
(typeof FormData === 'function' && thing instanceof FormData) || (
|
|
3693
|
-
isFunction$
|
|
3665
|
+
isFunction$2(thing.append) && (
|
|
3694
3666
|
(kind = kindOf(thing)) === 'formdata' ||
|
|
3695
3667
|
// detect form-data instance
|
|
3696
|
-
(kind === 'object' && isFunction$
|
|
3668
|
+
(kind === 'object' && isFunction$2(thing.toString) && thing.toString() === '[object FormData]')
|
|
3697
3669
|
)
|
|
3698
3670
|
)
|
|
3699
3671
|
)
|
|
@@ -3756,11 +3728,6 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
3756
3728
|
fn.call(null, obj[i], i, obj);
|
|
3757
3729
|
}
|
|
3758
3730
|
} else {
|
|
3759
|
-
// Buffer check
|
|
3760
|
-
if (isBuffer(obj)) {
|
|
3761
|
-
return;
|
|
3762
|
-
}
|
|
3763
|
-
|
|
3764
3731
|
// Iterate over object keys
|
|
3765
3732
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
3766
3733
|
const len = keys.length;
|
|
@@ -3774,10 +3741,6 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
3774
3741
|
}
|
|
3775
3742
|
|
|
3776
3743
|
function findKey(obj, key) {
|
|
3777
|
-
if (isBuffer(obj)){
|
|
3778
|
-
return null;
|
|
3779
|
-
}
|
|
3780
|
-
|
|
3781
3744
|
key = key.toLowerCase();
|
|
3782
3745
|
const keys = Object.keys(obj);
|
|
3783
3746
|
let i = keys.length;
|
|
@@ -3818,7 +3781,7 @@ const isContextDefined = (context) => !isUndefined$1(context) && context !== _gl
|
|
|
3818
3781
|
* @returns {Object} Result of all merge properties
|
|
3819
3782
|
*/
|
|
3820
3783
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
3821
|
-
const {caseless
|
|
3784
|
+
const {caseless} = isContextDefined(this) && this || {};
|
|
3822
3785
|
const result = {};
|
|
3823
3786
|
const assignValue = (val, key) => {
|
|
3824
3787
|
const targetKey = caseless && findKey(result, key) || key;
|
|
@@ -3828,7 +3791,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
3828
3791
|
result[targetKey] = merge({}, val);
|
|
3829
3792
|
} else if (isArray(val)) {
|
|
3830
3793
|
result[targetKey] = val.slice();
|
|
3831
|
-
} else
|
|
3794
|
+
} else {
|
|
3832
3795
|
result[targetKey] = val;
|
|
3833
3796
|
}
|
|
3834
3797
|
};
|
|
@@ -3851,7 +3814,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
3851
3814
|
*/
|
|
3852
3815
|
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
3853
3816
|
forEach(b, (val, key) => {
|
|
3854
|
-
if (thisArg && isFunction$
|
|
3817
|
+
if (thisArg && isFunction$2(val)) {
|
|
3855
3818
|
a[key] = bind(val, thisArg);
|
|
3856
3819
|
} else {
|
|
3857
3820
|
a[key] = val;
|
|
@@ -4067,13 +4030,13 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
4067
4030
|
const freezeMethods = (obj) => {
|
|
4068
4031
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
4069
4032
|
// skip restricted props in strict mode
|
|
4070
|
-
if (isFunction$
|
|
4033
|
+
if (isFunction$2(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
4071
4034
|
return false;
|
|
4072
4035
|
}
|
|
4073
4036
|
|
|
4074
4037
|
const value = obj[name];
|
|
4075
4038
|
|
|
4076
|
-
if (!isFunction$
|
|
4039
|
+
if (!isFunction$2(value)) return;
|
|
4077
4040
|
|
|
4078
4041
|
descriptor.enumerable = false;
|
|
4079
4042
|
|
|
@@ -4110,8 +4073,6 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
4110
4073
|
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
4111
4074
|
};
|
|
4112
4075
|
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
4076
|
/**
|
|
4116
4077
|
* If the thing is a FormData object, return true, otherwise return false.
|
|
4117
4078
|
*
|
|
@@ -4120,7 +4081,7 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
4120
4081
|
* @returns {boolean}
|
|
4121
4082
|
*/
|
|
4122
4083
|
function isSpecCompliantForm(thing) {
|
|
4123
|
-
return !!(thing && isFunction$
|
|
4084
|
+
return !!(thing && isFunction$2(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
4124
4085
|
}
|
|
4125
4086
|
|
|
4126
4087
|
const toJSONObject = (obj) => {
|
|
@@ -4133,11 +4094,6 @@ const toJSONObject = (obj) => {
|
|
|
4133
4094
|
return;
|
|
4134
4095
|
}
|
|
4135
4096
|
|
|
4136
|
-
//Buffer check
|
|
4137
|
-
if (isBuffer(source)) {
|
|
4138
|
-
return source;
|
|
4139
|
-
}
|
|
4140
|
-
|
|
4141
4097
|
if(!('toJSON' in source)) {
|
|
4142
4098
|
stack[i] = source;
|
|
4143
4099
|
const target = isArray(source) ? [] : {};
|
|
@@ -4162,7 +4118,7 @@ const toJSONObject = (obj) => {
|
|
|
4162
4118
|
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
4163
4119
|
|
|
4164
4120
|
const isThenable = (thing) =>
|
|
4165
|
-
thing && (isObject$1(thing) || isFunction$
|
|
4121
|
+
thing && (isObject$1(thing) || isFunction$2(thing)) && isFunction$2(thing.then) && isFunction$2(thing.catch);
|
|
4166
4122
|
|
|
4167
4123
|
// original code
|
|
4168
4124
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
@@ -4186,7 +4142,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
4186
4142
|
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
4187
4143
|
})(
|
|
4188
4144
|
typeof setImmediate === 'function',
|
|
4189
|
-
isFunction$
|
|
4145
|
+
isFunction$2(_global.postMessage)
|
|
4190
4146
|
);
|
|
4191
4147
|
|
|
4192
4148
|
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
@@ -4195,7 +4151,7 @@ const asap = typeof queueMicrotask !== 'undefined' ?
|
|
|
4195
4151
|
// *********************
|
|
4196
4152
|
|
|
4197
4153
|
|
|
4198
|
-
const isIterable = (thing) => thing != null && isFunction$
|
|
4154
|
+
const isIterable = (thing) => thing != null && isFunction$2(thing[iterator]);
|
|
4199
4155
|
|
|
4200
4156
|
|
|
4201
4157
|
var utils$1 = {
|
|
@@ -4209,7 +4165,6 @@ var utils$1 = {
|
|
|
4209
4165
|
isBoolean: isBoolean$1,
|
|
4210
4166
|
isObject: isObject$1,
|
|
4211
4167
|
isPlainObject: isPlainObject$1,
|
|
4212
|
-
isEmptyObject: isEmptyObject$1,
|
|
4213
4168
|
isReadableStream,
|
|
4214
4169
|
isRequest,
|
|
4215
4170
|
isResponse,
|
|
@@ -4219,7 +4174,7 @@ var utils$1 = {
|
|
|
4219
4174
|
isFile,
|
|
4220
4175
|
isBlob,
|
|
4221
4176
|
isRegExp,
|
|
4222
|
-
isFunction: isFunction$
|
|
4177
|
+
isFunction: isFunction$2,
|
|
4223
4178
|
isStream,
|
|
4224
4179
|
isURLSearchParams,
|
|
4225
4180
|
isTypedArray,
|
|
@@ -4345,18 +4300,11 @@ AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
|
|
4345
4300
|
return prop !== 'isAxiosError';
|
|
4346
4301
|
});
|
|
4347
4302
|
|
|
4348
|
-
|
|
4303
|
+
AxiosError$1.call(axiosError, error.message, code, config, request, response);
|
|
4349
4304
|
|
|
4350
|
-
|
|
4351
|
-
const errCode = code == null && error ? error.code : code;
|
|
4352
|
-
AxiosError$1.call(axiosError, msg, errCode, config, request, response);
|
|
4305
|
+
axiosError.cause = error;
|
|
4353
4306
|
|
|
4354
|
-
|
|
4355
|
-
if (error && axiosError.cause == null) {
|
|
4356
|
-
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
4357
|
-
}
|
|
4358
|
-
|
|
4359
|
-
axiosError.name = (error && error.name) || 'Error';
|
|
4307
|
+
axiosError.name = error.name;
|
|
4360
4308
|
|
|
4361
4309
|
customProps && Object.assign(axiosError, customProps);
|
|
4362
4310
|
|
|
@@ -4647,7 +4595,9 @@ function encode(val) {
|
|
|
4647
4595
|
replace(/%3A/gi, ':').
|
|
4648
4596
|
replace(/%24/g, '$').
|
|
4649
4597
|
replace(/%2C/gi, ',').
|
|
4650
|
-
replace(/%20/g, '+')
|
|
4598
|
+
replace(/%20/g, '+').
|
|
4599
|
+
replace(/%5B/gi, '[').
|
|
4600
|
+
replace(/%5D/gi, ']');
|
|
4651
4601
|
}
|
|
4652
4602
|
|
|
4653
4603
|
/**
|
|
@@ -4725,7 +4675,7 @@ class InterceptorManager {
|
|
|
4725
4675
|
*
|
|
4726
4676
|
* @param {Number} id The ID that was returned by `use`
|
|
4727
4677
|
*
|
|
4728
|
-
* @returns {
|
|
4678
|
+
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
4729
4679
|
*/
|
|
4730
4680
|
eject(id) {
|
|
4731
4681
|
if (this.handlers[id]) {
|
|
@@ -4844,7 +4794,7 @@ var platform$1 = {
|
|
|
4844
4794
|
};
|
|
4845
4795
|
|
|
4846
4796
|
function toURLEncodedForm(data, options) {
|
|
4847
|
-
return toFormData$1(data, new platform$1.classes.URLSearchParams(), {
|
|
4797
|
+
return toFormData$1(data, new platform$1.classes.URLSearchParams(), Object.assign({
|
|
4848
4798
|
visitor: function(value, key, path, helpers) {
|
|
4849
4799
|
if (platform$1.isNode && utils$1.isBuffer(value)) {
|
|
4850
4800
|
this.append(key, value.toString('base64'));
|
|
@@ -4852,9 +4802,8 @@ function toURLEncodedForm(data, options) {
|
|
|
4852
4802
|
}
|
|
4853
4803
|
|
|
4854
4804
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
4855
|
-
}
|
|
4856
|
-
|
|
4857
|
-
});
|
|
4805
|
+
}
|
|
4806
|
+
}, options));
|
|
4858
4807
|
}
|
|
4859
4808
|
|
|
4860
4809
|
/**
|
|
@@ -5050,7 +4999,7 @@ const defaults = {
|
|
|
5050
4999
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
5051
5000
|
|
|
5052
5001
|
try {
|
|
5053
|
-
return JSON.parse(data
|
|
5002
|
+
return JSON.parse(data);
|
|
5054
5003
|
} catch (e) {
|
|
5055
5004
|
if (strictJSONParsing) {
|
|
5056
5005
|
if (e.name === 'SyntaxError') {
|
|
@@ -5603,7 +5552,7 @@ function throttle(fn, freq) {
|
|
|
5603
5552
|
clearTimeout(timer);
|
|
5604
5553
|
timer = null;
|
|
5605
5554
|
}
|
|
5606
|
-
fn(
|
|
5555
|
+
fn.apply(null, args);
|
|
5607
5556
|
};
|
|
5608
5557
|
|
|
5609
5558
|
const throttled = (...args) => {
|
|
@@ -5685,38 +5634,27 @@ var cookies = platform$1.hasStandardBrowserEnv ?
|
|
|
5685
5634
|
|
|
5686
5635
|
// Standard browser envs support document.cookie
|
|
5687
5636
|
{
|
|
5688
|
-
write(name, value, expires, path, domain, secure
|
|
5689
|
-
|
|
5637
|
+
write(name, value, expires, path, domain, secure) {
|
|
5638
|
+
const cookie = [name + '=' + encodeURIComponent(value)];
|
|
5690
5639
|
|
|
5691
|
-
|
|
5640
|
+
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
5692
5641
|
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
}
|
|
5699
|
-
if (utils$1.isString(domain)) {
|
|
5700
|
-
cookie.push(`domain=${domain}`);
|
|
5701
|
-
}
|
|
5702
|
-
if (secure === true) {
|
|
5703
|
-
cookie.push('secure');
|
|
5704
|
-
}
|
|
5705
|
-
if (utils$1.isString(sameSite)) {
|
|
5706
|
-
cookie.push(`SameSite=${sameSite}`);
|
|
5707
|
-
}
|
|
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');
|
|
5708
5647
|
|
|
5709
5648
|
document.cookie = cookie.join('; ');
|
|
5710
5649
|
},
|
|
5711
5650
|
|
|
5712
5651
|
read(name) {
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
return match ? decodeURIComponent(match[1]) : null;
|
|
5652
|
+
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
5653
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
|
5716
5654
|
},
|
|
5717
5655
|
|
|
5718
5656
|
remove(name) {
|
|
5719
|
-
this.write(name, '', Date.now() - 86400000
|
|
5657
|
+
this.write(name, '', Date.now() - 86400000);
|
|
5720
5658
|
}
|
|
5721
5659
|
}
|
|
5722
5660
|
|
|
@@ -5805,11 +5743,11 @@ function mergeConfig$1(config1, config2) {
|
|
|
5805
5743
|
}
|
|
5806
5744
|
|
|
5807
5745
|
// eslint-disable-next-line consistent-return
|
|
5808
|
-
function mergeDeepProperties(a, b, prop, caseless) {
|
|
5746
|
+
function mergeDeepProperties(a, b, prop , caseless) {
|
|
5809
5747
|
if (!utils$1.isUndefined(b)) {
|
|
5810
|
-
return getMergedValue(a, b, prop, caseless);
|
|
5748
|
+
return getMergedValue(a, b, prop , caseless);
|
|
5811
5749
|
} else if (!utils$1.isUndefined(a)) {
|
|
5812
|
-
return getMergedValue(undefined, a, prop, caseless);
|
|
5750
|
+
return getMergedValue(undefined, a, prop , caseless);
|
|
5813
5751
|
}
|
|
5814
5752
|
}
|
|
5815
5753
|
|
|
@@ -5867,10 +5805,10 @@ function mergeConfig$1(config1, config2) {
|
|
|
5867
5805
|
socketPath: defaultToConfig2,
|
|
5868
5806
|
responseEncoding: defaultToConfig2,
|
|
5869
5807
|
validateStatus: mergeDirectKeys,
|
|
5870
|
-
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),
|
|
5808
|
+
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
|
5871
5809
|
};
|
|
5872
5810
|
|
|
5873
|
-
utils$1.forEach(Object.keys({
|
|
5811
|
+
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
5874
5812
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
5875
5813
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
5876
5814
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -5882,7 +5820,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
5882
5820
|
var resolveConfig = (config) => {
|
|
5883
5821
|
const newConfig = mergeConfig$1({}, config);
|
|
5884
5822
|
|
|
5885
|
-
let {
|
|
5823
|
+
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
5886
5824
|
|
|
5887
5825
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
5888
5826
|
|
|
@@ -5895,21 +5833,17 @@ var resolveConfig = (config) => {
|
|
|
5895
5833
|
);
|
|
5896
5834
|
}
|
|
5897
5835
|
|
|
5836
|
+
let contentType;
|
|
5837
|
+
|
|
5898
5838
|
if (utils$1.isFormData(data)) {
|
|
5899
5839
|
if (platform$1.hasStandardBrowserEnv || platform$1.hasStandardBrowserWebWorkerEnv) {
|
|
5900
|
-
headers.setContentType(undefined); // browser
|
|
5901
|
-
} else if (
|
|
5902
|
-
//
|
|
5903
|
-
const
|
|
5904
|
-
|
|
5905
|
-
const allowedHeaders = ['content-type', 'content-length'];
|
|
5906
|
-
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
5907
|
-
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
5908
|
-
headers.set(key, val);
|
|
5909
|
-
}
|
|
5910
|
-
});
|
|
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('; '));
|
|
5911
5845
|
}
|
|
5912
|
-
}
|
|
5846
|
+
}
|
|
5913
5847
|
|
|
5914
5848
|
// Add xsrf header
|
|
5915
5849
|
// This is only done if running in a standard browser environment.
|
|
@@ -6026,18 +5960,15 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
6026
5960
|
};
|
|
6027
5961
|
|
|
6028
5962
|
// Handle low level network errors
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
err.event = event || null;
|
|
6037
|
-
reject(err);
|
|
6038
|
-
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;
|
|
6039
5970
|
};
|
|
6040
|
-
|
|
5971
|
+
|
|
6041
5972
|
// Handle timeout
|
|
6042
5973
|
request.ontimeout = function handleTimeout() {
|
|
6043
5974
|
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
@@ -6251,18 +6182,14 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
6251
6182
|
})
|
|
6252
6183
|
};
|
|
6253
6184
|
|
|
6254
|
-
const
|
|
6255
|
-
|
|
6256
|
-
const {isFunction: isFunction$2} = utils$1;
|
|
6257
|
-
|
|
6258
|
-
const globalFetchAPI = (({Request, Response}) => ({
|
|
6259
|
-
Request, Response
|
|
6260
|
-
}))(utils$1.global);
|
|
6261
|
-
|
|
6262
|
-
const {
|
|
6263
|
-
ReadableStream: ReadableStream$1, TextEncoder
|
|
6264
|
-
} = utils$1.global;
|
|
6185
|
+
const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
|
|
6186
|
+
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
|
|
6265
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
|
+
);
|
|
6266
6193
|
|
|
6267
6194
|
const test = (fn, ...args) => {
|
|
6268
6195
|
try {
|
|
@@ -6272,380 +6199,278 @@ const test = (fn, ...args) => {
|
|
|
6272
6199
|
}
|
|
6273
6200
|
};
|
|
6274
6201
|
|
|
6275
|
-
const
|
|
6276
|
-
|
|
6277
|
-
skipUndefined: true
|
|
6278
|
-
}, globalFetchAPI, env);
|
|
6279
|
-
|
|
6280
|
-
const {fetch: envFetch, Request, Response} = env;
|
|
6281
|
-
const isFetchSupported = envFetch ? isFunction$2(envFetch) : typeof fetch === 'function';
|
|
6282
|
-
const isRequestSupported = isFunction$2(Request);
|
|
6283
|
-
const isResponseSupported = isFunction$2(Response);
|
|
6284
|
-
|
|
6285
|
-
if (!isFetchSupported) {
|
|
6286
|
-
return false;
|
|
6287
|
-
}
|
|
6288
|
-
|
|
6289
|
-
const isReadableStreamSupported = isFetchSupported && isFunction$2(ReadableStream$1);
|
|
6290
|
-
|
|
6291
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
6292
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
6293
|
-
async (str) => new Uint8Array(await new Request(str).arrayBuffer())
|
|
6294
|
-
);
|
|
6295
|
-
|
|
6296
|
-
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
6297
|
-
let duplexAccessed = false;
|
|
6202
|
+
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
6203
|
+
let duplexAccessed = false;
|
|
6298
6204
|
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
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');
|
|
6307
6213
|
|
|
6308
|
-
|
|
6309
|
-
|
|
6214
|
+
return duplexAccessed && !hasContentType;
|
|
6215
|
+
});
|
|
6310
6216
|
|
|
6311
|
-
|
|
6312
|
-
test(() => utils$1.isReadableStream(new Response('').body));
|
|
6217
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
6313
6218
|
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
};
|
|
6219
|
+
const supportsResponseStream = isReadableStreamSupported &&
|
|
6220
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
6317
6221
|
|
|
6318
|
-
isFetchSupported && ((() => {
|
|
6319
|
-
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
6320
|
-
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
6321
|
-
let method = res && res[type];
|
|
6322
6222
|
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6223
|
+
const resolvers = {
|
|
6224
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
6225
|
+
};
|
|
6326
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) => {
|
|
6327
6231
|
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
6328
6232
|
});
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
const getBodyLength = async (body) => {
|
|
6333
|
-
if (body == null) {
|
|
6334
|
-
return 0;
|
|
6335
|
-
}
|
|
6336
|
-
|
|
6337
|
-
if (utils$1.isBlob(body)) {
|
|
6338
|
-
return body.size;
|
|
6339
|
-
}
|
|
6340
|
-
|
|
6341
|
-
if (utils$1.isSpecCompliantForm(body)) {
|
|
6342
|
-
const _request = new Request(platform$1.origin, {
|
|
6343
|
-
method: 'POST',
|
|
6344
|
-
body,
|
|
6345
|
-
});
|
|
6346
|
-
return (await _request.arrayBuffer()).byteLength;
|
|
6347
|
-
}
|
|
6348
|
-
|
|
6349
|
-
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
6350
|
-
return body.byteLength;
|
|
6351
|
-
}
|
|
6352
|
-
|
|
6353
|
-
if (utils$1.isURLSearchParams(body)) {
|
|
6354
|
-
body = body + '';
|
|
6355
|
-
}
|
|
6356
|
-
|
|
6357
|
-
if (utils$1.isString(body)) {
|
|
6358
|
-
return (await encodeText(body)).byteLength;
|
|
6359
|
-
}
|
|
6360
|
-
};
|
|
6361
|
-
|
|
6362
|
-
const resolveBodyLength = async (headers, body) => {
|
|
6363
|
-
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
6364
|
-
|
|
6365
|
-
return length == null ? getBodyLength(body) : length;
|
|
6366
|
-
};
|
|
6367
|
-
|
|
6368
|
-
return async (config) => {
|
|
6369
|
-
let {
|
|
6370
|
-
url,
|
|
6371
|
-
method,
|
|
6372
|
-
data,
|
|
6373
|
-
signal,
|
|
6374
|
-
cancelToken,
|
|
6375
|
-
timeout,
|
|
6376
|
-
onDownloadProgress,
|
|
6377
|
-
onUploadProgress,
|
|
6378
|
-
responseType,
|
|
6379
|
-
headers,
|
|
6380
|
-
withCredentials = 'same-origin',
|
|
6381
|
-
fetchOptions
|
|
6382
|
-
} = resolveConfig(config);
|
|
6383
|
-
|
|
6384
|
-
let _fetch = envFetch || fetch;
|
|
6385
|
-
|
|
6386
|
-
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
6233
|
+
});
|
|
6234
|
+
})(new Response));
|
|
6387
6235
|
|
|
6388
|
-
|
|
6236
|
+
const getBodyLength = async (body) => {
|
|
6237
|
+
if (body == null) {
|
|
6238
|
+
return 0;
|
|
6239
|
+
}
|
|
6389
6240
|
|
|
6390
|
-
|
|
6241
|
+
if(utils$1.isBlob(body)) {
|
|
6242
|
+
return body.size;
|
|
6243
|
+
}
|
|
6391
6244
|
|
|
6392
|
-
|
|
6393
|
-
|
|
6245
|
+
if(utils$1.isSpecCompliantForm(body)) {
|
|
6246
|
+
const _request = new Request(platform$1.origin, {
|
|
6247
|
+
method: 'POST',
|
|
6248
|
+
body,
|
|
6394
6249
|
});
|
|
6250
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
6251
|
+
}
|
|
6395
6252
|
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
if (
|
|
6400
|
-
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
6401
|
-
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
6402
|
-
) {
|
|
6403
|
-
let _request = new Request(url, {
|
|
6404
|
-
method: 'POST',
|
|
6405
|
-
body: data,
|
|
6406
|
-
duplex: "half"
|
|
6407
|
-
});
|
|
6253
|
+
if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
6254
|
+
return body.byteLength;
|
|
6255
|
+
}
|
|
6408
6256
|
|
|
6409
|
-
|
|
6257
|
+
if(utils$1.isURLSearchParams(body)) {
|
|
6258
|
+
body = body + '';
|
|
6259
|
+
}
|
|
6410
6260
|
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6261
|
+
if(utils$1.isString(body)) {
|
|
6262
|
+
return (await encodeText(body)).byteLength;
|
|
6263
|
+
}
|
|
6264
|
+
};
|
|
6414
6265
|
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
requestContentLength,
|
|
6418
|
-
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
6419
|
-
);
|
|
6266
|
+
const resolveBodyLength = async (headers, body) => {
|
|
6267
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
6420
6268
|
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
}
|
|
6269
|
+
return length == null ? getBodyLength(body) : length;
|
|
6270
|
+
};
|
|
6424
6271
|
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
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
|
+
});
|
|
6428
6297
|
|
|
6429
|
-
|
|
6430
|
-
// see https://github.com/cloudflare/workerd/issues/902
|
|
6431
|
-
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
6298
|
+
let requestContentLength;
|
|
6432
6299
|
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
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',
|
|
6438
6307
|
body: data,
|
|
6439
|
-
duplex: "half"
|
|
6440
|
-
|
|
6441
|
-
};
|
|
6442
|
-
|
|
6443
|
-
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
6308
|
+
duplex: "half"
|
|
6309
|
+
});
|
|
6444
6310
|
|
|
6445
|
-
let
|
|
6311
|
+
let contentTypeHeader;
|
|
6446
6312
|
|
|
6447
|
-
|
|
6313
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
6314
|
+
headers.setContentType(contentTypeHeader);
|
|
6315
|
+
}
|
|
6448
6316
|
|
|
6449
|
-
if (
|
|
6450
|
-
const
|
|
6317
|
+
if (_request.body) {
|
|
6318
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
6319
|
+
requestContentLength,
|
|
6320
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
6321
|
+
);
|
|
6451
6322
|
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6323
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
6324
|
+
}
|
|
6325
|
+
}
|
|
6455
6326
|
|
|
6456
|
-
|
|
6327
|
+
if (!utils$1.isString(withCredentials)) {
|
|
6328
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
6329
|
+
}
|
|
6457
6330
|
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
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
|
+
});
|
|
6462
6343
|
|
|
6463
|
-
|
|
6464
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
6465
|
-
flush && flush();
|
|
6466
|
-
unsubscribe && unsubscribe();
|
|
6467
|
-
}),
|
|
6468
|
-
options
|
|
6469
|
-
);
|
|
6470
|
-
}
|
|
6344
|
+
let response = await fetch(request, fetchOptions);
|
|
6471
6345
|
|
|
6472
|
-
|
|
6346
|
+
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
6473
6347
|
|
|
6474
|
-
|
|
6348
|
+
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
6349
|
+
const options = {};
|
|
6475
6350
|
|
|
6476
|
-
|
|
6351
|
+
['status', 'statusText', 'headers'].forEach(prop => {
|
|
6352
|
+
options[prop] = response[prop];
|
|
6353
|
+
});
|
|
6477
6354
|
|
|
6478
|
-
|
|
6479
|
-
settle(resolve, reject, {
|
|
6480
|
-
data: responseData,
|
|
6481
|
-
headers: AxiosHeaders$1.from(response.headers),
|
|
6482
|
-
status: response.status,
|
|
6483
|
-
statusText: response.statusText,
|
|
6484
|
-
config,
|
|
6485
|
-
request
|
|
6486
|
-
});
|
|
6487
|
-
})
|
|
6488
|
-
} catch (err) {
|
|
6489
|
-
unsubscribe && unsubscribe();
|
|
6355
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
6490
6356
|
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
cause: err.cause || err
|
|
6496
|
-
}
|
|
6497
|
-
)
|
|
6498
|
-
}
|
|
6357
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
6358
|
+
responseContentLength,
|
|
6359
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
6360
|
+
) || [];
|
|
6499
6361
|
|
|
6500
|
-
|
|
6362
|
+
response = new Response(
|
|
6363
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
6364
|
+
flush && flush();
|
|
6365
|
+
unsubscribe && unsubscribe();
|
|
6366
|
+
}),
|
|
6367
|
+
options
|
|
6368
|
+
);
|
|
6501
6369
|
}
|
|
6502
|
-
}
|
|
6503
|
-
};
|
|
6504
6370
|
|
|
6505
|
-
|
|
6371
|
+
responseType = responseType || 'text';
|
|
6506
6372
|
|
|
6507
|
-
|
|
6508
|
-
let env = (config && config.env) || {};
|
|
6509
|
-
const {fetch, Request, Response} = env;
|
|
6510
|
-
const seeds = [
|
|
6511
|
-
Request, Response, fetch
|
|
6512
|
-
];
|
|
6373
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
6513
6374
|
|
|
6514
|
-
|
|
6515
|
-
seed, target, map = seedCache;
|
|
6375
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
6516
6376
|
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
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();
|
|
6520
6389
|
|
|
6521
|
-
|
|
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
|
+
}
|
|
6522
6398
|
|
|
6523
|
-
|
|
6399
|
+
throw AxiosError$1.from(err, err && err.code, config, request);
|
|
6524
6400
|
}
|
|
6401
|
+
});
|
|
6525
6402
|
|
|
6526
|
-
return target;
|
|
6527
|
-
};
|
|
6528
|
-
|
|
6529
|
-
getFetch();
|
|
6530
|
-
|
|
6531
|
-
/**
|
|
6532
|
-
* Known adapters mapping.
|
|
6533
|
-
* Provides environment-specific adapters for Axios:
|
|
6534
|
-
* - `http` for Node.js
|
|
6535
|
-
* - `xhr` for browsers
|
|
6536
|
-
* - `fetch` for fetch API-based requests
|
|
6537
|
-
*
|
|
6538
|
-
* @type {Object<string, Function|Object>}
|
|
6539
|
-
*/
|
|
6540
6403
|
const knownAdapters = {
|
|
6541
6404
|
http: httpAdapter,
|
|
6542
6405
|
xhr: xhrAdapter,
|
|
6543
|
-
fetch:
|
|
6544
|
-
get: getFetch,
|
|
6545
|
-
}
|
|
6406
|
+
fetch: fetchAdapter
|
|
6546
6407
|
};
|
|
6547
6408
|
|
|
6548
|
-
// Assign adapter names for easier debugging and identification
|
|
6549
6409
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
6550
6410
|
if (fn) {
|
|
6551
6411
|
try {
|
|
6552
|
-
Object.defineProperty(fn, 'name', {
|
|
6412
|
+
Object.defineProperty(fn, 'name', {value});
|
|
6553
6413
|
} catch (e) {
|
|
6554
6414
|
// eslint-disable-next-line no-empty
|
|
6555
6415
|
}
|
|
6556
|
-
Object.defineProperty(fn, 'adapterName', {
|
|
6416
|
+
Object.defineProperty(fn, 'adapterName', {value});
|
|
6557
6417
|
}
|
|
6558
6418
|
});
|
|
6559
6419
|
|
|
6560
|
-
/**
|
|
6561
|
-
* Render a rejection reason string for unknown or unsupported adapters
|
|
6562
|
-
*
|
|
6563
|
-
* @param {string} reason
|
|
6564
|
-
* @returns {string}
|
|
6565
|
-
*/
|
|
6566
6420
|
const renderReason = (reason) => `- ${reason}`;
|
|
6567
6421
|
|
|
6568
|
-
/**
|
|
6569
|
-
* Check if the adapter is resolved (function, null, or false)
|
|
6570
|
-
*
|
|
6571
|
-
* @param {Function|null|false} adapter
|
|
6572
|
-
* @returns {boolean}
|
|
6573
|
-
*/
|
|
6574
6422
|
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
6575
6423
|
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
* Throws an AxiosError if no adapter is suitable.
|
|
6580
|
-
*
|
|
6581
|
-
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
6582
|
-
* @param {Object} config - Axios request configuration
|
|
6583
|
-
* @throws {AxiosError} If no suitable adapter is available
|
|
6584
|
-
* @returns {Function} The resolved adapter function
|
|
6585
|
-
*/
|
|
6586
|
-
function getAdapter$1(adapters, config) {
|
|
6587
|
-
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
6424
|
+
var adapters = {
|
|
6425
|
+
getAdapter: (adapters) => {
|
|
6426
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
6588
6427
|
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6428
|
+
const {length} = adapters;
|
|
6429
|
+
let nameOrAdapter;
|
|
6430
|
+
let adapter;
|
|
6592
6431
|
|
|
6593
|
-
|
|
6432
|
+
const rejectedReasons = {};
|
|
6594
6433
|
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6434
|
+
for (let i = 0; i < length; i++) {
|
|
6435
|
+
nameOrAdapter = adapters[i];
|
|
6436
|
+
let id;
|
|
6598
6437
|
|
|
6599
|
-
|
|
6438
|
+
adapter = nameOrAdapter;
|
|
6600
6439
|
|
|
6601
|
-
|
|
6602
|
-
|
|
6440
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
6441
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
6603
6442
|
|
|
6604
|
-
|
|
6605
|
-
|
|
6443
|
+
if (adapter === undefined) {
|
|
6444
|
+
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
6445
|
+
}
|
|
6606
6446
|
}
|
|
6607
|
-
}
|
|
6608
|
-
|
|
6609
|
-
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
6610
|
-
break;
|
|
6611
|
-
}
|
|
6612
6447
|
|
|
6613
|
-
|
|
6614
|
-
|
|
6448
|
+
if (adapter) {
|
|
6449
|
+
break;
|
|
6450
|
+
}
|
|
6615
6451
|
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
.map(([id, state]) => `adapter ${id} ` +
|
|
6619
|
-
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
6620
|
-
);
|
|
6452
|
+
rejectedReasons[id || '#' + i] = adapter;
|
|
6453
|
+
}
|
|
6621
6454
|
|
|
6622
|
-
|
|
6623
|
-
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
6624
|
-
'as no adapter specified';
|
|
6455
|
+
if (!adapter) {
|
|
6625
6456
|
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
}
|
|
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
|
+
);
|
|
6631
6461
|
|
|
6632
|
-
|
|
6633
|
-
|
|
6462
|
+
let s = length ?
|
|
6463
|
+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
6464
|
+
'as no adapter specified';
|
|
6634
6465
|
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
* Resolve an adapter from a list of adapter names or functions.
|
|
6641
|
-
* @type {Function}
|
|
6642
|
-
*/
|
|
6643
|
-
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
|
+
}
|
|
6644
6471
|
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
* @type {Object<string, Function|Object>}
|
|
6648
|
-
*/
|
|
6472
|
+
return adapter;
|
|
6473
|
+
},
|
|
6649
6474
|
adapters: knownAdapters
|
|
6650
6475
|
};
|
|
6651
6476
|
|
|
@@ -6688,7 +6513,7 @@ function dispatchRequest(config) {
|
|
|
6688
6513
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
6689
6514
|
}
|
|
6690
6515
|
|
|
6691
|
-
const adapter = adapters.getAdapter(config.adapter || defaults.adapter
|
|
6516
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
|
|
6692
6517
|
|
|
6693
6518
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
6694
6519
|
throwIfCancellationRequested(config);
|
|
@@ -6722,7 +6547,7 @@ function dispatchRequest(config) {
|
|
|
6722
6547
|
});
|
|
6723
6548
|
}
|
|
6724
6549
|
|
|
6725
|
-
const VERSION$1 = "1.
|
|
6550
|
+
const VERSION$1 = "1.10.0";
|
|
6726
6551
|
|
|
6727
6552
|
const validators$1 = {};
|
|
6728
6553
|
|
|
@@ -6961,8 +6786,8 @@ let Axios$1 = class Axios {
|
|
|
6961
6786
|
|
|
6962
6787
|
if (!synchronousRequestInterceptors) {
|
|
6963
6788
|
const chain = [dispatchRequest.bind(this), undefined];
|
|
6964
|
-
chain.unshift(
|
|
6965
|
-
chain.push(
|
|
6789
|
+
chain.unshift.apply(chain, requestInterceptorChain);
|
|
6790
|
+
chain.push.apply(chain, responseInterceptorChain);
|
|
6966
6791
|
len = chain.length;
|
|
6967
6792
|
|
|
6968
6793
|
promise = Promise.resolve(config);
|
|
@@ -6978,6 +6803,8 @@ let Axios$1 = class Axios {
|
|
|
6978
6803
|
|
|
6979
6804
|
let newConfig = config;
|
|
6980
6805
|
|
|
6806
|
+
i = 0;
|
|
6807
|
+
|
|
6981
6808
|
while (i < len) {
|
|
6982
6809
|
const onFulfilled = requestInterceptorChain[i++];
|
|
6983
6810
|
const onRejected = requestInterceptorChain[i++];
|
|
@@ -7277,12 +7104,6 @@ const HttpStatusCode$1 = {
|
|
|
7277
7104
|
LoopDetected: 508,
|
|
7278
7105
|
NotExtended: 510,
|
|
7279
7106
|
NetworkAuthenticationRequired: 511,
|
|
7280
|
-
WebServerIsDown: 521,
|
|
7281
|
-
ConnectionTimedOut: 522,
|
|
7282
|
-
OriginIsUnreachable: 523,
|
|
7283
|
-
TimeoutOccurred: 524,
|
|
7284
|
-
SslHandshakeFailed: 525,
|
|
7285
|
-
InvalidSslCertificate: 526,
|
|
7286
7107
|
};
|
|
7287
7108
|
|
|
7288
7109
|
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
@@ -7622,9 +7443,8 @@ class ZodError extends Error {
|
|
|
7622
7443
|
const formErrors = [];
|
|
7623
7444
|
for (const sub of this.issues) {
|
|
7624
7445
|
if (sub.path.length > 0) {
|
|
7625
|
-
|
|
7626
|
-
fieldErrors[
|
|
7627
|
-
fieldErrors[firstEl].push(mapper(sub));
|
|
7446
|
+
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
7447
|
+
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
7628
7448
|
}
|
|
7629
7449
|
else {
|
|
7630
7450
|
formErrors.push(mapper(sub));
|
|
@@ -7708,8 +7528,6 @@ const errorMap = (issue, _ctx) => {
|
|
|
7708
7528
|
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
7709
7529
|
else if (issue.type === "number")
|
|
7710
7530
|
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
7711
|
-
else if (issue.type === "bigint")
|
|
7712
|
-
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
7713
7531
|
else if (issue.type === "date")
|
|
7714
7532
|
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
|
7715
7533
|
else
|
|
@@ -8307,8 +8125,6 @@ function isValidJWT(jwt, alg) {
|
|
|
8307
8125
|
return false;
|
|
8308
8126
|
try {
|
|
8309
8127
|
const [header] = jwt.split(".");
|
|
8310
|
-
if (!header)
|
|
8311
|
-
return false;
|
|
8312
8128
|
// Convert base64url to base64
|
|
8313
8129
|
const base64 = header
|
|
8314
8130
|
.replace(/-/g, "+")
|
|
@@ -12273,41 +12089,29 @@ var createApiClient = (apiKey, proxy) => {
|
|
|
12273
12089
|
baseURL: proxy ?? API_BASE_URL,
|
|
12274
12090
|
headers: {
|
|
12275
12091
|
"Content-Type": "application/json",
|
|
12276
|
-
Authorization: `Bearer ${apiKey}
|
|
12277
|
-
"Access-Control-Allow-Origin": "*",
|
|
12278
|
-
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
|
|
12279
|
-
"Access-Control-Allow-Headers": "Content-Type, Authorization"
|
|
12092
|
+
Authorization: `Bearer ${apiKey}`
|
|
12280
12093
|
}
|
|
12281
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
|
+
}
|
|
12282
12104
|
client.interceptors.response.use(
|
|
12283
12105
|
(response) => response.data,
|
|
12284
12106
|
(error) => {
|
|
12285
12107
|
const apiError = {
|
|
12286
12108
|
isError: true,
|
|
12287
|
-
status: 500,
|
|
12288
|
-
message:
|
|
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
|
|
12289
12113
|
};
|
|
12290
|
-
|
|
12291
|
-
apiError.status = error.response.status;
|
|
12292
|
-
apiError.message = error.response.data?.error || "Server error occurred";
|
|
12293
|
-
apiError.code = error.response.data?.code;
|
|
12294
|
-
apiError.details = error.response.data;
|
|
12295
|
-
} else if (error.request) {
|
|
12296
|
-
apiError.status = 503;
|
|
12297
|
-
apiError.message = "Service unavailable - no response from server";
|
|
12298
|
-
apiError.code = "SERVICE_UNAVAILABLE";
|
|
12299
|
-
apiError.details = error;
|
|
12300
|
-
} else {
|
|
12301
|
-
apiError.status = 500;
|
|
12302
|
-
apiError.message = "Request configuration error";
|
|
12303
|
-
apiError.code = "REQUEST_SETUP_ERROR";
|
|
12304
|
-
apiError.details = error;
|
|
12305
|
-
}
|
|
12306
|
-
console.error("API ERROR: ", apiError);
|
|
12307
|
-
if (apiError.code === "REQUEST_SETUP_ERROR" || apiError.code === "SERVICE_UNAVAILABLE") {
|
|
12308
|
-
throw apiError;
|
|
12309
|
-
}
|
|
12310
|
-
return apiError;
|
|
12114
|
+
throw apiError;
|
|
12311
12115
|
}
|
|
12312
12116
|
);
|
|
12313
12117
|
return client;
|
|
@@ -12338,9 +12142,9 @@ var Client = class {
|
|
|
12338
12142
|
*/
|
|
12339
12143
|
async updateCheckout(clientSecret, checkoutId, params) {
|
|
12340
12144
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
12341
|
-
const data = await apiClient.
|
|
12342
|
-
`/checkout/${checkoutId}`,
|
|
12343
|
-
params
|
|
12145
|
+
const data = await apiClient.post(
|
|
12146
|
+
`/checkout/${checkoutId}/update`,
|
|
12147
|
+
{ ...params }
|
|
12344
12148
|
);
|
|
12345
12149
|
if ("isError" in data && data.isError || !data || !("id" in data)) {
|
|
12346
12150
|
console.error(`Checkout session with id ${checkoutId} not found`);
|
|
@@ -13163,7 +12967,6 @@ const Toast = (props)=>{
|
|
|
13163
12967
|
"data-swipe-out": swipeOut,
|
|
13164
12968
|
"data-swipe-direction": swipeOutDirection,
|
|
13165
12969
|
"data-expanded": Boolean(expanded || expandByDefault && mounted),
|
|
13166
|
-
"data-testid": toast.testId,
|
|
13167
12970
|
style: {
|
|
13168
12971
|
'--index': index,
|
|
13169
12972
|
'--toasts-before': index,
|
|
@@ -13179,7 +12982,6 @@ const Toast = (props)=>{
|
|
|
13179
12982
|
pointerStartRef.current = null;
|
|
13180
12983
|
},
|
|
13181
12984
|
onPointerDown: (event)=>{
|
|
13182
|
-
if (event.button === 2) return; // Return early on right click
|
|
13183
12985
|
if (disabled || !dismissible) return;
|
|
13184
12986
|
dragStartTime.current = new Date();
|
|
13185
12987
|
setOffsetBeforeRemove(offset.current);
|
|
@@ -13372,26 +13174,17 @@ function assignOffset(defaultOffset, mobileOffset) {
|
|
|
13372
13174
|
return styles;
|
|
13373
13175
|
}
|
|
13374
13176
|
const Toaster$1 = /*#__PURE__*/ React__default.forwardRef(function Toaster(props, ref) {
|
|
13375
|
-
const {
|
|
13177
|
+
const { invert, position = 'bottom-right', hotkey = [
|
|
13376
13178
|
'altKey',
|
|
13377
13179
|
'KeyT'
|
|
13378
13180
|
], expand, closeButton, className, offset, mobileOffset, theme = 'light', richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = 'Notifications' } = props;
|
|
13379
13181
|
const [toasts, setToasts] = React__default.useState([]);
|
|
13380
|
-
const filteredToasts = React__default.useMemo(()=>{
|
|
13381
|
-
if (id) {
|
|
13382
|
-
return toasts.filter((toast)=>toast.toasterId === id);
|
|
13383
|
-
}
|
|
13384
|
-
return toasts.filter((toast)=>!toast.toasterId);
|
|
13385
|
-
}, [
|
|
13386
|
-
toasts,
|
|
13387
|
-
id
|
|
13388
|
-
]);
|
|
13389
13182
|
const possiblePositions = React__default.useMemo(()=>{
|
|
13390
13183
|
return Array.from(new Set([
|
|
13391
13184
|
position
|
|
13392
|
-
].concat(
|
|
13185
|
+
].concat(toasts.filter((toast)=>toast.position).map((toast)=>toast.position))));
|
|
13393
13186
|
}, [
|
|
13394
|
-
|
|
13187
|
+
toasts,
|
|
13395
13188
|
position
|
|
13396
13189
|
]);
|
|
13397
13190
|
const [heights, setHeights] = React__default.useState([]);
|
|
@@ -13546,7 +13339,7 @@ const Toaster$1 = /*#__PURE__*/ React__default.forwardRef(function Toaster(props
|
|
|
13546
13339
|
}, possiblePositions.map((position, index)=>{
|
|
13547
13340
|
var _heights_;
|
|
13548
13341
|
const [y, x] = position.split('-');
|
|
13549
|
-
if (!
|
|
13342
|
+
if (!toasts.length) return null;
|
|
13550
13343
|
return /*#__PURE__*/ React__default.createElement("ol", {
|
|
13551
13344
|
key: position,
|
|
13552
13345
|
dir: dir === 'auto' ? getDocumentDirection() : dir,
|
|
@@ -13598,7 +13391,7 @@ const Toaster$1 = /*#__PURE__*/ React__default.forwardRef(function Toaster(props
|
|
|
13598
13391
|
setInteracting(true);
|
|
13599
13392
|
},
|
|
13600
13393
|
onPointerUp: ()=>setInteracting(false)
|
|
13601
|
-
},
|
|
13394
|
+
}, toasts.filter((toast)=>!toast.position && index === 0 || toast.position === position).map((toast, index)=>{
|
|
13602
13395
|
var _toastOptions_duration, _toastOptions_closeButton;
|
|
13603
13396
|
return /*#__PURE__*/ React__default.createElement(Toast, {
|
|
13604
13397
|
key: toast.id,
|
|
@@ -13621,7 +13414,7 @@ const Toaster$1 = /*#__PURE__*/ React__default.forwardRef(function Toaster(props
|
|
|
13621
13414
|
actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
|
|
13622
13415
|
closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
|
|
13623
13416
|
removeToast: removeToast,
|
|
13624
|
-
toasts:
|
|
13417
|
+
toasts: toasts.filter((t)=>t.position == toast.position),
|
|
13625
13418
|
heights: heights.filter((h)=>h.position == toast.position),
|
|
13626
13419
|
setHeights: setHeights,
|
|
13627
13420
|
expandByDefault: expand,
|
|
@@ -13726,24 +13519,13 @@ function useComposedRefs(...refs) {
|
|
|
13726
13519
|
}
|
|
13727
13520
|
|
|
13728
13521
|
// src/slot.tsx
|
|
13729
|
-
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
13730
|
-
var use = React[" use ".trim().toString()];
|
|
13731
|
-
function isPromiseLike(value) {
|
|
13732
|
-
return typeof value === "object" && value !== null && "then" in value;
|
|
13733
|
-
}
|
|
13734
|
-
function isLazyComponent(element) {
|
|
13735
|
-
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
13736
|
-
}
|
|
13737
13522
|
// @__NO_SIDE_EFFECTS__
|
|
13738
|
-
function createSlot
|
|
13739
|
-
const SlotClone = /* @__PURE__ */ createSlotClone
|
|
13523
|
+
function createSlot(ownerName) {
|
|
13524
|
+
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
13740
13525
|
const Slot2 = React.forwardRef((props, forwardedRef) => {
|
|
13741
|
-
|
|
13742
|
-
if (isLazyComponent(children) && typeof use === "function") {
|
|
13743
|
-
children = use(children._payload);
|
|
13744
|
-
}
|
|
13526
|
+
const { children, ...slotProps } = props;
|
|
13745
13527
|
const childrenArray = React.Children.toArray(children);
|
|
13746
|
-
const slottable = childrenArray.find(isSlottable
|
|
13528
|
+
const slottable = childrenArray.find(isSlottable);
|
|
13747
13529
|
if (slottable) {
|
|
13748
13530
|
const newElement = slottable.props.children;
|
|
13749
13531
|
const newChildren = childrenArray.map((child) => {
|
|
@@ -13761,17 +13543,14 @@ function createSlot$1(ownerName) {
|
|
|
13761
13543
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
13762
13544
|
return Slot2;
|
|
13763
13545
|
}
|
|
13764
|
-
var Slot$2 = /* @__PURE__ */ createSlot
|
|
13546
|
+
var Slot$2 = /* @__PURE__ */ createSlot("Slot");
|
|
13765
13547
|
// @__NO_SIDE_EFFECTS__
|
|
13766
|
-
function createSlotClone
|
|
13548
|
+
function createSlotClone(ownerName) {
|
|
13767
13549
|
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
13768
|
-
|
|
13769
|
-
if (isLazyComponent(children) && typeof use === "function") {
|
|
13770
|
-
children = use(children._payload);
|
|
13771
|
-
}
|
|
13550
|
+
const { children, ...slotProps } = props;
|
|
13772
13551
|
if (React.isValidElement(children)) {
|
|
13773
|
-
const childrenRef = getElementRef$
|
|
13774
|
-
const props2 = mergeProps
|
|
13552
|
+
const childrenRef = getElementRef$1(children);
|
|
13553
|
+
const props2 = mergeProps(slotProps, children.props);
|
|
13775
13554
|
if (children.type !== React.Fragment) {
|
|
13776
13555
|
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
13777
13556
|
}
|
|
@@ -13782,11 +13561,11 @@ function createSlotClone$1(ownerName) {
|
|
|
13782
13561
|
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
13783
13562
|
return SlotClone;
|
|
13784
13563
|
}
|
|
13785
|
-
var SLOTTABLE_IDENTIFIER
|
|
13786
|
-
function isSlottable
|
|
13787
|
-
return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER
|
|
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;
|
|
13788
13567
|
}
|
|
13789
|
-
function mergeProps
|
|
13568
|
+
function mergeProps(slotProps, childProps) {
|
|
13790
13569
|
const overrideProps = { ...childProps };
|
|
13791
13570
|
for (const propName in childProps) {
|
|
13792
13571
|
const slotPropValue = slotProps[propName];
|
|
@@ -13810,7 +13589,7 @@ function mergeProps$1(slotProps, childProps) {
|
|
|
13810
13589
|
}
|
|
13811
13590
|
return { ...slotProps, ...overrideProps };
|
|
13812
13591
|
}
|
|
13813
|
-
function getElementRef$
|
|
13592
|
+
function getElementRef$1(element) {
|
|
13814
13593
|
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
13815
13594
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
13816
13595
|
if (mayWarn) {
|
|
@@ -13862,9 +13641,12 @@ function cloneObject(data) {
|
|
|
13862
13641
|
if (data instanceof Date) {
|
|
13863
13642
|
copy = new Date(data);
|
|
13864
13643
|
}
|
|
13644
|
+
else if (data instanceof Set) {
|
|
13645
|
+
copy = new Set(data);
|
|
13646
|
+
}
|
|
13865
13647
|
else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&
|
|
13866
13648
|
(isArray || isObject(data))) {
|
|
13867
|
-
copy = isArray ? [] :
|
|
13649
|
+
copy = isArray ? [] : {};
|
|
13868
13650
|
if (!isArray && !isPlainObject(data)) {
|
|
13869
13651
|
copy = data;
|
|
13870
13652
|
}
|
|
@@ -13985,7 +13767,7 @@ HookFormContext.displayName = 'HookFormContext';
|
|
|
13985
13767
|
*/
|
|
13986
13768
|
const useFormContext = () => React__default.useContext(HookFormContext);
|
|
13987
13769
|
/**
|
|
13988
|
-
* A provider component that propagates the `useForm` methods to all children components via [React Context](https://
|
|
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}.
|
|
13989
13771
|
*
|
|
13990
13772
|
* @remarks
|
|
13991
13773
|
* [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
|
|
@@ -14038,7 +13820,7 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
14038
13820
|
return result;
|
|
14039
13821
|
};
|
|
14040
13822
|
|
|
14041
|
-
const useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ?
|
|
13823
|
+
const useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
14042
13824
|
|
|
14043
13825
|
/**
|
|
14044
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.
|
|
@@ -14110,51 +13892,12 @@ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) =>
|
|
|
14110
13892
|
return get(formValues, names, defaultValue);
|
|
14111
13893
|
}
|
|
14112
13894
|
if (Array.isArray(names)) {
|
|
14113
|
-
return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName),
|
|
14114
|
-
get(formValues, fieldName)));
|
|
13895
|
+
return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName), get(formValues, fieldName)));
|
|
14115
13896
|
}
|
|
14116
13897
|
isGlobal && (_names.watchAll = true);
|
|
14117
13898
|
return formValues;
|
|
14118
13899
|
};
|
|
14119
13900
|
|
|
14120
|
-
var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
|
|
14121
|
-
|
|
14122
|
-
function deepEqual$1(object1, object2, _internal_visited = new WeakSet()) {
|
|
14123
|
-
if (isPrimitive(object1) || isPrimitive(object2)) {
|
|
14124
|
-
return Object.is(object1, object2);
|
|
14125
|
-
}
|
|
14126
|
-
if (isDateObject(object1) && isDateObject(object2)) {
|
|
14127
|
-
return object1.getTime() === object2.getTime();
|
|
14128
|
-
}
|
|
14129
|
-
const keys1 = Object.keys(object1);
|
|
14130
|
-
const keys2 = Object.keys(object2);
|
|
14131
|
-
if (keys1.length !== keys2.length) {
|
|
14132
|
-
return false;
|
|
14133
|
-
}
|
|
14134
|
-
if (_internal_visited.has(object1) || _internal_visited.has(object2)) {
|
|
14135
|
-
return true;
|
|
14136
|
-
}
|
|
14137
|
-
_internal_visited.add(object1);
|
|
14138
|
-
_internal_visited.add(object2);
|
|
14139
|
-
for (const key of keys1) {
|
|
14140
|
-
const val1 = object1[key];
|
|
14141
|
-
if (!keys2.includes(key)) {
|
|
14142
|
-
return false;
|
|
14143
|
-
}
|
|
14144
|
-
if (key !== 'ref') {
|
|
14145
|
-
const val2 = object2[key];
|
|
14146
|
-
if ((isDateObject(val1) && isDateObject(val2)) ||
|
|
14147
|
-
(isObject(val1) && isObject(val2)) ||
|
|
14148
|
-
(Array.isArray(val1) && Array.isArray(val2))
|
|
14149
|
-
? !deepEqual$1(val1, val2, _internal_visited)
|
|
14150
|
-
: !Object.is(val1, val2)) {
|
|
14151
|
-
return false;
|
|
14152
|
-
}
|
|
14153
|
-
}
|
|
14154
|
-
}
|
|
14155
|
-
return true;
|
|
14156
|
-
}
|
|
14157
|
-
|
|
14158
13901
|
/**
|
|
14159
13902
|
* Custom hook to subscribe to field change and isolate re-rendering at the component level.
|
|
14160
13903
|
*
|
|
@@ -14173,72 +13916,20 @@ function deepEqual$1(object1, object2, _internal_visited = new WeakSet()) {
|
|
|
14173
13916
|
*/
|
|
14174
13917
|
function useWatch(props) {
|
|
14175
13918
|
const methods = useFormContext();
|
|
14176
|
-
const { control = methods.control, name, defaultValue, disabled, exact,
|
|
13919
|
+
const { control = methods.control, name, defaultValue, disabled, exact, } = props || {};
|
|
14177
13920
|
const _defaultValue = React__default.useRef(defaultValue);
|
|
14178
|
-
const
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
|
|
14182
|
-
|
|
14183
|
-
|
|
14184
|
-
|
|
14185
|
-
|
|
14186
|
-
|
|
14187
|
-
|
|
14188
|
-
const formValues = generateWatchOutput(name, control._names, values || control._formValues, false, _defaultValue.current);
|
|
14189
|
-
return _compute.current ? _compute.current(formValues) : formValues;
|
|
14190
|
-
}, [control._formValues, control._names, name]);
|
|
14191
|
-
const refreshValue = React__default.useCallback((values) => {
|
|
14192
|
-
if (!disabled) {
|
|
14193
|
-
const formValues = generateWatchOutput(name, control._names, values || control._formValues, false, _defaultValue.current);
|
|
14194
|
-
if (_compute.current) {
|
|
14195
|
-
const computedFormValues = _compute.current(formValues);
|
|
14196
|
-
if (!deepEqual$1(computedFormValues, _computeFormValues.current)) {
|
|
14197
|
-
updateValue(computedFormValues);
|
|
14198
|
-
_computeFormValues.current = computedFormValues;
|
|
14199
|
-
}
|
|
14200
|
-
}
|
|
14201
|
-
else {
|
|
14202
|
-
updateValue(formValues);
|
|
14203
|
-
}
|
|
14204
|
-
}
|
|
14205
|
-
}, [control._formValues, control._names, disabled, name]);
|
|
14206
|
-
useIsomorphicLayoutEffect$1(() => {
|
|
14207
|
-
if (_prevControl.current !== control ||
|
|
14208
|
-
!deepEqual$1(_prevName.current, name)) {
|
|
14209
|
-
_prevControl.current = control;
|
|
14210
|
-
_prevName.current = name;
|
|
14211
|
-
refreshValue();
|
|
14212
|
-
}
|
|
14213
|
-
return control._subscribe({
|
|
14214
|
-
name,
|
|
14215
|
-
formState: {
|
|
14216
|
-
values: true,
|
|
14217
|
-
},
|
|
14218
|
-
exact,
|
|
14219
|
-
callback: (formState) => {
|
|
14220
|
-
refreshValue(formState.values);
|
|
14221
|
-
},
|
|
14222
|
-
});
|
|
14223
|
-
}, [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]);
|
|
14224
13931
|
React__default.useEffect(() => control._removeUnmounted());
|
|
14225
|
-
|
|
14226
|
-
// latest value so callers (like useController) see the correct value
|
|
14227
|
-
// immediately on the same render.
|
|
14228
|
-
// Optimize: Check control reference first before expensive deepEqual
|
|
14229
|
-
const controlChanged = _prevControl.current !== control;
|
|
14230
|
-
const prevName = _prevName.current;
|
|
14231
|
-
// Cache the computed output to avoid duplicate calls within the same render
|
|
14232
|
-
// We include shouldReturnImmediate in deps to ensure proper recomputation
|
|
14233
|
-
const computedOutput = React__default.useMemo(() => {
|
|
14234
|
-
if (disabled) {
|
|
14235
|
-
return null;
|
|
14236
|
-
}
|
|
14237
|
-
const nameChanged = !controlChanged && !deepEqual$1(prevName, name);
|
|
14238
|
-
const shouldReturnImmediate = controlChanged || nameChanged;
|
|
14239
|
-
return shouldReturnImmediate ? getCurrentOutput() : null;
|
|
14240
|
-
}, [disabled, controlChanged, name, prevName, getCurrentOutput]);
|
|
14241
|
-
return computedOutput !== null ? computedOutput : value;
|
|
13932
|
+
return value;
|
|
14242
13933
|
}
|
|
14243
13934
|
|
|
14244
13935
|
/**
|
|
@@ -14267,13 +13958,12 @@ function useWatch(props) {
|
|
|
14267
13958
|
*/
|
|
14268
13959
|
function useController(props) {
|
|
14269
13960
|
const methods = useFormContext();
|
|
14270
|
-
const { name, disabled, control = methods.control, shouldUnregister
|
|
13961
|
+
const { name, disabled, control = methods.control, shouldUnregister } = props;
|
|
14271
13962
|
const isArrayField = isNameInFieldArray(control._names.array, name);
|
|
14272
|
-
const defaultValueMemo = React__default.useMemo(() => get(control._formValues, name, get(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
|
|
14273
13963
|
const value = useWatch({
|
|
14274
13964
|
control,
|
|
14275
13965
|
name,
|
|
14276
|
-
defaultValue:
|
|
13966
|
+
defaultValue: get(control._formValues, name, get(control._defaultValues, name, props.defaultValue)),
|
|
14277
13967
|
exact: true,
|
|
14278
13968
|
});
|
|
14279
13969
|
const formState = useFormState({
|
|
@@ -14282,13 +13972,11 @@ function useController(props) {
|
|
|
14282
13972
|
exact: true,
|
|
14283
13973
|
});
|
|
14284
13974
|
const _props = React__default.useRef(props);
|
|
14285
|
-
const _previousNameRef = React__default.useRef(undefined);
|
|
14286
13975
|
const _registerProps = React__default.useRef(control.register(name, {
|
|
14287
13976
|
...props.rules,
|
|
14288
13977
|
value,
|
|
14289
13978
|
...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
|
|
14290
13979
|
}));
|
|
14291
|
-
_props.current = props;
|
|
14292
13980
|
const fieldState = React__default.useMemo(() => Object.defineProperties({}, {
|
|
14293
13981
|
invalid: {
|
|
14294
13982
|
enumerable: true,
|
|
@@ -14348,10 +14036,6 @@ function useController(props) {
|
|
|
14348
14036
|
}), [name, disabled, formState.disabled, onChange, onBlur, ref, value]);
|
|
14349
14037
|
React__default.useEffect(() => {
|
|
14350
14038
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
14351
|
-
const previousName = _previousNameRef.current;
|
|
14352
|
-
if (previousName && previousName !== name && !isArrayField) {
|
|
14353
|
-
control.unregister(previousName);
|
|
14354
|
-
}
|
|
14355
14039
|
control.register(name, {
|
|
14356
14040
|
..._props.current.rules,
|
|
14357
14041
|
...(isBoolean(_props.current.disabled)
|
|
@@ -14366,14 +14050,13 @@ function useController(props) {
|
|
|
14366
14050
|
};
|
|
14367
14051
|
updateMounted(name, true);
|
|
14368
14052
|
if (_shouldUnregisterField) {
|
|
14369
|
-
const value = cloneObject(get(control._options.defaultValues, name
|
|
14053
|
+
const value = cloneObject(get(control._options.defaultValues, name));
|
|
14370
14054
|
set(control._defaultValues, name, value);
|
|
14371
14055
|
if (isUndefined(get(control._formValues, name))) {
|
|
14372
14056
|
set(control._formValues, name, value);
|
|
14373
14057
|
}
|
|
14374
14058
|
}
|
|
14375
14059
|
!isArrayField && control.register(name);
|
|
14376
|
-
_previousNameRef.current = name;
|
|
14377
14060
|
return () => {
|
|
14378
14061
|
(isArrayField
|
|
14379
14062
|
? _shouldUnregisterField && !control._state.action
|
|
@@ -14479,24 +14162,42 @@ var createSubject = () => {
|
|
|
14479
14162
|
};
|
|
14480
14163
|
};
|
|
14481
14164
|
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
|
|
14485
|
-
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
|
|
14490
|
-
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
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;
|
|
14496
14197
|
}
|
|
14497
14198
|
}
|
|
14498
14199
|
}
|
|
14499
|
-
return
|
|
14200
|
+
return true;
|
|
14500
14201
|
}
|
|
14501
14202
|
|
|
14502
14203
|
var isEmptyObject = (value) => isObject(value) && !Object.keys(value).length;
|
|
@@ -14567,43 +14268,46 @@ var objectHasFunction = (data) => {
|
|
|
14567
14268
|
return false;
|
|
14568
14269
|
};
|
|
14569
14270
|
|
|
14570
|
-
function isTraversable(value) {
|
|
14571
|
-
return Array.isArray(value) || (isObject(value) && !objectHasFunction(value));
|
|
14572
|
-
}
|
|
14573
14271
|
function markFieldsDirty(data, fields = {}) {
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
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
|
+
}
|
|
14582
14283
|
}
|
|
14583
14284
|
}
|
|
14584
14285
|
return fields;
|
|
14585
14286
|
}
|
|
14586
|
-
function
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
|
|
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
|
+
}
|
|
14595
14302
|
}
|
|
14596
14303
|
else {
|
|
14597
|
-
|
|
14304
|
+
dirtyFieldsFromValues[key] = !deepEqual$1(data[key], formValues[key]);
|
|
14598
14305
|
}
|
|
14599
14306
|
}
|
|
14600
|
-
else {
|
|
14601
|
-
const formValue = formValues[key];
|
|
14602
|
-
dirtyFieldsFromValues[key] = !deepEqual$1(value, formValue);
|
|
14603
|
-
}
|
|
14604
14307
|
}
|
|
14605
14308
|
return dirtyFieldsFromValues;
|
|
14606
14309
|
}
|
|
14310
|
+
var getDirtyFields = (defaultValues, formValues) => getDirtyFieldsFromDefaultValues(defaultValues, formValues, markFieldsDirty(formValues));
|
|
14607
14311
|
|
|
14608
14312
|
const defaultResult = {
|
|
14609
14313
|
value: false,
|
|
@@ -14837,13 +14541,15 @@ var updateFieldArrayRootError = (errors, error, name) => {
|
|
|
14837
14541
|
return errors;
|
|
14838
14542
|
};
|
|
14839
14543
|
|
|
14544
|
+
var isMessage = (value) => isString(value);
|
|
14545
|
+
|
|
14840
14546
|
function getValidateError(result, ref, type = 'validate') {
|
|
14841
|
-
if (
|
|
14842
|
-
(Array.isArray(result) && result.every(
|
|
14547
|
+
if (isMessage(result) ||
|
|
14548
|
+
(Array.isArray(result) && result.every(isMessage)) ||
|
|
14843
14549
|
(isBoolean(result) && !result)) {
|
|
14844
14550
|
return {
|
|
14845
14551
|
type,
|
|
14846
|
-
message:
|
|
14552
|
+
message: isMessage(result) ? result : '',
|
|
14847
14553
|
ref,
|
|
14848
14554
|
};
|
|
14849
14555
|
}
|
|
@@ -14896,7 +14602,7 @@ var validateField = async (field, disabledFieldNames, formValues, validateAllFie
|
|
|
14896
14602
|
(isBoolean(inputValue) && !inputValue) ||
|
|
14897
14603
|
(isCheckBox && !getCheckboxValue(refs).isValid) ||
|
|
14898
14604
|
(isRadio && !getRadioValue(refs).isValid))) {
|
|
14899
|
-
const { value, message } =
|
|
14605
|
+
const { value, message } = isMessage(required)
|
|
14900
14606
|
? { value: !!required, message: required }
|
|
14901
14607
|
: getValueAndMessage(required);
|
|
14902
14608
|
if (value) {
|
|
@@ -15061,7 +14767,7 @@ function createFormControl(props = {}) {
|
|
|
15061
14767
|
errors: _options.errors || {},
|
|
15062
14768
|
disabled: _options.disabled || false,
|
|
15063
14769
|
};
|
|
15064
|
-
|
|
14770
|
+
const _fields = {};
|
|
15065
14771
|
let _defaultValues = isObject(_options.defaultValues) || isObject(_options.values)
|
|
15066
14772
|
? cloneObject(_options.defaultValues || _options.values) || {}
|
|
15067
14773
|
: {};
|
|
@@ -15194,7 +14900,7 @@ function createFormControl(props = {}) {
|
|
|
15194
14900
|
shouldSkipSetValueAs
|
|
15195
14901
|
? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f))
|
|
15196
14902
|
: setFieldValue(name, defaultValue);
|
|
15197
|
-
_state.mount &&
|
|
14903
|
+
_state.mount && _setValid();
|
|
15198
14904
|
}
|
|
15199
14905
|
};
|
|
15200
14906
|
const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
|
|
@@ -15302,11 +15008,11 @@ function createFormControl(props = {}) {
|
|
|
15302
15008
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
15303
15009
|
const isPromiseFunction = field._f && hasPromiseValidation(field._f);
|
|
15304
15010
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
15305
|
-
_updateIsValidating([
|
|
15011
|
+
_updateIsValidating([name], true);
|
|
15306
15012
|
}
|
|
15307
15013
|
const fieldError = await validateField(field, _names.disabled, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
|
|
15308
15014
|
if (isPromiseFunction && _proxyFormState.validatingFields) {
|
|
15309
|
-
_updateIsValidating([
|
|
15015
|
+
_updateIsValidating([name]);
|
|
15310
15016
|
}
|
|
15311
15017
|
if (fieldError[_f.name]) {
|
|
15312
15018
|
context.valid = false;
|
|
@@ -15445,7 +15151,7 @@ function createFormControl(props = {}) {
|
|
|
15445
15151
|
? setValues(name, cloneValue, options)
|
|
15446
15152
|
: setFieldValue(name, cloneValue, options);
|
|
15447
15153
|
}
|
|
15448
|
-
isWatched(name, _names) && _subjects.state.next({ ..._formState
|
|
15154
|
+
isWatched(name, _names) && _subjects.state.next({ ..._formState });
|
|
15449
15155
|
_subjects.state.next({
|
|
15450
15156
|
name: _state.mount ? name : undefined,
|
|
15451
15157
|
values: cloneObject(_formValues),
|
|
@@ -15480,10 +15186,8 @@ function createFormControl(props = {}) {
|
|
|
15480
15186
|
const watched = isWatched(name, _names, isBlurEvent);
|
|
15481
15187
|
set(_formValues, name, fieldValue);
|
|
15482
15188
|
if (isBlurEvent) {
|
|
15483
|
-
|
|
15484
|
-
|
|
15485
|
-
delayErrorCallback && delayErrorCallback(0);
|
|
15486
|
-
}
|
|
15189
|
+
field._f.onBlur && field._f.onBlur(event);
|
|
15190
|
+
delayErrorCallback && delayErrorCallback(0);
|
|
15487
15191
|
}
|
|
15488
15192
|
else if (field._f.onChange) {
|
|
15489
15193
|
field._f.onChange(event);
|
|
@@ -15539,7 +15243,6 @@ function createFormControl(props = {}) {
|
|
|
15539
15243
|
}
|
|
15540
15244
|
if (isFieldValueUpdated) {
|
|
15541
15245
|
field._f.deps &&
|
|
15542
|
-
(!Array.isArray(field._f.deps) || field._f.deps.length > 0) &&
|
|
15543
15246
|
trigger(field._f.deps);
|
|
15544
15247
|
shouldRenderByError(name, isValid, error, fieldState);
|
|
15545
15248
|
}
|
|
@@ -15587,13 +15290,10 @@ function createFormControl(props = {}) {
|
|
|
15587
15290
|
iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
|
|
15588
15291
|
return validationResult;
|
|
15589
15292
|
};
|
|
15590
|
-
const getValues = (fieldNames
|
|
15591
|
-
|
|
15293
|
+
const getValues = (fieldNames) => {
|
|
15294
|
+
const values = {
|
|
15592
15295
|
...(_state.mount ? _formValues : _defaultValues),
|
|
15593
15296
|
};
|
|
15594
|
-
if (config) {
|
|
15595
|
-
values = extractFormValues(config.dirtyFields ? _formState.dirtyFields : _formState.touchedFields, values);
|
|
15596
|
-
}
|
|
15597
15297
|
return isUndefined(fieldNames)
|
|
15598
15298
|
? values
|
|
15599
15299
|
: isString(fieldNames)
|
|
@@ -15633,8 +15333,7 @@ function createFormControl(props = {}) {
|
|
|
15633
15333
|
};
|
|
15634
15334
|
const watch = (name, defaultValue) => isFunction$1(name)
|
|
15635
15335
|
? _subjects.state.subscribe({
|
|
15636
|
-
next: (payload) =>
|
|
15637
|
-
name(_getWatch(undefined, defaultValue), payload),
|
|
15336
|
+
next: (payload) => name(_getWatch(undefined, defaultValue), payload),
|
|
15638
15337
|
})
|
|
15639
15338
|
: _getWatch(name, defaultValue, true);
|
|
15640
15339
|
const _subscribe = (props) => _subjects.state.subscribe({
|
|
@@ -15645,7 +15344,6 @@ function createFormControl(props = {}) {
|
|
|
15645
15344
|
values: { ..._formValues },
|
|
15646
15345
|
..._formState,
|
|
15647
15346
|
...formState,
|
|
15648
|
-
defaultValues: _defaultValues,
|
|
15649
15347
|
});
|
|
15650
15348
|
}
|
|
15651
15349
|
},
|
|
@@ -15915,20 +15613,15 @@ function createFormControl(props = {}) {
|
|
|
15915
15613
|
}
|
|
15916
15614
|
}
|
|
15917
15615
|
}
|
|
15918
|
-
|
|
15919
|
-
|
|
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);
|
|
15920
15620
|
setValue(fieldName, get(values, fieldName));
|
|
15921
15621
|
}
|
|
15922
15622
|
}
|
|
15923
|
-
else {
|
|
15924
|
-
_fields = {};
|
|
15925
|
-
}
|
|
15926
15623
|
}
|
|
15927
|
-
_formValues =
|
|
15928
|
-
? keepStateOptions.keepDefaultValues
|
|
15929
|
-
? cloneObject(_defaultValues)
|
|
15930
|
-
: {}
|
|
15931
|
-
: cloneObject(values);
|
|
15624
|
+
_formValues = cloneObject(values);
|
|
15932
15625
|
_subjects.array.next({
|
|
15933
15626
|
values: { ...values },
|
|
15934
15627
|
});
|
|
@@ -15948,8 +15641,7 @@ function createFormControl(props = {}) {
|
|
|
15948
15641
|
_state.mount =
|
|
15949
15642
|
!_proxyFormState.isValid ||
|
|
15950
15643
|
!!keepStateOptions.keepIsValid ||
|
|
15951
|
-
!!keepStateOptions.keepDirtyValues
|
|
15952
|
-
(!_options.shouldUnregister && !isEmptyObject(values));
|
|
15644
|
+
!!keepStateOptions.keepDirtyValues;
|
|
15953
15645
|
_state.watch = !!_options.shouldUnregister;
|
|
15954
15646
|
_subjects.state.next({
|
|
15955
15647
|
submitCount: keepStateOptions.keepSubmitCount
|
|
@@ -15983,7 +15675,6 @@ function createFormControl(props = {}) {
|
|
|
15983
15675
|
? _formState.isSubmitSuccessful
|
|
15984
15676
|
: false,
|
|
15985
15677
|
isSubmitting: false,
|
|
15986
|
-
defaultValues: _defaultValues,
|
|
15987
15678
|
});
|
|
15988
15679
|
};
|
|
15989
15680
|
const reset = (formValues, keepStateOptions) => _reset(isFunction$1(formValues)
|
|
@@ -16211,15 +15902,8 @@ function useForm(props = {}) {
|
|
|
16211
15902
|
}
|
|
16212
15903
|
}, [control, formState.isDirty]);
|
|
16213
15904
|
React__default.useEffect(() => {
|
|
16214
|
-
var _a;
|
|
16215
15905
|
if (props.values && !deepEqual$1(props.values, _values.current)) {
|
|
16216
|
-
control._reset(props.values,
|
|
16217
|
-
keepFieldsRef: true,
|
|
16218
|
-
...control._options.resetOptions,
|
|
16219
|
-
});
|
|
16220
|
-
if (!((_a = control._options.resetOptions) === null || _a === void 0 ? void 0 : _a.keepIsValid)) {
|
|
16221
|
-
control._setValid();
|
|
16222
|
-
}
|
|
15906
|
+
control._reset(props.values, control._options.resetOptions);
|
|
16223
15907
|
_values.current = props.values;
|
|
16224
15908
|
updateFormState((state) => ({ ...state }));
|
|
16225
15909
|
}
|
|
@@ -16243,7 +15927,7 @@ function useForm(props = {}) {
|
|
|
16243
15927
|
}
|
|
16244
15928
|
|
|
16245
15929
|
// src/primitive.tsx
|
|
16246
|
-
var NODES
|
|
15930
|
+
var NODES = [
|
|
16247
15931
|
"a",
|
|
16248
15932
|
"button",
|
|
16249
15933
|
"div",
|
|
@@ -16262,8 +15946,8 @@ var NODES$1 = [
|
|
|
16262
15946
|
"svg",
|
|
16263
15947
|
"ul"
|
|
16264
15948
|
];
|
|
16265
|
-
var Primitive
|
|
16266
|
-
const Slot = createSlot
|
|
15949
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
15950
|
+
const Slot = createSlot(`Primitive.${node}`);
|
|
16267
15951
|
const Node = React.forwardRef((props, forwardedRef) => {
|
|
16268
15952
|
const { asChild, ...primitiveProps } = props;
|
|
16269
15953
|
const Comp = asChild ? Slot : node;
|
|
@@ -16275,11 +15959,14 @@ var Primitive$1 = NODES$1.reduce((primitive, node) => {
|
|
|
16275
15959
|
Node.displayName = `Primitive.${node}`;
|
|
16276
15960
|
return { ...primitive, [node]: Node };
|
|
16277
15961
|
}, {});
|
|
15962
|
+
function dispatchDiscreteCustomEvent(target, event) {
|
|
15963
|
+
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
15964
|
+
}
|
|
16278
15965
|
|
|
16279
15966
|
var NAME$1 = "Label";
|
|
16280
15967
|
var Label$1 = React.forwardRef((props, forwardedRef) => {
|
|
16281
15968
|
return /* @__PURE__ */ jsx(
|
|
16282
|
-
Primitive
|
|
15969
|
+
Primitive.label,
|
|
16283
15970
|
{
|
|
16284
15971
|
...props,
|
|
16285
15972
|
ref: forwardedRef,
|
|
@@ -16297,36 +15984,7 @@ var Root$2 = Label$1;
|
|
|
16297
15984
|
|
|
16298
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}
|
|
16299
15986
|
|
|
16300
|
-
/**
|
|
16301
|
-
* Concatenates two arrays faster than the array spread operator.
|
|
16302
|
-
*/
|
|
16303
|
-
const concatArrays = (array1, array2) => {
|
|
16304
|
-
// Pre-allocate for better V8 optimization
|
|
16305
|
-
const combinedArray = new Array(array1.length + array2.length);
|
|
16306
|
-
for (let i = 0; i < array1.length; i++) {
|
|
16307
|
-
combinedArray[i] = array1[i];
|
|
16308
|
-
}
|
|
16309
|
-
for (let i = 0; i < array2.length; i++) {
|
|
16310
|
-
combinedArray[array1.length + i] = array2[i];
|
|
16311
|
-
}
|
|
16312
|
-
return combinedArray;
|
|
16313
|
-
};
|
|
16314
|
-
|
|
16315
|
-
// Factory function ensures consistent object shapes
|
|
16316
|
-
const createClassValidatorObject = (classGroupId, validator) => ({
|
|
16317
|
-
classGroupId,
|
|
16318
|
-
validator
|
|
16319
|
-
});
|
|
16320
|
-
// Factory ensures consistent ClassPartObject shape
|
|
16321
|
-
const createClassPartObject = (nextPart = new Map(), validators = null, classGroupId) => ({
|
|
16322
|
-
nextPart,
|
|
16323
|
-
validators,
|
|
16324
|
-
classGroupId
|
|
16325
|
-
});
|
|
16326
15987
|
const CLASS_PART_SEPARATOR = '-';
|
|
16327
|
-
const EMPTY_CONFLICTS = [];
|
|
16328
|
-
// I use two dots here because one dot is used as prefix for class groups in plugins
|
|
16329
|
-
const ARBITRARY_PROPERTY_PREFIX = 'arbitrary..';
|
|
16330
15988
|
const createClassGroupUtils = config => {
|
|
16331
15989
|
const classMap = createClassMap(config);
|
|
16332
15990
|
const {
|
|
@@ -16334,73 +15992,54 @@ const createClassGroupUtils = config => {
|
|
|
16334
15992
|
conflictingClassGroupModifiers
|
|
16335
15993
|
} = config;
|
|
16336
15994
|
const getClassGroupId = className => {
|
|
16337
|
-
if (className.startsWith('[') && className.endsWith(']')) {
|
|
16338
|
-
return getGroupIdForArbitraryProperty(className);
|
|
16339
|
-
}
|
|
16340
15995
|
const classParts = className.split(CLASS_PART_SEPARATOR);
|
|
16341
|
-
// Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and
|
|
16342
|
-
|
|
16343
|
-
|
|
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);
|
|
16344
16001
|
};
|
|
16345
16002
|
const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
|
|
16346
|
-
|
|
16347
|
-
|
|
16348
|
-
|
|
16349
|
-
if (modifierConflicts) {
|
|
16350
|
-
if (baseConflicts) {
|
|
16351
|
-
// Merge base conflicts with modifier conflicts
|
|
16352
|
-
return concatArrays(baseConflicts, modifierConflicts);
|
|
16353
|
-
}
|
|
16354
|
-
// Only modifier conflicts
|
|
16355
|
-
return modifierConflicts;
|
|
16356
|
-
}
|
|
16357
|
-
// Fall back to without postfix if no modifier conflicts
|
|
16358
|
-
return baseConflicts || EMPTY_CONFLICTS;
|
|
16003
|
+
const conflicts = conflictingClassGroups[classGroupId] || [];
|
|
16004
|
+
if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
|
|
16005
|
+
return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
|
|
16359
16006
|
}
|
|
16360
|
-
return
|
|
16007
|
+
return conflicts;
|
|
16361
16008
|
};
|
|
16362
16009
|
return {
|
|
16363
16010
|
getClassGroupId,
|
|
16364
16011
|
getConflictingClassGroupIds
|
|
16365
16012
|
};
|
|
16366
16013
|
};
|
|
16367
|
-
const getGroupRecursive = (classParts,
|
|
16368
|
-
|
|
16369
|
-
if (classPathsLength === 0) {
|
|
16014
|
+
const getGroupRecursive = (classParts, classPartObject) => {
|
|
16015
|
+
if (classParts.length === 0) {
|
|
16370
16016
|
return classPartObject.classGroupId;
|
|
16371
16017
|
}
|
|
16372
|
-
const currentClassPart = classParts[
|
|
16018
|
+
const currentClassPart = classParts[0];
|
|
16373
16019
|
const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
|
|
16374
|
-
|
|
16375
|
-
|
|
16376
|
-
|
|
16020
|
+
const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : undefined;
|
|
16021
|
+
if (classGroupFromNextClassPart) {
|
|
16022
|
+
return classGroupFromNextClassPart;
|
|
16377
16023
|
}
|
|
16378
|
-
|
|
16379
|
-
if (validators === null) {
|
|
16024
|
+
if (classPartObject.validators.length === 0) {
|
|
16380
16025
|
return undefined;
|
|
16381
16026
|
}
|
|
16382
|
-
|
|
16383
|
-
|
|
16384
|
-
|
|
16385
|
-
|
|
16386
|
-
|
|
16387
|
-
|
|
16388
|
-
|
|
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;
|
|
16389
16040
|
}
|
|
16390
16041
|
}
|
|
16391
|
-
return undefined;
|
|
16392
16042
|
};
|
|
16393
|
-
/**
|
|
16394
|
-
* Get the class group ID for an arbitrary property.
|
|
16395
|
-
*
|
|
16396
|
-
* @param className - The class name to get the group ID for. Is expected to be string starting with `[` and ending with `]`.
|
|
16397
|
-
*/
|
|
16398
|
-
const getGroupIdForArbitraryProperty = className => className.slice(1, -1).indexOf(':') === -1 ? undefined : (() => {
|
|
16399
|
-
const content = className.slice(1, -1);
|
|
16400
|
-
const colonIndex = content.indexOf(':');
|
|
16401
|
-
const property = content.slice(0, colonIndex);
|
|
16402
|
-
return property ? ARBITRARY_PROPERTY_PREFIX + property : undefined;
|
|
16403
|
-
})();
|
|
16404
16043
|
/**
|
|
16405
16044
|
* Exported for testing only
|
|
16406
16045
|
*/
|
|
@@ -16409,77 +16048,54 @@ const createClassMap = config => {
|
|
|
16409
16048
|
theme,
|
|
16410
16049
|
classGroups
|
|
16411
16050
|
} = config;
|
|
16412
|
-
|
|
16413
|
-
|
|
16414
|
-
|
|
16415
|
-
|
|
16416
|
-
const classMap = createClassPartObject();
|
|
16051
|
+
const classMap = {
|
|
16052
|
+
nextPart: new Map(),
|
|
16053
|
+
validators: []
|
|
16054
|
+
};
|
|
16417
16055
|
for (const classGroupId in classGroups) {
|
|
16418
|
-
|
|
16419
|
-
processClassesRecursively(group, classMap, classGroupId, theme);
|
|
16056
|
+
processClassesRecursively(classGroups[classGroupId], classMap, classGroupId, theme);
|
|
16420
16057
|
}
|
|
16421
16058
|
return classMap;
|
|
16422
16059
|
};
|
|
16423
16060
|
const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
|
|
16424
|
-
|
|
16425
|
-
|
|
16426
|
-
|
|
16427
|
-
|
|
16428
|
-
|
|
16429
|
-
}
|
|
16430
|
-
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
16436
|
-
|
|
16437
|
-
|
|
16438
|
-
|
|
16439
|
-
|
|
16440
|
-
|
|
16441
|
-
|
|
16442
|
-
|
|
16443
|
-
|
|
16444
|
-
|
|
16445
|
-
};
|
|
16446
|
-
const processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
|
|
16447
|
-
if (isThemeGetter(classDefinition)) {
|
|
16448
|
-
processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
|
|
16449
|
-
return;
|
|
16450
|
-
}
|
|
16451
|
-
if (classPartObject.validators === null) {
|
|
16452
|
-
classPartObject.validators = [];
|
|
16453
|
-
}
|
|
16454
|
-
classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
|
|
16455
|
-
};
|
|
16456
|
-
const processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
|
|
16457
|
-
const entries = Object.entries(classDefinition);
|
|
16458
|
-
const len = entries.length;
|
|
16459
|
-
for (let i = 0; i < len; i++) {
|
|
16460
|
-
const [key, value] = entries[i];
|
|
16461
|
-
processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
|
|
16462
|
-
}
|
|
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
|
+
});
|
|
16463
16082
|
};
|
|
16464
16083
|
const getPart = (classPartObject, path) => {
|
|
16465
|
-
let
|
|
16466
|
-
|
|
16467
|
-
|
|
16468
|
-
|
|
16469
|
-
|
|
16470
|
-
|
|
16471
|
-
|
|
16472
|
-
next = createClassPartObject();
|
|
16473
|
-
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
|
+
});
|
|
16474
16091
|
}
|
|
16475
|
-
|
|
16476
|
-
}
|
|
16477
|
-
return
|
|
16092
|
+
currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
|
|
16093
|
+
});
|
|
16094
|
+
return currentClassPartObject;
|
|
16478
16095
|
};
|
|
16479
|
-
|
|
16480
|
-
const isThemeGetter = func => 'isThemeGetter' in func && func.isThemeGetter === true;
|
|
16096
|
+
const isThemeGetter = func => func.isThemeGetter;
|
|
16481
16097
|
|
|
16482
|
-
// LRU cache
|
|
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
|
|
16483
16099
|
const createLruCache = maxCacheSize => {
|
|
16484
16100
|
if (maxCacheSize < 1) {
|
|
16485
16101
|
return {
|
|
@@ -16488,31 +16104,31 @@ const createLruCache = maxCacheSize => {
|
|
|
16488
16104
|
};
|
|
16489
16105
|
}
|
|
16490
16106
|
let cacheSize = 0;
|
|
16491
|
-
let cache =
|
|
16492
|
-
let previousCache =
|
|
16107
|
+
let cache = new Map();
|
|
16108
|
+
let previousCache = new Map();
|
|
16493
16109
|
const update = (key, value) => {
|
|
16494
|
-
cache
|
|
16110
|
+
cache.set(key, value);
|
|
16495
16111
|
cacheSize++;
|
|
16496
16112
|
if (cacheSize > maxCacheSize) {
|
|
16497
16113
|
cacheSize = 0;
|
|
16498
16114
|
previousCache = cache;
|
|
16499
|
-
cache =
|
|
16115
|
+
cache = new Map();
|
|
16500
16116
|
}
|
|
16501
16117
|
};
|
|
16502
16118
|
return {
|
|
16503
16119
|
get(key) {
|
|
16504
|
-
let value = cache
|
|
16120
|
+
let value = cache.get(key);
|
|
16505
16121
|
if (value !== undefined) {
|
|
16506
16122
|
return value;
|
|
16507
16123
|
}
|
|
16508
|
-
if ((value = previousCache
|
|
16124
|
+
if ((value = previousCache.get(key)) !== undefined) {
|
|
16509
16125
|
update(key, value);
|
|
16510
16126
|
return value;
|
|
16511
16127
|
}
|
|
16512
16128
|
},
|
|
16513
16129
|
set(key, value) {
|
|
16514
|
-
if (key
|
|
16515
|
-
cache
|
|
16130
|
+
if (cache.has(key)) {
|
|
16131
|
+
cache.set(key, value);
|
|
16516
16132
|
} else {
|
|
16517
16133
|
update(key, value);
|
|
16518
16134
|
}
|
|
@@ -16521,15 +16137,7 @@ const createLruCache = maxCacheSize => {
|
|
|
16521
16137
|
};
|
|
16522
16138
|
const IMPORTANT_MODIFIER = '!';
|
|
16523
16139
|
const MODIFIER_SEPARATOR = ':';
|
|
16524
|
-
const
|
|
16525
|
-
// Pre-allocated result object shape for consistency
|
|
16526
|
-
const createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
|
|
16527
|
-
modifiers,
|
|
16528
|
-
hasImportantModifier,
|
|
16529
|
-
baseClassName,
|
|
16530
|
-
maybePostfixModifierPosition,
|
|
16531
|
-
isExternal
|
|
16532
|
-
});
|
|
16140
|
+
const MODIFIER_SEPARATOR_LENGTH = MODIFIER_SEPARATOR.length;
|
|
16533
16141
|
const createParseClassName = config => {
|
|
16534
16142
|
const {
|
|
16535
16143
|
prefix,
|
|
@@ -16542,19 +16150,17 @@ const createParseClassName = config => {
|
|
|
16542
16150
|
* @see https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js
|
|
16543
16151
|
*/
|
|
16544
16152
|
let parseClassName = className => {
|
|
16545
|
-
// Use simple array with push for better performance
|
|
16546
16153
|
const modifiers = [];
|
|
16547
16154
|
let bracketDepth = 0;
|
|
16548
16155
|
let parenDepth = 0;
|
|
16549
16156
|
let modifierStart = 0;
|
|
16550
16157
|
let postfixModifierPosition;
|
|
16551
|
-
|
|
16552
|
-
|
|
16553
|
-
const currentCharacter = className[index];
|
|
16158
|
+
for (let index = 0; index < className.length; index++) {
|
|
16159
|
+
let currentCharacter = className[index];
|
|
16554
16160
|
if (bracketDepth === 0 && parenDepth === 0) {
|
|
16555
16161
|
if (currentCharacter === MODIFIER_SEPARATOR) {
|
|
16556
16162
|
modifiers.push(className.slice(modifierStart, index));
|
|
16557
|
-
modifierStart = index +
|
|
16163
|
+
modifierStart = index + MODIFIER_SEPARATOR_LENGTH;
|
|
16558
16164
|
continue;
|
|
16559
16165
|
}
|
|
16560
16166
|
if (currentCharacter === '/') {
|
|
@@ -16562,31 +16168,37 @@ const createParseClassName = config => {
|
|
|
16562
16168
|
continue;
|
|
16563
16169
|
}
|
|
16564
16170
|
}
|
|
16565
|
-
if (currentCharacter === '[')
|
|
16566
|
-
|
|
16567
|
-
|
|
16568
|
-
|
|
16569
|
-
|
|
16570
|
-
|
|
16571
|
-
|
|
16572
|
-
|
|
16573
|
-
|
|
16574
|
-
} else if (
|
|
16575
|
-
/**
|
|
16576
|
-
* In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
|
|
16577
|
-
* @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
|
|
16578
|
-
*/
|
|
16579
|
-
baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)) {
|
|
16580
|
-
baseClassName = baseClassNameWithImportantModifier.slice(1);
|
|
16581
|
-
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
|
+
}
|
|
16582
16180
|
}
|
|
16181
|
+
const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
|
|
16182
|
+
const baseClassName = stripImportantModifier(baseClassNameWithImportantModifier);
|
|
16183
|
+
const hasImportantModifier = baseClassName !== baseClassNameWithImportantModifier;
|
|
16583
16184
|
const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : undefined;
|
|
16584
|
-
return
|
|
16185
|
+
return {
|
|
16186
|
+
modifiers,
|
|
16187
|
+
hasImportantModifier,
|
|
16188
|
+
baseClassName,
|
|
16189
|
+
maybePostfixModifierPosition
|
|
16190
|
+
};
|
|
16585
16191
|
};
|
|
16586
16192
|
if (prefix) {
|
|
16587
16193
|
const fullPrefix = prefix + MODIFIER_SEPARATOR;
|
|
16588
16194
|
const parseClassNameOriginal = parseClassName;
|
|
16589
|
-
parseClassName = className => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.
|
|
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
|
+
};
|
|
16590
16202
|
}
|
|
16591
16203
|
if (experimentalParseClassName) {
|
|
16592
16204
|
const parseClassNameOriginal = parseClassName;
|
|
@@ -16597,6 +16209,19 @@ const createParseClassName = config => {
|
|
|
16597
16209
|
}
|
|
16598
16210
|
return parseClassName;
|
|
16599
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
|
+
};
|
|
16600
16225
|
|
|
16601
16226
|
/**
|
|
16602
16227
|
* Sorts modifiers according to following schema:
|
|
@@ -16604,41 +16229,26 @@ const createParseClassName = config => {
|
|
|
16604
16229
|
* - When an arbitrary variant appears, it must be preserved which modifiers are before and after it
|
|
16605
16230
|
*/
|
|
16606
16231
|
const createSortModifiers = config => {
|
|
16607
|
-
|
|
16608
|
-
const
|
|
16609
|
-
|
|
16610
|
-
|
|
16611
|
-
|
|
16612
|
-
|
|
16613
|
-
|
|
16614
|
-
|
|
16615
|
-
|
|
16616
|
-
|
|
16617
|
-
|
|
16618
|
-
|
|
16619
|
-
// Check if modifier is sensitive (starts with '[' or in orderSensitiveModifiers)
|
|
16620
|
-
const isArbitrary = modifier[0] === '[';
|
|
16621
|
-
const isOrderSensitive = modifierWeights.has(modifier);
|
|
16622
|
-
if (isArbitrary || isOrderSensitive) {
|
|
16623
|
-
// Sort and flush current segment alphabetically
|
|
16624
|
-
if (currentSegment.length > 0) {
|
|
16625
|
-
currentSegment.sort();
|
|
16626
|
-
result.push(...currentSegment);
|
|
16627
|
-
currentSegment = [];
|
|
16628
|
-
}
|
|
16629
|
-
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 = [];
|
|
16630
16244
|
} else {
|
|
16631
|
-
|
|
16632
|
-
currentSegment.push(modifier);
|
|
16245
|
+
unsortedModifiers.push(modifier);
|
|
16633
16246
|
}
|
|
16634
|
-
}
|
|
16635
|
-
|
|
16636
|
-
|
|
16637
|
-
currentSegment.sort();
|
|
16638
|
-
result.push(...currentSegment);
|
|
16639
|
-
}
|
|
16640
|
-
return result;
|
|
16247
|
+
});
|
|
16248
|
+
sortedModifiers.push(...unsortedModifiers.sort());
|
|
16249
|
+
return sortedModifiers;
|
|
16641
16250
|
};
|
|
16251
|
+
return sortModifiers;
|
|
16642
16252
|
};
|
|
16643
16253
|
const createConfigUtils = config => ({
|
|
16644
16254
|
cache: createLruCache(config.cacheSize),
|
|
@@ -16693,11 +16303,10 @@ const mergeClassList = (classList, configUtils) => {
|
|
|
16693
16303
|
}
|
|
16694
16304
|
hasPostfixModifier = false;
|
|
16695
16305
|
}
|
|
16696
|
-
|
|
16697
|
-
const variantModifier = modifiers.length === 0 ? '' : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(':');
|
|
16306
|
+
const variantModifier = sortModifiers(modifiers).join(':');
|
|
16698
16307
|
const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
|
|
16699
16308
|
const classId = modifierId + classGroupId;
|
|
16700
|
-
if (classGroupsInConflict.
|
|
16309
|
+
if (classGroupsInConflict.includes(classId)) {
|
|
16701
16310
|
// Tailwind class omitted due to conflict
|
|
16702
16311
|
continue;
|
|
16703
16312
|
}
|
|
@@ -16722,13 +16331,13 @@ const mergeClassList = (classList, configUtils) => {
|
|
|
16722
16331
|
*
|
|
16723
16332
|
* Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
|
|
16724
16333
|
*/
|
|
16725
|
-
|
|
16334
|
+
function twJoin() {
|
|
16726
16335
|
let index = 0;
|
|
16727
16336
|
let argument;
|
|
16728
16337
|
let resolvedValue;
|
|
16729
16338
|
let string = '';
|
|
16730
|
-
while (index <
|
|
16731
|
-
if (argument =
|
|
16339
|
+
while (index < arguments.length) {
|
|
16340
|
+
if (argument = arguments[index++]) {
|
|
16732
16341
|
if (resolvedValue = toValue(argument)) {
|
|
16733
16342
|
string && (string += ' ');
|
|
16734
16343
|
string += resolvedValue;
|
|
@@ -16736,9 +16345,8 @@ const twJoin = (...classLists) => {
|
|
|
16736
16345
|
}
|
|
16737
16346
|
}
|
|
16738
16347
|
return string;
|
|
16739
|
-
}
|
|
16348
|
+
}
|
|
16740
16349
|
const toValue = mix => {
|
|
16741
|
-
// Fast path for strings
|
|
16742
16350
|
if (typeof mix === 'string') {
|
|
16743
16351
|
return mix;
|
|
16744
16352
|
}
|
|
@@ -16754,20 +16362,20 @@ const toValue = mix => {
|
|
|
16754
16362
|
}
|
|
16755
16363
|
return string;
|
|
16756
16364
|
};
|
|
16757
|
-
|
|
16365
|
+
function createTailwindMerge(createConfigFirst, ...createConfigRest) {
|
|
16758
16366
|
let configUtils;
|
|
16759
16367
|
let cacheGet;
|
|
16760
16368
|
let cacheSet;
|
|
16761
|
-
let functionToCall;
|
|
16762
|
-
|
|
16369
|
+
let functionToCall = initTailwindMerge;
|
|
16370
|
+
function initTailwindMerge(classList) {
|
|
16763
16371
|
const config = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
|
|
16764
16372
|
configUtils = createConfigUtils(config);
|
|
16765
16373
|
cacheGet = configUtils.cache.get;
|
|
16766
16374
|
cacheSet = configUtils.cache.set;
|
|
16767
16375
|
functionToCall = tailwindMerge;
|
|
16768
16376
|
return tailwindMerge(classList);
|
|
16769
|
-
}
|
|
16770
|
-
|
|
16377
|
+
}
|
|
16378
|
+
function tailwindMerge(classList) {
|
|
16771
16379
|
const cachedResult = cacheGet(classList);
|
|
16772
16380
|
if (cachedResult) {
|
|
16773
16381
|
return cachedResult;
|
|
@@ -16775,13 +16383,13 @@ const createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
|
|
|
16775
16383
|
const result = mergeClassList(classList, configUtils);
|
|
16776
16384
|
cacheSet(classList, result);
|
|
16777
16385
|
return result;
|
|
16386
|
+
}
|
|
16387
|
+
return function callTailwindMerge() {
|
|
16388
|
+
return functionToCall(twJoin.apply(null, arguments));
|
|
16778
16389
|
};
|
|
16779
|
-
|
|
16780
|
-
return (...args) => functionToCall(twJoin(...args));
|
|
16781
|
-
};
|
|
16782
|
-
const fallbackThemeArr = [];
|
|
16390
|
+
}
|
|
16783
16391
|
const fromTheme = key => {
|
|
16784
|
-
const themeGetter = theme => theme[key] ||
|
|
16392
|
+
const themeGetter = theme => theme[key] || [];
|
|
16785
16393
|
themeGetter.isThemeGetter = true;
|
|
16786
16394
|
return themeGetter;
|
|
16787
16395
|
};
|
|
@@ -19489,7 +19097,7 @@ function Button(_a) {
|
|
|
19489
19097
|
|
|
19490
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,{})}
|
|
19491
19099
|
|
|
19492
|
-
// src/primitive.tsx
|
|
19100
|
+
// packages/core/primitive/src/primitive.tsx
|
|
19493
19101
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
19494
19102
|
return function handleEvent(event) {
|
|
19495
19103
|
originalEventHandler?.(event);
|
|
@@ -19655,127 +19263,6 @@ function isFunction(value) {
|
|
|
19655
19263
|
return typeof value === "function";
|
|
19656
19264
|
}
|
|
19657
19265
|
|
|
19658
|
-
// src/slot.tsx
|
|
19659
|
-
// @__NO_SIDE_EFFECTS__
|
|
19660
|
-
function createSlot(ownerName) {
|
|
19661
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
19662
|
-
const Slot2 = React.forwardRef((props, forwardedRef) => {
|
|
19663
|
-
const { children, ...slotProps } = props;
|
|
19664
|
-
const childrenArray = React.Children.toArray(children);
|
|
19665
|
-
const slottable = childrenArray.find(isSlottable);
|
|
19666
|
-
if (slottable) {
|
|
19667
|
-
const newElement = slottable.props.children;
|
|
19668
|
-
const newChildren = childrenArray.map((child) => {
|
|
19669
|
-
if (child === slottable) {
|
|
19670
|
-
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
|
19671
|
-
return React.isValidElement(newElement) ? newElement.props.children : null;
|
|
19672
|
-
} else {
|
|
19673
|
-
return child;
|
|
19674
|
-
}
|
|
19675
|
-
});
|
|
19676
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
|
|
19677
|
-
}
|
|
19678
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
19679
|
-
});
|
|
19680
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
19681
|
-
return Slot2;
|
|
19682
|
-
}
|
|
19683
|
-
// @__NO_SIDE_EFFECTS__
|
|
19684
|
-
function createSlotClone(ownerName) {
|
|
19685
|
-
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
19686
|
-
const { children, ...slotProps } = props;
|
|
19687
|
-
if (React.isValidElement(children)) {
|
|
19688
|
-
const childrenRef = getElementRef$1(children);
|
|
19689
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
19690
|
-
if (children.type !== React.Fragment) {
|
|
19691
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
19692
|
-
}
|
|
19693
|
-
return React.cloneElement(children, props2);
|
|
19694
|
-
}
|
|
19695
|
-
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
19696
|
-
});
|
|
19697
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
19698
|
-
return SlotClone;
|
|
19699
|
-
}
|
|
19700
|
-
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
19701
|
-
function isSlottable(child) {
|
|
19702
|
-
return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
19703
|
-
}
|
|
19704
|
-
function mergeProps(slotProps, childProps) {
|
|
19705
|
-
const overrideProps = { ...childProps };
|
|
19706
|
-
for (const propName in childProps) {
|
|
19707
|
-
const slotPropValue = slotProps[propName];
|
|
19708
|
-
const childPropValue = childProps[propName];
|
|
19709
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
19710
|
-
if (isHandler) {
|
|
19711
|
-
if (slotPropValue && childPropValue) {
|
|
19712
|
-
overrideProps[propName] = (...args) => {
|
|
19713
|
-
const result = childPropValue(...args);
|
|
19714
|
-
slotPropValue(...args);
|
|
19715
|
-
return result;
|
|
19716
|
-
};
|
|
19717
|
-
} else if (slotPropValue) {
|
|
19718
|
-
overrideProps[propName] = slotPropValue;
|
|
19719
|
-
}
|
|
19720
|
-
} else if (propName === "style") {
|
|
19721
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
19722
|
-
} else if (propName === "className") {
|
|
19723
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
19724
|
-
}
|
|
19725
|
-
}
|
|
19726
|
-
return { ...slotProps, ...overrideProps };
|
|
19727
|
-
}
|
|
19728
|
-
function getElementRef$1(element) {
|
|
19729
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
19730
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
19731
|
-
if (mayWarn) {
|
|
19732
|
-
return element.ref;
|
|
19733
|
-
}
|
|
19734
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
19735
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
19736
|
-
if (mayWarn) {
|
|
19737
|
-
return element.props.ref;
|
|
19738
|
-
}
|
|
19739
|
-
return element.props.ref || element.ref;
|
|
19740
|
-
}
|
|
19741
|
-
|
|
19742
|
-
// src/primitive.tsx
|
|
19743
|
-
var NODES = [
|
|
19744
|
-
"a",
|
|
19745
|
-
"button",
|
|
19746
|
-
"div",
|
|
19747
|
-
"form",
|
|
19748
|
-
"h2",
|
|
19749
|
-
"h3",
|
|
19750
|
-
"img",
|
|
19751
|
-
"input",
|
|
19752
|
-
"label",
|
|
19753
|
-
"li",
|
|
19754
|
-
"nav",
|
|
19755
|
-
"ol",
|
|
19756
|
-
"p",
|
|
19757
|
-
"select",
|
|
19758
|
-
"span",
|
|
19759
|
-
"svg",
|
|
19760
|
-
"ul"
|
|
19761
|
-
];
|
|
19762
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
19763
|
-
const Slot = createSlot(`Primitive.${node}`);
|
|
19764
|
-
const Node = React.forwardRef((props, forwardedRef) => {
|
|
19765
|
-
const { asChild, ...primitiveProps } = props;
|
|
19766
|
-
const Comp = asChild ? Slot : node;
|
|
19767
|
-
if (typeof window !== "undefined") {
|
|
19768
|
-
window[Symbol.for("radix-ui")] = true;
|
|
19769
|
-
}
|
|
19770
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
19771
|
-
});
|
|
19772
|
-
Node.displayName = `Primitive.${node}`;
|
|
19773
|
-
return { ...primitive, [node]: Node };
|
|
19774
|
-
}, {});
|
|
19775
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
19776
|
-
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
19777
|
-
}
|
|
19778
|
-
|
|
19779
19266
|
// packages/react/use-callback-ref/src/use-callback-ref.tsx
|
|
19780
19267
|
function useCallbackRef$1(callback) {
|
|
19781
19268
|
const callbackRef = React.useRef(callback);
|
|
@@ -20279,7 +19766,7 @@ function usePresence(present) {
|
|
|
20279
19766
|
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
20280
19767
|
const handleAnimationEnd = (event) => {
|
|
20281
19768
|
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
20282
|
-
const isCurrentAnimation = currentAnimationName.includes(
|
|
19769
|
+
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
20283
19770
|
if (event.target === node && isCurrentAnimation) {
|
|
20284
19771
|
send("ANIMATION_END");
|
|
20285
19772
|
if (!prevPresentRef.current) {
|
|
@@ -21195,7 +20682,7 @@ var hideOthers = function (originalTarget, parentNode, markerName) {
|
|
|
21195
20682
|
};
|
|
21196
20683
|
|
|
21197
20684
|
var DIALOG_NAME = "Dialog";
|
|
21198
|
-
var [createDialogContext] = createContextScope(DIALOG_NAME);
|
|
20685
|
+
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
21199
20686
|
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
21200
20687
|
var Dialog = (props) => {
|
|
21201
20688
|
const {
|
|
@@ -21493,7 +20980,7 @@ var Portal = DialogPortal;
|
|
|
21493
20980
|
var Overlay = DialogOverlay;
|
|
21494
20981
|
var Content$1 = DialogContent;
|
|
21495
20982
|
|
|
21496
|
-
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"};
|
|
21497
20984
|
|
|
21498
20985
|
/**
|
|
21499
20986
|
* @license lucide-react v0.479.0 - ISC
|
|
@@ -22225,7 +21712,7 @@ const flip$2 = function (options) {
|
|
|
22225
21712
|
if (!ignoreCrossAxisOverflow ||
|
|
22226
21713
|
// We leave the current main axis only if every placement on that axis
|
|
22227
21714
|
// overflows the main axis.
|
|
22228
|
-
overflowsData.every(d =>
|
|
21715
|
+
overflowsData.every(d => d.overflows[0] > 0 && getSideAxis(d.placement) === initialSideAxis)) {
|
|
22229
21716
|
// Try next placement and re-run the lifecycle.
|
|
22230
21717
|
return {
|
|
22231
21718
|
data: {
|
|
@@ -22964,9 +22451,14 @@ function getWindowScrollBarX(element, rect) {
|
|
|
22964
22451
|
return rect.left + leftScroll;
|
|
22965
22452
|
}
|
|
22966
22453
|
|
|
22967
|
-
function getHTMLOffset(documentElement, scroll) {
|
|
22454
|
+
function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
|
|
22455
|
+
if (ignoreScrollbarX === void 0) {
|
|
22456
|
+
ignoreScrollbarX = false;
|
|
22457
|
+
}
|
|
22968
22458
|
const htmlRect = documentElement.getBoundingClientRect();
|
|
22969
|
-
const x = htmlRect.left + scroll.scrollLeft -
|
|
22459
|
+
const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
|
|
22460
|
+
// RTL <body> scrollbar.
|
|
22461
|
+
getWindowScrollBarX(documentElement, htmlRect));
|
|
22970
22462
|
const y = htmlRect.top + scroll.scrollTop;
|
|
22971
22463
|
return {
|
|
22972
22464
|
x,
|
|
@@ -23005,7 +22497,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
23005
22497
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
23006
22498
|
}
|
|
23007
22499
|
}
|
|
23008
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
22500
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
|
|
23009
22501
|
return {
|
|
23010
22502
|
width: rect.width * scale.x,
|
|
23011
22503
|
height: rect.height * scale.y,
|
|
@@ -23039,10 +22531,6 @@ function getDocumentRect(element) {
|
|
|
23039
22531
|
};
|
|
23040
22532
|
}
|
|
23041
22533
|
|
|
23042
|
-
// Safety check: ensure the scrollbar space is reasonable in case this
|
|
23043
|
-
// calculation is affected by unusual styles.
|
|
23044
|
-
// Most scrollbars leave 15-18px of space.
|
|
23045
|
-
const SCROLLBAR_MAX = 25;
|
|
23046
22534
|
function getViewportRect(element, strategy) {
|
|
23047
22535
|
const win = getWindow(element);
|
|
23048
22536
|
const html = getDocumentElement(element);
|
|
@@ -23060,24 +22548,6 @@ function getViewportRect(element, strategy) {
|
|
|
23060
22548
|
y = visualViewport.offsetTop;
|
|
23061
22549
|
}
|
|
23062
22550
|
}
|
|
23063
|
-
const windowScrollbarX = getWindowScrollBarX(html);
|
|
23064
|
-
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
|
23065
|
-
// visual width of the <html> but this is not considered in the size
|
|
23066
|
-
// of `html.clientWidth`.
|
|
23067
|
-
if (windowScrollbarX <= 0) {
|
|
23068
|
-
const doc = html.ownerDocument;
|
|
23069
|
-
const body = doc.body;
|
|
23070
|
-
const bodyStyles = getComputedStyle(body);
|
|
23071
|
-
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
23072
|
-
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
23073
|
-
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
23074
|
-
width -= clippingStableScrollbarWidth;
|
|
23075
|
-
}
|
|
23076
|
-
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
23077
|
-
// If the <body> scrollbar is on the left, the width needs to be extended
|
|
23078
|
-
// by the scrollbar amount so there isn't extra space on the right.
|
|
23079
|
-
width += windowScrollbarX;
|
|
23080
|
-
}
|
|
23081
22551
|
return {
|
|
23082
22552
|
width,
|
|
23083
22553
|
height,
|
|
@@ -23988,13 +23458,8 @@ var PopperAnchor = React.forwardRef(
|
|
|
23988
23458
|
const context = usePopperContext(ANCHOR_NAME$1, __scopePopper);
|
|
23989
23459
|
const ref = React.useRef(null);
|
|
23990
23460
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
23991
|
-
const anchorRef = React.useRef(null);
|
|
23992
23461
|
React.useEffect(() => {
|
|
23993
|
-
|
|
23994
|
-
anchorRef.current = virtualRef?.current || ref.current;
|
|
23995
|
-
if (previousAnchor !== anchorRef.current) {
|
|
23996
|
-
context.onAnchorChange(anchorRef.current);
|
|
23997
|
-
}
|
|
23462
|
+
context.onAnchorChange(virtualRef?.current || ref.current);
|
|
23998
23463
|
});
|
|
23999
23464
|
return virtualRef ? null : /* @__PURE__ */ jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
24000
23465
|
}
|
|
@@ -24243,7 +23708,7 @@ var Content = PopperContent;
|
|
|
24243
23708
|
var Arrow = PopperArrow;
|
|
24244
23709
|
|
|
24245
23710
|
var POPOVER_NAME = "Popover";
|
|
24246
|
-
var [createPopoverContext] = createContextScope(POPOVER_NAME, [
|
|
23711
|
+
var [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [
|
|
24247
23712
|
createPopperScope
|
|
24248
23713
|
]);
|
|
24249
23714
|
var usePopperScope = createPopperScope();
|
|
@@ -30344,7 +29809,7 @@ var frRawCountries = [
|
|
|
30344
29809
|
id: 704,
|
|
30345
29810
|
alpha2: "vn",
|
|
30346
29811
|
alpha3: "vnm",
|
|
30347
|
-
name: "
|
|
29812
|
+
name: "Viêt Nam"
|
|
30348
29813
|
},
|
|
30349
29814
|
{
|
|
30350
29815
|
id: 887,
|
|
@@ -36456,10 +35921,10 @@ var hasRequiredReactStripe_umd;
|
|
|
36456
35921
|
function requireReactStripe_umd () {
|
|
36457
35922
|
if (hasRequiredReactStripe_umd) return reactStripe_umd$1.exports;
|
|
36458
35923
|
hasRequiredReactStripe_umd = 1;
|
|
36459
|
-
(function (module, exports
|
|
35924
|
+
(function (module, exports) {
|
|
36460
35925
|
(function (global, factory) {
|
|
36461
|
-
factory(exports
|
|
36462
|
-
})(reactStripe_umd, (function (exports
|
|
35926
|
+
factory(exports, React__default) ;
|
|
35927
|
+
})(reactStripe_umd, (function (exports, React) {
|
|
36463
35928
|
function ownKeys(object, enumerableOnly) {
|
|
36464
35929
|
var keys = Object.keys(object);
|
|
36465
35930
|
|
|
@@ -36894,12 +36359,12 @@ function requireReactStripe_umd () {
|
|
|
36894
36359
|
|
|
36895
36360
|
stripe._registerWrapper({
|
|
36896
36361
|
name: 'react-stripe-js',
|
|
36897
|
-
version: "3.
|
|
36362
|
+
version: "3.7.0"
|
|
36898
36363
|
});
|
|
36899
36364
|
|
|
36900
36365
|
stripe.registerAppInfo({
|
|
36901
36366
|
name: 'react-stripe-js',
|
|
36902
|
-
version: "3.
|
|
36367
|
+
version: "3.7.0",
|
|
36903
36368
|
url: 'https://stripe.com/docs/stripe-js/react'
|
|
36904
36369
|
});
|
|
36905
36370
|
};
|
|
@@ -36921,7 +36386,7 @@ function requireReactStripe_umd () {
|
|
|
36921
36386
|
* The `loadStripe` function will asynchronously load the Stripe.js script and initialize a `Stripe` object.
|
|
36922
36387
|
* Pass the returned `Promise` to `Elements`.
|
|
36923
36388
|
*
|
|
36924
|
-
* @docs https://
|
|
36389
|
+
* @docs https://stripe.com/docs/stripe-js/react#elements-provider
|
|
36925
36390
|
*/
|
|
36926
36391
|
|
|
36927
36392
|
var Elements = function Elements(_ref) {
|
|
@@ -37144,30 +36609,20 @@ function requireReactStripe_umd () {
|
|
|
37144
36609
|
var prevOptions = usePrevious(options);
|
|
37145
36610
|
var prevCheckoutSdk = usePrevious(ctx.checkoutSdk);
|
|
37146
36611
|
React.useEffect(function () {
|
|
37147
|
-
var _prevOptions$elements, _options$elementsOpti
|
|
36612
|
+
var _prevOptions$elements, _options$elementsOpti;
|
|
37148
36613
|
|
|
37149
36614
|
// Ignore changes while checkout sdk is not initialized.
|
|
37150
36615
|
if (!ctx.checkoutSdk) {
|
|
37151
36616
|
return;
|
|
37152
36617
|
}
|
|
37153
36618
|
|
|
37154
|
-
var hasSdkLoaded = Boolean(!prevCheckoutSdk && ctx.checkoutSdk); // Handle appearance changes
|
|
37155
|
-
|
|
37156
36619
|
var previousAppearance = prevOptions === null || prevOptions === void 0 ? void 0 : (_prevOptions$elements = prevOptions.elementsOptions) === null || _prevOptions$elements === void 0 ? void 0 : _prevOptions$elements.appearance;
|
|
37157
36620
|
var currentAppearance = options === null || options === void 0 ? void 0 : (_options$elementsOpti = options.elementsOptions) === null || _options$elementsOpti === void 0 ? void 0 : _options$elementsOpti.appearance;
|
|
37158
36621
|
var hasAppearanceChanged = !isEqual(currentAppearance, previousAppearance);
|
|
36622
|
+
var hasSdkLoaded = !prevCheckoutSdk && ctx.checkoutSdk;
|
|
37159
36623
|
|
|
37160
36624
|
if (currentAppearance && (hasAppearanceChanged || hasSdkLoaded)) {
|
|
37161
36625
|
ctx.checkoutSdk.changeAppearance(currentAppearance);
|
|
37162
|
-
} // Handle fonts changes
|
|
37163
|
-
|
|
37164
|
-
|
|
37165
|
-
var previousFonts = prevOptions === null || prevOptions === void 0 ? void 0 : (_prevOptions$elements2 = prevOptions.elementsOptions) === null || _prevOptions$elements2 === void 0 ? void 0 : _prevOptions$elements2.fonts;
|
|
37166
|
-
var currentFonts = options === null || options === void 0 ? void 0 : (_options$elementsOpti2 = options.elementsOptions) === null || _options$elementsOpti2 === void 0 ? void 0 : _options$elementsOpti2.fonts;
|
|
37167
|
-
var hasFontsChanged = !isEqual(previousFonts, currentFonts);
|
|
37168
|
-
|
|
37169
|
-
if (currentFonts && (hasFontsChanged || hasSdkLoaded)) {
|
|
37170
|
-
ctx.checkoutSdk.loadFonts(currentFonts);
|
|
37171
36626
|
}
|
|
37172
36627
|
}, [options, prevOptions, ctx.checkoutSdk, prevCheckoutSdk]); // Attach react-stripe-js version to stripe.js instance
|
|
37173
36628
|
|
|
@@ -37251,9 +36706,7 @@ function requireReactStripe_umd () {
|
|
|
37251
36706
|
onConfirm = _ref.onConfirm,
|
|
37252
36707
|
onCancel = _ref.onCancel,
|
|
37253
36708
|
onShippingAddressChange = _ref.onShippingAddressChange,
|
|
37254
|
-
onShippingRateChange = _ref.onShippingRateChange
|
|
37255
|
-
onSavedPaymentMethodRemove = _ref.onSavedPaymentMethodRemove,
|
|
37256
|
-
onSavedPaymentMethodUpdate = _ref.onSavedPaymentMethodUpdate;
|
|
36709
|
+
onShippingRateChange = _ref.onShippingRateChange;
|
|
37257
36710
|
var ctx = useElementsOrCheckoutSdkContextWithUseCase("mounts <".concat(displayName, ">"));
|
|
37258
36711
|
var elements = 'elements' in ctx ? ctx.elements : null;
|
|
37259
36712
|
var checkoutSdk = 'checkoutSdk' in ctx ? ctx.checkoutSdk : null;
|
|
@@ -37279,8 +36732,6 @@ function requireReactStripe_umd () {
|
|
|
37279
36732
|
useAttachEvent(element, 'cancel', onCancel);
|
|
37280
36733
|
useAttachEvent(element, 'shippingaddresschange', onShippingAddressChange);
|
|
37281
36734
|
useAttachEvent(element, 'shippingratechange', onShippingRateChange);
|
|
37282
|
-
useAttachEvent(element, 'savedpaymentmethodremove', onSavedPaymentMethodRemove);
|
|
37283
|
-
useAttachEvent(element, 'savedpaymentmethodupdate', onSavedPaymentMethodUpdate);
|
|
37284
36735
|
useAttachEvent(element, 'change', onChange);
|
|
37285
36736
|
var readyCallback;
|
|
37286
36737
|
|
|
@@ -37333,10 +36784,6 @@ function requireReactStripe_umd () {
|
|
|
37333
36784
|
newElement = checkoutSdk.createCurrencySelectorElement();
|
|
37334
36785
|
break;
|
|
37335
36786
|
|
|
37336
|
-
case 'taxId':
|
|
37337
|
-
newElement = checkoutSdk.createTaxIdElement(options);
|
|
37338
|
-
break;
|
|
37339
|
-
|
|
37340
36787
|
default:
|
|
37341
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 />."));
|
|
37342
36789
|
}
|
|
@@ -37412,8 +36859,6 @@ function requireReactStripe_umd () {
|
|
|
37412
36859
|
onCancel: PropTypes.func,
|
|
37413
36860
|
onShippingAddressChange: PropTypes.func,
|
|
37414
36861
|
onShippingRateChange: PropTypes.func,
|
|
37415
|
-
onSavedPaymentMethodRemove: PropTypes.func,
|
|
37416
|
-
onSavedPaymentMethodUpdate: PropTypes.func,
|
|
37417
36862
|
options: PropTypes.object
|
|
37418
36863
|
};
|
|
37419
36864
|
Element.displayName = displayName;
|
|
@@ -37721,42 +37166,35 @@ function requireReactStripe_umd () {
|
|
|
37721
37166
|
*/
|
|
37722
37167
|
|
|
37723
37168
|
var AfterpayClearpayMessageElement = createElementComponent('afterpayClearpayMessage', isServer);
|
|
37724
|
-
/**
|
|
37725
|
-
* Requires beta access:
|
|
37726
|
-
* Contact [Stripe support](https://support.stripe.com/) for more information.
|
|
37727
|
-
*/
|
|
37728
37169
|
|
|
37729
|
-
|
|
37730
|
-
|
|
37731
|
-
exports
|
|
37732
|
-
exports
|
|
37733
|
-
exports
|
|
37734
|
-
exports
|
|
37735
|
-
exports
|
|
37736
|
-
exports
|
|
37737
|
-
exports
|
|
37738
|
-
exports
|
|
37739
|
-
exports
|
|
37740
|
-
exports
|
|
37741
|
-
exports
|
|
37742
|
-
exports
|
|
37743
|
-
exports
|
|
37744
|
-
exports
|
|
37745
|
-
exports
|
|
37746
|
-
exports
|
|
37747
|
-
exports
|
|
37748
|
-
exports
|
|
37749
|
-
exports
|
|
37750
|
-
exports
|
|
37751
|
-
exports
|
|
37752
|
-
exports
|
|
37753
|
-
exports
|
|
37754
|
-
exports
|
|
37755
|
-
exports
|
|
37756
|
-
exports
|
|
37757
|
-
exports$1.useCheckout = useCheckout;
|
|
37758
|
-
exports$1.useElements = useElements;
|
|
37759
|
-
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;
|
|
37760
37198
|
|
|
37761
37199
|
}));
|
|
37762
37200
|
} (reactStripe_umd$1, reactStripe_umd$1.exports));
|
|
@@ -37961,7 +37399,7 @@ const useCheckout = create((set) => ({
|
|
|
37961
37399
|
setPaymentMethod: (paymentMethod) => set({ paymentMethod }),
|
|
37962
37400
|
}));
|
|
37963
37401
|
|
|
37964
|
-
const CheckoutForm$
|
|
37402
|
+
const CheckoutForm$1 = ({ onSuccess, onError, children, setSubmitting, }) => {
|
|
37965
37403
|
const stripe = reactStripe_umdExports.useStripe();
|
|
37966
37404
|
const elements = reactStripe_umdExports.useElements();
|
|
37967
37405
|
const { setIsSubmitting, setPaymentMethod } = useCheckout();
|
|
@@ -37996,9 +37434,9 @@ const CheckoutForm$2 = ({ onSuccess, onError, children, setSubmitting, }) => {
|
|
|
37996
37434
|
});
|
|
37997
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] }));
|
|
37998
37436
|
};
|
|
37999
|
-
var CheckoutForm$
|
|
37437
|
+
var CheckoutForm$2 = memo(CheckoutForm$1);
|
|
38000
37438
|
|
|
38001
|
-
function PaymentElement
|
|
37439
|
+
function PaymentElement({ paymentSecret, publicKey, checkoutAppearance, locale, fonts, onSuccess, onError, children, setSubmitting, }) {
|
|
38002
37440
|
const stripePromise = loadStripe(publicKey !== null && publicKey !== void 0 ? publicKey : "");
|
|
38003
37441
|
const options = {
|
|
38004
37442
|
locale: locale !== null && locale !== void 0 ? locale : "en",
|
|
@@ -38006,9 +37444,9 @@ function PaymentElement$1({ paymentSecret, publicKey, checkoutAppearance, locale
|
|
|
38006
37444
|
clientSecret: paymentSecret,
|
|
38007
37445
|
fonts: fonts,
|
|
38008
37446
|
};
|
|
38009
|
-
return (jsx(reactStripe_umdExports.Elements, { stripe: stripePromise, options: options, children: jsx(CheckoutForm$
|
|
37447
|
+
return (jsx(reactStripe_umdExports.Elements, { stripe: stripePromise, options: options, children: jsx(CheckoutForm$2, { onSuccess: onSuccess, onError: onError, setSubmitting: setSubmitting, children: children }) }));
|
|
38010
37448
|
}
|
|
38011
|
-
var PaymentElement = memo(PaymentElement
|
|
37449
|
+
var PaymentElement$1 = memo(PaymentElement);
|
|
38012
37450
|
|
|
38013
37451
|
const parseNumber = (color, len) => {
|
|
38014
37452
|
if (typeof color !== 'number') return;
|
|
@@ -42690,7 +42128,7 @@ function PaymentForm({ paymentSecret, onSuccess, onError, onBack, onDoubleBack,
|
|
|
42690
42128
|
const renderButtonIcon = () => {
|
|
42691
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;
|
|
42692
42130
|
};
|
|
42693
|
-
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, { 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)) })] }));
|
|
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)) })] }));
|
|
42694
42132
|
}
|
|
42695
42133
|
|
|
42696
42134
|
function Skeleton(_a) {
|
|
@@ -42985,6 +42423,7 @@ function CheckoutForm({ storeClient, checkoutId, onSuccess, onError, cancelUrl,
|
|
|
42985
42423
|
pickupPointId: shipmentFormData.pickupPointId,
|
|
42986
42424
|
},
|
|
42987
42425
|
}));
|
|
42426
|
+
console.log("UPDATING CHECKOUT WITH SHIPMENTS: ", shipments);
|
|
42988
42427
|
yield storeClient.updateCheckout(clientSecret, checkoutId, {
|
|
42989
42428
|
shipments,
|
|
42990
42429
|
});
|