@symbo.ls/utils 2.11.504 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1,13 +1,8 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
6
  var __export = (target, all) => {
12
7
  for (var name in all)
13
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -20,1919 +15,11 @@ var __copyProps = (to, from, except, desc) => {
20
15
  }
21
16
  return to;
22
17
  };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
31
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
19
 
33
- // ../../node_modules/@domql/utils/dist/cjs/key.js
34
- var require_key = __commonJS({
35
- "../../node_modules/@domql/utils/dist/cjs/key.js"(exports, module2) {
36
- "use strict";
37
- var __defProp2 = Object.defineProperty;
38
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
39
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
40
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
41
- var __export2 = (target, all) => {
42
- for (var name in all)
43
- __defProp2(target, name, { get: all[name], enumerable: true });
44
- };
45
- var __copyProps2 = (to, from, except, desc) => {
46
- if (from && typeof from === "object" || typeof from === "function") {
47
- for (let key of __getOwnPropNames2(from))
48
- if (!__hasOwnProp2.call(to, key) && key !== except)
49
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
50
- }
51
- return to;
52
- };
53
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54
- var key_exports = {};
55
- __export2(key_exports, {
56
- createSnapshotId: () => createSnapshotId,
57
- generateKey: () => generateKey
58
- });
59
- module2.exports = __toCommonJS2(key_exports);
60
- var generateKey = /* @__PURE__ */ function() {
61
- let index = 0;
62
- function newId() {
63
- index++;
64
- return index;
65
- }
66
- return newId;
67
- }();
68
- var createSnapshotId = generateKey;
69
- }
70
- });
71
-
72
- // ../../node_modules/@domql/utils/dist/cjs/env.js
73
- var require_env = __commonJS({
74
- "../../node_modules/@domql/utils/dist/cjs/env.js"(exports, module2) {
75
- "use strict";
76
- var __defProp2 = Object.defineProperty;
77
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
78
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
79
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
80
- var __export2 = (target, all) => {
81
- for (var name in all)
82
- __defProp2(target, name, { get: all[name], enumerable: true });
83
- };
84
- var __copyProps2 = (to, from, except, desc) => {
85
- if (from && typeof from === "object" || typeof from === "function") {
86
- for (let key of __getOwnPropNames2(from))
87
- if (!__hasOwnProp2.call(to, key) && key !== except)
88
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
89
- }
90
- return to;
91
- };
92
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
93
- var env_exports = {};
94
- __export2(env_exports, {
95
- NODE_ENV: () => NODE_ENV,
96
- getNev: () => getNev,
97
- isDevelopment: () => isDevelopment,
98
- isProduction: () => isProduction,
99
- isTest: () => isTest
100
- });
101
- module2.exports = __toCommonJS2(env_exports);
102
- var NODE_ENV = "development";
103
- var isProduction = (env = NODE_ENV) => env === "production" || env === "prod" || env !== "development" && env !== "dev" && env !== "test";
104
- var isTest = (env = NODE_ENV) => env === "test";
105
- var isDevelopment = (env = NODE_ENV) => env === "development" || env === "dev";
106
- var getNev = (key, env = NODE_ENV) => env[key];
107
- }
108
- });
109
-
110
- // ../../node_modules/@domql/utils/dist/cjs/globals.js
111
- var require_globals = __commonJS({
112
- "../../node_modules/@domql/utils/dist/cjs/globals.js"(exports, module2) {
113
- "use strict";
114
- var __defProp2 = Object.defineProperty;
115
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
116
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
117
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
118
- var __export2 = (target, all) => {
119
- for (var name in all)
120
- __defProp2(target, name, { get: all[name], enumerable: true });
121
- };
122
- var __copyProps2 = (to, from, except, desc) => {
123
- if (from && typeof from === "object" || typeof from === "function") {
124
- for (let key of __getOwnPropNames2(from))
125
- if (!__hasOwnProp2.call(to, key) && key !== except)
126
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
127
- }
128
- return to;
129
- };
130
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
131
- var globals_exports = {};
132
- __export2(globals_exports, {
133
- document: () => document2,
134
- global: () => global,
135
- self: () => self,
136
- window: () => window2
137
- });
138
- module2.exports = __toCommonJS2(globals_exports);
139
- var global = globalThis;
140
- var self = globalThis;
141
- var window2 = globalThis;
142
- var document2 = window2.document;
143
- }
144
- });
145
-
146
- // ../../node_modules/@domql/utils/dist/cjs/node.js
147
- var require_node = __commonJS({
148
- "../../node_modules/@domql/utils/dist/cjs/node.js"(exports, module2) {
149
- "use strict";
150
- var __defProp2 = Object.defineProperty;
151
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
152
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
153
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
154
- var __export2 = (target, all) => {
155
- for (var name in all)
156
- __defProp2(target, name, { get: all[name], enumerable: true });
157
- };
158
- var __copyProps2 = (to, from, except, desc) => {
159
- if (from && typeof from === "object" || typeof from === "function") {
160
- for (let key of __getOwnPropNames2(from))
161
- if (!__hasOwnProp2.call(to, key) && key !== except)
162
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
163
- }
164
- return to;
165
- };
166
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
167
- var node_exports = {};
168
- __export2(node_exports, {
169
- isDOMNode: () => isDOMNode,
170
- isHtmlElement: () => isHtmlElement,
171
- isNode: () => isNode
172
- });
173
- module2.exports = __toCommonJS2(node_exports);
174
- var import_globals = require_globals();
175
- var isNode = (obj) => {
176
- return (typeof Node === "object" ? obj instanceof import_globals.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_globals.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_globals.window !== "undefined" && (obj instanceof import_globals.window.Node || obj instanceof import_globals.window.Window || obj === import_globals.window || obj === document);
183
- };
184
- }
185
- });
186
-
187
- // ../../node_modules/@domql/utils/dist/cjs/types.js
188
- var require_types = __commonJS({
189
- "../../node_modules/@domql/utils/dist/cjs/types.js"(exports, module2) {
190
- "use strict";
191
- var __defProp2 = Object.defineProperty;
192
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
193
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
194
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
195
- var __export2 = (target, all) => {
196
- for (var name in all)
197
- __defProp2(target, name, { get: all[name], enumerable: true });
198
- };
199
- var __copyProps2 = (to, from, except, desc) => {
200
- if (from && typeof from === "object" || typeof from === "function") {
201
- for (let key of __getOwnPropNames2(from))
202
- if (!__hasOwnProp2.call(to, key) && key !== except)
203
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
204
- }
205
- return to;
206
- };
207
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
208
- var types_exports = {};
209
- __export2(types_exports, {
210
- TYPES: () => TYPES,
211
- is: () => is,
212
- isArray: () => isArray3,
213
- isBoolean: () => isBoolean,
214
- isDate: () => isDate,
215
- isDefined: () => isDefined,
216
- isFunction: () => isFunction,
217
- isNot: () => isNot,
218
- isNull: () => isNull,
219
- isNumber: () => isNumber2,
220
- isObject: () => isObject3,
221
- isObjectLike: () => isObjectLike,
222
- isString: () => isString2,
223
- isUndefined: () => isUndefined
224
- });
225
- module2.exports = __toCommonJS2(types_exports);
226
- var import_node = require_node();
227
- var isObject3 = (arg) => {
228
- if (arg === null)
229
- return false;
230
- return typeof arg === "object" && arg.constructor === Object;
231
- };
232
- var isString2 = (arg) => typeof arg === "string";
233
- var isNumber2 = (arg) => typeof arg === "number";
234
- var isFunction = (arg) => typeof arg === "function";
235
- var isBoolean = (arg) => arg === true || arg === false;
236
- var isNull = (arg) => arg === null;
237
- var isArray3 = (arg) => Array.isArray(arg);
238
- var isDate = (d) => d instanceof Date;
239
- var isObjectLike = (arg) => {
240
- if (arg === null)
241
- return false;
242
- return typeof arg === "object";
243
- };
244
- var isDefined = (arg) => {
245
- return isObject3(arg) || isObjectLike(arg) || isString2(arg) || isNumber2(arg) || isFunction(arg) || isArray3(arg) || isObjectLike(arg) || isBoolean(arg) || isDate(arg) || isNull(arg);
246
- };
247
- var isUndefined = (arg) => {
248
- return arg === void 0;
249
- };
250
- var TYPES = {
251
- boolean: isBoolean,
252
- array: isArray3,
253
- object: isObject3,
254
- string: isString2,
255
- date: isDate,
256
- number: isNumber2,
257
- null: isNull,
258
- function: isFunction,
259
- objectLike: isObjectLike,
260
- node: import_node.isNode,
261
- htmlElement: import_node.isHtmlElement,
262
- defined: isDefined
263
- };
264
- var is = (arg) => {
265
- return (...args) => {
266
- return args.map((val) => TYPES[val](arg)).filter((v) => v).length > 0;
267
- };
268
- };
269
- var isNot = (arg) => {
270
- return (...args) => {
271
- return args.map((val) => TYPES[val](arg)).filter((v) => v).length === 0;
272
- };
273
- };
274
- }
275
- });
276
-
277
- // ../../node_modules/@domql/utils/dist/cjs/array.js
278
- var require_array = __commonJS({
279
- "../../node_modules/@domql/utils/dist/cjs/array.js"(exports, module2) {
280
- "use strict";
281
- var __defProp2 = Object.defineProperty;
282
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
283
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
284
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
285
- var __export2 = (target, all) => {
286
- for (var name in all)
287
- __defProp2(target, name, { get: all[name], enumerable: true });
288
- };
289
- var __copyProps2 = (to, from, except, desc) => {
290
- if (from && typeof from === "object" || typeof from === "function") {
291
- for (let key of __getOwnPropNames2(from))
292
- if (!__hasOwnProp2.call(to, key) && key !== except)
293
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
294
- }
295
- return to;
296
- };
297
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
298
- var array_exports = {};
299
- __export2(array_exports, {
300
- addItemAfterEveryElement: () => addItemAfterEveryElement,
301
- arrayContainsOtherArray: () => arrayContainsOtherArray,
302
- arraysEqual: () => arraysEqual,
303
- checkIfStringIsInArray: () => checkIfStringIsInArray,
304
- cutArrayAfterValue: () => cutArrayAfterValue,
305
- cutArrayBeforeValue: () => cutArrayBeforeValue,
306
- filterArrays: () => filterArrays,
307
- filterArraysFast: () => filterArraysFast,
308
- getFrequencyInArray: () => getFrequencyInArray,
309
- joinArrays: () => joinArrays,
310
- mergeAndCloneIfArray: () => mergeAndCloneIfArray,
311
- mergeArray: () => mergeArray,
312
- removeFromArray: () => removeFromArray,
313
- removeValueFromArray: () => removeValueFromArray,
314
- removeValueFromArrayAll: () => removeValueFromArrayAll,
315
- reorderArrayByValues: () => reorderArrayByValues,
316
- swapItemsInArray: () => swapItemsInArray
317
- });
318
- module2.exports = __toCommonJS2(array_exports);
319
- var import_object = require_object();
320
- var import_types = require_types();
321
- var arrayContainsOtherArray = (arr1, arr2) => {
322
- return arr2.every((val) => arr1.includes(val));
323
- };
324
- var getFrequencyInArray = (arr, value) => {
325
- return arr.reduce((count, currentValue) => {
326
- return currentValue === value ? count + 1 : count;
327
- }, 0);
328
- };
329
- var removeFromArray = (arr, index) => {
330
- if ((0, import_types.isString)(index))
331
- index = parseInt(index);
332
- if ((0, import_types.isNumber)(index)) {
333
- if (index < 0 || index >= arr.length || isNaN(index)) {
334
- throw new Error("Invalid index");
335
- }
336
- arr.splice(index, 1);
337
- } else if ((0, import_types.isArray)(index)) {
338
- index.forEach((idx) => removeFromArray(arr, idx));
339
- } else {
340
- throw new Error("Invalid index");
341
- }
342
- return arr;
343
- };
344
- var swapItemsInArray = (arr, i, j) => {
345
- [arr[i], arr[j]] = [arr[j], arr[i]];
346
- };
347
- var joinArrays = (...arrays) => {
348
- return [].concat(...arrays);
349
- };
350
- var mergeArray = (arr, exclude = []) => {
351
- return arr.reduce((a, c) => (0, import_object.deepMerge)(a, (0, import_object.deepClone)(c, { exclude }), exclude), {});
352
- };
353
- var mergeAndCloneIfArray = (obj) => {
354
- return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepClone)(obj);
355
- };
356
- var cutArrayBeforeValue = (arr, value) => {
357
- const index = arr.indexOf(value);
358
- if (index !== -1) {
359
- return arr.slice(0, index);
360
- }
361
- return arr;
362
- };
363
- var cutArrayAfterValue = (arr, value) => {
364
- if (!(0, import_types.isArray)(arr))
365
- return;
366
- const index = arr.indexOf(value);
367
- if (index !== -1) {
368
- return arr.slice(index + 1);
369
- }
370
- return arr;
371
- };
372
- var removeValueFromArray = (arr, value) => {
373
- const index = arr.indexOf(value);
374
- if (index > -1) {
375
- const newArray = [...arr];
376
- newArray.splice(index, 1);
377
- return newArray;
378
- }
379
- return arr;
380
- };
381
- var removeValueFromArrayAll = (arr, value) => {
382
- return arr.filter((item) => item !== value);
383
- };
384
- var addItemAfterEveryElement = (array, item) => {
385
- const result = [];
386
- for (let i = 0; i < array.length; i++) {
387
- result.push(array[i]);
388
- if (i < array.length - 1) {
389
- result.push(item);
390
- }
391
- }
392
- return result;
393
- };
394
- var reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
395
- const newArray = [...array];
396
- const indexToMove = newArray.indexOf(valueToMove);
397
- const indexToInsertBefore = newArray.indexOf(insertBeforeValue);
398
- if (indexToMove !== -1 && indexToInsertBefore !== -1) {
399
- const removedItem = newArray.splice(indexToMove, 1)[0];
400
- const insertIndex = indexToInsertBefore < indexToMove ? indexToInsertBefore : indexToInsertBefore + 1;
401
- newArray.splice(insertIndex, 0, removedItem);
402
- }
403
- return newArray;
404
- };
405
- var arraysEqual = (arr1, arr2) => {
406
- if (arr1.length !== arr2.length) {
407
- return false;
408
- }
409
- for (let i = 0; i < arr1.length; i++) {
410
- if (arr1[i] !== arr2[i]) {
411
- return false;
412
- }
413
- }
414
- return true;
415
- };
416
- var filterArrays = (sourceArr, excludeArr) => {
417
- return sourceArr.filter((item) => !excludeArr.includes(item));
418
- };
419
- var filterArraysFast = (sourceArr, excludeArr) => {
420
- const excludeSet = new Set(excludeArr);
421
- return sourceArr.filter((item) => !excludeSet.has(item));
422
- };
423
- var checkIfStringIsInArray = (string, arr) => {
424
- if (!string)
425
- return;
426
- return arr.filter((v) => string.includes(v)).length;
427
- };
428
- }
429
- });
430
-
431
- // ../../node_modules/@domql/utils/dist/cjs/string.js
432
- var require_string = __commonJS({
433
- "../../node_modules/@domql/utils/dist/cjs/string.js"(exports, module2) {
434
- "use strict";
435
- var __defProp2 = Object.defineProperty;
436
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
437
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
438
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
439
- var __export2 = (target, all) => {
440
- for (var name in all)
441
- __defProp2(target, name, { get: all[name], enumerable: true });
442
- };
443
- var __copyProps2 = (to, from, except, desc) => {
444
- if (from && typeof from === "object" || typeof from === "function") {
445
- for (let key of __getOwnPropNames2(from))
446
- if (!__hasOwnProp2.call(to, key) && key !== except)
447
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
448
- }
449
- return to;
450
- };
451
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
452
- var string_exports = {};
453
- __export2(string_exports, {
454
- customDecodeURIComponent: () => customDecodeURIComponent,
455
- customEncodeURIComponent: () => customEncodeURIComponent,
456
- decodeNewlines: () => decodeNewlines,
457
- encodeNewlines: () => encodeNewlines,
458
- findKeyPosition: () => findKeyPosition,
459
- lowercaseFirstLetter: () => lowercaseFirstLetter,
460
- replaceLiteralsWithObjectFields: () => replaceLiteralsWithObjectFields,
461
- replaceOctalEscapeSequences: () => replaceOctalEscapeSequences,
462
- stringIncludesAny: () => stringIncludesAny,
463
- trimStringFromSymbols: () => trimStringFromSymbols
464
- });
465
- module2.exports = __toCommonJS2(string_exports);
466
- var stringIncludesAny = (str, characters) => {
467
- for (const char of characters) {
468
- if (str.includes(char)) {
469
- return true;
470
- }
471
- }
472
- return false;
473
- };
474
- var trimStringFromSymbols = (str, characters) => {
475
- const pattern = new RegExp(`[${characters.join("\\")}]`, "g");
476
- return str.replace(pattern, "");
477
- };
478
- var brackRegex = {
479
- 2: /\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}/g,
480
- 3: /\{\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}\}/g
481
- };
482
- function replaceLiteralsWithObjectFields(str, options = {}, forcedState) {
483
- if (!str.includes(options.bracketsLength === 3 ? "{{{" : "{{"))
484
- return str;
485
- const reg = brackRegex[options.bracketsLength || 2];
486
- const obj = forcedState || this.state || {};
487
- return str.replace(reg, (_, parentPath, variable) => {
488
- if (parentPath) {
489
- const parentLevels = parentPath.match(options.bracketsLength === 3 ? /\.\.\.\//g : /\.\.\//g).length;
490
- let parentState = obj;
491
- for (let i = 0; i < parentLevels; i++) {
492
- parentState = parentState.parent;
493
- if (!parentState) {
494
- return "";
495
- }
496
- }
497
- const value = parentState[variable.trim()];
498
- return value !== void 0 ? `${value}` : "";
499
- } else {
500
- const value = obj[variable.trim()];
501
- return value !== void 0 ? `${value}` : "";
502
- }
503
- });
504
- }
505
- var lowercaseFirstLetter = (inputString) => {
506
- return `${inputString.charAt(0).toLowerCase()}${inputString.slice(1)}`;
507
- };
508
- var findKeyPosition = (str, key) => {
509
- const lines = str.split("\n");
510
- let startLineNumber = -1;
511
- let endLineNumber = -1;
512
- let startColumn = -1;
513
- let endColumn = -1;
514
- const keyPattern = new RegExp(`\\b${key}\\b\\s*:\\s*`);
515
- let braceCount = 0;
516
- let foundKey = false;
517
- for (let i = 0; i < lines.length; i++) {
518
- if (keyPattern.test(lines[i]) && !foundKey) {
519
- foundKey = true;
520
- startLineNumber = i + 1;
521
- startColumn = lines[i].indexOf(key) + 1;
522
- if (lines[i].includes("{}")) {
523
- endLineNumber = startLineNumber;
524
- endColumn = lines[i].indexOf("{}") + 3;
525
- break;
526
- }
527
- const line = lines[i].slice(startColumn + key.length);
528
- if (line.includes("{") || line.includes("[")) {
529
- braceCount = 1;
530
- } else {
531
- endLineNumber = i + 1;
532
- endColumn = lines[i].length + 1;
533
- break;
534
- }
535
- } else if (foundKey) {
536
- braceCount += (lines[i].match(/{/g) || []).length;
537
- braceCount += (lines[i].match(/\[/g) || []).length;
538
- braceCount -= (lines[i].match(/}/g) || []).length;
539
- braceCount -= (lines[i].match(/]/g) || []).length;
540
- if (braceCount === 0) {
541
- endLineNumber = i + 1;
542
- endColumn = lines[i].lastIndexOf("}") !== -1 ? lines[i].lastIndexOf("}") + 2 : lines[i].length + 1;
543
- break;
544
- }
545
- }
546
- }
547
- return {
548
- startColumn,
549
- endColumn,
550
- startLineNumber,
551
- endLineNumber
552
- };
553
- };
554
- var replaceOctalEscapeSequences = (str) => {
555
- const octalRegex = /\\([0-7]{1,3})/g;
556
- return str.replace(octalRegex, (match, p1) => {
557
- const octalValue = parseInt(p1, 8);
558
- const char = String.fromCharCode(octalValue);
559
- return char;
560
- });
561
- };
562
- var encodeNewlines = (str) => {
563
- return str.split("\n").join("/////n").split("`").join("/////tilde").split("$").join("/////dlrsgn");
564
- };
565
- var decodeNewlines = (encodedStr) => {
566
- return encodedStr.split("/////n").join("\n").split("/////tilde").join("`").split("/////dlrsgn").join("$");
567
- };
568
- var customEncodeURIComponent = (str) => {
569
- return str.split("").map((char) => {
570
- if (/[^a-zA-Z0-9\s]/.test(char)) {
571
- return "%" + char.charCodeAt(0).toString(16).toUpperCase();
572
- }
573
- return char;
574
- }).join("");
575
- };
576
- var customDecodeURIComponent = (encodedStr) => {
577
- return encodedStr.replace(/%[0-9A-Fa-f]{2}/g, (match) => String.fromCharCode(parseInt(match.slice(1), 16)));
578
- };
579
- }
580
- });
581
-
582
- // ../../node_modules/@domql/utils/dist/cjs/object.js
583
- var require_object = __commonJS({
584
- "../../node_modules/@domql/utils/dist/cjs/object.js"(exports, module2) {
585
- "use strict";
586
- var __defProp2 = Object.defineProperty;
587
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
588
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
589
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
590
- var __export2 = (target, all) => {
591
- for (var name in all)
592
- __defProp2(target, name, { get: all[name], enumerable: true });
593
- };
594
- var __copyProps2 = (to, from, except, desc) => {
595
- if (from && typeof from === "object" || typeof from === "function") {
596
- for (let key of __getOwnPropNames2(from))
597
- if (!__hasOwnProp2.call(to, key) && key !== except)
598
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
599
- }
600
- return to;
601
- };
602
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
603
- var object_exports = {};
604
- __export2(object_exports, {
605
- clone: () => clone,
606
- createNestedObject: () => createNestedObject,
607
- createObjectWithoutPrototype: () => createObjectWithoutPrototype,
608
- deepClone: () => deepClone,
609
- deepContains: () => deepContains,
610
- deepDestringify: () => deepDestringify,
611
- deepDiff: () => deepDiff,
612
- deepMerge: () => deepMerge,
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: () => merge,
631
- mergeArrayExclude: () => mergeArrayExclude,
632
- mergeIfExisted: () => mergeIfExisted,
633
- objectToString: () => objectToString,
634
- overwrite: () => overwrite,
635
- overwriteDeep: () => overwriteDeep,
636
- overwriteShallow: () => overwriteShallow,
637
- removeFromObject: () => removeFromObject,
638
- removeNestedKeyByPath: () => removeNestedKeyByPath,
639
- stringToObject: () => stringToObject
640
- });
641
- module2.exports = __toCommonJS2(object_exports);
642
- var import_globals = 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 merge = (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 deepMerge = (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
- deepMerge(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) => deepMerge(acc, deepClone(curr, { exclude })), {});
704
- };
705
- var deepClone = (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] = deepClone(value, {
744
- ...options,
745
- visited
746
- });
747
- } else {
748
- clone2[key] = value;
749
- }
750
- }
751
- return clone2;
752
- };
753
- var deepStringify = (obj, stringified = {}) => {
754
- var _a, _b;
755
- if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
756
- (obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn("Trying to clone element or state at", obj);
757
- obj = (_b = obj.parse) == null ? void 0 : _b.call(obj);
758
- }
759
- for (const prop in obj) {
760
- const objProp = obj[prop];
761
- if ((0, import_types.isFunction)(objProp)) {
762
- stringified[prop] = objProp.toString();
763
- } else if ((0, import_types.isObject)(objProp)) {
764
- stringified[prop] = {};
765
- deepStringify(objProp, stringified[prop]);
766
- } else if ((0, import_types.isArray)(objProp)) {
767
- stringified[prop] = [];
768
- objProp.forEach((v, i) => {
769
- if ((0, import_types.isObject)(v)) {
770
- stringified[prop][i] = {};
771
- deepStringify(v, stringified[prop][i]);
772
- } else if ((0, import_types.isFunction)(v)) {
773
- stringified[prop][i] = v.toString();
774
- } else {
775
- stringified[prop][i] = v;
776
- }
777
- });
778
- } else {
779
- stringified[prop] = objProp;
780
- }
781
- }
782
- return stringified;
783
- };
784
- var MAX_DEPTH = 100;
785
- var deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "") => {
786
- if (depth > MAX_DEPTH) {
787
- console.warn(`Maximum depth exceeded at path: ${path}. Possible circular reference.`);
788
- return "[MAX_DEPTH_EXCEEDED]";
789
- }
790
- for (const prop in obj) {
791
- const currentPath = path ? `${path}.${prop}` : prop;
792
- const objProp = obj[prop];
793
- if ((0, import_types.isFunction)(objProp)) {
794
- stringified[prop] = objProp.toString();
795
- } else if ((0, import_types.isObject)(objProp)) {
796
- stringified[prop] = {};
797
- deepStringifyWithMaxDepth(objProp, stringified[prop], depth + 1, currentPath);
798
- } else if ((0, import_types.isArray)(objProp)) {
799
- stringified[prop] = [];
800
- objProp.forEach((v, i) => {
801
- const itemPath = `${currentPath}[${i}]`;
802
- if ((0, import_types.isObject)(v)) {
803
- stringified[prop][i] = {};
804
- deepStringifyWithMaxDepth(v, stringified[prop][i], depth + 1, itemPath);
805
- } else if ((0, import_types.isFunction)(v)) {
806
- stringified[prop][i] = v.toString();
807
- } else {
808
- stringified[prop][i] = v;
809
- }
810
- });
811
- } else {
812
- stringified[prop] = objProp;
813
- }
814
- }
815
- return stringified;
816
- };
817
- var objectToString = (obj = {}, indent = 0) => {
818
- if (obj === null || typeof obj !== "object") {
819
- return String(obj);
820
- }
821
- if (Object.keys(obj).length === 0) {
822
- return "{}";
823
- }
824
- const spaces = " ".repeat(indent);
825
- let str = "{\n";
826
- for (const [key, value] of Object.entries(obj)) {
827
- const keyNotAllowdChars = (0, import_string.stringIncludesAny)(key, ["&", "*", "-", ":", "%", "{", "}", ">", "<", "@", ".", "/", "!", " "]);
828
- const stringedKey = keyNotAllowdChars ? `'${key}'` : key;
829
- str += `${spaces} ${stringedKey}: `;
830
- if ((0, import_types.isArray)(value)) {
831
- str += "[\n";
832
- for (const element of value) {
833
- if ((0, import_types.isObjectLike)(element) && element !== null) {
834
- str += `${spaces} ${objectToString(element, indent + 2)},
835
- `;
836
- } else if ((0, import_types.isString)(element)) {
837
- str += `${spaces} '${element}',
838
- `;
839
- } else {
840
- str += `${spaces} ${element},
841
- `;
842
- }
843
- }
844
- str += `${spaces} ]`;
845
- } else if ((0, import_types.isObjectLike)(value)) {
846
- str += objectToString(value, indent + 1);
847
- } else if ((0, import_types.isString)(value)) {
848
- str += (0, import_string.stringIncludesAny)(value, ["\n", "'"]) ? `\`${value}\`` : `'${value}'`;
849
- } else {
850
- str += value;
851
- }
852
- str += ",\n";
853
- }
854
- str += `${spaces}}`;
855
- return str;
856
- };
857
- var detachFunctionsFromObject = (obj, detached = {}) => {
858
- for (const prop in obj) {
859
- const objProp = obj[prop];
860
- if ((0, import_types.isFunction)(objProp))
861
- continue;
862
- else if ((0, import_types.isObject)(objProp)) {
863
- detached[prop] = {};
864
- deepStringify(objProp, detached[prop]);
865
- } else if ((0, import_types.isArray)(objProp)) {
866
- detached[prop] = [];
867
- objProp.forEach((v, i) => {
868
- if ((0, import_types.isFunction)(v))
869
- return;
870
- if ((0, import_types.isObject)(v)) {
871
- detached[prop][i] = {};
872
- detachFunctionsFromObject(v, detached[prop][i]);
873
- } else {
874
- detached[prop][i] = v;
875
- }
876
- });
877
- } else {
878
- detached[prop] = objProp;
879
- }
880
- }
881
- return detached;
882
- };
883
- var deepDestringify = (obj, destringified = {}) => {
884
- for (const prop in obj) {
885
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
886
- if (!hasOwnProperty2)
887
- continue;
888
- const objProp = obj[prop];
889
- if ((0, import_types.isString)(objProp)) {
890
- if ((objProp.includes("(){") || objProp.includes("() {") || objProp.includes("=>") || objProp.startsWith("()") || objProp.startsWith("async") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
891
- try {
892
- const evalProp = import_globals.window.eval(`(${objProp})`);
893
- destringified[prop] = evalProp;
894
- } catch (e) {
895
- if (e)
896
- destringified[prop] = objProp;
897
- }
898
- } else {
899
- destringified[prop] = objProp;
900
- }
901
- } else if ((0, import_types.isArray)(objProp)) {
902
- destringified[prop] = [];
903
- objProp.forEach((arrProp) => {
904
- if ((0, import_types.isString)(arrProp)) {
905
- if (arrProp.includes("=>") || arrProp.includes("function") || arrProp.startsWith("(")) {
906
- try {
907
- const evalProp = import_globals.window.eval(`(${arrProp})`);
908
- destringified[prop].push(evalProp);
909
- } catch (e) {
910
- if (e)
911
- destringified[prop].push(arrProp);
912
- }
913
- } else {
914
- destringified[prop].push(arrProp);
915
- }
916
- } else if ((0, import_types.isObject)(arrProp)) {
917
- destringified[prop].push(deepDestringify(arrProp));
918
- } else {
919
- destringified[prop].push(arrProp);
920
- }
921
- });
922
- } else if ((0, import_types.isObject)(objProp)) {
923
- destringified[prop] = deepDestringify(objProp, destringified[prop]);
924
- } else {
925
- destringified[prop] = objProp;
926
- }
927
- }
928
- return destringified;
929
- };
930
- var stringToObject = (str, opts = { verbose: true }) => {
931
- try {
932
- return str ? import_globals.window.eval("(" + str + ")") : {};
933
- } catch (e) {
934
- if (opts.verbose)
935
- console.warn(e);
936
- }
937
- };
938
- var diffObjects = (original, objToDiff, cache) => {
939
- for (const e in objToDiff) {
940
- if (e === "ref")
941
- continue;
942
- const originalProp = original[e];
943
- const objToDiffProp = objToDiff[e];
944
- if ((0, import_types.isObject)(originalProp) && (0, import_types.isObject)(objToDiffProp)) {
945
- cache[e] = {};
946
- diff(originalProp, objToDiffProp, cache[e]);
947
- } else if (objToDiffProp !== void 0) {
948
- cache[e] = objToDiffProp;
949
- }
950
- }
951
- return cache;
952
- };
953
- var diffArrays = (original, objToDiff, cache) => {
954
- if (original.length !== objToDiff.length) {
955
- cache = objToDiff;
956
- } else {
957
- const diffArr = [];
958
- for (let i = 0; i < original.length; i++) {
959
- const diffObj = diff(original[i], objToDiff[i]);
960
- if (Object.keys(diffObj).length > 0) {
961
- diffArr.push(diffObj);
962
- }
963
- }
964
- if (diffArr.length > 0) {
965
- cache = diffArr;
966
- }
967
- }
968
- return cache;
969
- };
970
- var diff = (original, objToDiff, cache = {}) => {
971
- if ((0, import_types.isArray)(original) && (0, import_types.isArray)(objToDiff)) {
972
- cache = [];
973
- diffArrays(original, objToDiff, cache);
974
- } else {
975
- diffObjects(original, objToDiff, cache);
976
- }
977
- return cache;
978
- };
979
- var hasOwnProperty = (o, ...args) => Object.prototype.hasOwnProperty.call(o, ...args);
980
- var isEmpty = (o) => Object.keys(o).length === 0;
981
- var isEmptyObject = (o) => (0, import_types.isObject)(o) && isEmpty(o);
982
- var makeObjectWithoutPrototype = () => /* @__PURE__ */ Object.create(null);
983
- var deepDiff = (lhs, rhs) => {
984
- if (lhs === rhs)
985
- return {};
986
- if (!(0, import_types.isObjectLike)(lhs) || !(0, import_types.isObjectLike)(rhs))
987
- return rhs;
988
- const deletedValues = Object.keys(lhs).reduce((acc, key) => {
989
- if (!hasOwnProperty(rhs, key)) {
990
- acc[key] = void 0;
991
- }
992
- return acc;
993
- }, makeObjectWithoutPrototype());
994
- if ((0, import_types.isDate)(lhs) || (0, import_types.isDate)(rhs)) {
995
- if (lhs.valueOf() === rhs.valueOf())
996
- return {};
997
- return rhs;
998
- }
999
- return Object.keys(rhs).reduce((acc, key) => {
1000
- if (!hasOwnProperty(lhs, key)) {
1001
- acc[key] = rhs[key];
1002
- return acc;
1003
- }
1004
- const difference = diff(lhs[key], rhs[key]);
1005
- if (isEmptyObject(difference) && !(0, import_types.isDate)(difference) && (isEmptyObject(lhs[key]) || !isEmptyObject(rhs[key]))) {
1006
- return acc;
1007
- }
1008
- acc[key] = difference;
1009
- return acc;
1010
- }, deletedValues);
1011
- };
1012
- var overwrite = (element, params, opts = {}) => {
1013
- const { __ref: ref } = element;
1014
- const excl = opts.exclude || [];
1015
- const allowUnderscore = opts.preventUnderscore;
1016
- const preventCaching = opts.preventCaching;
1017
- for (const e in params) {
1018
- if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
1019
- continue;
1020
- const elementProp = element[e];
1021
- const paramsProp = params[e];
1022
- if (paramsProp !== void 0) {
1023
- element[e] = paramsProp;
1024
- if (ref && !preventCaching) {
1025
- ref.__cache[e] = elementProp;
1026
- }
1027
- if ((0, import_types.isObject)(opts.diff)) {
1028
- diff[e] = elementProp;
1029
- }
1030
- }
1031
- }
1032
- return element;
1033
- };
1034
- var overwriteShallow = (obj, params, excludeFrom = []) => {
1035
- for (const e in params) {
1036
- if (excludeFrom.includes(e) || e.startsWith("__"))
1037
- continue;
1038
- obj[e] = params[e];
1039
- }
1040
- return obj;
1041
- };
1042
- var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
1043
- const excl = opts.exclude || [];
1044
- const forcedExclude = opts.preventForce ? [] : ["node", "window"];
1045
- if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
1046
- return params;
1047
- }
1048
- if (visited.has(obj))
1049
- return visited.get(obj);
1050
- visited.set(obj, obj);
1051
- for (const e in params) {
1052
- if (!Object.hasOwnProperty.call(params, e))
1053
- continue;
1054
- if (excl.includes(e) || forcedExclude && e.startsWith("__"))
1055
- continue;
1056
- const objProp = obj[e];
1057
- const paramsProp = params[e];
1058
- if ((0, import_node.isDOMNode)(paramsProp)) {
1059
- obj[e] = paramsProp;
1060
- } else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
1061
- obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
1062
- } else if (paramsProp !== void 0) {
1063
- obj[e] = paramsProp;
1064
- }
1065
- }
1066
- return obj;
1067
- };
1068
- var mergeIfExisted = (a, b) => {
1069
- if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
1070
- return deepMerge(a, b);
1071
- return a || b;
1072
- };
1073
- var flattenRecursive = (param, prop, stack = []) => {
1074
- const objectized = (0, import_array.mergeAndCloneIfArray)(param);
1075
- stack.push(objectized);
1076
- const extendOfExtend = objectized[prop];
1077
- if (extendOfExtend)
1078
- flattenRecursive(extendOfExtend, prop, stack);
1079
- delete objectized[prop];
1080
- return stack;
1081
- };
1082
- var isEqualDeep = (param, element, visited = /* @__PURE__ */ new Set()) => {
1083
- if (typeof param !== "object" || typeof element !== "object" || param === null || element === null) {
1084
- return param === element;
1085
- }
1086
- if (visited.has(param) || visited.has(element)) {
1087
- return true;
1088
- }
1089
- visited.add(param);
1090
- visited.add(element);
1091
- const keysParam = Object.keys(param);
1092
- const keysElement = Object.keys(element);
1093
- if (keysParam.length !== keysElement.length) {
1094
- return false;
1095
- }
1096
- for (const key of keysParam) {
1097
- if (!keysElement.includes(key)) {
1098
- return false;
1099
- }
1100
- const paramProp = param[key];
1101
- const elementProp = element[key];
1102
- if (!isEqualDeep(paramProp, elementProp, visited)) {
1103
- return false;
1104
- }
1105
- }
1106
- return true;
1107
- };
1108
- var deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
1109
- if (obj1 === obj2)
1110
- return true;
1111
- if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2))
1112
- return false;
1113
- if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2))
1114
- return obj1 === obj2;
1115
- const stack = [[obj1, obj2]];
1116
- const visited = /* @__PURE__ */ new WeakSet();
1117
- while (stack.length > 0) {
1118
- const [current1, current2] = stack.pop();
1119
- if (visited.has(current1))
1120
- continue;
1121
- visited.add(current1);
1122
- const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
1123
- const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
1124
- if (keys1.length !== keys2.length)
1125
- return false;
1126
- for (const key of keys1) {
1127
- if (!Object.prototype.hasOwnProperty.call(current2, key))
1128
- return false;
1129
- const value1 = current1[key];
1130
- const value2 = current2[key];
1131
- if ((0, import_node.isDOMNode)(value1) || (0, import_node.isDOMNode)(value2)) {
1132
- if (value1 !== value2)
1133
- return false;
1134
- } else if ((0, import_types.isObjectLike)(value1) && (0, import_types.isObjectLike)(value2)) {
1135
- if (value1 !== value2) {
1136
- stack.push([value1, value2]);
1137
- }
1138
- } else if (value1 !== value2) {
1139
- return false;
1140
- }
1141
- }
1142
- }
1143
- return true;
1144
- };
1145
- var removeFromObject = (obj, props) => {
1146
- if (props === void 0 || props === null)
1147
- return obj;
1148
- if ((0, import_types.is)(props)("string", "number")) {
1149
- delete obj[props];
1150
- } else if ((0, import_types.isArray)(props)) {
1151
- props.forEach((prop) => delete obj[prop]);
1152
- } else {
1153
- throw new Error("Invalid input: props must be a string or an array of strings");
1154
- }
1155
- return obj;
1156
- };
1157
- var createObjectWithoutPrototype = (obj) => {
1158
- if (obj === null || typeof obj !== "object") {
1159
- return obj;
1160
- }
1161
- const newObj = /* @__PURE__ */ Object.create(null);
1162
- for (const key in obj) {
1163
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
1164
- newObj[key] = createObjectWithoutPrototype(obj[key]);
1165
- }
1166
- }
1167
- return newObj;
1168
- };
1169
- var createNestedObject = (arr, lastValue) => {
1170
- const nestedObject = {};
1171
- if (arr.length === 0) {
1172
- return lastValue;
1173
- }
1174
- arr.reduce((obj, value, index) => {
1175
- if (!obj[value]) {
1176
- obj[value] = {};
1177
- }
1178
- if (index === arr.length - 1 && lastValue) {
1179
- obj[value] = lastValue;
1180
- }
1181
- return obj[value];
1182
- }, nestedObject);
1183
- return nestedObject;
1184
- };
1185
- var removeNestedKeyByPath = (obj, path) => {
1186
- if (!Array.isArray(path)) {
1187
- throw new Error("Path must be an array.");
1188
- }
1189
- let current = obj;
1190
- for (let i = 0; i < path.length - 1; i++) {
1191
- if (current[path[i]] === void 0) {
1192
- return;
1193
- }
1194
- current = current[path[i]];
1195
- }
1196
- const lastKey = path[path.length - 1];
1197
- if (current && Object.hasOwnProperty.call(current, lastKey)) {
1198
- delete current[lastKey];
1199
- }
1200
- };
1201
- var detectInfiniteLoop = (arr) => {
1202
- const maxRepeats = 10;
1203
- let pattern = [];
1204
- let repeatCount = 0;
1205
- for (let i = 0; i < arr.length; i++) {
1206
- if (pattern.length < 2) {
1207
- pattern.push(arr[i]);
1208
- } else {
1209
- if (arr[i] === pattern[i % 2]) {
1210
- repeatCount++;
1211
- } else {
1212
- pattern = [arr[i - 1], arr[i]];
1213
- repeatCount = 1;
1214
- }
1215
- if (repeatCount >= maxRepeats * 2) {
1216
- if (ENV === "test" || ENV === "development") {
1217
- console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
1218
- }
1219
- return true;
1220
- }
1221
- }
1222
- }
1223
- };
1224
- var isCyclic = (obj) => {
1225
- const seenObjects = [];
1226
- function detect(obj2) {
1227
- if (obj2 && typeof obj2 === "object") {
1228
- if (seenObjects.indexOf(obj2) !== -1) {
1229
- return true;
1230
- }
1231
- seenObjects.push(obj2);
1232
- for (const key in obj2) {
1233
- if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
1234
- console.log(obj2, "cycle at " + key);
1235
- return true;
1236
- }
1237
- }
1238
- }
1239
- return false;
1240
- }
1241
- return detect(obj);
1242
- };
1243
- var excludeKeysFromObject = (obj, excludedKeys) => {
1244
- const result = { ...obj };
1245
- excludedKeys.forEach((key) => delete result[key]);
1246
- return result;
1247
- };
1248
- }
1249
- });
1250
-
1251
- // ../../node_modules/@domql/utils/dist/cjs/function.js
1252
- var require_function = __commonJS({
1253
- "../../node_modules/@domql/utils/dist/cjs/function.js"(exports, module2) {
1254
- "use strict";
1255
- var __defProp2 = Object.defineProperty;
1256
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1257
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1258
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1259
- var __export2 = (target, all) => {
1260
- for (var name in all)
1261
- __defProp2(target, name, { get: all[name], enumerable: true });
1262
- };
1263
- var __copyProps2 = (to, from, except, desc) => {
1264
- if (from && typeof from === "object" || typeof from === "function") {
1265
- for (let key of __getOwnPropNames2(from))
1266
- if (!__hasOwnProp2.call(to, key) && key !== except)
1267
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1268
- }
1269
- return to;
1270
- };
1271
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1272
- var function_exports = {};
1273
- __export2(function_exports, {
1274
- cloneFunction: () => cloneFunction,
1275
- debounce: () => debounce,
1276
- debounceOnContext: () => debounceOnContext,
1277
- isStringFunction: () => isStringFunction,
1278
- memoize: () => memoize
1279
- });
1280
- module2.exports = __toCommonJS2(function_exports);
1281
- function debounce(func, wait, immediate) {
1282
- let timeout;
1283
- return function() {
1284
- const context = this;
1285
- const args = arguments;
1286
- const later = function() {
1287
- timeout = null;
1288
- if (!immediate)
1289
- func.apply(context, args);
1290
- };
1291
- const callNow = immediate && !timeout;
1292
- clearTimeout(timeout);
1293
- timeout = setTimeout(later, wait);
1294
- if (callNow)
1295
- func.apply(context, args);
1296
- };
1297
- }
1298
- var debounceOnContext = (element, func, timeout = 300) => {
1299
- let timer;
1300
- return (...args) => {
1301
- clearTimeout(timer);
1302
- timer = setTimeout(() => {
1303
- func.apply(element, args);
1304
- }, timeout);
1305
- };
1306
- };
1307
- var memoize = (fn) => {
1308
- const cache = {};
1309
- return (...args) => {
1310
- const n = args[0];
1311
- if (n in cache) {
1312
- return cache[n];
1313
- } else {
1314
- const result = fn(n);
1315
- cache[n] = result;
1316
- return result;
1317
- }
1318
- };
1319
- };
1320
- var isStringFunction = (inputString) => {
1321
- const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
1322
- return functionRegex.test(inputString);
1323
- };
1324
- function cloneFunction(fn, win = window) {
1325
- const temp = function() {
1326
- return fn.apply(win, arguments);
1327
- };
1328
- for (const key in fn) {
1329
- if (Object.hasOwnProperty.call(fn, key)) {
1330
- temp[key] = fn[key];
1331
- }
1332
- }
1333
- return temp;
1334
- }
1335
- }
1336
- });
1337
-
1338
- // ../../node_modules/@domql/utils/dist/cjs/log.js
1339
- var require_log = __commonJS({
1340
- "../../node_modules/@domql/utils/dist/cjs/log.js"(exports, module2) {
1341
- "use strict";
1342
- var __defProp2 = Object.defineProperty;
1343
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1344
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1345
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1346
- var __export2 = (target, all) => {
1347
- for (var name in all)
1348
- __defProp2(target, name, { get: all[name], enumerable: true });
1349
- };
1350
- var __copyProps2 = (to, from, except, desc) => {
1351
- if (from && typeof from === "object" || typeof from === "function") {
1352
- for (let key of __getOwnPropNames2(from))
1353
- if (!__hasOwnProp2.call(to, key) && key !== except)
1354
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1355
- }
1356
- return to;
1357
- };
1358
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1359
- var log_exports = {};
1360
- __export2(log_exports, {
1361
- logGroupIf: () => logGroupIf,
1362
- logIf: () => logIf
1363
- });
1364
- module2.exports = __toCommonJS2(log_exports);
1365
- var logIf = (bool, ...arg) => {
1366
- if (bool)
1367
- arg.map((v) => console.log(v));
1368
- };
1369
- var logGroupIf = (bool, key, ...arg) => {
1370
- if (bool) {
1371
- console.group(key);
1372
- arg.map((v) => console.log(v));
1373
- console.groupEnd(key);
1374
- }
1375
- };
1376
- }
1377
- });
1378
-
1379
- // ../../node_modules/@domql/utils/dist/cjs/cookie.js
1380
- var require_cookie = __commonJS({
1381
- "../../node_modules/@domql/utils/dist/cjs/cookie.js"(exports, module2) {
1382
- "use strict";
1383
- var __defProp2 = Object.defineProperty;
1384
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1385
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1386
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1387
- var __export2 = (target, all) => {
1388
- for (var name in all)
1389
- __defProp2(target, name, { get: all[name], enumerable: true });
1390
- };
1391
- var __copyProps2 = (to, from, except, desc) => {
1392
- if (from && typeof from === "object" || typeof from === "function") {
1393
- for (let key of __getOwnPropNames2(from))
1394
- if (!__hasOwnProp2.call(to, key) && key !== except)
1395
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1396
- }
1397
- return to;
1398
- };
1399
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1400
- var cookie_exports = {};
1401
- __export2(cookie_exports, {
1402
- getCookie: () => getCookie,
1403
- getLocalStorage: () => getLocalStorage,
1404
- isMobile: () => isMobile,
1405
- removeCookie: () => removeCookie,
1406
- setCookie: () => setCookie,
1407
- setLocalStorage: () => setLocalStorage
1408
- });
1409
- module2.exports = __toCommonJS2(cookie_exports);
1410
- var import_types = require_types();
1411
- var import_utils3 = require_cjs();
1412
- var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
1413
- var setCookie = (cname, cvalue, exdays = 365) => {
1414
- if ((0, import_types.isUndefined)(import_utils3.document) || (0, import_types.isUndefined)(import_utils3.document.cookie))
1415
- return;
1416
- const d = /* @__PURE__ */ new Date();
1417
- d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
1418
- const expires = `expires=${d.toUTCString()}`;
1419
- import_utils3.document.cookie = `${cname}=${cvalue};${expires};path=/`;
1420
- };
1421
- var getCookie = (cname) => {
1422
- if ((0, import_types.isUndefined)(import_utils3.document) || (0, import_types.isUndefined)(import_utils3.document.cookie))
1423
- return;
1424
- const name = `${cname}=`;
1425
- const decodedCookie = decodeURIComponent(import_utils3.document.cookie);
1426
- const ca = decodedCookie.split(";");
1427
- for (let i = 0; i < ca.length; i++) {
1428
- let c = ca[i];
1429
- while (c.charAt(0) === " ")
1430
- c = c.substring(1);
1431
- if (c.indexOf(name) === 0)
1432
- return c.substring(name.length, c.length);
1433
- }
1434
- return "";
1435
- };
1436
- var removeCookie = (cname) => {
1437
- if ((0, import_types.isUndefined)(import_utils3.document) || (0, import_types.isUndefined)(import_utils3.document.cookie))
1438
- return;
1439
- import_utils3.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
1440
- };
1441
- function getLocalStorage(key) {
1442
- let savedJSON;
1443
- if (window.localStorage) {
1444
- try {
1445
- savedJSON = JSON.parse(window.localStorage.getItem(key));
1446
- } catch (e) {
1447
- }
1448
- }
1449
- if (typeof savedJSON !== "undefined") {
1450
- return savedJSON;
1451
- }
1452
- }
1453
- function setLocalStorage(key, data) {
1454
- if (data && window.localStorage) {
1455
- if (typeof data === "object") {
1456
- window.localStorage.setItem(key, JSON.stringify(data));
1457
- } else {
1458
- window.localStorage.setItem(key, data);
1459
- }
1460
- }
1461
- }
1462
- }
1463
- });
1464
-
1465
- // ../../node_modules/@domql/utils/dist/cjs/tags.js
1466
- var require_tags = __commonJS({
1467
- "../../node_modules/@domql/utils/dist/cjs/tags.js"(exports, module2) {
1468
- "use strict";
1469
- var __defProp2 = Object.defineProperty;
1470
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1471
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1472
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1473
- var __export2 = (target, all) => {
1474
- for (var name in all)
1475
- __defProp2(target, name, { get: all[name], enumerable: true });
1476
- };
1477
- var __copyProps2 = (to, from, except, desc) => {
1478
- if (from && typeof from === "object" || typeof from === "function") {
1479
- for (let key of __getOwnPropNames2(from))
1480
- if (!__hasOwnProp2.call(to, key) && key !== except)
1481
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1482
- }
1483
- return to;
1484
- };
1485
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1486
- var tags_exports = {};
1487
- __export2(tags_exports, {
1488
- HTML_TAGS: () => HTML_TAGS,
1489
- isValidHtmlTag: () => isValidHtmlTag
1490
- });
1491
- module2.exports = __toCommonJS2(tags_exports);
1492
- var HTML_TAGS = {
1493
- root: [
1494
- "body",
1495
- "html"
1496
- ],
1497
- head: [
1498
- "title",
1499
- "base",
1500
- "meta",
1501
- "style",
1502
- "noscript",
1503
- "script"
1504
- ],
1505
- body: [
1506
- "string",
1507
- "style",
1508
- "fragment",
1509
- "a",
1510
- "abbr",
1511
- "acronym",
1512
- "address",
1513
- "applet",
1514
- "area",
1515
- "article",
1516
- "aside",
1517
- "audio",
1518
- "b",
1519
- "basefont",
1520
- "bdi",
1521
- "bdo",
1522
- "big",
1523
- "blockquote",
1524
- "br",
1525
- "button",
1526
- "canvas",
1527
- "caption",
1528
- "center",
1529
- "cite",
1530
- "code",
1531
- "search",
1532
- "col",
1533
- "colgroup",
1534
- "data",
1535
- "datalist",
1536
- "dd",
1537
- "del",
1538
- "details",
1539
- "dfn",
1540
- "dialog",
1541
- "dir",
1542
- "div",
1543
- "dl",
1544
- "dt",
1545
- "em",
1546
- "embed",
1547
- "fieldset",
1548
- "figcaption",
1549
- "figure",
1550
- "font",
1551
- "footer",
1552
- "form",
1553
- "frame",
1554
- "frameset",
1555
- "h1",
1556
- "h2",
1557
- "h3",
1558
- "h4",
1559
- "h5",
1560
- "h6",
1561
- "head",
1562
- "header",
1563
- "hr",
1564
- "i",
1565
- "iframe",
1566
- "img",
1567
- "input",
1568
- "ins",
1569
- "kbd",
1570
- "label",
1571
- "legend",
1572
- "li",
1573
- "link",
1574
- "main",
1575
- "map",
1576
- "mark",
1577
- "meter",
1578
- "nav",
1579
- "noframes",
1580
- "noscript",
1581
- "object",
1582
- "ol",
1583
- "optgroup",
1584
- "option",
1585
- "output",
1586
- "p",
1587
- "param",
1588
- "picture",
1589
- "pre",
1590
- "progress",
1591
- "hgroup",
1592
- "q",
1593
- "rp",
1594
- "rt",
1595
- "ruby",
1596
- "s",
1597
- "samp",
1598
- "script",
1599
- "section",
1600
- "select",
1601
- "small",
1602
- "source",
1603
- "span",
1604
- "strike",
1605
- "strong",
1606
- "sub",
1607
- "summary",
1608
- "sup",
1609
- "table",
1610
- "tbody",
1611
- "td",
1612
- "template",
1613
- "hgroup",
1614
- "textarea",
1615
- "tfoot",
1616
- "th",
1617
- "thead",
1618
- "time",
1619
- "tr",
1620
- "track",
1621
- "tt",
1622
- "u",
1623
- "ul",
1624
- "var",
1625
- "video",
1626
- "wbr",
1627
- // SVG
1628
- "svg",
1629
- "path"
1630
- ]
1631
- };
1632
- var isValidHtmlTag = (arg) => HTML_TAGS.body.includes(arg);
1633
- }
1634
- });
1635
-
1636
- // ../../node_modules/@domql/utils/dist/cjs/component.js
1637
- var require_component = __commonJS({
1638
- "../../node_modules/@domql/utils/dist/cjs/component.js"(exports, module2) {
1639
- "use strict";
1640
- var __defProp2 = Object.defineProperty;
1641
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1642
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1643
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1644
- var __export2 = (target, all) => {
1645
- for (var name in all)
1646
- __defProp2(target, name, { get: all[name], enumerable: true });
1647
- };
1648
- var __copyProps2 = (to, from, except, desc) => {
1649
- if (from && typeof from === "object" || typeof from === "function") {
1650
- for (let key of __getOwnPropNames2(from))
1651
- if (!__hasOwnProp2.call(to, key) && key !== except)
1652
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1653
- }
1654
- return to;
1655
- };
1656
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1657
- var component_exports = {};
1658
- __export2(component_exports, {
1659
- addAdditionalExtend: () => addAdditionalExtend,
1660
- addChildrenIfNotInOriginal: () => addChildrenIfNotInOriginal,
1661
- applyComponentFromContext: () => applyComponentFromContext,
1662
- applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
1663
- checkIfKeyIsComponent: () => checkIfKeyIsComponent,
1664
- checkIfKeyIsProperty: () => checkIfKeyIsProperty,
1665
- checkIfSugar: () => checkIfSugar,
1666
- extendizeByKey: () => extendizeByKey,
1667
- extractComponentKeyFromKey: () => extractComponentKeyFromKey,
1668
- getCapitalCaseKeys: () => getCapitalCaseKeys,
1669
- getChildrenComponentsByKey: () => getChildrenComponentsByKey,
1670
- getExtendsInElement: () => getExtendsInElement,
1671
- hasVariantProp: () => hasVariantProp,
1672
- isVariant: () => isVariant,
1673
- setContentKey: () => setContentKey
1674
- });
1675
- module2.exports = __toCommonJS2(component_exports);
1676
- var import__ = require_cjs();
1677
- var ENV = "development";
1678
- var checkIfKeyIsComponent = (key) => {
1679
- const isFirstKeyString = (0, import__.isString)(key);
1680
- if (!isFirstKeyString)
1681
- return;
1682
- const firstCharKey = key.slice(0, 1);
1683
- return /^[A-Z]*$/.test(firstCharKey);
1684
- };
1685
- var checkIfKeyIsProperty = (key) => {
1686
- const isFirstKeyString = (0, import__.isString)(key);
1687
- if (!isFirstKeyString)
1688
- return;
1689
- const firstCharKey = key.slice(0, 1);
1690
- return /^[a-z]*$/.test(firstCharKey);
1691
- };
1692
- var addAdditionalExtend = (newExtend, element) => {
1693
- if (!newExtend)
1694
- return element;
1695
- const { extend: elementExtend } = element;
1696
- const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
1697
- const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
1698
- const extend = (0, import__.joinArrays)(receivedArray, originalArray);
1699
- return { ...element, extend };
1700
- };
1701
- var checkIfSugar = (element, parent, key) => {
1702
- var _a;
1703
- const {
1704
- extend,
1705
- props,
1706
- childExtend,
1707
- extends: extendProps,
1708
- childExtends,
1709
- childProps,
1710
- children,
1711
- on,
1712
- $collection,
1713
- $stateCollection,
1714
- $propsCollection
1715
- } = element;
1716
- const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
1717
- if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
1718
- const logErr = (_a = parent || element) == null ? void 0 : _a.error;
1719
- if (logErr)
1720
- logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
1721
- }
1722
- return !hasComponentAttrs || childProps || extendProps || children || childExtends;
1723
- };
1724
- var extractComponentKeyFromKey = (key) => {
1725
- return key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
1726
- };
1727
- var extendizeByKey = (element, parent, key) => {
1728
- const { context } = parent;
1729
- const { tag, extend, childExtends } = element;
1730
- const isSugar = checkIfSugar(element, parent, key);
1731
- const extendFromKey = extractComponentKeyFromKey(key);
1732
- const isExtendKeyComponent = context && context.components[extendFromKey];
1733
- if (element === isExtendKeyComponent)
1734
- return element;
1735
- else if (isSugar) {
1736
- const newElem = addAdditionalExtend(element.extends, {
1737
- extend: extendFromKey,
1738
- tag,
1739
- props: { ...element }
1740
- });
1741
- if (newElem.props.data) {
1742
- newElem.data = newElem.props.data;
1743
- delete newElem.props.data;
1744
- }
1745
- if (newElem.props.state) {
1746
- newElem.state = newElem.props.state;
1747
- delete newElem.props.state;
1748
- }
1749
- if (newElem.props.attr) {
1750
- newElem.attr = newElem.props.attr;
1751
- delete newElem.props.attr;
1752
- }
1753
- if (newElem.props.if) {
1754
- newElem.if = newElem.props.if;
1755
- delete newElem.props.if;
1756
- }
1757
- if (childExtends)
1758
- newElem.childExtend = childExtends;
1759
- return newElem;
1760
- } else if (!extend || extend === true) {
1761
- return {
1762
- ...element,
1763
- tag,
1764
- extend: extendFromKey
1765
- };
1766
- } else if (extend) {
1767
- return addAdditionalExtend(extendFromKey, element);
1768
- } else if ((0, import__.isFunction)(element)) {
1769
- return {
1770
- extend: extendFromKey,
1771
- tag,
1772
- props: { ...(0, import__.exec)(element, parent) }
1773
- };
1774
- }
1775
- };
1776
- function getCapitalCaseKeys(obj) {
1777
- return Object.keys(obj).filter((key) => /^[A-Z]/.test(key));
1778
- }
1779
- var addChildrenIfNotInOriginal = (element, parent, key) => {
1780
- const childElems = getCapitalCaseKeys(element.props);
1781
- if (!childElems.length)
1782
- return element;
1783
- for (const i in childElems) {
1784
- const childKey = childElems[i];
1785
- const childElem = element[childKey];
1786
- const newChild = element.props[childKey];
1787
- const assignChild = (val) => {
1788
- element[childKey] = val;
1789
- delete element.props[childKey];
1790
- };
1791
- if (newChild == null ? void 0 : newChild.ignoreExtend)
1792
- continue;
1793
- if (newChild === null)
1794
- assignChild(null);
1795
- else if (!childElem)
1796
- assignChild((0, import__.deepClone)(newChild));
1797
- else {
1798
- const isSugarChildElem = checkIfSugar(childElem, parent, key);
1799
- if (isSugarChildElem)
1800
- continue;
1801
- assignChild({
1802
- extend: element[childKey],
1803
- props: newChild
1804
- });
1805
- }
1806
- }
1807
- };
1808
- var applyKeyComponentAsExtend = (element, parent, key) => {
1809
- return extendizeByKey(element, parent, key) || element;
1810
- };
1811
- var applyComponentFromContext = (element, parent, options) => {
1812
- const { context } = element;
1813
- if (!context || !context.components)
1814
- return;
1815
- const { components } = context;
1816
- const { extend } = element;
1817
- const execExtend = (0, import__.exec)(extend, element);
1818
- if ((0, import__.isString)(execExtend)) {
1819
- const componentExists = components[execExtend] || components["smbls." + execExtend];
1820
- if (componentExists)
1821
- element.extend = componentExists;
1822
- else {
1823
- if ((ENV === "test" || ENV === "development") && options.verbose) {
1824
- console.warn(execExtend, "is not in library", components, element);
1825
- console.warn("replacing with ", {});
1826
- }
1827
- element.extend = {};
1828
- }
1829
- }
1830
- };
1831
- var isVariant = (param) => {
1832
- if (!(0, import__.isString)(param))
1833
- return;
1834
- const firstCharKey = param.slice(0, 1);
1835
- return firstCharKey === ".";
1836
- };
1837
- var hasVariantProp = (element) => {
1838
- const { props } = element;
1839
- if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
1840
- return true;
1841
- };
1842
- var getChildrenComponentsByKey = (key, el) => {
1843
- if (key === el.key || el.__ref.__componentKey === key) {
1844
- return el;
1845
- }
1846
- if (el.extend) {
1847
- const foundString = (0, import__.isString)(el.extend) && el.extend === key;
1848
- const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
1849
- if (foundString || foundInArray)
1850
- return el;
1851
- }
1852
- if (el.parent && el.parent.childExtend) {
1853
- const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
1854
- const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
1855
- if (foundString || foundInArray)
1856
- return el;
1857
- }
1858
- };
1859
- var getExtendsInElement = (obj) => {
1860
- let result = [];
1861
- function traverse(o) {
1862
- for (const key in o) {
1863
- if (Object.hasOwnProperty.call(o, key)) {
1864
- if (checkIfKeyIsComponent(key)) {
1865
- result.push(key);
1866
- }
1867
- if (key === "extend" || key === "extends") {
1868
- if (typeof o[key] === "string") {
1869
- result.push(o[key]);
1870
- } else if (Array.isArray(o[key])) {
1871
- result = result.concat(o[key]);
1872
- }
1873
- }
1874
- if (typeof o[key] === "object" && o[key] !== null) {
1875
- traverse(o[key]);
1876
- }
1877
- }
1878
- }
1879
- }
1880
- traverse(obj);
1881
- return result;
1882
- };
1883
- var setContentKey = (el, opts = {}) => {
1884
- const { __ref: ref } = el;
1885
- const contentElementKey = opts.contentElementKey;
1886
- if (contentElementKey !== "content" && contentElementKey !== ref.contentElementKey || !ref.contentElementKey) {
1887
- ref.contentElementKey = contentElementKey || "content";
1888
- } else
1889
- ref.contentElementKey = "content";
1890
- if (contentElementKey !== "content")
1891
- opts.contentElementKey = "content";
1892
- return ref.contentElementKey;
1893
- };
1894
- }
1895
- });
1896
-
1897
- // ../../node_modules/@domql/utils/dist/cjs/index.js
1898
- var require_cjs = __commonJS({
1899
- "../../node_modules/@domql/utils/dist/cjs/index.js"(exports, module2) {
1900
- "use strict";
1901
- var __defProp2 = Object.defineProperty;
1902
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1903
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1904
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1905
- var __copyProps2 = (to, from, except, desc) => {
1906
- if (from && typeof from === "object" || typeof from === "function") {
1907
- for (let key of __getOwnPropNames2(from))
1908
- if (!__hasOwnProp2.call(to, key) && key !== except)
1909
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1910
- }
1911
- return to;
1912
- };
1913
- var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
1914
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1915
- var utils_exports = {};
1916
- module2.exports = __toCommonJS2(utils_exports);
1917
- __reExport(utils_exports, require_key(), module2.exports);
1918
- __reExport(utils_exports, require_env(), module2.exports);
1919
- __reExport(utils_exports, require_types(), module2.exports);
1920
- __reExport(utils_exports, require_object(), module2.exports);
1921
- __reExport(utils_exports, require_function(), module2.exports);
1922
- __reExport(utils_exports, require_array(), module2.exports);
1923
- __reExport(utils_exports, require_node(), module2.exports);
1924
- __reExport(utils_exports, require_log(), module2.exports);
1925
- __reExport(utils_exports, require_string(), module2.exports);
1926
- __reExport(utils_exports, require_globals(), module2.exports);
1927
- __reExport(utils_exports, require_cookie(), module2.exports);
1928
- __reExport(utils_exports, require_tags(), module2.exports);
1929
- __reExport(utils_exports, require_component(), module2.exports);
1930
- }
1931
- });
1932
-
1933
20
  // src/index.js
