@orderingstack/front-components-product-configurator 1.4.0 → 1.4.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Counter/Counter.d.ts +1 -2
- package/dist/components/Counter/Counter.d.ts.map +1 -1
- package/dist/components/DisplayState/DisplayState.d.ts +1 -2
- package/dist/components/DisplayState/DisplayState.d.ts.map +1 -1
- package/dist/components/GroupStateInfo/GroupStateInfo.d.ts +1 -2
- package/dist/components/GroupStateInfo/GroupStateInfo.d.ts.map +1 -1
- package/dist/components/InfoLine/InfoLine.d.ts +1 -2
- package/dist/components/InfoLine/InfoLine.d.ts.map +1 -1
- package/dist/components/MenuItemsDispatcher/MenuItemsDispatcher.d.ts +2 -3
- package/dist/components/MenuItemsDispatcher/MenuItemsDispatcher.d.ts.map +1 -1
- package/dist/components/MenuOptions/MenuOptions.d.ts +1 -2
- package/dist/components/MenuOptions/MenuOptions.d.ts.map +1 -1
- package/dist/components/MenuOptions/MenuOptionsDefaultUI.d.ts +1 -2
- package/dist/components/MenuOptions/MenuOptionsDefaultUI.d.ts.map +1 -1
- package/dist/components/MenuProduct/MenuProduct.d.ts +2 -3
- package/dist/components/MenuProduct/MenuProduct.d.ts.map +1 -1
- package/dist/components/MenuProductRoot/MenuProductRoot.d.ts +1 -2
- package/dist/components/MenuProductRoot/MenuProductRoot.d.ts.map +1 -1
- package/dist/components/MenuProductRoot/MenuProductRootDefaultUI.d.ts +1 -2
- package/dist/components/MenuProductRoot/MenuProductRootDefaultUI.d.ts.map +1 -1
- package/dist/components/MenuProductRoot/MenuProductRootDefaultUIModal.d.ts +1 -2
- package/dist/components/MenuProductRoot/MenuProductRootDefaultUIModal.d.ts.map +1 -1
- package/dist/components/Price/Price.d.ts +1 -2
- package/dist/components/Price/Price.d.ts.map +1 -1
- package/dist/components/ProductConfigurator/ProductConfigurator.d.ts +1 -2
- package/dist/components/ProductConfigurator/ProductConfigurator.d.ts.map +1 -1
- package/dist/components/SimpleCheckbox/SimpleCheckbox.d.ts +1 -2
- package/dist/components/SimpleCheckbox/SimpleCheckbox.d.ts.map +1 -1
- package/dist/components/SimpleRadio/SimpleRadio.d.ts +1 -2
- package/dist/components/SimpleRadio/SimpleRadio.d.ts.map +1 -1
- package/dist/components/SubmitRow/SubmitRow.d.ts +1 -2
- package/dist/components/SubmitRow/SubmitRow.d.ts.map +1 -1
- package/dist/context/ProductData.d.ts +1 -1
- package/dist/context/ProductData.d.ts.map +1 -1
- package/dist/hooks/useEmitFilter.d.ts.map +1 -1
- package/dist/index.cjs.js +7 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1723 -1299
- package/dist/index.es.js.map +1 -1
- package/dist/state/index.d.ts +1 -1
- package/dist/state/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +6 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/filter.d.ts.map +1 -1
- package/dist/utils/setSelected.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,148 +1,118 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React__default, { useReducer, useRef, useDebugValue, useEffect, useLayoutEffect, useState, useMemo, createContext, useContext, forwardRef, Fragment as Fragment$1, isValidElement, cloneElement, createElement, createRef, useCallback } from "react";
|
|
2
3
|
import { useTransition, animated } from "react-spring";
|
|
3
4
|
import { createPortal } from "react-dom";
|
|
4
5
|
var tailwind = "";
|
|
5
6
|
var main = "";
|
|
6
|
-
function _typeof$1(
|
|
7
|
+
function _typeof$1(o2) {
|
|
7
8
|
"@babel/helpers - typeof";
|
|
8
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(
|
|
9
|
-
return typeof
|
|
10
|
-
} : function(
|
|
11
|
-
return
|
|
12
|
-
}, _typeof$1(
|
|
13
|
-
}
|
|
14
|
-
function _classCallCheck(
|
|
15
|
-
if (!(
|
|
9
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) {
|
|
10
|
+
return typeof o3;
|
|
11
|
+
} : function(o3) {
|
|
12
|
+
return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3;
|
|
13
|
+
}, _typeof$1(o2);
|
|
14
|
+
}
|
|
15
|
+
function _classCallCheck(a2, n2) {
|
|
16
|
+
if (!(a2 instanceof n2))
|
|
16
17
|
throw new TypeError("Cannot call a class as a function");
|
|
17
|
-
}
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
if (_typeof$1(
|
|
21
|
-
return
|
|
22
|
-
var
|
|
23
|
-
if (
|
|
24
|
-
var
|
|
25
|
-
if (_typeof$1(
|
|
26
|
-
return
|
|
19
|
+
function toPrimitive(t2, r2) {
|
|
20
|
+
if ("object" != _typeof$1(t2) || !t2)
|
|
21
|
+
return t2;
|
|
22
|
+
var e2 = t2[Symbol.toPrimitive];
|
|
23
|
+
if (void 0 !== e2) {
|
|
24
|
+
var i2 = e2.call(t2, r2 || "default");
|
|
25
|
+
if ("object" != _typeof$1(i2))
|
|
26
|
+
return i2;
|
|
27
27
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
28
28
|
}
|
|
29
|
-
return (
|
|
29
|
+
return ("string" === r2 ? String : Number)(t2);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
var
|
|
33
|
-
return _typeof$1(
|
|
31
|
+
function toPropertyKey(t2) {
|
|
32
|
+
var i2 = toPrimitive(t2, "string");
|
|
33
|
+
return "symbol" == _typeof$1(i2) ? i2 : i2 + "";
|
|
34
34
|
}
|
|
35
|
-
function _defineProperties(
|
|
36
|
-
for (var
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
descriptor.configurable = true;
|
|
40
|
-
if ("value" in descriptor)
|
|
41
|
-
descriptor.writable = true;
|
|
42
|
-
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
35
|
+
function _defineProperties(e2, r2) {
|
|
36
|
+
for (var t2 = 0; t2 < r2.length; t2++) {
|
|
37
|
+
var o2 = r2[t2];
|
|
38
|
+
o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, toPropertyKey(o2.key), o2);
|
|
43
39
|
}
|
|
44
40
|
}
|
|
45
|
-
function _createClass(
|
|
46
|
-
|
|
47
|
-
_defineProperties(Constructor.prototype, protoProps);
|
|
48
|
-
if (staticProps)
|
|
49
|
-
_defineProperties(Constructor, staticProps);
|
|
50
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
41
|
+
function _createClass(e2, r2, t2) {
|
|
42
|
+
return r2 && _defineProperties(e2.prototype, r2), t2 && _defineProperties(e2, t2), Object.defineProperty(e2, "prototype", {
|
|
51
43
|
writable: false
|
|
52
|
-
});
|
|
53
|
-
return Constructor;
|
|
44
|
+
}), e2;
|
|
54
45
|
}
|
|
55
|
-
function _assertThisInitialized(
|
|
56
|
-
if (
|
|
46
|
+
function _assertThisInitialized(e2) {
|
|
47
|
+
if (void 0 === e2)
|
|
57
48
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
58
|
-
|
|
59
|
-
return self2;
|
|
49
|
+
return e2;
|
|
60
50
|
}
|
|
61
|
-
function _setPrototypeOf(
|
|
62
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
};
|
|
66
|
-
return _setPrototypeOf(o2, p2);
|
|
51
|
+
function _setPrototypeOf(t2, e2) {
|
|
52
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t3, e3) {
|
|
53
|
+
return t3.__proto__ = e3, t3;
|
|
54
|
+
}, _setPrototypeOf(t2, e2);
|
|
67
55
|
}
|
|
68
|
-
function _inherits(
|
|
69
|
-
if (
|
|
56
|
+
function _inherits(t2, e2) {
|
|
57
|
+
if ("function" != typeof e2 && null !== e2)
|
|
70
58
|
throw new TypeError("Super expression must either be null or a function");
|
|
71
|
-
|
|
72
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
59
|
+
t2.prototype = Object.create(e2 && e2.prototype, {
|
|
73
60
|
constructor: {
|
|
74
|
-
value:
|
|
61
|
+
value: t2,
|
|
75
62
|
writable: true,
|
|
76
63
|
configurable: true
|
|
77
64
|
}
|
|
78
|
-
})
|
|
79
|
-
Object.defineProperty(subClass, "prototype", {
|
|
65
|
+
}), Object.defineProperty(t2, "prototype", {
|
|
80
66
|
writable: false
|
|
81
|
-
});
|
|
82
|
-
if (superClass)
|
|
83
|
-
_setPrototypeOf(subClass, superClass);
|
|
67
|
+
}), e2 && _setPrototypeOf(t2, e2);
|
|
84
68
|
}
|
|
85
|
-
function _possibleConstructorReturn(
|
|
86
|
-
if (
|
|
87
|
-
return
|
|
88
|
-
|
|
69
|
+
function _possibleConstructorReturn(t2, e2) {
|
|
70
|
+
if (e2 && ("object" == _typeof$1(e2) || "function" == typeof e2))
|
|
71
|
+
return e2;
|
|
72
|
+
if (void 0 !== e2)
|
|
89
73
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
} else {
|
|
109
|
-
obj[key] = value;
|
|
110
|
-
}
|
|
111
|
-
return obj;
|
|
112
|
-
}
|
|
113
|
-
function _arrayWithHoles$1(arr2) {
|
|
114
|
-
if (Array.isArray(arr2))
|
|
115
|
-
return arr2;
|
|
74
|
+
return _assertThisInitialized(t2);
|
|
75
|
+
}
|
|
76
|
+
function _getPrototypeOf(t2) {
|
|
77
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t3) {
|
|
78
|
+
return t3.__proto__ || Object.getPrototypeOf(t3);
|
|
79
|
+
}, _getPrototypeOf(t2);
|
|
80
|
+
}
|
|
81
|
+
function _defineProperty(e2, r2, t2) {
|
|
82
|
+
return (r2 = toPropertyKey(r2)) in e2 ? Object.defineProperty(e2, r2, {
|
|
83
|
+
value: t2,
|
|
84
|
+
enumerable: true,
|
|
85
|
+
configurable: true,
|
|
86
|
+
writable: true
|
|
87
|
+
}) : e2[r2] = t2, e2;
|
|
88
|
+
}
|
|
89
|
+
function _arrayWithHoles$1(r2) {
|
|
90
|
+
if (Array.isArray(r2))
|
|
91
|
+
return r2;
|
|
116
92
|
}
|
|
117
|
-
function _iterableToArray$1(
|
|
118
|
-
if (typeof Symbol
|
|
119
|
-
return Array.from(
|
|
93
|
+
function _iterableToArray$1(r2) {
|
|
94
|
+
if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"])
|
|
95
|
+
return Array.from(r2);
|
|
120
96
|
}
|
|
121
|
-
function _arrayLikeToArray$1(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return arr22;
|
|
97
|
+
function _arrayLikeToArray$1(r2, a2) {
|
|
98
|
+
(null == a2 || a2 > r2.length) && (a2 = r2.length);
|
|
99
|
+
for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++)
|
|
100
|
+
n2[e2] = r2[e2];
|
|
101
|
+
return n2;
|
|
127
102
|
}
|
|
128
|
-
function _unsupportedIterableToArray$1(
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
n2 = o2.constructor.name;
|
|
136
|
-
if (n2 === "Map" || n2 === "Set")
|
|
137
|
-
return Array.from(o2);
|
|
138
|
-
if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2))
|
|
139
|
-
return _arrayLikeToArray$1(o2, minLen);
|
|
103
|
+
function _unsupportedIterableToArray$1(r2, a2) {
|
|
104
|
+
if (r2) {
|
|
105
|
+
if ("string" == typeof r2)
|
|
106
|
+
return _arrayLikeToArray$1(r2, a2);
|
|
107
|
+
var t2 = {}.toString.call(r2).slice(8, -1);
|
|
108
|
+
return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray$1(r2, a2) : void 0;
|
|
109
|
+
}
|
|
140
110
|
}
|
|
141
111
|
function _nonIterableRest$1() {
|
|
142
112
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
143
113
|
}
|
|
144
|
-
function _toArray$1(
|
|
145
|
-
return _arrayWithHoles$1(
|
|
114
|
+
function _toArray$1(r2) {
|
|
115
|
+
return _arrayWithHoles$1(r2) || _iterableToArray$1(r2) || _unsupportedIterableToArray$1(r2) || _nonIterableRest$1();
|
|
146
116
|
}
|
|
147
117
|
function ownKeys$2(object, enumerableOnly) {
|
|
148
118
|
var keys2 = Object.keys(object);
|
|
@@ -434,13 +404,13 @@ var chars = [" ", ",", "?", "!", ";"];
|
|
|
434
404
|
function looksLikeObjectPath(key, nsSeparator, keySeparator) {
|
|
435
405
|
nsSeparator = nsSeparator || "";
|
|
436
406
|
keySeparator = keySeparator || "";
|
|
437
|
-
var possibleChars = chars.filter(function(
|
|
438
|
-
return nsSeparator.indexOf(
|
|
407
|
+
var possibleChars = chars.filter(function(c2) {
|
|
408
|
+
return nsSeparator.indexOf(c2) < 0 && keySeparator.indexOf(c2) < 0;
|
|
439
409
|
});
|
|
440
410
|
if (possibleChars.length === 0)
|
|
441
411
|
return true;
|
|
442
|
-
var r2 = new RegExp("(".concat(possibleChars.map(function(
|
|
443
|
-
return
|
|
412
|
+
var r2 = new RegExp("(".concat(possibleChars.map(function(c2) {
|
|
413
|
+
return c2 === "?" ? "\\?" : c2;
|
|
444
414
|
}).join("|"), ")"));
|
|
445
415
|
var matched = !r2.test(key);
|
|
446
416
|
if (!matched) {
|
|
@@ -1298,13 +1268,13 @@ var LanguageUtil = function() {
|
|
|
1298
1268
|
var _this2 = this;
|
|
1299
1269
|
var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
|
|
1300
1270
|
var codes = [];
|
|
1301
|
-
var addCode = function addCode2(
|
|
1302
|
-
if (!
|
|
1271
|
+
var addCode = function addCode2(c2) {
|
|
1272
|
+
if (!c2)
|
|
1303
1273
|
return;
|
|
1304
|
-
if (_this2.isSupportedCode(
|
|
1305
|
-
codes.push(
|
|
1274
|
+
if (_this2.isSupportedCode(c2)) {
|
|
1275
|
+
codes.push(c2);
|
|
1306
1276
|
} else {
|
|
1307
|
-
_this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(
|
|
1277
|
+
_this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c2));
|
|
1308
1278
|
}
|
|
1309
1279
|
};
|
|
1310
1280
|
if (typeof code === "string" && code.indexOf("-") > -1) {
|
|
@@ -1801,9 +1771,9 @@ var Interpolator = function() {
|
|
|
1801
1771
|
var sep = this.nestingOptionsSeparator;
|
|
1802
1772
|
if (key.indexOf(sep) < 0)
|
|
1803
1773
|
return key;
|
|
1804
|
-
var
|
|
1805
|
-
var optionsString = "{".concat(
|
|
1806
|
-
key =
|
|
1774
|
+
var c2 = key.split(new RegExp("".concat(sep, "[ ]*{")));
|
|
1775
|
+
var optionsString = "{".concat(c2[1]);
|
|
1776
|
+
key = c2[0];
|
|
1807
1777
|
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
1808
1778
|
var matchedSingleQuotes = optionsString.match(/'/g);
|
|
1809
1779
|
var matchedDoubleQuotes = optionsString.match(/"/g);
|
|
@@ -2651,7 +2621,7 @@ var I18n = function(_EventEmitter) {
|
|
|
2651
2621
|
if (usedLng && usedLng.toLowerCase() === "cimode")
|
|
2652
2622
|
return usedCallback();
|
|
2653
2623
|
var toLoad = [];
|
|
2654
|
-
var
|
|
2624
|
+
var append = function append2(lng) {
|
|
2655
2625
|
if (!lng)
|
|
2656
2626
|
return;
|
|
2657
2627
|
var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
|
|
@@ -2663,14 +2633,14 @@ var I18n = function(_EventEmitter) {
|
|
|
2663
2633
|
if (!usedLng) {
|
|
2664
2634
|
var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
2665
2635
|
fallbacks.forEach(function(l2) {
|
|
2666
|
-
return
|
|
2636
|
+
return append(l2);
|
|
2667
2637
|
});
|
|
2668
2638
|
} else {
|
|
2669
|
-
|
|
2639
|
+
append(usedLng);
|
|
2670
2640
|
}
|
|
2671
2641
|
if (this.options.preload) {
|
|
2672
2642
|
this.options.preload.forEach(function(l2) {
|
|
2673
|
-
return
|
|
2643
|
+
return append(l2);
|
|
2674
2644
|
});
|
|
2675
2645
|
}
|
|
2676
2646
|
this.services.backendConnector.load(toLoad, this.options.ns, function(e2) {
|
|
@@ -3017,14 +2987,65 @@ var isObject$1 = (value) => !isNullOrUndefined(value) && !Array.isArray(value) &
|
|
|
3017
2987
|
var getEventValue = (event) => isObject$1(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
|
|
3018
2988
|
var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
|
|
3019
2989
|
var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
|
|
2990
|
+
var isPlainObject = (tempObject) => {
|
|
2991
|
+
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
2992
|
+
return isObject$1(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
2993
|
+
};
|
|
2994
|
+
var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
|
|
2995
|
+
function cloneObject(data) {
|
|
2996
|
+
let copy2;
|
|
2997
|
+
const isArray2 = Array.isArray(data);
|
|
2998
|
+
if (data instanceof Date) {
|
|
2999
|
+
copy2 = new Date(data);
|
|
3000
|
+
} else if (data instanceof Set) {
|
|
3001
|
+
copy2 = new Set(data);
|
|
3002
|
+
} else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray2 || isObject$1(data))) {
|
|
3003
|
+
copy2 = isArray2 ? [] : {};
|
|
3004
|
+
if (!isArray2 && !isPlainObject(data)) {
|
|
3005
|
+
copy2 = data;
|
|
3006
|
+
} else {
|
|
3007
|
+
for (const key in data) {
|
|
3008
|
+
if (data.hasOwnProperty(key)) {
|
|
3009
|
+
copy2[key] = cloneObject(data[key]);
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
}
|
|
3013
|
+
} else {
|
|
3014
|
+
return data;
|
|
3015
|
+
}
|
|
3016
|
+
return copy2;
|
|
3017
|
+
}
|
|
3020
3018
|
var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
|
|
3021
3019
|
var isUndefined$2 = (val) => val === void 0;
|
|
3022
|
-
var get = (
|
|
3023
|
-
if (!path2 || !isObject$1(
|
|
3020
|
+
var get = (object, path2, defaultValue) => {
|
|
3021
|
+
if (!path2 || !isObject$1(object)) {
|
|
3024
3022
|
return defaultValue;
|
|
3025
3023
|
}
|
|
3026
|
-
const result = compact(path2.split(/[,[\].]+?/)).reduce((result2, key) => isNullOrUndefined(result2) ? result2 : result2[key],
|
|
3027
|
-
return isUndefined$2(result) || result ===
|
|
3024
|
+
const result = compact(path2.split(/[,[\].]+?/)).reduce((result2, key) => isNullOrUndefined(result2) ? result2 : result2[key], object);
|
|
3025
|
+
return isUndefined$2(result) || result === object ? isUndefined$2(object[path2]) ? defaultValue : object[path2] : result;
|
|
3026
|
+
};
|
|
3027
|
+
var isBoolean = (value) => typeof value === "boolean";
|
|
3028
|
+
var isKey = (value) => /^\w*$/.test(value);
|
|
3029
|
+
var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
3030
|
+
var set = (object, path2, value) => {
|
|
3031
|
+
let index = -1;
|
|
3032
|
+
const tempPath = isKey(path2) ? [path2] : stringToPath(path2);
|
|
3033
|
+
const length = tempPath.length;
|
|
3034
|
+
const lastIndex = length - 1;
|
|
3035
|
+
while (++index < length) {
|
|
3036
|
+
const key = tempPath[index];
|
|
3037
|
+
let newValue = value;
|
|
3038
|
+
if (index !== lastIndex) {
|
|
3039
|
+
const objValue = object[key];
|
|
3040
|
+
newValue = isObject$1(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};
|
|
3041
|
+
}
|
|
3042
|
+
if (key === "__proto__") {
|
|
3043
|
+
return;
|
|
3044
|
+
}
|
|
3045
|
+
object[key] = newValue;
|
|
3046
|
+
object = object[key];
|
|
3047
|
+
}
|
|
3048
|
+
return object;
|
|
3028
3049
|
};
|
|
3029
3050
|
const EVENTS = {
|
|
3030
3051
|
BLUR: "blur",
|
|
@@ -3047,11 +3068,11 @@ const INPUT_VALIDATION_RULES = {
|
|
|
3047
3068
|
required: "required",
|
|
3048
3069
|
validate: "validate"
|
|
3049
3070
|
};
|
|
3050
|
-
const HookFormContext =
|
|
3051
|
-
const useFormContext = () =>
|
|
3071
|
+
const HookFormContext = React__default.createContext(null);
|
|
3072
|
+
const useFormContext = () => React__default.useContext(HookFormContext);
|
|
3052
3073
|
const FormProvider = (props) => {
|
|
3053
3074
|
const { children, ...data } = props;
|
|
3054
|
-
return
|
|
3075
|
+
return React__default.createElement(HookFormContext.Provider, { value: data }, children);
|
|
3055
3076
|
};
|
|
3056
3077
|
var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
|
|
3057
3078
|
const result = {
|
|
@@ -3072,17 +3093,18 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
3072
3093
|
return result;
|
|
3073
3094
|
};
|
|
3074
3095
|
var isEmptyObject = (value) => isObject$1(value) && !Object.keys(value).length;
|
|
3075
|
-
var shouldRenderFormState = (formStateData, _proxyFormState, isRoot) => {
|
|
3096
|
+
var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
|
|
3097
|
+
updateFormState(formStateData);
|
|
3076
3098
|
const { name, ...formState } = formStateData;
|
|
3077
3099
|
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
|
|
3078
3100
|
};
|
|
3079
3101
|
var convertToArrayPayload = (value) => Array.isArray(value) ? value : [value];
|
|
3080
|
-
var shouldSubscribeByName = (name, signalName, exact) =>
|
|
3102
|
+
var shouldSubscribeByName = (name, signalName, exact) => !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (exact ? currentName === signalName : currentName.startsWith(signalName) || signalName.startsWith(currentName)));
|
|
3081
3103
|
function useSubscribe(props) {
|
|
3082
|
-
const _props =
|
|
3104
|
+
const _props = React__default.useRef(props);
|
|
3083
3105
|
_props.current = props;
|
|
3084
|
-
|
|
3085
|
-
const subscription = !props.disabled && _props.current.subject.subscribe({
|
|
3106
|
+
React__default.useEffect(() => {
|
|
3107
|
+
const subscription = !props.disabled && _props.current.subject && _props.current.subject.subscribe({
|
|
3086
3108
|
next: _props.current.next
|
|
3087
3109
|
});
|
|
3088
3110
|
return () => {
|
|
@@ -3093,36 +3115,31 @@ function useSubscribe(props) {
|
|
|
3093
3115
|
function useFormState(props) {
|
|
3094
3116
|
const methods = useFormContext();
|
|
3095
3117
|
const { control = methods.control, disabled, name, exact } = props || {};
|
|
3096
|
-
const [formState, updateFormState] =
|
|
3097
|
-
const _mounted =
|
|
3098
|
-
const _localProxyFormState =
|
|
3118
|
+
const [formState, updateFormState] = React__default.useState(control._formState);
|
|
3119
|
+
const _mounted = React__default.useRef(true);
|
|
3120
|
+
const _localProxyFormState = React__default.useRef({
|
|
3099
3121
|
isDirty: false,
|
|
3100
3122
|
isLoading: false,
|
|
3101
3123
|
dirtyFields: false,
|
|
3102
3124
|
touchedFields: false,
|
|
3125
|
+
validatingFields: false,
|
|
3103
3126
|
isValidating: false,
|
|
3104
3127
|
isValid: false,
|
|
3105
3128
|
errors: false
|
|
3106
3129
|
});
|
|
3107
|
-
const _name =
|
|
3130
|
+
const _name = React__default.useRef(name);
|
|
3108
3131
|
_name.current = name;
|
|
3109
3132
|
useSubscribe({
|
|
3110
3133
|
disabled,
|
|
3111
|
-
next: (value) => _mounted.current && shouldSubscribeByName(_name.current, value.name, exact) && shouldRenderFormState(value, _localProxyFormState.current) && updateFormState({
|
|
3134
|
+
next: (value) => _mounted.current && shouldSubscribeByName(_name.current, value.name, exact) && shouldRenderFormState(value, _localProxyFormState.current, control._updateFormState) && updateFormState({
|
|
3112
3135
|
...control._formState,
|
|
3113
3136
|
...value
|
|
3114
3137
|
}),
|
|
3115
3138
|
subject: control._subjects.state
|
|
3116
3139
|
});
|
|
3117
|
-
|
|
3140
|
+
React__default.useEffect(() => {
|
|
3118
3141
|
_mounted.current = true;
|
|
3119
|
-
|
|
3120
|
-
if (isDirty !== control._formState.isDirty) {
|
|
3121
|
-
control._subjects.state.next({
|
|
3122
|
-
isDirty
|
|
3123
|
-
});
|
|
3124
|
-
}
|
|
3125
|
-
control._updateValid();
|
|
3142
|
+
_localProxyFormState.current.isValid && control._updateValid(true);
|
|
3126
3143
|
return () => {
|
|
3127
3144
|
_mounted.current = false;
|
|
3128
3145
|
};
|
|
@@ -3141,53 +3158,27 @@ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) =>
|
|
|
3141
3158
|
isGlobal && (_names.watchAll = true);
|
|
3142
3159
|
return formValues;
|
|
3143
3160
|
};
|
|
3144
|
-
var isPlainObject = (tempObject) => {
|
|
3145
|
-
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
3146
|
-
return isObject$1(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
3147
|
-
};
|
|
3148
|
-
var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
|
|
3149
|
-
function cloneObject(data) {
|
|
3150
|
-
let copy2;
|
|
3151
|
-
const isArray2 = Array.isArray(data);
|
|
3152
|
-
if (data instanceof Date) {
|
|
3153
|
-
copy2 = new Date(data);
|
|
3154
|
-
} else if (data instanceof Set) {
|
|
3155
|
-
copy2 = new Set(data);
|
|
3156
|
-
} else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray2 || isObject$1(data))) {
|
|
3157
|
-
copy2 = isArray2 ? [] : {};
|
|
3158
|
-
if (!Array.isArray(data) && !isPlainObject(data)) {
|
|
3159
|
-
copy2 = data;
|
|
3160
|
-
} else {
|
|
3161
|
-
for (const key in data) {
|
|
3162
|
-
copy2[key] = cloneObject(data[key]);
|
|
3163
|
-
}
|
|
3164
|
-
}
|
|
3165
|
-
} else {
|
|
3166
|
-
return data;
|
|
3167
|
-
}
|
|
3168
|
-
return copy2;
|
|
3169
|
-
}
|
|
3170
3161
|
function useWatch(props) {
|
|
3171
3162
|
const methods = useFormContext();
|
|
3172
3163
|
const { control = methods.control, name, defaultValue, disabled, exact } = props || {};
|
|
3173
|
-
const _name =
|
|
3164
|
+
const _name = React__default.useRef(name);
|
|
3174
3165
|
_name.current = name;
|
|
3175
3166
|
useSubscribe({
|
|
3176
3167
|
disabled,
|
|
3177
|
-
subject: control._subjects.
|
|
3168
|
+
subject: control._subjects.values,
|
|
3178
3169
|
next: (formState) => {
|
|
3179
3170
|
if (shouldSubscribeByName(_name.current, formState.name, exact)) {
|
|
3180
3171
|
updateValue(cloneObject(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, defaultValue)));
|
|
3181
3172
|
}
|
|
3182
3173
|
}
|
|
3183
3174
|
});
|
|
3184
|
-
const [value, updateValue] =
|
|
3185
|
-
|
|
3175
|
+
const [value, updateValue] = React__default.useState(control._getWatch(name, defaultValue));
|
|
3176
|
+
React__default.useEffect(() => control._removeUnmounted());
|
|
3186
3177
|
return value;
|
|
3187
3178
|
}
|
|
3188
3179
|
function useController(props) {
|
|
3189
3180
|
const methods = useFormContext();
|
|
3190
|
-
const { name, control = methods.control, shouldUnregister } = props;
|
|
3181
|
+
const { name, disabled, control = methods.control, shouldUnregister } = props;
|
|
3191
3182
|
const isArrayField = isNameInFieldArray(control._names.array, name);
|
|
3192
3183
|
const value = useWatch({
|
|
3193
3184
|
control,
|
|
@@ -3199,35 +3190,54 @@ function useController(props) {
|
|
|
3199
3190
|
control,
|
|
3200
3191
|
name
|
|
3201
3192
|
});
|
|
3202
|
-
const _registerProps =
|
|
3193
|
+
const _registerProps = React__default.useRef(control.register(name, {
|
|
3203
3194
|
...props.rules,
|
|
3204
|
-
value
|
|
3195
|
+
value,
|
|
3196
|
+
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
3205
3197
|
}));
|
|
3206
|
-
|
|
3198
|
+
React__default.useEffect(() => {
|
|
3199
|
+
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
3207
3200
|
const updateMounted = (name2, value2) => {
|
|
3208
3201
|
const field = get(control._fields, name2);
|
|
3209
|
-
if (field) {
|
|
3202
|
+
if (field && field._f) {
|
|
3210
3203
|
field._f.mount = value2;
|
|
3211
3204
|
}
|
|
3212
3205
|
};
|
|
3213
3206
|
updateMounted(name, true);
|
|
3207
|
+
if (_shouldUnregisterField) {
|
|
3208
|
+
const value2 = cloneObject(get(control._options.defaultValues, name));
|
|
3209
|
+
set(control._defaultValues, name, value2);
|
|
3210
|
+
if (isUndefined$2(get(control._formValues, name))) {
|
|
3211
|
+
set(control._formValues, name, value2);
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
3214
|
return () => {
|
|
3215
|
-
|
|
3216
|
-
(isArrayField ? _shouldUnregisterField && !control._stateFlags.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
3215
|
+
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
3217
3216
|
};
|
|
3218
3217
|
}, [name, control, isArrayField, shouldUnregister]);
|
|
3218
|
+
React__default.useEffect(() => {
|
|
3219
|
+
if (get(control._fields, name)) {
|
|
3220
|
+
control._updateDisabledField({
|
|
3221
|
+
disabled,
|
|
3222
|
+
fields: control._fields,
|
|
3223
|
+
name,
|
|
3224
|
+
value: get(control._fields, name)._f.value
|
|
3225
|
+
});
|
|
3226
|
+
}
|
|
3227
|
+
}, [disabled, name, control]);
|
|
3219
3228
|
return {
|
|
3220
3229
|
field: {
|
|
3221
3230
|
name,
|
|
3222
3231
|
value,
|
|
3223
|
-
|
|
3232
|
+
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
3233
|
+
onChange: React__default.useCallback((event) => _registerProps.current.onChange({
|
|
3224
3234
|
target: {
|
|
3225
3235
|
value: getEventValue(event),
|
|
3226
3236
|
name
|
|
3227
3237
|
},
|
|
3228
3238
|
type: EVENTS.CHANGE
|
|
3229
3239
|
}), [name]),
|
|
3230
|
-
onBlur:
|
|
3240
|
+
onBlur: React__default.useCallback(() => _registerProps.current.onBlur({
|
|
3231
3241
|
target: {
|
|
3232
3242
|
value: get(control._formValues, name),
|
|
3233
3243
|
name
|
|
@@ -3260,6 +3270,10 @@ function useController(props) {
|
|
|
3260
3270
|
enumerable: true,
|
|
3261
3271
|
get: () => !!get(formState.touchedFields, name)
|
|
3262
3272
|
},
|
|
3273
|
+
isValidating: {
|
|
3274
|
+
enumerable: true,
|
|
3275
|
+
get: () => !!get(formState.validatingFields, name)
|
|
3276
|
+
},
|
|
3263
3277
|
error: {
|
|
3264
3278
|
enumerable: true,
|
|
3265
3279
|
get: () => get(formState.errors, name)
|
|
@@ -3268,6 +3282,76 @@ function useController(props) {
|
|
|
3268
3282
|
};
|
|
3269
3283
|
}
|
|
3270
3284
|
const Controller = (props) => props.render(useController(props));
|
|
3285
|
+
const POST_REQUEST = "post";
|
|
3286
|
+
function Form(props) {
|
|
3287
|
+
const methods = useFormContext();
|
|
3288
|
+
const [mounted, setMounted] = React__default.useState(false);
|
|
3289
|
+
const { control = methods.control, onSubmit, children, action, method = POST_REQUEST, headers, encType, onError, render, onSuccess, validateStatus, ...rest } = props;
|
|
3290
|
+
const submit = async (event) => {
|
|
3291
|
+
let hasError = false;
|
|
3292
|
+
let type = "";
|
|
3293
|
+
await control.handleSubmit(async (data) => {
|
|
3294
|
+
const formData = new FormData();
|
|
3295
|
+
let formDataJson = "";
|
|
3296
|
+
try {
|
|
3297
|
+
formDataJson = JSON.stringify(data);
|
|
3298
|
+
} catch (_a) {
|
|
3299
|
+
}
|
|
3300
|
+
for (const name of control._names.mount) {
|
|
3301
|
+
formData.append(name, get(data, name));
|
|
3302
|
+
}
|
|
3303
|
+
if (onSubmit) {
|
|
3304
|
+
await onSubmit({
|
|
3305
|
+
data,
|
|
3306
|
+
event,
|
|
3307
|
+
method,
|
|
3308
|
+
formData,
|
|
3309
|
+
formDataJson
|
|
3310
|
+
});
|
|
3311
|
+
}
|
|
3312
|
+
if (action) {
|
|
3313
|
+
try {
|
|
3314
|
+
const shouldStringifySubmissionData = [
|
|
3315
|
+
headers && headers["Content-Type"],
|
|
3316
|
+
encType
|
|
3317
|
+
].some((value) => value && value.includes("json"));
|
|
3318
|
+
const response = await fetch(action, {
|
|
3319
|
+
method,
|
|
3320
|
+
headers: {
|
|
3321
|
+
...headers,
|
|
3322
|
+
...encType ? { "Content-Type": encType } : {}
|
|
3323
|
+
},
|
|
3324
|
+
body: shouldStringifySubmissionData ? formDataJson : formData
|
|
3325
|
+
});
|
|
3326
|
+
if (response && (validateStatus ? !validateStatus(response.status) : response.status < 200 || response.status >= 300)) {
|
|
3327
|
+
hasError = true;
|
|
3328
|
+
onError && onError({ response });
|
|
3329
|
+
type = String(response.status);
|
|
3330
|
+
} else {
|
|
3331
|
+
onSuccess && onSuccess({ response });
|
|
3332
|
+
}
|
|
3333
|
+
} catch (error2) {
|
|
3334
|
+
hasError = true;
|
|
3335
|
+
onError && onError({ error: error2 });
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
})(event);
|
|
3339
|
+
if (hasError && props.control) {
|
|
3340
|
+
props.control._subjects.state.next({
|
|
3341
|
+
isSubmitSuccessful: false
|
|
3342
|
+
});
|
|
3343
|
+
props.control.setError("root.server", {
|
|
3344
|
+
type
|
|
3345
|
+
});
|
|
3346
|
+
}
|
|
3347
|
+
};
|
|
3348
|
+
React__default.useEffect(() => {
|
|
3349
|
+
setMounted(true);
|
|
3350
|
+
}, []);
|
|
3351
|
+
return render ? React__default.createElement(React__default.Fragment, null, render({
|
|
3352
|
+
submit
|
|
3353
|
+
})) : React__default.createElement("form", { noValidate: mounted, action, method, encType, onSubmit: submit, ...rest }, children);
|
|
3354
|
+
}
|
|
3271
3355
|
var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria ? {
|
|
3272
3356
|
...errors[name],
|
|
3273
3357
|
types: {
|
|
@@ -3275,49 +3359,11 @@ var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => va
|
|
|
3275
3359
|
[type]: message || true
|
|
3276
3360
|
}
|
|
3277
3361
|
} : {};
|
|
3278
|
-
var isKey = (value) => /^\w*$/.test(value);
|
|
3279
|
-
var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
3280
|
-
function set(object, path2, value) {
|
|
3281
|
-
let index = -1;
|
|
3282
|
-
const tempPath = isKey(path2) ? [path2] : stringToPath(path2);
|
|
3283
|
-
const length = tempPath.length;
|
|
3284
|
-
const lastIndex = length - 1;
|
|
3285
|
-
while (++index < length) {
|
|
3286
|
-
const key = tempPath[index];
|
|
3287
|
-
let newValue = value;
|
|
3288
|
-
if (index !== lastIndex) {
|
|
3289
|
-
const objValue = object[key];
|
|
3290
|
-
newValue = isObject$1(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};
|
|
3291
|
-
}
|
|
3292
|
-
object[key] = newValue;
|
|
3293
|
-
object = object[key];
|
|
3294
|
-
}
|
|
3295
|
-
return object;
|
|
3296
|
-
}
|
|
3297
|
-
const focusFieldBy = (fields, callback, fieldsNames) => {
|
|
3298
|
-
for (const key of fieldsNames || Object.keys(fields)) {
|
|
3299
|
-
const field = get(fields, key);
|
|
3300
|
-
if (field) {
|
|
3301
|
-
const { _f, ...currentField } = field;
|
|
3302
|
-
if (_f && callback(_f.name)) {
|
|
3303
|
-
if (_f.ref.focus) {
|
|
3304
|
-
_f.ref.focus();
|
|
3305
|
-
break;
|
|
3306
|
-
} else if (_f.refs && _f.refs[0].focus) {
|
|
3307
|
-
_f.refs[0].focus();
|
|
3308
|
-
break;
|
|
3309
|
-
}
|
|
3310
|
-
} else if (isObject$1(currentField)) {
|
|
3311
|
-
focusFieldBy(currentField, callback);
|
|
3312
|
-
}
|
|
3313
|
-
}
|
|
3314
|
-
}
|
|
3315
|
-
};
|
|
3316
3362
|
var generateId = () => {
|
|
3317
3363
|
const d2 = typeof performance === "undefined" ? Date.now() : performance.now() * 1e3;
|
|
3318
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (
|
|
3364
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => {
|
|
3319
3365
|
const r2 = (Math.random() * 16 + d2) % 16 | 0;
|
|
3320
|
-
return (
|
|
3366
|
+
return (c2 == "x" ? r2 : r2 & 3 | 8).toString(16);
|
|
3321
3367
|
});
|
|
3322
3368
|
};
|
|
3323
3369
|
var getFocusFieldName = (name, index, options = {}) => options.shouldFocus || isUndefined$2(options.shouldFocus) ? options.focusName || `${name}.${isUndefined$2(options.focusIndex) ? index : options.focusIndex}.` : "";
|
|
@@ -3329,13 +3375,31 @@ var getValidationModes = (mode) => ({
|
|
|
3329
3375
|
isOnTouch: mode === VALIDATION_MODE.onTouched
|
|
3330
3376
|
});
|
|
3331
3377
|
var isWatched = (name, _names, isBlurEvent) => !isBlurEvent && (_names.watchAll || _names.watch.has(name) || [..._names.watch].some((watchName) => name.startsWith(watchName) && /^\.\w+/.test(name.slice(watchName.length))));
|
|
3378
|
+
const iterateFieldsByAction = (fields, action, fieldsNames, abortEarly) => {
|
|
3379
|
+
for (const key of fieldsNames || Object.keys(fields)) {
|
|
3380
|
+
const field = get(fields, key);
|
|
3381
|
+
if (field) {
|
|
3382
|
+
const { _f, ...currentField } = field;
|
|
3383
|
+
if (_f) {
|
|
3384
|
+
if (_f.refs && _f.refs[0] && action(_f.refs[0], key) && !abortEarly) {
|
|
3385
|
+
break;
|
|
3386
|
+
} else if (_f.ref && action(_f.ref, _f.name) && !abortEarly) {
|
|
3387
|
+
break;
|
|
3388
|
+
} else {
|
|
3389
|
+
iterateFieldsByAction(currentField, action);
|
|
3390
|
+
}
|
|
3391
|
+
} else if (isObject$1(currentField)) {
|
|
3392
|
+
iterateFieldsByAction(currentField, action);
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
}
|
|
3396
|
+
};
|
|
3332
3397
|
var updateFieldArrayRootError = (errors, error2, name) => {
|
|
3333
|
-
const fieldArrayErrors =
|
|
3398
|
+
const fieldArrayErrors = convertToArrayPayload(get(errors, name));
|
|
3334
3399
|
set(fieldArrayErrors, "root", error2[name]);
|
|
3335
3400
|
set(errors, name, fieldArrayErrors);
|
|
3336
3401
|
return errors;
|
|
3337
3402
|
};
|
|
3338
|
-
var isBoolean = (value) => typeof value === "boolean";
|
|
3339
3403
|
var isFileInput = (element) => element.type === "file";
|
|
3340
3404
|
var isFunction$1 = (value) => typeof value === "function";
|
|
3341
3405
|
var isHTMLElement = (value) => {
|
|
@@ -3345,7 +3409,7 @@ var isHTMLElement = (value) => {
|
|
|
3345
3409
|
const owner = value ? value.ownerDocument : 0;
|
|
3346
3410
|
return value instanceof (owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement);
|
|
3347
3411
|
};
|
|
3348
|
-
var isMessage = (value) => isString(value)
|
|
3412
|
+
var isMessage = (value) => isString(value);
|
|
3349
3413
|
var isRadioInput = (element) => element.type === "radio";
|
|
3350
3414
|
var isRegex = (value) => value instanceof RegExp;
|
|
3351
3415
|
const defaultResult = {
|
|
@@ -3384,8 +3448,9 @@ var getValueAndMessage = (validationData) => isObject$1(validationData) && !isRe
|
|
|
3384
3448
|
value: validationData,
|
|
3385
3449
|
message: ""
|
|
3386
3450
|
};
|
|
3387
|
-
var validateField = async (field,
|
|
3451
|
+
var validateField = async (field, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
|
|
3388
3452
|
const { ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, valueAsNumber, mount, disabled } = field._f;
|
|
3453
|
+
const inputValue = get(formValues, name);
|
|
3389
3454
|
if (!mount || disabled) {
|
|
3390
3455
|
return {};
|
|
3391
3456
|
}
|
|
@@ -3462,8 +3527,8 @@ var validateField = async (field, inputValue, validateAllFieldCriteria, shouldUs
|
|
|
3462
3527
|
if ((maxLength || minLength) && !isEmpty2 && (isString(inputValue) || isFieldArray && Array.isArray(inputValue))) {
|
|
3463
3528
|
const maxLengthOutput = getValueAndMessage(maxLength);
|
|
3464
3529
|
const minLengthOutput = getValueAndMessage(minLength);
|
|
3465
|
-
const exceedMax = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > maxLengthOutput.value;
|
|
3466
|
-
const exceedMin = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < minLengthOutput.value;
|
|
3530
|
+
const exceedMax = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > +maxLengthOutput.value;
|
|
3531
|
+
const exceedMin = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < +minLengthOutput.value;
|
|
3467
3532
|
if (exceedMax || exceedMin) {
|
|
3468
3533
|
getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
|
|
3469
3534
|
if (!validateAllFieldCriteria) {
|
|
@@ -3489,7 +3554,7 @@ var validateField = async (field, inputValue, validateAllFieldCriteria, shouldUs
|
|
|
3489
3554
|
}
|
|
3490
3555
|
if (validate) {
|
|
3491
3556
|
if (isFunction$1(validate)) {
|
|
3492
|
-
const result = await validate(inputValue);
|
|
3557
|
+
const result = await validate(inputValue, formValues);
|
|
3493
3558
|
const validateError = getValidateError(result, inputRef);
|
|
3494
3559
|
if (validateError) {
|
|
3495
3560
|
error2[name] = {
|
|
@@ -3507,7 +3572,7 @@ var validateField = async (field, inputValue, validateAllFieldCriteria, shouldUs
|
|
|
3507
3572
|
if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {
|
|
3508
3573
|
break;
|
|
3509
3574
|
}
|
|
3510
|
-
const validateError = getValidateError(await validate[key](inputValue), inputRef, key);
|
|
3575
|
+
const validateError = getValidateError(await validate[key](inputValue, formValues), inputRef, key);
|
|
3511
3576
|
if (validateError) {
|
|
3512
3577
|
validationResult = {
|
|
3513
3578
|
...validateError,
|
|
@@ -3533,9 +3598,10 @@ var validateField = async (field, inputValue, validateAllFieldCriteria, shouldUs
|
|
|
3533
3598
|
setCustomValidity(true);
|
|
3534
3599
|
return error2;
|
|
3535
3600
|
};
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3601
|
+
var appendAt = (data, value) => [
|
|
3602
|
+
...data,
|
|
3603
|
+
...convertToArrayPayload(value)
|
|
3604
|
+
];
|
|
3539
3605
|
var fillEmptyArray = (value) => Array.isArray(value) ? value.map(() => void 0) : void 0;
|
|
3540
3606
|
function insert(data, index, value) {
|
|
3541
3607
|
return [
|
|
@@ -3554,9 +3620,10 @@ var moveArrayAt = (data, from, to) => {
|
|
|
3554
3620
|
data.splice(to, 0, data.splice(from, 1)[0]);
|
|
3555
3621
|
return data;
|
|
3556
3622
|
};
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3623
|
+
var prependAt = (data, value) => [
|
|
3624
|
+
...convertToArrayPayload(value),
|
|
3625
|
+
...convertToArrayPayload(data)
|
|
3626
|
+
];
|
|
3560
3627
|
function removeAtIndexes(data, indexes) {
|
|
3561
3628
|
let i2 = 0;
|
|
3562
3629
|
const temp = [...data];
|
|
@@ -3566,9 +3633,9 @@ function removeAtIndexes(data, indexes) {
|
|
|
3566
3633
|
}
|
|
3567
3634
|
return compact(temp).length ? temp : [];
|
|
3568
3635
|
}
|
|
3569
|
-
var removeArrayAt = (data, index) => isUndefined$2(index) ? [] : removeAtIndexes(data, convertToArrayPayload(index).sort((a2,
|
|
3636
|
+
var removeArrayAt = (data, index) => isUndefined$2(index) ? [] : removeAtIndexes(data, convertToArrayPayload(index).sort((a2, b2) => a2 - b2));
|
|
3570
3637
|
var swapArrayAt = (data, indexA, indexB) => {
|
|
3571
|
-
data[indexA]
|
|
3638
|
+
[data[indexA], data[indexB]] = [data[indexB], data[indexA]];
|
|
3572
3639
|
};
|
|
3573
3640
|
function baseGet(object, updatePath) {
|
|
3574
3641
|
const length = updatePath.slice(0, -1).length;
|
|
@@ -3580,36 +3647,22 @@ function baseGet(object, updatePath) {
|
|
|
3580
3647
|
}
|
|
3581
3648
|
function isEmptyArray(obj) {
|
|
3582
3649
|
for (const key in obj) {
|
|
3583
|
-
if (!isUndefined$2(obj[key])) {
|
|
3650
|
+
if (obj.hasOwnProperty(key) && !isUndefined$2(obj[key])) {
|
|
3584
3651
|
return false;
|
|
3585
3652
|
}
|
|
3586
3653
|
}
|
|
3587
3654
|
return true;
|
|
3588
3655
|
}
|
|
3589
3656
|
function unset(object, path2) {
|
|
3590
|
-
const
|
|
3591
|
-
const childObject =
|
|
3592
|
-
const
|
|
3593
|
-
|
|
3657
|
+
const paths = Array.isArray(path2) ? path2 : isKey(path2) ? [path2] : stringToPath(path2);
|
|
3658
|
+
const childObject = paths.length === 1 ? object : baseGet(object, paths);
|
|
3659
|
+
const index = paths.length - 1;
|
|
3660
|
+
const key = paths[index];
|
|
3594
3661
|
if (childObject) {
|
|
3595
3662
|
delete childObject[key];
|
|
3596
3663
|
}
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
let objectRef;
|
|
3600
|
-
const currentPaths = updatePath.slice(0, -(k2 + 1));
|
|
3601
|
-
const currentPathsLength = currentPaths.length - 1;
|
|
3602
|
-
if (k2 > 0) {
|
|
3603
|
-
previousObjRef = object;
|
|
3604
|
-
}
|
|
3605
|
-
while (++index < currentPaths.length) {
|
|
3606
|
-
const item = currentPaths[index];
|
|
3607
|
-
objectRef = objectRef ? objectRef[item] : object[item];
|
|
3608
|
-
if (currentPathsLength === index && (isObject$1(objectRef) && isEmptyObject(objectRef) || Array.isArray(objectRef) && isEmptyArray(objectRef))) {
|
|
3609
|
-
previousObjRef ? delete previousObjRef[item] : delete object[item];
|
|
3610
|
-
}
|
|
3611
|
-
previousObjRef = objectRef;
|
|
3612
|
-
}
|
|
3664
|
+
if (index !== 0 && (isObject$1(childObject) && isEmptyObject(childObject) || Array.isArray(childObject) && isEmptyArray(childObject))) {
|
|
3665
|
+
unset(object, paths.slice(0, -1));
|
|
3613
3666
|
}
|
|
3614
3667
|
return object;
|
|
3615
3668
|
}
|
|
@@ -3620,11 +3673,11 @@ var updateAt = (fieldValues, index, value) => {
|
|
|
3620
3673
|
function useFieldArray(props) {
|
|
3621
3674
|
const methods = useFormContext();
|
|
3622
3675
|
const { control = methods.control, name, keyName = "id", shouldUnregister } = props;
|
|
3623
|
-
const [fields, setFields] =
|
|
3624
|
-
const ids =
|
|
3625
|
-
const _fieldIds =
|
|
3626
|
-
const _name =
|
|
3627
|
-
const _actioned =
|
|
3676
|
+
const [fields, setFields] = React__default.useState(control._getFieldArray(name));
|
|
3677
|
+
const ids = React__default.useRef(control._getFieldArray(name).map(generateId));
|
|
3678
|
+
const _fieldIds = React__default.useRef(fields);
|
|
3679
|
+
const _name = React__default.useRef(name);
|
|
3680
|
+
const _actioned = React__default.useRef(false);
|
|
3628
3681
|
_name.current = name;
|
|
3629
3682
|
_fieldIds.current = fields;
|
|
3630
3683
|
control._names.array.add(name);
|
|
@@ -3641,29 +3694,29 @@ function useFieldArray(props) {
|
|
|
3641
3694
|
},
|
|
3642
3695
|
subject: control._subjects.array
|
|
3643
3696
|
});
|
|
3644
|
-
const updateValues =
|
|
3697
|
+
const updateValues = React__default.useCallback((updatedFieldArrayValues) => {
|
|
3645
3698
|
_actioned.current = true;
|
|
3646
3699
|
control._updateFieldArray(name, updatedFieldArrayValues);
|
|
3647
3700
|
}, [control, name]);
|
|
3648
|
-
const append
|
|
3701
|
+
const append = (value, options) => {
|
|
3649
3702
|
const appendValue = convertToArrayPayload(cloneObject(value));
|
|
3650
|
-
const updatedFieldArrayValues =
|
|
3703
|
+
const updatedFieldArrayValues = appendAt(control._getFieldArray(name), appendValue);
|
|
3651
3704
|
control._names.focus = getFocusFieldName(name, updatedFieldArrayValues.length - 1, options);
|
|
3652
|
-
ids.current =
|
|
3705
|
+
ids.current = appendAt(ids.current, appendValue.map(generateId));
|
|
3653
3706
|
updateValues(updatedFieldArrayValues);
|
|
3654
3707
|
setFields(updatedFieldArrayValues);
|
|
3655
|
-
control._updateFieldArray(name, updatedFieldArrayValues,
|
|
3708
|
+
control._updateFieldArray(name, updatedFieldArrayValues, appendAt, {
|
|
3656
3709
|
argA: fillEmptyArray(value)
|
|
3657
3710
|
});
|
|
3658
3711
|
};
|
|
3659
|
-
const prepend
|
|
3712
|
+
const prepend = (value, options) => {
|
|
3660
3713
|
const prependValue = convertToArrayPayload(cloneObject(value));
|
|
3661
|
-
const updatedFieldArrayValues =
|
|
3714
|
+
const updatedFieldArrayValues = prependAt(control._getFieldArray(name), prependValue);
|
|
3662
3715
|
control._names.focus = getFocusFieldName(name, 0, options);
|
|
3663
|
-
ids.current =
|
|
3716
|
+
ids.current = prependAt(ids.current, prependValue.map(generateId));
|
|
3664
3717
|
updateValues(updatedFieldArrayValues);
|
|
3665
3718
|
setFields(updatedFieldArrayValues);
|
|
3666
|
-
control._updateFieldArray(name, updatedFieldArrayValues,
|
|
3719
|
+
control._updateFieldArray(name, updatedFieldArrayValues, prependAt, {
|
|
3667
3720
|
argA: fillEmptyArray(value)
|
|
3668
3721
|
});
|
|
3669
3722
|
};
|
|
@@ -3728,15 +3781,17 @@ function useFieldArray(props) {
|
|
|
3728
3781
|
setFields([...updatedFieldArrayValues]);
|
|
3729
3782
|
control._updateFieldArray(name, [...updatedFieldArrayValues], (data) => data, {}, true, false);
|
|
3730
3783
|
};
|
|
3731
|
-
|
|
3732
|
-
control.
|
|
3733
|
-
isWatched(name, control._names) && control._subjects.state.next({
|
|
3784
|
+
React__default.useEffect(() => {
|
|
3785
|
+
control._state.action = false;
|
|
3786
|
+
isWatched(name, control._names) && control._subjects.state.next({
|
|
3787
|
+
...control._formState
|
|
3788
|
+
});
|
|
3734
3789
|
if (_actioned.current && (!getValidationModes(control._options.mode).isOnSubmit || control._formState.isSubmitted)) {
|
|
3735
3790
|
if (control._options.resolver) {
|
|
3736
3791
|
control._executeSchema([name]).then((result) => {
|
|
3737
3792
|
const error2 = get(result.errors, name);
|
|
3738
3793
|
const existingError = get(control._formState.errors, name);
|
|
3739
|
-
if (existingError ? !error2 && existingError.type : error2 && error2.type) {
|
|
3794
|
+
if (existingError ? !error2 && existingError.type || error2 && (existingError.type !== error2.type || existingError.message !== error2.message) : error2 && error2.type) {
|
|
3740
3795
|
error2 ? set(control._formState.errors, name, error2) : unset(control._formState.errors, name);
|
|
3741
3796
|
control._subjects.state.next({
|
|
3742
3797
|
errors: control._formState.errors
|
|
@@ -3745,47 +3800,54 @@ function useFieldArray(props) {
|
|
|
3745
3800
|
});
|
|
3746
3801
|
} else {
|
|
3747
3802
|
const field = get(control._fields, name);
|
|
3748
|
-
if (field && field._f) {
|
|
3749
|
-
validateField(field,
|
|
3803
|
+
if (field && field._f && !(getValidationModes(control._options.reValidateMode).isOnSubmit && getValidationModes(control._options.mode).isOnSubmit)) {
|
|
3804
|
+
validateField(field, control._formValues, control._options.criteriaMode === VALIDATION_MODE.all, control._options.shouldUseNativeValidation, true).then((error2) => !isEmptyObject(error2) && control._subjects.state.next({
|
|
3750
3805
|
errors: updateFieldArrayRootError(control._formState.errors, error2, name)
|
|
3751
3806
|
}));
|
|
3752
3807
|
}
|
|
3753
3808
|
}
|
|
3754
3809
|
}
|
|
3755
|
-
control._subjects.
|
|
3810
|
+
control._subjects.values.next({
|
|
3756
3811
|
name,
|
|
3757
|
-
values: control._formValues
|
|
3812
|
+
values: { ...control._formValues }
|
|
3813
|
+
});
|
|
3814
|
+
control._names.focus && iterateFieldsByAction(control._fields, (ref, key) => {
|
|
3815
|
+
if (control._names.focus && key.startsWith(control._names.focus) && ref.focus) {
|
|
3816
|
+
ref.focus();
|
|
3817
|
+
return 1;
|
|
3818
|
+
}
|
|
3819
|
+
return;
|
|
3758
3820
|
});
|
|
3759
|
-
control._names.focus && focusFieldBy(control._fields, (key) => !!key && key.startsWith(control._names.focus || ""));
|
|
3760
3821
|
control._names.focus = "";
|
|
3761
|
-
control.
|
|
3822
|
+
control._updateValid();
|
|
3823
|
+
_actioned.current = false;
|
|
3762
3824
|
}, [fields, name, control]);
|
|
3763
|
-
|
|
3825
|
+
React__default.useEffect(() => {
|
|
3764
3826
|
!get(control._formValues, name) && control._updateFieldArray(name);
|
|
3765
3827
|
return () => {
|
|
3766
3828
|
(control._options.shouldUnregister || shouldUnregister) && control.unregister(name);
|
|
3767
3829
|
};
|
|
3768
3830
|
}, [name, control, keyName, shouldUnregister]);
|
|
3769
3831
|
return {
|
|
3770
|
-
swap:
|
|
3771
|
-
move:
|
|
3772
|
-
prepend:
|
|
3773
|
-
append:
|
|
3774
|
-
remove:
|
|
3775
|
-
insert:
|
|
3776
|
-
update:
|
|
3777
|
-
replace:
|
|
3778
|
-
fields:
|
|
3832
|
+
swap: React__default.useCallback(swap, [updateValues, name, control]),
|
|
3833
|
+
move: React__default.useCallback(move, [updateValues, name, control]),
|
|
3834
|
+
prepend: React__default.useCallback(prepend, [updateValues, name, control]),
|
|
3835
|
+
append: React__default.useCallback(append, [updateValues, name, control]),
|
|
3836
|
+
remove: React__default.useCallback(remove2, [updateValues, name, control]),
|
|
3837
|
+
insert: React__default.useCallback(insert$1, [updateValues, name, control]),
|
|
3838
|
+
update: React__default.useCallback(update, [updateValues, name, control]),
|
|
3839
|
+
replace: React__default.useCallback(replace, [updateValues, name, control]),
|
|
3840
|
+
fields: React__default.useMemo(() => fields.map((field, index) => ({
|
|
3779
3841
|
...field,
|
|
3780
3842
|
[keyName]: ids.current[index] || generateId()
|
|
3781
3843
|
})), [fields, keyName])
|
|
3782
3844
|
};
|
|
3783
3845
|
}
|
|
3784
|
-
|
|
3846
|
+
var createSubject = () => {
|
|
3785
3847
|
let _observers = [];
|
|
3786
3848
|
const next = (value) => {
|
|
3787
3849
|
for (const observer of _observers) {
|
|
3788
|
-
observer.next(value);
|
|
3850
|
+
observer.next && observer.next(value);
|
|
3789
3851
|
}
|
|
3790
3852
|
};
|
|
3791
3853
|
const subscribe = (observer) => {
|
|
@@ -3807,7 +3869,7 @@ function createSubject() {
|
|
|
3807
3869
|
subscribe,
|
|
3808
3870
|
unsubscribe
|
|
3809
3871
|
};
|
|
3810
|
-
}
|
|
3872
|
+
};
|
|
3811
3873
|
var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
|
|
3812
3874
|
function deepEqual(object1, object2) {
|
|
3813
3875
|
if (isPrimitive(object1) || isPrimitive(object2)) {
|
|
@@ -3871,7 +3933,7 @@ function getDirtyFieldsFromDefaultValues(data, formValues, dirtyFieldsFromValues
|
|
|
3871
3933
|
getDirtyFieldsFromDefaultValues(data[key], isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);
|
|
3872
3934
|
}
|
|
3873
3935
|
} else {
|
|
3874
|
-
deepEqual(data[key], formValues[key])
|
|
3936
|
+
dirtyFieldsFromValues[key] = !deepEqual(data[key], formValues[key]);
|
|
3875
3937
|
}
|
|
3876
3938
|
}
|
|
3877
3939
|
}
|
|
@@ -3959,16 +4021,15 @@ const defaultOptions$1 = {
|
|
|
3959
4021
|
reValidateMode: VALIDATION_MODE.onChange,
|
|
3960
4022
|
shouldFocusError: true
|
|
3961
4023
|
};
|
|
3962
|
-
function createFormControl(props = {}
|
|
4024
|
+
function createFormControl(props = {}) {
|
|
3963
4025
|
let _options = {
|
|
3964
4026
|
...defaultOptions$1,
|
|
3965
4027
|
...props
|
|
3966
4028
|
};
|
|
3967
|
-
const shouldCaptureDirtyFields = props.resetOptions && props.resetOptions.keepDirtyValues;
|
|
3968
4029
|
let _formState = {
|
|
3969
4030
|
submitCount: 0,
|
|
3970
4031
|
isDirty: false,
|
|
3971
|
-
isLoading:
|
|
4032
|
+
isLoading: isFunction$1(_options.defaultValues),
|
|
3972
4033
|
isValidating: false,
|
|
3973
4034
|
isSubmitted: false,
|
|
3974
4035
|
isSubmitting: false,
|
|
@@ -3976,12 +4037,14 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
3976
4037
|
isValid: false,
|
|
3977
4038
|
touchedFields: {},
|
|
3978
4039
|
dirtyFields: {},
|
|
3979
|
-
|
|
4040
|
+
validatingFields: {},
|
|
4041
|
+
errors: _options.errors || {},
|
|
4042
|
+
disabled: _options.disabled || false
|
|
3980
4043
|
};
|
|
3981
4044
|
let _fields = {};
|
|
3982
|
-
let _defaultValues = isObject$1(_options.defaultValues) ? cloneObject(_options.defaultValues) || {} : {};
|
|
4045
|
+
let _defaultValues = isObject$1(_options.defaultValues) || isObject$1(_options.values) ? cloneObject(_options.defaultValues || _options.values) || {} : {};
|
|
3983
4046
|
let _formValues = _options.shouldUnregister ? {} : cloneObject(_defaultValues);
|
|
3984
|
-
let
|
|
4047
|
+
let _state = {
|
|
3985
4048
|
action: false,
|
|
3986
4049
|
mount: false,
|
|
3987
4050
|
watch: false
|
|
@@ -3997,13 +4060,14 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
3997
4060
|
const _proxyFormState = {
|
|
3998
4061
|
isDirty: false,
|
|
3999
4062
|
dirtyFields: false,
|
|
4063
|
+
validatingFields: false,
|
|
4000
4064
|
touchedFields: false,
|
|
4001
4065
|
isValidating: false,
|
|
4002
4066
|
isValid: false,
|
|
4003
4067
|
errors: false
|
|
4004
4068
|
};
|
|
4005
4069
|
const _subjects = {
|
|
4006
|
-
|
|
4070
|
+
values: createSubject(),
|
|
4007
4071
|
array: createSubject(),
|
|
4008
4072
|
state: createSubject()
|
|
4009
4073
|
};
|
|
@@ -4012,25 +4076,34 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4012
4076
|
const shouldDisplayAllAssociatedErrors = _options.criteriaMode === VALIDATION_MODE.all;
|
|
4013
4077
|
const debounce = (callback) => (wait) => {
|
|
4014
4078
|
clearTimeout(timer);
|
|
4015
|
-
timer =
|
|
4079
|
+
timer = setTimeout(callback, wait);
|
|
4016
4080
|
};
|
|
4017
|
-
const _updateValid = async () => {
|
|
4018
|
-
if (_proxyFormState.isValid) {
|
|
4081
|
+
const _updateValid = async (shouldUpdateValid) => {
|
|
4082
|
+
if (_proxyFormState.isValid || shouldUpdateValid) {
|
|
4019
4083
|
const isValid = _options.resolver ? isEmptyObject((await _executeSchema()).errors) : await executeBuiltInValidation(_fields, true);
|
|
4020
4084
|
if (isValid !== _formState.isValid) {
|
|
4021
|
-
_formState.isValid = isValid;
|
|
4022
4085
|
_subjects.state.next({
|
|
4023
4086
|
isValid
|
|
4024
4087
|
});
|
|
4025
4088
|
}
|
|
4026
4089
|
}
|
|
4027
4090
|
};
|
|
4028
|
-
const _updateIsValidating = (
|
|
4029
|
-
isValidating
|
|
4030
|
-
|
|
4091
|
+
const _updateIsValidating = (names, isValidating) => {
|
|
4092
|
+
if (_proxyFormState.isValidating || _proxyFormState.validatingFields) {
|
|
4093
|
+
(names || Array.from(_names.mount)).forEach((name) => {
|
|
4094
|
+
if (name) {
|
|
4095
|
+
isValidating ? set(_formState.validatingFields, name, isValidating) : unset(_formState.validatingFields, name);
|
|
4096
|
+
}
|
|
4097
|
+
});
|
|
4098
|
+
_subjects.state.next({
|
|
4099
|
+
validatingFields: _formState.validatingFields,
|
|
4100
|
+
isValidating: !isEmptyObject(_formState.validatingFields)
|
|
4101
|
+
});
|
|
4102
|
+
}
|
|
4103
|
+
};
|
|
4031
4104
|
const _updateFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
|
|
4032
4105
|
if (args && method) {
|
|
4033
|
-
|
|
4106
|
+
_state.action = true;
|
|
4034
4107
|
if (shouldUpdateFieldsAndState && Array.isArray(get(_fields, name))) {
|
|
4035
4108
|
const fieldValues = method(get(_fields, name), args.argA, args.argB);
|
|
4036
4109
|
shouldSetValues && set(_fields, name, fieldValues);
|
|
@@ -4064,12 +4137,19 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4064
4137
|
errors: _formState.errors
|
|
4065
4138
|
});
|
|
4066
4139
|
};
|
|
4140
|
+
const _setErrors = (errors) => {
|
|
4141
|
+
_formState.errors = errors;
|
|
4142
|
+
_subjects.state.next({
|
|
4143
|
+
errors: _formState.errors,
|
|
4144
|
+
isValid: false
|
|
4145
|
+
});
|
|
4146
|
+
};
|
|
4067
4147
|
const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
|
|
4068
4148
|
const field = get(_fields, name);
|
|
4069
4149
|
if (field) {
|
|
4070
4150
|
const defaultValue = get(_formValues, name, isUndefined$2(value) ? get(_defaultValues, name) : value);
|
|
4071
4151
|
isUndefined$2(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);
|
|
4072
|
-
|
|
4152
|
+
_state.mount && _updateValid();
|
|
4073
4153
|
}
|
|
4074
4154
|
};
|
|
4075
4155
|
const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
|
|
@@ -4078,15 +4158,16 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4078
4158
|
const output2 = {
|
|
4079
4159
|
name
|
|
4080
4160
|
};
|
|
4161
|
+
const disabledField = !!(get(_fields, name) && get(_fields, name)._f && get(_fields, name)._f.disabled);
|
|
4081
4162
|
if (!isBlurEvent || shouldDirty) {
|
|
4082
4163
|
if (_proxyFormState.isDirty) {
|
|
4083
4164
|
isPreviousDirty = _formState.isDirty;
|
|
4084
4165
|
_formState.isDirty = output2.isDirty = _getDirty();
|
|
4085
4166
|
shouldUpdateField = isPreviousDirty !== output2.isDirty;
|
|
4086
4167
|
}
|
|
4087
|
-
const isCurrentFieldPristine = deepEqual(get(_defaultValues, name), fieldValue);
|
|
4088
|
-
isPreviousDirty = get(_formState.dirtyFields, name);
|
|
4089
|
-
isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
|
|
4168
|
+
const isCurrentFieldPristine = disabledField || deepEqual(get(_defaultValues, name), fieldValue);
|
|
4169
|
+
isPreviousDirty = !!(!disabledField && get(_formState.dirtyFields, name));
|
|
4170
|
+
isCurrentFieldPristine || disabledField ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
|
|
4090
4171
|
output2.dirtyFields = _formState.dirtyFields;
|
|
4091
4172
|
shouldUpdateField = shouldUpdateField || _proxyFormState.dirtyFields && isPreviousDirty !== !isCurrentFieldPristine;
|
|
4092
4173
|
}
|
|
@@ -4125,11 +4206,15 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4125
4206
|
};
|
|
4126
4207
|
_subjects.state.next(updatedFormState);
|
|
4127
4208
|
}
|
|
4128
|
-
_updateIsValidating(false);
|
|
4129
4209
|
};
|
|
4130
|
-
const _executeSchema = async (name) =>
|
|
4210
|
+
const _executeSchema = async (name) => {
|
|
4211
|
+
_updateIsValidating(name, true);
|
|
4212
|
+
const result = await _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
|
|
4213
|
+
_updateIsValidating(name);
|
|
4214
|
+
return result;
|
|
4215
|
+
};
|
|
4131
4216
|
const executeSchemaAndUpdateState = async (names) => {
|
|
4132
|
-
const { errors } = await _executeSchema();
|
|
4217
|
+
const { errors } = await _executeSchema(names);
|
|
4133
4218
|
if (names) {
|
|
4134
4219
|
for (const name of names) {
|
|
4135
4220
|
const error2 = get(errors, name);
|
|
@@ -4149,7 +4234,9 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4149
4234
|
const { _f, ...fieldValue } = field;
|
|
4150
4235
|
if (_f) {
|
|
4151
4236
|
const isFieldArrayRoot = _names.array.has(_f.name);
|
|
4152
|
-
|
|
4237
|
+
_updateIsValidating([name], true);
|
|
4238
|
+
const fieldError = await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
|
|
4239
|
+
_updateIsValidating([name]);
|
|
4153
4240
|
if (fieldError[_f.name]) {
|
|
4154
4241
|
context.valid = false;
|
|
4155
4242
|
if (shouldOnlyCheckValid) {
|
|
@@ -4172,9 +4259,9 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4172
4259
|
};
|
|
4173
4260
|
const _getDirty = (name, data) => (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
|
|
4174
4261
|
const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
|
|
4175
|
-
...
|
|
4262
|
+
..._state.mount ? _formValues : isUndefined$2(defaultValue) ? _defaultValues : isString(names) ? { [names]: defaultValue } : defaultValue
|
|
4176
4263
|
}, isGlobal, defaultValue);
|
|
4177
|
-
const _getFieldArray = (name) => compact(get(
|
|
4264
|
+
const _getFieldArray = (name) => compact(get(_state.mount ? _formValues : _defaultValues, name, props.shouldUnregister ? get(_defaultValues, name, []) : []));
|
|
4178
4265
|
const setFieldValue = (name, value, options = {}) => {
|
|
4179
4266
|
const field = get(_fields, name);
|
|
4180
4267
|
let fieldValue = value;
|
|
@@ -4196,8 +4283,9 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4196
4283
|
} else {
|
|
4197
4284
|
fieldReference.ref.value = fieldValue;
|
|
4198
4285
|
if (!fieldReference.ref.type) {
|
|
4199
|
-
_subjects.
|
|
4200
|
-
name
|
|
4286
|
+
_subjects.values.next({
|
|
4287
|
+
name,
|
|
4288
|
+
values: { ..._formValues }
|
|
4201
4289
|
});
|
|
4202
4290
|
}
|
|
4203
4291
|
}
|
|
@@ -4222,30 +4310,34 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4222
4310
|
if (isFieldArray) {
|
|
4223
4311
|
_subjects.array.next({
|
|
4224
4312
|
name,
|
|
4225
|
-
values: _formValues
|
|
4313
|
+
values: { ..._formValues }
|
|
4226
4314
|
});
|
|
4227
4315
|
if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields) && options.shouldDirty) {
|
|
4228
|
-
_formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
|
|
4229
4316
|
_subjects.state.next({
|
|
4230
4317
|
name,
|
|
4231
|
-
dirtyFields:
|
|
4318
|
+
dirtyFields: getDirtyFields(_defaultValues, _formValues),
|
|
4232
4319
|
isDirty: _getDirty(name, cloneValue)
|
|
4233
4320
|
});
|
|
4234
4321
|
}
|
|
4235
4322
|
} else {
|
|
4236
4323
|
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options) : setFieldValue(name, cloneValue, options);
|
|
4237
4324
|
}
|
|
4238
|
-
isWatched(name, _names) && _subjects.state.next({});
|
|
4239
|
-
_subjects.
|
|
4240
|
-
name
|
|
4325
|
+
isWatched(name, _names) && _subjects.state.next({ ..._formState });
|
|
4326
|
+
_subjects.values.next({
|
|
4327
|
+
name: _state.mount ? name : void 0,
|
|
4328
|
+
values: { ..._formValues }
|
|
4241
4329
|
});
|
|
4242
|
-
!_stateFlags.mount && flushRootRender();
|
|
4243
4330
|
};
|
|
4244
4331
|
const onChange = async (event) => {
|
|
4332
|
+
_state.mount = true;
|
|
4245
4333
|
const target = event.target;
|
|
4246
4334
|
let name = target.name;
|
|
4335
|
+
let isFieldValueUpdated = true;
|
|
4247
4336
|
const field = get(_fields, name);
|
|
4248
4337
|
const getCurrentFieldValue = () => target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
4338
|
+
const _updateIsFieldValueUpdated = (fieldValue) => {
|
|
4339
|
+
isFieldValueUpdated = Number.isNaN(fieldValue) || fieldValue === get(_formValues, name, fieldValue);
|
|
4340
|
+
};
|
|
4249
4341
|
if (field) {
|
|
4250
4342
|
let error2;
|
|
4251
4343
|
let isValid;
|
|
@@ -4262,40 +4354,56 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4262
4354
|
}
|
|
4263
4355
|
const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent, false);
|
|
4264
4356
|
const shouldRender = !isEmptyObject(fieldState) || watched;
|
|
4265
|
-
!isBlurEvent && _subjects.
|
|
4357
|
+
!isBlurEvent && _subjects.values.next({
|
|
4266
4358
|
name,
|
|
4267
|
-
type: event.type
|
|
4359
|
+
type: event.type,
|
|
4360
|
+
values: { ..._formValues }
|
|
4268
4361
|
});
|
|
4269
4362
|
if (shouldSkipValidation) {
|
|
4270
4363
|
_proxyFormState.isValid && _updateValid();
|
|
4271
4364
|
return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
|
|
4272
4365
|
}
|
|
4273
|
-
!isBlurEvent && watched && _subjects.state.next({});
|
|
4274
|
-
_updateIsValidating(true);
|
|
4366
|
+
!isBlurEvent && watched && _subjects.state.next({ ..._formState });
|
|
4275
4367
|
if (_options.resolver) {
|
|
4276
4368
|
const { errors } = await _executeSchema([name]);
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4369
|
+
_updateIsFieldValueUpdated(fieldValue);
|
|
4370
|
+
if (isFieldValueUpdated) {
|
|
4371
|
+
const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
|
|
4372
|
+
const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
|
|
4373
|
+
error2 = errorLookupResult.error;
|
|
4374
|
+
name = errorLookupResult.name;
|
|
4375
|
+
isValid = isEmptyObject(errors);
|
|
4376
|
+
}
|
|
4282
4377
|
} else {
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4378
|
+
_updateIsValidating([name], true);
|
|
4379
|
+
error2 = (await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
|
|
4380
|
+
_updateIsValidating([name]);
|
|
4381
|
+
_updateIsFieldValueUpdated(fieldValue);
|
|
4382
|
+
if (isFieldValueUpdated) {
|
|
4383
|
+
if (error2) {
|
|
4384
|
+
isValid = false;
|
|
4385
|
+
} else if (_proxyFormState.isValid) {
|
|
4386
|
+
isValid = await executeBuiltInValidation(_fields, true);
|
|
4387
|
+
}
|
|
4288
4388
|
}
|
|
4289
4389
|
}
|
|
4290
|
-
|
|
4291
|
-
|
|
4390
|
+
if (isFieldValueUpdated) {
|
|
4391
|
+
field._f.deps && trigger(field._f.deps);
|
|
4392
|
+
shouldRenderByError(name, isValid, error2, fieldState);
|
|
4393
|
+
}
|
|
4394
|
+
}
|
|
4395
|
+
};
|
|
4396
|
+
const _focusInput = (ref, key) => {
|
|
4397
|
+
if (get(_formState.errors, key) && ref.focus) {
|
|
4398
|
+
ref.focus();
|
|
4399
|
+
return 1;
|
|
4292
4400
|
}
|
|
4401
|
+
return;
|
|
4293
4402
|
};
|
|
4294
4403
|
const trigger = async (name, options = {}) => {
|
|
4295
4404
|
let isValid;
|
|
4296
4405
|
let validationResult;
|
|
4297
4406
|
const fieldNames = convertToArrayPayload(name);
|
|
4298
|
-
_updateIsValidating(true);
|
|
4299
4407
|
if (_options.resolver) {
|
|
4300
4408
|
const errors = await executeSchemaAndUpdateState(isUndefined$2(name) ? name : fieldNames);
|
|
4301
4409
|
isValid = isEmptyObject(errors);
|
|
@@ -4312,34 +4420,36 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4312
4420
|
_subjects.state.next({
|
|
4313
4421
|
...!isString(name) || _proxyFormState.isValid && isValid !== _formState.isValid ? {} : { name },
|
|
4314
4422
|
..._options.resolver || !name ? { isValid } : {},
|
|
4315
|
-
errors: _formState.errors
|
|
4316
|
-
isValidating: false
|
|
4423
|
+
errors: _formState.errors
|
|
4317
4424
|
});
|
|
4318
|
-
options.shouldFocus && !validationResult &&
|
|
4425
|
+
options.shouldFocus && !validationResult && iterateFieldsByAction(_fields, _focusInput, name ? fieldNames : _names.mount);
|
|
4319
4426
|
return validationResult;
|
|
4320
4427
|
};
|
|
4321
4428
|
const getValues = (fieldNames) => {
|
|
4322
4429
|
const values = {
|
|
4323
|
-
..._defaultValues
|
|
4324
|
-
..._stateFlags.mount ? _formValues : {}
|
|
4430
|
+
..._state.mount ? _formValues : _defaultValues
|
|
4325
4431
|
};
|
|
4326
4432
|
return isUndefined$2(fieldNames) ? values : isString(fieldNames) ? get(values, fieldNames) : fieldNames.map((name) => get(values, name));
|
|
4327
4433
|
};
|
|
4328
4434
|
const getFieldState = (name, formState) => ({
|
|
4329
4435
|
invalid: !!get((formState || _formState).errors, name),
|
|
4330
4436
|
isDirty: !!get((formState || _formState).dirtyFields, name),
|
|
4331
|
-
|
|
4332
|
-
|
|
4437
|
+
error: get((formState || _formState).errors, name),
|
|
4438
|
+
isValidating: !!get(_formState.validatingFields, name),
|
|
4439
|
+
isTouched: !!get((formState || _formState).touchedFields, name)
|
|
4333
4440
|
});
|
|
4334
4441
|
const clearErrors = (name) => {
|
|
4335
|
-
name
|
|
4442
|
+
name && convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));
|
|
4336
4443
|
_subjects.state.next({
|
|
4337
|
-
errors: _formState.errors
|
|
4444
|
+
errors: name ? _formState.errors : {}
|
|
4338
4445
|
});
|
|
4339
4446
|
};
|
|
4340
4447
|
const setError = (name, error2, options) => {
|
|
4341
4448
|
const ref = (get(_fields, name, { _f: {} })._f || {}).ref;
|
|
4449
|
+
const currentError = get(_formState.errors, name) || {};
|
|
4450
|
+
const { ref: currentRef, message, type, ...restOfErrorTree } = currentError;
|
|
4342
4451
|
set(_formState.errors, name, {
|
|
4452
|
+
...restOfErrorTree,
|
|
4343
4453
|
...error2,
|
|
4344
4454
|
ref
|
|
4345
4455
|
});
|
|
@@ -4350,31 +4460,39 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4350
4460
|
});
|
|
4351
4461
|
options && options.shouldFocus && ref && ref.focus && ref.focus();
|
|
4352
4462
|
};
|
|
4353
|
-
const watch = (name, defaultValue) => isFunction$1(name) ? _subjects.
|
|
4463
|
+
const watch = (name, defaultValue) => isFunction$1(name) ? _subjects.values.subscribe({
|
|
4354
4464
|
next: (payload) => name(_getWatch(void 0, defaultValue), payload)
|
|
4355
4465
|
}) : _getWatch(name, defaultValue, true);
|
|
4356
4466
|
const unregister = (name, options = {}) => {
|
|
4357
4467
|
for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
|
|
4358
4468
|
_names.mount.delete(fieldName);
|
|
4359
4469
|
_names.array.delete(fieldName);
|
|
4360
|
-
if (
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4470
|
+
if (!options.keepValue) {
|
|
4471
|
+
unset(_fields, fieldName);
|
|
4472
|
+
unset(_formValues, fieldName);
|
|
4473
|
+
}
|
|
4474
|
+
!options.keepError && unset(_formState.errors, fieldName);
|
|
4475
|
+
!options.keepDirty && unset(_formState.dirtyFields, fieldName);
|
|
4476
|
+
!options.keepTouched && unset(_formState.touchedFields, fieldName);
|
|
4477
|
+
!options.keepIsValidating && unset(_formState.validatingFields, fieldName);
|
|
4478
|
+
!_options.shouldUnregister && !options.keepDefaultValue && unset(_defaultValues, fieldName);
|
|
4479
|
+
}
|
|
4480
|
+
_subjects.values.next({
|
|
4481
|
+
values: { ..._formValues }
|
|
4482
|
+
});
|
|
4372
4483
|
_subjects.state.next({
|
|
4373
4484
|
..._formState,
|
|
4374
4485
|
...!options.keepDirty ? {} : { isDirty: _getDirty() }
|
|
4375
4486
|
});
|
|
4376
4487
|
!options.keepIsValid && _updateValid();
|
|
4377
4488
|
};
|
|
4489
|
+
const _updateDisabledField = ({ disabled, name, field, fields, value }) => {
|
|
4490
|
+
if (isBoolean(disabled) && _state.mount || !!disabled) {
|
|
4491
|
+
const inputValue = disabled ? void 0 : isUndefined$2(value) ? getFieldValue(field ? field._f : get(fields, name)._f) : value;
|
|
4492
|
+
set(_formValues, name, inputValue);
|
|
4493
|
+
updateTouchAndDirty(name, inputValue, false, false, true);
|
|
4494
|
+
}
|
|
4495
|
+
};
|
|
4378
4496
|
const register = (name, options = {}) => {
|
|
4379
4497
|
let field = get(_fields, name);
|
|
4380
4498
|
const disabledIsDefined = isBoolean(options.disabled);
|
|
@@ -4388,10 +4506,19 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4388
4506
|
}
|
|
4389
4507
|
});
|
|
4390
4508
|
_names.mount.add(name);
|
|
4391
|
-
|
|
4509
|
+
if (field) {
|
|
4510
|
+
_updateDisabledField({
|
|
4511
|
+
field,
|
|
4512
|
+
disabled: options.disabled,
|
|
4513
|
+
name,
|
|
4514
|
+
value: options.value
|
|
4515
|
+
});
|
|
4516
|
+
} else {
|
|
4517
|
+
updateValidAndValue(name, true, options.value);
|
|
4518
|
+
}
|
|
4392
4519
|
return {
|
|
4393
4520
|
...disabledIsDefined ? { disabled: options.disabled } : {},
|
|
4394
|
-
..._options.
|
|
4521
|
+
..._options.progressive ? {
|
|
4395
4522
|
required: !!options.required,
|
|
4396
4523
|
min: getRuleValue(options.min),
|
|
4397
4524
|
max: getRuleValue(options.max),
|
|
@@ -4431,70 +4558,87 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4431
4558
|
if (field._f) {
|
|
4432
4559
|
field._f.mount = false;
|
|
4433
4560
|
}
|
|
4434
|
-
(_options.shouldUnregister || options.shouldUnregister) && !(isNameInFieldArray(_names.array, name) &&
|
|
4561
|
+
(_options.shouldUnregister || options.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name);
|
|
4435
4562
|
}
|
|
4436
4563
|
}
|
|
4437
4564
|
};
|
|
4438
4565
|
};
|
|
4439
|
-
const _focusError = () => _options.shouldFocusError &&
|
|
4566
|
+
const _focusError = () => _options.shouldFocusError && iterateFieldsByAction(_fields, _focusInput, _names.mount);
|
|
4567
|
+
const _disableForm = (disabled) => {
|
|
4568
|
+
if (isBoolean(disabled)) {
|
|
4569
|
+
_subjects.state.next({ disabled });
|
|
4570
|
+
iterateFieldsByAction(_fields, (ref, name) => {
|
|
4571
|
+
const currentField = get(_fields, name);
|
|
4572
|
+
if (currentField) {
|
|
4573
|
+
ref.disabled = currentField._f.disabled || disabled;
|
|
4574
|
+
if (Array.isArray(currentField._f.refs)) {
|
|
4575
|
+
currentField._f.refs.forEach((inputRef) => {
|
|
4576
|
+
inputRef.disabled = currentField._f.disabled || disabled;
|
|
4577
|
+
});
|
|
4578
|
+
}
|
|
4579
|
+
}
|
|
4580
|
+
}, 0, false);
|
|
4581
|
+
}
|
|
4582
|
+
};
|
|
4440
4583
|
const handleSubmit = (onValid, onInvalid) => async (e2) => {
|
|
4584
|
+
let onValidError = void 0;
|
|
4441
4585
|
if (e2) {
|
|
4442
4586
|
e2.preventDefault && e2.preventDefault();
|
|
4443
4587
|
e2.persist && e2.persist();
|
|
4444
4588
|
}
|
|
4445
|
-
let hasNoPromiseError = true;
|
|
4446
4589
|
let fieldValues = cloneObject(_formValues);
|
|
4447
4590
|
_subjects.state.next({
|
|
4448
4591
|
isSubmitting: true
|
|
4449
4592
|
});
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
_subjects.state.next({
|
|
4460
|
-
errors: {},
|
|
4461
|
-
isSubmitting: true
|
|
4462
|
-
});
|
|
4463
|
-
await onValid(fieldValues, e2);
|
|
4464
|
-
} else {
|
|
4465
|
-
if (onInvalid) {
|
|
4466
|
-
await onInvalid({ ..._formState.errors }, e2);
|
|
4467
|
-
}
|
|
4468
|
-
_focusError();
|
|
4469
|
-
}
|
|
4470
|
-
} catch (err) {
|
|
4471
|
-
hasNoPromiseError = false;
|
|
4472
|
-
throw err;
|
|
4473
|
-
} finally {
|
|
4474
|
-
_formState.isSubmitted = true;
|
|
4593
|
+
if (_options.resolver) {
|
|
4594
|
+
const { errors, values } = await _executeSchema();
|
|
4595
|
+
_formState.errors = errors;
|
|
4596
|
+
fieldValues = values;
|
|
4597
|
+
} else {
|
|
4598
|
+
await executeBuiltInValidation(_fields);
|
|
4599
|
+
}
|
|
4600
|
+
unset(_formState.errors, "root");
|
|
4601
|
+
if (isEmptyObject(_formState.errors)) {
|
|
4475
4602
|
_subjects.state.next({
|
|
4476
|
-
|
|
4477
|
-
isSubmitting: false,
|
|
4478
|
-
isSubmitSuccessful: isEmptyObject(_formState.errors) && hasNoPromiseError,
|
|
4479
|
-
submitCount: _formState.submitCount + 1,
|
|
4480
|
-
errors: _formState.errors
|
|
4603
|
+
errors: {}
|
|
4481
4604
|
});
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4605
|
+
try {
|
|
4606
|
+
await onValid(fieldValues, e2);
|
|
4607
|
+
} catch (error2) {
|
|
4608
|
+
onValidError = error2;
|
|
4609
|
+
}
|
|
4610
|
+
} else {
|
|
4611
|
+
if (onInvalid) {
|
|
4612
|
+
await onInvalid({ ..._formState.errors }, e2);
|
|
4613
|
+
}
|
|
4614
|
+
_focusError();
|
|
4615
|
+
setTimeout(_focusError);
|
|
4616
|
+
}
|
|
4617
|
+
_subjects.state.next({
|
|
4618
|
+
isSubmitted: true,
|
|
4619
|
+
isSubmitting: false,
|
|
4620
|
+
isSubmitSuccessful: isEmptyObject(_formState.errors) && !onValidError,
|
|
4621
|
+
submitCount: _formState.submitCount + 1,
|
|
4622
|
+
errors: _formState.errors
|
|
4623
|
+
});
|
|
4624
|
+
if (onValidError) {
|
|
4625
|
+
throw onValidError;
|
|
4626
|
+
}
|
|
4627
|
+
};
|
|
4628
|
+
const resetField = (name, options = {}) => {
|
|
4629
|
+
if (get(_fields, name)) {
|
|
4486
4630
|
if (isUndefined$2(options.defaultValue)) {
|
|
4487
|
-
setValue(name, get(_defaultValues, name));
|
|
4631
|
+
setValue(name, cloneObject(get(_defaultValues, name)));
|
|
4488
4632
|
} else {
|
|
4489
4633
|
setValue(name, options.defaultValue);
|
|
4490
|
-
set(_defaultValues, name, options.defaultValue);
|
|
4634
|
+
set(_defaultValues, name, cloneObject(options.defaultValue));
|
|
4491
4635
|
}
|
|
4492
4636
|
if (!options.keepTouched) {
|
|
4493
4637
|
unset(_formState.touchedFields, name);
|
|
4494
4638
|
}
|
|
4495
4639
|
if (!options.keepDirty) {
|
|
4496
4640
|
unset(_formState.dirtyFields, name);
|
|
4497
|
-
_formState.isDirty = options.defaultValue ? _getDirty(name, get(_defaultValues, name)) : _getDirty();
|
|
4641
|
+
_formState.isDirty = options.defaultValue ? _getDirty(name, cloneObject(get(_defaultValues, name))) : _getDirty();
|
|
4498
4642
|
}
|
|
4499
4643
|
if (!options.keepError) {
|
|
4500
4644
|
unset(_formState.errors, name);
|
|
@@ -4504,14 +4648,15 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4504
4648
|
}
|
|
4505
4649
|
};
|
|
4506
4650
|
const _reset = (formValues, keepStateOptions = {}) => {
|
|
4507
|
-
const updatedValues = formValues
|
|
4651
|
+
const updatedValues = formValues ? cloneObject(formValues) : _defaultValues;
|
|
4508
4652
|
const cloneUpdatedValues = cloneObject(updatedValues);
|
|
4509
|
-
const
|
|
4653
|
+
const isEmptyResetValues = isEmptyObject(formValues);
|
|
4654
|
+
const values = isEmptyResetValues ? _defaultValues : cloneUpdatedValues;
|
|
4510
4655
|
if (!keepStateOptions.keepDefaultValues) {
|
|
4511
4656
|
_defaultValues = updatedValues;
|
|
4512
4657
|
}
|
|
4513
4658
|
if (!keepStateOptions.keepValues) {
|
|
4514
|
-
if (keepStateOptions.keepDirtyValues
|
|
4659
|
+
if (keepStateOptions.keepDirtyValues) {
|
|
4515
4660
|
for (const fieldName of _names.mount) {
|
|
4516
4661
|
get(_formState.dirtyFields, fieldName) ? set(values, fieldName, get(_formValues, fieldName)) : setValue(fieldName, get(values, fieldName));
|
|
4517
4662
|
}
|
|
@@ -4533,34 +4678,33 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4533
4678
|
}
|
|
4534
4679
|
_fields = {};
|
|
4535
4680
|
}
|
|
4536
|
-
_formValues = props.shouldUnregister ? keepStateOptions.keepDefaultValues ? cloneObject(_defaultValues) : {} :
|
|
4681
|
+
_formValues = props.shouldUnregister ? keepStateOptions.keepDefaultValues ? cloneObject(_defaultValues) : {} : cloneObject(values);
|
|
4537
4682
|
_subjects.array.next({
|
|
4538
|
-
values
|
|
4683
|
+
values: { ...values }
|
|
4539
4684
|
});
|
|
4540
|
-
_subjects.
|
|
4541
|
-
values
|
|
4685
|
+
_subjects.values.next({
|
|
4686
|
+
values: { ...values }
|
|
4542
4687
|
});
|
|
4543
4688
|
}
|
|
4544
4689
|
_names = {
|
|
4545
|
-
mount: /* @__PURE__ */ new Set(),
|
|
4690
|
+
mount: keepStateOptions.keepDirtyValues ? _names.mount : /* @__PURE__ */ new Set(),
|
|
4546
4691
|
unMount: /* @__PURE__ */ new Set(),
|
|
4547
4692
|
array: /* @__PURE__ */ new Set(),
|
|
4548
4693
|
watch: /* @__PURE__ */ new Set(),
|
|
4549
4694
|
watchAll: false,
|
|
4550
4695
|
focus: ""
|
|
4551
4696
|
};
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
_stateFlags.watch = !!props.shouldUnregister;
|
|
4697
|
+
_state.mount = !_proxyFormState.isValid || !!keepStateOptions.keepIsValid || !!keepStateOptions.keepDirtyValues;
|
|
4698
|
+
_state.watch = !!props.shouldUnregister;
|
|
4555
4699
|
_subjects.state.next({
|
|
4556
4700
|
submitCount: keepStateOptions.keepSubmitCount ? _formState.submitCount : 0,
|
|
4557
|
-
isDirty:
|
|
4701
|
+
isDirty: isEmptyResetValues ? false : keepStateOptions.keepDirty ? _formState.isDirty : !!(keepStateOptions.keepDefaultValues && !deepEqual(formValues, _defaultValues)),
|
|
4558
4702
|
isSubmitted: keepStateOptions.keepIsSubmitted ? _formState.isSubmitted : false,
|
|
4559
|
-
dirtyFields: keepStateOptions.
|
|
4703
|
+
dirtyFields: isEmptyResetValues ? {} : keepStateOptions.keepDirtyValues ? keepStateOptions.keepDefaultValues && _formValues ? getDirtyFields(_defaultValues, _formValues) : _formState.dirtyFields : keepStateOptions.keepDefaultValues && formValues ? getDirtyFields(_defaultValues, formValues) : keepStateOptions.keepDirty ? _formState.dirtyFields : {},
|
|
4560
4704
|
touchedFields: keepStateOptions.keepTouched ? _formState.touchedFields : {},
|
|
4561
4705
|
errors: keepStateOptions.keepErrors ? _formState.errors : {},
|
|
4562
|
-
|
|
4563
|
-
|
|
4706
|
+
isSubmitSuccessful: keepStateOptions.keepIsSubmitSuccessful ? _formState.isSubmitSuccessful : false,
|
|
4707
|
+
isSubmitting: false
|
|
4564
4708
|
});
|
|
4565
4709
|
};
|
|
4566
4710
|
const reset = (formValues, keepStateOptions) => _reset(isFunction$1(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
|
|
@@ -4575,41 +4719,51 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4575
4719
|
}
|
|
4576
4720
|
}
|
|
4577
4721
|
};
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4722
|
+
const _updateFormState = (updatedFormState) => {
|
|
4723
|
+
_formState = {
|
|
4724
|
+
..._formState,
|
|
4725
|
+
...updatedFormState
|
|
4726
|
+
};
|
|
4727
|
+
};
|
|
4728
|
+
const _resetDefaultValues = () => isFunction$1(_options.defaultValues) && _options.defaultValues().then((values) => {
|
|
4729
|
+
reset(values, _options.resetOptions);
|
|
4730
|
+
_subjects.state.next({
|
|
4731
|
+
isLoading: false
|
|
4584
4732
|
});
|
|
4585
|
-
}
|
|
4733
|
+
});
|
|
4586
4734
|
return {
|
|
4587
4735
|
control: {
|
|
4588
4736
|
register,
|
|
4589
4737
|
unregister,
|
|
4590
4738
|
getFieldState,
|
|
4739
|
+
handleSubmit,
|
|
4740
|
+
setError,
|
|
4591
4741
|
_executeSchema,
|
|
4592
|
-
_focusError,
|
|
4593
4742
|
_getWatch,
|
|
4594
4743
|
_getDirty,
|
|
4595
4744
|
_updateValid,
|
|
4596
4745
|
_removeUnmounted,
|
|
4597
4746
|
_updateFieldArray,
|
|
4747
|
+
_updateDisabledField,
|
|
4598
4748
|
_getFieldArray,
|
|
4599
4749
|
_reset,
|
|
4750
|
+
_resetDefaultValues,
|
|
4751
|
+
_updateFormState,
|
|
4752
|
+
_disableForm,
|
|
4600
4753
|
_subjects,
|
|
4601
4754
|
_proxyFormState,
|
|
4755
|
+
_setErrors,
|
|
4602
4756
|
get _fields() {
|
|
4603
4757
|
return _fields;
|
|
4604
4758
|
},
|
|
4605
4759
|
get _formValues() {
|
|
4606
4760
|
return _formValues;
|
|
4607
4761
|
},
|
|
4608
|
-
get
|
|
4609
|
-
return
|
|
4762
|
+
get _state() {
|
|
4763
|
+
return _state;
|
|
4610
4764
|
},
|
|
4611
|
-
set
|
|
4612
|
-
|
|
4765
|
+
set _state(value) {
|
|
4766
|
+
_state = value;
|
|
4613
4767
|
},
|
|
4614
4768
|
get _defaultValues() {
|
|
4615
4769
|
return _defaultValues;
|
|
@@ -4652,11 +4806,12 @@ function createFormControl(props = {}, flushRootRender) {
|
|
|
4652
4806
|
};
|
|
4653
4807
|
}
|
|
4654
4808
|
function useForm(props = {}) {
|
|
4655
|
-
const _formControl =
|
|
4656
|
-
const
|
|
4809
|
+
const _formControl = React__default.useRef();
|
|
4810
|
+
const _values = React__default.useRef();
|
|
4811
|
+
const [formState, updateFormState] = React__default.useState({
|
|
4657
4812
|
isDirty: false,
|
|
4658
4813
|
isValidating: false,
|
|
4659
|
-
isLoading:
|
|
4814
|
+
isLoading: isFunction$1(props.defaultValues),
|
|
4660
4815
|
isSubmitted: false,
|
|
4661
4816
|
isSubmitting: false,
|
|
4662
4817
|
isSubmitSuccessful: false,
|
|
@@ -4664,12 +4819,14 @@ function useForm(props = {}) {
|
|
|
4664
4819
|
submitCount: 0,
|
|
4665
4820
|
dirtyFields: {},
|
|
4666
4821
|
touchedFields: {},
|
|
4667
|
-
|
|
4822
|
+
validatingFields: {},
|
|
4823
|
+
errors: props.errors || {},
|
|
4824
|
+
disabled: props.disabled || false,
|
|
4668
4825
|
defaultValues: isFunction$1(props.defaultValues) ? void 0 : props.defaultValues
|
|
4669
4826
|
});
|
|
4670
4827
|
if (!_formControl.current) {
|
|
4671
4828
|
_formControl.current = {
|
|
4672
|
-
...createFormControl(props
|
|
4829
|
+
...createFormControl(props),
|
|
4673
4830
|
formState
|
|
4674
4831
|
};
|
|
4675
4832
|
}
|
|
@@ -4678,40 +4835,59 @@ function useForm(props = {}) {
|
|
|
4678
4835
|
useSubscribe({
|
|
4679
4836
|
subject: control._subjects.state,
|
|
4680
4837
|
next: (value) => {
|
|
4681
|
-
if (shouldRenderFormState(value, control._proxyFormState, true)) {
|
|
4682
|
-
control._formState = {
|
|
4683
|
-
...control._formState,
|
|
4684
|
-
...value
|
|
4685
|
-
};
|
|
4838
|
+
if (shouldRenderFormState(value, control._proxyFormState, control._updateFormState, true)) {
|
|
4686
4839
|
updateFormState({ ...control._formState });
|
|
4687
4840
|
}
|
|
4688
4841
|
}
|
|
4689
4842
|
});
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4843
|
+
React__default.useEffect(() => control._disableForm(props.disabled), [control, props.disabled]);
|
|
4844
|
+
React__default.useEffect(() => {
|
|
4845
|
+
if (control._proxyFormState.isDirty) {
|
|
4846
|
+
const isDirty = control._getDirty();
|
|
4847
|
+
if (isDirty !== formState.isDirty) {
|
|
4848
|
+
control._subjects.state.next({
|
|
4849
|
+
isDirty
|
|
4850
|
+
});
|
|
4851
|
+
}
|
|
4698
4852
|
}
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
if (props.values && !deepEqual(props.values, control._defaultValues)) {
|
|
4853
|
+
}, [control, formState.isDirty]);
|
|
4854
|
+
React__default.useEffect(() => {
|
|
4855
|
+
if (props.values && !deepEqual(props.values, _values.current)) {
|
|
4703
4856
|
control._reset(props.values, control._options.resetOptions);
|
|
4857
|
+
_values.current = props.values;
|
|
4858
|
+
updateFormState((state) => ({ ...state }));
|
|
4859
|
+
} else {
|
|
4860
|
+
control._resetDefaultValues();
|
|
4704
4861
|
}
|
|
4705
4862
|
}, [props.values, control]);
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4863
|
+
React__default.useEffect(() => {
|
|
4864
|
+
if (props.errors) {
|
|
4865
|
+
control._setErrors(props.errors);
|
|
4866
|
+
}
|
|
4867
|
+
}, [props.errors, control]);
|
|
4868
|
+
React__default.useEffect(() => {
|
|
4869
|
+
if (!control._state.mount) {
|
|
4870
|
+
control._updateValid();
|
|
4871
|
+
control._state.mount = true;
|
|
4872
|
+
}
|
|
4873
|
+
if (control._state.watch) {
|
|
4874
|
+
control._state.watch = false;
|
|
4875
|
+
control._subjects.state.next({ ...control._formState });
|
|
4876
|
+
}
|
|
4877
|
+
control._removeUnmounted();
|
|
4878
|
+
});
|
|
4879
|
+
React__default.useEffect(() => {
|
|
4880
|
+
props.shouldUnregister && control._subjects.values.next({
|
|
4881
|
+
values: control._getWatch()
|
|
4882
|
+
});
|
|
4883
|
+
}, [props.shouldUnregister, control]);
|
|
4709
4884
|
_formControl.current.formState = getProxyFormState(formState, control);
|
|
4710
4885
|
return _formControl.current;
|
|
4711
4886
|
}
|
|
4712
4887
|
var index_esm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4713
4888
|
__proto__: null,
|
|
4714
4889
|
Controller,
|
|
4890
|
+
Form,
|
|
4715
4891
|
FormProvider,
|
|
4716
4892
|
appendErrors,
|
|
4717
4893
|
get,
|
|
@@ -4915,11 +5091,11 @@ var root$1 = root;
|
|
|
4915
5091
|
var Symbol$1 = root$1.Symbol;
|
|
4916
5092
|
var Symbol$2 = Symbol$1;
|
|
4917
5093
|
var objectProto$f = Object.prototype;
|
|
4918
|
-
var hasOwnProperty$
|
|
5094
|
+
var hasOwnProperty$c = objectProto$f.hasOwnProperty;
|
|
4919
5095
|
var nativeObjectToString$1 = objectProto$f.toString;
|
|
4920
5096
|
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
|
|
4921
5097
|
function getRawTag(value) {
|
|
4922
|
-
var isOwn = hasOwnProperty$
|
|
5098
|
+
var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
4923
5099
|
try {
|
|
4924
5100
|
value[symToStringTag$1] = void 0;
|
|
4925
5101
|
var unmasked = true;
|
|
@@ -5043,9 +5219,9 @@ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
|
5043
5219
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
5044
5220
|
var funcProto = Function.prototype, objectProto$d = Object.prototype;
|
|
5045
5221
|
var funcToString = funcProto.toString;
|
|
5046
|
-
var hasOwnProperty$
|
|
5222
|
+
var hasOwnProperty$b = objectProto$d.hasOwnProperty;
|
|
5047
5223
|
var reIsNative = RegExp(
|
|
5048
|
-
"^" + funcToString.call(hasOwnProperty$
|
|
5224
|
+
"^" + funcToString.call(hasOwnProperty$b).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
5049
5225
|
);
|
|
5050
5226
|
function baseIsNative(value) {
|
|
5051
5227
|
if (!isObject(value) || isMasked(value)) {
|
|
@@ -5130,10 +5306,10 @@ function eq(value, other) {
|
|
|
5130
5306
|
return value === other || value !== value && other !== other;
|
|
5131
5307
|
}
|
|
5132
5308
|
var objectProto$c = Object.prototype;
|
|
5133
|
-
var hasOwnProperty$
|
|
5309
|
+
var hasOwnProperty$a = objectProto$c.hasOwnProperty;
|
|
5134
5310
|
function assignValue(object, key, value) {
|
|
5135
5311
|
var objValue = object[key];
|
|
5136
|
-
if (!(hasOwnProperty$
|
|
5312
|
+
if (!(hasOwnProperty$a.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
|
5137
5313
|
baseAssignValue(object, key, value);
|
|
5138
5314
|
}
|
|
5139
5315
|
}
|
|
@@ -5179,12 +5355,12 @@ function baseIsArguments(value) {
|
|
|
5179
5355
|
return isObjectLike(value) && baseGetTag(value) == argsTag$3;
|
|
5180
5356
|
}
|
|
5181
5357
|
var objectProto$a = Object.prototype;
|
|
5182
|
-
var hasOwnProperty$
|
|
5358
|
+
var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
|
|
5183
5359
|
var propertyIsEnumerable$1 = objectProto$a.propertyIsEnumerable;
|
|
5184
5360
|
var isArguments = baseIsArguments(function() {
|
|
5185
5361
|
return arguments;
|
|
5186
5362
|
}()) ? baseIsArguments : function(value) {
|
|
5187
|
-
return isObjectLike(value) && hasOwnProperty$
|
|
5363
|
+
return isObjectLike(value) && hasOwnProperty$9.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
5188
5364
|
};
|
|
5189
5365
|
var isArguments$1 = isArguments;
|
|
5190
5366
|
function stubFalse() {
|
|
@@ -5229,11 +5405,11 @@ var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
|
|
|
5229
5405
|
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
5230
5406
|
var isTypedArray$1 = isTypedArray;
|
|
5231
5407
|
var objectProto$9 = Object.prototype;
|
|
5232
|
-
var hasOwnProperty$
|
|
5408
|
+
var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
|
|
5233
5409
|
function arrayLikeKeys(value, inherited) {
|
|
5234
5410
|
var isArr = isArray$1(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
5235
5411
|
for (var key in value) {
|
|
5236
|
-
if ((inherited || hasOwnProperty$
|
|
5412
|
+
if ((inherited || hasOwnProperty$8.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
|
|
5237
5413
|
result.push(key);
|
|
5238
5414
|
}
|
|
5239
5415
|
}
|
|
@@ -5247,14 +5423,14 @@ function overArg(func, transform) {
|
|
|
5247
5423
|
var nativeKeys = overArg(Object.keys, Object);
|
|
5248
5424
|
var nativeKeys$1 = nativeKeys;
|
|
5249
5425
|
var objectProto$8 = Object.prototype;
|
|
5250
|
-
var hasOwnProperty$
|
|
5426
|
+
var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
|
|
5251
5427
|
function baseKeys(object) {
|
|
5252
5428
|
if (!isPrototype(object)) {
|
|
5253
5429
|
return nativeKeys$1(object);
|
|
5254
5430
|
}
|
|
5255
5431
|
var result = [];
|
|
5256
5432
|
for (var key in Object(object)) {
|
|
5257
|
-
if (hasOwnProperty$
|
|
5433
|
+
if (hasOwnProperty$7.call(object, key) && key != "constructor") {
|
|
5258
5434
|
result.push(key);
|
|
5259
5435
|
}
|
|
5260
5436
|
}
|
|
@@ -5273,14 +5449,14 @@ function nativeKeysIn(object) {
|
|
|
5273
5449
|
return result;
|
|
5274
5450
|
}
|
|
5275
5451
|
var objectProto$7 = Object.prototype;
|
|
5276
|
-
var hasOwnProperty$
|
|
5452
|
+
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
|
|
5277
5453
|
function baseKeysIn(object) {
|
|
5278
5454
|
if (!isObject(object)) {
|
|
5279
5455
|
return nativeKeysIn(object);
|
|
5280
5456
|
}
|
|
5281
5457
|
var isProto = isPrototype(object), result = [];
|
|
5282
5458
|
for (var key in object) {
|
|
5283
|
-
if (!(key == "constructor" && (isProto || !hasOwnProperty$
|
|
5459
|
+
if (!(key == "constructor" && (isProto || !hasOwnProperty$6.call(object, key)))) {
|
|
5284
5460
|
result.push(key);
|
|
5285
5461
|
}
|
|
5286
5462
|
}
|
|
@@ -5302,20 +5478,20 @@ function hashDelete(key) {
|
|
|
5302
5478
|
}
|
|
5303
5479
|
var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
|
|
5304
5480
|
var objectProto$6 = Object.prototype;
|
|
5305
|
-
var hasOwnProperty$
|
|
5481
|
+
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
5306
5482
|
function hashGet(key) {
|
|
5307
5483
|
var data = this.__data__;
|
|
5308
5484
|
if (nativeCreate$1) {
|
|
5309
5485
|
var result = data[key];
|
|
5310
5486
|
return result === HASH_UNDEFINED$2 ? void 0 : result;
|
|
5311
5487
|
}
|
|
5312
|
-
return hasOwnProperty$
|
|
5488
|
+
return hasOwnProperty$5.call(data, key) ? data[key] : void 0;
|
|
5313
5489
|
}
|
|
5314
5490
|
var objectProto$5 = Object.prototype;
|
|
5315
|
-
var hasOwnProperty$
|
|
5491
|
+
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
5316
5492
|
function hashHas(key) {
|
|
5317
5493
|
var data = this.__data__;
|
|
5318
|
-
return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$
|
|
5494
|
+
return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$4.call(data, key);
|
|
5319
5495
|
}
|
|
5320
5496
|
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
|
|
5321
5497
|
function hashSet(key, value) {
|
|
@@ -5595,10 +5771,10 @@ if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3 ||
|
|
|
5595
5771
|
}
|
|
5596
5772
|
var getTag$1 = getTag;
|
|
5597
5773
|
var objectProto$3 = Object.prototype;
|
|
5598
|
-
var hasOwnProperty$
|
|
5774
|
+
var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
|
|
5599
5775
|
function initCloneArray(array) {
|
|
5600
5776
|
var length = array.length, result = new array.constructor(length);
|
|
5601
|
-
if (length && typeof array[0] == "string" && hasOwnProperty$
|
|
5777
|
+
if (length && typeof array[0] == "string" && hasOwnProperty$3.call(array, "index")) {
|
|
5602
5778
|
result.index = array.index;
|
|
5603
5779
|
result.input = array.input;
|
|
5604
5780
|
}
|
|
@@ -5890,7 +6066,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
5890
6066
|
}
|
|
5891
6067
|
var COMPARE_PARTIAL_FLAG$1 = 1;
|
|
5892
6068
|
var objectProto$2 = Object.prototype;
|
|
5893
|
-
var hasOwnProperty$
|
|
6069
|
+
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
|
5894
6070
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
5895
6071
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
|
|
5896
6072
|
if (objLength != othLength && !isPartial) {
|
|
@@ -5899,7 +6075,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
5899
6075
|
var index = objLength;
|
|
5900
6076
|
while (index--) {
|
|
5901
6077
|
var key = objProps[index];
|
|
5902
|
-
if (!(isPartial ? key in other : hasOwnProperty$
|
|
6078
|
+
if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) {
|
|
5903
6079
|
return false;
|
|
5904
6080
|
}
|
|
5905
6081
|
}
|
|
@@ -5937,7 +6113,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
5937
6113
|
var COMPARE_PARTIAL_FLAG = 1;
|
|
5938
6114
|
var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
|
|
5939
6115
|
var objectProto$1 = Object.prototype;
|
|
5940
|
-
var hasOwnProperty$
|
|
6116
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
5941
6117
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
5942
6118
|
var objIsArr = isArray$1(object), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
|
|
5943
6119
|
objTag = objTag == argsTag ? objectTag : objTag;
|
|
@@ -5955,7 +6131,7 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
5955
6131
|
return objIsArr || isTypedArray$1(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
5956
6132
|
}
|
|
5957
6133
|
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
5958
|
-
var objIsWrapped = objIsObj && hasOwnProperty$
|
|
6134
|
+
var objIsWrapped = objIsObj && hasOwnProperty$1.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$1.call(other, "__wrapped__");
|
|
5959
6135
|
if (objIsWrapped || othIsWrapped) {
|
|
5960
6136
|
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
5961
6137
|
stack || (stack = new Stack());
|
|
@@ -5994,7 +6170,7 @@ function inRange(number, start, end) {
|
|
|
5994
6170
|
}
|
|
5995
6171
|
var mapTag = "[object Map]", setTag = "[object Set]";
|
|
5996
6172
|
var objectProto = Object.prototype;
|
|
5997
|
-
var hasOwnProperty
|
|
6173
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
5998
6174
|
function isEmpty(value) {
|
|
5999
6175
|
if (value == null) {
|
|
6000
6176
|
return true;
|
|
@@ -6010,7 +6186,7 @@ function isEmpty(value) {
|
|
|
6010
6186
|
return !baseKeys(value).length;
|
|
6011
6187
|
}
|
|
6012
6188
|
for (var key in value) {
|
|
6013
|
-
if (hasOwnProperty
|
|
6189
|
+
if (hasOwnProperty.call(value, key)) {
|
|
6014
6190
|
return false;
|
|
6015
6191
|
}
|
|
6016
6192
|
}
|
|
@@ -6168,7 +6344,7 @@ const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
|
|
|
6168
6344
|
function create(createState) {
|
|
6169
6345
|
const api = typeof createState === "function" ? createStore(createState) : createState;
|
|
6170
6346
|
const useStore2 = (selector = api.getState, equalityFn = Object.is) => {
|
|
6171
|
-
const [, forceUpdate] = useReducer((
|
|
6347
|
+
const [, forceUpdate] = useReducer((c2) => c2 + 1, 0);
|
|
6172
6348
|
const state = api.getState();
|
|
6173
6349
|
const stateRef = useRef(state);
|
|
6174
6350
|
const selectorRef = useRef(selector);
|
|
@@ -6273,7 +6449,7 @@ const isInputCounterIncrementEnabled = (item, itemActualQty, validationMap) => {
|
|
|
6273
6449
|
}
|
|
6274
6450
|
};
|
|
6275
6451
|
const isProductQtyCntAllowedToIncrement = (item, itemActualQty) => {
|
|
6276
|
-
const {
|
|
6452
|
+
const { qtyMax } = item;
|
|
6277
6453
|
return Number(itemActualQty) < Number(qtyMax || Number.MAX_SAFE_INTEGER);
|
|
6278
6454
|
};
|
|
6279
6455
|
const checkSelCtxParam = (item, validationMap, param) => {
|
|
@@ -6548,12 +6724,25 @@ var EProductKind;
|
|
|
6548
6724
|
EProductKind2["STATIC"] = "3e/static";
|
|
6549
6725
|
EProductKind2["REF"] = "3e/ref";
|
|
6550
6726
|
EProductKind2["QUERY"] = "3e/query";
|
|
6727
|
+
EProductKind2["CMS"] = "3e/cms";
|
|
6551
6728
|
})(EProductKind || (EProductKind = {}));
|
|
6552
6729
|
var EProductKindBucket;
|
|
6553
6730
|
(function(EProductKindBucket2) {
|
|
6554
6731
|
EProductKindBucket2["GROUP"] = "group";
|
|
6555
6732
|
EProductKindBucket2["PRODUCT"] = "product";
|
|
6556
6733
|
})(EProductKindBucket || (EProductKindBucket = {}));
|
|
6734
|
+
var EOrderUserRole;
|
|
6735
|
+
(function(EOrderUserRole2) {
|
|
6736
|
+
EOrderUserRole2["CREATOR"] = "CREATOR";
|
|
6737
|
+
EOrderUserRole2["CUSTOMER"] = "CUSTOMER";
|
|
6738
|
+
EOrderUserRole2["COUPONS"] = "COUPON";
|
|
6739
|
+
EOrderUserRole2["KIOSK"] = "KIOSK";
|
|
6740
|
+
EOrderUserRole2["WAITER"] = "WAITER";
|
|
6741
|
+
EOrderUserRole2["MANAGER"] = "MANAGER";
|
|
6742
|
+
EOrderUserRole2["VIEWER"] = "VIEWER";
|
|
6743
|
+
EOrderUserRole2["DRIVER"] = "DRIVER";
|
|
6744
|
+
EOrderUserRole2["STAFF"] = "STAFF";
|
|
6745
|
+
})(EOrderUserRole || (EOrderUserRole = {}));
|
|
6557
6746
|
var EOrderType;
|
|
6558
6747
|
(function(EOrderType2) {
|
|
6559
6748
|
EOrderType2["TAKE_AWAY"] = "TAKE_AWAY";
|
|
@@ -6567,12 +6756,45 @@ var EOrderType;
|
|
|
6567
6756
|
EOrderType2["UBER_DELIVERY"] = "UBER_DELIVERY";
|
|
6568
6757
|
EOrderType2["UBER_TAKE_AWAY"] = "UBER_TAKE_AWAY";
|
|
6569
6758
|
EOrderType2["UBER_DINE_IN"] = "UBER_DINE_IN";
|
|
6570
|
-
EOrderType2["BOLT_DELIVERY"] = "BOLT_DELIVERY";
|
|
6571
|
-
EOrderType2["BOLT_TAKE_AWAY"] = "BOLT_TAKE_AWAY";
|
|
6572
6759
|
EOrderType2["WOLT_DELIVERY"] = "WOLT_DELIVERY";
|
|
6573
6760
|
EOrderType2["WOLT_TAKE_AWAY"] = "WOLT_TAKE_AWAY";
|
|
6574
6761
|
EOrderType2["WOLT_DINE_IN"] = "WOLT_DINE_IN";
|
|
6762
|
+
EOrderType2["BOLT_DELIVERY"] = "BOLT_DELIVERY";
|
|
6763
|
+
EOrderType2["BOLT_TAKE_AWAY"] = "BOLT_TAKE_AWAY";
|
|
6764
|
+
EOrderType2["BOLT_DINE_IN"] = "BOLT_DINE_IN";
|
|
6765
|
+
EOrderType2["TAZZ_DELIVERY"] = "TAZZ_DELIVERY";
|
|
6766
|
+
EOrderType2["TAZZ_TAKE_AWAY"] = "TAZZ_TAKE_AWAY";
|
|
6767
|
+
EOrderType2["UPMENU_DELIVERY"] = "UPMENU_DELIVERY";
|
|
6768
|
+
EOrderType2["UPMENU_TAKE_AWAY"] = "UPMENU_TAKE_AWAY";
|
|
6769
|
+
EOrderType2["UPMENU_DINE_IN"] = "UPMENU_DINE_IN";
|
|
6575
6770
|
})(EOrderType || (EOrderType = {}));
|
|
6771
|
+
var EOrderSource;
|
|
6772
|
+
(function(EOrderSource2) {
|
|
6773
|
+
EOrderSource2["KIOSK"] = "KIOSK";
|
|
6774
|
+
EOrderSource2["WEB"] = "WEB";
|
|
6775
|
+
EOrderSource2["JUST_EAT_TAKE_AWAY"] = "JUSTEATTAKEAWAY";
|
|
6776
|
+
EOrderSource2["GLOVO"] = "GLOVO";
|
|
6777
|
+
EOrderSource2["PYSZNE"] = "PYSZNE";
|
|
6778
|
+
EOrderSource2["WOLT"] = "WOLT";
|
|
6779
|
+
EOrderSource2["UBER"] = "UBER";
|
|
6780
|
+
EOrderSource2["BOLT"] = "BOLT";
|
|
6781
|
+
EOrderSource2["TAZZ"] = "TAZZ";
|
|
6782
|
+
EOrderSource2["POS"] = "POS";
|
|
6783
|
+
EOrderSource2["UPMENU"] = "UPMENU";
|
|
6784
|
+
})(EOrderSource || (EOrderSource = {}));
|
|
6785
|
+
var EChannelName;
|
|
6786
|
+
(function(EChannelName2) {
|
|
6787
|
+
EChannelName2["DINE_IN"] = "DINE_IN";
|
|
6788
|
+
EChannelName2["TAKE_AWAY"] = "TAKE_AWAY";
|
|
6789
|
+
EChannelName2["DELIVERY"] = "DELIVERY";
|
|
6790
|
+
EChannelName2["GLOVO"] = "GLOVO";
|
|
6791
|
+
EChannelName2["JUSTEAT"] = "JUSTEAT";
|
|
6792
|
+
EChannelName2["UBER"] = "UBER";
|
|
6793
|
+
EChannelName2["BOLT"] = "BOLT";
|
|
6794
|
+
EChannelName2["WOLT"] = "WOLT";
|
|
6795
|
+
EChannelName2["TAZZ"] = "TAZZ";
|
|
6796
|
+
EChannelName2["UPMENU"] = "UPMENU";
|
|
6797
|
+
})(EChannelName || (EChannelName = {}));
|
|
6576
6798
|
var EOrderStatus;
|
|
6577
6799
|
(function(EOrderStatus2) {
|
|
6578
6800
|
EOrderStatus2["NEW"] = "NEW";
|
|
@@ -6598,17 +6820,14 @@ var EOrderPaymentType;
|
|
|
6598
6820
|
EOrderPaymentType2["RETURN"] = "RETURN";
|
|
6599
6821
|
EOrderPaymentType2["EXTERNAL"] = "EXTERNAL";
|
|
6600
6822
|
})(EOrderPaymentType || (EOrderPaymentType = {}));
|
|
6601
|
-
var
|
|
6602
|
-
(function(
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
EOrderSource2["UBER"] = "UBER";
|
|
6610
|
-
EOrderSource2["BOLT"] = "BOLT";
|
|
6611
|
-
})(EOrderSource || (EOrderSource = {}));
|
|
6823
|
+
var ERbiOrderExtra;
|
|
6824
|
+
(function(ERbiOrderExtra2) {
|
|
6825
|
+
ERbiOrderExtra2["POINTS_TOTAL"] = "x-rbi-loyalty-points";
|
|
6826
|
+
ERbiOrderExtra2["POINTS_EARNED"] = "x-rbi-points-earned";
|
|
6827
|
+
ERbiOrderExtra2["REWARDS"] = "x-rbi-rewards";
|
|
6828
|
+
ERbiOrderExtra2["OFFERS"] = "x-rbi-offers";
|
|
6829
|
+
ERbiOrderExtra2["CUSTOMER_NAME"] = "x-customer-name";
|
|
6830
|
+
})(ERbiOrderExtra || (ERbiOrderExtra = {}));
|
|
6612
6831
|
var EOrderLineStatus;
|
|
6613
6832
|
(function(EOrderLineStatus2) {
|
|
6614
6833
|
EOrderLineStatus2["NEW"] = "NEW";
|
|
@@ -6624,17 +6843,6 @@ var EOrderProductKind;
|
|
|
6624
6843
|
EOrderProductKind2["GROUP"] = "group";
|
|
6625
6844
|
EOrderProductKind2["PRODUCT"] = "product";
|
|
6626
6845
|
})(EOrderProductKind || (EOrderProductKind = {}));
|
|
6627
|
-
var EChannelName;
|
|
6628
|
-
(function(EChannelName2) {
|
|
6629
|
-
EChannelName2["DINE_IN"] = "DINE_IN";
|
|
6630
|
-
EChannelName2["TAKE_AWAY"] = "TAKE_AWAY";
|
|
6631
|
-
EChannelName2["DELIVERY"] = "DELIVERY";
|
|
6632
|
-
EChannelName2["GLOVO"] = "GLOVO";
|
|
6633
|
-
EChannelName2["JUSTEAT"] = "JUSTEAT";
|
|
6634
|
-
EChannelName2["UBER"] = "UBER";
|
|
6635
|
-
EChannelName2["BOLT"] = "BOLT";
|
|
6636
|
-
EChannelName2["WOLT"] = "WOLT";
|
|
6637
|
-
})(EChannelName || (EChannelName = {}));
|
|
6638
6846
|
var ENotificationType;
|
|
6639
6847
|
(function(ENotificationType2) {
|
|
6640
6848
|
ENotificationType2["ORDER_EVENT_ERROR"] = "OrderEventError";
|
|
@@ -6647,6 +6855,7 @@ const validateProductFilter = (product, stateFilter) => {
|
|
|
6647
6855
|
const stateFiltersWithFltCtx = stateFilter[fltCtx];
|
|
6648
6856
|
const hasProductFilters = !!Object.keys(productFilters).length;
|
|
6649
6857
|
if (hasProductFilters && stateFiltersWithFltCtx) {
|
|
6858
|
+
console.log("12345", productFilters);
|
|
6650
6859
|
const commonFilters = Object.keys(stateFiltersWithFltCtx).filter(
|
|
6651
6860
|
(filterName) => Object.keys(productFilters).includes(filterName) && productFilters[filterName].includes(stateFiltersWithFltCtx[filterName])
|
|
6652
6861
|
);
|
|
@@ -6737,75 +6946,8 @@ function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
|
|
|
6737
6946
|
}
|
|
6738
6947
|
var jsxRuntime = { exports: {} };
|
|
6739
6948
|
var reactJsxRuntime_production_min = {};
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
(c) Sindre Sorhus
|
|
6743
|
-
@license MIT
|
|
6744
|
-
*/
|
|
6745
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
6746
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
6747
|
-
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
6748
|
-
function toObject(val) {
|
|
6749
|
-
if (val === null || val === void 0) {
|
|
6750
|
-
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
6751
|
-
}
|
|
6752
|
-
return Object(val);
|
|
6753
|
-
}
|
|
6754
|
-
function shouldUseNative() {
|
|
6755
|
-
try {
|
|
6756
|
-
if (!Object.assign) {
|
|
6757
|
-
return false;
|
|
6758
|
-
}
|
|
6759
|
-
var test1 = new String("abc");
|
|
6760
|
-
test1[5] = "de";
|
|
6761
|
-
if (Object.getOwnPropertyNames(test1)[0] === "5") {
|
|
6762
|
-
return false;
|
|
6763
|
-
}
|
|
6764
|
-
var test2 = {};
|
|
6765
|
-
for (var i2 = 0; i2 < 10; i2++) {
|
|
6766
|
-
test2["_" + String.fromCharCode(i2)] = i2;
|
|
6767
|
-
}
|
|
6768
|
-
var order2 = Object.getOwnPropertyNames(test2).map(function(n2) {
|
|
6769
|
-
return test2[n2];
|
|
6770
|
-
});
|
|
6771
|
-
if (order2.join("") !== "0123456789") {
|
|
6772
|
-
return false;
|
|
6773
|
-
}
|
|
6774
|
-
var test3 = {};
|
|
6775
|
-
"abcdefghijklmnopqrst".split("").forEach(function(letter) {
|
|
6776
|
-
test3[letter] = letter;
|
|
6777
|
-
});
|
|
6778
|
-
if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
|
|
6779
|
-
return false;
|
|
6780
|
-
}
|
|
6781
|
-
return true;
|
|
6782
|
-
} catch (err) {
|
|
6783
|
-
return false;
|
|
6784
|
-
}
|
|
6785
|
-
}
|
|
6786
|
-
shouldUseNative() ? Object.assign : function(target, source) {
|
|
6787
|
-
var from;
|
|
6788
|
-
var to = toObject(target);
|
|
6789
|
-
var symbols;
|
|
6790
|
-
for (var s2 = 1; s2 < arguments.length; s2++) {
|
|
6791
|
-
from = Object(arguments[s2]);
|
|
6792
|
-
for (var key in from) {
|
|
6793
|
-
if (hasOwnProperty.call(from, key)) {
|
|
6794
|
-
to[key] = from[key];
|
|
6795
|
-
}
|
|
6796
|
-
}
|
|
6797
|
-
if (getOwnPropertySymbols) {
|
|
6798
|
-
symbols = getOwnPropertySymbols(from);
|
|
6799
|
-
for (var i2 = 0; i2 < symbols.length; i2++) {
|
|
6800
|
-
if (propIsEnumerable.call(from, symbols[i2])) {
|
|
6801
|
-
to[symbols[i2]] = from[symbols[i2]];
|
|
6802
|
-
}
|
|
6803
|
-
}
|
|
6804
|
-
}
|
|
6805
|
-
}
|
|
6806
|
-
return to;
|
|
6807
|
-
};
|
|
6808
|
-
/** @license React v17.0.2
|
|
6949
|
+
/**
|
|
6950
|
+
* @license React
|
|
6809
6951
|
* react-jsx-runtime.production.min.js
|
|
6810
6952
|
*
|
|
6811
6953
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -6813,28 +6955,22 @@ shouldUseNative() ? Object.assign : function(target, source) {
|
|
|
6813
6955
|
* This source code is licensed under the MIT license found in the
|
|
6814
6956
|
* LICENSE file in the root directory of this source tree.
|
|
6815
6957
|
*/
|
|
6816
|
-
var f$3 =
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
g = h$3("react.element");
|
|
6821
|
-
reactJsxRuntime_production_min.Fragment = h$3("react.fragment");
|
|
6822
|
-
}
|
|
6823
|
-
var m$3 = f$3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n$2 = Object.prototype.hasOwnProperty, p$3 = { key: true, ref: true, __self: true, __source: true };
|
|
6824
|
-
function q(c, a2, k2) {
|
|
6825
|
-
var b, d2 = {}, e2 = null, l2 = null;
|
|
6826
|
-
void 0 !== k2 && (e2 = "" + k2);
|
|
6958
|
+
var f$5 = React__default, k$1 = Symbol.for("react.element"), l$6 = Symbol.for("react.fragment"), m$3 = Object.prototype.hasOwnProperty, n$4 = f$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p$4 = { key: true, ref: true, __self: true, __source: true };
|
|
6959
|
+
function q$1(c2, a2, g2) {
|
|
6960
|
+
var b2, d2 = {}, e2 = null, h2 = null;
|
|
6961
|
+
void 0 !== g2 && (e2 = "" + g2);
|
|
6827
6962
|
void 0 !== a2.key && (e2 = "" + a2.key);
|
|
6828
|
-
void 0 !== a2.ref && (
|
|
6829
|
-
for (
|
|
6830
|
-
|
|
6831
|
-
if (
|
|
6832
|
-
for (
|
|
6833
|
-
void 0 === d2[
|
|
6834
|
-
return { $$typeof:
|
|
6835
|
-
}
|
|
6836
|
-
reactJsxRuntime_production_min.
|
|
6837
|
-
reactJsxRuntime_production_min.
|
|
6963
|
+
void 0 !== a2.ref && (h2 = a2.ref);
|
|
6964
|
+
for (b2 in a2)
|
|
6965
|
+
m$3.call(a2, b2) && !p$4.hasOwnProperty(b2) && (d2[b2] = a2[b2]);
|
|
6966
|
+
if (c2 && c2.defaultProps)
|
|
6967
|
+
for (b2 in a2 = c2.defaultProps, a2)
|
|
6968
|
+
void 0 === d2[b2] && (d2[b2] = a2[b2]);
|
|
6969
|
+
return { $$typeof: k$1, type: c2, key: e2, ref: h2, props: d2, _owner: n$4.current };
|
|
6970
|
+
}
|
|
6971
|
+
reactJsxRuntime_production_min.Fragment = l$6;
|
|
6972
|
+
reactJsxRuntime_production_min.jsx = q$1;
|
|
6973
|
+
reactJsxRuntime_production_min.jsxs = q$1;
|
|
6838
6974
|
{
|
|
6839
6975
|
jsxRuntime.exports = reactJsxRuntime_production_min;
|
|
6840
6976
|
}
|
|
@@ -6943,8 +7079,8 @@ function _nonIterableRest() {
|
|
|
6943
7079
|
}
|
|
6944
7080
|
var Static = {
|
|
6945
7081
|
normalizePrecision: function normalizePrecision(objects) {
|
|
6946
|
-
var highestPrecision = objects.reduce(function(a2,
|
|
6947
|
-
return Math.max(a2.getPrecision(),
|
|
7082
|
+
var highestPrecision = objects.reduce(function(a2, b2) {
|
|
7083
|
+
return Math.max(a2.getPrecision(), b2.getPrecision());
|
|
6948
7084
|
});
|
|
6949
7085
|
return objects.map(function(object) {
|
|
6950
7086
|
return object.getPrecision() !== highestPrecision ? object.convertPrecision(highestPrecision) : object;
|
|
@@ -7049,12 +7185,12 @@ function isThenable(value) {
|
|
|
7049
7185
|
return Boolean(value) && (_typeof(value) === "object" || typeof value === "function") && typeof value.then === "function";
|
|
7050
7186
|
}
|
|
7051
7187
|
function Calculator() {
|
|
7052
|
-
var floatMultiply = function floatMultiply2(a2,
|
|
7188
|
+
var floatMultiply = function floatMultiply2(a2, b2) {
|
|
7053
7189
|
var getFactor = function getFactor2(number) {
|
|
7054
7190
|
return Math.pow(10, countFractionDigits(number));
|
|
7055
7191
|
};
|
|
7056
|
-
var factor = Math.max(getFactor(a2), getFactor(
|
|
7057
|
-
return Math.round(a2 * factor) * Math.round(
|
|
7192
|
+
var factor = Math.max(getFactor(a2), getFactor(b2));
|
|
7193
|
+
return Math.round(a2 * factor) * Math.round(b2 * factor) / (factor * factor);
|
|
7058
7194
|
};
|
|
7059
7195
|
var roundingModes = {
|
|
7060
7196
|
HALF_ODD: function HALF_ODD(number) {
|
|
@@ -7082,20 +7218,20 @@ function Calculator() {
|
|
|
7082
7218
|
}
|
|
7083
7219
|
};
|
|
7084
7220
|
return {
|
|
7085
|
-
add: function add(a2,
|
|
7086
|
-
return a2 +
|
|
7221
|
+
add: function add(a2, b2) {
|
|
7222
|
+
return a2 + b2;
|
|
7087
7223
|
},
|
|
7088
|
-
subtract: function subtract(a2,
|
|
7089
|
-
return a2 -
|
|
7224
|
+
subtract: function subtract(a2, b2) {
|
|
7225
|
+
return a2 - b2;
|
|
7090
7226
|
},
|
|
7091
|
-
multiply: function multiply(a2,
|
|
7092
|
-
return isFloat(a2) || isFloat(
|
|
7227
|
+
multiply: function multiply(a2, b2) {
|
|
7228
|
+
return isFloat(a2) || isFloat(b2) ? floatMultiply(a2, b2) : a2 * b2;
|
|
7093
7229
|
},
|
|
7094
|
-
divide: function divide(a2,
|
|
7095
|
-
return a2 /
|
|
7230
|
+
divide: function divide(a2, b2) {
|
|
7231
|
+
return a2 / b2;
|
|
7096
7232
|
},
|
|
7097
|
-
modulo: function modulo(a2,
|
|
7098
|
-
return a2 %
|
|
7233
|
+
modulo: function modulo(a2, b2) {
|
|
7234
|
+
return a2 % b2;
|
|
7099
7235
|
},
|
|
7100
7236
|
round: function round(number) {
|
|
7101
7237
|
var roundingMode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "HALF_EVEN";
|
|
@@ -7277,8 +7413,8 @@ var Dinero = function Dinero2(options) {
|
|
|
7277
7413
|
allocate: function allocate(ratios) {
|
|
7278
7414
|
var _this = this;
|
|
7279
7415
|
assertValidRatios(ratios);
|
|
7280
|
-
var total = ratios.reduce(function(a2,
|
|
7281
|
-
return calculator$1.add(a2,
|
|
7416
|
+
var total = ratios.reduce(function(a2, b2) {
|
|
7417
|
+
return calculator$1.add(a2, b2);
|
|
7282
7418
|
});
|
|
7283
7419
|
var remainder = this.getAmount();
|
|
7284
7420
|
var shares = ratios.map(function(ratio) {
|
|
@@ -7382,7 +7518,7 @@ var Dinero = function Dinero2(options) {
|
|
|
7382
7518
|
var factor = Math.pow(10, digits);
|
|
7383
7519
|
return calculator$1.divide(calculator$1.round(calculator$1.multiply(this.toUnit(), factor), roundingMode), factor);
|
|
7384
7520
|
},
|
|
7385
|
-
toObject: function
|
|
7521
|
+
toObject: function toObject() {
|
|
7386
7522
|
return {
|
|
7387
7523
|
amount,
|
|
7388
7524
|
currency,
|
|
@@ -7652,34 +7788,34 @@ function hasLoadedNamespace(ns, i18n) {
|
|
|
7652
7788
|
}
|
|
7653
7789
|
});
|
|
7654
7790
|
}
|
|
7655
|
-
function _iterableToArrayLimit(
|
|
7656
|
-
var
|
|
7657
|
-
if (null !=
|
|
7658
|
-
var
|
|
7791
|
+
function _iterableToArrayLimit(r2, l2) {
|
|
7792
|
+
var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"];
|
|
7793
|
+
if (null != t2) {
|
|
7794
|
+
var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false;
|
|
7659
7795
|
try {
|
|
7660
|
-
if (
|
|
7661
|
-
if (Object(
|
|
7796
|
+
if (i2 = (t2 = t2.call(r2)).next, 0 === l2) {
|
|
7797
|
+
if (Object(t2) !== t2)
|
|
7662
7798
|
return;
|
|
7663
|
-
|
|
7799
|
+
f2 = false;
|
|
7664
7800
|
} else
|
|
7665
|
-
for (; !(
|
|
7801
|
+
for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true)
|
|
7666
7802
|
;
|
|
7667
|
-
} catch (
|
|
7668
|
-
|
|
7803
|
+
} catch (r3) {
|
|
7804
|
+
o2 = true, n2 = r3;
|
|
7669
7805
|
} finally {
|
|
7670
7806
|
try {
|
|
7671
|
-
if (!
|
|
7807
|
+
if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2))
|
|
7672
7808
|
return;
|
|
7673
7809
|
} finally {
|
|
7674
|
-
if (
|
|
7675
|
-
throw
|
|
7810
|
+
if (o2)
|
|
7811
|
+
throw n2;
|
|
7676
7812
|
}
|
|
7677
7813
|
}
|
|
7678
|
-
return
|
|
7814
|
+
return a2;
|
|
7679
7815
|
}
|
|
7680
7816
|
}
|
|
7681
|
-
function _slicedToArray(
|
|
7682
|
-
return _arrayWithHoles$1(
|
|
7817
|
+
function _slicedToArray(r2, e2) {
|
|
7818
|
+
return _arrayWithHoles$1(r2) || _iterableToArrayLimit(r2, e2) || _unsupportedIterableToArray$1(r2, e2) || _nonIterableRest$1();
|
|
7683
7819
|
}
|
|
7684
7820
|
function ownKeys(object, enumerableOnly) {
|
|
7685
7821
|
var keys2 = Object.keys(object);
|
|
@@ -7894,12 +8030,12 @@ var cookie = {
|
|
|
7894
8030
|
var nameEQ = "".concat(name, "=");
|
|
7895
8031
|
var ca = document.cookie.split(";");
|
|
7896
8032
|
for (var i2 = 0; i2 < ca.length; i2++) {
|
|
7897
|
-
var
|
|
7898
|
-
while (
|
|
7899
|
-
|
|
8033
|
+
var c2 = ca[i2];
|
|
8034
|
+
while (c2.charAt(0) === " ") {
|
|
8035
|
+
c2 = c2.substring(1, c2.length);
|
|
7900
8036
|
}
|
|
7901
|
-
if (
|
|
7902
|
-
return
|
|
8037
|
+
if (c2.indexOf(nameEQ) === 0)
|
|
8038
|
+
return c2.substring(nameEQ.length, c2.length);
|
|
7903
8039
|
}
|
|
7904
8040
|
return null;
|
|
7905
8041
|
},
|
|
@@ -7912,9 +8048,9 @@ var cookie$1 = {
|
|
|
7912
8048
|
lookup: function lookup(options) {
|
|
7913
8049
|
var found;
|
|
7914
8050
|
if (options.lookupCookie && typeof document !== "undefined") {
|
|
7915
|
-
var
|
|
7916
|
-
if (
|
|
7917
|
-
found =
|
|
8051
|
+
var c2 = cookie.read(options.lookupCookie);
|
|
8052
|
+
if (c2)
|
|
8053
|
+
found = c2;
|
|
7918
8054
|
}
|
|
7919
8055
|
return found;
|
|
7920
8056
|
},
|
|
@@ -8405,7 +8541,7 @@ const MenuOptionsDefaultUI = (props) => {
|
|
|
8405
8541
|
})]
|
|
8406
8542
|
});
|
|
8407
8543
|
};
|
|
8408
|
-
const ComponentsContext =
|
|
8544
|
+
const ComponentsContext = React__default.createContext(null);
|
|
8409
8545
|
function useComponents() {
|
|
8410
8546
|
const context = useContext(ComponentsContext);
|
|
8411
8547
|
if (!context) {
|
|
@@ -8664,6 +8800,9 @@ function useEmitFilter(product) {
|
|
|
8664
8800
|
const setFilter = useStore((state) => state.setFilter);
|
|
8665
8801
|
const { id, selCtx, emit = {}, fltCtx } = product;
|
|
8666
8802
|
const value = watch(`selected.${selCtx}.${id}`);
|
|
8803
|
+
if (id === "MI1001001") {
|
|
8804
|
+
console.log("use emit filter", value, fltCtx, emit);
|
|
8805
|
+
}
|
|
8667
8806
|
useEffect(() => {
|
|
8668
8807
|
if (value && fltCtx && !isEmpty(emit)) {
|
|
8669
8808
|
setFilter(fltCtx, emit);
|
|
@@ -8703,7 +8842,7 @@ const selectUnselectProduct = (setValue, getValues, items, isChecked, state) =>
|
|
|
8703
8842
|
if (isChecked) {
|
|
8704
8843
|
addProductToState(selected, setValue);
|
|
8705
8844
|
const checkSubProducts = (items2) => {
|
|
8706
|
-
if (!Array.isArray(items2))
|
|
8845
|
+
if (!Array.isArray(items2) || isEmpty(state == null ? void 0 : state.selected))
|
|
8707
8846
|
return;
|
|
8708
8847
|
items2.map((product) => {
|
|
8709
8848
|
if (product.state && "selected" in product.state) {
|
|
@@ -9069,11 +9208,14 @@ const DisplayState = () => {
|
|
|
9069
9208
|
const {
|
|
9070
9209
|
watch
|
|
9071
9210
|
} = useFormContext();
|
|
9211
|
+
const form = useFormContext();
|
|
9072
9212
|
const selected = watch("selected");
|
|
9213
|
+
const filter = form.getValues("filter");
|
|
9073
9214
|
const validationMap = useStore((state) => state.validationMap);
|
|
9074
9215
|
console.log({
|
|
9075
9216
|
selected,
|
|
9076
|
-
validationMap
|
|
9217
|
+
validationMap,
|
|
9218
|
+
filter
|
|
9077
9219
|
});
|
|
9078
9220
|
return /* @__PURE__ */ jsxs("div", {
|
|
9079
9221
|
className: "flex flex-col items-center py-4",
|
|
@@ -9085,7 +9227,7 @@ const DisplayState = () => {
|
|
|
9085
9227
|
children: [/* @__PURE__ */ jsxs("p", {
|
|
9086
9228
|
className: "text-lg font-semibold",
|
|
9087
9229
|
children: [selCtx, ":"]
|
|
9088
|
-
}), Object.keys(selected[selCtx]).map((id) => /* @__PURE__ */ jsx(
|
|
9230
|
+
}), Object.keys(selected[selCtx]).map((id) => /* @__PURE__ */ jsx(React__default.Fragment, {
|
|
9089
9231
|
children: selected[selCtx][id] && /* @__PURE__ */ jsxs("p", {
|
|
9090
9232
|
children: [id, ":", selected[selCtx][id].toString()]
|
|
9091
9233
|
})
|
|
@@ -9241,24 +9383,62 @@ function clsx() {
|
|
|
9241
9383
|
(e2 = arguments[f2++]) && (t2 = r$4(e2)) && (n2 && (n2 += " "), n2 += t2);
|
|
9242
9384
|
return n2;
|
|
9243
9385
|
}
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9386
|
+
var i$3 = Object.defineProperty;
|
|
9387
|
+
var d$5 = (t2, e2, n2) => e2 in t2 ? i$3(t2, e2, { enumerable: true, configurable: true, writable: true, value: n2 }) : t2[e2] = n2;
|
|
9388
|
+
var r$3 = (t2, e2, n2) => (d$5(t2, typeof e2 != "symbol" ? e2 + "" : e2, n2), n2);
|
|
9389
|
+
class o$5 {
|
|
9390
|
+
constructor() {
|
|
9391
|
+
r$3(this, "current", this.detect());
|
|
9392
|
+
r$3(this, "handoffState", "pending");
|
|
9393
|
+
r$3(this, "currentId", 0);
|
|
9394
|
+
}
|
|
9395
|
+
set(e2) {
|
|
9396
|
+
this.current !== e2 && (this.handoffState = "pending", this.currentId = 0, this.current = e2);
|
|
9397
|
+
}
|
|
9398
|
+
reset() {
|
|
9399
|
+
this.set(this.detect());
|
|
9400
|
+
}
|
|
9401
|
+
nextId() {
|
|
9402
|
+
return ++this.currentId;
|
|
9403
|
+
}
|
|
9404
|
+
get isServer() {
|
|
9405
|
+
return this.current === "server";
|
|
9406
|
+
}
|
|
9407
|
+
get isClient() {
|
|
9408
|
+
return this.current === "client";
|
|
9409
|
+
}
|
|
9410
|
+
detect() {
|
|
9411
|
+
return typeof window == "undefined" || typeof document == "undefined" ? "server" : "client";
|
|
9412
|
+
}
|
|
9413
|
+
handoff() {
|
|
9414
|
+
this.handoffState === "pending" && (this.handoffState = "complete");
|
|
9415
|
+
}
|
|
9416
|
+
get isHandoffComplete() {
|
|
9417
|
+
return this.handoffState === "complete";
|
|
9418
|
+
}
|
|
9419
|
+
}
|
|
9420
|
+
let s$8 = new o$5();
|
|
9421
|
+
let l$5 = (e2, f2) => {
|
|
9422
|
+
s$8.isServer ? useEffect(e2, f2) : useLayoutEffect(e2, f2);
|
|
9423
|
+
};
|
|
9424
|
+
function s$7(e2) {
|
|
9247
9425
|
let r2 = useRef(e2);
|
|
9248
|
-
return
|
|
9426
|
+
return l$5(() => {
|
|
9249
9427
|
r2.current = e2;
|
|
9250
9428
|
}, [e2]), r2;
|
|
9251
9429
|
}
|
|
9252
|
-
function
|
|
9430
|
+
let o$4 = function(t2) {
|
|
9431
|
+
let e2 = s$7(t2);
|
|
9432
|
+
return React__default.useCallback((...r2) => e2.current(...r2), [e2]);
|
|
9433
|
+
};
|
|
9434
|
+
function t$6(e2) {
|
|
9253
9435
|
typeof queueMicrotask == "function" ? queueMicrotask(e2) : Promise.resolve().then(e2).catch((o2) => setTimeout(() => {
|
|
9254
9436
|
throw o2;
|
|
9255
9437
|
}));
|
|
9256
9438
|
}
|
|
9257
|
-
function
|
|
9258
|
-
let n2 = [],
|
|
9259
|
-
|
|
9260
|
-
}, addEventListener(e2, t2, a2, o2) {
|
|
9261
|
-
return e2.addEventListener(t2, a2, o2), r2.add(() => e2.removeEventListener(t2, a2, o2));
|
|
9439
|
+
function o$3() {
|
|
9440
|
+
let n2 = [], r2 = { addEventListener(e2, t2, s2, a2) {
|
|
9441
|
+
return e2.addEventListener(t2, s2, a2), r2.add(() => e2.removeEventListener(t2, s2, a2));
|
|
9262
9442
|
}, requestAnimationFrame(...e2) {
|
|
9263
9443
|
let t2 = requestAnimationFrame(...e2);
|
|
9264
9444
|
return r2.add(() => cancelAnimationFrame(t2));
|
|
@@ -9268,130 +9448,134 @@ function m$2() {
|
|
|
9268
9448
|
let t2 = setTimeout(...e2);
|
|
9269
9449
|
return r2.add(() => clearTimeout(t2));
|
|
9270
9450
|
}, microTask(...e2) {
|
|
9271
|
-
let
|
|
9272
|
-
return t(() => {
|
|
9273
|
-
|
|
9451
|
+
let t2 = { current: true };
|
|
9452
|
+
return t$6(() => {
|
|
9453
|
+
t2.current && e2[0]();
|
|
9274
9454
|
}), r2.add(() => {
|
|
9275
|
-
|
|
9455
|
+
t2.current = false;
|
|
9276
9456
|
});
|
|
9457
|
+
}, style(e2, t2, s2) {
|
|
9458
|
+
let a2 = e2.style.getPropertyValue(t2);
|
|
9459
|
+
return Object.assign(e2.style, { [t2]: s2 }), this.add(() => {
|
|
9460
|
+
Object.assign(e2.style, { [t2]: a2 });
|
|
9461
|
+
});
|
|
9462
|
+
}, group(e2) {
|
|
9463
|
+
let t2 = o$3();
|
|
9464
|
+
return e2(t2), this.add(() => t2.dispose());
|
|
9277
9465
|
}, add(e2) {
|
|
9278
9466
|
return n2.push(e2), () => {
|
|
9279
9467
|
let t2 = n2.indexOf(e2);
|
|
9280
|
-
if (t2 >= 0)
|
|
9281
|
-
let
|
|
9282
|
-
|
|
9283
|
-
}
|
|
9468
|
+
if (t2 >= 0)
|
|
9469
|
+
for (let s2 of n2.splice(t2, 1))
|
|
9470
|
+
s2();
|
|
9284
9471
|
};
|
|
9285
9472
|
}, dispose() {
|
|
9286
9473
|
for (let e2 of n2.splice(0))
|
|
9287
9474
|
e2();
|
|
9288
|
-
}, async workQueue() {
|
|
9289
|
-
for (let e2 of i2.splice(0))
|
|
9290
|
-
await e2();
|
|
9291
9475
|
} };
|
|
9292
9476
|
return r2;
|
|
9293
9477
|
}
|
|
9294
|
-
function p$
|
|
9295
|
-
let [e2] = useState(
|
|
9478
|
+
function p$3() {
|
|
9479
|
+
let [e2] = useState(o$3);
|
|
9296
9480
|
return useEffect(() => () => e2.dispose(), [e2]), e2;
|
|
9297
9481
|
}
|
|
9298
|
-
|
|
9299
|
-
let
|
|
9300
|
-
return React
|
|
9301
|
-
};
|
|
9302
|
-
|
|
9303
|
-
function
|
|
9304
|
-
let [e2,
|
|
9305
|
-
return useEffect(() => {
|
|
9306
|
-
e2 !== true &&
|
|
9307
|
-
}, [e2]), useEffect(() =>
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
return ++l$3;
|
|
9315
|
-
}
|
|
9316
|
-
let I$2 = (u$4 = React.useId) != null ? u$4 : function() {
|
|
9317
|
-
let n2 = a$2(), [e2, o2] = React.useState(n2 ? r$2 : null);
|
|
9318
|
-
return s$6(() => {
|
|
9319
|
-
e2 === null && o2(r$2());
|
|
9482
|
+
function s$6() {
|
|
9483
|
+
let r2 = typeof document == "undefined";
|
|
9484
|
+
return "useSyncExternalStore" in React ? ((o2) => o2.useSyncExternalStore)(React)(() => () => {
|
|
9485
|
+
}, () => false, () => !r2) : false;
|
|
9486
|
+
}
|
|
9487
|
+
function l$4() {
|
|
9488
|
+
let r2 = s$6(), [e2, n2] = React.useState(s$8.isHandoffComplete);
|
|
9489
|
+
return e2 && s$8.isHandoffComplete === false && n2(false), React.useEffect(() => {
|
|
9490
|
+
e2 !== true && n2(true);
|
|
9491
|
+
}, [e2]), React.useEffect(() => s$8.handoff(), []), r2 ? false : e2;
|
|
9492
|
+
}
|
|
9493
|
+
var o$2;
|
|
9494
|
+
let I$5 = (o$2 = React__default.useId) != null ? o$2 : function() {
|
|
9495
|
+
let n2 = l$4(), [e2, u2] = React__default.useState(n2 ? () => s$8.nextId() : null);
|
|
9496
|
+
return l$5(() => {
|
|
9497
|
+
e2 === null && u2(s$8.nextId());
|
|
9320
9498
|
}, [e2]), e2 != null ? "" + e2 : void 0;
|
|
9321
9499
|
};
|
|
9322
|
-
function u$
|
|
9500
|
+
function u$5(r2, n2, ...a2) {
|
|
9323
9501
|
if (r2 in n2) {
|
|
9324
9502
|
let e2 = n2[r2];
|
|
9325
9503
|
return typeof e2 == "function" ? e2(...a2) : e2;
|
|
9326
9504
|
}
|
|
9327
9505
|
let t2 = new Error(`Tried to handle "${r2}" but there is no handler defined. Only defined handlers are: ${Object.keys(n2).map((e2) => `"${e2}"`).join(", ")}.`);
|
|
9328
|
-
throw Error.captureStackTrace && Error.captureStackTrace(t2, u$
|
|
9506
|
+
throw Error.captureStackTrace && Error.captureStackTrace(t2, u$5), t2;
|
|
9329
9507
|
}
|
|
9330
|
-
function
|
|
9331
|
-
return
|
|
9508
|
+
function o$1(r2) {
|
|
9509
|
+
return s$8.isServer ? null : r2 instanceof Node ? r2.ownerDocument : r2 != null && r2.hasOwnProperty("current") && r2.current instanceof Node ? r2.current.ownerDocument : document;
|
|
9332
9510
|
}
|
|
9333
|
-
let
|
|
9334
|
-
var
|
|
9335
|
-
function
|
|
9336
|
-
return e2 == null ? [] : Array.from(e2.querySelectorAll(
|
|
9511
|
+
let c$4 = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e2) => `${e2}:not([tabindex='-1'])`).join(",");
|
|
9512
|
+
var M$2 = ((n2) => (n2[n2.First = 1] = "First", n2[n2.Previous = 2] = "Previous", n2[n2.Next = 4] = "Next", n2[n2.Last = 8] = "Last", n2[n2.WrapAround = 16] = "WrapAround", n2[n2.NoScroll = 32] = "NoScroll", n2))(M$2 || {}), N$2 = ((o2) => (o2[o2.Error = 0] = "Error", o2[o2.Overflow = 1] = "Overflow", o2[o2.Success = 2] = "Success", o2[o2.Underflow = 3] = "Underflow", o2))(N$2 || {}), F$2 = ((t2) => (t2[t2.Previous = -1] = "Previous", t2[t2.Next = 1] = "Next", t2))(F$2 || {});
|
|
9513
|
+
function f$4(e2 = document.body) {
|
|
9514
|
+
return e2 == null ? [] : Array.from(e2.querySelectorAll(c$4)).sort((r2, t2) => Math.sign((r2.tabIndex || Number.MAX_SAFE_INTEGER) - (t2.tabIndex || Number.MAX_SAFE_INTEGER)));
|
|
9337
9515
|
}
|
|
9338
|
-
var
|
|
9339
|
-
function h$2(e2,
|
|
9340
|
-
var
|
|
9341
|
-
return e2 === ((
|
|
9342
|
-
return e2.matches(
|
|
9516
|
+
var T$1 = ((t2) => (t2[t2.Strict = 0] = "Strict", t2[t2.Loose = 1] = "Loose", t2))(T$1 || {});
|
|
9517
|
+
function h$2(e2, r2 = 0) {
|
|
9518
|
+
var t2;
|
|
9519
|
+
return e2 === ((t2 = o$1(e2)) == null ? void 0 : t2.body) ? false : u$5(r2, { [0]() {
|
|
9520
|
+
return e2.matches(c$4);
|
|
9343
9521
|
}, [1]() {
|
|
9344
9522
|
let l2 = e2;
|
|
9345
9523
|
for (; l2 !== null; ) {
|
|
9346
|
-
if (l2.matches(
|
|
9524
|
+
if (l2.matches(c$4))
|
|
9347
9525
|
return true;
|
|
9348
9526
|
l2 = l2.parentElement;
|
|
9349
9527
|
}
|
|
9350
9528
|
return false;
|
|
9351
9529
|
} });
|
|
9352
9530
|
}
|
|
9353
|
-
|
|
9531
|
+
var w$1 = ((t2) => (t2[t2.Keyboard = 0] = "Keyboard", t2[t2.Mouse = 1] = "Mouse", t2))(w$1 || {});
|
|
9532
|
+
typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("keydown", (e2) => {
|
|
9533
|
+
e2.metaKey || e2.altKey || e2.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
|
|
9534
|
+
}, true), document.addEventListener("click", (e2) => {
|
|
9535
|
+
e2.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e2.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
|
|
9536
|
+
}, true));
|
|
9537
|
+
function y$3(e2) {
|
|
9354
9538
|
e2 == null || e2.focus({ preventScroll: true });
|
|
9355
9539
|
}
|
|
9356
|
-
let
|
|
9357
|
-
function
|
|
9358
|
-
var
|
|
9359
|
-
return (
|
|
9540
|
+
let S$5 = ["textarea", "input"].join(",");
|
|
9541
|
+
function H(e2) {
|
|
9542
|
+
var r2, t2;
|
|
9543
|
+
return (t2 = (r2 = e2 == null ? void 0 : e2.matches) == null ? void 0 : r2.call(e2, S$5)) != null ? t2 : false;
|
|
9360
9544
|
}
|
|
9361
|
-
function
|
|
9362
|
-
return e2.slice().sort((
|
|
9363
|
-
let o2 = t2
|
|
9545
|
+
function I$4(e2, r2 = (t2) => t2) {
|
|
9546
|
+
return e2.slice().sort((t2, l2) => {
|
|
9547
|
+
let o2 = r2(t2), i2 = r2(l2);
|
|
9364
9548
|
if (o2 === null || i2 === null)
|
|
9365
9549
|
return 0;
|
|
9366
9550
|
let n2 = o2.compareDocumentPosition(i2);
|
|
9367
9551
|
return n2 & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : n2 & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
|
9368
9552
|
});
|
|
9369
9553
|
}
|
|
9370
|
-
function
|
|
9371
|
-
let i2 = Array.isArray(e2) ? e2.length > 0 ? e2[0].ownerDocument : document : e2.ownerDocument, n2 = Array.isArray(e2) ?
|
|
9372
|
-
o2.length > 0 && (n2 = n2.filter((s2) => !o2.includes(s2))), l2 = l2 != null ? l2 : i2.activeElement;
|
|
9373
|
-
let
|
|
9374
|
-
if (
|
|
9554
|
+
function O$1(e2, r2, { sorted: t2 = true, relativeTo: l2 = null, skipElements: o2 = [] } = {}) {
|
|
9555
|
+
let i2 = Array.isArray(e2) ? e2.length > 0 ? e2[0].ownerDocument : document : e2.ownerDocument, n2 = Array.isArray(e2) ? t2 ? I$4(e2) : e2 : f$4(e2);
|
|
9556
|
+
o2.length > 0 && n2.length > 1 && (n2 = n2.filter((s2) => !o2.includes(s2))), l2 = l2 != null ? l2 : i2.activeElement;
|
|
9557
|
+
let E2 = (() => {
|
|
9558
|
+
if (r2 & 5)
|
|
9375
9559
|
return 1;
|
|
9376
|
-
if (
|
|
9560
|
+
if (r2 & 10)
|
|
9377
9561
|
return -1;
|
|
9378
9562
|
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
9379
9563
|
})(), x2 = (() => {
|
|
9380
|
-
if (
|
|
9564
|
+
if (r2 & 1)
|
|
9381
9565
|
return 0;
|
|
9382
|
-
if (
|
|
9566
|
+
if (r2 & 2)
|
|
9383
9567
|
return Math.max(0, n2.indexOf(l2)) - 1;
|
|
9384
|
-
if (
|
|
9568
|
+
if (r2 & 4)
|
|
9385
9569
|
return Math.max(0, n2.indexOf(l2)) + 1;
|
|
9386
|
-
if (
|
|
9570
|
+
if (r2 & 8)
|
|
9387
9571
|
return n2.length - 1;
|
|
9388
9572
|
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
9389
|
-
})(), p2 =
|
|
9573
|
+
})(), p2 = r2 & 32 ? { preventScroll: true } : {}, d2 = 0, a2 = n2.length, u2;
|
|
9390
9574
|
do {
|
|
9391
|
-
if (
|
|
9575
|
+
if (d2 >= a2 || d2 + a2 <= 0)
|
|
9392
9576
|
return 0;
|
|
9393
|
-
let s2 = x2 +
|
|
9394
|
-
if (
|
|
9577
|
+
let s2 = x2 + d2;
|
|
9578
|
+
if (r2 & 16)
|
|
9395
9579
|
s2 = (s2 + a2) % a2;
|
|
9396
9580
|
else {
|
|
9397
9581
|
if (s2 < 0)
|
|
@@ -9399,12 +9583,21 @@ function I$1(e2, t2, { sorted: r2 = true, relativeTo: l2 = null, skipElements: o
|
|
|
9399
9583
|
if (s2 >= a2)
|
|
9400
9584
|
return 1;
|
|
9401
9585
|
}
|
|
9402
|
-
u2 = n2[s2], u2 == null || u2.focus(p2),
|
|
9586
|
+
u2 = n2[s2], u2 == null || u2.focus(p2), d2 += E2;
|
|
9403
9587
|
} while (u2 !== i2.activeElement);
|
|
9404
|
-
return
|
|
9588
|
+
return r2 & 6 && H(u2) && u2.select(), 2;
|
|
9589
|
+
}
|
|
9590
|
+
function t$5() {
|
|
9591
|
+
return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
|
|
9592
|
+
}
|
|
9593
|
+
function i$2() {
|
|
9594
|
+
return /Android/gi.test(window.navigator.userAgent);
|
|
9405
9595
|
}
|
|
9406
|
-
function
|
|
9407
|
-
|
|
9596
|
+
function n$3() {
|
|
9597
|
+
return t$5() || i$2();
|
|
9598
|
+
}
|
|
9599
|
+
function d$4(e2, r2, n2) {
|
|
9600
|
+
let o2 = s$7(r2);
|
|
9408
9601
|
useEffect(() => {
|
|
9409
9602
|
function t2(u2) {
|
|
9410
9603
|
o2.current(u2);
|
|
@@ -9412,139 +9605,201 @@ function d$1(e2, r2, n2) {
|
|
|
9412
9605
|
return document.addEventListener(e2, t2, n2), () => document.removeEventListener(e2, t2, n2);
|
|
9413
9606
|
}, [e2, n2]);
|
|
9414
9607
|
}
|
|
9415
|
-
function
|
|
9608
|
+
function s$5(e2, r2, n2) {
|
|
9609
|
+
let o2 = s$7(r2);
|
|
9610
|
+
useEffect(() => {
|
|
9611
|
+
function t2(i2) {
|
|
9612
|
+
o2.current(i2);
|
|
9613
|
+
}
|
|
9614
|
+
return window.addEventListener(e2, t2, n2), () => window.removeEventListener(e2, t2, n2);
|
|
9615
|
+
}, [e2, n2]);
|
|
9616
|
+
}
|
|
9617
|
+
function y$2(s2, m2, a2 = true) {
|
|
9416
9618
|
let i2 = useRef(false);
|
|
9417
9619
|
useEffect(() => {
|
|
9418
9620
|
requestAnimationFrame(() => {
|
|
9419
|
-
i2.current =
|
|
9621
|
+
i2.current = a2;
|
|
9420
9622
|
});
|
|
9421
|
-
}, [
|
|
9422
|
-
function
|
|
9623
|
+
}, [a2]);
|
|
9624
|
+
function c2(e2, r2) {
|
|
9423
9625
|
if (!i2.current || e2.defaultPrevented)
|
|
9424
9626
|
return;
|
|
9425
|
-
let
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9627
|
+
let t2 = r2(e2);
|
|
9628
|
+
if (t2 === null || !t2.getRootNode().contains(t2) || !t2.isConnected)
|
|
9629
|
+
return;
|
|
9630
|
+
let E2 = function u2(n2) {
|
|
9631
|
+
return typeof n2 == "function" ? u2(n2()) : Array.isArray(n2) || n2 instanceof Set ? n2 : [n2];
|
|
9632
|
+
}(s2);
|
|
9633
|
+
for (let u2 of E2) {
|
|
9634
|
+
if (u2 === null)
|
|
9635
|
+
continue;
|
|
9636
|
+
let n2 = u2 instanceof HTMLElement ? u2 : u2.current;
|
|
9637
|
+
if (n2 != null && n2.contains(t2) || e2.composed && e2.composedPath().includes(n2))
|
|
9638
|
+
return;
|
|
9437
9639
|
}
|
|
9640
|
+
return !h$2(t2, T$1.Loose) && t2.tabIndex !== -1 && e2.preventDefault(), m2(e2, t2);
|
|
9438
9641
|
}
|
|
9439
|
-
let
|
|
9440
|
-
d$
|
|
9441
|
-
var
|
|
9442
|
-
i2.current && (
|
|
9443
|
-
}, true), d$
|
|
9444
|
-
|
|
9445
|
-
|
|
9642
|
+
let o2 = useRef(null);
|
|
9643
|
+
d$4("pointerdown", (e2) => {
|
|
9644
|
+
var r2, t2;
|
|
9645
|
+
i2.current && (o2.current = ((t2 = (r2 = e2.composedPath) == null ? void 0 : r2.call(e2)) == null ? void 0 : t2[0]) || e2.target);
|
|
9646
|
+
}, true), d$4("mousedown", (e2) => {
|
|
9647
|
+
var r2, t2;
|
|
9648
|
+
i2.current && (o2.current = ((t2 = (r2 = e2.composedPath) == null ? void 0 : r2.call(e2)) == null ? void 0 : t2[0]) || e2.target);
|
|
9649
|
+
}, true), d$4("click", (e2) => {
|
|
9650
|
+
n$3() || o2.current && (c2(e2, () => o2.current), o2.current = null);
|
|
9651
|
+
}, true), d$4("touchend", (e2) => c2(e2, () => e2.target instanceof HTMLElement ? e2.target : null), true), s$5("blur", (e2) => c2(e2, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), true);
|
|
9446
9652
|
}
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
return Object.assign(t2, { [u$2]: n2 });
|
|
9653
|
+
function n$2(...e2) {
|
|
9654
|
+
return useMemo(() => o$1(...e2), [...e2]);
|
|
9450
9655
|
}
|
|
9451
|
-
|
|
9656
|
+
let u$4 = Symbol();
|
|
9657
|
+
function T(t2, n2 = true) {
|
|
9658
|
+
return Object.assign(t2, { [u$4]: n2 });
|
|
9659
|
+
}
|
|
9660
|
+
function y$1(...t2) {
|
|
9452
9661
|
let n2 = useRef(t2);
|
|
9453
9662
|
useEffect(() => {
|
|
9454
9663
|
n2.current = t2;
|
|
9455
9664
|
}, [t2]);
|
|
9456
|
-
let
|
|
9665
|
+
let c2 = o$4((e2) => {
|
|
9457
9666
|
for (let o2 of n2.current)
|
|
9458
9667
|
o2 != null && (typeof o2 == "function" ? o2(e2) : o2.current = e2);
|
|
9459
9668
|
});
|
|
9460
|
-
return t2.every((e2) => e2 == null || (e2 == null ? void 0 : e2[u$
|
|
9461
|
-
}
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9669
|
+
return t2.every((e2) => e2 == null || (e2 == null ? void 0 : e2[u$4])) ? void 0 : c2;
|
|
9670
|
+
}
|
|
9671
|
+
function m$2(u2, t2) {
|
|
9672
|
+
let e2 = useRef([]), r2 = o$4(u2);
|
|
9673
|
+
useEffect(() => {
|
|
9674
|
+
let o2 = [...e2.current];
|
|
9675
|
+
for (let [n2, a2] of t2.entries())
|
|
9676
|
+
if (e2.current[n2] !== a2) {
|
|
9677
|
+
let l2 = r2(t2, o2);
|
|
9678
|
+
return e2.current = t2, l2;
|
|
9679
|
+
}
|
|
9680
|
+
}, [r2, ...t2]);
|
|
9681
|
+
}
|
|
9682
|
+
function t$4(...r2) {
|
|
9683
|
+
return Array.from(new Set(r2.flatMap((n2) => typeof n2 == "string" ? n2.split(" ") : []))).filter(Boolean).join(" ");
|
|
9684
|
+
}
|
|
9685
|
+
var O = ((n2) => (n2[n2.None = 0] = "None", n2[n2.RenderStrategy = 1] = "RenderStrategy", n2[n2.Static = 2] = "Static", n2))(O || {}), v$1 = ((e2) => (e2[e2.Unmount = 0] = "Unmount", e2[e2.Hidden = 1] = "Hidden", e2))(v$1 || {});
|
|
9686
|
+
function C({ ourProps: r2, theirProps: t2, slot: e2, defaultTag: n2, features: o2, visible: a2 = true, name: f2, mergeRefs: l2 }) {
|
|
9687
|
+
l2 = l2 != null ? l2 : k;
|
|
9688
|
+
let s2 = R(t2, r2);
|
|
9689
|
+
if (a2)
|
|
9690
|
+
return m$1(s2, e2, n2, f2, l2);
|
|
9691
|
+
let y2 = o2 != null ? o2 : 0;
|
|
9692
|
+
if (y2 & 2) {
|
|
9693
|
+
let { static: u2 = false, ...d2 } = s2;
|
|
9694
|
+
if (u2)
|
|
9695
|
+
return m$1(d2, e2, n2, f2, l2);
|
|
9696
|
+
}
|
|
9697
|
+
if (y2 & 1) {
|
|
9698
|
+
let { unmount: u2 = true, ...d2 } = s2;
|
|
9699
|
+
return u$5(u2 ? 0 : 1, { [0]() {
|
|
9476
9700
|
return null;
|
|
9477
9701
|
}, [1]() {
|
|
9478
|
-
return
|
|
9702
|
+
return m$1({ ...d2, hidden: true, style: { display: "none" } }, e2, n2, f2, l2);
|
|
9479
9703
|
} });
|
|
9480
9704
|
}
|
|
9481
|
-
return
|
|
9705
|
+
return m$1(s2, e2, n2, f2, l2);
|
|
9482
9706
|
}
|
|
9483
|
-
function
|
|
9484
|
-
let { as:
|
|
9485
|
-
s2.className && typeof s2.className == "function" && (s2.className = s2.className(t2));
|
|
9707
|
+
function m$1(r2, t2 = {}, e2, n2, o2) {
|
|
9708
|
+
let { as: a2 = e2, children: f2, refName: l2 = "ref", ...s2 } = F$1(r2, ["unmount", "static"]), y2 = r2.ref !== void 0 ? { [l2]: r2.ref } : {}, u2 = typeof f2 == "function" ? f2(t2) : f2;
|
|
9709
|
+
"className" in s2 && s2.className && typeof s2.className == "function" && (s2.className = s2.className(t2));
|
|
9486
9710
|
let d2 = {};
|
|
9487
9711
|
if (t2) {
|
|
9488
|
-
let
|
|
9489
|
-
for (let [
|
|
9490
|
-
typeof
|
|
9491
|
-
|
|
9492
|
-
}
|
|
9493
|
-
if (
|
|
9494
|
-
if (!isValidElement(
|
|
9495
|
-
throw new Error(['Passing props on "Fragment"!', "", `The current component <${
|
|
9496
|
-
`), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((
|
|
9712
|
+
let i2 = false, c2 = [];
|
|
9713
|
+
for (let [T2, p2] of Object.entries(t2))
|
|
9714
|
+
typeof p2 == "boolean" && (i2 = true), p2 === true && c2.push(T2);
|
|
9715
|
+
i2 && (d2["data-headlessui-state"] = c2.join(" "));
|
|
9716
|
+
}
|
|
9717
|
+
if (a2 === Fragment$1 && Object.keys(x$1(s2)).length > 0) {
|
|
9718
|
+
if (!isValidElement(u2) || Array.isArray(u2) && u2.length > 1)
|
|
9719
|
+
throw new Error(['Passing props on "Fragment"!', "", `The current component <${n2} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(s2).map((p2) => ` - ${p2}`).join(`
|
|
9720
|
+
`), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((p2) => ` - ${p2}`).join(`
|
|
9497
9721
|
`)].join(`
|
|
9498
9722
|
`));
|
|
9499
|
-
|
|
9723
|
+
let i2 = u2.props, c2 = typeof (i2 == null ? void 0 : i2.className) == "function" ? (...p2) => t$4(i2 == null ? void 0 : i2.className(...p2), s2.className) : t$4(i2 == null ? void 0 : i2.className, s2.className), T2 = c2 ? { className: c2 } : {};
|
|
9724
|
+
return cloneElement(u2, Object.assign({}, R(u2.props, x$1(F$1(s2, ["ref"]))), d2, y2, { ref: o2(u2.ref, y2.ref) }, T2));
|
|
9500
9725
|
}
|
|
9501
|
-
return createElement(
|
|
9726
|
+
return createElement(a2, Object.assign({}, F$1(s2, ["ref"]), a2 !== Fragment$1 && y2, a2 !== Fragment$1 && d2), u2);
|
|
9502
9727
|
}
|
|
9503
|
-
function
|
|
9504
|
-
return
|
|
9728
|
+
function k(...r2) {
|
|
9729
|
+
return r2.every((t2) => t2 == null) ? void 0 : (t2) => {
|
|
9505
9730
|
for (let e2 of r2)
|
|
9506
9731
|
e2 != null && (typeof e2 == "function" ? e2(t2) : e2.current = t2);
|
|
9507
|
-
}
|
|
9732
|
+
};
|
|
9508
9733
|
}
|
|
9509
|
-
function
|
|
9734
|
+
function R(...r2) {
|
|
9510
9735
|
if (r2.length === 0)
|
|
9511
9736
|
return {};
|
|
9512
9737
|
if (r2.length === 1)
|
|
9513
9738
|
return r2[0];
|
|
9514
9739
|
let t2 = {}, e2 = {};
|
|
9515
9740
|
for (let o2 of r2)
|
|
9516
|
-
for (let
|
|
9517
|
-
|
|
9741
|
+
for (let a2 in o2)
|
|
9742
|
+
a2.startsWith("on") && typeof o2[a2] == "function" ? (e2[a2] != null || (e2[a2] = []), e2[a2].push(o2[a2])) : t2[a2] = o2[a2];
|
|
9518
9743
|
if (t2.disabled || t2["aria-disabled"])
|
|
9519
9744
|
return Object.assign(t2, Object.fromEntries(Object.keys(e2).map((o2) => [o2, void 0])));
|
|
9520
9745
|
for (let o2 in e2)
|
|
9521
|
-
Object.assign(t2, { [o2](
|
|
9522
|
-
let
|
|
9523
|
-
for (let
|
|
9524
|
-
if ((
|
|
9746
|
+
Object.assign(t2, { [o2](a2, ...f2) {
|
|
9747
|
+
let l2 = e2[o2];
|
|
9748
|
+
for (let s2 of l2) {
|
|
9749
|
+
if ((a2 instanceof Event || (a2 == null ? void 0 : a2.nativeEvent) instanceof Event) && a2.defaultPrevented)
|
|
9525
9750
|
return;
|
|
9526
|
-
|
|
9751
|
+
s2(a2, ...f2);
|
|
9527
9752
|
}
|
|
9528
9753
|
} });
|
|
9529
9754
|
return t2;
|
|
9530
9755
|
}
|
|
9531
|
-
function
|
|
9756
|
+
function U$2(r2) {
|
|
9532
9757
|
var t2;
|
|
9533
9758
|
return Object.assign(forwardRef(r2), { displayName: (t2 = r2.displayName) != null ? t2 : r2.name });
|
|
9534
9759
|
}
|
|
9535
|
-
function
|
|
9760
|
+
function x$1(r2) {
|
|
9536
9761
|
let t2 = Object.assign({}, r2);
|
|
9537
9762
|
for (let e2 in t2)
|
|
9538
9763
|
t2[e2] === void 0 && delete t2[e2];
|
|
9539
9764
|
return t2;
|
|
9540
9765
|
}
|
|
9541
|
-
function
|
|
9766
|
+
function F$1(r2, t2 = []) {
|
|
9542
9767
|
let e2 = Object.assign({}, r2);
|
|
9543
|
-
for (let
|
|
9544
|
-
|
|
9768
|
+
for (let n2 of t2)
|
|
9769
|
+
n2 in e2 && delete e2[n2];
|
|
9545
9770
|
return e2;
|
|
9546
9771
|
}
|
|
9547
|
-
|
|
9772
|
+
let p$2 = "div";
|
|
9773
|
+
var s$4 = ((e2) => (e2[e2.None = 1] = "None", e2[e2.Focusable = 2] = "Focusable", e2[e2.Hidden = 4] = "Hidden", e2))(s$4 || {});
|
|
9774
|
+
function l$3(d2, o2) {
|
|
9775
|
+
var n2;
|
|
9776
|
+
let { features: t2 = 1, ...e2 } = d2, r2 = { ref: o2, "aria-hidden": (t2 & 2) === 2 ? true : (n2 = e2["aria-hidden"]) != null ? n2 : void 0, hidden: (t2 & 4) === 4 ? true : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(t2 & 4) === 4 && (t2 & 2) !== 2 && { display: "none" } } };
|
|
9777
|
+
return C({ ourProps: r2, theirProps: e2, slot: {}, defaultTag: p$2, name: "Hidden" });
|
|
9778
|
+
}
|
|
9779
|
+
let u$3 = U$2(l$3);
|
|
9780
|
+
let n$1 = createContext(null);
|
|
9781
|
+
n$1.displayName = "OpenClosedContext";
|
|
9782
|
+
var d$3 = ((e2) => (e2[e2.Open = 1] = "Open", e2[e2.Closed = 2] = "Closed", e2[e2.Closing = 4] = "Closing", e2[e2.Opening = 8] = "Opening", e2))(d$3 || {});
|
|
9783
|
+
function u$2() {
|
|
9784
|
+
return useContext(n$1);
|
|
9785
|
+
}
|
|
9786
|
+
function s$3({ value: o2, children: r2 }) {
|
|
9787
|
+
return React__default.createElement(n$1.Provider, { value: o2 }, r2);
|
|
9788
|
+
}
|
|
9789
|
+
function t$3(n2) {
|
|
9790
|
+
function e2() {
|
|
9791
|
+
document.readyState !== "loading" && (n2(), document.removeEventListener("DOMContentLoaded", e2));
|
|
9792
|
+
}
|
|
9793
|
+
typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("DOMContentLoaded", e2), e2());
|
|
9794
|
+
}
|
|
9795
|
+
let t$2 = [];
|
|
9796
|
+
t$3(() => {
|
|
9797
|
+
function e2(n2) {
|
|
9798
|
+
n2.target instanceof HTMLElement && n2.target !== document.body && t$2[0] !== n2.target && (t$2.unshift(n2.target), t$2 = t$2.filter((r2) => r2 != null && r2.isConnected), t$2.splice(10));
|
|
9799
|
+
}
|
|
9800
|
+
window.addEventListener("click", e2, { capture: true }), window.addEventListener("mousedown", e2, { capture: true }), window.addEventListener("focus", e2, { capture: true }), document.body.addEventListener("click", e2, { capture: true }), document.body.addEventListener("mousedown", e2, { capture: true }), document.body.addEventListener("focus", e2, { capture: true });
|
|
9801
|
+
});
|
|
9802
|
+
function r$2(n2) {
|
|
9548
9803
|
let e2 = n2.parentElement, l2 = null;
|
|
9549
9804
|
for (; e2 && !(e2 instanceof HTMLFieldSetElement); )
|
|
9550
9805
|
e2 instanceof HTMLLegendElement && (l2 = e2), e2 = e2.parentElement;
|
|
@@ -9562,60 +9817,9 @@ function i$1(n2) {
|
|
|
9562
9817
|
}
|
|
9563
9818
|
return true;
|
|
9564
9819
|
}
|
|
9565
|
-
|
|
9566
|
-
var s$4 = ((e2) => (e2[e2.None = 1] = "None", e2[e2.Focusable = 2] = "Focusable", e2[e2.Hidden = 4] = "Hidden", e2))(s$4 || {});
|
|
9567
|
-
let h$1 = C$1(function(t2, o2) {
|
|
9568
|
-
let { features: e2 = 1, ...r2 } = t2, d2 = { ref: o2, "aria-hidden": (e2 & 2) === 2 ? true : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(e2 & 4) === 4 && (e2 & 2) !== 2 && { display: "none" } } };
|
|
9569
|
-
return $$1({ ourProps: d2, theirProps: r2, slot: {}, defaultTag: a$1, name: "Hidden" });
|
|
9570
|
-
});
|
|
9571
|
-
let o$2 = createContext(null);
|
|
9572
|
-
o$2.displayName = "OpenClosedContext";
|
|
9573
|
-
var p = ((e2) => (e2[e2.Open = 0] = "Open", e2[e2.Closed = 1] = "Closed", e2))(p || {});
|
|
9574
|
-
function s$3() {
|
|
9575
|
-
return useContext(o$2);
|
|
9576
|
-
}
|
|
9577
|
-
function C({ value: t2, children: n2 }) {
|
|
9578
|
-
return React.createElement(o$2.Provider, { value: t2 }, n2);
|
|
9579
|
-
}
|
|
9580
|
-
var o$1 = ((r2) => (r2.Space = " ", r2.Enter = "Enter", r2.Escape = "Escape", r2.Backspace = "Backspace", r2.Delete = "Delete", r2.ArrowLeft = "ArrowLeft", r2.ArrowUp = "ArrowUp", r2.ArrowRight = "ArrowRight", r2.ArrowDown = "ArrowDown", r2.Home = "Home", r2.End = "End", r2.PageUp = "PageUp", r2.PageDown = "PageDown", r2.Tab = "Tab", r2))(o$1 || {});
|
|
9581
|
-
function m(u2, t2) {
|
|
9582
|
-
let e2 = useRef([]), r2 = o$3(u2);
|
|
9583
|
-
useEffect(() => {
|
|
9584
|
-
let o2 = [...e2.current];
|
|
9585
|
-
for (let [n2, a2] of t2.entries())
|
|
9586
|
-
if (e2.current[n2] !== a2) {
|
|
9587
|
-
let l2 = r2(t2, o2);
|
|
9588
|
-
return e2.current = t2, l2;
|
|
9589
|
-
}
|
|
9590
|
-
}, [r2, ...t2]);
|
|
9591
|
-
}
|
|
9592
|
-
function s$2(e2, r2, n2) {
|
|
9593
|
-
let o2 = s$5(r2);
|
|
9594
|
-
useEffect(() => {
|
|
9595
|
-
function t2(i2) {
|
|
9596
|
-
o2.current(i2);
|
|
9597
|
-
}
|
|
9598
|
-
return window.addEventListener(e2, t2, n2), () => window.removeEventListener(e2, t2, n2);
|
|
9599
|
-
}, [e2, n2]);
|
|
9600
|
-
}
|
|
9601
|
-
var s$1 = ((r2) => (r2[r2.Forwards = 0] = "Forwards", r2[r2.Backwards = 1] = "Backwards", r2))(s$1 || {});
|
|
9602
|
-
function n$1() {
|
|
9603
|
-
let e2 = useRef(0);
|
|
9604
|
-
return s$2("keydown", (o2) => {
|
|
9605
|
-
o2.key === "Tab" && (e2.current = o2.shiftKey ? 1 : 0);
|
|
9606
|
-
}, true), e2;
|
|
9607
|
-
}
|
|
9608
|
-
function f$1() {
|
|
9609
|
-
let e2 = useRef(false);
|
|
9610
|
-
return s$6(() => (e2.current = true, () => {
|
|
9611
|
-
e2.current = false;
|
|
9612
|
-
}), []), e2;
|
|
9613
|
-
}
|
|
9614
|
-
function n(...e2) {
|
|
9615
|
-
return useMemo(() => e$2(...e2), [...e2]);
|
|
9616
|
-
}
|
|
9820
|
+
var o = ((r2) => (r2.Space = " ", r2.Enter = "Enter", r2.Escape = "Escape", r2.Backspace = "Backspace", r2.Delete = "Delete", r2.ArrowLeft = "ArrowLeft", r2.ArrowUp = "ArrowUp", r2.ArrowRight = "ArrowRight", r2.ArrowDown = "ArrowDown", r2.Home = "Home", r2.End = "End", r2.PageUp = "PageUp", r2.PageDown = "PageDown", r2.Tab = "Tab", r2))(o || {});
|
|
9617
9821
|
function E(n2, e2, a2, t2) {
|
|
9618
|
-
let i2 = s$
|
|
9822
|
+
let i2 = s$7(a2);
|
|
9619
9823
|
useEffect(() => {
|
|
9620
9824
|
n2 = n2 != null ? n2 : window;
|
|
9621
9825
|
function r2(o2) {
|
|
@@ -9624,203 +9828,372 @@ function E(n2, e2, a2, t2) {
|
|
|
9624
9828
|
return n2.addEventListener(e2, r2, t2), () => n2.removeEventListener(e2, r2, t2);
|
|
9625
9829
|
}, [n2, e2, t2]);
|
|
9626
9830
|
}
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
let
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9831
|
+
function f$3() {
|
|
9832
|
+
let e2 = useRef(false);
|
|
9833
|
+
return l$5(() => (e2.current = true, () => {
|
|
9834
|
+
e2.current = false;
|
|
9835
|
+
}), []), e2;
|
|
9836
|
+
}
|
|
9837
|
+
function c$3(t2) {
|
|
9838
|
+
let r2 = o$4(t2), e2 = useRef(false);
|
|
9839
|
+
useEffect(() => (e2.current = false, () => {
|
|
9840
|
+
e2.current = true, t$6(() => {
|
|
9841
|
+
e2.current && r2();
|
|
9842
|
+
});
|
|
9843
|
+
}), [r2]);
|
|
9844
|
+
}
|
|
9845
|
+
var s$2 = ((r2) => (r2[r2.Forwards = 0] = "Forwards", r2[r2.Backwards = 1] = "Backwards", r2))(s$2 || {});
|
|
9846
|
+
function n() {
|
|
9847
|
+
let e2 = useRef(0);
|
|
9848
|
+
return s$5("keydown", (o2) => {
|
|
9849
|
+
o2.key === "Tab" && (e2.current = o2.shiftKey ? 1 : 0);
|
|
9850
|
+
}, true), e2;
|
|
9851
|
+
}
|
|
9852
|
+
function P(t2) {
|
|
9853
|
+
if (!t2)
|
|
9854
|
+
return /* @__PURE__ */ new Set();
|
|
9855
|
+
if (typeof t2 == "function")
|
|
9856
|
+
return new Set(t2());
|
|
9857
|
+
let n2 = /* @__PURE__ */ new Set();
|
|
9858
|
+
for (let e2 of t2.current)
|
|
9859
|
+
e2.current instanceof HTMLElement && n2.add(e2.current);
|
|
9860
|
+
return n2;
|
|
9861
|
+
}
|
|
9862
|
+
let X = "div";
|
|
9863
|
+
var _$1 = ((r2) => (r2[r2.None = 1] = "None", r2[r2.InitialFocus = 2] = "InitialFocus", r2[r2.TabLock = 4] = "TabLock", r2[r2.FocusLock = 8] = "FocusLock", r2[r2.RestoreFocus = 16] = "RestoreFocus", r2[r2.All = 30] = "All", r2))(_$1 || {});
|
|
9864
|
+
function z(t2, n$12) {
|
|
9865
|
+
let e2 = useRef(null), o2 = y$1(e2, n$12), { initialFocus: l2, containers: c2, features: r2 = 30, ...s2 } = t2;
|
|
9866
|
+
l$4() || (r2 = 1);
|
|
9867
|
+
let i2 = n$2(e2);
|
|
9868
|
+
Y({ ownerDocument: i2 }, Boolean(r2 & 16));
|
|
9869
|
+
let u2 = Z({ ownerDocument: i2, container: e2, initialFocus: l2 }, Boolean(r2 & 2));
|
|
9870
|
+
$({ ownerDocument: i2, container: e2, containers: c2, previousActiveElement: u2 }, Boolean(r2 & 8));
|
|
9871
|
+
let y2 = n(), R2 = o$4((a2) => {
|
|
9872
|
+
let m2 = e2.current;
|
|
9873
|
+
if (!m2)
|
|
9639
9874
|
return;
|
|
9640
|
-
((
|
|
9641
|
-
u$
|
|
9875
|
+
((B) => B())(() => {
|
|
9876
|
+
u$5(y2.current, { [s$2.Forwards]: () => {
|
|
9877
|
+
O$1(m2, M$2.First, { skipElements: [a2.relatedTarget] });
|
|
9878
|
+
}, [s$2.Backwards]: () => {
|
|
9879
|
+
O$1(m2, M$2.Last, { skipElements: [a2.relatedTarget] });
|
|
9880
|
+
} });
|
|
9642
9881
|
});
|
|
9643
|
-
}),
|
|
9644
|
-
|
|
9645
|
-
|
|
9882
|
+
}), h2 = p$3(), H2 = useRef(false), j2 = { ref: o2, onKeyDown(a2) {
|
|
9883
|
+
a2.key == "Tab" && (H2.current = true, h2.requestAnimationFrame(() => {
|
|
9884
|
+
H2.current = false;
|
|
9646
9885
|
}));
|
|
9647
|
-
}, onBlur(
|
|
9648
|
-
let
|
|
9649
|
-
|
|
9650
|
-
let
|
|
9651
|
-
|
|
9886
|
+
}, onBlur(a2) {
|
|
9887
|
+
let m2 = P(c2);
|
|
9888
|
+
e2.current instanceof HTMLElement && m2.add(e2.current);
|
|
9889
|
+
let T2 = a2.relatedTarget;
|
|
9890
|
+
T2 instanceof HTMLElement && T2.dataset.headlessuiFocusGuard !== "true" && (S$4(m2, T2) || (H2.current ? O$1(e2.current, u$5(y2.current, { [s$2.Forwards]: () => M$2.Next, [s$2.Backwards]: () => M$2.Previous }) | M$2.WrapAround, { relativeTo: a2.target }) : a2.target instanceof HTMLElement && y$3(a2.target)));
|
|
9652
9891
|
} };
|
|
9653
|
-
return
|
|
9654
|
-
}
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
});
|
|
9667
|
-
}), []);
|
|
9892
|
+
return React__default.createElement(React__default.Fragment, null, Boolean(r2 & 4) && React__default.createElement(u$3, { as: "button", type: "button", "data-headlessui-focus-guard": true, onFocus: R2, features: s$4.Focusable }), C({ ourProps: j2, theirProps: s2, defaultTag: X, name: "FocusTrap" }), Boolean(r2 & 4) && React__default.createElement(u$3, { as: "button", type: "button", "data-headlessui-focus-guard": true, onFocus: R2, features: s$4.Focusable }));
|
|
9893
|
+
}
|
|
9894
|
+
let D$2 = U$2(z), de = Object.assign(D$2, { features: _$1 });
|
|
9895
|
+
function Q(t2 = true) {
|
|
9896
|
+
let n2 = useRef(t$2.slice());
|
|
9897
|
+
return m$2(([e2], [o2]) => {
|
|
9898
|
+
o2 === true && e2 === false && t$6(() => {
|
|
9899
|
+
n2.current.splice(0);
|
|
9900
|
+
}), o2 === false && e2 === true && (n2.current = t$2.slice());
|
|
9901
|
+
}, [t2, t$2, n2]), o$4(() => {
|
|
9902
|
+
var e2;
|
|
9903
|
+
return (e2 = n2.current.find((o2) => o2 != null && o2.isConnected)) != null ? e2 : null;
|
|
9904
|
+
});
|
|
9668
9905
|
}
|
|
9669
|
-
function
|
|
9670
|
-
let
|
|
9671
|
-
|
|
9672
|
-
|
|
9906
|
+
function Y({ ownerDocument: t2 }, n2) {
|
|
9907
|
+
let e2 = Q(n2);
|
|
9908
|
+
m$2(() => {
|
|
9909
|
+
n2 || (t2 == null ? void 0 : t2.activeElement) === (t2 == null ? void 0 : t2.body) && y$3(e2());
|
|
9910
|
+
}, [n2]), c$3(() => {
|
|
9911
|
+
n2 && y$3(e2());
|
|
9912
|
+
});
|
|
9913
|
+
}
|
|
9914
|
+
function Z({ ownerDocument: t2, container: n2, initialFocus: e2 }, o2) {
|
|
9915
|
+
let l2 = useRef(null), c2 = f$3();
|
|
9916
|
+
return m$2(() => {
|
|
9917
|
+
if (!o2)
|
|
9673
9918
|
return;
|
|
9674
|
-
let
|
|
9675
|
-
|
|
9676
|
-
if (!
|
|
9919
|
+
let r2 = n2.current;
|
|
9920
|
+
r2 && t$6(() => {
|
|
9921
|
+
if (!c2.current)
|
|
9677
9922
|
return;
|
|
9678
|
-
let
|
|
9923
|
+
let s2 = t2 == null ? void 0 : t2.activeElement;
|
|
9679
9924
|
if (e2 != null && e2.current) {
|
|
9680
|
-
if ((e2 == null ? void 0 : e2.current) ===
|
|
9681
|
-
|
|
9925
|
+
if ((e2 == null ? void 0 : e2.current) === s2) {
|
|
9926
|
+
l2.current = s2;
|
|
9682
9927
|
return;
|
|
9683
9928
|
}
|
|
9684
|
-
} else if (
|
|
9685
|
-
|
|
9929
|
+
} else if (r2.contains(s2)) {
|
|
9930
|
+
l2.current = s2;
|
|
9686
9931
|
return;
|
|
9687
9932
|
}
|
|
9688
|
-
e2 != null && e2.current ?
|
|
9933
|
+
e2 != null && e2.current ? y$3(e2.current) : O$1(r2, M$2.First) === N$2.Error && console.warn("There are no focusable elements inside the <FocusTrap />"), l2.current = t2 == null ? void 0 : t2.activeElement;
|
|
9689
9934
|
});
|
|
9690
|
-
}, [
|
|
9935
|
+
}, [o2]), l2;
|
|
9691
9936
|
}
|
|
9692
|
-
function
|
|
9693
|
-
let
|
|
9694
|
-
E(
|
|
9695
|
-
if (!
|
|
9937
|
+
function $({ ownerDocument: t2, container: n2, containers: e2, previousActiveElement: o2 }, l2) {
|
|
9938
|
+
let c2 = f$3();
|
|
9939
|
+
E(t2 == null ? void 0 : t2.defaultView, "focus", (r2) => {
|
|
9940
|
+
if (!l2 || !c2.current)
|
|
9696
9941
|
return;
|
|
9697
|
-
let
|
|
9698
|
-
n2.add(
|
|
9699
|
-
let
|
|
9700
|
-
if (!
|
|
9942
|
+
let s2 = P(e2);
|
|
9943
|
+
n2.current instanceof HTMLElement && s2.add(n2.current);
|
|
9944
|
+
let i2 = o2.current;
|
|
9945
|
+
if (!i2)
|
|
9701
9946
|
return;
|
|
9702
|
-
let
|
|
9703
|
-
|
|
9947
|
+
let u2 = r2.target;
|
|
9948
|
+
u2 && u2 instanceof HTMLElement ? S$4(s2, u2) ? (o2.current = u2, y$3(u2)) : (r2.preventDefault(), r2.stopPropagation(), y$3(i2)) : y$3(o2.current);
|
|
9704
9949
|
}, true);
|
|
9705
9950
|
}
|
|
9706
|
-
function
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
if ((e2 = l2.current) != null && e2.contains(u2))
|
|
9951
|
+
function S$4(t2, n2) {
|
|
9952
|
+
for (let e2 of t2)
|
|
9953
|
+
if (e2.contains(n2))
|
|
9710
9954
|
return true;
|
|
9711
9955
|
return false;
|
|
9712
9956
|
}
|
|
9713
|
-
let
|
|
9714
|
-
function
|
|
9715
|
-
|
|
9716
|
-
}
|
|
9717
|
-
function l$2(t2) {
|
|
9718
|
-
let n2 = r.get(t2);
|
|
9719
|
-
!n2 || (n2["aria-hidden"] === null ? t2.removeAttribute("aria-hidden") : t2.setAttribute("aria-hidden", n2["aria-hidden"]), t2.inert = n2.inert);
|
|
9720
|
-
}
|
|
9721
|
-
function M$3(t2, n2 = true) {
|
|
9722
|
-
s$6(() => {
|
|
9723
|
-
if (!n2 || !t2.current)
|
|
9724
|
-
return;
|
|
9725
|
-
let o2 = t2.current, a2 = e$2(o2);
|
|
9726
|
-
if (!!a2) {
|
|
9727
|
-
i.add(o2);
|
|
9728
|
-
for (let e2 of r.keys())
|
|
9729
|
-
e2.contains(o2) && (l$2(e2), r.delete(e2));
|
|
9730
|
-
return a2.querySelectorAll("body > *").forEach((e2) => {
|
|
9731
|
-
if (e2 instanceof HTMLElement) {
|
|
9732
|
-
for (let f2 of i)
|
|
9733
|
-
if (e2.contains(f2))
|
|
9734
|
-
return;
|
|
9735
|
-
i.size === 1 && (r.set(e2, { "aria-hidden": e2.getAttribute("aria-hidden"), inert: e2.inert }), u$1(e2));
|
|
9736
|
-
}
|
|
9737
|
-
}), () => {
|
|
9738
|
-
if (i.delete(o2), i.size > 0)
|
|
9739
|
-
a2.querySelectorAll("body > *").forEach((e2) => {
|
|
9740
|
-
if (e2 instanceof HTMLElement && !r.has(e2)) {
|
|
9741
|
-
for (let f2 of i)
|
|
9742
|
-
if (e2.contains(f2))
|
|
9743
|
-
return;
|
|
9744
|
-
r.set(e2, { "aria-hidden": e2.getAttribute("aria-hidden"), inert: e2.inert }), u$1(e2);
|
|
9745
|
-
}
|
|
9746
|
-
});
|
|
9747
|
-
else
|
|
9748
|
-
for (let e2 of r.keys())
|
|
9749
|
-
l$2(e2), r.delete(e2);
|
|
9750
|
-
};
|
|
9751
|
-
}
|
|
9752
|
-
}, [n2]);
|
|
9753
|
-
}
|
|
9754
|
-
let e$1 = createContext(false);
|
|
9755
|
-
function l$1() {
|
|
9756
|
-
return useContext(e$1);
|
|
9957
|
+
let e = createContext(false);
|
|
9958
|
+
function a$4() {
|
|
9959
|
+
return useContext(e);
|
|
9757
9960
|
}
|
|
9758
|
-
function
|
|
9759
|
-
return
|
|
9961
|
+
function l$2(o2) {
|
|
9962
|
+
return React__default.createElement(e.Provider, { value: o2.force }, o2.children);
|
|
9760
9963
|
}
|
|
9761
|
-
function
|
|
9762
|
-
let
|
|
9763
|
-
if (!
|
|
9964
|
+
function F(p2) {
|
|
9965
|
+
let n2 = a$4(), l2 = useContext(_23), e2 = n$2(p2), [a2, o2] = useState(() => {
|
|
9966
|
+
if (!n2 && l2 !== null || s$8.isServer)
|
|
9764
9967
|
return null;
|
|
9765
|
-
let
|
|
9766
|
-
if (
|
|
9767
|
-
return
|
|
9968
|
+
let t2 = e2 == null ? void 0 : e2.getElementById("headlessui-portal-root");
|
|
9969
|
+
if (t2)
|
|
9970
|
+
return t2;
|
|
9768
9971
|
if (e2 === null)
|
|
9769
9972
|
return null;
|
|
9770
|
-
let
|
|
9771
|
-
return
|
|
9973
|
+
let r2 = e2.createElement("div");
|
|
9974
|
+
return r2.setAttribute("id", "headlessui-portal-root"), e2.body.appendChild(r2);
|
|
9772
9975
|
});
|
|
9773
9976
|
return useEffect(() => {
|
|
9774
|
-
|
|
9775
|
-
}, [
|
|
9776
|
-
|
|
9777
|
-
}, [
|
|
9778
|
-
}
|
|
9779
|
-
let
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
}),
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
let
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9977
|
+
a2 !== null && (e2 != null && e2.body.contains(a2) || e2 == null || e2.body.appendChild(a2));
|
|
9978
|
+
}, [a2, e2]), useEffect(() => {
|
|
9979
|
+
n2 || l2 !== null && o2(l2.current);
|
|
9980
|
+
}, [l2, o2, n2]), a2;
|
|
9981
|
+
}
|
|
9982
|
+
let U$1 = Fragment$1;
|
|
9983
|
+
function N$1(p2, n2) {
|
|
9984
|
+
let l2 = p2, e2 = useRef(null), a2 = y$1(T((u2) => {
|
|
9985
|
+
e2.current = u2;
|
|
9986
|
+
}), n2), o2 = n$2(e2), t2 = F(e2), [r2] = useState(() => {
|
|
9987
|
+
var u2;
|
|
9988
|
+
return s$8.isServer ? null : (u2 = o2 == null ? void 0 : o2.createElement("div")) != null ? u2 : null;
|
|
9989
|
+
}), i2 = useContext(f$2), v2 = l$4();
|
|
9990
|
+
return l$5(() => {
|
|
9991
|
+
!t2 || !r2 || t2.contains(r2) || (r2.setAttribute("data-headlessui-portal", ""), t2.appendChild(r2));
|
|
9992
|
+
}, [t2, r2]), l$5(() => {
|
|
9993
|
+
if (r2 && i2)
|
|
9994
|
+
return i2.register(r2);
|
|
9995
|
+
}, [i2, r2]), c$3(() => {
|
|
9996
|
+
var u2;
|
|
9997
|
+
!t2 || !r2 || (r2 instanceof Node && t2.contains(r2) && t2.removeChild(r2), t2.childNodes.length <= 0 && ((u2 = t2.parentElement) == null || u2.removeChild(t2)));
|
|
9998
|
+
}), v2 ? !t2 || !r2 ? null : createPortal(C({ ourProps: { ref: a2 }, theirProps: l2, defaultTag: U$1, name: "Portal" }), r2) : null;
|
|
9999
|
+
}
|
|
10000
|
+
let S$3 = Fragment$1, _23 = createContext(null);
|
|
10001
|
+
function j(p2, n2) {
|
|
10002
|
+
let { target: l2, ...e2 } = p2, o2 = { ref: y$1(n2) };
|
|
10003
|
+
return React__default.createElement(_23.Provider, { value: l2 }, C({ ourProps: o2, theirProps: e2, defaultTag: S$3, name: "Popover.Group" }));
|
|
10004
|
+
}
|
|
10005
|
+
let f$2 = createContext(null);
|
|
10006
|
+
function ee() {
|
|
10007
|
+
let p2 = useContext(f$2), n2 = useRef([]), l2 = o$4((o2) => (n2.current.push(o2), p2 && p2.register(o2), () => e2(o2))), e2 = o$4((o2) => {
|
|
10008
|
+
let t2 = n2.current.indexOf(o2);
|
|
10009
|
+
t2 !== -1 && n2.current.splice(t2, 1), p2 && p2.unregister(o2);
|
|
10010
|
+
}), a2 = useMemo(() => ({ register: l2, unregister: e2, portals: n2 }), [l2, e2, n2]);
|
|
10011
|
+
return [n2, useMemo(() => function({ children: t2 }) {
|
|
10012
|
+
return React__default.createElement(f$2.Provider, { value: a2 }, t2);
|
|
10013
|
+
}, [a2])];
|
|
10014
|
+
}
|
|
10015
|
+
let D$1 = U$2(N$1), I$3 = U$2(j), te = Object.assign(D$1, { Group: I$3 });
|
|
10016
|
+
function i(e2, t2) {
|
|
10017
|
+
return e2 === t2 && (e2 !== 0 || 1 / e2 === 1 / t2) || e2 !== e2 && t2 !== t2;
|
|
10018
|
+
}
|
|
10019
|
+
const d$2 = typeof Object.is == "function" ? Object.is : i, { useState: u$1, useEffect: h$1, useLayoutEffect: f$1, useDebugValue: p$1 } = React;
|
|
10020
|
+
function y(e2, t2, c2) {
|
|
10021
|
+
const a2 = t2(), [{ inst: n2 }, o2] = u$1({ inst: { value: a2, getSnapshot: t2 } });
|
|
10022
|
+
return f$1(() => {
|
|
10023
|
+
n2.value = a2, n2.getSnapshot = t2, r$1(n2) && o2({ inst: n2 });
|
|
10024
|
+
}, [e2, a2, t2]), h$1(() => (r$1(n2) && o2({ inst: n2 }), e2(() => {
|
|
10025
|
+
r$1(n2) && o2({ inst: n2 });
|
|
10026
|
+
})), [e2]), p$1(a2), a2;
|
|
10027
|
+
}
|
|
10028
|
+
function r$1(e2) {
|
|
10029
|
+
const t2 = e2.getSnapshot, c2 = e2.value;
|
|
10030
|
+
try {
|
|
10031
|
+
const a2 = t2();
|
|
10032
|
+
return !d$2(c2, a2);
|
|
10033
|
+
} catch {
|
|
10034
|
+
return true;
|
|
9805
10035
|
}
|
|
9806
|
-
return n2;
|
|
9807
10036
|
}
|
|
9808
|
-
function
|
|
9809
|
-
|
|
9810
|
-
return [n2.length > 0 ? n2.join(" ") : void 0, useMemo(() => function(e2) {
|
|
9811
|
-
let i2 = o$3((r2) => (t2((o2) => [...o2, r2]), () => t2((o2) => {
|
|
9812
|
-
let s2 = o2.slice(), p2 = s2.indexOf(r2);
|
|
9813
|
-
return p2 !== -1 && s2.splice(p2, 1), s2;
|
|
9814
|
-
}))), a2 = useMemo(() => ({ register: i2, slot: e2.slot, name: e2.name, props: e2.props }), [i2, e2.slot, e2.name, e2.props]);
|
|
9815
|
-
return React.createElement(d.Provider, { value: a2 }, e2.children);
|
|
9816
|
-
}, [t2])];
|
|
10037
|
+
function t$1(r2, e2, n2) {
|
|
10038
|
+
return e2();
|
|
9817
10039
|
}
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
10040
|
+
const r = typeof window != "undefined" && typeof window.document != "undefined" && typeof window.document.createElement != "undefined", s$1 = !r, c$2 = s$1 ? t$1 : y, a$3 = "useSyncExternalStore" in React ? ((n2) => n2.useSyncExternalStore)(React) : c$2;
|
|
10041
|
+
function S$2(t2) {
|
|
10042
|
+
return a$3(t2.subscribe, t2.getSnapshot, t2.getSnapshot);
|
|
10043
|
+
}
|
|
10044
|
+
function a$2(o2, r2) {
|
|
10045
|
+
let t2 = o2(), n2 = /* @__PURE__ */ new Set();
|
|
10046
|
+
return { getSnapshot() {
|
|
10047
|
+
return t2;
|
|
10048
|
+
}, subscribe(e2) {
|
|
10049
|
+
return n2.add(e2), () => n2.delete(e2);
|
|
10050
|
+
}, dispatch(e2, ...s2) {
|
|
10051
|
+
let i2 = r2[e2].call(t2, ...s2);
|
|
10052
|
+
i2 && (t2 = i2, n2.forEach((c2) => c2()));
|
|
10053
|
+
} };
|
|
10054
|
+
}
|
|
10055
|
+
function c$1() {
|
|
10056
|
+
let o2;
|
|
10057
|
+
return { before({ doc: e2 }) {
|
|
10058
|
+
var l2;
|
|
10059
|
+
let n2 = e2.documentElement;
|
|
10060
|
+
o2 = ((l2 = e2.defaultView) != null ? l2 : window).innerWidth - n2.clientWidth;
|
|
10061
|
+
}, after({ doc: e2, d: n2 }) {
|
|
10062
|
+
let t2 = e2.documentElement, l2 = t2.clientWidth - t2.offsetWidth, r2 = o2 - l2;
|
|
10063
|
+
n2.style(t2, "paddingRight", `${r2}px`);
|
|
10064
|
+
} };
|
|
10065
|
+
}
|
|
10066
|
+
function d$1() {
|
|
10067
|
+
return t$5() ? { before({ doc: r2, d: l2, meta: c2 }) {
|
|
10068
|
+
function o2(a2) {
|
|
10069
|
+
return c2.containers.flatMap((n2) => n2()).some((n2) => n2.contains(a2));
|
|
10070
|
+
}
|
|
10071
|
+
l2.microTask(() => {
|
|
10072
|
+
var s2;
|
|
10073
|
+
if (window.getComputedStyle(r2.documentElement).scrollBehavior !== "auto") {
|
|
10074
|
+
let t2 = o$3();
|
|
10075
|
+
t2.style(r2.documentElement, "scrollBehavior", "auto"), l2.add(() => l2.microTask(() => t2.dispose()));
|
|
10076
|
+
}
|
|
10077
|
+
let a2 = (s2 = window.scrollY) != null ? s2 : window.pageYOffset, n2 = null;
|
|
10078
|
+
l2.addEventListener(r2, "click", (t2) => {
|
|
10079
|
+
if (t2.target instanceof HTMLElement)
|
|
10080
|
+
try {
|
|
10081
|
+
let e2 = t2.target.closest("a");
|
|
10082
|
+
if (!e2)
|
|
10083
|
+
return;
|
|
10084
|
+
let { hash: f2 } = new URL(e2.href), i2 = r2.querySelector(f2);
|
|
10085
|
+
i2 && !o2(i2) && (n2 = i2);
|
|
10086
|
+
} catch {
|
|
10087
|
+
}
|
|
10088
|
+
}, true), l2.addEventListener(r2, "touchstart", (t2) => {
|
|
10089
|
+
if (t2.target instanceof HTMLElement)
|
|
10090
|
+
if (o2(t2.target)) {
|
|
10091
|
+
let e2 = t2.target;
|
|
10092
|
+
for (; e2.parentElement && o2(e2.parentElement); )
|
|
10093
|
+
e2 = e2.parentElement;
|
|
10094
|
+
l2.style(e2, "overscrollBehavior", "contain");
|
|
10095
|
+
} else
|
|
10096
|
+
l2.style(t2.target, "touchAction", "none");
|
|
10097
|
+
}), l2.addEventListener(r2, "touchmove", (t2) => {
|
|
10098
|
+
if (t2.target instanceof HTMLElement)
|
|
10099
|
+
if (o2(t2.target)) {
|
|
10100
|
+
let e2 = t2.target;
|
|
10101
|
+
for (; e2.parentElement && e2.dataset.headlessuiPortal !== "" && !(e2.scrollHeight > e2.clientHeight || e2.scrollWidth > e2.clientWidth); )
|
|
10102
|
+
e2 = e2.parentElement;
|
|
10103
|
+
e2.dataset.headlessuiPortal === "" && t2.preventDefault();
|
|
10104
|
+
} else
|
|
10105
|
+
t2.preventDefault();
|
|
10106
|
+
}, { passive: false }), l2.add(() => {
|
|
10107
|
+
var e2;
|
|
10108
|
+
let t2 = (e2 = window.scrollY) != null ? e2 : window.pageYOffset;
|
|
10109
|
+
a2 !== t2 && window.scrollTo(0, a2), n2 && n2.isConnected && (n2.scrollIntoView({ block: "nearest" }), n2 = null);
|
|
10110
|
+
});
|
|
10111
|
+
});
|
|
10112
|
+
} } : {};
|
|
10113
|
+
}
|
|
10114
|
+
function l$1() {
|
|
10115
|
+
return { before({ doc: e2, d: o2 }) {
|
|
10116
|
+
o2.style(e2.documentElement, "overflow", "hidden");
|
|
10117
|
+
} };
|
|
10118
|
+
}
|
|
10119
|
+
function m(e2) {
|
|
10120
|
+
let n2 = {};
|
|
10121
|
+
for (let t2 of e2)
|
|
10122
|
+
Object.assign(n2, t2(n2));
|
|
10123
|
+
return n2;
|
|
10124
|
+
}
|
|
10125
|
+
let a$1 = a$2(() => /* @__PURE__ */ new Map(), { PUSH(e2, n2) {
|
|
10126
|
+
var o2;
|
|
10127
|
+
let t2 = (o2 = this.get(e2)) != null ? o2 : { doc: e2, count: 0, d: o$3(), meta: /* @__PURE__ */ new Set() };
|
|
10128
|
+
return t2.count++, t2.meta.add(n2), this.set(e2, t2), this;
|
|
10129
|
+
}, POP(e2, n2) {
|
|
10130
|
+
let t2 = this.get(e2);
|
|
10131
|
+
return t2 && (t2.count--, t2.meta.delete(n2)), this;
|
|
10132
|
+
}, SCROLL_PREVENT({ doc: e2, d: n2, meta: t2 }) {
|
|
10133
|
+
let o2 = { doc: e2, d: n2, meta: m(t2) }, c2 = [d$1(), c$1(), l$1()];
|
|
10134
|
+
c2.forEach(({ before: r2 }) => r2 == null ? void 0 : r2(o2)), c2.forEach(({ after: r2 }) => r2 == null ? void 0 : r2(o2));
|
|
10135
|
+
}, SCROLL_ALLOW({ d: e2 }) {
|
|
10136
|
+
e2.dispose();
|
|
10137
|
+
}, TEARDOWN({ doc: e2 }) {
|
|
10138
|
+
this.delete(e2);
|
|
10139
|
+
} });
|
|
10140
|
+
a$1.subscribe(() => {
|
|
10141
|
+
let e2 = a$1.getSnapshot(), n2 = /* @__PURE__ */ new Map();
|
|
10142
|
+
for (let [t2] of e2)
|
|
10143
|
+
n2.set(t2, t2.documentElement.style.overflow);
|
|
10144
|
+
for (let t2 of e2.values()) {
|
|
10145
|
+
let o2 = n2.get(t2.doc) === "hidden", c2 = t2.count !== 0;
|
|
10146
|
+
(c2 && !o2 || !c2 && o2) && a$1.dispatch(t2.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", t2), t2.count === 0 && a$1.dispatch("TEARDOWN", t2);
|
|
10147
|
+
}
|
|
9823
10148
|
});
|
|
10149
|
+
function p(e2, r2, n2) {
|
|
10150
|
+
let f2 = S$2(a$1), o2 = e2 ? f2.get(e2) : void 0, i2 = o2 ? o2.count > 0 : false;
|
|
10151
|
+
return l$5(() => {
|
|
10152
|
+
if (!(!e2 || !r2))
|
|
10153
|
+
return a$1.dispatch("PUSH", e2, n2), () => a$1.dispatch("POP", e2, n2);
|
|
10154
|
+
}, [r2, e2]), i2;
|
|
10155
|
+
}
|
|
10156
|
+
let u = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
|
|
10157
|
+
function b$3(r2, l2 = true) {
|
|
10158
|
+
l$5(() => {
|
|
10159
|
+
var o2;
|
|
10160
|
+
if (!l2)
|
|
10161
|
+
return;
|
|
10162
|
+
let e2 = typeof r2 == "function" ? r2() : r2.current;
|
|
10163
|
+
if (!e2)
|
|
10164
|
+
return;
|
|
10165
|
+
function a2() {
|
|
10166
|
+
var d2;
|
|
10167
|
+
if (!e2)
|
|
10168
|
+
return;
|
|
10169
|
+
let i2 = (d2 = t.get(e2)) != null ? d2 : 1;
|
|
10170
|
+
if (i2 === 1 ? t.delete(e2) : t.set(e2, i2 - 1), i2 !== 1)
|
|
10171
|
+
return;
|
|
10172
|
+
let n2 = u.get(e2);
|
|
10173
|
+
n2 && (n2["aria-hidden"] === null ? e2.removeAttribute("aria-hidden") : e2.setAttribute("aria-hidden", n2["aria-hidden"]), e2.inert = n2.inert, u.delete(e2));
|
|
10174
|
+
}
|
|
10175
|
+
let f2 = (o2 = t.get(e2)) != null ? o2 : 0;
|
|
10176
|
+
return t.set(e2, f2 + 1), f2 !== 0 || (u.set(e2, { "aria-hidden": e2.getAttribute("aria-hidden"), inert: e2.inert }), e2.setAttribute("aria-hidden", "true"), e2.inert = true), a2;
|
|
10177
|
+
}, [r2, l2]);
|
|
10178
|
+
}
|
|
10179
|
+
function N({ defaultContainers: o2 = [], portals: r2, mainTreeNodeRef: u2 } = {}) {
|
|
10180
|
+
var f2;
|
|
10181
|
+
let t2 = useRef((f2 = u2 == null ? void 0 : u2.current) != null ? f2 : null), l2 = n$2(t2), c2 = o$4(() => {
|
|
10182
|
+
var i2, s2, a2;
|
|
10183
|
+
let n2 = [];
|
|
10184
|
+
for (let e2 of o2)
|
|
10185
|
+
e2 !== null && (e2 instanceof HTMLElement ? n2.push(e2) : "current" in e2 && e2.current instanceof HTMLElement && n2.push(e2.current));
|
|
10186
|
+
if (r2 != null && r2.current)
|
|
10187
|
+
for (let e2 of r2.current)
|
|
10188
|
+
n2.push(e2);
|
|
10189
|
+
for (let e2 of (i2 = l2 == null ? void 0 : l2.querySelectorAll("html > *, body > *")) != null ? i2 : [])
|
|
10190
|
+
e2 !== document.body && e2 !== document.head && e2 instanceof HTMLElement && e2.id !== "headlessui-portal-root" && (e2.contains(t2.current) || e2.contains((a2 = (s2 = t2.current) == null ? void 0 : s2.getRootNode()) == null ? void 0 : a2.host) || n2.some((L) => e2.contains(L)) || n2.push(e2));
|
|
10191
|
+
return n2;
|
|
10192
|
+
});
|
|
10193
|
+
return { resolveContainers: c2, contains: o$4((n2) => c2().some((i2) => i2.contains(n2))), mainTreeNodeRef: t2, MainTreeNode: useMemo(() => function() {
|
|
10194
|
+
return u2 != null ? null : React__default.createElement(u$3, { features: s$4.Hidden, ref: t2 });
|
|
10195
|
+
}, [t2, u2]) };
|
|
10196
|
+
}
|
|
9824
10197
|
let a = createContext(() => {
|
|
9825
10198
|
});
|
|
9826
10199
|
a.displayName = "StackContext";
|
|
@@ -9828,142 +10201,169 @@ var s = ((e2) => (e2[e2.Add = 0] = "Add", e2[e2.Remove = 1] = "Remove", e2))(s |
|
|
|
9828
10201
|
function x() {
|
|
9829
10202
|
return useContext(a);
|
|
9830
10203
|
}
|
|
9831
|
-
function
|
|
9832
|
-
let l2 = x(), o2 = o$
|
|
10204
|
+
function b$2({ children: i2, onUpdate: r2, type: e2, element: n2, enabled: u2 }) {
|
|
10205
|
+
let l2 = x(), o2 = o$4((...t2) => {
|
|
9833
10206
|
r2 == null || r2(...t2), l2(...t2);
|
|
9834
10207
|
});
|
|
9835
|
-
return
|
|
10208
|
+
return l$5(() => {
|
|
9836
10209
|
let t2 = u2 === void 0 || u2 === true;
|
|
9837
10210
|
return t2 && o2(0, e2, n2), () => {
|
|
9838
10211
|
t2 && o2(1, e2, n2);
|
|
9839
10212
|
};
|
|
9840
|
-
}, [o2, e2, n2, u2]),
|
|
10213
|
+
}, [o2, e2, n2, u2]), React__default.createElement(a.Provider, { value: o2 }, i2);
|
|
9841
10214
|
}
|
|
9842
|
-
|
|
9843
|
-
|
|
10215
|
+
let d = createContext(null);
|
|
10216
|
+
function f() {
|
|
10217
|
+
let r2 = useContext(d);
|
|
10218
|
+
if (r2 === null) {
|
|
10219
|
+
let t2 = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
|
|
10220
|
+
throw Error.captureStackTrace && Error.captureStackTrace(t2, f), t2;
|
|
10221
|
+
}
|
|
10222
|
+
return r2;
|
|
10223
|
+
}
|
|
10224
|
+
function w() {
|
|
10225
|
+
let [r2, t2] = useState([]);
|
|
10226
|
+
return [r2.length > 0 ? r2.join(" ") : void 0, useMemo(() => function(e2) {
|
|
10227
|
+
let i2 = o$4((s2) => (t2((o2) => [...o2, s2]), () => t2((o2) => {
|
|
10228
|
+
let p2 = o2.slice(), c2 = p2.indexOf(s2);
|
|
10229
|
+
return c2 !== -1 && p2.splice(c2, 1), p2;
|
|
10230
|
+
}))), n2 = useMemo(() => ({ register: i2, slot: e2.slot, name: e2.name, props: e2.props }), [i2, e2.slot, e2.name, e2.props]);
|
|
10231
|
+
return React__default.createElement(d.Provider, { value: n2 }, e2.children);
|
|
10232
|
+
}, [t2])];
|
|
9844
10233
|
}
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
10234
|
+
let I$2 = "p";
|
|
10235
|
+
function S$1(r2, t2) {
|
|
10236
|
+
let a2 = I$5(), { id: e2 = `headlessui-description-${a2}`, ...i2 } = r2, n2 = f(), s2 = y$1(t2);
|
|
10237
|
+
l$5(() => n2.register(e2), [e2, n2.register]);
|
|
10238
|
+
let o2 = { ref: s2, ...n2.props, id: e2 };
|
|
10239
|
+
return C({ ourProps: o2, theirProps: i2, slot: n2.slot || {}, defaultTag: I$2, name: n2.name || "Description" });
|
|
10240
|
+
}
|
|
10241
|
+
let h = U$2(S$1), G = Object.assign(h, {});
|
|
10242
|
+
var Me = ((r2) => (r2[r2.Open = 0] = "Open", r2[r2.Closed = 1] = "Closed", r2))(Me || {}), we = ((e2) => (e2[e2.SetTitleId = 0] = "SetTitleId", e2))(we || {});
|
|
10243
|
+
let He$1 = { [0](o2, e2) {
|
|
10244
|
+
return o2.titleId === e2.id ? o2 : { ...o2, titleId: e2.id };
|
|
10245
|
+
} }, I$1 = createContext(null);
|
|
10246
|
+
I$1.displayName = "DialogContext";
|
|
10247
|
+
function b$1(o2) {
|
|
10248
|
+
let e2 = useContext(I$1);
|
|
9852
10249
|
if (e2 === null) {
|
|
9853
|
-
let r2 = new Error(`<${
|
|
9854
|
-
throw Error.captureStackTrace && Error.captureStackTrace(r2,
|
|
10250
|
+
let r2 = new Error(`<${o2} /> is missing a parent <Dialog /> component.`);
|
|
10251
|
+
throw Error.captureStackTrace && Error.captureStackTrace(r2, b$1), r2;
|
|
9855
10252
|
}
|
|
9856
10253
|
return e2;
|
|
9857
10254
|
}
|
|
9858
|
-
function
|
|
9859
|
-
|
|
9860
|
-
var
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
let s2 = m$2(), d2 = window.pageYOffset;
|
|
9864
|
-
function a2(n2, i2, l2) {
|
|
9865
|
-
let P2 = n2.style.getPropertyValue(i2);
|
|
9866
|
-
return Object.assign(n2.style, { [i2]: l2 }), s2.add(() => {
|
|
9867
|
-
Object.assign(n2.style, { [i2]: P2 });
|
|
9868
|
-
});
|
|
9869
|
-
}
|
|
9870
|
-
let o$12 = t2.documentElement, f2 = ((c = t2.defaultView) != null ? c : window).innerWidth - o$12.clientWidth;
|
|
9871
|
-
if (a2(o$12, "overflow", "hidden"), f2 > 0) {
|
|
9872
|
-
let n2 = o$12.clientWidth - o$12.offsetWidth, i2 = f2 - n2;
|
|
9873
|
-
a2(o$12, "paddingRight", `${i2}px`);
|
|
9874
|
-
}
|
|
9875
|
-
if (o()) {
|
|
9876
|
-
a2(t2.body, "marginTop", `-${d2}px`), window.scrollTo(0, 0);
|
|
9877
|
-
let n2 = null;
|
|
9878
|
-
s2.addEventListener(t2, "click", (i2) => {
|
|
9879
|
-
if (i2.target instanceof HTMLElement)
|
|
9880
|
-
try {
|
|
9881
|
-
let l2 = i2.target.closest("a");
|
|
9882
|
-
if (!l2)
|
|
9883
|
-
return;
|
|
9884
|
-
let { hash: P2 } = new URL(l2.href), u2 = t2.querySelector(P2);
|
|
9885
|
-
u2 && !r2().some((_24) => _24.contains(u2)) && (n2 = u2);
|
|
9886
|
-
} catch {
|
|
9887
|
-
}
|
|
9888
|
-
}, true), s2.addEventListener(t2, "touchmove", (i2) => {
|
|
9889
|
-
i2.target instanceof HTMLElement && !r2().some((l2) => l2.contains(i2.target)) && i2.preventDefault();
|
|
9890
|
-
}, { passive: false }), s2.add(() => {
|
|
9891
|
-
window.scrollTo(0, window.pageYOffset + d2), n2 && n2.isConnected && (n2.scrollIntoView({ block: "nearest" }), n2 = null);
|
|
9892
|
-
});
|
|
9893
|
-
}
|
|
9894
|
-
return s2.dispose;
|
|
9895
|
-
}, [t2, e2]);
|
|
9896
|
-
}
|
|
9897
|
-
function Ce$1(t2, e2) {
|
|
9898
|
-
return u$3(e2.type, Ae, t2, e2);
|
|
10255
|
+
function Be(o2, e2, r2 = () => [document.body]) {
|
|
10256
|
+
p(o2, e2, (i2) => {
|
|
10257
|
+
var n2;
|
|
10258
|
+
return { containers: [...(n2 = i2.containers) != null ? n2 : [], r2] };
|
|
10259
|
+
});
|
|
9899
10260
|
}
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
|
|
10261
|
+
function Ge(o2, e2) {
|
|
10262
|
+
return u$5(e2.type, He$1, o2, e2);
|
|
10263
|
+
}
|
|
10264
|
+
let Ne$1 = "div", Ue = O.RenderStrategy | O.Static;
|
|
10265
|
+
function We(o$12, e2) {
|
|
10266
|
+
let r2 = I$5(), { id: i2 = `headlessui-dialog-${r2}`, open: n2, onClose: l2, initialFocus: s$12, role: a2 = "dialog", __demoMode: T2 = false, ...m2 } = o$12, [M2, f2] = useState(0), U2 = useRef(false);
|
|
10267
|
+
a2 = function() {
|
|
10268
|
+
return a2 === "dialog" || a2 === "alertdialog" ? a2 : (U2.current || (U2.current = true, console.warn(`Invalid role [${a2}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)), "dialog");
|
|
10269
|
+
}();
|
|
10270
|
+
let E$1 = u$2();
|
|
10271
|
+
n2 === void 0 && E$1 !== null && (n2 = (E$1 & d$3.Open) === d$3.Open);
|
|
10272
|
+
let D2 = useRef(null), ee$1 = y$1(D2, e2), g2 = n$2(D2), W = o$12.hasOwnProperty("open") || E$1 !== null, $2 = o$12.hasOwnProperty("onClose");
|
|
10273
|
+
if (!W && !$2)
|
|
9905
10274
|
throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");
|
|
9906
|
-
if (
|
|
10275
|
+
if (!W)
|
|
9907
10276
|
throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");
|
|
9908
|
-
if (
|
|
10277
|
+
if (!$2)
|
|
9909
10278
|
throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");
|
|
9910
|
-
if (typeof
|
|
9911
|
-
throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${
|
|
9912
|
-
if (typeof
|
|
9913
|
-
throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${
|
|
9914
|
-
let
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
10279
|
+
if (typeof n2 != "boolean")
|
|
10280
|
+
throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${n2}`);
|
|
10281
|
+
if (typeof l2 != "function")
|
|
10282
|
+
throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${l2}`);
|
|
10283
|
+
let p2 = n2 ? 0 : 1, [h2, te$1] = useReducer(Ge, { titleId: null, descriptionId: null, panelRef: createRef() }), P2 = o$4(() => l2(false)), Y2 = o$4((t2) => te$1({ type: 0, id: t2 })), S2 = l$4() ? T2 ? false : p2 === 0 : false, x2 = M2 > 1, j2 = useContext(I$1) !== null, [oe, re] = ee(), ne = { get current() {
|
|
10284
|
+
var t2;
|
|
10285
|
+
return (t2 = h2.panelRef.current) != null ? t2 : D2.current;
|
|
10286
|
+
} }, { resolveContainers: w$12, mainTreeNodeRef: L, MainTreeNode: le2 } = N({ portals: oe, defaultContainers: [ne] }), ae2 = x2 ? "parent" : "leaf", J = E$1 !== null ? (E$1 & d$3.Closing) === d$3.Closing : false, ie = (() => j2 || J ? false : S2)(), se2 = useCallback(() => {
|
|
10287
|
+
var t2, c2;
|
|
10288
|
+
return (c2 = Array.from((t2 = g2 == null ? void 0 : g2.querySelectorAll("body > *")) != null ? t2 : []).find((d2) => d2.id === "headlessui-portal-root" ? false : d2.contains(L.current) && d2 instanceof HTMLElement)) != null ? c2 : null;
|
|
10289
|
+
}, [L]);
|
|
10290
|
+
b$3(se2, ie);
|
|
10291
|
+
let pe = (() => x2 ? true : S2)(), de$1 = useCallback(() => {
|
|
10292
|
+
var t2, c2;
|
|
10293
|
+
return (c2 = Array.from((t2 = g2 == null ? void 0 : g2.querySelectorAll("[data-headlessui-portal]")) != null ? t2 : []).find((d2) => d2.contains(L.current) && d2 instanceof HTMLElement)) != null ? c2 : null;
|
|
10294
|
+
}, [L]);
|
|
10295
|
+
b$3(de$1, pe);
|
|
10296
|
+
let ue2 = (() => !(!S2 || x2))();
|
|
10297
|
+
y$2(w$12, (t2) => {
|
|
10298
|
+
t2.preventDefault(), P2();
|
|
10299
|
+
}, ue2);
|
|
10300
|
+
let fe = (() => !(x2 || p2 !== 0))();
|
|
10301
|
+
E(g2 == null ? void 0 : g2.defaultView, "keydown", (t2) => {
|
|
10302
|
+
fe && (t2.defaultPrevented || t2.key === o.Escape && (t2.preventDefault(), t2.stopPropagation(), P2()));
|
|
9919
10303
|
});
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
if (g2 !== 0 || !u2.current)
|
|
10304
|
+
let ge = (() => !(J || p2 !== 0 || j2))();
|
|
10305
|
+
Be(g2, ge, w$12), useEffect(() => {
|
|
10306
|
+
if (p2 !== 0 || !D2.current)
|
|
9924
10307
|
return;
|
|
9925
|
-
let
|
|
9926
|
-
for (let
|
|
9927
|
-
|
|
10308
|
+
let t2 = new ResizeObserver((c2) => {
|
|
10309
|
+
for (let d2 of c2) {
|
|
10310
|
+
let F2 = d2.target.getBoundingClientRect();
|
|
10311
|
+
F2.x === 0 && F2.y === 0 && F2.width === 0 && F2.height === 0 && P2();
|
|
10312
|
+
}
|
|
9928
10313
|
});
|
|
9929
|
-
return
|
|
9930
|
-
}, [
|
|
9931
|
-
let [
|
|
9932
|
-
return
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
let
|
|
10314
|
+
return t2.observe(D2.current), () => t2.disconnect();
|
|
10315
|
+
}, [p2, D2, P2]);
|
|
10316
|
+
let [Te, ce] = w(), De2 = useMemo(() => [{ dialogState: p2, close: P2, setTitleId: Y2 }, h2], [p2, h2, P2, Y2]), X2 = useMemo(() => ({ open: p2 === 0 }), [p2]), me = { ref: ee$1, id: i2, role: a2, "aria-modal": p2 === 0 ? true : void 0, "aria-labelledby": h2.titleId, "aria-describedby": Te };
|
|
10317
|
+
return React__default.createElement(b$2, { type: "Dialog", enabled: p2 === 0, element: D2, onUpdate: o$4((t2, c2) => {
|
|
10318
|
+
c2 === "Dialog" && u$5(t2, { [s.Add]: () => f2((d2) => d2 + 1), [s.Remove]: () => f2((d2) => d2 - 1) });
|
|
10319
|
+
}) }, React__default.createElement(l$2, { force: true }, React__default.createElement(te, null, React__default.createElement(I$1.Provider, { value: De2 }, React__default.createElement(te.Group, { target: D2 }, React__default.createElement(l$2, { force: false }, React__default.createElement(ce, { slot: X2, name: "Dialog.Description" }, React__default.createElement(de, { initialFocus: s$12, containers: w$12, features: S2 ? u$5(ae2, { parent: de.features.RestoreFocus, leaf: de.features.All & ~de.features.FocusLock }) : de.features.None }, React__default.createElement(re, null, C({ ourProps: me, theirProps: m2, slot: X2, defaultTag: Ne$1, features: Ue, visible: p2 === 0, name: "Dialog" }))))))))), React__default.createElement(le2, null));
|
|
10320
|
+
}
|
|
10321
|
+
let $e = "div";
|
|
10322
|
+
function Ye(o2, e2) {
|
|
10323
|
+
let r2 = I$5(), { id: i2 = `headlessui-dialog-overlay-${r2}`, ...n2 } = o2, [{ dialogState: l2, close: s2 }] = b$1("Dialog.Overlay"), a2 = y$1(e2), T2 = o$4((f2) => {
|
|
10324
|
+
if (f2.target === f2.currentTarget) {
|
|
10325
|
+
if (r$2(f2.currentTarget))
|
|
10326
|
+
return f2.preventDefault();
|
|
10327
|
+
f2.preventDefault(), f2.stopPropagation(), s2();
|
|
10328
|
+
}
|
|
10329
|
+
}), m2 = useMemo(() => ({ open: l2 === 0 }), [l2]);
|
|
10330
|
+
return C({ ourProps: { ref: a2, id: i2, "aria-hidden": true, onClick: T2 }, theirProps: n2, slot: m2, defaultTag: $e, name: "Dialog.Overlay" });
|
|
10331
|
+
}
|
|
10332
|
+
let je = "div";
|
|
10333
|
+
function Je(o2, e2) {
|
|
10334
|
+
let r2 = I$5(), { id: i2 = `headlessui-dialog-backdrop-${r2}`, ...n2 } = o2, [{ dialogState: l2 }, s2] = b$1("Dialog.Backdrop"), a2 = y$1(e2);
|
|
9950
10335
|
useEffect(() => {
|
|
9951
|
-
if (
|
|
10336
|
+
if (s2.panelRef.current === null)
|
|
9952
10337
|
throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.");
|
|
9953
|
-
}, [
|
|
9954
|
-
let
|
|
9955
|
-
return
|
|
9956
|
-
}
|
|
9957
|
-
|
|
9958
|
-
|
|
10338
|
+
}, [s2.panelRef]);
|
|
10339
|
+
let T2 = useMemo(() => ({ open: l2 === 0 }), [l2]);
|
|
10340
|
+
return React__default.createElement(l$2, { force: true }, React__default.createElement(te, null, C({ ourProps: { ref: a2, id: i2, "aria-hidden": true }, theirProps: n2, slot: T2, defaultTag: je, name: "Dialog.Backdrop" })));
|
|
10341
|
+
}
|
|
10342
|
+
let Xe = "div";
|
|
10343
|
+
function Ke(o2, e2) {
|
|
10344
|
+
let r2 = I$5(), { id: i2 = `headlessui-dialog-panel-${r2}`, ...n2 } = o2, [{ dialogState: l2 }, s2] = b$1("Dialog.Panel"), a2 = y$1(e2, s2.panelRef), T2 = useMemo(() => ({ open: l2 === 0 }), [l2]), m2 = o$4((f2) => {
|
|
10345
|
+
f2.stopPropagation();
|
|
9959
10346
|
});
|
|
9960
|
-
return
|
|
9961
|
-
}
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
let
|
|
9965
|
-
|
|
9966
|
-
|
|
10347
|
+
return C({ ourProps: { ref: a2, id: i2, onClick: m2 }, theirProps: n2, slot: T2, defaultTag: Xe, name: "Dialog.Panel" });
|
|
10348
|
+
}
|
|
10349
|
+
let Ve = "h2";
|
|
10350
|
+
function qe$1(o2, e2) {
|
|
10351
|
+
let r2 = I$5(), { id: i2 = `headlessui-dialog-title-${r2}`, ...n2 } = o2, [{ dialogState: l2, setTitleId: s2 }] = b$1("Dialog.Title"), a2 = y$1(e2);
|
|
10352
|
+
useEffect(() => (s2(i2), () => s2(null)), [i2, s2]);
|
|
10353
|
+
let T2 = useMemo(() => ({ open: l2 === 0 }), [l2]);
|
|
10354
|
+
return C({ ourProps: { ref: a2, id: i2 }, theirProps: n2, slot: T2, defaultTag: Ve, name: "Dialog.Title" });
|
|
10355
|
+
}
|
|
10356
|
+
let ze = U$2(We), Qe = U$2(Je), Ze = U$2(Ke), et = U$2(Ye), tt = U$2(qe$1), _t = Object.assign(ze, { Backdrop: Qe, Panel: Ze, Overlay: et, Title: tt, Description: G });
|
|
10357
|
+
function c(a2 = 0) {
|
|
10358
|
+
let [l2, r2] = useState(a2), t2 = f$3(), o2 = useCallback((e2) => {
|
|
10359
|
+
t2.current && r2((u2) => u2 | e2);
|
|
10360
|
+
}, [l2, t2]), m2 = useCallback((e2) => Boolean(l2 & e2), [l2]), s2 = useCallback((e2) => {
|
|
10361
|
+
t2.current && r2((u2) => u2 & ~e2);
|
|
10362
|
+
}, [r2, t2]), g2 = useCallback((e2) => {
|
|
10363
|
+
t2.current && r2((u2) => u2 ^ e2);
|
|
10364
|
+
}, [r2]);
|
|
10365
|
+
return { flags: l2, addFlag: o2, hasFlag: m2, removeFlag: s2, toggleFlag: g2 };
|
|
10366
|
+
}
|
|
9967
10367
|
function l(r2) {
|
|
9968
10368
|
let e2 = { called: false };
|
|
9969
10369
|
return (...t2) => {
|
|
@@ -9971,181 +10371,204 @@ function l(r2) {
|
|
|
9971
10371
|
return e2.called = true, r2(...t2);
|
|
9972
10372
|
};
|
|
9973
10373
|
}
|
|
9974
|
-
function
|
|
10374
|
+
function g(t2, ...e2) {
|
|
9975
10375
|
t2 && e2.length > 0 && t2.classList.add(...e2);
|
|
9976
10376
|
}
|
|
9977
|
-
function
|
|
10377
|
+
function v(t2, ...e2) {
|
|
9978
10378
|
t2 && e2.length > 0 && t2.classList.remove(...e2);
|
|
9979
10379
|
}
|
|
9980
|
-
function
|
|
9981
|
-
let n2 =
|
|
10380
|
+
function b(t2, e2) {
|
|
10381
|
+
let n2 = o$3();
|
|
9982
10382
|
if (!t2)
|
|
9983
10383
|
return n2.dispose;
|
|
9984
|
-
let { transitionDuration:
|
|
9985
|
-
let [r2 = 0] =
|
|
10384
|
+
let { transitionDuration: m2, transitionDelay: a2 } = getComputedStyle(t2), [u2, p2] = [m2, a2].map((l2) => {
|
|
10385
|
+
let [r2 = 0] = l2.split(",").filter(Boolean).map((i2) => i2.includes("ms") ? parseFloat(i2) : parseFloat(i2) * 1e3).sort((i2, T2) => T2 - i2);
|
|
9986
10386
|
return r2;
|
|
9987
|
-
});
|
|
9988
|
-
if (
|
|
9989
|
-
|
|
9990
|
-
r2.
|
|
10387
|
+
}), o2 = u2 + p2;
|
|
10388
|
+
if (o2 !== 0) {
|
|
10389
|
+
n2.group((r2) => {
|
|
10390
|
+
r2.setTimeout(() => {
|
|
10391
|
+
e2(), r2.dispose();
|
|
10392
|
+
}, o2), r2.addEventListener(t2, "transitionrun", (i2) => {
|
|
10393
|
+
i2.target === i2.currentTarget && r2.dispose();
|
|
10394
|
+
});
|
|
10395
|
+
});
|
|
10396
|
+
let l2 = n2.addEventListener(t2, "transitionend", (r2) => {
|
|
10397
|
+
r2.target === r2.currentTarget && (e2(), l2());
|
|
9991
10398
|
});
|
|
9992
10399
|
} else
|
|
9993
10400
|
e2();
|
|
9994
10401
|
return n2.add(() => e2()), n2.dispose;
|
|
9995
10402
|
}
|
|
9996
|
-
function M$1(t2, e2, n2,
|
|
9997
|
-
let
|
|
10403
|
+
function M$1(t2, e2, n2, m2) {
|
|
10404
|
+
let a2 = n2 ? "enter" : "leave", u2 = o$3(), p2 = m2 !== void 0 ? l(m2) : () => {
|
|
9998
10405
|
};
|
|
9999
|
-
|
|
10000
|
-
let
|
|
10001
|
-
return
|
|
10002
|
-
|
|
10003
|
-
}),
|
|
10004
|
-
}
|
|
10005
|
-
function D({ container:
|
|
10006
|
-
let
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
let
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
}
|
|
10017
|
-
|
|
10018
|
-
return n2.filter(Boolean).join(" ");
|
|
10406
|
+
a2 === "enter" && (t2.removeAttribute("hidden"), t2.style.display = "");
|
|
10407
|
+
let o2 = u$5(a2, { enter: () => e2.enter, leave: () => e2.leave }), l$12 = u$5(a2, { enter: () => e2.enterTo, leave: () => e2.leaveTo }), r2 = u$5(a2, { enter: () => e2.enterFrom, leave: () => e2.leaveFrom });
|
|
10408
|
+
return v(t2, ...e2.base, ...e2.enter, ...e2.enterTo, ...e2.enterFrom, ...e2.leave, ...e2.leaveFrom, ...e2.leaveTo, ...e2.entered), g(t2, ...e2.base, ...o2, ...r2), u2.nextFrame(() => {
|
|
10409
|
+
v(t2, ...e2.base, ...o2, ...r2), g(t2, ...e2.base, ...o2, ...l$12), b(t2, () => (v(t2, ...e2.base, ...o2), g(t2, ...e2.base, ...e2.entered), p2()));
|
|
10410
|
+
}), u2.dispose;
|
|
10411
|
+
}
|
|
10412
|
+
function D({ immediate: t2, container: s2, direction: n2, classes: u2, onStart: a2, onStop: c2 }) {
|
|
10413
|
+
let l2 = f$3(), d2 = p$3(), e2 = s$7(n2);
|
|
10414
|
+
l$5(() => {
|
|
10415
|
+
t2 && (e2.current = "enter");
|
|
10416
|
+
}, [t2]), l$5(() => {
|
|
10417
|
+
let r2 = o$3();
|
|
10418
|
+
d2.add(r2.dispose);
|
|
10419
|
+
let i2 = s2.current;
|
|
10420
|
+
if (i2 && e2.current !== "idle" && l2.current)
|
|
10421
|
+
return r2.dispose(), a2.current(e2.current), r2.add(M$1(i2, u2.current, e2.current === "enter", () => {
|
|
10422
|
+
r2.dispose(), c2.current(e2.current);
|
|
10423
|
+
})), r2.dispose;
|
|
10424
|
+
}, [n2]);
|
|
10019
10425
|
}
|
|
10020
|
-
function
|
|
10021
|
-
return
|
|
10426
|
+
function S(t2 = "") {
|
|
10427
|
+
return t2.split(/\s+/).filter((n2) => n2.length > 1);
|
|
10022
10428
|
}
|
|
10023
|
-
let
|
|
10024
|
-
|
|
10025
|
-
var
|
|
10026
|
-
function
|
|
10027
|
-
let
|
|
10028
|
-
if (
|
|
10429
|
+
let I = createContext(null);
|
|
10430
|
+
I.displayName = "TransitionContext";
|
|
10431
|
+
var Se = ((r2) => (r2.Visible = "visible", r2.Hidden = "hidden", r2))(Se || {});
|
|
10432
|
+
function ye() {
|
|
10433
|
+
let t2 = useContext(I);
|
|
10434
|
+
if (t2 === null)
|
|
10029
10435
|
throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
|
|
10030
|
-
return
|
|
10436
|
+
return t2;
|
|
10031
10437
|
}
|
|
10032
|
-
function
|
|
10033
|
-
let
|
|
10034
|
-
if (
|
|
10438
|
+
function xe() {
|
|
10439
|
+
let t2 = useContext(M);
|
|
10440
|
+
if (t2 === null)
|
|
10035
10441
|
throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
|
|
10036
|
-
return
|
|
10442
|
+
return t2;
|
|
10037
10443
|
}
|
|
10038
10444
|
let M = createContext(null);
|
|
10039
10445
|
M.displayName = "NestingContext";
|
|
10040
|
-
function
|
|
10041
|
-
return "children" in
|
|
10042
|
-
}
|
|
10043
|
-
function
|
|
10044
|
-
let
|
|
10045
|
-
let
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
}, [
|
|
10049
|
-
|
|
10050
|
-
} }),
|
|
10446
|
+
function U(t2) {
|
|
10447
|
+
return "children" in t2 ? U(t2.children) : t2.current.filter(({ el: n2 }) => n2.current !== null).filter(({ state: n2 }) => n2 === "visible").length > 0;
|
|
10448
|
+
}
|
|
10449
|
+
function se(t2, n2) {
|
|
10450
|
+
let r2 = s$7(t2), s2 = useRef([]), R2 = f$3(), D2 = p$3(), p2 = o$4((i2, e2 = v$1.Hidden) => {
|
|
10451
|
+
let a2 = s2.current.findIndex(({ el: o2 }) => o2 === i2);
|
|
10452
|
+
a2 !== -1 && (u$5(e2, { [v$1.Unmount]() {
|
|
10453
|
+
s2.current.splice(a2, 1);
|
|
10454
|
+
}, [v$1.Hidden]() {
|
|
10455
|
+
s2.current[a2].state = "hidden";
|
|
10456
|
+
} }), D2.microTask(() => {
|
|
10051
10457
|
var o2;
|
|
10052
|
-
!
|
|
10458
|
+
!U(s2) && R2.current && ((o2 = r2.current) == null || o2.call(r2));
|
|
10053
10459
|
}));
|
|
10054
|
-
}),
|
|
10055
|
-
let
|
|
10056
|
-
return
|
|
10057
|
-
}),
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
})]),
|
|
10061
|
-
Promise.all(
|
|
10062
|
-
})]),
|
|
10063
|
-
}),
|
|
10064
|
-
Promise.all(
|
|
10460
|
+
}), x2 = o$4((i2) => {
|
|
10461
|
+
let e2 = s2.current.find(({ el: a2 }) => a2 === i2);
|
|
10462
|
+
return e2 ? e2.state !== "visible" && (e2.state = "visible") : s2.current.push({ el: i2, state: "visible" }), () => p2(i2, v$1.Unmount);
|
|
10463
|
+
}), h2 = useRef([]), v2 = useRef(Promise.resolve()), u2 = useRef({ enter: [], leave: [], idle: [] }), g2 = o$4((i2, e2, a2) => {
|
|
10464
|
+
h2.current.splice(0), n2 && (n2.chains.current[e2] = n2.chains.current[e2].filter(([o2]) => o2 !== i2)), n2 == null || n2.chains.current[e2].push([i2, new Promise((o2) => {
|
|
10465
|
+
h2.current.push(o2);
|
|
10466
|
+
})]), n2 == null || n2.chains.current[e2].push([i2, new Promise((o2) => {
|
|
10467
|
+
Promise.all(u2.current[e2].map(([f2, N2]) => N2)).then(() => o2());
|
|
10468
|
+
})]), e2 === "enter" ? v2.current = v2.current.then(() => n2 == null ? void 0 : n2.wait.current).then(() => a2(e2)) : a2(e2);
|
|
10469
|
+
}), d2 = o$4((i2, e2, a2) => {
|
|
10470
|
+
Promise.all(u2.current[e2].splice(0).map(([o2, f2]) => f2)).then(() => {
|
|
10065
10471
|
var o2;
|
|
10066
|
-
(o2 =
|
|
10067
|
-
}).then(() =>
|
|
10472
|
+
(o2 = h2.current.shift()) == null || o2();
|
|
10473
|
+
}).then(() => a2(e2));
|
|
10068
10474
|
});
|
|
10069
|
-
return useMemo(() => ({ children:
|
|
10475
|
+
return useMemo(() => ({ children: s2, register: x2, unregister: p2, onStart: g2, onStop: d2, wait: v2, chains: u2 }), [x2, p2, s2, g2, d2, u2, v2]);
|
|
10070
10476
|
}
|
|
10071
|
-
function
|
|
10477
|
+
function Ne() {
|
|
10072
10478
|
}
|
|
10073
|
-
let
|
|
10074
|
-
function
|
|
10075
|
-
var
|
|
10076
|
-
let
|
|
10077
|
-
for (let
|
|
10078
|
-
|
|
10079
|
-
return
|
|
10479
|
+
let Pe = ["beforeEnter", "afterEnter", "beforeLeave", "afterLeave"];
|
|
10480
|
+
function ae(t2) {
|
|
10481
|
+
var r2;
|
|
10482
|
+
let n2 = {};
|
|
10483
|
+
for (let s2 of Pe)
|
|
10484
|
+
n2[s2] = (r2 = t2[s2]) != null ? r2 : Ne;
|
|
10485
|
+
return n2;
|
|
10080
10486
|
}
|
|
10081
|
-
function
|
|
10082
|
-
let
|
|
10487
|
+
function Re(t2) {
|
|
10488
|
+
let n2 = useRef(ae(t2));
|
|
10083
10489
|
return useEffect(() => {
|
|
10084
|
-
|
|
10085
|
-
}, [
|
|
10086
|
-
}
|
|
10087
|
-
let
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10490
|
+
n2.current = ae(t2);
|
|
10491
|
+
}, [t2]), n2;
|
|
10492
|
+
}
|
|
10493
|
+
let De = "div", le = O.RenderStrategy;
|
|
10494
|
+
function He(t2, n2) {
|
|
10495
|
+
var Q2, Y2;
|
|
10496
|
+
let { beforeEnter: r2, afterEnter: s2, beforeLeave: R2, afterLeave: D$12, enter: p2, enterFrom: x2, enterTo: h2, entered: v2, leave: u2, leaveFrom: g2, leaveTo: d2, ...i2 } = t2, e2 = useRef(null), a2 = y$1(e2, n2), o2 = (Q2 = i2.unmount) == null || Q2 ? v$1.Unmount : v$1.Hidden, { show: f2, appear: N2, initial: T2 } = ye(), [l2, j2] = useState(f2 ? "visible" : "hidden"), z2 = xe(), { register: L, unregister: O2 } = z2;
|
|
10497
|
+
useEffect(() => L(e2), [L, e2]), useEffect(() => {
|
|
10498
|
+
if (o2 === v$1.Hidden && e2.current) {
|
|
10499
|
+
if (f2 && l2 !== "visible") {
|
|
10500
|
+
j2("visible");
|
|
10093
10501
|
return;
|
|
10094
10502
|
}
|
|
10095
|
-
return u$
|
|
10503
|
+
return u$5(l2, { ["hidden"]: () => O2(e2), ["visible"]: () => L(e2) });
|
|
10096
10504
|
}
|
|
10097
|
-
}, [
|
|
10098
|
-
let
|
|
10505
|
+
}, [l2, e2, L, O2, f2, o2]);
|
|
10506
|
+
let k2 = s$7({ base: S(i2.className), enter: S(p2), enterFrom: S(x2), enterTo: S(h2), entered: S(v2), leave: S(u2), leaveFrom: S(g2), leaveTo: S(d2) }), V = Re({ beforeEnter: r2, afterEnter: s2, beforeLeave: R2, afterLeave: D$12 }), G2 = l$4();
|
|
10099
10507
|
useEffect(() => {
|
|
10100
|
-
if (
|
|
10508
|
+
if (G2 && l2 === "visible" && e2.current === null)
|
|
10101
10509
|
throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
|
|
10102
|
-
}, [
|
|
10103
|
-
let
|
|
10104
|
-
|
|
10105
|
-
}
|
|
10106
|
-
|
|
10107
|
-
},
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
}
|
|
10111
|
-
|
|
10112
|
-
}
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10510
|
+
}, [e2, l2, G2]);
|
|
10511
|
+
let Te = T2 && !N2, K = N2 && f2 && T2, de2 = (() => !G2 || Te ? "idle" : f2 ? "enter" : "leave")(), H2 = c(0), fe = o$4((C2) => u$5(C2, { enter: () => {
|
|
10512
|
+
H2.addFlag(d$3.Opening), V.current.beforeEnter();
|
|
10513
|
+
}, leave: () => {
|
|
10514
|
+
H2.addFlag(d$3.Closing), V.current.beforeLeave();
|
|
10515
|
+
}, idle: () => {
|
|
10516
|
+
} })), me = o$4((C2) => u$5(C2, { enter: () => {
|
|
10517
|
+
H2.removeFlag(d$3.Opening), V.current.afterEnter();
|
|
10518
|
+
}, leave: () => {
|
|
10519
|
+
H2.removeFlag(d$3.Closing), V.current.afterLeave();
|
|
10520
|
+
}, idle: () => {
|
|
10521
|
+
} })), w2 = se(() => {
|
|
10522
|
+
j2("hidden"), O2(e2);
|
|
10523
|
+
}, z2), B = useRef(false);
|
|
10524
|
+
D({ immediate: K, container: e2, classes: k2, direction: de2, onStart: s$7((C2) => {
|
|
10525
|
+
B.current = true, w2.onStart(e2, C2, fe);
|
|
10526
|
+
}), onStop: s$7((C2) => {
|
|
10527
|
+
B.current = false, w2.onStop(e2, C2, me), C2 === "leave" && !U(w2) && (j2("hidden"), O2(e2));
|
|
10528
|
+
}) });
|
|
10529
|
+
let P2 = i2, ce = { ref: a2 };
|
|
10530
|
+
return K ? P2 = { ...P2, className: t$4(i2.className, ...k2.current.enter, ...k2.current.enterFrom) } : B.current && (P2.className = t$4(i2.className, (Y2 = e2.current) == null ? void 0 : Y2.className), P2.className === "" && delete P2.className), React__default.createElement(M.Provider, { value: w2 }, React__default.createElement(s$3, { value: u$5(l2, { ["visible"]: d$3.Open, ["hidden"]: d$3.Closed }) | H2.flags }, C({ ourProps: ce, theirProps: P2, defaultTag: De, features: le, visible: l2 === "visible", name: "Transition.Child" })));
|
|
10531
|
+
}
|
|
10532
|
+
function Fe(t2, n2) {
|
|
10533
|
+
let { show: r2, appear: s2 = false, unmount: R2 = true, ...D2 } = t2, p2 = useRef(null), x2 = y$1(p2, n2);
|
|
10534
|
+
l$4();
|
|
10535
|
+
let h2 = u$2();
|
|
10536
|
+
if (r2 === void 0 && h2 !== null && (r2 = (h2 & d$3.Open) === d$3.Open), ![true, false].includes(r2))
|
|
10122
10537
|
throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
|
|
10123
|
-
let [
|
|
10124
|
-
|
|
10125
|
-
}), [
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
}, [
|
|
10129
|
-
let
|
|
10538
|
+
let [v2, u2] = useState(r2 ? "visible" : "hidden"), g2 = se(() => {
|
|
10539
|
+
u2("hidden");
|
|
10540
|
+
}), [d2, i2] = useState(true), e2 = useRef([r2]);
|
|
10541
|
+
l$5(() => {
|
|
10542
|
+
d2 !== false && e2.current[e2.current.length - 1] !== r2 && (e2.current.push(r2), i2(false));
|
|
10543
|
+
}, [e2, r2]);
|
|
10544
|
+
let a2 = useMemo(() => ({ show: r2, appear: s2, initial: d2 }), [r2, s2, d2]);
|
|
10130
10545
|
useEffect(() => {
|
|
10131
|
-
if (
|
|
10132
|
-
|
|
10133
|
-
else if (!
|
|
10134
|
-
|
|
10546
|
+
if (r2)
|
|
10547
|
+
u2("visible");
|
|
10548
|
+
else if (!U(g2))
|
|
10549
|
+
u2("hidden");
|
|
10135
10550
|
else {
|
|
10136
|
-
let
|
|
10137
|
-
if (!
|
|
10551
|
+
let T2 = p2.current;
|
|
10552
|
+
if (!T2)
|
|
10138
10553
|
return;
|
|
10139
|
-
let
|
|
10140
|
-
|
|
10141
|
-
}
|
|
10142
|
-
}, [
|
|
10143
|
-
let
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10554
|
+
let l2 = T2.getBoundingClientRect();
|
|
10555
|
+
l2.x === 0 && l2.y === 0 && l2.width === 0 && l2.height === 0 && u2("hidden");
|
|
10556
|
+
}
|
|
10557
|
+
}, [r2, g2]);
|
|
10558
|
+
let o2 = { unmount: R2 }, f2 = o$4(() => {
|
|
10559
|
+
var T2;
|
|
10560
|
+
d2 && i2(false), (T2 = t2.beforeEnter) == null || T2.call(t2);
|
|
10561
|
+
}), N2 = o$4(() => {
|
|
10562
|
+
var T2;
|
|
10563
|
+
d2 && i2(false), (T2 = t2.beforeLeave) == null || T2.call(t2);
|
|
10564
|
+
});
|
|
10565
|
+
return React__default.createElement(M.Provider, { value: g2 }, React__default.createElement(I.Provider, { value: a2 }, C({ ourProps: { ...o2, as: Fragment$1, children: React__default.createElement(ue, { ref: x2, ...o2, ...D2, beforeEnter: f2, beforeLeave: N2 }) }, theirProps: {}, defaultTag: Fragment$1, features: le, visible: v2 === "visible", name: "Transition" })));
|
|
10566
|
+
}
|
|
10567
|
+
function _e(t2, n2) {
|
|
10568
|
+
let r2 = useContext(I) !== null, s2 = u$2() !== null;
|
|
10569
|
+
return React__default.createElement(React__default.Fragment, null, !r2 && s2 ? React__default.createElement(q, { ref: n2, ...t2 }) : React__default.createElement(ue, { ref: n2, ...t2 }));
|
|
10570
|
+
}
|
|
10571
|
+
let q = U$2(Fe), ue = U$2(He), Le = U$2(_e), qe = Object.assign(q, { Child: Le, Root: q });
|
|
10149
10572
|
function Modal(props) {
|
|
10150
10573
|
const {
|
|
10151
10574
|
children,
|
|
@@ -10158,11 +10581,11 @@ function Modal(props) {
|
|
|
10158
10581
|
isModal: true
|
|
10159
10582
|
});
|
|
10160
10583
|
return /* @__PURE__ */ jsx(Fragment, {
|
|
10161
|
-
children: /* @__PURE__ */ jsx(
|
|
10584
|
+
children: /* @__PURE__ */ jsx(qe, {
|
|
10162
10585
|
appear: true,
|
|
10163
10586
|
show: isOpen,
|
|
10164
10587
|
as: Fragment$1,
|
|
10165
|
-
children: /* @__PURE__ */ jsx(
|
|
10588
|
+
children: /* @__PURE__ */ jsx(_t, {
|
|
10166
10589
|
as: "div",
|
|
10167
10590
|
className: "fixed inset-0 z-10 overflow-y-auto",
|
|
10168
10591
|
style: {
|
|
@@ -10171,7 +10594,7 @@ function Modal(props) {
|
|
|
10171
10594
|
onClose: handleClose,
|
|
10172
10595
|
children: /* @__PURE__ */ jsxs("div", {
|
|
10173
10596
|
className: "min-h-screen text-center sm:px-4",
|
|
10174
|
-
children: [/* @__PURE__ */ jsx(
|
|
10597
|
+
children: [/* @__PURE__ */ jsx(qe.Child, {
|
|
10175
10598
|
as: Fragment$1,
|
|
10176
10599
|
enter: "ease-out duration-300",
|
|
10177
10600
|
enterFrom: "opacity-0",
|
|
@@ -10179,14 +10602,14 @@ function Modal(props) {
|
|
|
10179
10602
|
leave: "ease-in duration-200",
|
|
10180
10603
|
leaveFrom: "opacity-100",
|
|
10181
10604
|
leaveTo: "opacity-0",
|
|
10182
|
-
children: /* @__PURE__ */ jsx(
|
|
10605
|
+
children: /* @__PURE__ */ jsx(_t.Overlay, {
|
|
10183
10606
|
className: "fixed inset-0"
|
|
10184
10607
|
})
|
|
10185
10608
|
}), /* @__PURE__ */ jsx("span", {
|
|
10186
10609
|
className: "inline-block h-screen align-middle",
|
|
10187
10610
|
"aria-hidden": "true",
|
|
10188
10611
|
children: "\u200B"
|
|
10189
|
-
}), /* @__PURE__ */ jsx(
|
|
10612
|
+
}), /* @__PURE__ */ jsx(qe.Child, {
|
|
10190
10613
|
as: Fragment$1,
|
|
10191
10614
|
enter: "ease-out duration-300",
|
|
10192
10615
|
enterFrom: "opacity-0 scale-95",
|
|
@@ -10411,7 +10834,7 @@ const MenuProductRoot = (props) => {
|
|
|
10411
10834
|
});
|
|
10412
10835
|
};
|
|
10413
10836
|
var style = "";
|
|
10414
|
-
const ProductDataContext =
|
|
10837
|
+
const ProductDataContext = React__default.createContext(null);
|
|
10415
10838
|
function ProductDataProvider({
|
|
10416
10839
|
rootProduct,
|
|
10417
10840
|
children
|
|
@@ -10489,6 +10912,7 @@ function ProductConfigurator(props) {
|
|
|
10489
10912
|
});
|
|
10490
10913
|
} else {
|
|
10491
10914
|
console.log("selected", getValues("selected"));
|
|
10915
|
+
console.log("filter", getValues("filter"));
|
|
10492
10916
|
const decodedCleanedSelected = decodeSelected(cleanSelected(getValues("selected")));
|
|
10493
10917
|
console.log("decodedCleanedSelected: ", decodedCleanedSelected);
|
|
10494
10918
|
handleAddToCart({
|