modern-idoc 0.9.1 → 0.9.3
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 +114 -13
- package/dist/index.d.cts +20 -0
- package/dist/index.d.mts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +114 -13
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -302,6 +302,7 @@ function getPropertyDescriptor(key, declaration = {}) {
|
|
|
302
302
|
return result;
|
|
303
303
|
}
|
|
304
304
|
function set(newValue) {
|
|
305
|
+
const oldValue = get.call(this);
|
|
305
306
|
if (alias && alias !== key) {
|
|
306
307
|
setObjectValueByPath(this, alias, newValue);
|
|
307
308
|
} else if (!internal && typeof this.setProperty !== "undefined") {
|
|
@@ -309,6 +310,7 @@ function getPropertyDescriptor(key, declaration = {}) {
|
|
|
309
310
|
} else {
|
|
310
311
|
this[internalKey] = newValue;
|
|
311
312
|
}
|
|
313
|
+
this.onUpdateProperty?.(key, newValue, oldValue);
|
|
312
314
|
}
|
|
313
315
|
return {
|
|
314
316
|
get,
|
|
@@ -363,6 +365,23 @@ function property2(declaration = {}) {
|
|
|
363
365
|
class Reactivable extends Observable {
|
|
364
366
|
_propertyAccessor;
|
|
365
367
|
_properties = /* @__PURE__ */ new Map();
|
|
368
|
+
_updatedProperties = /* @__PURE__ */ new Map();
|
|
369
|
+
_changedProperties = /* @__PURE__ */ new Set();
|
|
370
|
+
_updatingPromise = Promise.resolve();
|
|
371
|
+
_updating = false;
|
|
372
|
+
constructor(properties) {
|
|
373
|
+
super();
|
|
374
|
+
this.setProperties(properties);
|
|
375
|
+
}
|
|
376
|
+
isDirty(key) {
|
|
377
|
+
return key ? this._updatedProperties.has(key) : this._updatedProperties.size > 0;
|
|
378
|
+
}
|
|
379
|
+
offsetGet(key) {
|
|
380
|
+
return this[key];
|
|
381
|
+
}
|
|
382
|
+
offsetSet(key, newValue) {
|
|
383
|
+
this[key] = newValue;
|
|
384
|
+
}
|
|
366
385
|
getProperty(key, defaultValue) {
|
|
367
386
|
if (this._propertyAccessor?.getProperty) {
|
|
368
387
|
return this._propertyAccessor.getProperty(key, defaultValue);
|
|
@@ -371,42 +390,124 @@ class Reactivable extends Observable {
|
|
|
371
390
|
}
|
|
372
391
|
}
|
|
373
392
|
setProperty(key, newValue) {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
393
|
+
this._propertyAccessor?.setProperty?.(key, newValue);
|
|
394
|
+
this._properties.set(key, newValue);
|
|
395
|
+
}
|
|
396
|
+
getProperties(keys) {
|
|
397
|
+
const properties = {};
|
|
398
|
+
for (const [name, property] of this.getPropertyDeclarations()) {
|
|
399
|
+
if (!property.internal && !property.alias && (!keys || keys.includes(name))) {
|
|
400
|
+
properties[name] = this.getProperty(name);
|
|
401
|
+
}
|
|
377
402
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
403
|
+
return properties;
|
|
404
|
+
}
|
|
405
|
+
setProperties(properties) {
|
|
406
|
+
if (properties && typeof properties === "object") {
|
|
407
|
+
for (const [name] of this.getPropertyDeclarations()) {
|
|
408
|
+
if (name in properties) {
|
|
409
|
+
this.offsetSet(name, properties[name]);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return this;
|
|
414
|
+
}
|
|
415
|
+
resetProperties() {
|
|
416
|
+
for (const [name, property] of this.getPropertyDeclarations()) {
|
|
417
|
+
this.offsetSet(
|
|
418
|
+
name,
|
|
419
|
+
typeof property.default === "function" ? property.default() : property.default
|
|
420
|
+
);
|
|
382
421
|
}
|
|
383
|
-
this
|
|
422
|
+
return this;
|
|
384
423
|
}
|
|
385
424
|
getPropertyDeclarations() {
|
|
386
425
|
return getDeclarations(this.constructor);
|
|
387
426
|
}
|
|
427
|
+
getPropertyDeclaration(key) {
|
|
428
|
+
return this.getPropertyDeclarations().get(key);
|
|
429
|
+
}
|
|
388
430
|
setPropertyAccessor(accessor) {
|
|
389
431
|
this._propertyAccessor = accessor;
|
|
390
432
|
this.getPropertyDeclarations().forEach((_declaration, key) => {
|
|
391
|
-
const newValue = this
|
|
433
|
+
const newValue = this.offsetGet(key);
|
|
392
434
|
const oldValue = this._properties.get(key);
|
|
393
435
|
if (newValue === void 0) {
|
|
394
436
|
if (oldValue !== void 0) {
|
|
395
|
-
this
|
|
437
|
+
this.offsetSet(key, oldValue);
|
|
396
438
|
}
|
|
397
439
|
} else if (newValue !== oldValue) {
|
|
398
|
-
this
|
|
440
|
+
this.offsetSet(key, newValue);
|
|
399
441
|
}
|
|
400
442
|
});
|
|
401
443
|
return this;
|
|
402
444
|
}
|
|
445
|
+
async _nextTick() {
|
|
446
|
+
if ("requestAnimationFrame" in globalThis) {
|
|
447
|
+
return new Promise((r) => globalThis.requestAnimationFrame(r));
|
|
448
|
+
}
|
|
449
|
+
return Promise.resolve();
|
|
450
|
+
}
|
|
451
|
+
async _enqueueUpdate() {
|
|
452
|
+
this._updating = true;
|
|
453
|
+
try {
|
|
454
|
+
await this._updatingPromise;
|
|
455
|
+
} catch (e) {
|
|
456
|
+
Promise.reject(e);
|
|
457
|
+
}
|
|
458
|
+
await this._nextTick();
|
|
459
|
+
if (!this._updating)
|
|
460
|
+
return;
|
|
461
|
+
this.onUpdate();
|
|
462
|
+
this._updating = false;
|
|
463
|
+
}
|
|
464
|
+
onUpdate() {
|
|
465
|
+
this._update(this._updatedProperties);
|
|
466
|
+
this._updatedProperties = /* @__PURE__ */ new Map();
|
|
467
|
+
}
|
|
403
468
|
onUpdateProperty(key, newValue, oldValue) {
|
|
404
|
-
this.
|
|
405
|
-
|
|
469
|
+
this.requestUpdate(key, newValue, oldValue);
|
|
470
|
+
}
|
|
471
|
+
requestUpdate(key, newValue, oldValue) {
|
|
472
|
+
if (key !== void 0) {
|
|
473
|
+
this._updatedProperties.set(key, oldValue);
|
|
474
|
+
this._changedProperties.add(key);
|
|
475
|
+
this._updateProperty(key, newValue, oldValue);
|
|
476
|
+
this.emit("updateProperty", key, newValue, oldValue);
|
|
477
|
+
}
|
|
478
|
+
if (!this._updating) {
|
|
479
|
+
this._updatingPromise = this._enqueueUpdate();
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
483
|
+
_update(changed) {
|
|
406
484
|
}
|
|
407
485
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
408
486
|
_updateProperty(key, newValue, oldValue) {
|
|
409
487
|
}
|
|
488
|
+
toJSON() {
|
|
489
|
+
const json = {};
|
|
490
|
+
this._properties.forEach((value, key) => {
|
|
491
|
+
if (value === void 0) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
if (value && typeof value === "object") {
|
|
495
|
+
if ("toJSON" in value && typeof value.toJSON === "function") {
|
|
496
|
+
json[key] = value.toJSON();
|
|
497
|
+
} else if (Array.isArray(value)) {
|
|
498
|
+
json[key] = [...value];
|
|
499
|
+
} else {
|
|
500
|
+
json[key] = { ...value };
|
|
501
|
+
}
|
|
502
|
+
} else {
|
|
503
|
+
json[key] = value;
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
return json;
|
|
507
|
+
}
|
|
508
|
+
clone() {
|
|
509
|
+
return new this.constructor(this.toJSON());
|
|
510
|
+
}
|
|
410
511
|
}
|
|
411
512
|
|
|
412
513
|
function parseColor(color) {
|
package/dist/index.d.cts
CHANGED
|
@@ -331,6 +331,7 @@ interface PropertyDeclaration {
|
|
|
331
331
|
interface PropertyAccessor {
|
|
332
332
|
getProperty?: (key: string, defaultValue?: any) => any;
|
|
333
333
|
setProperty?: (key: string, newValue: any) => void;
|
|
334
|
+
onUpdateProperty?: (key: string, newValue: any, oldValue: any) => void;
|
|
334
335
|
}
|
|
335
336
|
declare function getDeclarations(constructor: any): Map<string, PropertyDeclaration>;
|
|
336
337
|
declare function getPropertyInternalKey(key: string): string;
|
|
@@ -872,12 +873,31 @@ interface Reactivable {
|
|
|
872
873
|
declare class Reactivable extends Observable implements PropertyAccessor {
|
|
873
874
|
protected _propertyAccessor?: PropertyAccessor;
|
|
874
875
|
protected _properties: Map<string, unknown>;
|
|
876
|
+
protected _updatedProperties: Map<string, unknown>;
|
|
877
|
+
protected _changedProperties: Set<string>;
|
|
878
|
+
protected _updatingPromise: Promise<void>;
|
|
879
|
+
protected _updating: boolean;
|
|
880
|
+
constructor(properties?: Record<string, any>);
|
|
881
|
+
isDirty(key?: string): boolean;
|
|
882
|
+
offsetGet(key: string): any;
|
|
883
|
+
offsetSet(key: string, newValue: any): void;
|
|
875
884
|
getProperty(key: string, defaultValue?: any): any;
|
|
876
885
|
setProperty(key: string, newValue: any): void;
|
|
886
|
+
getProperties(keys?: string[]): Record<string, any>;
|
|
887
|
+
setProperties(properties?: Record<string, any>): this;
|
|
888
|
+
resetProperties(): this;
|
|
877
889
|
getPropertyDeclarations(): Map<string, PropertyDeclaration>;
|
|
890
|
+
getPropertyDeclaration(key: string): PropertyDeclaration | undefined;
|
|
878
891
|
setPropertyAccessor(accessor: PropertyAccessor): this;
|
|
892
|
+
protected _nextTick(): Promise<void>;
|
|
893
|
+
protected _enqueueUpdate(): Promise<void>;
|
|
894
|
+
onUpdate(): void;
|
|
879
895
|
onUpdateProperty(key: string, newValue: any, oldValue: any): void;
|
|
896
|
+
requestUpdate(key?: string, newValue?: any, oldValue?: any): void;
|
|
897
|
+
protected _update(changed: Map<string, any>): void;
|
|
880
898
|
protected _updateProperty(key: string, newValue: any, oldValue: any): void;
|
|
899
|
+
toJSON(): Record<string, any>;
|
|
900
|
+
clone(): this;
|
|
881
901
|
}
|
|
882
902
|
|
|
883
903
|
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, defaultColor, defineProperty, flatDocumentToDocument, getDeclarations, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, getPropertyInternalKey, hasCRLF, idGenerator, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeColor, normalizeColorFill, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, pick, property, property2, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
package/dist/index.d.mts
CHANGED
|
@@ -331,6 +331,7 @@ interface PropertyDeclaration {
|
|
|
331
331
|
interface PropertyAccessor {
|
|
332
332
|
getProperty?: (key: string, defaultValue?: any) => any;
|
|
333
333
|
setProperty?: (key: string, newValue: any) => void;
|
|
334
|
+
onUpdateProperty?: (key: string, newValue: any, oldValue: any) => void;
|
|
334
335
|
}
|
|
335
336
|
declare function getDeclarations(constructor: any): Map<string, PropertyDeclaration>;
|
|
336
337
|
declare function getPropertyInternalKey(key: string): string;
|
|
@@ -872,12 +873,31 @@ interface Reactivable {
|
|
|
872
873
|
declare class Reactivable extends Observable implements PropertyAccessor {
|
|
873
874
|
protected _propertyAccessor?: PropertyAccessor;
|
|
874
875
|
protected _properties: Map<string, unknown>;
|
|
876
|
+
protected _updatedProperties: Map<string, unknown>;
|
|
877
|
+
protected _changedProperties: Set<string>;
|
|
878
|
+
protected _updatingPromise: Promise<void>;
|
|
879
|
+
protected _updating: boolean;
|
|
880
|
+
constructor(properties?: Record<string, any>);
|
|
881
|
+
isDirty(key?: string): boolean;
|
|
882
|
+
offsetGet(key: string): any;
|
|
883
|
+
offsetSet(key: string, newValue: any): void;
|
|
875
884
|
getProperty(key: string, defaultValue?: any): any;
|
|
876
885
|
setProperty(key: string, newValue: any): void;
|
|
886
|
+
getProperties(keys?: string[]): Record<string, any>;
|
|
887
|
+
setProperties(properties?: Record<string, any>): this;
|
|
888
|
+
resetProperties(): this;
|
|
877
889
|
getPropertyDeclarations(): Map<string, PropertyDeclaration>;
|
|
890
|
+
getPropertyDeclaration(key: string): PropertyDeclaration | undefined;
|
|
878
891
|
setPropertyAccessor(accessor: PropertyAccessor): this;
|
|
892
|
+
protected _nextTick(): Promise<void>;
|
|
893
|
+
protected _enqueueUpdate(): Promise<void>;
|
|
894
|
+
onUpdate(): void;
|
|
879
895
|
onUpdateProperty(key: string, newValue: any, oldValue: any): void;
|
|
896
|
+
requestUpdate(key?: string, newValue?: any, oldValue?: any): void;
|
|
897
|
+
protected _update(changed: Map<string, any>): void;
|
|
880
898
|
protected _updateProperty(key: string, newValue: any, oldValue: any): void;
|
|
899
|
+
toJSON(): Record<string, any>;
|
|
900
|
+
clone(): this;
|
|
881
901
|
}
|
|
882
902
|
|
|
883
903
|
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, defaultColor, defineProperty, flatDocumentToDocument, getDeclarations, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, getPropertyInternalKey, hasCRLF, idGenerator, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeColor, normalizeColorFill, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, pick, property, property2, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
package/dist/index.d.ts
CHANGED
|
@@ -331,6 +331,7 @@ interface PropertyDeclaration {
|
|
|
331
331
|
interface PropertyAccessor {
|
|
332
332
|
getProperty?: (key: string, defaultValue?: any) => any;
|
|
333
333
|
setProperty?: (key: string, newValue: any) => void;
|
|
334
|
+
onUpdateProperty?: (key: string, newValue: any, oldValue: any) => void;
|
|
334
335
|
}
|
|
335
336
|
declare function getDeclarations(constructor: any): Map<string, PropertyDeclaration>;
|
|
336
337
|
declare function getPropertyInternalKey(key: string): string;
|
|
@@ -872,12 +873,31 @@ interface Reactivable {
|
|
|
872
873
|
declare class Reactivable extends Observable implements PropertyAccessor {
|
|
873
874
|
protected _propertyAccessor?: PropertyAccessor;
|
|
874
875
|
protected _properties: Map<string, unknown>;
|
|
876
|
+
protected _updatedProperties: Map<string, unknown>;
|
|
877
|
+
protected _changedProperties: Set<string>;
|
|
878
|
+
protected _updatingPromise: Promise<void>;
|
|
879
|
+
protected _updating: boolean;
|
|
880
|
+
constructor(properties?: Record<string, any>);
|
|
881
|
+
isDirty(key?: string): boolean;
|
|
882
|
+
offsetGet(key: string): any;
|
|
883
|
+
offsetSet(key: string, newValue: any): void;
|
|
875
884
|
getProperty(key: string, defaultValue?: any): any;
|
|
876
885
|
setProperty(key: string, newValue: any): void;
|
|
886
|
+
getProperties(keys?: string[]): Record<string, any>;
|
|
887
|
+
setProperties(properties?: Record<string, any>): this;
|
|
888
|
+
resetProperties(): this;
|
|
877
889
|
getPropertyDeclarations(): Map<string, PropertyDeclaration>;
|
|
890
|
+
getPropertyDeclaration(key: string): PropertyDeclaration | undefined;
|
|
878
891
|
setPropertyAccessor(accessor: PropertyAccessor): this;
|
|
892
|
+
protected _nextTick(): Promise<void>;
|
|
893
|
+
protected _enqueueUpdate(): Promise<void>;
|
|
894
|
+
onUpdate(): void;
|
|
879
895
|
onUpdateProperty(key: string, newValue: any, oldValue: any): void;
|
|
896
|
+
requestUpdate(key?: string, newValue?: any, oldValue?: any): void;
|
|
897
|
+
protected _update(changed: Map<string, any>): void;
|
|
880
898
|
protected _updateProperty(key: string, newValue: any, oldValue: any): void;
|
|
899
|
+
toJSON(): Record<string, any>;
|
|
900
|
+
clone(): this;
|
|
881
901
|
}
|
|
882
902
|
|
|
883
903
|
export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, defaultColor, defineProperty, flatDocumentToDocument, getDeclarations, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, getPropertyInternalKey, hasCRLF, idGenerator, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeColor, normalizeColorFill, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, pick, property, property2, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(o,G){typeof exports=="object"&&typeof module<"u"?G(exports):typeof define=="function"&&define.amd?define(["exports"],G):(o=typeof globalThis<"u"?globalThis:o||self,G(o.modernIdoc={}))})(this,(function(o){"use strict";function G(t){return typeof t=="string"?{src:t}:t}var Se={grad:.9,turn:360,rad:360/(2*Math.PI)},D=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},b=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},E=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},ht=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},pt=function(t){return{r:E(t.r,0,255),g:E(t.g,0,255),b:E(t.b,0,255),a:E(t.a)}},tt=function(t){return{r:b(t.r),g:b(t.g),b:b(t.b),a:b(t.a,3)}},Ce=/^#([0-9a-f]{3,8})$/i,K=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},vt=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,a=Math.max(e,n,r),l=a-Math.min(e,n,r),u=l?a===e?(n-r)/l:a===n?2+(r-e)/l:4+(e-n)/l:0;return{h:60*(u<0?u+6:u),s:a?l/a*100:0,v:a/255*100,a:i}},mt=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),l=r*(1-n),u=r*(1-(e-a)*n),f=r*(1-(1-e+a)*n),p=a%6;return{r:255*[r,u,l,l,f,r][p],g:255*[f,r,r,u,l,l][p],b:255*[l,l,f,r,r,u][p],a:i}},yt=function(t){return{h:ht(t.h),s:E(t.s,0,100),l:E(t.l,0,100),a:E(t.a)}},bt=function(t){return{h:b(t.h),s:b(t.s),l:b(t.l),a:b(t.a,3)}},St=function(t){return mt((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=vt(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},we=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_e=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ze=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ee=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ct={string:[[function(t){var e=Ce.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?b(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?b(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=ze.exec(t)||Ee.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=we.exec(t)||_e.exec(t);if(!e)return null;var n,r,i=yt({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(Se[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return St(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 l=yt({h:Number(e),s:Number(n),l:Number(r),a:Number(a)});return St(l)},"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 l=(function(u){return{h:ht(u.h),s:E(u.s,0,100),v:E(u.v,0,100),a:E(u.a)}})({h:Number(e),s:Number(n),v:Number(r),a:Number(a)});return mt(l)},"hsv"]]},wt=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]},Fe=function(t){return typeof t=="string"?wt(t.trim(),Ct.string):typeof t=="object"&&t!==null?wt(t,Ct.object):[null,void 0]},et=function(t,e){var n=V(t);return{h:n.h,s:E(n.s+100*e,0,100),l:n.l,a:n.a}},nt=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},_t=function(t,e){var n=V(t);return{h:n.h,s:n.s,l:E(n.l+100*e,0,100),a:n.a}},zt=(function(){function t(e){this.parsed=Fe(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 b(nt(this.rgba),2)},t.prototype.isDark=function(){return nt(this.rgba)<.5},t.prototype.isLight=function(){return nt(this.rgba)>=.5},t.prototype.toHex=function(){return e=tt(this.rgba),n=e.r,r=e.g,i=e.b,l=(a=e.a)<1?K(b(255*a)):"","#"+K(n)+K(r)+K(i)+l;var e,n,r,i,a,l},t.prototype.toRgb=function(){return tt(this.rgba)},t.prototype.toRgbString=function(){return e=tt(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 bt(V(this.rgba))},t.prototype.toHslString=function(){return e=bt(V(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=vt(this.rgba),{h:b(e.h),s:b(e.s),v:b(e.v),a:b(e.a,3)};var e},t.prototype.invert=function(){return O({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),O(et(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),O(et(this.rgba,-e))},t.prototype.grayscale=function(){return O(et(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),O(_t(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),O(_t(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"?O({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):b(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=V(this.rgba);return typeof e=="number"?O({h:e,s:n.s,l:n.l,a:n.a}):b(n.h)},t.prototype.isEqual=function(e){return this.toHex()===O(e).toHex()},t})(),O=function(t){return t instanceof zt?t:new zt(t)};class Le{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 l=0,u=i.length;l<u;l++){const f=i[l];(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 l=r[a];typeof l.options=="object"&&l.options?.once&&this.off(e,l.value,l.options),l.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==="none"}function A(t,e=0,n=10**e){return Math.round(n*t)/n+0}function w(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(r=>w(r,e)):t;const n={};for(const r in t){const i=t[r];i!=null&&(e?n[r]=w(i,e):n[r]=i)}return n}function U(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 Et(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 Ft(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 Lt(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(/^\./,""),Et(t,e.split("."),n))}function Pt(t,e,n){if(!(typeof t!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Ft(t,e.split("."),n)}class Ot{_observers=new Map;on(e,n){let r=this._observers.get(e);return r===void 0&&this._observers.set(e,r=new Set),r.add(n),this}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};return this.on(e,r),this}off(e,n){const r=this._observers.get(e);return r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e)),this}emit(e,...n){return Array.from((this._observers.get(e)||new Map).values()).forEach(r=>r(...n)),this}destroy(){this._observers=new Map}}class Pe{_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 rt=Symbol("properties"),Dt=Symbol("inited");function M(t){let e;if(Object.hasOwn(t,rt))e=t[rt];else{const n=Object.getPrototypeOf(t);e=new Map(n?M(n):void 0),t[rt]=e}return e}function At(t){return`__internal:${t}`}function it(t,e={}){const n=At(t),{default:r,fallback:i,alias:a,internal:l}=e,u=()=>typeof r=="function"?r():r,f=()=>typeof i=="function"?i():i;function p(){let d;if(a&&a!==t?d=Lt(this,a):!l&&typeof this.getProperty<"u"?d=this.getProperty(t):d=this[n],d=d??f(),d===void 0&&r!==void 0&&!this[Dt]){this[Dt]=!0;const m=u();m!==void 0&&(v.call(this,m),d=m)}return d}function v(d){a&&a!==t?Pt(this,a,d):!l&&typeof this.setProperty<"u"?this.setProperty(t,d):this[n]=d}return{get:p,set:v}}function Nt(t,e,n={}){M(t).set(e,n);const r=it(e,n);Object.defineProperty(t.prototype,e,{get(){return r.get.call(this)},set(i){r.set.call(this,i)},configurable:!0,enumerable:!0})}function Oe(t){return function(e,n){if(typeof n!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");Nt(e.constructor,n,t)}}function De(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=it(r,t);return{init(a){return M(this.constructor).set(r,t),i.set.call(this,a),a},get(){return i.get.call(this)},set(a){i.set.call(this,a)}}}}class Ae extends Ot{_propertyAccessor;_properties=new Map;getProperty(e,n){return this._propertyAccessor?.getProperty?this._propertyAccessor.getProperty(e,n):this._properties.get(e)??n}setProperty(e,n){const r=this[e];Object.is(n,r)||(this._propertyAccessor?.setProperty?this._propertyAccessor.setProperty(e,n):this._properties.set(e,n),this.onUpdateProperty(e,n,r))}getPropertyDeclarations(){return M(this.constructor)}setPropertyAccessor(e){return this._propertyAccessor=e,this.getPropertyDeclarations().forEach((n,r)=>{const i=this[r],a=this._properties.get(r);i===void 0?a!==void 0&&(this[r]=a):i!==a&&(this[r]=i)}),this}onUpdateProperty(e,n,r){this._updateProperty(e,n,r),this.emit("updateProperty",e,n,r)}_updateProperty(e,n,r){}}function ot(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,O(e)}function Ne(t){return{r:A(t.r),g:A(t.g),b:A(t.b),a:A(t.a,3)}}function Y(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const T="#000000FF";function Rt(t){return ot(t).isValid()}function C(t,e=!1){const n=ot(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),T}const{r,g:i,b:a,a:l}=Ne(n.rgba);return`#${Y(r)}${Y(i)}${Y(a)}${Y(A(l*255))}`}var x=x||{};x.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(s){const c=new Error(`${e}: ${s}`);throw c.source=e,c}function r(){const s=i();return e.length>0&&n("Invalid input not EOF"),s}function i(){return j(a)}function a(){return l("linear-gradient",t.linearGradient,f)||l("repeating-linear-gradient",t.repeatingLinearGradient,f)||l("radial-gradient",t.radialGradient,d)||l("repeating-radial-gradient",t.repeatingRadialGradient,d)}function l(s,c,g){return u(c,S=>{const I=g();return I&&(y(t.comma)||n("Missing comma before color stops")),{type:s,orientation:I,colorStops:j(dt)}})}function u(s,c){const g=y(s);if(g){y(t.startCall)||n("Missing (");const S=c(g);return y(t.endCall)||n("Missing )"),S}}function f(){const s=p();if(s)return s;const c=z("position-keyword",t.positionKeywords,1);return c?{type:"directional",value:c.value}:v()}function p(){return z("directional",t.sideOrCorner,1)}function v(){return z("angular",t.angleValue,1)||z("angular",t.radianValue,1)}function d(){let s,c=m(),g;return c&&(s=[],s.push(c),g=e,y(t.comma)&&(c=m(),c?s.push(c):e=g)),s}function m(){let s=_()||N();if(s)s.at=P();else{const c=F();if(c){s=c;const g=P();g&&(s.at=g)}else{const g=P();if(g)s={type:"default-radial",at:g};else{const S=R();S&&(s={type:"default-radial",at:S})}}}return s}function _(){const s=z("shape",/^(circle)/i,0);return s&&(s.style=be()||F()),s}function N(){const s=z("shape",/^(ellipse)/i,0);return s&&(s.style=R()||Q()||F()),s}function F(){return z("extent-keyword",t.extentKeywords,1)}function P(){if(z("position",/^at/,0)){const s=R();return s||n("Missing positioning value"),s}}function R(){const s=W();if(s.x||s.y)return{type:"position",value:s}}function W(){return{x:Q(),y:Q()}}function j(s){let c=s();const g=[];if(c)for(g.push(c);y(t.comma);)c=s(),c?g.push(c):n("One extra comma");return g}function dt(){const s=Ke();return s||n("Expected color definition"),s.length=Q(),s}function Ke(){return Xe()||Je()||Ze()||xe()||Ye()||qe()||Ue()}function Ue(){return z("literal",t.literalColor,0)}function Xe(){return z("hex",t.hexColor,1)}function Ye(){return u(t.rgbColor,()=>({type:"rgb",value:j(B)}))}function xe(){return u(t.rgbaColor,()=>({type:"rgba",value:j(B)}))}function qe(){return u(t.varColor,()=>({type:"var",value:Qe()}))}function Ze(){return u(t.hslColor,()=>{y(t.percentageValue)&&n("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const c=B();y(t.comma);let g=y(t.percentageValue);const S=g?g[1]:null;y(t.comma),g=y(t.percentageValue);const I=g?g[1]:null;return(!S||!I)&&n("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[c,S,I]}})}function Je(){return u(t.hslaColor,()=>{const s=B();y(t.comma);let c=y(t.percentageValue);const g=c?c[1]:null;y(t.comma),c=y(t.percentageValue);const S=c?c[1]:null;y(t.comma);const I=B();return(!g||!S)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[s,g,S,I]}})}function Qe(){return y(t.variableName)[1]}function B(){return y(t.number)[1]}function Q(){return z("%",t.percentageValue,1)||tn()||en()||be()}function tn(){return z("position-keyword",t.positionKeywords,1)}function en(){return u(t.calcValue,()=>{let s=1,c=0;for(;s>0&&c<e.length;){const S=e.charAt(c);S==="("?s++:S===")"&&s--,c++}s>0&&n("Missing closing parenthesis in calc() expression");const g=e.substring(0,c-1);return gt(c-1),{type:"calc",value:g}})}function be(){return z("px",t.pixelValue,1)||z("em",t.emValue,1)}function z(s,c,g){const S=y(c);if(S)return{type:s,value:S[g]}}function y(s){let c,g;return g=/^\s+/.exec(e),g&>(g[0].length),c=s.exec(e),c&>(c[0].length),c}function gt(s){e=e.substr(s)}return function(s){return e=s.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),r()}})();const It=x.parse.bind(x);var q=q||{};q.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 Re=q.stringify.bind(q);function Gt(t){const e=t.length-1;return t.map((n,r)=>{const i=n.value;let a=A(r/e,3),l="#00000000";switch(n.type){case"rgb":l=C({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":l=C({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":l=C(n.value);break;case"hex":l=C(`#${n.value}`);break}switch(n.length?.type){case"%":a=Number(n.length.value)/100;break}return{offset:a,color:l}})}function kt(t){let e=0;switch(t.orientation?.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:Gt(t.colorStops)}}function jt(t){return t.orientation?.map(e=>{switch(e?.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:Gt(t.colorStops)}}function $(t){return t.startsWith("linear-gradient(")||t.startsWith("radial-gradient(")}function Vt(t){return It(t).map(e=>{switch(e?.type){case"linear-gradient":return kt(e);case"repeating-linear-gradient":return{...kt(e),repeat:!0};case"radial-gradient":return jt(e);case"repeating-radial-gradient":return{...jt(e),repeat:!0};default:return}}).filter(Boolean)}function Mt(t){let e;return typeof t=="string"?e={color:t}:e=t,{color:C(e.color)}}function Tt(t){let e;if(typeof t=="string"?e={image:t}:e=t,e.image){const{type:n,...r}=Vt(e.image)[0]??{};switch(n){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}}return e}function $t(t){let e;return typeof t=="string"?e={image:t}:e=t,e}function Ht(t){let e;return typeof t=="string"?e={preset:t}:e=t,{preset:e.preset,foregroundColor:h(e.foregroundColor)?void 0:C(e.foregroundColor),backgroundColor:h(e.backgroundColor)?void 0:C(e.backgroundColor)}}function Wt(t){return!h(t.color)}function Bt(t){return typeof t=="string"?Rt(t):Wt(t)}function Kt(t){return!h(t.image)&&$(t.image)||!!t.linearGradient||!!t.radialGradient}function Ut(t){return typeof t=="string"?$(t):Kt(t)}function Xt(t){return!h(t.image)&&!$(t.image)}function Yt(t){return typeof t=="string"?!$(t):Xt(t)}function xt(t){return!h(t.preset)}function qt(t){return typeof t=="string"?!1:xt(t)}function L(t){const e=t&&typeof t=="object"?t.enabled:void 0;return Bt(t)?w({enabled:e,...Mt(t)}):Ut(t)?w({enabled:e,...Tt(t)}):Yt(t)?w({enabled:e,...$t(t)}):qt(t)?w({enabled:e,...Ht(t)}):{}}function Zt(t){return typeof t=="string"?{...L(t)}:{...L(t),...U(t,["fillWithShape"])}}function at(){return{color:T,offsetX:0,offsetY:0,blurRadius:1}}function st(t){return{...at(),...w({...t,color:h(t.color)?T:C(t.color)})}}function Jt(){return{...at(),scaleX:1,scaleY:1}}function Qt(t){return{...Jt(),...st(t)}}function Ie(t){return t}function te(t){return w({...t,softEdge:h(t.softEdge)?void 0:t.softEdge,outerShadow:h(t.outerShadow)?void 0:Qt(t.outerShadow),innerShadow:h(t.innerShadow)?void 0:st(t.innerShadow)})}function ee(t){return typeof t=="string"?{...L(t)}:{...L(t),...U(t,["fillWithShape"])}}const Ge="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let ke=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=Ge[n[t]&63];return e};const ne=()=>ke(10),re=ne;function H(t){return typeof t=="string"?{...L(t)}:{...L(t),...U(t,["width","style","lineCap","lineJoin","headEnd","tailEnd"])}}function ie(t){return typeof t=="string"?{color:C(t)}:{...t,color:h(t.color)?T:C(t.color)}}function oe(){return{boxShadow:"none"}}function ae(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 se(){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 le(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function ue(){return{...se(),...le(),...oe(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function ce(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function fe(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function de(){return{...ce(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function ge(){return{...fe(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function he(){return{...ge(),...de(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function k(t){return w({...t,color:h(t.color)?void 0:C(t.color),backgroundColor:h(t.backgroundColor)?void 0:C(t.backgroundColor),borderColor:h(t.borderColor)?void 0:C(t.borderColor),outlineColor:h(t.outlineColor)?void 0:C(t.outlineColor),shadowColor:h(t.shadowColor)?void 0:C(t.shadowColor)})}function je(){return{...ue(),...he()}}const lt=/\r\n|\n\r|\n|\r/,Ve=new RegExp(`${lt.source}|<br\\/>`,"g"),Me=new RegExp(`^(${lt.source})$`),ut=`
|
|
2
|
-
`;function
|
|
1
|
+
(function(o,G){typeof exports=="object"&&typeof module<"u"?G(exports):typeof define=="function"&&define.amd?define(["exports"],G):(o=typeof globalThis<"u"?globalThis:o||self,G(o.modernIdoc={}))})(this,(function(o){"use strict";function G(t){return typeof t=="string"?{src:t}:t}var Se={grad:.9,turn:360,rad:360/(2*Math.PI)},D=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},b=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},z=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},ht=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},pt=function(t){return{r:z(t.r,0,255),g:z(t.g,0,255),b:z(t.b,0,255),a:z(t.a)}},tt=function(t){return{r:b(t.r),g:b(t.g),b:b(t.b),a:b(t.a,3)}},_e=/^#([0-9a-f]{3,8})$/i,K=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},vt=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,a=Math.max(e,n,r),u=a-Math.min(e,n,r),l=u?a===e?(n-r)/u:a===n?2+(r-e)/u:4+(e-n)/u:0;return{h:60*(l<0?l+6:l),s:a?u/a*100:0,v:a/255*100,a:i}},mt=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),u=r*(1-n),l=r*(1-(e-a)*n),f=r*(1-(1-e+a)*n),p=a%6;return{r:255*[r,l,u,u,f,r][p],g:255*[f,r,r,l,u,u][p],b:255*[u,u,f,r,r,l][p],a:i}},yt=function(t){return{h:ht(t.h),s:z(t.s,0,100),l:z(t.l,0,100),a:z(t.a)}},bt=function(t){return{h:b(t.h),s:b(t.s),l:b(t.l),a:b(t.a,3)}},St=function(t){return mt((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=vt(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},we=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ce=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pe=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ze=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_t={string:[[function(t){var e=_e.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?b(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?b(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=Pe.exec(t)||ze.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=we.exec(t)||Ce.exec(t);if(!e)return null;var n,r,i=yt({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(Se[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return St(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 u=yt({h:Number(e),s:Number(n),l:Number(r),a:Number(a)});return St(u)},"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 u=(function(l){return{h:ht(l.h),s:z(l.s,0,100),v:z(l.v,0,100),a:z(l.a)}})({h:Number(e),s:Number(n),v:Number(r),a:Number(a)});return mt(u)},"hsv"]]},wt=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]},Ee=function(t){return typeof t=="string"?wt(t.trim(),_t.string):typeof t=="object"&&t!==null?wt(t,_t.object):[null,void 0]},et=function(t,e){var n=V(t);return{h:n.h,s:z(n.s+100*e,0,100),l:n.l,a:n.a}},nt=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Ct=function(t,e){var n=V(t);return{h:n.h,s:n.s,l:z(n.l+100*e,0,100),a:n.a}},Pt=(function(){function t(e){this.parsed=Ee(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 b(nt(this.rgba),2)},t.prototype.isDark=function(){return nt(this.rgba)<.5},t.prototype.isLight=function(){return nt(this.rgba)>=.5},t.prototype.toHex=function(){return e=tt(this.rgba),n=e.r,r=e.g,i=e.b,u=(a=e.a)<1?K(b(255*a)):"","#"+K(n)+K(r)+K(i)+u;var e,n,r,i,a,u},t.prototype.toRgb=function(){return tt(this.rgba)},t.prototype.toRgbString=function(){return e=tt(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 bt(V(this.rgba))},t.prototype.toHslString=function(){return e=bt(V(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=vt(this.rgba),{h:b(e.h),s:b(e.s),v:b(e.v),a:b(e.a,3)};var e},t.prototype.invert=function(){return O({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),O(et(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),O(et(this.rgba,-e))},t.prototype.grayscale=function(){return O(et(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),O(Ct(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),O(Ct(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"?O({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):b(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=V(this.rgba);return typeof e=="number"?O({h:e,s:n.s,l:n.l,a:n.a}):b(n.h)},t.prototype.isEqual=function(e){return this.toHex()===O(e).toHex()},t})(),O=function(t){return t instanceof Pt?t:new Pt(t)};class Fe{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 u=0,l=i.length;u<l;u++){const f=i[u];(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 u=r[a];typeof u.options=="object"&&u.options?.once&&this.off(e,u.value,u.options),u.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==="none"}function N(t,e=0,n=10**e){return Math.round(n*t)/n+0}function w(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(r=>w(r,e)):t;const n={};for(const r in t){const i=t[r];i!=null&&(e?n[r]=w(i,e):n[r]=i)}return n}function U(t,e){const n={};return e.forEach(r=>{r in t&&(n[r]=t[r])}),n}function q(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 zt(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 Et(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 Ft(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(/^\./,""),zt(t,e.split("."),n))}function Lt(t,e,n){if(!(typeof t!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Et(t,e.split("."),n)}class Ot{_observers=new Map;on(e,n){let r=this._observers.get(e);return r===void 0&&this._observers.set(e,r=new Set),r.add(n),this}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};return this.on(e,r),this}off(e,n){const r=this._observers.get(e);return r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e)),this}emit(e,...n){return Array.from((this._observers.get(e)||new Map).values()).forEach(r=>r(...n)),this}destroy(){this._observers=new Map}}class Le{_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 rt=Symbol("properties"),Dt=Symbol("inited");function M(t){let e;if(Object.hasOwn(t,rt))e=t[rt];else{const n=Object.getPrototypeOf(t);e=new Map(n?M(n):void 0),t[rt]=e}return e}function Nt(t){return`__internal:${t}`}function it(t,e={}){const n=Nt(t),{default:r,fallback:i,alias:a,internal:u}=e,l=()=>typeof r=="function"?r():r,f=()=>typeof i=="function"?i():i;function p(){let d;if(a&&a!==t?d=Ft(this,a):!u&&typeof this.getProperty<"u"?d=this.getProperty(t):d=this[n],d=d??f(),d===void 0&&r!==void 0&&!this[Dt]){this[Dt]=!0;const v=l();v!==void 0&&(m.call(this,v),d=v)}return d}function m(d){const v=p.call(this);a&&a!==t?Lt(this,a,d):!u&&typeof this.setProperty<"u"?this.setProperty(t,d):this[n]=d,this.onUpdateProperty?.(t,d,v)}return{get:p,set:m}}function At(t,e,n={}){M(t).set(e,n);const r=it(e,n);Object.defineProperty(t.prototype,e,{get(){return r.get.call(this)},set(i){r.set.call(this,i)},configurable:!0,enumerable:!0})}function Oe(t){return function(e,n){if(typeof n!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");At(e.constructor,n,t)}}function De(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=it(r,t);return{init(a){return M(this.constructor).set(r,t),i.set.call(this,a),a},get(){return i.get.call(this)},set(a){i.set.call(this,a)}}}}class Ne extends Ot{_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}offsetGet(e){return this[e]}offsetSet(e,n){this[e]=n}getProperty(e,n){return this._propertyAccessor?.getProperty?this._propertyAccessor.getProperty(e,n):this._properties.get(e)??n}setProperty(e,n){this._propertyAccessor?.setProperty?.(e,n),this._properties.set(e,n)}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]of this.getPropertyDeclarations())n in e&&this.offsetSet(n,e[n]);return this}resetProperties(){for(const[e,n]of this.getPropertyDeclarations())this.offsetSet(e,typeof n.default=="function"?n.default():n.default);return this}getPropertyDeclarations(){return M(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations().get(e)}setPropertyAccessor(e){return this._propertyAccessor=e,this.getPropertyDeclarations().forEach((n,r)=>{const i=this.offsetGet(r),a=this._properties.get(r);i===void 0?a!==void 0&&this.offsetSet(r,a):i!==a&&this.offsetSet(r,i)}),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){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())}}function ot(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,O(e)}function Ae(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 k="#000000FF";function Rt(t){return ot(t).isValid()}function _(t,e=!1){const n=ot(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),k}const{r,g:i,b:a,a:u}=Ae(n.rgba);return`#${x(r)}${x(i)}${x(a)}${x(N(u*255))}`}var J=J||{};J.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(s){const c=new Error(`${e}: ${s}`);throw c.source=e,c}function r(){const s=i();return e.length>0&&n("Invalid input not EOF"),s}function i(){return T(a)}function a(){return u("linear-gradient",t.linearGradient,f)||u("repeating-linear-gradient",t.repeatingLinearGradient,f)||u("radial-gradient",t.radialGradient,d)||u("repeating-radial-gradient",t.repeatingRadialGradient,d)}function u(s,c,g){return l(c,S=>{const I=g();return I&&(y(t.comma)||n("Missing comma before color stops")),{type:s,orientation:I,colorStops:T(dt)}})}function l(s,c){const g=y(s);if(g){y(t.startCall)||n("Missing (");const S=c(g);return y(t.endCall)||n("Missing )"),S}}function f(){const s=p();if(s)return s;const c=P("position-keyword",t.positionKeywords,1);return c?{type:"directional",value:c.value}:m()}function p(){return P("directional",t.sideOrCorner,1)}function m(){return P("angular",t.angleValue,1)||P("angular",t.radianValue,1)}function d(){let s,c=v(),g;return c&&(s=[],s.push(c),g=e,y(t.comma)&&(c=v(),c?s.push(c):e=g)),s}function v(){let s=C()||A();if(s)s.at=L();else{const c=E();if(c){s=c;const g=L();g&&(s.at=g)}else{const g=L();if(g)s={type:"default-radial",at:g};else{const S=R();S&&(s={type:"default-radial",at:S})}}}return s}function C(){const s=P("shape",/^(circle)/i,0);return s&&(s.style=be()||E()),s}function A(){const s=P("shape",/^(ellipse)/i,0);return s&&(s.style=R()||Q()||E()),s}function E(){return P("extent-keyword",t.extentKeywords,1)}function L(){if(P("position",/^at/,0)){const s=R();return s||n("Missing positioning value"),s}}function R(){const s=W();if(s.x||s.y)return{type:"position",value:s}}function W(){return{x:Q(),y:Q()}}function T(s){let c=s();const g=[];if(c)for(g.push(c);y(t.comma);)c=s(),c?g.push(c):n("One extra comma");return g}function dt(){const s=Ke();return s||n("Expected color definition"),s.length=Q(),s}function Ke(){return qe()||Ze()||Ye()||Je()||xe()||Xe()||Ue()}function Ue(){return P("literal",t.literalColor,0)}function qe(){return P("hex",t.hexColor,1)}function xe(){return l(t.rgbColor,()=>({type:"rgb",value:T(B)}))}function Je(){return l(t.rgbaColor,()=>({type:"rgba",value:T(B)}))}function Xe(){return l(t.varColor,()=>({type:"var",value:Qe()}))}function Ye(){return l(t.hslColor,()=>{y(t.percentageValue)&&n("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const c=B();y(t.comma);let g=y(t.percentageValue);const S=g?g[1]:null;y(t.comma),g=y(t.percentageValue);const I=g?g[1]:null;return(!S||!I)&&n("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[c,S,I]}})}function Ze(){return l(t.hslaColor,()=>{const s=B();y(t.comma);let c=y(t.percentageValue);const g=c?c[1]:null;y(t.comma),c=y(t.percentageValue);const S=c?c[1]:null;y(t.comma);const I=B();return(!g||!S)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[s,g,S,I]}})}function Qe(){return y(t.variableName)[1]}function B(){return y(t.number)[1]}function Q(){return P("%",t.percentageValue,1)||tn()||en()||be()}function tn(){return P("position-keyword",t.positionKeywords,1)}function en(){return l(t.calcValue,()=>{let s=1,c=0;for(;s>0&&c<e.length;){const S=e.charAt(c);S==="("?s++:S===")"&&s--,c++}s>0&&n("Missing closing parenthesis in calc() expression");const g=e.substring(0,c-1);return gt(c-1),{type:"calc",value:g}})}function be(){return P("px",t.pixelValue,1)||P("em",t.emValue,1)}function P(s,c,g){const S=y(c);if(S)return{type:s,value:S[g]}}function y(s){let c,g;return g=/^\s+/.exec(e),g&>(g[0].length),c=s.exec(e),c&>(c[0].length),c}function gt(s){e=e.substr(s)}return function(s){return e=s.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),r()}})();const It=J.parse.bind(J);var X=X||{};X.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 Re=X.stringify.bind(X);function Gt(t){const e=t.length-1;return t.map((n,r)=>{const i=n.value;let a=N(r/e,3),u="#00000000";switch(n.type){case"rgb":u=_({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":u=_({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":u=_(n.value);break;case"hex":u=_(`#${n.value}`);break}switch(n.length?.type){case"%":a=Number(n.length.value)/100;break}return{offset:a,color:u}})}function jt(t){let e=0;switch(t.orientation?.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:Gt(t.colorStops)}}function Tt(t){return t.orientation?.map(e=>{switch(e?.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:Gt(t.colorStops)}}function $(t){return t.startsWith("linear-gradient(")||t.startsWith("radial-gradient(")}function Vt(t){return It(t).map(e=>{switch(e?.type){case"linear-gradient":return jt(e);case"repeating-linear-gradient":return{...jt(e),repeat:!0};case"radial-gradient":return Tt(e);case"repeating-radial-gradient":return{...Tt(e),repeat:!0};default:return}}).filter(Boolean)}function Mt(t){let e;return typeof t=="string"?e={color:t}:e=t,{color:_(e.color)}}function kt(t){let e;if(typeof t=="string"?e={image:t}:e=t,e.image){const{type:n,...r}=Vt(e.image)[0]??{};switch(n){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}}return e}function $t(t){let e;return typeof t=="string"?e={image:t}:e=t,e}function Ht(t){let e;return typeof t=="string"?e={preset:t}:e=t,{preset:e.preset,foregroundColor:h(e.foregroundColor)?void 0:_(e.foregroundColor),backgroundColor:h(e.backgroundColor)?void 0:_(e.backgroundColor)}}function Wt(t){return!h(t.color)}function Bt(t){return typeof t=="string"?Rt(t):Wt(t)}function Kt(t){return!h(t.image)&&$(t.image)||!!t.linearGradient||!!t.radialGradient}function Ut(t){return typeof t=="string"?$(t):Kt(t)}function qt(t){return!h(t.image)&&!$(t.image)}function xt(t){return typeof t=="string"?!$(t):qt(t)}function Jt(t){return!h(t.preset)}function Xt(t){return typeof t=="string"?!1:Jt(t)}function F(t){const e=t&&typeof t=="object"?t.enabled:void 0;return Bt(t)?w({enabled:e,...Mt(t)}):Ut(t)?w({enabled:e,...kt(t)}):xt(t)?w({enabled:e,...$t(t)}):Xt(t)?w({enabled:e,...Ht(t)}):{}}function Yt(t){return typeof t=="string"?{...F(t)}:{...F(t),...U(t,["fillWithShape"])}}function at(){return{color:k,offsetX:0,offsetY:0,blurRadius:1}}function st(t){return{...at(),...w({...t,color:h(t.color)?k:_(t.color)})}}function Zt(){return{...at(),scaleX:1,scaleY:1}}function Qt(t){return{...Zt(),...st(t)}}function Ie(t){return t}function te(t){return w({...t,softEdge:h(t.softEdge)?void 0:t.softEdge,outerShadow:h(t.outerShadow)?void 0:Qt(t.outerShadow),innerShadow:h(t.innerShadow)?void 0:st(t.innerShadow)})}function ee(t){return typeof t=="string"?{...F(t)}:{...F(t),...U(t,["fillWithShape"])}}const Ge="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let je=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=Ge[n[t]&63];return e};const ne=()=>je(10),re=ne;function H(t){return typeof t=="string"?{...F(t)}:{...F(t),...U(t,["width","style","lineCap","lineJoin","headEnd","tailEnd"])}}function ie(t){return typeof t=="string"?{color:_(t)}:{...t,color:h(t.color)?k:_(t.color)}}function oe(){return{boxShadow:"none"}}function ae(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 se(){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 ue(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function le(){return{...se(),...ue(),...oe(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function ce(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function fe(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function de(){return{...ce(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function ge(){return{...fe(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function he(){return{...ge(),...de(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function j(t){return w({...t,color:h(t.color)?void 0:_(t.color),backgroundColor:h(t.backgroundColor)?void 0:_(t.backgroundColor),borderColor:h(t.borderColor)?void 0:_(t.borderColor),outlineColor:h(t.outlineColor)?void 0:_(t.outlineColor),shadowColor:h(t.shadowColor)?void 0:_(t.shadowColor)})}function Te(){return{...le(),...he()}}const ut=/\r\n|\n\r|\n|\r/,Ve=new RegExp(`${ut.source}|<br\\/>`,"g"),Me=new RegExp(`^(${ut.source})$`),lt=`
|
|
2
|
+
`;function ke(t){return ut.test(t)}function ct(t){return Me.test(t)}function pe(t){return t.replace(Ve,lt)}function Y(t){const e=[];function n(){return e[e.length-1]}function r(l,f,p){const m=l?j(l):{},d=f?F(f):void 0,v=p?H(p):void 0,C=w({...m,fill:d,outline:v,fragments:[]});return e[e.length-1]?.fragments.length===0?e[e.length-1]=C:e.push(C),C}function i(l="",f,p,m){const d=f?j(f):{},v=p?F(p):void 0,C=m?H(m):void 0;Array.from(l).forEach(A=>{if(ct(A)){const{fragments:E,fill:L,outline:R,...W}=n()||r();E.length||E.push(w({...d,fill:v,outline:C,content:lt})),r(W,L,R)}else{const E=n()||r(),L=E.fragments[E.fragments.length-1];if(L){const{content:R,fill:W,outline:T,...dt}=L;if(q(v,W)&&q(C,T)&&q(d,dt)){L.content=`${R}${A}`;return}}E.fragments.push(w({...d,fill:v,outline:C,content:A}))}})}(Array.isArray(t)?t:[t]).forEach(l=>{if(typeof l=="string")r(),i(l);else if(ft(l)){const{content:f,fill:p,outline:m,...d}=l;r(d,p,m),i(f)}else if(ve(l)){const{fragments:f,fill:p,outline:m,...d}=l;r(d,p,m),f.forEach(v=>{const{content:C,fill:A,outline:E,...L}=v;i(C,L,A,E)})}else Array.isArray(l)?(r(),l.forEach(f=>{if(typeof f=="string")i(f);else if(ft(f)){const{content:p,fill:m,outline:d,...v}=f;i(p,v,m,d)}})):console.warn("Failed to parse text content",l)});const u=n();return u&&!u.fragments.length&&u.fragments.push({content:""}),e}function ve(t){return t&&typeof t=="object"&&"fragments"in t&&Array.isArray(t.fragments)}function ft(t){return t&&typeof t=="object"&&"content"in t&&typeof t.content=="string"}function me(t){return typeof t=="string"||Array.isArray(t)?{content:Y(t)}:w({...t,content:Y(t.content??""),style:t.style?j(t.style):void 0,effects:t.effects?t.effects.map(e=>j(e)):void 0,measureDom:t.measureDom,fonts:t.fonts,fill:t.fill?F(t.fill):void 0,outline:t.outline?H(t.outline):void 0})}function $e(t){return Y(t).map(e=>{const n=pe(e.fragments.flatMap(r=>r.content).join(""));return ct(n)?"":n}).join(lt)}function ye(t){return typeof t=="string"?{src:t}:t}function Z(t){return w({...t,id:t.id??re(),style:h(t.style)?void 0:j(t.style),text:h(t.text)?void 0:me(t.text),background:h(t.background)?void 0:Yt(t.background),shape:h(t.shape)?void 0:ae(t.shape),fill:h(t.fill)?void 0:F(t.fill),outline:h(t.outline)?void 0:H(t.outline),foreground:h(t.foreground)?void 0:ee(t.foreground),shadow:h(t.shadow)?void 0:ie(t.shadow),video:h(t.video)?void 0:ye(t.video),audio:h(t.audio)?void 0:G(t.audio),effect:h(t.effect)?void 0:te(t.effect),children:t.children?.map(e=>Z(e))})}function He(t){return Z(t)}function We(t){const e={};for(const n in t.children){const r=Z(t.children[n]);delete r.children,e[n]=r}return{...t,children:e}}function Be(t){const{children:e,...n}=t;function r(f){const{parentId:p,childrenIds:m,...d}=f;return{...d,children:[]}}const i={},a=[],u={...n,children:a};function l(f){if(!e[f]||i[f])return;const p=e[f],m=r(p);i[f]=m;const d=p.parentId;if(d){l(d);const v=e[d],C=i[d];if(!C)return;v?.childrenIds&&C?.children&&(C.children[v.childrenIds.indexOf(f)]=m)}else a.push(m)}for(const f in e)l(f);return u}o.EventEmitter=Fe,o.Observable=Ot,o.RawWeakMap=Le,o.Reactivable=Ne,o.clearUndef=w,o.defaultColor=k,o.defineProperty=At,o.flatDocumentToDocument=Be,o.getDeclarations=M,o.getDefaultElementStyle=le,o.getDefaultHighlightStyle=ce,o.getDefaultInnerShadow=at,o.getDefaultLayoutStyle=se,o.getDefaultListStyleStyle=fe,o.getDefaultOuterShadow=Zt,o.getDefaultShadowStyle=oe,o.getDefaultStyle=Te,o.getDefaultTextInlineStyle=de,o.getDefaultTextLineStyle=ge,o.getDefaultTextStyle=he,o.getDefaultTransformStyle=ue,o.getNestedValue=zt,o.getObjectValueByPath=Ft,o.getPropertyDescriptor=it,o.getPropertyInternalKey=Nt,o.hasCRLF=ke,o.idGenerator=re,o.isCRLF=ct,o.isColor=Rt,o.isColorFill=Bt,o.isColorFillObject=Wt,o.isEqualObject=q,o.isFragmentObject=ft,o.isGradient=$,o.isGradientFill=Ut,o.isGradientFillObject=Kt,o.isImageFill=xt,o.isImageFillObject=qt,o.isNone=h,o.isParagraphObject=ve,o.isPresetFill=Xt,o.isPresetFillObject=Jt,o.nanoid=ne,o.normalizeAudio=G,o.normalizeBackground=Yt,o.normalizeCRLF=pe,o.normalizeColor=_,o.normalizeColorFill=Mt,o.normalizeDocument=He,o.normalizeEffect=te,o.normalizeElement=Z,o.normalizeFill=F,o.normalizeFlatDocument=We,o.normalizeForeground=ee,o.normalizeGradient=Vt,o.normalizeGradientFill=kt,o.normalizeImageFill=$t,o.normalizeInnerShadow=st,o.normalizeOuterShadow=Qt,o.normalizeOutline=H,o.normalizePresetFill=Ht,o.normalizeShadow=ie,o.normalizeShape=ae,o.normalizeSoftEdge=Ie,o.normalizeStyle=j,o.normalizeText=me,o.normalizeTextContent=Y,o.normalizeVideo=ye,o.parseColor=ot,o.parseGradient=It,o.pick=U,o.property=Oe,o.property2=De,o.round=N,o.setNestedValue=Et,o.setObjectValueByPath=Lt,o.stringifyGradient=Re,o.textContentToString=$e,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.mjs
CHANGED
|
@@ -300,6 +300,7 @@ function getPropertyDescriptor(key, declaration = {}) {
|
|
|
300
300
|
return result;
|
|
301
301
|
}
|
|
302
302
|
function set(newValue) {
|
|
303
|
+
const oldValue = get.call(this);
|
|
303
304
|
if (alias && alias !== key) {
|
|
304
305
|
setObjectValueByPath(this, alias, newValue);
|
|
305
306
|
} else if (!internal && typeof this.setProperty !== "undefined") {
|
|
@@ -307,6 +308,7 @@ function getPropertyDescriptor(key, declaration = {}) {
|
|
|
307
308
|
} else {
|
|
308
309
|
this[internalKey] = newValue;
|
|
309
310
|
}
|
|
311
|
+
this.onUpdateProperty?.(key, newValue, oldValue);
|
|
310
312
|
}
|
|
311
313
|
return {
|
|
312
314
|
get,
|
|
@@ -361,6 +363,23 @@ function property2(declaration = {}) {
|
|
|
361
363
|
class Reactivable extends Observable {
|
|
362
364
|
_propertyAccessor;
|
|
363
365
|
_properties = /* @__PURE__ */ new Map();
|
|
366
|
+
_updatedProperties = /* @__PURE__ */ new Map();
|
|
367
|
+
_changedProperties = /* @__PURE__ */ new Set();
|
|
368
|
+
_updatingPromise = Promise.resolve();
|
|
369
|
+
_updating = false;
|
|
370
|
+
constructor(properties) {
|
|
371
|
+
super();
|
|
372
|
+
this.setProperties(properties);
|
|
373
|
+
}
|
|
374
|
+
isDirty(key) {
|
|
375
|
+
return key ? this._updatedProperties.has(key) : this._updatedProperties.size > 0;
|
|
376
|
+
}
|
|
377
|
+
offsetGet(key) {
|
|
378
|
+
return this[key];
|
|
379
|
+
}
|
|
380
|
+
offsetSet(key, newValue) {
|
|
381
|
+
this[key] = newValue;
|
|
382
|
+
}
|
|
364
383
|
getProperty(key, defaultValue) {
|
|
365
384
|
if (this._propertyAccessor?.getProperty) {
|
|
366
385
|
return this._propertyAccessor.getProperty(key, defaultValue);
|
|
@@ -369,42 +388,124 @@ class Reactivable extends Observable {
|
|
|
369
388
|
}
|
|
370
389
|
}
|
|
371
390
|
setProperty(key, newValue) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
391
|
+
this._propertyAccessor?.setProperty?.(key, newValue);
|
|
392
|
+
this._properties.set(key, newValue);
|
|
393
|
+
}
|
|
394
|
+
getProperties(keys) {
|
|
395
|
+
const properties = {};
|
|
396
|
+
for (const [name, property] of this.getPropertyDeclarations()) {
|
|
397
|
+
if (!property.internal && !property.alias && (!keys || keys.includes(name))) {
|
|
398
|
+
properties[name] = this.getProperty(name);
|
|
399
|
+
}
|
|
375
400
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
401
|
+
return properties;
|
|
402
|
+
}
|
|
403
|
+
setProperties(properties) {
|
|
404
|
+
if (properties && typeof properties === "object") {
|
|
405
|
+
for (const [name] of this.getPropertyDeclarations()) {
|
|
406
|
+
if (name in properties) {
|
|
407
|
+
this.offsetSet(name, properties[name]);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return this;
|
|
412
|
+
}
|
|
413
|
+
resetProperties() {
|
|
414
|
+
for (const [name, property] of this.getPropertyDeclarations()) {
|
|
415
|
+
this.offsetSet(
|
|
416
|
+
name,
|
|
417
|
+
typeof property.default === "function" ? property.default() : property.default
|
|
418
|
+
);
|
|
380
419
|
}
|
|
381
|
-
this
|
|
420
|
+
return this;
|
|
382
421
|
}
|
|
383
422
|
getPropertyDeclarations() {
|
|
384
423
|
return getDeclarations(this.constructor);
|
|
385
424
|
}
|
|
425
|
+
getPropertyDeclaration(key) {
|
|
426
|
+
return this.getPropertyDeclarations().get(key);
|
|
427
|
+
}
|
|
386
428
|
setPropertyAccessor(accessor) {
|
|
387
429
|
this._propertyAccessor = accessor;
|
|
388
430
|
this.getPropertyDeclarations().forEach((_declaration, key) => {
|
|
389
|
-
const newValue = this
|
|
431
|
+
const newValue = this.offsetGet(key);
|
|
390
432
|
const oldValue = this._properties.get(key);
|
|
391
433
|
if (newValue === void 0) {
|
|
392
434
|
if (oldValue !== void 0) {
|
|
393
|
-
this
|
|
435
|
+
this.offsetSet(key, oldValue);
|
|
394
436
|
}
|
|
395
437
|
} else if (newValue !== oldValue) {
|
|
396
|
-
this
|
|
438
|
+
this.offsetSet(key, newValue);
|
|
397
439
|
}
|
|
398
440
|
});
|
|
399
441
|
return this;
|
|
400
442
|
}
|
|
443
|
+
async _nextTick() {
|
|
444
|
+
if ("requestAnimationFrame" in globalThis) {
|
|
445
|
+
return new Promise((r) => globalThis.requestAnimationFrame(r));
|
|
446
|
+
}
|
|
447
|
+
return Promise.resolve();
|
|
448
|
+
}
|
|
449
|
+
async _enqueueUpdate() {
|
|
450
|
+
this._updating = true;
|
|
451
|
+
try {
|
|
452
|
+
await this._updatingPromise;
|
|
453
|
+
} catch (e) {
|
|
454
|
+
Promise.reject(e);
|
|
455
|
+
}
|
|
456
|
+
await this._nextTick();
|
|
457
|
+
if (!this._updating)
|
|
458
|
+
return;
|
|
459
|
+
this.onUpdate();
|
|
460
|
+
this._updating = false;
|
|
461
|
+
}
|
|
462
|
+
onUpdate() {
|
|
463
|
+
this._update(this._updatedProperties);
|
|
464
|
+
this._updatedProperties = /* @__PURE__ */ new Map();
|
|
465
|
+
}
|
|
401
466
|
onUpdateProperty(key, newValue, oldValue) {
|
|
402
|
-
this.
|
|
403
|
-
|
|
467
|
+
this.requestUpdate(key, newValue, oldValue);
|
|
468
|
+
}
|
|
469
|
+
requestUpdate(key, newValue, oldValue) {
|
|
470
|
+
if (key !== void 0) {
|
|
471
|
+
this._updatedProperties.set(key, oldValue);
|
|
472
|
+
this._changedProperties.add(key);
|
|
473
|
+
this._updateProperty(key, newValue, oldValue);
|
|
474
|
+
this.emit("updateProperty", key, newValue, oldValue);
|
|
475
|
+
}
|
|
476
|
+
if (!this._updating) {
|
|
477
|
+
this._updatingPromise = this._enqueueUpdate();
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
481
|
+
_update(changed) {
|
|
404
482
|
}
|
|
405
483
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
406
484
|
_updateProperty(key, newValue, oldValue) {
|
|
407
485
|
}
|
|
486
|
+
toJSON() {
|
|
487
|
+
const json = {};
|
|
488
|
+
this._properties.forEach((value, key) => {
|
|
489
|
+
if (value === void 0) {
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
if (value && typeof value === "object") {
|
|
493
|
+
if ("toJSON" in value && typeof value.toJSON === "function") {
|
|
494
|
+
json[key] = value.toJSON();
|
|
495
|
+
} else if (Array.isArray(value)) {
|
|
496
|
+
json[key] = [...value];
|
|
497
|
+
} else {
|
|
498
|
+
json[key] = { ...value };
|
|
499
|
+
}
|
|
500
|
+
} else {
|
|
501
|
+
json[key] = value;
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
return json;
|
|
505
|
+
}
|
|
506
|
+
clone() {
|
|
507
|
+
return new this.constructor(this.toJSON());
|
|
508
|
+
}
|
|
408
509
|
}
|
|
409
510
|
|
|
410
511
|
function parseColor(color) {
|