compelem 0.5.2-b1 → 0.5.3-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/index.js +2 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* compelem v0.5.
|
|
2
|
+
* compelem v0.5.3-b1.1743696793
|
|
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 s,fval as r,isUndefined as n,isBlank as i,get as o,isObject as a,isDefined as l,isEmpty as c,has as d,concat as u,defaults as h,merge as p,cloneDeep as f,each as g,kebabCase as m,toArray as _,last as E,startsWith as b,isFunction as v,isArray as C,initial as y,join as N,split as S,set as T,isEqual as P,replace as w,isPlainObject as x,flatMap as A,test as k,size as M,assign as O,first as R,closest as L,once as D,filter as V,bind as H,camelCase as I,isNil as $,trim as W,isBoolean as j,isNull as B,debounce as U,groupBy as z,reject as F,compact as K,remove as Q,includes as X,find as G,throttle as q,map as Y,replaceAll as Z,snakeCase as J,toString as tt,reduce as et,isMatch as st,clone as rt,findIndex as nt,call as it}from"myfx";const ot=new WeakMap,at=/\s+\.?key\s*=/;var lt,ct,dt;function ut(t){console.error("[CompElem]",t)}function ht(t,e){console.error(`[CompElem <${t}>]`,e)}function pt(e){return t(e).join("-")}function ft(t){return Object.getPrototypeOf(t)}function gt(t){let e=t;return s(t)&&/(?:^true$)|(?:^false$)/.test(e)?e=r(e):(n(e)||i(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.CLASS="class",t.FIELD="field",t.METHOD="method"}(dt||(dt={}));class mt{static get priority(){return 0}}const _t="getKey",Et="__decorators",bt=new WeakMap;class vt{args;metadata;decoratorClass;instanceMap;key;priority=0;constructor(t,e,s){this.args=t,this.metadata=e,this.decoratorClass=s,this.priority=o(s,"priority",0),this.instanceMap=new WeakMap}create(t){let e,s=new this.decoratorClass(...this.args),r=s.targets,i=this.metadata[2];a(i)&&l(o(i,"configurable"))?e=dt.METHOD:n(this.metadata[2])&&(e=dt.FIELD),!c(r)&&e&&r.includes(e)?(s.created(t,...this.metadata),this.instanceMap.set(t,s)):ut(`Decorator '${this.decoratorClass.name}' is out of targets, expect '${r.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 Ct=new WeakMap;function yt(t){let e=(...e)=>(...s)=>{let r=s[0].constructor,n=o(r,Et);if(!d(r,Et)){let t=o(Object.getPrototypeOf(r),Et);n=t?u(t):[],Reflect.defineProperty(r,Et,{configurable:!1,enumerable:!1,value:n})}let i,a={},l=o(t,_t);if(l){let s=Ct.get(t);if(s||(s=new WeakMap,Ct.set(t,s)),a=s.get(r),a||(a={},s.set(r,a)),i=l(...e),a[i])return a[i]}let c=new vt(e,s,t);return a[i]=c,n?.push(c),c};return bt.set(e,!0),e}const Nt=new WeakMap;function St(t){if(1===arguments.length)return(e,s,r)=>{t.required=t.required||!1,t.attribute=!1!==t.attribute,Tt(e,s,t,r)};let e=arguments[0],s=arguments[1],r=arguments[2];t={type:void 0,required:!1,attribute:!0},r&&"function"==typeof r.type&&(t=h(r,t),r=void 0),Tt(e,s,t,r)}function Tt(t,e,s,r){let n;if(/[a-z]/.test(e[0])||ut(`Prop '${e}' must be in CamelCase`),!d(t.constructor,ct.PROPS)){const e={};let s=t.constructor;for(;(s=ft(s))!==jt;)p(e,s[ct.PROPS]?f(s[ct.PROPS]):{});Reflect.defineProperty(t.constructor,ct.PROPS,{configurable:!1,enumerable:!1,value:e}),n=new Set,g(e,((t,e)=>{if(t.attribute){let t=m(e);n?.add(t)}})),Nt.set(t.constructor,n)}if(r&&(r.get&&(s.getter=r.get),r.set&&(s.setter=r.set)),s.attribute){n||(n=Nt.get(t.constructor));let s=m(e);n?.add(s)}d(t.constructor,"observedAttributes")||(t.constructor.observedAttributes=[]),t.constructor.observedAttributes=_(n),s.shallow=s.shallow||!1,t.constructor[ct.PROPS][e]=s}const Pt=new Set;function wt(t){return Nt.get(t)??Pt}const xt={collectWatch(t,e,s){let r=Rt.get(t);r||(r={},Rt.set(t,r));let n=r[s];n||(n=r[s]=[]),n.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=E(this.__directiveQ);const s=t?t.join(","):"",r=e?e.join(","):"";e&&s===r||(e&&e.length<t.length&&b(s,r)?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},At=new WeakMap,kt=new WeakMap,Mt=new WeakMap,Ot=new WeakMap,Rt=new WeakMap;function Lt(t,e){if(!a(t))return t;const s=t.__proxy?t:new Proxy(t,{get(t,e,s){if(!e)return;const r=Reflect.get(t,e,s);if("string"!=typeof e&&"number"!=typeof e)return r;let n=e in t;if((xt.__renderCollecting||xt.__collecting)&&(n&&t.hasOwnProperty(e)||!n)){let t=kt.get(s)??[],r=u(t,[e]),n=r.join("-");if(xt.__renderCollecting)xt.collect(pt(r)),xt.setDirectiveQ(r);else if(xt.__collecting){let t;switch(xt.__collectType){case lt.COMPUTED:t=Mt.get(xt.__collecting),t||(t={},Mt.set(xt.__collecting,t));break;case lt.CSS:t=Ot.get(xt.__collecting),t||(t={},Ot.set(xt.__collecting,t))}let e=t[n];e||(e=t[n]=[]),e.push(xt.__updater)}}return r},set(t,e,s,r){if(!e)return!1;let n=t[e];if(!a(n)&&n===s)return!0;if(Number.isNaN(s)&&Number.isNaN(n))return!0;let i=kt.get(r)??[],l=u(i,[e]),d=At.get(r).from,h=o(d.constructor,ct.PROPS),p=o(d.constructor,ct.STATES),f=o(h,[l[0],"hasChanged"])||o(p,[l[0],"hasChanged"]);if(f){if(!f.call(d,s,n))return!0}else if(n===s&&!ot.has(n))return!0;h&&h[e]&&t.__isData&&h[e].sync&&d.emit("update:"+e,{value:s});let g=At.get(r)?.contextSet,m=s;!a(s)||v(s)||s instanceof Node||Object.isFrozen(s)||g.forEach((t=>{let s=At.get(r)?.pathMap,n=s?.get(t);n&&(l=u(n,[e]),kt.set(m,l),m=Lt(m,t),kt.set(m,l))}));let _=Reflect.set(t,e,m),E=At.get(r).pathMap;return g.forEach((t=>{let s=E.get(t);if(!s)return;t===d&&i.length>1&&s.length>1&&i[0]===s[0]&&(s=i),l=u(s,"length"==e&&C(r)?[]:[e]);let a=Mt.get(t),h=Ot.get(t),p=Rt.get(t);if(a||h||p){let t=l.length;for(;t;){let e=l.slice(0,t).join("-");if(p){const s=p[e];t===l.length?s?.forEach((t=>{let e=t();e.ov=n,Dt.pushWatch(e)})):s?.forEach((t=>{let e=t();o(e,"deep")&&(e.ov=n,Dt.pushWatch(e))}))}if(a){let t=a[e];if(!c(t))for(let e=0;e<t.length;e++){const s=t[e];Dt.pushComputed(s)}}if(h){let t=h[e];if(!c(t))for(let e=0;e<t.length;e++){const s=t[e];Dt.pushCss(s)}}t--}}let f=t._notify(n,l);Dt.pushNext(f)})),_}});t.__proxy||Reflect.defineProperty(t,"__proxy",{enumerable:!1,writable:!1,configurable:!1,value:!0});let r=kt.get(t)??[];if(Object.isExtensible(t)&&!At.get(s)){let t=new Set;t.add(e);let n=new WeakMap;n.set(e,r),At.set(s,{from:e,contextSet:t,pathMap:n})}else{At.get(s).contextSet.add(e);let t=At.get(s).pathMap,n=t.get(e),i=u(r);if(n&&n.join("")!==i.join("")){let t=o(e,y(n));C(t)||function(...t){console.warn("[CompElem]",...t)}(`The object is referenced by more than one @state '${i.join(".")},${n.join(".")}'`),n=i}else t.set(e,i)}let n=o(e.constructor,ct.PROPS),i=o(e.constructor,ct.STATES);for(let s in t){const l=t[s];let c=o(n,[s,"shallow"])||o(i,[s,"shallow"]);!a(l)||l.__proxy||v(l)||l instanceof Node||Object.isFrozen(l)||c||(kt.set(l,u(r,[s])),t[s]=Lt(l,e),kt.set(t[s],u(r,[s])))}return s}class Dt{static watchSet=new Set;static computedSet=new Set;static cssSet=new Set;static nextSet=new Set;static nextPending=!1;static next;static{const t=Promise.resolve(),e=Dt.flush;Dt.next=()=>{t.then(e)}}static flush(){Dt.nextPending=!1;let t=Array.from(Dt.watchSet);Dt.watchSet.clear();let e=Array.from(Dt.computedSet);Dt.computedSet.clear();let s=Array.from(Dt.cssSet);Dt.cssSet.clear();let r=Array.from(Dt.nextSet);Dt.nextSet.clear(),t.forEach((t=>t(o(t,"ov")))),e.forEach((t=>t())),s.forEach((t=>t())),r.forEach((t=>t()))}static pushWatch(t){Dt.watchSet.add(t)}static pushComputed(t){Dt.computedSet.add(t)}static pushCss(t){Dt.cssSet.add(t)}static pushNext(t){Dt.nextSet.add(t),Dt.nextPending||(Dt.nextPending=!0,Dt.next())}}function Vt(t){return class extends t{__updatePoints;renderComponent;buildView(t){let e=this instanceof jt?this:this.renderComponent,[s,r]=ke(e,t),n=[],i=Ie(n,s,r,e,this);return this.__updatePoints=n,i}updateView(t){if(i(N(t.strings)))return;if(!this.__updatePoints)return;let{vars:e}=t,s=this instanceof jt?this:this.renderComponent;for(let t=0;t<this.__updatePoints.length;t++){const r=this.__updatePoints[t];let n=r.varIndex,i=r.value,l=e,c=r.node,d=S(n,"-");for(let e=0;e<d.length;e++){const s=d[e];l=o(l,s),l&&l.vars&&t<d.length-1&&(l=l.vars)}if(!a(i)&&i===l)continue;let u=c;if(r.isDirective){if(!i.di)continue;l.di=i.di,l.di.renderParams=l.varChain,l.di._renderArgs=l.args,l.point=i.point,l.varPath=i.varPath,i.update(i.point,l.args,i.args)}else if(r.isToggleProp){if(!!l===i)continue;u.toggleAttribute(r.attrName,!!l),T(u,r.attrName,!!l)}else if(r.isProp){if(!a(l)&&l===i)continue;c instanceof jt?c._updateProps({[r.attrName]:l}):c instanceof HTMLSlotElement&&s._updateSlot(c.getAttribute("name")||"default",r.attrName,l)}else if(r.attrName&&!r.isEvent){if(!P(i,l))switch(r.attrName){case"value":if(c instanceof HTMLInputElement){c.value=l;break}default:c.setAttribute(r.attrName,w(r.attrTmpl,He,l+""))}}else if(r.isTmpl)(l.strings.join()!==i.tmpl.strings.join()||l.vars.some((t=>a(t)&&!x(t)))||i.tmpl.vars.some((t=>a(t)&&!x(t)))||!P(l.vars,i.tmpl.vars))&&r.value.updateView(l),i.tmpl=l,l=i;else if(r.isText){let t=r.textNode.nextSibling;t&&t===r.node.previousSibling?t.textContent=l:($e.remove(r.textNode,r.node),$e.insertBefore(r.node,[l]))}r.value=l}}}}class Ht extends(Vt(Object)){tmpl;constructor(t){super(),this._renderVars=o(t,"_renderVars"),this.tmpl=t}}const It={boolean:Boolean,string:String,number:Number,object:Object,array:Array,function:Function,bigint:BigInt,symbol:Symbol,undefined:Object},$t=new WeakMap;let Wt=[];class jt extends(Vt(HTMLElement)){static __l_globalRule=document.createElement("style");static{document.head.appendChild(jt.__l_globalRule)}static defaults(t){Wt=A(t.css,(t=>{if(s(t)){let e=new CSSStyleSheet;return e.replaceSync(t),e}return t instanceof CSSStyleSheet?t:[]})),t.global,g(t,((t,e)=>{k(e[0],/[A-Z]/)}))}#t={};#e={"#slots":{}};#s={};#r={};#n;#i={};__events={};get[Symbol.toStringTag](){return this.constructor.name}get reactiveData(){return this.#s}get attrs(){return this.#o}get props(){return this.#a}get renderRoot(){return this.#l}get renderRoots(){return this.#c}get parentComponent(){return this.#d}get slotHooks(){return this.#u}get css(){return $t.get(this.constructor)}get isMounted(){return this.#h}get slots(){return this.#e["#slots"]}#o;#a;#l;#c;#d;#p={};#u={};#f={};#h=!1;static get autoSlot(){return!0}static get styles(){return[]}static get globalStyles(){return[]}get styles(){return[]}#g=!1;#m=!1;constructor(...t){super(),1===M(t)&&(this.#a={},O(this.#a,R(t)));let e=this.render.bind(this);this.render=function(){let t;return xt.startRender(this),t=e(),xt.endRender(this),t};let r=o(this.constructor,"globalStyles"),n=o(this.constructor,"_global_style_attached");if(!c(r)&&"1"!==n){let t="";r.forEach((e=>{s(e)&&(t+=e+"\n")})),jt.__l_globalRule.textContent+=t,T(this.constructor,"_global_style_attached","1")}let i=$t.get(this.constructor),a=i??[];i||(g(o(this.constructor,"styles"),(t=>{if(s(t)){let e=new CSSStyleSheet;e.replaceSync(t),a.push(e)}else a.push(t)})),$t.set(this.constructor,a)),this.#n=this.attachShadow({mode:"open",slotAssignment:o(this.constructor,"autoSlot",!0)?"named":"manual"}),this.#n.adoptedStyleSheets=[...Wt,...a],this._slotsPropMap={default:[]};let l=o(this.constructor,Et);l&&l.sort(((t,e)=>e.priority-t.priority)).forEach((t=>t.create(this))),this.#_=this.#E.bind(this)}#_;connectedCallback(){let t=L(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.#g)return;if(this.#m)return;this.#m=!0,this.#b();const t=this.#v();this.propsReady(t);for(const e in t){const s=t[e];this.#e[e]=s}this.#C(),g(this.#e,((t,e)=>{let s=Reflect.getOwnPropertyDescriptor(this.#e,e);Reflect.defineProperty(this,e,{get(){let t=Reflect.get(this.#s,e);return s?.get?s?.get():t},set(t){s?.set?s?.set(t):Reflect.set(this.#s,e,t)}})})),Reflect.defineProperty(this.#e,"__isData",{enumerable:!1,value:!0}),this.#s=Lt(this.#e,this);let e=o(this.constructor,ct.COMPUTED);g(e,((t,e)=>{xt.startCollect(this,lt.COMPUTED),xt.setUpdater((()=>{this.#s[e]=t.call(this)})),this.#e[e]=t.call(this),xt.endCollect(),Reflect.defineProperty(this,e,{get(){return Reflect.get(this.#s,e)},set(t){ht(this.tagName,"Cannot set a computed property '"+e+"'")}})}));let s=o(this.constructor,ct.WATCH);g(s,((t,e)=>{t.forEach((t=>{let{source:s,options:r,handler:n}=t,i=n.bind(this);o(r,"once",!1)&&(i=D(i));const a=function(t){let e=o(this,s.replaceAll("-","."));i(e,t,s)}.bind(this);let l=o(r,"deep",!1);if(a.deep=l,xt.collectWatch(this,(()=>a),e),!o(r,"immediate",!1))return;let c=o(this,s.replaceAll("-","."));i(c,c,s)}))}));let r=this.render(),n=this.buildView(r);if(n){let t=_(n);t.forEach((t=>{this.#n.appendChild(t)})),this.#c=V(t,(t=>t.nodeType===Node.ELEMENT_NODE)),this.#l=this.#c[0]}g(this.#u,((t,e)=>{this.#y(e)}));const a=this;let l=o(this.constructor,Et);l&&l.sort(((t,e)=>e.priority-t.priority)).forEach((t=>{t.beforeMount(this,((t,e)=>(a.#s[t]=e,a.#s[t])))})),this.beforeMount();let c=o(this.constructor,ct.EVENTS);c&&c.forEach((async t=>{let e=t.name,s=O({target:document,once:!1,passive:!1,capture:!1},t.options),r=H(t.fn,this),n=s.target;v(n)&&(n=await n.call(this,this)),n?n.addEventListener(e,r,s):ht(this.tagName,"The target of @event('"+e+"',...) is invalid")})),xt.startCollect(this,lt.CSS);let d=[];this.styles.forEach((t=>{if(!v(t))return;let e=new CSSStyleSheet;d.push(e),xt.setUpdater((()=>{let s=t()??"";e.replaceSync(s)}));let s=t();i(s)||e.replaceSync(s)})),xt.endCollect(),this.#n.adoptedStyleSheets=[...this.#n.adoptedStyleSheets,...d],setTimeout((()=>{this.#h=!0,this.mounted(),l&&l.forEach((t=>{t.mounted(this,((t,e)=>(a.#s[t]=e,a.#s[t])))}))}),0),this.#g=!0}propsReady(t){}render(){throw Error(`[CompElem <${this.tagName}>] Missing render()`)}beforeMount(){}mounted(){}#N(t,e){this.#b();let s=o(this.#t[e],"props");s&&g(this.slots,((t,e)=>{t.filter((t=>t.nodeType===Node.ELEMENT_NODE)).forEach((t=>{t instanceof jt?t._updateProps(s):g(s,((e,s)=>{if(t instanceof HTMLSlotElement){let r=o(t,"__l_comp");if(r){let n=t.name||"default",i=r.#t[n];i||(i=r.#t[n]={props:{}}),i.props||(i.props={}),i.props[s]=e,r.#N(t,n)}}else t.setAttribute(s,e)}))}))})),this.slotChange(t,e)}slotChange(t,e){}attributeChangedCallback(t,e,s){this.#S(t,e,s)}shouldUpdate(t){return!0}updated(t){}#T={};_notify(t,e){let s=[];for(let r=0;r<e.length;r++){const n=e[r];s.push(n);let i=o(this,s),l=pt(s);this.#r[l]={value:i,chain:"slots"===l?["slots"]:s,oldValue:t,end:s.length===e.length},a(i)&&"#"!=l[0]&&ot.set(i,l)}return this.#_}#E(){if(M(this.#r)<1)return;const t=this.#r;this.#r={};let e=o(this.constructor,Et);if(e&&e.sort(((t,e)=>e.priority-t.priority)).forEach((e=>{e.updated(this,t)})),!this.shouldUpdate(t))return;let s=new Set;g(t,(({value:t,chain:e,oldValue:r},n)=>{this.#i[n]&&this.#i[n].forEach((t=>{s.add(t)}))})),s.forEach((t=>{if(t===this)this.updateView(this.render());else{let e=t.render(...t._renderArgs?t._renderArgs:[]);e&&t.updateView(e)}})),this.#P.forEach((t=>{this.#y(t)})),this.updated(t),g(t,(({value:t,chain:e,oldValue:s},r)=>{a(t)&&ot.has(t)&&ot.delete(t)}))}#v(){let t=o(this.constructor,ct.PROPS),s=this.attributes,r=this.tagName,i=this.#a,c={};g(s,(({name:e,value:s})=>{if(e[0]===Ce||e[0]===ye||e[0]===Ne||e===Pe||"slot"===e)return;let r=I(e);t&&!t[r]&&(c[e]=s)})),this.#o=this.#o?O(this.#o,c):c;let u={};return g(t,((c,h)=>{let p,f=t[h],g=d(i,h),_=o(this,h);if(!("_defaultValue"in f)&&(f._defaultValue=_,!f.type)){n(_)&&ht(r,"Prop '"+h+"' has neither propType nor defaultValue be used for type inference");let t=typeof _;C(_)&&(t="array");let e=It[t];f.type=e}if(g)p=$(i[h])?_:i[h];else{p=_;let t=s.getNamedItem(m(h))||s.getNamedItem(ye+m(h));t&&(g=!0,p=t.value)}if(f.required&&!g)return ht(r,"Prop '"+h+"' is required"),!1;p=this.#w(t,h,p);let E=o(t,[h,"getter"]);E&&(E=H(E,this));let b=o(t,[h,"setter"]);if(b&&(b=H(b,this)),(E||b)&&Reflect.defineProperty(this.#e,h,{set:b||function(t){},get:E}),f.attribute&&l(p)&&!a(p)){let t=m(h),s=W(p);(v=f.type)===Boolean||e(v,(t=>t===Boolean))?(s=gt(p),j(s)?this.toggleAttribute(t,s):this.setAttribute(t,s)):this.setAttribute(t,s)}var v;this.#e[h]=p,u[h]=p})),Object.seal(u)}#w(t,n,i){let o=t[n];if(!o)return i;let a=o.isValid,c=o.type,d=C(c)?c:[c],u=o.converter,h=i;if(!e(d,(t=>t===String))&&s(h)&&!B(h))try{h=u?u(h):r(h,{html:We})}catch(t){ht(this.tagName,`Convert attribute '${n}' error with `+h)}for(let t=0;t<d.length;t++){"Boolean"===d[t].name&&(h=gt(h))}let p=typeof h,f=!l(h);for(let t=0;t<d.length;t++){const e=d[t];if(k(p,e.name,"i")||h instanceof e||Object.prototype.toString.call(h)===Object.prototype.toString.call(e.prototype)){f=!0;break}}return f||ht(this.tagName,`Invalid prop '${n}'. expected '${d.map((t=>t.name||t))}' but got '${p}'`),a&&(a.call(this,h,this.#e)||ht(this.tagName,`Invalid prop '${n}'. IsValid() check failed`)),h}#C(){let t=o(this.constructor,ct.STATES);g(t,((e,s)=>{let r=t[s],n=o(this,s);if(r){let t=r.prop;n=t?f(this.#e[t]):o(this,s)}this.#e[s]=n}))}#x=U(this.propsReady,100);_setParentProps(t,e){if(this.#g){let s=o(this.constructor,ct.PROPS);g(t,((t,e)=>{let r=I(e),n=s[r];if(!n)return;let i=this.#e[r];t=this.#w(s,r,t),n.hasChanged&&!n.hasChanged.call(this,t,i)||(this.#e[r]=t,this._notify(i,[r]))})),O(this.#a,t),O(this.#o,e),this.#x(this.#a)}}_updateProps(t){let e=o(this.constructor,ct.PROPS);g(t,((t,s)=>{let r=I(s);e[r]&&(t=this.#w(e,r,t),xt.__skipCheck=!0,T(this,r,t),xt.__skipCheck=!1)})),O(this.#a,t),this.#x(this.#a)}_initProps(t,e){this.#a=p(this.#a||{},t),this.#o=p({},e)}_bindSlot(t,e,s){if(this.#p[e]||(this.#p[e]=t,Reflect.defineProperty(t,"__l_comp",{value:this})),t.addEventListener("slotchange",(s=>{this.#g&&this.#N(t,"default"===e?"":e)})),!c(s)){let t=this.#t[e];t||(t=this.#t[e]={}),t.props=s}}_bindSlotHook(t,e){this.#u[t]=e}#P=new Set;_updateSlot(t,e,s){let r=this.#p[t],n=this.#u[t];if(!n&&!r)return;let i=this.#t[t];if(e&&(i.props||(i.props={}),i.props[e]=s),n)this.#P.add(t);else{let t=r.assignedElements({flatten:!0});for(let r=0;r<t.length;r++){t[r].setAttribute(e,s+"")}}}#b(){const t=A(this.childNodes,(t=>t.nodeType===Node.COMMENT_NODE?[]:t instanceof HTMLSlotElement?t.assignedNodes({flatten:!0}):t));let e=z(t,(t=>t.nodeType===Node.TEXT_NODE?"default":t instanceof Element?t.getAttribute("slot")||"default":void 0));if(c(e))return void(c(this.#e["#slots"])||(this.#g?this.#s["#slots"]={}:this.#e["#slots"]={}));g(e,((t,e)=>{if(e){for(;t.length>0;){let e=t[0];if(!(e.nodeType===Node.TEXT_NODE&&i(e.textContent)||e instanceof HTMLSlotElement&&c(e.assignedNodes({flatten:!0}))))break;t.shift()}for(;t.length>0;){let e=E(t);if(!(e.nodeType===Node.TEXT_NODE&&i(e.textContent)||e instanceof HTMLSlotElement&&c(e.assignedNodes({flatten:!0}))))break;t.pop()}}}));let s={};g(e,((t,e)=>{c(t)||(s[e]=t)})),this.#g?this.#s["#slots"]=s:this.#e["#slots"]=s}#y(t){let e=this.#u[t];if(!e)return;let s=this.#t[t];if(!this.#e["#slots"][t])return;this.renderAsync(e,o(s,"props"));const r=this._asyncDirectives.get(e);let n=r?.buildView(e(o(s,"props"))),i=F(_(n),(t=>t.nodeType===Node.COMMENT_NODE));if(i){let e=this.#f[t];if(!c(e))for(let t=0;t<e.length;t++){const s=e[t];s.parentNode?.removeChild(s)}this.#f[t]=i,this.append(...i),this.#P.clear()}}_asyncDirectives=new WeakMap;renderAsync(t,...e){}#S(t,e,s){if(!this.isMounted)return;if(wt(this.constructor).has(t)){let e=I(t);if(B(s)){s=o(this.constructor,ct.PROPS)[e]._defaultValue}this._updateProps({[e]:s})}}_regDeps(t,e){let s=this.#i[t];s||(s=this.#i[t]=new Set),s.add(e);let r=t.split("-");if(r.pop(),r.length<1)return;let n=r.join("-");s=this.#i[n],s||(s=this.#i[n]=new Set),s.add(e)}emit(t,e={},s){s&&s.event&&(e.event=s.event),e.target=this,this.dispatchEvent(new CustomEvent(t,{bubbles:o(s,"bubbles",!1),composed:o(s,"composed",!1),cancelable:!0,detail:e}))}on(t,e){this.#T[t]||(this.#T[t]=[]);let s=e.bind(this);this.#T[t].push(s),this.addEventListener(t,s)}nextTick(t){Dt.pushNext(t)}forceUpdate(){g(this.#s,((t,e)=>{this.#r[e]={value:void 0,chain:void 0}})),this.#E()}}var Bt,Ut,zt;!function(t){t.NONE="NONE",t.REMOVE="REMOVE",t.REPLACE="REPLACE",t.UPDATE="UPDATE",t.APPEND="APPEND"}(Bt||(Bt={}));class Ft{key;varIndex;value;isText=!1;isTmpl=!1;isDirective=!1;node;textNode;isComponent=!1;attrName;attrTmpl;isProp=!1;isToggleProp=!1;isEvent;constructor(t,e,s,r){this.varIndex=t,this.node=e,s&&(this.attrName=s),r&&(this.attrTmpl=r)}}!function(t){t.ATTR="attr",t.PROP="prop",t.TEXT="text",t.CLASS="class",t.STYLE="style",t.SLOT="slot",t.TAG="tag"}(Ut||(Ut={}));class Kt{startNode;endNode;type;attrName;varIndex;expressionChain;nodes;constructor(t,e,s){this.startNode=t,this.attrName=e,this.type=s}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"}(zt||(zt={}));class Qt extends Function{diClass;args;di;varPath;point;slotComponent;varChain;constructor(t,...e){super(),this.diClass=t,this.args=e,this.varChain=xt.popDirectiveQ(),this.di=new this.diClass,this.di.renderParams=this.varChain}checkScope(t){let e=o(this.diClass,"scopes");c(e)||k(e.join(","),t)||ut(`Directive '${this.diClass.name}' is out of scopes, expect '${e.join(",")}' bug got '${t}'`)}render(t){let e=this.di;return this.args,e.renderComponent||(e.renderComponent=t),this.di=e,e._renderArgs=this.args,this.di.render(...this.args)}update(t,e,s){let r=this.di.update(t,e,s);if(r===Bt.NONE)return;let n=t.getNodes();if(r===Bt.REMOVE)for(let t=0;t<n.length;t++){const e=n[t];e.parentNode?.removeChild(e)}else if(r===Bt.REPLACE){let s=[];for(let t=0;t<n.length;t++){const e=n[t];e.parentNode?.removeChild(e)}let r=this.di.render(...e),i=this.di.buildView(r);s=_(i);let o=document.createDocumentFragment();o.append(...s),t.endNode.parentNode.insertBefore(o,t.endNode)}else if(r===Bt.UPDATE){let s,r={},i=[],o=[],a=this.di.render(...e);if(a||(a=new Ue([],[])),c(n)){let e=this.di.buildView(a);return void t.startNode.after(...e)}let l={};a instanceof Ue&&a.vars.forEach((t=>{if(t instanceof Ue){const e=t.getKey();l[e]=t,r[e]=!0,o.push(e)}})),n=V(K(n),(t=>t.nodeType===Node.ELEMENT_NODE)),s=V(K(_(s)),(t=>t.nodeType===Node.ELEMENT_NODE));let d={},u="",h={};for(let t=0;t<n.length;t++){let e=n[t],s=e.getAttribute("key");if(s){if(d[s]){u=s;break}d[s]=e,i.push(s),h[s]=!0}}if(u)return void ut(`${I(this.diClass.name)} - duplicate key '${u}'`);let p=r;const f=t.startNode.parentNode;let m=[],b=[];if(g(h,((t,e)=>{p[e]||(b.push(e),delete h[e],Q(i,e))})),!c(o)){let e="",s=-1,r=[],n=new Map;for(let a=0;a<o.length;a++){const l=o[a];let c=i.findIndex((t=>t===l));if(c>-1&&c!==a){if(s<0||s-c==1){let t=E(r);r.push({nodeId:l,targetId:0===a?zt.AFTER_BEGIN:t?t.nodeId:o[a-1]})}else n.set(r.length,{group:r,targetId:""}),r=[],r.push({nodeId:l,targetId:i[c]});s=c}else if(c<0){let s=e?d[e]||t.endNode:t.startNode;m.push({prevNode:s,newkey:l})}e=l}c(n)&&r.length>0&&n.set(r.length,{group:r,targetId:""});let a=n.keys().toArray(),l=a.sort(((t,e)=>t-e));if(a.length>0&&a.length<2){let{group:e}=n.get(l[0]);y(e).forEach((({targetId:e,nodeId:s})=>{let r,n=d[s];e===zt.AFTER_BEGIN?(r=t.startNode,r.after(n)):(r=d[e],r.after(n))}))}}m.length>0&&this.#A(m,l,o),m.forEach((e=>{let s=e.newkey,r=this.newNodeMap[s],n=e.prevNode;n===t.endNode?n.before(r):(t.startNode,n.after(r))})),b.forEach((t=>{let e=i.findIndex((e=>e==t));this.#k(e);let s=d[t];s&&s.parentNode&&f.removeChild(s)})),this.di.__updatePoints.forEach((t=>{t.key||(t.key=t.value.tmpl.getKey());const e=o.findIndex((e=>e==t.key));t.varIndex=e})),this.di.updateView(a)}}getDirective(){return this.di}newNodeMap={};#A(t,e,s){const r=[],n=[];t.forEach((t=>{let s=t.newkey;r.push(""),n.push(e[s])})),r.push("");let i=new Ue(r,n),o=this.di.__updatePoints,a=this.di.buildView(i);this.di.__updatePoints.forEach(((t,e)=>{const s=t.value.tmpl.getKey();t.key=s})),this.di.__updatePoints.push(...o),a.forEach((t=>{t instanceof HTMLElement&&(this.newNodeMap[t.getAttribute("key")]=t)}))}#k(t){Q(this.di.__updatePoints,((e,s)=>{if(e.varIndex==t)return $e.remove(e.node,e.textNode),!0}))}}function Xt(t){return(...e)=>{let s=null;return e.forEach(((t,r)=>{if(v(t)){let n=t;e[r]=function(...t){let e=s.di;xt.startRender(e);let r=n.call(e.renderComponent,...t);return xt.endRender(e.renderComponent),r}}})),s=new Qt(t,...e),s}}const Gt=["resize","outside","mutate"],qt=new WeakMap,Yt=[],Zt=[],Jt=[],te=new ResizeObserver((t=>{for(const e of t){const t=Array.isArray(e.contentBoxSize)?e.contentBoxSize[0]:e.contentBoxSize,s=Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize;let r=qt.get(e.target);if(r){r(new CustomEvent("resize",{bubbles:!1,cancelable:!1,detail:{borderBox:{w:s.inlineSize,h:s.blockSize},contentBox:{w:t.inlineSize,h:t.blockSize}}}),e.target)}}}));var ee;!function(t){t.Child="child",t.Tree="tree",t.Attr="attr",t.Char="char"}(ee||(ee={}));const se=new WeakMap,re=new MutationObserver((t=>{for(let e=0;e<t.length;e++){const s=t[e];let r=se.get(s.target);if(!r)return;let n={target:s.target},i=null;switch(s.type){case"subtree":n.type=ee.Tree,i=r[ee.Tree];break;case"childList":n.type=ee.Child,n.addedNodes=s.addedNodes,n.removedNodes=s.removedNodes,i=r[ee.Child];break;case"attributes":n.type=ee.Attr,n.attributeName=s.attributeName,n.oldValue=s.oldValue,i=r[ee.Attr];break;case"characterData":n.type=ee.Char,n.oldValue=s.oldValue,i=r[ee.Char]}if(i){i(new CustomEvent("mutate",{bubbles:!1,cancelable:!1,detail:n}))}}}));function ne(t,e,s,r){if("resize"===t)!function(t,e){qt.has(t)||(qt.set(t,e),te.observe(t))}(e,s);else if("outside"===t)switch(r[0]){case"mousedown":!function(t,e){Yt.push([t,e])}(e,s);break;case"dblclick":!function(t,e){Jt.push([t,e])}(e,s);break;default:!function(t,e){Zt.push([t,e])}(e,s)}else"mutate"===t&&function(t,e,s){let r=X(s,"child"),n=X(s,"attr"),i=X(s,"char"),o=X(s,"tree"),a=se.get(t);a||(a={},se.set(t,a),r&&(a[ee.Child]=e),n&&(a[ee.Attr]=e),i&&(a[ee.Char]=e),o&&(a[ee.Tree]=e),re.observe(t,{childList:r,attributes:n,characterData:i,subtree:o}))}(e,s,r)}document.addEventListener("mousedown",(t=>{let e=o(t.composedPath(),0,t.target);Yt.forEach((([s,r])=>{if(!s.contains(e)&&!s.contains(L(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){r(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:s,event:t}}),s)}}))}),!1),document.addEventListener("click",(t=>{let e=o(t.composedPath(),0,t.target);Zt.forEach((([s,r])=>{if(!s.contains(e)&&!s.contains(L(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){r(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:s,event:t}}),s)}}))}),!1),document.addEventListener("dblclick",(t=>{let e=o(t.composedPath(),0,t.target);Jt.forEach((([s,r])=>{if(!s.contains(e)&&!s.contains(L(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){r(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:s,event:t}}),s)}}))}),!1);const ie=/,|^(debounce:.+)|(debounce$)/,oe=/,|^(throttle:.+)|(throttle$)/,ae="self",le="stop",ce="prevent",de="once",ue="left",he="right",pe="middle",fe="ctrl",ge="alt",me="shift",_e="meta",Ee={esc:"escape"},be=":";function ve(t,e,s,r){let n,i=t.split("."),o=i.shift(),a=i.includes(de),l=e;if(n=G(i,(t=>ie.test(t)))){let t=n.split(be);l=U(l,parseInt(t[1])||100)}if(n=G(i,(t=>oe.test(t)))){let t=n.split(be);l=q(l,parseInt(t[1])||100)}if(a&&(l=D(l)),function(t){return Gt.includes(t)}(o))return ne(o,s,l,i),l;let c=t=>{if(i.includes(ce)&&t.preventDefault(),i.includes(le)&&t.stopPropagation(),!i.includes(ae)||t.target===t.currentTarget){if(t instanceof MouseEvent){if(i.includes(ue)&&0!=t.button)return;if(i.includes(he)&&2!=t.button)return;if(i.includes(pe)&&1!=t.button)return}else if(t instanceof KeyboardEvent){if(Q(i,(t=>t==fe))[0]&&!t.ctrlKey)return;if(Q(i,(t=>t==ge))[0]&&!t.altKey)return;if(Q(i,(t=>t==me))[0]&&!t.shiftKey)return;if(Q(i,(t=>t==_e))[0]&&!t.metaKey)return;if(!Y(i,(t=>Ee[t]||t)).includes(t.key.toLowerCase()))return}l(t)}};s.addEventListener(o,c);let d=r.__events[o];return d||(d=r.__events[o]=[]),d.push([s,c]),c}const Ce="@",ye=".",Ne="?",Se="*",Te=":",Pe="ref",we=/[.?-a-z]+\s*=\s*(['"])\s*([^='"]*<\!--c_ui-pl_df-->){2,}.*?\1/ims,xe=/<\s*[a-z0-9-]+([^>]*<\!--c_ui-pl_df-->)*[^>]*?(?<!-)>/gims,Ae="slot-props";function ke(t,e){let s="",r=u(e.vars),n=e.strings.length-1,i=e.vars.length-1;for(let r=0;r<=n;r++){const n=e.strings[r];let a=o(e.vars,r,"");if(a&&a.di){let e=a.render(t);if(e instanceof Ue){let[s,r]=ke(t,e);Reflect.defineProperty(a,"_renderVars",{value:r}),a=Me+s+Oe}else a=e??De}else if(a instanceof Ue){let[e,s]=ke(t,a);Reflect.defineProperty(a,"_renderVars",{value:s}),a=Re+e+Le}else a=r>i?"":De;s+=n+a}let a=s.match(we);if(a){return ut(`Parse error: attribute value can be set only one interpolation —— \n ${Z(a[0],De,"${...}")}`),["",r]}let l=0;return s=s.replace(xe,((t,e)=>Z(t,De,(()=>De.replace("--\x3e","")+l++)))),s=s.replace(je,"$1><").trim(),[s,r]}const Me="\x3c!--c_ui-pl_di-start--\x3e",Oe="\x3c!--c_ui-pl_di-end--\x3e",Re="\x3c!--c_ui-pl_tmpl-start--\x3e",Le="\x3c!--c_ui-pl_tmpl-end--\x3e",De="\x3c!--c_ui-pl_df--\x3e",Ve="\x3c!--c_ui-pl_df",He=/<!--c_ui-pl_df\d*(-->)?/;function Ie(t,e,s,r,i){const a=document.createElement("div");a.innerHTML=e;const l=document.createNodeIterator(a,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let c,u,h=0,p=null,f=[],g=[],C=[],y=[t],N=[],S=[];for(;c=l.nextNode();)if(c instanceof HTMLElement||c instanceof SVGElement){c instanceof jt?p=c:p?.contains(c)||(p=null);let e={},n=_(c.attributes);for(let i=0;i<n.length;i++){const o=n[i];let{name:a,value:l}=o;if(a===Ae){let t=c.getAttribute("name")||"default";if(p){let e=p._slotsPropMap[t];e||(e=p._slotsPropMap[t]=[]),e.push(c)}}if(b(a,Ve)){let e=s[h];if(e instanceof Qt){e.checkScope(Ut.TAG);let s=new Kt(c,a.substring(1),Ut.TAG);e.point=s,e.di.slotComponent=p,e.di.renderComponent=r;let n=new Ft(h,c);n.isDirective=!0,n.value=e,n.isComponent=!!p,t.push(n),h++,e.di.created(s,...e.args)}c.removeAttribute(a)}else if(a[0]!==Ce)if(a!==Pe)if(a[0]!==ye||He.test(l)){if(He.test(l)){let n=s[h],i=new Ft(h,c,a.replace(/\.|\?|@/,""),l);if(i.isComponent=!!p,a[0]===ye||a[0]===Ne||a[0]===Se){if(n instanceof Qt){n.checkScope(Ut.PROP);let t=new Kt(c,a.substring(1),Ut.PROP);n.point=t,n.slotComponent=p,i.value=n,i.isDirective=!0,n&&n.di.created(n.point,...n.args)}else if(a[0]===Ne)i.isToggleProp=!0,i.value=!!n,i.value&&c.setAttribute(a.substring(1),"");else if(a[0]===Se){i.value=n;let t=a.substring(1);const[e,s]=t.split(Te);let r=e;switch(s){case"camel":r=I(r);break;case"kebab":r=m(r);break;case"snake":r=J(r)}i.attrName=r,c.setAttribute(r,n)}else if(c instanceof jt||"SLOT"===c.tagName){let t=I(a.substring(1));t in c||"SLOT"===c.tagName||ht(c.tagName,`Prop '${a}' is not defined in ${c.tagName}`),i.value=n,i.isProp=!0,e[t]=n}else ht(c.tagName,`Prop '${a}' can only be set on a CompElem or a slot`);c.removeAttribute(a),n=""}else{let t;if(i.value=n,n instanceof Qt){let e=Ut.ATTR;"class"===a?e=Ut.CLASS:"style"===a&&(e=Ut.STYLE),n.checkScope(e),i.isDirective=!0;let s=new Kt(c,a,e);n.point=s,n.di.slotComponent=p,n.di.renderComponent=r,t=n,n=""}l=w(l,He,n),o.value=l,t&&t.di.created(t.point,...t.args)}t.push(i),h++}}else ht(c.tagName,`Prop '${a}' must be an interpolation`);else{if(He.test(l)){let t=s[h];if(!d(t,"current")){ht(c.tagName,"Ref must be a RefObject");continue}h++,t.current=c}c.removeAttribute(a)}else{let e=t=>{};if(He.test(l)){let n=s[h];if(!v(n)){ht(c.tagName,`Event '${a}' must be a function`);continue}e=n.bind(r);let i=new Ft(h,c,a.replace(/\.|\?|@/,""),l);i.isComponent=!!p,i.isEvent=!0,t.push(i),h++}ve(a.substring(1),e,c,r),c.removeAttribute(a)}}c instanceof jt?c._initProps(e):c instanceof HTMLSlotElement&&r._bindSlot(c,c.name||"default",e)}else{let e=c,a=`\x3c!--${e.nodeValue}--\x3e`;if(a===Me){u&&f.push(u),u=e;let n=s[h],i=new Ft(h,c);i.isComponent=!!p,i.isDirective=!0,i.value=n;let o=p?Ut.SLOT:Ut.TEXT,a=new Kt(u,"",o);n.point=a,n.di.slotComponent=p,n.di.renderComponent=r,g.push(n),t.push(i),C.push(i),t=[],y.push(t),h++,S.push(h),N.push(s),s=n._renderVars,h=0;continue}if(a===Oe){C.pop().textNode=e;let r=g.pop();r.point.endNode=e,r.di.created(r.point,...r.args),u=f.pop(),r.di.__updatePoints=t,y.pop(),t=E(y),s=N.pop(),h=S.pop()}else{if(a===Re){u&&f.push(u),u=e;let n=s[h],a=new Ft(h,c);a.isComponent=!!p,a.isTmpl=!0;let l=E(g);(l&&"ForEach"===o(l,"diClass.name")||"ForEach"==i.constructor.name)&&(a.key=n.getKey()),n=a.value=new Ht(n);let d=p?Ut.SLOT:Ut.TEXT,m=new Kt(u,"",d);n.point=m,n.slotComponent=p,n.renderComponent=r,g.push(n),t.push(a),C.push(a),t=[],y.push(t),h++,S.push(h),N.push(s),s=n._renderVars,h=0;continue}if(a===Le){C.pop().textNode=e;let r=g.pop();r.point.endNode=e,u=f.pop(),r.__updatePoints=t,y.pop(),t=E(y),s=N.pop(),h=S.pop()}}if(a!==De)continue;let l=new Ft(h,c);t.push(l),l.isComponent=!!p,l.isText=!0;let d,m=s[h];if(d=document.createComment(`compelem-ui-${h}-child-start`),e.parentNode.insertBefore(d,e),e.nodeValue=`compelem-ui-${h}-child-end`,l.textNode=d,m instanceof Qt){l.isDirective=!0,l.value=m;let t=p?Ut.SLOT:Ut.TEXT,s=new Kt(d,"",t);s.endNode=e,m.point=s,m.di.slotComponent=p,m.di.renderComponent=r,m.di.created(s,...m.args),m=""}else if(m instanceof Ue){l.isTmpl=!0,l.value=m;let[e,s]=ke(r,m);m=Ie(t,e,s,r,i)}else l.value=m;if(h++,n(m))continue;if(m instanceof NodeList){let t=document.createDocumentFragment();t.append(...m),e.parentNode.insertBefore(t,e)}else if(m instanceof Element)e.parentNode.insertBefore(m,e);else if(W(m)){let t=document.createTextNode(m);e.parentNode.insertBefore(t,e)}}return a.childNodes}const $e={insertBefore:function(t,e){if(!t.parentNode)return;let s=document.createDocumentFragment();s.append(...e),t.parentNode.insertBefore(s,t)},remove:function(t,e){if(t===e)return void t?.parentNode?.removeChild(t);let s=t.nextSibling;for(;s&&s!==e;)s?.parentNode?.removeChild(s),s=t.nextSibling}};function We(t,...e){return new Ue(s(t)?[t]:t,e)}const je=/([a-z0-9"'])\s*>\s*</gim;function Be(t){return{current:t}}class Ue{strings;vars;constructor(t,e){this.strings=u(t),this.vars=e}getKey(){let t=this.vars,e="";return g(this.strings,((s,r)=>{if(at.test(s))return e=tt(t[r]),!1})),e}getKeys(){let t=this.vars,e=[];for(let s=0;s<this.strings.length;s++){const r=this.strings[s];if(at.test(r)){let r=tt(t[s]);e.push(r)}}return c(e)&&t.forEach((t=>{if(t instanceof Ue){let s=t.getKey();e.push(s)}})),e}append(t){let e=E(this.strings);return t.strings.forEach(((t,s)=>{0!=s?this.strings.push(t):this.strings[this.strings.length-1]=e+t})),this.vars=u(this.vars,t.vars),this}insert(t,e){let s=e.strings.shift();return this.strings[t]+=s,this.strings.splice(t+1,0,...e.strings),this.vars.splice(t,0,...e.vars),this}getHTML(t){let[e,s]=ke(t,this),r=Ie([],e,s,t,t);return et(r,((t,e)=>t+e.outerHTML),"")}}function ze(t,e,s){s.get||ut(`Computed '${e}' must be a getter`),d(t.constructor,ct.COMPUTED)||(t.constructor[ct.COMPUTED]=c(t.constructor[ct.COMPUTED])?{}:f(t.constructor[ct.COMPUTED])),t.constructor[ct.COMPUTED][e]=s.get}function Fe(t,e){return(s,r,n)=>{d(s.constructor,ct.EVENTS)||(s.constructor[ct.EVENTS]=c(s.constructor[ct.EVENTS])?[]:f(s.constructor[ct.EVENTS])),s.constructor[ct.EVENTS].push({name:t,options:e,fn:s[r]})}}var Ke;!function(t){t.ONCE="once",t.UPDATABLE="updatable"}(Ke||(Ke={}));class Qe extends mt{static get priority(){return Number.MAX_VALUE}created(t,e,s,...r){}mounted(t,e,...s){}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,s,r,...n){const i=this;Reflect.defineProperty(t,r,{get:()=>(i.result&&i.cache||i.getter(t),i.result)})}updated(t,e){this.cache===Ke.UPDATABLE&&this.getter(t)}}const Xe=yt(Qe),Ge=yt(class extends Qe{getter(t){this.result=t.shadowRoot?.querySelectorAll(this.selector)}});function qe(t){if(1===arguments.length)return(e,s)=>{Ye(e,s,t)};Ye(arguments[0],arguments[1],{prop:""})}function Ye(t,e,s){if(!d(t.constructor,ct.STATES)){const e={};let s=t.constructor;for(;(s=ft(s))!==jt;)p(e,s[ct.STATES]?f(s[ct.STATES]):{});Reflect.defineProperty(t.constructor,ct.STATES,{configurable:!1,enumerable:!1,value:e})}s.shallow=s.shallow||!1,t.constructor[ct.STATES][e]=s}function Ze(t,e,s){Ye(t.prototype,e,s||{prop:""})}function Je(t){return e=>{if(e){if(e.prototype.hasOwnProperty("attributeChangedCallback")){let t=e.prototype.attributeChangedCallback;e.prototype.attributeChangedCallback=function(e,s,r){jt.prototype.attributeChangedCallback.call(this,e,s,r),t.call(this,e,s,r)}}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.connectedCallback;e.prototype.disconnectedCallback=function(){jt.prototype.disconnectedCallback.call(this),t.call(this)}}customElements.define(t,e)}}}function ts(t,e){return(s,r)=>{d(s.constructor,ct.WATCH)||(s.constructor[ct.WATCH]=c(s.constructor[ct.WATCH])?{}:f(s.constructor[ct.WATCH]));(C(t)?t:[t]).forEach((t=>{let n=t.replaceAll(".","-"),i=s.constructor[ct.WATCH][n];C(i)||(i=s.constructor[ct.WATCH][n]=[]),i.push({source:t,options:e,handler:s[r]})}))}}class es extends(Vt(Object)){_renderArgs;static get scopes(){return[]}renderParams}const ss=["key"];const rs=Xt(class extends es{created(t,e){let s=t.startNode;if(s instanceof jt){let t={},r={};g(e,((e,n)=>{ss.includes(n)||(n in s?t[n]=e:r[n]=e+"")})),s._initProps(t,r)}else g(e,((t,e)=>{s.setAttribute(e,t)}))}update(t,e,s){return Bt.NONE}static get scopes(){return[Ut.TAG]}render(t){}});const ns=Xt(class extends es{created(t,e){let r=[];C(e)?r=K(e):a(e)?r=A(e,((t,e)=>t?e:[])):s(e)&&(r=e.split(" "));let n=t.startNode;g(this.lastCls,(t=>{n.classList.remove(t)})),g(r,(t=>{n.classList.add(t)})),this.lastCls=u(r)}update(t,e,s){return this.created(t,e[0]),Bt.NONE}static get scopes(){return[Ut.CLASS]}lastCls;render(t){}});const is=Xt(class extends es{created(t,...e){}update(t,e,s){if(c(t.getNodes())&&(!e||c(e[0])))return Bt.NONE;if(st(this.lastAry,e[0])&&this.lastAry.length===e[0].length)return Bt.NONE;if(!c(this.renderParams)){let t=E(this.renderParams);C(t)||(t=[t]),this.renderParams=t}return this.lastAry=rt(e[0]),Bt.UPDATE}constructor(t){super(),c(this.renderParams)||(this.renderParams=_(E(this.renderParams)))}static get scopes(){return[Ut.TEXT,Ut.SLOT]}lastAry;lastRenderTmpl;render(t,e){let s=Y(t,((t,s)=>e(t,s)));if(s.length<1)return this.lastRenderTmpl=new Ue([],[]),this.lastRenderTmpl;let r=[],n=[];const i=[],o=[];for(let t=0;t<s.length;t++){const e=s[t];let a=E(n),l=e.vars,c=!0,d=e.strings;for(let t=0;t<d.length;t++){const e=d[t];if(at.test(e)){let e=l[t]+"";if(r.includes(e))return void ut(`forEach - duplicate key '${e}'`);r.push(e),c=!1}0==t&&a?n[n.length-1]=a+e:n.push(e)}if(c)return void ut("forEach - missing 'key' prop");let u=E(i);u&&d.length>0&&(i[i.length-1]=W(u)+d.shift()),i.push(""),o.push(e)}return this.lastAry=rt(t),i.push(""),this.lastRenderTmpl=new Ue(i,o),this.lastRenderTmpl}});const os=Xt(class extends es{created(t,...e){}ifNodes;elseNodes;static get scopes(){return[Ut.TEXT,Ut.SLOT]}update(t,e,s){return!!e[0]==!!s[0]?Bt.NONE:(e[0],Bt.REPLACE)}render(t,e,s){return t?e(t):s(t)}});const as=Xt(class extends es{created(t,...e){}static get scopes(){return[Ut.TEXT,Ut.SLOT]}update(t,e,s){return e[0]===s[0]?Bt.NONE:e[0]?Bt.REPLACE:Bt.REMOVE}render(t,e){return t?e():We``}});var ls;!function(t){t.CHANGE="change",t.INPUT="input"}(ls||(ls={}));const cs=Xt(class extends es{created(t,e,s="value"){const r=t.startNode;if("binded"===o(r,"_model"))return;let n=E(this.renderParams);if(this.updateProp=s,this.modelPath=n,a(e)||W(e)||(e=""),r instanceof jt)r._initProps({[this.updateProp]:e}),r.addEventListener("update:"+s,(t=>{T(this.renderComponent,this.modelPath,t.detail.value)})),T(r,"_model","binded");else if(r instanceof HTMLTextAreaElement)r.setAttribute(this.updateProp,e+""),r.addEventListener("input",(t=>{let e=t.target;T(this.renderComponent,this.modelPath,e.value)})),T(r,"_model","binded");else if(r instanceof HTMLInputElement){let t="",n="";switch(r.type){case"checkbox":case"radio":t="checked",n="change";break;default:t="value",n="input"}r.setAttribute(s??t,e+""),r.addEventListener(n,(t=>{let e=t.target;T(this.renderComponent,this.modelPath,e.value)})),T(r,"_model","binded")}else r instanceof HTMLSelectElement&&(r.setAttribute(this.updateProp,e+""),r.addEventListener("change",(t=>{let e=t.target;T(this.renderComponent,this.modelPath,e.value)})),T(r,"_model","binded"))}update(t,e,s){if(this.modelPath||(this.modelPath=E(this.renderParams)),!P(e,s)){const s=t.startNode;if(s instanceof jt)s._updateProps({[this.updateProp]:e[0]});else if(s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement)s.setAttribute(this.updateProp,e[0]+"");else if(s instanceof HTMLInputElement)switch(s.type){case"checkbox":case"radio":e[0]?s.setAttribute("checked",""):s.removeAttribute("checked");break;default:s.setAttribute(this.updateProp,e[0]+"")}}return Bt.NONE}static get scopes(){return[Ut.TAG]}modelPath;render(t,e="value"){}});const ds=Xt(class extends es{created(t,e,s){let r=t.startNode;n(this.display)&&(this.display=r.style.display);let i=s;this.renderComponent.nextTick((()=>{r.style.display=e?this.display:"none",i&&i(r,e)}))}update(t,e,s){return this.created(t,e[0],e[1]),Bt.NONE}display=void 0;static get scopes(){return[Ut.TAG]}constructor(t){super(),this.point=t}render(t,e){}});const us=Xt(class extends es{created(t,e,s){e=e.bind(this.renderComponent),this.slotComponent._bindSlotHook(s||"default",e)}update(t,e,s){return Bt.NONE}static get scopes(){return[Ut.SLOT]}render(t,e){}});class hs{static getCssText(t){return s(t)?t:N(Y(t,((t,e)=>e.startsWith("--")?e+":"+t:m(e)+":"+t)),";")}static setStyle(t,e){if(s(t)&&!W(t))return{};let r=hs.getCssText(t),n={};return g(r.split(";"),(t=>{let s=t.split(":"),r=W(s[0]),i=W(s[1]);n[r]=e.style.getPropertyValue(r),e.style.setProperty(r,i)})),n}}const ps=Xt(class extends es{created(t,e){hs.setStyle(e,t.startNode)}update(t,e,s){return this.created(t,e[0]),Bt.NONE}constructor(t){super(),this.point=t}static get scopes(){return[Ut.STYLE]}render(t){}});const fs=Xt(class extends es{created(t,e){this.modelPath||(this.modelPath=E(this.renderParams));const s=t.startNode;let r=t.attrName;s._initProps({[r]:e}),s.addEventListener("update:"+r,(t=>{T(this.renderComponent,this.modelPath,t.detail.value)}))}update(t,e,s){if(!P(e,s)){const s=t.startNode;let r=t.attrName;s._updateProps({[r]:e[0]})}return Bt.NONE}static get scopes(){return[Ut.PROP]}modelPath;constructor(t){super()}render(t){}});const gs=Xt(class extends es{created(t,...e){}static get scopes(){return[Ut.TEXT,Ut.SLOT]}update(t,e,s){return P(e,s)?Bt.NONE:Bt.REPLACE}render(t,e){let s=()=>We``,r=[],n=[];g(e,((t,e)=>{if(v(t))r.push(e),n.push(t);else{let e=t[0],s=t[1];r.push(e),n.push(s)}"default"===e&&(s=t)}));let i=nt(r,(e=>v(e)?e(t):e==t));return it(n[i]??s)}});export{jt as CompElem,hs as CssHelper,mt as Decorator,dt as DecoratorType,vt as DecoratorWrapper,es as Directive,Bt as DirectiveUpdateTag,Qt as DirectiveWrapper,Kt as EnterPoint,Ut as EnterPointType,_t as GetKeyFnName,ls as ModelTriggerType,Ke as QueryCache,Ue as Template,Ft as UpdatePoint,bt as _DecoratorMap,Et as _DecoratorsKey,wt as _getObservedAttrs,rs as bind,ke as buildHTML,ns as classes,ze as computed,Be as createRef,yt as decorator,Xt as directive,Fe as event,is as forEach,We as html,os as ifElse,as as ifTrue,Ze as makeState,cs as model,St as prop,Xe as query,Ge as queryAll,ds as show,us as slot,qe as state,ps as styles,fs as sync,Je as tag,ts as watch,gs as when};
|
|
7
|
+
import{toPath as t,some as e,isString as s,fval as r,isUndefined as n,isBlank as i,get as o,isObject as a,isDefined as l,isEmpty as c,has as d,concat as u,defaults as h,merge as p,cloneDeep as f,each as g,kebabCase as m,toArray as E,last as _,startsWith as b,isFunction as v,isArray as C,initial as S,join as y,split as N,set as T,isEqual as P,replace as w,isPlainObject as A,flatMap as x,test as k,size as M,assign as O,first as R,closest as L,once as D,filter as V,bind as H,camelCase as I,isNil as $,trim as W,isBoolean as j,isNull as B,debounce as U,groupBy as z,reject as F,compact as K,remove as Q,includes as X,find as G,throttle as q,map as Y,replaceAll as Z,snakeCase as J,toString as tt,reduce as et,isMatch as st,clone as rt,findIndex as nt,call as it}from"myfx";const ot=new WeakMap,at=/\s+\.?key\s*=/;var lt,ct,dt;function ut(t){console.error("[CompElem]",t)}function ht(t,e){console.error(`[CompElem <${t}>]`,e)}function pt(e){return t(e).join("-")}function ft(t){return Object.getPrototypeOf(t)}function gt(t){let e=t;return s(t)&&/(?:^true$)|(?:^false$)/.test(e)?e=r(e):(n(e)||i(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.CLASS="class",t.FIELD="field",t.METHOD="method"}(dt||(dt={}));class mt{static get priority(){return 0}}const Et="getKey",_t="__decorators",bt=new WeakMap;class vt{args;metadata;decoratorClass;instanceMap;key;priority=0;constructor(t,e,s){this.args=t,this.metadata=e,this.decoratorClass=s,this.priority=o(s,"priority",0),this.instanceMap=new WeakMap}create(t){let e,s=new this.decoratorClass(...this.args),r=s.targets,i=this.metadata[2];a(i)&&l(o(i,"configurable"))?e=dt.METHOD:n(this.metadata[2])&&(e=dt.FIELD),!c(r)&&e&&r.includes(e)?(s.created(t,...this.metadata),this.instanceMap.set(t,s)):ut(`Decorator '${this.decoratorClass.name}' is out of targets, expect '${r.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 Ct=new WeakMap;function St(t){let e=(...e)=>(...s)=>{let r=s[0].constructor,n=o(r,_t);if(!d(r,_t)){let t=o(Object.getPrototypeOf(r),_t);n=t?u(t):[],Reflect.defineProperty(r,_t,{configurable:!1,enumerable:!1,value:n})}let i,a={},l=o(t,Et);if(l){let s=Ct.get(t);if(s||(s=new WeakMap,Ct.set(t,s)),a=s.get(r),a||(a={},s.set(r,a)),i=l(...e),a[i])return a[i]}let c=new vt(e,s,t);return a[i]=c,n?.push(c),c};return bt.set(e,!0),e}const yt=new WeakMap;function Nt(t){if(1===arguments.length)return(e,s,r)=>{t.required=t.required||!1,t.attribute=!1!==t.attribute,Tt(e,s,t,r)};let e=arguments[0],s=arguments[1],r=arguments[2];t={type:void 0,required:!1,attribute:!0},r&&"function"==typeof r.type&&(t=h(r,t),r=void 0),Tt(e,s,t,r)}function Tt(t,e,s,r){let n;if(/[a-z]/.test(e[0])||ut(`Prop '${e}' must be in CamelCase`),!d(t.constructor,ct.PROPS)){const e={};let s=t.constructor;for(;(s=ft(s))!==Bt;)p(e,s[ct.PROPS]?f(s[ct.PROPS]):{});Reflect.defineProperty(t.constructor,ct.PROPS,{configurable:!1,enumerable:!1,value:e}),n=new Set,g(e,((t,e)=>{if(t.attribute){let t=m(e);n?.add(t)}})),yt.set(t.constructor,n)}if(r&&(r.get&&(s.getter=r.get),r.set&&(s.setter=r.set)),s.attribute){n||(n=yt.get(t.constructor));let s=m(e);n?.add(s)}d(t.constructor,"observedAttributes")||(t.constructor.observedAttributes=[]),t.constructor.observedAttributes=E(n),s.shallow=s.shallow||!1,t.constructor[ct.PROPS][e]=s}const Pt=new Set;function wt(t){return yt.get(t)??Pt}const At={collectWatch(t,e,s){let r=Rt.get(t);r||(r={},Rt.set(t,r));let n=r[s];n||(n=r[s]=[]),n.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=_(this.__directiveQ);const s=t?t.join(","):"",r=e?e.join(","):"";e&&s===r||(e&&e.length<t.length&&b(s,r)?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},xt=new WeakMap,kt=new WeakMap,Mt=new WeakMap,Ot=new WeakMap,Rt=new WeakMap,Lt=new WeakSet;function Dt(t,e){if(!a(t))return t;const s=Lt.has(t)?t:new Proxy(t,{get(t,e,s){if(!e)return;const r=Reflect.get(t,e,s);if("string"!=typeof e&&"number"!=typeof e)return r;let n=e in t;if((At.__renderCollecting||At.__collecting)&&(n&&t.hasOwnProperty(e)||!n)){let t=kt.get(s)??[],r=u(t,[e]),n=r.join("-");if(At.__renderCollecting)At.collect(pt(r)),At.setDirectiveQ(r);else if(At.__collecting){let t;switch(At.__collectType){case lt.COMPUTED:t=Mt.get(At.__collecting),t||(t={},Mt.set(At.__collecting,t));break;case lt.CSS:t=Ot.get(At.__collecting),t||(t={},Ot.set(At.__collecting,t))}let e=t[n];e||(e=t[n]=[]),e.push(At.__updater)}}return r},set(t,e,s,r){if(!e)return!1;let n=t[e];if(!a(n)&&n===s)return!0;if(Number.isNaN(s)&&Number.isNaN(n))return!0;let i=kt.get(r)??[],l=u(i,[e]),d=xt.get(r).from,h=o(d.constructor,ct.PROPS),p=o(d.constructor,ct.STATES),f=o(h,[l[0],"hasChanged"])||o(p,[l[0],"hasChanged"]);if(f){if(!f.call(d,s,n))return!0}else if(n===s&&!ot.has(n))return!0;h&&h[e]&&t.__isData&&h[e].sync&&d.emit("update:"+e,{value:s});let g=xt.get(r)?.contextSet,m=s;!a(s)||v(s)||s instanceof Node||Object.isFrozen(s)||g.forEach((t=>{let s=xt.get(r)?.pathMap,n=s?.get(t);n&&(l=u(n,[e]),kt.set(m,l),m=Dt(m,t),Lt.add(m),kt.set(m,l))}));let E=Reflect.set(t,e,m),_=xt.get(r).pathMap;return g.forEach((t=>{let s=_.get(t);if(!s)return;t===d&&i.length>1&&s.length>1&&i[0]===s[0]&&(s=i),l=u(s,"length"==e&&C(r)?[]:[e]);let a=Mt.get(t),h=Ot.get(t),p=Rt.get(t);if(a||h||p){let t=l.length;for(;t;){let e=l.slice(0,t).join("-");if(p){const s=p[e];t===l.length?s?.forEach((t=>{let e=t();e.ov=n,Vt.pushWatch(e)})):s?.forEach((t=>{let e=t();o(e,"deep")&&(e.ov=n,Vt.pushWatch(e))}))}if(a){let t=a[e];if(!c(t))for(let e=0;e<t.length;e++){const s=t[e];Vt.pushComputed(s)}}if(h){let t=h[e];if(!c(t))for(let e=0;e<t.length;e++){const s=t[e];Vt.pushCss(s)}}t--}}let f=t._notify(n,l);Vt.pushNext(f)})),E}});Lt.has(s)||Lt.add(s);let r=kt.get(t)??[];if(Object.isExtensible(t)&&!xt.get(s)){let t=new Set;t.add(e);let n=new WeakMap;n.set(e,r),xt.set(s,{from:e,contextSet:t,pathMap:n})}else{xt.get(s).contextSet.add(e);let t=xt.get(s).pathMap,n=t.get(e),i=u(r);if(n&&n.join("")!==i.join("")){let t=o(e,S(n));C(t)||function(...t){console.warn("[CompElem]",...t)}(`The object is referenced by more than one @state '${i.join(".")},${n.join(".")}'`),n=i}else t.set(e,i)}let n=o(e.constructor,ct.PROPS),i=o(e.constructor,ct.STATES);for(let s in t){const l=t[s];let c=o(n,[s,"shallow"])||o(i,[s,"shallow"]);!a(l)||Lt.has(l)||v(l)||l instanceof Node||Object.isFrozen(l)||c||(kt.set(l,u(r,[s])),t[s]=Dt(l,e),Lt.add(t[s]),kt.set(t[s],u(r,[s])))}return s}class Vt{static watchSet=new Set;static computedSet=new Set;static cssSet=new Set;static nextSet=new Set;static nextPending=!1;static next;static{const t=Promise.resolve(),e=Vt.flush;Vt.next=()=>{t.then(e)}}static flush(){Vt.nextPending=!1;let t=Array.from(Vt.watchSet);Vt.watchSet.clear();let e=Array.from(Vt.computedSet);Vt.computedSet.clear();let s=Array.from(Vt.cssSet);Vt.cssSet.clear();let r=Array.from(Vt.nextSet);Vt.nextSet.clear(),t.forEach((t=>t(o(t,"ov")))),e.forEach((t=>t())),s.forEach((t=>t())),r.forEach((t=>t()))}static pushWatch(t){Vt.watchSet.add(t)}static pushComputed(t){Vt.computedSet.add(t)}static pushCss(t){Vt.cssSet.add(t)}static pushNext(t){Vt.nextSet.add(t),Vt.nextPending||(Vt.nextPending=!0,Vt.next())}}function Ht(t){return class extends t{__updatePoints;renderComponent;buildView(t){let e=this instanceof Bt?this:this.renderComponent,[s,r]=Me(e,t),n=[],i=$e(n,s,r,e,this);return this.__updatePoints=n,i}updateView(t){if(i(y(t.strings)))return;if(!this.__updatePoints)return;let{vars:e}=t,s=this instanceof Bt?this:this.renderComponent;for(let t=0;t<this.__updatePoints.length;t++){const r=this.__updatePoints[t];let n=r.varIndex;if(n<0)continue;let i=r.value,l=e,c=r.node,d=N(n,"-");for(let e=0;e<d.length;e++){const s=d[e];l=o(l,s),l&&l.vars&&t<d.length-1&&(l=l.vars)}if(!a(i)&&i===l)continue;let u=c;if(r.isDirective){if(!i.di)continue;l.di=i.di,l.di.renderParams=l.varChain,l.di._renderArgs=l.args,l.point=i.point,l.varPath=i.varPath,i.update(i.point,l.args,i.args)}else if(r.isToggleProp){if(!!l===i)continue;u.toggleAttribute(r.attrName,!!l),T(u,r.attrName,!!l)}else if(r.isProp){if(!a(l)&&l===i)continue;c instanceof Bt?c._updateProps({[r.attrName]:l}):c instanceof HTMLSlotElement&&s._updateSlot(c.getAttribute("name")||"default",r.attrName,l)}else if(r.attrName&&!r.isEvent){if(!P(i,l))switch(r.attrName){case"value":if(c instanceof HTMLInputElement){c.value=l;break}default:c.setAttribute(r.attrName,w(r.attrTmpl,Ie,l+""))}}else if(r.isTmpl)(l.strings.join()!==i.tmpl.strings.join()||l.vars.some((t=>a(t)&&!A(t)))||i.tmpl.vars.some((t=>a(t)&&!A(t)))||!P(l.vars,i.tmpl.vars))&&r.value.updateView(l),i.tmpl=l,l=i;else if(r.isText){let t=r.textNode.nextSibling;t&&t===r.node.previousSibling?t.textContent=l:(We.remove(r.textNode,r.node),We.insertBefore(r.node,[l]))}r.value=l}}}}class It extends(Ht(Object)){tmpl;constructor(t){super(),this._renderVars=o(t,"_renderVars"),this.tmpl=t}}const $t={boolean:Boolean,string:String,number:Number,object:Object,array:Array,function:Function,bigint:BigInt,symbol:Symbol,undefined:Object},Wt=new WeakMap;let jt=[];class Bt extends(Ht(HTMLElement)){static __l_globalRule=document.createElement("style");static{document.head.appendChild(Bt.__l_globalRule)}static defaults(t){jt=x(t.css,(t=>{if(s(t)){let e=new CSSStyleSheet;return e.replaceSync(t),e}return t instanceof CSSStyleSheet?t:[]})),t.global,g(t,((t,e)=>{k(e[0],/[A-Z]/)}))}#t={};#e={"#slots":{}};#s={};#r={};#n;#i={};__events={};get[Symbol.toStringTag](){return this.constructor.name}get reactiveData(){return this.#s}get attrs(){return this.#o}get props(){return this.#a}get renderRoot(){return this.#l}get renderRoots(){return this.#c}get parentComponent(){return this.#d}get slotHooks(){return this.#u}get css(){return Wt.get(this.constructor)}get isMounted(){return this.#h}get slots(){return this.#e["#slots"]}#o;#a;#l;#c;#d;#p={};#u={};#f={};#h=!1;static get autoSlot(){return!0}static get styles(){return[]}static get globalStyles(){return[]}get styles(){return[]}#g=!1;#m=!1;constructor(...t){super(),1===M(t)&&(this.#a={},O(this.#a,R(t)));let e=this.render.bind(this);this.render=function(){let t;return At.startRender(this),t=e(),At.endRender(this),t};let r=o(this.constructor,"globalStyles"),n=o(this.constructor,"_global_style_attached");if(!c(r)&&"1"!==n){let t="";r.forEach((e=>{s(e)&&(t+=e+"\n")})),Bt.__l_globalRule.textContent+=t,T(this.constructor,"_global_style_attached","1")}let i=Wt.get(this.constructor),a=i??[];i||(g(o(this.constructor,"styles"),(t=>{if(s(t)){let e=new CSSStyleSheet;e.replaceSync(t),a.push(e)}else a.push(t)})),Wt.set(this.constructor,a)),this.#n=this.attachShadow({mode:"open",slotAssignment:o(this.constructor,"autoSlot",!0)?"named":"manual"}),this.#n.adoptedStyleSheets=[...jt,...a],this._slotsPropMap={default:[]};let l=o(this.constructor,_t);l&&l.sort(((t,e)=>e.priority-t.priority)).forEach((t=>t.create(this))),this.#E=this.#_.bind(this)}#E;connectedCallback(){let t=L(this.parentNode,(t=>t instanceof Bt||t.host instanceof Bt),"parentNode");this.#d=t?t instanceof Bt?t:t.host:null,this.__init()}disconnectedCallback(){}__init(){if(this.#g)return;if(this.#m)return;this.#m=!0,this.#b();const t=this.#v();this.propsReady(t);for(const e in t){const s=t[e];this.#e[e]=s}this.#C(),g(this.#e,((t,e)=>{let s=Reflect.getOwnPropertyDescriptor(this.#e,e);Reflect.defineProperty(this,e,{get(){let t=Reflect.get(this.#s,e);return s?.get?s?.get():t},set(t){s?.set?s?.set(t):Reflect.set(this.#s,e,t)}})})),Reflect.defineProperty(this.#e,"__isData",{enumerable:!1,value:!0}),this.#s=Dt(this.#e,this);let e=o(this.constructor,ct.COMPUTED);g(e,((t,e)=>{At.startCollect(this,lt.COMPUTED),At.setUpdater((()=>{this.#s[e]=t.call(this)})),this.#e[e]=t.call(this),At.endCollect(),Reflect.defineProperty(this,e,{get(){return Reflect.get(this.#s,e)},set(t){ht(this.tagName,"Cannot set a computed property '"+e+"'")}})}));let s=o(this.constructor,ct.WATCH);g(s,((t,e)=>{t.forEach((t=>{let{source:s,options:r,handler:n}=t,i=n.bind(this);o(r,"once",!1)&&(i=D(i));const a=function(t){let e=o(this,s.replaceAll("-","."));i(e,t,s)}.bind(this);let l=o(r,"deep",!1);if(a.deep=l,At.collectWatch(this,(()=>a),e),!o(r,"immediate",!1))return;let c=o(this,s.replaceAll("-","."));i(c,c,s)}))}));let r=this.render(),n=this.buildView(r);if(n){let t=E(n);t.forEach((t=>{this.#n.appendChild(t)})),this.#c=V(t,(t=>t.nodeType===Node.ELEMENT_NODE)),this.#l=this.#c[0]}g(this.#u,((t,e)=>{this.#S(e)}));const a=this;let l=o(this.constructor,_t);l&&l.sort(((t,e)=>e.priority-t.priority)).forEach((t=>{t.beforeMount(this,((t,e)=>(a.#s[t]=e,a.#s[t])))})),this.beforeMount();let c=o(this.constructor,ct.EVENTS);c&&c.forEach((async t=>{let e=t.name,s=O({target:document,once:!1,passive:!1,capture:!1},t.options),r=H(t.fn,this),n=s.target;v(n)&&(n=await n.call(this,this)),n?n.addEventListener(e,r,s):ht(this.tagName,"The target of @event('"+e+"',...) is invalid")})),At.startCollect(this,lt.CSS);let d=[];this.styles.forEach((t=>{if(!v(t))return;let e=new CSSStyleSheet;d.push(e),At.setUpdater((()=>{let s=t()??"";e.replaceSync(s)}));let s=t();i(s)||e.replaceSync(s)})),At.endCollect(),this.#n.adoptedStyleSheets=[...this.#n.adoptedStyleSheets,...d],setTimeout((()=>{this.#h=!0,this.mounted(),l&&l.forEach((t=>{t.mounted(this,((t,e)=>(a.#s[t]=e,a.#s[t])))}))}),0),this.#g=!0}propsReady(t){}render(){throw Error(`[CompElem <${this.tagName}>] Missing render()`)}beforeMount(){}mounted(){}#y(t,e){this.#b();let s=o(this.#t[e],"props");s&&g(this.slots,((t,e)=>{t.filter((t=>t.nodeType===Node.ELEMENT_NODE)).forEach((t=>{t instanceof Bt?t._updateProps(s):g(s,((e,s)=>{if(t instanceof HTMLSlotElement){let r=o(t,"__l_comp");if(r){let n=t.name||"default",i=r.#t[n];i||(i=r.#t[n]={props:{}}),i.props||(i.props={}),i.props[s]=e,r.#y(t,n)}}else t.setAttribute(s,e)}))}))})),this.slotChange(t,e)}slotChange(t,e){}attributeChangedCallback(t,e,s){this.#N(t,e,s)}shouldUpdate(t){return!0}updated(t){}#T={};_notify(t,e){let s=[];for(let r=0;r<e.length;r++){const n=e[r];s.push(n);let i=o(this,s),l=pt(s);this.#r[l]={value:i,chain:"slots"===l?["slots"]:s,oldValue:t,end:s.length===e.length},a(i)&&"#"!=l[0]&&ot.set(i,l)}return this.#E}#_(){if(M(this.#r)<1)return;const t=this.#r;this.#r={};let e=o(this.constructor,_t);if(e&&e.sort(((t,e)=>e.priority-t.priority)).forEach((e=>{e.updated(this,t)})),!this.shouldUpdate(t))return;let s=new Set;g(t,(({value:t,chain:e,oldValue:r},n)=>{this.#i[n]&&this.#i[n].forEach((t=>{s.add(t)}))})),s.forEach((t=>{if(t===this)this.updateView(this.render());else{let e=t.render(...t._renderArgs?t._renderArgs:[]);e&&t.updateView(e)}})),this.#P.forEach((t=>{this.#S(t)})),this.updated(t),g(t,(({value:t,chain:e,oldValue:s},r)=>{a(t)&&ot.has(t)&&ot.delete(t)}))}#v(){let t=o(this.constructor,ct.PROPS),s=this.attributes,r=this.tagName,i=this.#a,c={};g(s,(({name:e,value:s})=>{if(e[0]===Se||e[0]===ye||e[0]===Ne||e===we||"slot"===e)return;let r=I(e);t&&!t[r]&&(c[e]=s)})),this.#o=this.#o?O(this.#o,c):c;let u={};return g(t,((c,h)=>{let p,f=t[h],g=d(i,h),E=o(this,h);if(!("_defaultValue"in f)&&(f._defaultValue=E,!f.type)){n(E)&&ht(r,"Prop '"+h+"' has neither propType nor defaultValue be used for type inference");let t=typeof E;C(E)&&(t="array");let e=$t[t];f.type=e}if(g)p=$(i[h])?E:i[h];else{p=E;let t=s.getNamedItem(m(h))||s.getNamedItem(ye+m(h));t&&(g=!0,p=t.value)}if(f.required&&!g)return ht(r,"Prop '"+h+"' is required"),!1;p=this.#w(t,h,p);let _=o(t,[h,"getter"]);_&&(_=H(_,this));let b=o(t,[h,"setter"]);if(b&&(b=H(b,this)),(_||b)&&Reflect.defineProperty(this.#e,h,{set:b||function(t){},get:_}),f.attribute&&l(p)&&!a(p)){let t=m(h),s=W(p);(v=f.type)===Boolean||e(v,(t=>t===Boolean))?(s=gt(p),j(s)?this.toggleAttribute(t,s):this.setAttribute(t,s)):this.setAttribute(t,s)}var v;this.#e[h]=p,u[h]=p})),Object.seal(u)}#w(t,n,i){let o=t[n];if(!o)return i;let a=o.isValid,c=o.type,d=C(c)?c:[c],u=o.converter,h=i;if(!e(d,(t=>t===String))&&s(h)&&!B(h))try{h=u?u(h):r(h,{html:je})}catch(t){ht(this.tagName,`Convert attribute '${n}' error with `+h)}for(let t=0;t<d.length;t++){"Boolean"===d[t].name&&(h=gt(h))}let p=typeof h,f=!l(h);for(let t=0;t<d.length;t++){const e=d[t];if(k(p,e.name,"i")||h instanceof e||Object.prototype.toString.call(h)===Object.prototype.toString.call(e.prototype)){f=!0;break}}return f||ht(this.tagName,`Invalid prop '${n}'. expected '${d.map((t=>t.name||t))}' but got '${p}'`),a&&(a.call(this,h,this.#e)||ht(this.tagName,`Invalid prop '${n}'. IsValid() check failed`)),h}#C(){let t=o(this.constructor,ct.STATES);g(t,((e,s)=>{let r=t[s],n=o(this,s);if(r){let t=r.prop;n=t?f(this.#e[t]):o(this,s)}this.#e[s]=n}))}#A=U(this.propsReady,100);_setParentProps(t,e){if(this.#g){let s=o(this.constructor,ct.PROPS);g(t,((t,e)=>{let r=I(e),n=s[r];if(!n)return;let i=this.#e[r];t=this.#w(s,r,t),n.hasChanged&&!n.hasChanged.call(this,t,i)||(this.#e[r]=t,this._notify(i,[r]))})),O(this.#a,t),O(this.#o,e),this.#A(this.#a)}}_updateProps(t){let e=o(this.constructor,ct.PROPS);g(t,((t,s)=>{let r=I(s);e[r]&&(t=this.#w(e,r,t),At.__skipCheck=!0,T(this,r,t),At.__skipCheck=!1)})),O(this.#a,t),this.#A(this.#a)}_initProps(t,e){this.#a=p(this.#a||{},t),this.#o=p({},e)}_bindSlot(t,e,s){if(this.#p[e]||(this.#p[e]=t,Reflect.defineProperty(t,"__l_comp",{value:this})),t.addEventListener("slotchange",(s=>{this.#g&&this.#y(t,"default"===e?"":e)})),!c(s)){let t=this.#t[e];t||(t=this.#t[e]={}),t.props=s}}_bindSlotHook(t,e){this.#u[t]=e}#P=new Set;_updateSlot(t,e,s){let r=this.#p[t],n=this.#u[t];if(!n&&!r)return;let i=this.#t[t];if(e&&(i.props||(i.props={}),i.props[e]=s),n)this.#P.add(t);else{let t=r.assignedElements({flatten:!0});for(let r=0;r<t.length;r++){t[r].setAttribute(e,s+"")}}}#b(){const t=x(this.childNodes,(t=>t.nodeType===Node.COMMENT_NODE?[]:t instanceof HTMLSlotElement?t.assignedNodes({flatten:!0}):t));let e=z(t,(t=>t.nodeType===Node.TEXT_NODE?"default":t instanceof Element?t.getAttribute("slot")||"default":void 0));if(c(e))return void(c(this.#e["#slots"])||(this.#g?this.#s["#slots"]={}:this.#e["#slots"]={}));g(e,((t,e)=>{if(e){for(;t.length>0;){let e=t[0];if(!(e.nodeType===Node.TEXT_NODE&&i(e.textContent)||e instanceof HTMLSlotElement&&c(e.assignedNodes({flatten:!0}))))break;t.shift()}for(;t.length>0;){let e=_(t);if(!(e.nodeType===Node.TEXT_NODE&&i(e.textContent)||e instanceof HTMLSlotElement&&c(e.assignedNodes({flatten:!0}))))break;t.pop()}}}));let s={};g(e,((t,e)=>{c(t)||(s[e]=t)})),this.#g?this.#s["#slots"]=s:this.#e["#slots"]=s}#S(t){let e=this.#u[t];if(!e)return;let s=this.#t[t];if(!this.#e["#slots"][t])return;this.renderAsync(e,o(s,"props"));const r=this._asyncDirectives.get(e);let n=r?.buildView(e(o(s,"props"))),i=F(E(n),(t=>t.nodeType===Node.COMMENT_NODE));if(i){let e=this.#f[t];if(!c(e))for(let t=0;t<e.length;t++){const s=e[t];s.parentNode?.removeChild(s)}this.#f[t]=i,this.append(...i),this.#P.clear()}}_asyncDirectives=new WeakMap;renderAsync(t,...e){}#N(t,e,s){if(!this.isMounted)return;if(wt(this.constructor).has(t)){let e=I(t);if(B(s)){s=o(this.constructor,ct.PROPS)[e]._defaultValue}this._updateProps({[e]:s})}}_regDeps(t,e){let s=this.#i[t];s||(s=this.#i[t]=new Set),s.add(e);let r=t.split("-");if(r.pop(),r.length<1)return;let n=r.join("-");s=this.#i[n],s||(s=this.#i[n]=new Set),s.add(e)}emit(t,e={},s){s&&s.event&&(e.event=s.event),e.target=this,this.dispatchEvent(new CustomEvent(t,{bubbles:o(s,"bubbles",!1),composed:o(s,"composed",!1),cancelable:!0,detail:e}))}on(t,e){this.#T[t]||(this.#T[t]=[]);let s=e.bind(this);this.#T[t].push(s),this.addEventListener(t,s)}nextTick(t){Vt.pushNext(t)}forceUpdate(){g(this.#s,((t,e)=>{this.#r[e]={value:void 0,chain:void 0}})),this.#_()}}var Ut,zt,Ft;!function(t){t.NONE="NONE",t.REMOVE="REMOVE",t.REPLACE="REPLACE",t.UPDATE="UPDATE",t.APPEND="APPEND"}(Ut||(Ut={}));class Kt{key;varIndex;value;isText=!1;isTmpl=!1;isDirective=!1;node;textNode;isComponent=!1;attrName;attrTmpl;isProp=!1;isToggleProp=!1;isEvent;constructor(t,e,s,r){this.varIndex=t,this.node=e,s&&(this.attrName=s),r&&(this.attrTmpl=r)}}!function(t){t.ATTR="attr",t.PROP="prop",t.TEXT="text",t.CLASS="class",t.STYLE="style",t.SLOT="slot",t.TAG="tag"}(zt||(zt={}));class Qt{startNode;endNode;type;attrName;varIndex;expressionChain;nodes;constructor(t,e,s){this.startNode=t,this.attrName=e,this.type=s}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"}(Ft||(Ft={}));class Xt extends Function{diClass;args;di;varPath;point;slotComponent;varChain;constructor(t,...e){super(),this.diClass=t,this.args=e,this.varChain=At.popDirectiveQ(),this.di=new this.diClass,this.di.renderParams=this.varChain}checkScope(t){let e=o(this.diClass,"scopes");c(e)||k(e.join(","),t)||ut(`Directive '${this.diClass.name}' is out of scopes, expect '${e.join(",")}' bug got '${t}'`)}render(t){let e=this.di;return e.renderComponent||(e.renderComponent=t),this.di=e,e._renderArgs=this.args,this.di.render(...this.args)}update(t,e,s){let r=this.di.update(t,e,s);if(r===Ut.NONE)return;let n=t.getNodes();if(r===Ut.REMOVE)for(let t=0;t<n.length;t++){const e=n[t];e.parentNode?.removeChild(e)}else if(r===Ut.REPLACE){let s=[];for(let t=0;t<n.length;t++){const e=n[t];e.parentNode?.removeChild(e)}let r=this.di.render(...e),i=this.di.buildView(r);s=E(i);let o=document.createDocumentFragment();o.append(...s),t.endNode.parentNode.insertBefore(o,t.endNode)}else if(r===Ut.UPDATE){let s,r={},i=[],o=[],a=this.di.render(...e);if(a||(a=new ze([],[])),c(n)){let e=this.di.buildView(a);return void t.startNode.after(...e)}let l={};a instanceof ze&&a.vars.forEach((t=>{if(t instanceof ze){const e=t.getKey();l[e]=t,r[e]=!0,o.push(e)}})),n=V(K(n),(t=>t.nodeType===Node.ELEMENT_NODE)),s=V(K(E(s)),(t=>t.nodeType===Node.ELEMENT_NODE));let d={},u="",h={};for(let t=0;t<n.length;t++){let e=n[t],s=e.getAttribute("key");if(s){if(d[s]){u=s;break}d[s]=e,i.push(s),h[s]=!0}}if(u)return void ut(`${I(this.diClass.name)} - duplicate key '${u}'`);let p=r;const f=t.startNode.parentNode;let m=[],b=[];if(g(h,((t,e)=>{p[e]||(b.push(e),delete h[e],Q(i,(t=>t===e)))})),!c(o)){let e="",s=-1,r=[],n=new Map;for(let a=0;a<o.length;a++){const l=o[a];let c=i.findIndex((t=>t===l));if(c>-1&&c!==a){if(s<0||s-c==1){let t=_(r);r.push({nodeId:l,targetId:0===a?Ft.AFTER_BEGIN:t?t.nodeId:o[a-1]})}else n.set(r.length,{group:r,targetId:""}),r=[],r.push({nodeId:l,targetId:i[c]});s=c}else if(c<0){let s=e?d[e]||t.endNode:t.startNode;m.push({prevNode:s,newkey:l})}e=l}c(n)&&r.length>0&&n.set(r.length,{group:r,targetId:""});let a=n.keys().toArray(),l=a.sort(((t,e)=>t-e));if(a.length>0&&a.length<2){let{group:e}=n.get(l[0]);S(e).forEach((({targetId:e,nodeId:s})=>{let r,n=d[s];e===Ft.AFTER_BEGIN?(r=t.startNode,r.after(n)):(r=d[e],r.after(n))}))}}m.length>0&&this.#x(m,l,o),m.forEach((e=>{let s=e.newkey,r=this.newNodeMap[s],n=e.prevNode;n===t.endNode?n.before(r):(t.startNode,n.after(r))})),b.forEach((t=>{let e=d[t];e&&e.parentNode&&f.removeChild(e)})),this.di.__updatePoints.forEach((t=>{t.key||(t.key=t.value.tmpl.getKey());const e=o.findIndex((e=>e==t.key));t.varIndex=e})),this.di.updateView(a)}}getDirective(){return this.di}newNodeMap={};#x(t,e,s){const r=[],n=[];t.forEach((t=>{let s=t.newkey;r.push(""),n.push(e[s])})),r.push("");let i=new ze(r,n),o=this.di.__updatePoints,a=this.di.buildView(i);this.di.__updatePoints.forEach(((t,e)=>{const s=t.value.tmpl.getKey();t.key=s})),this.di.__updatePoints.push(...o),a.forEach((t=>{t instanceof HTMLElement&&(this.newNodeMap[t.getAttribute("key")]=t)}))}}function Gt(t){return(...e)=>{let s=null;return e.forEach(((t,r)=>{if(v(t)){let n=t;e[r]=function(...t){let e=s.di;At.startRender(e);let r=n.call(e.renderComponent,...t);return At.endRender(e.renderComponent),r}}})),s=new Xt(t,...e),s}}const qt=["resize","outside","mutate"],Yt=new WeakMap,Zt=[],Jt=[],te=[],ee=new ResizeObserver((t=>{for(const e of t){const t=Array.isArray(e.contentBoxSize)?e.contentBoxSize[0]:e.contentBoxSize,s=Array.isArray(e.borderBoxSize)?e.borderBoxSize[0]:e.borderBoxSize;let r=Yt.get(e.target);if(r){r(new CustomEvent("resize",{bubbles:!1,cancelable:!1,detail:{borderBox:{w:s.inlineSize,h:s.blockSize},contentBox:{w:t.inlineSize,h:t.blockSize}}}),e.target)}}}));var se;!function(t){t.Child="child",t.Tree="tree",t.Attr="attr",t.Char="char"}(se||(se={}));const re=new WeakMap,ne=new MutationObserver((t=>{for(let e=0;e<t.length;e++){const s=t[e];let r=re.get(s.target);if(!r)return;let n={target:s.target},i=null;switch(s.type){case"subtree":n.type=se.Tree,i=r[se.Tree];break;case"childList":n.type=se.Child,n.addedNodes=s.addedNodes,n.removedNodes=s.removedNodes,i=r[se.Child];break;case"attributes":n.type=se.Attr,n.attributeName=s.attributeName,n.oldValue=s.oldValue,i=r[se.Attr];break;case"characterData":n.type=se.Char,n.oldValue=s.oldValue,i=r[se.Char]}if(i){i(new CustomEvent("mutate",{bubbles:!1,cancelable:!1,detail:n}))}}}));function ie(t,e,s,r){if("resize"===t)!function(t,e){Yt.has(t)||(Yt.set(t,e),ee.observe(t))}(e,s);else if("outside"===t)switch(r[0]){case"mousedown":!function(t,e){Zt.push([t,e])}(e,s);break;case"dblclick":!function(t,e){te.push([t,e])}(e,s);break;default:!function(t,e){Jt.push([t,e])}(e,s)}else"mutate"===t&&function(t,e,s){let r=X(s,"child"),n=X(s,"attr"),i=X(s,"char"),o=X(s,"tree"),a=re.get(t);a||(a={},re.set(t,a),r&&(a[se.Child]=e),n&&(a[se.Attr]=e),i&&(a[se.Char]=e),o&&(a[se.Tree]=e),ne.observe(t,{childList:r,attributes:n,characterData:i,subtree:o}))}(e,s,r)}document.addEventListener("mousedown",(t=>{let e=o(t.composedPath(),0,t.target);Zt.forEach((([s,r])=>{if(!s.contains(e)&&!s.contains(L(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){r(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:s,event:t}}),s)}}))}),!1),document.addEventListener("click",(t=>{let e=o(t.composedPath(),0,t.target);Jt.forEach((([s,r])=>{if(!s.contains(e)&&!s.contains(L(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){r(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:s,event:t}}),s)}}))}),!1),document.addEventListener("dblclick",(t=>{let e=o(t.composedPath(),0,t.target);te.forEach((([s,r])=>{if(!s.contains(e)&&!s.contains(L(e,(t=>t instanceof ShadowRoot),"parentNode")?.host)){r(new CustomEvent("outside",{bubbles:!1,cancelable:!1,detail:{currentTarget:s,event:t}}),s)}}))}),!1);const oe=/,|^(debounce:.+)|(debounce$)/,ae=/,|^(throttle:.+)|(throttle$)/,le="self",ce="stop",de="prevent",ue="once",he="left",pe="right",fe="middle",ge="ctrl",me="alt",Ee="shift",_e="meta",be={esc:"escape"},ve=":";function Ce(t,e,s,r){let n,i=t.split("."),o=i.shift(),a=i.includes(ue),l=e;if(n=G(i,(t=>oe.test(t)))){let t=n.split(ve);l=U(l,parseInt(t[1])||100)}if(n=G(i,(t=>ae.test(t)))){let t=n.split(ve);l=q(l,parseInt(t[1])||100)}if(a&&(l=D(l)),function(t){return qt.includes(t)}(o))return ie(o,s,l,i),l;let c=t=>{if(i.includes(de)&&t.preventDefault(),i.includes(ce)&&t.stopPropagation(),!i.includes(le)||t.target===t.currentTarget){if(t instanceof MouseEvent){if(i.includes(he)&&0!=t.button)return;if(i.includes(pe)&&2!=t.button)return;if(i.includes(fe)&&1!=t.button)return}else if(t instanceof KeyboardEvent){if(Q(i,(t=>t==ge))[0]&&!t.ctrlKey)return;if(Q(i,(t=>t==me))[0]&&!t.altKey)return;if(Q(i,(t=>t==Ee))[0]&&!t.shiftKey)return;if(Q(i,(t=>t==_e))[0]&&!t.metaKey)return;if(!Y(i,(t=>be[t]||t)).includes(t.key.toLowerCase()))return}l(t)}};s.addEventListener(o,c);let d=r.__events[o];return d||(d=r.__events[o]=[]),d.push([s,c]),c}const Se="@",ye=".",Ne="?",Te="*",Pe=":",we="ref",Ae=/[.?-a-z]+\s*=\s*(['"])\s*([^='"]*<\!--c_ui-pl_df-->){2,}.*?\1/ims,xe=/<\s*[a-z0-9-]+([^>]*<\!--c_ui-pl_df-->)*[^>]*?(?<!-)>/gims,ke="slot-props";function Me(t,e){let s="",r=u(e.vars),n=e.strings.length-1,i=e.vars.length-1;for(let r=0;r<=n;r++){const n=e.strings[r];let a=o(e.vars,r,"");if(a&&a.di){let e=a.render(t);if(e instanceof ze){let[s,r]=Me(t,e);Reflect.defineProperty(a,"_renderVars",{value:r}),a=Oe+s+Re}else a=e??Ve}else if(a instanceof ze){let[e,s]=Me(t,a);Reflect.defineProperty(a,"_renderVars",{value:s}),a=Le+e+De}else a=r>i?"":Ve;s+=n+a}let a=s.match(Ae);if(a){return ut(`Parse error: attribute value can be set only one interpolation —— \n ${Z(a[0],Ve,"${...}")}`),["",r]}let l=0;return s=s.replace(xe,((t,e)=>Z(t,Ve,(()=>Ve.replace("--\x3e","")+l++)))),s=s.replace(Be,"$1><").trim(),[s,r]}const Oe="\x3c!--c_ui-pl_di-start--\x3e",Re="\x3c!--c_ui-pl_di-end--\x3e",Le="\x3c!--c_ui-pl_tmpl-start--\x3e",De="\x3c!--c_ui-pl_tmpl-end--\x3e",Ve="\x3c!--c_ui-pl_df--\x3e",He="\x3c!--c_ui-pl_df",Ie=/<!--c_ui-pl_df\d*(-->)?/;function $e(t,e,s,r,i){const a=document.createElement("div");a.innerHTML=e;const l=document.createNodeIterator(a,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT);let c,u,h=0,p=null,f=[],g=[],C=[],S=[t],y=[],N=[];for(;c=l.nextNode();)if(c instanceof HTMLElement||c instanceof SVGElement){c instanceof Bt?p=c:p?.contains(c)||(p=null);let e={},n=E(c.attributes);for(let i=0;i<n.length;i++){const o=n[i];let{name:a,value:l}=o;if(a===ke){let t=c.getAttribute("name")||"default";if(p){let e=p._slotsPropMap[t];e||(e=p._slotsPropMap[t]=[]),e.push(c)}}if(b(a,He)){let e=s[h];if(e instanceof Xt){e.checkScope(zt.TAG);let s=new Qt(c,a.substring(1),zt.TAG);e.point=s,e.di.slotComponent=p,e.di.renderComponent=r;let n=new Kt(h,c);n.isDirective=!0,n.value=e,n.isComponent=!!p,t.push(n),h++,e.di.created(s,...e.args)}c.removeAttribute(a)}else if(a[0]!==Se)if(a!==we)if(a[0]!==ye||Ie.test(l)){if(Ie.test(l)){let n=s[h],i=new Kt(h,c,a.replace(/\.|\?|@/,""),l);if(i.isComponent=!!p,a[0]===ye||a[0]===Ne||a[0]===Te){if(n instanceof Xt){n.checkScope(zt.PROP);let t=new Qt(c,a.substring(1),zt.PROP);n.point=t,n.slotComponent=p,i.value=n,i.isDirective=!0,n&&n.di.created(n.point,...n.args)}else if(a[0]===Ne)i.isToggleProp=!0,i.value=!!n,i.value&&c.setAttribute(a.substring(1),"");else if(a[0]===Te){i.value=n;let t=a.substring(1);const[e,s]=t.split(Pe);let r=e;switch(s){case"camel":r=I(r);break;case"kebab":r=m(r);break;case"snake":r=J(r)}i.attrName=r,c.setAttribute(r,n)}else if(c instanceof Bt||"SLOT"===c.tagName){let t=I(a.substring(1));t in c||"SLOT"===c.tagName||ht(c.tagName,`Prop '${a}' is not defined in ${c.tagName}`),i.value=n,i.isProp=!0,e[t]=n}else ht(c.tagName,`Prop '${a}' can only be set on a CompElem or a slot`);c.removeAttribute(a),n=""}else{let t;if(i.value=n,n instanceof Xt){let e=zt.ATTR;"class"===a?e=zt.CLASS:"style"===a&&(e=zt.STYLE),n.checkScope(e),i.isDirective=!0;let s=new Qt(c,a,e);n.point=s,n.di.slotComponent=p,n.di.renderComponent=r,t=n,n=""}l=w(l,Ie,n),o.value=l,t&&t.di.created(t.point,...t.args)}t.push(i),h++}}else ht(c.tagName,`Prop '${a}' must be an interpolation`);else{if(Ie.test(l)){let t=s[h];if(!d(t,"current")){ht(c.tagName,"Ref must be a RefObject");continue}h++,t.current=c}c.removeAttribute(a)}else{let e=t=>{};if(Ie.test(l)){let n=s[h];if(!v(n)){ht(c.tagName,`Event '${a}' must be a function`);continue}e=n.bind(r);let i=new Kt(h,c,a.replace(/\.|\?|@/,""),l);i.isComponent=!!p,i.isEvent=!0,t.push(i),h++}Ce(a.substring(1),e,c,r),c.removeAttribute(a)}}c instanceof Bt?c._initProps(e):c instanceof HTMLSlotElement&&r._bindSlot(c,c.name||"default",e)}else{let e=c,a=`\x3c!--${e.nodeValue}--\x3e`;if(a===Oe){u&&f.push(u),u=e;let n=s[h],i=new Kt(h,c);i.isComponent=!!p,i.isDirective=!0,i.value=n;let o=p?zt.SLOT:zt.TEXT,a=new Qt(u,"",o);n.point=a,n.di.slotComponent=p,n.di.renderComponent=r,g.push(n),t.push(i),C.push(i),t=[],S.push(t),h++,N.push(h),y.push(s),s=n._renderVars,h=0;continue}if(a===Re){C.pop().textNode=e;let r=g.pop();r.point.endNode=e,r.di.created(r.point,...r.args),u=f.pop(),r.di.__updatePoints=t,S.pop(),t=_(S),s=y.pop(),h=N.pop()}else{if(a===Le){u&&f.push(u),u=e;let n=s[h],a=new Kt(h,c);a.isComponent=!!p,a.isTmpl=!0;let l=_(g);(l&&"ForEach"===o(l,"diClass.name")||"ForEach"==i.constructor.name)&&(a.key=n.getKey()),n=a.value=new It(n);let d=p?zt.SLOT:zt.TEXT,m=new Qt(u,"",d);n.point=m,n.slotComponent=p,n.renderComponent=r,g.push(n),t.push(a),C.push(a),t=[],S.push(t),h++,N.push(h),y.push(s),s=n._renderVars,h=0;continue}if(a===De){C.pop().textNode=e;let r=g.pop();r.point.endNode=e,u=f.pop(),r.__updatePoints=t,S.pop(),t=_(S),s=y.pop(),h=N.pop()}}if(a!==Ve)continue;let l=new Kt(h,c);t.push(l),l.isComponent=!!p,l.isText=!0;let d,m=s[h];if(d=document.createComment(`compelem-ui-${h}-child-start`),e.parentNode.insertBefore(d,e),e.nodeValue=`compelem-ui-${h}-child-end`,l.textNode=d,m instanceof Xt){l.isDirective=!0,l.value=m;let t=p?zt.SLOT:zt.TEXT,s=new Qt(d,"",t);s.endNode=e,m.point=s,m.di.slotComponent=p,m.di.renderComponent=r,m.di.created(s,...m.args),m=""}else if(m instanceof ze){l.isTmpl=!0,l.value=m;let[e,s]=Me(r,m);m=$e(t,e,s,r,i)}else l.value=m;if(h++,n(m))continue;if(m instanceof NodeList){let t=document.createDocumentFragment();t.append(...m),e.parentNode.insertBefore(t,e)}else if(m instanceof Element)e.parentNode.insertBefore(m,e);else if(W(m)){let t=document.createTextNode(m);e.parentNode.insertBefore(t,e)}}return a.childNodes}const We={insertBefore:function(t,e){if(!t.parentNode)return;let s=document.createDocumentFragment();s.append(...e),t.parentNode.insertBefore(s,t)},remove:function(t,e){if(t===e)return void t?.parentNode?.removeChild(t);let s=t.nextSibling;for(;s&&s!==e;)s?.parentNode?.removeChild(s),s=t.nextSibling}};function je(t,...e){return new ze(s(t)?[t]:t,e)}const Be=/([a-z0-9"'])\s*>\s*</gim;function Ue(t){return{current:t}}class ze{strings;vars;constructor(t,e){this.strings=u(t),this.vars=e}getKey(){let t=this.vars,e="";return g(this.strings,((s,r)=>{if(at.test(s))return e=tt(t[r]),!1})),e}getKeys(){let t=this.vars,e=[];for(let s=0;s<this.strings.length;s++){const r=this.strings[s];if(at.test(r)){let r=tt(t[s]);e.push(r)}}return c(e)&&t.forEach((t=>{if(t instanceof ze){let s=t.getKey();e.push(s)}})),e}append(t){let e=_(this.strings);return t.strings.forEach(((t,s)=>{0!=s?this.strings.push(t):this.strings[this.strings.length-1]=e+t})),this.vars=u(this.vars,t.vars),this}insert(t,e){let s=e.strings.shift();return this.strings[t]+=s,this.strings.splice(t+1,0,...e.strings),this.vars.splice(t,0,...e.vars),this}getHTML(t){let[e,s]=Me(t,this),r=$e([],e,s,t,t);return et(r,((t,e)=>t+e.outerHTML),"")}}function Fe(t,e,s){s.get||ut(`Computed '${e}' must be a getter`),d(t.constructor,ct.COMPUTED)||(t.constructor[ct.COMPUTED]=c(t.constructor[ct.COMPUTED])?{}:f(t.constructor[ct.COMPUTED])),t.constructor[ct.COMPUTED][e]=s.get}function Ke(t,e){return(s,r,n)=>{d(s.constructor,ct.EVENTS)||(s.constructor[ct.EVENTS]=c(s.constructor[ct.EVENTS])?[]:f(s.constructor[ct.EVENTS])),s.constructor[ct.EVENTS].push({name:t,options:e,fn:s[r]})}}var Qe;!function(t){t.ONCE="once",t.UPDATABLE="updatable"}(Qe||(Qe={}));class Xe extends mt{static get priority(){return Number.MAX_VALUE}created(t,e,s,...r){}mounted(t,e,...s){}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,s,r,...n){const i=this;Reflect.defineProperty(t,r,{get:()=>(i.result&&i.cache||i.getter(t),i.result)})}updated(t,e){this.cache===Qe.UPDATABLE&&this.getter(t)}}const Ge=St(Xe),qe=St(class extends Xe{getter(t){this.result=t.shadowRoot?.querySelectorAll(this.selector)}});function Ye(t){if(1===arguments.length)return(e,s)=>{Ze(e,s,t)};Ze(arguments[0],arguments[1],{prop:""})}function Ze(t,e,s){if(!d(t.constructor,ct.STATES)){const e={};let s=t.constructor;for(;(s=ft(s))!==Bt;)p(e,s[ct.STATES]?f(s[ct.STATES]):{});Reflect.defineProperty(t.constructor,ct.STATES,{configurable:!1,enumerable:!1,value:e})}s.shallow=s.shallow||!1,t.constructor[ct.STATES][e]=s}function Je(t,e,s){Ze(t.prototype,e,s||{prop:""})}function ts(t){return e=>{if(e){if(e.prototype.hasOwnProperty("attributeChangedCallback")){let t=e.prototype.attributeChangedCallback;e.prototype.attributeChangedCallback=function(e,s,r){Bt.prototype.attributeChangedCallback.call(this,e,s,r),t.call(this,e,s,r)}}if(e.prototype.hasOwnProperty("connectedCallback")){let t=e.prototype.connectedCallback;e.prototype.connectedCallback=function(){Bt.prototype.connectedCallback.call(this),t.call(this)}}if(e.prototype.hasOwnProperty("disconnectedCallback")){let t=e.prototype.disconnectedCallback;e.prototype.disconnectedCallback=function(){Bt.prototype.disconnectedCallback.call(this),t.call(this)}}customElements.define(t,e)}}}function es(t,e){return(s,r)=>{d(s.constructor,ct.WATCH)||(s.constructor[ct.WATCH]=c(s.constructor[ct.WATCH])?{}:f(s.constructor[ct.WATCH]));(C(t)?t:[t]).forEach((t=>{let n=t.replaceAll(".","-"),i=s.constructor[ct.WATCH][n];C(i)||(i=s.constructor[ct.WATCH][n]=[]),i.push({source:t,options:e,handler:s[r]})}))}}class ss extends(Ht(Object)){_renderArgs;static get scopes(){return[]}renderParams}const rs=["key"];const ns=Gt(class extends ss{created(t,e){let s=t.startNode;if(s instanceof Bt){let t={},r={};g(e,((e,n)=>{rs.includes(n)||(n in s?t[n]=e:r[n]=e+"")})),s._initProps(t,r)}else g(e,((t,e)=>{s.setAttribute(e,t)}))}update(t,e,s){return Ut.NONE}static get scopes(){return[zt.TAG]}render(t){}});const is=Gt(class extends ss{created(t,e){let r=[];C(e)?r=K(e):a(e)?r=x(e,((t,e)=>t?e:[])):s(e)&&(r=e.split(" "));let n=t.startNode;g(this.lastCls,(t=>{n.classList.remove(t)})),g(r,(t=>{n.classList.add(t)})),this.lastCls=u(r)}update(t,e,s){return this.created(t,e[0]),Ut.NONE}static get scopes(){return[zt.CLASS]}lastCls;render(t){}});const os=Gt(class extends ss{created(t,...e){}update(t,e,s){if(c(t.getNodes())&&(!e||c(e[0])))return Ut.NONE;if(st(this.lastAry,e[0])&&this.lastAry.length===e[0].length)return Ut.NONE;if(!c(this.renderParams)){let t=_(this.renderParams);C(t)||(t=[t]),this.renderParams=t}return this.lastAry=rt(e[0]),Ut.UPDATE}constructor(t){super(),c(this.renderParams)||(this.renderParams=E(_(this.renderParams)))}static get scopes(){return[zt.TEXT,zt.SLOT]}lastAry;lastRenderTmpl;render(t,e){let s=Y(t,((t,s)=>e(t,s)));if(s.length<1)return this.lastRenderTmpl=new ze([],[]),this.lastRenderTmpl;let r=[],n=[];const i=[],o=[];for(let t=0;t<s.length;t++){const e=s[t];let a=_(n),l=e.vars,c=!0,d=e.strings;for(let t=0;t<d.length;t++){const e=d[t];if(at.test(e)){let e=l[t]+"";if(r.includes(e))return void ut(`forEach - duplicate key '${e}'`);r.push(e),c=!1}0==t&&a?n[n.length-1]=a+e:n.push(e)}if(c)return void ut("forEach - missing 'key' prop");let u=_(i);u&&d.length>0&&(i[i.length-1]=W(u)+d.shift()),i.push(""),o.push(e)}return this.lastAry=rt(t),i.push(""),this.lastRenderTmpl=new ze(i,o),this.lastRenderTmpl}});const as=Gt(class extends ss{created(t,...e){}ifNodes;elseNodes;static get scopes(){return[zt.TEXT,zt.SLOT]}update(t,e,s){return!!e[0]==!!s[0]?Ut.NONE:(e[0],Ut.REPLACE)}render(t,e,s){return t?e(t):s(t)}});const ls=Gt(class extends ss{created(t,...e){}static get scopes(){return[zt.TEXT,zt.SLOT]}update(t,e,s){return e[0]===s[0]?Ut.NONE:e[0]?Ut.REPLACE:Ut.REMOVE}render(t,e){return t?e():je``}});var cs;!function(t){t.CHANGE="change",t.INPUT="input"}(cs||(cs={}));const ds=Gt(class extends ss{created(t,e,s="value"){const r=t.startNode;if("binded"===o(r,"_model"))return;let n=_(this.renderParams);if(this.updateProp=s,this.modelPath=n,a(e)||W(e)||(e=""),r instanceof Bt)r._initProps({[this.updateProp]:e}),r.addEventListener("update:"+s,(t=>{T(this.renderComponent,this.modelPath,t.detail.value)})),T(r,"_model","binded");else if(r instanceof HTMLTextAreaElement)r.setAttribute(this.updateProp,e+""),r.addEventListener("input",(t=>{let e=t.target;T(this.renderComponent,this.modelPath,e.value)})),T(r,"_model","binded");else if(r instanceof HTMLInputElement){let t="",n="";switch(r.type){case"checkbox":case"radio":t="checked",n="change";break;default:t="value",n="input"}r.setAttribute(s??t,e+""),r.addEventListener(n,(t=>{let e=t.target;T(this.renderComponent,this.modelPath,e.value)})),T(r,"_model","binded")}else r instanceof HTMLSelectElement&&(r.setAttribute(this.updateProp,e+""),r.addEventListener("change",(t=>{let e=t.target;T(this.renderComponent,this.modelPath,e.value)})),T(r,"_model","binded"))}update(t,e,s){if(this.modelPath||(this.modelPath=_(this.renderParams)),!P(e,s)){const s=t.startNode;if(s instanceof Bt)s._updateProps({[this.updateProp]:e[0]});else if(s instanceof HTMLTextAreaElement||s instanceof HTMLSelectElement)s.setAttribute(this.updateProp,e[0]+"");else if(s instanceof HTMLInputElement)switch(s.type){case"checkbox":case"radio":e[0]?s.setAttribute("checked",""):s.removeAttribute("checked");break;default:s.setAttribute(this.updateProp,e[0]+"")}}return Ut.NONE}static get scopes(){return[zt.TAG]}modelPath;render(t,e="value"){}});const us=Gt(class extends ss{created(t,e,s){let r=t.startNode;n(this.display)&&(this.display=r.style.display);let i=s;this.renderComponent.nextTick((()=>{r.style.display=e?this.display:"none",i&&i(r,e)}))}update(t,e,s){return this.created(t,e[0],e[1]),Ut.NONE}display=void 0;static get scopes(){return[zt.TAG]}constructor(t){super(),this.point=t}render(t,e){}});const hs=Gt(class extends ss{created(t,e,s){e=e.bind(this.renderComponent),this.slotComponent._bindSlotHook(s||"default",e)}update(t,e,s){return Ut.NONE}static get scopes(){return[zt.SLOT]}render(t,e){}});class ps{static getCssText(t){return s(t)?t:y(Y(t,((t,e)=>e.startsWith("--")?e+":"+t:m(e)+":"+t)),";")}static setStyle(t,e){if(s(t)&&!W(t))return{};let r=ps.getCssText(t),n={};return g(r.split(";"),(t=>{let s=t.split(":"),r=W(s[0]),i=W(s[1]);n[r]=e.style.getPropertyValue(r),e.style.setProperty(r,i)})),n}}const fs=Gt(class extends ss{created(t,e){ps.setStyle(e,t.startNode)}update(t,e,s){return this.created(t,e[0]),Ut.NONE}constructor(t){super(),this.point=t}static get scopes(){return[zt.STYLE]}render(t){}});const gs=Gt(class extends ss{created(t,e){this.modelPath||(this.modelPath=_(this.renderParams));const s=t.startNode;let r=t.attrName;s._initProps({[r]:e}),s.addEventListener("update:"+r,(t=>{T(this.renderComponent,this.modelPath,t.detail.value)}))}update(t,e,s){if(!P(e,s)){const s=t.startNode;let r=t.attrName;s._updateProps({[r]:e[0]})}return Ut.NONE}static get scopes(){return[zt.PROP]}modelPath;constructor(t){super()}render(t){}});const ms=Gt(class extends ss{created(t,...e){}static get scopes(){return[zt.TEXT,zt.SLOT]}update(t,e,s){return P(e,s)?Ut.NONE:Ut.REPLACE}render(t,e){let s=()=>je``,r=[],n=[];g(e,((t,e)=>{if(v(t))r.push(e),n.push(t);else{let e=t[0],s=t[1];r.push(e),n.push(s)}"default"===e&&(s=t)}));let i=nt(r,(e=>v(e)?e(t):e==t));return it(n[i]??s)}});export{Bt as CompElem,ps as CssHelper,mt as Decorator,dt as DecoratorType,vt as DecoratorWrapper,ss as Directive,Ut as DirectiveUpdateTag,Xt as DirectiveWrapper,Qt as EnterPoint,zt as EnterPointType,Et as GetKeyFnName,cs as ModelTriggerType,Qe as QueryCache,ze as Template,Kt as UpdatePoint,bt as _DecoratorMap,_t as _DecoratorsKey,wt as _getObservedAttrs,ns as bind,Me as buildHTML,is as classes,Fe as computed,Ue as createRef,St as decorator,Gt as directive,Ke as event,os as forEach,je as html,as as ifElse,ls as ifTrue,Je as makeState,ds as model,Nt as prop,Ge as query,qe as queryAll,us as show,hs as slot,Ye as state,fs as styles,gs as sync,ts as tag,es as watch,ms as when};
|