@symbo.ls/scratch 2.11.504 → 2.11.512

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