@symbo.ls/scratch 2.11.504 → 2.11.512

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.
@@ -30,3848 +30,63 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  ));
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
- // ../../node_modules/@domql/utils/dist/cjs/key.js
34
- var require_key = __commonJS({
35
- "../../node_modules/@domql/utils/dist/cjs/key.js"(exports, module2) {
36
- "use strict";
37
- var __defProp2 = Object.defineProperty;
38
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
39
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
40
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
41
- var __export2 = (target, all) => {
42
- for (var name in all)
43
- __defProp2(target, name, { get: all[name], enumerable: true });
44
- };
45
- var __copyProps2 = (to, from, except, desc) => {
46
- if (from && typeof from === "object" || typeof from === "function") {
47
- for (let key of __getOwnPropNames2(from))
48
- if (!__hasOwnProp2.call(to, key) && key !== except)
49
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
50
- }
51
- return to;
52
- };
53
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54
- var key_exports = {};
55
- __export2(key_exports, {
56
- createSnapshotId: () => createSnapshotId,
57
- generateKey: () => generateKey
58
- });
59
- module2.exports = __toCommonJS2(key_exports);
60
- var generateKey = /* @__PURE__ */ function() {
61
- let index = 0;
62
- function newId() {
63
- index++;
64
- return index;
65
- }
66
- return newId;
67
- }();
68
- var createSnapshotId = generateKey;
69
- }
70
- });
71
-
72
- // ../../node_modules/@domql/utils/dist/cjs/env.js
73
- var require_env = __commonJS({
74
- "../../node_modules/@domql/utils/dist/cjs/env.js"(exports, module2) {
75
- "use strict";
76
- var __defProp2 = Object.defineProperty;
77
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
78
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
79
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
80
- var __export2 = (target, all) => {
81
- for (var name in all)
82
- __defProp2(target, name, { get: all[name], enumerable: true });
83
- };
84
- var __copyProps2 = (to, from, except, desc) => {
85
- if (from && typeof from === "object" || typeof from === "function") {
86
- for (let key of __getOwnPropNames2(from))
87
- if (!__hasOwnProp2.call(to, key) && key !== except)
88
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
89
- }
90
- return to;
91
- };
92
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
93
- var env_exports = {};
94
- __export2(env_exports, {
95
- NODE_ENV: () => NODE_ENV,
96
- getNev: () => getNev,
97
- isDevelopment: () => isDevelopment,
98
- isProduction: () => isProduction,
99
- isTest: () => isTest
100
- });
101
- module2.exports = __toCommonJS2(env_exports);
102
- var NODE_ENV = "development";
103
- var isProduction = (env = NODE_ENV) => env === "production" || env === "prod" || env !== "development" && env !== "dev" && env !== "test";
104
- var isTest = (env = NODE_ENV) => env === "test";
105
- var isDevelopment = (env = NODE_ENV) => env === "development" || env === "dev";
106
- var getNev = (key, env = NODE_ENV) => env[key];
107
- }
108
- });
109
-
110
- // ../../node_modules/@domql/utils/dist/cjs/globals.js
111
- var require_globals = __commonJS({
112
- "../../node_modules/@domql/utils/dist/cjs/globals.js"(exports, module2) {
113
- "use strict";
114
- var __defProp2 = Object.defineProperty;
115
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
116
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
117
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
118
- var __export2 = (target, all) => {
119
- for (var name in all)
120
- __defProp2(target, name, { get: all[name], enumerable: true });
121
- };
122
- var __copyProps2 = (to, from, except, desc) => {
123
- if (from && typeof from === "object" || typeof from === "function") {
124
- for (let key of __getOwnPropNames2(from))
125
- if (!__hasOwnProp2.call(to, key) && key !== except)
126
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
127
- }
128
- return to;
129
- };
130
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
131
- var globals_exports = {};
132
- __export2(globals_exports, {
133
- document: () => document3,
134
- global: () => global,
135
- self: () => self,
136
- window: () => window3
137
- });
138
- module2.exports = __toCommonJS2(globals_exports);
139
- var global = globalThis;
140
- var self = globalThis;
141
- var window3 = globalThis;
142
- var document3 = window3.document;
143
- }
144
- });
145
-
146
- // ../../node_modules/@domql/utils/dist/cjs/node.js
147
- var require_node = __commonJS({
148
- "../../node_modules/@domql/utils/dist/cjs/node.js"(exports, module2) {
149
- "use strict";
150
- var __defProp2 = Object.defineProperty;
151
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
152
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
153
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
154
- var __export2 = (target, all) => {
155
- for (var name in all)
156
- __defProp2(target, name, { get: all[name], enumerable: true });
157
- };
158
- var __copyProps2 = (to, from, except, desc) => {
159
- if (from && typeof from === "object" || typeof from === "function") {
160
- for (let key of __getOwnPropNames2(from))
161
- if (!__hasOwnProp2.call(to, key) && key !== except)
162
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
163
- }
164
- return to;
165
- };
166
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
167
- var node_exports = {};
168
- __export2(node_exports, {
169
- isDOMNode: () => isDOMNode,
170
- isHtmlElement: () => isHtmlElement,
171
- isNode: () => isNode
172
- });
173
- module2.exports = __toCommonJS2(node_exports);
174
- var import_globals2 = require_globals();
175
- var isNode = (obj) => {
176
- return (typeof Node === "object" ? obj instanceof import_globals2.window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
177
- };
178
- var isHtmlElement = (obj) => {
179
- return (typeof HTMLElement === "object" ? obj instanceof import_globals2.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
180
- };
181
- var isDOMNode = (obj) => {
182
- return typeof import_globals2.window !== "undefined" && (obj instanceof import_globals2.window.Node || obj instanceof import_globals2.window.Window || obj === import_globals2.window || obj === document);
183
- };
184
- }
185
- });
186
-
187
- // ../../node_modules/@domql/utils/dist/cjs/types.js
188
- var require_types = __commonJS({
189
- "../../node_modules/@domql/utils/dist/cjs/types.js"(exports, module2) {
190
- "use strict";
191
- var __defProp2 = Object.defineProperty;
192
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
193
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
194
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
195
- var __export2 = (target, all) => {
196
- for (var name in all)
197
- __defProp2(target, name, { get: all[name], enumerable: true });
198
- };
199
- var __copyProps2 = (to, from, except, desc) => {
200
- if (from && typeof from === "object" || typeof from === "function") {
201
- for (let key of __getOwnPropNames2(from))
202
- if (!__hasOwnProp2.call(to, key) && key !== except)
203
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
204
- }
205
- return to;
206
- };
207
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
208
- var types_exports = {};
209
- __export2(types_exports, {
210
- TYPES: () => TYPES,
211
- is: () => is,
212
- isArray: () => isArray5,
213
- isBoolean: () => isBoolean,
214
- isDate: () => isDate,
215
- isDefined: () => isDefined2,
216
- isFunction: () => isFunction,
217
- isNot: () => isNot,
218
- isNull: () => isNull,
219
- isNumber: () => isNumber2,
220
- isObject: () => isObject4,
221
- isObjectLike: () => isObjectLike2,
222
- isString: () => isString7,
223
- isUndefined: () => isUndefined
224
- });
225
- module2.exports = __toCommonJS2(types_exports);
226
- var import_node = require_node();
227
- var isObject4 = (arg) => {
228
- if (arg === null)
229
- return false;
230
- return typeof arg === "object" && arg.constructor === Object;
231
- };
232
- var isString7 = (arg) => typeof arg === "string";
233
- var isNumber2 = (arg) => typeof arg === "number";
234
- var isFunction = (arg) => typeof arg === "function";
235
- var isBoolean = (arg) => arg === true || arg === false;
236
- var isNull = (arg) => arg === null;
237
- var isArray5 = (arg) => Array.isArray(arg);
238
- var isDate = (d) => d instanceof Date;
239
- var isObjectLike2 = (arg) => {
240
- if (arg === null)
241
- return false;
242
- return typeof arg === "object";
243
- };
244
- var isDefined2 = (arg) => {
245
- return isObject4(arg) || isObjectLike2(arg) || isString7(arg) || isNumber2(arg) || isFunction(arg) || isArray5(arg) || isObjectLike2(arg) || isBoolean(arg) || isDate(arg) || isNull(arg);
246
- };
247
- var isUndefined = (arg) => {
248
- return arg === void 0;
249
- };
250
- var TYPES = {
251
- boolean: isBoolean,
252
- array: isArray5,
253
- object: isObject4,
254
- string: isString7,
255
- date: isDate,
256
- number: isNumber2,
257
- null: isNull,
258
- function: isFunction,
259
- objectLike: isObjectLike2,
260
- node: import_node.isNode,
261
- htmlElement: import_node.isHtmlElement,
262
- defined: isDefined2
263
- };
264
- var is = (arg) => {
265
- return (...args) => {
266
- return args.map((val) => TYPES[val](arg)).filter((v) => v).length > 0;
267
- };
268
- };
269
- var isNot = (arg) => {
270
- return (...args) => {
271
- return args.map((val) => TYPES[val](arg)).filter((v) => v).length === 0;
272
- };
273
- };
274
- }
275
- });
276
-
277
- // ../../node_modules/@domql/utils/dist/cjs/array.js
278
- var require_array = __commonJS({
279
- "../../node_modules/@domql/utils/dist/cjs/array.js"(exports, module2) {
280
- "use strict";
281
- var __defProp2 = Object.defineProperty;
282
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
283
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
284
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
285
- var __export2 = (target, all) => {
286
- for (var name in all)
287
- __defProp2(target, name, { get: all[name], enumerable: true });
288
- };
289
- var __copyProps2 = (to, from, except, desc) => {
290
- if (from && typeof from === "object" || typeof from === "function") {
291
- for (let key of __getOwnPropNames2(from))
292
- if (!__hasOwnProp2.call(to, key) && key !== except)
293
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
294
- }
295
- return to;
296
- };
297
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
298
- var array_exports = {};
299
- __export2(array_exports, {
300
- addItemAfterEveryElement: () => addItemAfterEveryElement,
301
- arrayContainsOtherArray: () => arrayContainsOtherArray,
302
- arraysEqual: () => arraysEqual,
303
- checkIfStringIsInArray: () => checkIfStringIsInArray,
304
- cutArrayAfterValue: () => cutArrayAfterValue,
305
- cutArrayBeforeValue: () => cutArrayBeforeValue,
306
- filterArrays: () => filterArrays,
307
- filterArraysFast: () => filterArraysFast,
308
- getFrequencyInArray: () => getFrequencyInArray,
309
- joinArrays: () => joinArrays,
310
- mergeAndCloneIfArray: () => mergeAndCloneIfArray,
311
- mergeArray: () => mergeArray,
312
- removeFromArray: () => removeFromArray,
313
- removeValueFromArray: () => removeValueFromArray,
314
- removeValueFromArrayAll: () => removeValueFromArrayAll,
315
- reorderArrayByValues: () => reorderArrayByValues,
316
- swapItemsInArray: () => swapItemsInArray
317
- });
318
- module2.exports = __toCommonJS2(array_exports);
319
- var import_object = require_object();
320
- var import_types = require_types();
321
- var arrayContainsOtherArray = (arr1, arr2) => {
322
- return arr2.every((val) => arr1.includes(val));
323
- };
324
- var getFrequencyInArray = (arr, value) => {
325
- return arr.reduce((count, currentValue) => {
326
- return currentValue === value ? count + 1 : count;
327
- }, 0);
328
- };
329
- var removeFromArray = (arr, index) => {
330
- if ((0, import_types.isString)(index))
331
- index = parseInt(index);
332
- if ((0, import_types.isNumber)(index)) {
333
- if (index < 0 || index >= arr.length || isNaN(index)) {
334
- throw new Error("Invalid index");
335
- }
336
- arr.splice(index, 1);
337
- } else if ((0, import_types.isArray)(index)) {
338
- index.forEach((idx) => removeFromArray(arr, idx));
339
- } else {
340
- throw new Error("Invalid index");
341
- }
342
- return arr;
343
- };
344
- var swapItemsInArray = (arr, i, j) => {
345
- [arr[i], arr[j]] = [arr[j], arr[i]];
346
- };
347
- var joinArrays = (...arrays) => {
348
- return [].concat(...arrays);
349
- };
350
- var mergeArray = (arr, exclude = []) => {
351
- return arr.reduce((a, c) => (0, import_object.deepMerge)(a, (0, import_object.deepClone)(c, { exclude }), exclude), {});
352
- };
353
- var mergeAndCloneIfArray = (obj) => {
354
- return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepClone)(obj);
355
- };
356
- var cutArrayBeforeValue = (arr, value) => {
357
- const index = arr.indexOf(value);
358
- if (index !== -1) {
359
- return arr.slice(0, index);
360
- }
361
- return arr;
362
- };
363
- var cutArrayAfterValue = (arr, value) => {
364
- if (!(0, import_types.isArray)(arr))
365
- return;
366
- const index = arr.indexOf(value);
367
- if (index !== -1) {
368
- return arr.slice(index + 1);
369
- }
370
- return arr;
371
- };
372
- var removeValueFromArray = (arr, value) => {
373
- const index = arr.indexOf(value);
374
- if (index > -1) {
375
- const newArray = [...arr];
376
- newArray.splice(index, 1);
377
- return newArray;
378
- }
379
- return arr;
380
- };
381
- var removeValueFromArrayAll = (arr, value) => {
382
- return arr.filter((item) => item !== value);
383
- };
384
- var addItemAfterEveryElement = (array, item) => {
385
- const result = [];
386
- for (let i = 0; i < array.length; i++) {
387
- result.push(array[i]);
388
- if (i < array.length - 1) {
389
- result.push(item);
390
- }
391
- }
392
- return result;
393
- };
394
- var reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
395
- const newArray = [...array];
396
- const indexToMove = newArray.indexOf(valueToMove);
397
- const indexToInsertBefore = newArray.indexOf(insertBeforeValue);
398
- if (indexToMove !== -1 && indexToInsertBefore !== -1) {
399
- const removedItem = newArray.splice(indexToMove, 1)[0];
400
- const insertIndex = indexToInsertBefore < indexToMove ? indexToInsertBefore : indexToInsertBefore + 1;
401
- newArray.splice(insertIndex, 0, removedItem);
402
- }
403
- return newArray;
404
- };
405
- var arraysEqual = (arr1, arr2) => {
406
- if (arr1.length !== arr2.length) {
407
- return false;
408
- }
409
- for (let i = 0; i < arr1.length; i++) {
410
- if (arr1[i] !== arr2[i]) {
411
- return false;
412
- }
413
- }
414
- return true;
415
- };
416
- var filterArrays = (sourceArr, excludeArr) => {
417
- return sourceArr.filter((item) => !excludeArr.includes(item));
418
- };
419
- var filterArraysFast = (sourceArr, excludeArr) => {
420
- const excludeSet = new Set(excludeArr);
421
- return sourceArr.filter((item) => !excludeSet.has(item));
422
- };
423
- var checkIfStringIsInArray = (string, arr) => {
424
- if (!string)
425
- return;
426
- return arr.filter((v) => string.includes(v)).length;
427
- };
428
- }
429
- });
430
-
431
- // ../../node_modules/@domql/utils/dist/cjs/string.js
432
- var require_string = __commonJS({
433
- "../../node_modules/@domql/utils/dist/cjs/string.js"(exports, module2) {
434
- "use strict";
435
- var __defProp2 = Object.defineProperty;
436
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
437
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
438
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
439
- var __export2 = (target, all) => {
440
- for (var name in all)
441
- __defProp2(target, name, { get: all[name], enumerable: true });
442
- };
443
- var __copyProps2 = (to, from, except, desc) => {
444
- if (from && typeof from === "object" || typeof from === "function") {
445
- for (let key of __getOwnPropNames2(from))
446
- if (!__hasOwnProp2.call(to, key) && key !== except)
447
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
448
- }
449
- return to;
450
- };
451
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
452
- var string_exports = {};
453
- __export2(string_exports, {
454
- customDecodeURIComponent: () => customDecodeURIComponent,
455
- customEncodeURIComponent: () => customEncodeURIComponent,
456
- decodeNewlines: () => decodeNewlines,
457
- encodeNewlines: () => encodeNewlines,
458
- findKeyPosition: () => findKeyPosition,
459
- lowercaseFirstLetter: () => lowercaseFirstLetter,
460
- replaceLiteralsWithObjectFields: () => replaceLiteralsWithObjectFields,
461
- replaceOctalEscapeSequences: () => replaceOctalEscapeSequences,
462
- stringIncludesAny: () => stringIncludesAny,
463
- trimStringFromSymbols: () => trimStringFromSymbols
464
- });
465
- module2.exports = __toCommonJS2(string_exports);
466
- var stringIncludesAny = (str, characters) => {
467
- for (const char of characters) {
468
- if (str.includes(char)) {
469
- return true;
470
- }
471
- }
472
- return false;
473
- };
474
- var trimStringFromSymbols = (str, characters) => {
475
- const pattern = new RegExp(`[${characters.join("\\")}]`, "g");
476
- return str.replace(pattern, "");
477
- };
478
- var brackRegex = {
479
- 2: /\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}/g,
480
- 3: /\{\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}\}/g
481
- };
482
- function replaceLiteralsWithObjectFields(str, options = {}, forcedState) {
483
- if (!str.includes(options.bracketsLength === 3 ? "{{{" : "{{"))
484
- return str;
485
- const reg = brackRegex[options.bracketsLength || 2];
486
- const obj = forcedState || this.state || {};
487
- return str.replace(reg, (_, parentPath, variable) => {
488
- if (parentPath) {
489
- const parentLevels = parentPath.match(options.bracketsLength === 3 ? /\.\.\.\//g : /\.\.\//g).length;
490
- let parentState = obj;
491
- for (let i = 0; i < parentLevels; i++) {
492
- parentState = parentState.parent;
493
- if (!parentState) {
494
- return "";
495
- }
496
- }
497
- const value = parentState[variable.trim()];
498
- return value !== void 0 ? `${value}` : "";
499
- } else {
500
- const value = obj[variable.trim()];
501
- return value !== void 0 ? `${value}` : "";
502
- }
503
- });
504
- }
505
- var lowercaseFirstLetter = (inputString) => {
506
- return `${inputString.charAt(0).toLowerCase()}${inputString.slice(1)}`;
507
- };
508
- var findKeyPosition = (str, key) => {
509
- const lines = str.split("\n");
510
- let startLineNumber = -1;
511
- let endLineNumber = -1;
512
- let startColumn = -1;
513
- let endColumn = -1;
514
- const keyPattern = new RegExp(`\\b${key}\\b\\s*:\\s*`);
515
- let braceCount = 0;
516
- let foundKey = false;
517
- for (let i = 0; i < lines.length; i++) {
518
- if (keyPattern.test(lines[i]) && !foundKey) {
519
- foundKey = true;
520
- startLineNumber = i + 1;
521
- startColumn = lines[i].indexOf(key) + 1;
522
- if (lines[i].includes("{}")) {
523
- endLineNumber = startLineNumber;
524
- endColumn = lines[i].indexOf("{}") + 3;
525
- break;
526
- }
527
- const line = lines[i].slice(startColumn + key.length);
528
- if (line.includes("{") || line.includes("[")) {
529
- braceCount = 1;
530
- } else {
531
- endLineNumber = i + 1;
532
- endColumn = lines[i].length + 1;
533
- break;
534
- }
535
- } else if (foundKey) {
536
- braceCount += (lines[i].match(/{/g) || []).length;
537
- braceCount += (lines[i].match(/\[/g) || []).length;
538
- braceCount -= (lines[i].match(/}/g) || []).length;
539
- braceCount -= (lines[i].match(/]/g) || []).length;
540
- if (braceCount === 0) {
541
- endLineNumber = i + 1;
542
- endColumn = lines[i].lastIndexOf("}") !== -1 ? lines[i].lastIndexOf("}") + 2 : lines[i].length + 1;
543
- break;
544
- }
545
- }
546
- }
547
- return {
548
- startColumn,
549
- endColumn,
550
- startLineNumber,
551
- endLineNumber
552
- };
553
- };
554
- var replaceOctalEscapeSequences = (str) => {
555
- const octalRegex = /\\([0-7]{1,3})/g;
556
- return str.replace(octalRegex, (match, p1) => {
557
- const octalValue = parseInt(p1, 8);
558
- const char = String.fromCharCode(octalValue);
559
- return char;
560
- });
561
- };
562
- var encodeNewlines = (str) => {
563
- return str.split("\n").join("/////n").split("`").join("/////tilde").split("$").join("/////dlrsgn");
564
- };
565
- var decodeNewlines = (encodedStr) => {
566
- return encodedStr.split("/////n").join("\n").split("/////tilde").join("`").split("/////dlrsgn").join("$");
567
- };
568
- var customEncodeURIComponent = (str) => {
569
- return str.split("").map((char) => {
570
- if (/[^a-zA-Z0-9\s]/.test(char)) {
571
- return "%" + char.charCodeAt(0).toString(16).toUpperCase();
572
- }
573
- return char;
574
- }).join("");
575
- };
576
- var customDecodeURIComponent = (encodedStr) => {
577
- return encodedStr.replace(/%[0-9A-Fa-f]{2}/g, (match) => String.fromCharCode(parseInt(match.slice(1), 16)));
578
- };
579
- }
580
- });
581
-
582
- // ../../node_modules/@domql/utils/dist/cjs/object.js
583
- var require_object = __commonJS({
584
- "../../node_modules/@domql/utils/dist/cjs/object.js"(exports, module2) {
585
- "use strict";
586
- var __defProp2 = Object.defineProperty;
587
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
588
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
589
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
590
- var __export2 = (target, all) => {
591
- for (var name in all)
592
- __defProp2(target, name, { get: all[name], enumerable: true });
593
- };
594
- var __copyProps2 = (to, from, except, desc) => {
595
- if (from && typeof from === "object" || typeof from === "function") {
596
- for (let key of __getOwnPropNames2(from))
597
- if (!__hasOwnProp2.call(to, key) && key !== except)
598
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
599
- }
600
- return to;
601
- };
602
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
603
- var object_exports = {};
604
- __export2(object_exports, {
605
- clone: () => clone,
606
- createNestedObject: () => createNestedObject,
607
- createObjectWithoutPrototype: () => createObjectWithoutPrototype,
608
- deepClone: () => deepClone2,
609
- deepContains: () => deepContains,
610
- deepDestringify: () => deepDestringify,
611
- deepDiff: () => deepDiff,
612
- deepMerge: () => deepMerge2,
613
- deepStringify: () => deepStringify,
614
- deepStringifyWithMaxDepth: () => deepStringifyWithMaxDepth,
615
- detachFunctionsFromObject: () => detachFunctionsFromObject,
616
- detectInfiniteLoop: () => detectInfiniteLoop,
617
- diff: () => diff,
618
- diffArrays: () => diffArrays,
619
- diffObjects: () => diffObjects,
620
- excludeKeysFromObject: () => excludeKeysFromObject,
621
- exec: () => exec,
622
- flattenRecursive: () => flattenRecursive,
623
- hasOwnProperty: () => hasOwnProperty,
624
- isCyclic: () => isCyclic,
625
- isEmpty: () => isEmpty,
626
- isEmptyObject: () => isEmptyObject,
627
- isEqualDeep: () => isEqualDeep,
628
- makeObjectWithoutPrototype: () => makeObjectWithoutPrototype,
629
- map: () => map,
630
- merge: () => merge2,
631
- mergeArrayExclude: () => mergeArrayExclude,
632
- mergeIfExisted: () => mergeIfExisted,
633
- objectToString: () => objectToString,
634
- overwrite: () => overwrite,
635
- overwriteDeep: () => overwriteDeep,
636
- overwriteShallow: () => overwriteShallow,
637
- removeFromObject: () => removeFromObject,
638
- removeNestedKeyByPath: () => removeNestedKeyByPath,
639
- stringToObject: () => stringToObject
640
- });
641
- module2.exports = __toCommonJS2(object_exports);
642
- var import_globals2 = require_globals();
643
- var import_types = require_types();
644
- var import_array = require_array();
645
- var import_string = require_string();
646
- var import_node = require_node();
647
- var ENV = "development";
648
- var exec = (param, element, state, context) => {
649
- if ((0, import_types.isFunction)(param)) {
650
- return param.call(
651
- element,
652
- element,
653
- state || element.state,
654
- context || element.context
655
- );
656
- }
657
- return param;
658
- };
659
- var map = (obj, extention, element) => {
660
- for (const e in extention) {
661
- obj[e] = exec(extention[e], element);
662
- }
663
- };
664
- var merge2 = (element, obj, excludeFrom = []) => {
665
- for (const e in obj) {
666
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
667
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
668
- continue;
669
- const elementProp = element[e];
670
- const objProp = obj[e];
671
- if (elementProp === void 0) {
672
- element[e] = objProp;
673
- }
674
- }
675
- return element;
676
- };
677
- var deepMerge2 = (element, extend, excludeFrom = []) => {
678
- for (const e in extend) {
679
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
680
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
681
- continue;
682
- const elementProp = element[e];
683
- const extendProp = extend[e];
684
- if ((0, import_types.isObjectLike)(elementProp) && (0, import_types.isObjectLike)(extendProp)) {
685
- deepMerge2(elementProp, extendProp, excludeFrom);
686
- } else if (elementProp === void 0) {
687
- element[e] = extendProp;
688
- }
689
- }
690
- return element;
691
- };
692
- var clone = (obj, excludeFrom = []) => {
693
- const o = {};
694
- for (const prop in obj) {
695
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
696
- if (!hasOwnProperty2 || excludeFrom.includes(prop) || prop.startsWith("__"))
697
- continue;
698
- o[prop] = obj[prop];
699
- }
700
- return o;
701
- };
702
- var mergeArrayExclude = (arr, exclude = []) => {
703
- return arr.reduce((acc, curr) => deepMerge2(acc, deepClone2(curr, { exclude })), {});
704
- };
705
- var deepClone2 = (obj, options = {}) => {
706
- const {
707
- exclude = [],
708
- cleanUndefined = false,
709
- cleanNull = false,
710
- window: targetWindow,
711
- visited = /* @__PURE__ */ new WeakMap(),
712
- handleExtend = false
713
- } = options;
714
- if (!(0, import_types.isObjectLike)(obj) || (0, import_node.isDOMNode)(obj)) {
715
- return obj;
716
- }
717
- if (visited.has(obj)) {
718
- return visited.get(obj);
719
- }
720
- const clone2 = targetWindow ? (0, import_types.isArray)(obj) ? new targetWindow.Array() : new targetWindow.Object() : (0, import_types.isArray)(obj) ? [] : {};
721
- visited.set(obj, clone2);
722
- for (const key in obj) {
723
- if (!Object.prototype.hasOwnProperty.call(obj, key))
724
- continue;
725
- if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
726
- continue;
727
- const value = obj[key];
728
- if (cleanUndefined && (0, import_types.isUndefined)(value) || cleanNull && (0, import_types.isNull)(value))
729
- continue;
730
- if ((0, import_node.isDOMNode)(value)) {
731
- clone2[key] = value;
732
- continue;
733
- }
734
- if (handleExtend && key === "extend" && (0, import_types.isArray)(value)) {
735
- clone2[key] = (0, import_array.mergeArray)(value, exclude);
736
- continue;
737
- }
738
- if ((0, import_types.isFunction)(value) && targetWindow) {
739
- clone2[key] = targetWindow.eval("(" + value.toString() + ")");
740
- continue;
741
- }
742
- if ((0, import_types.isObjectLike)(value)) {
743
- clone2[key] = deepClone2(value, {
744
- ...options,
745
- visited
746
- });
747
- } else {
748
- clone2[key] = value;
749
- }
750
- }
751
- return clone2;
752
- };
753
- var deepStringify = (obj, stringified = {}) => {
754
- var _a, _b;
755
- if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
756
- (obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn("Trying to clone element or state at", obj);
757
- obj = (_b = obj.parse) == null ? void 0 : _b.call(obj);
758
- }
759
- for (const prop in obj) {
760
- const objProp = obj[prop];
761
- if ((0, import_types.isFunction)(objProp)) {
762
- stringified[prop] = objProp.toString();
763
- } else if ((0, import_types.isObject)(objProp)) {
764
- stringified[prop] = {};
765
- deepStringify(objProp, stringified[prop]);
766
- } else if ((0, import_types.isArray)(objProp)) {
767
- stringified[prop] = [];
768
- objProp.forEach((v, i) => {
769
- if ((0, import_types.isObject)(v)) {
770
- stringified[prop][i] = {};
771
- deepStringify(v, stringified[prop][i]);
772
- } else if ((0, import_types.isFunction)(v)) {
773
- stringified[prop][i] = v.toString();
774
- } else {
775
- stringified[prop][i] = v;
776
- }
777
- });
778
- } else {
779
- stringified[prop] = objProp;
780
- }
781
- }
782
- return stringified;
783
- };
784
- var MAX_DEPTH = 100;
785
- var deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "") => {
786
- if (depth > MAX_DEPTH) {
787
- console.warn(`Maximum depth exceeded at path: ${path}. Possible circular reference.`);
788
- return "[MAX_DEPTH_EXCEEDED]";
789
- }
790
- for (const prop in obj) {
791
- const currentPath = path ? `${path}.${prop}` : prop;
792
- const objProp = obj[prop];
793
- if ((0, import_types.isFunction)(objProp)) {
794
- stringified[prop] = objProp.toString();
795
- } else if ((0, import_types.isObject)(objProp)) {
796
- stringified[prop] = {};
797
- deepStringifyWithMaxDepth(objProp, stringified[prop], depth + 1, currentPath);
798
- } else if ((0, import_types.isArray)(objProp)) {
799
- stringified[prop] = [];
800
- objProp.forEach((v, i) => {
801
- const itemPath = `${currentPath}[${i}]`;
802
- if ((0, import_types.isObject)(v)) {
803
- stringified[prop][i] = {};
804
- deepStringifyWithMaxDepth(v, stringified[prop][i], depth + 1, itemPath);
805
- } else if ((0, import_types.isFunction)(v)) {
806
- stringified[prop][i] = v.toString();
807
- } else {
808
- stringified[prop][i] = v;
809
- }
810
- });
811
- } else {
812
- stringified[prop] = objProp;
813
- }
814
- }
815
- return stringified;
816
- };
817
- var objectToString = (obj = {}, indent = 0) => {
818
- if (obj === null || typeof obj !== "object") {
819
- return String(obj);
820
- }
821
- if (Object.keys(obj).length === 0) {
822
- return "{}";
823
- }
824
- const spaces = " ".repeat(indent);
825
- let str = "{\n";
826
- for (const [key, value] of Object.entries(obj)) {
827
- const keyNotAllowdChars = (0, import_string.stringIncludesAny)(key, ["&", "*", "-", ":", "%", "{", "}", ">", "<", "@", ".", "/", "!", " "]);
828
- const stringedKey = keyNotAllowdChars ? `'${key}'` : key;
829
- str += `${spaces} ${stringedKey}: `;
830
- if ((0, import_types.isArray)(value)) {
831
- str += "[\n";
832
- for (const element of value) {
833
- if ((0, import_types.isObjectLike)(element) && element !== null) {
834
- str += `${spaces} ${objectToString(element, indent + 2)},
835
- `;
836
- } else if ((0, import_types.isString)(element)) {
837
- str += `${spaces} '${element}',
838
- `;
839
- } else {
840
- str += `${spaces} ${element},
841
- `;
842
- }
843
- }
844
- str += `${spaces} ]`;
845
- } else if ((0, import_types.isObjectLike)(value)) {
846
- str += objectToString(value, indent + 1);
847
- } else if ((0, import_types.isString)(value)) {
848
- str += (0, import_string.stringIncludesAny)(value, ["\n", "'"]) ? `\`${value}\`` : `'${value}'`;
849
- } else {
850
- str += value;
851
- }
852
- str += ",\n";
853
- }
854
- str += `${spaces}}`;
855
- return str;
856
- };
857
- var detachFunctionsFromObject = (obj, detached = {}) => {
858
- for (const prop in obj) {
859
- const objProp = obj[prop];
860
- if ((0, import_types.isFunction)(objProp))
861
- continue;
862
- else if ((0, import_types.isObject)(objProp)) {
863
- detached[prop] = {};
864
- deepStringify(objProp, detached[prop]);
865
- } else if ((0, import_types.isArray)(objProp)) {
866
- detached[prop] = [];
867
- objProp.forEach((v, i) => {
868
- if ((0, import_types.isFunction)(v))
869
- return;
870
- if ((0, import_types.isObject)(v)) {
871
- detached[prop][i] = {};
872
- detachFunctionsFromObject(v, detached[prop][i]);
873
- } else {
874
- detached[prop][i] = v;
875
- }
876
- });
877
- } else {
878
- detached[prop] = objProp;
879
- }
880
- }
881
- return detached;
882
- };
883
- var deepDestringify = (obj, destringified = {}) => {
884
- for (const prop in obj) {
885
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
886
- if (!hasOwnProperty2)
887
- continue;
888
- const objProp = obj[prop];
889
- if ((0, import_types.isString)(objProp)) {
890
- if ((objProp.includes("(){") || objProp.includes("() {") || objProp.includes("=>") || objProp.startsWith("()") || objProp.startsWith("async") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
891
- try {
892
- const evalProp = import_globals2.window.eval(`(${objProp})`);
893
- destringified[prop] = evalProp;
894
- } catch (e) {
895
- if (e)
896
- destringified[prop] = objProp;
897
- }
898
- } else {
899
- destringified[prop] = objProp;
900
- }
901
- } else if ((0, import_types.isArray)(objProp)) {
902
- destringified[prop] = [];
903
- objProp.forEach((arrProp) => {
904
- if ((0, import_types.isString)(arrProp)) {
905
- if (arrProp.includes("=>") || arrProp.includes("function") || arrProp.startsWith("(")) {
906
- try {
907
- const evalProp = import_globals2.window.eval(`(${arrProp})`);
908
- destringified[prop].push(evalProp);
909
- } catch (e) {
910
- if (e)
911
- destringified[prop].push(arrProp);
912
- }
913
- } else {
914
- destringified[prop].push(arrProp);
915
- }
916
- } else if ((0, import_types.isObject)(arrProp)) {
917
- destringified[prop].push(deepDestringify(arrProp));
918
- } else {
919
- destringified[prop].push(arrProp);
920
- }
921
- });
922
- } else if ((0, import_types.isObject)(objProp)) {
923
- destringified[prop] = deepDestringify(objProp, destringified[prop]);
924
- } else {
925
- destringified[prop] = objProp;
926
- }
927
- }
928
- return destringified;
929
- };
930
- var stringToObject = (str, opts = { verbose: true }) => {
931
- try {
932
- return str ? import_globals2.window.eval("(" + str + ")") : {};
933
- } catch (e) {
934
- if (opts.verbose)
935
- console.warn(e);
936
- }
937
- };
938
- var diffObjects = (original, objToDiff, cache) => {
939
- for (const e in objToDiff) {
940
- if (e === "ref")
941
- continue;
942
- const originalProp = original[e];
943
- const objToDiffProp = objToDiff[e];
944
- if ((0, import_types.isObject)(originalProp) && (0, import_types.isObject)(objToDiffProp)) {
945
- cache[e] = {};
946
- diff(originalProp, objToDiffProp, cache[e]);
947
- } else if (objToDiffProp !== void 0) {
948
- cache[e] = objToDiffProp;
949
- }
950
- }
951
- return cache;
952
- };
953
- var diffArrays = (original, objToDiff, cache) => {
954
- if (original.length !== objToDiff.length) {
955
- cache = objToDiff;
956
- } else {
957
- const diffArr = [];
958
- for (let i = 0; i < original.length; i++) {
959
- const diffObj = diff(original[i], objToDiff[i]);
960
- if (Object.keys(diffObj).length > 0) {
961
- diffArr.push(diffObj);
962
- }
963
- }
964
- if (diffArr.length > 0) {
965
- cache = diffArr;
966
- }
967
- }
968
- return cache;
969
- };
970
- var diff = (original, objToDiff, cache = {}) => {
971
- if ((0, import_types.isArray)(original) && (0, import_types.isArray)(objToDiff)) {
972
- cache = [];
973
- diffArrays(original, objToDiff, cache);
974
- } else {
975
- diffObjects(original, objToDiff, cache);
976
- }
977
- return cache;
978
- };
979
- var hasOwnProperty = (o, ...args) => Object.prototype.hasOwnProperty.call(o, ...args);
980
- var isEmpty = (o) => Object.keys(o).length === 0;
981
- var isEmptyObject = (o) => (0, import_types.isObject)(o) && isEmpty(o);
982
- var makeObjectWithoutPrototype = () => /* @__PURE__ */ Object.create(null);
983
- var deepDiff = (lhs, rhs) => {
984
- if (lhs === rhs)
985
- return {};
986
- if (!(0, import_types.isObjectLike)(lhs) || !(0, import_types.isObjectLike)(rhs))
987
- return rhs;
988
- const deletedValues = Object.keys(lhs).reduce((acc, key) => {
989
- if (!hasOwnProperty(rhs, key)) {
990
- acc[key] = void 0;
991
- }
992
- return acc;
993
- }, makeObjectWithoutPrototype());
994
- if ((0, import_types.isDate)(lhs) || (0, import_types.isDate)(rhs)) {
995
- if (lhs.valueOf() === rhs.valueOf())
996
- return {};
997
- return rhs;
998
- }
999
- return Object.keys(rhs).reduce((acc, key) => {
1000
- if (!hasOwnProperty(lhs, key)) {
1001
- acc[key] = rhs[key];
1002
- return acc;
1003
- }
1004
- const difference = diff(lhs[key], rhs[key]);
1005
- if (isEmptyObject(difference) && !(0, import_types.isDate)(difference) && (isEmptyObject(lhs[key]) || !isEmptyObject(rhs[key]))) {
1006
- return acc;
1007
- }
1008
- acc[key] = difference;
1009
- return acc;
1010
- }, deletedValues);
1011
- };
1012
- var overwrite = (element, params, opts = {}) => {
1013
- const { __ref: ref } = element;
1014
- const excl = opts.exclude || [];
1015
- const allowUnderscore = opts.preventUnderscore;
1016
- const preventCaching = opts.preventCaching;
1017
- for (const e in params) {
1018
- if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
1019
- continue;
1020
- const elementProp = element[e];
1021
- const paramsProp = params[e];
1022
- if (paramsProp !== void 0) {
1023
- element[e] = paramsProp;
1024
- if (ref && !preventCaching) {
1025
- ref.__cache[e] = elementProp;
1026
- }
1027
- if ((0, import_types.isObject)(opts.diff)) {
1028
- diff[e] = elementProp;
1029
- }
1030
- }
1031
- }
1032
- return element;
1033
- };
1034
- var overwriteShallow = (obj, params, excludeFrom = []) => {
1035
- for (const e in params) {
1036
- if (excludeFrom.includes(e) || e.startsWith("__"))
1037
- continue;
1038
- obj[e] = params[e];
1039
- }
1040
- return obj;
1041
- };
1042
- var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
1043
- const excl = opts.exclude || [];
1044
- const forcedExclude = opts.preventForce ? [] : ["node", "window"];
1045
- if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
1046
- return params;
1047
- }
1048
- if (visited.has(obj))
1049
- return visited.get(obj);
1050
- visited.set(obj, obj);
1051
- for (const e in params) {
1052
- if (!Object.hasOwnProperty.call(params, e))
1053
- continue;
1054
- if (excl.includes(e) || forcedExclude && e.startsWith("__"))
1055
- continue;
1056
- const objProp = obj[e];
1057
- const paramsProp = params[e];
1058
- if ((0, import_node.isDOMNode)(paramsProp)) {
1059
- obj[e] = paramsProp;
1060
- } else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
1061
- obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
1062
- } else if (paramsProp !== void 0) {
1063
- obj[e] = paramsProp;
1064
- }
1065
- }
1066
- return obj;
1067
- };
1068
- var mergeIfExisted = (a, b) => {
1069
- if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
1070
- return deepMerge2(a, b);
1071
- return a || b;
1072
- };
1073
- var flattenRecursive = (param, prop, stack = []) => {
1074
- const objectized = (0, import_array.mergeAndCloneIfArray)(param);
1075
- stack.push(objectized);
1076
- const extendOfExtend = objectized[prop];
1077
- if (extendOfExtend)
1078
- flattenRecursive(extendOfExtend, prop, stack);
1079
- delete objectized[prop];
1080
- return stack;
1081
- };
1082
- var isEqualDeep = (param, element, visited = /* @__PURE__ */ new Set()) => {
1083
- if (typeof param !== "object" || typeof element !== "object" || param === null || element === null) {
1084
- return param === element;
1085
- }
1086
- if (visited.has(param) || visited.has(element)) {
1087
- return true;
1088
- }
1089
- visited.add(param);
1090
- visited.add(element);
1091
- const keysParam = Object.keys(param);
1092
- const keysElement = Object.keys(element);
1093
- if (keysParam.length !== keysElement.length) {
1094
- return false;
1095
- }
1096
- for (const key of keysParam) {
1097
- if (!keysElement.includes(key)) {
1098
- return false;
1099
- }
1100
- const paramProp = param[key];
1101
- const elementProp = element[key];
1102
- if (!isEqualDeep(paramProp, elementProp, visited)) {
1103
- return false;
1104
- }
1105
- }
1106
- return true;
1107
- };
1108
- var deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
1109
- if (obj1 === obj2)
1110
- return true;
1111
- if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2))
1112
- return false;
1113
- if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2))
1114
- return obj1 === obj2;
1115
- const stack = [[obj1, obj2]];
1116
- const visited = /* @__PURE__ */ new WeakSet();
1117
- while (stack.length > 0) {
1118
- const [current1, current2] = stack.pop();
1119
- if (visited.has(current1))
1120
- continue;
1121
- visited.add(current1);
1122
- const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
1123
- const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
1124
- if (keys1.length !== keys2.length)
1125
- return false;
1126
- for (const key of keys1) {
1127
- if (!Object.prototype.hasOwnProperty.call(current2, key))
1128
- return false;
1129
- const value1 = current1[key];
1130
- const value2 = current2[key];
1131
- if ((0, import_node.isDOMNode)(value1) || (0, import_node.isDOMNode)(value2)) {
1132
- if (value1 !== value2)
1133
- return false;
1134
- } else if ((0, import_types.isObjectLike)(value1) && (0, import_types.isObjectLike)(value2)) {
1135
- if (value1 !== value2) {
1136
- stack.push([value1, value2]);
1137
- }
1138
- } else if (value1 !== value2) {
1139
- return false;
1140
- }
1141
- }
1142
- }
1143
- return true;
1144
- };
1145
- var removeFromObject = (obj, props) => {
1146
- if (props === void 0 || props === null)
1147
- return obj;
1148
- if ((0, import_types.is)(props)("string", "number")) {
1149
- delete obj[props];
1150
- } else if ((0, import_types.isArray)(props)) {
1151
- props.forEach((prop) => delete obj[prop]);
1152
- } else {
1153
- throw new Error("Invalid input: props must be a string or an array of strings");
1154
- }
1155
- return obj;
1156
- };
1157
- var createObjectWithoutPrototype = (obj) => {
1158
- if (obj === null || typeof obj !== "object") {
1159
- return obj;
1160
- }
1161
- const newObj = /* @__PURE__ */ Object.create(null);
1162
- for (const key in obj) {
1163
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
1164
- newObj[key] = createObjectWithoutPrototype(obj[key]);
1165
- }
1166
- }
1167
- return newObj;
1168
- };
1169
- var createNestedObject = (arr, lastValue) => {
1170
- const nestedObject = {};
1171
- if (arr.length === 0) {
1172
- return lastValue;
1173
- }
1174
- arr.reduce((obj, value, index) => {
1175
- if (!obj[value]) {
1176
- obj[value] = {};
1177
- }
1178
- if (index === arr.length - 1 && lastValue) {
1179
- obj[value] = lastValue;
1180
- }
1181
- return obj[value];
1182
- }, nestedObject);
1183
- return nestedObject;
1184
- };
1185
- var removeNestedKeyByPath = (obj, path) => {
1186
- if (!Array.isArray(path)) {
1187
- throw new Error("Path must be an array.");
1188
- }
1189
- let current = obj;
1190
- for (let i = 0; i < path.length - 1; i++) {
1191
- if (current[path[i]] === void 0) {
1192
- return;
1193
- }
1194
- current = current[path[i]];
1195
- }
1196
- const lastKey = path[path.length - 1];
1197
- if (current && Object.hasOwnProperty.call(current, lastKey)) {
1198
- delete current[lastKey];
1199
- }
1200
- };
1201
- var detectInfiniteLoop = (arr) => {
1202
- const maxRepeats = 10;
1203
- let pattern = [];
1204
- let repeatCount = 0;
1205
- for (let i = 0; i < arr.length; i++) {
1206
- if (pattern.length < 2) {
1207
- pattern.push(arr[i]);
1208
- } else {
1209
- if (arr[i] === pattern[i % 2]) {
1210
- repeatCount++;
1211
- } else {
1212
- pattern = [arr[i - 1], arr[i]];
1213
- repeatCount = 1;
1214
- }
1215
- if (repeatCount >= maxRepeats * 2) {
1216
- if (ENV === "test" || ENV === "development") {
1217
- console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
1218
- }
1219
- return true;
1220
- }
1221
- }
1222
- }
1223
- };
1224
- var isCyclic = (obj) => {
1225
- const seenObjects = [];
1226
- function detect(obj2) {
1227
- if (obj2 && typeof obj2 === "object") {
1228
- if (seenObjects.indexOf(obj2) !== -1) {
1229
- return true;
1230
- }
1231
- seenObjects.push(obj2);
1232
- for (const key in obj2) {
1233
- if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
1234
- console.log(obj2, "cycle at " + key);
1235
- return true;
1236
- }
1237
- }
1238
- }
1239
- return false;
1240
- }
1241
- return detect(obj);
1242
- };
1243
- var excludeKeysFromObject = (obj, excludedKeys) => {
1244
- const result = { ...obj };
1245
- excludedKeys.forEach((key) => delete result[key]);
1246
- return result;
1247
- };
1248
- }
1249
- });
1250
-
1251
- // ../../node_modules/@domql/utils/dist/cjs/function.js
1252
- var require_function = __commonJS({
1253
- "../../node_modules/@domql/utils/dist/cjs/function.js"(exports, module2) {
1254
- "use strict";
1255
- var __defProp2 = Object.defineProperty;
1256
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1257
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1258
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1259
- var __export2 = (target, all) => {
1260
- for (var name in all)
1261
- __defProp2(target, name, { get: all[name], enumerable: true });
1262
- };
1263
- var __copyProps2 = (to, from, except, desc) => {
1264
- if (from && typeof from === "object" || typeof from === "function") {
1265
- for (let key of __getOwnPropNames2(from))
1266
- if (!__hasOwnProp2.call(to, key) && key !== except)
1267
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1268
- }
1269
- return to;
1270
- };
1271
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1272
- var function_exports = {};
1273
- __export2(function_exports, {
1274
- cloneFunction: () => cloneFunction,
1275
- debounce: () => debounce,
1276
- debounceOnContext: () => debounceOnContext,
1277
- isStringFunction: () => isStringFunction,
1278
- memoize: () => memoize
1279
- });
1280
- module2.exports = __toCommonJS2(function_exports);
1281
- function debounce(func, wait, immediate) {
1282
- let timeout;
1283
- return function() {
1284
- const context = this;
1285
- const args = arguments;
1286
- const later = function() {
1287
- timeout = null;
1288
- if (!immediate)
1289
- func.apply(context, args);
1290
- };
1291
- const callNow = immediate && !timeout;
1292
- clearTimeout(timeout);
1293
- timeout = setTimeout(later, wait);
1294
- if (callNow)
1295
- func.apply(context, args);
1296
- };
1297
- }
1298
- var debounceOnContext = (element, func, timeout = 300) => {
1299
- let timer;
1300
- return (...args) => {
1301
- clearTimeout(timer);
1302
- timer = setTimeout(() => {
1303
- func.apply(element, args);
1304
- }, timeout);
1305
- };
1306
- };
1307
- var memoize = (fn) => {
1308
- const cache = {};
1309
- return (...args) => {
1310
- const n = args[0];
1311
- if (n in cache) {
1312
- return cache[n];
1313
- } else {
1314
- const result = fn(n);
1315
- cache[n] = result;
1316
- return result;
1317
- }
1318
- };
1319
- };
1320
- var isStringFunction = (inputString) => {
1321
- const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
1322
- return functionRegex.test(inputString);
1323
- };
1324
- function cloneFunction(fn, win = window) {
1325
- const temp = function() {
1326
- return fn.apply(win, arguments);
1327
- };
1328
- for (const key in fn) {
1329
- if (Object.hasOwnProperty.call(fn, key)) {
1330
- temp[key] = fn[key];
1331
- }
1332
- }
1333
- return temp;
1334
- }
1335
- }
1336
- });
1337
-
1338
- // ../../node_modules/@domql/utils/dist/cjs/log.js
1339
- var require_log = __commonJS({
1340
- "../../node_modules/@domql/utils/dist/cjs/log.js"(exports, module2) {
1341
- "use strict";
1342
- var __defProp2 = Object.defineProperty;
1343
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1344
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1345
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1346
- var __export2 = (target, all) => {
1347
- for (var name in all)
1348
- __defProp2(target, name, { get: all[name], enumerable: true });
1349
- };
1350
- var __copyProps2 = (to, from, except, desc) => {
1351
- if (from && typeof from === "object" || typeof from === "function") {
1352
- for (let key of __getOwnPropNames2(from))
1353
- if (!__hasOwnProp2.call(to, key) && key !== except)
1354
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1355
- }
1356
- return to;
1357
- };
1358
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1359
- var log_exports = {};
1360
- __export2(log_exports, {
1361
- logGroupIf: () => logGroupIf,
1362
- logIf: () => logIf
1363
- });
1364
- module2.exports = __toCommonJS2(log_exports);
1365
- var logIf = (bool, ...arg) => {
1366
- if (bool)
1367
- arg.map((v) => console.log(v));
1368
- };
1369
- var logGroupIf = (bool, key, ...arg) => {
1370
- if (bool) {
1371
- console.group(key);
1372
- arg.map((v) => console.log(v));
1373
- console.groupEnd(key);
1374
- }
1375
- };
1376
- }
1377
- });
1378
-
1379
- // ../../node_modules/@domql/utils/dist/cjs/cookie.js
1380
- var require_cookie = __commonJS({
1381
- "../../node_modules/@domql/utils/dist/cjs/cookie.js"(exports, module2) {
1382
- "use strict";
1383
- var __defProp2 = Object.defineProperty;
1384
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1385
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1386
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1387
- var __export2 = (target, all) => {
1388
- for (var name in all)
1389
- __defProp2(target, name, { get: all[name], enumerable: true });
1390
- };
1391
- var __copyProps2 = (to, from, except, desc) => {
1392
- if (from && typeof from === "object" || typeof from === "function") {
1393
- for (let key of __getOwnPropNames2(from))
1394
- if (!__hasOwnProp2.call(to, key) && key !== except)
1395
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1396
- }
1397
- return to;
1398
- };
1399
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1400
- var cookie_exports = {};
1401
- __export2(cookie_exports, {
1402
- getCookie: () => getCookie,
1403
- getLocalStorage: () => getLocalStorage,
1404
- isMobile: () => isMobile,
1405
- removeCookie: () => removeCookie,
1406
- setCookie: () => setCookie,
1407
- setLocalStorage: () => setLocalStorage
1408
- });
1409
- module2.exports = __toCommonJS2(cookie_exports);
1410
- var import_types = require_types();
1411
- var import_utils13 = require_cjs();
1412
- var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
1413
- var setCookie = (cname, cvalue, exdays = 365) => {
1414
- if ((0, import_types.isUndefined)(import_utils13.document) || (0, import_types.isUndefined)(import_utils13.document.cookie))
1415
- return;
1416
- const d = /* @__PURE__ */ new Date();
1417
- d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
1418
- const expires = `expires=${d.toUTCString()}`;
1419
- import_utils13.document.cookie = `${cname}=${cvalue};${expires};path=/`;
1420
- };
1421
- var getCookie = (cname) => {
1422
- if ((0, import_types.isUndefined)(import_utils13.document) || (0, import_types.isUndefined)(import_utils13.document.cookie))
1423
- return;
1424
- const name = `${cname}=`;
1425
- const decodedCookie = decodeURIComponent(import_utils13.document.cookie);
1426
- const ca = decodedCookie.split(";");
1427
- for (let i = 0; i < ca.length; i++) {
1428
- let c = ca[i];
1429
- while (c.charAt(0) === " ")
1430
- c = c.substring(1);
1431
- if (c.indexOf(name) === 0)
1432
- return c.substring(name.length, c.length);
1433
- }
1434
- return "";
1435
- };
1436
- var removeCookie = (cname) => {
1437
- if ((0, import_types.isUndefined)(import_utils13.document) || (0, import_types.isUndefined)(import_utils13.document.cookie))
1438
- return;
1439
- import_utils13.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
1440
- };
1441
- function getLocalStorage(key) {
1442
- let savedJSON;
1443
- if (window.localStorage) {
1444
- try {
1445
- savedJSON = JSON.parse(window.localStorage.getItem(key));
1446
- } catch (e) {
1447
- }
1448
- }
1449
- if (typeof savedJSON !== "undefined") {
1450
- return savedJSON;
1451
- }
1452
- }
1453
- function setLocalStorage(key, data) {
1454
- if (data && window.localStorage) {
1455
- if (typeof data === "object") {
1456
- window.localStorage.setItem(key, JSON.stringify(data));
1457
- } else {
1458
- window.localStorage.setItem(key, data);
1459
- }
1460
- }
1461
- }
1462
- }
1463
- });
1464
-
1465
- // ../../node_modules/@domql/utils/dist/cjs/tags.js
1466
- var require_tags = __commonJS({
1467
- "../../node_modules/@domql/utils/dist/cjs/tags.js"(exports, module2) {
1468
- "use strict";
1469
- var __defProp2 = Object.defineProperty;
1470
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1471
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1472
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1473
- var __export2 = (target, all) => {
1474
- for (var name in all)
1475
- __defProp2(target, name, { get: all[name], enumerable: true });
1476
- };
1477
- var __copyProps2 = (to, from, except, desc) => {
1478
- if (from && typeof from === "object" || typeof from === "function") {
1479
- for (let key of __getOwnPropNames2(from))
1480
- if (!__hasOwnProp2.call(to, key) && key !== except)
1481
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1482
- }
1483
- return to;
1484
- };
1485
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1486
- var tags_exports = {};
1487
- __export2(tags_exports, {
1488
- HTML_TAGS: () => HTML_TAGS,
1489
- isValidHtmlTag: () => isValidHtmlTag
1490
- });
1491
- module2.exports = __toCommonJS2(tags_exports);
1492
- var HTML_TAGS = {
1493
- root: [
1494
- "body",
1495
- "html"
1496
- ],
1497
- head: [
1498
- "title",
1499
- "base",
1500
- "meta",
1501
- "style",
1502
- "noscript",
1503
- "script"
1504
- ],
1505
- body: [
1506
- "string",
1507
- "style",
1508
- "fragment",
1509
- "a",
1510
- "abbr",
1511
- "acronym",
1512
- "address",
1513
- "applet",
1514
- "area",
1515
- "article",
1516
- "aside",
1517
- "audio",
1518
- "b",
1519
- "basefont",
1520
- "bdi",
1521
- "bdo",
1522
- "big",
1523
- "blockquote",
1524
- "br",
1525
- "button",
1526
- "canvas",
1527
- "caption",
1528
- "center",
1529
- "cite",
1530
- "code",
1531
- "search",
1532
- "col",
1533
- "colgroup",
1534
- "data",
1535
- "datalist",
1536
- "dd",
1537
- "del",
1538
- "details",
1539
- "dfn",
1540
- "dialog",
1541
- "dir",
1542
- "div",
1543
- "dl",
1544
- "dt",
1545
- "em",
1546
- "embed",
1547
- "fieldset",
1548
- "figcaption",
1549
- "figure",
1550
- "font",
1551
- "footer",
1552
- "form",
1553
- "frame",
1554
- "frameset",
1555
- "h1",
1556
- "h2",
1557
- "h3",
1558
- "h4",
1559
- "h5",
1560
- "h6",
1561
- "head",
1562
- "header",
1563
- "hr",
1564
- "i",
1565
- "iframe",
1566
- "img",
1567
- "input",
1568
- "ins",
1569
- "kbd",
1570
- "label",
1571
- "legend",
1572
- "li",
1573
- "link",
1574
- "main",
1575
- "map",
1576
- "mark",
1577
- "meter",
1578
- "nav",
1579
- "noframes",
1580
- "noscript",
1581
- "object",
1582
- "ol",
1583
- "optgroup",
1584
- "option",
1585
- "output",
1586
- "p",
1587
- "param",
1588
- "picture",
1589
- "pre",
1590
- "progress",
1591
- "hgroup",
1592
- "q",
1593
- "rp",
1594
- "rt",
1595
- "ruby",
1596
- "s",
1597
- "samp",
1598
- "script",
1599
- "section",
1600
- "select",
1601
- "small",
1602
- "source",
1603
- "span",
1604
- "strike",
1605
- "strong",
1606
- "sub",
1607
- "summary",
1608
- "sup",
1609
- "table",
1610
- "tbody",
1611
- "td",
1612
- "template",
1613
- "hgroup",
1614
- "textarea",
1615
- "tfoot",
1616
- "th",
1617
- "thead",
1618
- "time",
1619
- "tr",
1620
- "track",
1621
- "tt",
1622
- "u",
1623
- "ul",
1624
- "var",
1625
- "video",
1626
- "wbr",
1627
- // SVG
1628
- "svg",
1629
- "path"
1630
- ]
1631
- };
1632
- var isValidHtmlTag = (arg) => HTML_TAGS.body.includes(arg);
1633
- }
1634
- });
1635
-
1636
- // ../../node_modules/@domql/utils/dist/cjs/component.js
1637
- var require_component = __commonJS({
1638
- "../../node_modules/@domql/utils/dist/cjs/component.js"(exports, module2) {
1639
- "use strict";
1640
- var __defProp2 = Object.defineProperty;
1641
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1642
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1643
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1644
- var __export2 = (target, all) => {
1645
- for (var name in all)
1646
- __defProp2(target, name, { get: all[name], enumerable: true });
1647
- };
1648
- var __copyProps2 = (to, from, except, desc) => {
1649
- if (from && typeof from === "object" || typeof from === "function") {
1650
- for (let key of __getOwnPropNames2(from))
1651
- if (!__hasOwnProp2.call(to, key) && key !== except)
1652
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1653
- }
1654
- return to;
1655
- };
1656
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1657
- var component_exports = {};
1658
- __export2(component_exports, {
1659
- addAdditionalExtend: () => addAdditionalExtend,
1660
- addChildrenIfNotInOriginal: () => addChildrenIfNotInOriginal,
1661
- applyComponentFromContext: () => applyComponentFromContext,
1662
- applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
1663
- checkIfKeyIsComponent: () => checkIfKeyIsComponent,
1664
- checkIfKeyIsProperty: () => checkIfKeyIsProperty,
1665
- checkIfSugar: () => checkIfSugar,
1666
- extendizeByKey: () => extendizeByKey,
1667
- extractComponentKeyFromKey: () => extractComponentKeyFromKey,
1668
- getCapitalCaseKeys: () => getCapitalCaseKeys,
1669
- getChildrenComponentsByKey: () => getChildrenComponentsByKey,
1670
- getExtendsInElement: () => getExtendsInElement,
1671
- hasVariantProp: () => hasVariantProp,
1672
- isVariant: () => isVariant,
1673
- setContentKey: () => setContentKey
1674
- });
1675
- module2.exports = __toCommonJS2(component_exports);
1676
- var import__ = require_cjs();
1677
- var ENV = "development";
1678
- var checkIfKeyIsComponent = (key) => {
1679
- const isFirstKeyString = (0, import__.isString)(key);
1680
- if (!isFirstKeyString)
1681
- return;
1682
- const firstCharKey = key.slice(0, 1);
1683
- return /^[A-Z]*$/.test(firstCharKey);
1684
- };
1685
- var checkIfKeyIsProperty = (key) => {
1686
- const isFirstKeyString = (0, import__.isString)(key);
1687
- if (!isFirstKeyString)
1688
- return;
1689
- const firstCharKey = key.slice(0, 1);
1690
- return /^[a-z]*$/.test(firstCharKey);
1691
- };
1692
- var addAdditionalExtend = (newExtend, element) => {
1693
- if (!newExtend)
1694
- return element;
1695
- const { extend: elementExtend } = element;
1696
- const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
1697
- const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
1698
- const extend = (0, import__.joinArrays)(receivedArray, originalArray);
1699
- return { ...element, extend };
1700
- };
1701
- var checkIfSugar = (element, parent, key) => {
1702
- var _a;
1703
- const {
1704
- extend,
1705
- props,
1706
- childExtend,
1707
- extends: extendProps,
1708
- childExtends,
1709
- childProps,
1710
- children,
1711
- on,
1712
- $collection,
1713
- $stateCollection,
1714
- $propsCollection
1715
- } = element;
1716
- const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
1717
- if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
1718
- const logErr = (_a = parent || element) == null ? void 0 : _a.error;
1719
- if (logErr)
1720
- logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
1721
- }
1722
- return !hasComponentAttrs || childProps || extendProps || children || childExtends;
1723
- };
1724
- var extractComponentKeyFromKey = (key) => {
1725
- return key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
1726
- };
1727
- var extendizeByKey = (element, parent, key) => {
1728
- const { context } = parent;
1729
- const { tag, extend, childExtends } = element;
1730
- const isSugar = checkIfSugar(element, parent, key);
1731
- const extendFromKey = extractComponentKeyFromKey(key);
1732
- const isExtendKeyComponent = context && context.components[extendFromKey];
1733
- if (element === isExtendKeyComponent)
1734
- return element;
1735
- else if (isSugar) {
1736
- const newElem = addAdditionalExtend(element.extends, {
1737
- extend: extendFromKey,
1738
- tag,
1739
- props: { ...element }
1740
- });
1741
- if (newElem.props.data) {
1742
- newElem.data = newElem.props.data;
1743
- delete newElem.props.data;
1744
- }
1745
- if (newElem.props.state) {
1746
- newElem.state = newElem.props.state;
1747
- delete newElem.props.state;
1748
- }
1749
- if (newElem.props.attr) {
1750
- newElem.attr = newElem.props.attr;
1751
- delete newElem.props.attr;
1752
- }
1753
- if (newElem.props.if) {
1754
- newElem.if = newElem.props.if;
1755
- delete newElem.props.if;
1756
- }
1757
- if (childExtends)
1758
- newElem.childExtend = childExtends;
1759
- return newElem;
1760
- } else if (!extend || extend === true) {
1761
- return {
1762
- ...element,
1763
- tag,
1764
- extend: extendFromKey
1765
- };
1766
- } else if (extend) {
1767
- return addAdditionalExtend(extendFromKey, element);
1768
- } else if ((0, import__.isFunction)(element)) {
1769
- return {
1770
- extend: extendFromKey,
1771
- tag,
1772
- props: { ...(0, import__.exec)(element, parent) }
1773
- };
1774
- }
1775
- };
1776
- function getCapitalCaseKeys(obj) {
1777
- return Object.keys(obj).filter((key) => /^[A-Z]/.test(key));
1778
- }
1779
- var addChildrenIfNotInOriginal = (element, parent, key) => {
1780
- const childElems = getCapitalCaseKeys(element.props);
1781
- if (!childElems.length)
1782
- return element;
1783
- for (const i in childElems) {
1784
- const childKey = childElems[i];
1785
- const childElem = element[childKey];
1786
- const newChild = element.props[childKey];
1787
- const assignChild = (val) => {
1788
- element[childKey] = val;
1789
- delete element.props[childKey];
1790
- };
1791
- if (newChild == null ? void 0 : newChild.ignoreExtend)
1792
- continue;
1793
- if (newChild === null)
1794
- assignChild(null);
1795
- else if (!childElem)
1796
- assignChild((0, import__.deepClone)(newChild));
1797
- else {
1798
- const isSugarChildElem = checkIfSugar(childElem, parent, key);
1799
- if (isSugarChildElem)
1800
- continue;
1801
- assignChild({
1802
- extend: element[childKey],
1803
- props: newChild
1804
- });
1805
- }
1806
- }
1807
- };
1808
- var applyKeyComponentAsExtend = (element, parent, key) => {
1809
- return extendizeByKey(element, parent, key) || element;
1810
- };
1811
- var applyComponentFromContext = (element, parent, options) => {
1812
- const { context } = element;
1813
- if (!context || !context.components)
1814
- return;
1815
- const { components } = context;
1816
- const { extend } = element;
1817
- const execExtend = (0, import__.exec)(extend, element);
1818
- if ((0, import__.isString)(execExtend)) {
1819
- const componentExists = components[execExtend] || components["smbls." + execExtend];
1820
- if (componentExists)
1821
- element.extend = componentExists;
1822
- else {
1823
- if ((ENV === "test" || ENV === "development") && options.verbose) {
1824
- console.warn(execExtend, "is not in library", components, element);
1825
- console.warn("replacing with ", {});
1826
- }
1827
- element.extend = {};
1828
- }
1829
- }
1830
- };
1831
- var isVariant = (param) => {
1832
- if (!(0, import__.isString)(param))
1833
- return;
1834
- const firstCharKey = param.slice(0, 1);
1835
- return firstCharKey === ".";
1836
- };
1837
- var hasVariantProp = (element) => {
1838
- const { props } = element;
1839
- if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
1840
- return true;
1841
- };
1842
- var getChildrenComponentsByKey = (key, el) => {
1843
- if (key === el.key || el.__ref.__componentKey === key) {
1844
- return el;
1845
- }
1846
- if (el.extend) {
1847
- const foundString = (0, import__.isString)(el.extend) && el.extend === key;
1848
- const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
1849
- if (foundString || foundInArray)
1850
- return el;
1851
- }
1852
- if (el.parent && el.parent.childExtend) {
1853
- const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
1854
- const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
1855
- if (foundString || foundInArray)
1856
- return el;
1857
- }
1858
- };
1859
- var getExtendsInElement = (obj) => {
1860
- let result = [];
1861
- function traverse(o) {
1862
- for (const key in o) {
1863
- if (Object.hasOwnProperty.call(o, key)) {
1864
- if (checkIfKeyIsComponent(key)) {
1865
- result.push(key);
1866
- }
1867
- if (key === "extend" || key === "extends") {
1868
- if (typeof o[key] === "string") {
1869
- result.push(o[key]);
1870
- } else if (Array.isArray(o[key])) {
1871
- result = result.concat(o[key]);
1872
- }
1873
- }
1874
- if (typeof o[key] === "object" && o[key] !== null) {
1875
- traverse(o[key]);
1876
- }
1877
- }
1878
- }
1879
- }
1880
- traverse(obj);
1881
- return result;
1882
- };
1883
- var setContentKey = (el, opts = {}) => {
1884
- const { __ref: ref } = el;
1885
- const contentElementKey = opts.contentElementKey;
1886
- if (contentElementKey !== "content" && contentElementKey !== ref.contentElementKey || !ref.contentElementKey) {
1887
- ref.contentElementKey = contentElementKey || "content";
1888
- } else
1889
- ref.contentElementKey = "content";
1890
- if (contentElementKey !== "content")
1891
- opts.contentElementKey = "content";
1892
- return ref.contentElementKey;
1893
- };
1894
- }
1895
- });
1896
-
1897
- // ../../node_modules/@domql/utils/dist/cjs/index.js
1898
- var require_cjs = __commonJS({
1899
- "../../node_modules/@domql/utils/dist/cjs/index.js"(exports, module2) {
1900
- "use strict";
1901
- var __defProp2 = Object.defineProperty;
1902
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1903
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1904
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1905
- var __copyProps2 = (to, from, except, desc) => {
1906
- if (from && typeof from === "object" || typeof from === "function") {
1907
- for (let key of __getOwnPropNames2(from))
1908
- if (!__hasOwnProp2.call(to, key) && key !== except)
1909
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1910
- }
1911
- return to;
1912
- };
1913
- var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
1914
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1915
- var utils_exports = {};
1916
- module2.exports = __toCommonJS2(utils_exports);
1917
- __reExport(utils_exports, require_key(), module2.exports);
1918
- __reExport(utils_exports, require_env(), module2.exports);
1919
- __reExport(utils_exports, require_types(), module2.exports);
1920
- __reExport(utils_exports, require_object(), module2.exports);
1921
- __reExport(utils_exports, require_function(), module2.exports);
1922
- __reExport(utils_exports, require_array(), module2.exports);
1923
- __reExport(utils_exports, require_node(), module2.exports);
1924
- __reExport(utils_exports, require_log(), module2.exports);
1925
- __reExport(utils_exports, require_string(), module2.exports);
1926
- __reExport(utils_exports, require_globals(), module2.exports);
1927
- __reExport(utils_exports, require_cookie(), module2.exports);
1928
- __reExport(utils_exports, require_tags(), module2.exports);
1929
- __reExport(utils_exports, require_component(), module2.exports);
1930
- }
1931
- });
1932
-
1933
33
  // ../../node_modules/@domql/globals/dist/cjs/index.js
