modern-idoc 0.10.17 → 0.10.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +66 -40
- package/dist/index.d.cts +8 -6
- package/dist/index.d.mts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +2 -2
- package/dist/index.mjs +66 -40
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -271,16 +271,16 @@ class RawWeakMap {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
const
|
|
275
|
-
const initedSymbol = Symbol("inited");
|
|
274
|
+
const declarationsSymbol = Symbol.for("declarations");
|
|
275
|
+
const initedSymbol = Symbol.for("inited");
|
|
276
276
|
function getDeclarations(constructor) {
|
|
277
277
|
let declarations;
|
|
278
|
-
if (Object.hasOwn(constructor,
|
|
279
|
-
declarations = constructor[
|
|
278
|
+
if (Object.hasOwn(constructor, declarationsSymbol)) {
|
|
279
|
+
declarations = constructor[declarationsSymbol];
|
|
280
280
|
} else {
|
|
281
281
|
const superConstructor = Object.getPrototypeOf(constructor);
|
|
282
|
-
declarations =
|
|
283
|
-
constructor[
|
|
282
|
+
declarations = { ...superConstructor ? getDeclarations(superConstructor) : {} };
|
|
283
|
+
constructor[declarationsSymbol] = declarations;
|
|
284
284
|
}
|
|
285
285
|
return declarations;
|
|
286
286
|
}
|
|
@@ -360,9 +360,10 @@ function getPropertyDescriptor(key, declaration) {
|
|
|
360
360
|
function defineProperty(constructor, key, declaration = {}) {
|
|
361
361
|
const _declaration = {
|
|
362
362
|
...declaration,
|
|
363
|
-
internalKey: Symbol(key)
|
|
363
|
+
internalKey: Symbol.for(key)
|
|
364
364
|
};
|
|
365
|
-
getDeclarations(constructor)
|
|
365
|
+
const declarations = getDeclarations(constructor);
|
|
366
|
+
declarations[key] = _declaration;
|
|
366
367
|
const { get, set } = getPropertyDescriptor(key, _declaration);
|
|
367
368
|
Object.defineProperty(constructor.prototype, key, {
|
|
368
369
|
get() {
|
|
@@ -391,12 +392,13 @@ function property2(declaration = {}) {
|
|
|
391
392
|
}
|
|
392
393
|
const _declaration = {
|
|
393
394
|
...declaration,
|
|
394
|
-
internalKey: Symbol(key)
|
|
395
|
+
internalKey: Symbol.for(key)
|
|
395
396
|
};
|
|
396
397
|
const descriptor = getPropertyDescriptor(key, _declaration);
|
|
397
398
|
return {
|
|
398
399
|
init(v) {
|
|
399
|
-
getDeclarations(this.constructor)
|
|
400
|
+
const declarations = getDeclarations(this.constructor);
|
|
401
|
+
declarations[key] = _declaration;
|
|
400
402
|
descriptor.set.call(this, v);
|
|
401
403
|
return v;
|
|
402
404
|
},
|
|
@@ -412,8 +414,8 @@ function property2(declaration = {}) {
|
|
|
412
414
|
|
|
413
415
|
class Reactivable extends Observable {
|
|
414
416
|
_propertyAccessor;
|
|
415
|
-
_properties =
|
|
416
|
-
_updatedProperties =
|
|
417
|
+
_properties = {};
|
|
418
|
+
_updatedProperties = {};
|
|
417
419
|
_changedProperties = /* @__PURE__ */ new Set();
|
|
418
420
|
_updatingPromise = Promise.resolve();
|
|
419
421
|
_updating = false;
|
|
@@ -422,7 +424,13 @@ class Reactivable extends Observable {
|
|
|
422
424
|
this.setProperties(properties);
|
|
423
425
|
}
|
|
424
426
|
isDirty(key) {
|
|
425
|
-
return key ? this._updatedProperties
|
|
427
|
+
return key ? Boolean(this._updatedProperties[key]) : Object.keys(this._updatedProperties).length > 0;
|
|
428
|
+
}
|
|
429
|
+
offsetGetProperty(key) {
|
|
430
|
+
return this._properties[key];
|
|
431
|
+
}
|
|
432
|
+
offsetSetProperty(key, value) {
|
|
433
|
+
this._properties[key] = value;
|
|
426
434
|
}
|
|
427
435
|
getProperty(key) {
|
|
428
436
|
const declaration = this.getPropertyDeclaration(key);
|
|
@@ -435,7 +443,7 @@ class Reactivable extends Observable {
|
|
|
435
443
|
if (accessor && accessor.getProperty) {
|
|
436
444
|
result = accessor.getProperty(key);
|
|
437
445
|
} else {
|
|
438
|
-
result = this.
|
|
446
|
+
result = this.offsetGetProperty(key);
|
|
439
447
|
}
|
|
440
448
|
return result ?? propertyOffsetFallback(this, key, declaration);
|
|
441
449
|
}
|
|
@@ -450,7 +458,7 @@ class Reactivable extends Observable {
|
|
|
450
458
|
} else {
|
|
451
459
|
const oldValue = this.getProperty(key);
|
|
452
460
|
this._propertyAccessor?.setProperty?.(key, newValue);
|
|
453
|
-
this.
|
|
461
|
+
this.offsetSetProperty(key, newValue);
|
|
454
462
|
this.onUpdateProperty?.(
|
|
455
463
|
key,
|
|
456
464
|
newValue ?? propertyOffsetFallback(this, key, declaration),
|
|
@@ -461,9 +469,13 @@ class Reactivable extends Observable {
|
|
|
461
469
|
}
|
|
462
470
|
getProperties(keys) {
|
|
463
471
|
const properties = {};
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
472
|
+
const declarations = this.getPropertyDeclarations();
|
|
473
|
+
const declarationKeys = Object.keys(declarations);
|
|
474
|
+
for (let i = 0, len = declarationKeys.length; i < len; i++) {
|
|
475
|
+
const key = declarationKeys[i];
|
|
476
|
+
const declaration = declarations[key];
|
|
477
|
+
if (!declaration.internal && !declaration.alias && (!keys || keys.includes(key))) {
|
|
478
|
+
properties[key] = this.getProperty(key);
|
|
467
479
|
}
|
|
468
480
|
}
|
|
469
481
|
return properties;
|
|
@@ -477,9 +489,13 @@ class Reactivable extends Observable {
|
|
|
477
489
|
return this;
|
|
478
490
|
}
|
|
479
491
|
resetProperties() {
|
|
480
|
-
|
|
492
|
+
const declarations = this.getPropertyDeclarations();
|
|
493
|
+
const declarationKeys = Object.keys(declarations);
|
|
494
|
+
for (let i = 0, len = declarationKeys.length; i < len; i++) {
|
|
495
|
+
const key = declarationKeys[i];
|
|
496
|
+
const declaration = declarations[key];
|
|
481
497
|
this.setProperty(
|
|
482
|
-
|
|
498
|
+
key,
|
|
483
499
|
typeof declaration.default === "function" ? declaration.default() : declaration.default
|
|
484
500
|
);
|
|
485
501
|
}
|
|
@@ -489,26 +505,32 @@ class Reactivable extends Observable {
|
|
|
489
505
|
return getDeclarations(this.constructor);
|
|
490
506
|
}
|
|
491
507
|
getPropertyDeclaration(key) {
|
|
492
|
-
return this.getPropertyDeclarations()
|
|
508
|
+
return this.getPropertyDeclarations()[key];
|
|
493
509
|
}
|
|
494
510
|
setPropertyAccessor(accessor) {
|
|
495
511
|
const declarations = this.getPropertyDeclarations();
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
if (
|
|
508
|
-
|
|
512
|
+
const items = [];
|
|
513
|
+
if (accessor && accessor.getProperty && accessor.setProperty) {
|
|
514
|
+
const declarationKeys = Object.keys(declarations);
|
|
515
|
+
for (let i = 0, len = declarationKeys.length; i < len; i++) {
|
|
516
|
+
const key = declarationKeys[i];
|
|
517
|
+
const declaration = declarations[key];
|
|
518
|
+
if (declaration.internal || declaration.alias) {
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
const oldValue = this.offsetGetProperty(key);
|
|
522
|
+
const newValue = accessor.getProperty(key);
|
|
523
|
+
if ((oldValue !== void 0 || newValue !== void 0) && !Object.is(oldValue, newValue)) {
|
|
524
|
+
accessor.setProperty(key, newValue);
|
|
525
|
+
items.push({ key, newValue, oldValue });
|
|
509
526
|
}
|
|
510
527
|
}
|
|
511
|
-
}
|
|
528
|
+
}
|
|
529
|
+
this._propertyAccessor = accessor;
|
|
530
|
+
for (let i = 0, len = items.length; i < len; i++) {
|
|
531
|
+
const { key, newValue, oldValue } = items[i];
|
|
532
|
+
this.requestUpdate(key, newValue, oldValue);
|
|
533
|
+
}
|
|
512
534
|
return this;
|
|
513
535
|
}
|
|
514
536
|
async _nextTick() {
|
|
@@ -532,7 +554,7 @@ class Reactivable extends Observable {
|
|
|
532
554
|
}
|
|
533
555
|
onUpdate() {
|
|
534
556
|
this._update(this._updatedProperties);
|
|
535
|
-
this._updatedProperties =
|
|
557
|
+
this._updatedProperties = {};
|
|
536
558
|
}
|
|
537
559
|
onUpdateProperty(key, newValue, oldValue) {
|
|
538
560
|
if (!Object.is(newValue, oldValue)) {
|
|
@@ -541,7 +563,7 @@ class Reactivable extends Observable {
|
|
|
541
563
|
}
|
|
542
564
|
requestUpdate(key, newValue, oldValue) {
|
|
543
565
|
if (key !== void 0) {
|
|
544
|
-
this._updatedProperties
|
|
566
|
+
this._updatedProperties[key] = oldValue;
|
|
545
567
|
this._changedProperties.add(key);
|
|
546
568
|
this._updateProperty(key, newValue, oldValue);
|
|
547
569
|
this.emit("updateProperty", key, newValue, oldValue);
|
|
@@ -558,9 +580,13 @@ class Reactivable extends Observable {
|
|
|
558
580
|
}
|
|
559
581
|
toJSON() {
|
|
560
582
|
const json = {};
|
|
561
|
-
this._properties
|
|
583
|
+
const properties = this._properties;
|
|
584
|
+
const keys = Object.keys(properties);
|
|
585
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
586
|
+
const key = keys[i];
|
|
587
|
+
const value = properties[key];
|
|
562
588
|
if (value === void 0) {
|
|
563
|
-
|
|
589
|
+
continue;
|
|
564
590
|
}
|
|
565
591
|
if (value && typeof value === "object") {
|
|
566
592
|
if ("toJSON" in value && typeof value.toJSON === "function") {
|
|
@@ -573,7 +599,7 @@ class Reactivable extends Observable {
|
|
|
573
599
|
} else {
|
|
574
600
|
json[key] = value;
|
|
575
601
|
}
|
|
576
|
-
}
|
|
602
|
+
}
|
|
577
603
|
return json;
|
|
578
604
|
}
|
|
579
605
|
clone() {
|
package/dist/index.d.cts
CHANGED
|
@@ -338,7 +338,7 @@ interface PropertyAccessor {
|
|
|
338
338
|
setProperty?: (key: string, newValue: any) => void;
|
|
339
339
|
onUpdateProperty?: (key: string, newValue: any, oldValue: any) => void;
|
|
340
340
|
}
|
|
341
|
-
declare function getDeclarations(constructor: any):
|
|
341
|
+
declare function getDeclarations(constructor: any): Record<string, PropertyDeclaration>;
|
|
342
342
|
declare function propertyOffsetSet(target: any & PropertyAccessor, key: string, newValue: any, declaration: PropertyDeclaration): void;
|
|
343
343
|
declare function propertyOffsetGet(target: any & PropertyAccessor, key: string, declaration: PropertyDeclaration): any;
|
|
344
344
|
declare function propertyOffsetFallback(target: any & PropertyAccessor, key: string, declaration: PropertyDeclaration): any;
|
|
@@ -881,27 +881,29 @@ interface Reactivable {
|
|
|
881
881
|
}
|
|
882
882
|
declare class Reactivable extends Observable implements PropertyAccessor {
|
|
883
883
|
protected _propertyAccessor?: PropertyAccessor;
|
|
884
|
-
protected _properties:
|
|
885
|
-
protected _updatedProperties:
|
|
884
|
+
protected _properties: Record<string, any>;
|
|
885
|
+
protected _updatedProperties: Record<string, any>;
|
|
886
886
|
protected _changedProperties: Set<string>;
|
|
887
887
|
protected _updatingPromise: Promise<void>;
|
|
888
888
|
protected _updating: boolean;
|
|
889
889
|
constructor(properties?: Record<string, any>);
|
|
890
890
|
isDirty(key?: string): boolean;
|
|
891
|
+
offsetGetProperty(key: string): any;
|
|
892
|
+
offsetSetProperty(key: string, value: any): void;
|
|
891
893
|
getProperty(key: string): any;
|
|
892
894
|
setProperty(key: string, newValue: any): void;
|
|
893
895
|
getProperties(keys?: string[]): Record<string, any>;
|
|
894
896
|
setProperties(properties?: Record<string, any>): this;
|
|
895
897
|
resetProperties(): this;
|
|
896
|
-
getPropertyDeclarations():
|
|
898
|
+
getPropertyDeclarations(): Record<string, PropertyDeclaration>;
|
|
897
899
|
getPropertyDeclaration(key: string): PropertyDeclaration | undefined;
|
|
898
|
-
setPropertyAccessor(accessor
|
|
900
|
+
setPropertyAccessor(accessor?: PropertyAccessor): this;
|
|
899
901
|
protected _nextTick(): Promise<void>;
|
|
900
902
|
protected _enqueueUpdate(): Promise<void>;
|
|
901
903
|
onUpdate(): void;
|
|
902
904
|
onUpdateProperty(key: string, newValue: any, oldValue: any): void;
|
|
903
905
|
requestUpdate(key?: string, newValue?: any, oldValue?: any): void;
|
|
904
|
-
protected _update(changed:
|
|
906
|
+
protected _update(changed: Record<string, any>): void;
|
|
905
907
|
protected _updateProperty(key: string, newValue: any, oldValue: any): void;
|
|
906
908
|
toJSON(): Record<string, any>;
|
|
907
909
|
clone(): this;
|
package/dist/index.d.mts
CHANGED
|
@@ -338,7 +338,7 @@ interface PropertyAccessor {
|
|
|
338
338
|
setProperty?: (key: string, newValue: any) => void;
|
|
339
339
|
onUpdateProperty?: (key: string, newValue: any, oldValue: any) => void;
|
|
340
340
|
}
|
|
341
|
-
declare function getDeclarations(constructor: any):
|
|
341
|
+
declare function getDeclarations(constructor: any): Record<string, PropertyDeclaration>;
|
|
342
342
|
declare function propertyOffsetSet(target: any & PropertyAccessor, key: string, newValue: any, declaration: PropertyDeclaration): void;
|
|
343
343
|
declare function propertyOffsetGet(target: any & PropertyAccessor, key: string, declaration: PropertyDeclaration): any;
|
|
344
344
|
declare function propertyOffsetFallback(target: any & PropertyAccessor, key: string, declaration: PropertyDeclaration): any;
|
|
@@ -881,27 +881,29 @@ interface Reactivable {
|
|
|
881
881
|
}
|
|
882
882
|
declare class Reactivable extends Observable implements PropertyAccessor {
|
|
883
883
|
protected _propertyAccessor?: PropertyAccessor;
|
|
884
|
-
protected _properties:
|
|
885
|
-
protected _updatedProperties:
|
|
884
|
+
protected _properties: Record<string, any>;
|
|
885
|
+
protected _updatedProperties: Record<string, any>;
|
|
886
886
|
protected _changedProperties: Set<string>;
|
|
887
887
|
protected _updatingPromise: Promise<void>;
|
|
888
888
|
protected _updating: boolean;
|
|
889
889
|
constructor(properties?: Record<string, any>);
|
|
890
890
|
isDirty(key?: string): boolean;
|
|
891
|
+
offsetGetProperty(key: string): any;
|
|
892
|
+
offsetSetProperty(key: string, value: any): void;
|
|
891
893
|
getProperty(key: string): any;
|
|
892
894
|
setProperty(key: string, newValue: any): void;
|
|
893
895
|
getProperties(keys?: string[]): Record<string, any>;
|
|
894
896
|
setProperties(properties?: Record<string, any>): this;
|
|
895
897
|
resetProperties(): this;
|
|
896
|
-
getPropertyDeclarations():
|
|
898
|
+
getPropertyDeclarations(): Record<string, PropertyDeclaration>;
|
|
897
899
|
getPropertyDeclaration(key: string): PropertyDeclaration | undefined;
|
|
898
|
-
setPropertyAccessor(accessor
|
|
900
|
+
setPropertyAccessor(accessor?: PropertyAccessor): this;
|
|
899
901
|
protected _nextTick(): Promise<void>;
|
|
900
902
|
protected _enqueueUpdate(): Promise<void>;
|
|
901
903
|
onUpdate(): void;
|
|
902
904
|
onUpdateProperty(key: string, newValue: any, oldValue: any): void;
|
|
903
905
|
requestUpdate(key?: string, newValue?: any, oldValue?: any): void;
|
|
904
|
-
protected _update(changed:
|
|
906
|
+
protected _update(changed: Record<string, any>): void;
|
|
905
907
|
protected _updateProperty(key: string, newValue: any, oldValue: any): void;
|
|
906
908
|
toJSON(): Record<string, any>;
|
|
907
909
|
clone(): this;
|
package/dist/index.d.ts
CHANGED
|
@@ -338,7 +338,7 @@ interface PropertyAccessor {
|
|
|
338
338
|
setProperty?: (key: string, newValue: any) => void;
|
|
339
339
|
onUpdateProperty?: (key: string, newValue: any, oldValue: any) => void;
|
|
340
340
|
}
|
|
341
|
-
declare function getDeclarations(constructor: any):
|
|
341
|
+
declare function getDeclarations(constructor: any): Record<string, PropertyDeclaration>;
|
|
342
342
|
declare function propertyOffsetSet(target: any & PropertyAccessor, key: string, newValue: any, declaration: PropertyDeclaration): void;
|
|
343
343
|
declare function propertyOffsetGet(target: any & PropertyAccessor, key: string, declaration: PropertyDeclaration): any;
|
|
344
344
|
declare function propertyOffsetFallback(target: any & PropertyAccessor, key: string, declaration: PropertyDeclaration): any;
|
|
@@ -881,27 +881,29 @@ interface Reactivable {
|
|
|
881
881
|
}
|
|
882
882
|
declare class Reactivable extends Observable implements PropertyAccessor {
|
|
883
883
|
protected _propertyAccessor?: PropertyAccessor;
|
|
884
|
-
protected _properties:
|
|
885
|
-
protected _updatedProperties:
|
|
884
|
+
protected _properties: Record<string, any>;
|
|
885
|
+
protected _updatedProperties: Record<string, any>;
|
|
886
886
|
protected _changedProperties: Set<string>;
|
|
887
887
|
protected _updatingPromise: Promise<void>;
|
|
888
888
|
protected _updating: boolean;
|
|
889
889
|
constructor(properties?: Record<string, any>);
|
|
890
890
|
isDirty(key?: string): boolean;
|
|
891
|
+
offsetGetProperty(key: string): any;
|
|
892
|
+
offsetSetProperty(key: string, value: any): void;
|
|
891
893
|
getProperty(key: string): any;
|
|
892
894
|
setProperty(key: string, newValue: any): void;
|
|
893
895
|
getProperties(keys?: string[]): Record<string, any>;
|
|
894
896
|
setProperties(properties?: Record<string, any>): this;
|
|
895
897
|
resetProperties(): this;
|
|
896
|
-
getPropertyDeclarations():
|
|
898
|
+
getPropertyDeclarations(): Record<string, PropertyDeclaration>;
|
|
897
899
|
getPropertyDeclaration(key: string): PropertyDeclaration | undefined;
|
|
898
|
-
setPropertyAccessor(accessor
|
|
900
|
+
setPropertyAccessor(accessor?: PropertyAccessor): this;
|
|
899
901
|
protected _nextTick(): Promise<void>;
|
|
900
902
|
protected _enqueueUpdate(): Promise<void>;
|
|
901
903
|
onUpdate(): void;
|
|
902
904
|
onUpdateProperty(key: string, newValue: any, oldValue: any): void;
|
|
903
905
|
requestUpdate(key?: string, newValue?: any, oldValue?: any): void;
|
|
904
|
-
protected _update(changed:
|
|
906
|
+
protected _update(changed: Record<string, any>): void;
|
|
905
907
|
protected _updateProperty(key: string, newValue: any, oldValue: any): void;
|
|
906
908
|
toJSON(): Record<string, any>;
|
|
907
909
|
clone(): this;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(o,I){typeof exports=="object"&&typeof module<"u"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(o=typeof globalThis<"u"?globalThis:o||self,I(o.modernIdoc={}))})(this,(function(o){"use strict";function I(t){return typeof t=="string"?{src:t}:t}var Oe={grad:.9,turn:360,rad:360/(2*Math.PI)},D=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},v=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},P=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},wt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Pt=function(t){return{r:P(t.r,0,255),g:P(t.g,0,255),b:P(t.b,0,255),a:P(t.a)}},nt=function(t){return{r:v(t.r),g:v(t.g),b:v(t.b),a:v(t.a,3)}},Le=/^#([0-9a-f]{3,8})$/i,q=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Ft=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,a=Math.max(e,n,r),s=a-Math.min(e,n,r),u=s?a===e?(n-r)/s:a===n?2+(r-e)/s:4+(e-n)/s:0;return{h:60*(u<0?u+6:u),s:a?s/a*100:0,v:a/255*100,a:i}},Ot=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var a=Math.floor(e),s=r*(1-n),u=r*(1-(e-a)*n),f=r*(1-(1-e+a)*n),g=a%6;return{r:255*[r,u,s,s,f,r][g],g:255*[f,r,r,u,s,s][g],b:255*[s,s,f,r,r,u][g],a:i}},Lt=function(t){return{h:wt(t.h),s:P(t.s,0,100),l:P(t.l,0,100),a:P(t.a)}},zt=function(t){return{h:v(t.h),s:v(t.s),l:v(t.l),a:v(t.a,3)}},Et=function(t){return Ot((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},M=function(t){return{h:(e=Ft(t)).h,s:(i=(200-(n=e.s))*(r=e.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,n,r,i},ze=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ee=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,De=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ae=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Dt={string:[[function(t){var e=Le.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?v(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?v(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=De.exec(t)||Ae.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Pt({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=ze.exec(t)||Ee.exec(t);if(!e)return null;var n,r,i=Lt({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(Oe[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Et(i)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,i=t.a,a=i===void 0?1:i;return D(e)&&D(n)&&D(r)?Pt({r:Number(e),g:Number(n),b:Number(r),a:Number(a)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,i=t.a,a=i===void 0?1:i;if(!D(e)||!D(n)||!D(r))return null;var s=Lt({h:Number(e),s:Number(n),l:Number(r),a:Number(a)});return Et(s)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,i=t.a,a=i===void 0?1:i;if(!D(e)||!D(n)||!D(r))return null;var s=(function(u){return{h:wt(u.h),s:P(u.s,0,100),v:P(u.v,0,100),a:P(u.a)}})({h:Number(e),s:Number(n),v:Number(r),a:Number(a)});return Ot(s)},"hsv"]]},At=function(t,e){for(var n=0;n<e.length;n++){var r=e[n][0](t);if(r)return[r,e[n][1]]}return[null,void 0]},Ne=function(t){return typeof t=="string"?At(t.trim(),Dt.string):typeof t=="object"&&t!==null?At(t,Dt.object):[null,void 0]},rt=function(t,e){var n=M(t);return{h:n.h,s:P(n.s+100*e,0,100),l:n.l,a:n.a}},it=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Nt=function(t,e){var n=M(t);return{h:n.h,s:n.s,l:P(n.l+100*e,0,100),a:n.a}},Rt=(function(){function t(e){this.parsed=Ne(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return v(it(this.rgba),2)},t.prototype.isDark=function(){return it(this.rgba)<.5},t.prototype.isLight=function(){return it(this.rgba)>=.5},t.prototype.toHex=function(){return e=nt(this.rgba),n=e.r,r=e.g,i=e.b,s=(a=e.a)<1?q(v(255*a)):"","#"+q(n)+q(r)+q(i)+s;var e,n,r,i,a,s},t.prototype.toRgb=function(){return nt(this.rgba)},t.prototype.toRgbString=function(){return e=nt(this.rgba),n=e.r,r=e.g,i=e.b,(a=e.a)<1?"rgba("+n+", "+r+", "+i+", "+a+")":"rgb("+n+", "+r+", "+i+")";var e,n,r,i,a},t.prototype.toHsl=function(){return zt(M(this.rgba))},t.prototype.toHslString=function(){return e=zt(M(this.rgba)),n=e.h,r=e.s,i=e.l,(a=e.a)<1?"hsla("+n+", "+r+"%, "+i+"%, "+a+")":"hsl("+n+", "+r+"%, "+i+"%)";var e,n,r,i,a},t.prototype.toHsv=function(){return e=Ft(this.rgba),{h:v(e.h),s:v(e.s),v:v(e.v),a:v(e.a,3)};var e},t.prototype.invert=function(){return E({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),E(rt(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),E(rt(this.rgba,-e))},t.prototype.grayscale=function(){return E(rt(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),E(Nt(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),E(Nt(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?E({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):v(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=M(this.rgba);return typeof e=="number"?E({h:e,s:n.s,l:n.l,a:n.a}):v(n.h)},t.prototype.isEqual=function(e){return this.toHex()===E(e).toHex()},t})(),E=function(t){return t instanceof Rt?t:new Rt(t)};class Re{eventListeners=new Map;addEventListener(e,n,r){const i={value:n,options:r},a=this.eventListeners.get(e);return a?Array.isArray(a)?a.push(i):this.eventListeners.set(e,[a,i]):this.eventListeners.set(e,i),this}removeEventListener(e,n,r){if(!n)return this.eventListeners.delete(e),this;const i=this.eventListeners.get(e);if(!i)return this;if(Array.isArray(i)){const a=[];for(let s=0,u=i.length;s<u;s++){const f=i[s];(f.value!==n||typeof r=="object"&&r?.once&&(typeof f.options=="boolean"||!f.options?.once))&&a.push(f)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else i.value===n&&(typeof r=="boolean"||!r?.once||typeof i.options=="boolean"||i.options?.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,...n){const r=this.eventListeners.get(e);if(r){if(Array.isArray(r))for(let i=r.length,a=0;a<i;a++){const s=r[a];typeof s.options=="object"&&s.options?.once&&this.off(e,s.value,s.options),s.value.apply(this,n)}else typeof r.options=="object"&&r.options?.once&&this.off(e,r.value,r.options),r.value.apply(this,n);return!0}else return!1}on(e,n,r){return this.addEventListener(e,n,r)}once(e,n){return this.addEventListener(e,n,{once:!0})}off(e,n,r){return this.removeEventListener(e,n,r)}emit(e,...n){this.dispatchEvent(e,...n)}}function h(t){return t==null||t===""||t==="none"}function N(t,e=0,n=10**e){return Math.round(n*t)/n+0}function F(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(r=>F(r,e)):t;const n={};for(const r in t){const i=t[r];i!=null&&(e?n[r]=F(i,e):n[r]=i)}return n}function A(t,e){const n={};return e.forEach(r=>{r in t&&(n[r]=t[r])}),n}function x(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){const n=Array.from(new Set([...Object.keys(t),...Object.keys(e)]));return!n.length||n.every(r=>t[r]===e[r])}return!1}function jt(t,e,n){const r=e.length-1;if(r<0)return t===void 0?n:t;for(let i=0;i<r;i++){if(t==null)return n;t=t[e[i]]}return t==null||t[e[r]]===void 0?n:t[e[r]]}function Gt(t,e,n){const r=e.length-1;for(let i=0;i<r;i++)typeof t[e[i]]!="object"&&(t[e[i]]={}),t=t[e[i]];t[e[r]]=n}function It(t,e,n){return t==null||!e||typeof e!="string"?n:t[e]!==void 0?t[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),jt(t,e.split("."),n))}function Tt(t,e,n){if(!(typeof t!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Gt(t,e.split("."),n)}class Vt{_eventListeners={};on(e,n){let r=this._eventListeners[e];r===void 0&&(r=[],this._eventListeners[e]=r);const i=r.indexOf(n);return i>-1&&r.splice(i,1),r.push(n),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r),this}off(e,n){const r=this._eventListeners[e];if(r!==void 0){const i=r.indexOf(n);i>-1&&r.splice(i,1)}return this}emit(e,...n){const r=this._eventListeners[e];if(r!==void 0){const i=r.length;if(i>0)for(let a=0;a<i;a++)r[a].apply(this,n)}return this}removeAllListeners(){return this._eventListeners={},this}hasEventListener(e){return!!this._eventListeners[e]}destroy(){this.removeAllListeners()}}class je{_map=new WeakMap;_toRaw(e){if(e&&typeof e=="object"){const n=e.__v_raw;n&&(e=this._toRaw(n))}return e}delete(e){return this._map.delete(this._toRaw(e))}get(e){return this._map.get(this._toRaw(e))}has(e){return this._map.has(this._toRaw(e))}set(e,n){return this._map.set(this._toRaw(e),this._toRaw(n)),this}}const ot=Symbol("properties"),J=Symbol("inited");function k(t){let e;if(Object.hasOwn(t,ot))e=t[ot];else{const n=Object.getPrototypeOf(t);e=new Map(n?k(n):void 0),t[ot]=e}return e}function at(t,e,n,r){const{alias:i,internalKey:a}=r,s=t[e];i?Tt(t,i,n):t[a]=n,t.onUpdateProperty?.(e,n??$(t,e,r),s)}function st(t,e,n){const{alias:r,internalKey:i}=n;let a;return r?a=It(t,r):a=t[i],a=a??$(t,e,n),a}function $(t,e,n){const{default:r,fallback:i}=n;let a;if(r!==void 0&&!t[J]?.[e]){t[J]||(t[J]={}),t[J][e]=!0;const s=typeof r=="function"?r():r;s!==void 0&&(t[e]=s,a=s)}return a===void 0&&i!==void 0&&(a=typeof i=="function"?i():i),a}function lt(t,e){function n(){return this.getProperty?this.getProperty(t):st(this,t,e)}function r(i){this.setProperty?this.setProperty(t,i):at(this,t,i,e)}return{get:n,set:r}}function Mt(t,e,n={}){const r={...n,internalKey:Symbol(e)};k(t).set(e,r);const{get:i,set:a}=lt(e,r);Object.defineProperty(t.prototype,e,{get(){return i.call(this)},set(s){a.call(this,s)},configurable:!0,enumerable:!0})}function Ge(t){return function(e,n){if(typeof n!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");Mt(e.constructor,n,t)}}function Ie(t={}){return function(e,n){const r=n.name;if(typeof r!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");const i={...t,internalKey:Symbol(r)},a=lt(r,i);return{init(s){return k(this.constructor).set(r,i),a.set.call(this,s),s},get(){return a.get.call(this)},set(s){a.set.call(this,s)}}}}class Te extends Vt{_propertyAccessor;_properties=new Map;_updatedProperties=new Map;_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?this._updatedProperties.has(e):this._updatedProperties.size>0}getProperty(e){const n=this.getPropertyDeclaration(e);if(n){if(n.internal||n.alias)return st(this,e,n);{const r=this._propertyAccessor;let i;return r&&r.getProperty?i=r.getProperty(e):i=this._properties.get(e),i??$(this,e,n)}}}setProperty(e,n){const r=this.getPropertyDeclaration(e);if(r)if(r.internal||r.alias)at(this,e,n,r);else{const i=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,n),this._properties.set(e,n),this.onUpdateProperty?.(e,n??$(this,e,r),i)}}getProperties(e){const n={};for(const[r,i]of this.getPropertyDeclarations())!i.internal&&!i.alias&&(!e||e.includes(r))&&(n[r]=this.getProperty(r));return n}setProperties(e){if(e&&typeof e=="object")for(const n in e)this.setProperty(n,e[n]);return this}resetProperties(){for(const[e,n]of this.getPropertyDeclarations())this.setProperty(e,typeof n.default=="function"?n.default():n.default);return this}getPropertyDeclarations(){return k(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations().get(e)}setPropertyAccessor(e){const n=this.getPropertyDeclarations();this._propertyAccessor=void 0;const r={};return n.forEach((i,a)=>{r[a]=this.getProperty(a)}),this._propertyAccessor=e,n.forEach((i,a)=>{const s=this.getProperty(a),u=r[a];s!==void 0&&!Object.is(s,u)&&(this.setProperty(a,s),!i.internal&&!i.alias&&this.requestUpdate(a,s,u))}),this}async _nextTick(){return"requestAnimationFrame"in globalThis?new Promise(e=>globalThis.requestAnimationFrame(e)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(e){Promise.reject(e)}await this._nextTick(),this._updating&&(this.onUpdate(),this._updating=!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties=new Map}onUpdateProperty(e,n,r){Object.is(n,r)||this.requestUpdate(e,n,r)}requestUpdate(e,n,r){e!==void 0&&(this._updatedProperties.set(e,r),this._changedProperties.add(e),this._updateProperty(e,n,r),this.emit("updateProperty",e,n,r)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(e){}_updateProperty(e,n,r){}toJSON(){const e={};return this._properties.forEach((n,r)=>{n!==void 0&&(n&&typeof n=="object"?"toJSON"in n&&typeof n.toJSON=="function"?e[r]=n.toJSON():Array.isArray(n)?e[r]=[...n]:e[r]={...n}:e[r]=n)}),e}clone(){return new this.constructor(this.toJSON())}destroy(){this.emit("destroy"),super.destroy()}}function ut(t){let e;return typeof t=="number"?e={r:t>>24&255,g:t>>16&255,b:t>>8&255,a:(t&255)/255}:e=t,E(e)}function Ve(t){return{r:N(t.r),g:N(t.g),b:N(t.b),a:N(t.a,3)}}function X(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const W="#000000FF";function ct(t){return ut(t).isValid()}function y(t,e=!1){const n=ut(t);if(!n.isValid()){if(typeof t=="string")return t;const u=`Failed to normalizeColor ${t}`;if(e)throw new Error(u);return console.warn(u),W}const{r,g:i,b:a,a:s}=Ve(n.rgba);return`#${X(r)}${X(i)}${X(a)}${X(N(s*255))}`}var Y=Y||{};Y.parse=(function(){const t={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function n(l){const c=new Error(`${e}: ${l}`);throw c.source=e,c}function r(){const l=i();return e.length>0&&n("Invalid input not EOF"),l}function i(){return V(a)}function a(){return s("linear-gradient",t.linearGradient,f)||s("repeating-linear-gradient",t.repeatingLinearGradient,f)||s("radial-gradient",t.radialGradient,p)||s("repeating-radial-gradient",t.repeatingRadialGradient,p)}function s(l,c,d){return u(c,S=>{const G=d();return G&&(m(t.comma)||n("Missing comma before color stops")),{type:l,orientation:G,colorStops:V(_t)}})}function u(l,c){const d=m(l);if(d){m(t.startCall)||n("Missing (");const S=c(d);return m(t.endCall)||n("Missing )"),S}}function f(){const l=g();if(l)return l;const c=w("position-keyword",t.positionKeywords,1);return c?{type:"directional",value:c.value}:b()}function g(){return w("directional",t.sideOrCorner,1)}function b(){return w("angular",t.angleValue,1)||w("angular",t.radianValue,1)}function p(){let l,c=_(),d;return c&&(l=[],l.push(c),d=e,m(t.comma)&&(c=_(),c?l.push(c):e=d)),l}function _(){let l=C()||R();if(l)l.at=z();else{const c=O();if(c){l=c;const d=z();d&&(l.at=d)}else{const d=z();if(d)l={type:"default-radial",at:d};else{const S=j();S&&(l={type:"default-radial",at:S})}}}return l}function C(){const l=w("shape",/^(circle)/i,0);return l&&(l.style=Fe()||O()),l}function R(){const l=w("shape",/^(ellipse)/i,0);return l&&(l.style=j()||et()||O()),l}function O(){return w("extent-keyword",t.extentKeywords,1)}function z(){if(w("position",/^at/,0)){const l=j();return l||n("Missing positioning value"),l}}function j(){const l=U();if(l.x||l.y)return{type:"position",value:l}}function U(){return{x:et(),y:et()}}function V(l){let c=l();const d=[];if(c)for(d.push(c);m(t.comma);)c=l(),c?d.push(c):n("One extra comma");return d}function _t(){const l=Ye();return l||n("Expected color definition"),l.length=et(),l}function Ye(){return Qe()||on()||rn()||en()||tn()||nn()||Ze()}function Ze(){return w("literal",t.literalColor,0)}function Qe(){return w("hex",t.hexColor,1)}function tn(){return u(t.rgbColor,()=>({type:"rgb",value:V(K)}))}function en(){return u(t.rgbaColor,()=>({type:"rgba",value:V(K)}))}function nn(){return u(t.varColor,()=>({type:"var",value:an()}))}function rn(){return u(t.hslColor,()=>{m(t.percentageValue)&&n("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const c=K();m(t.comma);let d=m(t.percentageValue);const S=d?d[1]:null;m(t.comma),d=m(t.percentageValue);const G=d?d[1]:null;return(!S||!G)&&n("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[c,S,G]}})}function on(){return u(t.hslaColor,()=>{const l=K();m(t.comma);let c=m(t.percentageValue);const d=c?c[1]:null;m(t.comma),c=m(t.percentageValue);const S=c?c[1]:null;m(t.comma);const G=K();return(!d||!S)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[l,d,S,G]}})}function an(){return m(t.variableName)[1]}function K(){return m(t.number)[1]}function et(){return w("%",t.percentageValue,1)||sn()||ln()||Fe()}function sn(){return w("position-keyword",t.positionKeywords,1)}function ln(){return u(t.calcValue,()=>{let l=1,c=0;for(;l>0&&c<e.length;){const S=e.charAt(c);S==="("?l++:S===")"&&l--,c++}l>0&&n("Missing closing parenthesis in calc() expression");const d=e.substring(0,c-1);return Ct(c-1),{type:"calc",value:d}})}function Fe(){return w("px",t.pixelValue,1)||w("em",t.emValue,1)}function w(l,c,d){const S=m(c);if(S)return{type:l,value:S[d]}}function m(l){let c,d;return d=/^\s+/.exec(e),d&&Ct(d[0].length),c=l.exec(e),c&&Ct(c[0].length),c}function Ct(l){e=e.substr(l)}return function(l){return e=l.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),r()}})();const kt=Y.parse.bind(Y);var Z=Z||{};Z.stringify=(function(){var t={"visit_linear-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return t.visit_gradient(e)},"visit_radial-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return t.visit_gradient(e)},visit_gradient:function(e){var n=t.visit(e.orientation);return n&&(n+=", "),e.type+"("+n+t.visit(e.colorStops)+")"},visit_shape:function(e){var n=e.value,r=t.visit(e.at),i=t.visit(e.style);return i&&(n+=" "+i),r&&(n+=" at "+r),n},"visit_default-radial":function(e){var n="",r=t.visit(e.at);return r&&(n+=r),n},"visit_extent-keyword":function(e){var n=e.value,r=t.visit(e.at);return r&&(n+=" at "+r),n},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return t.visit(e.value.x)+" "+t.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return t.visit_color(e.value,e)},visit_hex:function(e){return t.visit_color("#"+e.value,e)},visit_rgb:function(e){return t.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return t.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return t.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return t.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return t.visit_color("var("+e.value+")",e)},visit_color:function(e,n){var r=e,i=t.visit(n.length);return i&&(r+=" "+i),r},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var n="",r=e.length;return e.forEach(function(i,a){n+=t.visit(i),a<r-1&&(n+=", ")}),n},visit_object:function(e){return e.width&&e.height?t.visit(e.width)+" "+t.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return t.visit_array(e);if(typeof e=="object"&&!e.type)return t.visit_object(e);if(e.type){var n=t["visit_"+e.type];if(n)return n(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}})();const Me=Z.stringify.bind(Z);function $t(t){const e=t.length-1;return t.map((n,r)=>{const i=n.value;let a=N(r/e,3),s="#00000000";switch(n.type){case"rgb":s=y({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":s=y({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":s=y(n.value);break;case"hex":s=y(`#${n.value}`);break}return n.length?.type==="%"&&(a=Number(n.length.value)/100),{offset:a,color:s}})}function Wt(t){let e=0;return t.orientation?.type==="angular"&&(e=Number(t.orientation.value)),{type:"linear-gradient",angle:e,stops:$t(t.colorStops)}}function Ht(t){return t.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:"radial-gradient",stops:$t(t.colorStops)}}function H(t){return t.startsWith("linear-gradient(")||t.startsWith("radial-gradient(")}function Bt(t){return kt(t).map(e=>{switch(e?.type){case"linear-gradient":return Wt(e);case"repeating-linear-gradient":return{...Wt(e),repeat:!0};case"radial-gradient":return Ht(e);case"repeating-radial-gradient":return{...Ht(e),repeat:!0};default:return}}).filter(Boolean)}const ft=["color"];function Ut(t){let e;return typeof t=="string"?e={color:t}:e={...t},e.color&&(e.color=y(e.color)),A(e,ft)}const dt=["linearGradient","radialGradient","rotateWithShape"];function Kt(t){let e;if(typeof t=="string"?e={image:t}:e={...t},e.image){const{type:n,...r}=Bt(e.image)[0]??{};switch(n){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}}return A(e,dt)}const ht=["image","cropRect","stretchRect","tile","dpi","opacity","rotateWithShape"];function qt(t){let e;return typeof t=="string"?e={image:t}:e={...t},A(e,ht)}const gt=["preset","foregroundColor","backgroundColor"];function xt(t){let e;return typeof t=="string"?e={preset:t}:e={...t},h(e.foregroundColor)?delete e.foregroundColor:e.foregroundColor=y(e.foregroundColor),h(e.backgroundColor)?delete e.backgroundColor:e.backgroundColor=y(e.backgroundColor),A(e,gt)}function Jt(t){return!h(t.color)}function Xt(t){return typeof t=="string"?ct(t):Jt(t)}function Yt(t){return!h(t.image)&&H(t.image)||!!t.linearGradient||!!t.radialGradient}function Zt(t){return typeof t=="string"?H(t):Yt(t)}function Qt(t){return!h(t.image)&&!H(t.image)}function te(t){return typeof t=="string"?!ct(t)&&!H(t):Qt(t)}function ee(t){return!h(t.preset)}function ne(t){return typeof t=="string"?!1:ee(t)}function L(t){const n={enabled:t&&typeof t=="object"?t.enabled:void 0};return Xt(t)&&Object.assign(n,Ut(t)),Zt(t)&&Object.assign(n,Kt(t)),te(t)&&Object.assign(n,qt(t)),ne(t)&&Object.assign(n,xt(t)),A(F(n),Array.from(new Set([...ft,...ht,...dt,...gt])))}function re(t){return typeof t=="string"?{...L(t)}:{...L(t),...A(t,["fillWithShape"])}}function pt(){return{color:W,offsetX:0,offsetY:0,blurRadius:1}}function mt(t){return{...pt(),...F({...t,color:h(t.color)?W:y(t.color)})}}function ie(){return{...pt(),scaleX:1,scaleY:1}}function oe(t){return{...ie(),...mt(t)}}function ke(t){return t}function ae(t){return F({...t,softEdge:h(t.softEdge)?void 0:t.softEdge,outerShadow:h(t.outerShadow)?void 0:oe(t.outerShadow),innerShadow:h(t.innerShadow)?void 0:mt(t.innerShadow)})}function se(t){return typeof t=="string"?{...L(t)}:{...L(t),...A(t,["fillWithShape"])}}const $e="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let We=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=$e[n[t]&63];return e};const le=()=>We(10),ue=le;function B(t){return typeof t=="string"?{...L(t)}:{...L(t),...A(t,["width","style","lineCap","lineJoin","headEnd","tailEnd"])}}function ce(t){return typeof t=="string"?{color:y(t)}:{...t,color:h(t.color)?W:y(t.color)}}function fe(){return{boxShadow:"none"}}function de(t){return typeof t=="string"?t.startsWith("<svg")?{svg:t}:{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function he(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function ge(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function pe(){return{...he(),...ge(),...fe(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"none",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function me(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function ve(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function ye(){return{...me(),color:"#000000",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function be(){return{...ve(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Se(){return{...be(),...ye(),textStrokeWidth:0,textStrokeColor:"none"}}function T(t){return F({...t,color:h(t.color)?void 0:y(t.color),backgroundColor:h(t.backgroundColor)?void 0:y(t.backgroundColor),borderColor:h(t.borderColor)?void 0:y(t.borderColor),outlineColor:h(t.outlineColor)?void 0:y(t.outlineColor),shadowColor:h(t.shadowColor)?void 0:y(t.shadowColor),textStrokeColor:h(t.textStrokeColor)?void 0:y(t.textStrokeColor)})}function He(){return{...pe(),...Se()}}const vt=/\r\n|\n\r|\n|\r/,Be=new RegExp(`${vt.source}|<br\\/>`,"g"),Ue=new RegExp(`^(${vt.source})$`),yt=`
|
|
2
|
-
`;function
|
|
1
|
+
(function(a,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(a=typeof globalThis<"u"?globalThis:a||self,k(a.modernIdoc={}))})(this,(function(a){"use strict";function k(t){return typeof t=="string"?{src:t}:t}var Oe={grad:.9,turn:360,rad:360/(2*Math.PI)},D=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},y=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},P=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},wt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Pt=function(t){return{r:P(t.r,0,255),g:P(t.g,0,255),b:P(t.b,0,255),a:P(t.a)}},nt=function(t){return{r:y(t.r),g:y(t.g),b:y(t.b),a:y(t.a,3)}},Le=/^#([0-9a-f]{3,8})$/i,q=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Ft=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=Math.max(e,n,r),s=o-Math.min(e,n,r),l=s?o===e?(n-r)/s:o===n?2+(r-e)/s:4+(e-n)/s:0;return{h:60*(l<0?l+6:l),s:o?s/o*100:0,v:o/255*100,a:i}},Ot=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var o=Math.floor(e),s=r*(1-n),l=r*(1-(e-o)*n),f=r*(1-(1-e+o)*n),g=o%6;return{r:255*[r,l,s,s,f,r][g],g:255*[f,r,r,l,s,s][g],b:255*[s,s,f,r,r,l][g],a:i}},Lt=function(t){return{h:wt(t.h),s:P(t.s,0,100),l:P(t.l,0,100),a:P(t.a)}},zt=function(t){return{h:y(t.h),s:y(t.s),l:y(t.l),a:y(t.a,3)}},Et=function(t){return Ot((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},V=function(t){return{h:(e=Ft(t)).h,s:(i=(200-(n=e.s))*(r=e.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,n,r,i},ze=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ee=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,De=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ae=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Dt={string:[[function(t){var e=Le.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?y(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?y(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=De.exec(t)||Ae.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Pt({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=ze.exec(t)||Ee.exec(t);if(!e)return null;var n,r,i=Lt({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(Oe[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Et(i)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=i===void 0?1:i;return D(e)&&D(n)&&D(r)?Pt({r:Number(e),g:Number(n),b:Number(r),a:Number(o)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,i=t.a,o=i===void 0?1:i;if(!D(e)||!D(n)||!D(r))return null;var s=Lt({h:Number(e),s:Number(n),l:Number(r),a:Number(o)});return Et(s)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,i=t.a,o=i===void 0?1:i;if(!D(e)||!D(n)||!D(r))return null;var s=(function(l){return{h:wt(l.h),s:P(l.s,0,100),v:P(l.v,0,100),a:P(l.a)}})({h:Number(e),s:Number(n),v:Number(r),a:Number(o)});return Ot(s)},"hsv"]]},At=function(t,e){for(var n=0;n<e.length;n++){var r=e[n][0](t);if(r)return[r,e[n][1]]}return[null,void 0]},Ne=function(t){return typeof t=="string"?At(t.trim(),Dt.string):typeof t=="object"&&t!==null?At(t,Dt.object):[null,void 0]},rt=function(t,e){var n=V(t);return{h:n.h,s:P(n.s+100*e,0,100),l:n.l,a:n.a}},it=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Nt=function(t,e){var n=V(t);return{h:n.h,s:n.s,l:P(n.l+100*e,0,100),a:n.a}},jt=(function(){function t(e){this.parsed=Ne(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return y(it(this.rgba),2)},t.prototype.isDark=function(){return it(this.rgba)<.5},t.prototype.isLight=function(){return it(this.rgba)>=.5},t.prototype.toHex=function(){return e=nt(this.rgba),n=e.r,r=e.g,i=e.b,s=(o=e.a)<1?q(y(255*o)):"","#"+q(n)+q(r)+q(i)+s;var e,n,r,i,o,s},t.prototype.toRgb=function(){return nt(this.rgba)},t.prototype.toRgbString=function(){return e=nt(this.rgba),n=e.r,r=e.g,i=e.b,(o=e.a)<1?"rgba("+n+", "+r+", "+i+", "+o+")":"rgb("+n+", "+r+", "+i+")";var e,n,r,i,o},t.prototype.toHsl=function(){return zt(V(this.rgba))},t.prototype.toHslString=function(){return e=zt(V(this.rgba)),n=e.h,r=e.s,i=e.l,(o=e.a)<1?"hsla("+n+", "+r+"%, "+i+"%, "+o+")":"hsl("+n+", "+r+"%, "+i+"%)";var e,n,r,i,o},t.prototype.toHsv=function(){return e=Ft(this.rgba),{h:y(e.h),s:y(e.s),v:y(e.v),a:y(e.a,3)};var e},t.prototype.invert=function(){return E({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),E(rt(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),E(rt(this.rgba,-e))},t.prototype.grayscale=function(){return E(rt(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),E(Nt(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),E(Nt(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?E({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):y(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=V(this.rgba);return typeof e=="number"?E({h:e,s:n.s,l:n.l,a:n.a}):y(n.h)},t.prototype.isEqual=function(e){return this.toHex()===E(e).toHex()},t})(),E=function(t){return t instanceof jt?t:new jt(t)};class je{eventListeners=new Map;addEventListener(e,n,r){const i={value:n,options:r},o=this.eventListeners.get(e);return o?Array.isArray(o)?o.push(i):this.eventListeners.set(e,[o,i]):this.eventListeners.set(e,i),this}removeEventListener(e,n,r){if(!n)return this.eventListeners.delete(e),this;const i=this.eventListeners.get(e);if(!i)return this;if(Array.isArray(i)){const o=[];for(let s=0,l=i.length;s<l;s++){const f=i[s];(f.value!==n||typeof r=="object"&&r?.once&&(typeof f.options=="boolean"||!f.options?.once))&&o.push(f)}o.length?this.eventListeners.set(e,o.length===1?o[0]:o):this.eventListeners.delete(e)}else i.value===n&&(typeof r=="boolean"||!r?.once||typeof i.options=="boolean"||i.options?.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,...n){const r=this.eventListeners.get(e);if(r){if(Array.isArray(r))for(let i=r.length,o=0;o<i;o++){const s=r[o];typeof s.options=="object"&&s.options?.once&&this.off(e,s.value,s.options),s.value.apply(this,n)}else typeof r.options=="object"&&r.options?.once&&this.off(e,r.value,r.options),r.value.apply(this,n);return!0}else return!1}on(e,n,r){return this.addEventListener(e,n,r)}once(e,n){return this.addEventListener(e,n,{once:!0})}off(e,n,r){return this.removeEventListener(e,n,r)}emit(e,...n){this.dispatchEvent(e,...n)}}function h(t){return t==null||t===""||t==="none"}function N(t,e=0,n=10**e){return Math.round(n*t)/n+0}function F(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(r=>F(r,e)):t;const n={};for(const r in t){const i=t[r];i!=null&&(e?n[r]=F(i,e):n[r]=i)}return n}function A(t,e){const n={};return e.forEach(r=>{r in t&&(n[r]=t[r])}),n}function x(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){const n=Array.from(new Set([...Object.keys(t),...Object.keys(e)]));return!n.length||n.every(r=>t[r]===e[r])}return!1}function Rt(t,e,n){const r=e.length-1;if(r<0)return t===void 0?n:t;for(let i=0;i<r;i++){if(t==null)return n;t=t[e[i]]}return t==null||t[e[r]]===void 0?n:t[e[r]]}function Gt(t,e,n){const r=e.length-1;for(let i=0;i<r;i++)typeof t[e[i]]!="object"&&(t[e[i]]={}),t=t[e[i]];t[e[r]]=n}function kt(t,e,n){return t==null||!e||typeof e!="string"?n:t[e]!==void 0?t[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Rt(t,e.split("."),n))}function It(t,e,n){if(!(typeof t!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Gt(t,e.split("."),n)}class Tt{_eventListeners={};on(e,n){let r=this._eventListeners[e];r===void 0&&(r=[],this._eventListeners[e]=r);const i=r.indexOf(n);return i>-1&&r.splice(i,1),r.push(n),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r),this}off(e,n){const r=this._eventListeners[e];if(r!==void 0){const i=r.indexOf(n);i>-1&&r.splice(i,1)}return this}emit(e,...n){const r=this._eventListeners[e];if(r!==void 0){const i=r.length;if(i>0)for(let o=0;o<i;o++)r[o].apply(this,n)}return this}removeAllListeners(){return this._eventListeners={},this}hasEventListener(e){return!!this._eventListeners[e]}destroy(){this.removeAllListeners()}}class Re{_map=new WeakMap;_toRaw(e){if(e&&typeof e=="object"){const n=e.__v_raw;n&&(e=this._toRaw(n))}return e}delete(e){return this._map.delete(this._toRaw(e))}get(e){return this._map.get(this._toRaw(e))}has(e){return this._map.has(this._toRaw(e))}set(e,n){return this._map.set(this._toRaw(e),this._toRaw(n)),this}}const ot=Symbol.for("declarations"),J=Symbol.for("inited");function M(t){let e;if(Object.hasOwn(t,ot))e=t[ot];else{const n=Object.getPrototypeOf(t);e={...n?M(n):{}},t[ot]=e}return e}function at(t,e,n,r){const{alias:i,internalKey:o}=r,s=t[e];i?It(t,i,n):t[o]=n,t.onUpdateProperty?.(e,n??$(t,e,r),s)}function st(t,e,n){const{alias:r,internalKey:i}=n;let o;return r?o=kt(t,r):o=t[i],o=o??$(t,e,n),o}function $(t,e,n){const{default:r,fallback:i}=n;let o;if(r!==void 0&&!t[J]?.[e]){t[J]||(t[J]={}),t[J][e]=!0;const s=typeof r=="function"?r():r;s!==void 0&&(t[e]=s,o=s)}return o===void 0&&i!==void 0&&(o=typeof i=="function"?i():i),o}function lt(t,e){function n(){return this.getProperty?this.getProperty(t):st(this,t,e)}function r(i){this.setProperty?this.setProperty(t,i):at(this,t,i,e)}return{get:n,set:r}}function Vt(t,e,n={}){const r={...n,internalKey:Symbol.for(e)},i=M(t);i[e]=r;const{get:o,set:s}=lt(e,r);Object.defineProperty(t.prototype,e,{get(){return o.call(this)},set(l){s.call(this,l)},configurable:!0,enumerable:!0})}function Ge(t){return function(e,n){if(typeof n!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");Vt(e.constructor,n,t)}}function ke(t={}){return function(e,n){const r=n.name;if(typeof r!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");const i={...t,internalKey:Symbol.for(r)},o=lt(r,i);return{init(s){const l=M(this.constructor);return l[r]=i,o.set.call(this,s),s},get(){return o.get.call(this)},set(s){o.set.call(this,s)}}}}class Ie extends Tt{_propertyAccessor;_properties={};_updatedProperties={};_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?!!this._updatedProperties[e]:Object.keys(this._updatedProperties).length>0}offsetGetProperty(e){return this._properties[e]}offsetSetProperty(e,n){this._properties[e]=n}getProperty(e){const n=this.getPropertyDeclaration(e);if(n){if(n.internal||n.alias)return st(this,e,n);{const r=this._propertyAccessor;let i;return r&&r.getProperty?i=r.getProperty(e):i=this.offsetGetProperty(e),i??$(this,e,n)}}}setProperty(e,n){const r=this.getPropertyDeclaration(e);if(r)if(r.internal||r.alias)at(this,e,n,r);else{const i=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,n),this.offsetSetProperty(e,n),this.onUpdateProperty?.(e,n??$(this,e,r),i)}}getProperties(e){const n={},r=this.getPropertyDeclarations(),i=Object.keys(r);for(let o=0,s=i.length;o<s;o++){const l=i[o],f=r[l];!f.internal&&!f.alias&&(!e||e.includes(l))&&(n[l]=this.getProperty(l))}return n}setProperties(e){if(e&&typeof e=="object")for(const n in e)this.setProperty(n,e[n]);return this}resetProperties(){const e=this.getPropertyDeclarations(),n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){const o=n[r],s=e[o];this.setProperty(o,typeof s.default=="function"?s.default():s.default)}return this}getPropertyDeclarations(){return M(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations()[e]}setPropertyAccessor(e){const n=this.getPropertyDeclarations(),r=[];if(e&&e.getProperty&&e.setProperty){const i=Object.keys(n);for(let o=0,s=i.length;o<s;o++){const l=i[o],f=n[l];if(f.internal||f.alias)continue;const g=this.offsetGetProperty(l),p=e.getProperty(l);(g!==void 0||p!==void 0)&&!Object.is(g,p)&&(e.setProperty(l,p),r.push({key:l,newValue:p,oldValue:g}))}}this._propertyAccessor=e;for(let i=0,o=r.length;i<o;i++){const{key:s,newValue:l,oldValue:f}=r[i];this.requestUpdate(s,l,f)}return this}async _nextTick(){return"requestAnimationFrame"in globalThis?new Promise(e=>globalThis.requestAnimationFrame(e)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(e){Promise.reject(e)}await this._nextTick(),this._updating&&(this.onUpdate(),this._updating=!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties={}}onUpdateProperty(e,n,r){Object.is(n,r)||this.requestUpdate(e,n,r)}requestUpdate(e,n,r){e!==void 0&&(this._updatedProperties[e]=r,this._changedProperties.add(e),this._updateProperty(e,n,r),this.emit("updateProperty",e,n,r)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(e){}_updateProperty(e,n,r){}toJSON(){const e={},n=this._properties,r=Object.keys(n);for(let i=0,o=r.length;i<o;i++){const s=r[i],l=n[s];l!==void 0&&(l&&typeof l=="object"?"toJSON"in l&&typeof l.toJSON=="function"?e[s]=l.toJSON():Array.isArray(l)?e[s]=[...l]:e[s]={...l}:e[s]=l)}return e}clone(){return new this.constructor(this.toJSON())}destroy(){this.emit("destroy"),super.destroy()}}function ut(t){let e;return typeof t=="number"?e={r:t>>24&255,g:t>>16&255,b:t>>8&255,a:(t&255)/255}:e=t,E(e)}function Te(t){return{r:N(t.r),g:N(t.g),b:N(t.b),a:N(t.a,3)}}function X(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const W="#000000FF";function ct(t){return ut(t).isValid()}function b(t,e=!1){const n=ut(t);if(!n.isValid()){if(typeof t=="string")return t;const l=`Failed to normalizeColor ${t}`;if(e)throw new Error(l);return console.warn(l),W}const{r,g:i,b:o,a:s}=Te(n.rgba);return`#${X(r)}${X(i)}${X(o)}${X(N(s*255))}`}var Y=Y||{};Y.parse=(function(){const t={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function n(u){const c=new Error(`${e}: ${u}`);throw c.source=e,c}function r(){const u=i();return e.length>0&&n("Invalid input not EOF"),u}function i(){return T(o)}function o(){return s("linear-gradient",t.linearGradient,f)||s("repeating-linear-gradient",t.repeatingLinearGradient,f)||s("radial-gradient",t.radialGradient,v)||s("repeating-radial-gradient",t.repeatingRadialGradient,v)}function s(u,c,d){return l(c,S=>{const G=d();return G&&(m(t.comma)||n("Missing comma before color stops")),{type:u,orientation:G,colorStops:T(Ct)}})}function l(u,c){const d=m(u);if(d){m(t.startCall)||n("Missing (");const S=c(d);return m(t.endCall)||n("Missing )"),S}}function f(){const u=g();if(u)return u;const c=w("position-keyword",t.positionKeywords,1);return c?{type:"directional",value:c.value}:p()}function g(){return w("directional",t.sideOrCorner,1)}function p(){return w("angular",t.angleValue,1)||w("angular",t.radianValue,1)}function v(){let u,c=C(),d;return c&&(u=[],u.push(c),d=e,m(t.comma)&&(c=C(),c?u.push(c):e=d)),u}function C(){let u=_()||j();if(u)u.at=z();else{const c=O();if(c){u=c;const d=z();d&&(u.at=d)}else{const d=z();if(d)u={type:"default-radial",at:d};else{const S=R();S&&(u={type:"default-radial",at:S})}}}return u}function _(){const u=w("shape",/^(circle)/i,0);return u&&(u.style=Fe()||O()),u}function j(){const u=w("shape",/^(ellipse)/i,0);return u&&(u.style=R()||et()||O()),u}function O(){return w("extent-keyword",t.extentKeywords,1)}function z(){if(w("position",/^at/,0)){const u=R();return u||n("Missing positioning value"),u}}function R(){const u=K();if(u.x||u.y)return{type:"position",value:u}}function K(){return{x:et(),y:et()}}function T(u){let c=u();const d=[];if(c)for(d.push(c);m(t.comma);)c=u(),c?d.push(c):n("One extra comma");return d}function Ct(){const u=Ye();return u||n("Expected color definition"),u.length=et(),u}function Ye(){return Qe()||on()||rn()||en()||tn()||nn()||Ze()}function Ze(){return w("literal",t.literalColor,0)}function Qe(){return w("hex",t.hexColor,1)}function tn(){return l(t.rgbColor,()=>({type:"rgb",value:T(U)}))}function en(){return l(t.rgbaColor,()=>({type:"rgba",value:T(U)}))}function nn(){return l(t.varColor,()=>({type:"var",value:an()}))}function rn(){return l(t.hslColor,()=>{m(t.percentageValue)&&n("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const c=U();m(t.comma);let d=m(t.percentageValue);const S=d?d[1]:null;m(t.comma),d=m(t.percentageValue);const G=d?d[1]:null;return(!S||!G)&&n("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[c,S,G]}})}function on(){return l(t.hslaColor,()=>{const u=U();m(t.comma);let c=m(t.percentageValue);const d=c?c[1]:null;m(t.comma),c=m(t.percentageValue);const S=c?c[1]:null;m(t.comma);const G=U();return(!d||!S)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[u,d,S,G]}})}function an(){return m(t.variableName)[1]}function U(){return m(t.number)[1]}function et(){return w("%",t.percentageValue,1)||sn()||ln()||Fe()}function sn(){return w("position-keyword",t.positionKeywords,1)}function ln(){return l(t.calcValue,()=>{let u=1,c=0;for(;u>0&&c<e.length;){const S=e.charAt(c);S==="("?u++:S===")"&&u--,c++}u>0&&n("Missing closing parenthesis in calc() expression");const d=e.substring(0,c-1);return _t(c-1),{type:"calc",value:d}})}function Fe(){return w("px",t.pixelValue,1)||w("em",t.emValue,1)}function w(u,c,d){const S=m(c);if(S)return{type:u,value:S[d]}}function m(u){let c,d;return d=/^\s+/.exec(e),d&&_t(d[0].length),c=u.exec(e),c&&_t(c[0].length),c}function _t(u){e=e.substr(u)}return function(u){return e=u.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),r()}})();const Mt=Y.parse.bind(Y);var Z=Z||{};Z.stringify=(function(){var t={"visit_linear-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return t.visit_gradient(e)},"visit_radial-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return t.visit_gradient(e)},visit_gradient:function(e){var n=t.visit(e.orientation);return n&&(n+=", "),e.type+"("+n+t.visit(e.colorStops)+")"},visit_shape:function(e){var n=e.value,r=t.visit(e.at),i=t.visit(e.style);return i&&(n+=" "+i),r&&(n+=" at "+r),n},"visit_default-radial":function(e){var n="",r=t.visit(e.at);return r&&(n+=r),n},"visit_extent-keyword":function(e){var n=e.value,r=t.visit(e.at);return r&&(n+=" at "+r),n},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return t.visit(e.value.x)+" "+t.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return t.visit_color(e.value,e)},visit_hex:function(e){return t.visit_color("#"+e.value,e)},visit_rgb:function(e){return t.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return t.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return t.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return t.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return t.visit_color("var("+e.value+")",e)},visit_color:function(e,n){var r=e,i=t.visit(n.length);return i&&(r+=" "+i),r},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var n="",r=e.length;return e.forEach(function(i,o){n+=t.visit(i),o<r-1&&(n+=", ")}),n},visit_object:function(e){return e.width&&e.height?t.visit(e.width)+" "+t.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return t.visit_array(e);if(typeof e=="object"&&!e.type)return t.visit_object(e);if(e.type){var n=t["visit_"+e.type];if(n)return n(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}})();const Ve=Z.stringify.bind(Z);function $t(t){const e=t.length-1;return t.map((n,r)=>{const i=n.value;let o=N(r/e,3),s="#00000000";switch(n.type){case"rgb":s=b({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":s=b({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":s=b(n.value);break;case"hex":s=b(`#${n.value}`);break}return n.length?.type==="%"&&(o=Number(n.length.value)/100),{offset:o,color:s}})}function Wt(t){let e=0;return t.orientation?.type==="angular"&&(e=Number(t.orientation.value)),{type:"linear-gradient",angle:e,stops:$t(t.colorStops)}}function Ht(t){return t.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:"radial-gradient",stops:$t(t.colorStops)}}function H(t){return t.startsWith("linear-gradient(")||t.startsWith("radial-gradient(")}function Bt(t){return Mt(t).map(e=>{switch(e?.type){case"linear-gradient":return Wt(e);case"repeating-linear-gradient":return{...Wt(e),repeat:!0};case"radial-gradient":return Ht(e);case"repeating-radial-gradient":return{...Ht(e),repeat:!0};default:return}}).filter(Boolean)}const ft=["color"];function Kt(t){let e;return typeof t=="string"?e={color:t}:e={...t},e.color&&(e.color=b(e.color)),A(e,ft)}const dt=["linearGradient","radialGradient","rotateWithShape"];function Ut(t){let e;if(typeof t=="string"?e={image:t}:e={...t},e.image){const{type:n,...r}=Bt(e.image)[0]??{};switch(n){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}}return A(e,dt)}const ht=["image","cropRect","stretchRect","tile","dpi","opacity","rotateWithShape"];function qt(t){let e;return typeof t=="string"?e={image:t}:e={...t},A(e,ht)}const gt=["preset","foregroundColor","backgroundColor"];function xt(t){let e;return typeof t=="string"?e={preset:t}:e={...t},h(e.foregroundColor)?delete e.foregroundColor:e.foregroundColor=b(e.foregroundColor),h(e.backgroundColor)?delete e.backgroundColor:e.backgroundColor=b(e.backgroundColor),A(e,gt)}function Jt(t){return!h(t.color)}function Xt(t){return typeof t=="string"?ct(t):Jt(t)}function Yt(t){return!h(t.image)&&H(t.image)||!!t.linearGradient||!!t.radialGradient}function Zt(t){return typeof t=="string"?H(t):Yt(t)}function Qt(t){return!h(t.image)&&!H(t.image)}function te(t){return typeof t=="string"?!ct(t)&&!H(t):Qt(t)}function ee(t){return!h(t.preset)}function ne(t){return typeof t=="string"?!1:ee(t)}function L(t){const n={enabled:t&&typeof t=="object"?t.enabled:void 0};return Xt(t)&&Object.assign(n,Kt(t)),Zt(t)&&Object.assign(n,Ut(t)),te(t)&&Object.assign(n,qt(t)),ne(t)&&Object.assign(n,xt(t)),A(F(n),Array.from(new Set([...ft,...ht,...dt,...gt])))}function re(t){return typeof t=="string"?{...L(t)}:{...L(t),...A(t,["fillWithShape"])}}function pt(){return{color:W,offsetX:0,offsetY:0,blurRadius:1}}function vt(t){return{...pt(),...F({...t,color:h(t.color)?W:b(t.color)})}}function ie(){return{...pt(),scaleX:1,scaleY:1}}function oe(t){return{...ie(),...vt(t)}}function Me(t){return t}function ae(t){return F({...t,softEdge:h(t.softEdge)?void 0:t.softEdge,outerShadow:h(t.outerShadow)?void 0:oe(t.outerShadow),innerShadow:h(t.innerShadow)?void 0:vt(t.innerShadow)})}function se(t){return typeof t=="string"?{...L(t)}:{...L(t),...A(t,["fillWithShape"])}}const $e="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let We=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=$e[n[t]&63];return e};const le=()=>We(10),ue=le;function B(t){return typeof t=="string"?{...L(t)}:{...L(t),...A(t,["width","style","lineCap","lineJoin","headEnd","tailEnd"])}}function ce(t){return typeof t=="string"?{color:b(t)}:{...t,color:h(t.color)?W:b(t.color)}}function fe(){return{boxShadow:"none"}}function de(t){return typeof t=="string"?t.startsWith("<svg")?{svg:t}:{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function he(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function ge(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function pe(){return{...he(),...ge(),...fe(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"none",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function ve(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function me(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function ye(){return{...ve(),color:"#000000",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function be(){return{...me(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Se(){return{...be(),...ye(),textStrokeWidth:0,textStrokeColor:"none"}}function I(t){return F({...t,color:h(t.color)?void 0:b(t.color),backgroundColor:h(t.backgroundColor)?void 0:b(t.backgroundColor),borderColor:h(t.borderColor)?void 0:b(t.borderColor),outlineColor:h(t.outlineColor)?void 0:b(t.outlineColor),shadowColor:h(t.shadowColor)?void 0:b(t.shadowColor),textStrokeColor:h(t.textStrokeColor)?void 0:b(t.textStrokeColor)})}function He(){return{...pe(),...Se()}}const mt=/\r\n|\n\r|\n|\r/,Be=new RegExp(`${mt.source}|<br\\/>`,"g"),Ke=new RegExp(`^(${mt.source})$`),yt=`
|
|
2
|
+
`;function Ue(t){return mt.test(t)}function bt(t){return Ke.test(t)}function Ce(t){return t.replace(Be,yt)}function Q(t){const e=[];function n(){return e[e.length-1]}function r(l,f,g){const p=l?I(l):{},v=f?L(f):void 0,C=g?B(g):void 0,_=F({...p,fill:v,outline:C,fragments:[]});return e[e.length-1]?.fragments.length===0?e[e.length-1]=_:e.push(_),_}function i(l="",f,g,p){const v=f?I(f):{},C=g?L(g):void 0,_=p?B(p):void 0;Array.from(l).forEach(j=>{if(bt(j)){const{fragments:O,fill:z,outline:R,...K}=n()||r();O.length||O.push(F({...v,fill:C,outline:_,content:yt})),r(K,z,R)}else{const O=n()||r(),z=O.fragments[O.fragments.length-1];if(z){const{content:R,fill:K,outline:T,...Ct}=z;if(x(C,K)&&x(_,T)&&x(v,Ct)){z.content=`${R}${j}`;return}}O.fragments.push(F({...v,fill:C,outline:_,content:j}))}})}(Array.isArray(t)?t:[t]).forEach(l=>{if(typeof l=="string")r(),i(l);else if(St(l)){const{content:f,fill:g,outline:p,...v}=l;r(v,g,p),i(f)}else if(_e(l)){const{fragments:f,fill:g,outline:p,...v}=l;r(v,g,p),f.forEach(C=>{const{content:_,fill:j,outline:O,...z}=C;i(_,z,j,O)})}else Array.isArray(l)?(r(),l.forEach(f=>{if(typeof f=="string")i(f);else if(St(f)){const{content:g,fill:p,outline:v,...C}=f;i(g,C,p,v)}})):console.warn("Failed to parse text content",l)});const s=n();return s&&!s.fragments.length&&s.fragments.push({content:""}),e}function _e(t){return t&&typeof t=="object"&&"fragments"in t&&Array.isArray(t.fragments)}function St(t){return t&&typeof t=="object"&&"content"in t&&typeof t.content=="string"}function we(t){return typeof t=="string"||Array.isArray(t)?{content:Q(t)}:F({...t,content:Q(t.content??""),style:t.style?I(t.style):void 0,effects:t.effects?t.effects.map(e=>I(e)):void 0,measureDom:t.measureDom,fonts:t.fonts,fill:t.fill?L(t.fill):void 0,outline:t.outline?B(t.outline):void 0})}function qe(t){return Q(t).map(e=>{const n=Ce(e.fragments.flatMap(r=>r.content).join(""));return bt(n)?"":n}).join(yt)}function Pe(t){return typeof t=="string"?{src:t}:t}function tt(t){return F({...t,id:t.id??ue(),style:h(t.style)?void 0:I(t.style),text:h(t.text)?void 0:we(t.text),background:h(t.background)?void 0:re(t.background),shape:h(t.shape)?void 0:de(t.shape),fill:h(t.fill)?void 0:L(t.fill),outline:h(t.outline)?void 0:B(t.outline),foreground:h(t.foreground)?void 0:se(t.foreground),shadow:h(t.shadow)?void 0:ce(t.shadow),video:h(t.video)?void 0:Pe(t.video),audio:h(t.audio)?void 0:k(t.audio),effect:h(t.effect)?void 0:ae(t.effect),children:t.children?.map(e=>tt(e))})}function xe(t){return tt(t)}function Je(t){const e={};for(const n in t.children){const r=tt(t.children[n]);delete r.children,e[n]=r}return{...t,children:e}}function Xe(t){const{children:e,...n}=t;function r(f){const{parentId:g,childrenIds:p,...v}=f;return{...v,children:[]}}const i={},o=[],s={...n,children:o};function l(f){if(!e[f]||i[f])return;const g=e[f],p=r(g);i[f]=p;const v=g.parentId;if(v){l(v);const C=e[v],_=i[v];if(!_)return;C?.childrenIds&&_?.children&&(_.children[C.childrenIds.indexOf(f)]=p)}else o.push(p)}for(const f in e)l(f);return s}a.EventEmitter=je,a.Observable=Tt,a.RawWeakMap=Re,a.Reactivable=Ie,a.clearUndef=F,a.colorFillFields=ft,a.defaultColor=W,a.defineProperty=Vt,a.flatDocumentToDocument=Xe,a.getDeclarations=M,a.getDefaultElementStyle=pe,a.getDefaultHighlightStyle=ve,a.getDefaultInnerShadow=pt,a.getDefaultLayoutStyle=he,a.getDefaultListStyleStyle=me,a.getDefaultOuterShadow=ie,a.getDefaultShadowStyle=fe,a.getDefaultStyle=He,a.getDefaultTextInlineStyle=ye,a.getDefaultTextLineStyle=be,a.getDefaultTextStyle=Se,a.getDefaultTransformStyle=ge,a.getNestedValue=Rt,a.getObjectValueByPath=kt,a.getPropertyDescriptor=lt,a.gradientFillFields=dt,a.hasCRLF=Ue,a.idGenerator=ue,a.imageFillFiedls=ht,a.isCRLF=bt,a.isColor=ct,a.isColorFill=Xt,a.isColorFillObject=Jt,a.isEqualObject=x,a.isFragmentObject=St,a.isGradient=H,a.isGradientFill=Zt,a.isGradientFillObject=Yt,a.isImageFill=te,a.isImageFillObject=Qt,a.isNone=h,a.isParagraphObject=_e,a.isPresetFill=ne,a.isPresetFillObject=ee,a.nanoid=le,a.normalizeAudio=k,a.normalizeBackground=re,a.normalizeCRLF=Ce,a.normalizeColor=b,a.normalizeColorFill=Kt,a.normalizeDocument=xe,a.normalizeEffect=ae,a.normalizeElement=tt,a.normalizeFill=L,a.normalizeFlatDocument=Je,a.normalizeForeground=se,a.normalizeGradient=Bt,a.normalizeGradientFill=Ut,a.normalizeImageFill=qt,a.normalizeInnerShadow=vt,a.normalizeOuterShadow=oe,a.normalizeOutline=B,a.normalizePresetFill=xt,a.normalizeShadow=ce,a.normalizeShape=de,a.normalizeSoftEdge=Me,a.normalizeStyle=I,a.normalizeText=we,a.normalizeTextContent=Q,a.normalizeVideo=Pe,a.parseColor=ut,a.parseGradient=Mt,a.pick=A,a.presetFillFiedls=gt,a.property=Ge,a.property2=ke,a.propertyOffsetFallback=$,a.propertyOffsetGet=st,a.propertyOffsetSet=at,a.round=N,a.setNestedValue=Gt,a.setObjectValueByPath=It,a.stringifyGradient=Ve,a.textContentToString=qe,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.mjs
CHANGED
|
@@ -269,16 +269,16 @@ class RawWeakMap {
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
const
|
|
273
|
-
const initedSymbol = Symbol("inited");
|
|
272
|
+
const declarationsSymbol = Symbol.for("declarations");
|
|
273
|
+
const initedSymbol = Symbol.for("inited");
|
|
274
274
|
function getDeclarations(constructor) {
|
|
275
275
|
let declarations;
|
|
276
|
-
if (Object.hasOwn(constructor,
|
|
277
|
-
declarations = constructor[
|
|
276
|
+
if (Object.hasOwn(constructor, declarationsSymbol)) {
|
|
277
|
+
declarations = constructor[declarationsSymbol];
|
|
278
278
|
} else {
|
|
279
279
|
const superConstructor = Object.getPrototypeOf(constructor);
|
|
280
|
-
declarations =
|
|
281
|
-
constructor[
|
|
280
|
+
declarations = { ...superConstructor ? getDeclarations(superConstructor) : {} };
|
|
281
|
+
constructor[declarationsSymbol] = declarations;
|
|
282
282
|
}
|
|
283
283
|
return declarations;
|
|
284
284
|
}
|
|
@@ -358,9 +358,10 @@ function getPropertyDescriptor(key, declaration) {
|
|
|
358
358
|
function defineProperty(constructor, key, declaration = {}) {
|
|
359
359
|
const _declaration = {
|
|
360
360
|
...declaration,
|
|
361
|
-
internalKey: Symbol(key)
|
|
361
|
+
internalKey: Symbol.for(key)
|
|
362
362
|
};
|
|
363
|
-
getDeclarations(constructor)
|
|
363
|
+
const declarations = getDeclarations(constructor);
|
|
364
|
+
declarations[key] = _declaration;
|
|
364
365
|
const { get, set } = getPropertyDescriptor(key, _declaration);
|
|
365
366
|
Object.defineProperty(constructor.prototype, key, {
|
|
366
367
|
get() {
|
|
@@ -389,12 +390,13 @@ function property2(declaration = {}) {
|
|
|
389
390
|
}
|
|
390
391
|
const _declaration = {
|
|
391
392
|
...declaration,
|
|
392
|
-
internalKey: Symbol(key)
|
|
393
|
+
internalKey: Symbol.for(key)
|
|
393
394
|
};
|
|
394
395
|
const descriptor = getPropertyDescriptor(key, _declaration);
|
|
395
396
|
return {
|
|
396
397
|
init(v) {
|
|
397
|
-
getDeclarations(this.constructor)
|
|
398
|
+
const declarations = getDeclarations(this.constructor);
|
|
399
|
+
declarations[key] = _declaration;
|
|
398
400
|
descriptor.set.call(this, v);
|
|
399
401
|
return v;
|
|
400
402
|
},
|
|
@@ -410,8 +412,8 @@ function property2(declaration = {}) {
|
|
|
410
412
|
|
|
411
413
|
class Reactivable extends Observable {
|
|
412
414
|
_propertyAccessor;
|
|
413
|
-
_properties =
|
|
414
|
-
_updatedProperties =
|
|
415
|
+
_properties = {};
|
|
416
|
+
_updatedProperties = {};
|
|
415
417
|
_changedProperties = /* @__PURE__ */ new Set();
|
|
416
418
|
_updatingPromise = Promise.resolve();
|
|
417
419
|
_updating = false;
|
|
@@ -420,7 +422,13 @@ class Reactivable extends Observable {
|
|
|
420
422
|
this.setProperties(properties);
|
|
421
423
|
}
|
|
422
424
|
isDirty(key) {
|
|
423
|
-
return key ? this._updatedProperties
|
|
425
|
+
return key ? Boolean(this._updatedProperties[key]) : Object.keys(this._updatedProperties).length > 0;
|
|
426
|
+
}
|
|
427
|
+
offsetGetProperty(key) {
|
|
428
|
+
return this._properties[key];
|
|
429
|
+
}
|
|
430
|
+
offsetSetProperty(key, value) {
|
|
431
|
+
this._properties[key] = value;
|
|
424
432
|
}
|
|
425
433
|
getProperty(key) {
|
|
426
434
|
const declaration = this.getPropertyDeclaration(key);
|
|
@@ -433,7 +441,7 @@ class Reactivable extends Observable {
|
|
|
433
441
|
if (accessor && accessor.getProperty) {
|
|
434
442
|
result = accessor.getProperty(key);
|
|
435
443
|
} else {
|
|
436
|
-
result = this.
|
|
444
|
+
result = this.offsetGetProperty(key);
|
|
437
445
|
}
|
|
438
446
|
return result ?? propertyOffsetFallback(this, key, declaration);
|
|
439
447
|
}
|
|
@@ -448,7 +456,7 @@ class Reactivable extends Observable {
|
|
|
448
456
|
} else {
|
|
449
457
|
const oldValue = this.getProperty(key);
|
|
450
458
|
this._propertyAccessor?.setProperty?.(key, newValue);
|
|
451
|
-
this.
|
|
459
|
+
this.offsetSetProperty(key, newValue);
|
|
452
460
|
this.onUpdateProperty?.(
|
|
453
461
|
key,
|
|
454
462
|
newValue ?? propertyOffsetFallback(this, key, declaration),
|
|
@@ -459,9 +467,13 @@ class Reactivable extends Observable {
|
|
|
459
467
|
}
|
|
460
468
|
getProperties(keys) {
|
|
461
469
|
const properties = {};
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
470
|
+
const declarations = this.getPropertyDeclarations();
|
|
471
|
+
const declarationKeys = Object.keys(declarations);
|
|
472
|
+
for (let i = 0, len = declarationKeys.length; i < len; i++) {
|
|
473
|
+
const key = declarationKeys[i];
|
|
474
|
+
const declaration = declarations[key];
|
|
475
|
+
if (!declaration.internal && !declaration.alias && (!keys || keys.includes(key))) {
|
|
476
|
+
properties[key] = this.getProperty(key);
|
|
465
477
|
}
|
|
466
478
|
}
|
|
467
479
|
return properties;
|
|
@@ -475,9 +487,13 @@ class Reactivable extends Observable {
|
|
|
475
487
|
return this;
|
|
476
488
|
}
|
|
477
489
|
resetProperties() {
|
|
478
|
-
|
|
490
|
+
const declarations = this.getPropertyDeclarations();
|
|
491
|
+
const declarationKeys = Object.keys(declarations);
|
|
492
|
+
for (let i = 0, len = declarationKeys.length; i < len; i++) {
|
|
493
|
+
const key = declarationKeys[i];
|
|
494
|
+
const declaration = declarations[key];
|
|
479
495
|
this.setProperty(
|
|
480
|
-
|
|
496
|
+
key,
|
|
481
497
|
typeof declaration.default === "function" ? declaration.default() : declaration.default
|
|
482
498
|
);
|
|
483
499
|
}
|
|
@@ -487,26 +503,32 @@ class Reactivable extends Observable {
|
|
|
487
503
|
return getDeclarations(this.constructor);
|
|
488
504
|
}
|
|
489
505
|
getPropertyDeclaration(key) {
|
|
490
|
-
return this.getPropertyDeclarations()
|
|
506
|
+
return this.getPropertyDeclarations()[key];
|
|
491
507
|
}
|
|
492
508
|
setPropertyAccessor(accessor) {
|
|
493
509
|
const declarations = this.getPropertyDeclarations();
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
if (
|
|
506
|
-
|
|
510
|
+
const items = [];
|
|
511
|
+
if (accessor && accessor.getProperty && accessor.setProperty) {
|
|
512
|
+
const declarationKeys = Object.keys(declarations);
|
|
513
|
+
for (let i = 0, len = declarationKeys.length; i < len; i++) {
|
|
514
|
+
const key = declarationKeys[i];
|
|
515
|
+
const declaration = declarations[key];
|
|
516
|
+
if (declaration.internal || declaration.alias) {
|
|
517
|
+
continue;
|
|
518
|
+
}
|
|
519
|
+
const oldValue = this.offsetGetProperty(key);
|
|
520
|
+
const newValue = accessor.getProperty(key);
|
|
521
|
+
if ((oldValue !== void 0 || newValue !== void 0) && !Object.is(oldValue, newValue)) {
|
|
522
|
+
accessor.setProperty(key, newValue);
|
|
523
|
+
items.push({ key, newValue, oldValue });
|
|
507
524
|
}
|
|
508
525
|
}
|
|
509
|
-
}
|
|
526
|
+
}
|
|
527
|
+
this._propertyAccessor = accessor;
|
|
528
|
+
for (let i = 0, len = items.length; i < len; i++) {
|
|
529
|
+
const { key, newValue, oldValue } = items[i];
|
|
530
|
+
this.requestUpdate(key, newValue, oldValue);
|
|
531
|
+
}
|
|
510
532
|
return this;
|
|
511
533
|
}
|
|
512
534
|
async _nextTick() {
|
|
@@ -530,7 +552,7 @@ class Reactivable extends Observable {
|
|
|
530
552
|
}
|
|
531
553
|
onUpdate() {
|
|
532
554
|
this._update(this._updatedProperties);
|
|
533
|
-
this._updatedProperties =
|
|
555
|
+
this._updatedProperties = {};
|
|
534
556
|
}
|
|
535
557
|
onUpdateProperty(key, newValue, oldValue) {
|
|
536
558
|
if (!Object.is(newValue, oldValue)) {
|
|
@@ -539,7 +561,7 @@ class Reactivable extends Observable {
|
|
|
539
561
|
}
|
|
540
562
|
requestUpdate(key, newValue, oldValue) {
|
|
541
563
|
if (key !== void 0) {
|
|
542
|
-
this._updatedProperties
|
|
564
|
+
this._updatedProperties[key] = oldValue;
|
|
543
565
|
this._changedProperties.add(key);
|
|
544
566
|
this._updateProperty(key, newValue, oldValue);
|
|
545
567
|
this.emit("updateProperty", key, newValue, oldValue);
|
|
@@ -556,9 +578,13 @@ class Reactivable extends Observable {
|
|
|
556
578
|
}
|
|
557
579
|
toJSON() {
|
|
558
580
|
const json = {};
|
|
559
|
-
this._properties
|
|
581
|
+
const properties = this._properties;
|
|
582
|
+
const keys = Object.keys(properties);
|
|
583
|
+
for (let i = 0, len = keys.length; i < len; i++) {
|
|
584
|
+
const key = keys[i];
|
|
585
|
+
const value = properties[key];
|
|
560
586
|
if (value === void 0) {
|
|
561
|
-
|
|
587
|
+
continue;
|
|
562
588
|
}
|
|
563
589
|
if (value && typeof value === "object") {
|
|
564
590
|
if ("toJSON" in value && typeof value.toJSON === "function") {
|
|
@@ -571,7 +597,7 @@ class Reactivable extends Observable {
|
|
|
571
597
|
} else {
|
|
572
598
|
json[key] = value;
|
|
573
599
|
}
|
|
574
|
-
}
|
|
600
|
+
}
|
|
575
601
|
return json;
|
|
576
602
|
}
|
|
577
603
|
clone() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-idoc",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.10.
|
|
4
|
+
"version": "0.10.19",
|
|
5
5
|
"packageManager": "pnpm@10.18.1",
|
|
6
6
|
"description": "Intermediate document for modern codec libs",
|
|
7
7
|
"author": "wxm",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@antfu/eslint-config": "^7.2.0",
|
|
63
|
-
"@types/node": "^25.0
|
|
63
|
+
"@types/node": "^25.2.0",
|
|
64
64
|
"bumpp": "^10.4.0",
|
|
65
65
|
"conventional-changelog-cli": "^5.0.0",
|
|
66
66
|
"eslint": "^9.39.2",
|