@symbo.ls/scratch 2.11.500 → 2.11.512

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