1934
- var require_cjs2 = __commonJS({
34
+ var require_cjs = __commonJS({
1935
35
  "../../node_modules/@domql/globals/dist/cjs/index.js"(exports, module2) {
1936
36
  "use strict";
1937
- var __defProp2 = Object.defineProperty;
37
+ var __defProp3 = Object.defineProperty;
1938
38
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1939
39
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
1940
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
40
+ var __hasOwnProp3 = Object.prototype.hasOwnProperty;
1941
41
  var __export2 = (target, all) => {
1942
42
  for (var name in all)
1943
- __defProp2(target, name, { get: all[name], enumerable: true });
43
+ __defProp3(target, name, { get: all[name], enumerable: true });
1944
44
  };
1945
45
  var __copyProps2 = (to, from, except, desc) => {
1946
46
  if (from && typeof from === "object" || typeof from === "function") {
1947
47
  for (let key of __getOwnPropNames2(from))
1948
- if (!__hasOwnProp2.call(to, key) && key !== except)
1949
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
48
+ if (!__hasOwnProp3.call(to, key) && key !== except)
49
+ __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1950
50
  }
1951
51
  return to;
1952
52
  };
1953
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
53
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
1954
54
  var globals_exports = {};
1955
55
  __export2(globals_exports, {
1956
- document: () => document3,
56
+ document: () => document4,
1957
57
  global: () => global,
1958
58
  self: () => self,
1959
- window: () => window3
59
+ window: () => window4
1960
60
  });
1961
61
  module2.exports = __toCommonJS2(globals_exports);
1962
62
  var global = globalThis;
1963
63
  var self = globalThis;
1964
- var window3 = globalThis;
1965
- var document3 = window3.document;
64
+ var window4 = globalThis;
65
+ var document4 = window4.document;
1966
66
  }
1967
67
  });
1968
68
 
1969
69
  // ../utils/dist/cjs/index.js
1970
- var require_cjs3 = __commonJS({
70
+ var require_cjs2 = __commonJS({
1971
71
  "../utils/dist/cjs/index.js"(exports, module2) {
1972
72
  "use strict";
1973
- var __create2 = Object.create;
1974
- var __defProp2 = Object.defineProperty;
73
+ var __defProp3 = Object.defineProperty;
1975
74
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1976
75
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
1977
- var __getProtoOf2 = Object.getPrototypeOf;
1978
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1979
- var __commonJS2 = (cb, mod) => function __require() {
1980
- return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
1981
- };
76
+ var __hasOwnProp3 = Object.prototype.hasOwnProperty;
1982
77
  var __export2 = (target, all) => {
1983
78
  for (var name in all)
1984
- __defProp2(target, name, { get: all[name], enumerable: true });
79
+ __defProp3(target, name, { get: all[name], enumerable: true });
1985
80
  };
1986
81
  var __copyProps2 = (to, from, except, desc) => {
1987
82
  if (from && typeof from === "object" || typeof from === "function") {
1988
83
  for (let key of __getOwnPropNames2(from))
1989
- if (!__hasOwnProp2.call(to, key) && key !== except)
1990
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
84
+ if (!__hasOwnProp3.call(to, key) && key !== except)
85
+ __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1991
86
  }
1992
87
  return to;
1993
88
  };
1994
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
1995
- // If the importer is in node compatibility mode or this is not an ESM
1996
- // file that has been converted to a CommonJS file using a Babel-
1997
- // compatible transform (i.e. "__esModule" has not been set), then set
1998
- // "default" to the CommonJS "module.exports" for node compatibility.
1999
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
2000
- mod
2001
- ));
2002
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
2003
- var require_key2 = __commonJS2({
2004
- "../../node_modules/@domql/utils/dist/cjs/key.js"(exports2, module22) {
2005
- "use strict";
2006
- var __defProp22 = Object.defineProperty;
2007
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2008
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2009
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2010
- var __export22 = (target, all) => {
2011
- for (var name in all)
2012
- __defProp22(target, name, { get: all[name], enumerable: true });
2013
- };
2014
- var __copyProps22 = (to, from, except, desc) => {
2015
- if (from && typeof from === "object" || typeof from === "function") {
2016
- for (let key of __getOwnPropNames22(from))
2017
- if (!__hasOwnProp22.call(to, key) && key !== except)
2018
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2019
- }
2020
- return to;
2021
- };
2022
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2023
- var key_exports = {};
2024
- __export22(key_exports, {
2025
- createSnapshotId: () => createSnapshotId,
2026
- generateKey: () => generateKey
2027
- });
2028
- module22.exports = __toCommonJS22(key_exports);
2029
- var generateKey = /* @__PURE__ */ function() {
2030
- let index = 0;
2031
- function newId() {
2032
- index++;
2033
- return index;
2034
- }
2035
- return newId;
2036
- }();
2037
- var createSnapshotId = generateKey;
2038
- }
2039
- });
2040
- var require_env2 = __commonJS2({
2041
- "../../node_modules/@domql/utils/dist/cjs/env.js"(exports2, module22) {
2042
- "use strict";
2043
- var __defProp22 = Object.defineProperty;
2044
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2045
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2046
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2047
- var __export22 = (target, all) => {
2048
- for (var name in all)
2049
- __defProp22(target, name, { get: all[name], enumerable: true });
2050
- };
2051
- var __copyProps22 = (to, from, except, desc) => {
2052
- if (from && typeof from === "object" || typeof from === "function") {
2053
- for (let key of __getOwnPropNames22(from))
2054
- if (!__hasOwnProp22.call(to, key) && key !== except)
2055
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2056
- }
2057
- return to;
2058
- };
2059
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2060
- var env_exports = {};
2061
- __export22(env_exports, {
2062
- NODE_ENV: () => NODE_ENV,
2063
- getNev: () => getNev,
2064
- isDevelopment: () => isDevelopment,
2065
- isProduction: () => isProduction,
2066
- isTest: () => isTest
2067
- });
2068
- module22.exports = __toCommonJS22(env_exports);
2069
- var NODE_ENV = "development";
2070
- var isProduction = (env = NODE_ENV) => env === "production" || env === "prod" || env !== "development" && env !== "dev" && env !== "test";
2071
- var isTest = (env = NODE_ENV) => env === "test";
2072
- var isDevelopment = (env = NODE_ENV) => env === "development" || env === "dev";
2073
- var getNev = (key, env = NODE_ENV) => env[key];
2074
- }
2075
- });
2076
- var require_globals2 = __commonJS2({
2077
- "../../node_modules/@domql/utils/dist/cjs/globals.js"(exports2, module22) {
2078
- "use strict";
2079
- var __defProp22 = Object.defineProperty;
2080
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2081
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2082
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2083
- var __export22 = (target, all) => {
2084
- for (var name in all)
2085
- __defProp22(target, name, { get: all[name], enumerable: true });
2086
- };
2087
- var __copyProps22 = (to, from, except, desc) => {
2088
- if (from && typeof from === "object" || typeof from === "function") {
2089
- for (let key of __getOwnPropNames22(from))
2090
- if (!__hasOwnProp22.call(to, key) && key !== except)
2091
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2092
- }
2093
- return to;
2094
- };
2095
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2096
- var globals_exports = {};
2097
- __export22(globals_exports, {
2098
- document: () => document22,
2099
- global: () => global,
2100
- self: () => self,
2101
- window: () => window22
2102
- });
2103
- module22.exports = __toCommonJS22(globals_exports);
2104
- var global = globalThis;
2105
- var self = globalThis;
2106
- var window22 = globalThis;
2107
- var document22 = window22.document;
2108
- }
2109
- });
2110
- var require_node2 = __commonJS2({
2111
- "../../node_modules/@domql/utils/dist/cjs/node.js"(exports2, module22) {
2112
- "use strict";
2113
- var __defProp22 = Object.defineProperty;
2114
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2115
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2116
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2117
- var __export22 = (target, all) => {
2118
- for (var name in all)
2119
- __defProp22(target, name, { get: all[name], enumerable: true });
2120
- };
2121
- var __copyProps22 = (to, from, except, desc) => {
2122
- if (from && typeof from === "object" || typeof from === "function") {
2123
- for (let key of __getOwnPropNames22(from))
2124
- if (!__hasOwnProp22.call(to, key) && key !== except)
2125
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2126
- }
2127
- return to;
2128
- };
2129
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2130
- var node_exports = {};
2131
- __export22(node_exports, {
2132
- isDOMNode: () => isDOMNode,
2133
- isHtmlElement: () => isHtmlElement,
2134
- isNode: () => isNode
2135
- });
2136
- module22.exports = __toCommonJS22(node_exports);
2137
- var import_globals2 = require_globals2();
2138
- var isNode = (obj) => {
2139
- return (typeof Node === "object" ? obj instanceof import_globals2.window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
2140
- };
2141
- var isHtmlElement = (obj) => {
2142
- return (typeof HTMLElement === "object" ? obj instanceof import_globals2.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
2143
- };
2144
- var isDOMNode = (obj) => {
2145
- return typeof import_globals2.window !== "undefined" && (obj instanceof import_globals2.window.Node || obj instanceof import_globals2.window.Window || obj === import_globals2.window || obj === document);
2146
- };
2147
- }
2148
- });
2149
- var require_types2 = __commonJS2({
2150
- "../../node_modules/@domql/utils/dist/cjs/types.js"(exports2, module22) {
2151
- "use strict";
2152
- var __defProp22 = Object.defineProperty;
2153
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2154
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2155
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2156
- var __export22 = (target, all) => {
2157
- for (var name in all)
2158
- __defProp22(target, name, { get: all[name], enumerable: true });
2159
- };
2160
- var __copyProps22 = (to, from, except, desc) => {
2161
- if (from && typeof from === "object" || typeof from === "function") {
2162
- for (let key of __getOwnPropNames22(from))
2163
- if (!__hasOwnProp22.call(to, key) && key !== except)
2164
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2165
- }
2166
- return to;
2167
- };
2168
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2169
- var types_exports = {};
2170
- __export22(types_exports, {
2171
- TYPES: () => TYPES,
2172
- is: () => is,
2173
- isArray: () => isArray32,
2174
- isBoolean: () => isBoolean,
2175
- isDate: () => isDate,
2176
- isDefined: () => isDefined2,
2177
- isFunction: () => isFunction,
2178
- isNot: () => isNot,
2179
- isNull: () => isNull,
2180
- isNumber: () => isNumber2,
2181
- isObject: () => isObject32,
2182
- isObjectLike: () => isObjectLike2,
2183
- isString: () => isString22,
2184
- isUndefined: () => isUndefined
2185
- });
2186
- module22.exports = __toCommonJS22(types_exports);
2187
- var import_node = require_node2();
2188
- var isObject32 = (arg) => {
2189
- if (arg === null)
2190
- return false;
2191
- return typeof arg === "object" && arg.constructor === Object;
2192
- };
2193
- var isString22 = (arg) => typeof arg === "string";
2194
- var isNumber2 = (arg) => typeof arg === "number";
2195
- var isFunction = (arg) => typeof arg === "function";
2196
- var isBoolean = (arg) => arg === true || arg === false;
2197
- var isNull = (arg) => arg === null;
2198
- var isArray32 = (arg) => Array.isArray(arg);
2199
- var isDate = (d) => d instanceof Date;
2200
- var isObjectLike2 = (arg) => {
2201
- if (arg === null)
2202
- return false;
2203
- return typeof arg === "object";
2204
- };
2205
- var isDefined2 = (arg) => {
2206
- return isObject32(arg) || isObjectLike2(arg) || isString22(arg) || isNumber2(arg) || isFunction(arg) || isArray32(arg) || isObjectLike2(arg) || isBoolean(arg) || isDate(arg) || isNull(arg);
2207
- };
2208
- var isUndefined = (arg) => {
2209
- return arg === void 0;
2210
- };
2211
- var TYPES = {
2212
- boolean: isBoolean,
2213
- array: isArray32,
2214
- object: isObject32,
2215
- string: isString22,
2216
- date: isDate,
2217
- number: isNumber2,
2218
- null: isNull,
2219
- function: isFunction,
2220
- objectLike: isObjectLike2,
2221
- node: import_node.isNode,
2222
- htmlElement: import_node.isHtmlElement,
2223
- defined: isDefined2
2224
- };
2225
- var is = (arg) => {
2226
- return (...args) => {
2227
- return args.map((val) => TYPES[val](arg)).filter((v) => v).length > 0;
2228
- };
2229
- };
2230
- var isNot = (arg) => {
2231
- return (...args) => {
2232
- return args.map((val) => TYPES[val](arg)).filter((v) => v).length === 0;
2233
- };
2234
- };
2235
- }
2236
- });
2237
- var require_array2 = __commonJS2({
2238
- "../../node_modules/@domql/utils/dist/cjs/array.js"(exports2, module22) {
2239
- "use strict";
2240
- var __defProp22 = Object.defineProperty;
2241
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2242
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2243
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2244
- var __export22 = (target, all) => {
2245
- for (var name in all)
2246
- __defProp22(target, name, { get: all[name], enumerable: true });
2247
- };
2248
- var __copyProps22 = (to, from, except, desc) => {
2249
- if (from && typeof from === "object" || typeof from === "function") {
2250
- for (let key of __getOwnPropNames22(from))
2251
- if (!__hasOwnProp22.call(to, key) && key !== except)
2252
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2253
- }
2254
- return to;
2255
- };
2256
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2257
- var array_exports = {};
2258
- __export22(array_exports, {
2259
- addItemAfterEveryElement: () => addItemAfterEveryElement,
2260
- arrayContainsOtherArray: () => arrayContainsOtherArray,
2261
- arraysEqual: () => arraysEqual,
2262
- checkIfStringIsInArray: () => checkIfStringIsInArray,
2263
- cutArrayAfterValue: () => cutArrayAfterValue,
2264
- cutArrayBeforeValue: () => cutArrayBeforeValue,
2265
- filterArrays: () => filterArrays,
2266
- filterArraysFast: () => filterArraysFast,
2267
- getFrequencyInArray: () => getFrequencyInArray,
2268
- joinArrays: () => joinArrays,
2269
- mergeAndCloneIfArray: () => mergeAndCloneIfArray,
2270
- mergeArray: () => mergeArray,
2271
- removeFromArray: () => removeFromArray,
2272
- removeValueFromArray: () => removeValueFromArray,
2273
- removeValueFromArrayAll: () => removeValueFromArrayAll,
2274
- reorderArrayByValues: () => reorderArrayByValues,
2275
- swapItemsInArray: () => swapItemsInArray
2276
- });
2277
- module22.exports = __toCommonJS22(array_exports);
2278
- var import_object = require_object2();
2279
- var import_types = require_types2();
2280
- var arrayContainsOtherArray = (arr1, arr2) => {
2281
- return arr2.every((val) => arr1.includes(val));
2282
- };
2283
- var getFrequencyInArray = (arr, value) => {
2284
- return arr.reduce((count, currentValue) => {
2285
- return currentValue === value ? count + 1 : count;
2286
- }, 0);
2287
- };
2288
- var removeFromArray = (arr, index) => {
2289
- if ((0, import_types.isString)(index))
2290
- index = parseInt(index);
2291
- if ((0, import_types.isNumber)(index)) {
2292
- if (index < 0 || index >= arr.length || isNaN(index)) {
2293
- throw new Error("Invalid index");
2294
- }
2295
- arr.splice(index, 1);
2296
- } else if ((0, import_types.isArray)(index)) {
2297
- index.forEach((idx) => removeFromArray(arr, idx));
2298
- } else {
2299
- throw new Error("Invalid index");
2300
- }
2301
- return arr;
2302
- };
2303
- var swapItemsInArray = (arr, i, j) => {
2304
- [arr[i], arr[j]] = [arr[j], arr[i]];
2305
- };
2306
- var joinArrays = (...arrays) => {
2307
- return [].concat(...arrays);
2308
- };
2309
- var mergeArray = (arr, exclude = []) => {
2310
- return arr.reduce((a, c) => (0, import_object.deepMerge)(a, (0, import_object.deepClone)(c, { exclude }), exclude), {});
2311
- };
2312
- var mergeAndCloneIfArray = (obj) => {
2313
- return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepClone)(obj);
2314
- };
2315
- var cutArrayBeforeValue = (arr, value) => {
2316
- const index = arr.indexOf(value);
2317
- if (index !== -1) {
2318
- return arr.slice(0, index);
2319
- }
2320
- return arr;
2321
- };
2322
- var cutArrayAfterValue = (arr, value) => {
2323
- if (!(0, import_types.isArray)(arr))
2324
- return;
2325
- const index = arr.indexOf(value);
2326
- if (index !== -1) {
2327
- return arr.slice(index + 1);
2328
- }
2329
- return arr;
2330
- };
2331
- var removeValueFromArray = (arr, value) => {
2332
- const index = arr.indexOf(value);
2333
- if (index > -1) {
2334
- const newArray = [...arr];
2335
- newArray.splice(index, 1);
2336
- return newArray;
2337
- }
2338
- return arr;
2339
- };
2340
- var removeValueFromArrayAll = (arr, value) => {
2341
- return arr.filter((item) => item !== value);
2342
- };
2343
- var addItemAfterEveryElement = (array, item) => {
2344
- const result = [];
2345
- for (let i = 0; i < array.length; i++) {
2346
- result.push(array[i]);
2347
- if (i < array.length - 1) {
2348
- result.push(item);
2349
- }
2350
- }
2351
- return result;
2352
- };
2353
- var reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
2354
- const newArray = [...array];
2355
- const indexToMove = newArray.indexOf(valueToMove);
2356
- const indexToInsertBefore = newArray.indexOf(insertBeforeValue);
2357
- if (indexToMove !== -1 && indexToInsertBefore !== -1) {
2358
- const removedItem = newArray.splice(indexToMove, 1)[0];
2359
- const insertIndex = indexToInsertBefore < indexToMove ? indexToInsertBefore : indexToInsertBefore + 1;
2360
- newArray.splice(insertIndex, 0, removedItem);
2361
- }
2362
- return newArray;
2363
- };
2364
- var arraysEqual = (arr1, arr2) => {
2365
- if (arr1.length !== arr2.length) {
2366
- return false;
2367
- }
2368
- for (let i = 0; i < arr1.length; i++) {
2369
- if (arr1[i] !== arr2[i]) {
2370
- return false;
2371
- }
2372
- }
2373
- return true;
2374
- };
2375
- var filterArrays = (sourceArr, excludeArr) => {
2376
- return sourceArr.filter((item) => !excludeArr.includes(item));
2377
- };
2378
- var filterArraysFast = (sourceArr, excludeArr) => {
2379
- const excludeSet = new Set(excludeArr);
2380
- return sourceArr.filter((item) => !excludeSet.has(item));
2381
- };
2382
- var checkIfStringIsInArray = (string, arr) => {
2383
- if (!string)
2384
- return;
2385
- return arr.filter((v) => string.includes(v)).length;
2386
- };
2387
- }
2388
- });
2389
- var require_string2 = __commonJS2({
2390
- "../../node_modules/@domql/utils/dist/cjs/string.js"(exports2, module22) {
2391
- "use strict";
2392
- var __defProp22 = Object.defineProperty;
2393
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2394
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2395
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2396
- var __export22 = (target, all) => {
2397
- for (var name in all)
2398
- __defProp22(target, name, { get: all[name], enumerable: true });
2399
- };
2400
- var __copyProps22 = (to, from, except, desc) => {
2401
- if (from && typeof from === "object" || typeof from === "function") {
2402
- for (let key of __getOwnPropNames22(from))
2403
- if (!__hasOwnProp22.call(to, key) && key !== except)
2404
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2405
- }
2406
- return to;
2407
- };
2408
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2409
- var string_exports = {};
2410
- __export22(string_exports, {
2411
- customDecodeURIComponent: () => customDecodeURIComponent,
2412
- customEncodeURIComponent: () => customEncodeURIComponent,
2413
- decodeNewlines: () => decodeNewlines,
2414
- encodeNewlines: () => encodeNewlines,
2415
- findKeyPosition: () => findKeyPosition,
2416
- lowercaseFirstLetter: () => lowercaseFirstLetter,
2417
- replaceLiteralsWithObjectFields: () => replaceLiteralsWithObjectFields,
2418
- replaceOctalEscapeSequences: () => replaceOctalEscapeSequences,
2419
- stringIncludesAny: () => stringIncludesAny,
2420
- trimStringFromSymbols: () => trimStringFromSymbols
2421
- });
2422
- module22.exports = __toCommonJS22(string_exports);
2423
- var stringIncludesAny = (str, characters) => {
2424
- for (const char of characters) {
2425
- if (str.includes(char)) {
2426
- return true;
2427
- }
2428
- }
2429
- return false;
2430
- };
2431
- var trimStringFromSymbols = (str, characters) => {
2432
- const pattern = new RegExp(`[${characters.join("\\")}]`, "g");
2433
- return str.replace(pattern, "");
2434
- };
2435
- var brackRegex = {
2436
- 2: /\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}/g,
2437
- 3: /\{\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}\}/g
2438
- };
2439
- function replaceLiteralsWithObjectFields(str, options = {}, forcedState) {
2440
- if (!str.includes(options.bracketsLength === 3 ? "{{{" : "{{"))
2441
- return str;
2442
- const reg = brackRegex[options.bracketsLength || 2];
2443
- const obj = forcedState || this.state || {};
2444
- return str.replace(reg, (_, parentPath, variable) => {
2445
- if (parentPath) {
2446
- const parentLevels = parentPath.match(options.bracketsLength === 3 ? /\.\.\.\//g : /\.\.\//g).length;
2447
- let parentState = obj;
2448
- for (let i = 0; i < parentLevels; i++) {
2449
- parentState = parentState.parent;
2450
- if (!parentState) {
2451
- return "";
2452
- }
2453
- }
2454
- const value = parentState[variable.trim()];
2455
- return value !== void 0 ? `${value}` : "";
2456
- } else {
2457
- const value = obj[variable.trim()];
2458
- return value !== void 0 ? `${value}` : "";
2459
- }
2460
- });
2461
- }
2462
- var lowercaseFirstLetter = (inputString) => {
2463
- return `${inputString.charAt(0).toLowerCase()}${inputString.slice(1)}`;
2464
- };
2465
- var findKeyPosition = (str, key) => {
2466
- const lines = str.split("\n");
2467
- let startLineNumber = -1;
2468
- let endLineNumber = -1;
2469
- let startColumn = -1;
2470
- let endColumn = -1;
2471
- const keyPattern = new RegExp(`\\b${key}\\b\\s*:\\s*`);
2472
- let braceCount = 0;
2473
- let foundKey = false;
2474
- for (let i = 0; i < lines.length; i++) {
2475
- if (keyPattern.test(lines[i]) && !foundKey) {
2476
- foundKey = true;
2477
- startLineNumber = i + 1;
2478
- startColumn = lines[i].indexOf(key) + 1;
2479
- if (lines[i].includes("{}")) {
2480
- endLineNumber = startLineNumber;
2481
- endColumn = lines[i].indexOf("{}") + 3;
2482
- break;
2483
- }
2484
- const line = lines[i].slice(startColumn + key.length);
2485
- if (line.includes("{") || line.includes("[")) {
2486
- braceCount = 1;
2487
- } else {
2488
- endLineNumber = i + 1;
2489
- endColumn = lines[i].length + 1;
2490
- break;
2491
- }
2492
- } else if (foundKey) {
2493
- braceCount += (lines[i].match(/{/g) || []).length;
2494
- braceCount += (lines[i].match(/\[/g) || []).length;
2495
- braceCount -= (lines[i].match(/}/g) || []).length;
2496
- braceCount -= (lines[i].match(/]/g) || []).length;
2497
- if (braceCount === 0) {
2498
- endLineNumber = i + 1;
2499
- endColumn = lines[i].lastIndexOf("}") !== -1 ? lines[i].lastIndexOf("}") + 2 : lines[i].length + 1;
2500
- break;
2501
- }
2502
- }
2503
- }
2504
- return {
2505
- startColumn,
2506
- endColumn,
2507
- startLineNumber,
2508
- endLineNumber
2509
- };
2510
- };
2511
- var replaceOctalEscapeSequences = (str) => {
2512
- const octalRegex = /\\([0-7]{1,3})/g;
2513
- return str.replace(octalRegex, (match, p1) => {
2514
- const octalValue = parseInt(p1, 8);
2515
- const char = String.fromCharCode(octalValue);
2516
- return char;
2517
- });
2518
- };
2519
- var encodeNewlines = (str) => {
2520
- return str.split("\n").join("/////n").split("`").join("/////tilde").split("$").join("/////dlrsgn");
2521
- };
2522
- var decodeNewlines = (encodedStr) => {
2523
- return encodedStr.split("/////n").join("\n").split("/////tilde").join("`").split("/////dlrsgn").join("$");
2524
- };
2525
- var customEncodeURIComponent = (str) => {
2526
- return str.split("").map((char) => {
2527
- if (/[^a-zA-Z0-9\s]/.test(char)) {
2528
- return "%" + char.charCodeAt(0).toString(16).toUpperCase();
2529
- }
2530
- return char;
2531
- }).join("");
2532
- };
2533
- var customDecodeURIComponent = (encodedStr) => {
2534
- return encodedStr.replace(/%[0-9A-Fa-f]{2}/g, (match) => String.fromCharCode(parseInt(match.slice(1), 16)));
2535
- };
2536
- }
2537
- });
2538
- var require_object2 = __commonJS2({
2539
- "../../node_modules/@domql/utils/dist/cjs/object.js"(exports2, module22) {
2540
- "use strict";
2541
- var __defProp22 = Object.defineProperty;
2542
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2543
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2544
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2545
- var __export22 = (target, all) => {
2546
- for (var name in all)
2547
- __defProp22(target, name, { get: all[name], enumerable: true });
2548
- };
2549
- var __copyProps22 = (to, from, except, desc) => {
2550
- if (from && typeof from === "object" || typeof from === "function") {
2551
- for (let key of __getOwnPropNames22(from))
2552
- if (!__hasOwnProp22.call(to, key) && key !== except)
2553
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2554
- }
2555
- return to;
2556
- };
2557
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2558
- var object_exports = {};
2559
- __export22(object_exports, {
2560
- clone: () => clone,
2561
- createNestedObject: () => createNestedObject,
2562
- createObjectWithoutPrototype: () => createObjectWithoutPrototype,
2563
- deepClone: () => deepClone2,
2564
- deepContains: () => deepContains,
2565
- deepDestringify: () => deepDestringify,
2566
- deepDiff: () => deepDiff,
2567
- deepMerge: () => deepMerge2,
2568
- deepStringify: () => deepStringify,
2569
- deepStringifyWithMaxDepth: () => deepStringifyWithMaxDepth,
2570
- detachFunctionsFromObject: () => detachFunctionsFromObject,
2571
- detectInfiniteLoop: () => detectInfiniteLoop,
2572
- diff: () => diff,
2573
- diffArrays: () => diffArrays,
2574
- diffObjects: () => diffObjects,
2575
- excludeKeysFromObject: () => excludeKeysFromObject,
2576
- exec: () => exec,
2577
- flattenRecursive: () => flattenRecursive,
2578
- hasOwnProperty: () => hasOwnProperty,
2579
- isCyclic: () => isCyclic,
2580
- isEmpty: () => isEmpty,
2581
- isEmptyObject: () => isEmptyObject,
2582
- isEqualDeep: () => isEqualDeep,
2583
- makeObjectWithoutPrototype: () => makeObjectWithoutPrototype,
2584
- map: () => map,
2585
- merge: () => merge2,
2586
- mergeArrayExclude: () => mergeArrayExclude,
2587
- mergeIfExisted: () => mergeIfExisted,
2588
- objectToString: () => objectToString,
2589
- overwrite: () => overwrite,
2590
- overwriteDeep: () => overwriteDeep,
2591
- overwriteShallow: () => overwriteShallow,
2592
- removeFromObject: () => removeFromObject,
2593
- removeNestedKeyByPath: () => removeNestedKeyByPath,
2594
- stringToObject: () => stringToObject
2595
- });
2596
- module22.exports = __toCommonJS22(object_exports);
2597
- var import_globals2 = require_globals2();
2598
- var import_types = require_types2();
2599
- var import_array = require_array2();
2600
- var import_string = require_string2();
2601
- var import_node = require_node2();
2602
- var ENV = "development";
2603
- var exec = (param, element, state, context) => {
2604
- if ((0, import_types.isFunction)(param)) {
2605
- return param.call(
2606
- element,
2607
- element,
2608
- state || element.state,
2609
- context || element.context
2610
- );
2611
- }
2612
- return param;
2613
- };
2614
- var map = (obj, extention, element) => {
2615
- for (const e in extention) {
2616
- obj[e] = exec(extention[e], element);
2617
- }
2618
- };
2619
- var merge2 = (element, obj, excludeFrom = []) => {
2620
- for (const e in obj) {
2621
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
2622
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
2623
- continue;
2624
- const elementProp = element[e];
2625
- const objProp = obj[e];
2626
- if (elementProp === void 0) {
2627
- element[e] = objProp;
2628
- }
2629
- }
2630
- return element;
2631
- };
2632
- var deepMerge2 = (element, extend, excludeFrom = []) => {
2633
- for (const e in extend) {
2634
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
2635
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
2636
- continue;
2637
- const elementProp = element[e];
2638
- const extendProp = extend[e];
2639
- if ((0, import_types.isObjectLike)(elementProp) && (0, import_types.isObjectLike)(extendProp)) {
2640
- deepMerge2(elementProp, extendProp, excludeFrom);
2641
- } else if (elementProp === void 0) {
2642
- element[e] = extendProp;
2643
- }
2644
- }
2645
- return element;
2646
- };
2647
- var clone = (obj, excludeFrom = []) => {
2648
- const o = {};
2649
- for (const prop in obj) {
2650
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
2651
- if (!hasOwnProperty2 || excludeFrom.includes(prop) || prop.startsWith("__"))
2652
- continue;
2653
- o[prop] = obj[prop];
2654
- }
2655
- return o;
2656
- };
2657
- var mergeArrayExclude = (arr, exclude = []) => {
2658
- return arr.reduce((acc, curr) => deepMerge2(acc, deepClone2(curr, { exclude })), {});
2659
- };
2660
- var deepClone2 = (obj, options = {}) => {
2661
- const {
2662
- exclude = [],
2663
- cleanUndefined = false,
2664
- cleanNull = false,
2665
- window: targetWindow,
2666
- visited = /* @__PURE__ */ new WeakMap(),
2667
- handleExtend = false
2668
- } = options;
2669
- if (!(0, import_types.isObjectLike)(obj) || (0, import_node.isDOMNode)(obj)) {
2670
- return obj;
2671
- }
2672
- if (visited.has(obj)) {
2673
- return visited.get(obj);
2674
- }
2675
- const clone2 = targetWindow ? (0, import_types.isArray)(obj) ? new targetWindow.Array() : new targetWindow.Object() : (0, import_types.isArray)(obj) ? [] : {};
2676
- visited.set(obj, clone2);
2677
- for (const key in obj) {
2678
- if (!Object.prototype.hasOwnProperty.call(obj, key))
2679
- continue;
2680
- if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
2681
- continue;
2682
- const value = obj[key];
2683
- if (cleanUndefined && (0, import_types.isUndefined)(value) || cleanNull && (0, import_types.isNull)(value))
2684
- continue;
2685
- if ((0, import_node.isDOMNode)(value)) {
2686
- clone2[key] = value;
2687
- continue;
2688
- }
2689
- if (handleExtend && key === "extend" && (0, import_types.isArray)(value)) {
2690
- clone2[key] = (0, import_array.mergeArray)(value, exclude);
2691
- continue;
2692
- }
2693
- if ((0, import_types.isFunction)(value) && targetWindow) {
2694
- clone2[key] = targetWindow.eval("(" + value.toString() + ")");
2695
- continue;
2696
- }
2697
- if ((0, import_types.isObjectLike)(value)) {
2698
- clone2[key] = deepClone2(value, {
2699
- ...options,
2700
- visited
2701
- });
2702
- } else {
2703
- clone2[key] = value;
2704
- }
2705
- }
2706
- return clone2;
2707
- };
2708
- var deepStringify = (obj, stringified = {}) => {
2709
- var _a, _b;
2710
- if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
2711
- (obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn("Trying to clone element or state at", obj);
2712
- obj = (_b = obj.parse) == null ? void 0 : _b.call(obj);
2713
- }
2714
- for (const prop in obj) {
2715
- const objProp = obj[prop];
2716
- if ((0, import_types.isFunction)(objProp)) {
2717
- stringified[prop] = objProp.toString();
2718
- } else if ((0, import_types.isObject)(objProp)) {
2719
- stringified[prop] = {};
2720
- deepStringify(objProp, stringified[prop]);
2721
- } else if ((0, import_types.isArray)(objProp)) {
2722
- stringified[prop] = [];
2723
- objProp.forEach((v, i) => {
2724
- if ((0, import_types.isObject)(v)) {
2725
- stringified[prop][i] = {};
2726
- deepStringify(v, stringified[prop][i]);
2727
- } else if ((0, import_types.isFunction)(v)) {
2728
- stringified[prop][i] = v.toString();
2729
- } else {
2730
- stringified[prop][i] = v;
2731
- }
2732
- });
2733
- } else {
2734
- stringified[prop] = objProp;
2735
- }
2736
- }
2737
- return stringified;
2738
- };
2739
- var MAX_DEPTH = 100;
2740
- var deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "") => {
2741
- if (depth > MAX_DEPTH) {
2742
- console.warn(`Maximum depth exceeded at path: ${path}. Possible circular reference.`);
2743
- return "[MAX_DEPTH_EXCEEDED]";
2744
- }
2745
- for (const prop in obj) {
2746
- const currentPath = path ? `${path}.${prop}` : prop;
2747
- const objProp = obj[prop];
2748
- if ((0, import_types.isFunction)(objProp)) {
2749
- stringified[prop] = objProp.toString();
2750
- } else if ((0, import_types.isObject)(objProp)) {
2751
- stringified[prop] = {};
2752
- deepStringifyWithMaxDepth(objProp, stringified[prop], depth + 1, currentPath);
2753
- } else if ((0, import_types.isArray)(objProp)) {
2754
- stringified[prop] = [];
2755
- objProp.forEach((v, i) => {
2756
- const itemPath = `${currentPath}[${i}]`;
2757
- if ((0, import_types.isObject)(v)) {
2758
- stringified[prop][i] = {};
2759
- deepStringifyWithMaxDepth(v, stringified[prop][i], depth + 1, itemPath);
2760
- } else if ((0, import_types.isFunction)(v)) {
2761
- stringified[prop][i] = v.toString();
2762
- } else {
2763
- stringified[prop][i] = v;
2764
- }
2765
- });
2766
- } else {
2767
- stringified[prop] = objProp;
2768
- }
2769
- }
2770
- return stringified;
2771
- };
2772
- var objectToString = (obj = {}, indent = 0) => {
2773
- if (obj === null || typeof obj !== "object") {
2774
- return String(obj);
2775
- }
2776
- if (Object.keys(obj).length === 0) {
2777
- return "{}";
2778
- }
2779
- const spaces = " ".repeat(indent);
2780
- let str = "{\n";
2781
- for (const [key, value] of Object.entries(obj)) {
2782
- const keyNotAllowdChars = (0, import_string.stringIncludesAny)(key, ["&", "*", "-", ":", "%", "{", "}", ">", "<", "@", ".", "/", "!", " "]);
2783
- const stringedKey = keyNotAllowdChars ? `'${key}'` : key;
2784
- str += `${spaces} ${stringedKey}: `;
2785
- if ((0, import_types.isArray)(value)) {
2786
- str += "[\n";
2787
- for (const element of value) {
2788
- if ((0, import_types.isObjectLike)(element) && element !== null) {
2789
- str += `${spaces} ${objectToString(element, indent + 2)},
2790
- `;
2791
- } else if ((0, import_types.isString)(element)) {
2792
- str += `${spaces} '${element}',
2793
- `;
2794
- } else {
2795
- str += `${spaces} ${element},
2796
- `;
2797
- }
2798
- }
2799
- str += `${spaces} ]`;
2800
- } else if ((0, import_types.isObjectLike)(value)) {
2801
- str += objectToString(value, indent + 1);
2802
- } else if ((0, import_types.isString)(value)) {
2803
- str += (0, import_string.stringIncludesAny)(value, ["\n", "'"]) ? `\`${value}\`` : `'${value}'`;
2804
- } else {
2805
- str += value;
2806
- }
2807
- str += ",\n";
2808
- }
2809
- str += `${spaces}}`;
2810
- return str;
2811
- };
2812
- var detachFunctionsFromObject = (obj, detached = {}) => {
2813
- for (const prop in obj) {
2814
- const objProp = obj[prop];
2815
- if ((0, import_types.isFunction)(objProp))
2816
- continue;
2817
- else if ((0, import_types.isObject)(objProp)) {
2818
- detached[prop] = {};
2819
- deepStringify(objProp, detached[prop]);
2820
- } else if ((0, import_types.isArray)(objProp)) {
2821
- detached[prop] = [];
2822
- objProp.forEach((v, i) => {
2823
- if ((0, import_types.isFunction)(v))
2824
- return;
2825
- if ((0, import_types.isObject)(v)) {
2826
- detached[prop][i] = {};
2827
- detachFunctionsFromObject(v, detached[prop][i]);
2828
- } else {
2829
- detached[prop][i] = v;
2830
- }
2831
- });
2832
- } else {
2833
- detached[prop] = objProp;
2834
- }
2835
- }
2836
- return detached;
2837
- };
2838
- var deepDestringify = (obj, destringified = {}) => {
2839
- for (const prop in obj) {
2840
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
2841
- if (!hasOwnProperty2)
2842
- continue;
2843
- const objProp = obj[prop];
2844
- if ((0, import_types.isString)(objProp)) {
2845
- if ((objProp.includes("(){") || objProp.includes("() {") || objProp.includes("=>") || objProp.startsWith("()") || objProp.startsWith("async") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
2846
- try {
2847
- const evalProp = import_globals2.window.eval(`(${objProp})`);
2848
- destringified[prop] = evalProp;
2849
- } catch (e) {
2850
- if (e)
2851
- destringified[prop] = objProp;
2852
- }
2853
- } else {
2854
- destringified[prop] = objProp;
2855
- }
2856
- } else if ((0, import_types.isArray)(objProp)) {
2857
- destringified[prop] = [];
2858
- objProp.forEach((arrProp) => {
2859
- if ((0, import_types.isString)(arrProp)) {
2860
- if (arrProp.includes("=>") || arrProp.includes("function") || arrProp.startsWith("(")) {
2861
- try {
2862
- const evalProp = import_globals2.window.eval(`(${arrProp})`);
2863
- destringified[prop].push(evalProp);
2864
- } catch (e) {
2865
- if (e)
2866
- destringified[prop].push(arrProp);
2867
- }
2868
- } else {
2869
- destringified[prop].push(arrProp);
2870
- }
2871
- } else if ((0, import_types.isObject)(arrProp)) {
2872
- destringified[prop].push(deepDestringify(arrProp));
2873
- } else {
2874
- destringified[prop].push(arrProp);
2875
- }
2876
- });
2877
- } else if ((0, import_types.isObject)(objProp)) {
2878
- destringified[prop] = deepDestringify(objProp, destringified[prop]);
2879
- } else {
2880
- destringified[prop] = objProp;
2881
- }
2882
- }
2883
- return destringified;
2884
- };
2885
- var stringToObject = (str, opts = { verbose: true }) => {
2886
- try {
2887
- return str ? import_globals2.window.eval("(" + str + ")") : {};
2888
- } catch (e) {
2889
- if (opts.verbose)
2890
- console.warn(e);
2891
- }
2892
- };
2893
- var diffObjects = (original, objToDiff, cache) => {
2894
- for (const e in objToDiff) {
2895
- if (e === "ref")
2896
- continue;
2897
- const originalProp = original[e];
2898
- const objToDiffProp = objToDiff[e];
2899
- if ((0, import_types.isObject)(originalProp) && (0, import_types.isObject)(objToDiffProp)) {
2900
- cache[e] = {};
2901
- diff(originalProp, objToDiffProp, cache[e]);
2902
- } else if (objToDiffProp !== void 0) {
2903
- cache[e] = objToDiffProp;
2904
- }
2905
- }
2906
- return cache;
2907
- };
2908
- var diffArrays = (original, objToDiff, cache) => {
2909
- if (original.length !== objToDiff.length) {
2910
- cache = objToDiff;
2911
- } else {
2912
- const diffArr = [];
2913
- for (let i = 0; i < original.length; i++) {
2914
- const diffObj = diff(original[i], objToDiff[i]);
2915
- if (Object.keys(diffObj).length > 0) {
2916
- diffArr.push(diffObj);
2917
- }
2918
- }
2919
- if (diffArr.length > 0) {
2920
- cache = diffArr;
2921
- }
2922
- }
2923
- return cache;
2924
- };
2925
- var diff = (original, objToDiff, cache = {}) => {
2926
- if ((0, import_types.isArray)(original) && (0, import_types.isArray)(objToDiff)) {
2927
- cache = [];
2928
- diffArrays(original, objToDiff, cache);
2929
- } else {
2930
- diffObjects(original, objToDiff, cache);
2931
- }
2932
- return cache;
2933
- };
2934
- var hasOwnProperty = (o, ...args) => Object.prototype.hasOwnProperty.call(o, ...args);
2935
- var isEmpty = (o) => Object.keys(o).length === 0;
2936
- var isEmptyObject = (o) => (0, import_types.isObject)(o) && isEmpty(o);
2937
- var makeObjectWithoutPrototype = () => /* @__PURE__ */ Object.create(null);
2938
- var deepDiff = (lhs, rhs) => {
2939
- if (lhs === rhs)
2940
- return {};
2941
- if (!(0, import_types.isObjectLike)(lhs) || !(0, import_types.isObjectLike)(rhs))
2942
- return rhs;
2943
- const deletedValues = Object.keys(lhs).reduce((acc, key) => {
2944
- if (!hasOwnProperty(rhs, key)) {
2945
- acc[key] = void 0;
2946
- }
2947
- return acc;
2948
- }, makeObjectWithoutPrototype());
2949
- if ((0, import_types.isDate)(lhs) || (0, import_types.isDate)(rhs)) {
2950
- if (lhs.valueOf() === rhs.valueOf())
2951
- return {};
2952
- return rhs;
2953
- }
2954
- return Object.keys(rhs).reduce((acc, key) => {
2955
- if (!hasOwnProperty(lhs, key)) {
2956
- acc[key] = rhs[key];
2957
- return acc;
2958
- }
2959
- const difference = diff(lhs[key], rhs[key]);
2960
- if (isEmptyObject(difference) && !(0, import_types.isDate)(difference) && (isEmptyObject(lhs[key]) || !isEmptyObject(rhs[key]))) {
2961
- return acc;
2962
- }
2963
- acc[key] = difference;
2964
- return acc;
2965
- }, deletedValues);
2966
- };
2967
- var overwrite = (element, params, opts = {}) => {
2968
- const { __ref: ref } = element;
2969
- const excl = opts.exclude || [];
2970
- const allowUnderscore = opts.preventUnderscore;
2971
- const preventCaching = opts.preventCaching;
2972
- for (const e in params) {
2973
- if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
2974
- continue;
2975
- const elementProp = element[e];
2976
- const paramsProp = params[e];
2977
- if (paramsProp !== void 0) {
2978
- element[e] = paramsProp;
2979
- if (ref && !preventCaching) {
2980
- ref.__cache[e] = elementProp;
2981
- }
2982
- if ((0, import_types.isObject)(opts.diff)) {
2983
- diff[e] = elementProp;
2984
- }
2985
- }
2986
- }
2987
- return element;
2988
- };
2989
- var overwriteShallow = (obj, params, excludeFrom = []) => {
2990
- for (const e in params) {
2991
- if (excludeFrom.includes(e) || e.startsWith("__"))
2992
- continue;
2993
- obj[e] = params[e];
2994
- }
2995
- return obj;
2996
- };
2997
- var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
2998
- const excl = opts.exclude || [];
2999
- const forcedExclude = opts.preventForce ? [] : ["node", "window"];
3000
- if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
3001
- return params;
3002
- }
3003
- if (visited.has(obj))
3004
- return visited.get(obj);
3005
- visited.set(obj, obj);
3006
- for (const e in params) {
3007
- if (!Object.hasOwnProperty.call(params, e))
3008
- continue;
3009
- if (excl.includes(e) || forcedExclude && e.startsWith("__"))
3010
- continue;
3011
- const objProp = obj[e];
3012
- const paramsProp = params[e];
3013
- if ((0, import_node.isDOMNode)(paramsProp)) {
3014
- obj[e] = paramsProp;
3015
- } else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
3016
- obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
3017
- } else if (paramsProp !== void 0) {
3018
- obj[e] = paramsProp;
3019
- }
3020
- }
3021
- return obj;
3022
- };
3023
- var mergeIfExisted = (a, b) => {
3024
- if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
3025
- return deepMerge2(a, b);
3026
- return a || b;
3027
- };
3028
- var flattenRecursive = (param, prop, stack = []) => {
3029
- const objectized = (0, import_array.mergeAndCloneIfArray)(param);
3030
- stack.push(objectized);
3031
- const extendOfExtend = objectized[prop];
3032
- if (extendOfExtend)
3033
- flattenRecursive(extendOfExtend, prop, stack);
3034
- delete objectized[prop];
3035
- return stack;
3036
- };
3037
- var isEqualDeep = (param, element, visited = /* @__PURE__ */ new Set()) => {
3038
- if (typeof param !== "object" || typeof element !== "object" || param === null || element === null) {
3039
- return param === element;
3040
- }
3041
- if (visited.has(param) || visited.has(element)) {
3042
- return true;
3043
- }
3044
- visited.add(param);
3045
- visited.add(element);
3046
- const keysParam = Object.keys(param);
3047
- const keysElement = Object.keys(element);
3048
- if (keysParam.length !== keysElement.length) {
3049
- return false;
3050
- }
3051
- for (const key of keysParam) {
3052
- if (!keysElement.includes(key)) {
3053
- return false;
3054
- }
3055
- const paramProp = param[key];
3056
- const elementProp = element[key];
3057
- if (!isEqualDeep(paramProp, elementProp, visited)) {
3058
- return false;
3059
- }
3060
- }
3061
- return true;
3062
- };
3063
- var deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
3064
- if (obj1 === obj2)
3065
- return true;
3066
- if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2))
3067
- return false;
3068
- if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2))
3069
- return obj1 === obj2;
3070
- const stack = [[obj1, obj2]];
3071
- const visited = /* @__PURE__ */ new WeakSet();
3072
- while (stack.length > 0) {
3073
- const [current1, current2] = stack.pop();
3074
- if (visited.has(current1))
3075
- continue;
3076
- visited.add(current1);
3077
- const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
3078
- const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
3079
- if (keys1.length !== keys2.length)
3080
- return false;
3081
- for (const key of keys1) {
3082
- if (!Object.prototype.hasOwnProperty.call(current2, key))
3083
- return false;
3084
- const value1 = current1[key];
3085
- const value2 = current2[key];
3086
- if ((0, import_node.isDOMNode)(value1) || (0, import_node.isDOMNode)(value2)) {
3087
- if (value1 !== value2)
3088
- return false;
3089
- } else if ((0, import_types.isObjectLike)(value1) && (0, import_types.isObjectLike)(value2)) {
3090
- if (value1 !== value2) {
3091
- stack.push([value1, value2]);
3092
- }
3093
- } else if (value1 !== value2) {
3094
- return false;
3095
- }
3096
- }
3097
- }
3098
- return true;
3099
- };
3100
- var removeFromObject = (obj, props) => {
3101
- if (props === void 0 || props === null)
3102
- return obj;
3103
- if ((0, import_types.is)(props)("string", "number")) {
3104
- delete obj[props];
3105
- } else if ((0, import_types.isArray)(props)) {
3106
- props.forEach((prop) => delete obj[prop]);
3107
- } else {
3108
- throw new Error("Invalid input: props must be a string or an array of strings");
3109
- }
3110
- return obj;
3111
- };
3112
- var createObjectWithoutPrototype = (obj) => {
3113
- if (obj === null || typeof obj !== "object") {
3114
- return obj;
3115
- }
3116
- const newObj = /* @__PURE__ */ Object.create(null);
3117
- for (const key in obj) {
3118
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
3119
- newObj[key] = createObjectWithoutPrototype(obj[key]);
3120
- }
3121
- }
3122
- return newObj;
3123
- };
3124
- var createNestedObject = (arr, lastValue) => {
3125
- const nestedObject = {};
3126
- if (arr.length === 0) {
3127
- return lastValue;
3128
- }
3129
- arr.reduce((obj, value, index) => {
3130
- if (!obj[value]) {
3131
- obj[value] = {};
3132
- }
3133
- if (index === arr.length - 1 && lastValue) {
3134
- obj[value] = lastValue;
3135
- }
3136
- return obj[value];
3137
- }, nestedObject);
3138
- return nestedObject;
3139
- };
3140
- var removeNestedKeyByPath = (obj, path) => {
3141
- if (!Array.isArray(path)) {
3142
- throw new Error("Path must be an array.");
3143
- }
3144
- let current = obj;
3145
- for (let i = 0; i < path.length - 1; i++) {
3146
- if (current[path[i]] === void 0) {
3147
- return;
3148
- }
3149
- current = current[path[i]];
3150
- }
3151
- const lastKey = path[path.length - 1];
3152
- if (current && Object.hasOwnProperty.call(current, lastKey)) {
3153
- delete current[lastKey];
3154
- }
3155
- };
3156
- var detectInfiniteLoop = (arr) => {
3157
- const maxRepeats = 10;
3158
- let pattern = [];
3159
- let repeatCount = 0;
3160
- for (let i = 0; i < arr.length; i++) {
3161
- if (pattern.length < 2) {
3162
- pattern.push(arr[i]);
3163
- } else {
3164
- if (arr[i] === pattern[i % 2]) {
3165
- repeatCount++;
3166
- } else {
3167
- pattern = [arr[i - 1], arr[i]];
3168
- repeatCount = 1;
3169
- }
3170
- if (repeatCount >= maxRepeats * 2) {
3171
- if (ENV === "test" || ENV === "development") {
3172
- console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
3173
- }
3174
- return true;
3175
- }
3176
- }
3177
- }
3178
- };
3179
- var isCyclic = (obj) => {
3180
- const seenObjects = [];
3181
- function detect(obj2) {
3182
- if (obj2 && typeof obj2 === "object") {
3183
- if (seenObjects.indexOf(obj2) !== -1) {
3184
- return true;
3185
- }
3186
- seenObjects.push(obj2);
3187
- for (const key in obj2) {
3188
- if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
3189
- console.log(obj2, "cycle at " + key);
3190
- return true;
3191
- }
3192
- }
3193
- }
3194
- return false;
3195
- }
3196
- return detect(obj);
3197
- };
3198
- var excludeKeysFromObject = (obj, excludedKeys) => {
3199
- const result = { ...obj };
3200
- excludedKeys.forEach((key) => delete result[key]);
3201
- return result;
3202
- };
3203
- }
3204
- });
3205
- var require_function2 = __commonJS2({
3206
- "../../node_modules/@domql/utils/dist/cjs/function.js"(exports2, module22) {
3207
- "use strict";
3208
- var __defProp22 = Object.defineProperty;
3209
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
3210
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
3211
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
3212
- var __export22 = (target, all) => {
3213
- for (var name in all)
3214
- __defProp22(target, name, { get: all[name], enumerable: true });
3215
- };
3216
- var __copyProps22 = (to, from, except, desc) => {
3217
- if (from && typeof from === "object" || typeof from === "function") {
3218
- for (let key of __getOwnPropNames22(from))
3219
- if (!__hasOwnProp22.call(to, key) && key !== except)
3220
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
3221
- }
3222
- return to;
3223
- };
3224
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
3225
- var function_exports = {};
3226
- __export22(function_exports, {
3227
- cloneFunction: () => cloneFunction,
3228
- debounce: () => debounce,
3229
- debounceOnContext: () => debounceOnContext,
3230
- isStringFunction: () => isStringFunction,
3231
- memoize: () => memoize
3232
- });
3233
- module22.exports = __toCommonJS22(function_exports);
3234
- function debounce(func, wait, immediate) {
3235
- let timeout;
3236
- return function() {
3237
- const context = this;
3238
- const args = arguments;
3239
- const later = function() {
3240
- timeout = null;
3241
- if (!immediate)
3242
- func.apply(context, args);
3243
- };
3244
- const callNow = immediate && !timeout;
3245
- clearTimeout(timeout);
3246
- timeout = setTimeout(later, wait);
3247
- if (callNow)
3248
- func.apply(context, args);
3249
- };
3250
- }
3251
- var debounceOnContext = (element, func, timeout = 300) => {
3252
- let timer;
3253
- return (...args) => {
3254
- clearTimeout(timer);
3255
- timer = setTimeout(() => {
3256
- func.apply(element, args);
3257
- }, timeout);
3258
- };
3259
- };
3260
- var memoize = (fn) => {
3261
- const cache = {};
3262
- return (...args) => {
3263
- const n = args[0];
3264
- if (n in cache) {
3265
- return cache[n];
3266
- } else {
3267
- const result = fn(n);
3268
- cache[n] = result;
3269
- return result;
3270
- }
3271
- };
3272
- };
3273
- var isStringFunction = (inputString) => {
3274
- const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
3275
- return functionRegex.test(inputString);
3276
- };
3277
- function cloneFunction(fn, win = window) {
3278
- const temp = function() {
3279
- return fn.apply(win, arguments);
3280
- };
3281
- for (const key in fn) {
3282
- if (Object.hasOwnProperty.call(fn, key)) {
3283
- temp[key] = fn[key];
3284
- }
3285
- }
3286
- return temp;
3287
- }
3288
- }
3289
- });
3290
- var require_log2 = __commonJS2({
3291
- "../../node_modules/@domql/utils/dist/cjs/log.js"(exports2, module22) {
3292
- "use strict";
3293
- var __defProp22 = Object.defineProperty;
3294
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
3295
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
3296
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
3297
- var __export22 = (target, all) => {
3298
- for (var name in all)
3299
- __defProp22(target, name, { get: all[name], enumerable: true });
3300
- };
3301
- var __copyProps22 = (to, from, except, desc) => {
3302
- if (from && typeof from === "object" || typeof from === "function") {
3303
- for (let key of __getOwnPropNames22(from))
3304
- if (!__hasOwnProp22.call(to, key) && key !== except)
3305
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
3306
- }
3307
- return to;
3308
- };
3309
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
3310
- var log_exports = {};
3311
- __export22(log_exports, {
3312
- logGroupIf: () => logGroupIf,
3313
- logIf: () => logIf
3314
- });
3315
- module22.exports = __toCommonJS22(log_exports);
3316
- var logIf = (bool, ...arg) => {
3317
- if (bool)
3318
- arg.map((v) => console.log(v));
3319
- };
3320
- var logGroupIf = (bool, key, ...arg) => {
3321
- if (bool) {
3322
- console.group(key);
3323
- arg.map((v) => console.log(v));
3324
- console.groupEnd(key);
3325
- }
3326
- };
3327
- }
3328
- });
3329
- var require_cookie2 = __commonJS2({
3330
- "../../node_modules/@domql/utils/dist/cjs/cookie.js"(exports2, module22) {
3331
- "use strict";
3332
- var __defProp22 = Object.defineProperty;
3333
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
3334
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
3335
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
3336
- var __export22 = (target, all) => {
3337
- for (var name in all)
3338
- __defProp22(target, name, { get: all[name], enumerable: true });
3339
- };
3340
- var __copyProps22 = (to, from, except, desc) => {
3341
- if (from && typeof from === "object" || typeof from === "function") {
3342
- for (let key of __getOwnPropNames22(from))
3343
- if (!__hasOwnProp22.call(to, key) && key !== except)
3344
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
3345
- }
3346
- return to;
3347
- };
3348
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
3349
- var cookie_exports = {};
3350
- __export22(cookie_exports, {
3351
- getCookie: () => getCookie,
3352
- getLocalStorage: () => getLocalStorage,
3353
- isMobile: () => isMobile,
3354
- removeCookie: () => removeCookie,
3355
- setCookie: () => setCookie,
3356
- setLocalStorage: () => setLocalStorage
3357
- });
3358
- module22.exports = __toCommonJS22(cookie_exports);
3359
- var import_types = require_types2();
3360
- var import_utils32 = require_cjs4();
3361
- var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
3362
- var setCookie = (cname, cvalue, exdays = 365) => {
3363
- if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
3364
- return;
3365
- const d = /* @__PURE__ */ new Date();
3366
- d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
3367
- const expires = `expires=${d.toUTCString()}`;
3368
- import_utils32.document.cookie = `${cname}=${cvalue};${expires};path=/`;
3369
- };
3370
- var getCookie = (cname) => {
3371
- if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
3372
- return;
3373
- const name = `${cname}=`;
3374
- const decodedCookie = decodeURIComponent(import_utils32.document.cookie);
3375
- const ca = decodedCookie.split(";");
3376
- for (let i = 0; i < ca.length; i++) {
3377
- let c = ca[i];
3378
- while (c.charAt(0) === " ")
3379
- c = c.substring(1);
3380
- if (c.indexOf(name) === 0)
3381
- return c.substring(name.length, c.length);
3382
- }
3383
- return "";
3384
- };
3385
- var removeCookie = (cname) => {
3386
- if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
3387
- return;
3388
- import_utils32.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
3389
- };
3390
- function getLocalStorage(key) {
3391
- let savedJSON;
3392
- if (window.localStorage) {
3393
- try {
3394
- savedJSON = JSON.parse(window.localStorage.getItem(key));
3395
- } catch (e) {
3396
- }
3397
- }
3398
- if (typeof savedJSON !== "undefined") {
3399
- return savedJSON;
3400
- }
3401
- }
3402
- function setLocalStorage(key, data) {
3403
- if (data && window.localStorage) {
3404
- if (typeof data === "object") {
3405
- window.localStorage.setItem(key, JSON.stringify(data));
3406
- } else {
3407
- window.localStorage.setItem(key, data);
3408
- }
3409
- }
3410
- }
3411
- }
3412
- });
3413
- var require_tags2 = __commonJS2({
3414
- "../../node_modules/@domql/utils/dist/cjs/tags.js"(exports2, module22) {
3415
- "use strict";
3416
- var __defProp22 = Object.defineProperty;
3417
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
3418
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
3419
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
3420
- var __export22 = (target, all) => {
3421
- for (var name in all)
3422
- __defProp22(target, name, { get: all[name], enumerable: true });
3423
- };
3424
- var __copyProps22 = (to, from, except, desc) => {
3425
- if (from && typeof from === "object" || typeof from === "function") {
3426
- for (let key of __getOwnPropNames22(from))
3427
- if (!__hasOwnProp22.call(to, key) && key !== except)
3428
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
3429
- }
3430
- return to;
3431
- };
3432
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
3433
- var tags_exports = {};
3434
- __export22(tags_exports, {
3435
- HTML_TAGS: () => HTML_TAGS,
3436
- isValidHtmlTag: () => isValidHtmlTag
3437
- });
3438
- module22.exports = __toCommonJS22(tags_exports);
3439
- var HTML_TAGS = {
3440
- root: [
3441
- "body",
3442
- "html"
3443
- ],
3444
- head: [
3445
- "title",
3446
- "base",
3447
- "meta",
3448
- "style",
3449
- "noscript",
3450
- "script"
3451
- ],
3452
- body: [
3453
- "string",
3454
- "style",
3455
- "fragment",
3456
- "a",
3457
- "abbr",
3458
- "acronym",
3459
- "address",
3460
- "applet",
3461
- "area",
3462
- "article",
3463
- "aside",
3464
- "audio",
3465
- "b",
3466
- "basefont",
3467
- "bdi",
3468
- "bdo",
3469
- "big",
3470
- "blockquote",
3471
- "br",
3472
- "button",
3473
- "canvas",
3474
- "caption",
3475
- "center",
3476
- "cite",
3477
- "code",
3478
- "search",
3479
- "col",
3480
- "colgroup",
3481
- "data",
3482
- "datalist",
3483
- "dd",
3484
- "del",
3485
- "details",
3486
- "dfn",
3487
- "dialog",
3488
- "dir",
3489
- "div",
3490
- "dl",
3491
- "dt",
3492
- "em",
3493
- "embed",
3494
- "fieldset",
3495
- "figcaption",
3496
- "figure",
3497
- "font",
3498
- "footer",
3499
- "form",
3500
- "frame",
3501
- "frameset",
3502
- "h1",
3503
- "h2",
3504
- "h3",
3505
- "h4",
3506
- "h5",
3507
- "h6",
3508
- "head",
3509
- "header",
3510
- "hr",
3511
- "i",
3512
- "iframe",
3513
- "img",
3514
- "input",
3515
- "ins",
3516
- "kbd",
3517
- "label",
3518
- "legend",
3519
- "li",
3520
- "link",
3521
- "main",
3522
- "map",
3523
- "mark",
3524
- "meter",
3525
- "nav",
3526
- "noframes",
3527
- "noscript",
3528
- "object",
3529
- "ol",
3530
- "optgroup",
3531
- "option",
3532
- "output",
3533
- "p",
3534
- "param",
3535
- "picture",
3536
- "pre",
3537
- "progress",
3538
- "hgroup",
3539
- "q",
3540
- "rp",
3541
- "rt",
3542
- "ruby",
3543
- "s",
3544
- "samp",
3545
- "script",
3546
- "section",
3547
- "select",
3548
- "small",
3549
- "source",
3550
- "span",
3551
- "strike",
3552
- "strong",
3553
- "sub",
3554
- "summary",
3555
- "sup",
3556
- "table",
3557
- "tbody",
3558
- "td",
3559
- "template",
3560
- "hgroup",
3561
- "textarea",
3562
- "tfoot",
3563
- "th",
3564
- "thead",
3565
- "time",
3566
- "tr",
3567
- "track",
3568
- "tt",
3569
- "u",
3570
- "ul",
3571
- "var",
3572
- "video",
3573
- "wbr",
3574
- // SVG
3575
- "svg",
3576
- "path"
3577
- ]
3578
- };
3579
- var isValidHtmlTag = (arg) => HTML_TAGS.body.includes(arg);
3580
- }
3581
- });
3582
- var require_component2 = __commonJS2({
3583
- "../../node_modules/@domql/utils/dist/cjs/component.js"(exports2, module22) {
3584
- "use strict";
3585
- var __defProp22 = Object.defineProperty;
3586
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
3587
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
3588
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
3589
- var __export22 = (target, all) => {
3590
- for (var name in all)
3591
- __defProp22(target, name, { get: all[name], enumerable: true });
3592
- };
3593
- var __copyProps22 = (to, from, except, desc) => {
3594
- if (from && typeof from === "object" || typeof from === "function") {
3595
- for (let key of __getOwnPropNames22(from))
3596
- if (!__hasOwnProp22.call(to, key) && key !== except)
3597
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
3598
- }
3599
- return to;
3600
- };
3601
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
3602
- var component_exports = {};
3603
- __export22(component_exports, {
3604
- addAdditionalExtend: () => addAdditionalExtend,
3605
- addChildrenIfNotInOriginal: () => addChildrenIfNotInOriginal,
3606
- applyComponentFromContext: () => applyComponentFromContext,
3607
- applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
3608
- checkIfKeyIsComponent: () => checkIfKeyIsComponent,
3609
- checkIfKeyIsProperty: () => checkIfKeyIsProperty,
3610
- checkIfSugar: () => checkIfSugar,
3611
- extendizeByKey: () => extendizeByKey,
3612
- extractComponentKeyFromKey: () => extractComponentKeyFromKey,
3613
- getCapitalCaseKeys: () => getCapitalCaseKeys,
3614
- getChildrenComponentsByKey: () => getChildrenComponentsByKey,
3615
- getExtendsInElement: () => getExtendsInElement,
3616
- hasVariantProp: () => hasVariantProp,
3617
- isVariant: () => isVariant,
3618
- setContentKey: () => setContentKey
3619
- });
3620
- module22.exports = __toCommonJS22(component_exports);
3621
- var import__ = require_cjs4();
3622
- var ENV = "development";
3623
- var checkIfKeyIsComponent = (key) => {
3624
- const isFirstKeyString = (0, import__.isString)(key);
3625
- if (!isFirstKeyString)
3626
- return;
3627
- const firstCharKey = key.slice(0, 1);
3628
- return /^[A-Z]*$/.test(firstCharKey);
3629
- };
3630
- var checkIfKeyIsProperty = (key) => {
3631
- const isFirstKeyString = (0, import__.isString)(key);
3632
- if (!isFirstKeyString)
3633
- return;
3634
- const firstCharKey = key.slice(0, 1);
3635
- return /^[a-z]*$/.test(firstCharKey);
3636
- };
3637
- var addAdditionalExtend = (newExtend, element) => {
3638
- if (!newExtend)
3639
- return element;
3640
- const { extend: elementExtend } = element;
3641
- const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
3642
- const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
3643
- const extend = (0, import__.joinArrays)(receivedArray, originalArray);
3644
- return { ...element, extend };
3645
- };
3646
- var checkIfSugar = (element, parent, key) => {
3647
- var _a;
3648
- const {
3649
- extend,
3650
- props,
3651
- childExtend,
3652
- extends: extendProps,
3653
- childExtends,
3654
- childProps,
3655
- children,
3656
- on,
3657
- $collection,
3658
- $stateCollection,
3659
- $propsCollection
3660
- } = element;
3661
- const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
3662
- if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
3663
- const logErr = (_a = parent || element) == null ? void 0 : _a.error;
3664
- if (logErr)
3665
- logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
3666
- }
3667
- return !hasComponentAttrs || childProps || extendProps || children || childExtends;
3668
- };
3669
- var extractComponentKeyFromKey = (key) => {
3670
- return key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
3671
- };
3672
- var extendizeByKey = (element, parent, key) => {
3673
- const { context } = parent;
3674
- const { tag, extend, childExtends } = element;
3675
- const isSugar = checkIfSugar(element, parent, key);
3676
- const extendFromKey = extractComponentKeyFromKey(key);
3677
- const isExtendKeyComponent = context && context.components[extendFromKey];
3678
- if (element === isExtendKeyComponent)
3679
- return element;
3680
- else if (isSugar) {
3681
- const newElem = addAdditionalExtend(element.extends, {
3682
- extend: extendFromKey,
3683
- tag,
3684
- props: { ...element }
3685
- });
3686
- if (newElem.props.data) {
3687
- newElem.data = newElem.props.data;
3688
- delete newElem.props.data;
3689
- }
3690
- if (newElem.props.state) {
3691
- newElem.state = newElem.props.state;
3692
- delete newElem.props.state;
3693
- }
3694
- if (newElem.props.attr) {
3695
- newElem.attr = newElem.props.attr;
3696
- delete newElem.props.attr;
3697
- }
3698
- if (newElem.props.if) {
3699
- newElem.if = newElem.props.if;
3700
- delete newElem.props.if;
3701
- }
3702
- if (childExtends)
3703
- newElem.childExtend = childExtends;
3704
- return newElem;
3705
- } else if (!extend || extend === true) {
3706
- return {
3707
- ...element,
3708
- tag,
3709
- extend: extendFromKey
3710
- };
3711
- } else if (extend) {
3712
- return addAdditionalExtend(extendFromKey, element);
3713
- } else if ((0, import__.isFunction)(element)) {
3714
- return {
3715
- extend: extendFromKey,
3716
- tag,
3717
- props: { ...(0, import__.exec)(element, parent) }
3718
- };
3719
- }
3720
- };
3721
- function getCapitalCaseKeys(obj) {
3722
- return Object.keys(obj).filter((key) => /^[A-Z]/.test(key));
3723
- }
3724
- var addChildrenIfNotInOriginal = (element, parent, key) => {
3725
- const childElems = getCapitalCaseKeys(element.props);
3726
- if (!childElems.length)
3727
- return element;
3728
- for (const i in childElems) {
3729
- const childKey = childElems[i];
3730
- const childElem = element[childKey];
3731
- const newChild = element.props[childKey];
3732
- const assignChild = (val) => {
3733
- element[childKey] = val;
3734
- delete element.props[childKey];
3735
- };
3736
- if (newChild == null ? void 0 : newChild.ignoreExtend)
3737
- continue;
3738
- if (newChild === null)
3739
- assignChild(null);
3740
- else if (!childElem)
3741
- assignChild((0, import__.deepClone)(newChild));
3742
- else {
3743
- const isSugarChildElem = checkIfSugar(childElem, parent, key);
3744
- if (isSugarChildElem)
3745
- continue;
3746
- assignChild({
3747
- extend: element[childKey],
3748
- props: newChild
3749
- });
3750
- }
3751
- }
3752
- };
3753
- var applyKeyComponentAsExtend = (element, parent, key) => {
3754
- return extendizeByKey(element, parent, key) || element;
3755
- };
3756
- var applyComponentFromContext = (element, parent, options) => {
3757
- const { context } = element;
3758
- if (!context || !context.components)
3759
- return;
3760
- const { components } = context;
3761
- const { extend } = element;
3762
- const execExtend = (0, import__.exec)(extend, element);
3763
- if ((0, import__.isString)(execExtend)) {
3764
- const componentExists = components[execExtend] || components["smbls." + execExtend];
3765
- if (componentExists)
3766
- element.extend = componentExists;
3767
- else {
3768
- if ((ENV === "test" || ENV === "development") && options.verbose) {
3769
- console.warn(execExtend, "is not in library", components, element);
3770
- console.warn("replacing with ", {});
3771
- }
3772
- element.extend = {};
3773
- }
3774
- }
3775
- };
3776
- var isVariant = (param) => {
3777
- if (!(0, import__.isString)(param))
3778
- return;
3779
- const firstCharKey = param.slice(0, 1);
3780
- return firstCharKey === ".";
3781
- };
3782
- var hasVariantProp = (element) => {
3783
- const { props } = element;
3784
- if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
3785
- return true;
3786
- };
3787
- var getChildrenComponentsByKey = (key, el) => {
3788
- if (key === el.key || el.__ref.__componentKey === key) {
3789
- return el;
3790
- }
3791
- if (el.extend) {
3792
- const foundString = (0, import__.isString)(el.extend) && el.extend === key;
3793
- const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
3794
- if (foundString || foundInArray)
3795
- return el;
3796
- }
3797
- if (el.parent && el.parent.childExtend) {
3798
- const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
3799
- const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
3800
- if (foundString || foundInArray)
3801
- return el;
3802
- }
3803
- };
3804
- var getExtendsInElement = (obj) => {
3805
- let result = [];
3806
- function traverse(o) {
3807
- for (const key in o) {
3808
- if (Object.hasOwnProperty.call(o, key)) {
3809
- if (checkIfKeyIsComponent(key)) {
3810
- result.push(key);
3811
- }
3812
- if (key === "extend" || key === "extends") {
3813
- if (typeof o[key] === "string") {
3814
- result.push(o[key]);
3815
- } else if (Array.isArray(o[key])) {
3816
- result = result.concat(o[key]);
3817
- }
3818
- }
3819
- if (typeof o[key] === "object" && o[key] !== null) {
3820
- traverse(o[key]);
3821
- }
3822
- }
3823
- }
3824
- }
3825
- traverse(obj);
3826
- return result;
3827
- };
3828
- var setContentKey = (el, opts = {}) => {
3829
- const { __ref: ref } = el;
3830
- const contentElementKey = opts.contentElementKey;
3831
- if (contentElementKey !== "content" && contentElementKey !== ref.contentElementKey || !ref.contentElementKey) {
3832
- ref.contentElementKey = contentElementKey || "content";
3833
- } else
3834
- ref.contentElementKey = "content";
3835
- if (contentElementKey !== "content")
3836
- opts.contentElementKey = "content";
3837
- return ref.contentElementKey;
3838
- };
3839
- }
3840
- });
3841
- var require_cjs4 = __commonJS2({
3842
- "../../node_modules/@domql/utils/dist/cjs/index.js"(exports2, module22) {
3843
- "use strict";
3844
- var __defProp22 = Object.defineProperty;
3845
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
3846
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
3847
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
3848
- var __copyProps22 = (to, from, except, desc) => {
3849
- if (from && typeof from === "object" || typeof from === "function") {
3850
- for (let key of __getOwnPropNames22(from))
3851
- if (!__hasOwnProp22.call(to, key) && key !== except)
3852
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
3853
- }
3854
- return to;
3855
- };
3856
- var __reExport = (target, mod, secondTarget) => (__copyProps22(target, mod, "default"), secondTarget && __copyProps22(secondTarget, mod, "default"));
3857
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
3858
- var utils_exports = {};
3859
- module22.exports = __toCommonJS22(utils_exports);
3860
- __reExport(utils_exports, require_key2(), module22.exports);
3861
- __reExport(utils_exports, require_env2(), module22.exports);
3862
- __reExport(utils_exports, require_types2(), module22.exports);
3863
- __reExport(utils_exports, require_object2(), module22.exports);
3864
- __reExport(utils_exports, require_function2(), module22.exports);
3865
- __reExport(utils_exports, require_array2(), module22.exports);
3866
- __reExport(utils_exports, require_node2(), module22.exports);
3867
- __reExport(utils_exports, require_log2(), module22.exports);
3868
- __reExport(utils_exports, require_string2(), module22.exports);
3869
- __reExport(utils_exports, require_globals2(), module22.exports);
3870
- __reExport(utils_exports, require_cookie2(), module22.exports);
3871
- __reExport(utils_exports, require_tags2(), module22.exports);
3872
- __reExport(utils_exports, require_component2(), module22.exports);
3873
- }
3874
- });
89
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
3875
90
  var src_exports = {};
