@_sh/strapi-plugin-ckeditor 4.0.3 → 4.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +50 -31
  2. package/dist/_chunks/index--3qOEhDs.js +1259 -0
  3. package/dist/_chunks/index--3qOEhDs.js.map +1 -0
  4. package/dist/_chunks/index-4_OA7OAk.mjs +3619 -0
  5. package/dist/_chunks/index-4_OA7OAk.mjs.map +1 -0
  6. package/dist/_chunks/index-B4B_N_mT.js +1258 -0
  7. package/dist/_chunks/index-B4B_N_mT.js.map +1 -0
  8. package/dist/_chunks/index-B4zdHWmd.mjs +3628 -0
  9. package/dist/_chunks/index-B4zdHWmd.mjs.map +1 -0
  10. package/dist/_chunks/index-BAHV4Rit.mjs +18576 -0
  11. package/dist/_chunks/index-BAHV4Rit.mjs.map +1 -0
  12. package/dist/_chunks/index-BGnC47NY.js +1262 -0
  13. package/dist/_chunks/index-BGnC47NY.js.map +1 -0
  14. package/dist/_chunks/index-BIS1Nqu7.js +3647 -0
  15. package/dist/_chunks/index-BIS1Nqu7.js.map +1 -0
  16. package/dist/_chunks/index-BLPYcRSY.js +1259 -0
  17. package/dist/_chunks/index-BLPYcRSY.js.map +1 -0
  18. package/dist/_chunks/index-BQjPOiyH.mjs +1216 -0
  19. package/dist/_chunks/index-BQjPOiyH.mjs.map +1 -0
  20. package/dist/_chunks/index-BR1nmvVi.js +3647 -0
  21. package/dist/_chunks/index-BR1nmvVi.js.map +1 -0
  22. package/dist/_chunks/index-BUJ77Z7_.js +3647 -0
  23. package/dist/_chunks/index-BUJ77Z7_.js.map +1 -0
  24. package/dist/_chunks/index-BYwVUqR0.mjs +1216 -0
  25. package/dist/_chunks/index-BYwVUqR0.mjs.map +1 -0
  26. package/dist/_chunks/index-Bax19OtQ.mjs +3628 -0
  27. package/dist/_chunks/index-Bax19OtQ.mjs.map +1 -0
  28. package/dist/_chunks/index-BeTiFY5i.mjs +1215 -0
  29. package/dist/_chunks/index-BeTiFY5i.mjs.map +1 -0
  30. package/dist/_chunks/index-Bg8cqHJ2.js +3647 -0
  31. package/dist/_chunks/index-Bg8cqHJ2.js.map +1 -0
  32. package/dist/_chunks/index-Brt7PGzp.js +1258 -0
  33. package/dist/_chunks/index-Brt7PGzp.js.map +1 -0
  34. package/dist/_chunks/index-BuhTp-Sa.js +3647 -0
  35. package/dist/_chunks/index-BuhTp-Sa.js.map +1 -0
  36. package/dist/_chunks/index-BwKsnFO2.js +3647 -0
  37. package/dist/_chunks/index-BwKsnFO2.js.map +1 -0
  38. package/dist/_chunks/index-C4tb1DCd.mjs +1216 -0
  39. package/dist/_chunks/index-C4tb1DCd.mjs.map +1 -0
  40. package/dist/_chunks/index-C8KlcqmI.js +1258 -0
  41. package/dist/_chunks/index-C8KlcqmI.js.map +1 -0
  42. package/dist/_chunks/index-CCbtpGDB.mjs +3628 -0
  43. package/dist/_chunks/index-CCbtpGDB.mjs.map +1 -0
  44. package/dist/_chunks/index-CCc7pa2n.mjs +1215 -0
  45. package/dist/_chunks/index-CCc7pa2n.mjs.map +1 -0
  46. package/dist/_chunks/index-CE1EfY8M.js +3647 -0
  47. package/dist/_chunks/index-CE1EfY8M.js.map +1 -0
  48. package/dist/_chunks/index-CHDy_Zj7.mjs +1218 -0
  49. package/dist/_chunks/index-CHDy_Zj7.mjs.map +1 -0
  50. package/dist/_chunks/index-CM0RbkHm.js +3647 -0
  51. package/dist/_chunks/index-CM0RbkHm.js.map +1 -0
  52. package/dist/_chunks/index-CM0nD5cx.mjs +3628 -0
  53. package/dist/_chunks/index-CM0nD5cx.mjs.map +1 -0
  54. package/dist/_chunks/index-CMjpzY3E.js +3647 -0
  55. package/dist/_chunks/index-CMjpzY3E.js.map +1 -0
  56. package/dist/_chunks/index-COsQBkeK.mjs +1218 -0
  57. package/dist/_chunks/index-COsQBkeK.mjs.map +1 -0
  58. package/dist/_chunks/index-Ca1QQCiz.js +1263 -0
  59. package/dist/_chunks/index-Ca1QQCiz.js.map +1 -0
  60. package/dist/_chunks/index-Ca4wvrZM.js +1259 -0
  61. package/dist/_chunks/index-Ca4wvrZM.js.map +1 -0
  62. package/dist/_chunks/index-Cdm3BByz.mjs +3628 -0
  63. package/dist/_chunks/index-Cdm3BByz.mjs.map +1 -0
  64. package/dist/_chunks/index-Cfur1BcK.js +3647 -0
  65. package/dist/_chunks/index-Cfur1BcK.js.map +1 -0
  66. package/dist/_chunks/index-CkPQxfao.js +3647 -0
  67. package/dist/_chunks/index-CkPQxfao.js.map +1 -0
  68. package/dist/_chunks/index-CljfdYqm.mjs +1215 -0
  69. package/dist/_chunks/index-CljfdYqm.mjs.map +1 -0
  70. package/dist/_chunks/index-CoP42qaj.mjs +3628 -0
  71. package/dist/_chunks/index-CoP42qaj.mjs.map +1 -0
  72. package/dist/_chunks/index-CsyJ1GEi.js +3647 -0
  73. package/dist/_chunks/index-CsyJ1GEi.js.map +1 -0
  74. package/dist/_chunks/index-Ctd06mAS.js +1262 -0
  75. package/dist/_chunks/index-Ctd06mAS.js.map +1 -0
  76. package/dist/_chunks/index-Cvt-1fPJ.js +1258 -0
  77. package/dist/_chunks/index-Cvt-1fPJ.js.map +1 -0
  78. package/dist/_chunks/index-D-VjUqfk.js +1261 -0
  79. package/dist/_chunks/index-D-VjUqfk.js.map +1 -0
  80. package/dist/_chunks/index-D2eyzVJY.js +3647 -0
  81. package/dist/_chunks/index-D2eyzVJY.js.map +1 -0
  82. package/dist/_chunks/index-D46R-0q1.mjs +3628 -0
  83. package/dist/_chunks/index-D46R-0q1.mjs.map +1 -0
  84. package/dist/_chunks/index-DAzJ2oQj.js +4478 -0
  85. package/dist/_chunks/index-DAzJ2oQj.js.map +1 -0
  86. package/dist/_chunks/index-DE9sNFWe.js +1259 -0
  87. package/dist/_chunks/index-DE9sNFWe.js.map +1 -0
  88. package/dist/_chunks/index-DIj8vs42.mjs +1216 -0
  89. package/dist/_chunks/index-DIj8vs42.mjs.map +1 -0
  90. package/dist/_chunks/index-DNyJV04U.mjs +3628 -0
  91. package/dist/_chunks/index-DNyJV04U.mjs.map +1 -0
  92. package/dist/_chunks/index-DQmrEgPx.js +18620 -0
  93. package/dist/_chunks/index-DQmrEgPx.js.map +1 -0
  94. package/dist/_chunks/index-DSlMiMu4.mjs +1220 -0
  95. package/dist/_chunks/index-DSlMiMu4.mjs.map +1 -0
  96. package/dist/_chunks/index-DT7Ak3-R.js +3647 -0
  97. package/dist/_chunks/index-DT7Ak3-R.js.map +1 -0
  98. package/dist/_chunks/index-DX33_u0y.mjs +4459 -0
  99. package/dist/_chunks/index-DX33_u0y.mjs.map +1 -0
  100. package/dist/_chunks/index-DXiBhR_A.mjs +1216 -0
  101. package/dist/_chunks/index-DXiBhR_A.mjs.map +1 -0
  102. package/dist/_chunks/index-De1440YT.mjs +1220 -0
  103. package/dist/_chunks/index-De1440YT.mjs.map +1 -0
  104. package/dist/_chunks/index-DlZJKzF7.mjs +3628 -0
  105. package/dist/_chunks/index-DlZJKzF7.mjs.map +1 -0
  106. package/dist/_chunks/index-DsBSAoVd.mjs +1219 -0
  107. package/dist/_chunks/index-DsBSAoVd.mjs.map +1 -0
  108. package/dist/_chunks/index-DsrBTgAz.js +1259 -0
  109. package/dist/_chunks/index-DsrBTgAz.js.map +1 -0
  110. package/dist/_chunks/index-DtLPKm0j.js +1261 -0
  111. package/dist/_chunks/index-DtLPKm0j.js.map +1 -0
  112. package/dist/_chunks/index-DvQaV8xI.js +1259 -0
  113. package/dist/_chunks/index-DvQaV8xI.js.map +1 -0
  114. package/dist/_chunks/index-HTyR006C.mjs +3628 -0
  115. package/dist/_chunks/index-HTyR006C.mjs.map +1 -0
  116. package/dist/_chunks/index-L3hEYnIb.mjs +1215 -0
  117. package/dist/_chunks/index-L3hEYnIb.mjs.map +1 -0
  118. package/dist/_chunks/index-REEaVbcH.mjs +1216 -0
  119. package/dist/_chunks/index-REEaVbcH.mjs.map +1 -0
  120. package/dist/_chunks/index-S6wjiYIP.mjs +3628 -0
  121. package/dist/_chunks/index-S6wjiYIP.mjs.map +1 -0
  122. package/dist/_chunks/index-T5WTRwuT.mjs +3628 -0
  123. package/dist/_chunks/index-T5WTRwuT.mjs.map +1 -0
  124. package/dist/_chunks/index-W1DBUCcJ.js +1263 -0
  125. package/dist/_chunks/index-W1DBUCcJ.js.map +1 -0
  126. package/dist/_chunks/index-Y47yaZuA.mjs +3628 -0
  127. package/dist/_chunks/index-Y47yaZuA.mjs.map +1 -0
  128. package/dist/_chunks/index-YL7umCmx.mjs +1219 -0
  129. package/dist/_chunks/index-YL7umCmx.mjs.map +1 -0
  130. package/dist/_chunks/index-ZQQxP6CG.js +3638 -0
  131. package/dist/_chunks/index-ZQQxP6CG.js.map +1 -0
  132. package/dist/_chunks/index-jOXX9Ffc.mjs +3628 -0
  133. package/dist/_chunks/index-jOXX9Ffc.mjs.map +1 -0
  134. package/dist/_chunks/index-oj72y8-P.js +3647 -0
  135. package/dist/_chunks/index-oj72y8-P.js.map +1 -0
  136. package/dist/_chunks/index-y2orvMVy.mjs +3628 -0
  137. package/dist/_chunks/index-y2orvMVy.mjs.map +1 -0
  138. package/dist/admin/index.js +1 -1
  139. package/dist/admin/index.mjs +1 -1
  140. package/dist/server/index.js +1 -1
  141. package/dist/server/index.mjs +1 -1
  142. package/package.json +1 -1
