compelem 0.6.12-b1 → 0.7.1-b1

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/CompElem.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { IComponent } from "./IComponent";
2
2
  import { Template } from "./render/Template";
3
3
  import { DefaultProps, TmplFn } from "./types";
4
+ export declare const PROP_OBJECT_KEY_MAP_SYMBOL: unique symbol;
4
5
  /**
5
6
  * CompElem基类,意为组件元素。提供了基本内置属性及生命周期等必备接口
6
7
  * 每个组件都需要继承自该类
@@ -12,6 +13,8 @@ export declare class CompElem extends HTMLElement implements IComponent {
12
13
  static __l_globalRule: HTMLStyleElement;
13
14
  static defaults(options: DefaultProps): void;
14
15
  __events: Record<string, Array<Node | ((e: Event) => void)>[]>;
16
+ _propObjectKeyMap: Record<string, string>;
17
+ get [PROP_OBJECT_KEY_MAP_SYMBOL](): Record<string, string>;
15
18
  get [Symbol.toStringTag](): string;
16
19
  get cid(): number;
17
20
  get reactiveData(): Record<string, any>;
@@ -34,6 +37,10 @@ export declare class CompElem extends HTMLElement implements IComponent {
34
37
  static get hostStyles(): Array<string>;
35
38
  get styles(): Array<() => string>;
36
39
  constructor(...args: any[]);
40
+ /**
41
+ * Returns the root component in the parent chain, or itself if it's the top-level component.
42
+ */
43
+ get rootComponent(): CompElem;
37
44
  connectedCallback(): void;
38
45
  disconnectedCallback(): void;
39
46
  __init(): void;
