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