@littlebox/strapi-suite 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/_chunks/App-5t0oXrfw.mjs +5284 -0
- package/dist/_chunks/App-DUrW4zBW.js +5287 -0
- package/dist/_chunks/SlugInput-C221apIK.mjs +280 -0
- package/dist/_chunks/SlugInput-CxxShxb6.js +300 -0
- package/dist/_chunks/convertToSlug-B5DOR_Nr.js +83 -0
- package/dist/_chunks/convertToSlug-CmCb9ke3.mjs +84 -0
- package/dist/_chunks/en-Bz6GsXYT.js +170 -0
- package/dist/_chunks/en-RUOaam8y.mjs +170 -0
- package/dist/_chunks/index-B-VDYXwv.mjs +3408 -0
- package/dist/_chunks/index-BW7xqYof.js +3409 -0
- package/dist/admin/index.js +3 -0
- package/dist/admin/index.mjs +4 -0
- package/dist/admin/src/components/BoxGrid.d.ts +3 -0
- package/dist/admin/src/components/Card.d.ts +2 -0
- package/dist/admin/src/components/ConfirmModal.d.ts +2 -0
- package/dist/admin/src/components/DangerModal.d.ts +2 -0
- package/dist/admin/src/components/HeaderLayout.d.ts +2 -0
- package/dist/admin/src/components/Initializer.d.ts +5 -0
- package/dist/admin/src/components/Logo.d.ts +2 -0
- package/dist/admin/src/components/MenuCreateModal.d.ts +2 -0
- package/dist/admin/src/components/MenuDuplicateModal.d.ts +2 -0
- package/dist/admin/src/components/PageAttributesBox.d.ts +5 -0
- package/dist/admin/src/components/ParameterHandleDataModal.d.ts +9 -0
- package/dist/admin/src/components/PluginIcon.d.ts +2 -0
- package/dist/admin/src/components/ProductIcon.d.ts +2 -0
- package/dist/admin/src/components/SlugInput.d.ts +10 -0
- package/dist/admin/src/components/SlugSettingsModal.d.ts +2 -0
- package/dist/admin/src/components/Tab.d.ts +28 -0
- package/dist/admin/src/components/TemplateHandleDataModal.d.ts +9 -0
- package/dist/admin/src/components/TranslationHandleDataModal.d.ts +15 -0
- package/dist/admin/src/components/menu/MenuDragDrop.d.ts +7 -0
- package/dist/admin/src/components/menu/MenuEditItem.d.ts +8 -0
- package/dist/admin/src/components/menu/MenuItem.d.ts +11 -0
- package/dist/admin/src/components/menu/MenuList.d.ts +11 -0
- package/dist/admin/src/components/menu/types.d.ts +27 -0
- package/dist/admin/src/contexts/settings.d.ts +11 -0
- package/dist/admin/src/core/config.d.ts +14 -0
- package/dist/admin/src/core/di/registry.d.ts +8 -0
- package/dist/admin/src/core/events/appSettingsUpdated.d.ts +12 -0
- package/dist/admin/src/core/events/documentCustomFieldStarted.d.ts +10 -0
- package/dist/admin/src/core/events/event.d.ts +4 -0
- package/dist/admin/src/core/events/pageAttributeUpdated.d.ts +10 -0
- package/dist/admin/src/core/gateways/attributeGateway.d.ts +29 -0
- package/dist/admin/src/core/gateways/localeGateway.d.ts +20 -0
- package/dist/admin/src/core/gateways/menuGateway.d.ts +82 -0
- package/dist/admin/src/core/gateways/parameterGateway.d.ts +42 -0
- package/dist/admin/src/core/gateways/settingGateway.d.ts +21 -0
- package/dist/admin/src/core/gateways/slugGateway.d.ts +26 -0
- package/dist/admin/src/core/gateways/templateGateway.d.ts +37 -0
- package/dist/admin/src/core/gateways/translationGateway.d.ts +42 -0
- package/dist/admin/src/core/http/httpClient.d.ts +18 -0
- package/dist/admin/src/core/mediator/mediator.d.ts +11 -0
- package/dist/admin/src/core/usecases/createMenu.d.ts +10 -0
- package/dist/admin/src/core/usecases/createParameter.d.ts +10 -0
- package/dist/admin/src/core/usecases/createTemplate.d.ts +9 -0
- package/dist/admin/src/core/usecases/createTranslations.d.ts +10 -0
- package/dist/admin/src/core/usecases/deleteAttributes.d.ts +6 -0
- package/dist/admin/src/core/usecases/deleteMenus.d.ts +6 -0
- package/dist/admin/src/core/usecases/deleteParameters.d.ts +6 -0
- package/dist/admin/src/core/usecases/deleteSlugs.d.ts +6 -0
- package/dist/admin/src/core/usecases/deleteTemplates.d.ts +6 -0
- package/dist/admin/src/core/usecases/deleteTranslations.d.ts +6 -0
- package/dist/admin/src/core/usecases/duplicateMenu.d.ts +6 -0
- package/dist/admin/src/core/usecases/editMenu.d.ts +21 -0
- package/dist/admin/src/core/usecases/editParameter.d.ts +10 -0
- package/dist/admin/src/core/usecases/editTemplate.d.ts +9 -0
- package/dist/admin/src/core/usecases/editTranslations.d.ts +10 -0
- package/dist/admin/src/core/usecases/fetchAttributes.d.ts +19 -0
- package/dist/admin/src/core/usecases/fetchDocumentAttributes.d.ts +17 -0
- package/dist/admin/src/core/usecases/fetchLocales.d.ts +12 -0
- package/dist/admin/src/core/usecases/fetchMenu.d.ts +25 -0
- package/dist/admin/src/core/usecases/fetchMenus.d.ts +13 -0
- package/dist/admin/src/core/usecases/fetchModuleSettings.d.ts +4 -0
- package/dist/admin/src/core/usecases/fetchParameters.d.ts +13 -0
- package/dist/admin/src/core/usecases/fetchSettings.d.ts +10 -0
- package/dist/admin/src/core/usecases/fetchSlugs.d.ts +16 -0
- package/dist/admin/src/core/usecases/fetchTemplates.d.ts +12 -0
- package/dist/admin/src/core/usecases/fetchTranslations.d.ts +13 -0
- package/dist/admin/src/core/usecases/updateSetting.d.ts +14 -0
- package/dist/admin/src/core/utils/arrayToTree.d.ts +2 -0
- package/dist/admin/src/core/utils/convertToSlug.d.ts +2 -0
- package/dist/admin/src/core/utils/getTranslation.d.ts +2 -0
- package/dist/admin/src/core/utils/isEmpty.d.ts +3 -0
- package/dist/admin/src/core/utils/objectToQueryString.d.ts +2 -0
- package/dist/admin/src/index.d.ts +11 -0
- package/dist/admin/src/pages/App.d.ts +2 -0
- package/dist/admin/src/pages/AttributeSettingsPage.d.ts +2 -0
- package/dist/admin/src/pages/ErrorPage.d.ts +2 -0
- package/dist/admin/src/pages/HomePage.d.ts +2 -0
- package/dist/admin/src/pages/MenuSettingsEditPage.d.ts +2 -0
- package/dist/admin/src/pages/MenuSettingsPage.d.ts +2 -0
- package/dist/admin/src/pages/ParameterSettingsPage.d.ts +2 -0
- package/dist/admin/src/pages/SlugSettingsPage.d.ts +2 -0
- package/dist/admin/src/pages/TemplateSettingsPage.d.ts +2 -0
- package/dist/admin/src/pages/TranslationSettingsPage.d.ts +2 -0
- package/dist/admin/src/pluginId.d.ts +1 -0
- package/dist/server/index.js +2229 -0
- package/dist/server/index.mjs +2230 -0
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/config/index.d.ts +50 -0
- package/dist/server/src/content-types/app/settings/index.d.ts +51 -0
- package/dist/server/src/content-types/index.d.ts +447 -0
- package/dist/server/src/content-types/modules/attributes/index.d.ts +75 -0
- package/dist/server/src/content-types/modules/menus/children/index.d.ts +71 -0
- package/dist/server/src/content-types/modules/menus/index.d.ts +47 -0
- package/dist/server/src/content-types/modules/parameters/index.d.ts +47 -0
- package/dist/server/src/content-types/modules/slugs/index.d.ts +67 -0
- package/dist/server/src/content-types/modules/templates/index.d.ts +43 -0
- package/dist/server/src/content-types/modules/translations/index.d.ts +51 -0
- package/dist/server/src/controllers/app/setting.d.ts +9 -0
- package/dist/server/src/controllers/index.d.ts +61 -0
- package/dist/server/src/controllers/modules/attribute.d.ts +9 -0
- package/dist/server/src/controllers/modules/menu.d.ts +13 -0
- package/dist/server/src/controllers/modules/parameter.d.ts +11 -0
- package/dist/server/src/controllers/modules/slug.d.ts +9 -0
- package/dist/server/src/controllers/modules/template.d.ts +10 -0
- package/dist/server/src/controllers/modules/translation.d.ts +11 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/index.d.ts +653 -0
- package/dist/server/src/lifecycles/index.d.ts +9 -0
- package/dist/server/src/lifecycles/modules/slug/after-create.d.ts +1 -0
- package/dist/server/src/lifecycles/modules/slug/after-delete.d.ts +1 -0
- package/dist/server/src/lifecycles/modules/slug/after-findmany.d.ts +1 -0
- package/dist/server/src/lifecycles/modules/slug/after-findone.d.ts +1 -0
- package/dist/server/src/lifecycles/modules/slug/after-unpublish.d.ts +1 -0
- package/dist/server/src/lifecycles/modules/slug/after-update.d.ts +1 -0
- package/dist/server/src/lifecycles/modules/slug/before-create.d.ts +1 -0
- package/dist/server/src/lifecycles/modules/slug/before-update.d.ts +1 -0
- package/dist/server/src/middlewares/index.d.ts +2 -0
- package/dist/server/src/policies/index.d.ts +2 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/routes/admin-api.d.ts +9 -0
- package/dist/server/src/routes/content-api.d.ts +10 -0
- package/dist/server/src/routes/index.d.ts +26 -0
- package/dist/server/src/services/app/setting.d.ts +9 -0
- package/dist/server/src/services/index.d.ts +70 -0
- package/dist/server/src/services/modules/attribute.d.ts +9 -0
- package/dist/server/src/services/modules/menu.d.ts +13 -0
- package/dist/server/src/services/modules/parameter.d.ts +11 -0
- package/dist/server/src/services/modules/slug.d.ts +18 -0
- package/dist/server/src/services/modules/template.d.ts +10 -0
- package/dist/server/src/services/modules/translation.d.ts +16 -0
- package/dist/server/src/utils/arrayToTree.d.ts +2 -0
- package/dist/server/src/utils/getSlugByDocumentId.d.ts +7 -0
- package/package.json +112 -0
|
@@ -0,0 +1,3409 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const admin = require("@strapi/strapi/admin");
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
+
const reactRouterDom = require("react-router-dom");
|
|
6
|
+
const designSystem = require("@strapi/design-system");
|
|
7
|
+
const reactIntl = require("react-intl");
|
|
8
|
+
const icons = require("@strapi/icons");
|
|
9
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
|
+
const React__default = /* @__PURE__ */ _interopDefault(React);
|
|
11
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
12
|
+
const v = glob[path];
|
|
13
|
+
if (v) {
|
|
14
|
+
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
15
|
+
}
|
|
16
|
+
return new Promise((_, reject) => {
|
|
17
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
18
|
+
reject.bind(
|
|
19
|
+
null,
|
|
20
|
+
new Error(
|
|
21
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
var map;
|
|
28
|
+
try {
|
|
29
|
+
map = Map;
|
|
30
|
+
} catch (_) {
|
|
31
|
+
}
|
|
32
|
+
var set;
|
|
33
|
+
try {
|
|
34
|
+
set = Set;
|
|
35
|
+
} catch (_) {
|
|
36
|
+
}
|
|
37
|
+
function baseClone(src, circulars, clones) {
|
|
38
|
+
if (!src || typeof src !== "object" || typeof src === "function") {
|
|
39
|
+
return src;
|
|
40
|
+
}
|
|
41
|
+
if (src.nodeType && "cloneNode" in src) {
|
|
42
|
+
return src.cloneNode(true);
|
|
43
|
+
}
|
|
44
|
+
if (src instanceof Date) {
|
|
45
|
+
return new Date(src.getTime());
|
|
46
|
+
}
|
|
47
|
+
if (src instanceof RegExp) {
|
|
48
|
+
return new RegExp(src);
|
|
49
|
+
}
|
|
50
|
+
if (Array.isArray(src)) {
|
|
51
|
+
return src.map(clone);
|
|
52
|
+
}
|
|
53
|
+
if (map && src instanceof map) {
|
|
54
|
+
return new Map(Array.from(src.entries()));
|
|
55
|
+
}
|
|
56
|
+
if (set && src instanceof set) {
|
|
57
|
+
return new Set(Array.from(src.values()));
|
|
58
|
+
}
|
|
59
|
+
if (src instanceof Object) {
|
|
60
|
+
circulars.push(src);
|
|
61
|
+
var obj = Object.create(src);
|
|
62
|
+
clones.push(obj);
|
|
63
|
+
for (var key in src) {
|
|
64
|
+
var idx = circulars.findIndex(function(i) {
|
|
65
|
+
return i === src[key];
|
|
66
|
+
});
|
|
67
|
+
obj[key] = idx > -1 ? clones[idx] : baseClone(src[key], circulars, clones);
|
|
68
|
+
}
|
|
69
|
+
return obj;
|
|
70
|
+
}
|
|
71
|
+
return src;
|
|
72
|
+
}
|
|
73
|
+
function clone(src) {
|
|
74
|
+
return baseClone(src, [], []);
|
|
75
|
+
}
|
|
76
|
+
const toString$2 = Object.prototype.toString;
|
|
77
|
+
const errorToString = Error.prototype.toString;
|
|
78
|
+
const regExpToString = RegExp.prototype.toString;
|
|
79
|
+
const symbolToString$1 = typeof Symbol !== "undefined" ? Symbol.prototype.toString : () => "";
|
|
80
|
+
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
|
81
|
+
function printNumber(val) {
|
|
82
|
+
if (val != +val) return "NaN";
|
|
83
|
+
const isNegativeZero = val === 0 && 1 / val < 0;
|
|
84
|
+
return isNegativeZero ? "-0" : "" + val;
|
|
85
|
+
}
|
|
86
|
+
function printSimpleValue(val, quoteStrings = false) {
|
|
87
|
+
if (val == null || val === true || val === false) return "" + val;
|
|
88
|
+
const typeOf = typeof val;
|
|
89
|
+
if (typeOf === "number") return printNumber(val);
|
|
90
|
+
if (typeOf === "string") return quoteStrings ? `"${val}"` : val;
|
|
91
|
+
if (typeOf === "function") return "[Function " + (val.name || "anonymous") + "]";
|
|
92
|
+
if (typeOf === "symbol") return symbolToString$1.call(val).replace(SYMBOL_REGEXP, "Symbol($1)");
|
|
93
|
+
const tag = toString$2.call(val).slice(8, -1);
|
|
94
|
+
if (tag === "Date") return isNaN(val.getTime()) ? "" + val : val.toISOString(val);
|
|
95
|
+
if (tag === "Error" || val instanceof Error) return "[" + errorToString.call(val) + "]";
|
|
96
|
+
if (tag === "RegExp") return regExpToString.call(val);
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
function printValue(value, quoteStrings) {
|
|
100
|
+
let result = printSimpleValue(value, quoteStrings);
|
|
101
|
+
if (result !== null) return result;
|
|
102
|
+
return JSON.stringify(value, function(key, value2) {
|
|
103
|
+
let result2 = printSimpleValue(this[key], quoteStrings);
|
|
104
|
+
if (result2 !== null) return result2;
|
|
105
|
+
return value2;
|
|
106
|
+
}, 2);
|
|
107
|
+
}
|
|
108
|
+
let mixed = {
|
|
109
|
+
default: "${path} is invalid",
|
|
110
|
+
required: "${path} is a required field",
|
|
111
|
+
oneOf: "${path} must be one of the following values: ${values}",
|
|
112
|
+
notOneOf: "${path} must not be one of the following values: ${values}",
|
|
113
|
+
notType: ({
|
|
114
|
+
path,
|
|
115
|
+
type,
|
|
116
|
+
value,
|
|
117
|
+
originalValue
|
|
118
|
+
}) => {
|
|
119
|
+
let isCast = originalValue != null && originalValue !== value;
|
|
120
|
+
let msg = `${path} must be a \`${type}\` type, but the final value was: \`${printValue(value, true)}\`` + (isCast ? ` (cast from the value \`${printValue(originalValue, true)}\`).` : ".");
|
|
121
|
+
if (value === null) {
|
|
122
|
+
msg += `
|
|
123
|
+
If "null" is intended as an empty value be sure to mark the schema as \`.nullable()\``;
|
|
124
|
+
}
|
|
125
|
+
return msg;
|
|
126
|
+
},
|
|
127
|
+
defined: "${path} must be defined"
|
|
128
|
+
};
|
|
129
|
+
let string = {
|
|
130
|
+
length: "${path} must be exactly ${length} characters",
|
|
131
|
+
min: "${path} must be at least ${min} characters",
|
|
132
|
+
max: "${path} must be at most ${max} characters",
|
|
133
|
+
matches: '${path} must match the following: "${regex}"',
|
|
134
|
+
email: "${path} must be a valid email",
|
|
135
|
+
url: "${path} must be a valid URL",
|
|
136
|
+
uuid: "${path} must be a valid UUID",
|
|
137
|
+
trim: "${path} must be a trimmed string",
|
|
138
|
+
lowercase: "${path} must be a lowercase string",
|
|
139
|
+
uppercase: "${path} must be a upper case string"
|
|
140
|
+
};
|
|
141
|
+
let number = {
|
|
142
|
+
min: "${path} must be greater than or equal to ${min}",
|
|
143
|
+
max: "${path} must be less than or equal to ${max}",
|
|
144
|
+
lessThan: "${path} must be less than ${less}",
|
|
145
|
+
moreThan: "${path} must be greater than ${more}",
|
|
146
|
+
positive: "${path} must be a positive number",
|
|
147
|
+
negative: "${path} must be a negative number",
|
|
148
|
+
integer: "${path} must be an integer"
|
|
149
|
+
};
|
|
150
|
+
let date = {
|
|
151
|
+
min: "${path} field must be later than ${min}",
|
|
152
|
+
max: "${path} field must be at earlier than ${max}"
|
|
153
|
+
};
|
|
154
|
+
let boolean = {
|
|
155
|
+
isValue: "${path} field must be ${value}"
|
|
156
|
+
};
|
|
157
|
+
let object = {
|
|
158
|
+
noUnknown: "${path} field has unspecified keys: ${unknown}"
|
|
159
|
+
};
|
|
160
|
+
let array = {
|
|
161
|
+
min: "${path} field must have at least ${min} items",
|
|
162
|
+
max: "${path} field must have less than or equal to ${max} items",
|
|
163
|
+
length: "${path} must be have ${length} items"
|
|
164
|
+
};
|
|
165
|
+
Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
166
|
+
mixed,
|
|
167
|
+
string,
|
|
168
|
+
number,
|
|
169
|
+
date,
|
|
170
|
+
object,
|
|
171
|
+
array,
|
|
172
|
+
boolean
|
|
173
|
+
});
|
|
174
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
175
|
+
function getDefaultExportFromCjs(x) {
|
|
176
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
177
|
+
}
|
|
178
|
+
var objectProto$c = Object.prototype;
|
|
179
|
+
var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
|
|
180
|
+
function baseHas$1(object2, key) {
|
|
181
|
+
return object2 != null && hasOwnProperty$9.call(object2, key);
|
|
182
|
+
}
|
|
183
|
+
var _baseHas = baseHas$1;
|
|
184
|
+
var isArray$8 = Array.isArray;
|
|
185
|
+
var isArray_1 = isArray$8;
|
|
186
|
+
var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
187
|
+
var _freeGlobal = freeGlobal$1;
|
|
188
|
+
var freeGlobal = _freeGlobal;
|
|
189
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
190
|
+
var root$8 = freeGlobal || freeSelf || Function("return this")();
|
|
191
|
+
var _root = root$8;
|
|
192
|
+
var root$7 = _root;
|
|
193
|
+
var Symbol$5 = root$7.Symbol;
|
|
194
|
+
var _Symbol = Symbol$5;
|
|
195
|
+
var Symbol$4 = _Symbol;
|
|
196
|
+
var objectProto$b = Object.prototype;
|
|
197
|
+
var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
|
|
198
|
+
var nativeObjectToString$1 = objectProto$b.toString;
|
|
199
|
+
var symToStringTag$1 = Symbol$4 ? Symbol$4.toStringTag : void 0;
|
|
200
|
+
function getRawTag$1(value) {
|
|
201
|
+
var isOwn = hasOwnProperty$8.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
202
|
+
try {
|
|
203
|
+
value[symToStringTag$1] = void 0;
|
|
204
|
+
var unmasked = true;
|
|
205
|
+
} catch (e) {
|
|
206
|
+
}
|
|
207
|
+
var result = nativeObjectToString$1.call(value);
|
|
208
|
+
if (unmasked) {
|
|
209
|
+
if (isOwn) {
|
|
210
|
+
value[symToStringTag$1] = tag;
|
|
211
|
+
} else {
|
|
212
|
+
delete value[symToStringTag$1];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return result;
|
|
216
|
+
}
|
|
217
|
+
var _getRawTag = getRawTag$1;
|
|
218
|
+
var objectProto$a = Object.prototype;
|
|
219
|
+
var nativeObjectToString = objectProto$a.toString;
|
|
220
|
+
function objectToString$1(value) {
|
|
221
|
+
return nativeObjectToString.call(value);
|
|
222
|
+
}
|
|
223
|
+
var _objectToString = objectToString$1;
|
|
224
|
+
var Symbol$3 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
|
|
225
|
+
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
226
|
+
var symToStringTag = Symbol$3 ? Symbol$3.toStringTag : void 0;
|
|
227
|
+
function baseGetTag$5(value) {
|
|
228
|
+
if (value == null) {
|
|
229
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
230
|
+
}
|
|
231
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
232
|
+
}
|
|
233
|
+
var _baseGetTag = baseGetTag$5;
|
|
234
|
+
function isObjectLike$5(value) {
|
|
235
|
+
return value != null && typeof value == "object";
|
|
236
|
+
}
|
|
237
|
+
var isObjectLike_1 = isObjectLike$5;
|
|
238
|
+
var baseGetTag$4 = _baseGetTag, isObjectLike$4 = isObjectLike_1;
|
|
239
|
+
var symbolTag$1 = "[object Symbol]";
|
|
240
|
+
function isSymbol$3(value) {
|
|
241
|
+
return typeof value == "symbol" || isObjectLike$4(value) && baseGetTag$4(value) == symbolTag$1;
|
|
242
|
+
}
|
|
243
|
+
var isSymbol_1 = isSymbol$3;
|
|
244
|
+
var isArray$7 = isArray_1, isSymbol$2 = isSymbol_1;
|
|
245
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
|
|
246
|
+
function isKey$3(value, object2) {
|
|
247
|
+
if (isArray$7(value)) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
var type = typeof value;
|
|
251
|
+
if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol$2(value)) {
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
254
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object2 != null && value in Object(object2);
|
|
255
|
+
}
|
|
256
|
+
var _isKey = isKey$3;
|
|
257
|
+
function isObject$3(value) {
|
|
258
|
+
var type = typeof value;
|
|
259
|
+
return value != null && (type == "object" || type == "function");
|
|
260
|
+
}
|
|
261
|
+
var isObject_1 = isObject$3;
|
|
262
|
+
var baseGetTag$3 = _baseGetTag, isObject$2 = isObject_1;
|
|
263
|
+
var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
|
|
264
|
+
function isFunction$2(value) {
|
|
265
|
+
if (!isObject$2(value)) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
var tag = baseGetTag$3(value);
|
|
269
|
+
return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
270
|
+
}
|
|
271
|
+
var isFunction_1 = isFunction$2;
|
|
272
|
+
var root$6 = _root;
|
|
273
|
+
var coreJsData$1 = root$6["__core-js_shared__"];
|
|
274
|
+
var _coreJsData = coreJsData$1;
|
|
275
|
+
var coreJsData = _coreJsData;
|
|
276
|
+
var maskSrcKey = function() {
|
|
277
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
|
278
|
+
return uid ? "Symbol(src)_1." + uid : "";
|
|
279
|
+
}();
|
|
280
|
+
function isMasked$1(func) {
|
|
281
|
+
return !!maskSrcKey && maskSrcKey in func;
|
|
282
|
+
}
|
|
283
|
+
var _isMasked = isMasked$1;
|
|
284
|
+
var funcProto$1 = Function.prototype;
|
|
285
|
+
var funcToString$1 = funcProto$1.toString;
|
|
286
|
+
function toSource$2(func) {
|
|
287
|
+
if (func != null) {
|
|
288
|
+
try {
|
|
289
|
+
return funcToString$1.call(func);
|
|
290
|
+
} catch (e) {
|
|
291
|
+
}
|
|
292
|
+
try {
|
|
293
|
+
return func + "";
|
|
294
|
+
} catch (e) {
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return "";
|
|
298
|
+
}
|
|
299
|
+
var _toSource = toSource$2;
|
|
300
|
+
var isFunction$1 = isFunction_1, isMasked = _isMasked, isObject$1 = isObject_1, toSource$1 = _toSource;
|
|
301
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
302
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
303
|
+
var funcProto = Function.prototype, objectProto$9 = Object.prototype;
|
|
304
|
+
var funcToString = funcProto.toString;
|
|
305
|
+
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
306
|
+
var reIsNative = RegExp(
|
|
307
|
+
"^" + funcToString.call(hasOwnProperty$7).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
308
|
+
);
|
|
309
|
+
function baseIsNative$1(value) {
|
|
310
|
+
if (!isObject$1(value) || isMasked(value)) {
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
|
|
314
|
+
return pattern.test(toSource$1(value));
|
|
315
|
+
}
|
|
316
|
+
var _baseIsNative = baseIsNative$1;
|
|
317
|
+
function getValue$1(object2, key) {
|
|
318
|
+
return object2 == null ? void 0 : object2[key];
|
|
319
|
+
}
|
|
320
|
+
var _getValue = getValue$1;
|
|
321
|
+
var baseIsNative = _baseIsNative, getValue = _getValue;
|
|
322
|
+
function getNative$7(object2, key) {
|
|
323
|
+
var value = getValue(object2, key);
|
|
324
|
+
return baseIsNative(value) ? value : void 0;
|
|
325
|
+
}
|
|
326
|
+
var _getNative = getNative$7;
|
|
327
|
+
var getNative$6 = _getNative;
|
|
328
|
+
var nativeCreate$4 = getNative$6(Object, "create");
|
|
329
|
+
var _nativeCreate = nativeCreate$4;
|
|
330
|
+
var nativeCreate$3 = _nativeCreate;
|
|
331
|
+
function hashClear$1() {
|
|
332
|
+
this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
|
|
333
|
+
this.size = 0;
|
|
334
|
+
}
|
|
335
|
+
var _hashClear = hashClear$1;
|
|
336
|
+
function hashDelete$1(key) {
|
|
337
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
338
|
+
this.size -= result ? 1 : 0;
|
|
339
|
+
return result;
|
|
340
|
+
}
|
|
341
|
+
var _hashDelete = hashDelete$1;
|
|
342
|
+
var nativeCreate$2 = _nativeCreate;
|
|
343
|
+
var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
|
|
344
|
+
var objectProto$8 = Object.prototype;
|
|
345
|
+
var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
|
|
346
|
+
function hashGet$1(key) {
|
|
347
|
+
var data = this.__data__;
|
|
348
|
+
if (nativeCreate$2) {
|
|
349
|
+
var result = data[key];
|
|
350
|
+
return result === HASH_UNDEFINED$2 ? void 0 : result;
|
|
351
|
+
}
|
|
352
|
+
return hasOwnProperty$6.call(data, key) ? data[key] : void 0;
|
|
353
|
+
}
|
|
354
|
+
var _hashGet = hashGet$1;
|
|
355
|
+
var nativeCreate$1 = _nativeCreate;
|
|
356
|
+
var objectProto$7 = Object.prototype;
|
|
357
|
+
var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
|
|
358
|
+
function hashHas$1(key) {
|
|
359
|
+
var data = this.__data__;
|
|
360
|
+
return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$5.call(data, key);
|
|
361
|
+
}
|
|
362
|
+
var _hashHas = hashHas$1;
|
|
363
|
+
var nativeCreate = _nativeCreate;
|
|
364
|
+
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
|
|
365
|
+
function hashSet$1(key, value) {
|
|
366
|
+
var data = this.__data__;
|
|
367
|
+
this.size += this.has(key) ? 0 : 1;
|
|
368
|
+
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
|
|
369
|
+
return this;
|
|
370
|
+
}
|
|
371
|
+
var _hashSet = hashSet$1;
|
|
372
|
+
var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
|
|
373
|
+
function Hash$1(entries) {
|
|
374
|
+
var index2 = -1, length = entries == null ? 0 : entries.length;
|
|
375
|
+
this.clear();
|
|
376
|
+
while (++index2 < length) {
|
|
377
|
+
var entry = entries[index2];
|
|
378
|
+
this.set(entry[0], entry[1]);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
Hash$1.prototype.clear = hashClear;
|
|
382
|
+
Hash$1.prototype["delete"] = hashDelete;
|
|
383
|
+
Hash$1.prototype.get = hashGet;
|
|
384
|
+
Hash$1.prototype.has = hashHas;
|
|
385
|
+
Hash$1.prototype.set = hashSet;
|
|
386
|
+
var _Hash = Hash$1;
|
|
387
|
+
function listCacheClear$1() {
|
|
388
|
+
this.__data__ = [];
|
|
389
|
+
this.size = 0;
|
|
390
|
+
}
|
|
391
|
+
var _listCacheClear = listCacheClear$1;
|
|
392
|
+
function eq$2(value, other) {
|
|
393
|
+
return value === other || value !== value && other !== other;
|
|
394
|
+
}
|
|
395
|
+
var eq_1 = eq$2;
|
|
396
|
+
var eq$1 = eq_1;
|
|
397
|
+
function assocIndexOf$4(array2, key) {
|
|
398
|
+
var length = array2.length;
|
|
399
|
+
while (length--) {
|
|
400
|
+
if (eq$1(array2[length][0], key)) {
|
|
401
|
+
return length;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return -1;
|
|
405
|
+
}
|
|
406
|
+
var _assocIndexOf = assocIndexOf$4;
|
|
407
|
+
var assocIndexOf$3 = _assocIndexOf;
|
|
408
|
+
var arrayProto = Array.prototype;
|
|
409
|
+
var splice = arrayProto.splice;
|
|
410
|
+
function listCacheDelete$1(key) {
|
|
411
|
+
var data = this.__data__, index2 = assocIndexOf$3(data, key);
|
|
412
|
+
if (index2 < 0) {
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
var lastIndex = data.length - 1;
|
|
416
|
+
if (index2 == lastIndex) {
|
|
417
|
+
data.pop();
|
|
418
|
+
} else {
|
|
419
|
+
splice.call(data, index2, 1);
|
|
420
|
+
}
|
|
421
|
+
--this.size;
|
|
422
|
+
return true;
|
|
423
|
+
}
|
|
424
|
+
var _listCacheDelete = listCacheDelete$1;
|
|
425
|
+
var assocIndexOf$2 = _assocIndexOf;
|
|
426
|
+
function listCacheGet$1(key) {
|
|
427
|
+
var data = this.__data__, index2 = assocIndexOf$2(data, key);
|
|
428
|
+
return index2 < 0 ? void 0 : data[index2][1];
|
|
429
|
+
}
|
|
430
|
+
var _listCacheGet = listCacheGet$1;
|
|
431
|
+
var assocIndexOf$1 = _assocIndexOf;
|
|
432
|
+
function listCacheHas$1(key) {
|
|
433
|
+
return assocIndexOf$1(this.__data__, key) > -1;
|
|
434
|
+
}
|
|
435
|
+
var _listCacheHas = listCacheHas$1;
|
|
436
|
+
var assocIndexOf = _assocIndexOf;
|
|
437
|
+
function listCacheSet$1(key, value) {
|
|
438
|
+
var data = this.__data__, index2 = assocIndexOf(data, key);
|
|
439
|
+
if (index2 < 0) {
|
|
440
|
+
++this.size;
|
|
441
|
+
data.push([key, value]);
|
|
442
|
+
} else {
|
|
443
|
+
data[index2][1] = value;
|
|
444
|
+
}
|
|
445
|
+
return this;
|
|
446
|
+
}
|
|
447
|
+
var _listCacheSet = listCacheSet$1;
|
|
448
|
+
var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
|
|
449
|
+
function ListCache$4(entries) {
|
|
450
|
+
var index2 = -1, length = entries == null ? 0 : entries.length;
|
|
451
|
+
this.clear();
|
|
452
|
+
while (++index2 < length) {
|
|
453
|
+
var entry = entries[index2];
|
|
454
|
+
this.set(entry[0], entry[1]);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
ListCache$4.prototype.clear = listCacheClear;
|
|
458
|
+
ListCache$4.prototype["delete"] = listCacheDelete;
|
|
459
|
+
ListCache$4.prototype.get = listCacheGet;
|
|
460
|
+
ListCache$4.prototype.has = listCacheHas;
|
|
461
|
+
ListCache$4.prototype.set = listCacheSet;
|
|
462
|
+
var _ListCache = ListCache$4;
|
|
463
|
+
var getNative$5 = _getNative, root$5 = _root;
|
|
464
|
+
var Map$4 = getNative$5(root$5, "Map");
|
|
465
|
+
var _Map = Map$4;
|
|
466
|
+
var Hash = _Hash, ListCache$3 = _ListCache, Map$3 = _Map;
|
|
467
|
+
function mapCacheClear$1() {
|
|
468
|
+
this.size = 0;
|
|
469
|
+
this.__data__ = {
|
|
470
|
+
"hash": new Hash(),
|
|
471
|
+
"map": new (Map$3 || ListCache$3)(),
|
|
472
|
+
"string": new Hash()
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
var _mapCacheClear = mapCacheClear$1;
|
|
476
|
+
function isKeyable$1(value) {
|
|
477
|
+
var type = typeof value;
|
|
478
|
+
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
|
479
|
+
}
|
|
480
|
+
var _isKeyable = isKeyable$1;
|
|
481
|
+
var isKeyable = _isKeyable;
|
|
482
|
+
function getMapData$4(map2, key) {
|
|
483
|
+
var data = map2.__data__;
|
|
484
|
+
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
|
485
|
+
}
|
|
486
|
+
var _getMapData = getMapData$4;
|
|
487
|
+
var getMapData$3 = _getMapData;
|
|
488
|
+
function mapCacheDelete$1(key) {
|
|
489
|
+
var result = getMapData$3(this, key)["delete"](key);
|
|
490
|
+
this.size -= result ? 1 : 0;
|
|
491
|
+
return result;
|
|
492
|
+
}
|
|
493
|
+
var _mapCacheDelete = mapCacheDelete$1;
|
|
494
|
+
var getMapData$2 = _getMapData;
|
|
495
|
+
function mapCacheGet$1(key) {
|
|
496
|
+
return getMapData$2(this, key).get(key);
|
|
497
|
+
}
|
|
498
|
+
var _mapCacheGet = mapCacheGet$1;
|
|
499
|
+
var getMapData$1 = _getMapData;
|
|
500
|
+
function mapCacheHas$1(key) {
|
|
501
|
+
return getMapData$1(this, key).has(key);
|
|
502
|
+
}
|
|
503
|
+
var _mapCacheHas = mapCacheHas$1;
|
|
504
|
+
var getMapData = _getMapData;
|
|
505
|
+
function mapCacheSet$1(key, value) {
|
|
506
|
+
var data = getMapData(this, key), size = data.size;
|
|
507
|
+
data.set(key, value);
|
|
508
|
+
this.size += data.size == size ? 0 : 1;
|
|
509
|
+
return this;
|
|
510
|
+
}
|
|
511
|
+
var _mapCacheSet = mapCacheSet$1;
|
|
512
|
+
var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
|
|
513
|
+
function MapCache$3(entries) {
|
|
514
|
+
var index2 = -1, length = entries == null ? 0 : entries.length;
|
|
515
|
+
this.clear();
|
|
516
|
+
while (++index2 < length) {
|
|
517
|
+
var entry = entries[index2];
|
|
518
|
+
this.set(entry[0], entry[1]);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
MapCache$3.prototype.clear = mapCacheClear;
|
|
522
|
+
MapCache$3.prototype["delete"] = mapCacheDelete;
|
|
523
|
+
MapCache$3.prototype.get = mapCacheGet;
|
|
524
|
+
MapCache$3.prototype.has = mapCacheHas;
|
|
525
|
+
MapCache$3.prototype.set = mapCacheSet;
|
|
526
|
+
var _MapCache = MapCache$3;
|
|
527
|
+
var MapCache$2 = _MapCache;
|
|
528
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
529
|
+
function memoize$1(func, resolver) {
|
|
530
|
+
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
|
|
531
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
532
|
+
}
|
|
533
|
+
var memoized = function() {
|
|
534
|
+
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
|
535
|
+
if (cache.has(key)) {
|
|
536
|
+
return cache.get(key);
|
|
537
|
+
}
|
|
538
|
+
var result = func.apply(this, args);
|
|
539
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
540
|
+
return result;
|
|
541
|
+
};
|
|
542
|
+
memoized.cache = new (memoize$1.Cache || MapCache$2)();
|
|
543
|
+
return memoized;
|
|
544
|
+
}
|
|
545
|
+
memoize$1.Cache = MapCache$2;
|
|
546
|
+
var memoize_1 = memoize$1;
|
|
547
|
+
var memoize = memoize_1;
|
|
548
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
549
|
+
function memoizeCapped$1(func) {
|
|
550
|
+
var result = memoize(func, function(key) {
|
|
551
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
552
|
+
cache.clear();
|
|
553
|
+
}
|
|
554
|
+
return key;
|
|
555
|
+
});
|
|
556
|
+
var cache = result.cache;
|
|
557
|
+
return result;
|
|
558
|
+
}
|
|
559
|
+
var _memoizeCapped = memoizeCapped$1;
|
|
560
|
+
var memoizeCapped = _memoizeCapped;
|
|
561
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
562
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
563
|
+
var stringToPath$1 = memoizeCapped(function(string2) {
|
|
564
|
+
var result = [];
|
|
565
|
+
if (string2.charCodeAt(0) === 46) {
|
|
566
|
+
result.push("");
|
|
567
|
+
}
|
|
568
|
+
string2.replace(rePropName, function(match, number2, quote, subString) {
|
|
569
|
+
result.push(quote ? subString.replace(reEscapeChar, "$1") : number2 || match);
|
|
570
|
+
});
|
|
571
|
+
return result;
|
|
572
|
+
});
|
|
573
|
+
var _stringToPath = stringToPath$1;
|
|
574
|
+
function arrayMap$1(array2, iteratee) {
|
|
575
|
+
var index2 = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
|
|
576
|
+
while (++index2 < length) {
|
|
577
|
+
result[index2] = iteratee(array2[index2], index2, array2);
|
|
578
|
+
}
|
|
579
|
+
return result;
|
|
580
|
+
}
|
|
581
|
+
var _arrayMap = arrayMap$1;
|
|
582
|
+
var Symbol$2 = _Symbol, arrayMap = _arrayMap, isArray$6 = isArray_1, isSymbol$1 = isSymbol_1;
|
|
583
|
+
var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$1 ? symbolProto$1.toString : void 0;
|
|
584
|
+
function baseToString$1(value) {
|
|
585
|
+
if (typeof value == "string") {
|
|
586
|
+
return value;
|
|
587
|
+
}
|
|
588
|
+
if (isArray$6(value)) {
|
|
589
|
+
return arrayMap(value, baseToString$1) + "";
|
|
590
|
+
}
|
|
591
|
+
if (isSymbol$1(value)) {
|
|
592
|
+
return symbolToString ? symbolToString.call(value) : "";
|
|
593
|
+
}
|
|
594
|
+
var result = value + "";
|
|
595
|
+
return result == "0" && 1 / value == -Infinity ? "-0" : result;
|
|
596
|
+
}
|
|
597
|
+
var _baseToString = baseToString$1;
|
|
598
|
+
var baseToString = _baseToString;
|
|
599
|
+
function toString$1(value) {
|
|
600
|
+
return value == null ? "" : baseToString(value);
|
|
601
|
+
}
|
|
602
|
+
var toString_1 = toString$1;
|
|
603
|
+
var isArray$5 = isArray_1, isKey$2 = _isKey, stringToPath = _stringToPath, toString = toString_1;
|
|
604
|
+
function castPath$2(value, object2) {
|
|
605
|
+
if (isArray$5(value)) {
|
|
606
|
+
return value;
|
|
607
|
+
}
|
|
608
|
+
return isKey$2(value, object2) ? [value] : stringToPath(toString(value));
|
|
609
|
+
}
|
|
610
|
+
var _castPath = castPath$2;
|
|
611
|
+
var baseGetTag$2 = _baseGetTag, isObjectLike$3 = isObjectLike_1;
|
|
612
|
+
var argsTag$2 = "[object Arguments]";
|
|
613
|
+
function baseIsArguments$1(value) {
|
|
614
|
+
return isObjectLike$3(value) && baseGetTag$2(value) == argsTag$2;
|
|
615
|
+
}
|
|
616
|
+
var _baseIsArguments = baseIsArguments$1;
|
|
617
|
+
var baseIsArguments = _baseIsArguments, isObjectLike$2 = isObjectLike_1;
|
|
618
|
+
var objectProto$6 = Object.prototype;
|
|
619
|
+
var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
|
|
620
|
+
var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
|
|
621
|
+
var isArguments$2 = baseIsArguments(/* @__PURE__ */ function() {
|
|
622
|
+
return arguments;
|
|
623
|
+
}()) ? baseIsArguments : function(value) {
|
|
624
|
+
return isObjectLike$2(value) && hasOwnProperty$4.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
625
|
+
};
|
|
626
|
+
var isArguments_1 = isArguments$2;
|
|
627
|
+
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
628
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
629
|
+
function isIndex$2(value, length) {
|
|
630
|
+
var type = typeof value;
|
|
631
|
+
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
632
|
+
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
633
|
+
}
|
|
634
|
+
var _isIndex = isIndex$2;
|
|
635
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
636
|
+
function isLength$3(value) {
|
|
637
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
638
|
+
}
|
|
639
|
+
var isLength_1 = isLength$3;
|
|
640
|
+
var isSymbol = isSymbol_1;
|
|
641
|
+
function toKey$4(value) {
|
|
642
|
+
if (typeof value == "string" || isSymbol(value)) {
|
|
643
|
+
return value;
|
|
644
|
+
}
|
|
645
|
+
var result = value + "";
|
|
646
|
+
return result == "0" && 1 / value == -Infinity ? "-0" : result;
|
|
647
|
+
}
|
|
648
|
+
var _toKey = toKey$4;
|
|
649
|
+
var castPath$1 = _castPath, isArguments$1 = isArguments_1, isArray$4 = isArray_1, isIndex$1 = _isIndex, isLength$2 = isLength_1, toKey$3 = _toKey;
|
|
650
|
+
function hasPath$2(object2, path, hasFunc) {
|
|
651
|
+
path = castPath$1(path, object2);
|
|
652
|
+
var index2 = -1, length = path.length, result = false;
|
|
653
|
+
while (++index2 < length) {
|
|
654
|
+
var key = toKey$3(path[index2]);
|
|
655
|
+
if (!(result = object2 != null && hasFunc(object2, key))) {
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
object2 = object2[key];
|
|
659
|
+
}
|
|
660
|
+
if (result || ++index2 != length) {
|
|
661
|
+
return result;
|
|
662
|
+
}
|
|
663
|
+
length = object2 == null ? 0 : object2.length;
|
|
664
|
+
return !!length && isLength$2(length) && isIndex$1(key, length) && (isArray$4(object2) || isArguments$1(object2));
|
|
665
|
+
}
|
|
666
|
+
var _hasPath = hasPath$2;
|
|
667
|
+
var baseHas = _baseHas, hasPath$1 = _hasPath;
|
|
668
|
+
function has(object2, path) {
|
|
669
|
+
return object2 != null && hasPath$1(object2, path, baseHas);
|
|
670
|
+
}
|
|
671
|
+
var has_1 = has;
|
|
672
|
+
const has$1 = /* @__PURE__ */ getDefaultExportFromCjs(has_1);
|
|
673
|
+
const isSchema = (obj) => obj && obj.__isYupSchema__;
|
|
674
|
+
class Condition {
|
|
675
|
+
constructor(refs, options) {
|
|
676
|
+
this.refs = refs;
|
|
677
|
+
this.refs = refs;
|
|
678
|
+
if (typeof options === "function") {
|
|
679
|
+
this.fn = options;
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
if (!has$1(options, "is")) throw new TypeError("`is:` is required for `when()` conditions");
|
|
683
|
+
if (!options.then && !options.otherwise) throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");
|
|
684
|
+
let {
|
|
685
|
+
is,
|
|
686
|
+
then,
|
|
687
|
+
otherwise
|
|
688
|
+
} = options;
|
|
689
|
+
let check = typeof is === "function" ? is : (...values) => values.every((value) => value === is);
|
|
690
|
+
this.fn = function(...args) {
|
|
691
|
+
let options2 = args.pop();
|
|
692
|
+
let schema = args.pop();
|
|
693
|
+
let branch = check(...args) ? then : otherwise;
|
|
694
|
+
if (!branch) return void 0;
|
|
695
|
+
if (typeof branch === "function") return branch(schema);
|
|
696
|
+
return schema.concat(branch.resolve(options2));
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
resolve(base, options) {
|
|
700
|
+
let values = this.refs.map((ref) => ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context));
|
|
701
|
+
let schema = this.fn.apply(base, values.concat(base, options));
|
|
702
|
+
if (schema === void 0 || schema === base) return base;
|
|
703
|
+
if (!isSchema(schema)) throw new TypeError("conditions must return a schema object");
|
|
704
|
+
return schema.resolve(options);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
function toArray(value) {
|
|
708
|
+
return value == null ? [] : [].concat(value);
|
|
709
|
+
}
|
|
710
|
+
function _extends$2() {
|
|
711
|
+
_extends$2 = Object.assign || function(target) {
|
|
712
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
713
|
+
var source = arguments[i];
|
|
714
|
+
for (var key in source) {
|
|
715
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
716
|
+
target[key] = source[key];
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
return target;
|
|
721
|
+
};
|
|
722
|
+
return _extends$2.apply(this, arguments);
|
|
723
|
+
}
|
|
724
|
+
let strReg = /\$\{\s*(\w+)\s*\}/g;
|
|
725
|
+
class ValidationError extends Error {
|
|
726
|
+
static formatError(message, params) {
|
|
727
|
+
const path = params.label || params.path || "this";
|
|
728
|
+
if (path !== params.path) params = _extends$2({}, params, {
|
|
729
|
+
path
|
|
730
|
+
});
|
|
731
|
+
if (typeof message === "string") return message.replace(strReg, (_, key) => printValue(params[key]));
|
|
732
|
+
if (typeof message === "function") return message(params);
|
|
733
|
+
return message;
|
|
734
|
+
}
|
|
735
|
+
static isError(err) {
|
|
736
|
+
return err && err.name === "ValidationError";
|
|
737
|
+
}
|
|
738
|
+
constructor(errorOrErrors, value, field, type) {
|
|
739
|
+
super();
|
|
740
|
+
this.name = "ValidationError";
|
|
741
|
+
this.value = value;
|
|
742
|
+
this.path = field;
|
|
743
|
+
this.type = type;
|
|
744
|
+
this.errors = [];
|
|
745
|
+
this.inner = [];
|
|
746
|
+
toArray(errorOrErrors).forEach((err) => {
|
|
747
|
+
if (ValidationError.isError(err)) {
|
|
748
|
+
this.errors.push(...err.errors);
|
|
749
|
+
this.inner = this.inner.concat(err.inner.length ? err.inner : err);
|
|
750
|
+
} else {
|
|
751
|
+
this.errors.push(err);
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0];
|
|
755
|
+
if (Error.captureStackTrace) Error.captureStackTrace(this, ValidationError);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
const once = (cb) => {
|
|
759
|
+
let fired = false;
|
|
760
|
+
return (...args) => {
|
|
761
|
+
if (fired) return;
|
|
762
|
+
fired = true;
|
|
763
|
+
cb(...args);
|
|
764
|
+
};
|
|
765
|
+
};
|
|
766
|
+
function runTests(options, cb) {
|
|
767
|
+
let {
|
|
768
|
+
endEarly,
|
|
769
|
+
tests,
|
|
770
|
+
args,
|
|
771
|
+
value,
|
|
772
|
+
errors,
|
|
773
|
+
sort,
|
|
774
|
+
path
|
|
775
|
+
} = options;
|
|
776
|
+
let callback = once(cb);
|
|
777
|
+
let count = tests.length;
|
|
778
|
+
const nestedErrors = [];
|
|
779
|
+
errors = errors ? errors : [];
|
|
780
|
+
if (!count) return errors.length ? callback(new ValidationError(errors, value, path)) : callback(null, value);
|
|
781
|
+
for (let i = 0; i < tests.length; i++) {
|
|
782
|
+
const test = tests[i];
|
|
783
|
+
test(args, function finishTestRun(err) {
|
|
784
|
+
if (err) {
|
|
785
|
+
if (!ValidationError.isError(err)) {
|
|
786
|
+
return callback(err, value);
|
|
787
|
+
}
|
|
788
|
+
if (endEarly) {
|
|
789
|
+
err.value = value;
|
|
790
|
+
return callback(err, value);
|
|
791
|
+
}
|
|
792
|
+
nestedErrors.push(err);
|
|
793
|
+
}
|
|
794
|
+
if (--count <= 0) {
|
|
795
|
+
if (nestedErrors.length) {
|
|
796
|
+
if (sort) nestedErrors.sort(sort);
|
|
797
|
+
if (errors.length) nestedErrors.push(...errors);
|
|
798
|
+
errors = nestedErrors;
|
|
799
|
+
}
|
|
800
|
+
if (errors.length) {
|
|
801
|
+
callback(new ValidationError(errors, value, path), value);
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
callback(null, value);
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
var getNative$4 = _getNative;
|
|
810
|
+
var defineProperty$1 = function() {
|
|
811
|
+
try {
|
|
812
|
+
var func = getNative$4(Object, "defineProperty");
|
|
813
|
+
func({}, "", {});
|
|
814
|
+
return func;
|
|
815
|
+
} catch (e) {
|
|
816
|
+
}
|
|
817
|
+
}();
|
|
818
|
+
var _defineProperty = defineProperty$1;
|
|
819
|
+
var defineProperty = _defineProperty;
|
|
820
|
+
function baseAssignValue$1(object2, key, value) {
|
|
821
|
+
if (key == "__proto__" && defineProperty) {
|
|
822
|
+
defineProperty(object2, key, {
|
|
823
|
+
"configurable": true,
|
|
824
|
+
"enumerable": true,
|
|
825
|
+
"value": value,
|
|
826
|
+
"writable": true
|
|
827
|
+
});
|
|
828
|
+
} else {
|
|
829
|
+
object2[key] = value;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
var _baseAssignValue = baseAssignValue$1;
|
|
833
|
+
function createBaseFor$1(fromRight) {
|
|
834
|
+
return function(object2, iteratee, keysFunc) {
|
|
835
|
+
var index2 = -1, iterable = Object(object2), props = keysFunc(object2), length = props.length;
|
|
836
|
+
while (length--) {
|
|
837
|
+
var key = props[fromRight ? length : ++index2];
|
|
838
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
|
839
|
+
break;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
return object2;
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
var _createBaseFor = createBaseFor$1;
|
|
846
|
+
var createBaseFor = _createBaseFor;
|
|
847
|
+
var baseFor$1 = createBaseFor();
|
|
848
|
+
var _baseFor = baseFor$1;
|
|
849
|
+
function baseTimes$1(n, iteratee) {
|
|
850
|
+
var index2 = -1, result = Array(n);
|
|
851
|
+
while (++index2 < n) {
|
|
852
|
+
result[index2] = iteratee(index2);
|
|
853
|
+
}
|
|
854
|
+
return result;
|
|
855
|
+
}
|
|
856
|
+
var _baseTimes = baseTimes$1;
|
|
857
|
+
var isBuffer$2 = { exports: {} };
|
|
858
|
+
function stubFalse() {
|
|
859
|
+
return false;
|
|
860
|
+
}
|
|
861
|
+
var stubFalse_1 = stubFalse;
|
|
862
|
+
isBuffer$2.exports;
|
|
863
|
+
(function(module2, exports2) {
|
|
864
|
+
var root2 = _root, stubFalse2 = stubFalse_1;
|
|
865
|
+
var freeExports = exports2 && !exports2.nodeType && exports2;
|
|
866
|
+
var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
|
|
867
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
868
|
+
var Buffer = moduleExports ? root2.Buffer : void 0;
|
|
869
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
|
|
870
|
+
var isBuffer2 = nativeIsBuffer || stubFalse2;
|
|
871
|
+
module2.exports = isBuffer2;
|
|
872
|
+
})(isBuffer$2, isBuffer$2.exports);
|
|
873
|
+
var isBufferExports = isBuffer$2.exports;
|
|
874
|
+
var baseGetTag$1 = _baseGetTag, isLength$1 = isLength_1, isObjectLike$1 = isObjectLike_1;
|
|
875
|
+
var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", objectTag$2 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", weakMapTag$1 = "[object WeakMap]";
|
|
876
|
+
var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
|
|
877
|
+
var typedArrayTags = {};
|
|
878
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
|
879
|
+
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
|
|
880
|
+
function baseIsTypedArray$1(value) {
|
|
881
|
+
return isObjectLike$1(value) && isLength$1(value.length) && !!typedArrayTags[baseGetTag$1(value)];
|
|
882
|
+
}
|
|
883
|
+
var _baseIsTypedArray = baseIsTypedArray$1;
|
|
884
|
+
function baseUnary$1(func) {
|
|
885
|
+
return function(value) {
|
|
886
|
+
return func(value);
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
var _baseUnary = baseUnary$1;
|
|
890
|
+
var _nodeUtil = { exports: {} };
|
|
891
|
+
_nodeUtil.exports;
|
|
892
|
+
(function(module2, exports2) {
|
|
893
|
+
var freeGlobal2 = _freeGlobal;
|
|
894
|
+
var freeExports = exports2 && !exports2.nodeType && exports2;
|
|
895
|
+
var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
|
|
896
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
897
|
+
var freeProcess = moduleExports && freeGlobal2.process;
|
|
898
|
+
var nodeUtil2 = function() {
|
|
899
|
+
try {
|
|
900
|
+
var types = freeModule && freeModule.require && freeModule.require("util").types;
|
|
901
|
+
if (types) {
|
|
902
|
+
return types;
|
|
903
|
+
}
|
|
904
|
+
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
905
|
+
} catch (e) {
|
|
906
|
+
}
|
|
907
|
+
}();
|
|
908
|
+
module2.exports = nodeUtil2;
|
|
909
|
+
})(_nodeUtil, _nodeUtil.exports);
|
|
910
|
+
var _nodeUtilExports = _nodeUtil.exports;
|
|
911
|
+
var baseIsTypedArray = _baseIsTypedArray, baseUnary = _baseUnary, nodeUtil = _nodeUtilExports;
|
|
912
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
913
|
+
var isTypedArray$2 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
914
|
+
var isTypedArray_1 = isTypedArray$2;
|
|
915
|
+
var baseTimes = _baseTimes, isArguments = isArguments_1, isArray$3 = isArray_1, isBuffer$1 = isBufferExports, isIndex = _isIndex, isTypedArray$1 = isTypedArray_1;
|
|
916
|
+
var objectProto$5 = Object.prototype;
|
|
917
|
+
var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
|
|
918
|
+
function arrayLikeKeys$1(value, inherited) {
|
|
919
|
+
var isArr = isArray$3(value), isArg = !isArr && isArguments(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;
|
|
920
|
+
for (var key in value) {
|
|
921
|
+
if ((inherited || hasOwnProperty$3.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
922
|
+
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
923
|
+
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
924
|
+
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
925
|
+
isIndex(key, length)))) {
|
|
926
|
+
result.push(key);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
return result;
|
|
930
|
+
}
|
|
931
|
+
var _arrayLikeKeys = arrayLikeKeys$1;
|
|
932
|
+
var objectProto$4 = Object.prototype;
|
|
933
|
+
function isPrototype$1(value) {
|
|
934
|
+
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$4;
|
|
935
|
+
return value === proto;
|
|
936
|
+
}
|
|
937
|
+
var _isPrototype = isPrototype$1;
|
|
938
|
+
function overArg$1(func, transform) {
|
|
939
|
+
return function(arg) {
|
|
940
|
+
return func(transform(arg));
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
var _overArg = overArg$1;
|
|
944
|
+
var overArg = _overArg;
|
|
945
|
+
var nativeKeys$1 = overArg(Object.keys, Object);
|
|
946
|
+
var _nativeKeys = nativeKeys$1;
|
|
947
|
+
var isPrototype = _isPrototype, nativeKeys = _nativeKeys;
|
|
948
|
+
var objectProto$3 = Object.prototype;
|
|
949
|
+
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
|
950
|
+
function baseKeys$1(object2) {
|
|
951
|
+
if (!isPrototype(object2)) {
|
|
952
|
+
return nativeKeys(object2);
|
|
953
|
+
}
|
|
954
|
+
var result = [];
|
|
955
|
+
for (var key in Object(object2)) {
|
|
956
|
+
if (hasOwnProperty$2.call(object2, key) && key != "constructor") {
|
|
957
|
+
result.push(key);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
return result;
|
|
961
|
+
}
|
|
962
|
+
var _baseKeys = baseKeys$1;
|
|
963
|
+
var isFunction = isFunction_1, isLength = isLength_1;
|
|
964
|
+
function isArrayLike$1(value) {
|
|
965
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
966
|
+
}
|
|
967
|
+
var isArrayLike_1 = isArrayLike$1;
|
|
968
|
+
var arrayLikeKeys = _arrayLikeKeys, baseKeys = _baseKeys, isArrayLike = isArrayLike_1;
|
|
969
|
+
function keys$3(object2) {
|
|
970
|
+
return isArrayLike(object2) ? arrayLikeKeys(object2) : baseKeys(object2);
|
|
971
|
+
}
|
|
972
|
+
var keys_1 = keys$3;
|
|
973
|
+
var baseFor = _baseFor, keys$2 = keys_1;
|
|
974
|
+
function baseForOwn$1(object2, iteratee) {
|
|
975
|
+
return object2 && baseFor(object2, iteratee, keys$2);
|
|
976
|
+
}
|
|
977
|
+
var _baseForOwn = baseForOwn$1;
|
|
978
|
+
var ListCache$2 = _ListCache;
|
|
979
|
+
function stackClear$1() {
|
|
980
|
+
this.__data__ = new ListCache$2();
|
|
981
|
+
this.size = 0;
|
|
982
|
+
}
|
|
983
|
+
var _stackClear = stackClear$1;
|
|
984
|
+
function stackDelete$1(key) {
|
|
985
|
+
var data = this.__data__, result = data["delete"](key);
|
|
986
|
+
this.size = data.size;
|
|
987
|
+
return result;
|
|
988
|
+
}
|
|
989
|
+
var _stackDelete = stackDelete$1;
|
|
990
|
+
function stackGet$1(key) {
|
|
991
|
+
return this.__data__.get(key);
|
|
992
|
+
}
|
|
993
|
+
var _stackGet = stackGet$1;
|
|
994
|
+
function stackHas$1(key) {
|
|
995
|
+
return this.__data__.has(key);
|
|
996
|
+
}
|
|
997
|
+
var _stackHas = stackHas$1;
|
|
998
|
+
var ListCache$1 = _ListCache, Map$2 = _Map, MapCache$1 = _MapCache;
|
|
999
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
1000
|
+
function stackSet$1(key, value) {
|
|
1001
|
+
var data = this.__data__;
|
|
1002
|
+
if (data instanceof ListCache$1) {
|
|
1003
|
+
var pairs = data.__data__;
|
|
1004
|
+
if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
1005
|
+
pairs.push([key, value]);
|
|
1006
|
+
this.size = ++data.size;
|
|
1007
|
+
return this;
|
|
1008
|
+
}
|
|
1009
|
+
data = this.__data__ = new MapCache$1(pairs);
|
|
1010
|
+
}
|
|
1011
|
+
data.set(key, value);
|
|
1012
|
+
this.size = data.size;
|
|
1013
|
+
return this;
|
|
1014
|
+
}
|
|
1015
|
+
var _stackSet = stackSet$1;
|
|
1016
|
+
var ListCache = _ListCache, stackClear = _stackClear, stackDelete = _stackDelete, stackGet = _stackGet, stackHas = _stackHas, stackSet = _stackSet;
|
|
1017
|
+
function Stack$2(entries) {
|
|
1018
|
+
var data = this.__data__ = new ListCache(entries);
|
|
1019
|
+
this.size = data.size;
|
|
1020
|
+
}
|
|
1021
|
+
Stack$2.prototype.clear = stackClear;
|
|
1022
|
+
Stack$2.prototype["delete"] = stackDelete;
|
|
1023
|
+
Stack$2.prototype.get = stackGet;
|
|
1024
|
+
Stack$2.prototype.has = stackHas;
|
|
1025
|
+
Stack$2.prototype.set = stackSet;
|
|
1026
|
+
var _Stack = Stack$2;
|
|
1027
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
1028
|
+
function setCacheAdd$1(value) {
|
|
1029
|
+
this.__data__.set(value, HASH_UNDEFINED);
|
|
1030
|
+
return this;
|
|
1031
|
+
}
|
|
1032
|
+
var _setCacheAdd = setCacheAdd$1;
|
|
1033
|
+
function setCacheHas$1(value) {
|
|
1034
|
+
return this.__data__.has(value);
|
|
1035
|
+
}
|
|
1036
|
+
var _setCacheHas = setCacheHas$1;
|
|
1037
|
+
var MapCache = _MapCache, setCacheAdd = _setCacheAdd, setCacheHas = _setCacheHas;
|
|
1038
|
+
function SetCache$1(values) {
|
|
1039
|
+
var index2 = -1, length = values == null ? 0 : values.length;
|
|
1040
|
+
this.__data__ = new MapCache();
|
|
1041
|
+
while (++index2 < length) {
|
|
1042
|
+
this.add(values[index2]);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
SetCache$1.prototype.add = SetCache$1.prototype.push = setCacheAdd;
|
|
1046
|
+
SetCache$1.prototype.has = setCacheHas;
|
|
1047
|
+
var _SetCache = SetCache$1;
|
|
1048
|
+
function arraySome$1(array2, predicate) {
|
|
1049
|
+
var index2 = -1, length = array2 == null ? 0 : array2.length;
|
|
1050
|
+
while (++index2 < length) {
|
|
1051
|
+
if (predicate(array2[index2], index2, array2)) {
|
|
1052
|
+
return true;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
return false;
|
|
1056
|
+
}
|
|
1057
|
+
var _arraySome = arraySome$1;
|
|
1058
|
+
function cacheHas$1(cache, key) {
|
|
1059
|
+
return cache.has(key);
|
|
1060
|
+
}
|
|
1061
|
+
var _cacheHas = cacheHas$1;
|
|
1062
|
+
var SetCache = _SetCache, arraySome = _arraySome, cacheHas = _cacheHas;
|
|
1063
|
+
var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2;
|
|
1064
|
+
function equalArrays$2(array2, other, bitmask, customizer, equalFunc, stack) {
|
|
1065
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array2.length, othLength = other.length;
|
|
1066
|
+
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
1067
|
+
return false;
|
|
1068
|
+
}
|
|
1069
|
+
var arrStacked = stack.get(array2);
|
|
1070
|
+
var othStacked = stack.get(other);
|
|
1071
|
+
if (arrStacked && othStacked) {
|
|
1072
|
+
return arrStacked == other && othStacked == array2;
|
|
1073
|
+
}
|
|
1074
|
+
var index2 = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
|
|
1075
|
+
stack.set(array2, other);
|
|
1076
|
+
stack.set(other, array2);
|
|
1077
|
+
while (++index2 < arrLength) {
|
|
1078
|
+
var arrValue = array2[index2], othValue = other[index2];
|
|
1079
|
+
if (customizer) {
|
|
1080
|
+
var compared = isPartial ? customizer(othValue, arrValue, index2, other, array2, stack) : customizer(arrValue, othValue, index2, array2, other, stack);
|
|
1081
|
+
}
|
|
1082
|
+
if (compared !== void 0) {
|
|
1083
|
+
if (compared) {
|
|
1084
|
+
continue;
|
|
1085
|
+
}
|
|
1086
|
+
result = false;
|
|
1087
|
+
break;
|
|
1088
|
+
}
|
|
1089
|
+
if (seen) {
|
|
1090
|
+
if (!arraySome(other, function(othValue2, othIndex) {
|
|
1091
|
+
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
|
|
1092
|
+
return seen.push(othIndex);
|
|
1093
|
+
}
|
|
1094
|
+
})) {
|
|
1095
|
+
result = false;
|
|
1096
|
+
break;
|
|
1097
|
+
}
|
|
1098
|
+
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
1099
|
+
result = false;
|
|
1100
|
+
break;
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
stack["delete"](array2);
|
|
1104
|
+
stack["delete"](other);
|
|
1105
|
+
return result;
|
|
1106
|
+
}
|
|
1107
|
+
var _equalArrays = equalArrays$2;
|
|
1108
|
+
var root$4 = _root;
|
|
1109
|
+
var Uint8Array$1 = root$4.Uint8Array;
|
|
1110
|
+
var _Uint8Array = Uint8Array$1;
|
|
1111
|
+
function mapToArray$1(map2) {
|
|
1112
|
+
var index2 = -1, result = Array(map2.size);
|
|
1113
|
+
map2.forEach(function(value, key) {
|
|
1114
|
+
result[++index2] = [key, value];
|
|
1115
|
+
});
|
|
1116
|
+
return result;
|
|
1117
|
+
}
|
|
1118
|
+
var _mapToArray = mapToArray$1;
|
|
1119
|
+
function setToArray$1(set2) {
|
|
1120
|
+
var index2 = -1, result = Array(set2.size);
|
|
1121
|
+
set2.forEach(function(value) {
|
|
1122
|
+
result[++index2] = value;
|
|
1123
|
+
});
|
|
1124
|
+
return result;
|
|
1125
|
+
}
|
|
1126
|
+
var _setToArray = setToArray$1;
|
|
1127
|
+
var Symbol$1 = _Symbol, Uint8Array = _Uint8Array, eq = eq_1, equalArrays$1 = _equalArrays, mapToArray = _mapToArray, setToArray = _setToArray;
|
|
1128
|
+
var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2;
|
|
1129
|
+
var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag$1 = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag$1 = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
|
|
1130
|
+
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]";
|
|
1131
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
1132
|
+
function equalByTag$1(object2, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
1133
|
+
switch (tag) {
|
|
1134
|
+
case dataViewTag$1:
|
|
1135
|
+
if (object2.byteLength != other.byteLength || object2.byteOffset != other.byteOffset) {
|
|
1136
|
+
return false;
|
|
1137
|
+
}
|
|
1138
|
+
object2 = object2.buffer;
|
|
1139
|
+
other = other.buffer;
|
|
1140
|
+
case arrayBufferTag:
|
|
1141
|
+
if (object2.byteLength != other.byteLength || !equalFunc(new Uint8Array(object2), new Uint8Array(other))) {
|
|
1142
|
+
return false;
|
|
1143
|
+
}
|
|
1144
|
+
return true;
|
|
1145
|
+
case boolTag:
|
|
1146
|
+
case dateTag:
|
|
1147
|
+
case numberTag:
|
|
1148
|
+
return eq(+object2, +other);
|
|
1149
|
+
case errorTag:
|
|
1150
|
+
return object2.name == other.name && object2.message == other.message;
|
|
1151
|
+
case regexpTag:
|
|
1152
|
+
case stringTag:
|
|
1153
|
+
return object2 == other + "";
|
|
1154
|
+
case mapTag$1:
|
|
1155
|
+
var convert = mapToArray;
|
|
1156
|
+
case setTag$1:
|
|
1157
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
|
|
1158
|
+
convert || (convert = setToArray);
|
|
1159
|
+
if (object2.size != other.size && !isPartial) {
|
|
1160
|
+
return false;
|
|
1161
|
+
}
|
|
1162
|
+
var stacked = stack.get(object2);
|
|
1163
|
+
if (stacked) {
|
|
1164
|
+
return stacked == other;
|
|
1165
|
+
}
|
|
1166
|
+
bitmask |= COMPARE_UNORDERED_FLAG$2;
|
|
1167
|
+
stack.set(object2, other);
|
|
1168
|
+
var result = equalArrays$1(convert(object2), convert(other), bitmask, customizer, equalFunc, stack);
|
|
1169
|
+
stack["delete"](object2);
|
|
1170
|
+
return result;
|
|
1171
|
+
case symbolTag:
|
|
1172
|
+
if (symbolValueOf) {
|
|
1173
|
+
return symbolValueOf.call(object2) == symbolValueOf.call(other);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
return false;
|
|
1177
|
+
}
|
|
1178
|
+
var _equalByTag = equalByTag$1;
|
|
1179
|
+
function arrayPush$1(array2, values) {
|
|
1180
|
+
var index2 = -1, length = values.length, offset = array2.length;
|
|
1181
|
+
while (++index2 < length) {
|
|
1182
|
+
array2[offset + index2] = values[index2];
|
|
1183
|
+
}
|
|
1184
|
+
return array2;
|
|
1185
|
+
}
|
|
1186
|
+
var _arrayPush = arrayPush$1;
|
|
1187
|
+
var arrayPush = _arrayPush, isArray$2 = isArray_1;
|
|
1188
|
+
function baseGetAllKeys$1(object2, keysFunc, symbolsFunc) {
|
|
1189
|
+
var result = keysFunc(object2);
|
|
1190
|
+
return isArray$2(object2) ? result : arrayPush(result, symbolsFunc(object2));
|
|
1191
|
+
}
|
|
1192
|
+
var _baseGetAllKeys = baseGetAllKeys$1;
|
|
1193
|
+
function arrayFilter$1(array2, predicate) {
|
|
1194
|
+
var index2 = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
|
|
1195
|
+
while (++index2 < length) {
|
|
1196
|
+
var value = array2[index2];
|
|
1197
|
+
if (predicate(value, index2, array2)) {
|
|
1198
|
+
result[resIndex++] = value;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
return result;
|
|
1202
|
+
}
|
|
1203
|
+
var _arrayFilter = arrayFilter$1;
|
|
1204
|
+
function stubArray$1() {
|
|
1205
|
+
return [];
|
|
1206
|
+
}
|
|
1207
|
+
var stubArray_1 = stubArray$1;
|
|
1208
|
+
var arrayFilter = _arrayFilter, stubArray = stubArray_1;
|
|
1209
|
+
var objectProto$2 = Object.prototype;
|
|
1210
|
+
var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
|
|
1211
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
1212
|
+
var getSymbols$1 = !nativeGetSymbols ? stubArray : function(object2) {
|
|
1213
|
+
if (object2 == null) {
|
|
1214
|
+
return [];
|
|
1215
|
+
}
|
|
1216
|
+
object2 = Object(object2);
|
|
1217
|
+
return arrayFilter(nativeGetSymbols(object2), function(symbol) {
|
|
1218
|
+
return propertyIsEnumerable.call(object2, symbol);
|
|
1219
|
+
});
|
|
1220
|
+
};
|
|
1221
|
+
var _getSymbols = getSymbols$1;
|
|
1222
|
+
var baseGetAllKeys = _baseGetAllKeys, getSymbols = _getSymbols, keys$1 = keys_1;
|
|
1223
|
+
function getAllKeys$1(object2) {
|
|
1224
|
+
return baseGetAllKeys(object2, keys$1, getSymbols);
|
|
1225
|
+
}
|
|
1226
|
+
var _getAllKeys = getAllKeys$1;
|
|
1227
|
+
var getAllKeys = _getAllKeys;
|
|
1228
|
+
var COMPARE_PARTIAL_FLAG$3 = 1;
|
|
1229
|
+
var objectProto$1 = Object.prototype;
|
|
1230
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
1231
|
+
function equalObjects$1(object2, other, bitmask, customizer, equalFunc, stack) {
|
|
1232
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object2), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
|
|
1233
|
+
if (objLength != othLength && !isPartial) {
|
|
1234
|
+
return false;
|
|
1235
|
+
}
|
|
1236
|
+
var index2 = objLength;
|
|
1237
|
+
while (index2--) {
|
|
1238
|
+
var key = objProps[index2];
|
|
1239
|
+
if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
|
|
1240
|
+
return false;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
var objStacked = stack.get(object2);
|
|
1244
|
+
var othStacked = stack.get(other);
|
|
1245
|
+
if (objStacked && othStacked) {
|
|
1246
|
+
return objStacked == other && othStacked == object2;
|
|
1247
|
+
}
|
|
1248
|
+
var result = true;
|
|
1249
|
+
stack.set(object2, other);
|
|
1250
|
+
stack.set(other, object2);
|
|
1251
|
+
var skipCtor = isPartial;
|
|
1252
|
+
while (++index2 < objLength) {
|
|
1253
|
+
key = objProps[index2];
|
|
1254
|
+
var objValue = object2[key], othValue = other[key];
|
|
1255
|
+
if (customizer) {
|
|
1256
|
+
var compared = isPartial ? customizer(othValue, objValue, key, other, object2, stack) : customizer(objValue, othValue, key, object2, other, stack);
|
|
1257
|
+
}
|
|
1258
|
+
if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
|
|
1259
|
+
result = false;
|
|
1260
|
+
break;
|
|
1261
|
+
}
|
|
1262
|
+
skipCtor || (skipCtor = key == "constructor");
|
|
1263
|
+
}
|
|
1264
|
+
if (result && !skipCtor) {
|
|
1265
|
+
var objCtor = object2.constructor, othCtor = other.constructor;
|
|
1266
|
+
if (objCtor != othCtor && ("constructor" in object2 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
|
|
1267
|
+
result = false;
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
stack["delete"](object2);
|
|
1271
|
+
stack["delete"](other);
|
|
1272
|
+
return result;
|
|
1273
|
+
}
|
|
1274
|
+
var _equalObjects = equalObjects$1;
|
|
1275
|
+
var getNative$3 = _getNative, root$3 = _root;
|
|
1276
|
+
var DataView$1 = getNative$3(root$3, "DataView");
|
|
1277
|
+
var _DataView = DataView$1;
|
|
1278
|
+
var getNative$2 = _getNative, root$2 = _root;
|
|
1279
|
+
var Promise$2 = getNative$2(root$2, "Promise");
|
|
1280
|
+
var _Promise = Promise$2;
|
|
1281
|
+
var getNative$1 = _getNative, root$1 = _root;
|
|
1282
|
+
var Set$2 = getNative$1(root$1, "Set");
|
|
1283
|
+
var _Set = Set$2;
|
|
1284
|
+
var getNative = _getNative, root = _root;
|
|
1285
|
+
var WeakMap$1 = getNative(root, "WeakMap");
|
|
1286
|
+
var _WeakMap = WeakMap$1;
|
|
1287
|
+
var DataView = _DataView, Map$1 = _Map, Promise$1 = _Promise, Set$1 = _Set, WeakMap = _WeakMap, baseGetTag = _baseGetTag, toSource = _toSource;
|
|
1288
|
+
var mapTag = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag = "[object Set]", weakMapTag = "[object WeakMap]";
|
|
1289
|
+
var dataViewTag = "[object DataView]";
|
|
1290
|
+
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap);
|
|
1291
|
+
var getTag$1 = baseGetTag;
|
|
1292
|
+
if (DataView && getTag$1(new DataView(new ArrayBuffer(1))) != dataViewTag || Map$1 && getTag$1(new Map$1()) != mapTag || Promise$1 && getTag$1(Promise$1.resolve()) != promiseTag || Set$1 && getTag$1(new Set$1()) != setTag || WeakMap && getTag$1(new WeakMap()) != weakMapTag) {
|
|
1293
|
+
getTag$1 = function(value) {
|
|
1294
|
+
var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
|
1295
|
+
if (ctorString) {
|
|
1296
|
+
switch (ctorString) {
|
|
1297
|
+
case dataViewCtorString:
|
|
1298
|
+
return dataViewTag;
|
|
1299
|
+
case mapCtorString:
|
|
1300
|
+
return mapTag;
|
|
1301
|
+
case promiseCtorString:
|
|
1302
|
+
return promiseTag;
|
|
1303
|
+
case setCtorString:
|
|
1304
|
+
return setTag;
|
|
1305
|
+
case weakMapCtorString:
|
|
1306
|
+
return weakMapTag;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
return result;
|
|
1310
|
+
};
|
|
1311
|
+
}
|
|
1312
|
+
var _getTag = getTag$1;
|
|
1313
|
+
var Stack$1 = _Stack, equalArrays = _equalArrays, equalByTag = _equalByTag, equalObjects = _equalObjects, getTag = _getTag, isArray$1 = isArray_1, isBuffer = isBufferExports, isTypedArray = isTypedArray_1;
|
|
1314
|
+
var COMPARE_PARTIAL_FLAG$2 = 1;
|
|
1315
|
+
var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
|
|
1316
|
+
var objectProto = Object.prototype;
|
|
1317
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1318
|
+
function baseIsEqualDeep$1(object2, other, bitmask, customizer, equalFunc, stack) {
|
|
1319
|
+
var objIsArr = isArray$1(object2), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag(object2), othTag = othIsArr ? arrayTag : getTag(other);
|
|
1320
|
+
objTag = objTag == argsTag ? objectTag : objTag;
|
|
1321
|
+
othTag = othTag == argsTag ? objectTag : othTag;
|
|
1322
|
+
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
|
|
1323
|
+
if (isSameTag && isBuffer(object2)) {
|
|
1324
|
+
if (!isBuffer(other)) {
|
|
1325
|
+
return false;
|
|
1326
|
+
}
|
|
1327
|
+
objIsArr = true;
|
|
1328
|
+
objIsObj = false;
|
|
1329
|
+
}
|
|
1330
|
+
if (isSameTag && !objIsObj) {
|
|
1331
|
+
stack || (stack = new Stack$1());
|
|
1332
|
+
return objIsArr || isTypedArray(object2) ? equalArrays(object2, other, bitmask, customizer, equalFunc, stack) : equalByTag(object2, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
1333
|
+
}
|
|
1334
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
|
|
1335
|
+
var objIsWrapped = objIsObj && hasOwnProperty.call(object2, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
|
|
1336
|
+
if (objIsWrapped || othIsWrapped) {
|
|
1337
|
+
var objUnwrapped = objIsWrapped ? object2.value() : object2, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
1338
|
+
stack || (stack = new Stack$1());
|
|
1339
|
+
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
if (!isSameTag) {
|
|
1343
|
+
return false;
|
|
1344
|
+
}
|
|
1345
|
+
stack || (stack = new Stack$1());
|
|
1346
|
+
return equalObjects(object2, other, bitmask, customizer, equalFunc, stack);
|
|
1347
|
+
}
|
|
1348
|
+
var _baseIsEqualDeep = baseIsEqualDeep$1;
|
|
1349
|
+
var baseIsEqualDeep = _baseIsEqualDeep, isObjectLike = isObjectLike_1;
|
|
1350
|
+
function baseIsEqual$2(value, other, bitmask, customizer, stack) {
|
|
1351
|
+
if (value === other) {
|
|
1352
|
+
return true;
|
|
1353
|
+
}
|
|
1354
|
+
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
|
|
1355
|
+
return value !== value && other !== other;
|
|
1356
|
+
}
|
|
1357
|
+
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual$2, stack);
|
|
1358
|
+
}
|
|
1359
|
+
var _baseIsEqual = baseIsEqual$2;
|
|
1360
|
+
var Stack = _Stack, baseIsEqual$1 = _baseIsEqual;
|
|
1361
|
+
var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
|
|
1362
|
+
function baseIsMatch$1(object2, source, matchData, customizer) {
|
|
1363
|
+
var index2 = matchData.length, length = index2, noCustomizer = !customizer;
|
|
1364
|
+
if (object2 == null) {
|
|
1365
|
+
return !length;
|
|
1366
|
+
}
|
|
1367
|
+
object2 = Object(object2);
|
|
1368
|
+
while (index2--) {
|
|
1369
|
+
var data = matchData[index2];
|
|
1370
|
+
if (noCustomizer && data[2] ? data[1] !== object2[data[0]] : !(data[0] in object2)) {
|
|
1371
|
+
return false;
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
while (++index2 < length) {
|
|
1375
|
+
data = matchData[index2];
|
|
1376
|
+
var key = data[0], objValue = object2[key], srcValue = data[1];
|
|
1377
|
+
if (noCustomizer && data[2]) {
|
|
1378
|
+
if (objValue === void 0 && !(key in object2)) {
|
|
1379
|
+
return false;
|
|
1380
|
+
}
|
|
1381
|
+
} else {
|
|
1382
|
+
var stack = new Stack();
|
|
1383
|
+
if (customizer) {
|
|
1384
|
+
var result = customizer(objValue, srcValue, key, object2, source, stack);
|
|
1385
|
+
}
|
|
1386
|
+
if (!(result === void 0 ? baseIsEqual$1(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
|
|
1387
|
+
return false;
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
return true;
|
|
1392
|
+
}
|
|
1393
|
+
var _baseIsMatch = baseIsMatch$1;
|
|
1394
|
+
var isObject = isObject_1;
|
|
1395
|
+
function isStrictComparable$2(value) {
|
|
1396
|
+
return value === value && !isObject(value);
|
|
1397
|
+
}
|
|
1398
|
+
var _isStrictComparable = isStrictComparable$2;
|
|
1399
|
+
var isStrictComparable$1 = _isStrictComparable, keys = keys_1;
|
|
1400
|
+
function getMatchData$1(object2) {
|
|
1401
|
+
var result = keys(object2), length = result.length;
|
|
1402
|
+
while (length--) {
|
|
1403
|
+
var key = result[length], value = object2[key];
|
|
1404
|
+
result[length] = [key, value, isStrictComparable$1(value)];
|
|
1405
|
+
}
|
|
1406
|
+
return result;
|
|
1407
|
+
}
|
|
1408
|
+
var _getMatchData = getMatchData$1;
|
|
1409
|
+
function matchesStrictComparable$2(key, srcValue) {
|
|
1410
|
+
return function(object2) {
|
|
1411
|
+
if (object2 == null) {
|
|
1412
|
+
return false;
|
|
1413
|
+
}
|
|
1414
|
+
return object2[key] === srcValue && (srcValue !== void 0 || key in Object(object2));
|
|
1415
|
+
};
|
|
1416
|
+
}
|
|
1417
|
+
var _matchesStrictComparable = matchesStrictComparable$2;
|
|
1418
|
+
var baseIsMatch = _baseIsMatch, getMatchData = _getMatchData, matchesStrictComparable$1 = _matchesStrictComparable;
|
|
1419
|
+
function baseMatches$1(source) {
|
|
1420
|
+
var matchData = getMatchData(source);
|
|
1421
|
+
if (matchData.length == 1 && matchData[0][2]) {
|
|
1422
|
+
return matchesStrictComparable$1(matchData[0][0], matchData[0][1]);
|
|
1423
|
+
}
|
|
1424
|
+
return function(object2) {
|
|
1425
|
+
return object2 === source || baseIsMatch(object2, source, matchData);
|
|
1426
|
+
};
|
|
1427
|
+
}
|
|
1428
|
+
var _baseMatches = baseMatches$1;
|
|
1429
|
+
var castPath = _castPath, toKey$2 = _toKey;
|
|
1430
|
+
function baseGet$2(object2, path) {
|
|
1431
|
+
path = castPath(path, object2);
|
|
1432
|
+
var index2 = 0, length = path.length;
|
|
1433
|
+
while (object2 != null && index2 < length) {
|
|
1434
|
+
object2 = object2[toKey$2(path[index2++])];
|
|
1435
|
+
}
|
|
1436
|
+
return index2 && index2 == length ? object2 : void 0;
|
|
1437
|
+
}
|
|
1438
|
+
var _baseGet = baseGet$2;
|
|
1439
|
+
var baseGet$1 = _baseGet;
|
|
1440
|
+
function get$1(object2, path, defaultValue) {
|
|
1441
|
+
var result = object2 == null ? void 0 : baseGet$1(object2, path);
|
|
1442
|
+
return result === void 0 ? defaultValue : result;
|
|
1443
|
+
}
|
|
1444
|
+
var get_1 = get$1;
|
|
1445
|
+
function baseHasIn$1(object2, key) {
|
|
1446
|
+
return object2 != null && key in Object(object2);
|
|
1447
|
+
}
|
|
1448
|
+
var _baseHasIn = baseHasIn$1;
|
|
1449
|
+
var baseHasIn = _baseHasIn, hasPath = _hasPath;
|
|
1450
|
+
function hasIn$1(object2, path) {
|
|
1451
|
+
return object2 != null && hasPath(object2, path, baseHasIn);
|
|
1452
|
+
}
|
|
1453
|
+
var hasIn_1 = hasIn$1;
|
|
1454
|
+
var baseIsEqual = _baseIsEqual, get = get_1, hasIn = hasIn_1, isKey$1 = _isKey, isStrictComparable = _isStrictComparable, matchesStrictComparable = _matchesStrictComparable, toKey$1 = _toKey;
|
|
1455
|
+
var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
|
|
1456
|
+
function baseMatchesProperty$1(path, srcValue) {
|
|
1457
|
+
if (isKey$1(path) && isStrictComparable(srcValue)) {
|
|
1458
|
+
return matchesStrictComparable(toKey$1(path), srcValue);
|
|
1459
|
+
}
|
|
1460
|
+
return function(object2) {
|
|
1461
|
+
var objValue = get(object2, path);
|
|
1462
|
+
return objValue === void 0 && objValue === srcValue ? hasIn(object2, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
var _baseMatchesProperty = baseMatchesProperty$1;
|
|
1466
|
+
function identity$1(value) {
|
|
1467
|
+
return value;
|
|
1468
|
+
}
|
|
1469
|
+
var identity_1 = identity$1;
|
|
1470
|
+
function baseProperty$1(key) {
|
|
1471
|
+
return function(object2) {
|
|
1472
|
+
return object2 == null ? void 0 : object2[key];
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
var _baseProperty = baseProperty$1;
|
|
1476
|
+
var baseGet = _baseGet;
|
|
1477
|
+
function basePropertyDeep$1(path) {
|
|
1478
|
+
return function(object2) {
|
|
1479
|
+
return baseGet(object2, path);
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
var _basePropertyDeep = basePropertyDeep$1;
|
|
1483
|
+
var baseProperty = _baseProperty, basePropertyDeep = _basePropertyDeep, isKey = _isKey, toKey = _toKey;
|
|
1484
|
+
function property$1(path) {
|
|
1485
|
+
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
|
|
1486
|
+
}
|
|
1487
|
+
var property_1 = property$1;
|
|
1488
|
+
var baseMatches = _baseMatches, baseMatchesProperty = _baseMatchesProperty, identity = identity_1, isArray = isArray_1, property = property_1;
|
|
1489
|
+
function baseIteratee$1(value) {
|
|
1490
|
+
if (typeof value == "function") {
|
|
1491
|
+
return value;
|
|
1492
|
+
}
|
|
1493
|
+
if (value == null) {
|
|
1494
|
+
return identity;
|
|
1495
|
+
}
|
|
1496
|
+
if (typeof value == "object") {
|
|
1497
|
+
return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
|
|
1498
|
+
}
|
|
1499
|
+
return property(value);
|
|
1500
|
+
}
|
|
1501
|
+
var _baseIteratee = baseIteratee$1;
|
|
1502
|
+
var baseAssignValue = _baseAssignValue, baseForOwn = _baseForOwn, baseIteratee = _baseIteratee;
|
|
1503
|
+
function mapValues(object2, iteratee) {
|
|
1504
|
+
var result = {};
|
|
1505
|
+
iteratee = baseIteratee(iteratee);
|
|
1506
|
+
baseForOwn(object2, function(value, key, object3) {
|
|
1507
|
+
baseAssignValue(result, key, iteratee(value, key, object3));
|
|
1508
|
+
});
|
|
1509
|
+
return result;
|
|
1510
|
+
}
|
|
1511
|
+
var mapValues_1 = mapValues;
|
|
1512
|
+
const mapValues$1 = /* @__PURE__ */ getDefaultExportFromCjs(mapValues_1);
|
|
1513
|
+
function Cache(maxSize) {
|
|
1514
|
+
this._maxSize = maxSize;
|
|
1515
|
+
this.clear();
|
|
1516
|
+
}
|
|
1517
|
+
Cache.prototype.clear = function() {
|
|
1518
|
+
this._size = 0;
|
|
1519
|
+
this._values = /* @__PURE__ */ Object.create(null);
|
|
1520
|
+
};
|
|
1521
|
+
Cache.prototype.get = function(key) {
|
|
1522
|
+
return this._values[key];
|
|
1523
|
+
};
|
|
1524
|
+
Cache.prototype.set = function(key, value) {
|
|
1525
|
+
this._size >= this._maxSize && this.clear();
|
|
1526
|
+
if (!(key in this._values)) this._size++;
|
|
1527
|
+
return this._values[key] = value;
|
|
1528
|
+
};
|
|
1529
|
+
var SPLIT_REGEX = /[^.^\]^[]+|(?=\[\]|\.\.)/g, DIGIT_REGEX = /^\d+$/, LEAD_DIGIT_REGEX = /^\d/, SPEC_CHAR_REGEX = /[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g, CLEAN_QUOTES_REGEX = /^\s*(['"]?)(.*?)(\1)\s*$/, MAX_CACHE_SIZE = 512;
|
|
1530
|
+
var pathCache = new Cache(MAX_CACHE_SIZE), setCache = new Cache(MAX_CACHE_SIZE), getCache = new Cache(MAX_CACHE_SIZE);
|
|
1531
|
+
var propertyExpr = {
|
|
1532
|
+
Cache,
|
|
1533
|
+
split,
|
|
1534
|
+
normalizePath,
|
|
1535
|
+
setter: function(path) {
|
|
1536
|
+
var parts = normalizePath(path);
|
|
1537
|
+
return setCache.get(path) || setCache.set(path, function setter(obj, value) {
|
|
1538
|
+
var index2 = 0;
|
|
1539
|
+
var len = parts.length;
|
|
1540
|
+
var data = obj;
|
|
1541
|
+
while (index2 < len - 1) {
|
|
1542
|
+
var part = parts[index2];
|
|
1543
|
+
if (part === "__proto__" || part === "constructor" || part === "prototype") {
|
|
1544
|
+
return obj;
|
|
1545
|
+
}
|
|
1546
|
+
data = data[parts[index2++]];
|
|
1547
|
+
}
|
|
1548
|
+
data[parts[index2]] = value;
|
|
1549
|
+
});
|
|
1550
|
+
},
|
|
1551
|
+
getter: function(path, safe) {
|
|
1552
|
+
var parts = normalizePath(path);
|
|
1553
|
+
return getCache.get(path) || getCache.set(path, function getter(data) {
|
|
1554
|
+
var index2 = 0, len = parts.length;
|
|
1555
|
+
while (index2 < len) {
|
|
1556
|
+
if (data != null || !safe) data = data[parts[index2++]];
|
|
1557
|
+
else return;
|
|
1558
|
+
}
|
|
1559
|
+
return data;
|
|
1560
|
+
});
|
|
1561
|
+
},
|
|
1562
|
+
join: function(segments) {
|
|
1563
|
+
return segments.reduce(function(path, part) {
|
|
1564
|
+
return path + (isQuoted(part) || DIGIT_REGEX.test(part) ? "[" + part + "]" : (path ? "." : "") + part);
|
|
1565
|
+
}, "");
|
|
1566
|
+
},
|
|
1567
|
+
forEach: function(path, cb, thisArg) {
|
|
1568
|
+
forEach(Array.isArray(path) ? path : split(path), cb, thisArg);
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
function normalizePath(path) {
|
|
1572
|
+
return pathCache.get(path) || pathCache.set(
|
|
1573
|
+
path,
|
|
1574
|
+
split(path).map(function(part) {
|
|
1575
|
+
return part.replace(CLEAN_QUOTES_REGEX, "$2");
|
|
1576
|
+
})
|
|
1577
|
+
);
|
|
1578
|
+
}
|
|
1579
|
+
function split(path) {
|
|
1580
|
+
return path.match(SPLIT_REGEX) || [""];
|
|
1581
|
+
}
|
|
1582
|
+
function forEach(parts, iter, thisArg) {
|
|
1583
|
+
var len = parts.length, part, idx, isArray2, isBracket;
|
|
1584
|
+
for (idx = 0; idx < len; idx++) {
|
|
1585
|
+
part = parts[idx];
|
|
1586
|
+
if (part) {
|
|
1587
|
+
if (shouldBeQuoted(part)) {
|
|
1588
|
+
part = '"' + part + '"';
|
|
1589
|
+
}
|
|
1590
|
+
isBracket = isQuoted(part);
|
|
1591
|
+
isArray2 = !isBracket && /^\d+$/.test(part);
|
|
1592
|
+
iter.call(thisArg, part, isBracket, isArray2, idx, parts);
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
function isQuoted(str) {
|
|
1597
|
+
return typeof str === "string" && str && ["'", '"'].indexOf(str.charAt(0)) !== -1;
|
|
1598
|
+
}
|
|
1599
|
+
function hasLeadingNumber(part) {
|
|
1600
|
+
return part.match(LEAD_DIGIT_REGEX) && !part.match(DIGIT_REGEX);
|
|
1601
|
+
}
|
|
1602
|
+
function hasSpecialChars(part) {
|
|
1603
|
+
return SPEC_CHAR_REGEX.test(part);
|
|
1604
|
+
}
|
|
1605
|
+
function shouldBeQuoted(part) {
|
|
1606
|
+
return !isQuoted(part) && (hasLeadingNumber(part) || hasSpecialChars(part));
|
|
1607
|
+
}
|
|
1608
|
+
const prefixes = {
|
|
1609
|
+
context: "$",
|
|
1610
|
+
value: "."
|
|
1611
|
+
};
|
|
1612
|
+
class Reference {
|
|
1613
|
+
constructor(key, options = {}) {
|
|
1614
|
+
if (typeof key !== "string") throw new TypeError("ref must be a string, got: " + key);
|
|
1615
|
+
this.key = key.trim();
|
|
1616
|
+
if (key === "") throw new TypeError("ref must be a non-empty string");
|
|
1617
|
+
this.isContext = this.key[0] === prefixes.context;
|
|
1618
|
+
this.isValue = this.key[0] === prefixes.value;
|
|
1619
|
+
this.isSibling = !this.isContext && !this.isValue;
|
|
1620
|
+
let prefix = this.isContext ? prefixes.context : this.isValue ? prefixes.value : "";
|
|
1621
|
+
this.path = this.key.slice(prefix.length);
|
|
1622
|
+
this.getter = this.path && propertyExpr.getter(this.path, true);
|
|
1623
|
+
this.map = options.map;
|
|
1624
|
+
}
|
|
1625
|
+
getValue(value, parent, context) {
|
|
1626
|
+
let result = this.isContext ? context : this.isValue ? value : parent;
|
|
1627
|
+
if (this.getter) result = this.getter(result || {});
|
|
1628
|
+
if (this.map) result = this.map(result);
|
|
1629
|
+
return result;
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
*
|
|
1633
|
+
* @param {*} value
|
|
1634
|
+
* @param {Object} options
|
|
1635
|
+
* @param {Object=} options.context
|
|
1636
|
+
* @param {Object=} options.parent
|
|
1637
|
+
*/
|
|
1638
|
+
cast(value, options) {
|
|
1639
|
+
return this.getValue(value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context);
|
|
1640
|
+
}
|
|
1641
|
+
resolve() {
|
|
1642
|
+
return this;
|
|
1643
|
+
}
|
|
1644
|
+
describe() {
|
|
1645
|
+
return {
|
|
1646
|
+
type: "ref",
|
|
1647
|
+
key: this.key
|
|
1648
|
+
};
|
|
1649
|
+
}
|
|
1650
|
+
toString() {
|
|
1651
|
+
return `Ref(${this.key})`;
|
|
1652
|
+
}
|
|
1653
|
+
static isRef(value) {
|
|
1654
|
+
return value && value.__isYupRef;
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
Reference.prototype.__isYupRef = true;
|
|
1658
|
+
function _extends$1() {
|
|
1659
|
+
_extends$1 = Object.assign || function(target) {
|
|
1660
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1661
|
+
var source = arguments[i];
|
|
1662
|
+
for (var key in source) {
|
|
1663
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1664
|
+
target[key] = source[key];
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
return target;
|
|
1669
|
+
};
|
|
1670
|
+
return _extends$1.apply(this, arguments);
|
|
1671
|
+
}
|
|
1672
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
1673
|
+
if (source == null) return {};
|
|
1674
|
+
var target = {};
|
|
1675
|
+
var sourceKeys = Object.keys(source);
|
|
1676
|
+
var key, i;
|
|
1677
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
1678
|
+
key = sourceKeys[i];
|
|
1679
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
1680
|
+
target[key] = source[key];
|
|
1681
|
+
}
|
|
1682
|
+
return target;
|
|
1683
|
+
}
|
|
1684
|
+
function createValidation(config2) {
|
|
1685
|
+
function validate(_ref, cb) {
|
|
1686
|
+
let {
|
|
1687
|
+
value,
|
|
1688
|
+
path = "",
|
|
1689
|
+
label,
|
|
1690
|
+
options,
|
|
1691
|
+
originalValue,
|
|
1692
|
+
sync
|
|
1693
|
+
} = _ref, rest = _objectWithoutPropertiesLoose(_ref, ["value", "path", "label", "options", "originalValue", "sync"]);
|
|
1694
|
+
const {
|
|
1695
|
+
name,
|
|
1696
|
+
test,
|
|
1697
|
+
params,
|
|
1698
|
+
message
|
|
1699
|
+
} = config2;
|
|
1700
|
+
let {
|
|
1701
|
+
parent,
|
|
1702
|
+
context
|
|
1703
|
+
} = options;
|
|
1704
|
+
function resolve(item) {
|
|
1705
|
+
return Reference.isRef(item) ? item.getValue(value, parent, context) : item;
|
|
1706
|
+
}
|
|
1707
|
+
function createError(overrides = {}) {
|
|
1708
|
+
const nextParams = mapValues$1(_extends$1({
|
|
1709
|
+
value,
|
|
1710
|
+
originalValue,
|
|
1711
|
+
label,
|
|
1712
|
+
path: overrides.path || path
|
|
1713
|
+
}, params, overrides.params), resolve);
|
|
1714
|
+
const error = new ValidationError(ValidationError.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name);
|
|
1715
|
+
error.params = nextParams;
|
|
1716
|
+
return error;
|
|
1717
|
+
}
|
|
1718
|
+
let ctx = _extends$1({
|
|
1719
|
+
path,
|
|
1720
|
+
parent,
|
|
1721
|
+
type: name,
|
|
1722
|
+
createError,
|
|
1723
|
+
resolve,
|
|
1724
|
+
options,
|
|
1725
|
+
originalValue
|
|
1726
|
+
}, rest);
|
|
1727
|
+
if (!sync) {
|
|
1728
|
+
try {
|
|
1729
|
+
Promise.resolve(test.call(ctx, value, ctx)).then((validOrError) => {
|
|
1730
|
+
if (ValidationError.isError(validOrError)) cb(validOrError);
|
|
1731
|
+
else if (!validOrError) cb(createError());
|
|
1732
|
+
else cb(null, validOrError);
|
|
1733
|
+
});
|
|
1734
|
+
} catch (err) {
|
|
1735
|
+
cb(err);
|
|
1736
|
+
}
|
|
1737
|
+
return;
|
|
1738
|
+
}
|
|
1739
|
+
let result;
|
|
1740
|
+
try {
|
|
1741
|
+
var _ref2;
|
|
1742
|
+
result = test.call(ctx, value, ctx);
|
|
1743
|
+
if (typeof ((_ref2 = result) == null ? void 0 : _ref2.then) === "function") {
|
|
1744
|
+
throw new Error(`Validation test of type: "${ctx.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);
|
|
1745
|
+
}
|
|
1746
|
+
} catch (err) {
|
|
1747
|
+
cb(err);
|
|
1748
|
+
return;
|
|
1749
|
+
}
|
|
1750
|
+
if (ValidationError.isError(result)) cb(result);
|
|
1751
|
+
else if (!result) cb(createError());
|
|
1752
|
+
else cb(null, result);
|
|
1753
|
+
}
|
|
1754
|
+
validate.OPTIONS = config2;
|
|
1755
|
+
return validate;
|
|
1756
|
+
}
|
|
1757
|
+
let trim = (part) => part.substr(0, part.length - 1).substr(1);
|
|
1758
|
+
function getIn(schema, path, value, context = value) {
|
|
1759
|
+
let parent, lastPart, lastPartDebug;
|
|
1760
|
+
if (!path) return {
|
|
1761
|
+
parent,
|
|
1762
|
+
parentPath: path,
|
|
1763
|
+
schema
|
|
1764
|
+
};
|
|
1765
|
+
propertyExpr.forEach(path, (_part, isBracket, isArray2) => {
|
|
1766
|
+
let part = isBracket ? trim(_part) : _part;
|
|
1767
|
+
schema = schema.resolve({
|
|
1768
|
+
context,
|
|
1769
|
+
parent,
|
|
1770
|
+
value
|
|
1771
|
+
});
|
|
1772
|
+
if (schema.innerType) {
|
|
1773
|
+
let idx = isArray2 ? parseInt(part, 10) : 0;
|
|
1774
|
+
if (value && idx >= value.length) {
|
|
1775
|
+
throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path}. because there is no value at that index. `);
|
|
1776
|
+
}
|
|
1777
|
+
parent = value;
|
|
1778
|
+
value = value && value[idx];
|
|
1779
|
+
schema = schema.innerType;
|
|
1780
|
+
}
|
|
1781
|
+
if (!isArray2) {
|
|
1782
|
+
if (!schema.fields || !schema.fields[part]) throw new Error(`The schema does not contain the path: ${path}. (failed at: ${lastPartDebug} which is a type: "${schema._type}")`);
|
|
1783
|
+
parent = value;
|
|
1784
|
+
value = value && value[part];
|
|
1785
|
+
schema = schema.fields[part];
|
|
1786
|
+
}
|
|
1787
|
+
lastPart = part;
|
|
1788
|
+
lastPartDebug = isBracket ? "[" + _part + "]" : "." + _part;
|
|
1789
|
+
});
|
|
1790
|
+
return {
|
|
1791
|
+
schema,
|
|
1792
|
+
parent,
|
|
1793
|
+
parentPath: lastPart
|
|
1794
|
+
};
|
|
1795
|
+
}
|
|
1796
|
+
class ReferenceSet {
|
|
1797
|
+
constructor() {
|
|
1798
|
+
this.list = /* @__PURE__ */ new Set();
|
|
1799
|
+
this.refs = /* @__PURE__ */ new Map();
|
|
1800
|
+
}
|
|
1801
|
+
get size() {
|
|
1802
|
+
return this.list.size + this.refs.size;
|
|
1803
|
+
}
|
|
1804
|
+
describe() {
|
|
1805
|
+
const description = [];
|
|
1806
|
+
for (const item of this.list) description.push(item);
|
|
1807
|
+
for (const [, ref] of this.refs) description.push(ref.describe());
|
|
1808
|
+
return description;
|
|
1809
|
+
}
|
|
1810
|
+
toArray() {
|
|
1811
|
+
return Array.from(this.list).concat(Array.from(this.refs.values()));
|
|
1812
|
+
}
|
|
1813
|
+
add(value) {
|
|
1814
|
+
Reference.isRef(value) ? this.refs.set(value.key, value) : this.list.add(value);
|
|
1815
|
+
}
|
|
1816
|
+
delete(value) {
|
|
1817
|
+
Reference.isRef(value) ? this.refs.delete(value.key) : this.list.delete(value);
|
|
1818
|
+
}
|
|
1819
|
+
has(value, resolve) {
|
|
1820
|
+
if (this.list.has(value)) return true;
|
|
1821
|
+
let item, values = this.refs.values();
|
|
1822
|
+
while (item = values.next(), !item.done) if (resolve(item.value) === value) return true;
|
|
1823
|
+
return false;
|
|
1824
|
+
}
|
|
1825
|
+
clone() {
|
|
1826
|
+
const next = new ReferenceSet();
|
|
1827
|
+
next.list = new Set(this.list);
|
|
1828
|
+
next.refs = new Map(this.refs);
|
|
1829
|
+
return next;
|
|
1830
|
+
}
|
|
1831
|
+
merge(newItems, removeItems) {
|
|
1832
|
+
const next = this.clone();
|
|
1833
|
+
newItems.list.forEach((value) => next.add(value));
|
|
1834
|
+
newItems.refs.forEach((value) => next.add(value));
|
|
1835
|
+
removeItems.list.forEach((value) => next.delete(value));
|
|
1836
|
+
removeItems.refs.forEach((value) => next.delete(value));
|
|
1837
|
+
return next;
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
function _extends() {
|
|
1841
|
+
_extends = Object.assign || function(target) {
|
|
1842
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1843
|
+
var source = arguments[i];
|
|
1844
|
+
for (var key in source) {
|
|
1845
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1846
|
+
target[key] = source[key];
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
return target;
|
|
1851
|
+
};
|
|
1852
|
+
return _extends.apply(this, arguments);
|
|
1853
|
+
}
|
|
1854
|
+
class BaseSchema {
|
|
1855
|
+
constructor(options) {
|
|
1856
|
+
this.deps = [];
|
|
1857
|
+
this.conditions = [];
|
|
1858
|
+
this._whitelist = new ReferenceSet();
|
|
1859
|
+
this._blacklist = new ReferenceSet();
|
|
1860
|
+
this.exclusiveTests = /* @__PURE__ */ Object.create(null);
|
|
1861
|
+
this.tests = [];
|
|
1862
|
+
this.transforms = [];
|
|
1863
|
+
this.withMutation(() => {
|
|
1864
|
+
this.typeError(mixed.notType);
|
|
1865
|
+
});
|
|
1866
|
+
this.type = (options == null ? void 0 : options.type) || "mixed";
|
|
1867
|
+
this.spec = _extends({
|
|
1868
|
+
strip: false,
|
|
1869
|
+
strict: false,
|
|
1870
|
+
abortEarly: true,
|
|
1871
|
+
recursive: true,
|
|
1872
|
+
nullable: false,
|
|
1873
|
+
presence: "optional"
|
|
1874
|
+
}, options == null ? void 0 : options.spec);
|
|
1875
|
+
}
|
|
1876
|
+
// TODO: remove
|
|
1877
|
+
get _type() {
|
|
1878
|
+
return this.type;
|
|
1879
|
+
}
|
|
1880
|
+
_typeCheck(_value) {
|
|
1881
|
+
return true;
|
|
1882
|
+
}
|
|
1883
|
+
clone(spec) {
|
|
1884
|
+
if (this._mutate) {
|
|
1885
|
+
if (spec) Object.assign(this.spec, spec);
|
|
1886
|
+
return this;
|
|
1887
|
+
}
|
|
1888
|
+
const next = Object.create(Object.getPrototypeOf(this));
|
|
1889
|
+
next.type = this.type;
|
|
1890
|
+
next._typeError = this._typeError;
|
|
1891
|
+
next._whitelistError = this._whitelistError;
|
|
1892
|
+
next._blacklistError = this._blacklistError;
|
|
1893
|
+
next._whitelist = this._whitelist.clone();
|
|
1894
|
+
next._blacklist = this._blacklist.clone();
|
|
1895
|
+
next.exclusiveTests = _extends({}, this.exclusiveTests);
|
|
1896
|
+
next.deps = [...this.deps];
|
|
1897
|
+
next.conditions = [...this.conditions];
|
|
1898
|
+
next.tests = [...this.tests];
|
|
1899
|
+
next.transforms = [...this.transforms];
|
|
1900
|
+
next.spec = clone(_extends({}, this.spec, spec));
|
|
1901
|
+
return next;
|
|
1902
|
+
}
|
|
1903
|
+
label(label) {
|
|
1904
|
+
var next = this.clone();
|
|
1905
|
+
next.spec.label = label;
|
|
1906
|
+
return next;
|
|
1907
|
+
}
|
|
1908
|
+
meta(...args) {
|
|
1909
|
+
if (args.length === 0) return this.spec.meta;
|
|
1910
|
+
let next = this.clone();
|
|
1911
|
+
next.spec.meta = Object.assign(next.spec.meta || {}, args[0]);
|
|
1912
|
+
return next;
|
|
1913
|
+
}
|
|
1914
|
+
// withContext<TContext extends AnyObject>(): BaseSchema<
|
|
1915
|
+
// TCast,
|
|
1916
|
+
// TContext,
|
|
1917
|
+
// TOutput
|
|
1918
|
+
// > {
|
|
1919
|
+
// return this as any;
|
|
1920
|
+
// }
|
|
1921
|
+
withMutation(fn) {
|
|
1922
|
+
let before = this._mutate;
|
|
1923
|
+
this._mutate = true;
|
|
1924
|
+
let result = fn(this);
|
|
1925
|
+
this._mutate = before;
|
|
1926
|
+
return result;
|
|
1927
|
+
}
|
|
1928
|
+
concat(schema) {
|
|
1929
|
+
if (!schema || schema === this) return this;
|
|
1930
|
+
if (schema.type !== this.type && this.type !== "mixed") throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema.type}`);
|
|
1931
|
+
let base = this;
|
|
1932
|
+
let combined = schema.clone();
|
|
1933
|
+
const mergedSpec = _extends({}, base.spec, combined.spec);
|
|
1934
|
+
combined.spec = mergedSpec;
|
|
1935
|
+
combined._typeError || (combined._typeError = base._typeError);
|
|
1936
|
+
combined._whitelistError || (combined._whitelistError = base._whitelistError);
|
|
1937
|
+
combined._blacklistError || (combined._blacklistError = base._blacklistError);
|
|
1938
|
+
combined._whitelist = base._whitelist.merge(schema._whitelist, schema._blacklist);
|
|
1939
|
+
combined._blacklist = base._blacklist.merge(schema._blacklist, schema._whitelist);
|
|
1940
|
+
combined.tests = base.tests;
|
|
1941
|
+
combined.exclusiveTests = base.exclusiveTests;
|
|
1942
|
+
combined.withMutation((next) => {
|
|
1943
|
+
schema.tests.forEach((fn) => {
|
|
1944
|
+
next.test(fn.OPTIONS);
|
|
1945
|
+
});
|
|
1946
|
+
});
|
|
1947
|
+
return combined;
|
|
1948
|
+
}
|
|
1949
|
+
isType(v) {
|
|
1950
|
+
if (this.spec.nullable && v === null) return true;
|
|
1951
|
+
return this._typeCheck(v);
|
|
1952
|
+
}
|
|
1953
|
+
resolve(options) {
|
|
1954
|
+
let schema = this;
|
|
1955
|
+
if (schema.conditions.length) {
|
|
1956
|
+
let conditions = schema.conditions;
|
|
1957
|
+
schema = schema.clone();
|
|
1958
|
+
schema.conditions = [];
|
|
1959
|
+
schema = conditions.reduce((schema2, condition) => condition.resolve(schema2, options), schema);
|
|
1960
|
+
schema = schema.resolve(options);
|
|
1961
|
+
}
|
|
1962
|
+
return schema;
|
|
1963
|
+
}
|
|
1964
|
+
/**
|
|
1965
|
+
*
|
|
1966
|
+
* @param {*} value
|
|
1967
|
+
* @param {Object} options
|
|
1968
|
+
* @param {*=} options.parent
|
|
1969
|
+
* @param {*=} options.context
|
|
1970
|
+
*/
|
|
1971
|
+
cast(value, options = {}) {
|
|
1972
|
+
let resolvedSchema = this.resolve(_extends({
|
|
1973
|
+
value
|
|
1974
|
+
}, options));
|
|
1975
|
+
let result = resolvedSchema._cast(value, options);
|
|
1976
|
+
if (value !== void 0 && options.assert !== false && resolvedSchema.isType(result) !== true) {
|
|
1977
|
+
let formattedValue = printValue(value);
|
|
1978
|
+
let formattedResult = printValue(result);
|
|
1979
|
+
throw new TypeError(`The value of ${options.path || "field"} could not be cast to a value that satisfies the schema type: "${resolvedSchema._type}".
|
|
1980
|
+
|
|
1981
|
+
attempted value: ${formattedValue}
|
|
1982
|
+
` + (formattedResult !== formattedValue ? `result of cast: ${formattedResult}` : ""));
|
|
1983
|
+
}
|
|
1984
|
+
return result;
|
|
1985
|
+
}
|
|
1986
|
+
_cast(rawValue, _options) {
|
|
1987
|
+
let value = rawValue === void 0 ? rawValue : this.transforms.reduce((value2, fn) => fn.call(this, value2, rawValue, this), rawValue);
|
|
1988
|
+
if (value === void 0) {
|
|
1989
|
+
value = this.getDefault();
|
|
1990
|
+
}
|
|
1991
|
+
return value;
|
|
1992
|
+
}
|
|
1993
|
+
_validate(_value, options = {}, cb) {
|
|
1994
|
+
let {
|
|
1995
|
+
sync,
|
|
1996
|
+
path,
|
|
1997
|
+
from = [],
|
|
1998
|
+
originalValue = _value,
|
|
1999
|
+
strict = this.spec.strict,
|
|
2000
|
+
abortEarly = this.spec.abortEarly
|
|
2001
|
+
} = options;
|
|
2002
|
+
let value = _value;
|
|
2003
|
+
if (!strict) {
|
|
2004
|
+
value = this._cast(value, _extends({
|
|
2005
|
+
assert: false
|
|
2006
|
+
}, options));
|
|
2007
|
+
}
|
|
2008
|
+
let args = {
|
|
2009
|
+
value,
|
|
2010
|
+
path,
|
|
2011
|
+
options,
|
|
2012
|
+
originalValue,
|
|
2013
|
+
schema: this,
|
|
2014
|
+
label: this.spec.label,
|
|
2015
|
+
sync,
|
|
2016
|
+
from
|
|
2017
|
+
};
|
|
2018
|
+
let initialTests = [];
|
|
2019
|
+
if (this._typeError) initialTests.push(this._typeError);
|
|
2020
|
+
if (this._whitelistError) initialTests.push(this._whitelistError);
|
|
2021
|
+
if (this._blacklistError) initialTests.push(this._blacklistError);
|
|
2022
|
+
runTests({
|
|
2023
|
+
args,
|
|
2024
|
+
value,
|
|
2025
|
+
path,
|
|
2026
|
+
tests: initialTests,
|
|
2027
|
+
endEarly: abortEarly
|
|
2028
|
+
}, (err) => {
|
|
2029
|
+
if (err) return void cb(err, value);
|
|
2030
|
+
runTests({
|
|
2031
|
+
tests: this.tests,
|
|
2032
|
+
args,
|
|
2033
|
+
path,
|
|
2034
|
+
sync,
|
|
2035
|
+
value,
|
|
2036
|
+
endEarly: abortEarly
|
|
2037
|
+
}, cb);
|
|
2038
|
+
});
|
|
2039
|
+
}
|
|
2040
|
+
validate(value, options, maybeCb) {
|
|
2041
|
+
let schema = this.resolve(_extends({}, options, {
|
|
2042
|
+
value
|
|
2043
|
+
}));
|
|
2044
|
+
return typeof maybeCb === "function" ? schema._validate(value, options, maybeCb) : new Promise((resolve, reject) => schema._validate(value, options, (err, value2) => {
|
|
2045
|
+
if (err) reject(err);
|
|
2046
|
+
else resolve(value2);
|
|
2047
|
+
}));
|
|
2048
|
+
}
|
|
2049
|
+
validateSync(value, options) {
|
|
2050
|
+
let schema = this.resolve(_extends({}, options, {
|
|
2051
|
+
value
|
|
2052
|
+
}));
|
|
2053
|
+
let result;
|
|
2054
|
+
schema._validate(value, _extends({}, options, {
|
|
2055
|
+
sync: true
|
|
2056
|
+
}), (err, value2) => {
|
|
2057
|
+
if (err) throw err;
|
|
2058
|
+
result = value2;
|
|
2059
|
+
});
|
|
2060
|
+
return result;
|
|
2061
|
+
}
|
|
2062
|
+
isValid(value, options) {
|
|
2063
|
+
return this.validate(value, options).then(() => true, (err) => {
|
|
2064
|
+
if (ValidationError.isError(err)) return false;
|
|
2065
|
+
throw err;
|
|
2066
|
+
});
|
|
2067
|
+
}
|
|
2068
|
+
isValidSync(value, options) {
|
|
2069
|
+
try {
|
|
2070
|
+
this.validateSync(value, options);
|
|
2071
|
+
return true;
|
|
2072
|
+
} catch (err) {
|
|
2073
|
+
if (ValidationError.isError(err)) return false;
|
|
2074
|
+
throw err;
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
_getDefault() {
|
|
2078
|
+
let defaultValue = this.spec.default;
|
|
2079
|
+
if (defaultValue == null) {
|
|
2080
|
+
return defaultValue;
|
|
2081
|
+
}
|
|
2082
|
+
return typeof defaultValue === "function" ? defaultValue.call(this) : clone(defaultValue);
|
|
2083
|
+
}
|
|
2084
|
+
getDefault(options) {
|
|
2085
|
+
let schema = this.resolve(options || {});
|
|
2086
|
+
return schema._getDefault();
|
|
2087
|
+
}
|
|
2088
|
+
default(def) {
|
|
2089
|
+
if (arguments.length === 0) {
|
|
2090
|
+
return this._getDefault();
|
|
2091
|
+
}
|
|
2092
|
+
let next = this.clone({
|
|
2093
|
+
default: def
|
|
2094
|
+
});
|
|
2095
|
+
return next;
|
|
2096
|
+
}
|
|
2097
|
+
strict(isStrict = true) {
|
|
2098
|
+
var next = this.clone();
|
|
2099
|
+
next.spec.strict = isStrict;
|
|
2100
|
+
return next;
|
|
2101
|
+
}
|
|
2102
|
+
_isPresent(value) {
|
|
2103
|
+
return value != null;
|
|
2104
|
+
}
|
|
2105
|
+
defined(message = mixed.defined) {
|
|
2106
|
+
return this.test({
|
|
2107
|
+
message,
|
|
2108
|
+
name: "defined",
|
|
2109
|
+
exclusive: true,
|
|
2110
|
+
test(value) {
|
|
2111
|
+
return value !== void 0;
|
|
2112
|
+
}
|
|
2113
|
+
});
|
|
2114
|
+
}
|
|
2115
|
+
required(message = mixed.required) {
|
|
2116
|
+
return this.clone({
|
|
2117
|
+
presence: "required"
|
|
2118
|
+
}).withMutation((s) => s.test({
|
|
2119
|
+
message,
|
|
2120
|
+
name: "required",
|
|
2121
|
+
exclusive: true,
|
|
2122
|
+
test(value) {
|
|
2123
|
+
return this.schema._isPresent(value);
|
|
2124
|
+
}
|
|
2125
|
+
}));
|
|
2126
|
+
}
|
|
2127
|
+
notRequired() {
|
|
2128
|
+
var next = this.clone({
|
|
2129
|
+
presence: "optional"
|
|
2130
|
+
});
|
|
2131
|
+
next.tests = next.tests.filter((test) => test.OPTIONS.name !== "required");
|
|
2132
|
+
return next;
|
|
2133
|
+
}
|
|
2134
|
+
nullable(isNullable = true) {
|
|
2135
|
+
var next = this.clone({
|
|
2136
|
+
nullable: isNullable !== false
|
|
2137
|
+
});
|
|
2138
|
+
return next;
|
|
2139
|
+
}
|
|
2140
|
+
transform(fn) {
|
|
2141
|
+
var next = this.clone();
|
|
2142
|
+
next.transforms.push(fn);
|
|
2143
|
+
return next;
|
|
2144
|
+
}
|
|
2145
|
+
/**
|
|
2146
|
+
* Adds a test function to the schema's queue of tests.
|
|
2147
|
+
* tests can be exclusive or non-exclusive.
|
|
2148
|
+
*
|
|
2149
|
+
* - exclusive tests, will replace any existing tests of the same name.
|
|
2150
|
+
* - non-exclusive: can be stacked
|
|
2151
|
+
*
|
|
2152
|
+
* If a non-exclusive test is added to a schema with an exclusive test of the same name
|
|
2153
|
+
* the exclusive test is removed and further tests of the same name will be stacked.
|
|
2154
|
+
*
|
|
2155
|
+
* If an exclusive test is added to a schema with non-exclusive tests of the same name
|
|
2156
|
+
* the previous tests are removed and further tests of the same name will replace each other.
|
|
2157
|
+
*/
|
|
2158
|
+
test(...args) {
|
|
2159
|
+
let opts;
|
|
2160
|
+
if (args.length === 1) {
|
|
2161
|
+
if (typeof args[0] === "function") {
|
|
2162
|
+
opts = {
|
|
2163
|
+
test: args[0]
|
|
2164
|
+
};
|
|
2165
|
+
} else {
|
|
2166
|
+
opts = args[0];
|
|
2167
|
+
}
|
|
2168
|
+
} else if (args.length === 2) {
|
|
2169
|
+
opts = {
|
|
2170
|
+
name: args[0],
|
|
2171
|
+
test: args[1]
|
|
2172
|
+
};
|
|
2173
|
+
} else {
|
|
2174
|
+
opts = {
|
|
2175
|
+
name: args[0],
|
|
2176
|
+
message: args[1],
|
|
2177
|
+
test: args[2]
|
|
2178
|
+
};
|
|
2179
|
+
}
|
|
2180
|
+
if (opts.message === void 0) opts.message = mixed.default;
|
|
2181
|
+
if (typeof opts.test !== "function") throw new TypeError("`test` is a required parameters");
|
|
2182
|
+
let next = this.clone();
|
|
2183
|
+
let validate = createValidation(opts);
|
|
2184
|
+
let isExclusive = opts.exclusive || opts.name && next.exclusiveTests[opts.name] === true;
|
|
2185
|
+
if (opts.exclusive) {
|
|
2186
|
+
if (!opts.name) throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");
|
|
2187
|
+
}
|
|
2188
|
+
if (opts.name) next.exclusiveTests[opts.name] = !!opts.exclusive;
|
|
2189
|
+
next.tests = next.tests.filter((fn) => {
|
|
2190
|
+
if (fn.OPTIONS.name === opts.name) {
|
|
2191
|
+
if (isExclusive) return false;
|
|
2192
|
+
if (fn.OPTIONS.test === validate.OPTIONS.test) return false;
|
|
2193
|
+
}
|
|
2194
|
+
return true;
|
|
2195
|
+
});
|
|
2196
|
+
next.tests.push(validate);
|
|
2197
|
+
return next;
|
|
2198
|
+
}
|
|
2199
|
+
when(keys2, options) {
|
|
2200
|
+
if (!Array.isArray(keys2) && typeof keys2 !== "string") {
|
|
2201
|
+
options = keys2;
|
|
2202
|
+
keys2 = ".";
|
|
2203
|
+
}
|
|
2204
|
+
let next = this.clone();
|
|
2205
|
+
let deps = toArray(keys2).map((key) => new Reference(key));
|
|
2206
|
+
deps.forEach((dep) => {
|
|
2207
|
+
if (dep.isSibling) next.deps.push(dep.key);
|
|
2208
|
+
});
|
|
2209
|
+
next.conditions.push(new Condition(deps, options));
|
|
2210
|
+
return next;
|
|
2211
|
+
}
|
|
2212
|
+
typeError(message) {
|
|
2213
|
+
var next = this.clone();
|
|
2214
|
+
next._typeError = createValidation({
|
|
2215
|
+
message,
|
|
2216
|
+
name: "typeError",
|
|
2217
|
+
test(value) {
|
|
2218
|
+
if (value !== void 0 && !this.schema.isType(value)) return this.createError({
|
|
2219
|
+
params: {
|
|
2220
|
+
type: this.schema._type
|
|
2221
|
+
}
|
|
2222
|
+
});
|
|
2223
|
+
return true;
|
|
2224
|
+
}
|
|
2225
|
+
});
|
|
2226
|
+
return next;
|
|
2227
|
+
}
|
|
2228
|
+
oneOf(enums, message = mixed.oneOf) {
|
|
2229
|
+
var next = this.clone();
|
|
2230
|
+
enums.forEach((val) => {
|
|
2231
|
+
next._whitelist.add(val);
|
|
2232
|
+
next._blacklist.delete(val);
|
|
2233
|
+
});
|
|
2234
|
+
next._whitelistError = createValidation({
|
|
2235
|
+
message,
|
|
2236
|
+
name: "oneOf",
|
|
2237
|
+
test(value) {
|
|
2238
|
+
if (value === void 0) return true;
|
|
2239
|
+
let valids = this.schema._whitelist;
|
|
2240
|
+
return valids.has(value, this.resolve) ? true : this.createError({
|
|
2241
|
+
params: {
|
|
2242
|
+
values: valids.toArray().join(", ")
|
|
2243
|
+
}
|
|
2244
|
+
});
|
|
2245
|
+
}
|
|
2246
|
+
});
|
|
2247
|
+
return next;
|
|
2248
|
+
}
|
|
2249
|
+
notOneOf(enums, message = mixed.notOneOf) {
|
|
2250
|
+
var next = this.clone();
|
|
2251
|
+
enums.forEach((val) => {
|
|
2252
|
+
next._blacklist.add(val);
|
|
2253
|
+
next._whitelist.delete(val);
|
|
2254
|
+
});
|
|
2255
|
+
next._blacklistError = createValidation({
|
|
2256
|
+
message,
|
|
2257
|
+
name: "notOneOf",
|
|
2258
|
+
test(value) {
|
|
2259
|
+
let invalids = this.schema._blacklist;
|
|
2260
|
+
if (invalids.has(value, this.resolve)) return this.createError({
|
|
2261
|
+
params: {
|
|
2262
|
+
values: invalids.toArray().join(", ")
|
|
2263
|
+
}
|
|
2264
|
+
});
|
|
2265
|
+
return true;
|
|
2266
|
+
}
|
|
2267
|
+
});
|
|
2268
|
+
return next;
|
|
2269
|
+
}
|
|
2270
|
+
strip(strip = true) {
|
|
2271
|
+
let next = this.clone();
|
|
2272
|
+
next.spec.strip = strip;
|
|
2273
|
+
return next;
|
|
2274
|
+
}
|
|
2275
|
+
describe() {
|
|
2276
|
+
const next = this.clone();
|
|
2277
|
+
const {
|
|
2278
|
+
label,
|
|
2279
|
+
meta
|
|
2280
|
+
} = next.spec;
|
|
2281
|
+
const description = {
|
|
2282
|
+
meta,
|
|
2283
|
+
label,
|
|
2284
|
+
type: next.type,
|
|
2285
|
+
oneOf: next._whitelist.describe(),
|
|
2286
|
+
notOneOf: next._blacklist.describe(),
|
|
2287
|
+
tests: next.tests.map((fn) => ({
|
|
2288
|
+
name: fn.OPTIONS.name,
|
|
2289
|
+
params: fn.OPTIONS.params
|
|
2290
|
+
})).filter((n, idx, list) => list.findIndex((c) => c.name === n.name) === idx)
|
|
2291
|
+
};
|
|
2292
|
+
return description;
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
BaseSchema.prototype.__isYupSchema__ = true;
|
|
2296
|
+
for (const method of ["validate", "validateSync"]) BaseSchema.prototype[`${method}At`] = function(path, value, options = {}) {
|
|
2297
|
+
const {
|
|
2298
|
+
parent,
|
|
2299
|
+
parentPath,
|
|
2300
|
+
schema
|
|
2301
|
+
} = getIn(this, path, value, options.context);
|
|
2302
|
+
return schema[method](parent && parent[parentPath], _extends({}, options, {
|
|
2303
|
+
parent,
|
|
2304
|
+
path
|
|
2305
|
+
}));
|
|
2306
|
+
};
|
|
2307
|
+
for (const alias of ["equals", "is"]) BaseSchema.prototype[alias] = BaseSchema.prototype.oneOf;
|
|
2308
|
+
for (const alias of ["not", "nope"]) BaseSchema.prototype[alias] = BaseSchema.prototype.notOneOf;
|
|
2309
|
+
BaseSchema.prototype.optional = BaseSchema.prototype.notRequired;
|
|
2310
|
+
const isAbsent = (value) => value == null;
|
|
2311
|
+
let rEmail = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
|
|
2312
|
+
let rUrl = /^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;
|
|
2313
|
+
let rUUID = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
2314
|
+
let isTrimmed = (value) => isAbsent(value) || value === value.trim();
|
|
2315
|
+
let objStringTag = {}.toString();
|
|
2316
|
+
function create() {
|
|
2317
|
+
return new StringSchema();
|
|
2318
|
+
}
|
|
2319
|
+
class StringSchema extends BaseSchema {
|
|
2320
|
+
constructor() {
|
|
2321
|
+
super({
|
|
2322
|
+
type: "string"
|
|
2323
|
+
});
|
|
2324
|
+
this.withMutation(() => {
|
|
2325
|
+
this.transform(function(value) {
|
|
2326
|
+
if (this.isType(value)) return value;
|
|
2327
|
+
if (Array.isArray(value)) return value;
|
|
2328
|
+
const strValue = value != null && value.toString ? value.toString() : value;
|
|
2329
|
+
if (strValue === objStringTag) return value;
|
|
2330
|
+
return strValue;
|
|
2331
|
+
});
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
_typeCheck(value) {
|
|
2335
|
+
if (value instanceof String) value = value.valueOf();
|
|
2336
|
+
return typeof value === "string";
|
|
2337
|
+
}
|
|
2338
|
+
_isPresent(value) {
|
|
2339
|
+
return super._isPresent(value) && !!value.length;
|
|
2340
|
+
}
|
|
2341
|
+
length(length, message = string.length) {
|
|
2342
|
+
return this.test({
|
|
2343
|
+
message,
|
|
2344
|
+
name: "length",
|
|
2345
|
+
exclusive: true,
|
|
2346
|
+
params: {
|
|
2347
|
+
length
|
|
2348
|
+
},
|
|
2349
|
+
test(value) {
|
|
2350
|
+
return isAbsent(value) || value.length === this.resolve(length);
|
|
2351
|
+
}
|
|
2352
|
+
});
|
|
2353
|
+
}
|
|
2354
|
+
min(min, message = string.min) {
|
|
2355
|
+
return this.test({
|
|
2356
|
+
message,
|
|
2357
|
+
name: "min",
|
|
2358
|
+
exclusive: true,
|
|
2359
|
+
params: {
|
|
2360
|
+
min
|
|
2361
|
+
},
|
|
2362
|
+
test(value) {
|
|
2363
|
+
return isAbsent(value) || value.length >= this.resolve(min);
|
|
2364
|
+
}
|
|
2365
|
+
});
|
|
2366
|
+
}
|
|
2367
|
+
max(max, message = string.max) {
|
|
2368
|
+
return this.test({
|
|
2369
|
+
name: "max",
|
|
2370
|
+
exclusive: true,
|
|
2371
|
+
message,
|
|
2372
|
+
params: {
|
|
2373
|
+
max
|
|
2374
|
+
},
|
|
2375
|
+
test(value) {
|
|
2376
|
+
return isAbsent(value) || value.length <= this.resolve(max);
|
|
2377
|
+
}
|
|
2378
|
+
});
|
|
2379
|
+
}
|
|
2380
|
+
matches(regex, options) {
|
|
2381
|
+
let excludeEmptyString = false;
|
|
2382
|
+
let message;
|
|
2383
|
+
let name;
|
|
2384
|
+
if (options) {
|
|
2385
|
+
if (typeof options === "object") {
|
|
2386
|
+
({
|
|
2387
|
+
excludeEmptyString = false,
|
|
2388
|
+
message,
|
|
2389
|
+
name
|
|
2390
|
+
} = options);
|
|
2391
|
+
} else {
|
|
2392
|
+
message = options;
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
return this.test({
|
|
2396
|
+
name: name || "matches",
|
|
2397
|
+
message: message || string.matches,
|
|
2398
|
+
params: {
|
|
2399
|
+
regex
|
|
2400
|
+
},
|
|
2401
|
+
test: (value) => isAbsent(value) || value === "" && excludeEmptyString || value.search(regex) !== -1
|
|
2402
|
+
});
|
|
2403
|
+
}
|
|
2404
|
+
email(message = string.email) {
|
|
2405
|
+
return this.matches(rEmail, {
|
|
2406
|
+
name: "email",
|
|
2407
|
+
message,
|
|
2408
|
+
excludeEmptyString: true
|
|
2409
|
+
});
|
|
2410
|
+
}
|
|
2411
|
+
url(message = string.url) {
|
|
2412
|
+
return this.matches(rUrl, {
|
|
2413
|
+
name: "url",
|
|
2414
|
+
message,
|
|
2415
|
+
excludeEmptyString: true
|
|
2416
|
+
});
|
|
2417
|
+
}
|
|
2418
|
+
uuid(message = string.uuid) {
|
|
2419
|
+
return this.matches(rUUID, {
|
|
2420
|
+
name: "uuid",
|
|
2421
|
+
message,
|
|
2422
|
+
excludeEmptyString: false
|
|
2423
|
+
});
|
|
2424
|
+
}
|
|
2425
|
+
//-- transforms --
|
|
2426
|
+
ensure() {
|
|
2427
|
+
return this.default("").transform((val) => val === null ? "" : val);
|
|
2428
|
+
}
|
|
2429
|
+
trim(message = string.trim) {
|
|
2430
|
+
return this.transform((val) => val != null ? val.trim() : val).test({
|
|
2431
|
+
message,
|
|
2432
|
+
name: "trim",
|
|
2433
|
+
test: isTrimmed
|
|
2434
|
+
});
|
|
2435
|
+
}
|
|
2436
|
+
lowercase(message = string.lowercase) {
|
|
2437
|
+
return this.transform((value) => !isAbsent(value) ? value.toLowerCase() : value).test({
|
|
2438
|
+
message,
|
|
2439
|
+
name: "string_case",
|
|
2440
|
+
exclusive: true,
|
|
2441
|
+
test: (value) => isAbsent(value) || value === value.toLowerCase()
|
|
2442
|
+
});
|
|
2443
|
+
}
|
|
2444
|
+
uppercase(message = string.uppercase) {
|
|
2445
|
+
return this.transform((value) => !isAbsent(value) ? value.toUpperCase() : value).test({
|
|
2446
|
+
message,
|
|
2447
|
+
name: "string_case",
|
|
2448
|
+
exclusive: true,
|
|
2449
|
+
test: (value) => isAbsent(value) || value === value.toUpperCase()
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
create.prototype = StringSchema.prototype;
|
|
2454
|
+
var isoReg = /^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;
|
|
2455
|
+
function parseIsoDate(date2) {
|
|
2456
|
+
var numericKeys = [1, 4, 5, 6, 7, 10, 11], minutesOffset = 0, timestamp, struct;
|
|
2457
|
+
if (struct = isoReg.exec(date2)) {
|
|
2458
|
+
for (var i = 0, k; k = numericKeys[i]; ++i) struct[k] = +struct[k] || 0;
|
|
2459
|
+
struct[2] = (+struct[2] || 1) - 1;
|
|
2460
|
+
struct[3] = +struct[3] || 1;
|
|
2461
|
+
struct[7] = struct[7] ? String(struct[7]).substr(0, 3) : 0;
|
|
2462
|
+
if ((struct[8] === void 0 || struct[8] === "") && (struct[9] === void 0 || struct[9] === "")) timestamp = +new Date(struct[1], struct[2], struct[3], struct[4], struct[5], struct[6], struct[7]);
|
|
2463
|
+
else {
|
|
2464
|
+
if (struct[8] !== "Z" && struct[9] !== void 0) {
|
|
2465
|
+
minutesOffset = struct[10] * 60 + struct[11];
|
|
2466
|
+
if (struct[9] === "+") minutesOffset = 0 - minutesOffset;
|
|
2467
|
+
}
|
|
2468
|
+
timestamp = Date.UTC(struct[1], struct[2], struct[3], struct[4], struct[5] + minutesOffset, struct[6], struct[7]);
|
|
2469
|
+
}
|
|
2470
|
+
} else timestamp = Date.parse ? Date.parse(date2) : NaN;
|
|
2471
|
+
return timestamp;
|
|
2472
|
+
}
|
|
2473
|
+
let invalidDate = /* @__PURE__ */ new Date("");
|
|
2474
|
+
let isDate = (obj) => Object.prototype.toString.call(obj) === "[object Date]";
|
|
2475
|
+
class DateSchema extends BaseSchema {
|
|
2476
|
+
constructor() {
|
|
2477
|
+
super({
|
|
2478
|
+
type: "date"
|
|
2479
|
+
});
|
|
2480
|
+
this.withMutation(() => {
|
|
2481
|
+
this.transform(function(value) {
|
|
2482
|
+
if (this.isType(value)) return value;
|
|
2483
|
+
value = parseIsoDate(value);
|
|
2484
|
+
return !isNaN(value) ? new Date(value) : invalidDate;
|
|
2485
|
+
});
|
|
2486
|
+
});
|
|
2487
|
+
}
|
|
2488
|
+
_typeCheck(v) {
|
|
2489
|
+
return isDate(v) && !isNaN(v.getTime());
|
|
2490
|
+
}
|
|
2491
|
+
prepareParam(ref, name) {
|
|
2492
|
+
let param;
|
|
2493
|
+
if (!Reference.isRef(ref)) {
|
|
2494
|
+
let cast = this.cast(ref);
|
|
2495
|
+
if (!this._typeCheck(cast)) throw new TypeError(`\`${name}\` must be a Date or a value that can be \`cast()\` to a Date`);
|
|
2496
|
+
param = cast;
|
|
2497
|
+
} else {
|
|
2498
|
+
param = ref;
|
|
2499
|
+
}
|
|
2500
|
+
return param;
|
|
2501
|
+
}
|
|
2502
|
+
min(min, message = date.min) {
|
|
2503
|
+
let limit = this.prepareParam(min, "min");
|
|
2504
|
+
return this.test({
|
|
2505
|
+
message,
|
|
2506
|
+
name: "min",
|
|
2507
|
+
exclusive: true,
|
|
2508
|
+
params: {
|
|
2509
|
+
min
|
|
2510
|
+
},
|
|
2511
|
+
test(value) {
|
|
2512
|
+
return isAbsent(value) || value >= this.resolve(limit);
|
|
2513
|
+
}
|
|
2514
|
+
});
|
|
2515
|
+
}
|
|
2516
|
+
max(max, message = date.max) {
|
|
2517
|
+
var limit = this.prepareParam(max, "max");
|
|
2518
|
+
return this.test({
|
|
2519
|
+
message,
|
|
2520
|
+
name: "max",
|
|
2521
|
+
exclusive: true,
|
|
2522
|
+
params: {
|
|
2523
|
+
max
|
|
2524
|
+
},
|
|
2525
|
+
test(value) {
|
|
2526
|
+
return isAbsent(value) || value <= this.resolve(limit);
|
|
2527
|
+
}
|
|
2528
|
+
});
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
DateSchema.INVALID_DATE = invalidDate;
|
|
2532
|
+
var toposort$1 = { exports: {} };
|
|
2533
|
+
toposort$1.exports = function(edges) {
|
|
2534
|
+
return toposort(uniqueNodes(edges), edges);
|
|
2535
|
+
};
|
|
2536
|
+
toposort$1.exports.array = toposort;
|
|
2537
|
+
function toposort(nodes, edges) {
|
|
2538
|
+
var cursor = nodes.length, sorted = new Array(cursor), visited = {}, i = cursor, outgoingEdges = makeOutgoingEdges(edges), nodesHash = makeNodesHash(nodes);
|
|
2539
|
+
edges.forEach(function(edge) {
|
|
2540
|
+
if (!nodesHash.has(edge[0]) || !nodesHash.has(edge[1])) {
|
|
2541
|
+
throw new Error("Unknown node. There is an unknown node in the supplied edges.");
|
|
2542
|
+
}
|
|
2543
|
+
});
|
|
2544
|
+
while (i--) {
|
|
2545
|
+
if (!visited[i]) visit(nodes[i], i, /* @__PURE__ */ new Set());
|
|
2546
|
+
}
|
|
2547
|
+
return sorted;
|
|
2548
|
+
function visit(node, i2, predecessors) {
|
|
2549
|
+
if (predecessors.has(node)) {
|
|
2550
|
+
var nodeRep;
|
|
2551
|
+
try {
|
|
2552
|
+
nodeRep = ", node was:" + JSON.stringify(node);
|
|
2553
|
+
} catch (e) {
|
|
2554
|
+
nodeRep = "";
|
|
2555
|
+
}
|
|
2556
|
+
throw new Error("Cyclic dependency" + nodeRep);
|
|
2557
|
+
}
|
|
2558
|
+
if (!nodesHash.has(node)) {
|
|
2559
|
+
throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: " + JSON.stringify(node));
|
|
2560
|
+
}
|
|
2561
|
+
if (visited[i2]) return;
|
|
2562
|
+
visited[i2] = true;
|
|
2563
|
+
var outgoing = outgoingEdges.get(node) || /* @__PURE__ */ new Set();
|
|
2564
|
+
outgoing = Array.from(outgoing);
|
|
2565
|
+
if (i2 = outgoing.length) {
|
|
2566
|
+
predecessors.add(node);
|
|
2567
|
+
do {
|
|
2568
|
+
var child = outgoing[--i2];
|
|
2569
|
+
visit(child, nodesHash.get(child), predecessors);
|
|
2570
|
+
} while (i2);
|
|
2571
|
+
predecessors.delete(node);
|
|
2572
|
+
}
|
|
2573
|
+
sorted[--cursor] = node;
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
function uniqueNodes(arr) {
|
|
2577
|
+
var res = /* @__PURE__ */ new Set();
|
|
2578
|
+
for (var i = 0, len = arr.length; i < len; i++) {
|
|
2579
|
+
var edge = arr[i];
|
|
2580
|
+
res.add(edge[0]);
|
|
2581
|
+
res.add(edge[1]);
|
|
2582
|
+
}
|
|
2583
|
+
return Array.from(res);
|
|
2584
|
+
}
|
|
2585
|
+
function makeOutgoingEdges(arr) {
|
|
2586
|
+
var edges = /* @__PURE__ */ new Map();
|
|
2587
|
+
for (var i = 0, len = arr.length; i < len; i++) {
|
|
2588
|
+
var edge = arr[i];
|
|
2589
|
+
if (!edges.has(edge[0])) edges.set(edge[0], /* @__PURE__ */ new Set());
|
|
2590
|
+
if (!edges.has(edge[1])) edges.set(edge[1], /* @__PURE__ */ new Set());
|
|
2591
|
+
edges.get(edge[0]).add(edge[1]);
|
|
2592
|
+
}
|
|
2593
|
+
return edges;
|
|
2594
|
+
}
|
|
2595
|
+
function makeNodesHash(arr) {
|
|
2596
|
+
var res = /* @__PURE__ */ new Map();
|
|
2597
|
+
for (var i = 0, len = arr.length; i < len; i++) {
|
|
2598
|
+
res.set(arr[i], i);
|
|
2599
|
+
}
|
|
2600
|
+
return res;
|
|
2601
|
+
}
|
|
2602
|
+
const PLUGIN_ID = "littlebox-strapi-suite";
|
|
2603
|
+
const config = {
|
|
2604
|
+
pluginId: PLUGIN_ID,
|
|
2605
|
+
uuid: {
|
|
2606
|
+
modules: {
|
|
2607
|
+
menu: "menu",
|
|
2608
|
+
attribute: "attribute",
|
|
2609
|
+
parameter: "parameter",
|
|
2610
|
+
slug: "slug",
|
|
2611
|
+
translation: "translation",
|
|
2612
|
+
template: "template"
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
};
|
|
2616
|
+
class Registry {
|
|
2617
|
+
dependencies;
|
|
2618
|
+
static instance;
|
|
2619
|
+
constructor() {
|
|
2620
|
+
this.dependencies = {};
|
|
2621
|
+
}
|
|
2622
|
+
provide(name, dependency) {
|
|
2623
|
+
this.dependencies[name] = dependency;
|
|
2624
|
+
}
|
|
2625
|
+
inject(name) {
|
|
2626
|
+
return this.dependencies[name];
|
|
2627
|
+
}
|
|
2628
|
+
static getInstance() {
|
|
2629
|
+
if (!Registry.instance) {
|
|
2630
|
+
Registry.instance = new Registry();
|
|
2631
|
+
}
|
|
2632
|
+
return Registry.instance;
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
class StrapiAdapter {
|
|
2636
|
+
async get(url) {
|
|
2637
|
+
const { get: get2 } = admin.getFetchClient();
|
|
2638
|
+
const data = await get2(url);
|
|
2639
|
+
return data.data;
|
|
2640
|
+
}
|
|
2641
|
+
async post(url, body) {
|
|
2642
|
+
const { post } = admin.getFetchClient();
|
|
2643
|
+
const data = await post(url, body);
|
|
2644
|
+
return data.data;
|
|
2645
|
+
}
|
|
2646
|
+
async put(url, body) {
|
|
2647
|
+
const { put } = admin.getFetchClient();
|
|
2648
|
+
const data = await put(url, body);
|
|
2649
|
+
return data.data;
|
|
2650
|
+
}
|
|
2651
|
+
async delete(url, body) {
|
|
2652
|
+
const { del } = admin.getFetchClient();
|
|
2653
|
+
const data = await del(url, {
|
|
2654
|
+
params: body
|
|
2655
|
+
});
|
|
2656
|
+
return data.data;
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2659
|
+
const Initializer = ({ setPlugin }) => {
|
|
2660
|
+
const ref = React.useRef(setPlugin);
|
|
2661
|
+
React.useEffect(() => {
|
|
2662
|
+
ref.current(config.pluginId);
|
|
2663
|
+
}, []);
|
|
2664
|
+
return null;
|
|
2665
|
+
};
|
|
2666
|
+
const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "26", height: "26", viewBox: "0 0 26 26", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
2667
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2668
|
+
"path",
|
|
2669
|
+
{
|
|
2670
|
+
d: "M0 3C0 1.34315 1.34315 0 3 0H23C24.6569 0 26 1.34315 26 3V23C26 24.6569 24.6569 26 23 26H3C1.34315 26 0 24.6569 0 23V3Z",
|
|
2671
|
+
fill: "url(#paint0_linear_69_6)"
|
|
2672
|
+
}
|
|
2673
|
+
),
|
|
2674
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2675
|
+
"mask",
|
|
2676
|
+
{
|
|
2677
|
+
id: "path-2-outside-1_69_6",
|
|
2678
|
+
maskUnits: "userSpaceOnUse",
|
|
2679
|
+
x: "5",
|
|
2680
|
+
y: "5",
|
|
2681
|
+
width: "17",
|
|
2682
|
+
height: "15",
|
|
2683
|
+
fill: "black",
|
|
2684
|
+
children: [
|
|
2685
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { fill: "white", x: "5", y: "5", width: "17", height: "15" }),
|
|
2686
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.1155 18.1538C9.79228 18.1538 8.73516 17.8511 7.94414 17.2456C7.15801 16.6401 6.74785 15.749 6.71367 14.5723H8.94756C8.98662 15.1191 9.20146 15.5317 9.59209 15.8101C9.9876 16.0835 10.4856 16.2202 11.0862 16.2202C11.6722 16.2202 12.1409 16.0957 12.4925 15.8467C12.8489 15.5977 13.0271 15.2729 13.0271 14.8726C13.0271 14.5063 12.866 14.2256 12.5437 14.0303C12.2215 13.8301 11.7625 13.6592 11.1668 13.5176L9.97295 13.2246C9.05498 13.0049 8.32988 12.6558 7.79766 12.1772C7.27031 11.6938 7.00664 11.0493 7.00664 10.2437C7.00664 9.58447 7.18486 9.0083 7.54131 8.51514C7.89775 8.01709 8.38603 7.63135 9.00615 7.35791C9.63115 7.07959 10.3416 6.94043 11.1375 6.94043C11.948 6.94043 12.6561 7.07959 13.2615 7.35791C13.867 7.63623 14.3382 8.02197 14.6751 8.51514C15.0169 9.0083 15.1927 9.57715 15.2024 10.2217H12.9759C12.9368 9.79688 12.7562 9.46484 12.4339 9.22559C12.1116 8.98633 11.6746 8.8667 11.1229 8.8667C10.5613 8.8667 10.1292 8.98389 9.82646 9.21826C9.52373 9.44775 9.37236 9.74072 9.37236 10.0972C9.37236 10.4829 9.54082 10.7759 9.87773 10.9761C10.2146 11.1714 10.6199 11.3252 11.0936 11.4375L12.0677 11.6792C12.7024 11.8208 13.2664 12.0283 13.7596 12.3018C14.2527 12.5703 14.6409 12.917 14.9241 13.3418C15.2073 13.7617 15.3489 14.2744 15.3489 14.8799C15.3489 15.8809 14.9754 16.6768 14.2283 17.2676C13.4812 17.8584 12.4437 18.1538 11.1155 18.1538ZM20.3083 9.81152V11.5254H18.7556V15.4805C18.7556 16.0127 19.0144 16.2788 19.5319 16.2788C19.6198 16.2788 19.715 16.2715 19.8176 16.2568C19.925 16.2422 20.0178 16.2251 20.0959 16.2056L20.4548 17.9048C19.9714 18.0464 19.5026 18.1172 19.0485 18.1172C18.238 18.1172 17.6081 17.9121 17.1589 17.502C16.7146 17.0918 16.4924 16.5181 16.4924 15.7808V11.5254H15.3791V9.81152H16.4924V7.86328H18.7556V9.81152H20.3083Z" })
|
|
2687
|
+
]
|
|
2688
|
+
}
|
|
2689
|
+
),
|
|
2690
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2691
|
+
"path",
|
|
2692
|
+
{
|
|
2693
|
+
d: "M11.1155 18.1538C9.79228 18.1538 8.73516 17.8511 7.94414 17.2456C7.15801 16.6401 6.74785 15.749 6.71367 14.5723H8.94756C8.98662 15.1191 9.20146 15.5317 9.59209 15.8101C9.9876 16.0835 10.4856 16.2202 11.0862 16.2202C11.6722 16.2202 12.1409 16.0957 12.4925 15.8467C12.8489 15.5977 13.0271 15.2729 13.0271 14.8726C13.0271 14.5063 12.866 14.2256 12.5437 14.0303C12.2215 13.8301 11.7625 13.6592 11.1668 13.5176L9.97295 13.2246C9.05498 13.0049 8.32988 12.6558 7.79766 12.1772C7.27031 11.6938 7.00664 11.0493 7.00664 10.2437C7.00664 9.58447 7.18486 9.0083 7.54131 8.51514C7.89775 8.01709 8.38603 7.63135 9.00615 7.35791C9.63115 7.07959 10.3416 6.94043 11.1375 6.94043C11.948 6.94043 12.6561 7.07959 13.2615 7.35791C13.867 7.63623 14.3382 8.02197 14.6751 8.51514C15.0169 9.0083 15.1927 9.57715 15.2024 10.2217H12.9759C12.9368 9.79688 12.7562 9.46484 12.4339 9.22559C12.1116 8.98633 11.6746 8.8667 11.1229 8.8667C10.5613 8.8667 10.1292 8.98389 9.82646 9.21826C9.52373 9.44775 9.37236 9.74072 9.37236 10.0972C9.37236 10.4829 9.54082 10.7759 9.87773 10.9761C10.2146 11.1714 10.6199 11.3252 11.0936 11.4375L12.0677 11.6792C12.7024 11.8208 13.2664 12.0283 13.7596 12.3018C14.2527 12.5703 14.6409 12.917 14.9241 13.3418C15.2073 13.7617 15.3489 14.2744 15.3489 14.8799C15.3489 15.8809 14.9754 16.6768 14.2283 17.2676C13.4812 17.8584 12.4437 18.1538 11.1155 18.1538ZM20.3083 9.81152V11.5254H18.7556V15.4805C18.7556 16.0127 19.0144 16.2788 19.5319 16.2788C19.6198 16.2788 19.715 16.2715 19.8176 16.2568C19.925 16.2422 20.0178 16.2251 20.0959 16.2056L20.4548 17.9048C19.9714 18.0464 19.5026 18.1172 19.0485 18.1172C18.238 18.1172 17.6081 17.9121 17.1589 17.502C16.7146 17.0918 16.4924 16.5181 16.4924 15.7808V11.5254H15.3791V9.81152H16.4924V7.86328H18.7556V9.81152H20.3083Z",
|
|
2694
|
+
fill: "white"
|
|
2695
|
+
}
|
|
2696
|
+
),
|
|
2697
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2698
|
+
"path",
|
|
2699
|
+
{
|
|
2700
|
+
d: "M7.94414 17.2456L7.33395 18.0379L7.33633 18.0397L7.94414 17.2456ZM6.71367 14.5723V13.5723H5.6842L5.71409 14.6013L6.71367 14.5723ZM8.94756 14.5723L9.94502 14.501L9.87868 13.5723H8.94756V14.5723ZM9.59209 15.8101L9.01181 16.6245L9.01758 16.6286L9.02341 16.6326L9.59209 15.8101ZM12.4925 15.8467L11.9198 15.0269L11.9145 15.0307L12.4925 15.8467ZM12.5437 14.0303L12.016 14.8798L12.0254 14.8855L12.5437 14.0303ZM11.1668 13.5176L10.9285 14.4888L10.9355 14.4905L11.1668 13.5176ZM9.97295 13.2246L10.2113 12.2534L10.2057 12.2521L9.97295 13.2246ZM7.79766 12.1772L7.1219 12.9144L7.12907 12.9209L7.79766 12.1772ZM7.54131 8.51514L8.35178 9.10093L8.3545 9.09713L7.54131 8.51514ZM9.00615 7.35791L9.40962 8.27291L9.41295 8.27143L9.00615 7.35791ZM13.2615 7.35791L12.8439 8.26651L13.2615 7.35791ZM14.6751 8.51514L13.8494 9.07925L13.8532 9.08477L14.6751 8.51514ZM15.2024 10.2217V11.2217H16.2177L16.2023 10.2065L15.2024 10.2217ZM12.9759 10.2217L11.9801 10.3132L12.0636 11.2217H12.9759V10.2217ZM9.82646 9.21826L10.4306 10.0152L10.4386 10.009L9.82646 9.21826ZM9.87773 10.9761L9.36688 11.8358L9.3762 11.8412L9.87773 10.9761ZM11.0936 11.4375L11.3344 10.4669L11.3243 10.4645L11.0936 11.4375ZM12.0677 11.6792L11.8269 12.6498L11.8384 12.6526L11.85 12.6552L12.0677 11.6792ZM13.7596 12.3018L13.2746 13.1763L13.2813 13.18L13.7596 12.3018ZM14.9241 13.3418L14.0921 13.8965L14.095 13.9009L14.9241 13.3418ZM11.1155 17.1538C9.94009 17.1538 9.1189 16.8855 8.55195 16.4515L7.33633 18.0397C8.35141 18.8167 9.64448 19.1538 11.1155 19.1538V17.1538ZM8.55433 16.4533C8.05114 16.0658 7.74052 15.4822 7.71325 14.5432L5.71409 14.6013C5.75518 16.0159 6.26488 17.2145 7.33395 18.0379L8.55433 16.4533ZM6.71367 15.5723H8.94756V13.5723H6.71367V15.5723ZM7.9501 14.6435C8.007 15.4402 8.34177 16.1471 9.01181 16.6245L10.1724 14.9956C10.0612 14.9164 9.96624 14.7981 9.94502 14.501L7.9501 14.6435ZM9.02341 16.6326C9.62353 17.0475 10.3334 17.2202 11.0862 17.2202V15.2202C10.6379 15.2202 10.3517 15.1195 10.1608 14.9875L9.02341 16.6326ZM11.0862 17.2202C11.8062 17.2202 12.4988 17.0677 13.0705 16.6627L11.9145 15.0307C11.783 15.1238 11.5381 15.2202 11.0862 15.2202V17.2202ZM13.0652 16.6664C13.6624 16.2492 14.0271 15.6312 14.0271 14.8726H12.0271C12.0271 14.9185 12.0185 14.9321 12.0168 14.9352C12.0135 14.9413 11.9938 14.9752 11.9198 15.0269L13.0652 16.6664ZM14.0271 14.8726C14.0271 14.1444 13.6728 13.5452 13.0621 13.1751L12.0254 14.8855C12.0468 14.8984 12.0542 14.9059 12.0535 14.9053C12.0532 14.905 12.0513 14.903 12.0485 14.8993C12.0456 14.8956 12.0423 14.8908 12.039 14.8851C12.0357 14.8793 12.0329 14.8735 12.0307 14.868C12.0285 14.8625 12.0272 14.8582 12.0266 14.8556C12.0252 14.8501 12.0271 14.8546 12.0271 14.8726H14.0271ZM13.0714 13.1808C12.619 12.8998 12.0425 12.6979 11.3981 12.5447L10.9355 14.4905C11.4825 14.6205 11.824 14.7604 12.0161 14.8797L13.0714 13.1808ZM11.4051 12.5464L10.2113 12.2534L9.73462 14.1958L10.9285 14.4888L11.4051 12.5464ZM10.2057 12.2521C9.39994 12.0592 8.8413 11.7708 8.46624 11.4336L7.12907 12.9209C7.81846 13.5407 8.71002 13.9506 9.74016 14.1971L10.2057 12.2521ZM8.47338 11.4401C8.17986 11.171 8.00664 10.8082 8.00664 10.2437H6.00664C6.00664 11.2905 6.36076 12.2167 7.12193 12.9144L8.47338 11.4401ZM8.00664 10.2437C8.00664 9.77632 8.12895 9.40922 8.35178 9.10092L6.73084 7.92935C6.24078 8.60739 6.00664 9.39263 6.00664 10.2437H8.00664ZM8.3545 9.09713C8.59581 8.75996 8.93549 8.48197 9.40961 8.27291L8.60269 6.44291C7.83658 6.78072 7.19969 7.27422 6.72811 7.93314L8.3545 9.09713ZM9.41295 8.27143C9.89068 8.05869 10.4591 7.94043 11.1375 7.94043V5.94043C10.2241 5.94043 9.37162 6.10049 8.59935 6.44439L9.41295 8.27143ZM11.1375 7.94043C11.8344 7.94043 12.3946 8.05999 12.8439 8.26651L13.6792 6.44931C12.9175 6.09919 12.0617 5.94043 11.1375 5.94043V7.94043ZM12.8439 8.26651C13.3042 8.47811 13.6262 8.75261 13.8494 9.07923L15.5008 7.95104C15.0501 7.29134 14.4298 6.79436 13.6792 6.44931L12.8439 8.26651ZM13.8532 9.08477C14.0735 9.40259 14.1956 9.77523 14.2026 10.2368L16.2023 10.2065C16.1898 9.37907 15.9603 8.61401 15.497 7.9455L13.8532 9.08477ZM15.2024 9.22168H12.9759V11.2217H15.2024V9.22168ZM13.9717 10.1301C13.9084 9.44225 13.5963 8.84311 13.03 8.42268L11.8378 10.0285C11.916 10.0866 11.9652 10.1515 11.9801 10.3132L13.9717 10.1301ZM13.03 8.42268C12.4812 8.01526 11.8104 7.8667 11.1229 7.8667V9.8667C11.5388 9.8667 11.742 9.9574 11.8378 10.0285L13.03 8.42268ZM11.1229 7.8667C10.4393 7.8667 9.75737 8.00709 9.21429 8.42754L10.4386 10.009C10.501 9.96069 10.6834 9.8667 11.1229 9.8667V7.8667ZM9.22236 8.42136C8.6893 8.82545 8.37236 9.4046 8.37236 10.0972H10.3724C10.3724 10.0792 10.3742 10.0706 10.3746 10.0687C10.375 10.0672 10.3749 10.068 10.3743 10.0691C10.3719 10.0738 10.3799 10.0535 10.4306 10.0152L9.22236 8.42136ZM8.37236 10.0972C8.37236 10.8426 8.73268 11.4589 9.36691 11.8358L10.3886 10.1164C10.365 10.1024 10.3558 10.0936 10.355 10.0928C10.3546 10.0924 10.3559 10.0936 10.3581 10.0964C10.3603 10.0993 10.3629 10.1031 10.3656 10.1077C10.3683 10.1124 10.3704 10.1169 10.372 10.1209C10.3736 10.1249 10.3743 10.1275 10.3745 10.1282C10.3749 10.1298 10.3724 10.1207 10.3724 10.0972H8.37236ZM9.3762 11.8412C9.81566 12.096 10.3168 12.281 10.8628 12.4105L11.3243 10.4645C10.923 10.3693 10.6136 10.2468 10.3793 10.1109L9.3762 11.8412ZM10.8527 12.4081L11.8269 12.6498L12.3085 10.7086L11.3344 10.4669L10.8527 12.4081ZM11.85 12.6552C12.4053 12.7791 12.8769 12.9558 13.2747 13.1763L14.2445 11.4272C13.6559 11.1008 12.9996 10.8625 12.2854 10.7032L11.85 12.6552ZM13.2813 13.18C13.6466 13.3789 13.9076 13.6197 14.0921 13.8965L15.7562 12.7871C15.3743 12.2143 14.8589 11.7617 14.2378 11.4235L13.2813 13.18ZM14.095 13.9009C14.2466 14.1256 14.3489 14.4341 14.3489 14.8799H16.3489C16.3489 14.1148 16.1681 13.3978 15.7532 12.7827L14.095 13.9009ZM14.3489 14.8799C14.3489 15.5931 14.1015 16.093 13.608 16.4832L14.8486 18.0519C15.8493 17.2605 16.3489 16.1686 16.3489 14.8799H14.3489ZM13.608 16.4832C13.0956 16.8884 12.3058 17.1538 11.1155 17.1538V19.1538C12.5815 19.1538 13.8669 18.8284 14.8486 18.0519L13.608 16.4832ZM20.3083 9.81152H21.3083V8.81152H20.3083V9.81152ZM20.3083 11.5254V12.5254H21.3083V11.5254H20.3083ZM18.7556 11.5254V10.5254H17.7556V11.5254H18.7556ZM19.8176 16.2568L19.6825 15.266L19.6762 15.2669L19.8176 16.2568ZM20.0959 16.2056L21.0743 15.9989L20.8599 14.9838L19.8534 15.2354L20.0959 16.2056ZM20.4548 17.9048L20.7359 18.8645L21.6246 18.6041L21.4332 17.6981L20.4548 17.9048ZM17.1589 17.502L16.4806 18.2368L16.4846 18.2404L17.1589 17.502ZM16.4924 11.5254H17.4924V10.5254H16.4924V11.5254ZM15.3791 11.5254H14.3791V12.5254H15.3791V11.5254ZM15.3791 9.81152V8.81152H14.3791V9.81152H15.3791ZM16.4924 9.81152V10.8115H17.4924V9.81152H16.4924ZM16.4924 7.86328V6.86328H15.4924V7.86328H16.4924ZM18.7556 7.86328H19.7556V6.86328H18.7556V7.86328ZM18.7556 9.81152H17.7556V10.8115H18.7556V9.81152ZM19.3083 9.81152V11.5254H21.3083V9.81152H19.3083ZM20.3083 10.5254H18.7556V12.5254H20.3083V10.5254ZM17.7556 11.5254V15.4805H19.7556V11.5254H17.7556ZM17.7556 15.4805C17.7556 15.8938 17.8558 16.3888 18.2328 16.7764C18.6147 17.1691 19.1118 17.2788 19.5319 17.2788V15.2788C19.4853 15.2788 19.486 15.2725 19.5165 15.2829C19.5522 15.2952 19.6106 15.3245 19.6666 15.3821C19.7847 15.5035 19.7556 15.5993 19.7556 15.4805H17.7556ZM19.5319 17.2788C19.6746 17.2788 19.8176 17.267 19.959 17.2468L19.6762 15.2669C19.6124 15.276 19.565 15.2788 19.5319 15.2788V17.2788ZM19.9527 17.2477C20.0848 17.2297 20.2152 17.2065 20.3384 17.1757L19.8534 15.2354C19.8203 15.2437 19.7652 15.2547 19.6825 15.266L19.9527 17.2477ZM19.1175 16.4122L19.4764 18.1114L21.4332 17.6981L21.0743 15.9989L19.1175 16.4122ZM20.1737 16.9451C19.7717 17.0629 19.3977 17.1172 19.0485 17.1172V19.1172C19.6075 19.1172 20.171 19.0299 20.7359 18.8645L20.1737 16.9451ZM19.0485 17.1172C18.4029 17.1172 18.044 16.9559 17.8332 16.7635L16.4846 18.2404C17.1722 18.8683 18.073 19.1172 19.0485 19.1172V17.1172ZM17.8372 16.7671C17.6419 16.5869 17.4924 16.305 17.4924 15.7808H15.4924C15.4924 16.7311 15.7872 17.5967 16.4806 18.2368L17.8372 16.7671ZM17.4924 15.7808V11.5254H15.4924V15.7808H17.4924ZM16.4924 10.5254H15.3791V12.5254H16.4924V10.5254ZM16.3791 11.5254V9.81152H14.3791V11.5254H16.3791ZM15.3791 10.8115H16.4924V8.81152H15.3791V10.8115ZM17.4924 9.81152V7.86328H15.4924V9.81152H17.4924ZM16.4924 8.86328H18.7556V6.86328H16.4924V8.86328ZM17.7556 7.86328V9.81152H19.7556V7.86328H17.7556ZM18.7556 10.8115H20.3083V8.81152H18.7556V10.8115Z",
|
|
2701
|
+
fill: "url(#paint1_linear_69_6)",
|
|
2702
|
+
fillOpacity: "0.15",
|
|
2703
|
+
mask: "url(#path-2-outside-1_69_6)"
|
|
2704
|
+
}
|
|
2705
|
+
),
|
|
2706
|
+
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
2707
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2708
|
+
"linearGradient",
|
|
2709
|
+
{
|
|
2710
|
+
id: "paint0_linear_69_6",
|
|
2711
|
+
x1: "0.5",
|
|
2712
|
+
y1: "1",
|
|
2713
|
+
x2: "23.5",
|
|
2714
|
+
y2: "25.5",
|
|
2715
|
+
gradientUnits: "userSpaceOnUse",
|
|
2716
|
+
children: [
|
|
2717
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "#323949" }),
|
|
2718
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "#101828" })
|
|
2719
|
+
]
|
|
2720
|
+
}
|
|
2721
|
+
),
|
|
2722
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2723
|
+
"linearGradient",
|
|
2724
|
+
{
|
|
2725
|
+
id: "paint1_linear_69_6",
|
|
2726
|
+
x1: "6.28846",
|
|
2727
|
+
y1: "13.0385",
|
|
2728
|
+
x2: "6.41109",
|
|
2729
|
+
y2: "14.9154",
|
|
2730
|
+
gradientUnits: "userSpaceOnUse",
|
|
2731
|
+
children: [
|
|
2732
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "#101828" }),
|
|
2733
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0.948558", stopColor: "#101828" })
|
|
2734
|
+
]
|
|
2735
|
+
}
|
|
2736
|
+
)
|
|
2737
|
+
] })
|
|
2738
|
+
] }) });
|
|
2739
|
+
const getTranslation = (id) => `${config.pluginId}.${id}`;
|
|
2740
|
+
class SettingGatewayHttp {
|
|
2741
|
+
httpClient;
|
|
2742
|
+
constructor() {
|
|
2743
|
+
this.httpClient = Registry.getInstance().inject("httpClient");
|
|
2744
|
+
}
|
|
2745
|
+
async fetch() {
|
|
2746
|
+
return this.httpClient.get(`/${config.pluginId}/admin/settings`);
|
|
2747
|
+
}
|
|
2748
|
+
async update(data) {
|
|
2749
|
+
return this.httpClient.put(`/${config.pluginId}/admin/settings`, data);
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2752
|
+
class LocaleGatewayHttp {
|
|
2753
|
+
httpClient;
|
|
2754
|
+
constructor() {
|
|
2755
|
+
this.httpClient = Registry.getInstance().inject("httpClient");
|
|
2756
|
+
}
|
|
2757
|
+
async fetch() {
|
|
2758
|
+
return this.httpClient.get("/i18n/locales");
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
const objectToQueryString = (obj) => {
|
|
2762
|
+
const validEntries = Object.entries(obj).filter(
|
|
2763
|
+
([_, value]) => value !== void 0 && value !== null
|
|
2764
|
+
);
|
|
2765
|
+
const queryParams = validEntries.map(
|
|
2766
|
+
([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
|
|
2767
|
+
).join("&");
|
|
2768
|
+
return queryParams.length > 0 ? `?${queryParams}` : "";
|
|
2769
|
+
};
|
|
2770
|
+
class SlugGatewayHttp {
|
|
2771
|
+
httpClient;
|
|
2772
|
+
constructor() {
|
|
2773
|
+
this.httpClient = Registry.getInstance().inject("httpClient");
|
|
2774
|
+
}
|
|
2775
|
+
async fetch(params = {}) {
|
|
2776
|
+
return this.httpClient.get(`/${config.pluginId}/admin/slugs${objectToQueryString(params)}`);
|
|
2777
|
+
}
|
|
2778
|
+
async delete(contentIds, params = {}) {
|
|
2779
|
+
return this.httpClient.post(
|
|
2780
|
+
`/${config.pluginId}/admin/slugs/actions/delete${objectToQueryString(params)}`,
|
|
2781
|
+
{ contentIds }
|
|
2782
|
+
);
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
class AttributeGatewayHttp {
|
|
2786
|
+
httpClient;
|
|
2787
|
+
constructor() {
|
|
2788
|
+
this.httpClient = Registry.getInstance().inject("httpClient");
|
|
2789
|
+
}
|
|
2790
|
+
async fetch(params = {}) {
|
|
2791
|
+
return this.httpClient.get(`/${config.pluginId}/admin/attributes${objectToQueryString(params)}`);
|
|
2792
|
+
}
|
|
2793
|
+
async fetchByContentId(contentId, params = {}) {
|
|
2794
|
+
return this.httpClient.get(`/${config.pluginId}/admin/attributes/${contentId}${objectToQueryString(params)}`);
|
|
2795
|
+
}
|
|
2796
|
+
async delete(contentIds, params = {}) {
|
|
2797
|
+
return this.httpClient.post(
|
|
2798
|
+
`/${config.pluginId}/admin/attributes/actions/delete${objectToQueryString(params)}`,
|
|
2799
|
+
{ contentIds }
|
|
2800
|
+
);
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
class TemplateGatewayHttp {
|
|
2804
|
+
httpClient;
|
|
2805
|
+
constructor() {
|
|
2806
|
+
this.httpClient = Registry.getInstance().inject("httpClient");
|
|
2807
|
+
}
|
|
2808
|
+
async fetch(params = {}) {
|
|
2809
|
+
return this.httpClient.get(`/${config.pluginId}/admin/templates${objectToQueryString(params)}`);
|
|
2810
|
+
}
|
|
2811
|
+
async delete(documentIds, params = {}) {
|
|
2812
|
+
return this.httpClient.post(
|
|
2813
|
+
`/${config.pluginId}/admin/templates/actions/delete`,
|
|
2814
|
+
{ documentIds }
|
|
2815
|
+
);
|
|
2816
|
+
}
|
|
2817
|
+
async create(params) {
|
|
2818
|
+
return this.httpClient.post(`/${config.pluginId}/admin/templates`, params);
|
|
2819
|
+
}
|
|
2820
|
+
async edit(documentId, params) {
|
|
2821
|
+
return this.httpClient.put(`/${config.pluginId}/admin/templates/${documentId}`, params);
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
class MenuGatewayHttp {
|
|
2825
|
+
httpClient;
|
|
2826
|
+
constructor() {
|
|
2827
|
+
this.httpClient = Registry.getInstance().inject("httpClient");
|
|
2828
|
+
}
|
|
2829
|
+
async fetch(params = {}) {
|
|
2830
|
+
return this.httpClient.get(`/${config.pluginId}/admin/menus${objectToQueryString(params)}`);
|
|
2831
|
+
}
|
|
2832
|
+
async fetchByDocumentId(documentId) {
|
|
2833
|
+
return this.httpClient.get(`/${config.pluginId}/admin/menus/${documentId}`);
|
|
2834
|
+
}
|
|
2835
|
+
async delete(documentIds, params = {}) {
|
|
2836
|
+
return this.httpClient.post(
|
|
2837
|
+
`/${config.pluginId}/admin/menus/actions/delete`,
|
|
2838
|
+
{ documentIds }
|
|
2839
|
+
);
|
|
2840
|
+
}
|
|
2841
|
+
async duplicate(documentId, locale) {
|
|
2842
|
+
return this.httpClient.post(
|
|
2843
|
+
`/${config.pluginId}/admin/menus/actions/duplicate`,
|
|
2844
|
+
{ documentId, locale }
|
|
2845
|
+
);
|
|
2846
|
+
}
|
|
2847
|
+
async create(params) {
|
|
2848
|
+
return this.httpClient.post(`/${config.pluginId}/admin/menus`, params);
|
|
2849
|
+
}
|
|
2850
|
+
async edit(documentId, params) {
|
|
2851
|
+
return this.httpClient.put(`/${config.pluginId}/admin/menus/${documentId}`, params);
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
class ParameterGatewayHttp {
|
|
2855
|
+
httpClient;
|
|
2856
|
+
constructor() {
|
|
2857
|
+
this.httpClient = Registry.getInstance().inject("httpClient");
|
|
2858
|
+
}
|
|
2859
|
+
async fetch() {
|
|
2860
|
+
return this.httpClient.get(`/${config.pluginId}/admin/parameters`);
|
|
2861
|
+
}
|
|
2862
|
+
async delete(documentIds, params = {}) {
|
|
2863
|
+
return this.httpClient.post(
|
|
2864
|
+
`/${config.pluginId}/admin/parameters/actions/delete`,
|
|
2865
|
+
{ documentIds }
|
|
2866
|
+
);
|
|
2867
|
+
}
|
|
2868
|
+
async create(params) {
|
|
2869
|
+
return this.httpClient.post(`/${config.pluginId}/admin/parameters`, params);
|
|
2870
|
+
}
|
|
2871
|
+
async edit(documentId, params) {
|
|
2872
|
+
return this.httpClient.put(`/${config.pluginId}/admin/parameters/${documentId}`, params);
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
class TranslationGatewayHttp {
|
|
2876
|
+
httpClient;
|
|
2877
|
+
constructor() {
|
|
2878
|
+
this.httpClient = Registry.getInstance().inject("httpClient");
|
|
2879
|
+
}
|
|
2880
|
+
async fetch() {
|
|
2881
|
+
return this.httpClient.get(`/${config.pluginId}/admin/translations`);
|
|
2882
|
+
}
|
|
2883
|
+
async delete(uids, params = {}) {
|
|
2884
|
+
return this.httpClient.post(
|
|
2885
|
+
`/${config.pluginId}/admin/translations/actions/delete`,
|
|
2886
|
+
{ uids }
|
|
2887
|
+
);
|
|
2888
|
+
}
|
|
2889
|
+
async create(params) {
|
|
2890
|
+
return this.httpClient.post(`/${config.pluginId}/admin/translations`, params);
|
|
2891
|
+
}
|
|
2892
|
+
async edit(uid, params) {
|
|
2893
|
+
return this.httpClient.put(`/${config.pluginId}/admin/translations/${uid}`, params);
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
class Mediator {
|
|
2897
|
+
handlers;
|
|
2898
|
+
constructor() {
|
|
2899
|
+
this.handlers = /* @__PURE__ */ new Map();
|
|
2900
|
+
}
|
|
2901
|
+
subscribe(event, callback) {
|
|
2902
|
+
if (!this.handlers.has(event)) {
|
|
2903
|
+
this.handlers.set(event, /* @__PURE__ */ new Set());
|
|
2904
|
+
}
|
|
2905
|
+
this.handlers.get(event)?.add(callback);
|
|
2906
|
+
return {
|
|
2907
|
+
unsubscribe: () => this.unsubscribe(event, callback)
|
|
2908
|
+
};
|
|
2909
|
+
}
|
|
2910
|
+
unsubscribe(event, callback) {
|
|
2911
|
+
this.handlers.get(event)?.delete(callback);
|
|
2912
|
+
}
|
|
2913
|
+
async notify(event) {
|
|
2914
|
+
this.handlers.get(event.id)?.forEach((callback) => callback(event.data));
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
class FetchSettings {
|
|
2918
|
+
settingGateway;
|
|
2919
|
+
constructor() {
|
|
2920
|
+
this.settingGateway = Registry.getInstance().inject("settingGateway");
|
|
2921
|
+
}
|
|
2922
|
+
async execute() {
|
|
2923
|
+
const output = await this.settingGateway.fetch();
|
|
2924
|
+
return output;
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
class FetchModuleSettings {
|
|
2928
|
+
constructor() {
|
|
2929
|
+
}
|
|
2930
|
+
async execute(module2) {
|
|
2931
|
+
const fetchSettings = new FetchSettings();
|
|
2932
|
+
const outputFetchSettings = await fetchSettings.execute();
|
|
2933
|
+
const config2 = outputFetchSettings.find((setting) => setting.module === module2);
|
|
2934
|
+
if (!config2) throw new Error("Module not found: " + module2);
|
|
2935
|
+
return config2.settings;
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
class FetchSlugs {
|
|
2939
|
+
slugGateway;
|
|
2940
|
+
constructor() {
|
|
2941
|
+
this.slugGateway = Registry.getInstance().inject("slugGateway");
|
|
2942
|
+
}
|
|
2943
|
+
async execute(params = {}) {
|
|
2944
|
+
const result = await this.slugGateway.fetch(params);
|
|
2945
|
+
const output = result.map((data) => ({
|
|
2946
|
+
id: data.id,
|
|
2947
|
+
slug: data.slug,
|
|
2948
|
+
locale: data.locale,
|
|
2949
|
+
contentId: data.contentId,
|
|
2950
|
+
contentTitle: data.contentTitle,
|
|
2951
|
+
contentModel: data.contentModel,
|
|
2952
|
+
parentContentId: data.parentContentId,
|
|
2953
|
+
parentContentModel: data.parentContentModel
|
|
2954
|
+
}));
|
|
2955
|
+
return output;
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
class fetchTemplates {
|
|
2959
|
+
templateGateway;
|
|
2960
|
+
constructor() {
|
|
2961
|
+
this.templateGateway = Registry.getInstance().inject("templateGateway");
|
|
2962
|
+
}
|
|
2963
|
+
async execute() {
|
|
2964
|
+
const result = await this.templateGateway.fetch();
|
|
2965
|
+
const output = result.map((data) => ({
|
|
2966
|
+
id: data.id,
|
|
2967
|
+
documentId: data.documentId,
|
|
2968
|
+
uid: data.uid,
|
|
2969
|
+
name: data.name
|
|
2970
|
+
}));
|
|
2971
|
+
return output;
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
class fetchDocumentAttributes {
|
|
2975
|
+
attributeGateway;
|
|
2976
|
+
constructor() {
|
|
2977
|
+
this.attributeGateway = Registry.getInstance().inject("attributeGateway");
|
|
2978
|
+
}
|
|
2979
|
+
async execute(contentId, params = {}) {
|
|
2980
|
+
const result = await this.attributeGateway.fetchByContentId(contentId, params);
|
|
2981
|
+
const output = {
|
|
2982
|
+
id: result.id,
|
|
2983
|
+
locale: result.locale,
|
|
2984
|
+
contentId: result.contentId,
|
|
2985
|
+
contentModel: result.contentModel,
|
|
2986
|
+
parentContentId: result.parentContentId,
|
|
2987
|
+
parentContentModel: result.parentContentModel,
|
|
2988
|
+
templateId: result.templateId,
|
|
2989
|
+
priority: result.priority,
|
|
2990
|
+
frequency: result.frequency
|
|
2991
|
+
};
|
|
2992
|
+
return output;
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
class PageAttributeUpdated {
|
|
2996
|
+
constructor(data) {
|
|
2997
|
+
this.data = data;
|
|
2998
|
+
}
|
|
2999
|
+
id = "pageAttributeUpdated";
|
|
3000
|
+
static id = "pageAttributeUpdated";
|
|
3001
|
+
}
|
|
3002
|
+
class DocumentCustomFieldStarted {
|
|
3003
|
+
constructor(data) {
|
|
3004
|
+
this.data = data;
|
|
3005
|
+
}
|
|
3006
|
+
id = "documentCustomFieldStarted";
|
|
3007
|
+
static id = "documentCustomFieldStarted";
|
|
3008
|
+
}
|
|
3009
|
+
const DangerModal = ({ open, title, text, button }) => {
|
|
3010
|
+
const [hidden, setHidden] = React.useState(true);
|
|
3011
|
+
React.useEffect(() => {
|
|
3012
|
+
setHidden(!open);
|
|
3013
|
+
}, [open]);
|
|
3014
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: !hidden && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { defaultOpen: true, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
|
|
3015
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
|
|
3016
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { style: { textAlign: "center" }, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.WarningCircle, { fill: "danger600" }), children: text }),
|
|
3017
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Footer, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Action, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, variant: "danger-light", children: button }) }) })
|
|
3018
|
+
] }) }) });
|
|
3019
|
+
};
|
|
3020
|
+
const PageAttributesBox = ({ document }) => {
|
|
3021
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
3022
|
+
const location = reactRouterDom.useLocation();
|
|
3023
|
+
const { form } = admin.unstable_useContentManagerContext();
|
|
3024
|
+
const [selectedParent, setSelectedParent] = React__default.default.useState(-1);
|
|
3025
|
+
const [selectedTemplate, setSelectedTemplate] = React__default.default.useState(-1);
|
|
3026
|
+
const [selectedPriority, setSelectedPriority] = React__default.default.useState("no-priority");
|
|
3027
|
+
const [selectedFrequency, setSelectedFrequency] = React__default.default.useState("no-frequency");
|
|
3028
|
+
const [parents, setParents] = React__default.default.useState([]);
|
|
3029
|
+
const [templates, setTemplates] = React__default.default.useState([]);
|
|
3030
|
+
const [attributes, setAttributes] = React__default.default.useState();
|
|
3031
|
+
const [appSettings, setAppSettings] = React__default.default.useState();
|
|
3032
|
+
const [showDangerModal, setShowDangerModal] = React__default.default.useState(false);
|
|
3033
|
+
const [showBox, setShowBox] = React__default.default.useState(false);
|
|
3034
|
+
const [currentLocale, setCurrentLocale] = React__default.default.useState(getCurrentLocate());
|
|
3035
|
+
function getCurrentLocate() {
|
|
3036
|
+
const queryString = window.location.search.split("?")[1];
|
|
3037
|
+
const searchParams = new URLSearchParams(queryString);
|
|
3038
|
+
return searchParams.get("plugins[i18n][locale]");
|
|
3039
|
+
}
|
|
3040
|
+
function changeParentEvent(index2) {
|
|
3041
|
+
const parentContentId = index2 === -1 ? null : parents[index2].contentId;
|
|
3042
|
+
const parentContentModel = index2 === -1 ? null : parents[index2].contentModel;
|
|
3043
|
+
dispatchEvent("ltb_attribute_parent", parentContentId);
|
|
3044
|
+
dispatchEvent("ltb_attribute_parent_model", parentContentModel);
|
|
3045
|
+
setSelectedParent(index2);
|
|
3046
|
+
}
|
|
3047
|
+
function changeTemplateEvent(index2) {
|
|
3048
|
+
const templateId = index2 === -1 ? null : templates[index2].documentId;
|
|
3049
|
+
dispatchEvent("ltb_attribute_template", templateId);
|
|
3050
|
+
setSelectedTemplate(index2);
|
|
3051
|
+
}
|
|
3052
|
+
function changePriorityEvent(value) {
|
|
3053
|
+
const priority = value === "no-priority" ? null : value;
|
|
3054
|
+
dispatchEvent("ltb_attribute_priority", priority);
|
|
3055
|
+
setSelectedPriority(value);
|
|
3056
|
+
}
|
|
3057
|
+
function changeFrequencyEvent(value) {
|
|
3058
|
+
const frequency = value === "no-frequency" ? null : value;
|
|
3059
|
+
dispatchEvent("ltb_attribute_frequency", frequency);
|
|
3060
|
+
setSelectedFrequency(value);
|
|
3061
|
+
}
|
|
3062
|
+
function dispatchEvent(name, value) {
|
|
3063
|
+
const mockEvent = {
|
|
3064
|
+
target: { name, value }
|
|
3065
|
+
};
|
|
3066
|
+
form.onChange(mockEvent);
|
|
3067
|
+
}
|
|
3068
|
+
async function fectchAttributes() {
|
|
3069
|
+
if (document && document.documentId) {
|
|
3070
|
+
const fetchDocumentAttributes$1 = new fetchDocumentAttributes();
|
|
3071
|
+
const outputFetchDocumentAttributes = await fetchDocumentAttributes$1.execute(
|
|
3072
|
+
document.documentId,
|
|
3073
|
+
{
|
|
3074
|
+
locale: getCurrentLocate(),
|
|
3075
|
+
state: document.publishedAt ? "published" : "draft"
|
|
3076
|
+
}
|
|
3077
|
+
);
|
|
3078
|
+
setAttributes(outputFetchDocumentAttributes);
|
|
3079
|
+
}
|
|
3080
|
+
}
|
|
3081
|
+
async function fetchParents() {
|
|
3082
|
+
const fetchSlugs = new FetchSlugs();
|
|
3083
|
+
const outputFetchSlugs = await fetchSlugs.execute({ locale: getCurrentLocate() });
|
|
3084
|
+
const filteredParents = [];
|
|
3085
|
+
outputFetchSlugs.forEach((parent) => {
|
|
3086
|
+
if (!document || parent.contentId !== document.documentId) {
|
|
3087
|
+
filteredParents.push(parent);
|
|
3088
|
+
}
|
|
3089
|
+
});
|
|
3090
|
+
setParents(filteredParents);
|
|
3091
|
+
}
|
|
3092
|
+
async function fetchTemplates$1() {
|
|
3093
|
+
const fetchTemplates2 = new fetchTemplates();
|
|
3094
|
+
const outputFetchSlugs = await fetchTemplates2.execute();
|
|
3095
|
+
setTemplates(outputFetchSlugs);
|
|
3096
|
+
}
|
|
3097
|
+
function buildPath(selectedIndex) {
|
|
3098
|
+
const slugs = [];
|
|
3099
|
+
function findParentRecursively(index2) {
|
|
3100
|
+
const currentItem = parents[index2];
|
|
3101
|
+
slugs.unshift(currentItem.slug);
|
|
3102
|
+
if (currentItem.parentContentId && currentItem.parentContentModel) {
|
|
3103
|
+
const parentIndex = parents.findIndex(
|
|
3104
|
+
(item) => item.contentId === currentItem.parentContentId && item.contentModel === currentItem.parentContentModel
|
|
3105
|
+
);
|
|
3106
|
+
if (parentIndex !== -1) {
|
|
3107
|
+
findParentRecursively(parentIndex);
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
findParentRecursively(selectedIndex);
|
|
3112
|
+
return slugs.join("/");
|
|
3113
|
+
}
|
|
3114
|
+
async function fetchSettings() {
|
|
3115
|
+
const fetchModuleSettings = new FetchModuleSettings();
|
|
3116
|
+
const settings = await fetchModuleSettings.execute("attribute");
|
|
3117
|
+
setAppSettings(settings);
|
|
3118
|
+
}
|
|
3119
|
+
React__default.default.useEffect(() => {
|
|
3120
|
+
if (attributes) {
|
|
3121
|
+
if (parents) {
|
|
3122
|
+
const index2 = parents.findIndex(
|
|
3123
|
+
(p) => p.contentId === attributes.parentContentId && p.contentModel === attributes.parentContentModel
|
|
3124
|
+
);
|
|
3125
|
+
const showModal = index2 === -1 && attributes && attributes.parentContentId ? true : false;
|
|
3126
|
+
setSelectedParent(index2);
|
|
3127
|
+
setShowDangerModal(showModal);
|
|
3128
|
+
}
|
|
3129
|
+
if (templates) {
|
|
3130
|
+
const index2 = templates.findIndex(
|
|
3131
|
+
(t) => t.documentId === attributes.templateId
|
|
3132
|
+
);
|
|
3133
|
+
setSelectedTemplate(index2);
|
|
3134
|
+
}
|
|
3135
|
+
setSelectedPriority(attributes.priority || "no-priority");
|
|
3136
|
+
setSelectedFrequency(attributes.frequency || "no-frequency");
|
|
3137
|
+
}
|
|
3138
|
+
}, [templates, parents, attributes]);
|
|
3139
|
+
React__default.default.useEffect(() => {
|
|
3140
|
+
if (parents.length > 0) {
|
|
3141
|
+
const value = selectedParent === -1 ? "" : buildPath(selectedParent);
|
|
3142
|
+
const mediator = Registry.getInstance().inject("mediator");
|
|
3143
|
+
mediator.notify(new PageAttributeUpdated({ parentSlug: value }));
|
|
3144
|
+
}
|
|
3145
|
+
}, [selectedParent, parents]);
|
|
3146
|
+
React__default.default.useEffect(() => {
|
|
3147
|
+
fectchAttributes();
|
|
3148
|
+
fetchTemplates$1();
|
|
3149
|
+
fetchParents();
|
|
3150
|
+
}, [location]);
|
|
3151
|
+
React__default.default.useEffect(() => {
|
|
3152
|
+
const subscription = Registry.getInstance().inject("mediator").subscribe(DocumentCustomFieldStarted.id, () => {
|
|
3153
|
+
setShowBox(true);
|
|
3154
|
+
});
|
|
3155
|
+
fetchSettings();
|
|
3156
|
+
return () => subscription.unsubscribe();
|
|
3157
|
+
}, []);
|
|
3158
|
+
if (!showBox || !currentLocale) return null;
|
|
3159
|
+
if (!appSettings || appSettings && !appSettings.active) return null;
|
|
3160
|
+
return {
|
|
3161
|
+
title: formatMessage({
|
|
3162
|
+
id: getTranslation(`module.${config.uuid.modules.attribute}.panel.title`),
|
|
3163
|
+
defaultMessage: "Page Attributes"
|
|
3164
|
+
}),
|
|
3165
|
+
content: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3166
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { display: "flex", style: { flexDirection: "column", width: "100%" }, children: [
|
|
3167
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", style: { marginTop: "5px", marginBottom: "6px" }, children: formatMessage({
|
|
3168
|
+
id: getTranslation(`module.${config.uuid.modules.attribute}.panel.parent.title`),
|
|
3169
|
+
defaultMessage: "Parent"
|
|
3170
|
+
}) }),
|
|
3171
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3172
|
+
designSystem.SingleSelect,
|
|
3173
|
+
{
|
|
3174
|
+
onChange: changeParentEvent,
|
|
3175
|
+
value: selectedParent,
|
|
3176
|
+
disabled: form.isSubmitting || form.disabled,
|
|
3177
|
+
children: [
|
|
3178
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: -1, children: formatMessage({
|
|
3179
|
+
id: getTranslation(`module.${config.uuid.modules.attribute}.panel.parent.default`),
|
|
3180
|
+
defaultMessage: "No parent"
|
|
3181
|
+
}) }),
|
|
3182
|
+
parents.map((parent, index2) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: index2, children: parent.contentTitle }, index2))
|
|
3183
|
+
]
|
|
3184
|
+
}
|
|
3185
|
+
),
|
|
3186
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", style: { marginTop: "20px", marginBottom: "6px" }, children: formatMessage({
|
|
3187
|
+
id: getTranslation(`module.${config.uuid.modules.attribute}.panel.attribute.title`),
|
|
3188
|
+
defaultMessage: "Template"
|
|
3189
|
+
}) }),
|
|
3190
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3191
|
+
designSystem.SingleSelect,
|
|
3192
|
+
{
|
|
3193
|
+
onChange: changeTemplateEvent,
|
|
3194
|
+
value: selectedTemplate,
|
|
3195
|
+
disabled: form.isSubmitting || form.disabled,
|
|
3196
|
+
children: [
|
|
3197
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: -1, children: formatMessage({
|
|
3198
|
+
id: getTranslation(
|
|
3199
|
+
`module.${config.uuid.modules.attribute}.panel.template.default`
|
|
3200
|
+
),
|
|
3201
|
+
defaultMessage: "No template"
|
|
3202
|
+
}) }),
|
|
3203
|
+
templates.map((template, index2) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: index2, children: template.name }, index2))
|
|
3204
|
+
]
|
|
3205
|
+
}
|
|
3206
|
+
),
|
|
3207
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", style: { marginTop: "20px", marginBottom: "6px" }, children: formatMessage({
|
|
3208
|
+
id: getTranslation(
|
|
3209
|
+
`module.${config.uuid.modules.attribute}.panel.attribute.sitemap.priority`
|
|
3210
|
+
),
|
|
3211
|
+
defaultMessage: "Priority"
|
|
3212
|
+
}) }),
|
|
3213
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3214
|
+
designSystem.SingleSelect,
|
|
3215
|
+
{
|
|
3216
|
+
onChange: changePriorityEvent,
|
|
3217
|
+
value: selectedPriority,
|
|
3218
|
+
disabled: form.isSubmitting || form.disabled,
|
|
3219
|
+
children: [
|
|
3220
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "no-priority", children: formatMessage({
|
|
3221
|
+
id: getTranslation(
|
|
3222
|
+
`module.${config.uuid.modules.attribute}.panel.priority.default`
|
|
3223
|
+
),
|
|
3224
|
+
defaultMessage: "No priority"
|
|
3225
|
+
}) }),
|
|
3226
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "0.0", children: "0.0" }),
|
|
3227
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "0.1", children: "0.1" }),
|
|
3228
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "0.2", children: "0.2" }),
|
|
3229
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "0.3", children: "0.3" }),
|
|
3230
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "0.4", children: "0.4" }),
|
|
3231
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "0.5", children: "0.5" }),
|
|
3232
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "0.6", children: "0.6" }),
|
|
3233
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "0.7", children: "0.7" }),
|
|
3234
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "0.8", children: "0.8" }),
|
|
3235
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "0.9", children: "0.9" }),
|
|
3236
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "1.0", children: "1.0" })
|
|
3237
|
+
]
|
|
3238
|
+
}
|
|
3239
|
+
),
|
|
3240
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", style: { marginTop: "20px", marginBottom: "6px" }, children: formatMessage({
|
|
3241
|
+
id: getTranslation(
|
|
3242
|
+
`module.${config.uuid.modules.attribute}.panel.attribute.sitemap.frequency`
|
|
3243
|
+
),
|
|
3244
|
+
defaultMessage: "Change Frequency"
|
|
3245
|
+
}) }),
|
|
3246
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3247
|
+
designSystem.SingleSelect,
|
|
3248
|
+
{
|
|
3249
|
+
onChange: changeFrequencyEvent,
|
|
3250
|
+
value: selectedFrequency,
|
|
3251
|
+
disabled: form.isSubmitting || form.disabled,
|
|
3252
|
+
children: [
|
|
3253
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "no-frequency", children: formatMessage({
|
|
3254
|
+
id: getTranslation(
|
|
3255
|
+
`module.${config.uuid.modules.attribute}.panel.frequency.default`
|
|
3256
|
+
),
|
|
3257
|
+
defaultMessage: "No frequency"
|
|
3258
|
+
}) }),
|
|
3259
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "always", children: "Always" }),
|
|
3260
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "hourly", children: "Hourly" }),
|
|
3261
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "daily", children: "Daily" }),
|
|
3262
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "weekly", children: "Weekly" }),
|
|
3263
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "monthly", children: "Monthly" }),
|
|
3264
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "yearly", children: "Yearly" }),
|
|
3265
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "never", children: "Never" })
|
|
3266
|
+
]
|
|
3267
|
+
}
|
|
3268
|
+
)
|
|
3269
|
+
] }),
|
|
3270
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3271
|
+
DangerModal,
|
|
3272
|
+
{
|
|
3273
|
+
open: showDangerModal,
|
|
3274
|
+
title: formatMessage({
|
|
3275
|
+
id: getTranslation(
|
|
3276
|
+
`module.${config.uuid.modules.attribute}.panel.attribute.parent-not-found.title`
|
|
3277
|
+
),
|
|
3278
|
+
defaultMessage: "Page Attributes"
|
|
3279
|
+
}),
|
|
3280
|
+
text: formatMessage({
|
|
3281
|
+
id: getTranslation(
|
|
3282
|
+
`module.${config.uuid.modules.attribute}.panel.attribute.parent-not-found.text`
|
|
3283
|
+
),
|
|
3284
|
+
defaultMessage: "The parent no longer exists or is not active. Please select a valid parent."
|
|
3285
|
+
}),
|
|
3286
|
+
button: formatMessage({
|
|
3287
|
+
id: getTranslation(
|
|
3288
|
+
`module.${config.uuid.modules.attribute}.panel.attribute.parent-not-found.button`
|
|
3289
|
+
),
|
|
3290
|
+
defaultMessage: "Ok, I will fix it"
|
|
3291
|
+
})
|
|
3292
|
+
}
|
|
3293
|
+
)
|
|
3294
|
+
] })
|
|
3295
|
+
};
|
|
3296
|
+
};
|
|
3297
|
+
const index = {
|
|
3298
|
+
async register(app) {
|
|
3299
|
+
app.addMenuLink({
|
|
3300
|
+
to: `plugins/${config.pluginId}`,
|
|
3301
|
+
icon: PluginIcon,
|
|
3302
|
+
intlLabel: {
|
|
3303
|
+
id: `${config.pluginId}.app.name`,
|
|
3304
|
+
defaultMessage: config.pluginId
|
|
3305
|
+
},
|
|
3306
|
+
position: 999,
|
|
3307
|
+
Component: () => Promise.resolve().then(() => require("./App-DUrW4zBW.js"))
|
|
3308
|
+
});
|
|
3309
|
+
app.customFields.register({
|
|
3310
|
+
name: "ltbslug",
|
|
3311
|
+
pluginId: config.pluginId,
|
|
3312
|
+
type: "string",
|
|
3313
|
+
intlLabel: {
|
|
3314
|
+
id: getTranslation(`module.${config.uuid.modules.slug}.field.slug.label`),
|
|
3315
|
+
defaultMessage: "Littlebox Strapi Slug"
|
|
3316
|
+
},
|
|
3317
|
+
intlDescription: {
|
|
3318
|
+
id: getTranslation(`module.${config.uuid.modules.slug}.field.slug.description`),
|
|
3319
|
+
defaultMessage: "Generates custom slug"
|
|
3320
|
+
},
|
|
3321
|
+
icon: PluginIcon,
|
|
3322
|
+
components: {
|
|
3323
|
+
Input: async () => Promise.resolve().then(() => require(
|
|
3324
|
+
/* webpackChunkName: "input-slug-component" */
|
|
3325
|
+
"./SlugInput-CxxShxb6.js"
|
|
3326
|
+
))
|
|
3327
|
+
},
|
|
3328
|
+
options: {
|
|
3329
|
+
base: [
|
|
3330
|
+
{
|
|
3331
|
+
intlLabel: {
|
|
3332
|
+
id: getTranslation(`module.${config.uuid.modules.slug}.field.slug.target`),
|
|
3333
|
+
defaultMessage: "Attached field"
|
|
3334
|
+
},
|
|
3335
|
+
name: "options.targetField",
|
|
3336
|
+
type: "select",
|
|
3337
|
+
description: {
|
|
3338
|
+
id: getTranslation(`module.${config.uuid.modules.slug}.field.slug.target.description`),
|
|
3339
|
+
defaultMessage: "You must create the “title” field"
|
|
3340
|
+
},
|
|
3341
|
+
options: [
|
|
3342
|
+
{
|
|
3343
|
+
key: "__null_reset_value__",
|
|
3344
|
+
value: "",
|
|
3345
|
+
metadatas: { intlLabel: { id: "global.none", defaultMessage: "None" } }
|
|
3346
|
+
},
|
|
3347
|
+
{
|
|
3348
|
+
key: "title",
|
|
3349
|
+
value: "title",
|
|
3350
|
+
metadatas: {
|
|
3351
|
+
intlLabel: { id: `title.no-override`, defaultMessage: "Title" }
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
]
|
|
3355
|
+
}
|
|
3356
|
+
],
|
|
3357
|
+
advanced: [],
|
|
3358
|
+
validator: (args) => ({
|
|
3359
|
+
targetField: create().required({
|
|
3360
|
+
id: getTranslation(`module.${config.uuid.modules.slug}.field.slug.target.error`),
|
|
3361
|
+
defaultMessage: "The target field is required"
|
|
3362
|
+
})
|
|
3363
|
+
})
|
|
3364
|
+
}
|
|
3365
|
+
});
|
|
3366
|
+
app.registerPlugin({
|
|
3367
|
+
id: config.pluginId,
|
|
3368
|
+
initializer: Initializer,
|
|
3369
|
+
isReady: false,
|
|
3370
|
+
name: config.pluginId
|
|
3371
|
+
});
|
|
3372
|
+
},
|
|
3373
|
+
async registerTrads({ locales }) {
|
|
3374
|
+
return Promise.all(
|
|
3375
|
+
locales.map(async (locale) => {
|
|
3376
|
+
try {
|
|
3377
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./core/translations/en.json": () => Promise.resolve().then(() => require("./en-Bz6GsXYT.js")) }), `./core/translations/${locale}.json`, 4);
|
|
3378
|
+
return { data, locale };
|
|
3379
|
+
} catch {
|
|
3380
|
+
return { data: {}, locale };
|
|
3381
|
+
}
|
|
3382
|
+
})
|
|
3383
|
+
);
|
|
3384
|
+
},
|
|
3385
|
+
bootstrap(app) {
|
|
3386
|
+
Registry.getInstance().provide("mediator", new Mediator());
|
|
3387
|
+
Registry.getInstance().provide("httpClient", new StrapiAdapter());
|
|
3388
|
+
Registry.getInstance().provide("settingGateway", new SettingGatewayHttp());
|
|
3389
|
+
Registry.getInstance().provide("localeGateway", new LocaleGatewayHttp());
|
|
3390
|
+
Registry.getInstance().provide("slugGateway", new SlugGatewayHttp());
|
|
3391
|
+
Registry.getInstance().provide("attributeGateway", new AttributeGatewayHttp());
|
|
3392
|
+
Registry.getInstance().provide("templateGateway", new TemplateGatewayHttp());
|
|
3393
|
+
Registry.getInstance().provide("menuGateway", new MenuGatewayHttp());
|
|
3394
|
+
Registry.getInstance().provide("parameterGateway", new ParameterGatewayHttp());
|
|
3395
|
+
Registry.getInstance().provide("translationGateway", new TranslationGatewayHttp());
|
|
3396
|
+
app.getPlugin("content-manager").apis.addEditViewSidePanel([PageAttributesBox]);
|
|
3397
|
+
}
|
|
3398
|
+
};
|
|
3399
|
+
exports.DocumentCustomFieldStarted = DocumentCustomFieldStarted;
|
|
3400
|
+
exports.FetchModuleSettings = FetchModuleSettings;
|
|
3401
|
+
exports.FetchSettings = FetchSettings;
|
|
3402
|
+
exports.FetchSlugs = FetchSlugs;
|
|
3403
|
+
exports.PageAttributeUpdated = PageAttributeUpdated;
|
|
3404
|
+
exports.PluginIcon = PluginIcon;
|
|
3405
|
+
exports.Registry = Registry;
|
|
3406
|
+
exports.config = config;
|
|
3407
|
+
exports.fetchTemplates = fetchTemplates;
|
|
3408
|
+
exports.getTranslation = getTranslation;
|
|
3409
|
+
exports.index = index;
|