domql 3.2.3 → 3.2.8

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.
@@ -0,0 +1,4720 @@
1
+ "use strict";
2
+ var Domql = (() => {
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // index.js
22
+ var index_exports = {};
23
+ __export(index_exports, {
24
+ default: () => index_default
25
+ });
26
+
27
+ // ../utils/dist/esm/globals.js
28
+ var window2 = globalThis;
29
+ var document2 = window2.document;
30
+
31
+ // ../utils/dist/esm/node.js
32
+ var isNode = (obj) => {
33
+ return (typeof Node === "object" ? obj instanceof window2.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
34
+ };
35
+ var isHtmlElement = (obj) => {
36
+ return (typeof HTMLElement === "object" ? obj instanceof window2.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
37
+ };
38
+ var isDOMNode = (obj) => {
39
+ return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
40
+ };
41
+
42
+ // ../utils/dist/esm/types.js
43
+ var isObject = (arg) => {
44
+ if (arg === null) return false;
45
+ return typeof arg === "object" && arg.constructor === Object;
46
+ };
47
+ var isString = (arg) => typeof arg === "string";
48
+ var isNumber = (arg) => typeof arg === "number";
49
+ var isFunction = (arg) => typeof arg === "function";
50
+ var isBoolean = (arg) => arg === true || arg === false;
51
+ var isNull = (arg) => arg === null;
52
+ var isArray = (arg) => Array.isArray(arg);
53
+ var isDate = (d) => d instanceof Date;
54
+ var isObjectLike = (arg) => {
55
+ if (arg === null) return false;
56
+ return typeof arg === "object";
57
+ };
58
+ var isDefined = (arg) => arg !== void 0;
59
+ var isUndefined = (arg) => arg === void 0;
60
+ var TYPES = {
61
+ boolean: isBoolean,
62
+ array: isArray,
63
+ object: isObject,
64
+ string: isString,
65
+ date: isDate,
66
+ number: isNumber,
67
+ null: isNull,
68
+ function: isFunction,
69
+ objectLike: isObjectLike,
70
+ node: isNode,
71
+ htmlElement: isHtmlElement,
72
+ defined: isDefined
73
+ };
74
+ var is = (arg) => {
75
+ return (...args) => args.some((val) => TYPES[val](arg));
76
+ };
77
+ var isNot = (arg) => {
78
+ return (...args) => !args.some((val) => TYPES[val](arg));
79
+ };
80
+
81
+ // ../utils/dist/esm/array.js
82
+ var removeFromArray = (arr, index) => {
83
+ if (isString(index)) index = parseInt(index);
84
+ if (isNumber(index)) {
85
+ if (index < 0 || index >= arr.length || isNaN(index)) {
86
+ throw new Error("Invalid index");
87
+ }
88
+ arr.splice(index, 1);
89
+ } else {
90
+ throw new Error("Invalid index");
91
+ }
92
+ return arr;
93
+ };
94
+ var joinArrays = (...arrays) => {
95
+ return [].concat(...arrays);
96
+ };
97
+ var unstackArrayOfObjects = (arr, exclude = []) => {
98
+ return arr.reduce(
99
+ (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
100
+ {}
101
+ );
102
+ };
103
+ var removeValueFromArray = (arr, value) => {
104
+ const index = arr.indexOf(value);
105
+ if (index > -1) {
106
+ const newArray = [...arr];
107
+ newArray.splice(index, 1);
108
+ return newArray;
109
+ }
110
+ return arr;
111
+ };
112
+ var removeDuplicatesInArray = (arr) => {
113
+ if (!isArray(arr)) return arr;
114
+ return [...new Set(arr)];
115
+ };
116
+ var addProtoToArray = (state2, proto) => {
117
+ for (const key in proto) {
118
+ Object.defineProperty(state2, key, {
119
+ value: proto[key],
120
+ enumerable: false,
121
+ // Set this to true if you want the method to appear in for...in loops
122
+ configurable: true,
123
+ // Set this to true if you want to allow redefining/removing the property later
124
+ writable: true
125
+ // Set this to true if you want to allow changing the function later
126
+ });
127
+ }
128
+ };
129
+
130
+ // ../utils/dist/esm/string.js
131
+ var lowercaseFirstLetter = (inputString) => {
132
+ return `${inputString.charAt(0).toLowerCase()}${inputString.slice(1)}`;
133
+ };
134
+
135
+ // ../utils/dist/esm/keys.js
136
+ var DOMQ_PROPERTIES = /* @__PURE__ */ new Set([
137
+ "attr",
138
+ "style",
139
+ "text",
140
+ "html",
141
+ "content",
142
+ "data",
143
+ "classlist",
144
+ "state",
145
+ "scope",
146
+ "root",
147
+ "deps",
148
+ "extend",
149
+ "extends",
150
+ "$router",
151
+ "routes",
152
+ "children",
153
+ "childExtend",
154
+ "childExtends",
155
+ "childExtendRecursive",
156
+ "childExtendsRecursive",
157
+ "props",
158
+ "if",
159
+ "define",
160
+ "__name",
161
+ "__ref",
162
+ "__hash",
163
+ "__text",
164
+ "key",
165
+ "tag",
166
+ "query",
167
+ "parent",
168
+ "node",
169
+ "variables",
170
+ "on",
171
+ "component",
172
+ "context"
173
+ ]);
174
+ var PARSED_DOMQ_PROPERTIES = /* @__PURE__ */ new Set([
175
+ "attr",
176
+ "style",
177
+ "text",
178
+ "html",
179
+ "content",
180
+ "data",
181
+ "class",
182
+ "state",
183
+ "scope",
184
+ "children",
185
+ "props",
186
+ "if",
187
+ "key",
188
+ "tag",
189
+ "query",
190
+ "on",
191
+ "context"
192
+ ]);
193
+ var STATE_METHODS = /* @__PURE__ */ new Set([
194
+ "update",
195
+ "parse",
196
+ "clean",
197
+ "create",
198
+ "destroy",
199
+ "add",
200
+ "toggle",
201
+ "remove",
202
+ "apply",
203
+ "set",
204
+ "reset",
205
+ "replace",
206
+ "quietReplace",
207
+ "quietUpdate",
208
+ "applyReplace",
209
+ "applyFunction",
210
+ "keys",
211
+ "values",
212
+ "ref",
213
+ "rootUpdate",
214
+ "parentUpdate",
215
+ "parent",
216
+ "__element",
217
+ "__depends",
218
+ "__ref",
219
+ "__children",
220
+ "root",
221
+ "setByPath",
222
+ "setPathCollection",
223
+ "removeByPath",
224
+ "removePathCollection",
225
+ "getByPath"
226
+ ]);
227
+ var PROPS_METHODS = /* @__PURE__ */ new Set(["update", "__element"]);
228
+ var METHODS = /* @__PURE__ */ new Set([
229
+ "set",
230
+ "reset",
231
+ "update",
232
+ "remove",
233
+ "updateContent",
234
+ "removeContent",
235
+ "lookup",
236
+ "lookdown",
237
+ "lookdownAll",
238
+ "getRef",
239
+ "getPath",
240
+ "setNodeStyles",
241
+ "spotByPath",
242
+ "keys",
243
+ "parse",
244
+ "setProps",
245
+ "parseDeep",
246
+ "variables",
247
+ "if",
248
+ "log",
249
+ "verbose",
250
+ "warn",
251
+ "error",
252
+ "call",
253
+ "nextElement",
254
+ "previousElement",
255
+ "getRootState",
256
+ "getRoot",
257
+ "getRootData",
258
+ "getRootContext",
259
+ "getContext",
260
+ "getChildren"
261
+ ]);
262
+ var METHODS_EXL = /* @__PURE__ */ new Set([
263
+ "node",
264
+ "context",
265
+ "extends",
266
+ "__element",
267
+ "__ref",
268
+ ...METHODS,
269
+ ...STATE_METHODS,
270
+ ...PROPS_METHODS
271
+ ]);
272
+ var DOMQL_EVENTS = /* @__PURE__ */ new Set([
273
+ "init",
274
+ "beforeClassAssign",
275
+ "render",
276
+ "renderRouter",
277
+ "attachNode",
278
+ "stateInit",
279
+ "stateCreated",
280
+ "beforeStateUpdate",
281
+ "stateUpdate",
282
+ "beforeUpdate",
283
+ "done",
284
+ "create",
285
+ "complete",
286
+ "frame",
287
+ "update"
288
+ ]);
289
+
290
+ // ../utils/dist/esm/object.js
291
+ var ENV = process.env.NODE_ENV;
292
+ var _startsWithDunder = (e) => e.charCodeAt(0) === 95 && e.charCodeAt(1) === 95;
293
+ var exec = (param, element, state2, context) => {
294
+ if (isFunction(param)) {
295
+ if (!element) return;
296
+ const result = param.call(
297
+ element,
298
+ element,
299
+ state2 || element.state,
300
+ context || element.context
301
+ );
302
+ if (result && typeof result.then === "function") {
303
+ let resolved;
304
+ result.then((value) => {
305
+ resolved = value;
306
+ });
307
+ return resolved;
308
+ }
309
+ return result;
310
+ }
311
+ return param;
312
+ };
313
+ var merge = (element, obj, excludeFrom = []) => {
314
+ const useSet = excludeFrom instanceof Set;
315
+ for (const e in obj) {
316
+ if (!Object.prototype.hasOwnProperty.call(obj, e)) continue;
317
+ if (_startsWithDunder(e)) continue;
318
+ if (useSet ? excludeFrom.has(e) : excludeFrom.includes(e)) continue;
319
+ if (element[e] === void 0) {
320
+ element[e] = obj[e];
321
+ }
322
+ }
323
+ return element;
324
+ };
325
+ var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
326
+ const useSet = excludeFrom instanceof Set;
327
+ for (const e in extend) {
328
+ if (!Object.prototype.hasOwnProperty.call(extend, e)) continue;
329
+ if (_startsWithDunder(e)) continue;
330
+ if (useSet ? excludeFrom.has(e) : excludeFrom.includes(e)) continue;
331
+ const elementProp = element[e];
332
+ const extendProp = extend[e];
333
+ if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
334
+ deepMerge(elementProp, extendProp, excludeFrom);
335
+ } else if (elementProp === void 0) {
336
+ element[e] = extendProp;
337
+ }
338
+ }
339
+ return element;
340
+ };
341
+ var deepClone = (obj, options = {}) => {
342
+ const {
343
+ exclude = [],
344
+ cleanUndefined = false,
345
+ cleanNull = false,
346
+ window: targetWindow,
347
+ visited = /* @__PURE__ */ new WeakMap(),
348
+ handleExtends = false
349
+ } = options;
350
+ const contentWindow = targetWindow || window2 || globalThis;
351
+ if (!isObjectLike(obj) || isDOMNode(obj)) {
352
+ return obj;
353
+ }
354
+ if (visited.has(obj)) {
355
+ return visited.get(obj);
356
+ }
357
+ const isArr = isArray(obj);
358
+ const clone2 = isArr ? [] : {};
359
+ visited.set(obj, clone2);
360
+ const excludeSet = exclude instanceof Set ? exclude : exclude.length > 3 ? new Set(exclude) : null;
361
+ for (const key in obj) {
362
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
363
+ if (_startsWithDunder(key) || key === "__proto__") continue;
364
+ if (excludeSet ? excludeSet.has(key) : exclude.includes(key)) continue;
365
+ const value = obj[key];
366
+ if (cleanUndefined && value === void 0) continue;
367
+ if (cleanNull && value === null) continue;
368
+ if (isDOMNode(value)) {
369
+ clone2[key] = value;
370
+ continue;
371
+ }
372
+ if (handleExtends && key === "extends" && isArray(value)) {
373
+ clone2[key] = unstackArrayOfObjects(value, exclude);
374
+ continue;
375
+ }
376
+ if (isFunction(value) && options.window) {
377
+ clone2[key] = contentWindow.eval("(" + value.toString() + ")");
378
+ continue;
379
+ }
380
+ if (isObjectLike(value)) {
381
+ clone2[key] = deepClone(value, {
382
+ ...options,
383
+ visited
384
+ });
385
+ } else {
386
+ clone2[key] = value;
387
+ }
388
+ }
389
+ return clone2;
390
+ };
391
+ var overwrite = (element, params, opts = {}) => {
392
+ const excl = opts.exclude || [];
393
+ const allowUnderscore = opts.preventUnderscore;
394
+ for (const e in params) {
395
+ if (excl.includes(e) || !allowUnderscore && _startsWithDunder(e)) continue;
396
+ if (params[e] !== void 0) {
397
+ element[e] = params[e];
398
+ }
399
+ }
400
+ return element;
401
+ };
402
+ var overwriteShallow = (obj, params, excludeFrom = []) => {
403
+ const useSet = excludeFrom instanceof Set;
404
+ for (const e in params) {
405
+ if (_startsWithDunder(e)) continue;
406
+ if (useSet ? excludeFrom.has(e) : excludeFrom.includes(e)) continue;
407
+ obj[e] = params[e];
408
+ }
409
+ return obj;
410
+ };
411
+ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
412
+ if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
413
+ return params;
414
+ }
415
+ if (visited.has(obj)) return visited.get(obj);
416
+ visited.set(obj, obj);
417
+ const excl = opts.exclude;
418
+ const exclSet = excl ? excl instanceof Set ? excl : new Set(excl) : null;
419
+ const forcedExclude = !opts.preventForce;
420
+ for (const e in params) {
421
+ if (!Object.prototype.hasOwnProperty.call(params, e)) continue;
422
+ if (exclSet && exclSet.has(e) || forcedExclude && _startsWithDunder(e)) continue;
423
+ const objProp = obj[e];
424
+ const paramsProp = params[e];
425
+ if (isDOMNode(paramsProp)) {
426
+ obj[e] = paramsProp;
427
+ } else if (isObjectLike(objProp) && isObjectLike(paramsProp)) {
428
+ obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
429
+ } else if (paramsProp !== void 0) {
430
+ obj[e] = paramsProp;
431
+ }
432
+ }
433
+ return obj;
434
+ };
435
+ var DEEP_CONTAINS_IGNORED = /* @__PURE__ */ new Set(["node", "__ref"]);
436
+ var deepContains = (obj1, obj2, ignoredKeys = DEEP_CONTAINS_IGNORED) => {
437
+ if (obj1 === obj2) return true;
438
+ if (!isObjectLike(obj1) || !isObjectLike(obj2)) return obj1 === obj2;
439
+ if (isDOMNode(obj1) || isDOMNode(obj2)) return obj1 === obj2;
440
+ const ignored = ignoredKeys instanceof Set ? ignoredKeys : new Set(ignoredKeys);
441
+ const visited = /* @__PURE__ */ new WeakSet();
442
+ function checkContains(target, source) {
443
+ if (visited.has(source)) return true;
444
+ visited.add(source);
445
+ for (const key in source) {
446
+ if (!Object.prototype.hasOwnProperty.call(source, key)) continue;
447
+ if (ignored.has(key)) continue;
448
+ if (!Object.prototype.hasOwnProperty.call(target, key)) return false;
449
+ const sourceValue = source[key];
450
+ const targetValue = target[key];
451
+ if (isDOMNode(sourceValue) || isDOMNode(targetValue)) {
452
+ if (sourceValue !== targetValue) return false;
453
+ } else if (isObjectLike(sourceValue) && isObjectLike(targetValue)) {
454
+ if (!checkContains(targetValue, sourceValue)) return false;
455
+ } else if (sourceValue !== targetValue) {
456
+ return false;
457
+ }
458
+ }
459
+ return true;
460
+ }
461
+ return checkContains(obj1, obj2);
462
+ };
463
+ var removeFromObject = (obj, props) => {
464
+ if (props === void 0 || props === null) return obj;
465
+ if (is(props)("string", "number")) {
466
+ delete obj[props];
467
+ } else if (isArray(props)) {
468
+ for (let i = 0; i < props.length; i++) delete obj[props[i]];
469
+ } else {
470
+ throw new Error(
471
+ "Invalid input: props must be a string or an array of strings"
472
+ );
473
+ }
474
+ return obj;
475
+ };
476
+ var createNestedObject = (arr, lastValue) => {
477
+ if (arr.length === 0) return lastValue;
478
+ const nestedObject = {};
479
+ let current = nestedObject;
480
+ for (let i = 0; i < arr.length; i++) {
481
+ if (i === arr.length - 1 && lastValue) {
482
+ current[arr[i]] = lastValue;
483
+ } else {
484
+ current[arr[i]] = {};
485
+ current = current[arr[i]];
486
+ }
487
+ }
488
+ return nestedObject;
489
+ };
490
+ var removeNestedKeyByPath = (obj, path) => {
491
+ if (!Array.isArray(path)) {
492
+ throw new Error("Path must be an array.");
493
+ }
494
+ let current = obj;
495
+ for (let i = 0; i < path.length - 1; i++) {
496
+ if (current[path[i]] === void 0) return;
497
+ current = current[path[i]];
498
+ }
499
+ const lastKey = path[path.length - 1];
500
+ if (current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
501
+ delete current[lastKey];
502
+ }
503
+ };
504
+ var setInObjectByPath = (obj, path, value) => {
505
+ if (!Array.isArray(path)) {
506
+ throw new Error("Path must be an array.");
507
+ }
508
+ let current = obj;
509
+ for (let i = 0; i < path.length - 1; i++) {
510
+ if (!current[path[i]] || typeof current[path[i]] !== "object") {
511
+ current[path[i]] = {};
512
+ }
513
+ current = current[path[i]];
514
+ }
515
+ current[path[path.length - 1]] = value;
516
+ return obj;
517
+ };
518
+ var getInObjectByPath = (obj, path) => {
519
+ if (!Array.isArray(path)) {
520
+ throw new Error("Path must be an array.");
521
+ }
522
+ let current = obj;
523
+ for (let i = 0; i < path.length; i++) {
524
+ if (current === void 0 || current === null) {
525
+ return void 0;
526
+ }
527
+ current = current[path[i]];
528
+ }
529
+ return current;
530
+ };
531
+ var detectInfiniteLoop = (arr) => {
532
+ const maxRepeats = 10;
533
+ let pattern = [];
534
+ let repeatCount = 0;
535
+ for (let i = 0; i < arr.length; i++) {
536
+ if (pattern.length < 2) {
537
+ pattern.push(arr[i]);
538
+ } else {
539
+ if (arr[i] === pattern[i % 2]) {
540
+ repeatCount++;
541
+ } else {
542
+ pattern = [arr[i - 1], arr[i]];
543
+ repeatCount = 1;
544
+ }
545
+ if (repeatCount >= maxRepeats * 2) {
546
+ if (ENV === "test" || ENV === "development") {
547
+ console.warn(
548
+ "Warning: Potential infinite loop detected due to repeated sequence:",
549
+ pattern
550
+ );
551
+ }
552
+ return true;
553
+ }
554
+ }
555
+ }
556
+ };
557
+
558
+ // ../utils/dist/esm/key.js
559
+ var generateKey = /* @__PURE__ */ (function() {
560
+ let index = 0;
561
+ function newId() {
562
+ index++;
563
+ return index;
564
+ }
565
+ return newId;
566
+ })();
567
+ var createSnapshotId = generateKey;
568
+ var createKey = (element, parent, key) => {
569
+ return (exec(key, element) || key || element.key || generateKey()).toString();
570
+ };
571
+
572
+ // ../utils/dist/esm/env.js
573
+ var NODE_ENV = process.env.NODE_ENV;
574
+ var isProduction = (env = NODE_ENV) => env === "production";
575
+
576
+ // ../utils/dist/esm/if.js
577
+ var createIfConditionFlag = (element, parent) => {
578
+ const { __ref: ref } = element;
579
+ if (isFunction(element.if) && !element.if(element, element.state, element.context)) {
580
+ delete ref.__if;
581
+ } else ref.__if = true;
582
+ };
583
+
584
+ // ../utils/dist/esm/tags.js
585
+ var HTML_TAGS = {
586
+ root: ["body", "html"],
587
+ head: ["title", "base", "meta", "style", "noscript", "script"],
588
+ body: /* @__PURE__ */ new Set([
589
+ "string",
590
+ "style",
591
+ "fragment",
592
+ "a",
593
+ "abbr",
594
+ "acronym",
595
+ "address",
596
+ "applet",
597
+ "area",
598
+ "article",
599
+ "aside",
600
+ "audio",
601
+ "b",
602
+ "basefont",
603
+ "bdi",
604
+ "bdo",
605
+ "big",
606
+ "blockquote",
607
+ "br",
608
+ "button",
609
+ "canvas",
610
+ "caption",
611
+ "center",
612
+ "cite",
613
+ "code",
614
+ "search",
615
+ "col",
616
+ "colgroup",
617
+ "data",
618
+ "datalist",
619
+ "dd",
620
+ "del",
621
+ "details",
622
+ "dfn",
623
+ "dialog",
624
+ "dir",
625
+ "div",
626
+ "dl",
627
+ "dt",
628
+ "em",
629
+ "embed",
630
+ "fieldset",
631
+ "figcaption",
632
+ "figure",
633
+ "font",
634
+ "footer",
635
+ "form",
636
+ "frame",
637
+ "frameset",
638
+ "h1",
639
+ "h2",
640
+ "h3",
641
+ "h4",
642
+ "h5",
643
+ "h6",
644
+ "head",
645
+ "header",
646
+ "hr",
647
+ "i",
648
+ "iframe",
649
+ "img",
650
+ "input",
651
+ "ins",
652
+ "kbd",
653
+ "label",
654
+ "legend",
655
+ "li",
656
+ "link",
657
+ "main",
658
+ "map",
659
+ "mark",
660
+ "meter",
661
+ "nav",
662
+ "noframes",
663
+ "noscript",
664
+ "object",
665
+ "ol",
666
+ "optgroup",
667
+ "option",
668
+ "output",
669
+ "p",
670
+ "param",
671
+ "picture",
672
+ "pre",
673
+ "progress",
674
+ "hgroup",
675
+ "q",
676
+ "rp",
677
+ "rt",
678
+ "ruby",
679
+ "s",
680
+ "samp",
681
+ "script",
682
+ "section",
683
+ "select",
684
+ "small",
685
+ "source",
686
+ "span",
687
+ "strike",
688
+ "strong",
689
+ "sub",
690
+ "summary",
691
+ "sup",
692
+ "table",
693
+ "tbody",
694
+ "td",
695
+ "template",
696
+ "hgroup",
697
+ "textarea",
698
+ "tfoot",
699
+ "th",
700
+ "thead",
701
+ "time",
702
+ "tr",
703
+ "track",
704
+ "tt",
705
+ "u",
706
+ "ul",
707
+ "var",
708
+ "video",
709
+ "wbr",
710
+ // SVG
711
+ "svg",
712
+ "path",
713
+ "circle",
714
+ "ellipse",
715
+ "line",
716
+ "polygon",
717
+ "polyline",
718
+ "rect",
719
+ "g",
720
+ "defs",
721
+ "symbol",
722
+ "use",
723
+ "text",
724
+ "tspan",
725
+ "image",
726
+ "clipPath",
727
+ "mask",
728
+ "pattern",
729
+ "marker",
730
+ "linearGradient",
731
+ "radialGradient",
732
+ "stop",
733
+ "filter",
734
+ "feGaussianBlur",
735
+ "feOffset",
736
+ "feMerge",
737
+ "feMergeNode",
738
+ "feBlend",
739
+ "feColorMatrix",
740
+ "feFlood",
741
+ "feComposite",
742
+ "foreignObject"
743
+ ])
744
+ };
745
+ var SVG_TAGS = /* @__PURE__ */ new Set([
746
+ "svg",
747
+ "path",
748
+ "circle",
749
+ "ellipse",
750
+ "line",
751
+ "polygon",
752
+ "polyline",
753
+ "rect",
754
+ "g",
755
+ "defs",
756
+ "symbol",
757
+ "use",
758
+ "text",
759
+ "tspan",
760
+ "image",
761
+ "clipPath",
762
+ "mask",
763
+ "pattern",
764
+ "marker",
765
+ "linearGradient",
766
+ "radialGradient",
767
+ "stop",
768
+ "filter",
769
+ "feGaussianBlur",
770
+ "feOffset",
771
+ "feMerge",
772
+ "feMergeNode",
773
+ "feBlend",
774
+ "feColorMatrix",
775
+ "feFlood",
776
+ "feComposite",
777
+ "foreignObject"
778
+ ]);
779
+ var isValidHtmlTag = (arg) => HTML_TAGS.body.has(arg);
780
+
781
+ // ../utils/dist/esm/extends.js
782
+ var ENV2 = process.env.NODE_ENV;
783
+ var createExtendsFromKeys = (key) => {
784
+ if (key.includes("+")) {
785
+ return key.split("+").filter(matchesComponentNaming);
786
+ }
787
+ if (key.includes("_")) {
788
+ const [first] = key.split("_");
789
+ return [first];
790
+ }
791
+ if (key.includes(".") && !matchesComponentNaming(key.split(".")[1])) {
792
+ const [first] = key.split(".");
793
+ return [first];
794
+ }
795
+ return [key];
796
+ };
797
+ var createExtends = (element, parent, key) => {
798
+ let __extends = [];
799
+ const keyExtends = createExtendsFromKeys(key);
800
+ if (keyExtends) __extends = [...keyExtends];
801
+ const elementExtends = element.extends;
802
+ if (elementExtends) {
803
+ __extends = isArray(elementExtends) ? [...__extends, ...elementExtends] : [...__extends, elementExtends];
804
+ }
805
+ return __extends;
806
+ };
807
+ var addExtends = (newExtends, element) => {
808
+ const { __ref: ref } = element;
809
+ let { __extends } = ref;
810
+ if (!newExtends) return __extends;
811
+ const variant = element.props?.variant;
812
+ const context = element.context;
813
+ if (variant && context?.components && !Array.isArray(newExtends) && typeof newExtends === "string") {
814
+ const variantKey = `${newExtends}.${variant}`;
815
+ if (context.components[variantKey]) {
816
+ newExtends = variantKey;
817
+ }
818
+ }
819
+ if (!__extends.includes(newExtends)) {
820
+ __extends = Array.isArray(newExtends) ? [...__extends, ...newExtends] : [...__extends, newExtends];
821
+ ref.__extends = __extends;
822
+ }
823
+ return __extends;
824
+ };
825
+ var concatAddExtends = (newExtend, element) => {
826
+ if (!newExtend) return element;
827
+ const { extends: elementExtend } = element;
828
+ const originalArray = isArray(elementExtend) ? elementExtend : [elementExtend];
829
+ const receivedArray = isArray(newExtend) ? newExtend : [newExtend];
830
+ return {
831
+ ...element,
832
+ extends: joinArrays(receivedArray, originalArray)
833
+ };
834
+ };
835
+ var generateHash = () => Math.random().toString(36).substring(2);
836
+ var extendStackRegistry = {};
837
+ var getHashedExtend = (extend) => {
838
+ return extendStackRegistry[extend.__hash];
839
+ };
840
+ var setHashedExtend = (extend, stack) => {
841
+ const hash = generateHash();
842
+ if (!isString(extend)) {
843
+ extend.__hash = hash;
844
+ }
845
+ if (hash !== "__proto__" && hash !== "constructor" && hash !== "prototype") {
846
+ extendStackRegistry[hash] = stack;
847
+ }
848
+ return stack;
849
+ };
850
+ var getExtendsStackRegistry = (extend, stack) => {
851
+ if (extend.__hash) {
852
+ return stack.concat(getHashedExtend(extend));
853
+ }
854
+ return setHashedExtend(extend, stack);
855
+ };
856
+ var extractArrayExtend = (extend, stack, context, processed = /* @__PURE__ */ new Set()) => {
857
+ for (const each of extend) {
858
+ if (isArray(each)) {
859
+ extractArrayExtend(each, stack, context, processed);
860
+ } else {
861
+ flattenExtend(each, stack, context, processed);
862
+ }
863
+ }
864
+ return stack;
865
+ };
866
+ var deepExtend = (extend, stack, context, processed = /* @__PURE__ */ new Set()) => {
867
+ const extendOflattenExtend = extend.extends || extend.extend;
868
+ const cleanExtend = { ...extend };
869
+ delete cleanExtend.extends;
870
+ delete cleanExtend.extend;
871
+ let hasKeys = false;
872
+ for (const _k in cleanExtend) {
873
+ hasKeys = true;
874
+ break;
875
+ }
876
+ if (hasKeys) {
877
+ stack.push(cleanExtend);
878
+ }
879
+ if (extendOflattenExtend) {
880
+ flattenExtend(extendOflattenExtend, stack, context, processed);
881
+ }
882
+ return stack;
883
+ };
884
+ var flattenExtend = (extend, stack, context, processed = /* @__PURE__ */ new Set()) => {
885
+ if (!extend) return stack;
886
+ if (processed.has(extend)) return stack;
887
+ if (isArray(extend)) {
888
+ return extractArrayExtend(extend, stack, context, processed);
889
+ }
890
+ if (isString(extend)) {
891
+ extend = mapStringsWithContextComponents(extend, context);
892
+ }
893
+ processed.add(extend);
894
+ if (extend?.extends || extend?.extend) {
895
+ deepExtend(extend, stack, context, processed);
896
+ } else if (extend) {
897
+ stack.push(extend);
898
+ }
899
+ return stack;
900
+ };
901
+ var MERGE_EXTENDS_SKIP = /* @__PURE__ */ new Set([
902
+ "parent",
903
+ "node",
904
+ "__ref",
905
+ "__proto__",
906
+ "extend",
907
+ "childExtend",
908
+ "childExtendRecursive"
909
+ ]);
910
+ var deepMergeExtends = (element, extend) => {
911
+ extend = deepClone(extend);
912
+ for (const e in extend) {
913
+ if (MERGE_EXTENDS_SKIP.has(e)) continue;
914
+ const elementProp = element[e];
915
+ const extendProp = extend[e];
916
+ if (extendProp === void 0) continue;
917
+ if (Object.prototype.hasOwnProperty.call(extend, e) && e !== "__proto__" && e !== "constructor" && e !== "prototype") {
918
+ if (elementProp === void 0) {
919
+ element[e] = extendProp;
920
+ } else if (isObject(elementProp) && isObject(extendProp)) {
921
+ if (matchesComponentNaming(e)) {
922
+ element[e] = deepMergeExtends(elementProp, extendProp);
923
+ } else {
924
+ deepMergeExtends(elementProp, extendProp);
925
+ }
926
+ }
927
+ if (e === "extends" || e === "childExtends" || e === "childExtendsRecursive") {
928
+ if (isArray(elementProp) && isArray(extendProp)) {
929
+ element[e] = elementProp.concat(extendProp);
930
+ } else if (isArray(elementProp) && isObject(extendProp)) {
931
+ const obj = deepMergeExtends({}, elementProp);
932
+ element[e] = deepMergeExtends(obj, extendProp);
933
+ }
934
+ }
935
+ }
936
+ }
937
+ return element;
938
+ };
939
+ var cloneAndMergeArrayExtend = (stack) => {
940
+ return stack.reduce((acc, current) => {
941
+ const cloned = deepClone(current);
942
+ return deepMergeExtends(acc, cloned);
943
+ }, {});
944
+ };
945
+ var mapStringsWithContextComponents = (extend, context, options = {}, variant) => {
946
+ const COMPONENTS = context?.components || options.components;
947
+ const PAGES = context?.pages || options.pages;
948
+ if (isString(extend)) {
949
+ const componentExists = COMPONENTS && (COMPONENTS[extend + "." + variant] || COMPONENTS[extend] || COMPONENTS["smbls." + extend]);
950
+ const pageExists = PAGES && extend.charCodeAt(0) === 47 && PAGES[extend];
951
+ if (componentExists) return componentExists;
952
+ else if (pageExists) return pageExists;
953
+ else {
954
+ if (options.verbose && (ENV2 === "test" || ENV2 === "development")) {
955
+ console.warn("Extend is string but component was not found:", extend);
956
+ }
957
+ return;
958
+ }
959
+ }
960
+ return extend;
961
+ };
962
+ var getExtendsStack = (extend, context) => {
963
+ if (!extend) return [];
964
+ if (extend.__hash) return getHashedExtend(extend) || [];
965
+ const processed = /* @__PURE__ */ new Set();
966
+ const stack = flattenExtend(extend, [], context, processed);
967
+ return getExtendsStackRegistry(extend, stack);
968
+ };
969
+ var createElementExtends = (element, parent, options = {}) => {
970
+ const { __ref: ref } = element;
971
+ const context = element.context || parent.context;
972
+ const variant = element.props?.variant;
973
+ if (element.extend && !element.extends) element.extends = element.extend;
974
+ delete element.extend;
975
+ if (!element.extends && element.props?.extends) element.extends = element.props.extends;
976
+ if (element.extends) {
977
+ if (Array.isArray(element.extends) && element.extends.length > 0) {
978
+ const [firstExtend, ...restExtends] = element.extends;
979
+ if (typeof firstExtend === "string" && variant && context?.components) {
980
+ const variantKey = `${firstExtend}.${variant}`;
981
+ if (context.components[variantKey]) {
982
+ addExtends([variantKey, ...restExtends], element);
983
+ } else {
984
+ addExtends(element.extends, element);
985
+ }
986
+ } else {
987
+ addExtends(element.extends, element);
988
+ }
989
+ } else if (typeof element.extends === "string" && variant && context?.components) {
990
+ const variantKey = `${element.extends}.${variant}`;
991
+ if (context.components[variantKey]) {
992
+ addExtends(variantKey, element);
993
+ } else {
994
+ addExtends(element.extends, element);
995
+ }
996
+ } else {
997
+ addExtends(element.extends, element);
998
+ }
999
+ }
1000
+ inheritChildPropsExtends(element, parent, options);
1001
+ inheritChildExtends(element, parent, options);
1002
+ inheritRecursiveChildExtends(element, parent, options);
1003
+ if (element.component) {
1004
+ addExtends(exec(element.component, element), element);
1005
+ }
1006
+ if (context.defaultExtends) {
1007
+ addExtends(context.defaultExtends, element);
1008
+ }
1009
+ return removeDuplicatesInArray(ref.__extends);
1010
+ };
1011
+ var inheritChildPropsExtends = (element, parent, options = {}) => {
1012
+ const { props, __ref: ref } = element;
1013
+ const ignoreChildExtends = options.ignoreChildExtends || props?.ignoreChildExtends;
1014
+ if (!ignoreChildExtends) {
1015
+ if (parent.props?.childProps?.extends) {
1016
+ addExtends(parent.props?.childProps.extends, element);
1017
+ }
1018
+ }
1019
+ return ref.__extends;
1020
+ };
1021
+ var inheritChildExtends = (element, parent, options = {}) => {
1022
+ const { props, __ref: ref } = element;
1023
+ const ignoreChildExtends = options.ignoreChildExtends || props?.ignoreChildExtends;
1024
+ const childExtends = parent.childExtends || parent.childExtend;
1025
+ if (!ignoreChildExtends && childExtends) {
1026
+ addExtends(childExtends, element);
1027
+ }
1028
+ return ref.__extends;
1029
+ };
1030
+ var inheritRecursiveChildExtends = (element, parent, options = {}) => {
1031
+ const { props, __ref: ref } = element;
1032
+ const childExtendsRecursive = parent.childExtendsRecursive || parent.childExtendRecursive;
1033
+ const ignoreChildExtendsRecursive = options.ignoreChildExtendsRecursive || props?.ignoreChildExtendsRecursive;
1034
+ const isText = element.key === "__text";
1035
+ if (childExtendsRecursive && !isText && !ignoreChildExtendsRecursive) {
1036
+ addExtends(childExtendsRecursive, element);
1037
+ }
1038
+ return ref.__extends;
1039
+ };
1040
+ var createExtendsStack = (element, parent, options = {}) => {
1041
+ const { props, __ref: ref } = element;
1042
+ const context = element.context || parent.context;
1043
+ const variant = element.variant || props?.variant;
1044
+ const __extends = removeDuplicatesInArray(
1045
+ ref.__extends.map((val, i) => {
1046
+ return mapStringsWithContextComponents(
1047
+ val,
1048
+ context,
1049
+ options,
1050
+ i === 0 && variant
1051
+ );
1052
+ })
1053
+ );
1054
+ const stack = getExtendsStack(__extends, context);
1055
+ ref.__extendsStack = stack;
1056
+ return ref.__extendsStack;
1057
+ };
1058
+ var finalizeExtends = (element, parent, options = {}) => {
1059
+ const { __ref: ref } = element;
1060
+ const { __extendsStack } = ref;
1061
+ const flattenExtends = cloneAndMergeArrayExtend(__extendsStack);
1062
+ return deepMergeExtends(element, flattenExtends);
1063
+ };
1064
+ var applyExtends = (element, parent, options = {}) => {
1065
+ createElementExtends(element, parent, options);
1066
+ createExtendsStack(element, parent, options);
1067
+ finalizeExtends(element, parent, options);
1068
+ return element;
1069
+ };
1070
+
1071
+ // ../utils/dist/esm/component.js
1072
+ var matchesComponentNaming = (key) => {
1073
+ if (!isString(key) || !key.length) return false;
1074
+ const code = key.charCodeAt(0);
1075
+ return code >= 65 && code <= 90;
1076
+ };
1077
+ function isContextComponent(element, parent, passedKey) {
1078
+ const { context } = parent || {};
1079
+ const [extendsKey] = createExtendsFromKeys(passedKey);
1080
+ const key = passedKey || extendsKey;
1081
+ return context?.components?.[key] || context?.pages?.[key];
1082
+ }
1083
+
1084
+ // ../utils/dist/esm/events.js
1085
+ function addEventFromProps(key, obj) {
1086
+ const { props, on } = obj;
1087
+ const eventName = lowercaseFirstLetter(key.split("on")[1]);
1088
+ const origEvent = on[eventName];
1089
+ const funcFromProps = props[key];
1090
+ if (isFunction(origEvent)) {
1091
+ on[eventName] = (...args) => {
1092
+ const originalEventRetunrs = origEvent(...args);
1093
+ if (originalEventRetunrs !== false) funcFromProps(...args);
1094
+ };
1095
+ } else on[eventName] = funcFromProps;
1096
+ }
1097
+
1098
+ // ../utils/dist/esm/props.js
1099
+ var RE_UPPER = /^[A-Z]/;
1100
+ var RE_DIGITS = /^\d+$/;
1101
+ var createProps = (element, parent, key) => {
1102
+ const { props, __ref: ref } = element;
1103
+ ref.__propsStack = [];
1104
+ if (props) ref.__initialProps = props;
1105
+ else return {};
1106
+ if (!isObjectLike(props)) {
1107
+ ref.__propsStack.push(props);
1108
+ return {};
1109
+ }
1110
+ return { ...props };
1111
+ };
1112
+ function pickupPropsFromElement(obj, opts = {}) {
1113
+ const cachedKeys = opts.cachedKeys || [];
1114
+ for (const key in obj) {
1115
+ const value = obj[key];
1116
+ const isEventHandler = key.length > 2 && key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && key[2] === key[2].toUpperCase() && isFunction(value);
1117
+ if (isEventHandler) {
1118
+ const eventName = lowercaseFirstLetter(key.slice(2));
1119
+ if (obj.on) obj.on[eventName] = value;
1120
+ delete obj[key];
1121
+ continue;
1122
+ }
1123
+ const hasDefine = isObject(this.define?.[key]);
1124
+ const hasGlobalDefine = isObject(this.context?.define?.[key]);
1125
+ const isElement = RE_UPPER.test(key) || RE_DIGITS.test(key);
1126
+ const isBuiltin = DOMQ_PROPERTIES.has(key);
1127
+ if (!isElement && !isBuiltin && !hasDefine && !hasGlobalDefine) {
1128
+ obj.props[key] = value;
1129
+ delete obj[key];
1130
+ cachedKeys.push(key);
1131
+ }
1132
+ }
1133
+ return obj;
1134
+ }
1135
+ function pickupElementFromProps(obj = this, opts) {
1136
+ const cachedKeys = opts.cachedKeys || [];
1137
+ for (const key in obj.props) {
1138
+ const value = obj.props[key];
1139
+ const isEvent = key.length > 2 && key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110;
1140
+ const isFn = isFunction(value);
1141
+ if (isEvent && isFn) {
1142
+ addEventFromProps(key, obj);
1143
+ delete obj.props[key];
1144
+ continue;
1145
+ }
1146
+ if (cachedKeys.includes(key)) continue;
1147
+ const hasDefine = isObject(this.define?.[key]);
1148
+ const hasGlobalDefine = isObject(this.context?.define?.[key]);
1149
+ const isElement = RE_UPPER.test(key) || RE_DIGITS.test(key);
1150
+ const isBuiltin = DOMQ_PROPERTIES.has(key);
1151
+ if (isElement || isBuiltin || hasDefine || hasGlobalDefine) {
1152
+ if (obj[key] === void 0 || value === null) {
1153
+ obj[key] = value;
1154
+ if (obj.props) delete obj.props[key];
1155
+ }
1156
+ }
1157
+ }
1158
+ return obj;
1159
+ }
1160
+ function propertizeElement(element = this) {
1161
+ const cachedKeys = [];
1162
+ pickupPropsFromElement.call(this, element, { cachedKeys });
1163
+ pickupElementFromProps.call(this, element, { cachedKeys });
1164
+ return element;
1165
+ }
1166
+ function propertizeUpdate(params = {}) {
1167
+ if (!params.on) params.on = {};
1168
+ if (!params.props) params.props = {};
1169
+ return propertizeElement.call(this, params);
1170
+ }
1171
+ var objectizeStringProperty = (propValue) => {
1172
+ if (is(propValue)("string", "number")) {
1173
+ return { inheritedString: propValue };
1174
+ }
1175
+ return propValue;
1176
+ };
1177
+ var inheritParentProps = (element, parent) => {
1178
+ const { __ref: ref } = element;
1179
+ const propsStack = ref.__propsStack || [];
1180
+ const parentProps = parent.props;
1181
+ if (!parentProps) return propsStack;
1182
+ const matchParentKeyProps = parentProps[element.key];
1183
+ const matchParentChildProps = parentProps.childProps;
1184
+ const ignoreChildProps = element.props?.ignoreChildProps;
1185
+ if (matchParentChildProps && !ignoreChildProps) {
1186
+ const childProps = objectizeStringProperty(matchParentChildProps);
1187
+ propsStack.unshift(childProps);
1188
+ }
1189
+ if (matchParentKeyProps) {
1190
+ const keyProps = objectizeStringProperty(matchParentKeyProps);
1191
+ propsStack.unshift(keyProps);
1192
+ }
1193
+ return propsStack;
1194
+ };
1195
+ function update(props, options) {
1196
+ const element = this.__element;
1197
+ element.update({ props }, options);
1198
+ }
1199
+ function setPropsPrototype(element) {
1200
+ const methods = { update: update.bind(element.props), __element: element };
1201
+ Object.setPrototypeOf(element.props, methods);
1202
+ }
1203
+ var removeDuplicateProps = (propsStack) => {
1204
+ const seen = /* @__PURE__ */ new Set();
1205
+ return propsStack.filter((prop) => {
1206
+ if (!prop || PROPS_METHODS.has(prop)) return false;
1207
+ if (seen.has(prop)) return false;
1208
+ seen.add(prop);
1209
+ return true;
1210
+ });
1211
+ };
1212
+ var syncProps = (propsStack, element, opts) => {
1213
+ element.props = propsStack.reduce((mergedProps, v) => {
1214
+ if (PROPS_METHODS.has(v)) return mergedProps;
1215
+ while (isFunction(v)) v = exec(v, element);
1216
+ return deepMerge(mergedProps, deepClone(v, { exclude: PROPS_METHODS }));
1217
+ }, {});
1218
+ setPropsPrototype(element);
1219
+ return element.props;
1220
+ };
1221
+ var createPropsStack = (element, parent) => {
1222
+ const { props, __ref: ref } = element;
1223
+ let propsStack = ref.__propsStack || [];
1224
+ if (parent?.props) {
1225
+ const parentStack = inheritParentProps(element, parent);
1226
+ propsStack = [...parentStack];
1227
+ }
1228
+ if (isObject(props)) propsStack.push(props);
1229
+ else if (props === "inherit" && parent?.props) propsStack.push(parent.props);
1230
+ else if (props) propsStack.push(props);
1231
+ if (isArray(ref.__extendsStack)) {
1232
+ for (let i = 0; i < ref.__extendsStack.length; i++) {
1233
+ const _extends = ref.__extendsStack[i];
1234
+ if (_extends.props && _extends.props !== props) {
1235
+ propsStack.push(_extends.props);
1236
+ }
1237
+ }
1238
+ }
1239
+ ref.__propsStack = removeDuplicateProps(propsStack);
1240
+ return ref.__propsStack;
1241
+ };
1242
+ var applyProps = (element, parent) => {
1243
+ const { __ref: ref } = element;
1244
+ const propsStack = createPropsStack(element, parent);
1245
+ if (propsStack.length) {
1246
+ syncProps(propsStack, element);
1247
+ } else {
1248
+ ref.__propsStack = [];
1249
+ element.props = {};
1250
+ }
1251
+ };
1252
+ var initProps = function(element, parent, options) {
1253
+ const { __ref: ref } = element;
1254
+ if (ref.__if) applyProps(element, parent);
1255
+ else {
1256
+ try {
1257
+ applyProps(element, parent);
1258
+ } catch (e) {
1259
+ if (element.context?.designSystem?.verbose) {
1260
+ console.warn("initProps error at", ref.path?.join("."), e);
1261
+ }
1262
+ element.props = {};
1263
+ ref.__propsStack = [];
1264
+ }
1265
+ }
1266
+ setPropsPrototype(element);
1267
+ return element;
1268
+ };
1269
+ var updateProps = (newProps, element, parent) => {
1270
+ const { __ref: ref } = element;
1271
+ const propsStack = ref.__propsStack || [];
1272
+ let newStack = [...propsStack];
1273
+ const parentProps = inheritParentProps(element, parent);
1274
+ if (parentProps.length) {
1275
+ newStack = [...parentProps, ...newStack];
1276
+ }
1277
+ if (newProps) {
1278
+ newStack = [newProps, ...newStack];
1279
+ }
1280
+ ref.__propsStack = removeDuplicateProps(newStack);
1281
+ if (ref.__propsStack.length) {
1282
+ syncProps(ref.__propsStack, element);
1283
+ }
1284
+ return element;
1285
+ };
1286
+
1287
+ // ../utils/dist/esm/element.js
1288
+ var ENV3 = process.env.NODE_ENV;
1289
+ var returnValueAsText = (element, parent, key) => {
1290
+ const childExtendsTag = parent.childExtends && parent.childExtends.tag;
1291
+ const childPropsTag = parent.props.childProps && parent.props.childProps.tag;
1292
+ const isKeyValidHTMLTag = HTML_TAGS.body.has(key) && key;
1293
+ return {
1294
+ text: element,
1295
+ tag: childExtendsTag || childPropsTag || isKeyValidHTMLTag || "string"
1296
+ };
1297
+ };
1298
+ var createBasedOnType = (element, parent, key) => {
1299
+ if (element === void 0) {
1300
+ if (ENV3 === "test" || ENV3 === "development") {
1301
+ console.warn(
1302
+ key,
1303
+ "element is undefined in",
1304
+ parent?.__ref?.path
1305
+ );
1306
+ }
1307
+ return {};
1308
+ }
1309
+ if (element === null) return;
1310
+ if (element === true) return {};
1311
+ if (is(element)("string", "number")) {
1312
+ return returnValueAsText(element, parent, key);
1313
+ }
1314
+ if (isFunction(element)) {
1315
+ return { props: element };
1316
+ }
1317
+ return element;
1318
+ };
1319
+ var addRef = (element, parent) => {
1320
+ const ref = {};
1321
+ ref.origin = element;
1322
+ ref.parent = parent;
1323
+ return ref;
1324
+ };
1325
+ var createParent = (element, parent, key, options, root) => {
1326
+ if (!parent) return root;
1327
+ if (isNode(parent)) {
1328
+ const parentNodeWrapper = { key: ":root", node: parent };
1329
+ root[`${key}_parent`] = parentNodeWrapper;
1330
+ return parentNodeWrapper;
1331
+ }
1332
+ return parent;
1333
+ };
1334
+ var createRoot = (element, parent) => {
1335
+ const { __ref: ref } = element;
1336
+ const { __ref: parentRef } = parent;
1337
+ const hasRoot = parent && parent.key === ":root";
1338
+ if (!ref?.root) {
1339
+ ref.root = hasRoot ? element : parentRef?.root;
1340
+ }
1341
+ };
1342
+ var createPath = (element, parent, key) => {
1343
+ let { __ref: parentRef } = parent;
1344
+ if (!parentRef) parentRef = parent.ref = {};
1345
+ if (!parentRef.path) parentRef.path = [];
1346
+ return parentRef.path.concat(key);
1347
+ };
1348
+ var addContext = (element, parent, key, options, root) => {
1349
+ const forcedOptionsContext = options.context && !root.context && !element.context;
1350
+ if (forcedOptionsContext) root.context = options.context;
1351
+ return options.context || parent.context || root.context || element.context;
1352
+ };
1353
+ var addCaching = (element, parent, key) => {
1354
+ const ref = addRef(element, parent);
1355
+ element.__ref = ref;
1356
+ if (!ref.__defineCache) ref.__defineCache = {};
1357
+ if (!ref.__exec) ref.__exec = {};
1358
+ if (!ref.__execProps) ref.__execProps = {};
1359
+ if (!ref.__class) ref.__class = {};
1360
+ if (!ref.__classNames) ref.__classNames = {};
1361
+ if (!ref.__attr) ref.__attr = {};
1362
+ if (!ref.__changes) ref.__changes = [];
1363
+ if (!ref.__children) ref.__children = [];
1364
+ ref.__extends = createExtends(element, parent, key);
1365
+ ref.path = createPath(element, parent, key);
1366
+ return ref;
1367
+ };
1368
+ var createElement = (passedProps, parentEl, passedKey, opts, root) => {
1369
+ const hashed = passedProps?.__hash;
1370
+ const element = hashed ? { extends: [passedProps] } : createBasedOnType(passedProps, parentEl, passedKey);
1371
+ if (!element) return;
1372
+ const parent = createParent(element, parentEl, passedKey, opts, root);
1373
+ const key = createKey(element, parent, passedKey);
1374
+ addCaching(element, parent, key);
1375
+ const props = createProps(element, parent, key);
1376
+ const context = addContext(element, parent, key, opts, root);
1377
+ const on = element.on || {};
1378
+ return {
1379
+ ...element,
1380
+ key,
1381
+ props,
1382
+ parent,
1383
+ context,
1384
+ on
1385
+ };
1386
+ };
1387
+
1388
+ // ../utils/dist/esm/state.js
1389
+ var checkForStateTypes = (element) => {
1390
+ const { state: orig, props, __ref: ref } = element;
1391
+ const state2 = props?.state || orig;
1392
+ if (isFunction(state2)) {
1393
+ ref.__state = state2;
1394
+ return exec(state2, element);
1395
+ } else if (is(state2)("string", "number")) {
1396
+ ref.__state = state2;
1397
+ return { value: state2 };
1398
+ } else if (state2 === true) {
1399
+ ref.__state = element.key;
1400
+ return {};
1401
+ } else if (state2) {
1402
+ ref.__hasRootState = true;
1403
+ return state2;
1404
+ } else {
1405
+ return false;
1406
+ }
1407
+ };
1408
+ var getRootStateInKey = (stateKey, parentState) => {
1409
+ if (!stateKey.includes("~/")) return;
1410
+ const arr = stateKey.split("~/");
1411
+ if (arr.length > 1) return parentState.root;
1412
+ };
1413
+ var getParentStateInKey = (stateKey, parentState) => {
1414
+ if (!stateKey.includes("../")) return;
1415
+ const arr = stateKey.split("../");
1416
+ const arrLength = arr.length - 1;
1417
+ for (let i = 0; i < arrLength; i++) {
1418
+ if (!parentState.parent) return null;
1419
+ parentState = parentState.parent;
1420
+ }
1421
+ return parentState;
1422
+ };
1423
+ var getChildStateInKey = (stateKey, parentState, options = {}) => {
1424
+ const arr = isString(stateKey) ? stateKey.split("/") : [stateKey];
1425
+ const arrLength = arr.length - 1;
1426
+ for (let i = 0; i < arrLength; i++) {
1427
+ const childKey = arr[i];
1428
+ const grandChildKey = arr[i + 1];
1429
+ if (childKey === "__proto__" || grandChildKey === "__proto__") return;
1430
+ let childInParent = parentState[childKey];
1431
+ if (!childInParent) childInParent = parentState[childKey] = {};
1432
+ if (!childInParent[grandChildKey]) childInParent[grandChildKey] = {};
1433
+ stateKey = grandChildKey;
1434
+ parentState = childInParent;
1435
+ }
1436
+ if (options.returnParent) return parentState;
1437
+ return parentState[stateKey];
1438
+ };
1439
+ var findInheritedState = (element, parent, options = {}) => {
1440
+ const ref = element.__ref;
1441
+ let stateKey = ref.__state;
1442
+ if (!checkIfInherits(element)) return;
1443
+ const rootState = getRootStateInKey(stateKey, parent.state);
1444
+ let parentState = parent.state;
1445
+ if (rootState) {
1446
+ parentState = rootState;
1447
+ stateKey = stateKey.replaceAll("~/", "");
1448
+ } else {
1449
+ const findGrandParentState = getParentStateInKey(stateKey, parent.state);
1450
+ if (findGrandParentState) {
1451
+ parentState = findGrandParentState;
1452
+ stateKey = stateKey.replaceAll("../", "");
1453
+ }
1454
+ }
1455
+ if (!parentState) return;
1456
+ return getChildStateInKey(stateKey, parentState, options);
1457
+ };
1458
+ var createInheritedState = (element, parent) => {
1459
+ const ref = element.__ref;
1460
+ const inheritedState = findInheritedState(element, parent);
1461
+ if (inheritedState === void 0) return element.state;
1462
+ if (is(inheritedState)("object", "array")) {
1463
+ return deepClone(inheritedState);
1464
+ } else if (is(inheritedState)("string", "number", "boolean")) {
1465
+ ref.__stateType = typeof inheritedState;
1466
+ return { value: inheritedState };
1467
+ }
1468
+ console.warn(ref.__state, "is not present. Replacing with", {});
1469
+ };
1470
+ var checkIfInherits = (element) => {
1471
+ const { __ref: ref } = element;
1472
+ const stateKey = ref?.__state;
1473
+ if (stateKey && is(stateKey)("number", "string", "boolean")) return true;
1474
+ return false;
1475
+ };
1476
+ var isState = function(state2) {
1477
+ if (!isObjectLike(state2)) return false;
1478
+ return Boolean(
1479
+ state2.update && state2.parse && state2.clean && state2.create && state2.parent && state2.destroy && state2.rootUpdate && state2.parentUpdate && state2.keys && state2.values && state2.toggle && state2.replace && state2.quietUpdate && state2.quietReplace && state2.add && state2.apply && state2.applyReplace && state2.setByPath && state2.setPathCollection && state2.removeByPath && state2.removePathCollection && state2.getByPath && state2.applyFunction && state2.__element && state2.__children
1480
+ );
1481
+ };
1482
+ var createNestedObjectByKeyPath = (path, value) => {
1483
+ if (!path) {
1484
+ return value || {};
1485
+ }
1486
+ const keys3 = path.split("/");
1487
+ const obj = {};
1488
+ let ref = obj;
1489
+ const lastIdx = keys3.length - 1;
1490
+ for (let i = 0; i <= lastIdx; i++) {
1491
+ ref[keys3[i]] = i === lastIdx ? value || {} : {};
1492
+ ref = ref[keys3[i]];
1493
+ }
1494
+ return obj;
1495
+ };
1496
+ var applyDependentState = (element, state2) => {
1497
+ const { __element } = state2;
1498
+ const origState = exec(__element?.state, element);
1499
+ if (!origState) return;
1500
+ const dependentState = deepClone(origState, STATE_METHODS);
1501
+ const newDepends = { [element.key]: dependentState };
1502
+ const __depends = isObject(origState.__depends) ? { ...origState.__depends, ...newDepends } : newDepends;
1503
+ if (Array.isArray(origState)) {
1504
+ addProtoToArray(origState, {
1505
+ ...Object.getPrototypeOf(origState),
1506
+ __depends
1507
+ });
1508
+ } else {
1509
+ Object.setPrototypeOf(origState, {
1510
+ ...Object.getPrototypeOf(origState),
1511
+ __depends
1512
+ });
1513
+ }
1514
+ return dependentState;
1515
+ };
1516
+ var overwriteState = (state2, obj, options = {}) => {
1517
+ const { overwrite: overwrite2 } = options;
1518
+ if (!overwrite2) return;
1519
+ const shallow = overwrite2 === "shallow";
1520
+ const merge2 = overwrite2 === "merge";
1521
+ if (merge2) {
1522
+ deepMerge(state2, obj, STATE_METHODS);
1523
+ return;
1524
+ }
1525
+ const overwriteFunc = shallow ? overwriteShallow : overwriteDeep;
1526
+ overwriteFunc(state2, obj, STATE_METHODS);
1527
+ };
1528
+
1529
+ // ../utils/dist/esm/scope.js
1530
+ var createScope = (element, parent) => {
1531
+ const { __ref: ref } = element;
1532
+ if (!element.scope) element.scope = parent.scope || ref.root?.scope || {};
1533
+ };
1534
+
1535
+ // ../utils/dist/esm/triggerEvent.js
1536
+ var getOnOrPropsEvent = (param, element) => {
1537
+ const onEvent = element.on?.[param];
1538
+ if (onEvent) return onEvent;
1539
+ const props = element.props;
1540
+ if (!props) return;
1541
+ const propKey = "on" + param.charAt(0).toUpperCase() + param.slice(1);
1542
+ return props[propKey];
1543
+ };
1544
+ var applyEvent = (param, element, state2, context, options) => {
1545
+ if (!isFunction(param)) return;
1546
+ const result = param.call(
1547
+ element,
1548
+ element,
1549
+ state2 || element.state,
1550
+ context || element.context,
1551
+ options
1552
+ );
1553
+ if (result && typeof result.then === "function") {
1554
+ result.catch(() => {
1555
+ });
1556
+ }
1557
+ return result;
1558
+ };
1559
+ var triggerEventOn = (param, element, options) => {
1560
+ if (!element) {
1561
+ throw new Error("Element is required");
1562
+ }
1563
+ const appliedFunction = getOnOrPropsEvent(param, element);
1564
+ if (appliedFunction) {
1565
+ const { state: state2, context } = element;
1566
+ return applyEvent(appliedFunction, element, state2, context, options);
1567
+ }
1568
+ };
1569
+ var applyEventUpdate = (param, updatedObj, element, state2, context, options) => {
1570
+ if (!isFunction(param)) return;
1571
+ const result = param.call(
1572
+ element,
1573
+ updatedObj,
1574
+ element,
1575
+ state2 || element.state,
1576
+ context || element.context,
1577
+ options
1578
+ );
1579
+ if (result && typeof result.then === "function") {
1580
+ result.catch(() => {
1581
+ });
1582
+ }
1583
+ return result;
1584
+ };
1585
+ var triggerEventOnUpdate = (param, updatedObj, element, options) => {
1586
+ const appliedFunction = getOnOrPropsEvent(param, element);
1587
+ if (appliedFunction) {
1588
+ const { state: state2, context } = element;
1589
+ return applyEventUpdate(
1590
+ appliedFunction,
1591
+ updatedObj,
1592
+ element,
1593
+ state2,
1594
+ context,
1595
+ options
1596
+ );
1597
+ }
1598
+ };
1599
+
1600
+ // ../utils/dist/esm/methods.js
1601
+ var ENV4 = process.env.NODE_ENV;
1602
+ function spotByPath(path) {
1603
+ const element = this;
1604
+ const { __ref: ref } = element;
1605
+ const arr = [].concat(path);
1606
+ let foundelement = ref.root[arr[0]];
1607
+ if (!arr || !arr.length) {
1608
+ return console.log(arr, "on", element.key, "is undefined");
1609
+ }
1610
+ while (foundelement.key === arr[0]) {
1611
+ arr.shift();
1612
+ if (!arr.length) break;
1613
+ foundelement = foundelement[arr[0]];
1614
+ if (!foundelement) return;
1615
+ }
1616
+ return foundelement;
1617
+ }
1618
+ function lookup(param) {
1619
+ const el = this;
1620
+ let { parent } = el;
1621
+ if (isFunction(param)) {
1622
+ if (parent.state && param(parent, parent.state, parent.context)) {
1623
+ return parent;
1624
+ } else if (parent.parent) return parent.lookup(param);
1625
+ else return;
1626
+ }
1627
+ if (el[param]) return el[param];
1628
+ while (parent.param !== param) {
1629
+ if (parent[param]) return parent[param];
1630
+ parent = parent.parent;
1631
+ if (!parent) return;
1632
+ }
1633
+ return parent;
1634
+ }
1635
+ function lookdown(param) {
1636
+ const el = this;
1637
+ const { __ref: ref } = el;
1638
+ const children = ref?.__children;
1639
+ if (!children) return;
1640
+ for (let i = 0; i < children.length; i++) {
1641
+ const v = children[i];
1642
+ const childElem = el[v];
1643
+ if (v === param) return childElem;
1644
+ else if (isFunction(param)) {
1645
+ const exec2 = param(childElem, childElem.state, childElem.context);
1646
+ if (childElem.state && exec2) {
1647
+ return childElem;
1648
+ }
1649
+ }
1650
+ const lookdown2 = childElem?.lookdown?.(param);
1651
+ if (lookdown2) return lookdown2;
1652
+ }
1653
+ }
1654
+ function lookdownAll(param, results = []) {
1655
+ const el = this;
1656
+ const { __ref: ref } = el;
1657
+ const children = ref?.__children;
1658
+ if (!children) return;
1659
+ for (let i = 0; i < children.length; i++) {
1660
+ const v = children[i];
1661
+ const childElem = el[v];
1662
+ if (v === param) results.push(childElem);
1663
+ else if (isFunction(param)) {
1664
+ const exec2 = param(childElem, childElem.state, childElem.context);
1665
+ if (childElem.state && exec2) results.push(childElem);
1666
+ }
1667
+ childElem?.lookdownAll?.(param, results);
1668
+ }
1669
+ return results.length ? results : void 0;
1670
+ }
1671
+ function setNodeStyles(params = {}) {
1672
+ const el = this;
1673
+ if (!el.node?.style) return;
1674
+ for (const param in params) {
1675
+ const value = params[param];
1676
+ const childElem = el[param];
1677
+ if (isObject(value) && childElem) setNodeStyles.call(childElem, value);
1678
+ else el.node.style[param] = value;
1679
+ }
1680
+ return el;
1681
+ }
1682
+ function remove(opts) {
1683
+ const element = this;
1684
+ const beforeRemoveReturns = triggerEventOn("beforeRemove", element, opts);
1685
+ if (beforeRemoveReturns === false) return element;
1686
+ if (isFunction(element.node.remove)) element.node.remove();
1687
+ else if (!isProduction()) {
1688
+ console.warn("This item cant be removed");
1689
+ element.log();
1690
+ }
1691
+ delete element.parent[element.key];
1692
+ if (element.parent.__ref) {
1693
+ element.parent.__ref.__children = removeValueFromArray(
1694
+ element.parent.__ref.__children,
1695
+ element.key
1696
+ );
1697
+ }
1698
+ triggerEventOn("remove", element, opts);
1699
+ }
1700
+ function setProps(param, options) {
1701
+ const element = this;
1702
+ if (!param || !element.props) return;
1703
+ element.update({ props: param }, options);
1704
+ return element;
1705
+ }
1706
+ function getRef(key) {
1707
+ if (key) return this.__ref && this.__ref[key];
1708
+ return this.__ref;
1709
+ }
1710
+ function getPath() {
1711
+ return this.getRef().path;
1712
+ }
1713
+ function getRootState(param) {
1714
+ let state2 = null;
1715
+ const hasRootState = (obj) => obj.__element && obj.root?.isRootState;
1716
+ if (!this) {
1717
+ state2 = window.platformState || window.smblsApp?.state;
1718
+ } else if (hasRootState(this)) {
1719
+ state2 = this.root;
1720
+ } else if (this.__ref && this.__ref.path) {
1721
+ const hasPlatformState = this.state && hasRootState(this.state);
1722
+ const hasPlatformStateOnParent = isFunction(this.state) && this.parent.state && hasRootState(this.parent.state);
1723
+ if (hasPlatformState || hasPlatformStateOnParent) {
1724
+ state2 = this.state.root || this.parent.state.root;
1725
+ }
1726
+ }
1727
+ if (!state2) {
1728
+ state2 = window.platformState || window.smblsApp?.state;
1729
+ }
1730
+ return param ? state2?.[param] : state2;
1731
+ }
1732
+ function getRoot(key) {
1733
+ const rootElem = this.getRootState()?.__element;
1734
+ return rootElem && Object.keys(rootElem).length > 0 && key ? rootElem[key] : rootElem;
1735
+ }
1736
+ function getRootData(key) {
1737
+ return this.getRoot("data") && Object.keys(this.getRoot("data")).length > 0 && key ? this.getRoot("data")[key] : this.getRoot("data");
1738
+ }
1739
+ function getRootContext(key) {
1740
+ const ctx = this.getRoot()?.context;
1741
+ return key ? ctx[key] : ctx;
1742
+ }
1743
+ function getContext(key) {
1744
+ const ctx = this.context;
1745
+ return key ? ctx[key] : ctx;
1746
+ }
1747
+ function keys() {
1748
+ const element = this;
1749
+ const keys22 = [];
1750
+ for (const param in element) {
1751
+ if (
1752
+ // (REGISTRY[param] && !DOMQ_PROPERTIES.has(param)) ||
1753
+ !Object.prototype.hasOwnProperty.call(element, param) || DOMQ_PROPERTIES.has(param) && !PARSED_DOMQ_PROPERTIES.has(param)
1754
+ ) {
1755
+ continue;
1756
+ }
1757
+ keys22.push(param);
1758
+ }
1759
+ return keys22;
1760
+ }
1761
+ function parse(excl = []) {
1762
+ const element = this;
1763
+ const obj = {};
1764
+ const keyList = keys.call(element);
1765
+ const hasChildren = keyList.includes("children");
1766
+ const exclSet = excl.length ? new Set(excl) : null;
1767
+ for (let i = 0; i < keyList.length; i++) {
1768
+ const v = keyList[i];
1769
+ if (exclSet && exclSet.has(v) || !Object.prototype.hasOwnProperty.call(element, v)) continue;
1770
+ if (hasChildren && v === "content") continue;
1771
+ const val = element[v];
1772
+ if (v === "state") {
1773
+ if (element.__ref && !element.__ref.__hasRootState) continue;
1774
+ const parsedVal = isFunction(val && val.parse) ? val.parse() : val;
1775
+ obj[v] = isFunction(parsedVal) ? parsedVal : JSON.parse(JSON.stringify(parsedVal || {}));
1776
+ } else if (v === "scope") {
1777
+ if (element.__ref && !element.__ref.__hasRootScope) continue;
1778
+ obj[v] = JSON.parse(JSON.stringify(val || {}));
1779
+ } else if (v === "props") {
1780
+ const { __element, update: update3, ...props } = element[v];
1781
+ obj[v] = props;
1782
+ } else if (isDefined(val) && Object.prototype.hasOwnProperty.call(element, v)) {
1783
+ obj[v] = val;
1784
+ }
1785
+ }
1786
+ return obj;
1787
+ }
1788
+ function parseDeep(excl = [], visited = /* @__PURE__ */ new WeakSet()) {
1789
+ const element = this;
1790
+ if (visited.has(element)) return void 0;
1791
+ visited.add(element);
1792
+ const obj = parse.call(element, excl);
1793
+ const exclSet = excl.length ? new Set(excl) : null;
1794
+ for (const v in obj) {
1795
+ if (exclSet && exclSet.has(v) || !Object.prototype.hasOwnProperty.call(element, v)) continue;
1796
+ const val = obj[v];
1797
+ if (Array.isArray(val)) {
1798
+ obj[v] = val.map(
1799
+ (item) => isObjectLike(item) ? parseDeep.call(item, excl, visited) : item
1800
+ );
1801
+ } else if (isObjectLike(val)) {
1802
+ obj[v] = parseDeep.call(val, excl, visited);
1803
+ }
1804
+ }
1805
+ return obj;
1806
+ }
1807
+ function verbose(...args) {
1808
+ if (ENV4 !== "test" && ENV4 !== "development") return;
1809
+ const element = this;
1810
+ const { __ref: ref } = element;
1811
+ console.groupCollapsed(element.key);
1812
+ if (args.length) {
1813
+ args.forEach((v) => console.log(`%c${v}:
1814
+ `, "font-weight: bold", element[v]));
1815
+ } else {
1816
+ console.log(ref.path);
1817
+ const keys22 = element.keys();
1818
+ keys22.forEach((v) => console.log(`%c${v}:`, "font-weight: bold", element[v]));
1819
+ }
1820
+ console.log(element);
1821
+ console.groupEnd(element.key);
1822
+ return element;
1823
+ }
1824
+ function log(...params) {
1825
+ if (ENV4 === "test" || ENV4 === "development") {
1826
+ console.log(...params);
1827
+ }
1828
+ }
1829
+ function warn(...params) {
1830
+ if (ENV4 === "test" || ENV4 === "development") {
1831
+ console.warn(...params);
1832
+ }
1833
+ }
1834
+ function error(...params) {
1835
+ if (ENV4 === "test" || ENV4 === "development") {
1836
+ if (params[params.length - 1]?.debugger) debugger;
1837
+ if (params[params.length - 1]?.verbose) verbose.call(this);
1838
+ throw new Error(...params);
1839
+ }
1840
+ }
1841
+ function nextElement() {
1842
+ const element = this;
1843
+ const { key, parent } = element;
1844
+ const { __children } = parent.__ref;
1845
+ const currentIndex = __children.indexOf(key);
1846
+ const nextChild = __children[currentIndex + 1];
1847
+ return parent[nextChild];
1848
+ }
1849
+ function previousElement(el) {
1850
+ const element = el || this;
1851
+ const { key, parent } = element;
1852
+ const { __children } = parent.__ref;
1853
+ if (!__children) return;
1854
+ const currentIndex = __children.indexOf(key);
1855
+ return parent[__children[currentIndex - 1]];
1856
+ }
1857
+ function variables(obj = {}) {
1858
+ const element = this;
1859
+ if (!element.data) element.data = {};
1860
+ if (!element.data.varCaches) element.data.varCaches = {};
1861
+ const varCaches = element.data.varCaches;
1862
+ const changes = {};
1863
+ let changed;
1864
+ for (const key in obj) {
1865
+ if (obj[key] !== varCaches[key]) {
1866
+ changed = true;
1867
+ changes[key] = obj[key];
1868
+ }
1869
+ }
1870
+ return {
1871
+ changed: (cb) => {
1872
+ if (!changed) return;
1873
+ const returns = cb(changes, deepClone(varCaches));
1874
+ for (const key in changes) {
1875
+ varCaches[key] = changes[key];
1876
+ }
1877
+ return returns;
1878
+ },
1879
+ timeout: (cb, timeout) => {
1880
+ if (!changed) return;
1881
+ const t = setTimeout(() => {
1882
+ cb(changes);
1883
+ clearTimeout(t);
1884
+ }, timeout);
1885
+ }
1886
+ };
1887
+ }
1888
+ function call(fnKey, ...args) {
1889
+ const context = this.context;
1890
+ return (context.utils?.[fnKey] || context.functions?.[fnKey] || context.methods?.[fnKey] || context.snippets?.[fnKey])?.call(this, ...args);
1891
+ }
1892
+ function isMethod(param, element) {
1893
+ return Boolean(METHODS.has(param) || element?.context?.methods?.[param]);
1894
+ }
1895
+
1896
+ // ../utils/dist/esm/cache.js
1897
+ var OPTIONS = {};
1898
+
1899
+ // ../utils/dist/esm/update.js
1900
+ var snapshot = {
1901
+ snapshotId: createSnapshotId
1902
+ };
1903
+ var captureSnapshot = (element, options) => {
1904
+ const ref = element.__ref;
1905
+ const { currentSnapshot, calleeElement } = options;
1906
+ const isCallee = calleeElement === element;
1907
+ if (!calleeElement || isCallee) {
1908
+ const createdStanpshot = snapshot.snapshotId();
1909
+ ref.__currentSnapshot = createdStanpshot;
1910
+ return [createdStanpshot, element];
1911
+ }
1912
+ const snapshotOnCallee = calleeElement.__ref.__currentSnapshot;
1913
+ if (currentSnapshot < snapshotOnCallee) {
1914
+ return [snapshotOnCallee, calleeElement, true];
1915
+ }
1916
+ return [snapshotOnCallee, calleeElement];
1917
+ };
1918
+
1919
+ // ../../plugins/report/index.js
1920
+ var ERRORS_REGISTRY = {
1921
+ en: {
1922
+ DocumentNotDefined: {
1923
+ title: "Document is undefined",
1924
+ description: "To tweak with DOM, you should use browser."
1925
+ },
1926
+ OverwriteToBuiltin: {
1927
+ title: "Overwriting to builtin method",
1928
+ description: "Overwriting a builtin method in the window define is not possible, please choose different name"
1929
+ },
1930
+ BrowserNotDefined: {
1931
+ title: "Can't recognize environment",
1932
+ description: "Environment should be browser application, that can run Javascript"
1933
+ },
1934
+ SetQuickPreferancesIsNotObject: {
1935
+ title: "Quick preferances object is required",
1936
+ description: 'Please pass a plain object with "lang", "culture" and "area" properties'
1937
+ },
1938
+ InvalidParams: {
1939
+ title: "Params are invalid",
1940
+ description: 'Please pass a plain object with "lang", "culture" and "area" properties'
1941
+ },
1942
+ CantCreateWithoutNode: {
1943
+ title: "You must provide node",
1944
+ description: "Can't create DOM element without setting node or text"
1945
+ },
1946
+ HTMLInvalidTag: {
1947
+ title: "Element tag name (or DOM nodeName) is invalid",
1948
+ description: "To create element, you must provide valid DOM node. See full list of them at here: http://www.w3schools.com/tags/"
1949
+ },
1950
+ HTMLInvalidAttr: {
1951
+ title: "Attibutes object is invalid",
1952
+ description: "Please pass a valid plain object to apply as an attributes for a DOM node"
1953
+ },
1954
+ HTMLInvalidData: {
1955
+ title: "Data object is invalid",
1956
+ description: "Please pass a valid plain object to apply as an dataset for a DOM node"
1957
+ },
1958
+ HTMLInvalidStyles: {
1959
+ title: "Styles object is invalid",
1960
+ description: "Please pass a valid plain object to apply as an style for a DOM node"
1961
+ },
1962
+ HTMLInvalidText: {
1963
+ title: "Text string is invalid",
1964
+ description: "Please pass a valid string to apply text to DOM node"
1965
+ },
1966
+ ElementOnStateIsNotDefined: {
1967
+ title: "Element on state is not defined",
1968
+ description: "Please check the element object"
1969
+ }
1970
+ }
1971
+ };
1972
+ var report = (err, arg, element) => {
1973
+ const currentLang = "en";
1974
+ let errObj;
1975
+ if (err && typeof err === "string") errObj = ERRORS_REGISTRY[currentLang][err];
1976
+ const description = errObj ? `
1977
+
1978
+ ${errObj.description}` : "";
1979
+ const context = element ? `
1980
+
1981
+ ${element}` : "";
1982
+ return new Error(`"${err}", "${arg}"${description}${context}`);
1983
+ };
1984
+
1985
+ // ../element/dist/esm/tree.js
1986
+ var ROOT = {
1987
+ key: ":root",
1988
+ node: document2 ? document2.body : report("DocumentNotDefined", document2)
1989
+ };
1990
+ var TREE = ROOT;
1991
+
1992
+ // ../element/dist/esm/event/on.js
1993
+ var getOnOrPropsEvent2 = (param, element) => {
1994
+ const onEvent = element.on?.[param];
1995
+ if (onEvent) return onEvent;
1996
+ const props = element.props;
1997
+ if (!props) return;
1998
+ const propKey = "on" + param.charAt(0).toUpperCase() + param.slice(1);
1999
+ return props[propKey];
2000
+ };
2001
+ var registerNodeEvent = (param, element, node, options) => {
2002
+ const appliedFunction = getOnOrPropsEvent2(param, element);
2003
+ if (isFunction(appliedFunction)) {
2004
+ const { __ref: ref } = element;
2005
+ if (!ref.__eventListeners) ref.__eventListeners = {};
2006
+ if (ref.__eventListeners[param]) {
2007
+ node.removeEventListener(param, ref.__eventListeners[param]);
2008
+ }
2009
+ const handler = (event) => {
2010
+ const { state: state2, context } = element;
2011
+ const result = appliedFunction.call(
2012
+ element,
2013
+ event,
2014
+ element,
2015
+ state2,
2016
+ context,
2017
+ options
2018
+ );
2019
+ if (result && typeof result.then === "function") {
2020
+ result.catch(() => {
2021
+ });
2022
+ }
2023
+ };
2024
+ ref.__eventListeners[param] = handler;
2025
+ node.addEventListener(param, handler);
2026
+ }
2027
+ };
2028
+ var applyEventsOnNode = (element, options) => {
2029
+ const { node, on, props } = element;
2030
+ const handled = /* @__PURE__ */ new Set();
2031
+ for (const param in on) {
2032
+ if (DOMQL_EVENTS.has(param)) continue;
2033
+ handled.add(param);
2034
+ registerNodeEvent(param, element, node, options);
2035
+ }
2036
+ if (props) {
2037
+ for (const key in props) {
2038
+ if (key.length > 2 && key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && isFunction(props[key])) {
2039
+ const thirdChar = key[2];
2040
+ if (thirdChar !== thirdChar.toUpperCase()) continue;
2041
+ const eventName = thirdChar.toLowerCase() + key.slice(3);
2042
+ if (handled.has(eventName) || DOMQL_EVENTS.has(eventName)) continue;
2043
+ registerNodeEvent(eventName, element, node, options);
2044
+ }
2045
+ }
2046
+ }
2047
+ };
2048
+
2049
+ // ../element/dist/esm/event/can.js
2050
+ var canRenderTag = (tag) => {
2051
+ return isValidHtmlTag(tag || "div") || report("HTMLInvalidTag");
2052
+ };
2053
+
2054
+ // ../element/dist/esm/event/animationFrame.js
2055
+ var registerFrameListener = (el) => {
2056
+ if (!el || !el.__ref) {
2057
+ throw new Error("Element reference is invalid");
2058
+ }
2059
+ const { __ref: ref } = el;
2060
+ if (!ref.root) {
2061
+ throw new Error("Root reference is invalid");
2062
+ }
2063
+ if (!ref.root.data) {
2064
+ throw new Error("Data are undefined");
2065
+ }
2066
+ const { frameListeners } = ref.root.data;
2067
+ if (frameListeners && !frameListeners.has(el)) {
2068
+ frameListeners.add(el);
2069
+ }
2070
+ };
2071
+ var processFrameListeners = (frameListeners) => {
2072
+ for (const element of frameListeners) {
2073
+ if (!element.__ref.__frameHandler) {
2074
+ const handler = element.on?.frame || element.onFrame || element.props?.onFrame;
2075
+ if (handler) element.__ref.__frameHandler = handler;
2076
+ else {
2077
+ frameListeners.delete(element);
2078
+ continue;
2079
+ }
2080
+ }
2081
+ if (!element.node?.parentNode) {
2082
+ frameListeners.delete(element);
2083
+ delete element.__ref.__frameHandler;
2084
+ } else {
2085
+ try {
2086
+ element.__ref.__frameHandler(element, element.state, element.context);
2087
+ } catch (e) {
2088
+ console.warn(e);
2089
+ frameListeners.delete(element);
2090
+ delete element.__ref.__frameHandler;
2091
+ }
2092
+ }
2093
+ }
2094
+ };
2095
+ var startFrameLoop = (frameListeners) => {
2096
+ if (_frameRunning) return;
2097
+ _frameRunning = true;
2098
+ function requestFrame() {
2099
+ if (frameListeners.size === 0) {
2100
+ _frameRunning = false;
2101
+ return;
2102
+ }
2103
+ processFrameListeners(frameListeners);
2104
+ window.requestAnimationFrame(requestFrame);
2105
+ }
2106
+ window.requestAnimationFrame(requestFrame);
2107
+ };
2108
+ var applyAnimationFrame = (element) => {
2109
+ if (!element) {
2110
+ throw new Error("Element is invalid");
2111
+ }
2112
+ const { on, props, __ref: ref } = element;
2113
+ if (!ref.root || !ref.root.data) return;
2114
+ const { frameListeners } = ref.root.data;
2115
+ if (frameListeners && (on?.frame || element.onFrame || props?.onFrame)) {
2116
+ registerFrameListener(element);
2117
+ startFrameLoop(frameListeners);
2118
+ }
2119
+ };
2120
+ var _frameRunning = false;
2121
+
2122
+ // ../element/dist/esm/utils/propEvents.js
2123
+ var propagateEventsFromProps = (element) => {
2124
+ const { props, on } = element;
2125
+ for (const v in props) {
2126
+ if (v.charCodeAt(0) !== 111 || v.charCodeAt(1) !== 110) continue;
2127
+ const eventName = lowercaseFirstLetter(v.slice(2));
2128
+ const origEvent = on[eventName];
2129
+ const funcFromProps = props[v];
2130
+ if (isFunction(origEvent)) {
2131
+ on[eventName] = (...args) => {
2132
+ const originalEventRetunrs = origEvent(...args);
2133
+ if (originalEventRetunrs !== false) return funcFromProps(...args);
2134
+ };
2135
+ } else on[eventName] = funcFromProps;
2136
+ }
2137
+ };
2138
+ var propagateEventsFromElement = (element) => {
2139
+ const { on } = element;
2140
+ for (const param in element) {
2141
+ if (param.charCodeAt(0) !== 111 || param.charCodeAt(1) !== 110 || !Object.prototype.hasOwnProperty.call(element, param)) continue;
2142
+ const fn = element[param];
2143
+ if (!isFunction(fn)) continue;
2144
+ const eventName = lowercaseFirstLetter(param.slice(2));
2145
+ const origEvent = on[eventName];
2146
+ if (isFunction(origEvent)) {
2147
+ on[eventName] = (...args) => {
2148
+ const ret = origEvent(...args);
2149
+ if (ret !== false) return fn(...args);
2150
+ };
2151
+ } else on[eventName] = fn;
2152
+ }
2153
+ };
2154
+
2155
+ // ../element/dist/esm/render/cache.js
2156
+ var SVG_NS = "http://www.w3.org/2000/svg";
2157
+ var createHTMLNode = (element) => {
2158
+ const { tag, context } = element;
2159
+ const doc = context.document || document2;
2160
+ if (tag) {
2161
+ if (tag === "string") return doc.createTextNode(element.text);
2162
+ else if (tag === "fragment") {
2163
+ return doc.createDocumentFragment();
2164
+ } else if (SVG_TAGS.has(tag)) {
2165
+ if (tag === "svg" || element.parent?.node?.namespaceURI === SVG_NS) {
2166
+ return doc.createElementNS(SVG_NS, tag);
2167
+ }
2168
+ return doc.createElement(tag);
2169
+ } else return doc.createElement(tag);
2170
+ } else {
2171
+ return doc.createElement("div");
2172
+ }
2173
+ };
2174
+ var detectTag = (element) => {
2175
+ let { tag, key, props } = element;
2176
+ tag = exec(tag, element);
2177
+ if (tag === true) tag = key;
2178
+ if (isObject(props) && isString(props.tag)) {
2179
+ const tagExists = isValidHtmlTag(props.tag);
2180
+ if (tagExists) return props.tag;
2181
+ }
2182
+ if (isString(tag)) {
2183
+ if (isValidHtmlTag(tag)) return tag;
2184
+ } else {
2185
+ let keyAsTag = key.toLowerCase();
2186
+ if (keyAsTag.includes(".")) keyAsTag = keyAsTag.split(".")[0];
2187
+ if (keyAsTag.includes("_")) keyAsTag = keyAsTag.split("_")[0];
2188
+ if (isValidHtmlTag(keyAsTag)) return keyAsTag;
2189
+ }
2190
+ return "div";
2191
+ };
2192
+ var cacheNode = (element) => {
2193
+ const { context } = element;
2194
+ const win = context.window || window;
2195
+ const tag = element.tag = detectTag(element);
2196
+ if (!canRenderTag(tag)) {
2197
+ return report("HTMLInvalidTag", element.tag, element);
2198
+ }
2199
+ if (!win.nodeCaches) win.nodeCaches = {};
2200
+ const isSvgContext = SVG_TAGS.has(tag) && (tag === "svg" || element.parent?.node?.namespaceURI === SVG_NS);
2201
+ const cacheKey = isSvgContext ? "svg:" + tag : tag;
2202
+ let cachedTag = win.nodeCaches[cacheKey];
2203
+ if (!cachedTag) cachedTag = win.nodeCaches[cacheKey] = createHTMLNode(element);
2204
+ const clonedNode = cachedTag.cloneNode(true);
2205
+ if (tag === "string") clonedNode.nodeValue = element.text;
2206
+ return clonedNode;
2207
+ };
2208
+
2209
+ // ../element/dist/esm/render/append.js
2210
+ var appendNode = (node, parentNode) => {
2211
+ try {
2212
+ parentNode.appendChild(node);
2213
+ return node;
2214
+ } catch (e) {
2215
+ console.error("Does not support to append", parentNode, node);
2216
+ }
2217
+ };
2218
+ var insertNodeAfter = (node, siblingNode, parentNode) => {
2219
+ if (!node) {
2220
+ throw new Error("Node is required");
2221
+ }
2222
+ const parent = parentNode || siblingNode?.parentNode;
2223
+ if (siblingNode?.nextSibling) {
2224
+ parent?.insertBefore(node, siblingNode.nextSibling);
2225
+ } else if (siblingNode?.insertAdjacentElement) {
2226
+ siblingNode.insertAdjacentElement("afterend", node);
2227
+ } else {
2228
+ parent?.insertBefore(node, siblingNode);
2229
+ }
2230
+ };
2231
+ var insertNodeBefore = (node, siblingNode, parentNode) => {
2232
+ if (!node) {
2233
+ throw new Error("Node is required");
2234
+ }
2235
+ const parent = parentNode || siblingNode.parentNode;
2236
+ parent?.insertBefore(node, siblingNode);
2237
+ };
2238
+ var assignNode = (element, parent, key, attachOptions) => {
2239
+ if (!element) {
2240
+ throw new Error("Element is required");
2241
+ }
2242
+ if (!parent) {
2243
+ throw new Error("Parent is required");
2244
+ }
2245
+ parent[key || element.key] = element;
2246
+ if (element.tag !== "shadow") {
2247
+ if (attachOptions && attachOptions.position) {
2248
+ ;
2249
+ (attachOptions.position === "before" ? insertNodeBefore : insertNodeAfter)(element.node, attachOptions.node || parent.node);
2250
+ } else {
2251
+ appendNode(element.node, parent.node, element);
2252
+ }
2253
+ }
2254
+ return element;
2255
+ };
2256
+
2257
+ // ../element/dist/esm/iterate.js
2258
+ var throughInitialExec = (element, exclude = {}) => {
2259
+ const { __ref: ref } = element;
2260
+ for (const param in element) {
2261
+ if (exclude[param]) continue;
2262
+ const prop = element[param];
2263
+ if (isFunction(prop) && !isMethod(param, element)) {
2264
+ ref.__exec[param] = prop;
2265
+ const result = prop(element, element.state, element.context);
2266
+ if (result && typeof result.then === "function") {
2267
+ result.then((resolved) => {
2268
+ element[param] = resolved;
2269
+ });
2270
+ } else {
2271
+ element[param] = result;
2272
+ }
2273
+ }
2274
+ }
2275
+ };
2276
+ var throughUpdatedExec = (element, options = {}) => {
2277
+ const { __ref: ref } = element;
2278
+ const changes = {};
2279
+ for (const param in ref.__exec) {
2280
+ const prop = element[param];
2281
+ const isDefinedParam = ref.__defineCache[param];
2282
+ if (isDefinedParam) continue;
2283
+ const newExec = ref.__exec[param](element, element.state, element.context);
2284
+ if (newExec && typeof newExec.then === "function") {
2285
+ newExec.then((resolved) => {
2286
+ element[param] = resolved;
2287
+ });
2288
+ continue;
2289
+ }
2290
+ const execReturnsString = isString(newExec) || isNumber(newExec);
2291
+ if (prop?.node && execReturnsString) {
2292
+ overwrite(prop, { text: newExec });
2293
+ } else if (newExec !== prop) {
2294
+ if (matchesComponentNaming(param)) {
2295
+ const { extends: extend, ...newElem } = isContextComponent(
2296
+ newExec,
2297
+ element,
2298
+ param
2299
+ );
2300
+ overwrite(prop, newElem);
2301
+ } else {
2302
+ changes[param] = prop;
2303
+ element[param] = newExec;
2304
+ }
2305
+ }
2306
+ }
2307
+ return changes;
2308
+ };
2309
+ var throughExecProps = (element) => {
2310
+ const { __ref: ref } = element;
2311
+ const { props } = element;
2312
+ for (const k in props) {
2313
+ const c0 = k.charCodeAt(0);
2314
+ const c1 = k.charCodeAt(1);
2315
+ const isDefine = c0 === 105 && c1 === 115 || // 'is'
2316
+ c0 === 104 && c1 === 97 && k.charCodeAt(2) === 115 || // 'has'
2317
+ c0 === 117 && c1 === 115 && k.charCodeAt(2) === 101;
2318
+ const cachedExecProp = ref.__execProps[k];
2319
+ if (isFunction(cachedExecProp)) {
2320
+ const result = exec(cachedExecProp, element);
2321
+ if (result && typeof result.then === "function") {
2322
+ result.then((resolved) => {
2323
+ props[k] = resolved;
2324
+ });
2325
+ } else {
2326
+ props[k] = result;
2327
+ }
2328
+ } else if (isDefine && isFunction(props[k])) {
2329
+ ref.__execProps[k] = props[k];
2330
+ const result = exec(props[k], element);
2331
+ if (result && typeof result.then === "function") {
2332
+ result.then((resolved) => {
2333
+ props[k] = resolved;
2334
+ });
2335
+ } else {
2336
+ props[k] = result;
2337
+ }
2338
+ }
2339
+ }
2340
+ };
2341
+ var throughInitialDefine = (element) => {
2342
+ const { define, context, __ref: ref } = element;
2343
+ const hasLocalDefine = isObject(define);
2344
+ const hasGlobalDefine = context && isObject(context.define);
2345
+ if (!hasLocalDefine && !hasGlobalDefine) return element;
2346
+ const defineObj = hasLocalDefine && hasGlobalDefine ? { ...define, ...context.define } : hasLocalDefine ? define : context.define;
2347
+ for (const param in defineObj) {
2348
+ let elementProp = element[param];
2349
+ if (isFunction(elementProp) && !isMethod(param, element)) {
2350
+ ref.__exec[param] = elementProp;
2351
+ let execParam2 = exec(elementProp, element);
2352
+ if (execParam2 && typeof execParam2.then === "function") {
2353
+ execParam2.then((resolved) => {
2354
+ elementProp = element[param] = resolved && resolved.parse ? resolved.parse() : resolved;
2355
+ if (resolved) {
2356
+ ref.__defineCache[param] = elementProp;
2357
+ }
2358
+ });
2359
+ } else {
2360
+ elementProp = element[param] = execParam2 && execParam2.parse ? execParam2.parse() : execParam2;
2361
+ if (execParam2) {
2362
+ ref.__defineCache[param] = elementProp;
2363
+ }
2364
+ }
2365
+ }
2366
+ const execParam = defineObj[param](
2367
+ elementProp,
2368
+ element,
2369
+ element.state,
2370
+ element.context
2371
+ );
2372
+ if (execParam && typeof execParam.then === "function") {
2373
+ execParam.then((resolved) => {
2374
+ if (resolved) element[param] = resolved;
2375
+ });
2376
+ } else if (execParam) {
2377
+ element[param] = execParam;
2378
+ }
2379
+ }
2380
+ return element;
2381
+ };
2382
+ var throughUpdatedDefine = (element) => {
2383
+ const { context, define, __ref: ref } = element;
2384
+ const hasLocalDefine = isObject(define);
2385
+ const hasGlobalDefine = isObject(context?.define);
2386
+ if (!hasLocalDefine && !hasGlobalDefine) return;
2387
+ const obj = hasLocalDefine && hasGlobalDefine ? { ...define, ...context.define } : hasLocalDefine ? define : context.define;
2388
+ for (const param in obj) {
2389
+ const execParam = ref.__exec[param];
2390
+ if (execParam) {
2391
+ const result = execParam(element, element.state, element.context);
2392
+ if (result && typeof result.then === "function") {
2393
+ result.then((resolved) => {
2394
+ ref.__defineCache[param] = resolved;
2395
+ });
2396
+ } else {
2397
+ ref.__defineCache[param] = result;
2398
+ }
2399
+ }
2400
+ const cached = exec(ref.__defineCache[param], element);
2401
+ if (cached && typeof cached.then === "function") {
2402
+ cached.then((resolved) => {
2403
+ });
2404
+ continue;
2405
+ }
2406
+ const newExecParam = typeof obj[param] === "function" ? obj[param](cached, element, element.state, element.context) : void 0;
2407
+ if (newExecParam && typeof newExecParam.then === "function") {
2408
+ newExecParam.then((resolved) => {
2409
+ element[param] = resolved;
2410
+ });
2411
+ } else if (newExecParam) {
2412
+ element[param] = newExecParam;
2413
+ }
2414
+ }
2415
+ };
2416
+
2417
+ // ../element/dist/esm/mixins/attr.js
2418
+ function attr(params, element, node) {
2419
+ const { __ref: ref, props } = element;
2420
+ const { __attr } = ref;
2421
+ if (isNot(params)("object")) report("HTMLInvalidAttr", params);
2422
+ if (params) {
2423
+ const attrs = exec(params, element);
2424
+ if (props.attr) deepMerge(attrs, props.attr);
2425
+ for (const attr2 in attrs) {
2426
+ const val = exec(attrs[attr2], element);
2427
+ if (val === __attr[attr2]) continue;
2428
+ if (val !== false && val !== void 0 && val !== null && node.setAttribute) {
2429
+ node.setAttribute(attr2, val);
2430
+ } else if (node.removeAttribute) node.removeAttribute(attr2);
2431
+ __attr[attr2] = val;
2432
+ }
2433
+ }
2434
+ }
2435
+
2436
+ // ../element/dist/esm/mixins/classList.js
2437
+ var assignKeyAsClassname = (element) => {
2438
+ const { key } = element;
2439
+ if (element.classlist === true) element.classlist = key;
2440
+ else if (!element.classlist && typeof key === "string" && key.charAt(0) === "_" && key.charAt(1) !== "_") {
2441
+ element.classlist = key.slice(1);
2442
+ }
2443
+ };
2444
+ var classify = (obj, element) => {
2445
+ let className = "";
2446
+ for (const item in obj) {
2447
+ const param = obj[item];
2448
+ if (typeof param === "boolean" && param) className += ` ${item}`;
2449
+ else if (typeof param === "string") className += ` ${param}`;
2450
+ else if (typeof param === "function") {
2451
+ className += ` ${exec(param, element)}`;
2452
+ }
2453
+ }
2454
+ return className;
2455
+ };
2456
+ var classList = (params, element) => {
2457
+ if (!params) return;
2458
+ const { key } = element;
2459
+ if (params === true) params = element.classlist = { key };
2460
+ if (isString(params)) params = element.classlist = { default: params };
2461
+ if (isObject(params)) params = classify(params, element);
2462
+ const className = params.replace(/\s+/g, " ").trim();
2463
+ return className;
2464
+ };
2465
+
2466
+ // ../element/dist/esm/mixins/data.js
2467
+ function data(params, element, node) {
2468
+ if (params) {
2469
+ if (element.props.data) deepMerge(params, element.props.data);
2470
+ if (params.showOnNode) {
2471
+ if (!isObject(params)) report("HTMLInvalidData", params);
2472
+ for (const dataset in params) {
2473
+ if (dataset !== "showOnNode") {
2474
+ node.dataset[dataset] = exec(params[dataset], element);
2475
+ }
2476
+ }
2477
+ }
2478
+ }
2479
+ }
2480
+ var data_default = data;
2481
+
2482
+ // ../element/dist/esm/mixins/html.js
2483
+ function html(param, element, node) {
2484
+ const prop = exec(element?.props?.html || param, element);
2485
+ const { __ref } = element;
2486
+ if (prop !== __ref.__html) {
2487
+ if (node.nodeName === "SVG") node.textContent = prop;
2488
+ else node.innerHTML = prop;
2489
+ __ref.__html = prop;
2490
+ }
2491
+ }
2492
+ var html_default = html;
2493
+
2494
+ // ../element/dist/esm/mixins/style.js
2495
+ function style(params, element, node) {
2496
+ if (params) {
2497
+ if (isObject(params)) {
2498
+ const { __ref } = element;
2499
+ if (!__ref.__style) __ref.__style = {};
2500
+ const cache = __ref.__style;
2501
+ for (const prop in params) {
2502
+ const val = exec(params[prop], element);
2503
+ if (val === cache[prop]) continue;
2504
+ cache[prop] = val;
2505
+ node.style[prop] = val;
2506
+ }
2507
+ } else report("HTMLInvalidStyles", params);
2508
+ }
2509
+ }
2510
+ var style_default = style;
2511
+
2512
+ // ../element/dist/esm/mixins/text.js
2513
+ function text(param, element, node) {
2514
+ let prop = exec(element.props.text || param, element);
2515
+ if (isString(prop) && prop.includes("{{")) {
2516
+ prop = element.call("replaceLiteralsWithObjectFields", prop, element.state);
2517
+ }
2518
+ if (element.tag === "string") {
2519
+ node.nodeValue = prop;
2520
+ } else if (param !== void 0 && param !== null) {
2521
+ if (SVG_TAGS.has(element.tag)) {
2522
+ if (node) node.textContent = prop;
2523
+ return;
2524
+ }
2525
+ if (element.__text) {
2526
+ if (element.__text.text === prop) return;
2527
+ element.__text.text = prop;
2528
+ if (element.__text.node) element.__text.node.nodeValue = prop;
2529
+ } else create({ tag: "string", text: prop }, element, "__text");
2530
+ }
2531
+ }
2532
+ var text_default = text;
2533
+
2534
+ // ../element/dist/esm/mixins/state.js
2535
+ function state(params, element, node) {
2536
+ const state2 = exec(params, element);
2537
+ if (isObject(state2)) {
2538
+ for (const param in state2) {
2539
+ if (STATE_METHODS.has(param)) continue;
2540
+ if (!Object.prototype.hasOwnProperty.call(state2, param)) continue;
2541
+ }
2542
+ }
2543
+ return element;
2544
+ }
2545
+ var state_default = state;
2546
+
2547
+ // ../element/dist/esm/mixins/scope.js
2548
+ function scope(params, element, node) {
2549
+ if (!isObject(params)) return;
2550
+ for (const scopeItem in params) {
2551
+ const value = params[scopeItem];
2552
+ if (isFunction(value)) {
2553
+ element.scope[scopeItem] = value.bind(element);
2554
+ } else {
2555
+ element.scope[scopeItem] = value;
2556
+ }
2557
+ }
2558
+ }
2559
+ var scope_default = scope;
2560
+
2561
+ // ../element/dist/esm/mixins/registry.js
2562
+ var REGISTRY = {
2563
+ attr,
2564
+ style: style_default,
2565
+ text: text_default,
2566
+ html: html_default,
2567
+ data: data_default,
2568
+ classlist: classList,
2569
+ state: state_default,
2570
+ scope: scope_default,
2571
+ deps: (param, el) => param || el.parent.deps,
2572
+ extends: {},
2573
+ children: {},
2574
+ content: {},
2575
+ childExtends: {},
2576
+ childExtendsRecursive: {},
2577
+ props: {},
2578
+ if: {},
2579
+ define: {},
2580
+ __name: {},
2581
+ __ref: {},
2582
+ __hash: {},
2583
+ __text: {},
2584
+ key: {},
2585
+ tag: {},
2586
+ query: {},
2587
+ parent: {},
2588
+ node: {},
2589
+ variables: {},
2590
+ on: {},
2591
+ component: {},
2592
+ context: {}
2593
+ };
2594
+
2595
+ // ../element/dist/esm/utils/applyParam.js
2596
+ var applyParam = (param, element, options) => {
2597
+ const { node, context, __ref: ref } = element;
2598
+ const prop = exec(element[param], element);
2599
+ const { onlyUpdate } = options;
2600
+ const DOMQLProperty = REGISTRY[param];
2601
+ const DOMQLPropertyFromContext = context?.registry?.[param];
2602
+ const isGlobalTransformer = DOMQLPropertyFromContext || DOMQLProperty;
2603
+ const hasDefine = element.define?.[param];
2604
+ const hasContextDefine = context?.define?.[param];
2605
+ if (!ref.__if) return;
2606
+ const hasOnlyUpdate = onlyUpdate ? onlyUpdate === param || element.lookup(onlyUpdate) : true;
2607
+ if (isGlobalTransformer && !hasContextDefine && hasOnlyUpdate) {
2608
+ if (isFunction(isGlobalTransformer)) {
2609
+ isGlobalTransformer(prop, element, node, options);
2610
+ }
2611
+ return;
2612
+ }
2613
+ return { hasDefine, hasContextDefine };
2614
+ };
2615
+
2616
+ // ../element/dist/esm/children.js
2617
+ var shallowChildrenEqual = (a, b) => {
2618
+ if (a === b) return true;
2619
+ if (!a || !b) return false;
2620
+ if (isArray(a) && isArray(b)) {
2621
+ if (a.length !== b.length) return false;
2622
+ for (let i = 0; i < a.length; i++) {
2623
+ if (a[i] !== b[i]) return false;
2624
+ }
2625
+ return true;
2626
+ }
2627
+ if (isObject(a) && isObject(b)) {
2628
+ const keysA = Object.keys(a);
2629
+ const keysB = Object.keys(b);
2630
+ if (keysA.length !== keysB.length) return false;
2631
+ for (let i = 0; i < keysA.length; i++) {
2632
+ const key = keysA[i];
2633
+ if (a[key] !== b[key]) return false;
2634
+ }
2635
+ return true;
2636
+ }
2637
+ return a === b;
2638
+ };
2639
+ function setChildren(param, element, opts) {
2640
+ let { children, __ref: ref, state: state2 } = element;
2641
+ let { childrenAs } = element.props || {};
2642
+ let execParam = exec(param, element, state2);
2643
+ let execChildren = exec(children, element, state2);
2644
+ children = execParam || execChildren;
2645
+ if (children) {
2646
+ if (isState(children)) children = children.parse();
2647
+ if (isString(children) || isNumber(children)) {
2648
+ if (children === "state") children = state2.parse();
2649
+ else {
2650
+ const pathInState = getChildStateInKey(children, state2);
2651
+ if (pathInState) {
2652
+ childrenAs = "state";
2653
+ children = getChildStateInKey(children, state2) || { value: children };
2654
+ } else {
2655
+ children = { text: children };
2656
+ }
2657
+ }
2658
+ }
2659
+ if (isObject(children)) {
2660
+ if (children.$$typeof) {
2661
+ return element.call("renderReact", children, element);
2662
+ }
2663
+ children = Object.keys(children).map((v) => {
2664
+ const val = children[v];
2665
+ if (matchesComponentNaming(v)) return concatAddExtends(v, val);
2666
+ return val;
2667
+ });
2668
+ }
2669
+ }
2670
+ if (!children || isNot(children)("array", "object")) return;
2671
+ if (isArray(children) && children.some((v) => v?.$$typeof)) {
2672
+ const filterReact = [];
2673
+ const reactComponents = [];
2674
+ for (let i = 0; i < children.length; i++) {
2675
+ if (children[i]?.$$typeof) reactComponents.push(children[i]);
2676
+ else filterReact.push(children[i]);
2677
+ }
2678
+ if (reactComponents.length) {
2679
+ element.call("renderReact", reactComponents, element);
2680
+ }
2681
+ children = filterReact;
2682
+ }
2683
+ let cloned;
2684
+ if (ref.__childrenCache) {
2685
+ if (shallowChildrenEqual(children, ref.__childrenCache)) {
2686
+ ref.__noChildrenDifference = true;
2687
+ } else {
2688
+ cloned = deepClone(children);
2689
+ ref.__childrenCache = cloned;
2690
+ delete ref.__noChildrenDifference;
2691
+ }
2692
+ } else {
2693
+ cloned = deepClone(children);
2694
+ ref.__childrenCache = cloned;
2695
+ }
2696
+ if (isObject(children) || isArray(children)) {
2697
+ children = cloned || deepClone(children);
2698
+ }
2699
+ const content = { tag: "fragment" };
2700
+ for (const key in children) {
2701
+ const value = Object.prototype.hasOwnProperty.call(children, key) && children[key];
2702
+ if (isDefined(value) && value !== null && value !== false) {
2703
+ content[key] = isObjectLike(value) ? childrenAs ? { [childrenAs]: value } : value : childrenAs ? { [childrenAs]: childrenAs === "state" ? { value } : { text: value } } : { text: value };
2704
+ }
2705
+ }
2706
+ return content;
2707
+ }
2708
+ var children_default = setChildren;
2709
+
2710
+ // ../element/dist/esm/set.js
2711
+ var setContentKey = (element, opts = {}) => {
2712
+ const { __ref: ref } = element;
2713
+ const contentElementKey = opts.contentElementKey;
2714
+ if (!ref.contentElementKey || contentElementKey !== ref.contentElementKey) {
2715
+ ref.contentElementKey = contentElementKey || "content";
2716
+ }
2717
+ return ref.contentElementKey;
2718
+ };
2719
+ function reset(options) {
2720
+ const element = this;
2721
+ create(element, element.parent, void 0, {
2722
+ ignoreChildExtends: true,
2723
+ ...OPTIONS.defaultOptions,
2724
+ ...OPTIONS.create,
2725
+ ...options
2726
+ });
2727
+ }
2728
+ var resetContent = (params, element, opts) => {
2729
+ const contentElementKey = setContentKey(element, opts);
2730
+ if (element[contentElementKey]?.node) removeContent(element, opts);
2731
+ const contentElem = create(params, element, contentElementKey || "content", {
2732
+ ignoreChildExtends: true,
2733
+ ...OPTIONS.defaultOptions,
2734
+ ...OPTIONS.create,
2735
+ ...opts
2736
+ });
2737
+ if (contentElementKey !== "content") opts.contentElementKey = "content";
2738
+ return contentElem;
2739
+ };
2740
+ var updateContent = function(params, opts) {
2741
+ const element = this;
2742
+ const contentElementKey = setContentKey(element, opts);
2743
+ if (!element[contentElementKey]) return;
2744
+ if (element[contentElementKey].update) {
2745
+ element[contentElementKey].update(params, opts);
2746
+ }
2747
+ };
2748
+ function setContent(param, element, opts) {
2749
+ const content = exec(param, element);
2750
+ if (content && element) {
2751
+ set.call(element, content, opts);
2752
+ }
2753
+ }
2754
+ var removeContent = function(el, opts = {}) {
2755
+ const element = el || this;
2756
+ const contentElementKey = setContentKey(element, opts);
2757
+ if (opts.contentElementKey !== "content") {
2758
+ opts.contentElementKey = "content";
2759
+ }
2760
+ const content = element[contentElementKey];
2761
+ if (!content) return;
2762
+ if (content.tag === "fragment" && content.__ref?.__children) {
2763
+ const __children = content.__ref.__children;
2764
+ for (let i = 0; i < __children.length; i++) {
2765
+ const child = content[__children[i]];
2766
+ if (child.node && child.node.parentNode) {
2767
+ child.node.parentNode.removeChild(child.node);
2768
+ }
2769
+ if (isFunction(child.remove)) {
2770
+ child.remove();
2771
+ }
2772
+ }
2773
+ } else {
2774
+ if (content.node && content.node.parentNode) {
2775
+ content.node.parentNode.removeChild(content.node);
2776
+ }
2777
+ if (isFunction(content.remove)) {
2778
+ content.remove();
2779
+ }
2780
+ }
2781
+ delete element[contentElementKey];
2782
+ };
2783
+ var set = function(params, options = {}, el) {
2784
+ const element = el || this;
2785
+ const { __ref: ref } = element;
2786
+ const contentElementKey = setContentKey(element, options);
2787
+ const content = element[contentElementKey];
2788
+ const __contentRef = content && content.__ref;
2789
+ const lazyLoad = element.props && element.props.lazyLoad;
2790
+ const hasChildren = element.children;
2791
+ if (options.preventContentUpdate === true && !hasChildren) return;
2792
+ const childHasChanged = !ref.__noChildrenDifference;
2793
+ const childrenIsDifferentFromCache = childHasChanged && __contentRef && Object.keys(params).length === Object.keys(content).length && deepContains(params, content);
2794
+ if (content?.update && !childHasChanged && !childrenIsDifferentFromCache) {
2795
+ if (!options.preventBeforeUpdateListener && !options.preventListeners) {
2796
+ const beforeUpdateReturns = triggerEventOnUpdate(
2797
+ "beforeUpdate",
2798
+ params,
2799
+ element,
2800
+ options
2801
+ );
2802
+ if (beforeUpdateReturns === false) return element;
2803
+ }
2804
+ content.update(params);
2805
+ if (!options.preventUpdateListener && !options.preventListeners) {
2806
+ triggerEventOn("update", element, options);
2807
+ }
2808
+ return;
2809
+ }
2810
+ if (!params) return element;
2811
+ let { childExtends, props, tag } = params;
2812
+ if (!props) props = params.props = {};
2813
+ if (tag === "fragment") {
2814
+ if (!childExtends && element.childExtends) {
2815
+ params.childExtends = element.childExtends;
2816
+ props.ignoreChildExtends = true;
2817
+ }
2818
+ if (!props?.childProps && element.props?.childProps) {
2819
+ props.childProps = element.props.childProps;
2820
+ props.ignoreChildProps = true;
2821
+ }
2822
+ }
2823
+ if (lazyLoad) {
2824
+ window.requestAnimationFrame(() => {
2825
+ resetContent(params, element, options);
2826
+ if (!options.preventUpdateListener) {
2827
+ triggerEventOn("lazyLoad", element, options);
2828
+ }
2829
+ });
2830
+ } else {
2831
+ resetContent(params, element, options);
2832
+ }
2833
+ };
2834
+
2835
+ // ../element/dist/esm/node.js
2836
+ var ENV5 = process.env.NODE_ENV;
2837
+ var createNode = (element, opts) => {
2838
+ let { node, tag, __ref: ref } = element;
2839
+ if (!ref.__if) return element;
2840
+ let isNewNode;
2841
+ if (!node) {
2842
+ isNewNode = true;
2843
+ if (tag === "shadow") {
2844
+ node = element.node = element.parent.node.attachShadow({ mode: "open" });
2845
+ } else node = element.node = cacheNode(element);
2846
+ triggerEventOn("attachNode", element, opts);
2847
+ }
2848
+ if (ENV5 === "test" || ENV5 === "development" || opts.alowRefReference) {
2849
+ node.ref = element;
2850
+ if (isFunction(node.setAttribute)) node.setAttribute("key", element.key);
2851
+ }
2852
+ throughExecProps(element);
2853
+ throughInitialDefine(element);
2854
+ throughInitialExec(element);
2855
+ propagateEventsFromProps(element);
2856
+ propagateEventsFromElement(element);
2857
+ applyEventsOnNode(element, { isNewNode, ...opts });
2858
+ for (const param in element) {
2859
+ const value = element[param];
2860
+ if (!Object.prototype.hasOwnProperty.call(element, param) || value === void 0 || isMethod(param, element) || isObject(REGISTRY[param]) || param.length > 2 && param.charCodeAt(0) === 111 && param.charCodeAt(1) === 110 && param.charCodeAt(2) >= 65 && param.charCodeAt(2) <= 90) {
2861
+ continue;
2862
+ }
2863
+ const isElement = applyParam(param, element, opts);
2864
+ if (isElement) {
2865
+ const { hasDefine, hasContextDefine } = isElement;
2866
+ if (element[param] && !hasDefine && !hasContextDefine) {
2867
+ const createAsync = () => {
2868
+ create(value, element, param, opts);
2869
+ };
2870
+ if (element.props && element.props.lazyLoad || opts.lazyLoad) {
2871
+ window.requestAnimationFrame(() => {
2872
+ createAsync();
2873
+ if (!opts.preventUpdateListener) {
2874
+ triggerEventOn("lazyLoad", element, opts);
2875
+ }
2876
+ });
2877
+ } else createAsync();
2878
+ }
2879
+ }
2880
+ }
2881
+ const content = element.children ? children_default(element.children, element, opts) : element.children || element.content;
2882
+ if (content) {
2883
+ setContent(content, element, opts);
2884
+ }
2885
+ return element;
2886
+ };
2887
+
2888
+ // ../state/dist/esm/updateState.js
2889
+ var STATE_UPDATE_OPTIONS = {
2890
+ overwrite: true,
2891
+ preventHoistElementUpdate: false,
2892
+ updateByState: true,
2893
+ isHoisted: true,
2894
+ execStateFunction: true
2895
+ };
2896
+ var updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
2897
+ const state2 = this;
2898
+ const element = state2.__element;
2899
+ if (options.onEach) options.onEach(element, state2, element.context, options);
2900
+ if (!options.updateByState) merge(options, STATE_UPDATE_OPTIONS);
2901
+ if (!state2.__element) report("ElementOnStateIsNotDefined");
2902
+ if (options.preventInheritAtCurrentState === true) {
2903
+ options.preventInheritAtCurrentState = state2;
2904
+ } else if (options.preventInheritAtCurrentState) return;
2905
+ if (!options.preventBeforeStateUpdateListener) {
2906
+ const beforeStateUpdateReturns = triggerEventOnUpdate(
2907
+ "beforeStateUpdate",
2908
+ obj,
2909
+ element,
2910
+ options
2911
+ );
2912
+ if (beforeStateUpdateReturns === false) return element;
2913
+ }
2914
+ overwriteState(state2, obj, options);
2915
+ const updateIsHoisted = hoistStateUpdate(state2, obj, options);
2916
+ if (updateIsHoisted) return state2;
2917
+ updateDependentState(state2, obj, options);
2918
+ applyElementUpdate(state2, obj, options);
2919
+ if (!options.preventStateUpdateListener) {
2920
+ triggerEventOnUpdate("stateUpdate", obj, element, options);
2921
+ }
2922
+ return state2;
2923
+ };
2924
+ var hoistStateUpdate = (state2, obj, options) => {
2925
+ const element = state2.__element;
2926
+ const { parent, __ref: ref } = element;
2927
+ const stateKey = ref?.__state;
2928
+ const stateType = ref?.__stateType;
2929
+ if (!stateKey) return;
2930
+ const asksForInherit = checkIfInherits(element);
2931
+ const inheritedState = findInheritedState(element, parent, {
2932
+ returnParent: true
2933
+ });
2934
+ const shouldPropagateState = asksForInherit && inheritedState && !options.stopStatePropagation;
2935
+ if (!shouldPropagateState) return;
2936
+ const isStringState = stateType === "string" || stateType === "number" || stateType === "boolean";
2937
+ const value = isStringState ? state2.value : state2.parse();
2938
+ const passedValue = isStringState ? state2.value : obj;
2939
+ const findRootState = getRootStateInKey(stateKey, parent.state);
2940
+ const findGrandParentState = getParentStateInKey(stateKey, parent.state);
2941
+ const changesValue = createNestedObjectByKeyPath(stateKey, passedValue);
2942
+ const targetParent = findRootState || findGrandParentState || parent.state;
2943
+ if (options.replace) overwriteDeep(targetParent, changesValue || value);
2944
+ targetParent.update(changesValue, {
2945
+ execStateFunction: false,
2946
+ isHoisted: true,
2947
+ preventUpdate: options.preventHoistElementUpdate,
2948
+ overwrite: !options.replace,
2949
+ ...options
2950
+ });
2951
+ const hasNotUpdated = options.preventUpdate !== true || !options.preventHoistElementUpdate;
2952
+ if (!options.preventStateUpdateListener && hasNotUpdated) {
2953
+ triggerEventOnUpdate("stateUpdate", obj, element, options);
2954
+ }
2955
+ return true;
2956
+ };
2957
+ var updateDependentState = (state2, obj, options) => {
2958
+ if (!state2.__depends) return;
2959
+ for (const el in state2.__depends) {
2960
+ const dependentState = state2.__depends[el];
2961
+ const cleanState = dependentState.clean();
2962
+ cleanState.update(state2.parse(), options);
2963
+ }
2964
+ };
2965
+ var applyElementUpdate = (state2, obj, options) => {
2966
+ const element = state2.__element;
2967
+ if (options.preventUpdate !== true) {
2968
+ element.update(
2969
+ {},
2970
+ {
2971
+ ...options,
2972
+ updateByState: true
2973
+ }
2974
+ );
2975
+ } else if (options.preventUpdate === "recursive") {
2976
+ element.update(
2977
+ {},
2978
+ {
2979
+ ...options,
2980
+ isHoisted: false,
2981
+ updateByState: true,
2982
+ preventUpdate: true
2983
+ }
2984
+ );
2985
+ }
2986
+ };
2987
+
2988
+ // ../state/dist/esm/methods.js
2989
+ var parse2 = function() {
2990
+ const state2 = this;
2991
+ if (isObject(state2)) {
2992
+ const obj = {};
2993
+ for (const param in state2) {
2994
+ if (!STATE_METHODS.has(param)) {
2995
+ obj[param] = state2[param];
2996
+ }
2997
+ }
2998
+ return obj;
2999
+ } else if (isArray(state2)) {
3000
+ return state2.filter((item) => !STATE_METHODS.has(item));
3001
+ }
3002
+ };
3003
+ var clean = function(options = {}) {
3004
+ const state2 = this;
3005
+ for (const param in state2) {
3006
+ if (!STATE_METHODS.has(param) && Object.prototype.hasOwnProperty.call(state2, param)) {
3007
+ delete state2[param];
3008
+ }
3009
+ }
3010
+ if (!options.preventStateUpdate) {
3011
+ state2.update(state2, { replace: true, ...options });
3012
+ }
3013
+ return state2;
3014
+ };
3015
+ var destroy = function(options = {}) {
3016
+ const state2 = this;
3017
+ const element = state2.__element;
3018
+ const stateKey = element.__ref.__state;
3019
+ if (isString(stateKey)) {
3020
+ element.parent.state.remove(stateKey, { isHoisted: true, ...options });
3021
+ return element.state;
3022
+ }
3023
+ delete element.state;
3024
+ element.state = state2.parent;
3025
+ if (state2.parent) {
3026
+ delete state2.parent.__children[element.key];
3027
+ }
3028
+ if (state2.__children) {
3029
+ for (const key in state2.__children) {
3030
+ const child = state2.__children[key];
3031
+ if (child.state) {
3032
+ if (isArray(child.state)) {
3033
+ Object.defineProperty(child.state, "parent", {
3034
+ value: state2.parent,
3035
+ enumerable: false,
3036
+ // Set this to true if you want the method to appear in for...in loops
3037
+ configurable: true,
3038
+ // Set this to true if you want to allow redefining/removing the property later
3039
+ writable: true
3040
+ // Set this to true if you want to allow changing the function later
3041
+ });
3042
+ } else {
3043
+ Object.setPrototypeOf(child, { parent: state2.parent });
3044
+ }
3045
+ }
3046
+ }
3047
+ }
3048
+ element.state.update({}, { isHoisted: true, ...options });
3049
+ return element.state;
3050
+ };
3051
+ var parentUpdate = function(obj, options = {}) {
3052
+ const state2 = this;
3053
+ if (!state2 || !state2.parent) return;
3054
+ return state2.parent.update(obj, { isHoisted: true, ...options });
3055
+ };
3056
+ var rootUpdate = function(obj, options = {}) {
3057
+ const state2 = this;
3058
+ if (!state2) return;
3059
+ const rootState = state2.__element.__ref.root.state;
3060
+ return rootState.update(obj, { isHoisted: false, ...options });
3061
+ };
3062
+ var add = function(value, options = {}) {
3063
+ const state2 = this;
3064
+ if (isArray(state2)) {
3065
+ state2.push(value);
3066
+ state2.update(state2.parse(), { overwrite: true, ...options });
3067
+ } else if (isObject(state2)) {
3068
+ const key = Object.keys(state2).length;
3069
+ state2.update({ [key]: value }, options);
3070
+ }
3071
+ };
3072
+ var toggle = function(key, options = {}) {
3073
+ const state2 = this;
3074
+ state2.update({ [key]: !state2[key] }, options);
3075
+ };
3076
+ var remove2 = function(key, options = {}) {
3077
+ const state2 = this;
3078
+ if (isArray(state2)) removeFromArray(state2, key);
3079
+ else if (isObject(state2)) removeFromObject(state2, key);
3080
+ if (options.applyReset) {
3081
+ return state2.set(state2.parse(), { replace: true, ...options });
3082
+ }
3083
+ return state2.update({}, options);
3084
+ };
3085
+ var set2 = function(val, options = {}) {
3086
+ const state2 = this;
3087
+ const value = deepClone(val);
3088
+ const cleanState = state2.clean({ preventStateUpdate: true, ...options });
3089
+ return cleanState.update(value, { replace: true, ...options });
3090
+ };
3091
+ var setByPath = function(path, val, options = {}) {
3092
+ const state2 = this;
3093
+ const value = deepClone(val);
3094
+ if (!options.preventReplace) setInObjectByPath(state2, path, val);
3095
+ const update3 = createNestedObject(path, value);
3096
+ if (options.preventStateUpdate) return update3;
3097
+ return state2.update(update3, options);
3098
+ };
3099
+ var setPathCollection = function(changes, options = {}) {
3100
+ const state2 = this;
3101
+ const update3 = changes.reduce((acc, change) => {
3102
+ if (change[0] === "update") {
3103
+ const result = setByPath.call(state2, change[1], change[2], {
3104
+ preventStateUpdate: true
3105
+ });
3106
+ return overwriteDeep(acc, result);
3107
+ } else if (change[0] === "delete") {
3108
+ removeByPath.call(state2, change[1], {
3109
+ ...options,
3110
+ preventUpdate: true
3111
+ });
3112
+ }
3113
+ return acc;
3114
+ }, {});
3115
+ return state2.update(update3, options);
3116
+ };
3117
+ var removeByPath = function(path, options = {}) {
3118
+ const state2 = this;
3119
+ removeNestedKeyByPath(state2, path);
3120
+ if (options.preventUpdate) return path;
3121
+ return state2.update({}, options);
3122
+ };
3123
+ var removePathCollection = function(changes, options = {}) {
3124
+ const state2 = this;
3125
+ for (let i = 0; i < changes.length; i++) {
3126
+ removeByPath(changes[i], { preventUpdate: true });
3127
+ }
3128
+ return state2.update({}, options);
3129
+ };
3130
+ var getByPath = function(path, options = {}) {
3131
+ const state2 = this;
3132
+ return getInObjectByPath(state2, path);
3133
+ };
3134
+ var reset2 = function(options = {}) {
3135
+ const state2 = this;
3136
+ const value = deepClone(state2.parse());
3137
+ return state2.set(value, { replace: true, ...options });
3138
+ };
3139
+ var apply = function(func, options = {}) {
3140
+ const state2 = this;
3141
+ if (isFunction(func)) {
3142
+ const value = func(state2);
3143
+ return state2.update(value, { replace: true, ...options });
3144
+ }
3145
+ };
3146
+ var applyReplace = function(func, options = {}) {
3147
+ const state2 = this;
3148
+ if (isFunction(func)) {
3149
+ const value = func(state2);
3150
+ return state2.replace(value, options);
3151
+ }
3152
+ };
3153
+ var applyFunction = function(func, options = {}) {
3154
+ const state2 = this;
3155
+ if (isFunction(func)) {
3156
+ func(state2);
3157
+ return state2.update(state2.parse(), { replace: true, ...options });
3158
+ }
3159
+ };
3160
+ var quietUpdate = function(obj, options = {}) {
3161
+ const state2 = this;
3162
+ return state2.update(obj, { preventUpdate: true, ...options });
3163
+ };
3164
+ var replace = function(obj, options = {}) {
3165
+ const state2 = this;
3166
+ for (const param in obj) {
3167
+ state2[param] = obj[param];
3168
+ }
3169
+ return state2.update(obj, options);
3170
+ };
3171
+ var quietReplace = function(obj, options = {}) {
3172
+ const state2 = this;
3173
+ return state2.replace(obj, { preventUpdate: true, ...options });
3174
+ };
3175
+ var keys2 = function(obj, options = {}) {
3176
+ const state2 = this;
3177
+ return Object.keys(state2);
3178
+ };
3179
+ var values = function(obj, options = {}) {
3180
+ const state2 = this;
3181
+ return Object.values(state2);
3182
+ };
3183
+ var applyStateMethods = (element) => {
3184
+ const state2 = element.state;
3185
+ const ref = element.__ref;
3186
+ const proto = {
3187
+ clean: clean.bind(state2),
3188
+ parse: parse2.bind(state2),
3189
+ destroy: destroy.bind(state2),
3190
+ update: updateState.bind(state2),
3191
+ rootUpdate: rootUpdate.bind(state2),
3192
+ parentUpdate: parentUpdate.bind(state2),
3193
+ create: createState.bind(state2),
3194
+ add: add.bind(state2),
3195
+ toggle: toggle.bind(state2),
3196
+ remove: remove2.bind(state2),
3197
+ apply: apply.bind(state2),
3198
+ applyReplace: applyReplace.bind(state2),
3199
+ applyFunction: applyFunction.bind(state2),
3200
+ set: set2.bind(state2),
3201
+ quietUpdate: quietUpdate.bind(state2),
3202
+ replace: replace.bind(state2),
3203
+ quietReplace: quietReplace.bind(state2),
3204
+ reset: reset2.bind(state2),
3205
+ parent: element.parent?.state || state2,
3206
+ setByPath: setByPath.bind(state2),
3207
+ setPathCollection: setPathCollection.bind(state2),
3208
+ removeByPath: removeByPath.bind(state2),
3209
+ removePathCollection: removePathCollection.bind(state2),
3210
+ getByPath: getByPath.bind(state2),
3211
+ keys: keys2.bind(state2),
3212
+ values: values.bind(state2),
3213
+ __element: element,
3214
+ __children: {},
3215
+ root: ref?.root ? ref.root.state : state2
3216
+ };
3217
+ if (isArray(state2)) {
3218
+ addProtoToArray(state2, proto);
3219
+ } else {
3220
+ Object.setPrototypeOf(state2, proto);
3221
+ }
3222
+ if (state2.parent && state2.parent.__children) {
3223
+ state2.parent.__children[element.key] = state2;
3224
+ }
3225
+ };
3226
+
3227
+ // ../state/dist/esm/create.js
3228
+ var createState = function(element, parent, options) {
3229
+ element.state = applyInitialState(element, parent, options);
3230
+ return element.state;
3231
+ };
3232
+ var applyInitialState = function(element, parent, options) {
3233
+ const objectizeState = checkForStateTypes(element);
3234
+ if (objectizeState === false) return parent.state || {};
3235
+ else element.state = objectizeState;
3236
+ const whatInitReturns = triggerEventOn("stateInit", element, options);
3237
+ if (whatInitReturns === false) return element.state;
3238
+ if (checkIfInherits(element)) {
3239
+ const inheritedState = createInheritedState(element, parent);
3240
+ element.state = isUndefined(inheritedState) ? {} : inheritedState;
3241
+ }
3242
+ const dependentState = applyDependentState(
3243
+ element,
3244
+ element.state || parent.state || {}
3245
+ );
3246
+ if (dependentState) element.state = dependentState;
3247
+ applyStateMethods(element);
3248
+ triggerEventOn("stateCreated", element);
3249
+ return element.state;
3250
+ };
3251
+
3252
+ // ../element/dist/esm/utils/index.js
3253
+ var METHODS_EXL2 = [];
3254
+
3255
+ // ../element/dist/esm/update.js
3256
+ var UPDATE_DEFAULT_OPTIONS = {
3257
+ stackChanges: false,
3258
+ cleanExec: true,
3259
+ preventRecursive: false,
3260
+ currentSnapshot: false,
3261
+ calleeElement: false,
3262
+ exclude: METHODS_EXL2
3263
+ };
3264
+ var update2 = function(params = {}, opts) {
3265
+ const options = isObject(opts) ? { ...UPDATE_DEFAULT_OPTIONS, ...opts } : { ...UPDATE_DEFAULT_OPTIONS };
3266
+ const element = this;
3267
+ let ref = element.__ref;
3268
+ if (!ref) ref = element.__ref = {};
3269
+ const [snapshotOnCallee, calleeElement, snapshotHasUpdated] = captureSnapshot(
3270
+ element,
3271
+ options
3272
+ );
3273
+ if (snapshotHasUpdated) return;
3274
+ if (!options.preventListeners) {
3275
+ triggerEventOnUpdate("startUpdate", params, element, options);
3276
+ }
3277
+ const { parent, node, key } = element;
3278
+ const { exclude, preventInheritAtCurrentState } = options;
3279
+ if (preventInheritAtCurrentState && preventInheritAtCurrentState.__element === element) {
3280
+ return;
3281
+ }
3282
+ if (!exclude) merge(options, UPDATE_DEFAULT_OPTIONS);
3283
+ if (isString(params) || isNumber(params)) {
3284
+ params = { text: params };
3285
+ }
3286
+ params = propertizeUpdate.call(element, params);
3287
+ const inheritState = inheritStateUpdates(element, options);
3288
+ if (inheritState === false) return;
3289
+ const ifFails = checkIfOnUpdate(element, parent, options);
3290
+ if (ifFails) return;
3291
+ if (ref.__if && !options.preventPropsUpdate) {
3292
+ const hasParentProps = parent.props && (parent.props[key] || parent.props.childProps);
3293
+ const hasFunctionInProps = ref.__propsStack.some(isFunction);
3294
+ const props = params.props || hasParentProps || hasFunctionInProps;
3295
+ if (props) updateProps(props, element, parent);
3296
+ }
3297
+ if (!options.preventBeforeUpdateListener && !options.preventListeners) {
3298
+ const hasBeforeUpdate = element.on?.beforeUpdate || element.props?.onBeforeUpdate;
3299
+ if (hasBeforeUpdate) {
3300
+ const simulate = { ...params, ...element };
3301
+ const beforeUpdateReturns = triggerEventOnUpdate(
3302
+ "beforeUpdate",
3303
+ params,
3304
+ simulate,
3305
+ options
3306
+ );
3307
+ if (beforeUpdateReturns === false) return element;
3308
+ }
3309
+ }
3310
+ overwriteDeep(element, params);
3311
+ throughExecProps(element);
3312
+ throughUpdatedExec(element, { ignore: UPDATE_DEFAULT_OPTIONS });
3313
+ throughUpdatedDefine(element);
3314
+ if (!options.isForced && !options.preventListeners) {
3315
+ triggerEventOn("beforeClassAssign", element, options);
3316
+ }
3317
+ if (!ref.__if) return false;
3318
+ if (!node) return;
3319
+ const {
3320
+ preventUpdate,
3321
+ preventDefineUpdate,
3322
+ preventContentUpdate,
3323
+ preventStateUpdate,
3324
+ preventRecursive,
3325
+ preventUpdateListener,
3326
+ preventUpdateAfter,
3327
+ preventUpdateAfterCount
3328
+ } = options;
3329
+ if (preventUpdateAfter) {
3330
+ if (isNumber(preventUpdateAfterCount) && preventUpdateAfter <= preventUpdateAfterCount) {
3331
+ return;
3332
+ } else if (options.preventUpdateAfterCount === void 0) {
3333
+ options.preventUpdateAfterCount = 1;
3334
+ } else options.preventUpdateAfterCount++;
3335
+ }
3336
+ const preventUpdateSet = isArray(preventUpdate) ? new Set(preventUpdate) : null;
3337
+ const preventDefineUpdateSet = isArray(preventDefineUpdate) ? new Set(preventDefineUpdate) : null;
3338
+ for (const param in element) {
3339
+ const prop = element[param];
3340
+ if (!Object.prototype.hasOwnProperty.call(element, param)) continue;
3341
+ const isInPreventUpdate = preventUpdateSet && preventUpdateSet.has(param);
3342
+ const isInPreventDefineUpdate = preventDefineUpdateSet && preventDefineUpdateSet.has(param);
3343
+ const isRootEventHandler = isFunction(prop) && param.length > 2 && param.charCodeAt(0) === 111 && param.charCodeAt(1) === 110 && // 'on'
3344
+ param.charCodeAt(2) >= 65 && param.charCodeAt(2) <= 90;
3345
+ if (isUndefined(prop) || isInPreventUpdate || isInPreventDefineUpdate || preventDefineUpdate === true || preventDefineUpdate === param || preventStateUpdate && param === "state" || isMethod(param, element) || isRootEventHandler || isObject(REGISTRY[param])) {
3346
+ continue;
3347
+ }
3348
+ if (preventStateUpdate === "once") options.preventStateUpdate = false;
3349
+ const isElement = applyParam(param, element, options);
3350
+ if (isElement) {
3351
+ const { hasDefine, hasContextDefine } = isElement;
3352
+ const canUpdate = isObject(prop) && !hasDefine && !hasContextDefine && !preventRecursive;
3353
+ if (!canUpdate) continue;
3354
+ const lazyLoad = element.props.lazyLoad || options.lazyLoad;
3355
+ if (options.onEachUpdate) {
3356
+ options.onEachUpdate(param, element, element.state, element.context);
3357
+ }
3358
+ const childParams = params[param];
3359
+ if (childParams === void 0 && !options.isForced) continue;
3360
+ const childUpdateCall = () => update2.call(prop, childParams, {
3361
+ ...options,
3362
+ currentSnapshot: snapshotOnCallee,
3363
+ calleeElement
3364
+ });
3365
+ if (lazyLoad) {
3366
+ window2.requestAnimationFrame(() => {
3367
+ childUpdateCall();
3368
+ if (!options.preventUpdateListener && !options.preventListeners) {
3369
+ triggerEventOn("lazyLoad", element, options);
3370
+ }
3371
+ });
3372
+ } else childUpdateCall();
3373
+ }
3374
+ }
3375
+ if (!preventContentUpdate) {
3376
+ const contentKey = ref.contentElementKey || "content";
3377
+ const existingContent = element[contentKey];
3378
+ const childrenProp = params.children || element.children;
3379
+ if (childrenProp) {
3380
+ const content = children_default(childrenProp, element, opts);
3381
+ if (content && !ref.__noChildrenDifference) {
3382
+ setContent(content, element, options);
3383
+ } else if (existingContent?.__ref && isFunction(existingContent.update)) {
3384
+ const lazyLoad = element.props?.lazyLoad || options.lazyLoad;
3385
+ const contentUpdateCall = () => update2.call(existingContent, params[contentKey], {
3386
+ ...options,
3387
+ currentSnapshot: snapshotOnCallee,
3388
+ calleeElement
3389
+ });
3390
+ if (lazyLoad) {
3391
+ window2.requestAnimationFrame(() => {
3392
+ contentUpdateCall();
3393
+ if (!options.preventUpdateListener && !options.preventListeners) {
3394
+ triggerEventOn("lazyLoad", element, options);
3395
+ }
3396
+ });
3397
+ } else contentUpdateCall();
3398
+ }
3399
+ } else if (existingContent?.__ref && isFunction(existingContent.update)) {
3400
+ const lazyLoad = element.props?.lazyLoad || options.lazyLoad;
3401
+ const contentUpdateCall = () => update2.call(existingContent, params[contentKey], {
3402
+ ...options,
3403
+ currentSnapshot: snapshotOnCallee,
3404
+ calleeElement
3405
+ });
3406
+ if (lazyLoad) {
3407
+ window2.requestAnimationFrame(() => {
3408
+ contentUpdateCall();
3409
+ if (!options.preventUpdateListener && !options.preventListeners) {
3410
+ triggerEventOn("lazyLoad", element, options);
3411
+ }
3412
+ });
3413
+ } else contentUpdateCall();
3414
+ } else {
3415
+ const content = element.children || params.content;
3416
+ if (content) {
3417
+ setContent(content, element, options);
3418
+ }
3419
+ }
3420
+ }
3421
+ if (!preventUpdateListener && !options.preventListeners) {
3422
+ triggerEventOn("update", element, options);
3423
+ }
3424
+ };
3425
+ var checkIfOnUpdate = (element, parent, options) => {
3426
+ if (!isFunction(element.if) && !isFunction(element.props?.if) || !parent) {
3427
+ return;
3428
+ }
3429
+ const ref = element.__ref;
3430
+ const ifPassed = (element.if || element.props?.if)(
3431
+ element,
3432
+ element.state,
3433
+ element.context,
3434
+ options
3435
+ );
3436
+ const itWasFalse = ref.__if !== true;
3437
+ if (ifPassed) {
3438
+ ref.__if = true;
3439
+ if (itWasFalse) {
3440
+ delete element.__hash;
3441
+ delete element.__text;
3442
+ delete element.extends;
3443
+ if (!ref.__hasRootState) {
3444
+ delete element.state;
3445
+ }
3446
+ if (ref.__state) {
3447
+ element.state = ref.__state;
3448
+ } else if (!ref.__hasRootState) {
3449
+ delete element.state;
3450
+ }
3451
+ if (element.node) {
3452
+ element.node.remove();
3453
+ delete element.node;
3454
+ }
3455
+ const contentKey = ref.contentElementKey;
3456
+ if (element.children) {
3457
+ element.removeContent();
3458
+ } else if (element[contentKey]?.parseDeep) {
3459
+ element[contentKey] = element[contentKey].parseDeep();
3460
+ }
3461
+ const previousElement2 = element.previousElement();
3462
+ const previousNode = previousElement2?.node;
3463
+ const hasPrevious = previousNode?.parentNode;
3464
+ const nextElement2 = element.nextElement();
3465
+ const nextNode = nextElement2?.node;
3466
+ const hasNext = nextNode?.parentNode;
3467
+ const attachOptions = (hasPrevious || hasNext) && {
3468
+ position: hasPrevious ? "after" : hasNext ? "before" : null,
3469
+ node: hasPrevious && previousNode || hasNext && nextNode
3470
+ };
3471
+ delete element.__ref;
3472
+ delete element.parent;
3473
+ const createdElement = create(
3474
+ element,
3475
+ parent,
3476
+ element.key,
3477
+ OPTIONS.create,
3478
+ attachOptions
3479
+ );
3480
+ if (options.preventUpdate !== true && element.on && isFunction(element.on.update)) {
3481
+ applyEvent(element.on.update, createdElement, createdElement.state);
3482
+ }
3483
+ return createdElement;
3484
+ }
3485
+ } else if (element.node && !ifPassed) {
3486
+ element.node.remove();
3487
+ delete ref.__if;
3488
+ }
3489
+ };
3490
+ var inheritStateUpdates = (element, options) => {
3491
+ const { __ref: ref } = element;
3492
+ const stateKey = ref.__state;
3493
+ const { parent, state: state2 } = element;
3494
+ const { preventUpdateTriggerStateUpdate, isHoisted, execStateFunction } = options;
3495
+ if (preventUpdateTriggerStateUpdate) return;
3496
+ if (!stateKey && !ref.__hasRootState) {
3497
+ element.state = parent?.state || {};
3498
+ return;
3499
+ }
3500
+ const shouldForceFunctionState = isFunction(stateKey) && !isHoisted && execStateFunction;
3501
+ if (shouldForceFunctionState) {
3502
+ const execState = exec(stateKey, element);
3503
+ state2.set(execState, {
3504
+ ...options,
3505
+ preventUpdate: true,
3506
+ preventStateUpdateListener: false,
3507
+ updatedByStateFunction: true
3508
+ });
3509
+ return;
3510
+ }
3511
+ const keyInParentState = findInheritedState(element, element.parent);
3512
+ if (!keyInParentState || options.preventInheritedStateUpdate) return;
3513
+ if (!options.preventBeforeStateUpdateListener && !options.preventListeners) {
3514
+ const initStateReturns = triggerEventOnUpdate(
3515
+ "beforeStateUpdate",
3516
+ keyInParentState,
3517
+ element,
3518
+ options
3519
+ );
3520
+ if (initStateReturns === false) return element;
3521
+ }
3522
+ const newState = createStateUpdate(element, parent, options);
3523
+ if (!options.preventStateUpdateListener && !options.preventListeners) {
3524
+ triggerEventOnUpdate("stateUpdate", newState.parse(), element, options);
3525
+ }
3526
+ };
3527
+ var createStateUpdate = (element, parent, options) => {
3528
+ const __stateChildren = element.state.__children;
3529
+ const newState = createState(element, parent);
3530
+ element.state = newState;
3531
+ for (const child in __stateChildren) {
3532
+ if (newState[child]) newState.__children[child] = __stateChildren[child];
3533
+ Object.getPrototypeOf(__stateChildren[child]).parent = newState;
3534
+ }
3535
+ return newState;
3536
+ };
3537
+
3538
+ // ../element/dist/esm/methods/set.js
3539
+ var addMethods = (element, parent, options = {}) => {
3540
+ const proto = {
3541
+ set,
3542
+ reset,
3543
+ update: update2,
3544
+ variables,
3545
+ remove,
3546
+ updateContent,
3547
+ removeContent,
3548
+ setProps,
3549
+ lookup,
3550
+ lookdown,
3551
+ lookdownAll,
3552
+ getRef,
3553
+ getPath,
3554
+ getRootState,
3555
+ getRoot,
3556
+ getRootData,
3557
+ getRootContext,
3558
+ getContext,
3559
+ setNodeStyles,
3560
+ spotByPath,
3561
+ parse,
3562
+ parseDeep,
3563
+ keys,
3564
+ nextElement,
3565
+ previousElement,
3566
+ log,
3567
+ verbose,
3568
+ warn,
3569
+ error,
3570
+ call
3571
+ };
3572
+ if (element.context.methods) {
3573
+ ;
3574
+ (options.strict ? merge : overwrite)(proto, element.context.methods);
3575
+ }
3576
+ Object.setPrototypeOf(element, proto);
3577
+ };
3578
+
3579
+ // ../attrs-in-props/dist/esm/index.js
3580
+ var HTML_ATTRIBUTES = {
3581
+ default: [
3582
+ "accesskey",
3583
+ "autofocus",
3584
+ "class",
3585
+ "contenteditable",
3586
+ "contextmenu",
3587
+ "dir",
3588
+ "draggable",
3589
+ "hidden",
3590
+ "id",
3591
+ "lang",
3592
+ "part",
3593
+ "placeholder",
3594
+ "slot",
3595
+ "spellcheck",
3596
+ "style",
3597
+ "tabindex",
3598
+ "title",
3599
+ "translate",
3600
+ "inert",
3601
+ "radiogroup",
3602
+ "role",
3603
+ "about",
3604
+ "datatype",
3605
+ "inlist",
3606
+ "prefix",
3607
+ "property",
3608
+ "resource",
3609
+ "typeof",
3610
+ "vocab",
3611
+ "autocapitalize",
3612
+ "autocorrect",
3613
+ "autosave",
3614
+ "color",
3615
+ "itemprop",
3616
+ "itemscope",
3617
+ "itemtype",
3618
+ "itemid",
3619
+ "itemref",
3620
+ "results",
3621
+ "security",
3622
+ "unselectable",
3623
+ "is"
3624
+ ],
3625
+ a: [
3626
+ "accesskey",
3627
+ "charset",
3628
+ "coords",
3629
+ "download",
3630
+ "href",
3631
+ "hreflang",
3632
+ "name",
3633
+ "rel",
3634
+ "rev",
3635
+ "shape",
3636
+ "target",
3637
+ "type"
3638
+ ],
3639
+ aria: [
3640
+ "aria-activedescendant",
3641
+ "aria-atomic",
3642
+ "aria-autocomplete",
3643
+ "aria-checked",
3644
+ "aria-colcount",
3645
+ "aria-colindex",
3646
+ "aria-colspan",
3647
+ "aria-controls",
3648
+ "aria-current",
3649
+ "aria-describedby",
3650
+ "aria-details",
3651
+ "aria-dropeffect",
3652
+ "aria-errormessage",
3653
+ "aria-expanded",
3654
+ "aria-flowto",
3655
+ "aria-grabbed",
3656
+ "aria-haspopup",
3657
+ "aria-hidden",
3658
+ "aria-invalid",
3659
+ "aria-keyshortcuts",
3660
+ "aria-label",
3661
+ "aria-labelledby",
3662
+ "aria-level",
3663
+ "aria-live",
3664
+ "aria-modal",
3665
+ "aria-multiline",
3666
+ "aria-multiselectable",
3667
+ "aria-orientation",
3668
+ "aria-owns",
3669
+ "aria-placeholder",
3670
+ "aria-posinset",
3671
+ "aria-pressed",
3672
+ "aria-readonly",
3673
+ "aria-relevant",
3674
+ "aria-required",
3675
+ "aria-roledescription",
3676
+ "aria-rowcount",
3677
+ "aria-rowindex",
3678
+ "aria-rowspan",
3679
+ "aria-selected",
3680
+ "aria-setsize",
3681
+ "aria-sort",
3682
+ "aria-valuemax",
3683
+ "aria-valuemin",
3684
+ "aria-valuenow",
3685
+ "aria-valuetext"
3686
+ ],
3687
+ anchor: [
3688
+ "download",
3689
+ "href",
3690
+ "hreflang",
3691
+ "media",
3692
+ "ping",
3693
+ "rel",
3694
+ "target",
3695
+ "type",
3696
+ "referrerpolicy"
3697
+ ],
3698
+ audio: [
3699
+ "autoplay",
3700
+ "controls",
3701
+ "crossorigin",
3702
+ "loop",
3703
+ "muted",
3704
+ "preload",
3705
+ "src"
3706
+ ],
3707
+ area: [
3708
+ "alt",
3709
+ "coords",
3710
+ "download",
3711
+ "href",
3712
+ "hreflang",
3713
+ "media",
3714
+ "referrerpolicy",
3715
+ "rel",
3716
+ "shape",
3717
+ "target",
3718
+ "ping"
3719
+ ],
3720
+ base: [
3721
+ "href",
3722
+ "target"
3723
+ ],
3724
+ blockquote: [
3725
+ "cite"
3726
+ ],
3727
+ button: [
3728
+ "disabled",
3729
+ "form",
3730
+ "formaction",
3731
+ "formenctype",
3732
+ "formmethod",
3733
+ "formnovalidate",
3734
+ "formtarget",
3735
+ "name",
3736
+ "type",
3737
+ "value"
3738
+ ],
3739
+ canvas: [
3740
+ "height",
3741
+ "width"
3742
+ ],
3743
+ col: [
3744
+ "span",
3745
+ "width"
3746
+ ],
3747
+ colgroup: [
3748
+ "span"
3749
+ ],
3750
+ data: [
3751
+ "value"
3752
+ ],
3753
+ details: [
3754
+ "open"
3755
+ ],
3756
+ del: [
3757
+ "cite",
3758
+ "datetime"
3759
+ ],
3760
+ dialog: [
3761
+ "open"
3762
+ ],
3763
+ embed: [
3764
+ "height",
3765
+ "src",
3766
+ "type",
3767
+ "width"
3768
+ ],
3769
+ fieldset: [
3770
+ "disabled",
3771
+ "form",
3772
+ "name"
3773
+ ],
3774
+ form: [
3775
+ "acceptcharset",
3776
+ "action",
3777
+ "autocomplete",
3778
+ "enctype",
3779
+ "method",
3780
+ "name",
3781
+ "novalidate",
3782
+ "target",
3783
+ "rel"
3784
+ ],
3785
+ html: [
3786
+ "manifest"
3787
+ ],
3788
+ iframe: [
3789
+ "allow",
3790
+ "allowfullscreen",
3791
+ "allowtransparency",
3792
+ "frameborder",
3793
+ "height",
3794
+ "loading",
3795
+ "marginheight",
3796
+ "marginwidth",
3797
+ "mozallowfullscreen",
3798
+ "name",
3799
+ "referrerpolicy",
3800
+ "sandbox",
3801
+ "scrolling",
3802
+ "seamless",
3803
+ "src",
3804
+ "srcdoc",
3805
+ "webkitallowfullscreen",
3806
+ "width"
3807
+ ],
3808
+ img: [
3809
+ "alt",
3810
+ "crossorigin",
3811
+ "decoding",
3812
+ "height",
3813
+ "ismap",
3814
+ "loading",
3815
+ "referrerpolicy",
3816
+ "sizes",
3817
+ "src",
3818
+ "srcset",
3819
+ "usemap",
3820
+ "width"
3821
+ ],
3822
+ ins: [
3823
+ "cite",
3824
+ "datetime"
3825
+ ],
3826
+ input: [
3827
+ "accept",
3828
+ "alt",
3829
+ "autocomplete",
3830
+ "capture",
3831
+ "checked",
3832
+ "crossorigin",
3833
+ "disabled",
3834
+ "form",
3835
+ "formaction",
3836
+ "formenctype",
3837
+ "formmethod",
3838
+ "formnovalidate",
3839
+ "formtarget",
3840
+ "height",
3841
+ "indeterminate",
3842
+ "list",
3843
+ "max",
3844
+ "maxlength",
3845
+ "min",
3846
+ "minlength",
3847
+ "multiple",
3848
+ "name",
3849
+ "pattern",
3850
+ "placeholder",
3851
+ "readonly",
3852
+ "required",
3853
+ "size",
3854
+ "src",
3855
+ "step",
3856
+ "type",
3857
+ "value",
3858
+ "width"
3859
+ ],
3860
+ keygen: [
3861
+ "challenge",
3862
+ "disabled",
3863
+ "form",
3864
+ "keytype",
3865
+ "keyparams",
3866
+ "name"
3867
+ ],
3868
+ label: [
3869
+ "form",
3870
+ "for"
3871
+ ],
3872
+ li: [
3873
+ "value"
3874
+ ],
3875
+ link: [
3876
+ "as",
3877
+ "crossorigin",
3878
+ "href",
3879
+ "hreflang",
3880
+ "integrity",
3881
+ "media",
3882
+ "imagesrcset",
3883
+ "imagesizes",
3884
+ "referrerpolicy",
3885
+ "rel",
3886
+ "sizes",
3887
+ "type",
3888
+ "charset"
3889
+ ],
3890
+ map: [
3891
+ "name"
3892
+ ],
3893
+ menu: [
3894
+ "type"
3895
+ ],
3896
+ media: [
3897
+ "autoplay",
3898
+ "controls",
3899
+ "currenttime",
3900
+ "defaultmuted",
3901
+ "defaultplaybackrate",
3902
+ "loop",
3903
+ "mediagroup",
3904
+ "muted",
3905
+ "playsinline",
3906
+ "preload",
3907
+ "src",
3908
+ "volume"
3909
+ ],
3910
+ meta: [
3911
+ "charset",
3912
+ "content",
3913
+ "http-equiv",
3914
+ "name",
3915
+ "media"
3916
+ ],
3917
+ meter: [
3918
+ "form",
3919
+ "high",
3920
+ "low",
3921
+ "max",
3922
+ "min",
3923
+ "optimum",
3924
+ "value"
3925
+ ],
3926
+ quote: [
3927
+ "cite"
3928
+ ],
3929
+ object: [
3930
+ "classid",
3931
+ "data",
3932
+ "form",
3933
+ "height",
3934
+ "name",
3935
+ "type",
3936
+ "usemap",
3937
+ "width",
3938
+ "wmode"
3939
+ ],
3940
+ ol: [
3941
+ "reversed",
3942
+ "start",
3943
+ "type"
3944
+ ],
3945
+ optgroup: [
3946
+ "disabled",
3947
+ "label"
3948
+ ],
3949
+ option: [
3950
+ "disabled",
3951
+ "label",
3952
+ "selected",
3953
+ "value"
3954
+ ],
3955
+ output: [
3956
+ "form",
3957
+ "for",
3958
+ "name"
3959
+ ],
3960
+ param: [
3961
+ "name",
3962
+ "value"
3963
+ ],
3964
+ progress: [
3965
+ "max",
3966
+ "value"
3967
+ ],
3968
+ slot: [
3969
+ "name"
3970
+ ],
3971
+ script: [
3972
+ "async",
3973
+ "charset",
3974
+ "crossorigin",
3975
+ "defer",
3976
+ "integrity",
3977
+ "nomodule",
3978
+ "nonce",
3979
+ "referrerpolicy",
3980
+ "src",
3981
+ "type"
3982
+ ],
3983
+ select: [
3984
+ "autocomplete",
3985
+ "disabled",
3986
+ "form",
3987
+ "multiple",
3988
+ "name",
3989
+ "required",
3990
+ "size",
3991
+ "value",
3992
+ "onchange"
3993
+ ],
3994
+ source: [
3995
+ "height",
3996
+ "media",
3997
+ "sizes",
3998
+ "src",
3999
+ "srcset",
4000
+ "type",
4001
+ "width"
4002
+ ],
4003
+ style: [
4004
+ "media",
4005
+ "nonce",
4006
+ "scoped",
4007
+ "type"
4008
+ ],
4009
+ table: [
4010
+ "align",
4011
+ "bgcolor",
4012
+ "border",
4013
+ "cellpadding",
4014
+ "cellspacing",
4015
+ "frame",
4016
+ "rules",
4017
+ "summary",
4018
+ "width"
4019
+ ],
4020
+ textarea: [
4021
+ "autocomplete",
4022
+ "cols",
4023
+ "dirname",
4024
+ "disabled",
4025
+ "form",
4026
+ "maxlength",
4027
+ "minlength",
4028
+ "name",
4029
+ "placeholder",
4030
+ "readonly",
4031
+ "required",
4032
+ "rows",
4033
+ "value",
4034
+ "wrap"
4035
+ ],
4036
+ td: [
4037
+ "align",
4038
+ "colspan",
4039
+ "headers",
4040
+ "rowspan",
4041
+ "scope",
4042
+ "abbr",
4043
+ "height",
4044
+ "width",
4045
+ "valign"
4046
+ ],
4047
+ th: [
4048
+ "align",
4049
+ "colspan",
4050
+ "headers",
4051
+ "rowspan",
4052
+ "scope",
4053
+ "abbr"
4054
+ ],
4055
+ time: [
4056
+ "datetime"
4057
+ ],
4058
+ track: [
4059
+ "default",
4060
+ "kind",
4061
+ "label",
4062
+ "src",
4063
+ "srclang"
4064
+ ],
4065
+ video: [
4066
+ "autoplay",
4067
+ "controls",
4068
+ "crossorigin",
4069
+ "disablepictureinpicture",
4070
+ "disableremoteplayback",
4071
+ "height",
4072
+ "loop",
4073
+ "muted",
4074
+ "playsinline",
4075
+ "poster",
4076
+ "preload",
4077
+ "src",
4078
+ "width"
4079
+ ],
4080
+ svg: [
4081
+ "className",
4082
+ "class",
4083
+ "color",
4084
+ "height",
4085
+ "id",
4086
+ "lang",
4087
+ "max",
4088
+ "media",
4089
+ "method",
4090
+ "min",
4091
+ "name",
4092
+ "style",
4093
+ "target",
4094
+ "type",
4095
+ "width",
4096
+ // Other HTML properties supported by SVG elements in browsers
4097
+ "role",
4098
+ "tabindex",
4099
+ "crossorigin",
4100
+ // SVG Specific attributes
4101
+ "accent-height",
4102
+ "accumulate",
4103
+ "additive",
4104
+ "alignment-baseline",
4105
+ "allowReorder",
4106
+ "alphabetic",
4107
+ "amplitude",
4108
+ "arabic-form",
4109
+ "ascent",
4110
+ "attributeName",
4111
+ "attributeType",
4112
+ "autoReverse",
4113
+ "azimuth",
4114
+ "baseFrequency",
4115
+ "baseline-shift",
4116
+ "baseProfile",
4117
+ "bbox",
4118
+ "begin",
4119
+ "bias",
4120
+ "by",
4121
+ "calcMode",
4122
+ "cap-height",
4123
+ "clip",
4124
+ "clip-path",
4125
+ "clipPathUnits",
4126
+ "clip-rule",
4127
+ "color-interpolation",
4128
+ "color-interpolation-filters",
4129
+ "color-profile",
4130
+ "color-rendering",
4131
+ "contentScriptType",
4132
+ "contentStyleType",
4133
+ "cursor",
4134
+ "cx",
4135
+ "cy",
4136
+ "d",
4137
+ "decelerate",
4138
+ "descent",
4139
+ "diffuseConstant",
4140
+ "direction",
4141
+ "display",
4142
+ "divisor",
4143
+ "dominant-baseline",
4144
+ "dur",
4145
+ "dx",
4146
+ "dy",
4147
+ "edgeMode",
4148
+ "elevation",
4149
+ "enable-background",
4150
+ "end",
4151
+ "exponent",
4152
+ "externalResourcesRequired",
4153
+ "fill",
4154
+ "fill-opacity",
4155
+ "fill-rule",
4156
+ "filter",
4157
+ "filterRes",
4158
+ "filterUnits",
4159
+ "flood-color",
4160
+ "flood-opacity",
4161
+ "focusable",
4162
+ "font-family",
4163
+ "font-size",
4164
+ "font-size-adjust",
4165
+ "font-stretch",
4166
+ "font-style",
4167
+ "font-variant",
4168
+ "font-weight",
4169
+ "format",
4170
+ "from",
4171
+ "fx",
4172
+ "fy",
4173
+ "g1",
4174
+ "g2",
4175
+ "glyph-name",
4176
+ "glyph-orientation-horizontal",
4177
+ "glyph-orientation-vertical",
4178
+ "glyphRef",
4179
+ "gradientTransform",
4180
+ "gradientUnits",
4181
+ "hanging",
4182
+ "href",
4183
+ "horiz-adv-x",
4184
+ "horiz-origin-x",
4185
+ "ideographic",
4186
+ "image-rendering",
4187
+ "in2",
4188
+ "in",
4189
+ "intercept",
4190
+ "k1",
4191
+ "k2",
4192
+ "k3",
4193
+ "k4",
4194
+ "k",
4195
+ "kernelMatrix",
4196
+ "kernelUnitLength",
4197
+ "kerning",
4198
+ "keyPoints",
4199
+ "keySplines",
4200
+ "keyTimes",
4201
+ "lengthAdjust",
4202
+ "letter-spacing",
4203
+ "lighting-color",
4204
+ "limitingConeAngle",
4205
+ "local",
4206
+ "marker-end",
4207
+ "markerHeight",
4208
+ "marker-mid",
4209
+ "marker-start",
4210
+ "markerUnits",
4211
+ "markerWidth",
4212
+ "mask",
4213
+ "maskContentUnits",
4214
+ "maskUnits",
4215
+ "mathematical",
4216
+ "mode",
4217
+ "numOctaves",
4218
+ "offset",
4219
+ "opacity",
4220
+ "operator",
4221
+ "order",
4222
+ "orient",
4223
+ "orientation",
4224
+ "origin",
4225
+ "overflow",
4226
+ "overline-position",
4227
+ "overline-thickness",
4228
+ "paint-order",
4229
+ "panose-1",
4230
+ "path",
4231
+ "pathLength",
4232
+ "patternContentUnits",
4233
+ "patternTransform",
4234
+ "patternUnits",
4235
+ "pointer-events",
4236
+ "points",
4237
+ "pointsAtX",
4238
+ "pointsAtY",
4239
+ "pointsAtZ",
4240
+ "preserveAlpha",
4241
+ "preserveAspectRatio",
4242
+ "primitiveUnits",
4243
+ "r",
4244
+ "radius",
4245
+ "refX",
4246
+ "refY",
4247
+ "rendering-intent",
4248
+ "repeatCount",
4249
+ "repeatDur",
4250
+ "requiredExtensions",
4251
+ "requiredFeatures",
4252
+ "restart",
4253
+ "result",
4254
+ "rotate",
4255
+ "rx",
4256
+ "ry",
4257
+ "scale",
4258
+ "seed",
4259
+ "shape-rendering",
4260
+ "slope",
4261
+ "spacing",
4262
+ "specularConstant",
4263
+ "specularExponent",
4264
+ "speed",
4265
+ "spreadMethod",
4266
+ "startOffset",
4267
+ "stdDeviation",
4268
+ "stemh",
4269
+ "stemv",
4270
+ "stitchTiles",
4271
+ "stop-color",
4272
+ "stop-opacity",
4273
+ "strikethrough-position",
4274
+ "strikethrough-thickness",
4275
+ "string",
4276
+ "stroke",
4277
+ "stroke-dasharray",
4278
+ "stroke-dashoffset",
4279
+ "stroke-linecap",
4280
+ "stroke-linejoin",
4281
+ "stroke-miterlimit",
4282
+ "stroke-opacity",
4283
+ "stroke-width",
4284
+ "surfaceScale",
4285
+ "systemLanguage",
4286
+ "tableValues",
4287
+ "targetX",
4288
+ "targetY",
4289
+ "text-anchor",
4290
+ "text-decoration",
4291
+ "textLength",
4292
+ "text-rendering",
4293
+ "to",
4294
+ "transform",
4295
+ "u1",
4296
+ "u2",
4297
+ "underline-position",
4298
+ "underline-thickness",
4299
+ "unicode",
4300
+ "unicode-bidi",
4301
+ "unicode-range",
4302
+ "units-per-em",
4303
+ "v-alphabetic",
4304
+ "values",
4305
+ "vector-effect",
4306
+ "version",
4307
+ "vert-adv-y",
4308
+ "vert-origin-x",
4309
+ "vert-origin-y",
4310
+ "v-hanging",
4311
+ "v-ideographic",
4312
+ "viewBox",
4313
+ "viewTarget",
4314
+ "visibility",
4315
+ "v-mathematical",
4316
+ "widths",
4317
+ "word-spacing",
4318
+ "writing-mode",
4319
+ "x1",
4320
+ "x2",
4321
+ "x",
4322
+ "xChannelSelector",
4323
+ "x-height",
4324
+ "xlink:actuate",
4325
+ "xlink:arcrole",
4326
+ "xlink:href",
4327
+ "xlink:role",
4328
+ "xlink:show",
4329
+ "xlink:title",
4330
+ "xlink:type",
4331
+ "xml:base",
4332
+ "xml:lang",
4333
+ "xmlns",
4334
+ "xmlns:xlink",
4335
+ "xml:space",
4336
+ "y1",
4337
+ "y2",
4338
+ "y",
4339
+ "yChannelSelector",
4340
+ "z",
4341
+ "zoomAndPan"
4342
+ ]
4343
+ };
4344
+ var DOM_EVENTS = [
4345
+ // Clipboard Events
4346
+ "oncopy",
4347
+ "oncut",
4348
+ "onpaste",
4349
+ // Composition Events
4350
+ "oncompositionend",
4351
+ "oncompositionstart",
4352
+ "oncompositionupdate",
4353
+ // Focus Events
4354
+ "onfocus",
4355
+ "onfocusin",
4356
+ "onfocusout",
4357
+ "onblur",
4358
+ // Form Events
4359
+ "onchange",
4360
+ "onbeforeinput",
4361
+ "oninput",
4362
+ "onreset",
4363
+ "onsubmit",
4364
+ "oninvalid",
4365
+ "onformdata",
4366
+ // Image Events
4367
+ "onload",
4368
+ "onerror",
4369
+ // also a Media Event
4370
+ // Detail Events
4371
+ "ontoggle",
4372
+ // Keyboard Events
4373
+ "onkeydown",
4374
+ "onkeypress",
4375
+ "onkeyup",
4376
+ // Media Events
4377
+ "onabort",
4378
+ "oncanplay",
4379
+ "oncanplaythrough",
4380
+ "oncuechange",
4381
+ "ondurationchange",
4382
+ "onemptied",
4383
+ "onencrypted",
4384
+ "onended",
4385
+ "onloadeddata",
4386
+ "onloadedmetadata",
4387
+ "onloadstart",
4388
+ "onpause",
4389
+ "onplay",
4390
+ "onplaying",
4391
+ "onprogress",
4392
+ "onratechange",
4393
+ "onseeked",
4394
+ "onseeking",
4395
+ "onstalled",
4396
+ "onsuspend",
4397
+ "ontimeupdate",
4398
+ "onvolumechange",
4399
+ "onwaiting",
4400
+ // MouseEvents
4401
+ "onauxclick",
4402
+ "onclick",
4403
+ "oncontextmenu",
4404
+ "ondblclick",
4405
+ "ondrag",
4406
+ "ondragend",
4407
+ "ondragenter",
4408
+ "ondragexit",
4409
+ "ondragleave",
4410
+ "ondragover",
4411
+ "ondragstart",
4412
+ "ondrop",
4413
+ "onmousedown",
4414
+ "onmouseenter",
4415
+ "onmouseleave",
4416
+ "onmousemove",
4417
+ "onmouseout",
4418
+ "onmouseover",
4419
+ "onmouseup",
4420
+ // Selection Events
4421
+ "onselect",
4422
+ "onselectionchange",
4423
+ "onselectstart",
4424
+ // Touch Events
4425
+ "ontouchcancel",
4426
+ "ontouchend",
4427
+ "ontouchmove",
4428
+ "ontouchstart",
4429
+ // Pointer Events
4430
+ "ongotpointercapture",
4431
+ "onpointercancel",
4432
+ "onpointerdown",
4433
+ "onpointerenter",
4434
+ "onpointerleave",
4435
+ "onpointermove",
4436
+ "onpointerout",
4437
+ "onpointerover",
4438
+ "onpointerup",
4439
+ "onlostpointercapture",
4440
+ // UI Events
4441
+ "onscroll",
4442
+ "onresize",
4443
+ // Wheel Events
4444
+ "onwheel",
4445
+ // Animation Events
4446
+ "onanimationstart",
4447
+ "onanimationend",
4448
+ "onanimationiteration",
4449
+ // Transition Events
4450
+ "ontransitionstart",
4451
+ "ontransitionrun",
4452
+ "ontransitionend",
4453
+ "ontransitioncancel",
4454
+ // Svelte Transition Events
4455
+ "onoutrostart",
4456
+ "onoutroend",
4457
+ "onintrostart",
4458
+ "onintroend",
4459
+ // Message Events
4460
+ "onmessage",
4461
+ "onmessageerror",
4462
+ // Document Events
4463
+ "onvisibilitychange",
4464
+ // Global Events
4465
+ "oncancel",
4466
+ "onclose",
4467
+ "onfullscreenchange",
4468
+ "onfullscreenerror"
4469
+ ];
4470
+ var checkAttributeByTagName = (tag, attribute) => {
4471
+ if (Object.prototype.hasOwnProperty.call(HTML_ATTRIBUTES, tag)) {
4472
+ const attributes = HTML_ATTRIBUTES[tag];
4473
+ return attributes.includes(attribute) || attributes.includes("default");
4474
+ } else {
4475
+ const defaultAttributes = HTML_ATTRIBUTES.default;
4476
+ return defaultAttributes.includes(attribute);
4477
+ }
4478
+ };
4479
+ var checkEventFunctions = (key) => {
4480
+ if (!isString(key)) return false;
4481
+ const normalizedKey = key.toLowerCase();
4482
+ return DOM_EVENTS.includes(normalizedKey);
4483
+ };
4484
+ var filterAttributesByTagName = (tag, props, cssProps) => {
4485
+ const filteredObject = {};
4486
+ for (const key in props) {
4487
+ if (Object.prototype.hasOwnProperty.call(props, key)) {
4488
+ if (cssProps && key in cssProps) continue;
4489
+ const isAttribute = checkAttributeByTagName(tag, key);
4490
+ const isEvent = checkEventFunctions(key);
4491
+ if (isDefined(props[key]) && (isAttribute || isEvent)) {
4492
+ filteredObject[key] = props[key];
4493
+ }
4494
+ }
4495
+ }
4496
+ return filteredObject;
4497
+ };
4498
+
4499
+ // ../element/dist/esm/create.js
4500
+ var EXCLUDED_ATTRS = /* @__PURE__ */ new Set(["class", "style"]);
4501
+ var applyPropsAsAttrs = (element) => {
4502
+ const { tag, props, context } = element;
4503
+ if (!tag || !props) return;
4504
+ const autoAttrs = filterAttributesByTagName(tag, props, context?.cssPropsRegistry);
4505
+ const filtered = {};
4506
+ for (const key in autoAttrs) {
4507
+ if (!EXCLUDED_ATTRS.has(key)) filtered[key] = autoAttrs[key];
4508
+ }
4509
+ let hasFiltered = false;
4510
+ for (const _k in filtered) {
4511
+ hasFiltered = true;
4512
+ break;
4513
+ }
4514
+ if (!hasFiltered) return;
4515
+ if (!element.attr) {
4516
+ element.attr = filtered;
4517
+ } else if (typeof element.attr === "object") {
4518
+ element.attr = { ...filtered, ...element.attr };
4519
+ }
4520
+ };
4521
+ var ENV6 = process.env.NODE_ENV;
4522
+ var create = (props, parentEl, passedKey, options = OPTIONS.create || {}, attachOptions) => {
4523
+ cacheOptions(options);
4524
+ const element = createElement(props, parentEl, passedKey, options, ROOT);
4525
+ if (!element) return;
4526
+ const { key, parent, __ref: ref } = element;
4527
+ createRoot(element, parent);
4528
+ applyExtends(element, parent, options);
4529
+ if (options.onlyResolveExtends) {
4530
+ return onlyResolveExtends(element, parent, key, options);
4531
+ }
4532
+ propertizeElement.call(element, element);
4533
+ triggerEventOn("start", element, options);
4534
+ resetOptions(element, parent, options);
4535
+ addMethods(element, parent, options);
4536
+ createScope(element, parent);
4537
+ createState(element, parent);
4538
+ if (element.scope === "state") element.scope = element.state;
4539
+ createIfConditionFlag(element, parent);
4540
+ initProps(element, parent, options);
4541
+ pickupElementFromProps.call(element, element, { cachedKeys: [] });
4542
+ applyPropsAsAttrs(element);
4543
+ if (element.scope === "props" || element.scope === true) {
4544
+ element.scope = element.props;
4545
+ }
4546
+ createIfConditionFlag(element, parent);
4547
+ if (element.node) {
4548
+ if (ref.__if) return assignNode(element, parent, key, attachOptions);
4549
+ }
4550
+ const onInit = triggerEventOn("init", element, options);
4551
+ if (onInit === false) return element;
4552
+ triggerEventOn("beforeClassAssign", element, options);
4553
+ assignKeyAsClassname(element);
4554
+ renderElement(element, parent, options, attachOptions);
4555
+ addElementIntoParentChildren(element, parent);
4556
+ triggerEventOn("complete", element, options);
4557
+ return element;
4558
+ };
4559
+ var cacheOptions = (options) => {
4560
+ if (options && !OPTIONS.create) {
4561
+ OPTIONS.create = options;
4562
+ OPTIONS.create.context = options.context;
4563
+ }
4564
+ };
4565
+ var resetOptions = (element, parent, options) => {
4566
+ let hasKeys = false;
4567
+ for (const _k in options) {
4568
+ hasKeys = true;
4569
+ break;
4570
+ }
4571
+ if (hasKeys) {
4572
+ OPTIONS.defaultOptions = options;
4573
+ if (options.ignoreChildExtends) delete options.ignoreChildExtends;
4574
+ }
4575
+ };
4576
+ var addElementIntoParentChildren = (element, parent) => {
4577
+ if (parent.__ref && parent.__ref.__children) {
4578
+ parent.__ref.__children.push(element.key);
4579
+ }
4580
+ };
4581
+ var _uniqIdCounter = 1;
4582
+ var visitedElements = /* @__PURE__ */ new WeakMap();
4583
+ var renderElement = (element, parent, options, attachOptions) => {
4584
+ if (visitedElements.has(element)) {
4585
+ if (ENV6 === "test" || ENV6 === "development") {
4586
+ console.warn("Cyclic rendering detected:", element.__ref.path);
4587
+ }
4588
+ }
4589
+ visitedElements.set(element, true);
4590
+ const { __ref: ref, key } = element;
4591
+ const createNestedChild = () => {
4592
+ const isInfiniteLoopDetected = detectInfiniteLoop(ref.path);
4593
+ if (ref.__uniqId || isInfiniteLoopDetected) return;
4594
+ createNode(element, options);
4595
+ ref.__uniqId = _uniqIdCounter++;
4596
+ };
4597
+ if (ENV6 === "test" || ENV6 === "development") {
4598
+ createNestedChild();
4599
+ } else {
4600
+ try {
4601
+ createNestedChild();
4602
+ } catch (e) {
4603
+ const path = ref.path;
4604
+ if (path.includes("ComponentsGrid")) {
4605
+ path.splice(0, path.indexOf("ComponentsGrid") + 2);
4606
+ }
4607
+ if (path.includes("demoComponent")) {
4608
+ path.splice(0, path.indexOf("demoComponent") + 1);
4609
+ }
4610
+ const isDemoComponent = element.lookup((el) => el.state.key)?.state?.key;
4611
+ element.warn(
4612
+ "Error happened in:",
4613
+ isDemoComponent ? isDemoComponent + " " : "" + path.join(".")
4614
+ );
4615
+ element.verbose();
4616
+ element.error(e, options);
4617
+ if (element.on?.error) {
4618
+ element.on.error(e, element, element.state, element.context, options);
4619
+ }
4620
+ }
4621
+ }
4622
+ if (!ref.__if) {
4623
+ parent[key || element.key] = element;
4624
+ return element;
4625
+ }
4626
+ assignNode(element, parent, key, attachOptions);
4627
+ applyAnimationFrame(element, options);
4628
+ triggerEventOn("render", element, options);
4629
+ triggerEventOn("renderRouter", element, options);
4630
+ triggerEventOn("done", element, options);
4631
+ triggerEventOn("create", element, options);
4632
+ };
4633
+ var onlyResolveExtends = (element, parent, key, options) => {
4634
+ const { __ref: ref } = element;
4635
+ addMethods(element, parent, options);
4636
+ createScope(element, parent);
4637
+ createState(element, parent);
4638
+ if (element.scope === "state") element.scope = element.state;
4639
+ createIfConditionFlag(element, parent);
4640
+ initProps(element, parent, options);
4641
+ pickupElementFromProps.call(element, element, { cachedKeys: [] });
4642
+ if (element.scope === "props" || element.scope === true) {
4643
+ element.scope = element.props;
4644
+ }
4645
+ if (element.node && ref.__if) {
4646
+ parent[key || element.key] = element;
4647
+ }
4648
+ if (!element.props) element.props = {};
4649
+ addElementIntoParentChildren(element, parent);
4650
+ if (element.tag !== "string" && element.tag !== "fragment") {
4651
+ throughInitialDefine(element);
4652
+ throughInitialExec(element);
4653
+ for (const k in element) {
4654
+ if (isUndefined(element[k]) || isMethod(k, element) || isObject(REGISTRY[k])) {
4655
+ continue;
4656
+ }
4657
+ const hasDefine = element.define?.[k];
4658
+ const contextHasDefine = element.context?.define?.[k];
4659
+ const optionsHasDefine = options.define?.[k];
4660
+ if (!ref.__skipCreate && REGISTRY[k] && !optionsHasDefine) {
4661
+ continue;
4662
+ } else if (element[k] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
4663
+ create(exec(element[k], element), element, k, options);
4664
+ }
4665
+ }
4666
+ }
4667
+ parent[key || element.key] = element;
4668
+ delete element.update;
4669
+ delete element.__element;
4670
+ if (element.props) {
4671
+ delete element.props.update;
4672
+ delete element.props.__element;
4673
+ }
4674
+ return element;
4675
+ };
4676
+ var create_default = create;
4677
+
4678
+ // index.js
4679
+ var create2 = (element, parent, key, options) => {
4680
+ const domqlElement = (create_default.default || create_default)(
4681
+ element,
4682
+ parent,
4683
+ key,
4684
+ options
4685
+ );
4686
+ const complete = domqlElement.on?.complete;
4687
+ if (complete) {
4688
+ domqlElement.on.complete(element, element.state, element.context, options);
4689
+ }
4690
+ const onComplete = domqlElement.props?.onComplete;
4691
+ if (onComplete) {
4692
+ domqlElement.props?.onComplete(
4693
+ element,
4694
+ element.state,
4695
+ element.context,
4696
+ options
4697
+ );
4698
+ }
4699
+ const initInspect = domqlElement.on?.initInspect;
4700
+ if (initInspect) {
4701
+ domqlElement.on.initInspect(
4702
+ element,
4703
+ element.state,
4704
+ element.context,
4705
+ options
4706
+ );
4707
+ }
4708
+ const initSync = domqlElement.on?.initSync;
4709
+ if (initSync) {
4710
+ domqlElement.on.initSync(element, element.state, element.context, options);
4711
+ }
4712
+ return domqlElement;
4713
+ };
4714
+ var index_default = {
4715
+ TREE,
4716
+ create: create2
4717
+ };
4718
+ return __toCommonJS(index_exports);
4719
+ })();
4720
+ // @preserve-env