1934
- var src_exports = {};
1935
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
1936
23
  arrayzeValue: () => arrayzeValue,
1937
24
  copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
1938
25
  copyStringToClipboard: () => copyStringToClipboard,
@@ -1946,7 +33,6 @@ __export(src_exports, {
1946
33
  loadJavascriptFile: () => loadJavascriptFile,
1947
34
  loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
1948
35
  loadJavascriptFileSync: () => loadJavascriptFileSync,
1949
- registerFrameListener: () => registerFrameListener,
1950
36
  removeChars: () => removeChars,
1951
37
  toCamelCase: () => toCamelCase,
1952
38
  toDashCase: () => toDashCase,
@@ -1954,8 +40,23 @@ __export(src_exports, {
1954
40
  toTitleCase: () => toTitleCase,
1955
41
  toggleFullscreen: () => toggleFullscreen
1956
42
  });
1957
- module.exports = __toCommonJS(src_exports);
1958
- var import_utils2 = __toESM(require_cjs(), 1);
43
+ module.exports = __toCommonJS(index_exports);
44
+
45
+ // node_modules/@domql/utils/dist/esm/globals.js
46
+ var window2 = globalThis;
47
+ var document2 = window2.document;
48
+
49
+ // node_modules/@domql/utils/dist/esm/types.js
50
+ var isObject = (arg) => {
51
+ if (arg === null) return false;
52
+ return typeof arg === "object" && arg.constructor === Object;
53
+ };
54
+ var isString = (arg) => typeof arg === "string";
55
+ var isNumber = (arg) => typeof arg === "number";
56
+ var isArray = (arg) => Array.isArray(arg);
57
+
58
+ // node_modules/@domql/utils/dist/esm/cookie.js
59
+ var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
1959
60
 
1960
61
  // src/browser.js
1961
62
  async function toggleFullscreen(opts) {
@@ -1971,23 +72,20 @@ async function toggleFullscreen(opts) {
1971
72
  }
1972
73
 
1973
74
  // src/scaling.js
1974
- var import_utils = __toESM(require_cjs(), 1);
1975
75
  var findClosestNumber = (number, arr) => {
1976
- return ((0, import_utils.isArray)(arr) ? arr : Object.values(arr)).reduce((prev, curr) => {
76
+ return (isArray(arr) ? arr : Object.values(arr)).reduce((prev, curr) => {
1977
77
  return Math.abs(curr - number) < Math.abs(prev - number) ? curr : prev;
1978
78
  });
1979
79
  };
1980
80
  var findClosestNumberInFactory = (val, factory) => {
1981
81
  val = parseFloat(val);
1982
- if ((0, import_utils.isObject)(factory))
1983
- factory = Object.values(factory);
82
+ if (isObject(factory)) factory = Object.values(factory);
1984
83
  return findClosestNumber(val, factory);
1985
84
  };
1986
85
 
1987
86
  // src/date.js
1988
87
  var formatDate = (timestamp) => {
1989
- if (!timestamp)
1990
- return "";
88
+ if (!timestamp) return "";
1991
89
  const d = new Date(timestamp);
1992
90
  const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
1993
91
  const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
@@ -2058,8 +156,7 @@ var loadJavascriptFileEmbedSync = (FILE_URL, doc = document, fallback, type = "t
2058
156
  scriptEle.type = type;
2059
157
  scriptEle.text = xhr.responseText;
2060
158
  doc.body.appendChild(scriptEle);
2061
- if (typeof fallback === "function")
2062
- fallback();
159
+ if (typeof fallback === "function") fallback();
2063
160
  } else {
2064
161
  throw new Error(`Failed to load the script ${FILE_URL}`);
2065
162
  }
@@ -2097,15 +194,6 @@ var loadJavascript = (body, async = false, doc = document, type = "text/javascri
2097
194
  // src/files.js
2098
195
  var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
2099
196
 
2100
- // src/animationFrame.js
2101
- var registerFrameListener = (el) => {
2102
- const { __ref: ref } = el;
2103
- const { frameListeners } = ref.root.data;
2104
- if (frameListeners && !frameListeners.has(el)) {
2105
- frameListeners.add(el);
2106
- }
2107
- };
2108
-
2109
197
  // src/index.js
2110
198
  var copyStringToClipboard = async (str) => {
2111
199
  try {
@@ -2140,18 +228,13 @@ var toTitleCase = (str) => str && str.replace(
2140
228
  );
2141
229
  var toDashCase = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
2142
230
  var toDescriptionCase = (str = "") => {
2143
- if (typeof str !== "string")
2144
- return;
231
+ if (typeof str !== "string") return;
2145
232
  const result = str.replace(/([A-Z])/g, " $1");
2146
233
  return result.charAt(0).toUpperCase() + result.slice(1);
2147
234
  };
2148
235
  var arrayzeValue = (val) => {
2149
- if ((0, import_utils2.isArray)(val))
2150
- return val;
2151
- if ((0, import_utils2.isString)(val))
2152
- return val.split(" ");
2153
- if ((0, import_utils2.isObject)(val))
2154
- return Object.values(val);
2155
- if ((0, import_utils2.isNumber)(val))
2156
- return [val];
236
+ if (isArray(val)) return val;
237
+ if (isString(val)) return val.split(" ");
238
+ if (isObject(val)) return Object.values(val);
239
+ if (isNumber(val)) return [val];
2157
240
  };