3876
91
  __export2(src_exports, {
3877
92
  arrayzeValue: () => arrayzeValue2,
@@ -3887,7 +102,6 @@ var require_cjs3 = __commonJS({
3887
102
  loadJavascriptFile: () => loadJavascriptFile,
3888
103
  loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
3889
104
  loadJavascriptFileSync: () => loadJavascriptFileSync,
3890
- registerFrameListener: () => registerFrameListener,
3891
105
  removeChars: () => removeChars,
3892
106
  toCamelCase: () => toCamelCase,
3893
107
  toDashCase: () => toDashCase2,
@@ -3896,7 +110,17 @@ var require_cjs3 = __commonJS({
3896
110
  toggleFullscreen: () => toggleFullscreen
3897
111
  });
3898
112
  module2.exports = __toCommonJS2(src_exports);
3899
- var import_utils22 = __toESM2(require_cjs4(), 1);
113
+ var window22 = globalThis;
114
+ var document22 = window22.document;
115
+ var isObject2 = (arg) => {
116
+ if (arg === null)
117
+ return false;
118
+ return typeof arg === "object" && arg.constructor === Object;
119
+ };
120
+ var isString2 = (arg) => typeof arg === "string";
121
+ var isNumber2 = (arg) => typeof arg === "number";
122
+ var isArray2 = (arg) => Array.isArray(arg);
123
+ var isMobile2 = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
3900
124
  async function toggleFullscreen(opts) {
3901
125
  if (!document.fullscreenElement) {
3902
126
  try {
@@ -3908,15 +132,14 @@ var require_cjs3 = __commonJS({
3908
132
  await document.exitFullscreen();
3909
133
  }
3910
134
  }
3911
- var import_utils13 = __toESM2(require_cjs4(), 1);
3912
135
  var findClosestNumber = (number, arr) => {
3913
- return ((0, import_utils13.isArray)(arr) ? arr : Object.values(arr)).reduce((prev, curr) => {
136
+ return (isArray2(arr) ? arr : Object.values(arr)).reduce((prev, curr) => {
3914
137
  return Math.abs(curr - number) < Math.abs(prev - number) ? curr : prev;
3915
138
  });
3916
139
  };
3917
140
  var findClosestNumberInFactory = (val, factory) => {
3918
141
  val = parseFloat(val);
3919
- if ((0, import_utils13.isObject)(factory))
142
+ if (isObject2(factory))
3920
143
  factory = Object.values(factory);
3921
144
  return findClosestNumber(val, factory);
3922
145
  };
@@ -4025,13 +248,6 @@ var require_cjs3 = __commonJS({
4025
248
  }
4026
249
  };
4027
250
  var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
4028
- var registerFrameListener = (el) => {
4029
- const { __ref: ref } = el;
4030
- const { frameListeners } = ref.root.data;
4031
- if (frameListeners && !frameListeners.has(el)) {
4032
- frameListeners.add(el);
4033
- }
4034
- };
4035
251
  var copyStringToClipboard = async (str) => {
4036
252
  try {
4037
253
  await navigator.clipboard.writeText(str);
@@ -4071,13 +287,13 @@ var require_cjs3 = __commonJS({
4071
287
  return result.charAt(0).toUpperCase() + result.slice(1);
4072
288
  };
4073
289
  var arrayzeValue2 = (val) => {
4074
- if ((0, import_utils22.isArray)(val))
290
+ if (isArray2(val))
4075
291
  return val;
4076
- if ((0, import_utils22.isString)(val))
292
+ if (isString2(val))
4077
293
  return val.split(" ");
4078
- if ((0, import_utils22.isObject)(val))
294
+ if (isObject2(val))
4079
295
  return Object.values(val);
4080
- if ((0, import_utils22.isNumber)(val))
296
+ if (isNumber2(val))
4081
297
  return [val];
4082
298
  };
4083
299
  }
@@ -4091,8 +307,125 @@ __export(shadow_exports, {
4091
307
  });
4092
308
  module.exports = __toCommonJS(shadow_exports);
4093
309
 
4094
- // src/factory.js
4095
- var import_utils = __toESM(require_cjs(), 1);
310
+ // ../../../domql/packages/utils/dist/esm/globals.js
311
+ var window2 = globalThis;
312
+ var document2 = window2.document;
313
+
314
+ // ../../../domql/packages/utils/dist/esm/node.js
315
+ var isDOMNode = (obj) => {
316
+ return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
317
+ };
318
+
319
+ // ../../../domql/packages/utils/dist/esm/types.js
320
+ var isObject = (arg) => {
321
+ if (arg === null)
322
+ return false;
323
+ return typeof arg === "object" && arg.constructor === Object;
324
+ };
325
+ var isString = (arg) => typeof arg === "string";
326
+ var isNumber = (arg) => typeof arg === "number";
327
+ var isFunction = (arg) => typeof arg === "function";
328
+ var isNull = (arg) => arg === null;
329
+ var isArray = (arg) => Array.isArray(arg);
330
+ var isObjectLike = (arg) => {
331
+ if (arg === null)
332
+ return false;
333
+ return typeof arg === "object";
334
+ };
335
+ var isUndefined = (arg) => {
336
+ return arg === void 0;
337
+ };
338
+
339
+ // ../../../domql/packages/utils/dist/esm/array.js
340
+ var mergeArray = (arr, exclude = []) => {
341
+ return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
342
+ };
343
+
344
+ // ../../../domql/packages/utils/dist/esm/object.js
345
+ var __defProp2 = Object.defineProperty;
346
+ var __defProps = Object.defineProperties;
347
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
348
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
349
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
350
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
351
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
352
+ var __spreadValues = (a, b) => {
353
+ for (var prop in b || (b = {}))
354
+ if (__hasOwnProp2.call(b, prop))
355
+ __defNormalProp(a, prop, b[prop]);
356
+ if (__getOwnPropSymbols)
357
+ for (var prop of __getOwnPropSymbols(b)) {
358
+ if (__propIsEnum.call(b, prop))
359
+ __defNormalProp(a, prop, b[prop]);
360
+ }
361
+ return a;
362
+ };
363
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
364
+ var deepMerge = (element, extend, excludeFrom = []) => {
365
+ for (const e in extend) {
366
+ const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
367
+ if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
368
+ continue;
369
+ const elementProp = element[e];
370
+ const extendProp = extend[e];
371
+ if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
372
+ deepMerge(elementProp, extendProp, excludeFrom);
373
+ } else if (elementProp === void 0) {
374
+ element[e] = extendProp;
375
+ }
376
+ }
377
+ return element;
378
+ };
379
+ var deepClone = (obj, options = {}) => {
380
+ const {
381
+ exclude = [],
382
+ cleanUndefined = false,
383
+ cleanNull = false,
384
+ window: targetWindow,
385
+ visited = /* @__PURE__ */ new WeakMap(),
386
+ handleExtend = false
387
+ } = options;
388
+ if (!isObjectLike(obj) || isDOMNode(obj)) {
389
+ return obj;
390
+ }
391
+ if (visited.has(obj)) {
392
+ return visited.get(obj);
393
+ }
394
+ const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
395
+ visited.set(obj, clone2);
396
+ for (const key in obj) {
397
+ if (!Object.prototype.hasOwnProperty.call(obj, key))
398
+ continue;
399
+ if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
400
+ continue;
401
+ const value = obj[key];
402
+ if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
403
+ continue;
404
+ if (isDOMNode(value)) {
405
+ clone2[key] = value;
406
+ continue;
407
+ }
408
+ if (handleExtend && key === "extend" && isArray(value)) {
409
+ clone2[key] = mergeArray(value, exclude);
410
+ continue;
411
+ }
412
+ if (isFunction(value) && targetWindow) {
413
+ clone2[key] = targetWindow.eval("(" + value.toString() + ")");
414
+ continue;
415
+ }
416
+ if (isObjectLike(value)) {
417
+ clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
418
+ visited
419
+ }));
420
+ } else {
421
+ clone2[key] = value;
422
+ }
423
+ }
424
+ return clone2;
425
+ };
426
+
427
+ // ../../../domql/packages/utils/dist/esm/cookie.js
428
+ var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
4096
429
 
4097
430
  // src/defaultConfig/index.js
4098
431
  var defaultConfig_exports = {};
@@ -4306,7 +639,7 @@ var CONFIG = {
4306
639
  CSS_VARS,
4307
640
  ...void 0 || defaultConfig_exports
4308
641
  };
4309
- var cachedConfig = (0, import_utils.deepClone)(CONFIG);
642
+ var cachedConfig = deepClone(CONFIG);
4310
643
  var FACTORY = {
4311
644
  active: "0",
4312
645
  0: CONFIG
@@ -4315,17 +648,13 @@ var getActiveConfig = (def) => {
4315
648
  return FACTORY[def || FACTORY.active] || CONFIG;
4316
649
  };
4317
650
 
4318
- // src/system/color.js
4319
- var import_utils7 = __toESM(require_cjs(), 1);
4320
-
4321
651
  // src/utils/unit.js
4322
652
  var isScalingUnit = (unit) => {
4323
653
  return unit === "em" || unit === "rem" || unit === "vw" || unit === "vh" || unit === "vmax" || unit === "vmin";
4324
654
  };
4325
655
 
4326
656
  // src/utils/color.js
4327
- var import_globals = __toESM(require_cjs2(), 1);
4328
- var import_utils2 = __toESM(require_cjs(), 1);
657
+ var import_globals4 = __toESM(require_cjs(), 1);
4329
658
  var colorStringToRgbaArray = (color) => {
4330
659
  if (color === "")
4331
660
  return [0, 0, 0, 0];
@@ -4343,21 +672,21 @@ var colorStringToRgbaArray = (color) => {
4343
672
  ];
4344
673
  }
4345
674
  if (color.indexOf("rgb") === -1) {
4346
- if (import_globals.document && import_globals.window) {
4347
- const elem = import_globals.document.body.appendChild(import_globals.document.createElement("fictum"));
675
+ if (import_globals4.document && import_globals4.window) {
676
+ const elem = import_globals4.document.body.appendChild(import_globals4.document.createElement("fictum"));
4348
677
  const flag = "rgb(1, 2, 3)";
4349
678
  elem.style.color = flag;
4350
679
  if (elem.style.color !== flag) {
4351
- import_globals.document.body.removeChild(elem);
680
+ import_globals4.document.body.removeChild(elem);
4352
681
  return;
4353
682
  }
4354
683
  elem.style.color = color;
4355
684
  if (elem.style.color === flag || elem.style.color === "") {
4356
- import_globals.document.body.removeChild(elem);
685
+ import_globals4.document.body.removeChild(elem);
4357
686
  return [0, 0, 0, 0];
4358
687
  }
4359
- color = import_globals.window.getComputedStyle(elem).color;
4360
- import_globals.document.body.removeChild(elem);
688
+ color = import_globals4.window.getComputedStyle(elem).color;
689
+ import_globals4.document.body.removeChild(elem);
4361
690
  }
4362
691
  }
4363
692
  if (color.indexOf("rgb") === 0) {
@@ -4405,11 +734,11 @@ var getColorShade = (col, amt) => {
4405
734
  return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
4406
735
  };
4407
736
  var getRgbTone = (rgb, tone) => {
4408
- if ((0, import_utils2.isString)(rgb) && rgb.includes("rgb"))
737
+ if (isString(rgb) && rgb.includes("rgb"))
4409
738
  rgb = colorStringToRgbaArray(rgb).join(", ");
4410
- if ((0, import_utils2.isString)(rgb))
739
+ if (isString(rgb))
4411
740
  rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
4412
- if ((0, import_utils2.isNumber)(tone))
741
+ if (isNumber(tone))
4413
742
  tone += "";
4414
743
  const toHex = rgbArrayToHex(rgb);
4415
744
  const abs = tone.slice(0, 1);
@@ -4426,8 +755,7 @@ var getRgbTone = (rgb, tone) => {
4426
755
  };
4427
756
 
4428
757
  // src/utils/sequence.js
4429
- var import_utils3 = __toESM(require_cjs(), 1);
4430
- var import_utils4 = __toESM(require_cjs3(), 1);
758
+ var import_utils4 = __toESM(require_cjs2(), 1);
4431
759
  var numToLetterMap = {
4432
760
  "-6": "U",
4433
761
  "-5": "V",
@@ -4566,7 +894,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
4566
894
  unit = UNIT2.default,
4567
895
  useVariable
4568
896
  } = sequenceProps;
4569
- if ((0, import_utils3.isString)(value) && value.slice(0, 2) === "--")
897
+ if (isString(value) && value.slice(0, 2) === "--")
4570
898
  return `var(${value})`;
4571
899
  const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
4572
900
  const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
@@ -4624,16 +952,10 @@ var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
4624
952
  return { [propertyName]: getSequenceValue(value, sequenceProps) };
4625
953
  };
4626
954
 
4627
- // src/utils/var.js
4628
- var import_utils5 = __toESM(require_cjs(), 1);
4629
-
4630
- // src/utils/sprite.js
4631
- var import_utils6 = __toESM(require_cjs(), 1);
4632
-
4633
955
  // src/system/color.js
4634
956
  var getColor = (value, key, config) => {
4635
957
  const CONFIG2 = config || getActiveConfig();
4636
- if (!(0, import_utils7.isString)(value)) {
958
+ if (!isString(value)) {
4637
959
  if (CONFIG2.verbose)
4638
960
  console.warn(value, "- type for color is not valid");
4639
961
  return;
@@ -4642,7 +964,7 @@ var getColor = (value, key, config) => {
4642
964
  return `var(${value})`;
4643
965
  if (key && value[key])
4644
966
  value = value[key];
4645
- const [name, alpha, tone] = (0, import_utils7.isArray)(value) ? value : value.split(" ");
967
+ const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
4646
968
  const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
4647
969
  let val = COLOR2[name] || GRADIENT2[name];
4648
970
  if (!val) {
@@ -4672,8 +994,7 @@ var getColor = (value, key, config) => {
4672
994
  };
4673
995
 
4674
996
  // src/system/spacing.js
4675
- var import_utils9 = __toESM(require_cjs3(), 1);
4676
- var import_utils10 = __toESM(require_cjs(), 1);
997
+ var import_utils9 = __toESM(require_cjs2(), 1);
4677
998
  var getSequence = (sequenceProps) => {
4678
999
  const CONFIG2 = getActiveConfig();
4679
1000
  const { SPACING: SPACING2 } = CONFIG2;
@@ -4684,11 +1005,11 @@ var getSequence = (sequenceProps) => {
4684
1005
  };
4685
1006
  var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
4686
1007
  const sequence = getSequence(sequenceProps);
4687
- if ((0, import_utils10.isString)(value) && (value.includes("calc") || value.includes("var"))) {
1008
+ if (isString(value) && (value.includes("calc") || value.includes("var"))) {
4688
1009
  return { [propertyName]: value };
4689
1010
  }
4690
1011
  const stack = (0, import_utils9.arrayzeValue)(value);
4691
- if (!(0, import_utils10.isArray)(stack))
1012
+ if (!isArray(stack))
4692
1013
  return;
4693
1014
  if (stack.length > 1) {
4694
1015
  let suffix = "";
@@ -4716,16 +1037,15 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
4716
1037
  };
4717
1038
 
4718
1039
  // src/system/shadow.js
4719
- var import_utils12 = __toESM(require_cjs(), 1);
4720
1040
  var setShadow = (value, key, suffix, prefers) => {
4721
1041
  const CONFIG2 = getActiveConfig();
4722
- if ((0, import_utils12.isArray)(value)) {
1042
+ if (isArray(value)) {
4723
1043
  return {
4724
1044
  "@light": setShadow(value[0], key, "light"),
4725
1045
  "@dark": setShadow(value[1], key, "dark")
4726
1046
  };
4727
1047
  }
4728
- if ((0, import_utils12.isObject)(value)) {
1048
+ if (isObject(value)) {
4729
1049
  const obj = {};
4730
1050
  for (const variant in value) {
4731
1051
  obj[variant] = setShadow(
@@ -4736,7 +1056,7 @@ var setShadow = (value, key, suffix, prefers) => {
4736
1056
  }
4737
1057
  return obj;
4738
1058
  }
4739
- if ((0, import_utils12.isString)(value) && value.includes(",")) {
1059
+ if (isString(value) && value.includes(",")) {
4740
1060
  value = value.split(",").map((v) => {
4741
1061
  v = v.trim();
4742
1062
  if (v.startsWith("--"))
@@ -4764,17 +1084,17 @@ var getShadow = (value, globalTheme) => {
4764
1084
  const CONFIG2 = getActiveConfig();
4765
1085
  if (!globalTheme)
4766
1086
  globalTheme = CONFIG2.globalTheme;
4767
- if (!(0, import_utils12.isString)(value)) {
1087
+ if (!isString(value)) {
4768
1088
  if (CONFIG2.verbose)
4769
1089
  console.warn(value, "- type for color is not valid");
4770
1090
  return;
4771
1091
  }
4772
1092
  if (value.slice(0, 2) === "--")
4773
1093
  return `var(${value})`;
4774
- const [name] = (0, import_utils12.isArray)(value) ? value : value.split(" ");
1094
+ const [name] = isArray(value) ? value : value.split(" ");
4775
1095
  const { SHADOW: SHADOW2 } = CONFIG2;
4776
1096
  const val = SHADOW2[name];
4777
- const isObj = (0, import_utils12.isObject)(val);
1097
+ const isObj = isObject(val);
4778
1098
  if (!val) {
4779
1099
  if (CONFIG2.verbose)
4780
1100
  console.warn("Can't find color ", name);