@@ -64,10 +71,6 @@ export declare class CompElem extends HTMLElement implements IComponent {
64
71
  * @returns
65
72
  */
66
73
  _notify(ov: any, chain: string[]): any;
67
- /**
68
- * @deprecated
69
- */
70
- _setParentProps(props: Record<string, any>, attrs?: Record<string, any>): void;
71
74
  _updateProps(props: Record<string, any>): void;
72
75
  _initProps(props: Record<string, any>, attrs?: Record<string, any>): void;
73
76
  /**
@@ -84,6 +87,7 @@ export declare class CompElem extends HTMLElement implements IComponent {
84
87
  */
85
88
  _regDeps(varPath: string, renderContext: CompElem | Node): void;
86
89
  _regWrapper(wrapperComponent: CompElem): void;
90
+ _getPrivateData(): Record<string, any>;
87
91
  /**
88
92
  * 抛出自定义事件
89
93
  * @param evName 事件名称
package/IComponent.d.ts CHANGED
@@ -10,6 +10,7 @@ export interface IComponent {
10
10
  get props(): Record<string, any>;
11
11
  get renderRoot(): HTMLElement;
12
12
  get renderRoots(): HTMLElement[];
13
+ get rootComponent(): HTMLElement;
13
14
  get parentComponent(): HTMLElement | null;
14
15
  get wrapperComponent(): HTMLElement | null;
15
16
  get slots(): Record<string, Array<Node>>;
package/README.md CHANGED
@@ -234,6 +234,7 @@ export class PageTest extends CompElem {
234
234
  <div ref="${divRef}"></div>`;
235
235
  ```
236
236
  - ### 内置属性及函数
237
+ - `readonly` rootComponent 根组件引用
237
238
  - `readonly` parentComponent 父组件引用,可能为空
238
239
  - `readonly` wrapperComponent 包装(组件所在视图归属)组件引用,可能为空
239
240
  - `readonly` renderRoot/renderRoots 渲染根元素/渲染根元素列表
package/compelem.umd.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * compelem v0.6.12-b1.1758802699
2
+ * compelem v0.7.1-b1.1760246752
3
3
  * A modern, reactive, fast, lightweight and flexible lib for building web components
4
4
  * @holyhigh2
5
5
  * https://github.com/holyhigh2/compelem
6
6
  */
7
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("myfx")):"function"==typeof define&&define.amd?define(["exports","myfx"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).compelem={},e.myfx)}(this,(function(e,t){"use strict";const r=new WeakMap,n=/\s+\.?key\s*=/;var s,o,i,a;function l(e){console.error("[CompElem]",e)}function c(e,t){console.error(`[CompElem <${e}>]`,t)}function u(e){return t.toPath(e).join("-")}function d(e){return Object.getPrototypeOf(e)}function p(e){let r=e;return t.isString(e)&&/(?:^true$)|(?:^false$)/.test(r)?r="true"===r:(t.isUndefined(r)||t.isBlank(r))&&(r=!0),r}!function(e){e[e.CSS=1]="CSS",e[e.COMPUTED=2]="COMPUTED"}(s||(s={})),function(e){e.PROPS="__deco_props",e.STATES="__deco_states",e.COMPUTED="__deco_computed",e.WATCH="__deco_watch",e.EVENTS="__deco_events"}(o||(o={})),function(e){e.Prod="prod",e.Dev="dev"}(i||(i={})),e.DecoratorType=void 0,(a=e.DecoratorType||(e.DecoratorType={})).CLASS="class",a.FIELD="field",a.METHOD="method";class h{static get priority(){return 0}}const f="getKey",g="__decorators",m=new WeakMap;class y{args;metadata;decoratorClass;instanceMap;key;priority=0;constructor(e,r,n){this.args=e,this.metadata=r,this.decoratorClass=n,this.priority=t.get(n,"priority",0),this.instanceMap=new WeakMap}create(r){let n,s=new this.decoratorClass(...this.args),o=s.targets,i=this.metadata[2];t.isObject(i)&&t.isDefined(t.get(i,"configurable"))?n=e.DecoratorType.METHOD:t.isUndefined(this.metadata[2])&&(n=e.DecoratorType.FIELD),!t.isEmpty(o)&&n&&o.includes(n)?(s.created(r,...this.metadata),this.instanceMap.set(r,s)):l(`Decorator '${this.decoratorClass.name}' is out of targets, expect '${o.join(",")}' bug got '${n}'`)}beforeMount(e,t){this.instanceMap.get(e).beforeMount(e,t,...this.metadata)}mounted(e,t){this.instanceMap.get(e).mounted(e,t,...this.metadata)}updated(e,t){this.instanceMap.get(e).updated(e,t)}}const v=new WeakMap;function E(e){let r=(...r)=>(...n)=>{let s=n[0].constructor,o=s[g];if(!t.has(s,g)){let e=Object.getPrototypeOf(s);o=e?t.concat(e[g]??[]):[],Reflect.defineProperty(s,g,{configurable:!1,enumerable:!1,value:o})}let i,a={},l=e[f];if(l){let t=v.get(e);if(t||(t=new WeakMap,v.set(e,t)),a=t.get(s),a||(a={},t.set(s,a)),i=l(...r),a[i])return a[i]}let c=new y(r,n,e);return a[i]=c,o?.push(c),c};return m.set(r,!0),r}const b=new WeakMap;function T(e,r,n,s){let i;if(t.isLowerCaseChar(r[0])||l(`Prop '${r}' must be in CamelCase`),!t.has(e.constructor,o.PROPS)){const r={};let n=e.constructor;for(;(n=d(n))!==j;)t.merge(r,n[o.PROPS]?t.cloneDeep(n[o.PROPS]):{});Reflect.defineProperty(e.constructor,o.PROPS,{configurable:!1,enumerable:!1,value:r}),i=new Set,t.each(r,((e,r)=>{if(e.attribute){let e=t.kebabCase(r);i?.add(e)}})),b.set(e.constructor,i)}if(s&&(s.get&&(n.getter=s.get),s.set&&(n.setter=s.set)),n.attribute){i||(i=b.get(e.constructor));let n=t.kebabCase(r);i?.add(n)}t.has(e.constructor,"observedAttributes")||(e.constructor.observedAttributes=[]),e.constructor.observedAttributes=t.toArray(i),n.shallow=n.shallow||!1,e.constructor[o.PROPS][r]=n}const S=new Set;function N(e){return b.get(e)??S}const C={collectWatch(e,t,r){let n=D.get(e);n||(n={},D.set(e,n));let s=n[r];s||(s=n[r]=[]),s.push(t)},startCollect(e,t){this.__collectType=t,this.__collecting=e},setUpdater(e){this.__updater=e},endCollect(){this.__collecting=null},__directiveQ:[],setDirectiveQ(e){let r=t.last(this.__directiveQ);const n=e?e.join(","):"",s=r?r.join(","):"";r&&n===s||(r&&r.length<e.length&&t.startsWith(n,s)?this.__directiveQ[this.__directiveQ.length-1]=e:this.__directiveQ.push(e))},popDirectiveQ(){let e=t.concat(this.__directiveQ);return this.__directiveQ=[],e},startRender(e){this.__renderCollecting=!0,this.__renderContext=e},endRender(e){this.__renderCollection.forEach((t=>{e._regDeps(t,this.__renderContext)})),this.__renderCollection.clear(),this.__renderCollecting=!1,this.__renderContext=null},collect(e){this.__renderCollection.add(e)},clear(){this.__directiveQ=[]},__updater:null,__collecting:null,__collectType:-1,__renderCollection:new Set,__renderContext:null,__renderCollecting:!1,__skipCheck:!1},_=new WeakMap,P=new WeakMap,A=new WeakMap,w=new WeakMap,D=new WeakMap,k=new WeakSet;function M(e,n){if(!t.isObject(e))return e;const i=k.has(e)?e:new Proxy(e,{get(e,r,n){if(!r)return;const i=Reflect.get(e,r,n);if("string"!=typeof r&&"number"!=typeof r)return i;let a=r in e;if((C.__renderCollecting||C.__collecting)&&(a&&e.hasOwnProperty(r)||!a)){let e=P.get(n)??[],a=t.concat(e,[r]);if(a.length>1){let e=_.get(n).from,r=t.get(e.constructor,o.PROPS),s=t.get(e.constructor,o.STATES);if(t.get(r,[a[0],"shallow"])||t.get(s,[a[0],"shallow"]))return i}let l=a.join("-");if(C.__renderCollecting)C.collect(u(a)),C.setDirectiveQ(a);else if(C.__collecting){let e;switch(C.__collectType){case s.COMPUTED:e=A.get(C.__collecting),e||(e={},A.set(C.__collecting,e));break;case s.CSS:e=w.get(C.__collecting),e||(e={},w.set(C.__collecting,e))}let t=e[l];t||(t=e[l]=[]),t.push(C.__updater)}}return i},set(e,n,s,i){if(!n)return!1;let a=e[n];if(!t.isObject(a)&&a===s)return!0;if(Number.isNaN(s)&&Number.isNaN(a))return!0;let l=P.get(i)??[],c=t.concat(l,[n]),u=_.get(i).from,d=t.get(u.constructor,o.PROPS),p=t.get(u.constructor,o.STATES),h=t.get(d,[c[0],"hasChanged"])||t.get(p,[c[0],"hasChanged"]);if(h){if(!h.call(u,s,a))return!0}else if(a===s&&!r.has(a))return!0;d&&d[n]&&e.__isData&&d[n].sync&&u.emit("update:"+n,{value:s});let f=_.get(i)?.contextSet,g=s;!t.isObject(s)||t.isFunction(s)||s instanceof Node||Object.isFrozen(s)||f.forEach((e=>{let r=_.get(i)?.pathMap,s=r?.get(e);s&&(c=t.concat(s,[n]),P.set(g,c),g=M(g,e),k.add(g),P.set(g,c))}));let m=Reflect.set(e,n,g),y=_.get(i).pathMap;return f.forEach((e=>{let r=y.get(e);if(!r)return;e===u&&l.length>1&&r.length>1&&l[0]===r[0]&&(r=l),c=t.concat(r,"length"==n&&t.isArray(i)?[]:[n]);let s=A.get(e),o=w.get(e),d=D.get(e);if(s||o||d){let e=c.length;for(;e;){let r=c.slice(0,e).join("-");if(d){const n=d[r];e===c.length?n?.forEach((e=>{let t=e();t.ov=a,x.pushWatch(t)})):n?.forEach((e=>{let r=e();t.get(r,"deep")&&(r.ov=a,x.pushWatch(r))}))}if(s){let e=s[r];if(!t.isEmpty(e))for(let t=0;t<e.length;t++){const r=e[t];x.pushComputed(r)}}if(o){let e=o[r];if(!t.isEmpty(e))for(let t=0;t<e.length;t++){const r=e[t];x.pushCss(r)}}e--}}let p=e._notify(a,c);x.pushNext(p,e.cid)})),m}});k.has(i)||k.add(i);let a=P.get(e)??[];if(Object.isExtensible(e)&&!_.get(i)){let e=new Set;e.add(n);let t=new WeakMap;t.set(n,a),_.set(i,{from:n,contextSet:e,pathMap:t})}else{_.get(i).contextSet.add(n);let e=_.get(i).pathMap,r=e.get(n),s=t.concat(a);if(r&&r.join("")!==s.join("")){let e=t.get(n,t.initial(r));t.isArray(e)||function(...e){console.warn("[CompElem]",...e)}(`The object is referenced by more than one @state '${s.join(".")},${r.join(".")}'`),r=s}else e.set(n,s)}let l=t.get(n.constructor,o.PROPS),c=t.get(n.constructor,o.STATES);for(let r in e){const s=e[r];let o=t.get(l,[r,"shallow"])||t.get(c,[r,"shallow"]);!t.isObject(s)||k.has(s)||t.isFunction(s)||s instanceof Node||Object.isFrozen(s)||o||(P.set(s,t.concat(a,[r])),e[r]=M(s,n),k.add(e[r]),P.set(e[r],t.concat(a,[r])))}return i}const O=new Map;class x{static watchSet=new Set;static computedSet=new Set;static cssSet=new Set;static nextSet=new Set;static nextPending=!1;static next;static flush(){x.nextPending=!1;let e=Array.from(x.watchSet);x.watchSet.clear();let r=Array.from(x.computedSet);x.computedSet.clear();let n=Array.from(x.cssSet);x.cssSet.clear();let s=Array.from(x.nextSet);x.nextSet.clear(),e.forEach((e=>e(t.get(e,"ov")))),r.forEach((e=>e())),n.forEach((e=>e())),s.forEach((e=>e())),O.clear()}static pushWatch(e){x.watchSet.add(e)}static pushComputed(e){x.computedSet.add(e)}static pushCss(e){x.cssSet.add(e)}static pushNext(e,t){if(t){if(O.has(t))return;O.set(t,e)}x.nextSet.add(e),x.nextPending||(x.nextPending=!0,x.next())}}(()=>{const e=Promise.resolve(),t=x.flush;x.next=()=>{e.then(t)}})();const R={boolean:Boolean,string:String,number:Number,object:Object,array:Array,function:Function,undefined:Object},L=new WeakMap;let U=[],W=0;const H=new Map,$=new WeakMap;class j extends HTMLElement{static __l_globalRule=document.createElement("style");static defaults(e){U=t.flatMap(e.css,(e=>{if(t.isString(e)){let t=new CSSStyleSheet;return t.replaceSync(e),t}return e instanceof CSSStyleSheet?e:[]})),e.global,t.each(e,((e,r)=>{t.test(r[0],/[A-Z]/)}))}#e;#t={};#r={"#slots":{}};#n={};#s={};#o;#i={};__events={};get[Symbol.toStringTag](){return this.constructor.name}get cid(){return this.#e}get reactiveData(){return this.#n}get attrs(){return this.#a}get props(){return this.#l}get renderRoot(){return this.#c}get renderRoots(){return this.#u}get parentComponent(){return this.#d}get wrapperComponent(){return this.#p}get slotHooks(){return this.#h}get css(){return L.get(this.constructor)}get globalStyleSheet(){return H.get(this.constructor)?.sheet}get isMounted(){return this.#f}get slots(){return this.#r["#slots"]}#a;#l;#c;#u;#d;#p;#g={};#h={};#m={};#f=!1;static get styles(){return[]}static get globalStyles(){return[]}static get hostStyles(){return[]}get styles(){return[]}#y=!1;#v=!1;constructor(...e){super(),this.#e=W++,1===t.size(e)&&(this.#l={},t.assign(this.#l,t.first(e)));let r=this.render.bind(this);this.render=function(){let e;return C.startRender(this),e=r(),C.endRender(this),e};let n=t.get(this.constructor,"globalStyles"),s=H.has(this.constructor);if(!t.isEmpty(n)&&!s){let e="";n.forEach((r=>{t.isString(r)&&(e+=r+"\n")}));let r=document.createElement("style");r.textContent+=e,H.set(this.constructor,r),document.head.appendChild(r)}let o=L.get(this.constructor),i=o??[];o||(t.each(t.get(this.constructor,"styles"),(e=>{if(t.isString(e)){let t=new CSSStyleSheet;t.replaceSync(e),i.push(t)}else i.push(e)})),L.set(this.constructor,i)),this.#o=this.attachShadow({mode:"open"}),this.#o.adoptedStyleSheets=[...U,...i],this.#E();let a=t.get(this.constructor,g);a&&a.sort(((e,t)=>t.priority-e.priority)).forEach((e=>e.create(this))),this.#b=this.#T.bind(this)}#b;connectedCallback(){let e=t.closest(this.parentNode,(e=>e instanceof j||e.host instanceof j),"parentNode");this.#d=e?e instanceof j?e:e.host:null,this.__init()}disconnectedCallback(){}__init(){if(this.#y)return;if(this.#v)return;this.#v=!0,this.#E();const e=this.#S();this.propsReady(e);for(const t in e){const r=e[t];this.#r[t]=r}this.#N(),t.each(this.#r,((e,t)=>{let r=Reflect.getOwnPropertyDescriptor(this.#r,t);Reflect.defineProperty(this,t,{get(){let e=Reflect.get(this.#n,t);return r?.get?r?.get():e},set(e){r?.set?r?.set(e):Reflect.set(this.#n,t,e)}})})),Reflect.defineProperty(this.#r,"__isData",{enumerable:!1,value:!0}),this.#n=M(this.#r,this);let r=t.get(this.constructor,o.COMPUTED);t.each(r,((e,t)=>{C.startCollect(this,s.COMPUTED),C.setUpdater((()=>{this.#n[t]=e.call(this)})),this.#r[t]=e.call(this),C.endCollect(),Reflect.defineProperty(this,t,{get(){return Reflect.get(this.#n,t)},set(e){c(this.tagName,"Cannot set a computed property '"+t+"'")}})}));let n=t.get(this.constructor,o.WATCH);t.each(n,((e,r)=>{e.forEach((e=>{let{source:n,options:s,handler:o}=e,i=o.bind(this);t.get(s,"once",!1)&&(i=t.once(i));const a=function(e){let r=t.get(this,n.replaceAll("-","."));i(r,e,n)}.bind(this);let l=t.get(s,"deep",!1);if(a.deep=l,C.collectWatch(this,(()=>a),r),!t.get(s,"immediate",!1))return;let c=t.get(this,n.replaceAll("-","."));i(c,c,n)}))}));let i=function(e,r){let n,s=[];if(Oe.has(r.constructor)){let o=Oe.get(r.constructor),i=function(e,r){let n=t.concat(r.vars),s=r.strings.length-1;for(let o=0;o<=s;o++){let s=t.get(r.vars,o,"");if(s instanceof Ze){let[t,r]=Ie(e,s);n.splice(o,1,...r)}}return n}(r,e);n=xe.has(r.constructor)?function(e,r,n){let s=xe.get(n.constructor)?.cloneNode(!0),o=Re.get(n.constructor);const i=document.createNodeIterator(s,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let a,l,c=0,u=0;for(;a=i.nextNode();){let s;if(u++,l&&!l.contains(a)&&(l=void 0),a instanceof HTMLElement||a instanceof SVGElement){a instanceof j&&(l=a);let i={};o[u].forEach((o=>{let u=r[c++];switch(o.type){case Le.Event:s=t.clone(o.up),o.value||c--,o.value&&Te(o.name,u.bind(n),a,n),a.removeAttribute(o.attrName);break;case Le.AttrSlot:l&&o.name,a.removeAttribute(o.attrName);break;case Le.Ref:s=t.clone(o.up),u.current=a,a.removeAttribute(o.attrName);break;case Le.AttrKey:s=t.clone(o.up),a.setAttribute(we,u);break;case Le.AttrBool:s=t.clone(o.up),s.value=!!u,s.node=a,s.value&&a.setAttribute(o.name,""),a.removeAttribute(o.attrName);break;case Le.AttrProp:s=t.clone(o.up),s.value=u,s.node=a,i[o.name]=u;break;case Le.AttrRef:case Le.Attr:s=t.clone(o.up),s.value=u,s.node=a,a.setAttribute(o.attrName,u),Le.AttrRef===o.type&&a.removeAttribute(o.name);break;case Le.DirectiveAttr:case Le.DirectiveTag:case Le.DirectiveProp:s=t.clone(o.up),s.value=u,s.node=a;let e=t.clone(o.point);e.startNode=a;let[r,d,p,h,f]=u,g=Ve.get(a);if(g||(g={},Ve.set(a,g)),g[o.attrName??Symbol.keyFor(r)]=[e,n,l],p(e,d,void 0,{renderComponent:n,slotComponent:l,varChain:f}),Le.DirectiveAttr===o.type){let e=a.getAttribute(o.attrName);e=t.replace(e,ze,""),a.setAttribute(o.attrName,e)}o.name&&a.removeAttribute(o.name)}s&&e.push(s)})),a instanceof j?(a._initProps(i),a._regWrapper(n)):a instanceof HTMLSlotElement&&n._bindSlot(a,a.name||"default",i)}else{o[u].forEach((o=>{let i=r[c++];switch(o.type){case Le.DirectiveSlot:case Le.DirectiveText:s=t.clone(o.up),s.value=i,s.node=a;let[e,r,c,u,d]=i,p=Symbol.keyFor(e),h=document.createComment(`compelem-${n.tagName}-${p}-start`);s.textNode=h,a.parentNode.insertBefore(h,a),a.nodeValue=`compelem-${n.tagName}-${p}-end`;let f=t.clone(o.point);f.startNode=h,f.endNode=a,$e.set(a,[f,n,l,r,d]),He.set(a,c),je.set(a,s),C.startRender(a);let g=c(f,r,void 0,{renderComponent:n,slotComponent:l,varChain:d});C.endRender(n);let m=Ke(a,g[1],n);m&&m.length>0&&Xe.insertBefore(a,Array.from(m));break;case Le.Text:s=t.clone(o.up),s.node=a;let y=t.toString(i??""),v=document.createTextNode(y);a.replaceWith(v),s.textNode=v}s&&e.push(s)}))}}return s.childNodes}(s,i,r):Ge(s,o,i,r)}else{let[t,o]=Ie(r,e);Oe.set(r.constructor,t),n=Ge(s,t,o,r)}return Ue.set(r,s),n}(this.render(),this);i&&(this.#o.append(...i),this.#u=t.filter(this.#o.childNodes,(e=>e.nodeType===Node.ELEMENT_NODE)),this.#c=this.#u[0]),t.each(this.#h,((e,t)=>{this.#C(t)}));const a=this;let l=t.get(this.constructor,g);l&&l.sort(((e,t)=>t.priority-e.priority)).forEach((e=>{e.beforeMount(this,((e,t)=>(a.#n[e]=t,a.#n[e])))}));let u=t.get(this.constructor,"hostStyles"),d=this.#p?.shadowRoot??this.ownerDocument,p=$.get(d);if(!p?.includes(this.constructor)&&u.length>0){let e=[];t.each(u,(r=>{if(t.isString(r)){let t=new CSSStyleSheet;t.replaceSync(r),e.push(t)}else e.push(r)})),d.adoptedStyleSheets=[...d.adoptedStyleSheets,...e],p?.push(this.constructor)}this.beforeMount();let h=t.get(this.constructor,o.EVENTS);h&&h.forEach((async e=>{let r=e.name,n=t.assign({target:document,once:!1,passive:!1,capture:!1},e.options),s=t.bind(e.fn,this),o=n.target;t.isFunction(o)&&(o=await o.call(this,this)),o?o.addEventListener(r,s,n):c(this.tagName,"The target of @event('"+r+"',...) is invalid")})),C.startCollect(this,s.CSS);let f=[];this.styles.forEach((e=>{if(!t.isFunction(e))return;let r=new CSSStyleSheet;f.push(r),C.setUpdater((()=>{let t=e()??"";r.replaceSync(t)}));let n=e();t.isBlank(n)||r.replaceSync(n)})),C.endCollect(),f.length>0&&(this.#o.adoptedStyleSheets=[...this.#o.adoptedStyleSheets,...f]),setTimeout((()=>{this.#f=!0,this.mounted(),l&&l.forEach((e=>{e.mounted(this,((e,t)=>(a.#n[e]=t,a.#n[e])))}))}),0),this.#y=!0}propsReady(e){}render(){throw Error(`[CompElem <${this.tagName}>] Missing render()`)}beforeMount(){}mounted(){}#_(e,r){this.#E();let n=t.get(this.#t[r],"props");n&&t.each(this.slots,((e,r)=>{e.filter((e=>e.nodeType===Node.ELEMENT_NODE)).forEach((e=>{e instanceof j?e._updateProps(n):t.each(n,((r,n)=>{if(e instanceof HTMLSlotElement){let s=t.get(e,"__l_comp");if(s){let t=e.name||"default",o=s.#t[t];o||(o=s.#t[t]={props:{}}),o.props||(o.props={}),o.props[n]=r,s.#_(e,t)}}else e.setAttribute(n,r)}))}))})),this.slotChange(e,r)}slotChange(e,t){}attributeChangedCallback(e,t,r){this.#P(e,t,r)}shouldUpdate(e){return!0}updated(e){}#A={};_notify(e,n){let s=[];for(let o=0;o<n.length;o++){const i=n[o];s.push(i);let a=t.get(this,s),l=u(s);this.#s[l]={value:a,chain:"slots"===l?["slots"]:s,oldValue:e,end:s.length===n.length},t.isObject(a)&&"#"!=l[0]&&r.set(a,l)}return this.#b}#T(){if(t.size(this.#s)<1)return;const e=this.#s;this.#s={};let n=t.get(this.constructor,g);if(n&&n.sort(((e,t)=>t.priority-e.priority)).forEach((t=>{t.updated(this,e)})),!this.shouldUpdate(e))return;let s=new Set;t.each(e,(({value:e,chain:t,oldValue:r,end:n},o)=>{this.#i[o]&&this.#i[o].forEach((e=>{s.add(e)}))})),s.forEach((e=>{e===this?Qe(this.render(),this):qe(e,this)})),this.#w.forEach((e=>{this.#C(e)})),this.updated(e),t.each(e,(({value:e,chain:n,oldValue:s},o)=>{t.isObject(e)&&r.has(e)&&r.delete(e)}))}#S(){let e=t.get(this.constructor,o.PROPS),r=this.attributes,n=this.tagName,s=this.#l,i={};t.each(r,(({name:r,value:n})=>{if(r[0]===Se||r[0]===Ne||r[0]===Ce||r===Ae||"slot"===r)return;let s=t.camelCase(r);e&&!e[s]&&(i[r]=n)})),this.#a=this.#a?t.assign(this.#a,i):i;let a={};if(!e)return Object.seal(a);let l=Object.keys(e),u=l.length;for(let o=0;o<u;o++){const i=l[o],u=t.kebabCase(i),h=this.hasAttribute(u);let f,g=e[i],m=t.has(s,i),y=t.get(this,i);if(!("_defaultValue"in g)&&(g._defaultValue=y,!g.type)){t.isUndefined(y)&&c(n,"Prop '"+i+"' has neither propType nor defaultValue be used for type inference");let e=typeof y;t.isArray(y)&&(e="array");let r=R[e];g.type=r}if(m)f=t.isNil(s[i])?y:s[i];else{f=y;let e=r.getNamedItem(u)||r.getNamedItem(Ne+u);e&&(m=!0,f=e.value)}if(g.required&&!m){c(n,"Prop '"+i+"' is required");break}f=this.#D(e,i,f,h);let v=t.get(e,[i,"getter"]);v&&(v=t.bind(v,this));let E=t.get(e,[i,"setter"]);if(E&&(E=t.bind(E,this)),(v||E)&&Reflect.defineProperty(this.#r,i,{set:E||function(e){},get:v}),g.attribute&&t.isDefined(f)&&!t.isObject(f)){let e=t.kebabCase(i),r=t.trim(f);(d=g.type)===Boolean||t.some(d,(e=>e===Boolean))?(r=p(f),t.isBoolean(r)?this.toggleAttribute(e,r):this.setAttribute(e,r)):this.setAttribute(e,r)}this.#r[i]=f,a[i]=f}var d;return Object.seal(a)}#k(e,r){let n=e;try{for(let s=0;s<r.length;s++){const o=r[s];n=o===Boolean?p(e):o===Number?Number(e):o===String?String(e):o===Object||o===Array?t.parseJSON(e):o===Date?new Date(e):new o(e)}}catch(t){c(this.tagName,"Convert attribute error with "+e)}return n}#D(e,r,n,s){let o=e[r];if(!o)return n;let i=o.isValid,a=o.type,l=t.isArray(a)?a:[a],u=o.converter,d=n;if(!t.some(l,(e=>e===String))&&t.isString(d)&&!t.isNull(d))try{d=u?u(d):this.#k(d,l)}catch(e){c(this.tagName,`Convert attribute '${r}' error with `+d)}for(let e=0;e<l.length;e++){"Boolean"===l[e].name&&(d=(!1!==s||!t.isBlank(d))&&p(d))}if(t.isNil(d))return d;let h=typeof d,f=!t.isDefined(d);for(let e=0;e<l.length;e++){const r=l[e];if(t.test(h,r.name,"i")||d instanceof r||Object.prototype.toString.call(d)===Object.prototype.toString.call(r.prototype)){f=!0;break}}return f||c(this.tagName,`Invalid prop '${r}'. expected '${l.map((e=>e.name||e))}' but got '${h}'`),i&&(i.call(this,d,this.#r)||c(this.tagName,`Invalid prop '${r}'. IsValid() check failed`)),d}#N(){let e=t.get(this.constructor,o.STATES);t.each(e,((r,n)=>{let s=e[n],o=t.get(this,n);if(s){let e=s.prop;o=e?t.cloneDeep(this.#r[e]):t.get(this,n)}this.#r[n]=o}))}#M=t.debounce(this.propsReady,100);_setParentProps(e,r){if(this.#y){let n=t.get(this.constructor,o.PROPS);t.each(e,((e,r)=>{let s=t.camelCase(r),o=n[s];if(!o)return;let i=this.#r[s];e=this.#D(n,s,e),o.hasChanged&&!o.hasChanged.call(this,e,i)||(this.#r[s]=e,this._notify(i,[s]))})),t.assign(this.#l,e),t.assign(this.#a,r),this.#M(this.#l)}}_updateProps(e){let r=t.get(this.constructor,o.PROPS);t.each(e,((e,n)=>{let s=t.camelCase(n);r[s]&&(e=this.#D(r,s,e),C.__skipCheck=!0,t.set(this,s,e),C.__skipCheck=!1)})),t.assign(this.#l,e),this.#M(this.#l)}_initProps(e,r){this.#l=t.merge(this.#l||{},e),this.#a=t.merge(this.#a||{},r)}_bindSlot(e,r,n){if(this.#g[r]||(this.#g[r]=e,Reflect.defineProperty(e,"__l_comp",{value:this})),e.addEventListener("slotchange",(t=>{this.#y&&this.#_(e,"default"===r?"":r)})),!t.isEmpty(n)){let e=this.#t[r];e||(e=this.#t[r]={}),e.props=n}}_bindSlotHook(e,t){this.#h[e]=t}#w=new Set;_updateSlot(e,t,r){let n=this.#g[e],s=this.#h[e];if(!s&&!n)return;let o=this.#t[e];if(t&&(o.props||(o.props={}),o.props[t]=r),s)this.#w.add(e);else{let e=n.assignedElements({flatten:!0});for(let n=0;n<e.length;n++){e[n].setAttribute(t,r+"")}}}#E(){const e=t.flatMap(this.childNodes,(e=>e.nodeType===Node.COMMENT_NODE?[]:e instanceof HTMLSlotElement?e.assignedNodes({flatten:!0}):e));let r=t.groupBy(e,(e=>e.nodeType===Node.TEXT_NODE?"default":e instanceof Element?e.getAttribute("slot")||"default":void 0));if(t.isEmpty(r))return void(t.isEmpty(this.#r["#slots"])||(this.#y?this.#n["#slots"]={}:this.#r["#slots"]={}));t.each(r,((e,r)=>{if(r){for(;e.length>0;){let r=e[0];if(!(r.nodeType===Node.TEXT_NODE&&t.isBlank(r.textContent)||r instanceof HTMLSlotElement&&t.isEmpty(r.assignedNodes({flatten:!0}))))break;e.shift()}for(;e.length>0;){let r=t.last(e);if(!(r.nodeType===Node.TEXT_NODE&&t.isBlank(r.textContent)||r instanceof HTMLSlotElement&&t.isEmpty(r.assignedNodes({flatten:!0}))))break;e.pop()}}}));let n={};t.each(r,((e,r)=>{t.isEmpty(e)||(n[r]=e)})),this.#y?this.#n["#slots"]=n:this.#r["#slots"]=n}#C(e){let r=this.#h[e];if(!r)return;let n=this.#t[e];if(!this.#r["#slots"][e])return;this.renderAsync(r,t.get(n,"props"));const s=this._asyncDirectives.get(r);let o=s?.buildView(r(t.get(n,"props"))),i=t.reject(t.toArray(o),(e=>e.nodeType===Node.COMMENT_NODE));if(i){let r=this.#m[e];if(!t.isEmpty(r))for(let e=0;e<r.length;e++){const t=r[e];t.parentNode?.removeChild(t)}this.#m[e]=i,this.append(...i),this.#w.clear()}}_asyncDirectives=new WeakMap;renderAsync(e,...t){}#P(e,r,n){if(!this.#y)return;if(N(this.constructor).has(e)){let r=t.camelCase(e);if(t.isNull(n)){n=t.get(this.constructor,o.PROPS)[r]._defaultValue}this._updateProps({[r]:n})}}_regDeps(e,t){let r=this.#i[e];r||(r=this.#i[e]=new Set),r.add(t);let n=e.split("-");if(n.pop(),n.length<1)return;let s=n.join("-");r=this.#i[s],r||(r=this.#i[s]=new Set),r.add(t)}_regWrapper(e){this.#p=e}emit(e,r={},n){n&&n.event&&(r.event=n.event),r.target=this,this.dispatchEvent(new CustomEvent(e,{bubbles:t.get(n,"bubbles",!1),composed:t.get(n,"composed",!1),cancelable:!0,detail:r}))}on(e,t){this.#A[e]||(this.#A[e]=[]);let r=t.bind(this);this.#A[e].push(r),this.addEventListener(e,r)}nextTick(e,t){x.pushNext(e,t)}forceUpdate(){t.each(this.#n,((e,t)=>{this.#s[t]={value:void 0,chain:void 0}})),this.#T()}}var V,I,B;e.EnterPointType=void 0,(V=e.EnterPointType||(e.EnterPointType={})).ATTR="attr",V.PROP="prop",V.TEXT="text",V.CLASS="class",V.STYLE="style",V.SLOT="slot",V.TAG="tag",e.DirectiveUpdateTag=void 0,(I=e.DirectiveUpdateTag||(e.DirectiveUpdateTag={})).NONE="NONE",I.REMOVE="REMOVE",I.REPLACE="REPLACE",I.UPDATE="UPDATE",I.APPEND="APPEND";class F{key;varIndex;value;isText=!1;isDirective=!1;node;textNode;isComponent=!1;attrName;attrTmpl;isProp=!1;isToggleProp=!1;notUpdated;constructor(e,t,r,n){this.varIndex=e,this.node=t,r&&(this.attrName=r),n&&(this.attrTmpl=n)}}class z{startNode;endNode;type;attrName;varIndex;expressionChain;nodes;constructor(e,t,r){this.startNode=e,this.attrName=t,this.type=r}setVarIndex(e){this.varIndex=e}getNodes(){let e=this.startNode.nextSibling;if(!this.endNode)return[e];let t=[];for(;e&&e!==this.endNode;)t.push(e),e=e?.nextSibling;return t}}!function(e){e.AFTER_BEGIN="afterbegin"}(B||(B={}));const G={};function K(r,n,s,o,i,a,c,u=!1){let d;if(u?(C.startRender(r.endNode),d=o(r,n,s,{renderComponent:i,slotComponent:a,varChain:c}),C.endRender(i)):d=o(r,n,s,{renderComponent:i,slotComponent:a,varChain:c}),!d)return;let[p,h]=d;if(p===e.DirectiveUpdateTag.NONE)return;let f=r.getNodes();if(p===e.DirectiveUpdateTag.REMOVE)for(let e=0;e<f.length;e++){const t=f[e];t.parentNode?.removeChild(t)}else if(p===e.DirectiveUpdateTag.REPLACE){let e=[];for(let e=0;e<f.length;e++){const t=f[e];t.parentNode?.removeChild(t)}let n=Ke(r.endNode,h,i);e=t.toArray(n);let s=document.createDocumentFragment();s.append(...e),r.endNode.parentNode.insertBefore(s,r.endNode)}else if(p===e.DirectiveUpdateTag.UPDATE){let e,n={},s=[],o=[],a=We.get(r.endNode);if(h||(h=new Ze([],[])),t.isEmpty(f)){let e=Ke(r.endNode,h,i);return void r.startNode.after(...e)}let c={};h instanceof Ze&&h.vars.forEach((e=>{if(e instanceof Ze){const t=e.getKey();c[t]=e,n[t]=!0,o.push(t)}})),f=t.filter(t.compact(f),(e=>e.nodeType===Node.ELEMENT_NODE)),e=t.filter(t.compact(t.toArray(e)),(e=>e.nodeType===Node.ELEMENT_NODE));let u={},d="",p={};for(let e=0;e<f.length;e++){let t=f[e],r=t.getAttribute("key");if(r){if(u[r]){d=r;break}u[r]=t,s.push(r),p[r]=!0}}if(d)return void l(`${t.camelCase(r.endNode._diName)} - duplicate key '${d}'`);let g=n;const m=r.startNode.parentNode;let y=[],v=[];t.each(p,((e,r)=>{g[r]||(v.push(r),delete p[r],t.remove(s,(e=>e===r)))}));let E,b=!1;if(!t.isEmpty(o)){let e=-1,n=[],i=[],a=0,l=0;for(;l<o.length;l++){const c=o[l];let d=s.findIndex((e=>e===c));if(d<0){let e=o[l-1],t=e?u[e]||e:r.startNode;y.push({prevNode:t,newkey:c}),a++}else if(d>-1&&d!==l-a){if(e<0||1===Math.abs(e-d)){let e=t.last(n);n.push({nodeId:c,targetId:0===l?B.AFTER_BEGIN:e?e.nodeId:o[l-1]})}else i.push({moveGroup:n,moveIndex:l+n.length}),n=[],n.push({nodeId:c,targetId:o[l-1]});e=d}}if(n.length>0&&i.push({moveGroup:n,moveIndex:l+n.length}),i.length>0){b=!0;let e=i.sort(((e,t)=>e.moveGroup.length-t.moveGroup.length));if(e.length<2){let{moveGroup:n}=e[0];if(n.length>1){let e=t.last(n).targetId;n[n.length-2].nodeId===e&&(n=t.initial(n))}n.forEach((({targetId:e,nodeId:t})=>{let n,s=u[t];e===B.AFTER_BEGIN?(n=r.startNode,n.after(s)):(n=u[e],n.after(s))}))}else{let n=t.last(e).moveIndex;1===Math.abs(e[e.length-2].moveIndex-n)&&(e=t.initial(e)),e.forEach((({moveGroup:e})=>{e.forEach((({targetId:e,nodeId:t})=>{let n,s=u[t];e===B.AFTER_BEGIN?(n=r.startNode,n.after(s)):(n=u[e],n.after(s))}))}))}}}if(y.length>0&&(E=function(e,r,n,s,o,i){const a=[],l=[],c=[];let u,d=[];e.forEach((e=>{let n=t.last(d);n&&u===e.prevNode?(n.group||(n.group=[u]),n.group.push(e.newkey)):d.push(e),u=e.newkey;let s=e.newkey;c.push(s),a.push(""),l.push(r[s])})),a.push("");let p=new Ze(a,l),h=[...o],f=Ke(i,p,s),g=We.get(i);o.length=0,o.push(...g);let m=new Map;return f.forEach((e=>{const t=e.getAttribute("key");c.includes(t)&&(m.set(t,!0),G[t]=e)})),h.forEach(((e,t)=>{const r=e.key+"";!m.get(r)&&n.includes(r)&&o.push(e)})),d}(y,c,o,i,a,r.endNode),E.forEach(((e,n)=>{let s=e.newkey,o=G[s],i=e.prevNode;if(e.group){let r=document.createDocumentFragment();r.append(...t.map(e.group,(e=>G[e]))),o=r}i===r.endNode?i.before(o):i===r.startNode?i.after(o):"string"==typeof i?G[i].after(o):i.after(o)}))),v.forEach((e=>{let t=u[e];t&&t.parentNode&&m.removeChild(t)})),h.vars[0]instanceof Ze){let e=[],r=[];t.each(h.vars,(n=>{r.push(...n.vars),e.push(...t.map(n.vars,(e=>"1")))})),e.push("1"),h=new Ze(e,r)}if(b||v.length>0||E){const e=t.groupBy(a,(e=>e.key));let r=[],n=0;o.forEach((t=>{e[t].forEach((e=>{e.varIndex=n++,r.push(e)}))})),a=r}qe(r.endNode,i,h,a)}}let Q=0;function q(e,r){let n=e.name||"Di-"+Q++,s=Symbol.for(n);return(...n)=>{let o=e(...n);return[s,n,o,e=>{process.env.DEV&&(t.isEmpty(r)||t.test(r.join(","),e)||l(`Directive '${Symbol.keyFor(s)}' is out of scopes, expect '${r.join(",")}' bug got '${e}'`))},C.popDirectiveQ()]}}const X=["resize","outside","mutate"],Y=new WeakMap,J=[],Z=[],ee=[],te=new ResizeObserver((e=>{for(const t of e){const e=Array.isArray(t.contentBoxSize)?t.contentBoxSize[0]:t.contentBoxSize,r=Array.isArray(t.borderBoxSize)?t.borderBoxSize[0]:t.borderBoxSize;let n=Y.get(t.target);if(n){n(new CustomEvent("resize",{bubbles:!1,cancelable:!1,detail:{borderBox:{w:r.inlineSize,h:r.blockSize},contentBox:{w:e.inlineSize,h:e.blockSize}}}),t.target)}}}));var re;!function(e){e.Child="child",e.Tree="tree",e.Attr="attr",e.Char="char"}(re||(re={}));const ne=new WeakMap,se=new MutationObserver((e=>{for(let t=0;t<e.length;t++){const r=e[t];let n=ne.get(r.target);if(!n)return;let s={target:r.target},o=null;switch(r.type){case"subtree":s.type=re.Tree,o=n[re.Tree];break;case"childList":s.type=re.Child,s.addedNodes=r.addedNodes,s.removedNodes=r.removedNodes,o=n[re.Child];break;case"attributes":s.type=re.Attr,s.attributeName=r.attributeName,s.oldValue=r.oldValue,o=n[re.Attr];break;case"characterData":s.type=re.Char,s.oldValue=r.oldValue,o=n[re.Char]}if(o){o(new CustomEvent("mutate",{bubbles:!1,cancelable:!1,detail:s}))}}}));function oe(e,r,n,s){if("resize"===e)!function(e,t){Y.has(e)||(Y.set(e,t),te.observe(e))}(r,n);else if("outside"===e)switch(s[0]){case"mousedown":!function(e,t){J.push([e,t])}(r,n);break;case"dblclick":!function(e,t){ee.push([e,t])}(r,n);break;default:!function(e,t){Z.push([e,t])}(r,n)}else"mutate"===e&&function(e,r,n){let s=t.includes(n,"child"),o=t.includes(n,"attr"),i=t.includes(n,"char"),a=t.includes(n,"tree"),l=ne.get(e);l||(l={},ne.set(e,l),s&&(l[re.Child]=r),o&&(l[re.Attr]=r),i&&(l[re.Char]=r),a&&(l[re.Tree]=r),se.observe(e,{childList:s,attributes:o,characterData:i,subtree:a}))}(r,n,s)}document.addEventListener("mousedown",(e=>{let r=t.get(e.composedPath(),0,e.target);J.forEach((([n,s])=>{if(!n.contains(r)&&!n.contains(t.closest(r,(e=>e instanceof ShadowRoot),"parentNode")?.host)){s(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:n,event:e}}),n)}}))}),!1),document.addEventListener("click",(e=>{let r=t.get(e.composedPath(),0,e.target);Z.forEach((([n,s])=>{if(!n.contains(r)&&!n.contains(t.closest(r,(e=>e instanceof ShadowRoot),"parentNode")?.host)){s(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:n,event:e}}),n)}}))}),!1),document.addEventListener("dblclick",(e=>{let r=t.get(e.composedPath(),0,e.target);ee.forEach((([n,s])=>{if(!n.contains(r)&&!n.contains(t.closest(r,(e=>e instanceof ShadowRoot),"parentNode")?.host)){s(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:n,event:e}}),n)}}))}),!1);const ie=/,|^(debounce:.+)|(debounce$)/,ae=/,|^(throttle:.+)|(throttle$)/,le="self",ce="stop",ue="prevent",de="once",pe="left",he="right",fe="middle",ge="ctrl",me="alt",ye="shift",ve="meta",Ee={esc:"escape"},be=":";function Te(e,r,n,s){let o,i=e.split("."),a=i.shift(),l=i.includes(de),c=r;if(o=t.find(i,(e=>ie.test(e)))){let e=o.split(be);c=t.debounce(c,parseInt(e[1])||100)}if(o=t.find(i,(e=>ae.test(e)))){let e=o.split(be);c=t.throttle(c,parseInt(e[1])||100)}if(l&&(c=t.once(c)),function(e){return X.includes(e)}(a))return oe(a,n,c,i),c;let u=e=>{if(i.includes(ue)&&e.preventDefault(),i.includes(ce)&&e.stopPropagation(),!i.includes(le)||e.target===e.currentTarget){if(e instanceof MouseEvent){if(i.includes(pe)&&0!=e.button)return;if(i.includes(he)&&2!=e.button)return;if(i.includes(fe)&&1!=e.button)return}else if(e instanceof KeyboardEvent){if(t.remove(i,(e=>e==ge))[0]&&!e.ctrlKey)return;if(t.remove(i,(e=>e==me))[0]&&!e.altKey)return;if(t.remove(i,(e=>e==ye))[0]&&!e.shiftKey)return;if(t.remove(i,(e=>e==ve))[0]&&!e.metaKey)return;if(!t.map(i,(e=>Ee[e]||e)).includes(e.key.toLowerCase()))return}c(e)}};n.addEventListener(a,u);let d=s.__events[a];return d||(d=s.__events[a]=[]),d.push([n,u]),u}const Se="@",Ne=".",Ce="?",_e="*",Pe=":",Ae="ref",we="key",De=/[.?-a-z]+\s*=\s*(['"])\s*([^='"]*<\!--c_ui-pl_df-->){2,}.*?\1/ims,ke=/<\s*[a-z0-9-]+([^>]*<\!--c_ui-pl_df-->)*[^>]*?(?<!-)>/gims,Me="slot-props",Oe=new Map,xe=new Map,Re=new Map;var Le;!function(e){e.Event="event",e.Directive="directive",e.DirectiveTag="directiveTag",e.DirectiveAttr="directiveAttr",e.DirectiveProp="directiveProp",e.DirectiveText="directiveText",e.DirectiveSlot="directiveSlot",e.Attr="attr",e.AttrProp="attrProp",e.AttrBool="attrBool",e.AttrRef="attrRef",e.AttrSlot="attrSlot",e.AttrKey="key",e.Ref="ref",e.Text="text"}(Le||(Le={}));const Ue=new WeakMap,We=new WeakMap,He=new WeakMap,$e=new WeakMap,je=new WeakMap,Ve=new WeakMap;function Ie(e,r){let n="",s=t.concat(r.vars),o=r.strings.length-1,i=r.vars.length-1,a=0;for(let l=0;l<=o;l++){const o=r.strings[l];let c=t.get(s,a,"");if(c instanceof Ze){let[t,r]=Ie(e,c);c=t,s.splice(a,1,...r),a+=r.length-1}else c=l>i?"":Be;a++,n=n+o+c}if(process.env.DEV){let e=n.match(De);if(e){return l(`Parse error: attribute value can be set only one interpolation —— \n ${t.replaceAll(e[0],Be,"${...}")}`),["",s]}}let c=0;return n=n.replace(ke,((e,r)=>t.replaceAll(e,Be,(()=>Be.replace("--\x3e","")+c++)))),n=n.replace(Je,"$1><").trim(),[n,s]}const Be="\x3c!--c_ui-pl_df--\x3e",Fe="\x3c!--c_ui-pl_df",ze=/<!--c_ui-pl_df\d*(-->)?/;function Ge(r,n,s,o,i=!1){const a=document.createElement("div");a.innerHTML=n;const l=Re.has(o.constructor);i||!l||xe.has(o.constructor)||xe.set(o.constructor,a.cloneNode(!0));let u=0;const d=document.createNodeIterator(a,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let p,h,f=0,g=l?void 0:{},m=null,y="";for(;p=d.nextNode();){u++;let n=l?void 0:[];if(h&&!h.contains(p)&&(h=void 0),p instanceof HTMLElement||p instanceof SVGElement){p instanceof j&&(h=p);let i={},a=t.toArray(p.attributes);for(let l=0;l<a.length;l++){const u=a[l];let{name:d,value:g}=u;if(d!==Me)if(t.startsWith(d,Fe)){let i=s[f];if(t.isArray(i)&&t.isSymbol(i[0])){let[,t,s,a,l]=i;a(e.EnterPointType.TAG);let c=new z(p,d.substring(1),e.EnterPointType.TAG),u=Ve.get(p);u||(u={},Ve.set(p,u)),u[Symbol.keyFor(i[0])]=[c,o,h];let g=new F(f,p);g.isDirective=!0,g.value=i,g.isComponent=!!h,r.push(g),m&&m?.contains(p)&&(g.key=y),f++,s(c,t,void 0,{renderComponent:o,slotComponent:h,varChain:l}),n&&n.push({type:Le.DirectiveTag,point:c,up:g,name:d})}p.removeAttribute(d)}else if(d[0]!==Se)if(d!==Ae)if(d!==we)if(!process.env.DEV||d[0]!==Ne||ze.test(g)){if(ze.test(g)){let a=s[f],l=new F(f,p,d.replace(/\.|\?|@/,""),g);if(l.isComponent=!!h,m&&m?.contains(p)&&(l.key=y),d[0]===Ne||d[0]===Ce||d[0]===_e){if(t.isArray(a)&&t.isSymbol(a[0])){let[,t,r,s,i]=a;s(e.EnterPointType.PROP);let c=d.substring(1),u=new z(p,c,e.EnterPointType.PROP),f=Ve.get(p);f||(f={},Ve.set(p,f)),f[c]=[u,o,h],r(u,t,void 0,{renderComponent:o,slotComponent:h}),l.value=a,l.isDirective=!0,n&&n.push({type:Le.DirectiveProp,up:l,point:u,name:d,attrName:c})}else if(d[0]===Ce){l.isToggleProp=!0,l.value=!!a;let e=d.substring(1);l.value&&p.setAttribute(e,""),n&&n.push({type:Le.AttrBool,name:e,up:l,attrName:d})}else if(d[0]===_e){l.value=a;let e=d.substring(1);const[r,s]=e.split(Pe);let o=r;switch(s){case"camel":o=t.camelCase(o);break;case"kebab":o=t.kebabCase(o);break;case"snake":o=t.snakeCase(o)}l.attrName=o,p.setAttribute(o,a),n&&n.push({type:Le.AttrRef,up:l,name:d,attrName:o})}else if(!process.env.DEV||p instanceof j||"SLOT"===p.tagName){let e=t.camelCase(d.substring(1));process.env.DEV&&!(e in p)&&"SLOT"!==p.tagName&&c(p.tagName,`Prop '${d}' is not defined in ${p.tagName}`),l.value=a,l.isProp=!0,i[e]=a,n&&n.push({type:Le.AttrProp,up:l,name:e,attrName:d})}else c(p.tagName,`Prop '${d}' can only be set on a CompElem or a slot`);p.removeAttribute(d),a=""}else{let r,s;l.value=a;let i={type:Le.Attr,up:l,attrName:d};if(t.isArray(a)&&t.isSymbol(a[0])){let t=e.EnterPointType.ATTR;"class"===d?t=e.EnterPointType.CLASS:"style"===d&&(t=e.EnterPointType.STYLE);let[,n,c,u,f]=a;u(t),l.isDirective=!0,l.attrName=d;let g=new z(p,d,t),m=Ve.get(p);m||(m={},Ve.set(p,m)),m[d]=[g,o,h],s=n,r=c,a="",i.type=Le.DirectiveAttr,i.point=g}g=t.replace(g,ze,a),u.value=g,r&&r(i.point,s,void 0,{renderComponent:o,slotComponent:h}),n&&n.push(i)}r.push(l),f++}}else c(p.tagName,`Prop '${d}' must be an interpolation`);else{let e=s[f];p.setAttribute(d,e);let t=new F(f,p);t.notUpdated=!0,m&&m?.contains(p)&&(t.key=y),r.push(t),f++,m=p,y=e,n&&n.push({up:t,type:Le.AttrKey}),r.length>0&&r.forEach((t=>{t.key=t.key??e}))}else{if(ze.test(g)){let e=s[f];if(process.env.DEV&&!t.has(e,"current")){c(p.tagName,"Ref must be a RefObject");continue}let o=new F(f,p);o.notUpdated=!0,m&&m?.contains(p)&&(o.key=y),r.push(o),f++,e.current=p,n&&n.push({type:Le.Ref,up:o,attrName:d})}p.removeAttribute(d)}else{let e=e=>{},i=null,a=!1;if(ze.test(g)){i=new F(f,p),i.notUpdated=!0,m&&m?.contains(p)&&(i.key=y),r.push(i);let n=s[f];if(process.env.DEV&&!t.isFunction(n)){c(p.tagName,`Event '${d}' must be a function`);continue}e=n.bind(o),f++,a=!0}let l=d.substring(1);Te(l,e,p,o),p.removeAttribute(d),n&&n.push({type:Le.Event,up:i,name:l,attrName:d,value:a})}else{let e=p.getAttribute("name")||"default";n&&n.push({type:Le.AttrSlot,name:e,attrName:d})}}p instanceof j?(p._initProps(i),p._regWrapper(o)):p instanceof HTMLSlotElement&&o._bindSlot(p,p.name||"default",i)}else{let i=p;if(`\x3c!--${i.nodeValue}--\x3e`!==Be)continue;let a=new F(f,p);m&&m?.contains(p)&&(a.key=y),r.push(a),a.isComponent=!!h,a.isText=!0;let l=s[f];if(t.isArray(l)&&t.isSymbol(l[0])){const t=Symbol.keyFor(l[0]);let r;r=document.createComment(`compelem-${o.tagName}-${t}-start`),a.textNode=r,i.parentNode.insertBefore(r,i),i.nodeValue=`compelem-${o.tagName}-${t}-end`,i._diName=t,a.isDirective=!0,a.value=l;let s=h?e.EnterPointType.SLOT:e.EnterPointType.TEXT,[,c,u,d,p]=l;d(s);let f=new z(r,"",s);f.endNode=i,$e.set(i,[f,o,h,c,p]),He.set(i,u),je.set(i,a),C.startRender(i);let g=u(f,c,void 0,{renderComponent:o,slotComponent:h,varChain:p});if(C.endRender(o),g){let e=Ke(i,g[1],o);e&&e.length>0&&Xe.insertBefore(i,Array.from(e))}l=void 0,n&&n.push({type:s===e.EnterPointType.SLOT?Le.DirectiveSlot:Le.DirectiveText,up:a,point:f})}else a.value=l,n&&n.push({type:Le.Text,up:a});f++;let c=t.toString(l??""),u=document.createTextNode(c);i.parentNode.insertBefore(u,i),a.textNode=u}g&&n&&(g[u]=n),m&&!m.contains(p)&&m!==p&&(m=null,y="")}return!i&&g&&Re.set(o.constructor,g),a.childNodes}function Ke(e,t,r){let[n,s]=Ie(r,t),o=[],i=Ge(o,n,s,r,!0);return We.set(e,o),i}function Qe(r,n,s){if(t.isBlank(t.join(r.strings)))return;if(!Ue.has(n))return;let{vars:o}=r;s=s??Ue.get(n);for(let r=0;r<s.length;r++){const i=s[r];let a=i.varIndex;if(a<0)continue;if(i.notUpdated)continue;let l=i.value,c=o,u=i.node,d=t.split(a,"-");for(let e=0;e<d.length;e++){const n=d[e];c=t.get(c,n),c&&c.vars&&r<d.length-1&&(c=c.vars)}if(!t.isObject(l)&&l===c)continue;let p=u;if(i.isDirective){let[t,r,n,,s]=i.value,o=$e.get(u);if(!o){const e=Ve.get(u);o=e[i.attrName]||e[Symbol.keyFor(t)]}let[a,l,d]=o,[,p]=c;const h=je.get(u);if(h){h.value=c;$e.get(u)[3]=p}K(a,p,r,n,l,d,s,a.type==e.EnterPointType.TEXT||a.type==e.EnterPointType.SLOT)}else if(i.isToggleProp){if(!!c===l)continue;p.toggleAttribute(i.attrName,!!c),t.set(p,i.attrName,!!c)}else if(i.isProp){if(!t.isObject(c)&&c===l)continue;u instanceof j?u._updateProps({[i.attrName]:c}):u instanceof HTMLSlotElement&&n._updateSlot(u.getAttribute("name")||"default",i.attrName,c)}else if(i.attrName){if(!t.isEqual(l,c))switch(i.attrName){case"value":if(u instanceof HTMLInputElement){u.value=c;break}default:u.setAttribute(i.attrName,t.replace(i.attrTmpl,ze,c+""))}}else if(i.isText){i.textNode.textContent=t.toString(c??"")}i.value=c}}function qe(e,r,n,s){const o=He.get(e),[i,a,l,c,u]=$e.get(e),d=je.get(e);if(!n){let e=o(i,d.value[1],c,{renderComponent:a,slotComponent:l,varChain:u});if(!e)return;n=e[1]}if(n&&n.vars[0]instanceof Ze){let e=[],r=[];t.each(n.vars,(n=>{r.push(...n.vars),e.push(...t.map(n.vars,(e=>"1")))})),e.push("1"),n=new Ze(e,r)}s&&We.set(e,s),Qe(n,r,s=s??We.get(e))}const Xe={insertBefore:function(e,t){if(!e.parentNode)return;let r=document.createDocumentFragment();r.append(...t),e.parentNode.insertBefore(r,e)},remove:function(e,t){if(e===t)return void e?.parentNode?.removeChild(e);let r=e.nextSibling;for(;r&&r!==t;)r?.parentNode?.removeChild(r),r=e.nextSibling}};function Ye(e,...r){return new Ze(t.isString(e)?[e]:e,r)}const Je=/([a-z0-9"'])\s*>\s*</gim;class Ze{strings;vars;constructor(e,r){this.strings=t.concat(e),this.vars=r}getKey(){let e=this.vars,r="";return t.each(this.strings,((s,o)=>{if(n.test(s))return r=t.toString(e[o]),!1})),r}getKeys(){let e=this.vars,r=[];for(let s=0;s<this.strings.length;s++){const o=this.strings[s];if(n.test(o)){let n=t.toString(e[s]);r.push(n)}}return t.isEmpty(r)&&e.forEach((e=>{if(e instanceof Ze){let t=e.getKey();r.push(t)}})),r}append(e){let r=t.last(this.strings);return e.strings.forEach(((e,t)=>{0!=t?this.strings.push(e):this.strings[this.strings.length-1]=r+e})),this.vars=t.concat(this.vars,e.vars),this}insert(e,t){let r=t.strings.shift();return this.strings[e]+=r,this.strings.splice(e+1,0,...t.strings),this.vars.splice(e,0,...t.vars),this}getHTML(e){let[r,n]=Ie(e,this),s=Ge([],r,n,e);return t.reduce(s,((e,t)=>e+(t.outerHTML??"")),"")}}const et=E(class extends h{static get priority(){return Number.MAX_VALUE}created(e,r,n,...s){let o=t.get(e,n);t.set(e,n,t.debounce(o,this.wait,this.immediate));let i=Reflect.getPrototypeOf(e);i&&!t.get(i,n+"_$__")&&t.set(i,n+"_$__",o)}beforeMount(e,t,...r){}mounted(e,t,...r){}updated(e,t){}get targets(){return[e.DecoratorType.METHOD]}wait;immediate;result;constructor(e,t=!1){super(),this.wait=e,this.immediate=t}});const tt=E(class extends h{static get priority(){return Number.MAX_VALUE}created(e,r,n,...s){let o=t.bind(t.get(e,n),e);t.set(e,n,t.once(o));let i=Reflect.getPrototypeOf(e);i&&!t.get(i,n+"_$__")&&t.set(i,n+"_$__",o)}beforeMount(e,t,...r){}mounted(e,t,...r){}updated(e,t){}get targets(){return[e.DecoratorType.METHOD]}wait;result;constructor(){super()}});var rt;e.QueryCache=void 0,(rt=e.QueryCache||(e.QueryCache={})).ONCE="once",rt.UPDATABLE="updatable";class nt extends h{static get priority(){return Number.MAX_VALUE}created(e,t,r,...n){}mounted(e,t,...r){}get targets(){return[e.DecoratorType.FIELD]}selector;cache;result;constructor(e,t){super(),this.selector=e,this.cache=t}static getKey(e){return e}getter(e){this.result=e.shadowRoot?.querySelector(this.selector)}beforeMount(e,t,r,n,...s){const o=this;Reflect.defineProperty(e,n,{get:()=>(o.result&&o.cache||o.getter(e),o.result)})}updated(t,r){this.cache===e.QueryCache.UPDATABLE&&this.getter(t)}}const st=E(nt),ot=E(class extends nt{getter(e){this.result=e.shadowRoot?.querySelectorAll(this.selector)}});function it(e,r,n){if(!t.has(e.constructor,o.STATES)){const r={};let n=e.constructor;for(;(n=d(n))!==j;)t.merge(r,n[o.STATES]?t.cloneDeep(n[o.STATES]):{});Reflect.defineProperty(e.constructor,o.STATES,{configurable:!1,enumerable:!1,value:r})}n.shallow=n.shallow||!1,e.constructor[o.STATES][r]=n}const at=E(class extends h{static get priority(){return Number.MAX_VALUE}created(e,r,n,...s){let o=t.get(e,n);t.set(e,n,t.throttle(o,this.wait));let i=Reflect.getPrototypeOf(e);i&&!t.get(i,n+"_$__")&&t.set(i,n+"_$__",o)}beforeMount(e,t,...r){}mounted(e,t,...r){}updated(e,t){}get targets(){return[e.DecoratorType.METHOD]}wait;result;constructor(e){super(),this.wait=e}});const lt=["key"],ct=q((function(e){return(e,[r],n)=>{let s=e.startNode;if(n)t.each(r,((e,t)=>{s.setAttribute(t,e)}));else if(s instanceof j){let e={},n={},i=t.get(s.constructor,o.PROPS);t.each(r,((r,s)=>{if(lt.includes(s))return;let o=t.camelCase(s);i[o]?e[s]=r:n[s]=r+""})),s._initProps(e,n)}else t.each(r,((e,t)=>{s.setAttribute(t,e)}))}}),[e.EnterPointType.TAG]),ut=new Map,dt=q((function(e){return(e,[r],n,{renderComponent:s})=>{let o=[];if(t.isArray(r)?o=t.compact(r):t.isObject(r)?o=t.flatMap(r,((e,t)=>e?t:[])):t.isString(r)&&(o=r.split(" ")),o.length<1&&!n)return;let i=e.startNode;if(ut.get(i)&&ut.get(i).length===o.length&&t.isMatch(ut.get(i),o))return;let a=ut.get(i);t.each(a,(e=>{i.classList.remove(e)})),t.each(o,(e=>{i.classList.add(e)})),a=t.concat(o),ut.set(i,a)}}),[e.EnterPointType.CLASS]),pt=new Map,ht=new Map,ft=q((function(r,s){return(r,o,i,{varChain:a})=>{let c=r.startNode,u=function(e,r,s){let o=t.map(e,((e,t)=>r(e,t)));if(o.length<1){let e=new Ze([],[]);return ht.set(s,e),e}let i=[],a=[];const c=[],u=[];for(let e=0;e<o.length;e++){const r=o[e];let s=t.last(a),d=r.vars,p=!0,h=r.strings;for(let e=0;e<h.length;e++){const t=h[e];if(n.test(t)){let t=d[e]+"";if(i.includes(t))return void l(`forEach - duplicate key '${t}'`);i.push(t),p=!1}0==e&&s?a[a.length-1]=s+t:a.push(t)}if(p)return void l("forEach - missing 'key' prop");let f=t.last(c);f&&h.length>0&&(c[c.length-1]=t.trim(f)+h.shift()),c.push(""),u.push(r)}c.push("");let d=new Ze(c,u);return ht.set(s,d),d}(o[0],s,c);if(i&&i[0]){const n=pt.get(c);if(t.isEmpty(r.getNodes())&&(!o||t.isEmpty(o[0])))return[e.DirectiveUpdateTag.NONE,u];if(n&&t.isMatch(n,o[0])&&n.length===o[0].length)return[e.DirectiveUpdateTag.NONE,u]}return pt.set(c,t.clone(o[0])),i?[e.DirectiveUpdateTag.UPDATE,u]:[e.DirectiveUpdateTag.APPEND,u]}}),[e.EnterPointType.TEXT,e.EnterPointType.SLOT]);const gt=new WeakMap,mt=q((function(t,r,n){return(s,[o,i],a,{renderComponent:l})=>{let c=s.endNode;if(a){if(!!o==!!a[0]){let t=gt.get(c);return[e.DirectiveUpdateTag.NONE,t.call(l,o)]}let t=o?r:n;return gt.set(c,t),[e.DirectiveUpdateTag.REPLACE,t.call(l,o)]}{let s=o?r:n;return gt.set(c,s),[e.DirectiveUpdateTag.APPEND,s.call(l,t)]}}}),[e.EnterPointType.TEXT,e.EnterPointType.SLOT]),yt=q((function(t,r){return(t,[r,n],s)=>s?r===s[0]?[e.DirectiveUpdateTag.NONE,r?n():Ye``]:r?[e.DirectiveUpdateTag.REPLACE,r?n():Ye``]:[e.DirectiveUpdateTag.REMOVE]:[e.DirectiveUpdateTag.APPEND,r?n():Ye``]}),[e.EnterPointType.TEXT,e.EnterPointType.SLOT]);var vt;e.ModelTriggerType=void 0,(vt=e.ModelTriggerType||(e.ModelTriggerType={})).CHANGE="change",vt.INPUT="input";const Et=new WeakMap,bt=q((function(e,r="value"){return(n,s,o,{varChain:i,renderComponent:a})=>{const l=n.startNode;if(o){if(t.isEqual(s,o))return;if(!t.isEqual(s,o)){let e=s[0];if(l instanceof j)l._updateProps({[r]:e});else if(l instanceof HTMLTextAreaElement||l instanceof HTMLSelectElement)l.setAttribute(r,e+"");else if(l instanceof HTMLInputElement){if(l.value==e)return;switch(l.type){case"checkbox":case"radio":e?l.setAttribute("checked",""):l.removeAttribute("checked");break;case"text":case"email":case"number":case"password":case"search":case"tel":case"url":l.setAttribute(r,e+""),t.set(l,r,e);break;default:l.setAttribute(r,e+"")}}}return}if("binded"===t.get(l,"_model"))return;let c=t.last(i);if(Et.set(l,c),t.isObject(e)||t.trim(e)||(e=""),l instanceof j)l._initProps({[r]:e}),l.addEventListener("update:"+r,(e=>{t.set(a,c,e.detail.value)})),t.set(l,"_model","binded");else if(l instanceof HTMLTextAreaElement)l.setAttribute(r,e+""),l.addEventListener("input",(e=>{let r=e.target;t.set(a,c,r.value)})),t.set(l,"_model","binded");else if(l instanceof HTMLInputElement){let n="",s="";switch(l.type){case"checkbox":case"radio":n="checked",s="change";break;default:n="value",s="input"}l.setAttribute(r??n,e+""),l.addEventListener(s,(e=>{let r=e.target;t.set(a,c,r.value)})),t.set(l,"_model","binded")}else l instanceof HTMLSelectElement&&(l.setAttribute(r,e+""),l.addEventListener("change",(e=>{let r=e.target;t.set(a,c,r.value)})),t.set(l,"_model","binded"))}}),[e.EnterPointType.TAG]),Tt=new Map,St=q((function(e,t){return(e,[r],n)=>{if(n&&r===n[0])return;let s=e.startNode;if(!Tt.has(s)){let e=s.style.display;Tt.set(s,"none"==e?"unset":e)}s.style.display=r?Tt.get(s):"none",t&&t(s,r)}}),[e.EnterPointType.TAG]),Nt=q((function(e,t){return(r,n,s,{renderComponent:o,slotComponent:i})=>{s||(e=e.bind(o),i._bindSlotHook(t||"default",e))}}),[e.EnterPointType.SLOT]);class Ct{static getCssText(e,r=!1){return t.isString(e)?e:t.join(t.map(e,((e,n)=>n.startsWith("--")?n+":"+e+(r?" !important":""):t.kebabCase(n)+":"+e+(r?" !important":""))),";")}static setStyle(e,r){if(t.isString(e)&&!t.trim(e))return{};let n=Ct.getCssText(e),s={};return t.each(n.split(";"),(e=>{let n=e.split(":"),o=t.trim(n[0]),i=t.trim(n[1]);s[o]=r.style.getPropertyValue(o),r.style.setProperty(o,i)})),s}}const _t=new Map;let Pt=0;const At=q((function(e){return(e,t,r,{renderComponent:n})=>{let s=e.startNode,o=_t.get(s);o||(o="style_d"+Pt++,_t.set(s,o)),n.nextTick((()=>{Ct.setStyle(t[0],s)}),o)}}),[e.EnterPointType.STYLE]),wt=q((function(e){return(r,n,s,{renderComponent:o,varChain:i})=>{const a=r.startNode;if(s){if(!t.isEqual(n,s)){let e=r.attrName;a._updateProps({[e]:n[0]})}return}let l=t.last(i),c=r.attrName;a._initProps({[c]:e}),a.addEventListener("update:"+c,(e=>{t.set(o,l,e.detail.value)}))}}),[e.EnterPointType.PROP]),Dt=q((function(r,n){return(r,[n,s],o)=>{let i=()=>Ye``,a=[],l=[];t.each(s,((e,r)=>{if(t.isFunction(e))a.push(r),l.push(e);else{let t=e[0],r=e[1];a.push(t),l.push(r)}"default"===r&&(i=e)}));let c=t.findIndex(a,(e=>t.isFunction(e)?e(n):e==n));return o?[e.DirectiveUpdateTag.REPLACE,t.call(l[c]??i)]:[e.DirectiveUpdateTag.APPEND,t.call(l[c]??i)]}}),[e.EnterPointType.TEXT,e.EnterPointType.SLOT]);e.CompElem=j,e.CssHelper=Ct,e.Decorator=h,e.DecoratorWrapper=y,e.EnterPoint=z,e.GetKeyFnName=f,e.Template=Ze,e.UpdatePoint=F,e._DecoratorMap=m,e._DecoratorsKey=g,e._getObservedAttrs=N,e.bind=ct,e.buildHTML=Ie,e.classes=dt,e.computed=function(e,r,n){n.get||l(`Computed '${r}' must be a getter`),t.has(e.constructor,o.COMPUTED)||(e.constructor[o.COMPUTED]=t.isEmpty(e.constructor[o.COMPUTED])?{}:t.cloneDeep(e.constructor[o.COMPUTED])),e.constructor[o.COMPUTED][r]=n.get},e.createRef=function(e){return{current:e}},e.debounced=et,e.decorator=E,e.directive=q,e.event=function(e,r){return(n,s,i)=>{t.has(n.constructor,o.EVENTS)||(n.constructor[o.EVENTS]=t.isEmpty(n.constructor[o.EVENTS])?[]:t.cloneDeep(n.constructor[o.EVENTS])),n.constructor[o.EVENTS].push({name:e,options:r,fn:n[s]})}},e.forEach=ft,e.html=Ye,e.ifElse=mt,e.ifTrue=yt,e.makeState=function(e,t,r){it(e.prototype,t,r||{prop:""})},e.model=bt,e.onced=tt,e.prop=function(e){if(1===arguments.length)return(t,r,n)=>{e.required=e.required||!1,e.attribute=!1!==e.attribute,T(t,r,e,n)};let r=arguments[0],n=arguments[1],s=arguments[2];e={type:void 0,required:!1,attribute:!0},s&&"function"==typeof s.type&&(e=t.defaults(s,e),s=void 0),T(r,n,e,s)},e.query=st,e.queryAll=ot,e.show=St,e.slot=Nt,e.state=function(e){if(1===arguments.length)return(t,r)=>{it(t,r,e)};it(arguments[0],arguments[1],{prop:""})},e.styles=At,e.sync=wt,e.tag=function(e){return t=>{if(t){if(t.prototype.hasOwnProperty("attributeChangedCallback")){let e=t.prototype.attributeChangedCallback;t.prototype.attributeChangedCallback=function(t,r,n){j.prototype.attributeChangedCallback.call(this,t,r,n),e.call(this,t,r,n)}}if(t.prototype.hasOwnProperty("connectedCallback")){let e=t.prototype.connectedCallback;t.prototype.connectedCallback=function(){j.prototype.connectedCallback.call(this),e.call(this)}}if(t.prototype.hasOwnProperty("disconnectedCallback")){let e=t.prototype.disconnectedCallback;t.prototype.disconnectedCallback=function(){j.prototype.disconnectedCallback.call(this),e.call(this)}}customElements.define(e,t)}}},e.throttled=at,e.updateDirective=K,e.watch=function(e,r){return(n,s)=>{t.has(n.constructor,o.WATCH)||(n.constructor[o.WATCH]=t.isEmpty(n.constructor[o.WATCH])?{}:t.cloneDeep(n.constructor[o.WATCH]));(t.isArray(e)?e:[e]).forEach((e=>{let i=e.replaceAll(".","-"),a=n.constructor[o.WATCH][i];t.isArray(a)||(a=n.constructor[o.WATCH][i]=[]),a.push({source:e,options:r,handler:n[s]})}))}},e.when=Dt,Object.defineProperty(e,"__esModule",{value:!0})}));
7
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("myfx")):"function"==typeof define&&define.amd?define(["exports","myfx"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).compelem={},e.myfx)}(this,(function(e,t){"use strict";const r=/\s+\.?key\s*=/;var n,s,o,i;function a(e){console.error("[CompElem]",e)}function l(e,t){console.error(`[CompElem <${e}>]`,t)}function c(e){return t.toPath(e).join("-")}function u(e){return Object.getPrototypeOf(e)}function d(e){return e===Boolean||t.some(e,(e=>e===Boolean))}function p(e){let r=e;return t.isString(e)&&/(?:^true$)|(?:^false$)/.test(r)?r="true"===r:(t.isUndefined(r)||t.isBlank(r))&&(r=!0),r}!function(e){e[e.CSS=1]="CSS",e[e.COMPUTED=2]="COMPUTED"}(n||(n={})),function(e){e.PROPS="__deco_props",e.STATES="__deco_states",e.COMPUTED="__deco_computed",e.WATCH="__deco_watch",e.EVENTS="__deco_events"}(s||(s={})),function(e){e.Prod="prod",e.Dev="dev"}(o||(o={})),e.DecoratorType=void 0,(i=e.DecoratorType||(e.DecoratorType={})).CLASS="class",i.FIELD="field",i.METHOD="method";class h{static get priority(){return 0}}const f="getKey",g="__decorators",m=new WeakMap;class y{args;metadata;decoratorClass;instanceMap;key;priority=0;constructor(e,r,n){this.args=e,this.metadata=r,this.decoratorClass=n,this.priority=t.get(n,"priority",0),this.instanceMap=new WeakMap}create(r){let n,s=new this.decoratorClass(...this.args),o=s.targets,i=this.metadata[2];t.isObject(i)&&t.isDefined(t.get(i,"configurable"))?n=e.DecoratorType.METHOD:t.isUndefined(this.metadata[2])&&(n=e.DecoratorType.FIELD),!t.isEmpty(o)&&n&&o.includes(n)?(s.created(r,...this.metadata),this.instanceMap.set(r,s)):a(`Decorator '${this.decoratorClass.name}' is out of targets, expect '${o.join(",")}' bug got '${n}'`)}beforeMount(e,t){this.instanceMap.get(e).beforeMount(e,t,...this.metadata)}mounted(e,t){this.instanceMap.get(e).mounted(e,t,...this.metadata)}updated(e,t){this.instanceMap.get(e).updated(e,t)}}const v=new WeakMap;function b(e){let r=(...r)=>(...n)=>{let s=n[0].constructor,o=s[g];if(!t.has(s,g)){let e=Object.getPrototypeOf(s);o=e?t.concat(e[g]??[]):[],Reflect.defineProperty(s,g,{configurable:!1,enumerable:!1,value:o})}let i,a={},l=e[f];if(l){let t=v.get(e);if(t||(t=new WeakMap,v.set(e,t)),a=t.get(s),a||(a={},t.set(s,a)),i=l(...r),a[i])return a[i]}let c=new y(r,n,e);return a[i]=c,o?.push(c),c};return m.set(r,!0),r}const E=new WeakMap;function T(e,r,n,o){let i;if(t.isLowerCaseChar(r[0])||a(`Prop '${r}' must be in CamelCase`),!t.has(e.constructor,s.PROPS)){const r={};let n=e.constructor;for(;(n=u(n))!==G;)t.merge(r,n[s.PROPS]?t.cloneDeep(n[s.PROPS]):{});Reflect.defineProperty(e.constructor,s.PROPS,{configurable:!1,enumerable:!1,value:r}),i=new Set,t.each(r,((e,r)=>{if(e.attribute){let e=t.kebabCase(r);i?.add(e)}})),E.set(e.constructor,i)}if(o&&(o.get&&(n.getter=o.get),o.set&&(n.setter=o.set)),n.attribute){i||(i=E.get(e.constructor));let n=t.kebabCase(r);i?.add(n)}t.has(e.constructor,"observedAttributes")||(e.constructor.observedAttributes=[]),e.constructor.observedAttributes=t.toArray(i),e.constructor[s.PROPS][r]=n}const S=new Set;function C(e){return E.get(e)??S}var _,N;e.EnterPointType=void 0,(_=e.EnterPointType||(e.EnterPointType={})).ATTR="attr",_.PROP="prop",_.TEXT="text",_.CLASS="class",_.STYLE="style",_.SLOT="slot",_.TAG="tag",e.DirectiveUpdateTag=void 0,(N=e.DirectiveUpdateTag||(e.DirectiveUpdateTag={})).NONE="NONE",N.REMOVE="REMOVE",N.REPLACE="REPLACE",N.UPDATE="UPDATE",N.APPEND="APPEND";class A{key;varIndex;value;isText=!1;isDirective=!1;node;textNode;isComponent=!1;attrName;attrTmpl;isProp=!1;isToggleProp=!1;notUpdated;constructor(e,t,r,n){this.varIndex=e,this.node=t,r&&(this.attrName=r),n&&(this.attrTmpl=n)}}const P="-",w={collectWatch(e,t,r){let n=x.get(e);n||(n={},x.set(e,n));let s=n[r];s||(s=n[r]=[]),s.push(t)},startCollect(e,t){this.__collectType=t,this.__collecting=e},setUpdater(e){this.__updater=e},endCollect(){this.__collecting=null},__directiveQ:[],setDirectiveQ(e){let r=t.last(this.__directiveQ);const n=e?e.join(","):"",s=r?r.join(","):"";r&&n===s||(r&&r.length<e.length&&t.startsWith(n,s)?this.__directiveQ[this.__directiveQ.length-1]=e:this.__directiveQ.push(e))},popDirectiveQ(){let e=t.concat(this.__directiveQ);return this.__directiveQ=[],e},startRender(e){this.__renderCollecting=!0,this.__renderContext=e},endRender(e){this.__renderCollection.forEach((t=>{e._regDeps(t,this.__renderContext)})),this.__renderCollection.clear(),this.__renderCollecting=!1,this.__renderContext=null},collect(e){this.__renderCollection.add(e)},clear(){this.__directiveQ=[]},__updater:null,__collecting:null,__collectType:-1,__renderCollection:new Set,__renderContext:null,__renderCollecting:!1,__skipCheck:!1},D=new WeakMap,M=new WeakMap,k=new WeakMap,O=new WeakMap,x=new WeakMap,R=new WeakMap;function L(e,r){if(!t.isObject(e))return e;if(R.has(e))return R.get(e);if(D.has(e))return e;const o=new Proxy(e,{get(e,r,o){if(!r)return;const i=Reflect.get(e,r,o);if(t.isSymbol(r))return i;if("length"===r&&t.isArray(e))return i;let a=M.get(o)??[],l=t.concat(a,[r]),u=r in e;if((w.__renderCollecting||w.__collecting)&&(u&&e.hasOwnProperty(r)||!u)){let e=l.join(P);if(w.__renderCollecting)w.collect(c(l)),w.setDirectiveQ(l);else if(w.__collecting){let t;switch(w.__collectType){case n.COMPUTED:t=k.get(w.__collecting),t||(t={},k.set(w.__collecting,t));break;case n.CSS:t=O.get(w.__collecting),t||(t={},O.set(w.__collecting,t))}let r=t[e];r||(r=t[e]=[]),r.push(w.__updater)}}const d=D.get(o);let p=d.from,h=t.get(p.constructor,s.STATES);if(t.get(h,[r,"shallow"]))return i;let f=i;if(t.isObject(i)&&!t.isFunction(i)&&!(i instanceof Node)&&!Object.isFrozen(i)){let e=d.pathMap;d.contextSet.forEach((t=>{let r=e?.get(t);r&&(f=L(i,t),R.set(i,f),M.has(f)||M.set(f,l))}))}return f},set(e,n,o,i){if(!n)return!1;let a=e[n],l=M.get(i)??[],c=t.concat(l,[n]),u=t.get(r.constructor,s.PROPS),d=t.get(r.constructor,s.STATES),p=t.get(u,[c[0],"hasChanged"])||t.get(d,[c[0],"hasChanged"]);if(p){let e=o,t=a;if(c.length>1&&(t=e=r._getPrivateData()[c[0]]),!p.call(r,e,t,c,o,a))return!0}else if(Object.is(a,o))return!0;u&&u[n]&&e.__isData&&u[n].sync&&r.emit("update:"+n,{value:o});let h=o,f=Reflect.set(e,n,h);return U(r,a,c),f}});let i=M.get(e)??[];if(Object.isExtensible(e)&&!D.get(o)){let e=new Set;e.add(r);let t=new WeakMap;t.set(r,i),D.set(o,{from:r,contextSet:e,pathMap:t})}else{D.get(o).contextSet.add(r);let e=D.get(o).pathMap,n=e.get(r),s=t.concat(i);if(n&&n.join("")!==s.join("")){let e=t.get(r,t.initial(n));t.isArray(e)||function(...e){console.warn("[CompElem]",...e)}(`The object is referenced by more than one @state '${s.join(".")},${n.join(".")}'`),n=s}else e.set(r,s)}return R.set(e,o),o}function U(e,r,n){let s=k.get(e),o=O.get(e),i=x.get(e);if(s||o||i){let e=n.length;for(;e;){let a=n.slice(0,e).join(P);if(i){const s=i[a];e===n.length?s?.forEach((e=>{let t=e();t.ov=r,W.pushWatch(t)})):s?.forEach((e=>{let n=e();t.get(n,"deep")&&(n.ov=r,W.pushWatch(n))}))}if(s){let e=s[a];if(!t.isEmpty(e))for(let t=0;t<e.length;t++){const r=e[t];W.pushComputed(r)}}if(o){let e=o[a];if(!t.isEmpty(e))for(let t=0;t<e.length;t++){const r=e[t];W.pushCss(r)}}e--}}let a=e._notify(r,n);W.pushNext(a,e.cid)}const j=new Map;class W{static watchSet=new Set;static computedSet=new Set;static cssSet=new Set;static nextSet=new Set;static nextPending=!1;static next;static flush(){W.nextPending=!1;let e=Array.from(W.watchSet);W.watchSet.clear();let r=Array.from(W.computedSet);W.computedSet.clear();let n=Array.from(W.cssSet);W.cssSet.clear();let s=Array.from(W.nextSet);W.nextSet.clear(),j.clear(),e.forEach((e=>e(t.get(e,"ov")))),r.forEach((e=>e())),n.forEach((e=>e())),s.forEach((e=>e()))}static pushWatch(e){W.watchSet.add(e)}static pushComputed(e){W.computedSet.add(e)}static pushCss(e){W.cssSet.add(e)}static pushNext(e,t){if(t){if(j.has(t))return;j.set(t,e)}W.nextSet.add(e),W.nextPending||(W.nextPending=!0,W.next())}}(()=>{const e=Promise.resolve(),t=W.flush;W.next=()=>{e.then(t)}})();const H={boolean:Boolean,string:String,number:Number,object:Object,array:Array,function:Function,undefined:Object},I=new WeakMap;let B=[],V=0;const $=new Map,F=new WeakMap,K=Symbol.for("PROP_OBJECT_KEY_MAP_SYMBOL");class G extends HTMLElement{static __l_globalRule=document.createElement("style");static defaults(e){B=t.flatMap(e.css,(e=>{if(t.isString(e)){let t=new CSSStyleSheet;return t.replaceSync(e),t}return e instanceof CSSStyleSheet?e:[]})),e.global,t.each(e,((e,r)=>{t.test(r[0],/[A-Z]/)}))}#e;#t={};#r={"#slots":{}};#n={};#s={};#o;#i={};__events={};_propObjectKeyMap={};get[K](){return this._propObjectKeyMap}get[Symbol.toStringTag](){return this.constructor.name}get cid(){return this.#e}get reactiveData(){return this.#n}get attrs(){return this.#a}get props(){return this.#l}get renderRoot(){return this.#c}get renderRoots(){return this.#u}get parentComponent(){return this.#d}get wrapperComponent(){return this.#p}get slotHooks(){return this.#h}get css(){return I.get(this.constructor)}get globalStyleSheet(){return $.get(this.constructor)?.sheet}get isMounted(){return this.#f}get slots(){return this.#r["#slots"]}#a;#l;#c;#u;#d;#p;#g={};#h={};#m={};#f=!1;static get styles(){return[]}static get globalStyles(){return[]}static get hostStyles(){return[]}get styles(){return[]}#y=!1;#v=!1;constructor(...e){super(),this.#e=V++,1===t.size(e)&&(this.#l={},t.assign(this.#l,t.first(e)));let r=this.render.bind(this);this.render=function(){let e;return w.startRender(this),e=r(),w.endRender(this),e};let n=t.get(this.constructor,"globalStyles"),s=$.has(this.constructor);if(!t.isEmpty(n)&&!s){let e="";n.forEach((r=>{t.isString(r)&&(e+=r+"\n")}));let r=document.createElement("style");r.textContent+=e,$.set(this.constructor,r),document.head.appendChild(r)}let o=I.get(this.constructor),i=o??[];o||(t.each(t.get(this.constructor,"styles"),(e=>{if(t.isString(e)){let t=new CSSStyleSheet;t.replaceSync(e),i.push(t)}else i.push(e)})),I.set(this.constructor,i)),this.#o=this.attachShadow({mode:"open"}),this.#o.adoptedStyleSheets=[...B,...i],this.#b();let a=t.get(this.constructor,g);a&&a.sort(((e,t)=>t.priority-e.priority)).forEach((e=>e.create(this))),this.#E=this.#T.bind(this)}get rootComponent(){let e=this;for(;e.parentComponent;)e=e.parentComponent;return e}#E;connectedCallback(){let e=t.closest(this.parentNode,(e=>e instanceof G||e.host instanceof G),"parentNode");this.#d=e?e instanceof G?e:e.host:null,this.__init()}disconnectedCallback(){}__init(){if(this.#y)return;if(this.#v)return;this.#v=!0,this.#b();const e=this.#S();this.propsReady(e);for(const t in e){const r=e[t];this.#r[t]=r}this.#C(),t.each(this.#r,((e,t)=>{let r=Reflect.getOwnPropertyDescriptor(this.#r,t);Reflect.defineProperty(this,t,{get(){let e=Reflect.get(this.#n,t);return r?.get?r?.get():e},set(e){r?.set?r?.set(e):Reflect.set(this.#n,t,e)}})})),Reflect.defineProperty(this.#r,"__isData",{enumerable:!1,value:!0}),this.#n=L(this.#r,this);let r=t.get(this.constructor,s.COMPUTED);t.each(r,((e,t)=>{w.startCollect(this,n.COMPUTED),w.setUpdater((()=>{this.#n[t]=e.call(this)})),this.#r[t]=e.call(this),w.endCollect(),Reflect.defineProperty(this,t,{get(){return Reflect.get(this.#n,t)},set(e){l(this.tagName,"Cannot set a computed property '"+t+"'")}})}));let o=t.get(this.constructor,s.WATCH);t.each(o,((e,r)=>{e.forEach((e=>{let{source:n,options:s,handler:o}=e,i=o.bind(this);t.get(s,"once",!1)&&(i=t.once(i));const a=function(e){let r=t.get(this,n.replaceAll(P,"."));i(r,e,n)}.bind(this);let l=t.get(s,"deep",!1);if(a.deep=l,w.collectWatch(this,(()=>a),r),!t.get(s,"immediate",!1))return;let c=t.get(this,n.replaceAll(P,"."));i(c,c,n)}))}));let i=function(e,r){let n,s=[];if(Re.has(r.constructor)){let o=Re.get(r.constructor),i=function(e,r){let n=t.concat(r.vars),s=r.strings.length-1;for(let o=0;o<=s;o++){let s=t.get(r.vars,o,"");if(s instanceof tt){let[t,r]=Fe(e,s);n.splice(o,1,...r)}}return n}(r,e);n=Le.has(r.constructor)?function(e,r,n){let s=Le.get(n.constructor)?.cloneNode(!0),o=Ue.get(n.constructor);const i=document.createNodeIterator(s,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let a,l,c=0,u=0;for(;a=i.nextNode();){let s;if(u++,l&&!l.contains(a)&&(l=void 0),a instanceof HTMLElement||a instanceof SVGElement){a instanceof G&&(l=a);let i={};o[u].forEach((o=>{let u=r[c++];switch(o.type){case je.Event:s=t.clone(o.up),o.value||c--,o.value&&_e(o.name,u.bind(n),a,n),a.removeAttribute(o.attrName);break;case je.AttrSlot:l&&o.name,a.removeAttribute(o.attrName);break;case je.Ref:s=t.clone(o.up),u.current=a,a.removeAttribute(o.attrName);break;case je.AttrKey:s=t.clone(o.up),a.setAttribute(ke,u);break;case je.AttrBool:s=t.clone(o.up),s.value=!!u,s.node=a,s.value&&a.setAttribute(o.name,""),a.removeAttribute(o.attrName);break;case je.AttrProp:s=t.clone(o.up),s.value=u,s.node=a,i[o.name]=u,o.attrName&&a.removeAttribute(o.attrName);break;case je.AttrRef:case je.Attr:s=t.clone(o.up),s.value=u,s.node=a,a.setAttribute(o.attrName,u),je.AttrRef===o.type&&a.removeAttribute(o.name);break;case je.DirectiveAttr:case je.DirectiveTag:case je.DirectiveProp:s=t.clone(o.up),s.value=u,s.node=a;let e=t.clone(o.point);e.startNode=a;let[r,d,p,h,f]=u,g=$e.get(a);if(g||(g={},$e.set(a,g)),g[o.attrName??Symbol.keyFor(r)]=[e,n,l],p(e,d,void 0,{renderComponent:n,slotComponent:l,varChain:f}),je.DirectiveAttr===o.type){let e=a.getAttribute(o.attrName);e=t.replace(e,ze,""),a.setAttribute(o.attrName,e)}o.name&&a.removeAttribute(o.name)}s&&e.push(s)})),a instanceof G?(a._initProps(i),a._regWrapper(n)):a instanceof HTMLSlotElement&&n._bindSlot(a,a.name||"default",i)}else{o[u].forEach((o=>{let i=r[c++];switch(o.type){case je.DirectiveSlot:case je.DirectiveText:s=t.clone(o.up),s.value=i,s.node=a;let[e,r,c,u,d]=i,p=Symbol.keyFor(e),h=document.createComment(`compelem-${n.tagName}-${p}-start`);s.textNode=h,a.parentNode.insertBefore(h,a),a.nodeValue=`compelem-${n.tagName}-${p}-end`;let f=t.clone(o.point);f.startNode=h,f.endNode=a,Be.set(a,[f,n,l,r,d]),Ie.set(a,c),Ve.set(a,s),w.startRender(a);let g=c(f,r,void 0,{renderComponent:n,slotComponent:l,varChain:d});w.endRender(n);let m=qe(a,g[1],n);m&&m.length>0&&Je.insertBefore(a,Array.from(m));break;case je.Text:s=t.clone(o.up),s.node=a;let y=t.toString(i??""),v=document.createTextNode(y);a.replaceWith(v),s.textNode=v}s&&e.push(s)}))}}return s.childNodes}(s,i,r):Qe(s,o,i,r)}else{let[t,o]=Fe(r,e);Re.set(r.constructor,t),n=Qe(s,t,o,r)}return We.set(r,s),n}(this.render(),this);i&&(this.#o.append(...i),this.#u=t.filter(this.#o.childNodes,(e=>e.nodeType===Node.ELEMENT_NODE)),this.#c=this.#u[0]),t.each(this.#h,((e,t)=>{this.#_(t)}));const a=this;let c=t.get(this.constructor,g);c&&c.sort(((e,t)=>t.priority-e.priority)).forEach((e=>{e.beforeMount(this,((e,t)=>(a.#n[e]=t,a.#n[e])))}));let u=t.get(this.constructor,"hostStyles"),d=this.#p?.shadowRoot??this.ownerDocument,p=F.get(d);if(!p?.includes(this.constructor)&&u.length>0){let e=[];t.each(u,(r=>{if(t.isString(r)){let t=new CSSStyleSheet;t.replaceSync(r),e.push(t)}else e.push(r)})),d.adoptedStyleSheets=[...d.adoptedStyleSheets,...e],p?.push(this.constructor)}this.beforeMount();let h=t.get(this.constructor,s.EVENTS);h&&h.forEach((async e=>{let r=e.name,n=t.assign({target:document,once:!1,passive:!1,capture:!1},e.options),s=t.bind(e.fn,this),o=n.target;t.isFunction(o)&&(o=await o.call(this,this)),o?o.addEventListener(r,s,n):l(this.tagName,"The target of @event('"+r+"',...) is invalid")})),w.startCollect(this,n.CSS);let f=[];this.styles.forEach((e=>{if(!t.isFunction(e))return;let r=new CSSStyleSheet;f.push(r),w.setUpdater((()=>{let t=e()??"";r.replaceSync(t)}));let n=e();t.isBlank(n)||r.replaceSync(n)})),w.endCollect(),f.length>0&&(this.#o.adoptedStyleSheets=[...this.#o.adoptedStyleSheets,...f]),setTimeout((()=>{this.#f=!0,this.mounted(),c&&c.forEach((e=>{e.mounted(this,((e,t)=>(a.#n[e]=t,a.#n[e])))}))}),0),this.#y=!0}propsReady(e){}render(){throw Error(`[CompElem <${this.tagName}>] Missing render()`)}beforeMount(){}mounted(){}#N(e,r){this.#b();let n=t.get(this.#t[r],"props");n&&t.each(this.slots,((e,r)=>{e.filter((e=>e.nodeType===Node.ELEMENT_NODE)).forEach((e=>{e instanceof G?e._updateProps(n):t.each(n,((r,n)=>{if(e instanceof HTMLSlotElement){let s=t.get(e,"__l_comp");if(s){let t=e.name||"default",o=s.#t[t];o||(o=s.#t[t]={props:{}}),o.props||(o.props={}),o.props[n]=r,s.#N(e,t)}}else e.setAttribute(n,r)}))}))})),this.slotChange(e,r)}slotChange(e,t){}attributeChangedCallback(e,r,n){if(Object.is(n,r))return;let o=t.camelCase(e);if(d(t.get(this.constructor,[s.PROPS,o]).type)){let e=p(n);if(t.get(this,o)===e)return}this.#A(e,r,n)}shouldUpdate(e){return!0}updated(e){}#P={};_notify(e,r){let n=[];for(let s=0;s<r.length;s++){const o=r[s];n.push(o);let i=t.get(this,n),a=c(n);this.#s[a]={value:i,chain:"slots"===a?["slots"]:n,oldValue:e,end:n.length===r.length}}return this.#E}#T(){if(t.size(this.#s)<1)return;const e=this.#s;this.#s={};const r=Object.keys(e);let n=t.get(this.constructor,g);if(n&&n.sort(((e,t)=>t.priority-e.priority)).forEach((t=>{t.updated(this,e)})),!this.shouldUpdate(e))return;let s=new Set;const o=this.#i;t.each(e,(({value:e,chain:t,oldValue:r,end:n},i)=>{o[i]&&o[i].forEach((e=>{s.add(e)}))})),s.forEach((e=>{e===this?Xe(this.render(),this,void 0,r):Ye(e,this)})),this.#w.forEach((e=>{this.#_(e)})),this.updated(e)}#S(){let e=t.get(this.constructor,s.PROPS),r=this.attributes,n=this.tagName,o=this.#l,i={};t.each(r,(({name:r,value:n})=>{if(r[0]===Ne||r[0]===Ae||r[0]===Pe||r===Me||"slot"===r)return;let s=t.camelCase(r);e&&!e[s]&&(i[r]=n)})),this.#a=this.#a?t.assign(this.#a,i):i;let a={};if(!e)return Object.seal(a);let c=Object.keys(e),u=c.length;for(let s=0;s<u;s++){const i=c[s],u=t.kebabCase(i),d=this.hasAttribute(u);let p,h=e[i],f=t.has(o,i),g=t.get(this,i);if(!("_defaultValue"in h)&&(h._defaultValue=g,!h.type)){t.isUndefined(g)&&l(n,"Prop '"+i+"' has neither propType nor defaultValue be used for type inference");let e=typeof g;t.isArray(g)&&(e="array");let r=H[e];h.type=r}if(f)p=t.isNil(o[i])?g:o[i];else{p=g;let e=r.getNamedItem(u)||r.getNamedItem(Ae+u);e&&(f=!0,p=e.value)}if(h.required&&!f){l(n,"Prop '"+i+"' is required");break}p=this.#D(e,i,p,d);let m=t.get(e,[i,"getter"]);m&&(m=t.bind(m,this));let y=t.get(e,[i,"setter"]);y&&(y=t.bind(y,this)),(m||y)&&Reflect.defineProperty(this.#r,i,{set:y||function(e){},get:m}),h.attribute&&t.isDefined(p)&&!t.isObject(p)&&this.#M(h,i,p),this.#r[i]=p,a[i]=p}return Object.seal(a)}#M(e,r,n){let s=t.kebabCase(r),o=t.trim(n);d(e.type)?(o=p(n),t.isBoolean(o)?o&&!this.hasAttribute(s)?this.toggleAttribute(s,!0):!o&&this.hasAttribute(s)&&this.toggleAttribute(s,!1):this.getAttribute(s)!==o&&this.setAttribute(s,o)):this.getAttribute(s)!==o&&this.setAttribute(s,o)}#k(e,r){let n=e;try{for(let s=0;s<r.length;s++){const o=r[s];n=o===Boolean?p(e):o===Number?Number(e):o===String?String(e):o===Object||o===Array?t.parseJSON(e):o===Date?new Date(e):new o(e)}}catch(t){l(this.tagName,"Convert attribute error with "+e)}return n}#D(e,r,n,s){let o=e[r];if(!o)return n;let i=o.isValid,a=o.type,c=t.isArray(a)?a:[a],u=o.converter,d=n;if(!t.some(c,(e=>e===String))&&t.isString(d)&&!t.isNull(d))try{d=u?u(d):this.#k(d,c)}catch(e){l(this.tagName,`Convert attribute '${r}' error with `+d)}for(let e=0;e<c.length;e++){"Boolean"===c[e].name&&s&&(d=p(d))}if(t.isNil(d))return d;let h=typeof d,f=!t.isDefined(d);for(let e=0;e<c.length;e++){const r=c[e];if(t.test(h,r.name,"i")||d instanceof r||Object.prototype.toString.call(d)===Object.prototype.toString.call(r.prototype)){f=!0;break}}return f||l(this.tagName,`Invalid prop '${r}'. expected '${c.map((e=>e.name||e))}' but got '${h}'`),i&&(i.call(this,d,this.#r)||l(this.tagName,`Invalid prop '${r}'. IsValid() check failed`)),d}#C(){let e=t.get(this.constructor,s.STATES);t.each(e,((r,n)=>{let s=e[n],o=t.get(this,n);if(s){let e=s.prop;o=e?t.cloneDeep(this.#r[e]):t.get(this,n)}this.#r[n]=o}))}#O=t.debounce(this.propsReady,100);_updateProps(e){let r=t.get(this.constructor,s.PROPS),n=[];t.each(e,((e,s)=>{let o=t.camelCase(s),i=r[o];i&&(e=this.#D(r,o,e),i.attribute&&t.isDefined(e)&&!t.isObject(e)&&n.push([i,o,e]),w.__skipCheck=!0,t.set(this,o,e),w.__skipCheck=!1)})),t.assign(this.#l,e),n.forEach((([e,t,r])=>{this.#M(e,t,r)})),this.#O(this.#l)}_initProps(e,r){this.#l=t.merge(this.#l||{},e),this.#a=t.merge(this.#a||{},r)}_bindSlot(e,r,n){if(this.#g[r]||(this.#g[r]=e,Reflect.defineProperty(e,"__l_comp",{value:this})),e.addEventListener("slotchange",(t=>{this.#y&&this.#N(e,"default"===r?"":r)})),!t.isEmpty(n)){let e=this.#t[r];e||(e=this.#t[r]={}),e.props=n}}_bindSlotHook(e,t){this.#h[e]=t}#w=new Set;_updateSlot(e,t,r){let n=this.#g[e],s=this.#h[e];if(!s&&!n)return;let o=this.#t[e];if(t&&(o.props||(o.props={}),o.props[t]=r),s)this.#w.add(e);else{let e=n.assignedElements({flatten:!0});for(let n=0;n<e.length;n++){e[n].setAttribute(t,r+"")}}}#b(){const e=t.flatMap(this.childNodes,(e=>e.nodeType===Node.COMMENT_NODE?[]:e instanceof HTMLSlotElement?e.assignedNodes({flatten:!0}):e));let r=t.groupBy(e,(e=>e.nodeType===Node.TEXT_NODE?"default":e instanceof Element?e.getAttribute("slot")||"default":void 0));if(t.isEmpty(r))return void(t.isEmpty(this.#r["#slots"])||(this.#y?this.#n["#slots"]={}:this.#r["#slots"]={}));t.each(r,((e,r)=>{if(r){for(;e.length>0;){let r=e[0];if(!(r.nodeType===Node.TEXT_NODE&&t.isBlank(r.textContent)||r instanceof HTMLSlotElement&&t.isEmpty(r.assignedNodes({flatten:!0}))))break;e.shift()}for(;e.length>0;){let r=t.last(e);if(!(r.nodeType===Node.TEXT_NODE&&t.isBlank(r.textContent)||r instanceof HTMLSlotElement&&t.isEmpty(r.assignedNodes({flatten:!0}))))break;e.pop()}}}));let n={};t.each(r,((e,r)=>{t.isEmpty(e)||(n[r]=e)})),this.#y?this.#n["#slots"]=n:this.#r["#slots"]=n}#_(e){let r=this.#h[e];if(!r)return;let n=this.#t[e];if(!this.#r["#slots"][e])return;this.renderAsync(r,t.get(n,"props"));const s=this._asyncDirectives.get(r);let o=s?.buildView(r(t.get(n,"props"))),i=t.reject(t.toArray(o),(e=>e.nodeType===Node.COMMENT_NODE));if(i){let r=this.#m[e];if(!t.isEmpty(r))for(let e=0;e<r.length;e++){const t=r[e];t.parentNode?.removeChild(t)}this.#m[e]=i,this.append(...i),this.#w.clear()}}_asyncDirectives=new WeakMap;renderAsync(e,...t){}#A(e,r,n){if(!this.#y)return;if(C(this.constructor).has(e)){let r=t.camelCase(e);if(t.isNull(n)){n=t.get(this.constructor,s.PROPS)[r]._defaultValue}this._updateProps({[r]:n})}}_regDeps(e,t){let r=this.#i[e];r||(r=this.#i[e]=new Set),r.add(t);let n=e.split(P);if(n.pop(),n.length<1)return;let s=n.join(P);r=this.#i[s],r||(r=this.#i[s]=new Set),r.add(t)}_regWrapper(e){this.#p=e}_getPrivateData(){return this.#r}emit(e,r={},n){n&&n.event&&(r.event=n.event),r.target=this,this.dispatchEvent(new CustomEvent(e,{bubbles:t.get(n,"bubbles",!1),composed:t.get(n,"composed",!1),cancelable:!0,detail:r}))}on(e,t){this.#P[e]||(this.#P[e]=[]);let r=t.bind(this);this.#P[e].push(r),this.addEventListener(e,r)}nextTick(e,t){W.pushNext(e,t)}forceUpdate(){t.each(this.#n,((e,t)=>{this.#s[t]={value:void 0,chain:void 0}})),this.#T()}}class z{startNode;endNode;type;attrName;varIndex;expressionChain;nodes;constructor(e,t,r){this.startNode=e,this.attrName=t,this.type=r}setVarIndex(e){this.varIndex=e}getNodes(){let e=this.startNode.nextSibling;if(!this.endNode)return[e];let t=[];for(;e&&e!==this.endNode;)t.push(e),e=e?.nextSibling;return t}}var Q;!function(e){e.AFTER_BEGIN="afterbegin"}(Q||(Q={}));const q={};function X(r,n,s,o,i,l,c,u=!1){let d;if(u?(w.startRender(r.endNode),d=o(r,n,s,{renderComponent:i,slotComponent:l,varChain:c}),w.endRender(i)):d=o(r,n,s,{renderComponent:i,slotComponent:l,varChain:c}),!d)return;let[p,h]=d;if(p===e.DirectiveUpdateTag.NONE)return;let f=r.getNodes();if(p===e.DirectiveUpdateTag.REMOVE)for(let e=0;e<f.length;e++){const t=f[e];t.parentNode?.removeChild(t)}else if(p===e.DirectiveUpdateTag.REPLACE){let e=[];for(let e=0;e<f.length;e++){const t=f[e];t.parentNode?.removeChild(t)}let n=qe(r.endNode,h,i);e=t.toArray(n);let s=document.createDocumentFragment();s.append(...e),r.endNode.parentNode.insertBefore(s,r.endNode)}else if(p===e.DirectiveUpdateTag.UPDATE){let e,n={},s=[],o=[],l=He.get(r.endNode);if(h||(h=new tt([],[])),t.isEmpty(f)){let e=qe(r.endNode,h,i);return void r.startNode.after(...e)}let c={};h instanceof tt&&h.vars.forEach((e=>{if(e instanceof tt){const t=e.getKey();c[t]=e,n[t]=!0,o.push(t)}})),f=t.filter(t.compact(f),(e=>e.nodeType===Node.ELEMENT_NODE)),e=t.filter(t.compact(t.toArray(e)),(e=>e.nodeType===Node.ELEMENT_NODE));let u={},d="",p={};for(let e=0;e<f.length;e++){let t=f[e],r=t.getAttribute("key");if(r){if(u[r]){d=r;break}u[r]=t,s.push(r),p[r]=!0}}if(d)return void a(`${t.camelCase(r.endNode._diName)} - duplicate key '${d}'`);let g=n;const m=r.startNode.parentNode;let y=[],v=[];t.each(p,((e,r)=>{g[r]||(v.push(r),delete p[r],t.remove(s,(e=>e===r)))}));let b,E=!1;if(!t.isEmpty(o)){let e=-1,n=[],i=[],a=0,l=0;for(;l<o.length;l++){const c=o[l];let d=s.findIndex((e=>e===c));if(d<0){let e=o[l-1],t=e?u[e]||e:r.startNode;y.push({prevNode:t,newkey:c}),a++}else if(d>-1&&d!==l-a){if(e<0||1===Math.abs(e-d)){let e=t.last(n);n.push({nodeId:c,targetId:0===l?Q.AFTER_BEGIN:e?e.nodeId:o[l-1]})}else i.push({moveGroup:n,moveIndex:l+n.length}),n=[],n.push({nodeId:c,targetId:o[l-1]});e=d}}if(n.length>0&&i.push({moveGroup:n,moveIndex:l+n.length}),i.length>0){E=!0;let e=i.sort(((e,t)=>e.moveGroup.length-t.moveGroup.length));if(e.length<2){let{moveGroup:n}=e[0];if(n.length>1){let e=t.last(n).targetId;n[n.length-2].nodeId===e&&(n=t.initial(n))}n.forEach((({targetId:e,nodeId:t})=>{let n,s=u[t];e===Q.AFTER_BEGIN?(n=r.startNode,n.after(s)):(n=u[e],n.after(s))}))}else{let n=t.last(e).moveIndex;1===Math.abs(e[e.length-2].moveIndex-n)&&(e=t.initial(e)),e.forEach((({moveGroup:e})=>{e.forEach((({targetId:e,nodeId:t})=>{let n,s=u[t];e===Q.AFTER_BEGIN?(n=r.startNode,n.after(s)):(n=u[e],n.after(s))}))}))}}}if(y.length>0&&(b=function(e,r,n,s,o,i){const a=[],l=[],c=[];let u,d=[];e.forEach((e=>{let n=t.last(d);n&&u===e.prevNode?(n.group||(n.group=[u]),n.group.push(e.newkey)):d.push(e),u=e.newkey;let s=e.newkey;c.push(s),a.push(""),l.push(r[s])})),a.push("");let p=new tt(a,l),h=[...o],f=qe(i,p,s),g=He.get(i);o.length=0,o.push(...g);let m=new Map;return f.forEach((e=>{const t=e.getAttribute("key");c.includes(t)&&(m.set(t,!0),q[t]=e)})),h.forEach(((e,t)=>{const r=e.key+"";!m.get(r)&&n.includes(r)&&o.push(e)})),d}(y,c,o,i,l,r.endNode),b.forEach(((e,n)=>{let s=e.newkey,o=q[s],i=e.prevNode;if(e.group){let r=document.createDocumentFragment();r.append(...t.map(e.group,(e=>q[e]))),o=r}i===r.endNode?i.before(o):i===r.startNode?i.after(o):"string"==typeof i?q[i].after(o):i.after(o)}))),v.forEach((e=>{let t=u[e];t&&t.parentNode&&m.removeChild(t)})),h.vars[0]instanceof tt){let e=[],r=[];t.each(h.vars,(n=>{r.push(...n.vars),e.push(...t.map(n.vars,(e=>"1")))})),e.push("1"),h=new tt(e,r)}if(E||v.length>0||b){const e=t.groupBy(l,(e=>e.key));let r=[],n=0;o.forEach((t=>{e[t].forEach((e=>{e.varIndex=n++,r.push(e)}))})),l=r}Ye(r.endNode,i,h,l)}}let Y=0;function J(e,t){let r=e.name||"Di-"+Y++,n=Symbol.for(r);return(...t)=>{let r=e(...t);return[n,t,r,e=>{},w.popDirectiveQ()]}}const Z=["resize","outside","mutate"],ee=new WeakMap,te=[],re=[],ne=[],se=new ResizeObserver((e=>{for(const t of e){const e=Array.isArray(t.contentBoxSize)?t.contentBoxSize[0]:t.contentBoxSize,r=Array.isArray(t.borderBoxSize)?t.borderBoxSize[0]:t.borderBoxSize;let n=ee.get(t.target);if(n){n(new CustomEvent("resize",{bubbles:!1,cancelable:!1,detail:{borderBox:{w:r.inlineSize,h:r.blockSize},contentBox:{w:e.inlineSize,h:e.blockSize}}}),t.target)}}}));var oe;!function(e){e.Child="child",e.Tree="tree",e.Attr="attr",e.Char="char"}(oe||(oe={}));const ie=new WeakMap,ae=new MutationObserver((e=>{for(let t=0;t<e.length;t++){const r=e[t];let n=ie.get(r.target);if(!n)return;let s={target:r.target},o=null;switch(r.type){case"subtree":s.type=oe.Tree,o=n[oe.Tree];break;case"childList":s.type=oe.Child,s.addedNodes=r.addedNodes,s.removedNodes=r.removedNodes,o=n[oe.Child];break;case"attributes":s.type=oe.Attr,s.attributeName=r.attributeName,s.oldValue=r.oldValue,o=n[oe.Attr];break;case"characterData":s.type=oe.Char,s.oldValue=r.oldValue,o=n[oe.Char]}if(o){o(new CustomEvent("mutate",{bubbles:!1,cancelable:!1,detail:s}))}}}));function le(e,r,n,s){if("resize"===e)!function(e,t){ee.has(e)||(ee.set(e,t),se.observe(e))}(r,n);else if("outside"===e)switch(s[0]){case"mousedown":!function(e,t){te.push([e,t])}(r,n);break;case"dblclick":!function(e,t){ne.push([e,t])}(r,n);break;default:!function(e,t){re.push([e,t])}(r,n)}else"mutate"===e&&function(e,r,n){let s=t.includes(n,"child"),o=t.includes(n,"attr"),i=t.includes(n,"char"),a=t.includes(n,"tree"),l=ie.get(e);l||(l={},ie.set(e,l),s&&(l[oe.Child]=r),o&&(l[oe.Attr]=r),i&&(l[oe.Char]=r),a&&(l[oe.Tree]=r),ae.observe(e,{childList:s,attributes:o,characterData:i,subtree:a}))}(r,n,s)}document.addEventListener("mousedown",(e=>{let r=t.get(e.composedPath(),0,e.target);te.forEach((([n,s])=>{if(!n.contains(r)&&!n.contains(t.closest(r,(e=>e instanceof ShadowRoot),"parentNode")?.host)){s(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:n,event:e}}),n)}}))}),!1),document.addEventListener("click",(e=>{let r=t.get(e.composedPath(),0,e.target);re.forEach((([n,s])=>{if(!n.contains(r)&&!n.contains(t.closest(r,(e=>e instanceof ShadowRoot),"parentNode")?.host)){s(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:n,event:e}}),n)}}))}),!1),document.addEventListener("dblclick",(e=>{let r=t.get(e.composedPath(),0,e.target);ne.forEach((([n,s])=>{if(!n.contains(r)&&!n.contains(t.closest(r,(e=>e instanceof ShadowRoot),"parentNode")?.host)){s(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:n,event:e}}),n)}}))}),!1);const ce=/,|^(debounce:.+)|(debounce$)/,ue=/,|^(throttle:.+)|(throttle$)/,de="self",pe="stop",he="prevent",fe="once",ge="left",me="right",ye="middle",ve="ctrl",be="alt",Ee="shift",Te="meta",Se={esc:"escape"},Ce=":";function _e(e,r,n,s){let o,i=e.split("."),a=i.shift(),l=i.includes(fe),c=r;if(o=t.find(i,(e=>ce.test(e)))){let e=o.split(Ce);c=t.debounce(c,parseInt(e[1])||100)}if(o=t.find(i,(e=>ue.test(e)))){let e=o.split(Ce);c=t.throttle(c,parseInt(e[1])||100)}if(l&&(c=t.once(c)),function(e){return Z.includes(e)}(a))return le(a,n,c,i),c;let u=e=>{if(i.includes(he)&&e.preventDefault(),i.includes(pe)&&e.stopPropagation(),!i.includes(de)||e.target===e.currentTarget){if(e instanceof MouseEvent){if(i.includes(ge)&&0!=e.button)return;if(i.includes(me)&&2!=e.button)return;if(i.includes(ye)&&1!=e.button)return}else if(e instanceof KeyboardEvent){if(t.remove(i,(e=>e==ve))[0]&&!e.ctrlKey)return;if(t.remove(i,(e=>e==be))[0]&&!e.altKey)return;if(t.remove(i,(e=>e==Ee))[0]&&!e.shiftKey)return;if(t.remove(i,(e=>e==Te))[0]&&!e.metaKey)return;if(!t.map(i,(e=>Se[e]||e)).includes(e.key.toLowerCase()))return}c(e)}};n.addEventListener(a,u);let d=s.__events[a];return d||(d=s.__events[a]=[]),d.push([n,u]),u}const Ne="@",Ae=".",Pe="?",we="*",De=":",Me="ref",ke="key",Oe=/<\s*[a-z0-9-]+([^>]*<\!--c_ui-pl_df-->)*[^>]*?(?<!-)>/gims,xe="slot-props",Re=new Map,Le=new Map,Ue=new Map;var je;!function(e){e.Event="event",e.Directive="directive",e.DirectiveTag="directiveTag",e.DirectiveAttr="directiveAttr",e.DirectiveProp="directiveProp",e.DirectiveText="directiveText",e.DirectiveSlot="directiveSlot",e.Attr="attr",e.AttrProp="attrProp",e.AttrBool="attrBool",e.AttrRef="attrRef",e.AttrSlot="attrSlot",e.AttrKey="key",e.Ref="ref",e.Text="text"}(je||(je={}));const We=new WeakMap,He=new WeakMap,Ie=new WeakMap,Be=new WeakMap,Ve=new WeakMap,$e=new WeakMap;function Fe(e,r){let n="",s=t.concat(r.vars),o=r.strings.length-1,i=r.vars.length-1,a=0;for(let l=0;l<=o;l++){const o=r.strings[l];let c=t.get(s,a,"");if(c instanceof tt){let[t,r]=Fe(e,c);c=t,s.splice(a,1,...r),a+=r.length-1}else c=l>i?"":Ke;a++,n=n+o+c}let l=0;return n=n.replace(Oe,((e,r)=>t.replaceAll(e,Ke,(()=>Ke.replace("--\x3e","")+l++)))),n=n.replace(et,"$1><").trim(),[n,s]}const Ke="\x3c!--c_ui-pl_df--\x3e",Ge="\x3c!--c_ui-pl_df",ze=/<!--c_ui-pl_df\d*(-->)?/;function Qe(r,n,s,o,i=!1){const a=document.createElement("div");a.innerHTML=n;const l=Ue.has(o.constructor);i||!l||Le.has(o.constructor)||Le.set(o.constructor,a.cloneNode(!0));let c=0;const u=document.createNodeIterator(a,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let d,p,h=0,f=l?void 0:{},g=null,m="";for(;d=u.nextNode();){c++;let n=l?void 0:[];if(p&&!p.contains(d)&&(p=void 0),d instanceof HTMLElement||d instanceof SVGElement){d instanceof G&&(p=d);let i={},a=t.toArray(d.attributes);for(let l=0;l<a.length;l++){const c=a[l];let{name:u,value:f}=c;if(u!==xe)if(t.startsWith(u,Ge)){let i=s[h];if(t.isArray(i)&&t.isSymbol(i[0])){let[,t,s,a,l]=i;a(e.EnterPointType.TAG);let c=new z(d,u.substring(1),e.EnterPointType.TAG),f=$e.get(d);f||(f={},$e.set(d,f)),f[Symbol.keyFor(i[0])]=[c,o,p];let y=new A(h,d);y.isDirective=!0,y.value=i,y.isComponent=!!p,r.push(y),g&&g?.contains(d)&&(y.key=m),h++,s(c,t,void 0,{renderComponent:o,slotComponent:p,varChain:l}),n&&n.push({type:je.DirectiveTag,point:c,up:y,name:u})}d.removeAttribute(u)}else if(u[0]!==Ne)if(u!==Me)if(u!==ke){if(ze.test(f)){let a=s[h],l=new A(h,d,u.replace(/\.|\?|@/,""),f);if(l.isComponent=!!p,g&&g?.contains(d)&&(l.key=m),u[0]===Ae||u[0]===Pe||u[0]===we){if(t.isArray(a)&&t.isSymbol(a[0])){let[,t,r,s,i]=a;s(e.EnterPointType.PROP);let c=u.substring(1),h=new z(d,c,e.EnterPointType.PROP),f=$e.get(d);f||(f={},$e.set(d,f)),f[c]=[h,o,p],r(h,t,void 0,{renderComponent:o,slotComponent:p}),l.value=a,l.isDirective=!0,n&&n.push({type:je.DirectiveProp,up:l,point:h,name:u,attrName:c})}else if(u[0]===Pe){l.isToggleProp=!0,l.value=!!a;let e=u.substring(1);l.value&&d.setAttribute(e,""),n&&n.push({type:je.AttrBool,name:e,up:l,attrName:u})}else if(u[0]===we){l.value=a;let e=u.substring(1);const[r,s]=e.split(De);let o=r;switch(s){case"camel":o=t.camelCase(o);break;case"kebab":o=t.kebabCase(o);break;case"snake":o=t.snakeCase(o)}l.attrName=o,d.setAttribute(o,a),n&&n.push({type:je.AttrRef,up:l,name:u,attrName:o})}else{let e=t.camelCase(u.substring(1)),r=M.get(a);r&&(d._propObjectKeyMap[r.join(P)]=e),l.value=a,l.isProp=!0,i[e]=a,n&&n.push({type:je.AttrProp,up:l,name:e,attrName:u})}d.removeAttribute(u),a=""}else{let r,s;l.value=a;let i={type:je.Attr,up:l,attrName:u};if(t.isArray(a)&&t.isSymbol(a[0])){let t=e.EnterPointType.ATTR;"class"===u?t=e.EnterPointType.CLASS:"style"===u&&(t=e.EnterPointType.STYLE);let[,n,c,h,f]=a;h(t),l.isDirective=!0,l.attrName=u;let g=new z(d,u,t),m=$e.get(d);m||(m={},$e.set(d,m)),m[u]=[g,o,p],s=n,r=c,a="",i.type=je.DirectiveAttr,i.point=g}f=t.replace(f,ze,a),c.value=f,r&&r(i.point,s,void 0,{renderComponent:o,slotComponent:p}),n&&n.push(i)}r.push(l),h++}}else{let e=s[h];d.setAttribute(u,e);let t=new A(h,d);t.notUpdated=!0,g&&g?.contains(d)&&(t.key=m),r.push(t),h++,g=d,m=e,n&&n.push({up:t,type:je.AttrKey}),r.length>0&&r.forEach((t=>{t.key=t.key??e}))}else{if(ze.test(f)){let e=s[h],t=new A(h,d);t.notUpdated=!0,g&&g?.contains(d)&&(t.key=m),r.push(t),h++,e.current=d,n&&n.push({type:je.Ref,up:t,attrName:u})}d.removeAttribute(u)}else{let e=e=>{},t=null,i=!1;if(ze.test(f)){t=new A(h,d),t.notUpdated=!0,g&&g?.contains(d)&&(t.key=m),r.push(t),e=s[h].bind(o),h++,i=!0}let a=u.substring(1);_e(a,e,d,o),d.removeAttribute(u),n&&n.push({type:je.Event,up:t,name:a,attrName:u,value:i})}else{let e=d.getAttribute("name")||"default";n&&n.push({type:je.AttrSlot,name:e,attrName:u})}}d instanceof G?(d._initProps(i),d._regWrapper(o)):d instanceof HTMLSlotElement&&o._bindSlot(d,d.name||"default",i)}else{let i=d;if(`\x3c!--${i.nodeValue}--\x3e`!==Ke)continue;let a=new A(h,d);g&&g?.contains(d)&&(a.key=m),r.push(a),a.isComponent=!!p,a.isText=!0;let l=s[h];if(t.isArray(l)&&t.isSymbol(l[0])){const t=Symbol.keyFor(l[0]);let r;r=document.createComment(`compelem-${o.tagName}-${t}-start`),a.textNode=r,i.parentNode.insertBefore(r,i),i.nodeValue=`compelem-${o.tagName}-${t}-end`,i._diName=t,a.isDirective=!0,a.value=l;let s=p?e.EnterPointType.SLOT:e.EnterPointType.TEXT,[,c,u,d,h]=l;d(s);let f=new z(r,"",s);f.endNode=i,Be.set(i,[f,o,p,c,h]),Ie.set(i,u),Ve.set(i,a),w.startRender(i);let g=u(f,c,void 0,{renderComponent:o,slotComponent:p,varChain:h});if(w.endRender(o),g){let e=qe(i,g[1],o);e&&e.length>0&&Je.insertBefore(i,Array.from(e))}l=void 0,n&&n.push({type:s===e.EnterPointType.SLOT?je.DirectiveSlot:je.DirectiveText,up:a,point:f})}else a.value=l,n&&n.push({type:je.Text,up:a});h++;let c=t.toString(l??""),u=document.createTextNode(c);i.parentNode.insertBefore(u,i),a.textNode=u}f&&n&&(f[c]=n),g&&!g.contains(d)&&g!==d&&(g=null,m="")}return!i&&f&&Ue.set(o.constructor,f),a.childNodes}function qe(e,t,r){let[n,s]=Fe(r,t),o=[],i=Qe(o,n,s,r,!0);return He.set(e,o),i}function Xe(r,n,s,o){if(t.isBlank(t.join(r.strings)))return;if(!We.has(n))return;let i=r.flatVars(n);s=s??We.get(n);for(let r=0;r<s.length;r++){const a=s[r];let l=a.varIndex;if(l<0)continue;if(a.notUpdated)continue;let c=a.value,u=i,d=a.node,p=t.split(l,P);for(let e=0;e<p.length;e++){const n=p[e];u=t.get(u,n),u&&u.vars&&r<p.length-1&&(u=u.vars)}if(!t.isObject(c)&&c===u)continue;let h=d;if(a.isDirective){let[t,r,n,,s]=a.value,o=Be.get(d);if(!o){const e=$e.get(d);o=e[a.attrName]||e[Symbol.keyFor(t)]}let[i,l,c]=o,[,p]=u;const h=Ve.get(d);if(h){h.value=u;Be.get(d)[3]=p}X(i,p,r,n,l,c,s,i.type==e.EnterPointType.TEXT||i.type==e.EnterPointType.SLOT)}else if(a.isToggleProp){if(!!u===c)continue;h.toggleAttribute(a.attrName,!!u),t.set(h,a.attrName,!!u)}else if(a.isProp){if(!t.isObject(u)&&u===c)continue;if(d instanceof G)if(t.isObject(u)&&Object.is(u,c)){let e=t.camelCase(a.attrName),r=[e];if(o&&o.length>0){let n="",s=t.join(M.get(a.value),P);o.forEach((e=>{e.startsWith(s)&&e.length>n.length&&(n=e)})),r=t.concat(t.split(n.replace(s,e),P))}U(d,c,r)}else d._updateProps({[a.attrName]:u});else d instanceof HTMLSlotElement&&n._updateSlot(d.getAttribute("name")||"default",a.attrName,u)}else if(a.attrName){if(!t.isEqual(c,u))switch(a.attrName){case"value":if(d instanceof HTMLInputElement){d.value=u;break}default:d.setAttribute(a.attrName,t.replace(a.attrTmpl,ze,u+""))}}else if(a.isText){a.textNode.textContent=t.toString(u??"")}a.value=u}}function Ye(e,r,n,s){const o=Ie.get(e),[i,a,l,c,u]=Be.get(e),d=Ve.get(e);if(!n){let e=o(i,d.value[1],c,{renderComponent:a,slotComponent:l,varChain:u});if(!e)return;n=e[1]}if(n&&n.vars[0]instanceof tt){let e=[],r=[];t.each(n.vars,(n=>{r.push(...n.vars),e.push(...t.map(n.vars,(e=>"1")))})),e.push("1"),n=new tt(e,r)}s&&He.set(e,s),Xe(n,r,s=s??He.get(e))}const Je={insertBefore:function(e,t){if(!e.parentNode)return;let r=document.createDocumentFragment();r.append(...t),e.parentNode.insertBefore(r,e)},remove:function(e,t){if(e===t)return void e?.parentNode?.removeChild(e);let r=e.nextSibling;for(;r&&r!==t;)r?.parentNode?.removeChild(r),r=e.nextSibling}};function Ze(e,...r){return new tt(t.isString(e)?[e]:e,r)}const et=/([a-z0-9"'])\s*>\s*</gim;class tt{strings;vars;constructor(e,r){this.strings=t.concat(e),this.vars=r}getKey(){let e=this.vars,n="";return t.each(this.strings,((s,o)=>{if(r.test(s))return n=t.toString(e[o]),!1})),n}getKeys(){let e=this.vars,n=[];for(let s=0;s<this.strings.length;s++){const o=this.strings[s];if(r.test(o)){let r=t.toString(e[s]);n.push(r)}}return t.isEmpty(n)&&e.forEach((e=>{if(e instanceof tt){let t=e.getKey();n.push(t)}})),n}append(e){let r=t.last(this.strings);return e.strings.forEach(((e,t)=>{0!=t?this.strings.push(e):this.strings[this.strings.length-1]=r+e})),this.vars=t.concat(this.vars,e.vars),this}insert(e,t){let r=t.strings.shift();return this.strings[e]+=r,this.strings.splice(e+1,0,...t.strings),this.vars.splice(e,0,...t.vars),this}getHTML(e){let[r,n]=Fe(e,this),s=Qe([],r,n,e);return t.reduce(s,((e,t)=>e+(t.outerHTML??"")),"")}flatVars(e){let r=t.concat(this.vars),n=this.strings.length-1,s=0;for(let o=0;o<=n;o++){let n=t.get(r,s,"");if(n instanceof tt&&n.vars.length>0){let[t,o]=Fe(e,n);n=t,r.splice(s,1,...o),s+=o.length-1}s++}return r}}const rt=b(class extends h{static get priority(){return Number.MAX_VALUE}created(e,r,n,...s){let o=t.get(e,n);t.set(e,n,t.debounce(o,this.wait,this.immediate));let i=Reflect.getPrototypeOf(e);i&&!t.get(i,n+"_$__")&&t.set(i,n+"_$__",o)}beforeMount(e,t,...r){}mounted(e,t,...r){}updated(e,t){}get targets(){return[e.DecoratorType.METHOD]}wait;immediate;result;constructor(e,t=!1){super(),this.wait=e,this.immediate=t}});const nt=b(class extends h{static get priority(){return Number.MAX_VALUE}created(e,r,n,...s){let o=t.bind(t.get(e,n),e);t.set(e,n,t.once(o));let i=Reflect.getPrototypeOf(e);i&&!t.get(i,n+"_$__")&&t.set(i,n+"_$__",o)}beforeMount(e,t,...r){}mounted(e,t,...r){}updated(e,t){}get targets(){return[e.DecoratorType.METHOD]}wait;result;constructor(){super()}});var st;e.QueryCache=void 0,(st=e.QueryCache||(e.QueryCache={})).ONCE="once",st.UPDATABLE="updatable";class ot extends h{static get priority(){return Number.MAX_VALUE}created(e,t,r,...n){}mounted(e,t,...r){}get targets(){return[e.DecoratorType.FIELD]}selector;cache;result;constructor(e,t){super(),this.selector=e,this.cache=t}static getKey(e){return e}getter(e){this.result=e.shadowRoot?.querySelector(this.selector)}beforeMount(e,t,r,n,...s){const o=this;Reflect.defineProperty(e,n,{get:()=>(o.result&&o.cache||o.getter(e),o.result)})}updated(t,r){this.cache===e.QueryCache.UPDATABLE&&this.getter(t)}}const it=b(ot),at=b(class extends ot{getter(e){this.result=e.shadowRoot?.querySelectorAll(this.selector)}});function lt(e,r,n){if(!t.has(e.constructor,s.STATES)){const r={};let n=e.constructor;for(;(n=u(n))!==G;)t.merge(r,n[s.STATES]?t.cloneDeep(n[s.STATES]):{});Reflect.defineProperty(e.constructor,s.STATES,{configurable:!1,enumerable:!1,value:r})}n.shallow=n.shallow||!1,e.constructor[s.STATES][r]=n}const ct=b(class extends h{static get priority(){return Number.MAX_VALUE}created(e,r,n,...s){let o=t.get(e,n);t.set(e,n,t.throttle(o,this.wait));let i=Reflect.getPrototypeOf(e);i&&!t.get(i,n+"_$__")&&t.set(i,n+"_$__",o)}beforeMount(e,t,...r){}mounted(e,t,...r){}updated(e,t){}get targets(){return[e.DecoratorType.METHOD]}wait;result;constructor(e){super(),this.wait=e}});const ut=["key"],dt=J((function(e){return(e,[r],n)=>{let o=e.startNode;if(n)t.each(r,((e,t)=>{o.setAttribute(t,e)}));else if(o instanceof G){let e={},n={},i=t.get(o.constructor,s.PROPS);t.each(r,((r,s)=>{if(ut.includes(s))return;let o=t.camelCase(s);i[o]?e[s]=r:n[s]=r+""})),o._initProps(e,n)}else t.each(r,((e,t)=>{o.setAttribute(t,e)}))}}),e.EnterPointType.TAG),pt=new Map,ht=J((function(e){return(e,[r],n,{renderComponent:s})=>{let o=[];if(t.isArray(r)?o=t.compact(r):t.isObject(r)?o=t.flatMap(r,((e,t)=>e?t:[])):t.isString(r)&&(o=r.split(" ")),o.length<1&&!n)return;let i=e.startNode;if(pt.get(i)&&pt.get(i).length===o.length&&t.isMatch(pt.get(i),o))return;let a=pt.get(i);t.each(a,(e=>{i.classList.remove(e)})),t.each(o,(e=>{i.classList.add(e)})),a=t.concat(o),pt.set(i,a)}}),e.EnterPointType.CLASS),ft=new Map,gt=new Map,mt=J((function(n,s){return(n,o,i,{varChain:l})=>{let c=n.startNode,u=function(e,n,s){let o=t.map(e,((e,t)=>n(e,t)));if(o.length<1){let e=new tt([],[]);return gt.set(s,e),e}let i=[],l=[];const c=[],u=[];for(let e=0;e<o.length;e++){const n=o[e];let s=t.last(l),d=n.vars,p=!0,h=n.strings;for(let e=0;e<h.length;e++){const t=h[e];if(r.test(t)){let t=d[e]+"";if(i.includes(t))return void a(`forEach - duplicate key '${t}'`);i.push(t),p=!1}0==e&&s?l[l.length-1]=s+t:l.push(t)}if(p)return void a("forEach - missing 'key' prop");let f=t.last(c);f&&h.length>0&&(c[c.length-1]=t.trim(f)+h.shift()),c.push(""),u.push(n)}c.push("");let d=new tt(c,u);return gt.set(s,d),d}(o[0],s,c);if(i&&i[0]){const r=ft.get(c);if(t.isEmpty(n.getNodes())&&(!o||t.isEmpty(o[0])))return[e.DirectiveUpdateTag.NONE,u];if(r&&t.isMatch(r,o[0])&&r.length===o[0].length)return[e.DirectiveUpdateTag.NONE,u]}return ft.set(c,t.clone(o[0])),i?[e.DirectiveUpdateTag.UPDATE,u]:[e.DirectiveUpdateTag.APPEND,u]}}),(e.EnterPointType.TEXT,e.EnterPointType.SLOT));const yt=new WeakMap,vt=J((function(t,r,n){return(s,[o,i],a,{renderComponent:l})=>{let c=s.endNode;if(a){if(!!o==!!a[0]){let t=yt.get(c);return[e.DirectiveUpdateTag.NONE,t.call(l,o)]}let t=o?r:n;return yt.set(c,t),[e.DirectiveUpdateTag.REPLACE,t.call(l,o)]}{let s=o?r:n;return yt.set(c,s),[e.DirectiveUpdateTag.APPEND,s.call(l,t)]}}}),(e.EnterPointType.TEXT,e.EnterPointType.SLOT)),bt=J((function(t,r){return(t,[r,n],s)=>s?r===s[0]?[e.DirectiveUpdateTag.NONE,r?n():Ze``]:r?[e.DirectiveUpdateTag.REPLACE,r?n():Ze``]:[e.DirectiveUpdateTag.REMOVE]:[e.DirectiveUpdateTag.APPEND,r?n():Ze``]}),(e.EnterPointType.TEXT,e.EnterPointType.SLOT));var Et;e.ModelTriggerType=void 0,(Et=e.ModelTriggerType||(e.ModelTriggerType={})).CHANGE="change",Et.INPUT="input";const Tt=new WeakMap,St=J((function(e,r="value"){return(n,s,o,{varChain:i,renderComponent:a})=>{const l=n.startNode;if(o){if(t.isEqual(s,o))return;if(!t.isEqual(s,o)){let e=s[0];if(l instanceof G)l._updateProps({[r]:e});else if(l instanceof HTMLTextAreaElement||l instanceof HTMLSelectElement){if(l.setAttribute(r,e+""),l instanceof HTMLSelectElement){let r=t.find(l.querySelectorAll("option"),(t=>t.value==e));r&&(r.selected=!0)}}else if(l instanceof HTMLInputElement){if(l.value==e)return;switch(l.type){case"checkbox":case"radio":e?l.setAttribute("checked",""):l.removeAttribute("checked");break;case"text":case"email":case"number":case"password":case"search":case"tel":case"url":l.setAttribute(r,e+""),t.set(l,r,e);break;default:l.setAttribute(r,e+"")}}}return}if("binded"===t.get(l,"_model"))return;let c=t.last(i),u=c.join(P),d=Object.keys(a._propObjectKeyMap);if(d.length>0&&t.each(d,(e=>{if(u.startsWith(e)){let t=u.replace(e,a._propObjectKeyMap[e]);return c=t.split(P),!1}})),Tt.set(l,c),t.isObject(e)||t.trim(e)||(e=""),l instanceof G)l._initProps({[r]:e}),l.addEventListener("update:"+r,(e=>{t.set(a,c,e.detail.value)})),t.set(l,"_model","binded");else if(l instanceof HTMLTextAreaElement)l.setAttribute(r,e+""),l.addEventListener("input",(e=>{let r=e.target;t.set(a,c,r.value)})),t.set(l,"_model","binded");else if(l instanceof HTMLInputElement){let n="",s="";switch(l.type){case"checkbox":case"radio":n="checked",s="change";break;default:n="value",s="input"}l.setAttribute(r??n,e+""),l.addEventListener(s,(e=>{let r=e.target;t.set(a,c,r.value)})),t.set(l,"_model","binded")}else l instanceof HTMLSelectElement&&(l.setAttribute(r,e+""),l.addEventListener("change",(e=>{let r=e.target;t.set(a,c,r.value)})),t.set(l,"_model","binded"))}}),e.EnterPointType.TAG),Ct=new Map,_t=J((function(e,t){return(e,[r],n)=>{if(n&&r===n[0])return;let s=e.startNode;if(!Ct.has(s)){let e=s.style.display;Ct.set(s,"none"==e?"unset":e)}s.style.display=r?Ct.get(s):"none",t&&t(s,r)}}),e.EnterPointType.TAG),Nt=J((function(e,t){return(r,n,s,{renderComponent:o,slotComponent:i})=>{s||(e=e.bind(o),i._bindSlotHook(t||"default",e))}}),e.EnterPointType.SLOT);class At{static getCssText(e,r=!1){return t.isString(e)?e:t.join(t.map(e,((e,n)=>n.startsWith("--")?n+":"+e+(r?" !important":""):t.kebabCase(n)+":"+e+(r?" !important":""))),";")}static setStyle(e,r){if(t.isString(e)&&!t.trim(e))return{};let n=At.getCssText(e),s={};return t.each(n.split(";"),(e=>{let n=e.split(":"),o=t.trim(n[0]),i=t.trim(n[1]);s[o]=r.style.getPropertyValue(o),r.style.setProperty(o,i)})),s}}const Pt=new Map;let wt=0;const Dt=J((function(e){return(e,t,r,{renderComponent:n})=>{let s=e.startNode,o=Pt.get(s);o||(o="style_d"+wt++,Pt.set(s,o)),n.nextTick((()=>{At.setStyle(t[0],s)}),o)}}),e.EnterPointType.STYLE),Mt=J((function(e){return(r,n,s,{renderComponent:o,varChain:i})=>{const a=r.startNode;if(s){if(!t.isEqual(n,s)){let e=r.attrName;a._updateProps({[e]:n[0]})}return}let l=t.last(i),c=r.attrName;a._initProps({[c]:e}),a.addEventListener("update:"+c,(e=>{t.set(o,l,e.detail.value)}))}}),e.EnterPointType.PROP),kt=J((function(r,n){return(r,[n,s],o)=>{let i=()=>Ze``,a=[],l=[];t.each(s,((e,r)=>{if(t.isFunction(e))a.push(r),l.push(e);else{let t=e[0],r=e[1];a.push(t),l.push(r)}"default"===r&&(i=e)}));let c=t.findIndex(a,(e=>t.isFunction(e)?e(n):e==n));return o?[e.DirectiveUpdateTag.REPLACE,t.call(l[c]??i)]:[e.DirectiveUpdateTag.APPEND,t.call(l[c]??i)]}}),(e.EnterPointType.TEXT,e.EnterPointType.SLOT));e.CompElem=G,e.CssHelper=At,e.Decorator=h,e.DecoratorWrapper=y,e.EnterPoint=z,e.GetKeyFnName=f,e.PATH_SEPARATOR=P,e.PROP_OBJECT_KEY_MAP_SYMBOL=K,e.Template=tt,e.UpdatePoint=A,e._DecoratorMap=m,e._DecoratorsKey=g,e._getObservedAttrs=C,e.bind=dt,e.buildHTML=Fe,e.classes=ht,e.computed=function(e,r,n){n.get||a(`Computed '${r}' must be a getter`),t.has(e.constructor,s.COMPUTED)||(e.constructor[s.COMPUTED]=t.isEmpty(e.constructor[s.COMPUTED])?{}:t.cloneDeep(e.constructor[s.COMPUTED])),e.constructor[s.COMPUTED][r]=n.get},e.createRef=function(e){return{current:e}},e.debounced=rt,e.decorator=b,e.directive=J,e.event=function(e,r){return(n,o,i)=>{t.has(n.constructor,s.EVENTS)||(n.constructor[s.EVENTS]=t.isEmpty(n.constructor[s.EVENTS])?[]:t.cloneDeep(n.constructor[s.EVENTS])),n.constructor[s.EVENTS].push({name:e,options:r,fn:n[o]})}},e.forEach=mt,e.html=Ze,e.ifElse=vt,e.ifTrue=bt,e.makeState=function(e,t,r){lt(e.prototype,t,r||{prop:""})},e.model=St,e.onced=nt,e.prop=function(e){if(1===arguments.length)return(t,r,n)=>{e.required=e.required||!1,e.attribute=!1!==e.attribute,T(t,r,e,n)};let r=arguments[0],n=arguments[1],s=arguments[2];e={type:void 0,required:!1,attribute:!0},s&&"function"==typeof s.type&&(e=t.defaults(s,e),s=void 0),T(r,n,e,s)},e.query=it,e.queryAll=at,e.show=_t,e.slot=Nt,e.state=function(e){if(1===arguments.length)return(t,r)=>{lt(t,r,e)};lt(arguments[0],arguments[1],{prop:""})},e.styles=Dt,e.sync=Mt,e.tag=function(e){return t=>{if(t){if(t.prototype.hasOwnProperty("attributeChangedCallback")){let e=t.prototype.attributeChangedCallback;t.prototype.attributeChangedCallback=function(t,r,n){G.prototype.attributeChangedCallback.call(this,t,r,n),e.call(this,t,r,n)}}if(t.prototype.hasOwnProperty("connectedCallback")){let e=t.prototype.connectedCallback;t.prototype.connectedCallback=function(){G.prototype.connectedCallback.call(this),e.call(this)}}if(t.prototype.hasOwnProperty("disconnectedCallback")){let e=t.prototype.disconnectedCallback;t.prototype.disconnectedCallback=function(){G.prototype.disconnectedCallback.call(this),e.call(this)}}customElements.define(e,t)}}},e.throttled=ct,e.updateDirective=X,e.watch=function(e,r){return(n,o)=>{t.has(n.constructor,s.WATCH)||(n.constructor[s.WATCH]=t.isEmpty(n.constructor[s.WATCH])?{}:t.cloneDeep(n.constructor[s.WATCH]));(t.isArray(e)?e:[e]).forEach((e=>{let i=e.replaceAll(".",P),a=n.constructor[s.WATCH][i];t.isArray(a)||(a=n.constructor[s.WATCH][i]=[]),a.push({source:e,options:r,handler:n[o]})}))}},e.when=kt,Object.defineProperty(e,"__esModule",{value:!0})}));
package/constants.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * 共享内容
3
3
  */
4
- export declare const ChangedMap: WeakMap<WeakKey, any>;
5
4
  export declare const EXP_KEY: RegExp;
6
5
  export declare enum CollectorType {
7
6
  CSS = 1,
@@ -7,10 +7,6 @@ export type PropOption = {
7
7
  * 参数类型
8
8
  */
9
9
  type: Constructor<any> | Array<Constructor<any>>;
10
- /**
11
- * 是否浅层监控,默认false
12
- */
13
- shallow?: boolean;
14
10
  /**
15
11
  * 是否必填,默认false
16
12
  */
@@ -29,7 +25,7 @@ export type PropOption = {
29
25
  * @param oldValue
30
26
  * @returns
31
27
  */
32
- hasChanged?: (newValue: any, oldValue: any) => boolean;
28
+ hasChanged?: (newValue: any, oldValue: any, changeChain: string[], subNewValue: any, subOldValue: any) => boolean;
33
29
  /**
34
30
  * 设置属性getter,可以通过 get 函数方式设置
35
31
  * @returns
@@ -13,7 +13,7 @@ export type StateOption = {
13
13
  * @param oldValue
14
14
  * @returns
15
15
  */
16
- hasChanged?: (newValue: any, oldValue: any) => boolean;
16
+ hasChanged?: (newValue: any, oldValue: any, changeChain: string[], subNewValue: any, subOldValue: any) => boolean;
17
17
  };
18
18
  /**
19
19
  * 声明一个可双向变动的属性
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * compelem v0.6.12-b1.1758802699
2
+ * compelem v0.7.1-b1.1760246752
3
3
  * A modern, reactive, fast, lightweight and flexible lib for building web components
4
4
  * @holyhigh2
5
5
  * https://github.com/holyhigh2/compelem
6
6
  */
7
- import{toPath as t,some as e,isString as r,isUndefined as n,isBlank as s,get as o,isObject as i,isDefined as a,isEmpty as l,has as c,concat as u,defaults as d,isLowerCaseChar as p,merge as h,cloneDeep as f,each as g,kebabCase as m,toArray as v,last as b,startsWith as E,isFunction as y,isArray as S,initial as N,flatMap as _,test as C,size as T,assign as A,first as w,closest as P,once as k,bind as M,camelCase as D,isNil as x,trim as O,isBoolean as R,parseJSON as L,isNull as W,debounce as H,set as $,groupBy as V,reject as I,filter as U,compact as B,remove as j,map as F,includes as z,find as G,throttle as K,join as X,split as Q,isEqual as q,replace as Y,toString as Z,replaceAll as J,isSymbol as tt,snakeCase as et,clone as rt,reduce as nt,isMatch as st,findIndex as ot,call as it}from"myfx";const at=new WeakMap,lt=/\s+\.?key\s*=/;var ct,ut,dt,pt;function ht(t){console.error("[CompElem]",t)}function ft(t,e){console.error(`[CompElem <${t}>]`,e)}function gt(e){return t(e).join("-")}function mt(t){return Object.getPrototypeOf(t)}function vt(t){let e=t;return r(t)&&/(?:^true$)|(?:^false$)/.test(e)?e="true"===e:(n(e)||s(e))&&(e=!0),e}!function(t){t[t.CSS=1]="CSS",t[t.COMPUTED=2]="COMPUTED"}(ct||(ct={})),function(t){t.PROPS="__deco_props",t.STATES="__deco_states",t.COMPUTED="__deco_computed",t.WATCH="__deco_watch",t.EVENTS="__deco_events"}(ut||(ut={})),function(t){t.Prod="prod",t.Dev="dev"}(dt||(dt={})),function(t){t.CLASS="class",t.FIELD="field",t.METHOD="method"}(pt||(pt={}));class bt{static get priority(){return 0}}const Et="getKey",yt="__decorators",St=new WeakMap;class Nt{args;metadata;decoratorClass;instanceMap;key;priority=0;constructor(t,e,r){this.args=t,this.metadata=e,this.decoratorClass=r,this.priority=o(r,"priority",0),this.instanceMap=new WeakMap}create(t){let e,r=new this.decoratorClass(...this.args),s=r.targets,c=this.metadata[2];i(c)&&a(o(c,"configurable"))?e=pt.METHOD:n(this.metadata[2])&&(e=pt.FIELD),!l(s)&&e&&s.includes(e)?(r.created(t,...this.metadata),this.instanceMap.set(t,r)):ht(`Decorator '${this.decoratorClass.name}' is out of targets, expect '${s.join(",")}' bug got '${e}'`)}beforeMount(t,e){this.instanceMap.get(t).beforeMount(t,e,...this.metadata)}mounted(t,e){this.instanceMap.get(t).mounted(t,e,...this.metadata)}updated(t,e){this.instanceMap.get(t).updated(t,e)}}const _t=new WeakMap;function Ct(t){let e=(...e)=>(...r)=>{let n=r[0].constructor,s=n[yt];if(!c(n,yt)){let t=Object.getPrototypeOf(n);s=t?u(t[yt]??[]):[],Reflect.defineProperty(n,yt,{configurable:!1,enumerable:!1,value:s})}let o,i={},a=t[Et];if(a){let r=_t.get(t);if(r||(r=new WeakMap,_t.set(t,r)),i=r.get(n),i||(i={},r.set(n,i)),o=a(...e),i[o])return i[o]}let l=new Nt(e,r,t);return i[o]=l,s?.push(l),l};return St.set(e,!0),e}const Tt=new WeakMap;function At(t){if(1===arguments.length)return(e,r,n)=>{t.required=t.required||!1,t.attribute=!1!==t.attribute,wt(e,r,t,n)};let e=arguments[0],r=arguments[1],n=arguments[2];t={type:void 0,required:!1,attribute:!0},n&&"function"==typeof n.type&&(t=d(n,t),n=void 0),wt(e,r,t,n)}function wt(t,e,r,n){let s;if(p(e[0])||ht(`Prop '${e}' must be in CamelCase`),!c(t.constructor,ut.PROPS)){const e={};let r=t.constructor;for(;(r=mt(r))!==Gt;)h(e,r[ut.PROPS]?f(r[ut.PROPS]):{});Reflect.defineProperty(t.constructor,ut.PROPS,{configurable:!1,enumerable:!1,value:e}),s=new Set,g(e,((t,e)=>{if(t.attribute){let t=m(e);s?.add(t)}})),Tt.set(t.constructor,s)}if(n&&(n.get&&(r.getter=n.get),n.set&&(r.setter=n.set)),r.attribute){s||(s=Tt.get(t.constructor));let r=m(e);s?.add(r)}c(t.constructor,"observedAttributes")||(t.constructor.observedAttributes=[]),t.constructor.observedAttributes=v(s),r.shallow=r.shallow||!1,t.constructor[ut.PROPS][e]=r}const Pt=new Set;function kt(t){return Tt.get(t)??Pt}const Mt={collectWatch(t,e,r){let n=Lt.get(t);n||(n={},Lt.set(t,n));let s=n[r];s||(s=n[r]=[]),s.push(e)},startCollect(t,e){this.__collectType=e,this.__collecting=t},setUpdater(t){this.__updater=t},endCollect(){this.__collecting=null},__directiveQ:[],setDirectiveQ(t){let e=b(this.__directiveQ);const r=t?t.join(","):"",n=e?e.join(","):"";e&&r===n||(e&&e.length<t.length&&E(r,n)?this.__directiveQ[this.__directiveQ.length-1]=t:this.__directiveQ.push(t))},popDirectiveQ(){let t=u(this.__directiveQ);return this.__directiveQ=[],t},startRender(t){this.__renderCollecting=!0,this.__renderContext=t},endRender(t){this.__renderCollection.forEach((e=>{t._regDeps(e,this.__renderContext)})),this.__renderCollection.clear(),this.__renderCollecting=!1,this.__renderContext=null},collect(t){this.__renderCollection.add(t)},clear(){this.__directiveQ=[]},__updater:null,__collecting:null,__collectType:-1,__renderCollection:new Set,__renderContext:null,__renderCollecting:!1,__skipCheck:!1},Dt=new WeakMap,xt=new WeakMap,Ot=new WeakMap,Rt=new WeakMap,Lt=new WeakMap,Wt=new WeakSet;function Ht(t,e){if(!i(t))return t;const r=Wt.has(t)?t:new Proxy(t,{get(t,e,r){if(!e)return;const n=Reflect.get(t,e,r);if("string"!=typeof e&&"number"!=typeof e)return n;let s=e in t;if((Mt.__renderCollecting||Mt.__collecting)&&(s&&t.hasOwnProperty(e)||!s)){let t=xt.get(r)??[],s=u(t,[e]);if(s.length>1){let t=Dt.get(r).from,e=o(t.constructor,ut.PROPS),i=o(t.constructor,ut.STATES);if(o(e,[s[0],"shallow"])||o(i,[s[0],"shallow"]))return n}let i=s.join("-");if(Mt.__renderCollecting)Mt.collect(gt(s)),Mt.setDirectiveQ(s);else if(Mt.__collecting){let t;switch(Mt.__collectType){case ct.COMPUTED:t=Ot.get(Mt.__collecting),t||(t={},Ot.set(Mt.__collecting,t));break;case ct.CSS:t=Rt.get(Mt.__collecting),t||(t={},Rt.set(Mt.__collecting,t))}let e=t[i];e||(e=t[i]=[]),e.push(Mt.__updater)}}return n},set(t,e,r,n){if(!e)return!1;let s=t[e];if(!i(s)&&s===r)return!0;if(Number.isNaN(r)&&Number.isNaN(s))return!0;let a=xt.get(n)??[],c=u(a,[e]),d=Dt.get(n).from,p=o(d.constructor,ut.PROPS),h=o(d.constructor,ut.STATES),f=o(p,[c[0],"hasChanged"])||o(h,[c[0],"hasChanged"]);if(f){if(!f.call(d,r,s))return!0}else if(s===r&&!at.has(s))return!0;p&&p[e]&&t.__isData&&p[e].sync&&d.emit("update:"+e,{value:r});let g=Dt.get(n)?.contextSet,m=r;!i(r)||y(r)||r instanceof Node||Object.isFrozen(r)||g.forEach((t=>{let r=Dt.get(n)?.pathMap,s=r?.get(t);s&&(c=u(s,[e]),xt.set(m,c),m=Ht(m,t),Wt.add(m),xt.set(m,c))}));let v=Reflect.set(t,e,m),b=Dt.get(n).pathMap;return g.forEach((t=>{let r=b.get(t);if(!r)return;t===d&&a.length>1&&r.length>1&&a[0]===r[0]&&(r=a),c=u(r,"length"==e&&S(n)?[]:[e]);let i=Ot.get(t),p=Rt.get(t),h=Lt.get(t);if(i||p||h){let t=c.length;for(;t;){let e=c.slice(0,t).join("-");if(h){const r=h[e];t===c.length?r?.forEach((t=>{let e=t();e.ov=s,Vt.pushWatch(e)})):r?.forEach((t=>{let e=t();o(e,"deep")&&(e.ov=s,Vt.pushWatch(e))}))}if(i){let t=i[e];if(!l(t))for(let e=0;e<t.length;e++){const r=t[e];Vt.pushComputed(r)}}if(p){let t=p[e];if(!l(t))for(let e=0;e<t.length;e++){const r=t[e];Vt.pushCss(r)}}t--}}let f=t._notify(s,c);Vt.pushNext(f,t.cid)})),v}});Wt.has(r)||Wt.add(r);let n=xt.get(t)??[];if(Object.isExtensible(t)&&!Dt.get(r)){let t=new Set;t.add(e);let s=new WeakMap;s.set(e,n),Dt.set(r,{from:e,contextSet:t,pathMap:s})}else{Dt.get(r).contextSet.add(e);let t=Dt.get(r).pathMap,s=t.get(e),i=u(n);if(s&&s.join("")!==i.join("")){let t=o(e,N(s));S(t)||function(...t){console.warn("[CompElem]",...t)}(`The object is referenced by more than one @state '${i.join(".")},${s.join(".")}'`),s=i}else t.set(e,i)}let s=o(e.constructor,ut.PROPS),a=o(e.constructor,ut.STATES);for(let r in t){const l=t[r];let c=o(s,[r,"shallow"])||o(a,[r,"shallow"]);!i(l)||Wt.has(l)||y(l)||l instanceof Node||Object.isFrozen(l)||c||(xt.set(l,u(n,[r])),t[r]=Ht(l,e),Wt.add(t[r]),xt.set(t[r],u(n,[r])))}return r}const $t=new Map;class Vt{static watchSet=new Set;static computedSet=new Set;static cssSet=new Set;static nextSet=new Set;static nextPending=!1;static next;static flush(){Vt.nextPending=!1;let t=Array.from(Vt.watchSet);Vt.watchSet.clear();let e=Array.from(Vt.computedSet);Vt.computedSet.clear();let r=Array.from(Vt.cssSet);Vt.cssSet.clear();let n=Array.from(Vt.nextSet);Vt.nextSet.clear(),t.forEach((t=>t(o(t,"ov")))),e.forEach((t=>t())),r.forEach((t=>t())),n.forEach((t=>t())),$t.clear()}static pushWatch(t){Vt.watchSet.add(t)}static pushComputed(t){Vt.computedSet.add(t)}static pushCss(t){Vt.cssSet.add(t)}static pushNext(t,e){if(e){if($t.has(e))return;$t.set(e,t)}Vt.nextSet.add(t),Vt.nextPending||(Vt.nextPending=!0,Vt.next())}}(()=>{const t=Promise.resolve(),e=Vt.flush;Vt.next=()=>{t.then(e)}})();const It={boolean:Boolean,string:String,number:Number,object:Object,array:Array,function:Function,undefined:Object},Ut=new WeakMap;let Bt=[],jt=0;const Ft=new Map,zt=new WeakMap;class Gt extends HTMLElement{static __l_globalRule=document.createElement("style");static defaults(t){Bt=_(t.css,(t=>{if(r(t)){let e=new CSSStyleSheet;return e.replaceSync(t),e}return t instanceof CSSStyleSheet?t:[]})),t.global,g(t,((t,e)=>{C(e[0],/[A-Z]/)}))}#t;#e={};#r={"#slots":{}};#n={};#s={};#o;#i={};__events={};get[Symbol.toStringTag](){return this.constructor.name}get cid(){return this.#t}get reactiveData(){return this.#n}get attrs(){return this.#a}get props(){return this.#l}get renderRoot(){return this.#c}get renderRoots(){return this.#u}get parentComponent(){return this.#d}get wrapperComponent(){return this.#p}get slotHooks(){return this.#h}get css(){return Ut.get(this.constructor)}get globalStyleSheet(){return Ft.get(this.constructor)?.sheet}get isMounted(){return this.#f}get slots(){return this.#r["#slots"]}#a;#l;#c;#u;#d;#p;#g={};#h={};#m={};#f=!1;static get styles(){return[]}static get globalStyles(){return[]}static get hostStyles(){return[]}get styles(){return[]}#v=!1;#b=!1;constructor(...t){super(),this.#t=jt++,1===T(t)&&(this.#l={},A(this.#l,w(t)));let e=this.render.bind(this);this.render=function(){let t;return Mt.startRender(this),t=e(),Mt.endRender(this),t};let n=o(this.constructor,"globalStyles"),s=Ft.has(this.constructor);if(!l(n)&&!s){let t="";n.forEach((e=>{r(e)&&(t+=e+"\n")}));let e=document.createElement("style");e.textContent+=t,Ft.set(this.constructor,e),document.head.appendChild(e)}let i=Ut.get(this.constructor),a=i??[];i||(g(o(this.constructor,"styles"),(t=>{if(r(t)){let e=new CSSStyleSheet;e.replaceSync(t),a.push(e)}else a.push(t)})),Ut.set(this.constructor,a)),this.#o=this.attachShadow({mode:"open"}),this.#o.adoptedStyleSheets=[...Bt,...a],this.#E();let c=o(this.constructor,yt);c&&c.sort(((t,e)=>e.priority-t.priority)).forEach((t=>t.create(this))),this.#y=this.#S.bind(this)}#y;connectedCallback(){let t=P(this.parentNode,(t=>t instanceof Gt||t.host instanceof Gt),"parentNode");this.#d=t?t instanceof Gt?t:t.host:null,this.__init()}disconnectedCallback(){}__init(){if(this.#v)return;if(this.#b)return;this.#b=!0,this.#E();const t=this.#N();this.propsReady(t);for(const e in t){const r=t[e];this.#r[e]=r}this.#_(),g(this.#r,((t,e)=>{let r=Reflect.getOwnPropertyDescriptor(this.#r,e);Reflect.defineProperty(this,e,{get(){let t=Reflect.get(this.#n,e);return r?.get?r?.get():t},set(t){r?.set?r?.set(t):Reflect.set(this.#n,e,t)}})})),Reflect.defineProperty(this.#r,"__isData",{enumerable:!1,value:!0}),this.#n=Ht(this.#r,this);let e=o(this.constructor,ut.COMPUTED);g(e,((t,e)=>{Mt.startCollect(this,ct.COMPUTED),Mt.setUpdater((()=>{this.#n[e]=t.call(this)})),this.#r[e]=t.call(this),Mt.endCollect(),Reflect.defineProperty(this,e,{get(){return Reflect.get(this.#n,e)},set(t){ft(this.tagName,"Cannot set a computed property '"+e+"'")}})}));let n=o(this.constructor,ut.WATCH);g(n,((t,e)=>{t.forEach((t=>{let{source:r,options:n,handler:s}=t,i=s.bind(this);o(n,"once",!1)&&(i=k(i));const a=function(t){let e=o(this,r.replaceAll("-","."));i(e,t,r)}.bind(this);let l=o(n,"deep",!1);if(a.deep=l,Mt.collectWatch(this,(()=>a),e),!o(n,"immediate",!1))return;let c=o(this,r.replaceAll("-","."));i(c,c,r)}))}));let i=function(t,e){let r,n=[];if($e.has(e.constructor)){let s=$e.get(e.constructor),i=function(t,e){let r=u(e.vars),n=e.strings.length-1;for(let s=0;s<=n;s++){let n=o(e.vars,s,"");if(n instanceof ir){let[e,o]=Xe(t,n);r.splice(s,1,...o)}}return r}(e,t);r=Ve.has(e.constructor)?function(t,e,r){let n=Ve.get(r.constructor)?.cloneNode(!0),s=Ie.get(r.constructor);const o=document.createNodeIterator(n,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let i,a,l=0,c=0;for(;i=o.nextNode();){let n;if(c++,a&&!a.contains(i)&&(a=void 0),i instanceof HTMLElement||i instanceof SVGElement){i instanceof Gt&&(a=i);let o={};s[c].forEach((s=>{let c=e[l++];switch(s.type){case Ue.Event:n=rt(s.up),s.value||l--,s.value&&we(s.name,c.bind(r),i,r),i.removeAttribute(s.attrName);break;case Ue.AttrSlot:a&&s.name,i.removeAttribute(s.attrName);break;case Ue.Ref:n=rt(s.up),c.current=i,i.removeAttribute(s.attrName);break;case Ue.AttrKey:n=rt(s.up),i.setAttribute(Re,c);break;case Ue.AttrBool:n=rt(s.up),n.value=!!c,n.node=i,n.value&&i.setAttribute(s.name,""),i.removeAttribute(s.attrName);break;case Ue.AttrProp:n=rt(s.up),n.value=c,n.node=i,o[s.name]=c;break;case Ue.AttrRef:case Ue.Attr:n=rt(s.up),n.value=c,n.node=i,i.setAttribute(s.attrName,c),Ue.AttrRef===s.type&&i.removeAttribute(s.name);break;case Ue.DirectiveAttr:case Ue.DirectiveTag:case Ue.DirectiveProp:n=rt(s.up),n.value=c,n.node=i;let t=rt(s.point);t.startNode=i;let[e,u,d,p,h]=c,f=Ke.get(i);if(f||(f={},Ke.set(i,f)),f[s.attrName??Symbol.keyFor(e)]=[t,r,a],d(t,u,void 0,{renderComponent:r,slotComponent:a,varChain:h}),Ue.DirectiveAttr===s.type){let t=i.getAttribute(s.attrName);t=Y(t,Ye,""),i.setAttribute(s.attrName,t)}s.name&&i.removeAttribute(s.name)}n&&t.push(n)})),i instanceof Gt?(i._initProps(o),i._regWrapper(r)):i instanceof HTMLSlotElement&&r._bindSlot(i,i.name||"default",o)}else{s[c].forEach((s=>{let o=e[l++];switch(s.type){case Ue.DirectiveSlot:case Ue.DirectiveText:n=rt(s.up),n.value=o,n.node=i;let[t,e,l,c,u]=o,d=Symbol.keyFor(t),p=document.createComment(`compelem-${r.tagName}-${d}-start`);n.textNode=p,i.parentNode.insertBefore(p,i),i.nodeValue=`compelem-${r.tagName}-${d}-end`;let h=rt(s.point);h.startNode=p,h.endNode=i,ze.set(i,[h,r,a,e,u]),Fe.set(i,l),Ge.set(i,n),Mt.startRender(i);let f=l(h,e,void 0,{renderComponent:r,slotComponent:a,varChain:u});Mt.endRender(r);let g=Je(i,f[1],r);g&&g.length>0&&rr.insertBefore(i,Array.from(g));break;case Ue.Text:n=rt(s.up),n.node=i;let m=Z(o??""),v=document.createTextNode(m);i.replaceWith(v),n.textNode=v}n&&t.push(n)}))}}return n.childNodes}(n,i,e):Ze(n,s,i,e)}else{let[s,o]=Xe(e,t);$e.set(e.constructor,s),r=Ze(n,s,o,e)}return Be.set(e,n),r}(this.render(),this);i&&(this.#o.append(...i),this.#u=U(this.#o.childNodes,(t=>t.nodeType===Node.ELEMENT_NODE)),this.#c=this.#u[0]),g(this.#h,((t,e)=>{this.#C(e)}));const a=this;let l=o(this.constructor,yt);l&&l.sort(((t,e)=>e.priority-t.priority)).forEach((t=>{t.beforeMount(this,((t,e)=>(a.#n[t]=e,a.#n[t])))}));let c=o(this.constructor,"hostStyles"),d=this.#p?.shadowRoot??this.ownerDocument,p=zt.get(d);if(!p?.includes(this.constructor)&&c.length>0){let t=[];g(c,(e=>{if(r(e)){let r=new CSSStyleSheet;r.replaceSync(e),t.push(r)}else t.push(e)})),d.adoptedStyleSheets=[...d.adoptedStyleSheets,...t],p?.push(this.constructor)}this.beforeMount();let h=o(this.constructor,ut.EVENTS);h&&h.forEach((async t=>{let e=t.name,r=A({target:document,once:!1,passive:!1,capture:!1},t.options),n=M(t.fn,this),s=r.target;y(s)&&(s=await s.call(this,this)),s?s.addEventListener(e,n,r):ft(this.tagName,"The target of @event('"+e+"',...) is invalid")})),Mt.startCollect(this,ct.CSS);let f=[];this.styles.forEach((t=>{if(!y(t))return;let e=new CSSStyleSheet;f.push(e),Mt.setUpdater((()=>{let r=t()??"";e.replaceSync(r)}));let r=t();s(r)||e.replaceSync(r)})),Mt.endCollect(),f.length>0&&(this.#o.adoptedStyleSheets=[...this.#o.adoptedStyleSheets,...f]),setTimeout((()=>{this.#f=!0,this.mounted(),l&&l.forEach((t=>{t.mounted(this,((t,e)=>(a.#n[t]=e,a.#n[t])))}))}),0),this.#v=!0}propsReady(t){}render(){throw Error(`[CompElem <${this.tagName}>] Missing render()`)}beforeMount(){}mounted(){}#T(t,e){this.#E();let r=o(this.#e[e],"props");r&&g(this.slots,((t,e)=>{t.filter((t=>t.nodeType===Node.ELEMENT_NODE)).forEach((t=>{t instanceof Gt?t._updateProps(r):g(r,((e,r)=>{if(t instanceof HTMLSlotElement){let n=o(t,"__l_comp");if(n){let s=t.name||"default",o=n.#e[s];o||(o=n.#e[s]={props:{}}),o.props||(o.props={}),o.props[r]=e,n.#T(t,s)}}else t.setAttribute(r,e)}))}))})),this.slotChange(t,e)}slotChange(t,e){}attributeChangedCallback(t,e,r){this.#A(t,e,r)}shouldUpdate(t){return!0}updated(t){}#w={};_notify(t,e){let r=[];for(let n=0;n<e.length;n++){const s=e[n];r.push(s);let a=o(this,r),l=gt(r);this.#s[l]={value:a,chain:"slots"===l?["slots"]:r,oldValue:t,end:r.length===e.length},i(a)&&"#"!=l[0]&&at.set(a,l)}return this.#y}#S(){if(T(this.#s)<1)return;const t=this.#s;this.#s={};let e=o(this.constructor,yt);if(e&&e.sort(((t,e)=>e.priority-t.priority)).forEach((e=>{e.updated(this,t)})),!this.shouldUpdate(t))return;let r=new Set;g(t,(({value:t,chain:e,oldValue:n,end:s},o)=>{this.#i[o]&&this.#i[o].forEach((t=>{r.add(t)}))})),r.forEach((t=>{t===this?tr(this.render(),this):er(t,this)})),this.#P.forEach((t=>{this.#C(t)})),this.updated(t),g(t,(({value:t,chain:e,oldValue:r},n)=>{i(t)&&at.has(t)&&at.delete(t)}))}#N(){let t=o(this.constructor,ut.PROPS),r=this.attributes,s=this.tagName,l=this.#l,u={};g(r,(({name:e,value:r})=>{if(e[0]===Pe||e[0]===ke||e[0]===Me||e===Oe||"slot"===e)return;let n=D(e);t&&!t[n]&&(u[e]=r)})),this.#a=this.#a?A(this.#a,u):u;let d={};if(!t)return Object.seal(d);let p=Object.keys(t),h=p.length;for(let u=0;u<h;u++){const h=p[u],g=m(h),v=this.hasAttribute(g);let b,E=t[h],y=c(l,h),N=o(this,h);if(!("_defaultValue"in E)&&(E._defaultValue=N,!E.type)){n(N)&&ft(s,"Prop '"+h+"' has neither propType nor defaultValue be used for type inference");let t=typeof N;S(N)&&(t="array");let e=It[t];E.type=e}if(y)b=x(l[h])?N:l[h];else{b=N;let t=r.getNamedItem(g)||r.getNamedItem(ke+g);t&&(y=!0,b=t.value)}if(E.required&&!y){ft(s,"Prop '"+h+"' is required");break}b=this.#k(t,h,b,v);let _=o(t,[h,"getter"]);_&&(_=M(_,this));let C=o(t,[h,"setter"]);if(C&&(C=M(C,this)),(_||C)&&Reflect.defineProperty(this.#r,h,{set:C||function(t){},get:_}),E.attribute&&a(b)&&!i(b)){let t=m(h),r=O(b);(f=E.type)===Boolean||e(f,(t=>t===Boolean))?(r=vt(b),R(r)?this.toggleAttribute(t,r):this.setAttribute(t,r)):this.setAttribute(t,r)}this.#r[h]=b,d[h]=b}var f;return Object.seal(d)}#M(t,e){let r=t;try{for(let n=0;n<e.length;n++){const s=e[n];r=s===Boolean?vt(t):s===Number?Number(t):s===String?String(t):s===Object||s===Array?L(t):s===Date?new Date(t):new s(t)}}catch(e){ft(this.tagName,"Convert attribute error with "+t)}return r}#k(t,n,o,i){let l=t[n];if(!l)return o;let c=l.isValid,u=l.type,d=S(u)?u:[u],p=l.converter,h=o;if(!e(d,(t=>t===String))&&r(h)&&!W(h))try{h=p?p(h):this.#M(h,d)}catch(t){ft(this.tagName,`Convert attribute '${n}' error with `+h)}for(let t=0;t<d.length;t++){"Boolean"===d[t].name&&(h=(!1!==i||!s(h))&&vt(h))}if(x(h))return h;let f=typeof h,g=!a(h);for(let t=0;t<d.length;t++){const e=d[t];if(C(f,e.name,"i")||h instanceof e||Object.prototype.toString.call(h)===Object.prototype.toString.call(e.prototype)){g=!0;break}}return g||ft(this.tagName,`Invalid prop '${n}'. expected '${d.map((t=>t.name||t))}' but got '${f}'`),c&&(c.call(this,h,this.#r)||ft(this.tagName,`Invalid prop '${n}'. IsValid() check failed`)),h}#_(){let t=o(this.constructor,ut.STATES);g(t,((e,r)=>{let n=t[r],s=o(this,r);if(n){let t=n.prop;s=t?f(this.#r[t]):o(this,r)}this.#r[r]=s}))}#D=H(this.propsReady,100);_setParentProps(t,e){if(this.#v){let r=o(this.constructor,ut.PROPS);g(t,((t,e)=>{let n=D(e),s=r[n];if(!s)return;let o=this.#r[n];t=this.#k(r,n,t),s.hasChanged&&!s.hasChanged.call(this,t,o)||(this.#r[n]=t,this._notify(o,[n]))})),A(this.#l,t),A(this.#a,e),this.#D(this.#l)}}_updateProps(t){let e=o(this.constructor,ut.PROPS);g(t,((t,r)=>{let n=D(r);e[n]&&(t=this.#k(e,n,t),Mt.__skipCheck=!0,$(this,n,t),Mt.__skipCheck=!1)})),A(this.#l,t),this.#D(this.#l)}_initProps(t,e){this.#l=h(this.#l||{},t),this.#a=h(this.#a||{},e)}_bindSlot(t,e,r){if(this.#g[e]||(this.#g[e]=t,Reflect.defineProperty(t,"__l_comp",{value:this})),t.addEventListener("slotchange",(r=>{this.#v&&this.#T(t,"default"===e?"":e)})),!l(r)){let t=this.#e[e];t||(t=this.#e[e]={}),t.props=r}}_bindSlotHook(t,e){this.#h[t]=e}#P=new Set;_updateSlot(t,e,r){let n=this.#g[t],s=this.#h[t];if(!s&&!n)return;let o=this.#e[t];if(e&&(o.props||(o.props={}),o.props[e]=r),s)this.#P.add(t);else{let t=n.assignedElements({flatten:!0});for(let n=0;n<t.length;n++){t[n].setAttribute(e,r+"")}}}#E(){const t=_(this.childNodes,(t=>t.nodeType===Node.COMMENT_NODE?[]:t instanceof HTMLSlotElement?t.assignedNodes({flatten:!0}):t));let e=V(t,(t=>t.nodeType===Node.TEXT_NODE?"default":t instanceof Element?t.getAttribute("slot")||"default":void 0));if(l(e))return void(l(this.#r["#slots"])||(this.#v?this.#n["#slots"]={}:this.#r["#slots"]={}));g(e,((t,e)=>{if(e){for(;t.length>0;){let e=t[0];if(!(e.nodeType===Node.TEXT_NODE&&s(e.textContent)||e instanceof HTMLSlotElement&&l(e.assignedNodes({flatten:!0}))))break;t.shift()}for(;t.length>0;){let e=b(t);if(!(e.nodeType===Node.TEXT_NODE&&s(e.textContent)||e instanceof HTMLSlotElement&&l(e.assignedNodes({flatten:!0}))))break;t.pop()}}}));let r={};g(e,((t,e)=>{l(t)||(r[e]=t)})),this.#v?this.#n["#slots"]=r:this.#r["#slots"]=r}#C(t){let e=this.#h[t];if(!e)return;let r=this.#e[t];if(!this.#r["#slots"][t])return;this.renderAsync(e,o(r,"props"));const n=this._asyncDirectives.get(e);let s=n?.buildView(e(o(r,"props"))),i=I(v(s),(t=>t.nodeType===Node.COMMENT_NODE));if(i){let e=this.#m[t];if(!l(e))for(let t=0;t<e.length;t++){const r=e[t];r.parentNode?.removeChild(r)}this.#m[t]=i,this.append(...i),this.#P.clear()}}_asyncDirectives=new WeakMap;renderAsync(t,...e){}#A(t,e,r){if(!this.#v)return;if(kt(this.constructor).has(t)){let e=D(t);if(W(r)){r=o(this.constructor,ut.PROPS)[e]._defaultValue}this._updateProps({[e]:r})}}_regDeps(t,e){let r=this.#i[t];r||(r=this.#i[t]=new Set),r.add(e);let n=t.split("-");if(n.pop(),n.length<1)return;let s=n.join("-");r=this.#i[s],r||(r=this.#i[s]=new Set),r.add(e)}_regWrapper(t){this.#p=t}emit(t,e={},r){r&&r.event&&(e.event=r.event),e.target=this,this.dispatchEvent(new CustomEvent(t,{bubbles:o(r,"bubbles",!1),composed:o(r,"composed",!1),cancelable:!0,detail:e}))}on(t,e){this.#w[t]||(this.#w[t]=[]);let r=e.bind(this);this.#w[t].push(r),this.addEventListener(t,r)}nextTick(t,e){Vt.pushNext(t,e)}forceUpdate(){g(this.#n,((t,e)=>{this.#s[e]={value:void 0,chain:void 0}})),this.#S()}}var Kt,Xt,Qt;!function(t){t.ATTR="attr",t.PROP="prop",t.TEXT="text",t.CLASS="class",t.STYLE="style",t.SLOT="slot",t.TAG="tag"}(Kt||(Kt={})),function(t){t.NONE="NONE",t.REMOVE="REMOVE",t.REPLACE="REPLACE",t.UPDATE="UPDATE",t.APPEND="APPEND"}(Xt||(Xt={}));class qt{key;varIndex;value;isText=!1;isDirective=!1;node;textNode;isComponent=!1;attrName;attrTmpl;isProp=!1;isToggleProp=!1;notUpdated;constructor(t,e,r,n){this.varIndex=t,this.node=e,r&&(this.attrName=r),n&&(this.attrTmpl=n)}}class Yt{startNode;endNode;type;attrName;varIndex;expressionChain;nodes;constructor(t,e,r){this.startNode=t,this.attrName=e,this.type=r}setVarIndex(t){this.varIndex=t}getNodes(){let t=this.startNode.nextSibling;if(!this.endNode)return[t];let e=[];for(;t&&t!==this.endNode;)e.push(t),t=t?.nextSibling;return e}}!function(t){t.AFTER_BEGIN="afterbegin"}(Qt||(Qt={}));const Zt={};function Jt(t,e,r,n,s,o,i,a=!1){let c;if(a?(Mt.startRender(t.endNode),c=n(t,e,r,{renderComponent:s,slotComponent:o,varChain:i}),Mt.endRender(s)):c=n(t,e,r,{renderComponent:s,slotComponent:o,varChain:i}),!c)return;let[u,d]=c;if(u===Xt.NONE)return;let p=t.getNodes();if(u===Xt.REMOVE)for(let t=0;t<p.length;t++){const e=p[t];e.parentNode?.removeChild(e)}else if(u===Xt.REPLACE){let e=[];for(let t=0;t<p.length;t++){const e=p[t];e.parentNode?.removeChild(e)}let r=Je(t.endNode,d,s);e=v(r);let n=document.createDocumentFragment();n.append(...e),t.endNode.parentNode.insertBefore(n,t.endNode)}else if(u===Xt.UPDATE){let e,r={},n=[],o=[],i=je.get(t.endNode);if(d||(d=new ir([],[])),l(p)){let e=Je(t.endNode,d,s);return void t.startNode.after(...e)}let a={};d instanceof ir&&d.vars.forEach((t=>{if(t instanceof ir){const e=t.getKey();a[e]=t,r[e]=!0,o.push(e)}})),p=U(B(p),(t=>t.nodeType===Node.ELEMENT_NODE)),e=U(B(v(e)),(t=>t.nodeType===Node.ELEMENT_NODE));let c={},u="",h={};for(let t=0;t<p.length;t++){let e=p[t],r=e.getAttribute("key");if(r){if(c[r]){u=r;break}c[r]=e,n.push(r),h[r]=!0}}if(u)return void ht(`${D(t.endNode._diName)} - duplicate key '${u}'`);let f=r;const m=t.startNode.parentNode;let E=[],y=[];g(h,((t,e)=>{f[e]||(y.push(e),delete h[e],j(n,(t=>t===e)))}));let S,_=!1;if(!l(o)){let e=-1,r=[],s=[],i=0,a=0;for(;a<o.length;a++){const l=o[a];let u=n.findIndex((t=>t===l));if(u<0){let e=o[a-1],r=e?c[e]||e:t.startNode;E.push({prevNode:r,newkey:l}),i++}else if(u>-1&&u!==a-i){if(e<0||1===Math.abs(e-u)){let t=b(r);r.push({nodeId:l,targetId:0===a?Qt.AFTER_BEGIN:t?t.nodeId:o[a-1]})}else s.push({moveGroup:r,moveIndex:a+r.length}),r=[],r.push({nodeId:l,targetId:o[a-1]});e=u}}if(r.length>0&&s.push({moveGroup:r,moveIndex:a+r.length}),s.length>0){_=!0;let e=s.sort(((t,e)=>t.moveGroup.length-e.moveGroup.length));if(e.length<2){let{moveGroup:r}=e[0];if(r.length>1){let t=b(r).targetId;r[r.length-2].nodeId===t&&(r=N(r))}r.forEach((({targetId:e,nodeId:r})=>{let n,s=c[r];e===Qt.AFTER_BEGIN?(n=t.startNode,n.after(s)):(n=c[e],n.after(s))}))}else{let r=b(e).moveIndex;1===Math.abs(e[e.length-2].moveIndex-r)&&(e=N(e)),e.forEach((({moveGroup:e})=>{e.forEach((({targetId:e,nodeId:r})=>{let n,s=c[r];e===Qt.AFTER_BEGIN?(n=t.startNode,n.after(s)):(n=c[e],n.after(s))}))}))}}}if(E.length>0&&(S=function(t,e,r,n,s,o){const i=[],a=[],l=[];let c,u=[];t.forEach((t=>{let r=b(u);r&&c===t.prevNode?(r.group||(r.group=[c]),r.group.push(t.newkey)):u.push(t),c=t.newkey;let n=t.newkey;l.push(n),i.push(""),a.push(e[n])})),i.push("");let d=new ir(i,a),p=[...s],h=Je(o,d,n),f=je.get(o);s.length=0,s.push(...f);let g=new Map;return h.forEach((t=>{const e=t.getAttribute("key");l.includes(e)&&(g.set(e,!0),Zt[e]=t)})),p.forEach(((t,e)=>{const n=t.key+"";!g.get(n)&&r.includes(n)&&s.push(t)})),u}(E,a,o,s,i,t.endNode),S.forEach(((e,r)=>{let n=e.newkey,s=Zt[n],o=e.prevNode;if(e.group){let t=document.createDocumentFragment();t.append(...F(e.group,(t=>Zt[t]))),s=t}o===t.endNode?o.before(s):o===t.startNode?o.after(s):"string"==typeof o?Zt[o].after(s):o.after(s)}))),y.forEach((t=>{let e=c[t];e&&e.parentNode&&m.removeChild(e)})),d.vars[0]instanceof ir){let t=[],e=[];g(d.vars,(r=>{e.push(...r.vars),t.push(...F(r.vars,(t=>"1")))})),t.push("1"),d=new ir(t,e)}if(_||y.length>0||S){const t=V(i,(t=>t.key));let e=[],r=0;o.forEach((n=>{t[n].forEach((t=>{t.varIndex=r++,e.push(t)}))})),i=e}er(t.endNode,s,d,i)}}let te=0;function ee(t,e){let r=t.name||"Di-"+te++,n=Symbol.for(r);return(...r)=>{let s=t(...r);return[n,r,s,t=>{process.env.DEV&&(l(e)||C(e.join(","),t)||ht(`Directive '${Symbol.keyFor(n)}' is out of scopes, expect '${e.join(",")}' bug got '${t}'`))},Mt.popDirectiveQ()]}}const re=["resize","outside","mutate"],ne=new WeakMap,se=[],oe=[],ie=[],ae=new ResizeObserver((t=>{for(const e of t){const t=Array.isArray(e.contentBoxSize)?e.contentBoxSize[0]:e.contentBoxSize,r=Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize;let n=ne.get(e.target);if(n){n(new CustomEvent("resize",{bubbles:!1,cancelable:!1,detail:{borderBox:{w:r.inlineSize,h:r.blockSize},contentBox:{w:t.inlineSize,h:t.blockSize}}}),e.target)}}}));var le;!function(t){t.Child="child",t.Tree="tree",t.Attr="attr",t.Char="char"}(le||(le={}));const ce=new WeakMap,ue=new MutationObserver((t=>{for(let e=0;e<t.length;e++){const r=t[e];let n=ce.get(r.target);if(!n)return;let s={target:r.target},o=null;switch(r.type){case"subtree":s.type=le.Tree,o=n[le.Tree];break;case"childList":s.type=le.Child,s.addedNodes=r.addedNodes,s.removedNodes=r.removedNodes,o=n[le.Child];break;case"attributes":s.type=le.Attr,s.attributeName=r.attributeName,s.oldValue=r.oldValue,o=n[le.Attr];break;case"characterData":s.type=le.Char,s.oldValue=r.oldValue,o=n[le.Char]}if(o){o(new CustomEvent("mutate",{bubbles:!1,cancelable:!1,detail:s}))}}}));function de(t,e,r,n){if("resize"===t)!function(t,e){ne.has(t)||(ne.set(t,e),ae.observe(t))}(e,r);else if("outside"===t)switch(n[0]){case"mousedown":!function(t,e){se.push([t,e])}(e,r);break;case"dblclick":!function(t,e){ie.push([t,e])}(e,r);break;default:!function(t,e){oe.push([t,e])}(e,r)}else"mutate"===t&&function(t,e,r){let n=z(r,"child"),s=z(r,"attr"),o=z(r,"char"),i=z(r,"tree"),a=ce.get(t);a||(a={},ce.set(t,a),n&&(a[le.Child]=e),s&&(a[le.Attr]=e),o&&(a[le.Char]=e),i&&(a[le.Tree]=e),ue.observe(t,{childList:n,attributes:s,characterData:o,subtree:i}))}(e,r,n)}document.addEventListener("mousedown",(t=>{let e=o(t.composedPath(),0,t.target);se.forEach((([r,n])=>{if(!r.contains(e)&&!r.contains(P(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){n(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:r,event:t}}),r)}}))}),!1),document.addEventListener("click",(t=>{let e=o(t.composedPath(),0,t.target);oe.forEach((([r,n])=>{if(!r.contains(e)&&!r.contains(P(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){n(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:r,event:t}}),r)}}))}),!1),document.addEventListener("dblclick",(t=>{let e=o(t.composedPath(),0,t.target);ie.forEach((([r,n])=>{if(!r.contains(e)&&!r.contains(P(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){n(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:r,event:t}}),r)}}))}),!1);const pe=/,|^(debounce:.+)|(debounce$)/,he=/,|^(throttle:.+)|(throttle$)/,fe="self",ge="stop",me="prevent",ve="once",be="left",Ee="right",ye="middle",Se="ctrl",Ne="alt",_e="shift",Ce="meta",Te={esc:"escape"},Ae=":";function we(t,e,r,n){let s,o=t.split("."),i=o.shift(),a=o.includes(ve),l=e;if(s=G(o,(t=>pe.test(t)))){let t=s.split(Ae);l=H(l,parseInt(t[1])||100)}if(s=G(o,(t=>he.test(t)))){let t=s.split(Ae);l=K(l,parseInt(t[1])||100)}if(a&&(l=k(l)),function(t){return re.includes(t)}(i))return de(i,r,l,o),l;let c=t=>{if(o.includes(me)&&t.preventDefault(),o.includes(ge)&&t.stopPropagation(),!o.includes(fe)||t.target===t.currentTarget){if(t instanceof MouseEvent){if(o.includes(be)&&0!=t.button)return;if(o.includes(Ee)&&2!=t.button)return;if(o.includes(ye)&&1!=t.button)return}else if(t instanceof KeyboardEvent){if(j(o,(t=>t==Se))[0]&&!t.ctrlKey)return;if(j(o,(t=>t==Ne))[0]&&!t.altKey)return;if(j(o,(t=>t==_e))[0]&&!t.shiftKey)return;if(j(o,(t=>t==Ce))[0]&&!t.metaKey)return;if(!F(o,(t=>Te[t]||t)).includes(t.key.toLowerCase()))return}l(t)}};r.addEventListener(i,c);let u=n.__events[i];return u||(u=n.__events[i]=[]),u.push([r,c]),c}const Pe="@",ke=".",Me="?",De="*",xe=":",Oe="ref",Re="key",Le=/[.?-a-z]+\s*=\s*(['"])\s*([^='"]*<\!--c_ui-pl_df-->){2,}.*?\1/ims,We=/<\s*[a-z0-9-]+([^>]*<\!--c_ui-pl_df-->)*[^>]*?(?<!-)>/gims,He="slot-props",$e=new Map,Ve=new Map,Ie=new Map;var Ue;!function(t){t.Event="event",t.Directive="directive",t.DirectiveTag="directiveTag",t.DirectiveAttr="directiveAttr",t.DirectiveProp="directiveProp",t.DirectiveText="directiveText",t.DirectiveSlot="directiveSlot",t.Attr="attr",t.AttrProp="attrProp",t.AttrBool="attrBool",t.AttrRef="attrRef",t.AttrSlot="attrSlot",t.AttrKey="key",t.Ref="ref",t.Text="text"}(Ue||(Ue={}));const Be=new WeakMap,je=new WeakMap,Fe=new WeakMap,ze=new WeakMap,Ge=new WeakMap,Ke=new WeakMap;function Xe(t,e){let r="",n=u(e.vars),s=e.strings.length-1,i=e.vars.length-1,a=0;for(let l=0;l<=s;l++){const s=e.strings[l];let c=o(n,a,"");if(c instanceof ir){let[e,r]=Xe(t,c);c=e,n.splice(a,1,...r),a+=r.length-1}else c=l>i?"":Qe;a++,r=r+s+c}if(process.env.DEV){let t=r.match(Le);if(t){return ht(`Parse error: attribute value can be set only one interpolation —— \n ${J(t[0],Qe,"${...}")}`),["",n]}}let l=0;return r=r.replace(We,((t,e)=>J(t,Qe,(()=>Qe.replace("--\x3e","")+l++)))),r=r.replace(sr,"$1><").trim(),[r,n]}const Qe="\x3c!--c_ui-pl_df--\x3e",qe="\x3c!--c_ui-pl_df",Ye=/<!--c_ui-pl_df\d*(-->)?/;function Ze(t,e,r,n,s=!1){const o=document.createElement("div");o.innerHTML=e;const i=Ie.has(n.constructor);s||!i||Ve.has(n.constructor)||Ve.set(n.constructor,o.cloneNode(!0));let a=0;const l=document.createNodeIterator(o,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let u,d,p=0,h=i?void 0:{},f=null,g="";for(;u=l.nextNode();){a++;let e=i?void 0:[];if(d&&!d.contains(u)&&(d=void 0),u instanceof HTMLElement||u instanceof SVGElement){u instanceof Gt&&(d=u);let s={},o=v(u.attributes);for(let i=0;i<o.length;i++){const a=o[i];let{name:l,value:h}=a;if(l!==He)if(E(l,qe)){let s=r[p];if(S(s)&&tt(s[0])){let[,r,o,i,a]=s;i(Kt.TAG);let c=new Yt(u,l.substring(1),Kt.TAG),h=Ke.get(u);h||(h={},Ke.set(u,h)),h[Symbol.keyFor(s[0])]=[c,n,d];let m=new qt(p,u);m.isDirective=!0,m.value=s,m.isComponent=!!d,t.push(m),f&&f?.contains(u)&&(m.key=g),p++,o(c,r,void 0,{renderComponent:n,slotComponent:d,varChain:a}),e&&e.push({type:Ue.DirectiveTag,point:c,up:m,name:l})}u.removeAttribute(l)}else if(l[0]!==Pe)if(l!==Oe)if(l!==Re)if(!process.env.DEV||l[0]!==ke||Ye.test(h)){if(Ye.test(h)){let o=r[p],i=new qt(p,u,l.replace(/\.|\?|@/,""),h);if(i.isComponent=!!d,f&&f?.contains(u)&&(i.key=g),l[0]===ke||l[0]===Me||l[0]===De){if(S(o)&&tt(o[0])){let[,t,r,s,a]=o;s(Kt.PROP);let c=l.substring(1),p=new Yt(u,c,Kt.PROP),h=Ke.get(u);h||(h={},Ke.set(u,h)),h[c]=[p,n,d],r(p,t,void 0,{renderComponent:n,slotComponent:d}),i.value=o,i.isDirective=!0,e&&e.push({type:Ue.DirectiveProp,up:i,point:p,name:l,attrName:c})}else if(l[0]===Me){i.isToggleProp=!0,i.value=!!o;let t=l.substring(1);i.value&&u.setAttribute(t,""),e&&e.push({type:Ue.AttrBool,name:t,up:i,attrName:l})}else if(l[0]===De){i.value=o;let t=l.substring(1);const[r,n]=t.split(xe);let s=r;switch(n){case"camel":s=D(s);break;case"kebab":s=m(s);break;case"snake":s=et(s)}i.attrName=s,u.setAttribute(s,o),e&&e.push({type:Ue.AttrRef,up:i,name:l,attrName:s})}else if(!process.env.DEV||u instanceof Gt||"SLOT"===u.tagName){let t=D(l.substring(1));process.env.DEV&&!(t in u)&&"SLOT"!==u.tagName&&ft(u.tagName,`Prop '${l}' is not defined in ${u.tagName}`),i.value=o,i.isProp=!0,s[t]=o,e&&e.push({type:Ue.AttrProp,up:i,name:t,attrName:l})}else ft(u.tagName,`Prop '${l}' can only be set on a CompElem or a slot`);u.removeAttribute(l),o=""}else{let t,r;i.value=o;let s={type:Ue.Attr,up:i,attrName:l};if(S(o)&&tt(o[0])){let e=Kt.ATTR;"class"===l?e=Kt.CLASS:"style"===l&&(e=Kt.STYLE);let[,a,c,p,h]=o;p(e),i.isDirective=!0,i.attrName=l;let f=new Yt(u,l,e),g=Ke.get(u);g||(g={},Ke.set(u,g)),g[l]=[f,n,d],r=a,t=c,o="",s.type=Ue.DirectiveAttr,s.point=f}h=Y(h,Ye,o),a.value=h,t&&t(s.point,r,void 0,{renderComponent:n,slotComponent:d}),e&&e.push(s)}t.push(i),p++}}else ft(u.tagName,`Prop '${l}' must be an interpolation`);else{let n=r[p];u.setAttribute(l,n);let s=new qt(p,u);s.notUpdated=!0,f&&f?.contains(u)&&(s.key=g),t.push(s),p++,f=u,g=n,e&&e.push({up:s,type:Ue.AttrKey}),t.length>0&&t.forEach((t=>{t.key=t.key??n}))}else{if(Ye.test(h)){let n=r[p];if(process.env.DEV&&!c(n,"current")){ft(u.tagName,"Ref must be a RefObject");continue}let s=new qt(p,u);s.notUpdated=!0,f&&f?.contains(u)&&(s.key=g),t.push(s),p++,n.current=u,e&&e.push({type:Ue.Ref,up:s,attrName:l})}u.removeAttribute(l)}else{let s=t=>{},o=null,i=!1;if(Ye.test(h)){o=new qt(p,u),o.notUpdated=!0,f&&f?.contains(u)&&(o.key=g),t.push(o);let e=r[p];if(process.env.DEV&&!y(e)){ft(u.tagName,`Event '${l}' must be a function`);continue}s=e.bind(n),p++,i=!0}let a=l.substring(1);we(a,s,u,n),u.removeAttribute(l),e&&e.push({type:Ue.Event,up:o,name:a,attrName:l,value:i})}else{let t=u.getAttribute("name")||"default";e&&e.push({type:Ue.AttrSlot,name:t,attrName:l})}}u instanceof Gt?(u._initProps(s),u._regWrapper(n)):u instanceof HTMLSlotElement&&n._bindSlot(u,u.name||"default",s)}else{let s=u;if(`\x3c!--${s.nodeValue}--\x3e`!==Qe)continue;let o=new qt(p,u);f&&f?.contains(u)&&(o.key=g),t.push(o),o.isComponent=!!d,o.isText=!0;let i=r[p];if(S(i)&&tt(i[0])){const t=Symbol.keyFor(i[0]);let r;r=document.createComment(`compelem-${n.tagName}-${t}-start`),o.textNode=r,s.parentNode.insertBefore(r,s),s.nodeValue=`compelem-${n.tagName}-${t}-end`,s._diName=t,o.isDirective=!0,o.value=i;let a=d?Kt.SLOT:Kt.TEXT,[,l,c,u,p]=i;u(a);let h=new Yt(r,"",a);h.endNode=s,ze.set(s,[h,n,d,l,p]),Fe.set(s,c),Ge.set(s,o),Mt.startRender(s);let f=c(h,l,void 0,{renderComponent:n,slotComponent:d,varChain:p});if(Mt.endRender(n),f){let t=Je(s,f[1],n);t&&t.length>0&&rr.insertBefore(s,Array.from(t))}i=void 0,e&&e.push({type:a===Kt.SLOT?Ue.DirectiveSlot:Ue.DirectiveText,up:o,point:h})}else o.value=i,e&&e.push({type:Ue.Text,up:o});p++;let a=Z(i??""),l=document.createTextNode(a);s.parentNode.insertBefore(l,s),o.textNode=l}h&&e&&(h[a]=e),f&&!f.contains(u)&&f!==u&&(f=null,g="")}return!s&&h&&Ie.set(n.constructor,h),o.childNodes}function Je(t,e,r){let[n,s]=Xe(r,e),o=[],i=Ze(o,n,s,r,!0);return je.set(t,o),i}function tr(t,e,r){if(s(X(t.strings)))return;if(!Be.has(e))return;let{vars:n}=t;r=r??Be.get(e);for(let t=0;t<r.length;t++){const s=r[t];let a=s.varIndex;if(a<0)continue;if(s.notUpdated)continue;let l=s.value,c=n,u=s.node,d=Q(a,"-");for(let e=0;e<d.length;e++){const r=d[e];c=o(c,r),c&&c.vars&&t<d.length-1&&(c=c.vars)}if(!i(l)&&l===c)continue;let p=u;if(s.isDirective){let[t,e,r,,n]=s.value,o=ze.get(u);if(!o){const e=Ke.get(u);o=e[s.attrName]||e[Symbol.keyFor(t)]}let[i,a,l]=o,[,d]=c;const p=Ge.get(u);if(p){p.value=c;ze.get(u)[3]=d}Jt(i,d,e,r,a,l,n,i.type==Kt.TEXT||i.type==Kt.SLOT)}else if(s.isToggleProp){if(!!c===l)continue;p.toggleAttribute(s.attrName,!!c),$(p,s.attrName,!!c)}else if(s.isProp){if(!i(c)&&c===l)continue;u instanceof Gt?u._updateProps({[s.attrName]:c}):u instanceof HTMLSlotElement&&e._updateSlot(u.getAttribute("name")||"default",s.attrName,c)}else if(s.attrName){if(!q(l,c))switch(s.attrName){case"value":if(u instanceof HTMLInputElement){u.value=c;break}default:u.setAttribute(s.attrName,Y(s.attrTmpl,Ye,c+""))}}else if(s.isText){s.textNode.textContent=Z(c??"")}s.value=c}}function er(t,e,r,n){const s=Fe.get(t),[o,i,a,l,c]=ze.get(t),u=Ge.get(t);if(!r){let t=s(o,u.value[1],l,{renderComponent:i,slotComponent:a,varChain:c});if(!t)return;r=t[1]}if(r&&r.vars[0]instanceof ir){let t=[],e=[];g(r.vars,(r=>{e.push(...r.vars),t.push(...F(r.vars,(t=>"1")))})),t.push("1"),r=new ir(t,e)}n&&je.set(t,n),tr(r,e,n=n??je.get(t))}const rr={insertBefore:function(t,e){if(!t.parentNode)return;let r=document.createDocumentFragment();r.append(...e),t.parentNode.insertBefore(r,t)},remove:function(t,e){if(t===e)return void t?.parentNode?.removeChild(t);let r=t.nextSibling;for(;r&&r!==e;)r?.parentNode?.removeChild(r),r=t.nextSibling}};function nr(t,...e){return new ir(r(t)?[t]:t,e)}const sr=/([a-z0-9"'])\s*>\s*</gim;function or(t){return{current:t}}class ir{strings;vars;constructor(t,e){this.strings=u(t),this.vars=e}getKey(){let t=this.vars,e="";return g(this.strings,((r,n)=>{if(lt.test(r))return e=Z(t[n]),!1})),e}getKeys(){let t=this.vars,e=[];for(let r=0;r<this.strings.length;r++){const n=this.strings[r];if(lt.test(n)){let n=Z(t[r]);e.push(n)}}return l(e)&&t.forEach((t=>{if(t instanceof ir){let r=t.getKey();e.push(r)}})),e}append(t){let e=b(this.strings);return t.strings.forEach(((t,r)=>{0!=r?this.strings.push(t):this.strings[this.strings.length-1]=e+t})),this.vars=u(this.vars,t.vars),this}insert(t,e){let r=e.strings.shift();return this.strings[t]+=r,this.strings.splice(t+1,0,...e.strings),this.vars.splice(t,0,...e.vars),this}getHTML(t){let[e,r]=Xe(t,this),n=Ze([],e,r,t);return nt(n,((t,e)=>t+(e.outerHTML??"")),"")}}function ar(t,e,r){r.get||ht(`Computed '${e}' must be a getter`),c(t.constructor,ut.COMPUTED)||(t.constructor[ut.COMPUTED]=l(t.constructor[ut.COMPUTED])?{}:f(t.constructor[ut.COMPUTED])),t.constructor[ut.COMPUTED][e]=r.get}const lr=Ct(class extends bt{static get priority(){return Number.MAX_VALUE}created(t,e,r,...n){let s=o(t,r);$(t,r,H(s,this.wait,this.immediate));let i=Reflect.getPrototypeOf(t);i&&!o(i,r+"_$__")&&$(i,r+"_$__",s)}beforeMount(t,e,...r){}mounted(t,e,...r){}updated(t,e){}get targets(){return[pt.METHOD]}wait;immediate;result;constructor(t,e=!1){super(),this.wait=t,this.immediate=e}});function cr(t,e){return(r,n,s)=>{c(r.constructor,ut.EVENTS)||(r.constructor[ut.EVENTS]=l(r.constructor[ut.EVENTS])?[]:f(r.constructor[ut.EVENTS])),r.constructor[ut.EVENTS].push({name:t,options:e,fn:r[n]})}}const ur=Ct(class extends bt{static get priority(){return Number.MAX_VALUE}created(t,e,r,...n){let s=M(o(t,r),t);$(t,r,k(s));let i=Reflect.getPrototypeOf(t);i&&!o(i,r+"_$__")&&$(i,r+"_$__",s)}beforeMount(t,e,...r){}mounted(t,e,...r){}updated(t,e){}get targets(){return[pt.METHOD]}wait;result;constructor(){super()}});var dr;!function(t){t.ONCE="once",t.UPDATABLE="updatable"}(dr||(dr={}));class pr extends bt{static get priority(){return Number.MAX_VALUE}created(t,e,r,...n){}mounted(t,e,...r){}get targets(){return[pt.FIELD]}selector;cache;result;constructor(t,e){super(),this.selector=t,this.cache=e}static getKey(t){return t}getter(t){this.result=t.shadowRoot?.querySelector(this.selector)}beforeMount(t,e,r,n,...s){const o=this;Reflect.defineProperty(t,n,{get:()=>(o.result&&o.cache||o.getter(t),o.result)})}updated(t,e){this.cache===dr.UPDATABLE&&this.getter(t)}}const hr=Ct(pr),fr=Ct(class extends pr{getter(t){this.result=t.shadowRoot?.querySelectorAll(this.selector)}});function gr(t){if(1===arguments.length)return(e,r)=>{mr(e,r,t)};mr(arguments[0],arguments[1],{prop:""})}function mr(t,e,r){if(!c(t.constructor,ut.STATES)){const e={};let r=t.constructor;for(;(r=mt(r))!==Gt;)h(e,r[ut.STATES]?f(r[ut.STATES]):{});Reflect.defineProperty(t.constructor,ut.STATES,{configurable:!1,enumerable:!1,value:e})}r.shallow=r.shallow||!1,t.constructor[ut.STATES][e]=r}function vr(t,e,r){mr(t.prototype,e,r||{prop:""})}function br(t){return e=>{if(e){if(e.prototype.hasOwnProperty("attributeChangedCallback")){let t=e.prototype.attributeChangedCallback;e.prototype.attributeChangedCallback=function(e,r,n){Gt.prototype.attributeChangedCallback.call(this,e,r,n),t.call(this,e,r,n)}}if(e.prototype.hasOwnProperty("connectedCallback")){let t=e.prototype.connectedCallback;e.prototype.connectedCallback=function(){Gt.prototype.connectedCallback.call(this),t.call(this)}}if(e.prototype.hasOwnProperty("disconnectedCallback")){let t=e.prototype.disconnectedCallback;e.prototype.disconnectedCallback=function(){Gt.prototype.disconnectedCallback.call(this),t.call(this)}}customElements.define(t,e)}}}const Er=Ct(class extends bt{static get priority(){return Number.MAX_VALUE}created(t,e,r,...n){let s=o(t,r);$(t,r,K(s,this.wait));let i=Reflect.getPrototypeOf(t);i&&!o(i,r+"_$__")&&$(i,r+"_$__",s)}beforeMount(t,e,...r){}mounted(t,e,...r){}updated(t,e){}get targets(){return[pt.METHOD]}wait;result;constructor(t){super(),this.wait=t}});function yr(t,e){return(r,n)=>{c(r.constructor,ut.WATCH)||(r.constructor[ut.WATCH]=l(r.constructor[ut.WATCH])?{}:f(r.constructor[ut.WATCH]));(S(t)?t:[t]).forEach((t=>{let s=t.replaceAll(".","-"),o=r.constructor[ut.WATCH][s];S(o)||(o=r.constructor[ut.WATCH][s]=[]),o.push({source:t,options:e,handler:r[n]})}))}}const Sr=["key"],Nr=ee((function(t){return(t,[e],r)=>{let n=t.startNode;if(r)g(e,((t,e)=>{n.setAttribute(e,t)}));else if(n instanceof Gt){let t={},r={},s=o(n.constructor,ut.PROPS);g(e,((e,n)=>{if(Sr.includes(n))return;let o=D(n);s[o]?t[n]=e:r[n]=e+""})),n._initProps(t,r)}else g(e,((t,e)=>{n.setAttribute(e,t)}))}}),[Kt.TAG]),_r=new Map,Cr=ee((function(t){return(t,[e],n,{renderComponent:s})=>{let o=[];if(S(e)?o=B(e):i(e)?o=_(e,((t,e)=>t?e:[])):r(e)&&(o=e.split(" ")),o.length<1&&!n)return;let a=t.startNode;if(_r.get(a)&&_r.get(a).length===o.length&&st(_r.get(a),o))return;let l=_r.get(a);g(l,(t=>{a.classList.remove(t)})),g(o,(t=>{a.classList.add(t)})),l=u(o),_r.set(a,l)}}),[Kt.CLASS]),Tr=new Map,Ar=new Map,wr=ee((function(t,e){return(t,r,n,{varChain:s})=>{let o=t.startNode,i=function(t,e,r){let n=F(t,((t,r)=>e(t,r)));if(n.length<1){let t=new ir([],[]);return Ar.set(r,t),t}let s=[],o=[];const i=[],a=[];for(let t=0;t<n.length;t++){const e=n[t];let r=b(o),l=e.vars,c=!0,u=e.strings;for(let t=0;t<u.length;t++){const e=u[t];if(lt.test(e)){let e=l[t]+"";if(s.includes(e))return void ht(`forEach - duplicate key '${e}'`);s.push(e),c=!1}0==t&&r?o[o.length-1]=r+e:o.push(e)}if(c)return void ht("forEach - missing 'key' prop");let d=b(i);d&&u.length>0&&(i[i.length-1]=O(d)+u.shift()),i.push(""),a.push(e)}i.push("");let l=new ir(i,a);return Ar.set(r,l),l}(r[0],e,o);if(n&&n[0]){const e=Tr.get(o);if(l(t.getNodes())&&(!r||l(r[0])))return[Xt.NONE,i];if(e&&st(e,r[0])&&e.length===r[0].length)return[Xt.NONE,i]}return Tr.set(o,rt(r[0])),n?[Xt.UPDATE,i]:[Xt.APPEND,i]}}),[Kt.TEXT,Kt.SLOT]);const Pr=new WeakMap,kr=ee((function(t,e,r){return(n,[s,o],i,{renderComponent:a})=>{let l=n.endNode;if(i){if(!!s==!!i[0]){let t=Pr.get(l);return[Xt.NONE,t.call(a,s)]}let t=s?e:r;return Pr.set(l,t),[Xt.REPLACE,t.call(a,s)]}{let n=s?e:r;return Pr.set(l,n),[Xt.APPEND,n.call(a,t)]}}}),[Kt.TEXT,Kt.SLOT]),Mr=ee((function(t,e){return(t,[e,r],n)=>n?e===n[0]?[Xt.NONE,e?r():nr``]:e?[Xt.REPLACE,e?r():nr``]:[Xt.REMOVE]:[Xt.APPEND,e?r():nr``]}),[Kt.TEXT,Kt.SLOT]);var Dr;!function(t){t.CHANGE="change",t.INPUT="input"}(Dr||(Dr={}));const xr=new WeakMap,Or=ee((function(t,e="value"){return(r,n,s,{varChain:a,renderComponent:l})=>{const c=r.startNode;if(s){if(q(n,s))return;if(!q(n,s)){let t=n[0];if(c instanceof Gt)c._updateProps({[e]:t});else if(c instanceof HTMLTextAreaElement||c instanceof HTMLSelectElement)c.setAttribute(e,t+"");else if(c instanceof HTMLInputElement){if(c.value==t)return;switch(c.type){case"checkbox":case"radio":t?c.setAttribute("checked",""):c.removeAttribute("checked");break;case"text":case"email":case"number":case"password":case"search":case"tel":case"url":c.setAttribute(e,t+""),$(c,e,t);break;default:c.setAttribute(e,t+"")}}}return}if("binded"===o(c,"_model"))return;let u=b(a);if(xr.set(c,u),i(t)||O(t)||(t=""),c instanceof Gt)c._initProps({[e]:t}),c.addEventListener("update:"+e,(t=>{$(l,u,t.detail.value)})),$(c,"_model","binded");else if(c instanceof HTMLTextAreaElement)c.setAttribute(e,t+""),c.addEventListener("input",(t=>{let e=t.target;$(l,u,e.value)})),$(c,"_model","binded");else if(c instanceof HTMLInputElement){let r="",n="";switch(c.type){case"checkbox":case"radio":r="checked",n="change";break;default:r="value",n="input"}c.setAttribute(e??r,t+""),c.addEventListener(n,(t=>{let e=t.target;$(l,u,e.value)})),$(c,"_model","binded")}else c instanceof HTMLSelectElement&&(c.setAttribute(e,t+""),c.addEventListener("change",(t=>{let e=t.target;$(l,u,e.value)})),$(c,"_model","binded"))}}),[Kt.TAG]),Rr=new Map,Lr=ee((function(t,e){return(t,[r],n)=>{if(n&&r===n[0])return;let s=t.startNode;if(!Rr.has(s)){let t=s.style.display;Rr.set(s,"none"==t?"unset":t)}s.style.display=r?Rr.get(s):"none",e&&e(s,r)}}),[Kt.TAG]),Wr=ee((function(t,e){return(r,n,s,{renderComponent:o,slotComponent:i})=>{s||(t=t.bind(o),i._bindSlotHook(e||"default",t))}}),[Kt.SLOT]);class Hr{static getCssText(t,e=!1){return r(t)?t:X(F(t,((t,r)=>r.startsWith("--")?r+":"+t+(e?" !important":""):m(r)+":"+t+(e?" !important":""))),";")}static setStyle(t,e){if(r(t)&&!O(t))return{};let n=Hr.getCssText(t),s={};return g(n.split(";"),(t=>{let r=t.split(":"),n=O(r[0]),o=O(r[1]);s[n]=e.style.getPropertyValue(n),e.style.setProperty(n,o)})),s}}const $r=new Map;let Vr=0;const Ir=ee((function(t){return(t,e,r,{renderComponent:n})=>{let s=t.startNode,o=$r.get(s);o||(o="style_d"+Vr++,$r.set(s,o)),n.nextTick((()=>{Hr.setStyle(e[0],s)}),o)}}),[Kt.STYLE]),Ur=ee((function(t){return(e,r,n,{renderComponent:s,varChain:o})=>{const i=e.startNode;if(n){if(!q(r,n)){let t=e.attrName;i._updateProps({[t]:r[0]})}return}let a=b(o),l=e.attrName;i._initProps({[l]:t}),i.addEventListener("update:"+l,(t=>{$(s,a,t.detail.value)}))}}),[Kt.PROP]),Br=ee((function(t,e){return(t,[e,r],n)=>{let s=()=>nr``,o=[],i=[];g(r,((t,e)=>{if(y(t))o.push(e),i.push(t);else{let e=t[0],r=t[1];o.push(e),i.push(r)}"default"===e&&(s=t)}));let a=ot(o,(t=>y(t)?t(e):t==e));return n?[Xt.REPLACE,it(i[a]??s)]:[Xt.APPEND,it(i[a]??s)]}}),[Kt.TEXT,Kt.SLOT]);export{Gt as CompElem,Hr as CssHelper,bt as Decorator,pt as DecoratorType,Nt as DecoratorWrapper,Xt as DirectiveUpdateTag,Yt as EnterPoint,Kt as EnterPointType,Et as GetKeyFnName,Dr as ModelTriggerType,dr as QueryCache,ir as Template,qt as UpdatePoint,St as _DecoratorMap,yt as _DecoratorsKey,kt as _getObservedAttrs,Nr as bind,Xe as buildHTML,Cr as classes,ar as computed,or as createRef,lr as debounced,Ct as decorator,ee as directive,cr as event,wr as forEach,nr as html,kr as ifElse,Mr as ifTrue,vr as makeState,Or as model,ur as onced,At as prop,hr as query,fr as queryAll,Lr as show,Wr as slot,gr as state,Ir as styles,Ur as sync,br as tag,Er as throttled,Jt as updateDirective,yr as watch,Br as when};
7
+ import{toPath as t,some as e,isString as r,isUndefined as n,isBlank as s,get as o,isObject as i,isDefined as a,isEmpty as l,has as c,concat as u,defaults as d,isLowerCaseChar as p,merge as h,cloneDeep as f,each as g,kebabCase as m,toArray as v,last as b,startsWith as E,isSymbol as y,isArray as S,isFunction as N,initial as _,flatMap as C,test as T,size as A,assign as w,first as P,closest as M,once as k,bind as O,camelCase as D,isNil as x,trim as R,isBoolean as L,parseJSON as W,isNull as H,debounce as I,set as V,groupBy as j,reject as $,filter as B,compact as U,remove as F,map as K,includes as G,find as z,throttle as X,join as Q,split as q,isEqual as Y,replace as J,toString as Z,replaceAll as tt,snakeCase as et,clone as rt,reduce as nt,isMatch as st,findIndex as ot,call as it}from"myfx";const at=/\s+\.?key\s*=/;var lt,ct,ut,dt;function pt(t){console.error("[CompElem]",t)}function ht(t,e){console.error(`[CompElem <${t}>]`,e)}function ft(e){return t(e).join("-")}function gt(t){return Object.getPrototypeOf(t)}function mt(t){return t===Boolean||e(t,(t=>t===Boolean))}function vt(t){let e=t;return r(t)&&/(?:^true$)|(?:^false$)/.test(e)?e="true"===e:(n(e)||s(e))&&(e=!0),e}!function(t){t[t.CSS=1]="CSS",t[t.COMPUTED=2]="COMPUTED"}(lt||(lt={})),function(t){t.PROPS="__deco_props",t.STATES="__deco_states",t.COMPUTED="__deco_computed",t.WATCH="__deco_watch",t.EVENTS="__deco_events"}(ct||(ct={})),function(t){t.Prod="prod",t.Dev="dev"}(ut||(ut={})),function(t){t.CLASS="class",t.FIELD="field",t.METHOD="method"}(dt||(dt={}));class bt{static get priority(){return 0}}const Et="getKey",yt="__decorators",St=new WeakMap;class Nt{args;metadata;decoratorClass;instanceMap;key;priority=0;constructor(t,e,r){this.args=t,this.metadata=e,this.decoratorClass=r,this.priority=o(r,"priority",0),this.instanceMap=new WeakMap}create(t){let e,r=new this.decoratorClass(...this.args),s=r.targets,c=this.metadata[2];i(c)&&a(o(c,"configurable"))?e=dt.METHOD:n(this.metadata[2])&&(e=dt.FIELD),!l(s)&&e&&s.includes(e)?(r.created(t,...this.metadata),this.instanceMap.set(t,r)):pt(`Decorator '${this.decoratorClass.name}' is out of targets, expect '${s.join(",")}' bug got '${e}'`)}beforeMount(t,e){this.instanceMap.get(t).beforeMount(t,e,...this.metadata)}mounted(t,e){this.instanceMap.get(t).mounted(t,e,...this.metadata)}updated(t,e){this.instanceMap.get(t).updated(t,e)}}const _t=new WeakMap;function Ct(t){let e=(...e)=>(...r)=>{let n=r[0].constructor,s=n[yt];if(!c(n,yt)){let t=Object.getPrototypeOf(n);s=t?u(t[yt]??[]):[],Reflect.defineProperty(n,yt,{configurable:!1,enumerable:!1,value:s})}let o,i={},a=t[Et];if(a){let r=_t.get(t);if(r||(r=new WeakMap,_t.set(t,r)),i=r.get(n),i||(i={},r.set(n,i)),o=a(...e),i[o])return i[o]}let l=new Nt(e,r,t);return i[o]=l,s?.push(l),l};return St.set(e,!0),e}const Tt=new WeakMap;function At(t){if(1===arguments.length)return(e,r,n)=>{t.required=t.required||!1,t.attribute=!1!==t.attribute,wt(e,r,t,n)};let e=arguments[0],r=arguments[1],n=arguments[2];t={type:void 0,required:!1,attribute:!0},n&&"function"==typeof n.type&&(t=d(n,t),n=void 0),wt(e,r,t,n)}function wt(t,e,r,n){let s;if(p(e[0])||pt(`Prop '${e}' must be in CamelCase`),!c(t.constructor,ct.PROPS)){const e={};let r=t.constructor;for(;(r=gt(r))!==Jt;)h(e,r[ct.PROPS]?f(r[ct.PROPS]):{});Reflect.defineProperty(t.constructor,ct.PROPS,{configurable:!1,enumerable:!1,value:e}),s=new Set,g(e,((t,e)=>{if(t.attribute){let t=m(e);s?.add(t)}})),Tt.set(t.constructor,s)}if(n&&(n.get&&(r.getter=n.get),n.set&&(r.setter=n.set)),r.attribute){s||(s=Tt.get(t.constructor));let r=m(e);s?.add(r)}c(t.constructor,"observedAttributes")||(t.constructor.observedAttributes=[]),t.constructor.observedAttributes=v(s),t.constructor[ct.PROPS][e]=r}const Pt=new Set;function Mt(t){return Tt.get(t)??Pt}var kt,Ot;!function(t){t.ATTR="attr",t.PROP="prop",t.TEXT="text",t.CLASS="class",t.STYLE="style",t.SLOT="slot",t.TAG="tag"}(kt||(kt={})),function(t){t.NONE="NONE",t.REMOVE="REMOVE",t.REPLACE="REPLACE",t.UPDATE="UPDATE",t.APPEND="APPEND"}(Ot||(Ot={}));class Dt{key;varIndex;value;isText=!1;isDirective=!1;node;textNode;isComponent=!1;attrName;attrTmpl;isProp=!1;isToggleProp=!1;notUpdated;constructor(t,e,r,n){this.varIndex=t,this.node=e,r&&(this.attrName=r),n&&(this.attrTmpl=n)}}const xt="-",Rt={collectWatch(t,e,r){let n=Vt.get(t);n||(n={},Vt.set(t,n));let s=n[r];s||(s=n[r]=[]),s.push(e)},startCollect(t,e){this.__collectType=e,this.__collecting=t},setUpdater(t){this.__updater=t},endCollect(){this.__collecting=null},__directiveQ:[],setDirectiveQ(t){let e=b(this.__directiveQ);const r=t?t.join(","):"",n=e?e.join(","):"";e&&r===n||(e&&e.length<t.length&&E(r,n)?this.__directiveQ[this.__directiveQ.length-1]=t:this.__directiveQ.push(t))},popDirectiveQ(){let t=u(this.__directiveQ);return this.__directiveQ=[],t},startRender(t){this.__renderCollecting=!0,this.__renderContext=t},endRender(t){this.__renderCollection.forEach((e=>{t._regDeps(e,this.__renderContext)})),this.__renderCollection.clear(),this.__renderCollecting=!1,this.__renderContext=null},collect(t){this.__renderCollection.add(t)},clear(){this.__directiveQ=[]},__updater:null,__collecting:null,__collectType:-1,__renderCollection:new Set,__renderContext:null,__renderCollecting:!1,__skipCheck:!1},Lt=new WeakMap,Wt=new WeakMap,Ht=new WeakMap,It=new WeakMap,Vt=new WeakMap,jt=new WeakMap;function $t(t,e){if(!i(t))return t;if(jt.has(t))return jt.get(t);if(Lt.has(t))return t;const r=new Proxy(t,{get(t,e,r){if(!e)return;const n=Reflect.get(t,e,r);if(y(e))return n;if("length"===e&&S(t))return n;let s=Wt.get(r)??[],a=u(s,[e]),l=e in t;if((Rt.__renderCollecting||Rt.__collecting)&&(l&&t.hasOwnProperty(e)||!l)){let t=a.join(xt);if(Rt.__renderCollecting)Rt.collect(ft(a)),Rt.setDirectiveQ(a);else if(Rt.__collecting){let e;switch(Rt.__collectType){case lt.COMPUTED:e=Ht.get(Rt.__collecting),e||(e={},Ht.set(Rt.__collecting,e));break;case lt.CSS:e=It.get(Rt.__collecting),e||(e={},It.set(Rt.__collecting,e))}let r=e[t];r||(r=e[t]=[]),r.push(Rt.__updater)}}const c=Lt.get(r);let d=c.from,p=o(d.constructor,ct.STATES);if(o(p,[e,"shallow"]))return n;let h=n;if(i(n)&&!N(n)&&!(n instanceof Node)&&!Object.isFrozen(n)){let t=c.pathMap;c.contextSet.forEach((e=>{let r=t?.get(e);r&&(h=$t(n,e),jt.set(n,h),Wt.has(h)||Wt.set(h,a))}))}return h},set(t,r,n,s){if(!r)return!1;let i=t[r],a=Wt.get(s)??[],l=u(a,[r]),c=o(e.constructor,ct.PROPS),d=o(e.constructor,ct.STATES),p=o(c,[l[0],"hasChanged"])||o(d,[l[0],"hasChanged"]);if(p){let t=n,r=i;if(l.length>1&&(r=t=e._getPrivateData()[l[0]]),!p.call(e,t,r,l,n,i))return!0}else if(Object.is(i,n))return!0;c&&c[r]&&t.__isData&&c[r].sync&&e.emit("update:"+r,{value:n});let h=n,f=Reflect.set(t,r,h);return Bt(e,i,l),f}});let n=Wt.get(t)??[];if(Object.isExtensible(t)&&!Lt.get(r)){let t=new Set;t.add(e);let s=new WeakMap;s.set(e,n),Lt.set(r,{from:e,contextSet:t,pathMap:s})}else{Lt.get(r).contextSet.add(e);let t=Lt.get(r).pathMap,s=t.get(e),i=u(n);if(s&&s.join("")!==i.join("")){let t=o(e,_(s));S(t)||function(...t){console.warn("[CompElem]",...t)}(`The object is referenced by more than one @state '${i.join(".")},${s.join(".")}'`),s=i}else t.set(e,i)}return jt.set(t,r),r}function Bt(t,e,r){let n=Ht.get(t),s=It.get(t),i=Vt.get(t);if(n||s||i){let t=r.length;for(;t;){let a=r.slice(0,t).join(xt);if(i){const n=i[a];t===r.length?n?.forEach((t=>{let r=t();r.ov=e,Ft.pushWatch(r)})):n?.forEach((t=>{let r=t();o(r,"deep")&&(r.ov=e,Ft.pushWatch(r))}))}if(n){let t=n[a];if(!l(t))for(let e=0;e<t.length;e++){const r=t[e];Ft.pushComputed(r)}}if(s){let t=s[a];if(!l(t))for(let e=0;e<t.length;e++){const r=t[e];Ft.pushCss(r)}}t--}}let a=t._notify(e,r);Ft.pushNext(a,t.cid)}const Ut=new Map;class Ft{static watchSet=new Set;static computedSet=new Set;static cssSet=new Set;static nextSet=new Set;static nextPending=!1;static next;static flush(){Ft.nextPending=!1;let t=Array.from(Ft.watchSet);Ft.watchSet.clear();let e=Array.from(Ft.computedSet);Ft.computedSet.clear();let r=Array.from(Ft.cssSet);Ft.cssSet.clear();let n=Array.from(Ft.nextSet);Ft.nextSet.clear(),Ut.clear(),t.forEach((t=>t(o(t,"ov")))),e.forEach((t=>t())),r.forEach((t=>t())),n.forEach((t=>t()))}static pushWatch(t){Ft.watchSet.add(t)}static pushComputed(t){Ft.computedSet.add(t)}static pushCss(t){Ft.cssSet.add(t)}static pushNext(t,e){if(e){if(Ut.has(e))return;Ut.set(e,t)}Ft.nextSet.add(t),Ft.nextPending||(Ft.nextPending=!0,Ft.next())}}(()=>{const t=Promise.resolve(),e=Ft.flush;Ft.next=()=>{t.then(e)}})();const Kt={boolean:Boolean,string:String,number:Number,object:Object,array:Array,function:Function,undefined:Object},Gt=new WeakMap;let zt=[],Xt=0;const Qt=new Map,qt=new WeakMap,Yt=Symbol.for("PROP_OBJECT_KEY_MAP_SYMBOL");class Jt extends HTMLElement{static __l_globalRule=document.createElement("style");static defaults(t){zt=C(t.css,(t=>{if(r(t)){let e=new CSSStyleSheet;return e.replaceSync(t),e}return t instanceof CSSStyleSheet?t:[]})),t.global,g(t,((t,e)=>{T(e[0],/[A-Z]/)}))}#t;#e={};#r={"#slots":{}};#n={};#s={};#o;#i={};__events={};_propObjectKeyMap={};get[Yt](){return this._propObjectKeyMap}get[Symbol.toStringTag](){return this.constructor.name}get cid(){return this.#t}get reactiveData(){return this.#n}get attrs(){return this.#a}get props(){return this.#l}get renderRoot(){return this.#c}get renderRoots(){return this.#u}get parentComponent(){return this.#d}get wrapperComponent(){return this.#p}get slotHooks(){return this.#h}get css(){return Gt.get(this.constructor)}get globalStyleSheet(){return Qt.get(this.constructor)?.sheet}get isMounted(){return this.#f}get slots(){return this.#r["#slots"]}#a;#l;#c;#u;#d;#p;#g={};#h={};#m={};#f=!1;static get styles(){return[]}static get globalStyles(){return[]}static get hostStyles(){return[]}get styles(){return[]}#v=!1;#b=!1;constructor(...t){super(),this.#t=Xt++,1===A(t)&&(this.#l={},w(this.#l,P(t)));let e=this.render.bind(this);this.render=function(){let t;return Rt.startRender(this),t=e(),Rt.endRender(this),t};let n=o(this.constructor,"globalStyles"),s=Qt.has(this.constructor);if(!l(n)&&!s){let t="";n.forEach((e=>{r(e)&&(t+=e+"\n")}));let e=document.createElement("style");e.textContent+=t,Qt.set(this.constructor,e),document.head.appendChild(e)}let i=Gt.get(this.constructor),a=i??[];i||(g(o(this.constructor,"styles"),(t=>{if(r(t)){let e=new CSSStyleSheet;e.replaceSync(t),a.push(e)}else a.push(t)})),Gt.set(this.constructor,a)),this.#o=this.attachShadow({mode:"open"}),this.#o.adoptedStyleSheets=[...zt,...a],this.#E();let c=o(this.constructor,yt);c&&c.sort(((t,e)=>e.priority-t.priority)).forEach((t=>t.create(this))),this.#y=this.#S.bind(this)}get rootComponent(){let t=this;for(;t.parentComponent;)t=t.parentComponent;return t}#y;connectedCallback(){let t=M(this.parentNode,(t=>t instanceof Jt||t.host instanceof Jt),"parentNode");this.#d=t?t instanceof Jt?t:t.host:null,this.__init()}disconnectedCallback(){}__init(){if(this.#v)return;if(this.#b)return;this.#b=!0,this.#E();const t=this.#N();this.propsReady(t);for(const e in t){const r=t[e];this.#r[e]=r}this.#_(),g(this.#r,((t,e)=>{let r=Reflect.getOwnPropertyDescriptor(this.#r,e);Reflect.defineProperty(this,e,{get(){let t=Reflect.get(this.#n,e);return r?.get?r?.get():t},set(t){r?.set?r?.set(t):Reflect.set(this.#n,e,t)}})})),Reflect.defineProperty(this.#r,"__isData",{enumerable:!1,value:!0}),this.#n=$t(this.#r,this);let e=o(this.constructor,ct.COMPUTED);g(e,((t,e)=>{Rt.startCollect(this,lt.COMPUTED),Rt.setUpdater((()=>{this.#n[e]=t.call(this)})),this.#r[e]=t.call(this),Rt.endCollect(),Reflect.defineProperty(this,e,{get(){return Reflect.get(this.#n,e)},set(t){ht(this.tagName,"Cannot set a computed property '"+e+"'")}})}));let n=o(this.constructor,ct.WATCH);g(n,((t,e)=>{t.forEach((t=>{let{source:r,options:n,handler:s}=t,i=s.bind(this);o(n,"once",!1)&&(i=k(i));const a=function(t){let e=o(this,r.replaceAll(xt,"."));i(e,t,r)}.bind(this);let l=o(n,"deep",!1);if(a.deep=l,Rt.collectWatch(this,(()=>a),e),!o(n,"immediate",!1))return;let c=o(this,r.replaceAll(xt,"."));i(c,c,r)}))}));let i=function(t,e){let r,n=[];if(je.has(e.constructor)){let s=je.get(e.constructor),i=function(t,e){let r=u(e.vars),n=e.strings.length-1;for(let s=0;s<=n;s++){let n=o(e.vars,s,"");if(n instanceof lr){let[e,o]=qe(t,n);r.splice(s,1,...o)}}return r}(e,t);r=$e.has(e.constructor)?function(t,e,r){let n=$e.get(r.constructor)?.cloneNode(!0),s=Be.get(r.constructor);const o=document.createNodeIterator(n,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let i,a,l=0,c=0;for(;i=o.nextNode();){let n;if(c++,a&&!a.contains(i)&&(a=void 0),i instanceof HTMLElement||i instanceof SVGElement){i instanceof Jt&&(a=i);let o={};s[c].forEach((s=>{let c=e[l++];switch(s.type){case Ue.Event:n=rt(s.up),s.value||l--,s.value&&ke(s.name,c.bind(r),i,r),i.removeAttribute(s.attrName);break;case Ue.AttrSlot:a&&s.name,i.removeAttribute(s.attrName);break;case Ue.Ref:n=rt(s.up),c.current=i,i.removeAttribute(s.attrName);break;case Ue.AttrKey:n=rt(s.up),i.setAttribute(He,c);break;case Ue.AttrBool:n=rt(s.up),n.value=!!c,n.node=i,n.value&&i.setAttribute(s.name,""),i.removeAttribute(s.attrName);break;case Ue.AttrProp:n=rt(s.up),n.value=c,n.node=i,o[s.name]=c,s.attrName&&i.removeAttribute(s.attrName);break;case Ue.AttrRef:case Ue.Attr:n=rt(s.up),n.value=c,n.node=i,i.setAttribute(s.attrName,c),Ue.AttrRef===s.type&&i.removeAttribute(s.name);break;case Ue.DirectiveAttr:case Ue.DirectiveTag:case Ue.DirectiveProp:n=rt(s.up),n.value=c,n.node=i;let t=rt(s.point);t.startNode=i;let[e,u,d,p,h]=c,f=Qe.get(i);if(f||(f={},Qe.set(i,f)),f[s.attrName??Symbol.keyFor(e)]=[t,r,a],d(t,u,void 0,{renderComponent:r,slotComponent:a,varChain:h}),Ue.DirectiveAttr===s.type){let t=i.getAttribute(s.attrName);t=J(t,Ze,""),i.setAttribute(s.attrName,t)}s.name&&i.removeAttribute(s.name)}n&&t.push(n)})),i instanceof Jt?(i._initProps(o),i._regWrapper(r)):i instanceof HTMLSlotElement&&r._bindSlot(i,i.name||"default",o)}else{s[c].forEach((s=>{let o=e[l++];switch(s.type){case Ue.DirectiveSlot:case Ue.DirectiveText:n=rt(s.up),n.value=o,n.node=i;let[t,e,l,c,u]=o,d=Symbol.keyFor(t),p=document.createComment(`compelem-${r.tagName}-${d}-start`);n.textNode=p,i.parentNode.insertBefore(p,i),i.nodeValue=`compelem-${r.tagName}-${d}-end`;let h=rt(s.point);h.startNode=p,h.endNode=i,ze.set(i,[h,r,a,e,u]),Ge.set(i,l),Xe.set(i,n),Rt.startRender(i);let f=l(h,e,void 0,{renderComponent:r,slotComponent:a,varChain:u});Rt.endRender(r);let g=er(i,f[1],r);g&&g.length>0&&sr.insertBefore(i,Array.from(g));break;case Ue.Text:n=rt(s.up),n.node=i;let m=Z(o??""),v=document.createTextNode(m);i.replaceWith(v),n.textNode=v}n&&t.push(n)}))}}return n.childNodes}(n,i,e):tr(n,s,i,e)}else{let[s,o]=qe(e,t);je.set(e.constructor,s),r=tr(n,s,o,e)}return Fe.set(e,n),r}(this.render(),this);i&&(this.#o.append(...i),this.#u=B(this.#o.childNodes,(t=>t.nodeType===Node.ELEMENT_NODE)),this.#c=this.#u[0]),g(this.#h,((t,e)=>{this.#C(e)}));const a=this;let l=o(this.constructor,yt);l&&l.sort(((t,e)=>e.priority-t.priority)).forEach((t=>{t.beforeMount(this,((t,e)=>(a.#n[t]=e,a.#n[t])))}));let c=o(this.constructor,"hostStyles"),d=this.#p?.shadowRoot??this.ownerDocument,p=qt.get(d);if(!p?.includes(this.constructor)&&c.length>0){let t=[];g(c,(e=>{if(r(e)){let r=new CSSStyleSheet;r.replaceSync(e),t.push(r)}else t.push(e)})),d.adoptedStyleSheets=[...d.adoptedStyleSheets,...t],p?.push(this.constructor)}this.beforeMount();let h=o(this.constructor,ct.EVENTS);h&&h.forEach((async t=>{let e=t.name,r=w({target:document,once:!1,passive:!1,capture:!1},t.options),n=O(t.fn,this),s=r.target;N(s)&&(s=await s.call(this,this)),s?s.addEventListener(e,n,r):ht(this.tagName,"The target of @event('"+e+"',...) is invalid")})),Rt.startCollect(this,lt.CSS);let f=[];this.styles.forEach((t=>{if(!N(t))return;let e=new CSSStyleSheet;f.push(e),Rt.setUpdater((()=>{let r=t()??"";e.replaceSync(r)}));let r=t();s(r)||e.replaceSync(r)})),Rt.endCollect(),f.length>0&&(this.#o.adoptedStyleSheets=[...this.#o.adoptedStyleSheets,...f]),setTimeout((()=>{this.#f=!0,this.mounted(),l&&l.forEach((t=>{t.mounted(this,((t,e)=>(a.#n[t]=e,a.#n[t])))}))}),0),this.#v=!0}propsReady(t){}render(){throw Error(`[CompElem <${this.tagName}>] Missing render()`)}beforeMount(){}mounted(){}#T(t,e){this.#E();let r=o(this.#e[e],"props");r&&g(this.slots,((t,e)=>{t.filter((t=>t.nodeType===Node.ELEMENT_NODE)).forEach((t=>{t instanceof Jt?t._updateProps(r):g(r,((e,r)=>{if(t instanceof HTMLSlotElement){let n=o(t,"__l_comp");if(n){let s=t.name||"default",o=n.#e[s];o||(o=n.#e[s]={props:{}}),o.props||(o.props={}),o.props[r]=e,n.#T(t,s)}}else t.setAttribute(r,e)}))}))})),this.slotChange(t,e)}slotChange(t,e){}attributeChangedCallback(t,e,r){if(Object.is(r,e))return;let n=D(t);if(mt(o(this.constructor,[ct.PROPS,n]).type)){let t=vt(r);if(o(this,n)===t)return}this.#A(t,e,r)}shouldUpdate(t){return!0}updated(t){}#w={};_notify(t,e){let r=[];for(let n=0;n<e.length;n++){const s=e[n];r.push(s);let i=o(this,r),a=ft(r);this.#s[a]={value:i,chain:"slots"===a?["slots"]:r,oldValue:t,end:r.length===e.length}}return this.#y}#S(){if(A(this.#s)<1)return;const t=this.#s;this.#s={};const e=Object.keys(t);let r=o(this.constructor,yt);if(r&&r.sort(((t,e)=>e.priority-t.priority)).forEach((e=>{e.updated(this,t)})),!this.shouldUpdate(t))return;let n=new Set;const s=this.#i;g(t,(({value:t,chain:e,oldValue:r,end:o},i)=>{s[i]&&s[i].forEach((t=>{n.add(t)}))})),n.forEach((t=>{t===this?rr(this.render(),this,void 0,e):nr(t,this)})),this.#P.forEach((t=>{this.#C(t)})),this.updated(t)}#N(){let t=o(this.constructor,ct.PROPS),e=this.attributes,r=this.tagName,s=this.#l,l={};g(e,(({name:e,value:r})=>{if(e[0]===Oe||e[0]===De||e[0]===xe||e===We||"slot"===e)return;let n=D(e);t&&!t[n]&&(l[e]=r)})),this.#a=this.#a?w(this.#a,l):l;let u={};if(!t)return Object.seal(u);let d=Object.keys(t),p=d.length;for(let l=0;l<p;l++){const p=d[l],h=m(p),f=this.hasAttribute(h);let g,v=t[p],b=c(s,p),E=o(this,p);if(!("_defaultValue"in v)&&(v._defaultValue=E,!v.type)){n(E)&&ht(r,"Prop '"+p+"' has neither propType nor defaultValue be used for type inference");let t=typeof E;S(E)&&(t="array");let e=Kt[t];v.type=e}if(b)g=x(s[p])?E:s[p];else{g=E;let t=e.getNamedItem(h)||e.getNamedItem(De+h);t&&(b=!0,g=t.value)}if(v.required&&!b){ht(r,"Prop '"+p+"' is required");break}g=this.#M(t,p,g,f);let y=o(t,[p,"getter"]);y&&(y=O(y,this));let N=o(t,[p,"setter"]);N&&(N=O(N,this)),(y||N)&&Reflect.defineProperty(this.#r,p,{set:N||function(t){},get:y}),v.attribute&&a(g)&&!i(g)&&this.#k(v,p,g),this.#r[p]=g,u[p]=g}return Object.seal(u)}#k(t,e,r){let n=m(e),s=R(r);mt(t.type)?(s=vt(r),L(s)?s&&!this.hasAttribute(n)?this.toggleAttribute(n,!0):!s&&this.hasAttribute(n)&&this.toggleAttribute(n,!1):this.getAttribute(n)!==s&&this.setAttribute(n,s)):this.getAttribute(n)!==s&&this.setAttribute(n,s)}#O(t,e){let r=t;try{for(let n=0;n<e.length;n++){const s=e[n];r=s===Boolean?vt(t):s===Number?Number(t):s===String?String(t):s===Object||s===Array?W(t):s===Date?new Date(t):new s(t)}}catch(e){ht(this.tagName,"Convert attribute error with "+t)}return r}#M(t,n,s,o){let i=t[n];if(!i)return s;let l=i.isValid,c=i.type,u=S(c)?c:[c],d=i.converter,p=s;if(!e(u,(t=>t===String))&&r(p)&&!H(p))try{p=d?d(p):this.#O(p,u)}catch(t){ht(this.tagName,`Convert attribute '${n}' error with `+p)}for(let t=0;t<u.length;t++){"Boolean"===u[t].name&&o&&(p=vt(p))}if(x(p))return p;let h=typeof p,f=!a(p);for(let t=0;t<u.length;t++){const e=u[t];if(T(h,e.name,"i")||p instanceof e||Object.prototype.toString.call(p)===Object.prototype.toString.call(e.prototype)){f=!0;break}}return f||ht(this.tagName,`Invalid prop '${n}'. expected '${u.map((t=>t.name||t))}' but got '${h}'`),l&&(l.call(this,p,this.#r)||ht(this.tagName,`Invalid prop '${n}'. IsValid() check failed`)),p}#_(){let t=o(this.constructor,ct.STATES);g(t,((e,r)=>{let n=t[r],s=o(this,r);if(n){let t=n.prop;s=t?f(this.#r[t]):o(this,r)}this.#r[r]=s}))}#D=I(this.propsReady,100);_updateProps(t){let e=o(this.constructor,ct.PROPS),r=[];g(t,((t,n)=>{let s=D(n),o=e[s];o&&(t=this.#M(e,s,t),o.attribute&&a(t)&&!i(t)&&r.push([o,s,t]),Rt.__skipCheck=!0,V(this,s,t),Rt.__skipCheck=!1)})),w(this.#l,t),r.forEach((([t,e,r])=>{this.#k(t,e,r)})),this.#D(this.#l)}_initProps(t,e){this.#l=h(this.#l||{},t),this.#a=h(this.#a||{},e)}_bindSlot(t,e,r){if(this.#g[e]||(this.#g[e]=t,Reflect.defineProperty(t,"__l_comp",{value:this})),t.addEventListener("slotchange",(r=>{this.#v&&this.#T(t,"default"===e?"":e)})),!l(r)){let t=this.#e[e];t||(t=this.#e[e]={}),t.props=r}}_bindSlotHook(t,e){this.#h[t]=e}#P=new Set;_updateSlot(t,e,r){let n=this.#g[t],s=this.#h[t];if(!s&&!n)return;let o=this.#e[t];if(e&&(o.props||(o.props={}),o.props[e]=r),s)this.#P.add(t);else{let t=n.assignedElements({flatten:!0});for(let n=0;n<t.length;n++){t[n].setAttribute(e,r+"")}}}#E(){const t=C(this.childNodes,(t=>t.nodeType===Node.COMMENT_NODE?[]:t instanceof HTMLSlotElement?t.assignedNodes({flatten:!0}):t));let e=j(t,(t=>t.nodeType===Node.TEXT_NODE?"default":t instanceof Element?t.getAttribute("slot")||"default":void 0));if(l(e))return void(l(this.#r["#slots"])||(this.#v?this.#n["#slots"]={}:this.#r["#slots"]={}));g(e,((t,e)=>{if(e){for(;t.length>0;){let e=t[0];if(!(e.nodeType===Node.TEXT_NODE&&s(e.textContent)||e instanceof HTMLSlotElement&&l(e.assignedNodes({flatten:!0}))))break;t.shift()}for(;t.length>0;){let e=b(t);if(!(e.nodeType===Node.TEXT_NODE&&s(e.textContent)||e instanceof HTMLSlotElement&&l(e.assignedNodes({flatten:!0}))))break;t.pop()}}}));let r={};g(e,((t,e)=>{l(t)||(r[e]=t)})),this.#v?this.#n["#slots"]=r:this.#r["#slots"]=r}#C(t){let e=this.#h[t];if(!e)return;let r=this.#e[t];if(!this.#r["#slots"][t])return;this.renderAsync(e,o(r,"props"));const n=this._asyncDirectives.get(e);let s=n?.buildView(e(o(r,"props"))),i=$(v(s),(t=>t.nodeType===Node.COMMENT_NODE));if(i){let e=this.#m[t];if(!l(e))for(let t=0;t<e.length;t++){const r=e[t];r.parentNode?.removeChild(r)}this.#m[t]=i,this.append(...i),this.#P.clear()}}_asyncDirectives=new WeakMap;renderAsync(t,...e){}#A(t,e,r){if(!this.#v)return;if(Mt(this.constructor).has(t)){let e=D(t);if(H(r)){r=o(this.constructor,ct.PROPS)[e]._defaultValue}this._updateProps({[e]:r})}}_regDeps(t,e){let r=this.#i[t];r||(r=this.#i[t]=new Set),r.add(e);let n=t.split(xt);if(n.pop(),n.length<1)return;let s=n.join(xt);r=this.#i[s],r||(r=this.#i[s]=new Set),r.add(e)}_regWrapper(t){this.#p=t}_getPrivateData(){return this.#r}emit(t,e={},r){r&&r.event&&(e.event=r.event),e.target=this,this.dispatchEvent(new CustomEvent(t,{bubbles:o(r,"bubbles",!1),composed:o(r,"composed",!1),cancelable:!0,detail:e}))}on(t,e){this.#w[t]||(this.#w[t]=[]);let r=e.bind(this);this.#w[t].push(r),this.addEventListener(t,r)}nextTick(t,e){Ft.pushNext(t,e)}forceUpdate(){g(this.#n,((t,e)=>{this.#s[e]={value:void 0,chain:void 0}})),this.#S()}}class Zt{startNode;endNode;type;attrName;varIndex;expressionChain;nodes;constructor(t,e,r){this.startNode=t,this.attrName=e,this.type=r}setVarIndex(t){this.varIndex=t}getNodes(){let t=this.startNode.nextSibling;if(!this.endNode)return[t];let e=[];for(;t&&t!==this.endNode;)e.push(t),t=t?.nextSibling;return e}}var te;!function(t){t.AFTER_BEGIN="afterbegin"}(te||(te={}));const ee={};function re(t,e,r,n,s,o,i,a=!1){let c;if(a?(Rt.startRender(t.endNode),c=n(t,e,r,{renderComponent:s,slotComponent:o,varChain:i}),Rt.endRender(s)):c=n(t,e,r,{renderComponent:s,slotComponent:o,varChain:i}),!c)return;let[u,d]=c;if(u===Ot.NONE)return;let p=t.getNodes();if(u===Ot.REMOVE)for(let t=0;t<p.length;t++){const e=p[t];e.parentNode?.removeChild(e)}else if(u===Ot.REPLACE){let e=[];for(let t=0;t<p.length;t++){const e=p[t];e.parentNode?.removeChild(e)}let r=er(t.endNode,d,s);e=v(r);let n=document.createDocumentFragment();n.append(...e),t.endNode.parentNode.insertBefore(n,t.endNode)}else if(u===Ot.UPDATE){let e,r={},n=[],o=[],i=Ke.get(t.endNode);if(d||(d=new lr([],[])),l(p)){let e=er(t.endNode,d,s);return void t.startNode.after(...e)}let a={};d instanceof lr&&d.vars.forEach((t=>{if(t instanceof lr){const e=t.getKey();a[e]=t,r[e]=!0,o.push(e)}})),p=B(U(p),(t=>t.nodeType===Node.ELEMENT_NODE)),e=B(U(v(e)),(t=>t.nodeType===Node.ELEMENT_NODE));let c={},u="",h={};for(let t=0;t<p.length;t++){let e=p[t],r=e.getAttribute("key");if(r){if(c[r]){u=r;break}c[r]=e,n.push(r),h[r]=!0}}if(u)return void pt(`${D(t.endNode._diName)} - duplicate key '${u}'`);let f=r;const m=t.startNode.parentNode;let E=[],y=[];g(h,((t,e)=>{f[e]||(y.push(e),delete h[e],F(n,(t=>t===e)))}));let S,N=!1;if(!l(o)){let e=-1,r=[],s=[],i=0,a=0;for(;a<o.length;a++){const l=o[a];let u=n.findIndex((t=>t===l));if(u<0){let e=o[a-1],r=e?c[e]||e:t.startNode;E.push({prevNode:r,newkey:l}),i++}else if(u>-1&&u!==a-i){if(e<0||1===Math.abs(e-u)){let t=b(r);r.push({nodeId:l,targetId:0===a?te.AFTER_BEGIN:t?t.nodeId:o[a-1]})}else s.push({moveGroup:r,moveIndex:a+r.length}),r=[],r.push({nodeId:l,targetId:o[a-1]});e=u}}if(r.length>0&&s.push({moveGroup:r,moveIndex:a+r.length}),s.length>0){N=!0;let e=s.sort(((t,e)=>t.moveGroup.length-e.moveGroup.length));if(e.length<2){let{moveGroup:r}=e[0];if(r.length>1){let t=b(r).targetId;r[r.length-2].nodeId===t&&(r=_(r))}r.forEach((({targetId:e,nodeId:r})=>{let n,s=c[r];e===te.AFTER_BEGIN?(n=t.startNode,n.after(s)):(n=c[e],n.after(s))}))}else{let r=b(e).moveIndex;1===Math.abs(e[e.length-2].moveIndex-r)&&(e=_(e)),e.forEach((({moveGroup:e})=>{e.forEach((({targetId:e,nodeId:r})=>{let n,s=c[r];e===te.AFTER_BEGIN?(n=t.startNode,n.after(s)):(n=c[e],n.after(s))}))}))}}}if(E.length>0&&(S=function(t,e,r,n,s,o){const i=[],a=[],l=[];let c,u=[];t.forEach((t=>{let r=b(u);r&&c===t.prevNode?(r.group||(r.group=[c]),r.group.push(t.newkey)):u.push(t),c=t.newkey;let n=t.newkey;l.push(n),i.push(""),a.push(e[n])})),i.push("");let d=new lr(i,a),p=[...s],h=er(o,d,n),f=Ke.get(o);s.length=0,s.push(...f);let g=new Map;return h.forEach((t=>{const e=t.getAttribute("key");l.includes(e)&&(g.set(e,!0),ee[e]=t)})),p.forEach(((t,e)=>{const n=t.key+"";!g.get(n)&&r.includes(n)&&s.push(t)})),u}(E,a,o,s,i,t.endNode),S.forEach(((e,r)=>{let n=e.newkey,s=ee[n],o=e.prevNode;if(e.group){let t=document.createDocumentFragment();t.append(...K(e.group,(t=>ee[t]))),s=t}o===t.endNode?o.before(s):o===t.startNode?o.after(s):"string"==typeof o?ee[o].after(s):o.after(s)}))),y.forEach((t=>{let e=c[t];e&&e.parentNode&&m.removeChild(e)})),d.vars[0]instanceof lr){let t=[],e=[];g(d.vars,(r=>{e.push(...r.vars),t.push(...K(r.vars,(t=>"1")))})),t.push("1"),d=new lr(t,e)}if(N||y.length>0||S){const t=j(i,(t=>t.key));let e=[],r=0;o.forEach((n=>{t[n].forEach((t=>{t.varIndex=r++,e.push(t)}))})),i=e}nr(t.endNode,s,d,i)}}let ne=0;function se(t,e){let r=t.name||"Di-"+ne++,n=Symbol.for(r);return(...e)=>{let r=t(...e);return[n,e,r,t=>{},Rt.popDirectiveQ()]}}const oe=["resize","outside","mutate"],ie=new WeakMap,ae=[],le=[],ce=[],ue=new ResizeObserver((t=>{for(const e of t){const t=Array.isArray(e.contentBoxSize)?e.contentBoxSize[0]:e.contentBoxSize,r=Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize;let n=ie.get(e.target);if(n){n(new CustomEvent("resize",{bubbles:!1,cancelable:!1,detail:{borderBox:{w:r.inlineSize,h:r.blockSize},contentBox:{w:t.inlineSize,h:t.blockSize}}}),e.target)}}}));var de;!function(t){t.Child="child",t.Tree="tree",t.Attr="attr",t.Char="char"}(de||(de={}));const pe=new WeakMap,he=new MutationObserver((t=>{for(let e=0;e<t.length;e++){const r=t[e];let n=pe.get(r.target);if(!n)return;let s={target:r.target},o=null;switch(r.type){case"subtree":s.type=de.Tree,o=n[de.Tree];break;case"childList":s.type=de.Child,s.addedNodes=r.addedNodes,s.removedNodes=r.removedNodes,o=n[de.Child];break;case"attributes":s.type=de.Attr,s.attributeName=r.attributeName,s.oldValue=r.oldValue,o=n[de.Attr];break;case"characterData":s.type=de.Char,s.oldValue=r.oldValue,o=n[de.Char]}if(o){o(new CustomEvent("mutate",{bubbles:!1,cancelable:!1,detail:s}))}}}));function fe(t,e,r,n){if("resize"===t)!function(t,e){ie.has(t)||(ie.set(t,e),ue.observe(t))}(e,r);else if("outside"===t)switch(n[0]){case"mousedown":!function(t,e){ae.push([t,e])}(e,r);break;case"dblclick":!function(t,e){ce.push([t,e])}(e,r);break;default:!function(t,e){le.push([t,e])}(e,r)}else"mutate"===t&&function(t,e,r){let n=G(r,"child"),s=G(r,"attr"),o=G(r,"char"),i=G(r,"tree"),a=pe.get(t);a||(a={},pe.set(t,a),n&&(a[de.Child]=e),s&&(a[de.Attr]=e),o&&(a[de.Char]=e),i&&(a[de.Tree]=e),he.observe(t,{childList:n,attributes:s,characterData:o,subtree:i}))}(e,r,n)}document.addEventListener("mousedown",(t=>{let e=o(t.composedPath(),0,t.target);ae.forEach((([r,n])=>{if(!r.contains(e)&&!r.contains(M(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){n(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:r,event:t}}),r)}}))}),!1),document.addEventListener("click",(t=>{let e=o(t.composedPath(),0,t.target);le.forEach((([r,n])=>{if(!r.contains(e)&&!r.contains(M(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){n(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:r,event:t}}),r)}}))}),!1),document.addEventListener("dblclick",(t=>{let e=o(t.composedPath(),0,t.target);ce.forEach((([r,n])=>{if(!r.contains(e)&&!r.contains(M(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){n(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:r,event:t}}),r)}}))}),!1);const ge=/,|^(debounce:.+)|(debounce$)/,me=/,|^(throttle:.+)|(throttle$)/,ve="self",be="stop",Ee="prevent",ye="once",Se="left",Ne="right",_e="middle",Ce="ctrl",Te="alt",Ae="shift",we="meta",Pe={esc:"escape"},Me=":";function ke(t,e,r,n){let s,o=t.split("."),i=o.shift(),a=o.includes(ye),l=e;if(s=z(o,(t=>ge.test(t)))){let t=s.split(Me);l=I(l,parseInt(t[1])||100)}if(s=z(o,(t=>me.test(t)))){let t=s.split(Me);l=X(l,parseInt(t[1])||100)}if(a&&(l=k(l)),function(t){return oe.includes(t)}(i))return fe(i,r,l,o),l;let c=t=>{if(o.includes(Ee)&&t.preventDefault(),o.includes(be)&&t.stopPropagation(),!o.includes(ve)||t.target===t.currentTarget){if(t instanceof MouseEvent){if(o.includes(Se)&&0!=t.button)return;if(o.includes(Ne)&&2!=t.button)return;if(o.includes(_e)&&1!=t.button)return}else if(t instanceof KeyboardEvent){if(F(o,(t=>t==Ce))[0]&&!t.ctrlKey)return;if(F(o,(t=>t==Te))[0]&&!t.altKey)return;if(F(o,(t=>t==Ae))[0]&&!t.shiftKey)return;if(F(o,(t=>t==we))[0]&&!t.metaKey)return;if(!K(o,(t=>Pe[t]||t)).includes(t.key.toLowerCase()))return}l(t)}};r.addEventListener(i,c);let u=n.__events[i];return u||(u=n.__events[i]=[]),u.push([r,c]),c}const Oe="@",De=".",xe="?",Re="*",Le=":",We="ref",He="key",Ie=/<\s*[a-z0-9-]+([^>]*<\!--c_ui-pl_df-->)*[^>]*?(?<!-)>/gims,Ve="slot-props",je=new Map,$e=new Map,Be=new Map;var Ue;!function(t){t.Event="event",t.Directive="directive",t.DirectiveTag="directiveTag",t.DirectiveAttr="directiveAttr",t.DirectiveProp="directiveProp",t.DirectiveText="directiveText",t.DirectiveSlot="directiveSlot",t.Attr="attr",t.AttrProp="attrProp",t.AttrBool="attrBool",t.AttrRef="attrRef",t.AttrSlot="attrSlot",t.AttrKey="key",t.Ref="ref",t.Text="text"}(Ue||(Ue={}));const Fe=new WeakMap,Ke=new WeakMap,Ge=new WeakMap,ze=new WeakMap,Xe=new WeakMap,Qe=new WeakMap;function qe(t,e){let r="",n=u(e.vars),s=e.strings.length-1,i=e.vars.length-1,a=0;for(let l=0;l<=s;l++){const s=e.strings[l];let c=o(n,a,"");if(c instanceof lr){let[e,r]=qe(t,c);c=e,n.splice(a,1,...r),a+=r.length-1}else c=l>i?"":Ye;a++,r=r+s+c}let l=0;return r=r.replace(Ie,((t,e)=>tt(t,Ye,(()=>Ye.replace("--\x3e","")+l++)))),r=r.replace(ir,"$1><").trim(),[r,n]}const Ye="\x3c!--c_ui-pl_df--\x3e",Je="\x3c!--c_ui-pl_df",Ze=/<!--c_ui-pl_df\d*(-->)?/;function tr(t,e,r,n,s=!1){const o=document.createElement("div");o.innerHTML=e;const i=Be.has(n.constructor);s||!i||$e.has(n.constructor)||$e.set(n.constructor,o.cloneNode(!0));let a=0;const l=document.createNodeIterator(o,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let c,u,d=0,p=i?void 0:{},h=null,f="";for(;c=l.nextNode();){a++;let e=i?void 0:[];if(u&&!u.contains(c)&&(u=void 0),c instanceof HTMLElement||c instanceof SVGElement){c instanceof Jt&&(u=c);let s={},o=v(c.attributes);for(let i=0;i<o.length;i++){const a=o[i];let{name:l,value:p}=a;if(l!==Ve)if(E(l,Je)){let s=r[d];if(S(s)&&y(s[0])){let[,r,o,i,a]=s;i(kt.TAG);let p=new Zt(c,l.substring(1),kt.TAG),g=Qe.get(c);g||(g={},Qe.set(c,g)),g[Symbol.keyFor(s[0])]=[p,n,u];let m=new Dt(d,c);m.isDirective=!0,m.value=s,m.isComponent=!!u,t.push(m),h&&h?.contains(c)&&(m.key=f),d++,o(p,r,void 0,{renderComponent:n,slotComponent:u,varChain:a}),e&&e.push({type:Ue.DirectiveTag,point:p,up:m,name:l})}c.removeAttribute(l)}else if(l[0]!==Oe)if(l!==We)if(l!==He){if(Ze.test(p)){let o=r[d],i=new Dt(d,c,l.replace(/\.|\?|@/,""),p);if(i.isComponent=!!u,h&&h?.contains(c)&&(i.key=f),l[0]===De||l[0]===xe||l[0]===Re){if(S(o)&&y(o[0])){let[,t,r,s,a]=o;s(kt.PROP);let d=l.substring(1),p=new Zt(c,d,kt.PROP),h=Qe.get(c);h||(h={},Qe.set(c,h)),h[d]=[p,n,u],r(p,t,void 0,{renderComponent:n,slotComponent:u}),i.value=o,i.isDirective=!0,e&&e.push({type:Ue.DirectiveProp,up:i,point:p,name:l,attrName:d})}else if(l[0]===xe){i.isToggleProp=!0,i.value=!!o;let t=l.substring(1);i.value&&c.setAttribute(t,""),e&&e.push({type:Ue.AttrBool,name:t,up:i,attrName:l})}else if(l[0]===Re){i.value=o;let t=l.substring(1);const[r,n]=t.split(Le);let s=r;switch(n){case"camel":s=D(s);break;case"kebab":s=m(s);break;case"snake":s=et(s)}i.attrName=s,c.setAttribute(s,o),e&&e.push({type:Ue.AttrRef,up:i,name:l,attrName:s})}else{let t=D(l.substring(1)),r=Wt.get(o);r&&(c._propObjectKeyMap[r.join(xt)]=t),i.value=o,i.isProp=!0,s[t]=o,e&&e.push({type:Ue.AttrProp,up:i,name:t,attrName:l})}c.removeAttribute(l),o=""}else{let t,r;i.value=o;let s={type:Ue.Attr,up:i,attrName:l};if(S(o)&&y(o[0])){let e=kt.ATTR;"class"===l?e=kt.CLASS:"style"===l&&(e=kt.STYLE);let[,a,d,p,h]=o;p(e),i.isDirective=!0,i.attrName=l;let f=new Zt(c,l,e),g=Qe.get(c);g||(g={},Qe.set(c,g)),g[l]=[f,n,u],r=a,t=d,o="",s.type=Ue.DirectiveAttr,s.point=f}p=J(p,Ze,o),a.value=p,t&&t(s.point,r,void 0,{renderComponent:n,slotComponent:u}),e&&e.push(s)}t.push(i),d++}}else{let n=r[d];c.setAttribute(l,n);let s=new Dt(d,c);s.notUpdated=!0,h&&h?.contains(c)&&(s.key=f),t.push(s),d++,h=c,f=n,e&&e.push({up:s,type:Ue.AttrKey}),t.length>0&&t.forEach((t=>{t.key=t.key??n}))}else{if(Ze.test(p)){let n=r[d],s=new Dt(d,c);s.notUpdated=!0,h&&h?.contains(c)&&(s.key=f),t.push(s),d++,n.current=c,e&&e.push({type:Ue.Ref,up:s,attrName:l})}c.removeAttribute(l)}else{let s=t=>{},o=null,i=!1;if(Ze.test(p)){o=new Dt(d,c),o.notUpdated=!0,h&&h?.contains(c)&&(o.key=f),t.push(o),s=r[d].bind(n),d++,i=!0}let a=l.substring(1);ke(a,s,c,n),c.removeAttribute(l),e&&e.push({type:Ue.Event,up:o,name:a,attrName:l,value:i})}else{let t=c.getAttribute("name")||"default";e&&e.push({type:Ue.AttrSlot,name:t,attrName:l})}}c instanceof Jt?(c._initProps(s),c._regWrapper(n)):c instanceof HTMLSlotElement&&n._bindSlot(c,c.name||"default",s)}else{let s=c;if(`\x3c!--${s.nodeValue}--\x3e`!==Ye)continue;let o=new Dt(d,c);h&&h?.contains(c)&&(o.key=f),t.push(o),o.isComponent=!!u,o.isText=!0;let i=r[d];if(S(i)&&y(i[0])){const t=Symbol.keyFor(i[0]);let r;r=document.createComment(`compelem-${n.tagName}-${t}-start`),o.textNode=r,s.parentNode.insertBefore(r,s),s.nodeValue=`compelem-${n.tagName}-${t}-end`,s._diName=t,o.isDirective=!0,o.value=i;let a=u?kt.SLOT:kt.TEXT,[,l,c,d,p]=i;d(a);let h=new Zt(r,"",a);h.endNode=s,ze.set(s,[h,n,u,l,p]),Ge.set(s,c),Xe.set(s,o),Rt.startRender(s);let f=c(h,l,void 0,{renderComponent:n,slotComponent:u,varChain:p});if(Rt.endRender(n),f){let t=er(s,f[1],n);t&&t.length>0&&sr.insertBefore(s,Array.from(t))}i=void 0,e&&e.push({type:a===kt.SLOT?Ue.DirectiveSlot:Ue.DirectiveText,up:o,point:h})}else o.value=i,e&&e.push({type:Ue.Text,up:o});d++;let a=Z(i??""),l=document.createTextNode(a);s.parentNode.insertBefore(l,s),o.textNode=l}p&&e&&(p[a]=e),h&&!h.contains(c)&&h!==c&&(h=null,f="")}return!s&&p&&Be.set(n.constructor,p),o.childNodes}function er(t,e,r){let[n,s]=qe(r,e),o=[],i=tr(o,n,s,r,!0);return Ke.set(t,o),i}function rr(t,e,r,n){if(s(Q(t.strings)))return;if(!Fe.has(e))return;let a=t.flatVars(e);r=r??Fe.get(e);for(let t=0;t<r.length;t++){const s=r[t];let l=s.varIndex;if(l<0)continue;if(s.notUpdated)continue;let c=s.value,d=a,p=s.node,h=q(l,xt);for(let e=0;e<h.length;e++){const r=h[e];d=o(d,r),d&&d.vars&&t<h.length-1&&(d=d.vars)}if(!i(c)&&c===d)continue;let f=p;if(s.isDirective){let[t,e,r,,n]=s.value,o=ze.get(p);if(!o){const e=Qe.get(p);o=e[s.attrName]||e[Symbol.keyFor(t)]}let[i,a,l]=o,[,c]=d;const u=Xe.get(p);if(u){u.value=d;ze.get(p)[3]=c}re(i,c,e,r,a,l,n,i.type==kt.TEXT||i.type==kt.SLOT)}else if(s.isToggleProp){if(!!d===c)continue;f.toggleAttribute(s.attrName,!!d),V(f,s.attrName,!!d)}else if(s.isProp){if(!i(d)&&d===c)continue;if(p instanceof Jt)if(i(d)&&Object.is(d,c)){let t=D(s.attrName),e=[t];if(n&&n.length>0){let r="",o=Q(Wt.get(s.value),xt);n.forEach((t=>{t.startsWith(o)&&t.length>r.length&&(r=t)})),e=u(q(r.replace(o,t),xt))}Bt(p,c,e)}else p._updateProps({[s.attrName]:d});else p instanceof HTMLSlotElement&&e._updateSlot(p.getAttribute("name")||"default",s.attrName,d)}else if(s.attrName){if(!Y(c,d))switch(s.attrName){case"value":if(p instanceof HTMLInputElement){p.value=d;break}default:p.setAttribute(s.attrName,J(s.attrTmpl,Ze,d+""))}}else if(s.isText){s.textNode.textContent=Z(d??"")}s.value=d}}function nr(t,e,r,n){const s=Ge.get(t),[o,i,a,l,c]=ze.get(t),u=Xe.get(t);if(!r){let t=s(o,u.value[1],l,{renderComponent:i,slotComponent:a,varChain:c});if(!t)return;r=t[1]}if(r&&r.vars[0]instanceof lr){let t=[],e=[];g(r.vars,(r=>{e.push(...r.vars),t.push(...K(r.vars,(t=>"1")))})),t.push("1"),r=new lr(t,e)}n&&Ke.set(t,n),rr(r,e,n=n??Ke.get(t))}const sr={insertBefore:function(t,e){if(!t.parentNode)return;let r=document.createDocumentFragment();r.append(...e),t.parentNode.insertBefore(r,t)},remove:function(t,e){if(t===e)return void t?.parentNode?.removeChild(t);let r=t.nextSibling;for(;r&&r!==e;)r?.parentNode?.removeChild(r),r=t.nextSibling}};function or(t,...e){return new lr(r(t)?[t]:t,e)}const ir=/([a-z0-9"'])\s*>\s*</gim;function ar(t){return{current:t}}class lr{strings;vars;constructor(t,e){this.strings=u(t),this.vars=e}getKey(){let t=this.vars,e="";return g(this.strings,((r,n)=>{if(at.test(r))return e=Z(t[n]),!1})),e}getKeys(){let t=this.vars,e=[];for(let r=0;r<this.strings.length;r++){const n=this.strings[r];if(at.test(n)){let n=Z(t[r]);e.push(n)}}return l(e)&&t.forEach((t=>{if(t instanceof lr){let r=t.getKey();e.push(r)}})),e}append(t){let e=b(this.strings);return t.strings.forEach(((t,r)=>{0!=r?this.strings.push(t):this.strings[this.strings.length-1]=e+t})),this.vars=u(this.vars,t.vars),this}insert(t,e){let r=e.strings.shift();return this.strings[t]+=r,this.strings.splice(t+1,0,...e.strings),this.vars.splice(t,0,...e.vars),this}getHTML(t){let[e,r]=qe(t,this),n=tr([],e,r,t);return nt(n,((t,e)=>t+(e.outerHTML??"")),"")}flatVars(t){let e=u(this.vars),r=this.strings.length-1,n=0;for(let s=0;s<=r;s++){let r=o(e,n,"");if(r instanceof lr&&r.vars.length>0){let[s,o]=qe(t,r);r=s,e.splice(n,1,...o),n+=o.length-1}n++}return e}}function cr(t,e,r){r.get||pt(`Computed '${e}' must be a getter`),c(t.constructor,ct.COMPUTED)||(t.constructor[ct.COMPUTED]=l(t.constructor[ct.COMPUTED])?{}:f(t.constructor[ct.COMPUTED])),t.constructor[ct.COMPUTED][e]=r.get}const ur=Ct(class extends bt{static get priority(){return Number.MAX_VALUE}created(t,e,r,...n){let s=o(t,r);V(t,r,I(s,this.wait,this.immediate));let i=Reflect.getPrototypeOf(t);i&&!o(i,r+"_$__")&&V(i,r+"_$__",s)}beforeMount(t,e,...r){}mounted(t,e,...r){}updated(t,e){}get targets(){return[dt.METHOD]}wait;immediate;result;constructor(t,e=!1){super(),this.wait=t,this.immediate=e}});function dr(t,e){return(r,n,s)=>{c(r.constructor,ct.EVENTS)||(r.constructor[ct.EVENTS]=l(r.constructor[ct.EVENTS])?[]:f(r.constructor[ct.EVENTS])),r.constructor[ct.EVENTS].push({name:t,options:e,fn:r[n]})}}const pr=Ct(class extends bt{static get priority(){return Number.MAX_VALUE}created(t,e,r,...n){let s=O(o(t,r),t);V(t,r,k(s));let i=Reflect.getPrototypeOf(t);i&&!o(i,r+"_$__")&&V(i,r+"_$__",s)}beforeMount(t,e,...r){}mounted(t,e,...r){}updated(t,e){}get targets(){return[dt.METHOD]}wait;result;constructor(){super()}});var hr;!function(t){t.ONCE="once",t.UPDATABLE="updatable"}(hr||(hr={}));class fr extends bt{static get priority(){return Number.MAX_VALUE}created(t,e,r,...n){}mounted(t,e,...r){}get targets(){return[dt.FIELD]}selector;cache;result;constructor(t,e){super(),this.selector=t,this.cache=e}static getKey(t){return t}getter(t){this.result=t.shadowRoot?.querySelector(this.selector)}beforeMount(t,e,r,n,...s){const o=this;Reflect.defineProperty(t,n,{get:()=>(o.result&&o.cache||o.getter(t),o.result)})}updated(t,e){this.cache===hr.UPDATABLE&&this.getter(t)}}const gr=Ct(fr),mr=Ct(class extends fr{getter(t){this.result=t.shadowRoot?.querySelectorAll(this.selector)}});function vr(t){if(1===arguments.length)return(e,r)=>{br(e,r,t)};br(arguments[0],arguments[1],{prop:""})}function br(t,e,r){if(!c(t.constructor,ct.STATES)){const e={};let r=t.constructor;for(;(r=gt(r))!==Jt;)h(e,r[ct.STATES]?f(r[ct.STATES]):{});Reflect.defineProperty(t.constructor,ct.STATES,{configurable:!1,enumerable:!1,value:e})}r.shallow=r.shallow||!1,t.constructor[ct.STATES][e]=r}function Er(t,e,r){br(t.prototype,e,r||{prop:""})}function yr(t){return e=>{if(e){if(e.prototype.hasOwnProperty("attributeChangedCallback")){let t=e.prototype.attributeChangedCallback;e.prototype.attributeChangedCallback=function(e,r,n){Jt.prototype.attributeChangedCallback.call(this,e,r,n),t.call(this,e,r,n)}}if(e.prototype.hasOwnProperty("connectedCallback")){let t=e.prototype.connectedCallback;e.prototype.connectedCallback=function(){Jt.prototype.connectedCallback.call(this),t.call(this)}}if(e.prototype.hasOwnProperty("disconnectedCallback")){let t=e.prototype.disconnectedCallback;e.prototype.disconnectedCallback=function(){Jt.prototype.disconnectedCallback.call(this),t.call(this)}}customElements.define(t,e)}}}const Sr=Ct(class extends bt{static get priority(){return Number.MAX_VALUE}created(t,e,r,...n){let s=o(t,r);V(t,r,X(s,this.wait));let i=Reflect.getPrototypeOf(t);i&&!o(i,r+"_$__")&&V(i,r+"_$__",s)}beforeMount(t,e,...r){}mounted(t,e,...r){}updated(t,e){}get targets(){return[dt.METHOD]}wait;result;constructor(t){super(),this.wait=t}});function Nr(t,e){return(r,n)=>{c(r.constructor,ct.WATCH)||(r.constructor[ct.WATCH]=l(r.constructor[ct.WATCH])?{}:f(r.constructor[ct.WATCH]));(S(t)?t:[t]).forEach((t=>{let s=t.replaceAll(".",xt),o=r.constructor[ct.WATCH][s];S(o)||(o=r.constructor[ct.WATCH][s]=[]),o.push({source:t,options:e,handler:r[n]})}))}}const _r=["key"],Cr=se((function(t){return(t,[e],r)=>{let n=t.startNode;if(r)g(e,((t,e)=>{n.setAttribute(e,t)}));else if(n instanceof Jt){let t={},r={},s=o(n.constructor,ct.PROPS);g(e,((e,n)=>{if(_r.includes(n))return;let o=D(n);s[o]?t[n]=e:r[n]=e+""})),n._initProps(t,r)}else g(e,((t,e)=>{n.setAttribute(e,t)}))}}),kt.TAG),Tr=new Map,Ar=se((function(t){return(t,[e],n,{renderComponent:s})=>{let o=[];if(S(e)?o=U(e):i(e)?o=C(e,((t,e)=>t?e:[])):r(e)&&(o=e.split(" ")),o.length<1&&!n)return;let a=t.startNode;if(Tr.get(a)&&Tr.get(a).length===o.length&&st(Tr.get(a),o))return;let l=Tr.get(a);g(l,(t=>{a.classList.remove(t)})),g(o,(t=>{a.classList.add(t)})),l=u(o),Tr.set(a,l)}}),kt.CLASS),wr=new Map,Pr=new Map,Mr=se((function(t,e){return(t,r,n,{varChain:s})=>{let o=t.startNode,i=function(t,e,r){let n=K(t,((t,r)=>e(t,r)));if(n.length<1){let t=new lr([],[]);return Pr.set(r,t),t}let s=[],o=[];const i=[],a=[];for(let t=0;t<n.length;t++){const e=n[t];let r=b(o),l=e.vars,c=!0,u=e.strings;for(let t=0;t<u.length;t++){const e=u[t];if(at.test(e)){let e=l[t]+"";if(s.includes(e))return void pt(`forEach - duplicate key '${e}'`);s.push(e),c=!1}0==t&&r?o[o.length-1]=r+e:o.push(e)}if(c)return void pt("forEach - missing 'key' prop");let d=b(i);d&&u.length>0&&(i[i.length-1]=R(d)+u.shift()),i.push(""),a.push(e)}i.push("");let l=new lr(i,a);return Pr.set(r,l),l}(r[0],e,o);if(n&&n[0]){const e=wr.get(o);if(l(t.getNodes())&&(!r||l(r[0])))return[Ot.NONE,i];if(e&&st(e,r[0])&&e.length===r[0].length)return[Ot.NONE,i]}return wr.set(o,rt(r[0])),n?[Ot.UPDATE,i]:[Ot.APPEND,i]}}),(kt.TEXT,kt.SLOT));const kr=new WeakMap,Or=se((function(t,e,r){return(n,[s,o],i,{renderComponent:a})=>{let l=n.endNode;if(i){if(!!s==!!i[0]){let t=kr.get(l);return[Ot.NONE,t.call(a,s)]}let t=s?e:r;return kr.set(l,t),[Ot.REPLACE,t.call(a,s)]}{let n=s?e:r;return kr.set(l,n),[Ot.APPEND,n.call(a,t)]}}}),(kt.TEXT,kt.SLOT)),Dr=se((function(t,e){return(t,[e,r],n)=>n?e===n[0]?[Ot.NONE,e?r():or``]:e?[Ot.REPLACE,e?r():or``]:[Ot.REMOVE]:[Ot.APPEND,e?r():or``]}),(kt.TEXT,kt.SLOT));var xr;!function(t){t.CHANGE="change",t.INPUT="input"}(xr||(xr={}));const Rr=new WeakMap,Lr=se((function(t,e="value"){return(r,n,s,{varChain:a,renderComponent:l})=>{const c=r.startNode;if(s){if(Y(n,s))return;if(!Y(n,s)){let t=n[0];if(c instanceof Jt)c._updateProps({[e]:t});else if(c instanceof HTMLTextAreaElement||c instanceof HTMLSelectElement){if(c.setAttribute(e,t+""),c instanceof HTMLSelectElement){let e=z(c.querySelectorAll("option"),(e=>e.value==t));e&&(e.selected=!0)}}else if(c instanceof HTMLInputElement){if(c.value==t)return;switch(c.type){case"checkbox":case"radio":t?c.setAttribute("checked",""):c.removeAttribute("checked");break;case"text":case"email":case"number":case"password":case"search":case"tel":case"url":c.setAttribute(e,t+""),V(c,e,t);break;default:c.setAttribute(e,t+"")}}}return}if("binded"===o(c,"_model"))return;let u=b(a),d=u.join(xt),p=Object.keys(l._propObjectKeyMap);if(p.length>0&&g(p,(t=>{if(d.startsWith(t)){let e=d.replace(t,l._propObjectKeyMap[t]);return u=e.split(xt),!1}})),Rr.set(c,u),i(t)||R(t)||(t=""),c instanceof Jt)c._initProps({[e]:t}),c.addEventListener("update:"+e,(t=>{V(l,u,t.detail.value)})),V(c,"_model","binded");else if(c instanceof HTMLTextAreaElement)c.setAttribute(e,t+""),c.addEventListener("input",(t=>{let e=t.target;V(l,u,e.value)})),V(c,"_model","binded");else if(c instanceof HTMLInputElement){let r="",n="";switch(c.type){case"checkbox":case"radio":r="checked",n="change";break;default:r="value",n="input"}c.setAttribute(e??r,t+""),c.addEventListener(n,(t=>{let e=t.target;V(l,u,e.value)})),V(c,"_model","binded")}else c instanceof HTMLSelectElement&&(c.setAttribute(e,t+""),c.addEventListener("change",(t=>{let e=t.target;V(l,u,e.value)})),V(c,"_model","binded"))}}),kt.TAG),Wr=new Map,Hr=se((function(t,e){return(t,[r],n)=>{if(n&&r===n[0])return;let s=t.startNode;if(!Wr.has(s)){let t=s.style.display;Wr.set(s,"none"==t?"unset":t)}s.style.display=r?Wr.get(s):"none",e&&e(s,r)}}),kt.TAG),Ir=se((function(t,e){return(r,n,s,{renderComponent:o,slotComponent:i})=>{s||(t=t.bind(o),i._bindSlotHook(e||"default",t))}}),kt.SLOT);class Vr{static getCssText(t,e=!1){return r(t)?t:Q(K(t,((t,r)=>r.startsWith("--")?r+":"+t+(e?" !important":""):m(r)+":"+t+(e?" !important":""))),";")}static setStyle(t,e){if(r(t)&&!R(t))return{};let n=Vr.getCssText(t),s={};return g(n.split(";"),(t=>{let r=t.split(":"),n=R(r[0]),o=R(r[1]);s[n]=e.style.getPropertyValue(n),e.style.setProperty(n,o)})),s}}const jr=new Map;let $r=0;const Br=se((function(t){return(t,e,r,{renderComponent:n})=>{let s=t.startNode,o=jr.get(s);o||(o="style_d"+$r++,jr.set(s,o)),n.nextTick((()=>{Vr.setStyle(e[0],s)}),o)}}),kt.STYLE),Ur=se((function(t){return(e,r,n,{renderComponent:s,varChain:o})=>{const i=e.startNode;if(n){if(!Y(r,n)){let t=e.attrName;i._updateProps({[t]:r[0]})}return}let a=b(o),l=e.attrName;i._initProps({[l]:t}),i.addEventListener("update:"+l,(t=>{V(s,a,t.detail.value)}))}}),kt.PROP),Fr=se((function(t,e){return(t,[e,r],n)=>{let s=()=>or``,o=[],i=[];g(r,((t,e)=>{if(N(t))o.push(e),i.push(t);else{let e=t[0],r=t[1];o.push(e),i.push(r)}"default"===e&&(s=t)}));let a=ot(o,(t=>N(t)?t(e):t==e));return n?[Ot.REPLACE,it(i[a]??s)]:[Ot.APPEND,it(i[a]??s)]}}),(kt.TEXT,kt.SLOT));export{Jt as CompElem,Vr as CssHelper,bt as Decorator,dt as DecoratorType,Nt as DecoratorWrapper,Ot as DirectiveUpdateTag,Zt as EnterPoint,kt as EnterPointType,Et as GetKeyFnName,xr as ModelTriggerType,xt as PATH_SEPARATOR,Yt as PROP_OBJECT_KEY_MAP_SYMBOL,hr as QueryCache,lr as Template,Dt as UpdatePoint,St as _DecoratorMap,yt as _DecoratorsKey,Mt as _getObservedAttrs,Cr as bind,qe as buildHTML,Ar as classes,cr as computed,ar as createRef,ur as debounced,Ct as decorator,se as directive,dr as event,Mr as forEach,or as html,Or as ifElse,Dr as ifTrue,Er as makeState,Lr as model,pr as onced,At as prop,gr as query,mr as queryAll,Hr as show,Ir as slot,vr as state,Br as styles,Ur as sync,yr as tag,Sr as throttled,re as updateDirective,Nr as watch,Fr as when};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compelem",
3
- "version": "0.6.12-b1",
3
+ "version": "0.7.1-b1",
4
4
  "description": "A modern, reactive, fast, lightweight and flexible lib for building web components",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
package/reactive.d.ts CHANGED
@@ -25,15 +25,14 @@ export declare const Collector: {
25
25
  __renderCollecting: boolean;
26
26
  __skipCheck: boolean;
27
27
  };
28
+ export declare const OBJECT_VAR_PATH: WeakMap<any, string[]>;
28
29
  /**
29
- * 1. 初始化时obj都是普通对象
30
- * 2. OBJECT_VAR_PATH 首次是普通对象
31
- * 3. OBJECT_META_DATA 直接绑定代理对象
32
30
  * @param obj
33
31
  * @param context
34
32
  * @returns
35
33
  */
36
- export declare function reactive(obj: Record<string, any>, context: any): any;
34
+ export declare function reactive(obj: Record<string, any>, context: any): ProxyConstructor;
35
+ export declare function notifyUpdate(context: CompElem, ov: any, path: Array<string>): void;
37
36
  export declare class Queue {
38
37
  static watchSet: Set<Updater>;
39
38
  static computedSet: Set<Updater>;
@@ -23,4 +23,8 @@ export declare class Template {
23
23
  */
24
24
  insert(position: number, tmpl: Template): this;
25
25
  getHTML(comp: CompElem): string;
26
+ /**
27
+ * 对var中的Template类型进行合并
28
+ */
29
+ flatVars(comp: CompElem): any[];
26
30
  }
@@ -36,7 +36,7 @@ export declare function buildTmplate(updatePoints: Array<UpdatePoint>, html: str
36
36
  export declare function buildTmplate2(updatePoints: Array<UpdatePoint>, vars: any[], component: CompElem): NodeListOf<ChildNode>;
37
37
  export declare function buildView(tmpl: Template, component: CompElem): NodeListOf<ChildNode>;
38
38
  export declare function buildDirectiveView(pointNode: Node, tmpl: Template, component: CompElem): NodeListOf<ChildNode>;
39
- export declare function updateView(tmpl: Template, comp: CompElem, updatePoints?: UpdatePoint[]): void;
39
+ export declare function updateView(tmpl: Template, comp: CompElem, updatePoints?: UpdatePoint[], changedKeys?: string[]): void;
40
40
  export declare function updateDirectiveView(node: Node, comp: CompElem, tmpl?: Template, updatePoints?: UpdatePoint[]): void;
41
41
  export declare const DomUtil: {
42
42
  insertBefore: (node: Node, newNodes: any[]) => void;
package/types.d.ts CHANGED
@@ -70,3 +70,4 @@ export declare class UpdatePoint {
70
70
  notUpdated: boolean;
71
71
  constructor(varIndex: number, node: Node, attrName?: string, attrTmpl?: string);
72
72
  }
73
+ export declare const PATH_SEPARATOR = "-";