@@ -0,0 +1,4478 @@
1
+ "use strict";
2
+ require("react");
3
+ const cke = require("ckeditor5");
4
+ const sanitizeHtml = require("sanitize-html");
5
+ const jsxRuntime = require("react/jsx-runtime");
6
+ const styled = require("styled-components");
7
+ const designSystem = require("@strapi/design-system");
8
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule)
11
+ return e;
12
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
13
+ if (e) {
14
+ for (const k in e) {
15
+ if (k !== "default") {
16
+ const d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: () => e[k]
20
+ });
21
+ }
22
+ }
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+ const cke__namespace = /* @__PURE__ */ _interopNamespace(cke);
28
+ const sanitizeHtml__default = /* @__PURE__ */ _interopDefault(sanitizeHtml);
29
+ var map;
30
+ try {
31
+ map = Map;
32
+ } catch (_) {
33
+ }
34
+ var set;
35
+ try {
36
+ set = Set;
37
+ } catch (_) {
38
+ }
39
+ function baseClone(src, circulars, clones) {
40
+ if (!src || typeof src !== "object" || typeof src === "function") {
41
+ return src;
42
+ }
43
+ if (src.nodeType && "cloneNode" in src) {
44
+ return src.cloneNode(true);
45
+ }
46
+ if (src instanceof Date) {
47
+ return new Date(src.getTime());
48
+ }
49
+ if (src instanceof RegExp) {
50
+ return new RegExp(src);
51
+ }
52
+ if (Array.isArray(src)) {
53
+ return src.map(clone);
54
+ }
55
+ if (map && src instanceof map) {
56
+ return new Map(Array.from(src.entries()));
57
+ }
58
+ if (set && src instanceof set) {
59
+ return new Set(Array.from(src.values()));
60
+ }
61
+ if (src instanceof Object) {
62
+ circulars.push(src);
63
+ var obj = Object.create(src);
64
+ clones.push(obj);
65
+ for (var key in src) {
66
+ var idx = circulars.findIndex(function(i) {
67
+ return i === src[key];
68
+ });
69
+ obj[key] = idx > -1 ? clones[idx] : baseClone(src[key], circulars, clones);
70
+ }
71
+ return obj;
72
+ }
73
+ return src;
74
+ }
75
+ function clone(src) {
76
+ return baseClone(src, [], []);
77
+ }
78
+ const toString$6 = Object.prototype.toString;
79
+ const errorToString = Error.prototype.toString;
80
+ const regExpToString = RegExp.prototype.toString;
81
+ const symbolToString$1 = typeof Symbol !== "undefined" ? Symbol.prototype.toString : () => "";
82
+ const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
83
+ function printNumber(val) {
84
+ if (val != +val)
85
+ return "NaN";
86
+ const isNegativeZero = val === 0 && 1 / val < 0;
87
+ return isNegativeZero ? "-0" : "" + val;
88
+ }
89
+ function printSimpleValue(val, quoteStrings = false) {
90
+ if (val == null || val === true || val === false)
91
+ return "" + val;
92
+ const typeOf = typeof val;
93
+ if (typeOf === "number")
94
+ return printNumber(val);
95
+ if (typeOf === "string")
96
+ return quoteStrings ? `"${val}"` : val;
97
+ if (typeOf === "function")
98
+ return "[Function " + (val.name || "anonymous") + "]";
99
+ if (typeOf === "symbol")
100
+ return symbolToString$1.call(val).replace(SYMBOL_REGEXP, "Symbol($1)");
101
+ const tag = toString$6.call(val).slice(8, -1);
102
+ if (tag === "Date")
103
+ return isNaN(val.getTime()) ? "" + val : val.toISOString(val);
104
+ if (tag === "Error" || val instanceof Error)
105
+ return "[" + errorToString.call(val) + "]";
106
+ if (tag === "RegExp")
107
+ return regExpToString.call(val);
108
+ return null;
109
+ }
110
+ function printValue(value, quoteStrings) {
111
+ let result = printSimpleValue(value, quoteStrings);
112
+ if (result !== null)
113
+ return result;
114
+ return JSON.stringify(value, function(key, value2) {
115
+ let result2 = printSimpleValue(this[key], quoteStrings);
116
+ if (result2 !== null)
117
+ return result2;
118
+ return value2;
119
+ }, 2);
120
+ }
121
+ let mixed = {
122
+ default: "${path} is invalid",
123
+ required: "${path} is a required field",
124
+ oneOf: "${path} must be one of the following values: ${values}",
125
+ notOneOf: "${path} must not be one of the following values: ${values}",
126
+ notType: ({
127
+ path,
128
+ type,
129
+ value,
130
+ originalValue
131
+ }) => {
132
+ let isCast = originalValue != null && originalValue !== value;
133
+ let msg = `${path} must be a \`${type}\` type, but the final value was: \`${printValue(value, true)}\`` + (isCast ? ` (cast from the value \`${printValue(originalValue, true)}\`).` : ".");
134
+ if (value === null) {
135
+ msg += `
136
+ If "null" is intended as an empty value be sure to mark the schema as \`.nullable()\``;
137
+ }
138
+ return msg;
139
+ },
140
+ defined: "${path} must be defined"
141
+ };
142
+ let string = {
143
+ length: "${path} must be exactly ${length} characters",
144
+ min: "${path} must be at least ${min} characters",
145
+ max: "${path} must be at most ${max} characters",
146
+ matches: '${path} must match the following: "${regex}"',
147
+ email: "${path} must be a valid email",
148
+ url: "${path} must be a valid URL",
149
+ uuid: "${path} must be a valid UUID",
150
+ trim: "${path} must be a trimmed string",
151
+ lowercase: "${path} must be a lowercase string",
152
+ uppercase: "${path} must be a upper case string"
153
+ };
154
+ let number = {
155
+ min: "${path} must be greater than or equal to ${min}",
156
+ max: "${path} must be less than or equal to ${max}",
157
+ lessThan: "${path} must be less than ${less}",
158
+ moreThan: "${path} must be greater than ${more}",
159
+ positive: "${path} must be a positive number",
160
+ negative: "${path} must be a negative number",
161
+ integer: "${path} must be an integer"
162
+ };
163
+ let date = {
164
+ min: "${path} field must be later than ${min}",
165
+ max: "${path} field must be at earlier than ${max}"
166
+ };
167
+ let boolean = {
168
+ isValue: "${path} field must be ${value}"
169
+ };
170
+ let object = {
171
+ noUnknown: "${path} field has unspecified keys: ${unknown}"
172
+ };
173
+ let array = {
174
+ min: "${path} field must have at least ${min} items",
175
+ max: "${path} field must have less than or equal to ${max} items",
176
+ length: "${path} must be have ${length} items"
177
+ };
178
+ Object.assign(/* @__PURE__ */ Object.create(null), {
179
+ mixed,
180
+ string,
181
+ number,
182
+ date,
183
+ object,
184
+ array,
185
+ boolean
186
+ });
187
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
188
+ function getDefaultExportFromCjs(x) {
189
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
190
+ }
191
+ function getAugmentedNamespace(n) {
192
+ if (n.__esModule)
193
+ return n;
194
+ var f = n.default;
195
+ if (typeof f == "function") {
196
+ var a = function a2() {
197
+ if (this instanceof a2) {
198
+ return Reflect.construct(f, arguments, this.constructor);
199
+ }
200
+ return f.apply(this, arguments);
201
+ };
202
+ a.prototype = f.prototype;
203
+ } else
204
+ a = {};
205
+ Object.defineProperty(a, "__esModule", { value: true });
206
+ Object.keys(n).forEach(function(k) {
207
+ var d = Object.getOwnPropertyDescriptor(n, k);
208
+ Object.defineProperty(a, k, d.get ? d : {
209
+ enumerable: true,
210
+ get: function() {
211
+ return n[k];
212
+ }
213
+ });
214
+ });
215
+ return a;
216
+ }
217
+ var objectProto$c = Object.prototype;
218
+ var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
219
+ function baseHas$1(object2, key) {
220
+ return object2 != null && hasOwnProperty$9.call(object2, key);
221
+ }
222
+ var _baseHas = baseHas$1;
223
+ var isArray$8 = Array.isArray;
224
+ var isArray_1 = isArray$8;
225
+ var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
226
+ var _freeGlobal = freeGlobal$1;
227
+ var freeGlobal = _freeGlobal;
228
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
229
+ var root$8 = freeGlobal || freeSelf || Function("return this")();
230
+ var _root = root$8;
231
+ var root$7 = _root;
232
+ var Symbol$5 = root$7.Symbol;
233
+ var _Symbol = Symbol$5;
234
+ var Symbol$4 = _Symbol;
235
+ var objectProto$b = Object.prototype;
236
+ var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
237
+ var nativeObjectToString$1 = objectProto$b.toString;
238
+ var symToStringTag$1 = Symbol$4 ? Symbol$4.toStringTag : void 0;
239
+ function getRawTag$1(value) {
240
+ var isOwn = hasOwnProperty$8.call(value, symToStringTag$1), tag = value[symToStringTag$1];
241
+ try {
242
+ value[symToStringTag$1] = void 0;
243
+ var unmasked = true;
244
+ } catch (e) {
245
+ }
246
+ var result = nativeObjectToString$1.call(value);
247
+ if (unmasked) {
248
+ if (isOwn) {
249
+ value[symToStringTag$1] = tag;
250
+ } else {
251
+ delete value[symToStringTag$1];
252
+ }
253
+ }
254
+ return result;
255
+ }
256
+ var _getRawTag = getRawTag$1;
257
+ var objectProto$a = Object.prototype;
258
+ var nativeObjectToString = objectProto$a.toString;
259
+ function objectToString$1(value) {
260
+ return nativeObjectToString.call(value);
261
+ }
262
+ var _objectToString = objectToString$1;
263
+ var Symbol$3 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
264
+ var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
265
+ var symToStringTag = Symbol$3 ? Symbol$3.toStringTag : void 0;
266
+ function baseGetTag$5(value) {
267
+ if (value == null) {
268
+ return value === void 0 ? undefinedTag : nullTag;
269
+ }
270
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
271
+ }
272
+ var _baseGetTag = baseGetTag$5;
273
+ function isObjectLike$5(value) {
274
+ return value != null && typeof value == "object";
275
+ }
276
+ var isObjectLike_1 = isObjectLike$5;
277
+ var baseGetTag$4 = _baseGetTag, isObjectLike$4 = isObjectLike_1;
278
+ var symbolTag$1 = "[object Symbol]";
279
+ function isSymbol$3(value) {
280
+ return typeof value == "symbol" || isObjectLike$4(value) && baseGetTag$4(value) == symbolTag$1;
281
+ }
282
+ var isSymbol_1 = isSymbol$3;
283
+ var isArray$7 = isArray_1, isSymbol$2 = isSymbol_1;
284
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
285
+ function isKey$3(value, object2) {
286
+ if (isArray$7(value)) {
287
+ return false;
288
+ }
289
+ var type = typeof value;
290
+ if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol$2(value)) {
291
+ return true;
292
+ }
293
+ return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object2 != null && value in Object(object2);
294
+ }
295
+ var _isKey = isKey$3;
296
+ function isObject$4(value) {
297
+ var type = typeof value;
298
+ return value != null && (type == "object" || type == "function");
299
+ }
300
+ var isObject_1 = isObject$4;
301
+ var baseGetTag$3 = _baseGetTag, isObject$3 = isObject_1;
302
+ var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
303
+ function isFunction$2(value) {
304
+ if (!isObject$3(value)) {
305
+ return false;
306
+ }
307
+ var tag = baseGetTag$3(value);
308
+ return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
309
+ }
310
+ var isFunction_1 = isFunction$2;
311
+ var root$6 = _root;
312
+ var coreJsData$1 = root$6["__core-js_shared__"];
313
+ var _coreJsData = coreJsData$1;
314
+ var coreJsData = _coreJsData;
315
+ var maskSrcKey = function() {
316
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
317
+ return uid ? "Symbol(src)_1." + uid : "";
318
+ }();
319
+ function isMasked$1(func) {
320
+ return !!maskSrcKey && maskSrcKey in func;
321
+ }
322
+ var _isMasked = isMasked$1;
323
+ var funcProto$1 = Function.prototype;
324
+ var funcToString$1 = funcProto$1.toString;
325
+ function toSource$2(func) {
326
+ if (func != null) {
327
+ try {
328
+ return funcToString$1.call(func);
329
+ } catch (e) {
330
+ }
331
+ try {
332
+ return func + "";
333
+ } catch (e) {
334
+ }
335
+ }
336
+ return "";
337
+ }
338
+ var _toSource = toSource$2;
339
+ var isFunction$1 = isFunction_1, isMasked = _isMasked, isObject$2 = isObject_1, toSource$1 = _toSource;
340
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
341
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
342
+ var funcProto = Function.prototype, objectProto$9 = Object.prototype;
343
+ var funcToString = funcProto.toString;
344
+ var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
345
+ var reIsNative = RegExp(
346
+ "^" + funcToString.call(hasOwnProperty$7).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
347
+ );
348
+ function baseIsNative$1(value) {
349
+ if (!isObject$2(value) || isMasked(value)) {
350
+ return false;
351
+ }
352
+ var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
353
+ return pattern.test(toSource$1(value));
354
+ }
355
+ var _baseIsNative = baseIsNative$1;
356
+ function getValue$1(object2, key) {
357
+ return object2 == null ? void 0 : object2[key];
358
+ }
359
+ var _getValue = getValue$1;
360
+ var baseIsNative = _baseIsNative, getValue = _getValue;
361
+ function getNative$7(object2, key) {
362
+ var value = getValue(object2, key);
363
+ return baseIsNative(value) ? value : void 0;
364
+ }
365
+ var _getNative = getNative$7;
366
+ var getNative$6 = _getNative;
367
+ var nativeCreate$4 = getNative$6(Object, "create");
368
+ var _nativeCreate = nativeCreate$4;
369
+ var nativeCreate$3 = _nativeCreate;
370
+ function hashClear$1() {
371
+ this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
372
+ this.size = 0;
373
+ }
374
+ var _hashClear = hashClear$1;
375
+ function hashDelete$1(key) {
376
+ var result = this.has(key) && delete this.__data__[key];
377
+ this.size -= result ? 1 : 0;
378
+ return result;
379
+ }
380
+ var _hashDelete = hashDelete$1;
381
+ var nativeCreate$2 = _nativeCreate;
382
+ var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
383
+ var objectProto$8 = Object.prototype;
384
+ var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
385
+ function hashGet$1(key) {
386
+ var data = this.__data__;
387
+ if (nativeCreate$2) {
388
+ var result = data[key];
389
+ return result === HASH_UNDEFINED$2 ? void 0 : result;
390
+ }
391
+ return hasOwnProperty$6.call(data, key) ? data[key] : void 0;
392
+ }
393
+ var _hashGet = hashGet$1;
394
+ var nativeCreate$1 = _nativeCreate;
395
+ var objectProto$7 = Object.prototype;
396
+ var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
397
+ function hashHas$1(key) {
398
+ var data = this.__data__;
399
+ return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$5.call(data, key);
400
+ }
401
+ var _hashHas = hashHas$1;
402
+ var nativeCreate = _nativeCreate;
403
+ var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
404
+ function hashSet$1(key, value) {
405
+ var data = this.__data__;
406
+ this.size += this.has(key) ? 0 : 1;
407
+ data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
408
+ return this;
409
+ }
410
+ var _hashSet = hashSet$1;
411
+ var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
412
+ function Hash$1(entries) {
413
+ var index2 = -1, length = entries == null ? 0 : entries.length;
414
+ this.clear();
415
+ while (++index2 < length) {
416
+ var entry = entries[index2];
417
+ this.set(entry[0], entry[1]);
418
+ }
419
+ }
420
+ Hash$1.prototype.clear = hashClear;
421
+ Hash$1.prototype["delete"] = hashDelete;
422
+ Hash$1.prototype.get = hashGet;
423
+ Hash$1.prototype.has = hashHas;
424
+ Hash$1.prototype.set = hashSet;
425
+ var _Hash = Hash$1;
426
+ function listCacheClear$1() {
427
+ this.__data__ = [];
428
+ this.size = 0;
429
+ }
430
+ var _listCacheClear = listCacheClear$1;
431
+ function eq$2(value, other) {
432
+ return value === other || value !== value && other !== other;
433
+ }
434
+ var eq_1 = eq$2;
435
+ var eq$1 = eq_1;
436
+ function assocIndexOf$4(array2, key) {
437
+ var length = array2.length;
438
+ while (length--) {
439
+ if (eq$1(array2[length][0], key)) {
440
+ return length;
441
+ }
442
+ }
443
+ return -1;
444
+ }
445
+ var _assocIndexOf = assocIndexOf$4;
446
+ var assocIndexOf$3 = _assocIndexOf;
447
+ var arrayProto = Array.prototype;
448
+ var splice = arrayProto.splice;
449
+ function listCacheDelete$1(key) {
450
+ var data = this.__data__, index2 = assocIndexOf$3(data, key);
451
+ if (index2 < 0) {
452
+ return false;
453
+ }
454
+ var lastIndex = data.length - 1;
455
+ if (index2 == lastIndex) {
456
+ data.pop();
457
+ } else {
458
+ splice.call(data, index2, 1);
459
+ }
460
+ --this.size;
461
+ return true;
462
+ }
463
+ var _listCacheDelete = listCacheDelete$1;
464
+ var assocIndexOf$2 = _assocIndexOf;
465
+ function listCacheGet$1(key) {
466
+ var data = this.__data__, index2 = assocIndexOf$2(data, key);
467
+ return index2 < 0 ? void 0 : data[index2][1];
468
+ }
469
+ var _listCacheGet = listCacheGet$1;
470
+ var assocIndexOf$1 = _assocIndexOf;
471
+ function listCacheHas$1(key) {
472
+ return assocIndexOf$1(this.__data__, key) > -1;
473
+ }
474
+ var _listCacheHas = listCacheHas$1;
475
+ var assocIndexOf = _assocIndexOf;
476
+ function listCacheSet$1(key, value) {
477
+ var data = this.__data__, index2 = assocIndexOf(data, key);
478
+ if (index2 < 0) {
479
+ ++this.size;
480
+ data.push([key, value]);
481
+ } else {
482
+ data[index2][1] = value;
483
+ }
484
+ return this;
485
+ }
486
+ var _listCacheSet = listCacheSet$1;
487
+ var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
488
+ function ListCache$4(entries) {
489
+ var index2 = -1, length = entries == null ? 0 : entries.length;
490
+ this.clear();
491
+ while (++index2 < length) {
492
+ var entry = entries[index2];
493
+ this.set(entry[0], entry[1]);
494
+ }
495
+ }
496
+ ListCache$4.prototype.clear = listCacheClear;
497
+ ListCache$4.prototype["delete"] = listCacheDelete;
498
+ ListCache$4.prototype.get = listCacheGet;
499
+ ListCache$4.prototype.has = listCacheHas;
500
+ ListCache$4.prototype.set = listCacheSet;
501
+ var _ListCache = ListCache$4;
502
+ var getNative$5 = _getNative, root$5 = _root;
503
+ var Map$4 = getNative$5(root$5, "Map");
504
+ var _Map = Map$4;
505
+ var Hash = _Hash, ListCache$3 = _ListCache, Map$3 = _Map;
506
+ function mapCacheClear$1() {
507
+ this.size = 0;
508
+ this.__data__ = {
509
+ "hash": new Hash(),
510
+ "map": new (Map$3 || ListCache$3)(),
511
+ "string": new Hash()
512
+ };
513
+ }
514
+ var _mapCacheClear = mapCacheClear$1;
515
+ function isKeyable$1(value) {
516
+ var type = typeof value;
517
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
518
+ }
519
+ var _isKeyable = isKeyable$1;
520
+ var isKeyable = _isKeyable;
521
+ function getMapData$4(map2, key) {
522
+ var data = map2.__data__;
523
+ return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
524
+ }
525
+ var _getMapData = getMapData$4;
526
+ var getMapData$3 = _getMapData;
527
+ function mapCacheDelete$1(key) {
528
+ var result = getMapData$3(this, key)["delete"](key);
529
+ this.size -= result ? 1 : 0;
530
+ return result;
531
+ }
532
+ var _mapCacheDelete = mapCacheDelete$1;
533
+ var getMapData$2 = _getMapData;
534
+ function mapCacheGet$1(key) {
535
+ return getMapData$2(this, key).get(key);
536
+ }
537
+ var _mapCacheGet = mapCacheGet$1;
538
+ var getMapData$1 = _getMapData;
539
+ function mapCacheHas$1(key) {
540
+ return getMapData$1(this, key).has(key);
541
+ }
542
+ var _mapCacheHas = mapCacheHas$1;
543
+ var getMapData = _getMapData;
544
+ function mapCacheSet$1(key, value) {
545
+ var data = getMapData(this, key), size = data.size;
546
+ data.set(key, value);
547
+ this.size += data.size == size ? 0 : 1;
548
+ return this;
549
+ }
550
+ var _mapCacheSet = mapCacheSet$1;
551
+ var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
552
+ function MapCache$3(entries) {
553
+ var index2 = -1, length = entries == null ? 0 : entries.length;
554
+ this.clear();
555
+ while (++index2 < length) {
556
+ var entry = entries[index2];
557
+ this.set(entry[0], entry[1]);
558
+ }
559
+ }
560
+ MapCache$3.prototype.clear = mapCacheClear;
561
+ MapCache$3.prototype["delete"] = mapCacheDelete;
562
+ MapCache$3.prototype.get = mapCacheGet;
563
+ MapCache$3.prototype.has = mapCacheHas;
564
+ MapCache$3.prototype.set = mapCacheSet;
565
+ var _MapCache = MapCache$3;
566
+ var MapCache$2 = _MapCache;
567
+ var FUNC_ERROR_TEXT = "Expected a function";
568
+ function memoize$1(func, resolver) {
569
+ if (typeof func != "function" || resolver != null && typeof resolver != "function") {
570
+ throw new TypeError(FUNC_ERROR_TEXT);
571
+ }
572
+ var memoized = function() {
573
+ var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
574
+ if (cache.has(key)) {
575
+ return cache.get(key);
576
+ }
577
+ var result = func.apply(this, args);
578
+ memoized.cache = cache.set(key, result) || cache;
579
+ return result;
580
+ };
581
+ memoized.cache = new (memoize$1.Cache || MapCache$2)();
582
+ return memoized;
583
+ }
584
+ memoize$1.Cache = MapCache$2;
585
+ var memoize_1 = memoize$1;
586
+ var memoize = memoize_1;
587
+ var MAX_MEMOIZE_SIZE = 500;
588
+ function memoizeCapped$1(func) {
589
+ var result = memoize(func, function(key) {
590
+ if (cache.size === MAX_MEMOIZE_SIZE) {
591
+ cache.clear();
592
+ }
593
+ return key;
594
+ });
595
+ var cache = result.cache;
596
+ return result;
597
+ }
598
+ var _memoizeCapped = memoizeCapped$1;
599
+ var memoizeCapped = _memoizeCapped;
600
+ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
601
+ var reEscapeChar = /\\(\\)?/g;
602
+ var stringToPath$1 = memoizeCapped(function(string2) {
603
+ var result = [];
604
+ if (string2.charCodeAt(0) === 46) {
605
+ result.push("");
606
+ }
607
+ string2.replace(rePropName, function(match, number2, quote, subString) {
608
+ result.push(quote ? subString.replace(reEscapeChar, "$1") : number2 || match);
609
+ });
610
+ return result;
611
+ });
612
+ var _stringToPath = stringToPath$1;
613
+ function arrayMap$1(array2, iteratee) {
614
+ var index2 = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
615
+ while (++index2 < length) {
616
+ result[index2] = iteratee(array2[index2], index2, array2);
617
+ }
618
+ return result;
619
+ }
620
+ var _arrayMap = arrayMap$1;
621
+ var Symbol$2 = _Symbol, arrayMap = _arrayMap, isArray$6 = isArray_1, isSymbol$1 = isSymbol_1;
622
+ var INFINITY$1 = 1 / 0;
623
+ var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$1 ? symbolProto$1.toString : void 0;
624
+ function baseToString$1(value) {
625
+ if (typeof value == "string") {
626
+ return value;
627
+ }
628
+ if (isArray$6(value)) {
629
+ return arrayMap(value, baseToString$1) + "";
630
+ }
631
+ if (isSymbol$1(value)) {
632
+ return symbolToString ? symbolToString.call(value) : "";
633
+ }
634
+ var result = value + "";
635
+ return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
636
+ }
637
+ var _baseToString = baseToString$1;
638
+ var baseToString = _baseToString;
639
+ function toString$5(value) {
640
+ return value == null ? "" : baseToString(value);
641
+ }
642
+ var toString_1 = toString$5;
643
+ var isArray$5 = isArray_1, isKey$2 = _isKey, stringToPath = _stringToPath, toString$4 = toString_1;
644
+ function castPath$2(value, object2) {
645
+ if (isArray$5(value)) {
646
+ return value;
647
+ }
648
+ return isKey$2(value, object2) ? [value] : stringToPath(toString$4(value));
649
+ }
650
+ var _castPath = castPath$2;
651
+ var baseGetTag$2 = _baseGetTag, isObjectLike$3 = isObjectLike_1;
652
+ var argsTag$2 = "[object Arguments]";
653
+ function baseIsArguments$1(value) {
654
+ return isObjectLike$3(value) && baseGetTag$2(value) == argsTag$2;
655
+ }
656
+ var _baseIsArguments = baseIsArguments$1;
657
+ var baseIsArguments = _baseIsArguments, isObjectLike$2 = isObjectLike_1;
658
+ var objectProto$6 = Object.prototype;
659
+ var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
660
+ var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
661
+ var isArguments$2 = baseIsArguments(/* @__PURE__ */ function() {
662
+ return arguments;
663
+ }()) ? baseIsArguments : function(value) {
664
+ return isObjectLike$2(value) && hasOwnProperty$4.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
665
+ };
666
+ var isArguments_1 = isArguments$2;
667
+ var MAX_SAFE_INTEGER$1 = 9007199254740991;
668
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
669
+ function isIndex$2(value, length) {
670
+ var type = typeof value;
671
+ length = length == null ? MAX_SAFE_INTEGER$1 : length;
672
+ return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
673
+ }
674
+ var _isIndex = isIndex$2;
675
+ var MAX_SAFE_INTEGER = 9007199254740991;
676
+ function isLength$3(value) {
677
+ return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
678
+ }
679
+ var isLength_1 = isLength$3;
680
+ var isSymbol = isSymbol_1;
681
+ var INFINITY = 1 / 0;
682
+ function toKey$4(value) {
683
+ if (typeof value == "string" || isSymbol(value)) {
684
+ return value;
685
+ }
686
+ var result = value + "";
687
+ return result == "0" && 1 / value == -INFINITY ? "-0" : result;
688
+ }
689
+ var _toKey = toKey$4;
690
+ var castPath$1 = _castPath, isArguments$1 = isArguments_1, isArray$4 = isArray_1, isIndex$1 = _isIndex, isLength$2 = isLength_1, toKey$3 = _toKey;
691
+ function hasPath$2(object2, path, hasFunc) {
692
+ path = castPath$1(path, object2);
693
+ var index2 = -1, length = path.length, result = false;
694
+ while (++index2 < length) {
695
+ var key = toKey$3(path[index2]);
696
+ if (!(result = object2 != null && hasFunc(object2, key))) {
697
+ break;
698
+ }
699
+ object2 = object2[key];
700
+ }
701
+ if (result || ++index2 != length) {
702
+ return result;
703
+ }
704
+ length = object2 == null ? 0 : object2.length;
705
+ return !!length && isLength$2(length) && isIndex$1(key, length) && (isArray$4(object2) || isArguments$1(object2));
706
+ }
707
+ var _hasPath = hasPath$2;
708
+ var baseHas = _baseHas, hasPath$1 = _hasPath;
709
+ function has(object2, path) {
710
+ return object2 != null && hasPath$1(object2, path, baseHas);
711
+ }
712
+ var has_1 = has;
713
+ const has$1 = /* @__PURE__ */ getDefaultExportFromCjs(has_1);
714
+ const isSchema = (obj) => obj && obj.__isYupSchema__;
715
+ class Condition {
716
+ constructor(refs, options) {
717
+ this.refs = refs;
718
+ this.refs = refs;
719
+ if (typeof options === "function") {
720
+ this.fn = options;
721
+ return;
722
+ }
723
+ if (!has$1(options, "is"))
724
+ throw new TypeError("`is:` is required for `when()` conditions");
725
+ if (!options.then && !options.otherwise)
726
+ throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");
727
+ let {
728
+ is,
729
+ then,
730
+ otherwise
731
+ } = options;
732
+ let check = typeof is === "function" ? is : (...values) => values.every((value) => value === is);
733
+ this.fn = function(...args) {
734
+ let options2 = args.pop();
735
+ let schema = args.pop();
736
+ let branch = check(...args) ? then : otherwise;
737
+ if (!branch)
738
+ return void 0;
739
+ if (typeof branch === "function")
740
+ return branch(schema);
741
+ return schema.concat(branch.resolve(options2));
742
+ };
743
+ }
744
+ resolve(base, options) {
745
+ 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));
746
+ let schema = this.fn.apply(base, values.concat(base, options));
747
+ if (schema === void 0 || schema === base)
748
+ return base;
749
+ if (!isSchema(schema))
750
+ throw new TypeError("conditions must return a schema object");
751
+ return schema.resolve(options);
752
+ }
753
+ }
754
+ function toArray(value) {
755
+ return value == null ? [] : [].concat(value);
756
+ }
757
+ function _extends$3() {
758
+ _extends$3 = Object.assign || function(target) {
759
+ for (var i = 1; i < arguments.length; i++) {
760
+ var source = arguments[i];
761
+ for (var key in source) {
762
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
763
+ target[key] = source[key];
764
+ }
765
+ }
766
+ }
767
+ return target;
768
+ };
769
+ return _extends$3.apply(this, arguments);
770
+ }
771
+ let strReg = /\$\{\s*(\w+)\s*\}/g;
772
+ class ValidationError extends Error {
773
+ static formatError(message, params) {
774
+ const path = params.label || params.path || "this";
775
+ if (path !== params.path)
776
+ params = _extends$3({}, params, {
777
+ path
778
+ });
779
+ if (typeof message === "string")
780
+ return message.replace(strReg, (_, key) => printValue(params[key]));
781
+ if (typeof message === "function")
782
+ return message(params);
783
+ return message;
784
+ }
785
+ static isError(err) {
786
+ return err && err.name === "ValidationError";
787
+ }
788
+ constructor(errorOrErrors, value, field, type) {
789
+ super();
790
+ this.name = "ValidationError";
791
+ this.value = value;
792
+ this.path = field;
793
+ this.type = type;
794
+ this.errors = [];
795
+ this.inner = [];
796
+ toArray(errorOrErrors).forEach((err) => {
797
+ if (ValidationError.isError(err)) {
798
+ this.errors.push(...err.errors);
799
+ this.inner = this.inner.concat(err.inner.length ? err.inner : err);
800
+ } else {
801
+ this.errors.push(err);
802
+ }
803
+ });
804
+ this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0];
805
+ if (Error.captureStackTrace)
806
+ Error.captureStackTrace(this, ValidationError);
807
+ }
808
+ }
809
+ const once = (cb) => {
810
+ let fired = false;
811
+ return (...args) => {
812
+ if (fired)
813
+ return;
814
+ fired = true;
815
+ cb(...args);
816
+ };
817
+ };
818
+ function runTests(options, cb) {
819
+ let {
820
+ endEarly,
821
+ tests,
822
+ args,
823
+ value,
824
+ errors,
825
+ sort,
826
+ path
827
+ } = options;
828
+ let callback = once(cb);
829
+ let count = tests.length;
830
+ const nestedErrors = [];
831
+ errors = errors ? errors : [];
832
+ if (!count)
833
+ return errors.length ? callback(new ValidationError(errors, value, path)) : callback(null, value);
834
+ for (let i = 0; i < tests.length; i++) {
835
+ const test = tests[i];
836
+ test(args, function finishTestRun(err) {
837
+ if (err) {
838
+ if (!ValidationError.isError(err)) {
839
+ return callback(err, value);
840
+ }
841
+ if (endEarly) {
842
+ err.value = value;
843
+ return callback(err, value);
844
+ }
845
+ nestedErrors.push(err);
846
+ }
847
+ if (--count <= 0) {
848
+ if (nestedErrors.length) {
849
+ if (sort)
850
+ nestedErrors.sort(sort);
851
+ if (errors.length)
852
+ nestedErrors.push(...errors);
853
+ errors = nestedErrors;
854
+ }
855
+ if (errors.length) {
856
+ callback(new ValidationError(errors, value, path), value);
857
+ return;
858
+ }
859
+ callback(null, value);
860
+ }
861
+ });
862
+ }
863
+ }
864
+ var getNative$4 = _getNative;
865
+ var defineProperty$1 = function() {
866
+ try {
867
+ var func = getNative$4(Object, "defineProperty");
868
+ func({}, "", {});
869
+ return func;
870
+ } catch (e) {
871
+ }
872
+ }();
873
+ var _defineProperty = defineProperty$1;
874
+ var defineProperty = _defineProperty;
875
+ function baseAssignValue$2(object2, key, value) {
876
+ if (key == "__proto__" && defineProperty) {
877
+ defineProperty(object2, key, {
878
+ "configurable": true,
879
+ "enumerable": true,
880
+ "value": value,
881
+ "writable": true
882
+ });
883
+ } else {
884
+ object2[key] = value;
885
+ }
886
+ }
887
+ var _baseAssignValue = baseAssignValue$2;
888
+ function createBaseFor$1(fromRight) {
889
+ return function(object2, iteratee, keysFunc) {
890
+ var index2 = -1, iterable = Object(object2), props = keysFunc(object2), length = props.length;
891
+ while (length--) {
892
+ var key = props[fromRight ? length : ++index2];
893
+ if (iteratee(iterable[key], key, iterable) === false) {
894
+ break;
895
+ }
896
+ }
897
+ return object2;
898
+ };
899
+ }
900
+ var _createBaseFor = createBaseFor$1;
901
+ var createBaseFor = _createBaseFor;
902
+ var baseFor$1 = createBaseFor();
903
+ var _baseFor = baseFor$1;
904
+ function baseTimes$1(n, iteratee) {
905
+ var index2 = -1, result = Array(n);
906
+ while (++index2 < n) {
907
+ result[index2] = iteratee(index2);
908
+ }
909
+ return result;
910
+ }
911
+ var _baseTimes = baseTimes$1;
912
+ var isBuffer$2 = { exports: {} };
913
+ function stubFalse() {
914
+ return false;
915
+ }
916
+ var stubFalse_1 = stubFalse;
917
+ isBuffer$2.exports;
918
+ (function(module2, exports2) {
919
+ var root2 = _root, stubFalse2 = stubFalse_1;
920
+ var freeExports = exports2 && !exports2.nodeType && exports2;
921
+ var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
922
+ var moduleExports = freeModule && freeModule.exports === freeExports;
923
+ var Buffer = moduleExports ? root2.Buffer : void 0;
924
+ var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
925
+ var isBuffer2 = nativeIsBuffer || stubFalse2;
926
+ module2.exports = isBuffer2;
927
+ })(isBuffer$2, isBuffer$2.exports);
928
+ var isBufferExports = isBuffer$2.exports;
929
+ var baseGetTag$1 = _baseGetTag, isLength$1 = isLength_1, isObjectLike$1 = isObjectLike_1;
930
+ 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]";
931
+ 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]";
932
+ var typedArrayTags = {};
933
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
934
+ 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;
935
+ function baseIsTypedArray$1(value) {
936
+ return isObjectLike$1(value) && isLength$1(value.length) && !!typedArrayTags[baseGetTag$1(value)];
937
+ }
938
+ var _baseIsTypedArray = baseIsTypedArray$1;
939
+ function baseUnary$1(func) {
940
+ return function(value) {
941
+ return func(value);
942
+ };
943
+ }
944
+ var _baseUnary = baseUnary$1;
945
+ var _nodeUtil = { exports: {} };
946
+ _nodeUtil.exports;
947
+ (function(module2, exports2) {
948
+ var freeGlobal2 = _freeGlobal;
949
+ var freeExports = exports2 && !exports2.nodeType && exports2;
950
+ var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
951
+ var moduleExports = freeModule && freeModule.exports === freeExports;
952
+ var freeProcess = moduleExports && freeGlobal2.process;
953
+ var nodeUtil2 = function() {
954
+ try {
955
+ var types = freeModule && freeModule.require && freeModule.require("util").types;
956
+ if (types) {
957
+ return types;
958
+ }
959
+ return freeProcess && freeProcess.binding && freeProcess.binding("util");
960
+ } catch (e) {
961
+ }
962
+ }();
963
+ module2.exports = nodeUtil2;
964
+ })(_nodeUtil, _nodeUtil.exports);
965
+ var _nodeUtilExports = _nodeUtil.exports;
966
+ var baseIsTypedArray = _baseIsTypedArray, baseUnary = _baseUnary, nodeUtil = _nodeUtilExports;
967
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
968
+ var isTypedArray$2 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
969
+ var isTypedArray_1 = isTypedArray$2;
970
+ var baseTimes = _baseTimes, isArguments = isArguments_1, isArray$3 = isArray_1, isBuffer$1 = isBufferExports, isIndex = _isIndex, isTypedArray$1 = isTypedArray_1;
971
+ var objectProto$5 = Object.prototype;
972
+ var hasOwnProperty$3 = objectProto$5.hasOwnProperty;
973
+ function arrayLikeKeys$1(value, inherited) {
974
+ 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;
975
+ for (var key in value) {
976
+ if ((inherited || hasOwnProperty$3.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
977
+ (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
978
+ isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
979
+ isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
980
+ isIndex(key, length)))) {
981
+ result.push(key);
982
+ }
983
+ }
984
+ return result;
985
+ }
986
+ var _arrayLikeKeys = arrayLikeKeys$1;
987
+ var objectProto$4 = Object.prototype;
988
+ function isPrototype$1(value) {
989
+ var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$4;
990
+ return value === proto;
991
+ }
992
+ var _isPrototype = isPrototype$1;
993
+ function overArg$1(func, transform) {
994
+ return function(arg) {
995
+ return func(transform(arg));
996
+ };
997
+ }
998
+ var _overArg = overArg$1;
999
+ var overArg = _overArg;
1000
+ var nativeKeys$1 = overArg(Object.keys, Object);
1001
+ var _nativeKeys = nativeKeys$1;
1002
+ var isPrototype = _isPrototype, nativeKeys = _nativeKeys;
1003
+ var objectProto$3 = Object.prototype;
1004
+ var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
1005
+ function baseKeys$1(object2) {
1006
+ if (!isPrototype(object2)) {
1007
+ return nativeKeys(object2);
1008
+ }
1009
+ var result = [];
1010
+ for (var key in Object(object2)) {
1011
+ if (hasOwnProperty$2.call(object2, key) && key != "constructor") {
1012
+ result.push(key);
1013
+ }
1014
+ }
1015
+ return result;
1016
+ }
1017
+ var _baseKeys = baseKeys$1;
1018
+ var isFunction = isFunction_1, isLength = isLength_1;
1019
+ function isArrayLike$1(value) {
1020
+ return value != null && isLength(value.length) && !isFunction(value);
1021
+ }
1022
+ var isArrayLike_1 = isArrayLike$1;
1023
+ var arrayLikeKeys = _arrayLikeKeys, baseKeys = _baseKeys, isArrayLike = isArrayLike_1;
1024
+ function keys$3(object2) {
1025
+ return isArrayLike(object2) ? arrayLikeKeys(object2) : baseKeys(object2);
1026
+ }
1027
+ var keys_1 = keys$3;
1028
+ var baseFor = _baseFor, keys$2 = keys_1;
1029
+ function baseForOwn$2(object2, iteratee) {
1030
+ return object2 && baseFor(object2, iteratee, keys$2);
1031
+ }
1032
+ var _baseForOwn = baseForOwn$2;
1033
+ var ListCache$2 = _ListCache;
1034
+ function stackClear$1() {
1035
+ this.__data__ = new ListCache$2();
1036
+ this.size = 0;
1037
+ }
1038
+ var _stackClear = stackClear$1;
1039
+ function stackDelete$1(key) {
1040
+ var data = this.__data__, result = data["delete"](key);
1041
+ this.size = data.size;
1042
+ return result;
1043
+ }
1044
+ var _stackDelete = stackDelete$1;
1045
+ function stackGet$1(key) {
1046
+ return this.__data__.get(key);
1047
+ }
1048
+ var _stackGet = stackGet$1;
1049
+ function stackHas$1(key) {
1050
+ return this.__data__.has(key);
1051
+ }
1052
+ var _stackHas = stackHas$1;
1053
+ var ListCache$1 = _ListCache, Map$2 = _Map, MapCache$1 = _MapCache;
1054
+ var LARGE_ARRAY_SIZE = 200;
1055
+ function stackSet$1(key, value) {
1056
+ var data = this.__data__;
1057
+ if (data instanceof ListCache$1) {
1058
+ var pairs = data.__data__;
1059
+ if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
1060
+ pairs.push([key, value]);
1061
+ this.size = ++data.size;
1062
+ return this;
1063
+ }
1064
+ data = this.__data__ = new MapCache$1(pairs);
1065
+ }
1066
+ data.set(key, value);
1067
+ this.size = data.size;
1068
+ return this;
1069
+ }
1070
+ var _stackSet = stackSet$1;
1071
+ var ListCache = _ListCache, stackClear = _stackClear, stackDelete = _stackDelete, stackGet = _stackGet, stackHas = _stackHas, stackSet = _stackSet;
1072
+ function Stack$2(entries) {
1073
+ var data = this.__data__ = new ListCache(entries);
1074
+ this.size = data.size;
1075
+ }
1076
+ Stack$2.prototype.clear = stackClear;
1077
+ Stack$2.prototype["delete"] = stackDelete;
1078
+ Stack$2.prototype.get = stackGet;
1079
+ Stack$2.prototype.has = stackHas;
1080
+ Stack$2.prototype.set = stackSet;
1081
+ var _Stack = Stack$2;
1082
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
1083
+ function setCacheAdd$1(value) {
1084
+ this.__data__.set(value, HASH_UNDEFINED);
1085
+ return this;
1086
+ }
1087
+ var _setCacheAdd = setCacheAdd$1;
1088
+ function setCacheHas$1(value) {
1089
+ return this.__data__.has(value);
1090
+ }
1091
+ var _setCacheHas = setCacheHas$1;
1092
+ var MapCache = _MapCache, setCacheAdd = _setCacheAdd, setCacheHas = _setCacheHas;
1093
+ function SetCache$1(values) {
1094
+ var index2 = -1, length = values == null ? 0 : values.length;
1095
+ this.__data__ = new MapCache();
1096
+ while (++index2 < length) {
1097
+ this.add(values[index2]);
1098
+ }
1099
+ }
1100
+ SetCache$1.prototype.add = SetCache$1.prototype.push = setCacheAdd;
1101
+ SetCache$1.prototype.has = setCacheHas;
1102
+ var _SetCache = SetCache$1;
1103
+ function arraySome$1(array2, predicate) {
1104
+ var index2 = -1, length = array2 == null ? 0 : array2.length;
1105
+ while (++index2 < length) {
1106
+ if (predicate(array2[index2], index2, array2)) {
1107
+ return true;
1108
+ }
1109
+ }
1110
+ return false;
1111
+ }
1112
+ var _arraySome = arraySome$1;
1113
+ function cacheHas$1(cache, key) {
1114
+ return cache.has(key);
1115
+ }
1116
+ var _cacheHas = cacheHas$1;
1117
+ var SetCache = _SetCache, arraySome = _arraySome, cacheHas = _cacheHas;
1118
+ var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2;
1119
+ function equalArrays$2(array2, other, bitmask, customizer, equalFunc, stack) {
1120
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array2.length, othLength = other.length;
1121
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1122
+ return false;
1123
+ }
1124
+ var arrStacked = stack.get(array2);
1125
+ var othStacked = stack.get(other);
1126
+ if (arrStacked && othStacked) {
1127
+ return arrStacked == other && othStacked == array2;
1128
+ }
1129
+ var index2 = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
1130
+ stack.set(array2, other);
1131
+ stack.set(other, array2);
1132
+ while (++index2 < arrLength) {
1133
+ var arrValue = array2[index2], othValue = other[index2];
1134
+ if (customizer) {
1135
+ var compared = isPartial ? customizer(othValue, arrValue, index2, other, array2, stack) : customizer(arrValue, othValue, index2, array2, other, stack);
1136
+ }
1137
+ if (compared !== void 0) {
1138
+ if (compared) {
1139
+ continue;
1140
+ }
1141
+ result = false;
1142
+ break;
1143
+ }
1144
+ if (seen) {
1145
+ if (!arraySome(other, function(othValue2, othIndex) {
1146
+ if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
1147
+ return seen.push(othIndex);
1148
+ }
1149
+ })) {
1150
+ result = false;
1151
+ break;
1152
+ }
1153
+ } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1154
+ result = false;
1155
+ break;
1156
+ }
1157
+ }
1158
+ stack["delete"](array2);
1159
+ stack["delete"](other);
1160
+ return result;
1161
+ }
1162
+ var _equalArrays = equalArrays$2;
1163
+ var root$4 = _root;
1164
+ var Uint8Array$1 = root$4.Uint8Array;
1165
+ var _Uint8Array = Uint8Array$1;
1166
+ function mapToArray$1(map2) {
1167
+ var index2 = -1, result = Array(map2.size);
1168
+ map2.forEach(function(value, key) {
1169
+ result[++index2] = [key, value];
1170
+ });
1171
+ return result;
1172
+ }
1173
+ var _mapToArray = mapToArray$1;
1174
+ function setToArray$1(set2) {
1175
+ var index2 = -1, result = Array(set2.size);
1176
+ set2.forEach(function(value) {
1177
+ result[++index2] = value;
1178
+ });
1179
+ return result;
1180
+ }
1181
+ var _setToArray = setToArray$1;
1182
+ var Symbol$1 = _Symbol, Uint8Array = _Uint8Array, eq = eq_1, equalArrays$1 = _equalArrays, mapToArray = _mapToArray, setToArray = _setToArray;
1183
+ var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2;
1184
+ 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]";
1185
+ var arrayBufferTag = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]";
1186
+ var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
1187
+ function equalByTag$1(object2, other, tag, bitmask, customizer, equalFunc, stack) {
1188
+ switch (tag) {
1189
+ case dataViewTag$1:
1190
+ if (object2.byteLength != other.byteLength || object2.byteOffset != other.byteOffset) {
1191
+ return false;
1192
+ }
1193
+ object2 = object2.buffer;
1194
+ other = other.buffer;
1195
+ case arrayBufferTag:
1196
+ if (object2.byteLength != other.byteLength || !equalFunc(new Uint8Array(object2), new Uint8Array(other))) {
1197
+ return false;
1198
+ }
1199
+ return true;
1200
+ case boolTag:
1201
+ case dateTag:
1202
+ case numberTag:
1203
+ return eq(+object2, +other);
1204
+ case errorTag:
1205
+ return object2.name == other.name && object2.message == other.message;
1206
+ case regexpTag:
1207
+ case stringTag:
1208
+ return object2 == other + "";
1209
+ case mapTag$1:
1210
+ var convert = mapToArray;
1211
+ case setTag$1:
1212
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
1213
+ convert || (convert = setToArray);
1214
+ if (object2.size != other.size && !isPartial) {
1215
+ return false;
1216
+ }
1217
+ var stacked = stack.get(object2);
1218
+ if (stacked) {
1219
+ return stacked == other;
1220
+ }
1221
+ bitmask |= COMPARE_UNORDERED_FLAG$2;
1222
+ stack.set(object2, other);
1223
+ var result = equalArrays$1(convert(object2), convert(other), bitmask, customizer, equalFunc, stack);
1224
+ stack["delete"](object2);
1225
+ return result;
1226
+ case symbolTag:
1227
+ if (symbolValueOf) {
1228
+ return symbolValueOf.call(object2) == symbolValueOf.call(other);
1229
+ }
1230
+ }
1231
+ return false;
1232
+ }
1233
+ var _equalByTag = equalByTag$1;
1234
+ function arrayPush$1(array2, values) {
1235
+ var index2 = -1, length = values.length, offset = array2.length;
1236
+ while (++index2 < length) {
1237
+ array2[offset + index2] = values[index2];
1238
+ }
1239
+ return array2;
1240
+ }
1241
+ var _arrayPush = arrayPush$1;
1242
+ var arrayPush = _arrayPush, isArray$2 = isArray_1;
1243
+ function baseGetAllKeys$1(object2, keysFunc, symbolsFunc) {
1244
+ var result = keysFunc(object2);
1245
+ return isArray$2(object2) ? result : arrayPush(result, symbolsFunc(object2));
1246
+ }
1247
+ var _baseGetAllKeys = baseGetAllKeys$1;
1248
+ function arrayFilter$1(array2, predicate) {
1249
+ var index2 = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
1250
+ while (++index2 < length) {
1251
+ var value = array2[index2];
1252
+ if (predicate(value, index2, array2)) {
1253
+ result[resIndex++] = value;
1254
+ }
1255
+ }
1256
+ return result;
1257
+ }
1258
+ var _arrayFilter = arrayFilter$1;
1259
+ function stubArray$1() {
1260
+ return [];
1261
+ }
1262
+ var stubArray_1 = stubArray$1;
1263
+ var arrayFilter = _arrayFilter, stubArray = stubArray_1;
1264
+ var objectProto$2 = Object.prototype;
1265
+ var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
1266
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
1267
+ var getSymbols$1 = !nativeGetSymbols ? stubArray : function(object2) {
1268
+ if (object2 == null) {
1269
+ return [];
1270
+ }
1271
+ object2 = Object(object2);
1272
+ return arrayFilter(nativeGetSymbols(object2), function(symbol) {
1273
+ return propertyIsEnumerable.call(object2, symbol);
1274
+ });
1275
+ };
1276
+ var _getSymbols = getSymbols$1;
1277
+ var baseGetAllKeys = _baseGetAllKeys, getSymbols = _getSymbols, keys$1 = keys_1;
1278
+ function getAllKeys$1(object2) {
1279
+ return baseGetAllKeys(object2, keys$1, getSymbols);
1280
+ }
1281
+ var _getAllKeys = getAllKeys$1;
1282
+ var getAllKeys = _getAllKeys;
1283
+ var COMPARE_PARTIAL_FLAG$3 = 1;
1284
+ var objectProto$1 = Object.prototype;
1285
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
1286
+ function equalObjects$1(object2, other, bitmask, customizer, equalFunc, stack) {
1287
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object2), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
1288
+ if (objLength != othLength && !isPartial) {
1289
+ return false;
1290
+ }
1291
+ var index2 = objLength;
1292
+ while (index2--) {
1293
+ var key = objProps[index2];
1294
+ if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
1295
+ return false;
1296
+ }
1297
+ }
1298
+ var objStacked = stack.get(object2);
1299
+ var othStacked = stack.get(other);
1300
+ if (objStacked && othStacked) {
1301
+ return objStacked == other && othStacked == object2;
1302
+ }
1303
+ var result = true;
1304
+ stack.set(object2, other);
1305
+ stack.set(other, object2);
1306
+ var skipCtor = isPartial;
1307
+ while (++index2 < objLength) {
1308
+ key = objProps[index2];
1309
+ var objValue = object2[key], othValue = other[key];
1310
+ if (customizer) {
1311
+ var compared = isPartial ? customizer(othValue, objValue, key, other, object2, stack) : customizer(objValue, othValue, key, object2, other, stack);
1312
+ }
1313
+ if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
1314
+ result = false;
1315
+ break;
1316
+ }
1317
+ skipCtor || (skipCtor = key == "constructor");
1318
+ }
1319
+ if (result && !skipCtor) {
1320
+ var objCtor = object2.constructor, othCtor = other.constructor;
1321
+ if (objCtor != othCtor && ("constructor" in object2 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
1322
+ result = false;
1323
+ }
1324
+ }
1325
+ stack["delete"](object2);
1326
+ stack["delete"](other);
1327
+ return result;
1328
+ }
1329
+ var _equalObjects = equalObjects$1;
1330
+ var getNative$3 = _getNative, root$3 = _root;
1331
+ var DataView$1 = getNative$3(root$3, "DataView");
1332
+ var _DataView = DataView$1;
1333
+ var getNative$2 = _getNative, root$2 = _root;
1334
+ var Promise$2 = getNative$2(root$2, "Promise");
1335
+ var _Promise = Promise$2;
1336
+ var getNative$1 = _getNative, root$1 = _root;
1337
+ var Set$2 = getNative$1(root$1, "Set");
1338
+ var _Set = Set$2;
1339
+ var getNative = _getNative, root = _root;
1340
+ var WeakMap$1 = getNative(root, "WeakMap");
1341
+ var _WeakMap = WeakMap$1;
1342
+ var DataView = _DataView, Map$1 = _Map, Promise$1 = _Promise, Set$1 = _Set, WeakMap = _WeakMap, baseGetTag = _baseGetTag, toSource = _toSource;
1343
+ var mapTag = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag = "[object Set]", weakMapTag = "[object WeakMap]";
1344
+ var dataViewTag = "[object DataView]";
1345
+ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap);
1346
+ var getTag$1 = baseGetTag;
1347
+ 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) {
1348
+ getTag$1 = function(value) {
1349
+ var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
1350
+ if (ctorString) {
1351
+ switch (ctorString) {
1352
+ case dataViewCtorString:
1353
+ return dataViewTag;
1354
+ case mapCtorString:
1355
+ return mapTag;
1356
+ case promiseCtorString:
1357
+ return promiseTag;
1358
+ case setCtorString:
1359
+ return setTag;
1360
+ case weakMapCtorString:
1361
+ return weakMapTag;
1362
+ }
1363
+ }
1364
+ return result;
1365
+ };
1366
+ }
1367
+ var _getTag = getTag$1;
1368
+ var Stack$1 = _Stack, equalArrays = _equalArrays, equalByTag = _equalByTag, equalObjects = _equalObjects, getTag = _getTag, isArray$1 = isArray_1, isBuffer = isBufferExports, isTypedArray = isTypedArray_1;
1369
+ var COMPARE_PARTIAL_FLAG$2 = 1;
1370
+ var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
1371
+ var objectProto = Object.prototype;
1372
+ var hasOwnProperty = objectProto.hasOwnProperty;
1373
+ function baseIsEqualDeep$1(object2, other, bitmask, customizer, equalFunc, stack) {
1374
+ var objIsArr = isArray$1(object2), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag(object2), othTag = othIsArr ? arrayTag : getTag(other);
1375
+ objTag = objTag == argsTag ? objectTag : objTag;
1376
+ othTag = othTag == argsTag ? objectTag : othTag;
1377
+ var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
1378
+ if (isSameTag && isBuffer(object2)) {
1379
+ if (!isBuffer(other)) {
1380
+ return false;
1381
+ }
1382
+ objIsArr = true;
1383
+ objIsObj = false;
1384
+ }
1385
+ if (isSameTag && !objIsObj) {
1386
+ stack || (stack = new Stack$1());
1387
+ return objIsArr || isTypedArray(object2) ? equalArrays(object2, other, bitmask, customizer, equalFunc, stack) : equalByTag(object2, other, objTag, bitmask, customizer, equalFunc, stack);
1388
+ }
1389
+ if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
1390
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object2, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
1391
+ if (objIsWrapped || othIsWrapped) {
1392
+ var objUnwrapped = objIsWrapped ? object2.value() : object2, othUnwrapped = othIsWrapped ? other.value() : other;
1393
+ stack || (stack = new Stack$1());
1394
+ return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
1395
+ }
1396
+ }
1397
+ if (!isSameTag) {
1398
+ return false;
1399
+ }
1400
+ stack || (stack = new Stack$1());
1401
+ return equalObjects(object2, other, bitmask, customizer, equalFunc, stack);
1402
+ }
1403
+ var _baseIsEqualDeep = baseIsEqualDeep$1;
1404
+ var baseIsEqualDeep = _baseIsEqualDeep, isObjectLike = isObjectLike_1;
1405
+ function baseIsEqual$2(value, other, bitmask, customizer, stack) {
1406
+ if (value === other) {
1407
+ return true;
1408
+ }
1409
+ if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
1410
+ return value !== value && other !== other;
1411
+ }
1412
+ return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual$2, stack);
1413
+ }
1414
+ var _baseIsEqual = baseIsEqual$2;
1415
+ var Stack = _Stack, baseIsEqual$1 = _baseIsEqual;
1416
+ var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
1417
+ function baseIsMatch$1(object2, source, matchData, customizer) {
1418
+ var index2 = matchData.length, length = index2, noCustomizer = !customizer;
1419
+ if (object2 == null) {
1420
+ return !length;
1421
+ }
1422
+ object2 = Object(object2);
1423
+ while (index2--) {
1424
+ var data = matchData[index2];
1425
+ if (noCustomizer && data[2] ? data[1] !== object2[data[0]] : !(data[0] in object2)) {
1426
+ return false;
1427
+ }
1428
+ }
1429
+ while (++index2 < length) {
1430
+ data = matchData[index2];
1431
+ var key = data[0], objValue = object2[key], srcValue = data[1];
1432
+ if (noCustomizer && data[2]) {
1433
+ if (objValue === void 0 && !(key in object2)) {
1434
+ return false;
1435
+ }
1436
+ } else {
1437
+ var stack = new Stack();
1438
+ if (customizer) {
1439
+ var result = customizer(objValue, srcValue, key, object2, source, stack);
1440
+ }
1441
+ if (!(result === void 0 ? baseIsEqual$1(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
1442
+ return false;
1443
+ }
1444
+ }
1445
+ }
1446
+ return true;
1447
+ }
1448
+ var _baseIsMatch = baseIsMatch$1;
1449
+ var isObject$1 = isObject_1;
1450
+ function isStrictComparable$2(value) {
1451
+ return value === value && !isObject$1(value);
1452
+ }
1453
+ var _isStrictComparable = isStrictComparable$2;
1454
+ var isStrictComparable$1 = _isStrictComparable, keys = keys_1;
1455
+ function getMatchData$1(object2) {
1456
+ var result = keys(object2), length = result.length;
1457
+ while (length--) {
1458
+ var key = result[length], value = object2[key];
1459
+ result[length] = [key, value, isStrictComparable$1(value)];
1460
+ }
1461
+ return result;
1462
+ }
1463
+ var _getMatchData = getMatchData$1;
1464
+ function matchesStrictComparable$2(key, srcValue) {
1465
+ return function(object2) {
1466
+ if (object2 == null) {
1467
+ return false;
1468
+ }
1469
+ return object2[key] === srcValue && (srcValue !== void 0 || key in Object(object2));
1470
+ };
1471
+ }
1472
+ var _matchesStrictComparable = matchesStrictComparable$2;
1473
+ var baseIsMatch = _baseIsMatch, getMatchData = _getMatchData, matchesStrictComparable$1 = _matchesStrictComparable;
1474
+ function baseMatches$1(source) {
1475
+ var matchData = getMatchData(source);
1476
+ if (matchData.length == 1 && matchData[0][2]) {
1477
+ return matchesStrictComparable$1(matchData[0][0], matchData[0][1]);
1478
+ }
1479
+ return function(object2) {
1480
+ return object2 === source || baseIsMatch(object2, source, matchData);
1481
+ };
1482
+ }
1483
+ var _baseMatches = baseMatches$1;
1484
+ var castPath = _castPath, toKey$2 = _toKey;
1485
+ function baseGet$2(object2, path) {
1486
+ path = castPath(path, object2);
1487
+ var index2 = 0, length = path.length;
1488
+ while (object2 != null && index2 < length) {
1489
+ object2 = object2[toKey$2(path[index2++])];
1490
+ }
1491
+ return index2 && index2 == length ? object2 : void 0;
1492
+ }
1493
+ var _baseGet = baseGet$2;
1494
+ var baseGet$1 = _baseGet;
1495
+ function get$1(object2, path, defaultValue) {
1496
+ var result = object2 == null ? void 0 : baseGet$1(object2, path);
1497
+ return result === void 0 ? defaultValue : result;
1498
+ }
1499
+ var get_1 = get$1;
1500
+ function baseHasIn$1(object2, key) {
1501
+ return object2 != null && key in Object(object2);
1502
+ }
1503
+ var _baseHasIn = baseHasIn$1;
1504
+ var baseHasIn = _baseHasIn, hasPath = _hasPath;
1505
+ function hasIn$1(object2, path) {
1506
+ return object2 != null && hasPath(object2, path, baseHasIn);
1507
+ }
1508
+ var hasIn_1 = hasIn$1;
1509
+ var baseIsEqual = _baseIsEqual, get = get_1, hasIn = hasIn_1, isKey$1 = _isKey, isStrictComparable = _isStrictComparable, matchesStrictComparable = _matchesStrictComparable, toKey$1 = _toKey;
1510
+ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
1511
+ function baseMatchesProperty$1(path, srcValue) {
1512
+ if (isKey$1(path) && isStrictComparable(srcValue)) {
1513
+ return matchesStrictComparable(toKey$1(path), srcValue);
1514
+ }
1515
+ return function(object2) {
1516
+ var objValue = get(object2, path);
1517
+ return objValue === void 0 && objValue === srcValue ? hasIn(object2, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
1518
+ };
1519
+ }
1520
+ var _baseMatchesProperty = baseMatchesProperty$1;
1521
+ function identity$1(value) {
1522
+ return value;
1523
+ }
1524
+ var identity_1 = identity$1;
1525
+ function baseProperty$1(key) {
1526
+ return function(object2) {
1527
+ return object2 == null ? void 0 : object2[key];
1528
+ };
1529
+ }
1530
+ var _baseProperty = baseProperty$1;
1531
+ var baseGet = _baseGet;
1532
+ function basePropertyDeep$1(path) {
1533
+ return function(object2) {
1534
+ return baseGet(object2, path);
1535
+ };
1536
+ }
1537
+ var _basePropertyDeep = basePropertyDeep$1;
1538
+ var baseProperty = _baseProperty, basePropertyDeep = _basePropertyDeep, isKey = _isKey, toKey = _toKey;
1539
+ function property$1(path) {
1540
+ return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
1541
+ }
1542
+ var property_1 = property$1;
1543
+ var baseMatches = _baseMatches, baseMatchesProperty = _baseMatchesProperty, identity = identity_1, isArray = isArray_1, property = property_1;
1544
+ function baseIteratee$2(value) {
1545
+ if (typeof value == "function") {
1546
+ return value;
1547
+ }
1548
+ if (value == null) {
1549
+ return identity;
1550
+ }
1551
+ if (typeof value == "object") {
1552
+ return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
1553
+ }
1554
+ return property(value);
1555
+ }
1556
+ var _baseIteratee = baseIteratee$2;
1557
+ var baseAssignValue$1 = _baseAssignValue, baseForOwn$1 = _baseForOwn, baseIteratee$1 = _baseIteratee;
1558
+ function mapValues(object2, iteratee) {
1559
+ var result = {};
1560
+ iteratee = baseIteratee$1(iteratee);
1561
+ baseForOwn$1(object2, function(value, key, object3) {
1562
+ baseAssignValue$1(result, key, iteratee(value, key, object3));
1563
+ });
1564
+ return result;
1565
+ }
1566
+ var mapValues_1 = mapValues;
1567
+ const mapValues$1 = /* @__PURE__ */ getDefaultExportFromCjs(mapValues_1);
1568
+ function Cache(maxSize) {
1569
+ this._maxSize = maxSize;
1570
+ this.clear();
1571
+ }
1572
+ Cache.prototype.clear = function() {
1573
+ this._size = 0;
1574
+ this._values = /* @__PURE__ */ Object.create(null);
1575
+ };
1576
+ Cache.prototype.get = function(key) {
1577
+ return this._values[key];
1578
+ };
1579
+ Cache.prototype.set = function(key, value) {
1580
+ this._size >= this._maxSize && this.clear();
1581
+ if (!(key in this._values))
1582
+ this._size++;
1583
+ return this._values[key] = value;
1584
+ };
1585
+ 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;
1586
+ var pathCache = new Cache(MAX_CACHE_SIZE), setCache = new Cache(MAX_CACHE_SIZE), getCache = new Cache(MAX_CACHE_SIZE);
1587
+ var propertyExpr = {
1588
+ Cache,
1589
+ split,
1590
+ normalizePath,
1591
+ setter: function(path) {
1592
+ var parts = normalizePath(path);
1593
+ return setCache.get(path) || setCache.set(path, function setter(obj, value) {
1594
+ var index2 = 0;
1595
+ var len = parts.length;
1596
+ var data = obj;
1597
+ while (index2 < len - 1) {
1598
+ var part = parts[index2];
1599
+ if (part === "__proto__" || part === "constructor" || part === "prototype") {
1600
+ return obj;
1601
+ }
1602
+ data = data[parts[index2++]];
1603
+ }
1604
+ data[parts[index2]] = value;
1605
+ });
1606
+ },
1607
+ getter: function(path, safe) {
1608
+ var parts = normalizePath(path);
1609
+ return getCache.get(path) || getCache.set(path, function getter(data) {
1610
+ var index2 = 0, len = parts.length;
1611
+ while (index2 < len) {
1612
+ if (data != null || !safe)
1613
+ data = data[parts[index2++]];
1614
+ else
1615
+ return;
1616
+ }
1617
+ return data;
1618
+ });
1619
+ },
1620
+ join: function(segments) {
1621
+ return segments.reduce(function(path, part) {
1622
+ return path + (isQuoted(part) || DIGIT_REGEX.test(part) ? "[" + part + "]" : (path ? "." : "") + part);
1623
+ }, "");
1624
+ },
1625
+ forEach: function(path, cb, thisArg) {
1626
+ forEach(Array.isArray(path) ? path : split(path), cb, thisArg);
1627
+ }
1628
+ };
1629
+ function normalizePath(path) {
1630
+ return pathCache.get(path) || pathCache.set(
1631
+ path,
1632
+ split(path).map(function(part) {
1633
+ return part.replace(CLEAN_QUOTES_REGEX, "$2");
1634
+ })
1635
+ );
1636
+ }
1637
+ function split(path) {
1638
+ return path.match(SPLIT_REGEX) || [""];
1639
+ }
1640
+ function forEach(parts, iter, thisArg) {
1641
+ var len = parts.length, part, idx, isArray2, isBracket;
1642
+ for (idx = 0; idx < len; idx++) {
1643
+ part = parts[idx];
1644
+ if (part) {
1645
+ if (shouldBeQuoted(part)) {
1646
+ part = '"' + part + '"';
1647
+ }
1648
+ isBracket = isQuoted(part);
1649
+ isArray2 = !isBracket && /^\d+$/.test(part);
1650
+ iter.call(thisArg, part, isBracket, isArray2, idx, parts);
1651
+ }
1652
+ }
1653
+ }
1654
+ function isQuoted(str) {
1655
+ return typeof str === "string" && str && ["'", '"'].indexOf(str.charAt(0)) !== -1;
1656
+ }
1657
+ function hasLeadingNumber(part) {
1658
+ return part.match(LEAD_DIGIT_REGEX) && !part.match(DIGIT_REGEX);
1659
+ }
1660
+ function hasSpecialChars(part) {
1661
+ return SPEC_CHAR_REGEX.test(part);
1662
+ }
1663
+ function shouldBeQuoted(part) {
1664
+ return !isQuoted(part) && (hasLeadingNumber(part) || hasSpecialChars(part));
1665
+ }
1666
+ const prefixes = {
1667
+ context: "$",
1668
+ value: "."
1669
+ };
1670
+ function create$3(key, options) {
1671
+ return new Reference(key, options);
1672
+ }
1673
+ class Reference {
1674
+ constructor(key, options = {}) {
1675
+ if (typeof key !== "string")
1676
+ throw new TypeError("ref must be a string, got: " + key);
1677
+ this.key = key.trim();
1678
+ if (key === "")
1679
+ throw new TypeError("ref must be a non-empty string");
1680
+ this.isContext = this.key[0] === prefixes.context;
1681
+ this.isValue = this.key[0] === prefixes.value;
1682
+ this.isSibling = !this.isContext && !this.isValue;
1683
+ let prefix = this.isContext ? prefixes.context : this.isValue ? prefixes.value : "";
1684
+ this.path = this.key.slice(prefix.length);
1685
+ this.getter = this.path && propertyExpr.getter(this.path, true);
1686
+ this.map = options.map;
1687
+ }
1688
+ getValue(value, parent, context) {
1689
+ let result = this.isContext ? context : this.isValue ? value : parent;
1690
+ if (this.getter)
1691
+ result = this.getter(result || {});
1692
+ if (this.map)
1693
+ result = this.map(result);
1694
+ return result;
1695
+ }
1696
+ /**
1697
+ *
1698
+ * @param {*} value
1699
+ * @param {Object} options
1700
+ * @param {Object=} options.context
1701
+ * @param {Object=} options.parent
1702
+ */
1703
+ cast(value, options) {
1704
+ return this.getValue(value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context);
1705
+ }
1706
+ resolve() {
1707
+ return this;
1708
+ }
1709
+ describe() {
1710
+ return {
1711
+ type: "ref",
1712
+ key: this.key
1713
+ };
1714
+ }
1715
+ toString() {
1716
+ return `Ref(${this.key})`;
1717
+ }
1718
+ static isRef(value) {
1719
+ return value && value.__isYupRef;
1720
+ }
1721
+ }
1722
+ Reference.prototype.__isYupRef = true;
1723
+ function _extends$2() {
1724
+ _extends$2 = Object.assign || function(target) {
1725
+ for (var i = 1; i < arguments.length; i++) {
1726
+ var source = arguments[i];
1727
+ for (var key in source) {
1728
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1729
+ target[key] = source[key];
1730
+ }
1731
+ }
1732
+ }
1733
+ return target;
1734
+ };
1735
+ return _extends$2.apply(this, arguments);
1736
+ }
1737
+ function _objectWithoutPropertiesLoose(source, excluded) {
1738
+ if (source == null)
1739
+ return {};
1740
+ var target = {};
1741
+ var sourceKeys = Object.keys(source);
1742
+ var key, i;
1743
+ for (i = 0; i < sourceKeys.length; i++) {
1744
+ key = sourceKeys[i];
1745
+ if (excluded.indexOf(key) >= 0)
1746
+ continue;
1747
+ target[key] = source[key];
1748
+ }
1749
+ return target;
1750
+ }
1751
+ function createValidation(config) {
1752
+ function validate(_ref, cb) {
1753
+ let {
1754
+ value,
1755
+ path = "",
1756
+ label,
1757
+ options,
1758
+ originalValue,
1759
+ sync
1760
+ } = _ref, rest = _objectWithoutPropertiesLoose(_ref, ["value", "path", "label", "options", "originalValue", "sync"]);
1761
+ const {
1762
+ name: name2,
1763
+ test,
1764
+ params,
1765
+ message
1766
+ } = config;
1767
+ let {
1768
+ parent,
1769
+ context
1770
+ } = options;
1771
+ function resolve(item) {
1772
+ return Reference.isRef(item) ? item.getValue(value, parent, context) : item;
1773
+ }
1774
+ function createError(overrides = {}) {
1775
+ const nextParams = mapValues$1(_extends$2({
1776
+ value,
1777
+ originalValue,
1778
+ label,
1779
+ path: overrides.path || path
1780
+ }, params, overrides.params), resolve);
1781
+ const error = new ValidationError(ValidationError.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name2);
1782
+ error.params = nextParams;
1783
+ return error;
1784
+ }
1785
+ let ctx = _extends$2({
1786
+ path,
1787
+ parent,
1788
+ type: name2,
1789
+ createError,
1790
+ resolve,
1791
+ options,
1792
+ originalValue
1793
+ }, rest);
1794
+ if (!sync) {
1795
+ try {
1796
+ Promise.resolve(test.call(ctx, value, ctx)).then((validOrError) => {
1797
+ if (ValidationError.isError(validOrError))
1798
+ cb(validOrError);
1799
+ else if (!validOrError)
1800
+ cb(createError());
1801
+ else
1802
+ cb(null, validOrError);
1803
+ });
1804
+ } catch (err) {
1805
+ cb(err);
1806
+ }
1807
+ return;
1808
+ }
1809
+ let result;
1810
+ try {
1811
+ var _ref2;
1812
+ result = test.call(ctx, value, ctx);
1813
+ if (typeof ((_ref2 = result) == null ? void 0 : _ref2.then) === "function") {
1814
+ 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`);
1815
+ }
1816
+ } catch (err) {
1817
+ cb(err);
1818
+ return;
1819
+ }
1820
+ if (ValidationError.isError(result))
1821
+ cb(result);
1822
+ else if (!result)
1823
+ cb(createError());
1824
+ else
1825
+ cb(null, result);
1826
+ }
1827
+ validate.OPTIONS = config;
1828
+ return validate;
1829
+ }
1830
+ let trim = (part) => part.substr(0, part.length - 1).substr(1);
1831
+ function getIn(schema, path, value, context = value) {
1832
+ let parent, lastPart, lastPartDebug;
1833
+ if (!path)
1834
+ return {
1835
+ parent,
1836
+ parentPath: path,
1837
+ schema
1838
+ };
1839
+ propertyExpr.forEach(path, (_part, isBracket, isArray2) => {
1840
+ let part = isBracket ? trim(_part) : _part;
1841
+ schema = schema.resolve({
1842
+ context,
1843
+ parent,
1844
+ value
1845
+ });
1846
+ if (schema.innerType) {
1847
+ let idx = isArray2 ? parseInt(part, 10) : 0;
1848
+ if (value && idx >= value.length) {
1849
+ 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. `);
1850
+ }
1851
+ parent = value;
1852
+ value = value && value[idx];
1853
+ schema = schema.innerType;
1854
+ }
1855
+ if (!isArray2) {
1856
+ if (!schema.fields || !schema.fields[part])
1857
+ throw new Error(`The schema does not contain the path: ${path}. (failed at: ${lastPartDebug} which is a type: "${schema._type}")`);
1858
+ parent = value;
1859
+ value = value && value[part];
1860
+ schema = schema.fields[part];
1861
+ }
1862
+ lastPart = part;
1863
+ lastPartDebug = isBracket ? "[" + _part + "]" : "." + _part;
1864
+ });
1865
+ return {
1866
+ schema,
1867
+ parent,
1868
+ parentPath: lastPart
1869
+ };
1870
+ }
1871
+ class ReferenceSet {
1872
+ constructor() {
1873
+ this.list = /* @__PURE__ */ new Set();
1874
+ this.refs = /* @__PURE__ */ new Map();
1875
+ }
1876
+ get size() {
1877
+ return this.list.size + this.refs.size;
1878
+ }
1879
+ describe() {
1880
+ const description2 = [];
1881
+ for (const item of this.list)
1882
+ description2.push(item);
1883
+ for (const [, ref] of this.refs)
1884
+ description2.push(ref.describe());
1885
+ return description2;
1886
+ }
1887
+ toArray() {
1888
+ return Array.from(this.list).concat(Array.from(this.refs.values()));
1889
+ }
1890
+ add(value) {
1891
+ Reference.isRef(value) ? this.refs.set(value.key, value) : this.list.add(value);
1892
+ }
1893
+ delete(value) {
1894
+ Reference.isRef(value) ? this.refs.delete(value.key) : this.list.delete(value);
1895
+ }
1896
+ has(value, resolve) {
1897
+ if (this.list.has(value))
1898
+ return true;
1899
+ let item, values = this.refs.values();
1900
+ while (item = values.next(), !item.done)
1901
+ if (resolve(item.value) === value)
1902
+ return true;
1903
+ return false;
1904
+ }
1905
+ clone() {
1906
+ const next = new ReferenceSet();
1907
+ next.list = new Set(this.list);
1908
+ next.refs = new Map(this.refs);
1909
+ return next;
1910
+ }
1911
+ merge(newItems, removeItems) {
1912
+ const next = this.clone();
1913
+ newItems.list.forEach((value) => next.add(value));
1914
+ newItems.refs.forEach((value) => next.add(value));
1915
+ removeItems.list.forEach((value) => next.delete(value));
1916
+ removeItems.refs.forEach((value) => next.delete(value));
1917
+ return next;
1918
+ }
1919
+ }
1920
+ function _extends$1() {
1921
+ _extends$1 = Object.assign || function(target) {
1922
+ for (var i = 1; i < arguments.length; i++) {
1923
+ var source = arguments[i];
1924
+ for (var key in source) {
1925
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1926
+ target[key] = source[key];
1927
+ }
1928
+ }
1929
+ }
1930
+ return target;
1931
+ };
1932
+ return _extends$1.apply(this, arguments);
1933
+ }
1934
+ class BaseSchema {
1935
+ constructor(options) {
1936
+ this.deps = [];
1937
+ this.conditions = [];
1938
+ this._whitelist = new ReferenceSet();
1939
+ this._blacklist = new ReferenceSet();
1940
+ this.exclusiveTests = /* @__PURE__ */ Object.create(null);
1941
+ this.tests = [];
1942
+ this.transforms = [];
1943
+ this.withMutation(() => {
1944
+ this.typeError(mixed.notType);
1945
+ });
1946
+ this.type = (options == null ? void 0 : options.type) || "mixed";
1947
+ this.spec = _extends$1({
1948
+ strip: false,
1949
+ strict: false,
1950
+ abortEarly: true,
1951
+ recursive: true,
1952
+ nullable: false,
1953
+ presence: "optional"
1954
+ }, options == null ? void 0 : options.spec);
1955
+ }
1956
+ // TODO: remove
1957
+ get _type() {
1958
+ return this.type;
1959
+ }
1960
+ _typeCheck(_value) {
1961
+ return true;
1962
+ }
1963
+ clone(spec) {
1964
+ if (this._mutate) {
1965
+ if (spec)
1966
+ Object.assign(this.spec, spec);
1967
+ return this;
1968
+ }
1969
+ const next = Object.create(Object.getPrototypeOf(this));
1970
+ next.type = this.type;
1971
+ next._typeError = this._typeError;
1972
+ next._whitelistError = this._whitelistError;
1973
+ next._blacklistError = this._blacklistError;
1974
+ next._whitelist = this._whitelist.clone();
1975
+ next._blacklist = this._blacklist.clone();
1976
+ next.exclusiveTests = _extends$1({}, this.exclusiveTests);
1977
+ next.deps = [...this.deps];
1978
+ next.conditions = [...this.conditions];
1979
+ next.tests = [...this.tests];
1980
+ next.transforms = [...this.transforms];
1981
+ next.spec = clone(_extends$1({}, this.spec, spec));
1982
+ return next;
1983
+ }
1984
+ label(label) {
1985
+ var next = this.clone();
1986
+ next.spec.label = label;
1987
+ return next;
1988
+ }
1989
+ meta(...args) {
1990
+ if (args.length === 0)
1991
+ return this.spec.meta;
1992
+ let next = this.clone();
1993
+ next.spec.meta = Object.assign(next.spec.meta || {}, args[0]);
1994
+ return next;
1995
+ }
1996
+ // withContext<TContext extends AnyObject>(): BaseSchema<
1997
+ // TCast,
1998
+ // TContext,
1999
+ // TOutput
2000
+ // > {
2001
+ // return this as any;
2002
+ // }
2003
+ withMutation(fn) {
2004
+ let before = this._mutate;
2005
+ this._mutate = true;
2006
+ let result = fn(this);
2007
+ this._mutate = before;
2008
+ return result;
2009
+ }
2010
+ concat(schema) {
2011
+ if (!schema || schema === this)
2012
+ return this;
2013
+ if (schema.type !== this.type && this.type !== "mixed")
2014
+ throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema.type}`);
2015
+ let base = this;
2016
+ let combined = schema.clone();
2017
+ const mergedSpec = _extends$1({}, base.spec, combined.spec);
2018
+ combined.spec = mergedSpec;
2019
+ combined._typeError || (combined._typeError = base._typeError);
2020
+ combined._whitelistError || (combined._whitelistError = base._whitelistError);
2021
+ combined._blacklistError || (combined._blacklistError = base._blacklistError);
2022
+ combined._whitelist = base._whitelist.merge(schema._whitelist, schema._blacklist);
2023
+ combined._blacklist = base._blacklist.merge(schema._blacklist, schema._whitelist);
2024
+ combined.tests = base.tests;
2025
+ combined.exclusiveTests = base.exclusiveTests;
2026
+ combined.withMutation((next) => {
2027
+ schema.tests.forEach((fn) => {
2028
+ next.test(fn.OPTIONS);
2029
+ });
2030
+ });
2031
+ return combined;
2032
+ }
2033
+ isType(v) {
2034
+ if (this.spec.nullable && v === null)
2035
+ return true;
2036
+ return this._typeCheck(v);
2037
+ }
2038
+ resolve(options) {
2039
+ let schema = this;
2040
+ if (schema.conditions.length) {
2041
+ let conditions = schema.conditions;
2042
+ schema = schema.clone();
2043
+ schema.conditions = [];
2044
+ schema = conditions.reduce((schema2, condition) => condition.resolve(schema2, options), schema);
2045
+ schema = schema.resolve(options);
2046
+ }
2047
+ return schema;
2048
+ }
2049
+ /**
2050
+ *
2051
+ * @param {*} value
2052
+ * @param {Object} options
2053
+ * @param {*=} options.parent
2054
+ * @param {*=} options.context
2055
+ */
2056
+ cast(value, options = {}) {
2057
+ let resolvedSchema = this.resolve(_extends$1({
2058
+ value
2059
+ }, options));
2060
+ let result = resolvedSchema._cast(value, options);
2061
+ if (value !== void 0 && options.assert !== false && resolvedSchema.isType(result) !== true) {
2062
+ let formattedValue = printValue(value);
2063
+ let formattedResult = printValue(result);
2064
+ throw new TypeError(`The value of ${options.path || "field"} could not be cast to a value that satisfies the schema type: "${resolvedSchema._type}".
2065
+
2066
+ attempted value: ${formattedValue}
2067
+ ` + (formattedResult !== formattedValue ? `result of cast: ${formattedResult}` : ""));
2068
+ }
2069
+ return result;
2070
+ }
2071
+ _cast(rawValue, _options) {
2072
+ let value = rawValue === void 0 ? rawValue : this.transforms.reduce((value2, fn) => fn.call(this, value2, rawValue, this), rawValue);
2073
+ if (value === void 0) {
2074
+ value = this.getDefault();
2075
+ }
2076
+ return value;
2077
+ }
2078
+ _validate(_value, options = {}, cb) {
2079
+ let {
2080
+ sync,
2081
+ path,
2082
+ from = [],
2083
+ originalValue = _value,
2084
+ strict = this.spec.strict,
2085
+ abortEarly = this.spec.abortEarly
2086
+ } = options;
2087
+ let value = _value;
2088
+ if (!strict) {
2089
+ value = this._cast(value, _extends$1({
2090
+ assert: false
2091
+ }, options));
2092
+ }
2093
+ let args = {
2094
+ value,
2095
+ path,
2096
+ options,
2097
+ originalValue,
2098
+ schema: this,
2099
+ label: this.spec.label,
2100
+ sync,
2101
+ from
2102
+ };
2103
+ let initialTests = [];
2104
+ if (this._typeError)
2105
+ initialTests.push(this._typeError);
2106
+ if (this._whitelistError)
2107
+ initialTests.push(this._whitelistError);
2108
+ if (this._blacklistError)
2109
+ initialTests.push(this._blacklistError);
2110
+ runTests({
2111
+ args,
2112
+ value,
2113
+ path,
2114
+ sync,
2115
+ tests: initialTests,
2116
+ endEarly: abortEarly
2117
+ }, (err) => {
2118
+ if (err)
2119
+ return void cb(err, value);
2120
+ runTests({
2121
+ tests: this.tests,
2122
+ args,
2123
+ path,
2124
+ sync,
2125
+ value,
2126
+ endEarly: abortEarly
2127
+ }, cb);
2128
+ });
2129
+ }
2130
+ validate(value, options, maybeCb) {
2131
+ let schema = this.resolve(_extends$1({}, options, {
2132
+ value
2133
+ }));
2134
+ return typeof maybeCb === "function" ? schema._validate(value, options, maybeCb) : new Promise((resolve, reject) => schema._validate(value, options, (err, value2) => {
2135
+ if (err)
2136
+ reject(err);
2137
+ else
2138
+ resolve(value2);
2139
+ }));
2140
+ }
2141
+ validateSync(value, options) {
2142
+ let schema = this.resolve(_extends$1({}, options, {
2143
+ value
2144
+ }));
2145
+ let result;
2146
+ schema._validate(value, _extends$1({}, options, {
2147
+ sync: true
2148
+ }), (err, value2) => {
2149
+ if (err)
2150
+ throw err;
2151
+ result = value2;
2152
+ });
2153
+ return result;
2154
+ }
2155
+ isValid(value, options) {
2156
+ return this.validate(value, options).then(() => true, (err) => {
2157
+ if (ValidationError.isError(err))
2158
+ return false;
2159
+ throw err;
2160
+ });
2161
+ }
2162
+ isValidSync(value, options) {
2163
+ try {
2164
+ this.validateSync(value, options);
2165
+ return true;
2166
+ } catch (err) {
2167
+ if (ValidationError.isError(err))
2168
+ return false;
2169
+ throw err;
2170
+ }
2171
+ }
2172
+ _getDefault() {
2173
+ let defaultValue = this.spec.default;
2174
+ if (defaultValue == null) {
2175
+ return defaultValue;
2176
+ }
2177
+ return typeof defaultValue === "function" ? defaultValue.call(this) : clone(defaultValue);
2178
+ }
2179
+ getDefault(options) {
2180
+ let schema = this.resolve(options || {});
2181
+ return schema._getDefault();
2182
+ }
2183
+ default(def) {
2184
+ if (arguments.length === 0) {
2185
+ return this._getDefault();
2186
+ }
2187
+ let next = this.clone({
2188
+ default: def
2189
+ });
2190
+ return next;
2191
+ }
2192
+ strict(isStrict = true) {
2193
+ var next = this.clone();
2194
+ next.spec.strict = isStrict;
2195
+ return next;
2196
+ }
2197
+ _isPresent(value) {
2198
+ return value != null;
2199
+ }
2200
+ defined(message = mixed.defined) {
2201
+ return this.test({
2202
+ message,
2203
+ name: "defined",
2204
+ exclusive: true,
2205
+ test(value) {
2206
+ return value !== void 0;
2207
+ }
2208
+ });
2209
+ }
2210
+ required(message = mixed.required) {
2211
+ return this.clone({
2212
+ presence: "required"
2213
+ }).withMutation((s) => s.test({
2214
+ message,
2215
+ name: "required",
2216
+ exclusive: true,
2217
+ test(value) {
2218
+ return this.schema._isPresent(value);
2219
+ }
2220
+ }));
2221
+ }
2222
+ notRequired() {
2223
+ var next = this.clone({
2224
+ presence: "optional"
2225
+ });
2226
+ next.tests = next.tests.filter((test) => test.OPTIONS.name !== "required");
2227
+ return next;
2228
+ }
2229
+ nullable(isNullable = true) {
2230
+ var next = this.clone({
2231
+ nullable: isNullable !== false
2232
+ });
2233
+ return next;
2234
+ }
2235
+ transform(fn) {
2236
+ var next = this.clone();
2237
+ next.transforms.push(fn);
2238
+ return next;
2239
+ }
2240
+ /**
2241
+ * Adds a test function to the schema's queue of tests.
2242
+ * tests can be exclusive or non-exclusive.
2243
+ *
2244
+ * - exclusive tests, will replace any existing tests of the same name.
2245
+ * - non-exclusive: can be stacked
2246
+ *
2247
+ * If a non-exclusive test is added to a schema with an exclusive test of the same name
2248
+ * the exclusive test is removed and further tests of the same name will be stacked.
2249
+ *
2250
+ * If an exclusive test is added to a schema with non-exclusive tests of the same name
2251
+ * the previous tests are removed and further tests of the same name will replace each other.
2252
+ */
2253
+ test(...args) {
2254
+ let opts;
2255
+ if (args.length === 1) {
2256
+ if (typeof args[0] === "function") {
2257
+ opts = {
2258
+ test: args[0]
2259
+ };
2260
+ } else {
2261
+ opts = args[0];
2262
+ }
2263
+ } else if (args.length === 2) {
2264
+ opts = {
2265
+ name: args[0],
2266
+ test: args[1]
2267
+ };
2268
+ } else {
2269
+ opts = {
2270
+ name: args[0],
2271
+ message: args[1],
2272
+ test: args[2]
2273
+ };
2274
+ }
2275
+ if (opts.message === void 0)
2276
+ opts.message = mixed.default;
2277
+ if (typeof opts.test !== "function")
2278
+ throw new TypeError("`test` is a required parameters");
2279
+ let next = this.clone();
2280
+ let validate = createValidation(opts);
2281
+ let isExclusive = opts.exclusive || opts.name && next.exclusiveTests[opts.name] === true;
2282
+ if (opts.exclusive) {
2283
+ if (!opts.name)
2284
+ throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");
2285
+ }
2286
+ if (opts.name)
2287
+ next.exclusiveTests[opts.name] = !!opts.exclusive;
2288
+ next.tests = next.tests.filter((fn) => {
2289
+ if (fn.OPTIONS.name === opts.name) {
2290
+ if (isExclusive)
2291
+ return false;
2292
+ if (fn.OPTIONS.test === validate.OPTIONS.test)
2293
+ return false;
2294
+ }
2295
+ return true;
2296
+ });
2297
+ next.tests.push(validate);
2298
+ return next;
2299
+ }
2300
+ when(keys2, options) {
2301
+ if (!Array.isArray(keys2) && typeof keys2 !== "string") {
2302
+ options = keys2;
2303
+ keys2 = ".";
2304
+ }
2305
+ let next = this.clone();
2306
+ let deps = toArray(keys2).map((key) => new Reference(key));
2307
+ deps.forEach((dep) => {
2308
+ if (dep.isSibling)
2309
+ next.deps.push(dep.key);
2310
+ });
2311
+ next.conditions.push(new Condition(deps, options));
2312
+ return next;
2313
+ }
2314
+ typeError(message) {
2315
+ var next = this.clone();
2316
+ next._typeError = createValidation({
2317
+ message,
2318
+ name: "typeError",
2319
+ test(value) {
2320
+ if (value !== void 0 && !this.schema.isType(value))
2321
+ return this.createError({
2322
+ params: {
2323
+ type: this.schema._type
2324
+ }
2325
+ });
2326
+ return true;
2327
+ }
2328
+ });
2329
+ return next;
2330
+ }
2331
+ oneOf(enums, message = mixed.oneOf) {
2332
+ var next = this.clone();
2333
+ enums.forEach((val) => {
2334
+ next._whitelist.add(val);
2335
+ next._blacklist.delete(val);
2336
+ });
2337
+ next._whitelistError = createValidation({
2338
+ message,
2339
+ name: "oneOf",
2340
+ test(value) {
2341
+ if (value === void 0)
2342
+ return true;
2343
+ let valids = this.schema._whitelist;
2344
+ return valids.has(value, this.resolve) ? true : this.createError({
2345
+ params: {
2346
+ values: valids.toArray().join(", ")
2347
+ }
2348
+ });
2349
+ }
2350
+ });
2351
+ return next;
2352
+ }
2353
+ notOneOf(enums, message = mixed.notOneOf) {
2354
+ var next = this.clone();
2355
+ enums.forEach((val) => {
2356
+ next._blacklist.add(val);
2357
+ next._whitelist.delete(val);
2358
+ });
2359
+ next._blacklistError = createValidation({
2360
+ message,
2361
+ name: "notOneOf",
2362
+ test(value) {
2363
+ let invalids = this.schema._blacklist;
2364
+ if (invalids.has(value, this.resolve))
2365
+ return this.createError({
2366
+ params: {
2367
+ values: invalids.toArray().join(", ")
2368
+ }
2369
+ });
2370
+ return true;
2371
+ }
2372
+ });
2373
+ return next;
2374
+ }
2375
+ strip(strip = true) {
2376
+ let next = this.clone();
2377
+ next.spec.strip = strip;
2378
+ return next;
2379
+ }
2380
+ describe() {
2381
+ const next = this.clone();
2382
+ const {
2383
+ label,
2384
+ meta
2385
+ } = next.spec;
2386
+ const description2 = {
2387
+ meta,
2388
+ label,
2389
+ type: next.type,
2390
+ oneOf: next._whitelist.describe(),
2391
+ notOneOf: next._blacklist.describe(),
2392
+ tests: next.tests.map((fn) => ({
2393
+ name: fn.OPTIONS.name,
2394
+ params: fn.OPTIONS.params
2395
+ })).filter((n, idx, list) => list.findIndex((c) => c.name === n.name) === idx)
2396
+ };
2397
+ return description2;
2398
+ }
2399
+ }
2400
+ BaseSchema.prototype.__isYupSchema__ = true;
2401
+ for (const method of ["validate", "validateSync"])
2402
+ BaseSchema.prototype[`${method}At`] = function(path, value, options = {}) {
2403
+ const {
2404
+ parent,
2405
+ parentPath,
2406
+ schema
2407
+ } = getIn(this, path, value, options.context);
2408
+ return schema[method](parent && parent[parentPath], _extends$1({}, options, {
2409
+ parent,
2410
+ path
2411
+ }));
2412
+ };
2413
+ for (const alias of ["equals", "is"])
2414
+ BaseSchema.prototype[alias] = BaseSchema.prototype.oneOf;
2415
+ for (const alias of ["not", "nope"])
2416
+ BaseSchema.prototype[alias] = BaseSchema.prototype.notOneOf;
2417
+ BaseSchema.prototype.optional = BaseSchema.prototype.notRequired;
2418
+ const Mixed = BaseSchema;
2419
+ Mixed.prototype;
2420
+ const isAbsent = (value) => value == null;
2421
+ function create$2() {
2422
+ return new BooleanSchema();
2423
+ }
2424
+ class BooleanSchema extends BaseSchema {
2425
+ constructor() {
2426
+ super({
2427
+ type: "boolean"
2428
+ });
2429
+ this.withMutation(() => {
2430
+ this.transform(function(value) {
2431
+ if (!this.isType(value)) {
2432
+ if (/^(true|1)$/i.test(String(value)))
2433
+ return true;
2434
+ if (/^(false|0)$/i.test(String(value)))
2435
+ return false;
2436
+ }
2437
+ return value;
2438
+ });
2439
+ });
2440
+ }
2441
+ _typeCheck(v) {
2442
+ if (v instanceof Boolean)
2443
+ v = v.valueOf();
2444
+ return typeof v === "boolean";
2445
+ }
2446
+ isTrue(message = boolean.isValue) {
2447
+ return this.test({
2448
+ message,
2449
+ name: "is-value",
2450
+ exclusive: true,
2451
+ params: {
2452
+ value: "true"
2453
+ },
2454
+ test(value) {
2455
+ return isAbsent(value) || value === true;
2456
+ }
2457
+ });
2458
+ }
2459
+ isFalse(message = boolean.isValue) {
2460
+ return this.test({
2461
+ message,
2462
+ name: "is-value",
2463
+ exclusive: true,
2464
+ params: {
2465
+ value: "false"
2466
+ },
2467
+ test(value) {
2468
+ return isAbsent(value) || value === false;
2469
+ }
2470
+ });
2471
+ }
2472
+ }
2473
+ create$2.prototype = BooleanSchema.prototype;
2474
+ 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;
2475
+ 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;
2476
+ 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;
2477
+ let isTrimmed = (value) => isAbsent(value) || value === value.trim();
2478
+ let objStringTag = {}.toString();
2479
+ function create$1() {
2480
+ return new StringSchema();
2481
+ }
2482
+ class StringSchema extends BaseSchema {
2483
+ constructor() {
2484
+ super({
2485
+ type: "string"
2486
+ });
2487
+ this.withMutation(() => {
2488
+ this.transform(function(value) {
2489
+ if (this.isType(value))
2490
+ return value;
2491
+ if (Array.isArray(value))
2492
+ return value;
2493
+ const strValue = value != null && value.toString ? value.toString() : value;
2494
+ if (strValue === objStringTag)
2495
+ return value;
2496
+ return strValue;
2497
+ });
2498
+ });
2499
+ }
2500
+ _typeCheck(value) {
2501
+ if (value instanceof String)
2502
+ value = value.valueOf();
2503
+ return typeof value === "string";
2504
+ }
2505
+ _isPresent(value) {
2506
+ return super._isPresent(value) && !!value.length;
2507
+ }
2508
+ length(length, message = string.length) {
2509
+ return this.test({
2510
+ message,
2511
+ name: "length",
2512
+ exclusive: true,
2513
+ params: {
2514
+ length
2515
+ },
2516
+ test(value) {
2517
+ return isAbsent(value) || value.length === this.resolve(length);
2518
+ }
2519
+ });
2520
+ }
2521
+ min(min, message = string.min) {
2522
+ return this.test({
2523
+ message,
2524
+ name: "min",
2525
+ exclusive: true,
2526
+ params: {
2527
+ min
2528
+ },
2529
+ test(value) {
2530
+ return isAbsent(value) || value.length >= this.resolve(min);
2531
+ }
2532
+ });
2533
+ }
2534
+ max(max, message = string.max) {
2535
+ return this.test({
2536
+ name: "max",
2537
+ exclusive: true,
2538
+ message,
2539
+ params: {
2540
+ max
2541
+ },
2542
+ test(value) {
2543
+ return isAbsent(value) || value.length <= this.resolve(max);
2544
+ }
2545
+ });
2546
+ }
2547
+ matches(regex, options) {
2548
+ let excludeEmptyString = false;
2549
+ let message;
2550
+ let name2;
2551
+ if (options) {
2552
+ if (typeof options === "object") {
2553
+ ({
2554
+ excludeEmptyString = false,
2555
+ message,
2556
+ name: name2
2557
+ } = options);
2558
+ } else {
2559
+ message = options;
2560
+ }
2561
+ }
2562
+ return this.test({
2563
+ name: name2 || "matches",
2564
+ message: message || string.matches,
2565
+ params: {
2566
+ regex
2567
+ },
2568
+ test: (value) => isAbsent(value) || value === "" && excludeEmptyString || value.search(regex) !== -1
2569
+ });
2570
+ }
2571
+ email(message = string.email) {
2572
+ return this.matches(rEmail, {
2573
+ name: "email",
2574
+ message,
2575
+ excludeEmptyString: true
2576
+ });
2577
+ }
2578
+ url(message = string.url) {
2579
+ return this.matches(rUrl, {
2580
+ name: "url",
2581
+ message,
2582
+ excludeEmptyString: true
2583
+ });
2584
+ }
2585
+ uuid(message = string.uuid) {
2586
+ return this.matches(rUUID, {
2587
+ name: "uuid",
2588
+ message,
2589
+ excludeEmptyString: false
2590
+ });
2591
+ }
2592
+ //-- transforms --
2593
+ ensure() {
2594
+ return this.default("").transform((val) => val === null ? "" : val);
2595
+ }
2596
+ trim(message = string.trim) {
2597
+ return this.transform((val) => val != null ? val.trim() : val).test({
2598
+ message,
2599
+ name: "trim",
2600
+ test: isTrimmed
2601
+ });
2602
+ }
2603
+ lowercase(message = string.lowercase) {
2604
+ return this.transform((value) => !isAbsent(value) ? value.toLowerCase() : value).test({
2605
+ message,
2606
+ name: "string_case",
2607
+ exclusive: true,
2608
+ test: (value) => isAbsent(value) || value === value.toLowerCase()
2609
+ });
2610
+ }
2611
+ uppercase(message = string.uppercase) {
2612
+ return this.transform((value) => !isAbsent(value) ? value.toUpperCase() : value).test({
2613
+ message,
2614
+ name: "string_case",
2615
+ exclusive: true,
2616
+ test: (value) => isAbsent(value) || value === value.toUpperCase()
2617
+ });
2618
+ }
2619
+ }
2620
+ create$1.prototype = StringSchema.prototype;
2621
+ var isoReg = /^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;
2622
+ function parseIsoDate(date2) {
2623
+ var numericKeys = [1, 4, 5, 6, 7, 10, 11], minutesOffset = 0, timestamp, struct;
2624
+ if (struct = isoReg.exec(date2)) {
2625
+ for (var i = 0, k; k = numericKeys[i]; ++i)
2626
+ struct[k] = +struct[k] || 0;
2627
+ struct[2] = (+struct[2] || 1) - 1;
2628
+ struct[3] = +struct[3] || 1;
2629
+ struct[7] = struct[7] ? String(struct[7]).substr(0, 3) : 0;
2630
+ if ((struct[8] === void 0 || struct[8] === "") && (struct[9] === void 0 || struct[9] === ""))
2631
+ timestamp = +new Date(struct[1], struct[2], struct[3], struct[4], struct[5], struct[6], struct[7]);
2632
+ else {
2633
+ if (struct[8] !== "Z" && struct[9] !== void 0) {
2634
+ minutesOffset = struct[10] * 60 + struct[11];
2635
+ if (struct[9] === "+")
2636
+ minutesOffset = 0 - minutesOffset;
2637
+ }
2638
+ timestamp = Date.UTC(struct[1], struct[2], struct[3], struct[4], struct[5] + minutesOffset, struct[6], struct[7]);
2639
+ }
2640
+ } else
2641
+ timestamp = Date.parse ? Date.parse(date2) : NaN;
2642
+ return timestamp;
2643
+ }
2644
+ let invalidDate = /* @__PURE__ */ new Date("");
2645
+ let isDate = (obj) => Object.prototype.toString.call(obj) === "[object Date]";
2646
+ class DateSchema extends BaseSchema {
2647
+ constructor() {
2648
+ super({
2649
+ type: "date"
2650
+ });
2651
+ this.withMutation(() => {
2652
+ this.transform(function(value) {
2653
+ if (this.isType(value))
2654
+ return value;
2655
+ value = parseIsoDate(value);
2656
+ return !isNaN(value) ? new Date(value) : invalidDate;
2657
+ });
2658
+ });
2659
+ }
2660
+ _typeCheck(v) {
2661
+ return isDate(v) && !isNaN(v.getTime());
2662
+ }
2663
+ prepareParam(ref, name2) {
2664
+ let param;
2665
+ if (!Reference.isRef(ref)) {
2666
+ let cast = this.cast(ref);
2667
+ if (!this._typeCheck(cast))
2668
+ throw new TypeError(`\`${name2}\` must be a Date or a value that can be \`cast()\` to a Date`);
2669
+ param = cast;
2670
+ } else {
2671
+ param = ref;
2672
+ }
2673
+ return param;
2674
+ }
2675
+ min(min, message = date.min) {
2676
+ let limit = this.prepareParam(min, "min");
2677
+ return this.test({
2678
+ message,
2679
+ name: "min",
2680
+ exclusive: true,
2681
+ params: {
2682
+ min
2683
+ },
2684
+ test(value) {
2685
+ return isAbsent(value) || value >= this.resolve(limit);
2686
+ }
2687
+ });
2688
+ }
2689
+ max(max, message = date.max) {
2690
+ var limit = this.prepareParam(max, "max");
2691
+ return this.test({
2692
+ message,
2693
+ name: "max",
2694
+ exclusive: true,
2695
+ params: {
2696
+ max
2697
+ },
2698
+ test(value) {
2699
+ return isAbsent(value) || value <= this.resolve(limit);
2700
+ }
2701
+ });
2702
+ }
2703
+ }
2704
+ DateSchema.INVALID_DATE = invalidDate;
2705
+ DateSchema.prototype;
2706
+ function arrayReduce$1(array2, iteratee, accumulator, initAccum) {
2707
+ var index2 = -1, length = array2 == null ? 0 : array2.length;
2708
+ if (initAccum && length) {
2709
+ accumulator = array2[++index2];
2710
+ }
2711
+ while (++index2 < length) {
2712
+ accumulator = iteratee(accumulator, array2[index2], index2, array2);
2713
+ }
2714
+ return accumulator;
2715
+ }
2716
+ var _arrayReduce = arrayReduce$1;
2717
+ function basePropertyOf$1(object2) {
2718
+ return function(key) {
2719
+ return object2 == null ? void 0 : object2[key];
2720
+ };
2721
+ }
2722
+ var _basePropertyOf = basePropertyOf$1;
2723
+ var basePropertyOf = _basePropertyOf;
2724
+ var deburredLetters = {
2725
+ // Latin-1 Supplement block.
2726
+ "À": "A",
2727
+ "Á": "A",
2728
+ "Â": "A",
2729
+ "Ã": "A",
2730
+ "Ä": "A",
2731
+ "Å": "A",
2732
+ "à": "a",
2733
+ "á": "a",
2734
+ "â": "a",
2735
+ "ã": "a",
2736
+ "ä": "a",
2737
+ "å": "a",
2738
+ "Ç": "C",
2739
+ "ç": "c",
2740
+ "Ð": "D",
2741
+ "ð": "d",
2742
+ "È": "E",
2743
+ "É": "E",
2744
+ "Ê": "E",
2745
+ "Ë": "E",
2746
+ "è": "e",
2747
+ "é": "e",
2748
+ "ê": "e",
2749
+ "ë": "e",
2750
+ "Ì": "I",
2751
+ "Í": "I",
2752
+ "Î": "I",
2753
+ "Ï": "I",
2754
+ "ì": "i",
2755
+ "í": "i",
2756
+ "î": "i",
2757
+ "ï": "i",
2758
+ "Ñ": "N",
2759
+ "ñ": "n",
2760
+ "Ò": "O",
2761
+ "Ó": "O",
2762
+ "Ô": "O",
2763
+ "Õ": "O",
2764
+ "Ö": "O",
2765
+ "Ø": "O",
2766
+ "ò": "o",
2767
+ "ó": "o",
2768
+ "ô": "o",
2769
+ "õ": "o",
2770
+ "ö": "o",
2771
+ "ø": "o",
2772
+ "Ù": "U",
2773
+ "Ú": "U",
2774
+ "Û": "U",
2775
+ "Ü": "U",
2776
+ "ù": "u",
2777
+ "ú": "u",
2778
+ "û": "u",
2779
+ "ü": "u",
2780
+ "Ý": "Y",
2781
+ "ý": "y",
2782
+ "ÿ": "y",
2783
+ "Æ": "Ae",
2784
+ "æ": "ae",
2785
+ "Þ": "Th",
2786
+ "þ": "th",
2787
+ "ß": "ss",
2788
+ // Latin Extended-A block.
2789
+ "Ā": "A",
2790
+ "Ă": "A",
2791
+ "Ą": "A",
2792
+ "ā": "a",
2793
+ "ă": "a",
2794
+ "ą": "a",
2795
+ "Ć": "C",
2796
+ "Ĉ": "C",
2797
+ "Ċ": "C",
2798
+ "Č": "C",
2799
+ "ć": "c",
2800
+ "ĉ": "c",
2801
+ "ċ": "c",
2802
+ "č": "c",
2803
+ "Ď": "D",
2804
+ "Đ": "D",
2805
+ "ď": "d",
2806
+ "đ": "d",
2807
+ "Ē": "E",
2808
+ "Ĕ": "E",
2809
+ "Ė": "E",
2810
+ "Ę": "E",
2811
+ "Ě": "E",
2812
+ "ē": "e",
2813
+ "ĕ": "e",
2814
+ "ė": "e",
2815
+ "ę": "e",
2816
+ "ě": "e",
2817
+ "Ĝ": "G",
2818
+ "Ğ": "G",
2819
+ "Ġ": "G",
2820
+ "Ģ": "G",
2821
+ "ĝ": "g",
2822
+ "ğ": "g",
2823
+ "ġ": "g",
2824
+ "ģ": "g",
2825
+ "Ĥ": "H",
2826
+ "Ħ": "H",
2827
+ "ĥ": "h",
2828
+ "ħ": "h",
2829
+ "Ĩ": "I",
2830
+ "Ī": "I",
2831
+ "Ĭ": "I",
2832
+ "Į": "I",
2833
+ "İ": "I",
2834
+ "ĩ": "i",
2835
+ "ī": "i",
2836
+ "ĭ": "i",
2837
+ "į": "i",
2838
+ "ı": "i",
2839
+ "Ĵ": "J",
2840
+ "ĵ": "j",
2841
+ "Ķ": "K",
2842
+ "ķ": "k",
2843
+ "ĸ": "k",
2844
+ "Ĺ": "L",
2845
+ "Ļ": "L",
2846
+ "Ľ": "L",
2847
+ "Ŀ": "L",
2848
+ "Ł": "L",
2849
+ "ĺ": "l",
2850
+ "ļ": "l",
2851
+ "ľ": "l",
2852
+ "ŀ": "l",
2853
+ "ł": "l",
2854
+ "Ń": "N",
2855
+ "Ņ": "N",
2856
+ "Ň": "N",
2857
+ "Ŋ": "N",
2858
+ "ń": "n",
2859
+ "ņ": "n",
2860
+ "ň": "n",
2861
+ "ŋ": "n",
2862
+ "Ō": "O",
2863
+ "Ŏ": "O",
2864
+ "Ő": "O",
2865
+ "ō": "o",
2866
+ "ŏ": "o",
2867
+ "ő": "o",
2868
+ "Ŕ": "R",
2869
+ "Ŗ": "R",
2870
+ "Ř": "R",
2871
+ "ŕ": "r",
2872
+ "ŗ": "r",
2873
+ "ř": "r",
2874
+ "Ś": "S",
2875
+ "Ŝ": "S",
2876
+ "Ş": "S",
2877
+ "Š": "S",
2878
+ "ś": "s",
2879
+ "ŝ": "s",
2880
+ "ş": "s",
2881
+ "š": "s",
2882
+ "Ţ": "T",
2883
+ "Ť": "T",
2884
+ "Ŧ": "T",
2885
+ "ţ": "t",
2886
+ "ť": "t",
2887
+ "ŧ": "t",
2888
+ "Ũ": "U",
2889
+ "Ū": "U",
2890
+ "Ŭ": "U",
2891
+ "Ů": "U",
2892
+ "Ű": "U",
2893
+ "Ų": "U",
2894
+ "ũ": "u",
2895
+ "ū": "u",
2896
+ "ŭ": "u",
2897
+ "ů": "u",
2898
+ "ű": "u",
2899
+ "ų": "u",
2900
+ "Ŵ": "W",
2901
+ "ŵ": "w",
2902
+ "Ŷ": "Y",
2903
+ "ŷ": "y",
2904
+ "Ÿ": "Y",
2905
+ "Ź": "Z",
2906
+ "Ż": "Z",
2907
+ "Ž": "Z",
2908
+ "ź": "z",
2909
+ "ż": "z",
2910
+ "ž": "z",
2911
+ "IJ": "IJ",
2912
+ "ij": "ij",
2913
+ "Œ": "Oe",
2914
+ "œ": "oe",
2915
+ "ʼn": "'n",
2916
+ "ſ": "s"
2917
+ };
2918
+ var deburrLetter$1 = basePropertyOf(deburredLetters);
2919
+ var _deburrLetter = deburrLetter$1;
2920
+ var deburrLetter = _deburrLetter, toString$3 = toString_1;
2921
+ var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
2922
+ var rsComboMarksRange$3 = "\\u0300-\\u036f", reComboHalfMarksRange$3 = "\\ufe20-\\ufe2f", rsComboSymbolsRange$3 = "\\u20d0-\\u20ff", rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3;
2923
+ var rsCombo$2 = "[" + rsComboRange$3 + "]";
2924
+ var reComboMark = RegExp(rsCombo$2, "g");
2925
+ function deburr$1(string2) {
2926
+ string2 = toString$3(string2);
2927
+ return string2 && string2.replace(reLatin, deburrLetter).replace(reComboMark, "");
2928
+ }
2929
+ var deburr_1 = deburr$1;
2930
+ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
2931
+ function asciiWords$1(string2) {
2932
+ return string2.match(reAsciiWord) || [];
2933
+ }
2934
+ var _asciiWords = asciiWords$1;
2935
+ var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
2936
+ function hasUnicodeWord$1(string2) {
2937
+ return reHasUnicodeWord.test(string2);
2938
+ }
2939
+ var _hasUnicodeWord = hasUnicodeWord$1;
2940
+ var rsAstralRange$2 = "\\ud800-\\udfff", rsComboMarksRange$2 = "\\u0300-\\u036f", reComboHalfMarksRange$2 = "\\ufe20-\\ufe2f", rsComboSymbolsRange$2 = "\\u20d0-\\u20ff", rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange$2 = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
2941
+ var rsApos$1 = "['’]", rsBreak = "[" + rsBreakRange + "]", rsCombo$1 = "[" + rsComboRange$2 + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange$2 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz$1 = "\\ud83c[\\udffb-\\udfff]", rsModifier$1 = "(?:" + rsCombo$1 + "|" + rsFitz$1 + ")", rsNonAstral$1 = "[^" + rsAstralRange$2 + "]", rsRegional$1 = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair$1 = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ$2 = "\\u200d";
2942
+ var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos$1 + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos$1 + "(?:D|LL|M|RE|S|T|VE))?", reOptMod$1 = rsModifier$1 + "?", rsOptVar$1 = "[" + rsVarRange$2 + "]?", rsOptJoin$1 = "(?:" + rsZWJ$2 + "(?:" + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsOptVar$1 + reOptMod$1 + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1, rsEmoji = "(?:" + [rsDingbat, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsSeq$1;
2943
+ var reUnicodeWord = RegExp([
2944
+ rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
2945
+ rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
2946
+ rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
2947
+ rsUpper + "+" + rsOptContrUpper,
2948
+ rsOrdUpper,
2949
+ rsOrdLower,
2950
+ rsDigits,
2951
+ rsEmoji
2952
+ ].join("|"), "g");
2953
+ function unicodeWords$1(string2) {
2954
+ return string2.match(reUnicodeWord) || [];
2955
+ }
2956
+ var _unicodeWords = unicodeWords$1;
2957
+ var asciiWords = _asciiWords, hasUnicodeWord = _hasUnicodeWord, toString$2 = toString_1, unicodeWords = _unicodeWords;
2958
+ function words$1(string2, pattern, guard) {
2959
+ string2 = toString$2(string2);
2960
+ pattern = guard ? void 0 : pattern;
2961
+ if (pattern === void 0) {
2962
+ return hasUnicodeWord(string2) ? unicodeWords(string2) : asciiWords(string2);
2963
+ }
2964
+ return string2.match(pattern) || [];
2965
+ }
2966
+ var words_1 = words$1;
2967
+ var arrayReduce = _arrayReduce, deburr = deburr_1, words = words_1;
2968
+ var rsApos = "['’]";
2969
+ var reApos = RegExp(rsApos, "g");
2970
+ function createCompounder$2(callback) {
2971
+ return function(string2) {
2972
+ return arrayReduce(words(deburr(string2).replace(reApos, "")), callback, "");
2973
+ };
2974
+ }
2975
+ var _createCompounder = createCompounder$2;
2976
+ var createCompounder$1 = _createCompounder;
2977
+ var snakeCase = createCompounder$1(function(result, word, index2) {
2978
+ return result + (index2 ? "_" : "") + word.toLowerCase();
2979
+ });
2980
+ var snakeCase_1 = snakeCase;
2981
+ const snakeCase$1 = /* @__PURE__ */ getDefaultExportFromCjs(snakeCase_1);
2982
+ function baseSlice$1(array2, start, end) {
2983
+ var index2 = -1, length = array2.length;
2984
+ if (start < 0) {
2985
+ start = -start > length ? 0 : length + start;
2986
+ }
2987
+ end = end > length ? length : end;
2988
+ if (end < 0) {
2989
+ end += length;
2990
+ }
2991
+ length = start > end ? 0 : end - start >>> 0;
2992
+ start >>>= 0;
2993
+ var result = Array(length);
2994
+ while (++index2 < length) {
2995
+ result[index2] = array2[index2 + start];
2996
+ }
2997
+ return result;
2998
+ }
2999
+ var _baseSlice = baseSlice$1;
3000
+ var baseSlice = _baseSlice;
3001
+ function castSlice$1(array2, start, end) {
3002
+ var length = array2.length;
3003
+ end = end === void 0 ? length : end;
3004
+ return !start && end >= length ? array2 : baseSlice(array2, start, end);
3005
+ }
3006
+ var _castSlice = castSlice$1;
3007
+ var rsAstralRange$1 = "\\ud800-\\udfff", rsComboMarksRange$1 = "\\u0300-\\u036f", reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f", rsComboSymbolsRange$1 = "\\u20d0-\\u20ff", rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1, rsVarRange$1 = "\\ufe0e\\ufe0f";
3008
+ var rsZWJ$1 = "\\u200d";
3009
+ var reHasUnicode = RegExp("[" + rsZWJ$1 + rsAstralRange$1 + rsComboRange$1 + rsVarRange$1 + "]");
3010
+ function hasUnicode$2(string2) {
3011
+ return reHasUnicode.test(string2);
3012
+ }
3013
+ var _hasUnicode = hasUnicode$2;
3014
+ function asciiToArray$1(string2) {
3015
+ return string2.split("");
3016
+ }
3017
+ var _asciiToArray = asciiToArray$1;
3018
+ var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsVarRange = "\\ufe0e\\ufe0f";
3019
+ var rsAstral = "[" + rsAstralRange + "]", rsCombo = "[" + rsComboRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsZWJ = "\\u200d";
3020
+ var reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
3021
+ var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
3022
+ function unicodeToArray$1(string2) {
3023
+ return string2.match(reUnicode) || [];
3024
+ }
3025
+ var _unicodeToArray = unicodeToArray$1;
3026
+ var asciiToArray = _asciiToArray, hasUnicode$1 = _hasUnicode, unicodeToArray = _unicodeToArray;
3027
+ function stringToArray$1(string2) {
3028
+ return hasUnicode$1(string2) ? unicodeToArray(string2) : asciiToArray(string2);
3029
+ }
3030
+ var _stringToArray = stringToArray$1;
3031
+ var castSlice = _castSlice, hasUnicode = _hasUnicode, stringToArray = _stringToArray, toString$1 = toString_1;
3032
+ function createCaseFirst$1(methodName) {
3033
+ return function(string2) {
3034
+ string2 = toString$1(string2);
3035
+ var strSymbols = hasUnicode(string2) ? stringToArray(string2) : void 0;
3036
+ var chr = strSymbols ? strSymbols[0] : string2.charAt(0);
3037
+ var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string2.slice(1);
3038
+ return chr[methodName]() + trailing;
3039
+ };
3040
+ }
3041
+ var _createCaseFirst = createCaseFirst$1;
3042
+ var createCaseFirst = _createCaseFirst;
3043
+ var upperFirst$1 = createCaseFirst("toUpperCase");
3044
+ var upperFirst_1 = upperFirst$1;
3045
+ var toString = toString_1, upperFirst = upperFirst_1;
3046
+ function capitalize$1(string2) {
3047
+ return upperFirst(toString(string2).toLowerCase());
3048
+ }
3049
+ var capitalize_1 = capitalize$1;
3050
+ var capitalize = capitalize_1, createCompounder = _createCompounder;
3051
+ var camelCase = createCompounder(function(result, word, index2) {
3052
+ word = word.toLowerCase();
3053
+ return result + (index2 ? capitalize(word) : word);
3054
+ });
3055
+ var camelCase_1 = camelCase;
3056
+ const camelCase$1 = /* @__PURE__ */ getDefaultExportFromCjs(camelCase_1);
3057
+ var baseAssignValue = _baseAssignValue, baseForOwn = _baseForOwn, baseIteratee = _baseIteratee;
3058
+ function mapKeys(object2, iteratee) {
3059
+ var result = {};
3060
+ iteratee = baseIteratee(iteratee);
3061
+ baseForOwn(object2, function(value, key, object3) {
3062
+ baseAssignValue(result, iteratee(value, key, object3), value);
3063
+ });
3064
+ return result;
3065
+ }
3066
+ var mapKeys_1 = mapKeys;
3067
+ const mapKeys$1 = /* @__PURE__ */ getDefaultExportFromCjs(mapKeys_1);
3068
+ var toposort$2 = { exports: {} };
3069
+ toposort$2.exports = function(edges) {
3070
+ return toposort(uniqueNodes(edges), edges);
3071
+ };
3072
+ toposort$2.exports.array = toposort;
3073
+ function toposort(nodes, edges) {
3074
+ var cursor = nodes.length, sorted = new Array(cursor), visited = {}, i = cursor, outgoingEdges = makeOutgoingEdges(edges), nodesHash = makeNodesHash(nodes);
3075
+ edges.forEach(function(edge) {
3076
+ if (!nodesHash.has(edge[0]) || !nodesHash.has(edge[1])) {
3077
+ throw new Error("Unknown node. There is an unknown node in the supplied edges.");
3078
+ }
3079
+ });
3080
+ while (i--) {
3081
+ if (!visited[i])
3082
+ visit(nodes[i], i, /* @__PURE__ */ new Set());
3083
+ }
3084
+ return sorted;
3085
+ function visit(node, i2, predecessors) {
3086
+ if (predecessors.has(node)) {
3087
+ var nodeRep;
3088
+ try {
3089
+ nodeRep = ", node was:" + JSON.stringify(node);
3090
+ } catch (e) {
3091
+ nodeRep = "";
3092
+ }
3093
+ throw new Error("Cyclic dependency" + nodeRep);
3094
+ }
3095
+ if (!nodesHash.has(node)) {
3096
+ throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: " + JSON.stringify(node));
3097
+ }
3098
+ if (visited[i2])
3099
+ return;
3100
+ visited[i2] = true;
3101
+ var outgoing = outgoingEdges.get(node) || /* @__PURE__ */ new Set();
3102
+ outgoing = Array.from(outgoing);
3103
+ if (i2 = outgoing.length) {
3104
+ predecessors.add(node);
3105
+ do {
3106
+ var child = outgoing[--i2];
3107
+ visit(child, nodesHash.get(child), predecessors);
3108
+ } while (i2);
3109
+ predecessors.delete(node);
3110
+ }
3111
+ sorted[--cursor] = node;
3112
+ }
3113
+ }
3114
+ function uniqueNodes(arr) {
3115
+ var res = /* @__PURE__ */ new Set();
3116
+ for (var i = 0, len = arr.length; i < len; i++) {
3117
+ var edge = arr[i];
3118
+ res.add(edge[0]);
3119
+ res.add(edge[1]);
3120
+ }
3121
+ return Array.from(res);
3122
+ }
3123
+ function makeOutgoingEdges(arr) {
3124
+ var edges = /* @__PURE__ */ new Map();
3125
+ for (var i = 0, len = arr.length; i < len; i++) {
3126
+ var edge = arr[i];
3127
+ if (!edges.has(edge[0]))
3128
+ edges.set(edge[0], /* @__PURE__ */ new Set());
3129
+ if (!edges.has(edge[1]))
3130
+ edges.set(edge[1], /* @__PURE__ */ new Set());
3131
+ edges.get(edge[0]).add(edge[1]);
3132
+ }
3133
+ return edges;
3134
+ }
3135
+ function makeNodesHash(arr) {
3136
+ var res = /* @__PURE__ */ new Map();
3137
+ for (var i = 0, len = arr.length; i < len; i++) {
3138
+ res.set(arr[i], i);
3139
+ }
3140
+ return res;
3141
+ }
3142
+ var toposortExports = toposort$2.exports;
3143
+ const toposort$1 = /* @__PURE__ */ getDefaultExportFromCjs(toposortExports);
3144
+ function sortFields(fields, excludes = []) {
3145
+ let edges = [];
3146
+ let nodes = [];
3147
+ function addNode(depPath, key) {
3148
+ var node = propertyExpr.split(depPath)[0];
3149
+ if (!~nodes.indexOf(node))
3150
+ nodes.push(node);
3151
+ if (!~excludes.indexOf(`${key}-${node}`))
3152
+ edges.push([key, node]);
3153
+ }
3154
+ for (const key in fields)
3155
+ if (has$1(fields, key)) {
3156
+ let value = fields[key];
3157
+ if (!~nodes.indexOf(key))
3158
+ nodes.push(key);
3159
+ if (Reference.isRef(value) && value.isSibling)
3160
+ addNode(value.path, key);
3161
+ else if (isSchema(value) && "deps" in value)
3162
+ value.deps.forEach((path) => addNode(path, key));
3163
+ }
3164
+ return toposort$1.array(nodes, edges).reverse();
3165
+ }
3166
+ function findIndex(arr, err) {
3167
+ let idx = Infinity;
3168
+ arr.some((key, ii) => {
3169
+ var _err$path;
3170
+ if (((_err$path = err.path) == null ? void 0 : _err$path.indexOf(key)) !== -1) {
3171
+ idx = ii;
3172
+ return true;
3173
+ }
3174
+ });
3175
+ return idx;
3176
+ }
3177
+ function sortByKeyOrder(keys2) {
3178
+ return (a, b) => {
3179
+ return findIndex(keys2, a) - findIndex(keys2, b);
3180
+ };
3181
+ }
3182
+ function _extends() {
3183
+ _extends = Object.assign || function(target) {
3184
+ for (var i = 1; i < arguments.length; i++) {
3185
+ var source = arguments[i];
3186
+ for (var key in source) {
3187
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
3188
+ target[key] = source[key];
3189
+ }
3190
+ }
3191
+ }
3192
+ return target;
3193
+ };
3194
+ return _extends.apply(this, arguments);
3195
+ }
3196
+ let isObject = (obj) => Object.prototype.toString.call(obj) === "[object Object]";
3197
+ function unknown(ctx, value) {
3198
+ let known = Object.keys(ctx.fields);
3199
+ return Object.keys(value).filter((key) => known.indexOf(key) === -1);
3200
+ }
3201
+ const defaultSort = sortByKeyOrder([]);
3202
+ class ObjectSchema extends BaseSchema {
3203
+ constructor(spec) {
3204
+ super({
3205
+ type: "object"
3206
+ });
3207
+ this.fields = /* @__PURE__ */ Object.create(null);
3208
+ this._sortErrors = defaultSort;
3209
+ this._nodes = [];
3210
+ this._excludedEdges = [];
3211
+ this.withMutation(() => {
3212
+ this.transform(function coerce(value) {
3213
+ if (typeof value === "string") {
3214
+ try {
3215
+ value = JSON.parse(value);
3216
+ } catch (err) {
3217
+ value = null;
3218
+ }
3219
+ }
3220
+ if (this.isType(value))
3221
+ return value;
3222
+ return null;
3223
+ });
3224
+ if (spec) {
3225
+ this.shape(spec);
3226
+ }
3227
+ });
3228
+ }
3229
+ _typeCheck(value) {
3230
+ return isObject(value) || typeof value === "function";
3231
+ }
3232
+ _cast(_value, options = {}) {
3233
+ var _options$stripUnknown;
3234
+ let value = super._cast(_value, options);
3235
+ if (value === void 0)
3236
+ return this.getDefault();
3237
+ if (!this._typeCheck(value))
3238
+ return value;
3239
+ let fields = this.fields;
3240
+ let strip = (_options$stripUnknown = options.stripUnknown) != null ? _options$stripUnknown : this.spec.noUnknown;
3241
+ let props = this._nodes.concat(Object.keys(value).filter((v) => this._nodes.indexOf(v) === -1));
3242
+ let intermediateValue = {};
3243
+ let innerOptions = _extends({}, options, {
3244
+ parent: intermediateValue,
3245
+ __validating: options.__validating || false
3246
+ });
3247
+ let isChanged = false;
3248
+ for (const prop of props) {
3249
+ let field = fields[prop];
3250
+ let exists = has$1(value, prop);
3251
+ if (field) {
3252
+ let fieldValue;
3253
+ let inputValue = value[prop];
3254
+ innerOptions.path = (options.path ? `${options.path}.` : "") + prop;
3255
+ field = field.resolve({
3256
+ value: inputValue,
3257
+ context: options.context,
3258
+ parent: intermediateValue
3259
+ });
3260
+ let fieldSpec = "spec" in field ? field.spec : void 0;
3261
+ let strict = fieldSpec == null ? void 0 : fieldSpec.strict;
3262
+ if (fieldSpec == null ? void 0 : fieldSpec.strip) {
3263
+ isChanged = isChanged || prop in value;
3264
+ continue;
3265
+ }
3266
+ fieldValue = !options.__validating || !strict ? (
3267
+ // TODO: use _cast, this is double resolving
3268
+ field.cast(value[prop], innerOptions)
3269
+ ) : value[prop];
3270
+ if (fieldValue !== void 0) {
3271
+ intermediateValue[prop] = fieldValue;
3272
+ }
3273
+ } else if (exists && !strip) {
3274
+ intermediateValue[prop] = value[prop];
3275
+ }
3276
+ if (intermediateValue[prop] !== value[prop]) {
3277
+ isChanged = true;
3278
+ }
3279
+ }
3280
+ return isChanged ? intermediateValue : value;
3281
+ }
3282
+ _validate(_value, opts = {}, callback) {
3283
+ let errors = [];
3284
+ let {
3285
+ sync,
3286
+ from = [],
3287
+ originalValue = _value,
3288
+ abortEarly = this.spec.abortEarly,
3289
+ recursive = this.spec.recursive
3290
+ } = opts;
3291
+ from = [{
3292
+ schema: this,
3293
+ value: originalValue
3294
+ }, ...from];
3295
+ opts.__validating = true;
3296
+ opts.originalValue = originalValue;
3297
+ opts.from = from;
3298
+ super._validate(_value, opts, (err, value) => {
3299
+ if (err) {
3300
+ if (!ValidationError.isError(err) || abortEarly) {
3301
+ return void callback(err, value);
3302
+ }
3303
+ errors.push(err);
3304
+ }
3305
+ if (!recursive || !isObject(value)) {
3306
+ callback(errors[0] || null, value);
3307
+ return;
3308
+ }
3309
+ originalValue = originalValue || value;
3310
+ let tests = this._nodes.map((key) => (_, cb) => {
3311
+ let path = key.indexOf(".") === -1 ? (opts.path ? `${opts.path}.` : "") + key : `${opts.path || ""}["${key}"]`;
3312
+ let field = this.fields[key];
3313
+ if (field && "validate" in field) {
3314
+ field.validate(value[key], _extends({}, opts, {
3315
+ // @ts-ignore
3316
+ path,
3317
+ from,
3318
+ // inner fields are always strict:
3319
+ // 1. this isn't strict so the casting will also have cast inner values
3320
+ // 2. this is strict in which case the nested values weren't cast either
3321
+ strict: true,
3322
+ parent: value,
3323
+ originalValue: originalValue[key]
3324
+ }), cb);
3325
+ return;
3326
+ }
3327
+ cb(null);
3328
+ });
3329
+ runTests({
3330
+ sync,
3331
+ tests,
3332
+ value,
3333
+ errors,
3334
+ endEarly: abortEarly,
3335
+ sort: this._sortErrors,
3336
+ path: opts.path
3337
+ }, callback);
3338
+ });
3339
+ }
3340
+ clone(spec) {
3341
+ const next = super.clone(spec);
3342
+ next.fields = _extends({}, this.fields);
3343
+ next._nodes = this._nodes;
3344
+ next._excludedEdges = this._excludedEdges;
3345
+ next._sortErrors = this._sortErrors;
3346
+ return next;
3347
+ }
3348
+ concat(schema) {
3349
+ let next = super.concat(schema);
3350
+ let nextFields = next.fields;
3351
+ for (let [field, schemaOrRef] of Object.entries(this.fields)) {
3352
+ const target = nextFields[field];
3353
+ if (target === void 0) {
3354
+ nextFields[field] = schemaOrRef;
3355
+ } else if (target instanceof BaseSchema && schemaOrRef instanceof BaseSchema) {
3356
+ nextFields[field] = schemaOrRef.concat(target);
3357
+ }
3358
+ }
3359
+ return next.withMutation(() => next.shape(nextFields));
3360
+ }
3361
+ getDefaultFromShape() {
3362
+ let dft = {};
3363
+ this._nodes.forEach((key) => {
3364
+ const field = this.fields[key];
3365
+ dft[key] = "default" in field ? field.getDefault() : void 0;
3366
+ });
3367
+ return dft;
3368
+ }
3369
+ _getDefault() {
3370
+ if ("default" in this.spec) {
3371
+ return super._getDefault();
3372
+ }
3373
+ if (!this._nodes.length) {
3374
+ return void 0;
3375
+ }
3376
+ return this.getDefaultFromShape();
3377
+ }
3378
+ shape(additions, excludes = []) {
3379
+ let next = this.clone();
3380
+ let fields = Object.assign(next.fields, additions);
3381
+ next.fields = fields;
3382
+ next._sortErrors = sortByKeyOrder(Object.keys(fields));
3383
+ if (excludes.length) {
3384
+ if (!Array.isArray(excludes[0]))
3385
+ excludes = [excludes];
3386
+ let keys2 = excludes.map(([first, second]) => `${first}-${second}`);
3387
+ next._excludedEdges = next._excludedEdges.concat(keys2);
3388
+ }
3389
+ next._nodes = sortFields(fields, next._excludedEdges);
3390
+ return next;
3391
+ }
3392
+ pick(keys2) {
3393
+ const picked = {};
3394
+ for (const key of keys2) {
3395
+ if (this.fields[key])
3396
+ picked[key] = this.fields[key];
3397
+ }
3398
+ return this.clone().withMutation((next) => {
3399
+ next.fields = {};
3400
+ return next.shape(picked);
3401
+ });
3402
+ }
3403
+ omit(keys2) {
3404
+ const next = this.clone();
3405
+ const fields = next.fields;
3406
+ next.fields = {};
3407
+ for (const key of keys2) {
3408
+ delete fields[key];
3409
+ }
3410
+ return next.withMutation(() => next.shape(fields));
3411
+ }
3412
+ from(from, to, alias) {
3413
+ let fromGetter = propertyExpr.getter(from, true);
3414
+ return this.transform((obj) => {
3415
+ if (obj == null)
3416
+ return obj;
3417
+ let newObj = obj;
3418
+ if (has$1(obj, from)) {
3419
+ newObj = _extends({}, obj);
3420
+ if (!alias)
3421
+ delete newObj[from];
3422
+ newObj[to] = fromGetter(obj);
3423
+ }
3424
+ return newObj;
3425
+ });
3426
+ }
3427
+ noUnknown(noAllow = true, message = object.noUnknown) {
3428
+ if (typeof noAllow === "string") {
3429
+ message = noAllow;
3430
+ noAllow = true;
3431
+ }
3432
+ let next = this.test({
3433
+ name: "noUnknown",
3434
+ exclusive: true,
3435
+ message,
3436
+ test(value) {
3437
+ if (value == null)
3438
+ return true;
3439
+ const unknownKeys = unknown(this.schema, value);
3440
+ return !noAllow || unknownKeys.length === 0 || this.createError({
3441
+ params: {
3442
+ unknown: unknownKeys.join(", ")
3443
+ }
3444
+ });
3445
+ }
3446
+ });
3447
+ next.spec.noUnknown = noAllow;
3448
+ return next;
3449
+ }
3450
+ unknown(allow = true, message = object.noUnknown) {
3451
+ return this.noUnknown(!allow, message);
3452
+ }
3453
+ transformKeys(fn) {
3454
+ return this.transform((obj) => obj && mapKeys$1(obj, (_, key) => fn(key)));
3455
+ }
3456
+ camelCase() {
3457
+ return this.transformKeys(camelCase$1);
3458
+ }
3459
+ snakeCase() {
3460
+ return this.transformKeys(snakeCase$1);
3461
+ }
3462
+ constantCase() {
3463
+ return this.transformKeys((key) => snakeCase$1(key).toUpperCase());
3464
+ }
3465
+ describe() {
3466
+ let base = super.describe();
3467
+ base.fields = mapValues$1(this.fields, (value) => value.describe());
3468
+ return base;
3469
+ }
3470
+ }
3471
+ function create(spec) {
3472
+ return new ObjectSchema(spec);
3473
+ }
3474
+ create.prototype = ObjectSchema.prototype;
3475
+ const mediaLibIcon = '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.3.6a.9.9 0 100 1.8h15.311a.9.9 0 100-1.8H4.301zm17.1 3.7A1.6 1.6 0 0123 5.9v15.5a1.6 1.6 0 01-1.6 1.6H2.6A1.601 1.601 0 011 21.4V8 5.915C1 5.03 1.716 4.3 2.6 4.3h18.8zM5.032 19.18h14.336l-3.136-3.205-1.792 1.831-4.032-4.12-5.376 5.494zm13.44-8.697c0 1.282-.985 2.289-2.24 2.289-1.254 0-2.24-1.007-2.24-2.29 0-1.281.986-2.288 2.24-2.288 1.255 0 2.24 1.007 2.24 2.289z"></path></svg>';
3476
+ class StrapiMediaLib extends cke.Plugin {
3477
+ /**
3478
+ * Strapi function used to show media library modal.
3479
+ * Should be provided via connect method before using toggle method.
3480
+ *
3481
+ * @type {function|null}
3482
+ */
3483
+ strapiToggle = null;
3484
+ static get pluginName() {
3485
+ return "StrapiMediaLib";
3486
+ }
3487
+ init() {
3488
+ const editor = this.editor;
3489
+ const config = editor.config.get("strapiMediaLib");
3490
+ editor.ui.componentFactory.add("strapiMediaLib", () => {
3491
+ const button = new cke.ButtonView();
3492
+ button.set({
3493
+ label: "Media Library",
3494
+ icon: mediaLibIcon,
3495
+ tooltip: true
3496
+ });
3497
+ button.on("execute", config.toggle.bind(this));
3498
+ return button;
3499
+ });
3500
+ }
3501
+ }
3502
+ class StrapiUploadAdapter extends cke.Plugin {
3503
+ static get requires() {
3504
+ return [cke.FileRepository];
3505
+ }
3506
+ static get pluginName() {
3507
+ return "StrapiUploadAdapter";
3508
+ }
3509
+ init() {
3510
+ const options = this.editor.config.get("strapiUploadAdapter");
3511
+ if (!options) {
3512
+ return;
3513
+ }
3514
+ if (!options.uploadUrl) {
3515
+ console.warn(
3516
+ 'strapi-upload-adapter-missing-uploadUrl: Missing the "uploadUrl" property in the "strapiUploadAdapter" editor configuration.'
3517
+ );
3518
+ return;
3519
+ }
3520
+ this.editor.plugins.get(cke.FileRepository).createUploadAdapter = (loader) => {
3521
+ return new Adapter(loader, options);
3522
+ };
3523
+ }
3524
+ }
3525
+ class Adapter {
3526
+ /**
3527
+ * Creates a new adapter instance.
3528
+ */
3529
+ constructor(loader, options) {
3530
+ this.loader = loader;
3531
+ this.options = options;
3532
+ }
3533
+ /**
3534
+ * Starts the upload process.
3535
+ *
3536
+ * @returns {Promise}
3537
+ */
3538
+ upload() {
3539
+ return this.loader.file.then(
3540
+ (file) => new Promise((resolve, reject) => {
3541
+ this._initRequest();
3542
+ this._initListeners(resolve, reject, file);
3543
+ this._sendRequest(file);
3544
+ })
3545
+ );
3546
+ }
3547
+ /**
3548
+ * Aborts the upload process.
3549
+ *
3550
+ * @returns {Promise}
3551
+ */
3552
+ abort() {
3553
+ if (this.xhr) {
3554
+ this.xhr.abort();
3555
+ }
3556
+ }
3557
+ /**
3558
+ * Initializes the `XMLHttpRequest` object using the URL specified as
3559
+ * `strapiUpload.uploadUrl` in the editor's
3560
+ * configuration.
3561
+ *
3562
+ * @private
3563
+ */
3564
+ _initRequest() {
3565
+ const xhr = this.xhr = new XMLHttpRequest();
3566
+ xhr.open("POST", this.options.uploadUrl, true);
3567
+ xhr.responseType = "json";
3568
+ }
3569
+ /**
3570
+ * Initializes XMLHttpRequest listeners
3571
+ *
3572
+ * @private
3573
+ * @param {Function} resolve Callback function to be called when the request is successful.
3574
+ * @param {Function} reject Callback function to be called when the request cannot be completed.
3575
+ * @param {File} file Native File object.
3576
+ */
3577
+ _initListeners(resolve, reject, file) {
3578
+ const xhr = this.xhr;
3579
+ const loader = this.loader;
3580
+ const genericErrorText = `Couldn't upload file: ${file.name}.`;
3581
+ xhr.addEventListener("error", () => reject(genericErrorText));
3582
+ xhr.addEventListener("abort", () => reject());
3583
+ xhr.addEventListener("load", () => {
3584
+ const response = xhr.response;
3585
+ if (!Array.isArray(response) || response.error || response.length !== 1) {
3586
+ return reject(
3587
+ response && response.error && response.error.message ? response.error.message : genericErrorText
3588
+ );
3589
+ }
3590
+ const { backendUrl, responsive } = this.options || {};
3591
+ const { name: name2, url, alternativeText, formats, provider } = response[0];
3592
+ const defaultUrl = provider !== "local" ? url : backendUrl + url;
3593
+ if (formats && responsive) {
3594
+ let urls = { default: defaultUrl };
3595
+ let keys2 = Object.keys(formats).sort(
3596
+ (a, b) => formats[a].width - formats[b].width
3597
+ );
3598
+ keys2.map(
3599
+ (k) => urls[formats[k].width] = provider !== "local" ? url : backendUrl + formats[k].url
3600
+ );
3601
+ resolve({ alt: alternativeText || name2, urls });
3602
+ } else {
3603
+ resolve(
3604
+ url ? {
3605
+ alt: alternativeText || name2,
3606
+ urls: { default: defaultUrl }
3607
+ } : null
3608
+ );
3609
+ }
3610
+ });
3611
+ if (xhr.upload) {
3612
+ xhr.upload.addEventListener("progress", (evt) => {
3613
+ if (evt.lengthComputable) {
3614
+ loader.uploadTotal = evt.total;
3615
+ loader.uploaded = evt.loaded;
3616
+ }
3617
+ });
3618
+ }
3619
+ }
3620
+ /**
3621
+ * Prepares the data and sends the request.
3622
+ *
3623
+ * @private
3624
+ * @param {File} file File instance to be uploaded.
3625
+ */
3626
+ _sendRequest(file) {
3627
+ const headers = this.options.headers || {};
3628
+ const withCredentials = this.options.withCredentials || false;
3629
+ for (const headerName of Object.keys(headers)) {
3630
+ this.xhr.setRequestHeader(headerName, headers[headerName]);
3631
+ }
3632
+ this.xhr.withCredentials = withCredentials;
3633
+ const data = new FormData();
3634
+ data.append("files", file);
3635
+ this.xhr.send(data);
3636
+ }
3637
+ }
3638
+ const materialColors = [
3639
+ { label: "Red 50", color: "#ffebee" },
3640
+ { label: "Purple 50", color: "#f3e5f5" },
3641
+ { label: "Indigo 50", color: "#e8eaf6" },
3642
+ { label: "Blue 50", color: "#e3f2fd" },
3643
+ { label: "Cyan 50", color: "#e0f7fa" },
3644
+ { label: "Teal 50", color: "#e0f2f1" },
3645
+ { label: "Light green 50", color: "#f1f8e9" },
3646
+ { label: "Lime 50", color: "#f9fbe7" },
3647
+ { label: "Amber 50", color: "#fff8e1" },
3648
+ { label: "Orange 50", color: "#fff3e0" },
3649
+ { label: "Grey 50", color: "#fafafa" },
3650
+ { label: "Blue grey 50", color: "#eceff1" },
3651
+ { label: "Red 100", color: "#ffcdd2" },
3652
+ { label: "Purple 100", color: "#e1bee7" },
3653
+ { label: "Indigo 100", color: "#c5cae9" },
3654
+ { label: "Blue 100", color: "#bbdefb" },
3655
+ { label: "Cyan 100", color: "#b2ebf2" },
3656
+ { label: "Teal 100", color: "#b2dfdb" },
3657
+ { label: "Light green 100", color: "#dcedc8" },
3658
+ { label: "Lime 100", color: "#f0f4c3" },
3659
+ { label: "Amber 100", color: "#ffecb3" },
3660
+ { label: "Orange 100", color: "#ffe0b2" },
3661
+ { label: "Grey 100", color: "#f5f5f5" },
3662
+ { label: "Blue grey 100", color: "#cfd8dc" },
3663
+ { label: "Red 200", color: "#ef9a9a" },
3664
+ { label: "Purple 200", color: "#ce93d8" },
3665
+ { label: "Indigo 200", color: "#9fa8da" },
3666
+ { label: "Blue 200", color: "#90caf9" },
3667
+ { label: "Cyan 200", color: "#80deea" },
3668
+ { label: "Teal 200", color: "#80cbc4" },
3669
+ { label: "Light green 200", color: "#c5e1a5" },
3670
+ { label: "Lime 200", color: "#e6ee9c" },
3671
+ { label: "Amber 200", color: "#ffe082" },
3672
+ { label: "Orange 200", color: "#ffcc80" },
3673
+ { label: "Grey 200", color: "#eeeeee" },
3674
+ { label: "Blue grey 200", color: "#b0bec5" },
3675
+ { label: "Red 300", color: "#e57373" },
3676
+ { label: "Purple 300", color: "#ba68c8" },
3677
+ { label: "Indigo 300", color: "#7986cb" },
3678
+ { label: "Blue 300", color: "#64b5f6" },
3679
+ { label: "Cyan 300", color: "#4dd0e1" },
3680
+ { label: "Teal 300", color: "#4db6ac" },
3681
+ { label: "Light green 300", color: "#aed581" },
3682
+ { label: "Lime 300", color: "#dce775" },
3683
+ { label: "Amber 300", color: "#ffd54f" },
3684
+ { label: "Orange 300", color: "#ffb74d" },
3685
+ { label: "Grey 300", color: "#e0e0e0" },
3686
+ { label: "Blue grey 300", color: "#90a4ae" },
3687
+ { label: "Red 400", color: "#ef5350" },
3688
+ { label: "Purple 400", color: "#ab47bc" },
3689
+ { label: "Indigo 400", color: "#5c6bc0" },
3690
+ { label: "Blue 400", color: "#42a5f5" },
3691
+ { label: "Cyan 400", color: "#26c6da" },
3692
+ { label: "Teal 400", color: "#26a69a" },
3693
+ { label: "Light green 400", color: "#9ccc65" },
3694
+ { label: "Lime 400", color: "#d4e157" },
3695
+ { label: "Amber 400", color: "#ffca28" },
3696
+ { label: "Orange 400", color: "#ffa726" },
3697
+ { label: "Grey 400", color: "#bdbdbd" },
3698
+ { label: "Blue grey 400", color: "#78909c" },
3699
+ { label: "Red 500", color: "#f44336" },
3700
+ { label: "Purple 500", color: "#9c27b0" },
3701
+ { label: "Indigo 500", color: "#3f51b5" },
3702
+ { label: "Blue 500", color: "#2196f3" },
3703
+ { label: "Cyan 500", color: "#00bcd4" },
3704
+ { label: "Teal 500", color: "#009688" },
3705
+ { label: "Light green 500", color: "#8bc34a" },
3706
+ { label: "Lime 500", color: "#cddc39" },
3707
+ { label: "Amber 500", color: "#ffc107" },
3708
+ { label: "Orange 500", color: "#ff9800" },
3709
+ { label: "Grey 500", color: "#9e9e9e" },
3710
+ { label: "Blue grey 500", color: "#607d8b" },
3711
+ { label: "Red 600", color: "#e53935" },
3712
+ { label: "Purple 600", color: "#8e24aa" },
3713
+ { label: "Indigo 600", color: "#3949ab" },
3714
+ { label: "Blue 600", color: "#1e88e5" },
3715
+ { label: "Cyan 600", color: "#00acc1" },
3716
+ { label: "Teal 600", color: "#00897b" },
3717
+ { label: "Light green 600", color: "#7cb342" },
3718
+ { label: "Lime 600", color: "#c0ca33" },
3719
+ { label: "Amber 600", color: "#ffb300" },
3720
+ { label: "Orange 600", color: "#fb8c00" },
3721
+ { label: "Grey 600", color: "#757575" },
3722
+ { label: "Blue grey 600", color: "#546e7a" },
3723
+ { label: "Red 700", color: "#d32f2f" },
3724
+ { label: "Purple 700", color: "#7b1fa2" },
3725
+ { label: "Indigo 700", color: "#303f9f" },
3726
+ { label: "Blue 700", color: "#1976d2" },
3727
+ { label: "Cyan 700", color: "#0097a7" },
3728
+ { label: "Teal 700", color: "#00796b" },
3729
+ { label: "Light green 700", color: "#689f38" },
3730
+ { label: "Lime 700", color: "#afb42b" },
3731
+ { label: "Amber 700", color: "#ffa000" },
3732
+ { label: "Orange 700", color: "#f57c00" },
3733
+ { label: "Grey 700", color: "#616161" },
3734
+ { label: "Blue grey 700", color: "#455a64" },
3735
+ { label: "Red 800", color: "#c62828" },
3736
+ { label: "Purple 800", color: "#6a1b9a" },
3737
+ { label: "Indigo 800", color: "#283593" },
3738
+ { label: "Blue 800", color: "#1565c0" },
3739
+ { label: "Cyan 800", color: "#00838f" },
3740
+ { label: "Teal 800", color: "#00695c" },
3741
+ { label: "Light green 800", color: "#558b2f" },
3742
+ { label: "Lime 800", color: "#9e9d24" },
3743
+ { label: "Amber 800", color: "#ff8f00" },
3744
+ { label: "Orange 800", color: "#ef6c00" },
3745
+ { label: "Grey 800", color: "#424242" },
3746
+ { label: "Blue grey 800", color: "#37474f" },
3747
+ { label: "Red 900", color: "#b71c1c" },
3748
+ { label: "Purple 900", color: "#4a148c" },
3749
+ { label: "Indigo 900", color: "#1a237e" },
3750
+ { label: "Blue 900", color: "#0d47a1" },
3751
+ { label: "Cyan 900", color: "#006064" },
3752
+ { label: "Teal 900", color: "#004d40" },
3753
+ { label: "Light green 900", color: "#33691e" },
3754
+ { label: "Lime 900", color: "#827717" },
3755
+ { label: "Amber 900", color: "#ff6f00" },
3756
+ { label: "Orange 900", color: "#e65100" },
3757
+ { label: "Grey 900", color: "#212121" },
3758
+ { label: "Blue grey 900", color: "#263238" }
3759
+ ];
3760
+ globalThis.SH_CKE = {
3761
+ ...cke__namespace,
3762
+ StrapiMediaLib,
3763
+ StrapiUploadAdapter,
3764
+ MaterialColors: materialColors
3765
+ };
3766
+ const defaultEditorConfig = {
3767
+ plugins: [
3768
+ SH_CKE.Alignment,
3769
+ SH_CKE.Autoformat,
3770
+ SH_CKE.AutoImage,
3771
+ SH_CKE.BalloonToolbar,
3772
+ SH_CKE.BlockQuote,
3773
+ SH_CKE.Bold,
3774
+ SH_CKE.Code,
3775
+ SH_CKE.CodeBlock,
3776
+ SH_CKE.Essentials,
3777
+ SH_CKE.FontBackgroundColor,
3778
+ SH_CKE.FontColor,
3779
+ SH_CKE.FontFamily,
3780
+ SH_CKE.FontSize,
3781
+ SH_CKE.GeneralHtmlSupport,
3782
+ SH_CKE.Heading,
3783
+ SH_CKE.HorizontalLine,
3784
+ SH_CKE.HtmlEmbed,
3785
+ SH_CKE.Image,
3786
+ SH_CKE.ImageCaption,
3787
+ SH_CKE.ImageInsert,
3788
+ SH_CKE.ImageResize,
3789
+ SH_CKE.ImageStyle,
3790
+ SH_CKE.ImageToolbar,
3791
+ SH_CKE.ImageUpload,
3792
+ SH_CKE.Indent,
3793
+ SH_CKE.IndentBlock,
3794
+ SH_CKE.Italic,
3795
+ SH_CKE.List,
3796
+ SH_CKE.ListProperties,
3797
+ SH_CKE.Link,
3798
+ SH_CKE.LinkImage,
3799
+ SH_CKE.LinkImage,
3800
+ SH_CKE.MediaEmbed,
3801
+ SH_CKE.PageBreak,
3802
+ SH_CKE.Paragraph,
3803
+ SH_CKE.PasteFromOffice,
3804
+ SH_CKE.PictureEditing,
3805
+ SH_CKE.RemoveFormat,
3806
+ SH_CKE.SourceEditing,
3807
+ SH_CKE.SpecialCharacters,
3808
+ SH_CKE.SpecialCharactersArrows,
3809
+ SH_CKE.SpecialCharactersCurrency,
3810
+ SH_CKE.SpecialCharactersLatin,
3811
+ SH_CKE.SpecialCharactersMathematical,
3812
+ SH_CKE.SpecialCharactersText,
3813
+ SH_CKE.StrapiMediaLib,
3814
+ SH_CKE.StrapiUploadAdapter,
3815
+ SH_CKE.Strikethrough,
3816
+ SH_CKE.Style,
3817
+ SH_CKE.Subscript,
3818
+ SH_CKE.Superscript,
3819
+ SH_CKE.ShowBlocks,
3820
+ SH_CKE.Table,
3821
+ SH_CKE.TableCaption,
3822
+ SH_CKE.TableCellProperties,
3823
+ SH_CKE.TableColumnResize,
3824
+ SH_CKE.TableProperties,
3825
+ SH_CKE.TableToolbar,
3826
+ SH_CKE.Underline,
3827
+ SH_CKE.WordCount
3828
+ ],
3829
+ toolbar: [
3830
+ {
3831
+ label: " ",
3832
+ tooltip: null,
3833
+ icon: "paragraph",
3834
+ items: ["heading", "style"]
3835
+ },
3836
+ {
3837
+ label: " ",
3838
+ tooltip: null,
3839
+ icon: "text",
3840
+ items: ["fontSize", "fontFamily"]
3841
+ },
3842
+ "|",
3843
+ "alignment",
3844
+ {
3845
+ label: " ",
3846
+ tooltip: null,
3847
+ icon: SH_CKE.icons.indent,
3848
+ items: ["outdent", "indent"]
3849
+ },
3850
+ "|",
3851
+ "bulletedList",
3852
+ "numberedList",
3853
+ "|",
3854
+ "insertImage",
3855
+ "mediaEmbed",
3856
+ "strapiMediaLib",
3857
+ "link",
3858
+ "blockquote",
3859
+ "insertTable",
3860
+ "specialCharacters",
3861
+ "htmlEmbed",
3862
+ "codeBlock",
3863
+ "|",
3864
+ "horizontalLine",
3865
+ "pageBreak",
3866
+ "|",
3867
+ "SourceEditing",
3868
+ "|",
3869
+ "showBlocks",
3870
+ "|",
3871
+ "undo",
3872
+ "redo",
3873
+ "|"
3874
+ ],
3875
+ balloonToolbar: [
3876
+ "bold",
3877
+ "italic",
3878
+ "fontColor",
3879
+ "fontBackgroundColor",
3880
+ {
3881
+ label: " ",
3882
+ tooltip: null,
3883
+ icon: `
3884
+ <svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
3885
+ <rect x="0" fill="none" width="24" height="24"/>
3886
+ <g>
3887
+ <path d="M14.348 12H21v2h-4.613c.24.515.368 1.094.368 1.748 0 1.317-.474 2.355-1.423 3.114-.947.76-2.266 1.138-3.956 1.138-1.557 0-2.934-.293-4.132-.878v-2.874c.985.44 1.818.75 2.5.928.682.18 1.306.27 1.872.27.68 0 1.2-.13 1.562-.39.363-.26.545-.644.545-1.158 0-.285-.08-.54-.24-.763-.16-.222-.394-.437-.704-.643-.18-.12-.483-.287-.88-.49H3v-2H14.347zm-3.528-2c-.073-.077-.143-.155-.193-.235-.126-.202-.19-.44-.19-.713 0-.44.157-.795.47-1.068.313-.273.762-.41 1.348-.41.492 0 .993.064 1.502.19.51.127 1.153.35 1.93.67l1-2.405c-.753-.327-1.473-.58-2.16-.76-.69-.18-1.414-.27-2.173-.27-1.544 0-2.753.37-3.628 1.108-.874.738-1.312 1.753-1.312 3.044 0 .302.036.58.088.848h3.318z"/>
3888
+ </g>
3889
+ </svg>`,
3890
+ items: ["underline", "strikethrough", "superscript", "subscript"]
3891
+ },
3892
+ "|",
3893
+ "removeFormat"
3894
+ ],
3895
+ fontFamily: {
3896
+ supportAllValues: true
3897
+ },
3898
+ fontSize: {
3899
+ options: [10, 12, 14, "default", 18, 20, 22],
3900
+ supportAllValues: true
3901
+ },
3902
+ fontColor: {
3903
+ columns: 12,
3904
+ documentColors: 12,
3905
+ colors: materialColors
3906
+ },
3907
+ fontBackgroundColor: {
3908
+ columns: 12,
3909
+ documentColors: 12,
3910
+ colors: materialColors
3911
+ },
3912
+ heading: {
3913
+ options: [
3914
+ { model: "paragraph", title: "Paragraph", class: "ck-heading_paragraph" },
3915
+ {
3916
+ model: "heading1",
3917
+ view: "h1",
3918
+ title: "Heading 1",
3919
+ class: "ck-heading_heading1"
3920
+ },
3921
+ {
3922
+ model: "heading2",
3923
+ view: "h2",
3924
+ title: "Heading 2",
3925
+ class: "ck-heading_heading2"
3926
+ },
3927
+ {
3928
+ model: "heading3",
3929
+ view: "h3",
3930
+ title: "Heading 3",
3931
+ class: "ck-heading_heading3"
3932
+ },
3933
+ {
3934
+ model: "heading4",
3935
+ view: "h4",
3936
+ title: "Heading 4",
3937
+ class: "ck-heading_heading4"
3938
+ },
3939
+ {
3940
+ model: "heading5",
3941
+ view: "h5",
3942
+ title: "Heading 5",
3943
+ class: "ck-heading_heading5"
3944
+ },
3945
+ {
3946
+ model: "heading6",
3947
+ view: "h6",
3948
+ title: "Heading 6",
3949
+ class: "ck-heading_heading6"
3950
+ }
3951
+ ]
3952
+ },
3953
+ htmlSupport: {
3954
+ allow: [
3955
+ {
3956
+ name: /.*/,
3957
+ attributes: true,
3958
+ classes: true,
3959
+ styles: true
3960
+ }
3961
+ ],
3962
+ disallow: [
3963
+ {
3964
+ attributes: [
3965
+ { key: /^on(.*)/i, value: true },
3966
+ {
3967
+ key: /.*/,
3968
+ value: /(\b)(on\S+)(\s*)=|javascript:|(<\s*)(\/*)script/i
3969
+ },
3970
+ { key: /.*/, value: /data:(?!image\/(png|jpeg|gif|webp))/i }
3971
+ ]
3972
+ },
3973
+ { name: "script" }
3974
+ ]
3975
+ },
3976
+ htmlEmbed: {
3977
+ showPreviews: true,
3978
+ sanitizeHtml: (inputHtml) => {
3979
+ const outputHtml = sanitizeHtml__default.default(inputHtml);
3980
+ return {
3981
+ html: outputHtml,
3982
+ hasChanged: true
3983
+ };
3984
+ }
3985
+ },
3986
+ list: {
3987
+ properties: {
3988
+ styles: true,
3989
+ startIndex: true,
3990
+ reversed: true
3991
+ }
3992
+ },
3993
+ table: {
3994
+ contentToolbar: [
3995
+ "tableColumn",
3996
+ "tableRow",
3997
+ "mergeTableCells",
3998
+ "tableProperties",
3999
+ "tableCellProperties",
4000
+ "toggleTableCaption"
4001
+ ]
4002
+ },
4003
+ image: {
4004
+ styles: {
4005
+ options: [
4006
+ "inline",
4007
+ "alignLeft",
4008
+ "alignRight",
4009
+ "alignCenter",
4010
+ "alignBlockLeft",
4011
+ "alignBlockRight",
4012
+ "block",
4013
+ "side"
4014
+ ]
4015
+ },
4016
+ resizeOptions: [
4017
+ {
4018
+ name: "resizeImage:original",
4019
+ label: "Default image width",
4020
+ value: null
4021
+ },
4022
+ {
4023
+ name: "resizeImage:50",
4024
+ label: "50% page width",
4025
+ value: "50"
4026
+ },
4027
+ {
4028
+ name: "resizeImage:75",
4029
+ label: "75% page width",
4030
+ value: "75"
4031
+ }
4032
+ ],
4033
+ toolbar: [
4034
+ "imageTextAlternative",
4035
+ "toggleImageCaption",
4036
+ "linkImage",
4037
+ "|",
4038
+ "imageStyle:inline",
4039
+ "imageStyle:wrapText",
4040
+ "imageStyle:breakText",
4041
+ "imageStyle:side",
4042
+ "|",
4043
+ "resizeImage"
4044
+ ]
4045
+ },
4046
+ link: {
4047
+ decorators: {
4048
+ openInNewTab: {
4049
+ mode: "manual",
4050
+ label: "Open in a new tab",
4051
+ defaultValue: true,
4052
+ attributes: {
4053
+ target: "_blank",
4054
+ rel: "noopener noreferrer"
4055
+ }
4056
+ },
4057
+ toggleDownloadable: {
4058
+ mode: "manual",
4059
+ label: "Downloadable",
4060
+ attributes: {
4061
+ download: "file"
4062
+ }
4063
+ }
4064
+ },
4065
+ addTargetToExternalLinks: true,
4066
+ defaultProtocol: "https://"
4067
+ },
4068
+ style: {
4069
+ definitions: [
4070
+ {
4071
+ name: "Title",
4072
+ element: "h1",
4073
+ classes: ["document-title"]
4074
+ },
4075
+ {
4076
+ name: "Subtitle",
4077
+ element: "h2",
4078
+ classes: ["document-subtitle"]
4079
+ },
4080
+ {
4081
+ name: "Callout",
4082
+ element: "p",
4083
+ classes: ["callout"]
4084
+ },
4085
+ {
4086
+ name: "Side quote",
4087
+ element: "blockquote",
4088
+ classes: ["side-quote"]
4089
+ },
4090
+ {
4091
+ name: "Needs clarification",
4092
+ element: "span",
4093
+ classes: ["needs-clarification"]
4094
+ },
4095
+ {
4096
+ name: "Wide spacing",
4097
+ element: "span",
4098
+ classes: ["wide-spacing"]
4099
+ },
4100
+ {
4101
+ name: "Small caps",
4102
+ element: "span",
4103
+ classes: ["small-caps"]
4104
+ },
4105
+ {
4106
+ name: "Code (dark)",
4107
+ element: "pre",
4108
+ classes: ["stylish-code", "stylish-code-dark"]
4109
+ },
4110
+ {
4111
+ name: "Code (bright)",
4112
+ element: "pre",
4113
+ classes: ["stylish-code", "stylish-code-bright"]
4114
+ }
4115
+ ]
4116
+ },
4117
+ ui: {
4118
+ poweredBy: {
4119
+ position: "inside",
4120
+ side: "right",
4121
+ label: ""
4122
+ }
4123
+ }
4124
+ };
4125
+ const defaultEditor = {
4126
+ default: {
4127
+ field: {
4128
+ key: "default",
4129
+ value: "default",
4130
+ metadatas: {
4131
+ intlLabel: {
4132
+ id: "ckeditor.preset.default.label",
4133
+ defaultMessage: "default"
4134
+ }
4135
+ }
4136
+ },
4137
+ editorConfig: defaultEditorConfig
4138
+ }
4139
+ };
4140
+ const basePresets = {
4141
+ ...defaultEditor
4142
+ };
4143
+ const name = "@_sh/strapi-plugin-ckeditor";
4144
+ const version = "4.0.3";
4145
+ const description = "Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Unofficial integration)";
4146
+ const keywords = [
4147
+ "strapi",
4148
+ "ckeditor",
4149
+ "ckeditor5",
4150
+ "ckeditor 5",
4151
+ "wysiwyg",
4152
+ "rich text",
4153
+ "editor"
4154
+ ];
4155
+ const author = {
4156
+ name: "nshenderov"
4157
+ };
4158
+ const homepage = "https://market.strapi.io/plugins/@_sh-strapi-plugin-ckeditor";
4159
+ const repository = {
4160
+ type: "git",
4161
+ url: "https://github.com/nshenderov/strapi-plugin-ckeditor.git"
4162
+ };
4163
+ const strapi$1 = {
4164
+ name: "ckeditor5",
4165
+ displayName: "CKEditor 5",
4166
+ description: "Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Unofficial integration)",
4167
+ kind: "plugin"
4168
+ };
4169
+ const exports$1 = {
4170
+ "./package.json": "./package.json",
4171
+ "./strapi-admin": {
4172
+ source: "./admin/src/index.js",
4173
+ "import": "./dist/admin/index.mjs",
4174
+ require: "./dist/admin/index.js",
4175
+ "default": "./dist/admin/index.js"
4176
+ },
4177
+ "./strapi-server": {
4178
+ source: "./server/src/index.js",
4179
+ "import": "./dist/server/index.mjs",
4180
+ require: "./dist/server/index.js",
4181
+ "default": "./dist/server/index.js"
4182
+ }
4183
+ };
4184
+ const files = [
4185
+ "dist",
4186
+ "./strapi-server.js"
4187
+ ];
4188
+ const scripts = {
4189
+ build: "strapi-plugin build",
4190
+ watch: "strapi-plugin watch",
4191
+ "watch:link": "strapi-plugin watch:link",
4192
+ verify: "strapi-plugin verify",
4193
+ release: "release-it",
4194
+ "release:info": "release-it --changelog"
4195
+ };
4196
+ const dependencies = {
4197
+ ckeditor5: "^43.1.0",
4198
+ "@ckeditor/ckeditor5-react": "^9.1.0",
4199
+ "@strapi/design-system": "^2.0.0-rc.11",
4200
+ "prop-types": "^15.8.1",
4201
+ "sanitize-html": "^2.13.0"
4202
+ };
4203
+ const devDependencies = {
4204
+ "@strapi/strapi": "^5.0.0",
4205
+ "@strapi/sdk-plugin": "^5.2.6",
4206
+ prettier: "^3.3.3",
4207
+ react: "^18.3.1",
4208
+ "react-dom": "^18.3.1",
4209
+ "react-router-dom": "^6.26.2",
4210
+ "styled-components": "^6.1.13",
4211
+ "release-it": "^17.6.0",
4212
+ "@release-it/conventional-changelog": "^8.0.1"
4213
+ };
4214
+ const peerDependencies = {
4215
+ "@strapi/strapi": "^5.0.0",
4216
+ "@strapi/sdk-plugin": "^5.2.6",
4217
+ react: "^18.3.1",
4218
+ "react-dom": "^18.3.1",
4219
+ "react-router-dom": "^6.26.2",
4220
+ "styled-components": "^6.1.13"
4221
+ };
4222
+ const engines = {
4223
+ node: ">=18.0.0 <=20.x.x",
4224
+ npm: ">=6.0.0"
4225
+ };
4226
+ const license = "MIT";
4227
+ const pluginPkg = {
4228
+ name,
4229
+ version,
4230
+ description,
4231
+ "private": false,
4232
+ keywords,
4233
+ author,
4234
+ homepage,
4235
+ repository,
4236
+ strapi: strapi$1,
4237
+ exports: exports$1,
4238
+ files,
4239
+ scripts,
4240
+ dependencies,
4241
+ devDependencies,
4242
+ peerDependencies,
4243
+ engines,
4244
+ license
4245
+ };
4246
+ const PLUGIN_ID = pluginPkg.strapi.name;
4247
+ const insertConfigScript = () => {
4248
+ const url = strapi.backendURL !== "/" ? `${strapi.backendURL}/${PLUGIN_ID}/config/ckeditor` : `/${PLUGIN_ID}/config/ckeditor`;
4249
+ var script = document.createElement("script");
4250
+ script.id = "ckeditor-config";
4251
+ script.src = url;
4252
+ document.body.appendChild(script);
4253
+ };
4254
+ const waitForConfigToInitialize = async () => {
4255
+ return new Promise((resolve) => {
4256
+ (function checkConfigLoaded() {
4257
+ if (typeof globalThis.SH_CKE_CONFIG !== "undefined") {
4258
+ resolve(globalThis.SH_CKE_CONFIG);
4259
+ } else
4260
+ setTimeout(checkConfigLoaded, 5);
4261
+ })();
4262
+ });
4263
+ };
4264
+ const getPluginConfig = async () => {
4265
+ insertConfigScript();
4266
+ const configFromScript = await waitForConfigToInitialize();
4267
+ if (configFromScript) {
4268
+ return configFromScript;
4269
+ }
4270
+ return null;
4271
+ };
4272
+ const mergePresetsTo = (userPresets, basePresets2) => {
4273
+ Object.keys(userPresets).map((presetName) => {
4274
+ if (basePresets2.hasOwnProperty(presetName)) {
4275
+ basePresets2[presetName].field = {
4276
+ ...basePresets2[presetName].field,
4277
+ ...userPresets[presetName].field
4278
+ };
4279
+ basePresets2[presetName].styles = userPresets[presetName].styles || basePresets2[presetName].styles;
4280
+ basePresets2[presetName].editorConfig = {
4281
+ ...basePresets2[presetName].editorConfig,
4282
+ ...userPresets[presetName].editorConfig
4283
+ };
4284
+ } else {
4285
+ basePresets2[presetName] = userPresets[presetName];
4286
+ }
4287
+ });
4288
+ };
4289
+ const getPresetsOptions = async () => {
4290
+ const { presets: userPresets, dontMergePresets } = await getPluginConfig() || {};
4291
+ if (!dontMergePresets && userPresets) {
4292
+ mergePresetsTo(userPresets, basePresets);
4293
+ }
4294
+ const options = [
4295
+ ...Object.keys(basePresets).map(
4296
+ (presetName) => basePresets[presetName].field
4297
+ )
4298
+ ];
4299
+ return options;
4300
+ };
4301
+ const IconBox = styled.styled(designSystem.Flex)`
4302
+ background-color: #f0f0ff; /* primary100 */
4303
+ border: 1px solid #d9d8ff; /* primary200 */
4304
+ svg > path {
4305
+ fill: #4945ff; /* primary600 */
4306
+ }
4307
+ `;
4308
+ const SvgIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
4309
+ "svg",
4310
+ {
4311
+ width: "68",
4312
+ height: "64",
4313
+ viewBox: "-20 -14 98 94",
4314
+ xmlns: "http://www.w3.org/2000/svg",
4315
+ children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", "fill-rule": "evenodd", children: [
4316
+ /* @__PURE__ */ jsxRuntime.jsx(
4317
+ "path",
4318
+ {
4319
+ d: "M43.71 11.025a11.508 11.508 0 0 0-1.213 5.159c0 6.42 5.244 11.625 11.713 11.625.083 0 .167 0 .25-.002v16.282a5.464 5.464 0 0 1-2.756 4.739L30.986 60.7a5.548 5.548 0 0 1-5.512 0L4.756 48.828A5.464 5.464 0 0 1 2 44.089V20.344c0-1.955 1.05-3.76 2.756-4.738L25.474 3.733a5.548 5.548 0 0 1 5.512 0l12.724 7.292z",
4320
+ fill: "#FFF"
4321
+ }
4322
+ ),
4323
+ /* @__PURE__ */ jsxRuntime.jsx(
4324
+ "path",
4325
+ {
4326
+ d: "M45.684 8.79a12.604 12.604 0 0 0-1.329 5.65c0 7.032 5.744 12.733 12.829 12.733.091 0 .183-.001.274-.003v17.834a5.987 5.987 0 0 1-3.019 5.19L31.747 63.196a6.076 6.076 0 0 1-6.037 0L3.02 50.193A5.984 5.984 0 0 1 0 45.003V18.997c0-2.14 1.15-4.119 3.019-5.19L25.71.804a6.076 6.076 0 0 1 6.037 0L45.684 8.79zm-29.44 11.89c-.834 0-1.51.671-1.51 1.498v.715c0 .828.676 1.498 1.51 1.498h25.489c.833 0 1.51-.67 1.51-1.498v-.715c0-.827-.677-1.498-1.51-1.498h-25.49.001zm0 9.227c-.834 0-1.51.671-1.51 1.498v.715c0 .828.676 1.498 1.51 1.498h18.479c.833 0 1.509-.67 1.509-1.498v-.715c0-.827-.676-1.498-1.51-1.498H16.244zm0 9.227c-.834 0-1.51.671-1.51 1.498v.715c0 .828.676 1.498 1.51 1.498h25.489c.833 0 1.51-.67 1.51-1.498v-.715c0-.827-.677-1.498-1.51-1.498h-25.49.001zm41.191-14.459c-5.835 0-10.565-4.695-10.565-10.486 0-5.792 4.73-10.487 10.565-10.487C63.27 3.703 68 8.398 68 14.19c0 5.791-4.73 10.486-10.565 10.486v-.001z",
4327
+ fill: "#1EBC61",
4328
+ "fill-rule": "nonzero"
4329
+ }
4330
+ ),
4331
+ /* @__PURE__ */ jsxRuntime.jsx(
4332
+ "path",
4333
+ {
4334
+ d: "M60.857 15.995c0-.467-.084-.875-.251-1.225a2.547 2.547 0 0 0-.686-.88 2.888 2.888 0 0 0-1.026-.531 4.418 4.418 0 0 0-1.259-.175c-.134 0-.283.006-.447.018-.15.01-.3.034-.446.07l.075-1.4h3.587v-1.8h-5.462l-.214 5.06c.319-.116.682-.21 1.089-.28.406-.071.77-.107 1.088-.107.218 0 .437.021.655.063.218.041.413.114.585.218s.313.244.422.419c.109.175.163.391.163.65 0 .424-.132.745-.396.961a1.434 1.434 0 0 1-.938.325c-.352 0-.656-.1-.912-.3-.256-.2-.43-.453-.523-.762l-1.925.588c.1.35.258.664.472.943.214.279.47.514.767.706.298.191.63.339.995.443.365.104.749.156 1.151.156.437 0 .86-.064 1.272-.193.41-.13.778-.323 1.1-.581a2.8 2.8 0 0 0 .775-.981c.193-.396.29-.864.29-1.405h-.001z",
4335
+ fill: "#FFF",
4336
+ "fill-rule": "nonzero"
4337
+ }
4338
+ )
4339
+ ] })
4340
+ }
4341
+ );
4342
+ const CKEditorIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
4343
+ IconBox,
4344
+ {
4345
+ justifyContent: "center",
4346
+ alignItems: "center",
4347
+ width: 7,
4348
+ height: 6,
4349
+ hasRadius: true,
4350
+ "aria-hidden": true,
4351
+ children: /* @__PURE__ */ jsxRuntime.jsx(SvgIcon, {})
4352
+ }
4353
+ );
4354
+ const index = {
4355
+ async register(app) {
4356
+ app.customFields.register({
4357
+ name: "CKEditor",
4358
+ type: "richtext",
4359
+ pluginId: PLUGIN_ID,
4360
+ icon: CKEditorIcon,
4361
+ intlLabel: {
4362
+ id: PLUGIN_ID + ".label",
4363
+ defaultMessage: "CKEditor 5"
4364
+ },
4365
+ intlDescription: {
4366
+ id: PLUGIN_ID + ".description",
4367
+ defaultMessage: "The rich text editor for every use case"
4368
+ },
4369
+ components: {
4370
+ Input: async () => Promise.resolve().then(() => require("./index-DQmrEgPx.js"))
4371
+ },
4372
+ options: {
4373
+ base: [
4374
+ {
4375
+ intlLabel: {
4376
+ id: PLUGIN_ID + ".preset.label",
4377
+ defaultMessage: "Preset"
4378
+ },
4379
+ description: {
4380
+ id: PLUGIN_ID + ".preset.description",
4381
+ defaultMessage: " "
4382
+ },
4383
+ name: "options.preset",
4384
+ type: "select",
4385
+ options: await getPresetsOptions()
4386
+ }
4387
+ ],
4388
+ advanced: [
4389
+ {
4390
+ sectionTitle: null,
4391
+ items: [
4392
+ {
4393
+ name: "required",
4394
+ type: "checkbox",
4395
+ intlLabel: {
4396
+ id: PLUGIN_ID + ".required.label",
4397
+ defaultMessage: "Required field"
4398
+ },
4399
+ description: {
4400
+ id: PLUGIN_ID + "required.description",
4401
+ defaultMessage: "You won't be able to create an entry if this field is empty"
4402
+ }
4403
+ },
4404
+ {
4405
+ name: "options.maxLengthCharacters",
4406
+ type: "checkbox-with-number-field",
4407
+ intlLabel: {
4408
+ id: PLUGIN_ID + ".maxLength.label",
4409
+ defaultMessage: "Maximum length (characters)"
4410
+ }
4411
+ }
4412
+ ]
4413
+ }
4414
+ ],
4415
+ validator: (args) => ({
4416
+ preset: create$1().required({
4417
+ id: PLUGIN_ID + ".preset.error.required",
4418
+ defaultMessage: "Editor preset is required"
4419
+ })
4420
+ })
4421
+ }
4422
+ });
4423
+ }
4424
+ };
4425
+ exports._Stack = _Stack;
4426
+ exports._Symbol = _Symbol;
4427
+ exports._Uint8Array = _Uint8Array;
4428
+ exports._WeakMap = _WeakMap;
4429
+ exports._arrayLikeKeys = _arrayLikeKeys;
4430
+ exports._arrayMap = _arrayMap;
4431
+ exports._arrayPush = _arrayPush;
4432
+ exports._baseAssignValue = _baseAssignValue;
4433
+ exports._baseFor = _baseFor;
4434
+ exports._baseGet = _baseGet;
4435
+ exports._baseGetAllKeys = _baseGetAllKeys;
4436
+ exports._baseGetTag = _baseGetTag;
4437
+ exports._baseIsEqual = _baseIsEqual;
4438
+ exports._baseIteratee = _baseIteratee;
4439
+ exports._baseKeys = _baseKeys;
4440
+ exports._baseSlice = _baseSlice;
4441
+ exports._baseUnary = _baseUnary;
4442
+ exports._castPath = _castPath;
4443
+ exports._defineProperty = _defineProperty;
4444
+ exports._getAllKeys = _getAllKeys;
4445
+ exports._getSymbols = _getSymbols;
4446
+ exports._getTag = _getTag;
4447
+ exports._isIndex = _isIndex;
4448
+ exports._isPrototype = _isPrototype;
4449
+ exports._nodeUtilExports = _nodeUtilExports;
4450
+ exports._overArg = _overArg;
4451
+ exports._root = _root;
4452
+ exports._stringToPath = _stringToPath;
4453
+ exports._toKey = _toKey;
4454
+ exports.basePresets = basePresets;
4455
+ exports.commonjsGlobal = commonjsGlobal;
4456
+ exports.create = create;
4457
+ exports.create$1 = create$1;
4458
+ exports.create$2 = create$2;
4459
+ exports.create$3 = create$3;
4460
+ exports.eq_1 = eq_1;
4461
+ exports.getAugmentedNamespace = getAugmentedNamespace;
4462
+ exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
4463
+ exports.hasIn_1 = hasIn_1;
4464
+ exports.identity_1 = identity_1;
4465
+ exports.index = index;
4466
+ exports.isArguments_1 = isArguments_1;
4467
+ exports.isArrayLike_1 = isArrayLike_1;
4468
+ exports.isArray_1 = isArray_1;
4469
+ exports.isBufferExports = isBufferExports;
4470
+ exports.isFunction_1 = isFunction_1;
4471
+ exports.isObjectLike_1 = isObjectLike_1;
4472
+ exports.isObject_1 = isObject_1;
4473
+ exports.isSymbol_1 = isSymbol_1;
4474
+ exports.isTypedArray_1 = isTypedArray_1;
4475
+ exports.keys_1 = keys_1;
4476
+ exports.stubArray_1 = stubArray_1;
4477
+ exports.toString_1 = toString_1;
4478
+ //# sourceMappingURL=index-DAzJ2oQj.js.map