ouider 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
- 'use strict';var me=require('route-parser');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var me__default=/*#__PURE__*/_interopDefault(me);var Ut=Object.defineProperty;var te=(c,t,s)=>t in c?Ut(c,t,{enumerable:true,configurable:true,writable:true,value:s}):c[t]=s;var d=(c,t)=>Ut(c,"name",{value:t,configurable:true});var p=(c,t,s)=>te(c,typeof t!="symbol"?t+"":t,s);var gt=class gt{constructor(){p(this,"components",new Map);}register(t,s){console.log(`[OUID] - Registering component: ${t}`);let n=t.toLocaleLowerCase();this.components.has(n)||this.components.set(n,s);}unregister(t){let s=t.toLocaleLowerCase();this.components.delete(s);}get(t){return this.components.get(t.toLocaleLowerCase())}has(t){return this.components.has(t)}getAll(){return Array.from(this.components.entries())}};d(gt,"ComponentsRegistry");var it=gt,K=new it;var bt=class bt{constructor(t){p(this,"events");this.events=t;}emit(t,...s){let n=this.events[t];n?n(...s):console.log("Not handler found for ",t);}};d(bt,"Emits");var lt=bt;var St=new WeakMap,Z=null,ht=[],tt,ee=(tt=class{constructor(t,s,n){p(this,"fn");p(this,"scheduler");p(this,"onStop");p(this,"deps",[]);p(this,"active",true);this.fn=t,this.scheduler=s,this.onStop=n;}run(){var t;if(!this.active)return this.fn();try{return ht.push(this),Z=this,Vt(this),this.fn()}finally{ht.pop(),Z=(t=ht[ht.length-1])!=null?t:null;}}stop(){var t;this.active&&(Vt(this),this.active=false,(t=this.onStop)==null||t.call(this));}},d(tt,"ReactiveEffect"),tt);function Vt(c){for(let t of c.deps)t.delete(c);c.deps.length=0;}d(Vt,"cleanupEffect");function Ct(c,t){if(!Z)return;let s=St.get(c);s||St.set(c,s=new Map);let n=s.get(t);n||s.set(t,n=new Set),n.has(Z)||(n.add(Z),Z.deps.push(n));}d(Ct,"track");function dt(c,t){let s=St.get(c);if(!s)return;let n=s.get(t);if(!n)return;let r=new Set(n);for(let l of r)l.scheduler?l.scheduler():l.run();}d(dt,"trigger");var kt=new Set,Et=false;function se(c){kt.add(c),!Et&&(Et=true,queueMicrotask(()=>{try{for(let t of kt)t();}finally{kt.clear(),Et=false;}}));}d(se,"queueJob");function at(c,t){let s=new ee(c,t==null?void 0:t.scheduler,t==null?void 0:t.onStop),n=s.run.bind(s);return n.effect=s,t!=null&&t.lazy||n(),n}d(at,"effect");function ne(c){c.effect.stop();}d(ne,"stop");function ft(c){return c!==null&&typeof c=="object"}d(ft,"isObject");var Bt=new WeakMap;function rt(c){if(!ft(c))return c;let t=Bt.get(c);if(t)return t;let s=new Proxy(c,{get(n,r,l){let a=Reflect.get(n,r,l);return Ct(n,r),ft(a)?rt(a):a},set(n,r,l,a){let m=Reflect.set(n,r,l,a);return console.log("Setting reactive",n,r,l),dt(n,r),m},deleteProperty(n,r){let l=Object.prototype.hasOwnProperty.call(n,r),a=Reflect.deleteProperty(n,r);return l&&a&&dt(n,r),a}});return Bt.set(c,s),s}d(rt,"reactive");function qt(c){return !!c&&typeof c=="object"&&c.__isRef===true}d(qt,"isRef");function Ot(c){let t=ft(c)?rt(c):c,s={__isRef:true,get value(){return Ct(s,"value"),t},set value(n){let r=ft(n)?rt(n):n;Object.is(r,t)||(t=r,dt(s,"value"));}};return s}d(Ot,"ref");function Ft(c){let t=true,s,n={__isRef:true},r=at(c,{lazy:true,scheduler:d(()=>{t||(t=true,dt(n,"value"));},"scheduler")});return Object.defineProperty(n,"value",{get(){return Ct(n,"value"),t&&(t=false,s=r()),s},set(){throw new Error("computed is readonly")},enumerable:true}),n}d(Ft,"computed");function Ht(c){let t,s=d(r=>t=r,"onCleanup"),n=at(()=>{t==null||t(),t=void 0,c(s);},{scheduler:d(()=>se(n),"scheduler"),onStop:d(()=>{t==null||t(),t=void 0;},"onStop")});return ()=>ne(n)}d(Ht,"watchEffect");function xt(c){return qt(c)}d(xt,"isStated");function Te(c){return Ot(c)}d(Te,"stated");var Tt=class Tt{constructor(t){p(this,"_ctx");this._ctx=rt(t);}wrap(t){return Ot(t)}computed(t){return Ft(t)}watchEffect(t){return Ht(t)}get value(){return this._ctx}};d(Tt,"State");var pt=Tt;var ie=0;function Wt(c){return function(t){var r;let s=(r=class extends t{constructor(){super(...arguments);p(this,"template",c.template);p(this,"css",c.css);p(this,"tag",c.tag);p(this,"use",c.use);p(this,"hostClasses",c.hostClasses);p(this,"hash","component-"+ie+"-"+c.tag);}},d(r,"WithDecoration"),r),n=s;return n.tag=c.tag,s}}d(Wt,"Component");var wt=class wt{constructor(t,s=[]){p(this,"node");p(this,"children");this.node=t,this.children=s;}attachTo(t){if(typeof this.node=="string"){t.innerHTML=this.node;return}let s=this.node;for(let n of this.children)n.attachTo(s);t.appendChild(s);}static of(t,s=[]){return new wt(t,s)}addChild(t){return this.children.push(t),this}};d(wt,"RenderNode");var et=wt,ot=class ot{constructor(t,s){p(this,"data");p(this,"css");this.data=t,this.css=s;}toString(){let t=this.css?this.css+`
1
+ 'use strict';var ge=require('route-parser');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ge__default=/*#__PURE__*/_interopDefault(ge);var qt=Object.defineProperty;var Bt=Object.getOwnPropertySymbols;var ne=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable;var kt=(o,t,s)=>t in o?qt(o,t,{enumerable:true,configurable:true,writable:true,value:s}):o[t]=s,rt=(o,t)=>{for(var s in t||(t={}))ne.call(t,s)&&kt(o,s,t[s]);if(Bt)for(var s of Bt(t))ie.call(t,s)&&kt(o,s,t[s]);return o};var d=(o,t)=>qt(o,"name",{value:t,configurable:true});var p=(o,t,s)=>kt(o,typeof t!="symbol"?t+"":t,s);var Et=class Et{constructor(){p(this,"components",new Map);}register(t,s){console.log(`[OUID] - Registering component: ${t}`);let n=t.toLocaleLowerCase();this.components.has(n)||this.components.set(n,s);}unregister(t){let s=t.toLocaleLowerCase();this.components.delete(s);}get(t){return this.components.get(t.toLocaleLowerCase())}has(t){return this.components.has(t)}getAll(){return Array.from(this.components.entries())}};d(Et,"ComponentsRegistry");var at=Et,K=new at;var St=class St{constructor(t){p(this,"events");this.events=t;}emit(t,...s){let n=this.events[t];n?n(...s):console.log("Not handler found for ",t);}};d(St,"Emits");var ft=St;var xt=new WeakMap,Z=null,pt=[],tt,re=(tt=class{constructor(t,s,n){p(this,"fn");p(this,"scheduler");p(this,"onStop");p(this,"deps",[]);p(this,"active",true);this.fn=t,this.scheduler=s,this.onStop=n;}run(){var t;if(!this.active)return this.fn();try{return pt.push(this),Z=this,Ft(this),this.fn()}finally{pt.pop(),Z=(t=pt[pt.length-1])!=null?t:null;}}stop(){var t;this.active&&(Ft(this),this.active=false,(t=this.onStop)==null||t.call(this));}},d(tt,"ReactiveEffect"),tt);function Ft(o){for(let t of o.deps)t.delete(o);o.deps.length=0;}d(Ft,"cleanupEffect");function Tt(o,t){if(!Z)return;let s=xt.get(o);s||xt.set(o,s=new Map);let n=s.get(t);n||s.set(t,n=new Set),n.has(Z)||(n.add(Z),Z.deps.push(n));}d(Tt,"track");function mt(o,t){let s=xt.get(o);if(!s)return;let n=s.get(t);if(!n)return;let r=new Set(n);for(let l of r)l.scheduler?l.scheduler():l.run();}d(mt,"trigger");var Ct=new Set,Ot=false;function ae(o){Ct.add(o),!Ot&&(Ot=true,queueMicrotask(()=>{try{for(let t of Ct)t();}finally{Ct.clear(),Ot=false;}}));}d(ae,"queueJob");function ct(o,t){let s=new re(o,t==null?void 0:t.scheduler,t==null?void 0:t.onStop),n=s.run.bind(s);return n.effect=s,t!=null&&t.lazy||n(),n}d(ct,"effect");function oe(o){o.effect.stop();}d(oe,"stop");function wt(o){return o!==null&&typeof o=="object"}d(wt,"isObject");var Ht=new WeakMap;function ot(o){if(!wt(o))return o;let t=Ht.get(o);if(t)return t;let s=new Proxy(o,{get(n,r,l){let a=Reflect.get(n,r,l);return Tt(n,r),wt(a)?ot(a):a},set(n,r,l,a){let m=Reflect.set(n,r,l,a);return console.log("Setting reactive",n,r,l),mt(n,r),m},deleteProperty(n,r){let l=Object.prototype.hasOwnProperty.call(n,r),a=Reflect.deleteProperty(n,r);return l&&a&&mt(n,r),a}});return Ht.set(o,s),s}d(ot,"reactive");function $t(o){return !!o&&typeof o=="object"&&o.__isRef===true}d($t,"isRef");function Pt(o){let t=wt(o)?ot(o):o,s={__isRef:true,get value(){return Tt(s,"value"),t},set value(n){let r=wt(n)?ot(n):n;Object.is(r,t)||(t=r,mt(s,"value"));}};return s}d(Pt,"ref");function Wt(o){let t=true,s,n={__isRef:true},r=ct(o,{lazy:true,scheduler:d(()=>{t||(t=true,mt(n,"value"));},"scheduler")});return Object.defineProperty(n,"value",{get(){return Tt(n,"value"),t&&(t=false,s=r()),s},set(){throw new Error("computed is readonly")},enumerable:true}),n}d(Wt,"computed");function Gt(o){let t,s=d(r=>t=r,"onCleanup"),n=ct(()=>{t==null||t(),t=void 0,o(s);},{scheduler:d(()=>ae(n),"scheduler"),onStop:d(()=>{t==null||t(),t=void 0;},"onStop")});return ()=>oe(n)}d(Gt,"watchEffect");function At(o){return $t(o)}d(At,"isStated");function Ie(o){return Pt(o)}d(Ie,"stated");var _t=class _t{constructor(t){p(this,"_ctx");this._ctx=ot(t);}wrap(t){return Pt(t)}computed(t){return Wt(t)}watchEffect(t){return Gt(t)}get value(){return this._ctx}};d(_t,"State");var yt=_t;var ce=0;function Kt(o){return function(t){var r;let s=(r=class extends t{constructor(){super(...arguments);p(this,"template",o.template);p(this,"css",o.css);p(this,"tag",o.tag);p(this,"use",o.use);p(this,"hostClasses",o.hostClasses);p(this,"hash","component-"+ce+"-"+o.tag);}},d(r,"WithDecoration"),r),n=s;return n.tag=o.tag,s}}d(Kt,"Component");var gt=class gt{constructor(t,s=[]){p(this,"node");p(this,"children");this.node=t,this.children=s;}attachTo(t){if(typeof this.node=="string"){t.innerHTML=this.node;return}let s=this.node;for(let n of this.children)n.attachTo(s);t.appendChild(s);}static of(t,s=[]){return new gt(t,s)}addChild(t){return this.children.push(t),this}};d(gt,"RenderNode");var et=gt,ut=class ut{constructor(t,s){p(this,"data");p(this,"css");this.data=t,this.css=s;}toString(){let t=this.css?this.css+`
2
2
  `:"";for(let s in this.data){let n=this.data[s];typeof n=="string"?t+=`${s} { ${n} }
3
- `:n instanceof ot&&(t+=`${s} {
3
+ `:n instanceof ut&&(t+=`${s} {
4
4
  ${n.toString()}}
5
- `);}return t}static of(t,...s){return new ot(t,s.join(`
6
- `))}};d(ot,"StyleData");var mt=ot;function Pt(c,t,s){return new c(t,s)}d(Pt,"createComponent");var At=class At{constructor(t={},s={}){p(this,"state");p(this,"parent");p(this,"emits");p(this,"props");p(this,"provides",new Map);this.state=new pt({}),this.props=t,this.emits=new lt(s);}onActivated(){}onDeactivated(){}onMounted(){}willMount(){}willUnmount(){}provide(t,s){this.provides.set(t,s);}inject(t){let s=this;for(;s;){if(s.provides.has(t))return s.provides.get(t);s=s.parent;}}decorateHostElement(t){return Promise.resolve()}};d(At,"OComponent");var st=At;function nt(c){let t=Date.now();return `${(1e3+Math.floor(Math.random()*9e3)+c.length).toString(16)}-${t.toString(16)}`}d(nt,"generateUIID");function _t(c){return new Promise(t=>setTimeout(t,c))}d(_t,"delay");var re=typeof globalThis.queueMicrotask=="function",H=d(c=>c?re?queueMicrotask(c):Promise.resolve().then(c):Promise.resolve(),"deferMicro");(function(c){var y,A,S,j,q,F,I,Q,z,W,$,G;let t=(y=class{constructor(){p(this,"actions",[]);}async exec(){await this.commit();}add(u){return this.actions.push(u),this}async commit(){let u=this.actions;this.actions=[],await Promise.all(u.map(async e=>await e()));}},d(y,"BatchActions"),y);c.BatchActions=t;let s=new Set(["invoke","dispatchEvent","setProperty"]),n=[],r=new Map,l=false,a=null;function m(){if(l)return;l=true;let Y=d(()=>{l=false,g();},"runner");setTimeout(()=>Y(),0);}d(m,"scheduleBatchFlush");async function g(){let Y=n;n=[],r.clear();let u=a;a=null;try{Y.length&&await w.batchActions(Y),u==null||u.resolve();}catch(e){u==null||u.reject(e);}}d(g,"flushBatchQueue");function v(Y){for(let u of Y){if(s.has(u.fn)){n.push(u);continue}let e=`${u.fn}|${u.args.map(o=>typeof o=="object"?JSON.stringify(o):String(o)).join("|")}`,i=r.get(e);i!==void 0?n[i]=u:(r.set(e,n.length),n.push(u));}if(!a){let u,e,i=new Promise((o,h)=>{u=o,e=h;});return a={resolve:u,reject:e},m(),i}return m(),new Promise((u,e)=>{let i=a;a={resolve:d(()=>{i==null||i.resolve(),u();},"resolve"),reject:d(o=>{i==null||i.reject(o),e(o);},"reject")};})}d(v,"enqueueBatchActions");let E=(A=class{constructor(u){p(this,"node");p(this,"operations",[]);this.node=u;}accept(u){this.operations.push(...u.operations),u.operations=[];}async exec(u=false){let e=this.operations;this.operations=[];let i=[],o=e.map(h=>typeof h=="object"?(i.push({fn:h.fn,args:[h.node.uid,...h.args.map(f=>f instanceof C?f.uid:f)]}),null):h()).filter(h=>h!=null);if(i.length>0){let h={},f=[];i.forEach(k=>{let T=`${k.fn}.${k.args.map(N=>N==null?void 0:N.toString()).join(",")}`;h[T]&&!["invoke","setProperty","dispatchEvent"].includes(k.fn)||(h[T]=k,f.push(k));}),u?o.unshift(w.batchActions(f)):o.unshift(v(f));}try{await Promise.all(o);}catch(h){console.error("Error while batch updates");}}append(u,...e){return this.operations.push({fn:u,args:e,node:this.node}),this}add(u,e,...i){return typeof u=="function"?this.operations.push(u):this.operations.push({fn:u,args:i,node:e}),this}addEventListener(u,e,i,o){return this.add(()=>{this.node.addEventListener(u,e,{options:i,policy:o});})}setProperty(u,e){return this.append("setProperty",u,e)}dettachEventListener(u){return this.append("dettachEventListener",u)}invoke(u,...e){return this.append("invoke",u,...e.map(i=>i instanceof C?i.ref:i))}dispatchEvent(u,e,i){return this.append("dispatchEvent",u,e,i)}addClass(...u){return this.append("addClass",...u)}removeClass(...u){return this.append("removeClass",...u)}setAttribute(u,e){return this.append("setAttribute",u,e)}removeAttribute(u){return this.append("removeAttribute",u)}appendChild(u){return this.append("appendChild",u.uid)}removeChild(u){return this.append("removeChild",u.uid)}remove(){return this.append("remove")}removeAndRelease(){return this.append("remove").append("release")}release(){return this.append("release")}innerHTML(u){return this.append("setHTML",u)}replaceChildNode(u,e){return this.append("replaceChildNode",u,e)}replaceWith(u){return this.append("replaceWith",u.uid)}after(u){return this.append("after",u.uid)}setInnerText(u){return this.append("setInnerText",u)}setContentText(u){return this.append("setContentText",u)}insertBefore(u,e){return this.append("insertBefore",u.uid,e.uid)}setInputValue(u){return this.append("setInputValue",u)}setStyle(u,e){return this.append("setStyle",u,e)}},d(A,"BatchUpdates"),A);c.BatchUpdates=E;let C=(S=class{constructor(u,e){p(this,"uid");p(this,"tag");this.uid=u,this.tag=e;}static toInstance(u){return new S(u.uid,u.tag)}async release(){await w.call("releaseNode",this.uid);}async addEventListener(u,e,i){return w.addEventListener(this,u,e,{options:i==null?void 0:i.options,policy:i==null?void 0:i.policy})}async dettachEventListener(u){await w.dettachEventListener(u);}async invoke(u,...e){return await w.call("invokeObjectMethod",this.uid,u,...e)}async invokeAndHold(u,...e){let i=await w.call("invokeObjectMethodAndHold",this.uid,u,...e);return i&&new S(i.uid,i.tag)}async getProperty(u){return await w.call("getObjectProperty",this.uid,u)}async getPropertyAndHold(u){let e=await w.call("getObjectPropertyAndHold",this.uid,u);return e&&new S(e.uid,e.tag)}async setProperty(u,e){await w.call("setObjectProperty",this.uid,u,e);}async dispatchEvent(u,e,i){await w.call("dispatchEvent",this.uid,u,e,i);}updates(){return new E(this)}batches(){return new E(this)}get ref(){return {__ref__:this.uid}}},d(S,"OObject"),S);c.OObject=C;let U=(j=class extends C{constructor(e){super(e.uid,e.tag);p(this,"textContent");p(this,"type","Unknown");p(this,"attributes");p(this,"children");p(this,"classes");p(this,"style");for(let f in e)this[f]=e[f];(this.attributes)!=null||(this.attributes=[]),(this.classes)!=null||(this.classes=[]),(this.style)!=null||(this.style="");}},d(j,"ONode"),j);c.ONode=U;let M=(q=class extends U{constructor(e){super(e);p(this,"_hydrated",false);}async addClass(...e){await w.call("addClass",this.uid,...e);}async removeClass(...e){await w.call("removeClass",this.uid,...e);}async setAttribute(e,i){let o=await w.call("setAttribute",this.uid,e,i);o&&(this.attributes=o);}async removeAttribute(e){let i=await w.call("removeAttribute",this.uid,e);i&&(this.attributes=i);}async appendChild(e){await w.call("appendChild",this.uid,e.uid);}set innerHTML(e){this.setHTML(e);}async cloneNode(e){let i=await w.call("cloneNode",this.uid,e);return i?new q(i):null}async remove(){await w.call("removeNode",this.uid);}async removeAndRelease(){await this.remove(),await this.release();}async removeChild(e){await w.call("removeChild",this.uid,e.uid);}async replaceChildNode(e,i){await w.call("replaceChildNode",this.uid,e.uid,i.uid);}async replaceWith(e){await w.call("replaceWith",this.uid,e.uid);}async after(e){await w.call("insertAfter",this.uid,e.uid);}async setHTML(e){await w.call("setInnerHTML",this.uid,e);}async HTML(){var e;return (e=await w.call("getInnerHTML",this.uid))!=null?e:""}async setInnerText(e){await w.call("setInnerText",this.uid,e);}async setContentText(e){await w.call("setContentText",this.uid,e);}async getContentText(){var e;return (e=await w.call("getContentText",this.uid))!=null?e:""}async content(){var e;try{return (e=await w.call("getInnerText",this.uid))!=null?e:""}catch(i){return console.error(i),""}}async childNodes(){var e,i;return (i=(e=await w.call("childNodes",this.uid))==null?void 0:e.map(o=>new q(o)))!=null?i:[]}hasAttribute(e){return !!this.attributes.find(i=>i.name===e)}async getAttribute(e){var i;return (i=await w.call("getAttribte",this.uid,e))!=null?i:""}attribute(e){var i,o;return (o=(i=this.attributes.find(h=>h.name===e))==null?void 0:i.value)!=null?o:null}async nextSibling(){let e=await w.call("nextSibling",this.uid);return e?new q(e):null}async getAttributeNames(){var e;return (e=await w.call("getAttributeNames",this.uid))!=null?e:[]}async parentNode(){let e=await w.call("parentNode",this.uid);return e?new q(e):null}async insertBefore(e,i){await w.call("insertBefore",this.uid,e.uid,i.uid);}async setInputValue(e){await w.call("setInputValue",this.uid,e);}async inputValue(){var e;return (e=await w.call("inputValue",this.uid))!=null?e:""}get hydrated(){return this._hydrated}hydrate(){this._hydrated=true,this.addClass("hydrated");}async query(e,i){return await w.query(e,i,this.uid)}async queryAll(e,i){return await w.queryAll(e,i,this.uid)}async setStyle(e,i){await w.call("setStyle",this.uid,e,i);}},d(q,"OElement"),q);c.OElement=M;let _=(F=class extends C{constructor(u){super(u.uid,u.tag);}addColorStop(u,e){return this.invoke("addColorStop",u,e),this}},d(F,"CanvasGradient"),F);c.CanvasGradient=_;let O=(I=class extends C{constructor(e){super(e.uid,e.tag);p(this,"batch",new E(this));}static async new(e){let i=typeof e!="undefined"?await w.newObject("DOMMatrix",e):await w.newObject("DOMMatrix");return i?new I(i):null}invertSelf(){return this.batch.invoke("invertSelf"),this}multiplySelf(e){return this.batch.invoke("multiplySelf",...e?[e.ref]:[]),this}premultiplySelf(e){return this.batch.invoke("premultiplySelf",...e?[e.ref]:[]),this}rotateAxisAngleSelf(e,i,o,h){let f=[];return e&&f.push(e),i&&f.push(i),o&&f.push(o),h&&f.push(h),this.batch.invoke("rotateAxisAngleSelf",...f),this}rotateFromVectorSelf(e,i){let o=[];return e&&o.push(e),i&&o.push(i),this.batch.invoke("rotateFromVectorSelf",...o),this}rotateSelf(e,i,o){let h=[];return e&&h.push(e),i&&h.push(i),o&&h.push(o),this.batch.invoke("rotateFromVectorSelf",...h),this}scale3dSelf(e,i,o,h){let f=[];return e&&f.push(e),i&&f.push(i),o&&f.push(o),h&&f.push(h),this.batch.invoke("scale3dSelf",...f),this}scaleSelf(e,i,o,h,f,k){let T=[];return e&&T.push(e),i&&T.push(i),o&&T.push(o),h&&T.push(h),f&&T.push(f),k&&T.push(k),this.batch.invoke("scaleSelf",...T),this}setMatrixValue(e){return this.invoke("setMatrixValue",e),this}skewXSelf(e){return this.batch.invoke("skewXSelf",e),this}skewYSelf(e){return this.batch.invoke("skewYSelf",e),this}translateSelf(e,i,o){return this.batch.invoke("translateSelf",e,i,...o?[o]:[]),this}async commit(){await this.batch.exec();}async is2D(){var e;return (e=await this.invoke("is2D"))!=null?e:false}async isIdentity(){var e;return (e=await this.invoke("isIdentity"))!=null?e:false}async flipX(){let e=await this.invokeAndHold("flipX");return e?new I(e):null}async flipY(){let e=await this.invokeAndHold("flipY");return e?new I(e):null}async inverse(){let e=await this.invokeAndHold("inverse");return e?new I(e):null}async multiply(e){let i=await this.invokeAndHold("multiply",...e?[e.ref]:[]);return i?new I(i):null}async rotate(e,i,o){let h=[];e&&h.push(e),i&&h.push(i),o&&h.push(o);let f=await this.invokeAndHold("rotate",...h);return f?new I(f):null}async rotateAxisAngle(e,i,o,h){let f=[];e&&f.push(e),i&&f.push(i),o&&f.push(o),h&&f.push(h);let k=await this.invokeAndHold("rotateAxisAngle",...f);return k?new I(k):null}async rotateFromVector(e,i){let o=[];e&&o.push(e),i&&o.push(i);let h=await this.invokeAndHold("rotateFromVector",...o);return h?new I(h):null}async scale(e,i,o,h,f,k){let T=[];e&&T.push(e),i&&T.push(i),o&&T.push(o),h&&T.push(h),f&&T.push(f),k&&T.push(k);let N=await this.invokeAndHold("scale",...T);return N?new I(N):null}async scale3d(e,i,o,h){let f=[];e&&f.push(e),i&&f.push(i),o&&f.push(o),h&&f.push(h);let k=await this.invokeAndHold("scale",...f);return k?new I(k):null}async skewX(e){let i=[];e&&i.push(e);let o=await this.invokeAndHold("skewX",...i);return o?new I(o):null}async skewY(e){let i=[];e&&i.push(e);let o=await this.invokeAndHold("skewY",...i);return o?new I(o):null}toJSON(){return this.invoke("toJSON")}async toString(){return this.invoke("toString")}async translate(e,i,o){let h=[];e&&h.push(e),i&&h.push(i),o&&h.push(o);let f=await this.invokeAndHold("translate",...h);return f?new I(f):null}},d(I,"DOMMatrix"),I);c.DOMMatrix=O;let P=(Q=class extends C{constructor(u){super(u.uid,u.tag);}async setTransform(u){await this.invoke("setTransform",u.ref);}},d(Q,"CanvasPattern"),Q);c.CanvasPattern=P;let x=(z=class extends C{constructor(e){super(e,"unknown");p(this,"batch",new E(this));}arc(e,i,o,h,f,k=false){return this.batch.invoke("arc",e,i,o,h,f,k),this}arcTo(e,i,o,h,f){return this.batch.invoke("arcTo",e,i,o,h,f),this}bezierCurveTo(e,i,o,h,f,k){return this.batch.invoke("bezierCurveTo",e,i,o,h,f,k),this}clearRect(e,i,o,h){return this.batch.invoke("clearRect",e,i,o,h),this}clip(e,i){let o=[];return typeof e=="string"?o.push(e):e instanceof V&&(e.commit(this.batch),o.push(e.ref)),typeof i=="string"&&o.push(i),this.batch.invoke("clip",...o),this}beginPath(){return this.batch.invoke("beginPath"),this}closePath(){return this.batch.invoke("closePath"),this}async createConicGradient(e,i,o){let h=await this.invokeAndHold("createConicGradient",e,i,o);return h?new _(h):null}async createLinearGradient(e,i,o,h){let f=await this.invokeAndHold("createLinearGradient",e,i,o,h);return f?new _(f):null}async createPattern(e,i=""){let o=await this.invokeAndHold("createPattern",e.ref,i);return o?new P(o):null}async createRadialGradient(e,i,o,h,f,k){let T=await this.invokeAndHold("createRadialGradient",e,i,o,h,f,k);return T?new _(T):null}drawImage(e,i,o,h,f,k,T,N,Zt){let X=[e.ref];return typeof k=="undefined"?(X.push(i,o),h&&X.push(h),f&&X.push(f),this.batch.invoke("drawImage",...X),this):(X.push(i,o,h,f,k,T,N,Zt),this.batch.invoke("drawImage",...X),this)}ellipse(e,i,o,h,f,k,T,N=false){return this.batch.invoke("ellipse",e,i,o,h,f,k,T,N),this}fill(e,i){let o=[];return e&&o.push(typeof e=="string"?e:(e.commit(this.batch),e.ref)),i&&o.push(i),this.batch.invoke("fill",...o),this}fillRect(e,i,o,h){return this.batch.invoke("fillRect",e,i,o,h),this}fillText(e,i,o,h){return this.batch.invoke("fillText",e,i,o,...h?[h]:[]),this}getImageData(e,i,o,h,f){return this.invokeAndHold("getImageData",e,i,o,h,...f?[f]:[])}getLineDash(){return this.invoke("getLineDash")}async getTransform(){let e=await this.invokeAndHold("getTransform");return e?new O(e):null}async isContextLost(){return await this.invoke("isContextLost")}async isPointInPath(e,i,o,h){let f=[];return typeof e=="number"?(f.push(e,i),o&&f.push(o)):(await e.commit(this.batch),f.push(e.ref,i,o),h&&f.push(h)),await this.invoke("isPointInPath",...f)}async isPointInStroke(e,i,o){var f;let h=[];return typeof e=="number"?h.push(e,i):(await e.commit(),h.push(e.ref,i,o)),(f=await this.invoke("isPointInStroke",...h))!=null?f:false}lineTo(e,i){return this.batch.invoke("lineTo",e,i),this}async measureText(e){var i;return (i=await this.invoke("measureText",e))!=null?i:0}moveTo(e,i){return this.batch.invoke("moveTo",e,i),this}putImageData(e,i,o,h,f,k,T){let N=[e.ref,i,o];return h&&N.push(h),f&&N.push(f),k&&N.push(k),T&&N.push(T),this.batch.invoke("putImageData",...N),this}quadraticCurveTo(e,i,o,h){return this.batch.invoke("quadraticCurveTo",e,i,o,h),this}rect(e,i,o,h){return this.batch.invoke("rect",e,i,o,h),this}reset(){this.invoke("reset");}resetTransform(){this.invoke("resetTransform");}restore(){return this.batch.invoke("restore")}rotate(e){return this.batch.invoke("rotate",e),this}roundRect(e,i,o,h,f){return this.batch.invoke("roundRect",e,i,o,h,f),this}save(){return this.batch.invoke("save")}scale(e,i){return this.batch.invoke("scale",e,i),this}setLineDash(e){return this.invoke("setLineDash",e)}setTransform(e,i,o,h,f,k){typeof e=="number"?this.batch.invoke("setTransform",e,i,o,h,f,k):this.batch.invoke("setTransform",e.ref);}stroke(e){return this.batch.invoke("stroke",...e?[(e.commit(this.batch),e.ref)]:[]),this}strokeRect(e,i,o,h){return this.batch.invoke("strokeRect",e,i,o,h),this}strokeText(e,i,o,h){return this.batch.invoke("strokeText",e,i,o,...h?[h]:[]),this}transform(e,i,o,h,f,k){return this.batch.invoke("transform",e,i,o,h,f,k),this}translate(e,i){return this.batch.invoke("translate",e,i),this}set fillStyle(e){this.setFillStyle(e);}setFillStyle(e){return this.batch.setProperty("fillStyle",typeof e=="string"?e:e instanceof C?e.ref:e),this}set filter(e){this.setFilter(e);}setFilter(e){return this.batch.setProperty("filter",e),this}set font(e){this.setFont(e);}setFont(e){return this.batch.setProperty("font",e),this}set fontKerning(e){this.setFontKerning(e);}setFontKerning(e){return this.batch.setProperty("fontKerning",e),this}set fontStretch(e){this.setFontStretch(e);}setFontStretch(e){return this.batch.setProperty("fontStretch",e),this}set fontVariantCaps(e){this.setFontVariantCaps(e);}setFontVariantCaps(e){return this.batch.setProperty("fontVariantCaps",e),this}set globalAlpha(e){this.setGlobalAlpha(e);}setGlobalAlpha(e){return this.batch.setProperty("globalAlpha",e),this}set globalCompositeOperation(e){this.setGlobalCompositeOperation(e);}setGlobalCompositeOperation(e){return this.batch.setProperty("globalCompositeOperation",e),this}set imageSmoothingEnabled(e){this.setImageSmoothingEnabled(e);}setImageSmoothingEnabled(e){return this.batch.setProperty("imageSmoothingEnabled",e),this}set imageSmoothingQuality(e){this.setImageSmoothingQuality(e);}setImageSmoothingQuality(e){return this.batch.setProperty("imageSmoothingQuality",e),this}set letterSpacing(e){this.setLetterSpacing(e);}setLetterSpacing(e){return this.batch.setProperty("letterSpacing",e),this}set lineCap(e){this.setLineCap(e);}setLineCap(e){return this.batch.setProperty("lineCap",e),this}set lineDashOffset(e){this.setLineDashOffset(e);}setLineDashOffset(e){return this.batch.setProperty("lineDashOffset",e),this}set lineJoin(e){this.setLineJoin(e);}setLineJoin(e){return this.batch.setProperty("lineJoin",e),this}set lineWidth(e){this.setLineWidth(e);}setLineWidth(e){return this.batch.setProperty("lineWidth",e),this}set miterLimit(e){this.setMiterLimit(e);}setMiterLimit(e){return this.batch.setProperty("miterLimit",e),this}set shadowBlur(e){this.setShadowBlur(e);}setShadowBlur(e){return this.batch.setProperty("shadowBlur",e),this}set shadowColor(e){this.setShadowColor(e);}setShadowColor(e){return this.batch.setProperty("shadowColor",e),this}set shadowOffsetX(e){this.setShadowOffsetX(e);}setShadowOffsetX(e){return this.batch.setProperty("shadowOffsetX",e),this}set shadowOffsetY(e){this.setShadowOffsetY(e);}setShadowOffsetY(e){return this.batch.setProperty("shadowOffsetY",e),this}set strokeStyle(e){this.setStrokeStyle(e);}setStrokeStyle(e){return this.batch.setProperty("strokeStyle",typeof e=="string"?e:e instanceof C?e.ref:e),this}set textAlign(e){this.setTextAlign(e);}setTextAlign(e){return this.batch.setProperty("textAlign",e),this}set textBaseline(e){this.setTextBaseline(e);}setTextBaseline(e){return this.batch.setProperty("textBaseline",e),this}set wordSpacing(e){this.setWordSpacing(e);}setWordSpacing(e){return this.batch.setProperty("wordSpacing",e),this}set textRendering(e){this.setTextRendering(e);}setTextRendering(e){return this.batch.setProperty("textRendering",e),this}async commit(){await this.batch.exec();}},d(z,"Canvas2DContext"),z);c.Canvas2DContext=x;let L=(W=class extends C{constructor(u){super(u.uid,u.tag);}static async new(u,e){let i=[];u&&i.push(u),e&&i.push(e);let o=await w.newObject("Image",...i);return o?new W(o):null}async width(){var u;return (u=await this.getProperty("width"))!=null?u:0}async height(){var u;return (u=await this.getProperty("height"))!=null?u:0}async naturalWidth(){var u;return (u=await this.getProperty("naturalWidth"))!=null?u:0}async naturalHeight(){var u;return (u=await this.getProperty("naturalHeight"))!=null?u:0}async src(){return await this.getProperty("src")}async currentSrc(){return await this.getProperty("currentSrc")}async setSrc(u){await this.setProperty("src",u);}},d(W,"Image"),W);c.Image=L;let V=($=class extends C{constructor(e){super(e.uid,e.tag);p(this,"batch",new E(this));}static async create(){let e=await w.newObject("Path2D");return e?new $(e):null}addPath(e){return this.batch.invoke("addPath",e.ref),this}arc(e,i,o,h,f,k=false){return this.batch.invoke("arc",e,i,o,h,f,k),this}arcTo(e,i,o,h,f){return this.batch.invoke("arcTo",e,i,o,h,f),this}bezierCurveTo(e,i,o,h,f,k){return this.batch.invoke("bezierCurveTo",e,i,o,h,f,k),this}quadraticCurveTo(e,i,o,h){return this.batch.invoke("quadraticCurveTo",e,i,o,h),this}closePath(){return this.batch.invoke("closePath"),this}ellipse(e,i,o,h,f,k,T,N=false){return this.batch.invoke("ellipse",e,i,o,h,f,k,T,N),this}moveTo(e,i){return this.batch.invoke("moveTo",e,i),this}lineTo(e,i){return this.batch.invoke("lineTo",e,i),this}rect(e,i,o,h){return this.batch.invoke("rect",e,i,o,h),this}roundRect(e,i,o,h,f){return this.batch.invoke("roundRect",e,i,o,h,f),this}commit(e){return e?(e.accept(this.batch),Promise.resolve()):this.batch.exec()}},d($,"CanvasPath2D"),$);c.CanvasPath2D=V;let b=(G=class extends M{constructor(u){super(u);}async width(){return this.getProperty("width")}async height(){return this.getProperty("height")}async setWidth(u){this.setProperty("width",u);}async setHeight(u){this.setProperty("height",u);}async getContext(u){let e=await this.invokeAndHold("getContext",u);return e&&new x(e.uid)}static async of(u,e,i){let o=await w.query(u,e);return o?new G(o):null}},d(G,"CanvasElement"),G);c.CanvasElement=b;})(exports.ODOM||(exports.ODOM={}));var Nt=class Nt{constructor(){p(this,"callbacks",new Map);p(this,"DOM_EVENT_LISTENERS",new Map);p(this,"timers",new Map);p(this,"_config");p(this,"listeners",new Map);this.subscribe("__ouid_native_event_success__",(t,s)=>{let n=this.callbacks.get(t);if(n)return this.callbacks.delete(t),n.success(...JSON.parse(s))}),this.subscribe("__ouid_native_event_error__",(t,s)=>{let n=this.callbacks.get(t);if(n)return this.callbacks.delete(t),n.error(...JSON.parse(s))}),this.subscribe("__ouid_web_event__",(t,s)=>{let n=this.DOM_EVENT_LISTENERS.get(t),r=JSON.parse(s);if(n){let l=r[1];return l&&typeof l=="object"&&(l.target=l!=null&&l.target?new exports.ODOM.OElement(l.target):null,l.currentTarget=l!=null&&l.currentTarget?new exports.ODOM.OElement(l.currentTarget):null,l.relatedTarget=l!=null&&l.relatedTarget?new exports.ODOM.OElement(l.relatedTarget):null),n(l)}else console.error("No cb found for ",t,r[0]);});}config(t){return this._config=t,this}invoke(t,...s){let n=nt(t);return new Promise((r,l)=>{this.callbacks.set(n,{success:r,error:l});try{if(!WebOUID)throw new Error("NativeOUID bridge not available");WebOUID.invoke(n,t,JSON.stringify(s));}catch(a){console.error(a),this.callbacks.delete(n);}})}registerComponent(t,s){K.register(t,s);}unregisterComponent(t,s){K.unregister(t);}async call(t,...s){try{return (await this.invoke(`_ouid_${t}`,...s)).data}catch(n){return console.error(n),null}}emit(t,s){WebOUID==null||WebOUID.invoke("event",t,JSON.stringify(s));}subscribe(t,s){this.listeners.has(t)||(this.listeners.set(t,[]),globalThis[t]=(n,r)=>{var l;(l=this.listeners.get(t))==null||l.forEach(a=>a(n,r));}),this.listeners.get(t).push(s);}async query(t,s,n){let r=await this.call("query",t,s,n);return r?new exports.ODOM.OElement(r):null}async queryAll(t,s,n){let r=await this.call("queryAll",t,s,n);return r?r.map(l=>new exports.ODOM.OElement(l)):[]}async createElement(t,s={}){let n=await this.call("createElement",t,s);return n?new exports.ODOM.OElement(n):null}async createComment(t){let s=await this.call("createComment",t);return s?new exports.ODOM.OElement(s):null}async addEventListener(t,s,n,r){let l=nt(s+(typeof t=="string"?t:t.tag));return this.DOM_EVENT_LISTENERS.set(l,n),await w.call("attachEventListener",typeof t=="string"?t:t.uid,l,s,r==null?void 0:r.options,r==null?void 0:r.policy),l}async dettachEventListener(t){this.DOM_EVENT_LISTENERS.delete(t),await w.call("dettachEventListener",t);}async createComponentStyles(t,s=true){let n=await w.call("createComponentStyles",t,s);return n?new exports.ODOM.OElement(n):null}async appendComponentStyles(t){await w.call("appendComponentStyles",t);}async rejectComponentStyles(t){await w.call("rejectComponentStyles",t.uid);}async getOObject(t){let s=await w.call("getOObject",t);return s?new exports.ODOM.OObject(s.uid,s.tag):null}async acquireObject(t){let s=await w.call("acquireObject",t);return s?new exports.ODOM.OObject(s.uid,s.tag):null}async setTimeout(t,s){var l;let n=nt("setTimeout"+s);this.DOM_EVENT_LISTENERS.set(n,()=>{t();let a=this.timers.get(r);a&&(this.timers.delete(r),this.DOM_EVENT_LISTENERS.delete(a));});let r=(l=await w.call("setTimeout",n,s))!=null?l:-1;return r>=0&&this.timers.set(r,n),r}async clearTimeout(t){let s=this.timers.get(t);s&&(this.timers.delete(t),this.DOM_EVENT_LISTENERS.delete(s),await w.call("clearTimeout",t));}async setInterval(t,s){var l;let n=nt("setInterval"+s);this.DOM_EVENT_LISTENERS.set(n,t);let r=(l=await w.call("setInterval",n,s))!=null?l:-1;return r>=0&&this.timers.set(r,n),r}async clearInterval(t){let s=this.timers.get(t);s&&(this.timers.delete(t),this.DOM_EVENT_LISTENERS.delete(s),await w.call("clearInterval",t));}async fetch(t,s,n="json"){let r=await w.call("fetch",t,s,n);return n==="buffer"||n==="bytes"?exports.ODOM.OObject.toInstance(r):r}async alert(t){console.log("Alerting:::",t),await w.call("alert",t);}async prompt(t){await w.call("prompt",t);}async newObject(t,...s){return w.call("newObject",t,...s)}async requestAnimationFrame(t){var r;let s=nt("requestAnimationFrame");this.DOM_EVENT_LISTENERS.set(s,l=>{t(l);let a=this.timers.get(n);a&&(this.DOM_EVENT_LISTENERS.delete(a),this.timers.delete(n));});let n=(r=await w.call("requestAnimationFrame",s))!=null?r:-1;return n>=0&&this.timers.set(n,s),n}async cancelAnimationFrame(t){let s=this.timers.get(t);s&&(this.timers.delete(t),await w.call("cancelAnimationFrame",t),this.DOM_EVENT_LISTENERS.delete(s));}async batchActions(t){await w.call("batchActions",t);}nextTick(t){w.setTimeout(t,0);}};d(Nt,"OUIDBridge");var It=Nt,w=new Proxy(new It,{get:d((c,t)=>t in c?c[t]:async(...s)=>await c.call(t,...s),"get")});globalThis.OUID=w;exports.ODOM=void 0;function ae(c){return c.replace(/-([a-z])/g,(t,s)=>s.toUpperCase())}d(ae,"toCamelCase");function oe(c){return c.replace(/(?!^)([A-Z])/g,(t,s)=>`-${s.toLowerCase()}`)}d(oe,"toSnakeCase");function D(c){return xt(c)?c.value:c}d(D,"normaliseValue");function ce(c){return typeof c=="function"&&!("prototype"in c)}d(ce,"isLazyLoader");var $t=new Map,Gt=new Map,Kt=new WeakMap;function ue(c){if(!c||typeof c!="object"&&typeof c!="function")return {};let t=Kt.get(c);if(t)return t;let s=Object.create(null);for(let n=c;n&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let r of Object.getOwnPropertyNames(n)){if(r==="constructor"||r.startsWith("__")||r.endsWith("__")||r in s)continue;let l=Object.getOwnPropertyDescriptor(n,r);l&&(typeof l.value=="function"?s[r]=l.value.bind(c):l.get&&Object.defineProperty(s,r,{get:d(()=>l.get.call(c),"get"),enumerable:true}));}return Kt.set(c,s),s}d(ue,"getMethodsView");function Qt(c,t){let s=$t.get(c);return s||(s=new Function("s","with (s) { return ("+c+"); }"),$t.set(c,s)),s(t)}d(Qt,"evalInScope");function le(c){let t=Gt.get(c);if(t)return t;let s=[],n=0;for(;n<c.length;){let r=c.indexOf("{{",n);if(r<0){s.push({t:c.slice(n)});break}r>n&&s.push({t:c.slice(n,r)});let l=c.indexOf("}}",r+2),a=l>=0?c.slice(r+2,l).trim():c.slice(r+2).trim();s.push({e:a}),n=l>=0?l+2:c.length;}return t=d(r=>{let l="";for(let a of s)if(a.t!==void 0)l+=a.t;else if(a.e!==void 0){let m=D(Qt(a.e,r));l+=m==null?"":String(m);}return l},"fn"),Gt.set(c,t),t}d(le,"compileInterpolated");var Jt,B=class B{constructor(t,s,n,...r){p(this,"app");p(this,"component");p(this,"parentContext");p(this,"bindings",[]);p(this,"directives",[]);p(this,"mountedComponents",(Jt=yt(B.MOUNTED_COMPONENTS_TOKEN))!=null?Jt:new Map);p(this,"componentsRegistry",new it);p(this,"updatingDirectives",false);p(this,"updatingBindings",false);p(this,"_stack",[]);p(this,"flatStack",Object.create(null));p(this,"viewUpdates");p(this,"mountedQueue",[]);this.app=t,this.component=s,this.parentContext=n;for(let l of r)this.push(l);}get hostElement(){return this.component._hostElement}get stack(){return this._stack}set stack(t){this.flatStack=Object.create(null),this._stack=[];for(let s of t)this.push(s);}getRoot(){let t=this;for(;t.parentContext;)t=t.parentContext;return t}enqueueMounted(t){this.getRoot().mountedQueue.push(t);}async flushMounted(){let t=this.getRoot(),s=t.mountedQueue;t.mountedQueue=[];for(let n of s)try{n();}catch(r){console.error("onMounted error:",r);}}getMountedComponent(t){return this.mountedComponents.get(t.uid)}bind(t){this.bindings.push(t);}directive(t){this.directives.push(t);}evaluateExpression(t){return this.resolve(t)}resolveScope(...t){var r;let s=(r=this.component)!=null?r:{},n=ue(s);return new Proxy(Object.create(null),{get:d((l,a)=>{for(let m=t.length-1;m>=0;m--)if(a in t[m])return D(t[m][a]);return a in this.flatStack?D(this.flatStack[a]):a in n?D(n[a]):D(s[a])},"get"),set:d((l,a,m)=>{let g;for(let v=t.length-1;v>=0;v--)if(a in t[v]){g=t[v][a];break}return g===void 0&&(a in this.flatStack?g=this.flatStack[a]:a in n?g=n[a]:g=s[a]),g!==void 0&&xt(g)?(g.value=m,true):false},"set"),has:d((l,a)=>t.some(m=>a in m)||a in this.flatStack||a in n||a in s,"has")})}resolve(t,...s){if(!t)return;let n=this.resolveScope(...s);try{return Qt(t,n)}catch(r){return}}updateValue(t,s){this.resolve(`${t}=__o_model_value__`,{__o_model_value__:s});}push(t){this._stack.unshift(t),Object.assign(this.flatStack,t);}pop(){let t=this._stack.shift();if(t)for(let s of Object.keys(t))delete this.flatStack[s];}resolveTag(t){var n;let s=this;for(;;){if(s.componentsRegistry.has(t))return s.componentsRegistry.get(t);if(s=(n=s==null?void 0:s.parentContext)!=null?n:null,!s)break}return K.get(t)}async updateBindings(){if(!this.updatingBindings){this.updatingBindings=true;for(let t of this.bindings)this.updateBinding(t);this.updatingBindings=false;}}updateBinding(t){if(t.type==="model"){t.node.setProperty("value",D(t.context.resolve(t.key)));return}if(t.type==="interpolation"){let s=t.templateFn(t.context.resolveScope());this.viewUpdates.add("setContentText",t.node,s);return}if(t.type==="attribute"){let s=t.key,n=D(this.resolve(t.template));s==="class"?this.expandClass(t.node,n):s==="style"?this.expandStyle(t.node,n):typeof n!="object"&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="undefined"&&this.viewUpdates.add("setAttribute",t.node,s,n.toString());return}if(t.type==="prop"&&t.context.component){let s=D(this.resolve(t.template));try{t.context.component.props[t.key]=s,Promise.all([t.context.updateBindings(),t.context.updateDirectives()]).then(()=>{t.context.viewUpdates.exec();});}catch(n){console.error(n);}return}}async updateDirectives(){var n,r,l;if(this.updatingDirectives)return;let t=new exports.ODOM.BatchActions;this.updatingDirectives=true;for(let a of this.directives){if(a.type==="if"){if(!D(a.context.evaluateExpression(a.expr))){if(a.active===false)continue;a.active=false,a.renderedNode&&(a.destroy?this.unmountComponent(a.renderedNode):this.viewUpdates.add("addClass",a.renderedNode,"oui-hidden"));continue}if(a.active===true)continue;a.active=true;let g=a.renderedNode;if(!g||a.destroy){let v=await a.node.cloneNode(true);a.renderedNode=v,await a.context.render(v),this.viewUpdates.add("after",a.placeholder,v);}else this.viewUpdates.add("removeClass",g,"oui-hidden");}if(a.type==="for"){let m=(n=a.children)!=null?n:new Map,g=new Map,v=d((P,x)=>a.key?D(a.context.resolve(a.key,{[a.item]:P})):x,"keyFn"),E=D(a.context.resolve(a.list))||[],C=new exports.ODOM.BatchActions,U=32,M=0,_=a.placeholder;for(let P=0;P<E.length;P++){let x=E[P];console.log("val:::",x);let L=v(x,P),V=m.get(L),b,y,A=_;if(V){b=V.node,y=V.ctx,y.stack=[{[a.item]:x},...a.context.stack];let S=await _.nextSibling();b.uid!==(S==null?void 0:S.uid)&&C.add(()=>A.after(b)),(r=y.__renderRunner__)==null||r.call(y),await Promise.all([y.updateBindings(),y.updateDirectives()]);}else {if(y=new B(this.app,this.component,this),y.viewUpdates=this.viewUpdates,y.stack=[{[a.item]:x},...a.context.stack],b=await a.node.cloneNode(true),C.add(async()=>{await A.after(b);}),await y.render(b),await y.updateDirectives(),!y.__renderRunner__){let j=at(()=>{y.collectDepsForBindingsAndDirectives();},{lazy:true,scheduler:d(()=>{H(async()=>{var F;if((F=y.__renderRunner__)==null||F.call(y),!y.__updating){y.__updating=true;try{await Promise.all([y.updateBindings(),y.updateDirectives()]),await y.viewUpdates.exec(),await y.flushMounted();}finally{y.__updating=false;}}});},"scheduler")});y.__renderRunner__=j,j();let q=y.component;q.effects=(l=q.effects)!=null?l:[],q.effects.push(()=>j.effect.stop());}y.__renderRunner__();}_=b,g.set(L,{node:b,ctx:y}),++M>=U&&(M=0,await C.commit(),await H());}let O=[];for(let[P,x]of m.entries())g.has(P)||O.push(this.unmountComponent(x.node));await Promise.all(O),await C.commit(),a.children=g;}}await t.commit(),this.updatingDirectives=false;}async render(t,s){if(t.hydrated||s!=null&&s.skipSlotted&&t.hasAttribute("slotted"))return;switch(t.type){case "Text":this.handleTextNode(t);break;case "Element":await this.handleElementNode(t,s);break;}let n=new exports.ODOM.BatchActions;await Promise.all([this.updateBindings(),this.updateDirectives()]),n.commit(),this.viewUpdates.add("addClass",t,"hydrated");}async expandClass(t,s){let n;typeof s=="object"?Array.isArray(s)?n=s:n=Object.keys(s).filter(r=>s[r]):n=s.toString().split(/\s+/),n.length>0&&this.viewUpdates.add("addClass",t,...n);}expandStyle(t,s){let n=s;typeof s=="object"&&!Array.isArray(s)&&(n=Object.keys(s).filter(r=>s[r]).map(r=>`${oe(r)}: ${s[r]}`).join(";")),n&&this.viewUpdates.add("setAttribute",t,"style",n);}expandStandardAttributes(t){[...t.attributes].filter(s=>s.name.startsWith(":")).forEach(s=>{let n=s.name.substring(1);this.bind({type:"attribute",node:t,key:n,context:this,template:s.value.trim()}),this.viewUpdates.add("removeAttribute",t,s.name);});}setRefValue(t,s){let n=t.trim();this.updateValue(n,s);}async handleElementNode(t,s){var _;let n=await t.parentNode(),r=null,l=t.hasAttribute("o-if")?"o-if":t.hasAttribute("o-show")?"o-show":null;if(l){let O=await t.getAttribute(l),P=await OUID.createComment(l+":"+O),x=l==="o-if";await n.insertBefore(t,P),await t.updates().removeAttribute(l).remove().exec(),this.directive({type:"if",expr:O,node:t,placeholder:P,context:this,active:void 0,destroy:x}),r="if";return}if(t.hasAttribute("o-for")){if(r==="if")throw new Error("Can't have o-if and o-for on the same component");let O=await t.getAttribute("o-for"),[P,x]=O.split(" of ").map(b=>b.trim()),L=await OUID.createComment("for:"+O),V=(_=t.attribute(":key"))!=null?_:"";await(n==null?void 0:n.insertBefore(t,L)),await t.updates().removeAttribute("o-for").removeAttribute(":key").remove().exec(),this.directive({type:"for",item:P,list:x,node:t,placeholder:L,context:this,key:V}),r="for";return}let a=t.tag.toLowerCase(),m=this.resolveTag(a),g=t.updates();[...t.attributes].forEach(async O=>{if(O.name==="o-model"){let P=O.value.trim();g.setInputValue(D(this.resolve(P))).addEventListener("input",async L=>{let V=await L.target.getProperty("value");this.updateValue(P,V);}),this.bind({node:t,key:P,type:"model",context:this}),g.removeAttribute(O.name);}else O.name==="ref"&&(m||this.setRefValue(O.value,t));});let v={},E={},{props:C,events:U}=this.componentAttributes(t,this);if(v=C,E=U,this.expandStandardAttributes(t),Object.keys(E).forEach(async O=>{let P=E[O];m||g.addEventListener(O,x=>{typeof P=="function"&&P.apply(this.component,[x]);}),g.removeAttribute("@"+O);}),this.viewUpdates.accept(g),m){await this.mountComponent(t,m,this,v,E);return}let M=await t.childNodes();s!=null&&s.skipSlotted&&(M=M.filter(O=>!O.hasAttribute("slotted")));for(let O of M)await this.render(O,s);}handleTextNode(t){var n;let s=(n=t.textContent)!=null?n:"";s.includes("{{")&&this.bind({type:"interpolation",node:t,key:"__template__",templateFn:le(s),context:this});}collectDepsForBindingsAndDirectives(){for(let t of this.bindings)t.type==="model"?D(this.resolve(t.key)):t.type==="interpolation"?t.templateFn(this.resolveScope()):t.type==="attribute"?D(this.resolve(t.template)):t.type==="prop"&&D(this.resolve(t.template));for(let t of this.directives)t.type==="if"?D(t.context.evaluateExpression(t.expr)):t.type==="for"&&(D(t.context.resolve(t.list)),t.key);}componentAttributes(t,s){let n={},r={},l=["import","interface","module","o-model","o-if","o-for"];return [...t.attributes].filter(a=>!l.includes(a.name)).forEach(a=>{let m=a.name;if(m.startsWith("@")){let E=s==null?void 0:s.resolve(a.value);if(typeof E!="function")throw new Error("Event handler can only be function");m=m.substring(1),r[m]=E;return}let g=null,v=a.value;m.startsWith(":")&&(g=a.value,m=m.substring(1),v=D(s==null?void 0:s.resolve(a.value))),m=ae(m),n[m]={name:m,value:v,expr:g};}),{props:n,events:r}}async mountComponent(t,s,n,r={},l={}){var M,_,O,P,x,V;if(this.viewUpdates=(_=(M=this.viewUpdates)!=null?M:n==null?void 0:n.viewUpdates)!=null?_:new exports.ODOM.BatchUpdates(t),this.mountedComponents.has(t.uid))return this.mountedComponents.get(t.uid);let a=new B(this.app,{},this);a.viewUpdates=this.viewUpdates;let m={},g;for(let b of Object.keys(r)){let y=r[b];if(y.name==="ref"&&!y.expr){g=y;continue}y.expr&&this.bind({type:"prop",node:t,key:b,context:a,template:y.expr}),m[b]=y.value;}let v=await he(s,m,l);a.component=v,a.stack=[],this.mountedComponents.set(t.uid,v),g&&this.setRefValue(g.value,v);{let b=t.updates();for(let A of Object.keys(r))r[A].expr||b.setAttribute(A,r[A].value);let y=(O=v.hostClasses)!=null?O:[];y&&(y=typeof y=="string"?[y]:y),y.push("o-component-host"),t.tag.toLowerCase()!=="div"&&y.push("c-"+t.tag.toLowerCase()),b.addClass(...y),this.viewUpdates.accept(b);}H(async()=>{try{await v.decorateHostElement(t);}catch(b){}});{let b=(P=v.use)!=null?P:{};for(let y of Object.keys(b))a.componentsRegistry.register(y,b[y]);}if(v.willMount(),!s.cssInstance){let b=v.style?(x=v.style())==null?void 0:x.toString():v.css;b&&((s.cssInstance)!=null||(s.cssInstance=await OUID.createComponentStyles(b,false)));}H(()=>{var y;let b=s.cssInstance;if(b){let A=(y=B.STYLE_REF.get(b))!=null?y:0;A===0&&OUID.appendComponentStyles(b.uid),B.STYLE_REF.set(b,A+1),v.cssInstance=b;}});let E=await t.childNodes();if(v.render){let b=await v.render(a);b&&b.attachTo(t);}else await t.setHTML(v.template.trim());let C=await t.queryAll("slot");C&&C.length&&await Promise.all(C.filter(b=>{var y;return !((y=b.classes)!=null&&y.includes("hydrated"))}).map(async b=>{let y=b.attribute("name"),A=E.filter(S=>y?S.type==="Element"&&S.attribute("slot")===y:S.type!=="Element"||!S.hasAttribute("slot"));if(A.length){for(let S of A)this.viewUpdates.add("setAttribute",S,"slotted","true"),this.viewUpdates.add("appendChild",b,S);await this.viewUpdates.exec(),await Promise.all(A.map(S=>this.render(S)));}})),v._hostElement=t,v.parent=(V=n==null?void 0:n.component)!=null?V:void 0,v.provide(B.PROVIDE_TOKEN,this);{let b=await t.childNodes(),y=6,A=0;for(;A<b.length;){let S=b.slice(A,A+y);await Promise.all(S.map(j=>a.render(j,{skipSlotted:true}))),A+=y;}}a.viewUpdates.add("addClass",t,"hydrated"),this.enqueueMounted(()=>{try{v.onMounted();}catch(b){}}),await a.viewUpdates.exec();let U=at(()=>{a.collectDepsForBindingsAndDirectives(),console.log("Effect running!!!!");},{lazy:true,scheduler:d(()=>{console.log("Effect schedulling!!!!"),H(async()=>{if(!a.__updating){a.__updating=true;try{await Promise.all([a.updateBindings(),a.updateDirectives()]),await a.viewUpdates.exec(),await a.flushMounted();}finally{a.__updating=false;}}});},"scheduler")});return U(),v.__effects__=[()=>U.effect.stop()],v}async unmountComponent(t){var r,l;let s=this.mountedComponents.get(t.uid);if(await t.removeAndRelease(),s){let a=s.cssInstance;if(a){let g=(r=B.STYLE_REF.get(a))!=null?r:1;g===1?(await OUID.rejectComponentStyles(a),B.STYLE_REF.delete(a)):B.STYLE_REF.set(a,g-1);}s.willUnmount();let m=s.__effects__;m==null||m.forEach(g=>{try{g();}catch(v){}}),s.effects=void 0,s._hostElement=null,s.cssInstance=null;}let n=(l=await t.queryAll("*"))!=null?l:[];for(let a of n)await this.unmountComponent(a);this.mountedComponents.delete(t.uid),t.hasAttribute("ref")&&this.setRefValue(t.attribute("ref"),null);}};d(B,"RenderContext"),p(B,"PROVIDE_TOKEN","RENDER_CONTEXT"),p(B,"MOUNTED_COMPONENTS_TOKEN","RENDER_CONTEXT_MOUNTED_COMPONENTS"),p(B,"STYLE_REF",new WeakMap);var J=B;async function Ke(c,t,s=[],n){let r=t!=null?t:{},l=await OUID.createElement(c,Object.keys(r).reduce((a,m)=>(a[m]=r[m],a),{}));return Object.keys(n!=null?n:{}).forEach(a=>{l==null||l.addEventListener(a,m=>{let g=n[a];typeof g=="function"&&g(m);});}),new et(l,s)}d(Ke,"node");function he(c,t,s){return ce(c)?c().then(n=>Pt(n.default,t,s)):Pt(c,t,s)}d(he,"o");function de(c){return typeof c=="function"}d(de,"isProvideFunction");var ct=class ct{constructor(t,s){p(this,"root");p(this,"options");p(this,"providers",new Map);this.root=t,this.options=s,ct.currentApp=this;}provide(t,s){if(this.providers.has(t)){console.warn(`[OUID] - Provider ${t} already exists`);return}this.providers.set(t,de(s)?{provide:s}:{value:s});}inject(t){var s;return (s=this.providers.get(t))==null?void 0:s.value}use(t,s){return t.install(this,s),this}async mount(t){var r;if(!globalThis.__OUI_PUR_JS_CONTEXT__)return;(r=this.options)!=null&&r.css&&await OUID.createComponentStyles(this.options.css),await OUID.createComponentStyles(`
5
+ `);}return t}static of(t,...s){return new ut(t,s.join(`
6
+ `))}};d(ut,"StyleData");var vt=ut;function It(o,t,s){return new o(t,s)}d(It,"createComponent");var Nt=class Nt{constructor(t={},s={}){p(this,"state");p(this,"parent");p(this,"emits");p(this,"props");p(this,"provides",new Map);this.state=new yt({}),this.props=t,this.emits=new ft(s);}onActivated(){}onDeactivated(){}onMounted(){}willMount(){}willUnmount(){}provide(t,s){this.provides.set(t,s);}inject(t){let s=this;for(;s;){if(s.provides.has(t))return s.provides.get(t);s=s.parent;}}decorateHostElement(t){return Promise.resolve()}};d(Nt,"OComponent");var st=Nt;function nt(o){let t=Date.now();return `${(1e3+Math.floor(Math.random()*9e3)+o.length).toString(16)}-${t.toString(16)}`}d(nt,"generateUIID");function Rt(o){return new Promise(t=>setTimeout(t,o))}d(Rt,"delay");var ue=typeof globalThis.queueMicrotask=="function",H=d(o=>o?ue?queueMicrotask(o):Promise.resolve().then(o):Promise.resolve(),"deferMicro");(function(o){var w,P,T,_,N,F,R,Q,z,$,W,G;let t=(w=class{constructor(){p(this,"actions",[]);}async exec(){await this.commit();}add(u){return this.actions.push(u),this}async commit(){let u=this.actions;this.actions=[],await Promise.all(u.map(async e=>await e()));}},d(w,"BatchActions"),w);o.BatchActions=t;let s=new Set(["invoke","dispatchEvent","setProperty"]),n=[],r=new Map,l=false,a=null;function m(){if(l)return;l=true;let Y=d(()=>{l=false,g();},"runner");setTimeout(()=>Y(),0);}d(m,"scheduleBatchFlush");async function g(){let Y=n;n=[],r.clear();let u=a;a=null;try{Y.length&&await y.batchActions(Y),u==null||u.resolve();}catch(e){u==null||u.reject(e);}}d(g,"flushBatchQueue");function v(Y){for(let u of Y){if(s.has(u.fn)){n.push(u);continue}let e=`${u.fn}|${u.args.map(c=>typeof c=="object"?JSON.stringify(c):String(c)).join("|")}`,i=r.get(e);i!==void 0?n[i]=u:(r.set(e,n.length),n.push(u));}if(!a){let u,e,i=new Promise((c,h)=>{u=c,e=h;});return a={resolve:u,reject:e},m(),i}return m(),new Promise((u,e)=>{let i=a;a={resolve:d(()=>{i==null||i.resolve(),u();},"resolve"),reject:d(c=>{i==null||i.reject(c),e(c);},"reject")};})}d(v,"enqueueBatchActions");let S=(P=class{constructor(u){p(this,"node");p(this,"operations",[]);this.node=u;}accept(u){this.operations.push(...u.operations),u.operations=[];}async exec(u=false){let e=this.operations;this.operations=[];let i=[],c=e.map(h=>typeof h=="object"?(i.push({fn:h.fn,args:[h.node.uid,...h.args.map(f=>f instanceof C?f.uid:f)]}),null):h()).filter(h=>h!=null);if(i.length>0){let h={},f=[];i.forEach(k=>{let O=`${k.fn}.${k.args.map(j=>j==null?void 0:j.toString()).join(",")}`;h[O]&&!["invoke","setProperty","dispatchEvent"].includes(k.fn)||(h[O]=k,f.push(k));}),u?c.unshift(y.batchActions(f)):c.unshift(v(f));}try{await Promise.all(c);}catch(h){console.error("Error while batch updates");}}append(u,...e){return this.operations.push({fn:u,args:e,node:this.node}),this}add(u,e,...i){return typeof u=="function"?this.operations.push(u):this.operations.push({fn:u,args:i,node:e}),this}addEventListener(u,e,i,c){return this.add(()=>{this.node.addEventListener(u,e,{options:i,policy:c});})}setProperty(u,e){return this.append("setProperty",u,e)}dettachEventListener(u){return this.append("dettachEventListener",u)}invoke(u,...e){return this.append("invoke",u,...e.map(i=>i instanceof C?i.ref:i))}dispatchEvent(u,e,i){return this.append("dispatchEvent",u,e,i)}addClass(...u){return this.append("addClass",...u)}removeClass(...u){return this.append("removeClass",...u)}setAttribute(u,e){return this.append("setAttribute",u,e)}removeAttribute(u){return this.append("removeAttribute",u)}appendChild(u){return this.append("appendChild",u.uid)}removeChild(u){return this.append("removeChild",u.uid)}remove(){return this.append("remove")}removeAndRelease(){return this.append("remove").append("release")}release(){return this.append("release")}innerHTML(u){return this.append("setHTML",u)}replaceChildNode(u,e){return this.append("replaceChildNode",u,e)}replaceWith(u){return this.append("replaceWith",u.uid)}after(u){return this.append("after",u.uid)}setInnerText(u){return this.append("setInnerText",u)}setContentText(u){return this.append("setContentText",u)}insertBefore(u,e){return this.append("insertBefore",u.uid,e.uid)}setInputValue(u){return this.append("setInputValue",u)}setStyle(u,e){return this.append("setStyle",u,e)}},d(P,"BatchUpdates"),P);o.BatchUpdates=S;let C=(T=class{constructor(u,e){p(this,"uid");p(this,"tag");this.uid=u,this.tag=e;}static toInstance(u){return new T(u.uid,u.tag)}async release(){await y.call("releaseNode",this.uid);}async addEventListener(u,e,i){return y.addEventListener(this,u,e,{options:i==null?void 0:i.options,policy:i==null?void 0:i.policy})}async dettachEventListener(u){await y.dettachEventListener(u);}async invoke(u,...e){return await y.call("invokeObjectMethod",this.uid,u,...e)}async invokeAndHold(u,...e){let i=await y.call("invokeObjectMethodAndHold",this.uid,u,...e);return i&&new T(i.uid,i.tag)}async getProperty(u){return await y.call("getObjectProperty",this.uid,u)}async getPropertyAndHold(u){let e=await y.call("getObjectPropertyAndHold",this.uid,u);return e&&new T(e.uid,e.tag)}async setProperty(u,e){await y.call("setObjectProperty",this.uid,u,e);}async dispatchEvent(u,e,i){await y.call("dispatchEvent",this.uid,u,e,i);}updates(){return new S(this)}batches(){return new S(this)}get ref(){return {__ref__:this.uid}}},d(T,"OObject"),T);o.OObject=C;let B=(_=class extends C{constructor(e){super(e.uid,e.tag);p(this,"textContent");p(this,"type","Unknown");p(this,"attributes");p(this,"children");p(this,"classes");p(this,"style");for(let f in e)this[f]=e[f];(this.attributes)!=null||(this.attributes=[]),(this.classes)!=null||(this.classes=[]),(this.style)!=null||(this.style="");}},d(_,"ONode"),_);o.ONode=B;let V=(N=class extends B{constructor(e){super(e);p(this,"_hydrated",false);}async addClass(...e){await y.call("addClass",this.uid,...e);}async removeClass(...e){await y.call("removeClass",this.uid,...e);}async setAttribute(e,i){let c=await y.call("setAttribute",this.uid,e,i);c&&(this.attributes=c);}async removeAttribute(e){let i=await y.call("removeAttribute",this.uid,e);i&&(this.attributes=i);}async appendChild(e){await y.call("appendChild",this.uid,e.uid);}set innerHTML(e){this.setHTML(e);}async cloneNode(e){let i=await y.call("cloneNode",this.uid,e);return i?new N(i):null}async remove(){await y.call("removeNode",this.uid);}async removeAndRelease(){await this.remove(),await this.release();}async removeChild(e){await y.call("removeChild",this.uid,e.uid);}async replaceChildNode(e,i){await y.call("replaceChildNode",this.uid,e.uid,i.uid);}async replaceWith(e){await y.call("replaceWith",this.uid,e.uid);}async after(e){await y.call("insertAfter",this.uid,e.uid);}async setHTML(e){await y.call("setInnerHTML",this.uid,e);}async HTML(){var e;return (e=await y.call("getInnerHTML",this.uid))!=null?e:""}async setInnerText(e){await y.call("setInnerText",this.uid,e);}async setContentText(e){await y.call("setContentText",this.uid,e);}async getContentText(){var e;return (e=await y.call("getContentText",this.uid))!=null?e:""}async content(){var e;try{return (e=await y.call("getInnerText",this.uid))!=null?e:""}catch(i){return console.error(i),""}}async childNodes(){var e,i;return (i=(e=await y.call("childNodes",this.uid))==null?void 0:e.map(c=>new N(c)))!=null?i:[]}hasAttribute(e){return !!this.attributes.find(i=>i.name===e)}async getAttribute(e){var i;return (i=await y.call("getAttribte",this.uid,e))!=null?i:""}attribute(e){var i,c;return (c=(i=this.attributes.find(h=>h.name===e))==null?void 0:i.value)!=null?c:null}async nextSibling(){let e=await y.call("nextSibling",this.uid);return e?new N(e):null}async getAttributeNames(){var e;return (e=await y.call("getAttributeNames",this.uid))!=null?e:[]}async parentNode(){let e=await y.call("parentNode",this.uid);return e?new N(e):null}async insertBefore(e,i){await y.call("insertBefore",this.uid,e.uid,i.uid);}async setInputValue(e){await y.call("setInputValue",this.uid,e);}async inputValue(){var e;return (e=await y.call("inputValue",this.uid))!=null?e:""}get hydrated(){return this._hydrated}hydrate(){this._hydrated=true,this.addClass("hydrated");}async query(e,i){return await y.query(e,i,this.uid)}async queryAll(e,i){return await y.queryAll(e,i,this.uid)}async setStyle(e,i){await y.call("setStyle",this.uid,e,i);}},d(N,"OElement"),N);o.OElement=V;let D=(F=class extends C{constructor(u){super(u.uid,u.tag);}addColorStop(u,e){return this.invoke("addColorStop",u,e),this}},d(F,"CanvasGradient"),F);o.CanvasGradient=D;let E=(R=class extends C{constructor(e){super(e.uid,e.tag);p(this,"batch",new S(this));}static async new(e){let i=typeof e!="undefined"?await y.newObject("DOMMatrix",e):await y.newObject("DOMMatrix");return i?new R(i):null}invertSelf(){return this.batch.invoke("invertSelf"),this}multiplySelf(e){return this.batch.invoke("multiplySelf",...e?[e.ref]:[]),this}premultiplySelf(e){return this.batch.invoke("premultiplySelf",...e?[e.ref]:[]),this}rotateAxisAngleSelf(e,i,c,h){let f=[];return e&&f.push(e),i&&f.push(i),c&&f.push(c),h&&f.push(h),this.batch.invoke("rotateAxisAngleSelf",...f),this}rotateFromVectorSelf(e,i){let c=[];return e&&c.push(e),i&&c.push(i),this.batch.invoke("rotateFromVectorSelf",...c),this}rotateSelf(e,i,c){let h=[];return e&&h.push(e),i&&h.push(i),c&&h.push(c),this.batch.invoke("rotateFromVectorSelf",...h),this}scale3dSelf(e,i,c,h){let f=[];return e&&f.push(e),i&&f.push(i),c&&f.push(c),h&&f.push(h),this.batch.invoke("scale3dSelf",...f),this}scaleSelf(e,i,c,h,f,k){let O=[];return e&&O.push(e),i&&O.push(i),c&&O.push(c),h&&O.push(h),f&&O.push(f),k&&O.push(k),this.batch.invoke("scaleSelf",...O),this}setMatrixValue(e){return this.invoke("setMatrixValue",e),this}skewXSelf(e){return this.batch.invoke("skewXSelf",e),this}skewYSelf(e){return this.batch.invoke("skewYSelf",e),this}translateSelf(e,i,c){return this.batch.invoke("translateSelf",e,i,...c?[c]:[]),this}async commit(){await this.batch.exec();}async is2D(){var e;return (e=await this.invoke("is2D"))!=null?e:false}async isIdentity(){var e;return (e=await this.invoke("isIdentity"))!=null?e:false}async flipX(){let e=await this.invokeAndHold("flipX");return e?new R(e):null}async flipY(){let e=await this.invokeAndHold("flipY");return e?new R(e):null}async inverse(){let e=await this.invokeAndHold("inverse");return e?new R(e):null}async multiply(e){let i=await this.invokeAndHold("multiply",...e?[e.ref]:[]);return i?new R(i):null}async rotate(e,i,c){let h=[];e&&h.push(e),i&&h.push(i),c&&h.push(c);let f=await this.invokeAndHold("rotate",...h);return f?new R(f):null}async rotateAxisAngle(e,i,c,h){let f=[];e&&f.push(e),i&&f.push(i),c&&f.push(c),h&&f.push(h);let k=await this.invokeAndHold("rotateAxisAngle",...f);return k?new R(k):null}async rotateFromVector(e,i){let c=[];e&&c.push(e),i&&c.push(i);let h=await this.invokeAndHold("rotateFromVector",...c);return h?new R(h):null}async scale(e,i,c,h,f,k){let O=[];e&&O.push(e),i&&O.push(i),c&&O.push(c),h&&O.push(h),f&&O.push(f),k&&O.push(k);let j=await this.invokeAndHold("scale",...O);return j?new R(j):null}async scale3d(e,i,c,h){let f=[];e&&f.push(e),i&&f.push(i),c&&f.push(c),h&&f.push(h);let k=await this.invokeAndHold("scale",...f);return k?new R(k):null}async skewX(e){let i=[];e&&i.push(e);let c=await this.invokeAndHold("skewX",...i);return c?new R(c):null}async skewY(e){let i=[];e&&i.push(e);let c=await this.invokeAndHold("skewY",...i);return c?new R(c):null}toJSON(){return this.invoke("toJSON")}async toString(){return this.invoke("toString")}async translate(e,i,c){let h=[];e&&h.push(e),i&&h.push(i),c&&h.push(c);let f=await this.invokeAndHold("translate",...h);return f?new R(f):null}},d(R,"DOMMatrix"),R);o.DOMMatrix=E;let x=(Q=class extends C{constructor(u){super(u.uid,u.tag);}async setTransform(u){await this.invoke("setTransform",u.ref);}},d(Q,"CanvasPattern"),Q);o.CanvasPattern=x;let A=(z=class extends C{constructor(e){super(e,"unknown");p(this,"batch",new S(this));}arc(e,i,c,h,f,k=false){return this.batch.invoke("arc",e,i,c,h,f,k),this}arcTo(e,i,c,h,f){return this.batch.invoke("arcTo",e,i,c,h,f),this}bezierCurveTo(e,i,c,h,f,k){return this.batch.invoke("bezierCurveTo",e,i,c,h,f,k),this}clearRect(e,i,c,h){return this.batch.invoke("clearRect",e,i,c,h),this}clip(e,i){let c=[];return typeof e=="string"?c.push(e):e instanceof U&&(e.commit(this.batch),c.push(e.ref)),typeof i=="string"&&c.push(i),this.batch.invoke("clip",...c),this}beginPath(){return this.batch.invoke("beginPath"),this}closePath(){return this.batch.invoke("closePath"),this}async createConicGradient(e,i,c){let h=await this.invokeAndHold("createConicGradient",e,i,c);return h?new D(h):null}async createLinearGradient(e,i,c,h){let f=await this.invokeAndHold("createLinearGradient",e,i,c,h);return f?new D(f):null}async createPattern(e,i=""){let c=await this.invokeAndHold("createPattern",e.ref,i);return c?new x(c):null}async createRadialGradient(e,i,c,h,f,k){let O=await this.invokeAndHold("createRadialGradient",e,i,c,h,f,k);return O?new D(O):null}drawImage(e,i,c,h,f,k,O,j,se){let X=[e.ref];return typeof k=="undefined"?(X.push(i,c),h&&X.push(h),f&&X.push(f),this.batch.invoke("drawImage",...X),this):(X.push(i,c,h,f,k,O,j,se),this.batch.invoke("drawImage",...X),this)}ellipse(e,i,c,h,f,k,O,j=false){return this.batch.invoke("ellipse",e,i,c,h,f,k,O,j),this}fill(e,i){let c=[];return e&&c.push(typeof e=="string"?e:(e.commit(this.batch),e.ref)),i&&c.push(i),this.batch.invoke("fill",...c),this}fillRect(e,i,c,h){return this.batch.invoke("fillRect",e,i,c,h),this}fillText(e,i,c,h){return this.batch.invoke("fillText",e,i,c,...h?[h]:[]),this}getImageData(e,i,c,h,f){return this.invokeAndHold("getImageData",e,i,c,h,...f?[f]:[])}getLineDash(){return this.invoke("getLineDash")}async getTransform(){let e=await this.invokeAndHold("getTransform");return e?new E(e):null}async isContextLost(){return await this.invoke("isContextLost")}async isPointInPath(e,i,c,h){let f=[];return typeof e=="number"?(f.push(e,i),c&&f.push(c)):(await e.commit(this.batch),f.push(e.ref,i,c),h&&f.push(h)),await this.invoke("isPointInPath",...f)}async isPointInStroke(e,i,c){var f;let h=[];return typeof e=="number"?h.push(e,i):(await e.commit(),h.push(e.ref,i,c)),(f=await this.invoke("isPointInStroke",...h))!=null?f:false}lineTo(e,i){return this.batch.invoke("lineTo",e,i),this}async measureText(e){var i;return (i=await this.invoke("measureText",e))!=null?i:0}moveTo(e,i){return this.batch.invoke("moveTo",e,i),this}putImageData(e,i,c,h,f,k,O){let j=[e.ref,i,c];return h&&j.push(h),f&&j.push(f),k&&j.push(k),O&&j.push(O),this.batch.invoke("putImageData",...j),this}quadraticCurveTo(e,i,c,h){return this.batch.invoke("quadraticCurveTo",e,i,c,h),this}rect(e,i,c,h){return this.batch.invoke("rect",e,i,c,h),this}reset(){this.invoke("reset");}resetTransform(){this.invoke("resetTransform");}restore(){return this.batch.invoke("restore")}rotate(e){return this.batch.invoke("rotate",e),this}roundRect(e,i,c,h,f){return this.batch.invoke("roundRect",e,i,c,h,f),this}save(){return this.batch.invoke("save")}scale(e,i){return this.batch.invoke("scale",e,i),this}setLineDash(e){return this.invoke("setLineDash",e)}setTransform(e,i,c,h,f,k){typeof e=="number"?this.batch.invoke("setTransform",e,i,c,h,f,k):this.batch.invoke("setTransform",e.ref);}stroke(e){return this.batch.invoke("stroke",...e?[(e.commit(this.batch),e.ref)]:[]),this}strokeRect(e,i,c,h){return this.batch.invoke("strokeRect",e,i,c,h),this}strokeText(e,i,c,h){return this.batch.invoke("strokeText",e,i,c,...h?[h]:[]),this}transform(e,i,c,h,f,k){return this.batch.invoke("transform",e,i,c,h,f,k),this}translate(e,i){return this.batch.invoke("translate",e,i),this}set fillStyle(e){this.setFillStyle(e);}setFillStyle(e){return this.batch.setProperty("fillStyle",typeof e=="string"?e:e instanceof C?e.ref:e),this}set filter(e){this.setFilter(e);}setFilter(e){return this.batch.setProperty("filter",e),this}set font(e){this.setFont(e);}setFont(e){return this.batch.setProperty("font",e),this}set fontKerning(e){this.setFontKerning(e);}setFontKerning(e){return this.batch.setProperty("fontKerning",e),this}set fontStretch(e){this.setFontStretch(e);}setFontStretch(e){return this.batch.setProperty("fontStretch",e),this}set fontVariantCaps(e){this.setFontVariantCaps(e);}setFontVariantCaps(e){return this.batch.setProperty("fontVariantCaps",e),this}set globalAlpha(e){this.setGlobalAlpha(e);}setGlobalAlpha(e){return this.batch.setProperty("globalAlpha",e),this}set globalCompositeOperation(e){this.setGlobalCompositeOperation(e);}setGlobalCompositeOperation(e){return this.batch.setProperty("globalCompositeOperation",e),this}set imageSmoothingEnabled(e){this.setImageSmoothingEnabled(e);}setImageSmoothingEnabled(e){return this.batch.setProperty("imageSmoothingEnabled",e),this}set imageSmoothingQuality(e){this.setImageSmoothingQuality(e);}setImageSmoothingQuality(e){return this.batch.setProperty("imageSmoothingQuality",e),this}set letterSpacing(e){this.setLetterSpacing(e);}setLetterSpacing(e){return this.batch.setProperty("letterSpacing",e),this}set lineCap(e){this.setLineCap(e);}setLineCap(e){return this.batch.setProperty("lineCap",e),this}set lineDashOffset(e){this.setLineDashOffset(e);}setLineDashOffset(e){return this.batch.setProperty("lineDashOffset",e),this}set lineJoin(e){this.setLineJoin(e);}setLineJoin(e){return this.batch.setProperty("lineJoin",e),this}set lineWidth(e){this.setLineWidth(e);}setLineWidth(e){return this.batch.setProperty("lineWidth",e),this}set miterLimit(e){this.setMiterLimit(e);}setMiterLimit(e){return this.batch.setProperty("miterLimit",e),this}set shadowBlur(e){this.setShadowBlur(e);}setShadowBlur(e){return this.batch.setProperty("shadowBlur",e),this}set shadowColor(e){this.setShadowColor(e);}setShadowColor(e){return this.batch.setProperty("shadowColor",e),this}set shadowOffsetX(e){this.setShadowOffsetX(e);}setShadowOffsetX(e){return this.batch.setProperty("shadowOffsetX",e),this}set shadowOffsetY(e){this.setShadowOffsetY(e);}setShadowOffsetY(e){return this.batch.setProperty("shadowOffsetY",e),this}set strokeStyle(e){this.setStrokeStyle(e);}setStrokeStyle(e){return this.batch.setProperty("strokeStyle",typeof e=="string"?e:e instanceof C?e.ref:e),this}set textAlign(e){this.setTextAlign(e);}setTextAlign(e){return this.batch.setProperty("textAlign",e),this}set textBaseline(e){this.setTextBaseline(e);}setTextBaseline(e){return this.batch.setProperty("textBaseline",e),this}set wordSpacing(e){this.setWordSpacing(e);}setWordSpacing(e){return this.batch.setProperty("wordSpacing",e),this}set textRendering(e){this.setTextRendering(e);}setTextRendering(e){return this.batch.setProperty("textRendering",e),this}async commit(){await this.batch.exec();}},d(z,"Canvas2DContext"),z);o.Canvas2DContext=A;let I=($=class extends C{constructor(u){super(u.uid,u.tag);}static async new(u,e){let i=[];u&&i.push(u),e&&i.push(e);let c=await y.newObject("Image",...i);return c?new $(c):null}async width(){var u;return (u=await this.getProperty("width"))!=null?u:0}async height(){var u;return (u=await this.getProperty("height"))!=null?u:0}async naturalWidth(){var u;return (u=await this.getProperty("naturalWidth"))!=null?u:0}async naturalHeight(){var u;return (u=await this.getProperty("naturalHeight"))!=null?u:0}async src(){return await this.getProperty("src")}async currentSrc(){return await this.getProperty("currentSrc")}async setSrc(u){await this.setProperty("src",u);}},d($,"Image"),$);o.Image=I;let U=(W=class extends C{constructor(e){super(e.uid,e.tag);p(this,"batch",new S(this));}static async create(){let e=await y.newObject("Path2D");return e?new W(e):null}addPath(e){return this.batch.invoke("addPath",e.ref),this}arc(e,i,c,h,f,k=false){return this.batch.invoke("arc",e,i,c,h,f,k),this}arcTo(e,i,c,h,f){return this.batch.invoke("arcTo",e,i,c,h,f),this}bezierCurveTo(e,i,c,h,f,k){return this.batch.invoke("bezierCurveTo",e,i,c,h,f,k),this}quadraticCurveTo(e,i,c,h){return this.batch.invoke("quadraticCurveTo",e,i,c,h),this}closePath(){return this.batch.invoke("closePath"),this}ellipse(e,i,c,h,f,k,O,j=false){return this.batch.invoke("ellipse",e,i,c,h,f,k,O,j),this}moveTo(e,i){return this.batch.invoke("moveTo",e,i),this}lineTo(e,i){return this.batch.invoke("lineTo",e,i),this}rect(e,i,c,h){return this.batch.invoke("rect",e,i,c,h),this}roundRect(e,i,c,h,f){return this.batch.invoke("roundRect",e,i,c,h,f),this}commit(e){return e?(e.accept(this.batch),Promise.resolve()):this.batch.exec()}},d(W,"CanvasPath2D"),W);o.CanvasPath2D=U;let b=(G=class extends V{constructor(u){super(u);}async width(){return this.getProperty("width")}async height(){return this.getProperty("height")}async setWidth(u){this.setProperty("width",u);}async setHeight(u){this.setProperty("height",u);}async getContext(u){let e=await this.invokeAndHold("getContext",u);return e&&new A(e.uid)}static async of(u,e,i){let c=await y.query(u,e);return c?new G(c):null}},d(G,"CanvasElement"),G);o.CanvasElement=b;})(exports.ODOM||(exports.ODOM={}));var jt=class jt{constructor(){p(this,"callbacks",new Map);p(this,"DOM_EVENT_LISTENERS",new Map);p(this,"timers",new Map);p(this,"_config");p(this,"listeners",new Map);this.subscribe("__ouid_native_event_success__",(t,s)=>{let n=this.callbacks.get(t);if(n)return this.callbacks.delete(t),n.success(...JSON.parse(s))}),this.subscribe("__ouid_native_event_error__",(t,s)=>{let n=this.callbacks.get(t);if(n)return this.callbacks.delete(t),n.error(...JSON.parse(s))}),this.subscribe("__ouid_web_event__",(t,s)=>{let n=this.DOM_EVENT_LISTENERS.get(t),r=JSON.parse(s);if(n){let l=r[1];return l&&typeof l=="object"&&(l.target=l!=null&&l.target?new exports.ODOM.OElement(l.target):null,l.currentTarget=l!=null&&l.currentTarget?new exports.ODOM.OElement(l.currentTarget):null,l.relatedTarget=l!=null&&l.relatedTarget?new exports.ODOM.OElement(l.relatedTarget):null),n(l)}else console.error("No cb found for ",t,r[0]);});}config(t){return this._config=t,this}invoke(t,...s){let n=nt(t);return new Promise((r,l)=>{this.callbacks.set(n,{success:r,error:l});try{if(!WebOUID)throw new Error("NativeOUID bridge not available");WebOUID.invoke(n,t,JSON.stringify(s));}catch(a){console.error(a),this.callbacks.delete(n);}})}registerComponent(t,s){K.register(t,s);}unregisterComponent(t,s){K.unregister(t);}async call(t,...s){try{return (await this.invoke(`_ouid_${t}`,...s)).data}catch(n){return console.error(n),null}}emit(t,s){WebOUID==null||WebOUID.invoke("event",t,JSON.stringify(s));}subscribe(t,s){this.listeners.has(t)||(this.listeners.set(t,[]),globalThis[t]=(n,r)=>{var l;(l=this.listeners.get(t))==null||l.forEach(a=>a(n,r));}),this.listeners.get(t).push(s);}async query(t,s,n){let r=await this.call("query",t,s,n);return r?new exports.ODOM.OElement(r):null}async queryAll(t,s,n){let r=await this.call("queryAll",t,s,n);return r?r.map(l=>new exports.ODOM.OElement(l)):[]}async createElement(t,s={}){let n=await this.call("createElement",t,s);return n?new exports.ODOM.OElement(n):null}async createComment(t){let s=await this.call("createComment",t);return s?new exports.ODOM.OElement(s):null}async addEventListener(t,s,n,r){let l=nt(s+(typeof t=="string"?t:t.tag));return this.DOM_EVENT_LISTENERS.set(l,n),await y.call("attachEventListener",typeof t=="string"?t:t.uid,l,s,r==null?void 0:r.options,r==null?void 0:r.policy),l}async dettachEventListener(t){this.DOM_EVENT_LISTENERS.delete(t),await y.call("dettachEventListener",t);}async createComponentStyles(t,s=true){let n=await y.call("createComponentStyles",t,s);return n?new exports.ODOM.OElement(n):null}async appendComponentStyles(t){await y.call("appendComponentStyles",t);}async rejectComponentStyles(t){await y.call("rejectComponentStyles",t.uid);}async getOObject(t){let s=await y.call("getOObject",t);return s?new exports.ODOM.OObject(s.uid,s.tag):null}async acquireObject(t){let s=await y.call("acquireObject",t);return s?new exports.ODOM.OObject(s.uid,s.tag):null}async setTimeout(t,s){var l;let n=nt("setTimeout"+s);this.DOM_EVENT_LISTENERS.set(n,()=>{t();let a=this.timers.get(r);a&&(this.timers.delete(r),this.DOM_EVENT_LISTENERS.delete(a));});let r=(l=await y.call("setTimeout",n,s))!=null?l:-1;return r>=0&&this.timers.set(r,n),r}async clearTimeout(t){let s=this.timers.get(t);s&&(this.timers.delete(t),this.DOM_EVENT_LISTENERS.delete(s),await y.call("clearTimeout",t));}async setInterval(t,s){var l;let n=nt("setInterval"+s);this.DOM_EVENT_LISTENERS.set(n,t);let r=(l=await y.call("setInterval",n,s))!=null?l:-1;return r>=0&&this.timers.set(r,n),r}async clearInterval(t){let s=this.timers.get(t);s&&(this.timers.delete(t),this.DOM_EVENT_LISTENERS.delete(s),await y.call("clearInterval",t));}async fetch(t,s,n="json"){let r=await y.call("fetch",t,s,n);return n==="buffer"||n==="bytes"?exports.ODOM.OObject.toInstance(r):r}async alert(t){console.log("Alerting:::",t),await y.call("alert",t);}async prompt(t){await y.call("prompt",t);}async newObject(t,...s){return y.call("newObject",t,...s)}async requestAnimationFrame(t){var r;let s=nt("requestAnimationFrame");this.DOM_EVENT_LISTENERS.set(s,l=>{t(l);let a=this.timers.get(n);a&&(this.DOM_EVENT_LISTENERS.delete(a),this.timers.delete(n));});let n=(r=await y.call("requestAnimationFrame",s))!=null?r:-1;return n>=0&&this.timers.set(n,s),n}async cancelAnimationFrame(t){let s=this.timers.get(t);s&&(this.timers.delete(t),await y.call("cancelAnimationFrame",t),this.DOM_EVENT_LISTENERS.delete(s));}async batchActions(t){await y.call("batchActions",t);}nextTick(t){y.setTimeout(t,0);}};d(jt,"OUIDBridge");var Dt=jt,y=new Proxy(new Dt,{get:d((o,t)=>t in o?o[t]:async(...s)=>await o.call(t,...s),"get")});globalThis.OUID=y;exports.ODOM=void 0;function le(o){return o.replace(/-([a-z])/g,(t,s)=>s.toUpperCase())}d(le,"toCamelCase");function he(o){return o.replace(/(?!^)([A-Z])/g,(t,s)=>`-${s.toLowerCase()}`)}d(he,"toSnakeCase");function L(o){return At(o)?o.value:o}d(L,"normaliseValue");function de(o){return typeof o=="function"&&!("prototype"in o)}d(de,"isLazyLoader");var Jt=new Map,Qt=new Map,zt=new WeakMap;function fe(o){if(!o||typeof o!="object"&&typeof o!="function")return {};let t=zt.get(o);if(t)return t;let s=Object.create(null);for(let n=o;n&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let r of Object.getOwnPropertyNames(n)){if(r==="constructor"||r.startsWith("__")||r.endsWith("__")||r in s)continue;let l=Object.getOwnPropertyDescriptor(n,r);l&&(typeof l.value=="function"?s[r]=l.value.bind(o):l.get&&Object.defineProperty(s,r,{get:d(()=>l.get.call(o),"get"),enumerable:true}));}return zt.set(o,s),s}d(fe,"getMethodsView");function Xt(o,t){let s=Jt.get(o);return s||(s=new Function("s","with (s) { return ("+o+"); }"),Jt.set(o,s)),s(t)}d(Xt,"evalInScope");function pe(o){let t=Qt.get(o);if(t)return t;let s=[],n=0;for(;n<o.length;){let r=o.indexOf("{{",n);if(r<0){s.push({t:o.slice(n)});break}r>n&&s.push({t:o.slice(n,r)});let l=o.indexOf("}}",r+2),a=l>=0?o.slice(r+2,l).trim():o.slice(r+2).trim();s.push({e:a}),n=l>=0?l+2:o.length;}return t=d(r=>{let l="";for(let a of s)if(a.t!==void 0)l+=a.t;else if(a.e!==void 0){let m=L(Xt(a.e,r));l+=m==null?"":String(m);}return l},"fn"),Qt.set(o,t),t}d(pe,"compileInterpolated");var Yt,q=class q{constructor(t,s,n,...r){p(this,"app");p(this,"component");p(this,"parentContext");p(this,"bindings",[]);p(this,"directives",[]);p(this,"mountedComponents",(Yt=it(q.MOUNTED_COMPONENTS_TOKEN))!=null?Yt:new Map);p(this,"componentsRegistry",new at);p(this,"updatingDirectives",false);p(this,"updatingBindings",false);p(this,"_stack",[]);p(this,"flatStack",Object.create(null));p(this,"viewUpdates");p(this,"mountedQueue",[]);this.app=t,this.component=s,this.parentContext=n;for(let l of r)this.push(l);}get hostElement(){return this.component._hostElement}get stack(){return this._stack}set stack(t){this.flatStack=Object.create(null),this._stack=[];for(let s of t)this.push(s);}getRoot(){let t=this;for(;t.parentContext;)t=t.parentContext;return t}enqueueMounted(t){this.getRoot().mountedQueue.push(t);}async flushMounted(){let t=this.getRoot(),s=t.mountedQueue;t.mountedQueue=[];for(let n of s)try{n();}catch(r){console.error("onMounted error:",r);}}getMountedComponent(t){return this.mountedComponents.get(t.uid)}bind(t){this.bindings.push(t);}directive(t){this.directives.push(t);}evaluateExpression(t){return this.resolve(t)}resolveScope(...t){var r;let s=(r=this.component)!=null?r:{},n=fe(s);return new Proxy(Object.create(null),{get:d((l,a)=>{for(let m=t.length-1;m>=0;m--)if(a in t[m])return L(t[m][a]);return a in this.flatStack?L(this.flatStack[a]):a in n?L(n[a]):L(s[a])},"get"),set:d((l,a,m)=>{let g;for(let v=t.length-1;v>=0;v--)if(a in t[v]){g=t[v][a];break}return g===void 0&&(a in this.flatStack?g=this.flatStack[a]:a in n?g=n[a]:g=s[a]),g!==void 0&&At(g)?(g.value=m,true):false},"set"),has:d((l,a)=>t.some(m=>a in m)||a in this.flatStack||a in n||a in s,"has")})}resolve(t,...s){if(!t)return;let n=this.resolveScope(...s);try{return Xt(t,n)}catch(r){return}}updateValue(t,s){this.resolve(`${t}=__o_model_value__`,{__o_model_value__:s});}push(t){this._stack.unshift(t),Object.assign(this.flatStack,t);}pop(){let t=this._stack.shift();if(t)for(let s of Object.keys(t))delete this.flatStack[s];}resolveTag(t){var n;let s=this;for(;;){if(s.componentsRegistry.has(t))return s.componentsRegistry.get(t);if(s=(n=s==null?void 0:s.parentContext)!=null?n:null,!s)break}return K.get(t)}async updateBindings(){if(!this.updatingBindings){this.updatingBindings=true;for(let t of this.bindings)this.updateBinding(t);this.updatingBindings=false;}}updateBinding(t){if(t.type==="model"){t.node.setProperty("value",L(t.context.resolve(t.key)));return}if(t.type==="interpolation"){let s=t.templateFn(t.context.resolveScope());this.viewUpdates.add("setContentText",t.node,s);return}if(t.type==="attribute"){let s=t.key,n=L(this.resolve(t.template));s==="class"?this.expandClass(t.node,n):s==="style"?this.expandStyle(t.node,n):typeof n!="object"&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="undefined"&&this.viewUpdates.add("setAttribute",t.node,s,n.toString());return}if(t.type==="prop"&&t.context.component){let s=L(this.resolve(t.template));try{t.context.component.props[t.key]=s,Promise.all([t.context.updateBindings(),t.context.updateDirectives()]).then(()=>{t.context.viewUpdates.exec();});}catch(n){console.error(n);}return}}async updateDirectives(){var n,r,l;if(this.updatingDirectives)return;let t=new exports.ODOM.BatchActions;this.updatingDirectives=true;for(let a of this.directives){if(a.type==="if"){if(!L(a.context.evaluateExpression(a.expr))){if(a.active===false)continue;a.active=false,a.renderedNode&&(a.destroy?this.unmountComponent(a.renderedNode):this.viewUpdates.add("addClass",a.renderedNode,"oui-hidden"));continue}if(a.active===true)continue;a.active=true;let g=a.renderedNode;if(!g||a.destroy){let v=await a.node.cloneNode(true);a.renderedNode=v,await a.context.render(v),this.viewUpdates.add("after",a.placeholder,v);}else this.viewUpdates.add("removeClass",g,"oui-hidden");}if(a.type==="for"){let m=(n=a.children)!=null?n:new Map,g=new Map,v=d((x,A)=>a.key?L(a.context.resolve(a.key,{[a.item]:x})):A,"keyFn"),S=L(a.context.resolve(a.list))||[],C=new exports.ODOM.BatchActions,B=32,V=0,D=a.placeholder;for(let x=0;x<S.length;x++){let A=S[x],I=v(A,x),U=m.get(I),b,w,P=D;if(U){b=U.node,w=U.ctx,w.stack=[{[a.item]:A},...a.context.stack];let T=await D.nextSibling();b.uid!==(T==null?void 0:T.uid)&&C.add(()=>P.after(b)),(r=w.__renderRunner__)==null||r.call(w),await Promise.all([w.updateBindings(),w.updateDirectives()]);}else {if(w=new q(this.app,this.component,this),w.viewUpdates=this.viewUpdates,w.stack=[{[a.item]:A},...a.context.stack],b=await a.node.cloneNode(true),C.add(async()=>{await P.after(b);}),await w.render(b),await w.updateDirectives(),!w.__renderRunner__){let _=ct(()=>{w.collectDepsForBindingsAndDirectives();},{lazy:true,scheduler:d(()=>{H(async()=>{var F;if((F=w.__renderRunner__)==null||F.call(w),!w.__updating){w.__updating=true;try{await Promise.all([w.updateBindings(),w.updateDirectives()]),await w.viewUpdates.exec(),await w.flushMounted();}finally{w.__updating=false;}}});},"scheduler")});w.__renderRunner__=_,_();let N=w.component;N.effects=(l=N.effects)!=null?l:[],N.effects.push(()=>_.effect.stop());}w.__renderRunner__();}D=b,g.set(I,{node:b,ctx:w}),++V>=B&&(V=0,await C.commit(),await H());}let E=[];for(let[x,A]of m.entries())g.has(x)||E.push(this.unmountComponent(A.node));await Promise.all(E),await C.commit(),a.children=g;}}await t.commit(),this.updatingDirectives=false;}async render(t,s){if(t.hydrated||s!=null&&s.skipSlotted&&t.hasAttribute("slotted"))return;switch(t.type){case "Text":this.handleTextNode(t);break;case "Element":await this.handleElementNode(t,s);break;}let n=new exports.ODOM.BatchActions;await Promise.all([this.updateBindings(),this.updateDirectives()]),n.commit(),this.viewUpdates.add("addClass",t,"hydrated");}async expandClass(t,s){let n,r=[];typeof s=="object"?Array.isArray(s)?n=s:(n=Object.keys(s).filter(l=>s[l]),r=Object.keys(s).filter(l=>!s[l])):n=s.toString().split(/\s+/),n.length>0&&(this.viewUpdates.add("addClass",t,...n),r.length>0&&this.viewUpdates.add("removeClass",t,...r));}expandStyle(t,s){let n=s;typeof s=="object"&&!Array.isArray(s)&&(n=Object.keys(s).filter(r=>s[r]).map(r=>`${he(r)}: ${s[r]}`).join(";")),n&&this.viewUpdates.add("setAttribute",t,"style",n);}expandStandardAttributes(t){[...t.attributes].filter(s=>s.name.startsWith(":")).forEach(s=>{let n=s.name.substring(1);this.bind({type:"attribute",node:t,key:n,context:this,template:s.value.trim()}),this.viewUpdates.add("removeAttribute",t,s.name);});}setRefValue(t,s){let n=t.trim();this.updateValue(n,s);}async handleElementNode(t,s){var D;let n=await t.parentNode(),r=null,l=t.hasAttribute("o-if")?"o-if":t.hasAttribute("o-show")?"o-show":null;if(l){let E=await t.getAttribute(l),x=await OUID.createComment(l+":"+E),A=l==="o-if";await n.insertBefore(t,x),await t.updates().removeAttribute(l).remove().exec(),this.directive({type:"if",expr:E,node:t,placeholder:x,context:this,active:void 0,destroy:A}),r="if";return}if(t.hasAttribute("o-for")){if(r==="if")throw new Error("Can't have o-if and o-for on the same component");let E=await t.getAttribute("o-for"),[x,A]=E.split(" of ").map(b=>b.trim()),I=await OUID.createComment("for:"+E),U=(D=t.attribute(":key"))!=null?D:"";await(n==null?void 0:n.insertBefore(t,I)),await t.updates().removeAttribute("o-for").removeAttribute(":key").remove().exec(),this.directive({type:"for",item:x,list:A,node:t,placeholder:I,context:this,key:U}),r="for";return}let a=t.tag.toLowerCase(),m=this.resolveTag(a),g=t.updates();[...t.attributes].forEach(async E=>{if(E.name==="o-model"){let x=E.value.trim();g.setInputValue(L(this.resolve(x))).addEventListener("input",async I=>{let U=await I.target.getProperty("value");this.updateValue(x,U);}),this.bind({node:t,key:x,type:"model",context:this}),g.removeAttribute(E.name);}else E.name==="ref"&&(m||this.setRefValue(E.value,t));});let v={},S={},{props:C,events:B}=this.componentAttributes(t,this);if(v=C,S=B,this.expandStandardAttributes(t),Object.keys(S).forEach(async E=>{let x=S[E];m||g.addEventListener(E,A=>{typeof x=="function"&&x.apply(this.component,[A]);}),g.removeAttribute("@"+E);}),this.viewUpdates.accept(g),m){await this.mountComponent(t,m,this,v,S);return}let V=await t.childNodes();s!=null&&s.skipSlotted&&(V=V.filter(E=>!E.hasAttribute("slotted")));for(let E of V)await this.render(E,s);}handleTextNode(t){var n;let s=(n=t.textContent)!=null?n:"";s.includes("{{")&&this.bind({type:"interpolation",node:t,key:"__template__",templateFn:pe(s),context:this});}collectDepsForBindingsAndDirectives(){for(let t of this.bindings)t.type==="model"?L(this.resolve(t.key)):t.type==="interpolation"?t.templateFn(this.resolveScope()):t.type==="attribute"?L(this.resolve(t.template)):t.type==="prop"&&L(this.resolve(t.template));for(let t of this.directives)t.type==="if"?L(t.context.evaluateExpression(t.expr)):t.type==="for"&&(L(t.context.resolve(t.list)),t.key);}componentAttributes(t,s){let n={},r={},l=["import","interface","module","o-model","o-if","o-for"];return [...t.attributes].filter(a=>!l.includes(a.name)).forEach(a=>{let m=a.name;if(m.startsWith("@")){let S=s==null?void 0:s.resolve(a.value);if(typeof S!="function")throw new Error("Event handler can only be function");m=m.substring(1),r[m]=S;return}let g=null,v=a.value;m.startsWith(":")&&(g=a.value,m=m.substring(1),v=L(s==null?void 0:s.resolve(a.value))),m=le(m),n[m]={name:m,value:v,expr:g};}),{props:n,events:r}}async mountComponent(t,s,n,r={},l={}){var V,D,E,x,A,I;if(this.viewUpdates=(D=(V=this.viewUpdates)!=null?V:n==null?void 0:n.viewUpdates)!=null?D:new exports.ODOM.BatchUpdates(t),this.mountedComponents.has(t.uid))return this.mountedComponents.get(t.uid);let a=new q(this.app,{},this);a.viewUpdates=this.viewUpdates;let m={},g;for(let b of Object.keys(r)){let w=r[b];if(w.name==="ref"&&!w.expr){g=w;continue}w.expr&&this.bind({type:"prop",node:t,key:b,context:a,template:w.expr}),m[b]=w.value;}let v=await me(s,m,l);a.component=v,a.stack=[],this.mountedComponents.set(t.uid,v),g&&this.setRefValue(g.value,v);{let b=t.updates();for(let P of Object.keys(r))r[P].expr||b.setAttribute(P,r[P].value);let w=(E=v.hostClasses)!=null?E:[];w&&(w=typeof w=="string"?[w]:w),w.push("o-component-host"),t.tag.toLowerCase()!=="div"&&w.push("c-"+t.tag.toLowerCase()),b.addClass(...w),this.viewUpdates.accept(b);}H(async()=>{try{await v.decorateHostElement(t);}catch(b){}});{let b=(x=v.use)!=null?x:{};for(let w of Object.keys(b))a.componentsRegistry.register(w,b[w]);}if(v._hostElement=t,v.parent=(A=n==null?void 0:n.component)!=null?A:void 0,v.provide(q.PROVIDE_TOKEN,a),v.willMount(),!s.cssInstance){let b=v.style?(I=v.style())==null?void 0:I.toString():v.css;b&&((s.cssInstance)!=null||(s.cssInstance=await OUID.createComponentStyles(b,false)));}H(()=>{var w;let b=s.cssInstance;if(b){let P=(w=q.STYLE_REF.get(b))!=null?w:0;P===0&&OUID.appendComponentStyles(b.uid),q.STYLE_REF.set(b,P+1),v.cssInstance=b;}});let S=await t.childNodes();if(v.render){let b=await v.render(a);b&&b.attachTo(t);}else await t.setHTML(v.template.trim());let C=await t.queryAll("slot");C&&C.length&&await Promise.all(C.filter(b=>{var w;return !((w=b.classes)!=null&&w.includes("hydrated"))}).map(async b=>{let w=b.attribute("name"),P=S.filter(T=>w?T.type==="Element"&&T.attribute("slot")===w:T.type!=="Element"||!T.hasAttribute("slot"));if(P.length){for(let T of P)this.viewUpdates.add("setAttribute",T,"slotted","true"),this.viewUpdates.add("appendChild",b,T);await this.viewUpdates.exec(),await Promise.all(P.map(T=>this.render(T)));}}));{let b=await t.childNodes(),w=6,P=0;for(;P<b.length;){let T=b.slice(P,P+w);await Promise.all(T.map(_=>a.render(_,{skipSlotted:true}))),P+=w;}}a.viewUpdates.add("addClass",t,"hydrated"),this.enqueueMounted(()=>{try{v.onMounted();}catch(b){}}),await a.viewUpdates.exec();let B=ct(()=>{a.collectDepsForBindingsAndDirectives();},{lazy:true,scheduler:d(()=>{H(async()=>{if(!a.__updating){a.__updating=true;try{await Promise.all([a.updateBindings(),a.updateDirectives()]),await a.viewUpdates.exec(),await a.flushMounted();}finally{a.__updating=false;}}});},"scheduler")});return B(),v.__effects__=[()=>B.effect.stop()],v}async unmountComponent(t){var r,l;let s=this.mountedComponents.get(t.uid);if(await t.removeAndRelease(),s){let a=s.cssInstance;if(a){let g=(r=q.STYLE_REF.get(a))!=null?r:1;g===1?(await OUID.rejectComponentStyles(a),q.STYLE_REF.delete(a)):q.STYLE_REF.set(a,g-1);}s.willUnmount();let m=s.__effects__;m==null||m.forEach(g=>{try{g();}catch(v){}}),s.effects=void 0,s._hostElement=null,s.cssInstance=null;}let n=(l=await t.queryAll("*"))!=null?l:[];for(let a of n)await this.unmountComponent(a);this.mountedComponents.delete(t.uid),t.hasAttribute("ref")&&this.setRefValue(t.attribute("ref"),null);}};d(q,"RenderContext"),p(q,"PROVIDE_TOKEN","RENDER_CONTEXT"),p(q,"MOUNTED_COMPONENTS_TOKEN","RENDER_CONTEXT_MOUNTED_COMPONENTS"),p(q,"STYLE_REF",new WeakMap);var J=q;async function Ye(o,t,s=[],n){let r=t!=null?t:{},l=await OUID.createElement(o,Object.keys(r).reduce((a,m)=>(a[m]=r[m],a),{}));return Object.keys(n!=null?n:{}).forEach(a=>{l==null||l.addEventListener(a,m=>{let g=n[a];typeof g=="function"&&g(m);});}),new et(l,s)}d(Ye,"node");function me(o,t,s){return de(o)?o().then(n=>It(n.default,t,s)):It(o,t,s)}d(me,"o");function we(o){return typeof o=="function"}d(we,"isProvideFunction");var lt=class lt{constructor(t,s){p(this,"root");p(this,"options");p(this,"providers",new Map);this.root=t,this.options=s,lt.currentApp=this;}provide(t,s){if(this.providers.has(t)){console.warn(`[OUID] - Provider ${t} already exists`);return}this.providers.set(t,we(s)?{provide:s}:{value:s});}inject(t){var s;return (s=this.providers.get(t))==null?void 0:s.value}use(t,s){return t.install(this,s),this}async mount(t){var r;if(!globalThis.__OUI_PUR_JS_CONTEXT__)return;(r=this.options)!=null&&r.css&&await OUID.createComponentStyles(this.options.css),await OUID.createComponentStyles(`
7
7
  * {
8
8
  ${t} * {
9
9
  visibility: hidden;
@@ -14,7 +14,7 @@ ${n.toString()}}
14
14
  .oui-hidden {
15
15
  display: none !important;
16
16
  }
17
- `),fe(J.MOUNTED_COMPONENTS_TOKEN,new Map);let s=await OUID.query(t);if(!s)throw new Error("No selector found for "+t);let n=new J(this,{},null);n.mountComponent(s,this.root,null).then(async()=>{n.updateBindings(),n.updateDirectives(),await n.flushMounted();});}};d(ct,"App"),p(ct,"currentApp",null);var vt=ct;function fe(c,t){var s;(s=vt.currentApp)==null||s.provide(c,t);}d(fe,"provide");function yt(c){var t,s;return (s=(t=vt.currentApp)==null?void 0:t.inject(c))!=null?s:void 0}d(yt,"inject");function pe(c,t,s,n){var r=arguments.length,l=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,s):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(c,t,s,n);else for(var m=c.length-1;m>=0;m--)(a=c[m])&&(l=(r<3?a(l):r>3?a(t,s,l):a(t,s))||l);return r>3&&l&&Object.defineProperty(t,s,l),l}d(pe,"_ts_decorate");var jt=class jt extends st{constructor(){super(...arguments);p(this,"router");}willMount(){}onMounted(){var s;this.router=we(),(s=this.router)==null||s.bind(this).then(n=>{n==null||n();});}willUnmount(){var s;(s=this.router)==null||s.unbind();}};d(jt,"ORouter");exports.ORouter=jt;exports.ORouter=pe([Wt({tag:"o-router",template:`
17
+ `),ye(J.MOUNTED_COMPONENTS_TOKEN,new Map);let s=await OUID.query(t);if(!s)throw new Error("No selector found for "+t);let n=new J(this,{},null);n.mountComponent(s,this.root,null).then(async()=>{n.updateBindings(),n.updateDirectives(),await n.flushMounted();});}};d(lt,"App"),p(lt,"currentApp",null);var bt=lt;function ye(o,t){var s;(s=bt.currentApp)==null||s.provide(o,t);}d(ye,"provide");function it(o){var t,s;return (s=(t=bt.currentApp)==null?void 0:t.inject(o))!=null?s:void 0}d(it,"inject");function ve(o,t,s,n){var r=arguments.length,l=r<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,s):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(o,t,s,n);else for(var m=o.length-1;m>=0;m--)(a=o[m])&&(l=(r<3?a(l):r>3?a(t,s,l):a(t,s))||l);return r>3&&l&&Object.defineProperty(t,s,l),l}d(ve,"_ts_decorate");var Lt=class Lt extends st{constructor(){super(...arguments);p(this,"router");}willMount(){}onMounted(){var s;this.router=be(),(s=this.router)==null||s.bind(this).then(n=>{n==null||n();});}willUnmount(){var s;(s=this.router)==null||s.unbind();}};d(Lt,"ORouter");exports.ORouter=Lt;exports.ORouter=ve([Kt({tag:"o-router",template:`
18
18
  <div id="router-view"></div>
19
19
  `,css:`
20
20
  #router-view {
@@ -58,11 +58,11 @@ ${n.toString()}}
58
58
  .route-pop-end {
59
59
  transform: translateX(100%);
60
60
  }
61
- `})],exports.ORouter);var Yt="OROUTER_TOKEN",Rt="ACTIVE_ROUTE",zt=250;function we(){return yt(Yt)}d(we,"useRouter");function rs(c){return new Dt(c)}d(rs,"createRouter");function ye(c){c&&(c.__isActive=true,typeof c.onActivated=="function"&&c.onActivated());}d(ye,"activate");function ve(c){c&&(c.__isActive=false,typeof c.onDeactivated=="function"&&c.onDeactivated());}d(ve,"deactivate");var Mt=class Mt{constructor(t){p(this,"routes");p(this,"windowObject",null);p(this,"guards",[]);p(this,"eventRegistration",null);p(this,"compiled");p(this,"outletEl",null);p(this,"stack",[]);p(this,"pendingNav",null);p(this,"lastDirection","none");p(this,"historyIndex",0);this.routes=t,this.compiled=t.map(s=>({route:s,parser:new me__default.default(s.path)}));}install(t){t.provide(Yt,this),w.registerComponent("o-router",exports.ORouter);}resolveByName(t){for(let s of this.compiled)if(s.route.name===t)return {route:s.route,params:{},query:{},parser:s.parser};return null}resolve(t){let[s,n=""]=t.split("?"),r=n?n.split("&").reduce((l,a)=>{let[m,g=""]=a.split("=");return m&&(l[m]=decodeURIComponent(g)),l},{}):{};for(let l of this.compiled){let a=l.parser.match(s);if(a)return l.route.redirectTo?typeof l.route.redirectTo=="string"?this.resolve(l.route.redirectTo):this.resolveByName(l.route.redirectTo.name):{route:l.route,params:a,query:r,parser:l.parser}}return null}replace(t){this.push(t,true);}push(t,s=false){var r,l;if(!t.path&&!t.name){console.warn("[OUID-Router]: no path or name provided to push");return}this.lastDirection="forward";let n=d((a,m=true)=>{var v,E,C;let g={navIndex:s?this.historyIndex:this.historyIndex+1};s?(v=this.windowObject)==null||v.invoke("history.replaceState",g,"",a):(E=this.windowObject)==null||E.invoke("history.pushState",g,"",a),m&&((C=this.windowObject)==null||C.dispatchEvent("popstate","PopStateEvent",{state:g}));},"dispatchPushEvent");if(t.name){let a=this.resolveByName(t.name);if(!a){console.warn("[OUID-Router]: No matched route name found");return}let m=a.parser.reverse((r=t.params)!=null?r:{});m&&n(m);return}if(t.absolute&&t.path&&n(t.path,false),t.path){let a=this.resolve(t.path);if(a){let m=a.parser.reverse((l=t.params)!=null?l:{});m&&n(m);return}}}async pop(){var s,n;this.lastDirection="back",(s=this.windowObject)==null||s.invoke("history.back");let t={navIndex:this.historyIndex-1};await((n=this.windowObject)==null?void 0:n.invoke("history.pushState",t,""));}async beforeRouteGoing(t,s){for(let n of this.guards.filter(r=>r.type==="before")){let r=await n.fn(t,s);if(r)return r}}async afterRouteGoing(t,s){for(let n of this.guards.filter(r=>r.type==="after")){let r=await n.fn(t,s);if(r)return r}}async bind(t){this.windowObject=await w.acquireObject("window");let s=d(async m=>{var y,A;this.windowObject||(this.windowObject=await w.acquireObject("window"));let g=m!=null?m:await this.windowObject.getProperty("location.pathname"),v=this.resolve(g);if(!v){console.warn(`[Router] No route found for: ${g}`);return}let E=t.inject(J.PROVIDE_TOKEN);this.outletEl||(this.outletEl=await E.hostElement.query("#router-view"));let C=this.outletEl;if(!C)return;let U=await this.beforeRouteGoing({url:g,path:g,name:v.route.name},t.inject(Rt));if(U){typeof U=="object"&&"name"in U&&this.push({name:U.name,params:U.params});return}t.provide(Rt,{params:v.params,query:v.query});let M=await C.childNodes(),_=(y=M[M.length-1])!=null?y:null,O=_&&(A=E.getMountedComponent(_))!=null?A:null,P=this.getNavMode(),x,L,V=this.stack.length,b=this.stack[V-2];if(this.lastDirection==="back"&&b){x=b.host,L=b.inst;let S=C.updates();M.some(j=>j.uid===x.uid),S.add("appendChild",C,x),S.add("removeClass",x,"route-hidden"),await S.exec(),await Promise.all([b.ctx.updateBindings(),b.ctx.updateDirectives()]);}else {let S=await w.createElement("div",{class:"route-view route-hidden"});await C.appendChild(S);let j=await E.mountComponent(S,v.route.component,E);x=S,L=j,E==null||E.flushMounted(),this.lastDirection==="forward"&&this.stack.push({host:S,ctx:E,inst:j});}P==="push"?await this.runTransitionPush(C,_,x):P==="pop"&&_&&await this.runTransitionPop(C,_,x),_&&O&&this.lastDirection==="back"&&(this.stack.pop(),ve(O),await E.unmountComponent(_)),ye(L),await this.afterRouteGoing({url:g,path:g,name:v.route.name},t.inject(Rt)),await H();},"handler"),n=d(async m=>{let g=await this.windowObject.getProperty("location.pathname");return this.pendingNav?this.pendingNav:(this.pendingNav=(async()=>{try{let v=(m==null?void 0:m.state)||await this.windowObject.getProperty("history.state"),E=0;v&&typeof v.navIndex=="number"&&(E=v.navIndex),E>this.historyIndex?this.lastDirection="forward":E<this.historyIndex?this.lastDirection="back":this.lastDirection="none",this.historyIndex=E,await s(g);}finally{this.pendingNav=null;}})(),this.pendingNav)},"run"),r=await this.windowObject.getProperty("location.pathname"),l=await this.windowObject.getProperty("history.state");(!l||typeof l.navIndex!="number")&&await this.windowObject.invoke("history.replaceState",{navIndex:this.historyIndex},"",r);let a=await this.windowObject.addEventListener("popstate",n);return this.eventRegistration=a,s}unbind(){var t;this.eventRegistration&&((t=this.windowObject)==null||t.dettachEventListener(this.eventRegistration));}async runTransitionPush(t,s,n){if(!s){await n.updates().removeClass("route-hidden","route-transitioning","route-push-start").addClass("route-view","route-push-end").exec();return}let r=n.updates();r.addClass("route-view"),s&&r.add("addClass",s,"route-view"),r.removeClass("route-hidden","route-push-end","route-pop-end").addClass("route-push-start"),await r.exec(),await new Promise(m=>{w.requestAnimationFrame(()=>m());});let l=n.updates();l.addClass("route-transitioning").removeClass("route-push-start").addClass("route-push-end"),await l.exec(),await _t(zt+40);let a=n.updates();a.removeClass("route-transitioning","route-push-start"),s&&a.add("addClass",s,"route-hidden"),await a.exec();}async runTransitionPop(t,s,n){let r=s.updates();r.addClass("route-view"),r.add("addClass",n,"route-view"),r.add("removeClass",n,"route-hidden"),r.addClass("route-pop-start").removeClass("route-push-end","route-pop-end"),await r.exec(),await new Promise(m=>{w.requestAnimationFrame(()=>m());});let l=s.updates();l.addClass("route-transitioning"),l.removeClass("route-pop-start").addClass("route-pop-end"),await l.exec(),await _t(zt+40);let a=s.updates();a.addClass("route-hidden").removeClass("route-transitioning","route-pop-start"),await a.exec();}getNavMode(){return this.lastDirection==="back"?"pop":"push"}beforeEach(t){let s={fn:t,type:"before"};return this.guards.push(s),()=>{this.guards.splice(this.guards.indexOf(s));}}afterEach(t){let s={fn:t,type:"after"};return this.guards.push(s),()=>{this.guards.splice(this.guards.indexOf(s));}}};d(Mt,"Router");var Dt=Mt;var Lt=class Lt extends st{render(t){return et.of('<i class="o-icon"><slot></slot></i>')}style(){return mt.of({i:`
61
+ `})],exports.ORouter);var te="OROUTER_TOKEN",ht="ACTIVE_ROUTE",Zt=250;function be(){return it(te)}d(be,"useRouter");function us(o){return new Mt(o)}d(us,"createRouter");function ke(o){o&&(o.__isActive=true,typeof o.onActivated=="function"&&o.onActivated());}d(ke,"activate");function Ee(o){o&&(o.__isActive=false,typeof o.onDeactivated=="function"&&o.onDeactivated());}d(Ee,"deactivate");var Ut=class Ut{constructor(t){p(this,"routes");p(this,"windowObject",null);p(this,"guards",[]);p(this,"eventRegistration",null);p(this,"compiled");p(this,"outletEl",null);p(this,"stack",[]);p(this,"pendingNav",null);p(this,"lastDirection","none");p(this,"historyIndex",0);this.routes=t,this.compiled=t.map(s=>({route:s,parser:new ge__default.default(s.path)}));}install(t){t.provide(te,this),t.provide(ht,{params:{},query:{}}),y.registerComponent("o-router",exports.ORouter);}resolveByName(t){for(let s of this.compiled)if(s.route.name===t)return {route:s.route,params:{},query:{},parser:s.parser};return null}mapPath(t,s={},n={}){let r=t.reverse(s);if(!r)return null;let l=Object.keys(n).map(a=>`${encodeURIComponent(a)}=${encodeURIComponent(n[a])}`).join("&");return l&&(r+=`?${l}`),r}resolve(t){let[s,n=""]=t.split("?"),r=n?n.split("&").reduce((l,a)=>{let[m,g=""]=a.split("=");return m&&(l[m]=decodeURIComponent(g)),l},{}):{};for(let l of this.compiled){let a=l.parser.match(s);if(a)return l.route.redirectTo?typeof l.route.redirectTo=="string"?this.resolve(l.route.redirectTo):this.resolveByName(l.route.redirectTo.name):{route:l.route,params:a,query:r,parser:l.parser}}return null}replace(t){this.push(t,true);}push(t,s=false){if(!t.path&&!t.name){console.warn("[OUID-Router]: no path or name provided to push");return}this.lastDirection="forward";let n=d((r,l=true)=>{var m,g,v;let a={navIndex:s?this.historyIndex:this.historyIndex+1};s?(m=this.windowObject)==null||m.invoke("history.replaceState",a,"",r):(g=this.windowObject)==null||g.invoke("history.pushState",a,"",r),l&&((v=this.windowObject)==null||v.dispatchEvent("popstate","PopStateEvent",{state:a}));},"dispatchPushEvent");if(t.name){let r=this.resolveByName(t.name);if(!r){console.warn("[OUID-Router]: No matched route name found");return}let l=this.mapPath(r.parser,t.params,t.query);l&&n(l);return}if(t.absolute&&t.path){n(t.path);return}if(t.path){let r=this.resolve(t.path);if(r){let l=this.mapPath(r.parser,rt(rt({},r.params),t.params),rt(rt({},r.query),t.query));l&&n(l);return}}}async pop(){var s,n;this.lastDirection="back",(s=this.windowObject)==null||s.invoke("history.back");let t={navIndex:this.historyIndex-1};await((n=this.windowObject)==null?void 0:n.invoke("history.pushState",t,""));}async beforeRouteGoing(t,s){for(let n of this.guards.filter(r=>r.type==="before")){let r=await n.fn(t,s);if(r)return r}}async afterRouteGoing(t,s){for(let n of this.guards.filter(r=>r.type==="after")){let r=await n.fn(t,s);if(r)return r}}async bind(t){this.windowObject=await y.acquireObject("window");let s=d(async m=>{var P,T;this.windowObject||(this.windowObject=await y.acquireObject("window"));let g=m!=null?m:await this.resolvePath(),v=this.resolve(g);if(!v){console.warn(`[Router] No route found for: ${g}`);return}let S=t.inject(J.PROVIDE_TOKEN);this.outletEl||(this.outletEl=await S.hostElement.query("#router-view"));let C=this.outletEl;if(!C)return;let B=await this.beforeRouteGoing({url:g,path:g,name:v.route.name},it(ht));if(B){typeof B=="object"&&"name"in B&&this.push({name:B.name,params:B.params});return}let V=it(ht);V.params=v.params,V.query=v.query,t.provide(ht,V);let D=await C.childNodes(),E=(P=D[D.length-1])!=null?P:null,x=E&&(T=S.getMountedComponent(E))!=null?T:null,A=this.getNavMode(),I,U,b=this.stack.length,w=this.stack[b-2];if(this.lastDirection==="back"&&w){I=w.host,U=w.inst;let _=C.updates();D.some(N=>N.uid===I.uid),_.add("appendChild",C,I),_.add("removeClass",I,"route-hidden"),await _.exec(),await Promise.all([w.ctx.updateBindings(),w.ctx.updateDirectives()]);}else {let _=await y.createElement("div",{class:"route-view route-hidden"});await C.appendChild(_);let N=await S.mountComponent(_,v.route.component,S);I=_,U=N,S==null||S.flushMounted(),this.lastDirection==="forward"&&this.stack.push({host:_,ctx:S,inst:N});}A==="push"?await this.runTransitionPush(C,E,I):A==="pop"&&E&&await this.runTransitionPop(C,E,I),E&&x&&this.lastDirection==="back"&&(this.stack.pop(),Ee(x),await S.unmountComponent(E)),ke(U),await this.afterRouteGoing({url:g,path:g,name:v.route.name},t.inject(ht)),await H();},"handler"),n=d(async m=>{let g=await this.resolvePath();return this.pendingNav?this.pendingNav:(this.pendingNav=(async()=>{try{let v=(m==null?void 0:m.state)||await this.windowObject.getProperty("history.state"),S=0;v&&typeof v.navIndex=="number"&&(S=v.navIndex),S>this.historyIndex?this.lastDirection="forward":S<this.historyIndex?this.lastDirection="back":this.lastDirection="none",this.historyIndex=S,await s(g);}finally{this.pendingNav=null;}})(),this.pendingNav)},"run"),r=await this.resolvePath(),l=await this.windowObject.getProperty("history.state");(!l||typeof l.navIndex!="number")&&await this.windowObject.invoke("history.replaceState",{navIndex:this.historyIndex},"",r);let a=await this.windowObject.addEventListener("popstate",n);return this.eventRegistration=a,s}async resolvePath(){let t=await this.windowObject.getProperty("location.href"),s=await this.windowObject.getProperty("location.origin"),n=t.replace(s,"");return n.startsWith("/")||(n="/"+n),n}unbind(){var t;this.eventRegistration&&((t=this.windowObject)==null||t.dettachEventListener(this.eventRegistration));}async runTransitionPush(t,s,n){if(!s){await n.updates().removeClass("route-hidden","route-transitioning","route-push-start").addClass("route-view","route-push-end").exec();return}let r=n.updates();r.addClass("route-view"),s&&r.add("addClass",s,"route-view"),r.removeClass("route-hidden","route-push-end","route-pop-end").addClass("route-push-start"),await r.exec(),await new Promise(m=>{y.requestAnimationFrame(()=>m());});let l=n.updates();l.addClass("route-transitioning").removeClass("route-push-start").addClass("route-push-end"),await l.exec(),await Rt(Zt+40);let a=n.updates();a.removeClass("route-transitioning","route-push-start"),s&&a.add("addClass",s,"route-hidden"),await a.exec();}async runTransitionPop(t,s,n){let r=s.updates();r.addClass("route-view"),r.add("addClass",n,"route-view"),r.add("removeClass",n,"route-hidden"),r.addClass("route-pop-start").removeClass("route-push-end","route-pop-end"),await r.exec(),await new Promise(m=>{y.requestAnimationFrame(()=>m());});let l=s.updates();l.addClass("route-transitioning"),l.removeClass("route-pop-start").addClass("route-pop-end"),await l.exec(),await Rt(Zt+40);let a=s.updates();a.addClass("route-hidden").removeClass("route-transitioning","route-pop-start"),await a.exec();}getNavMode(){return this.lastDirection==="back"?"pop":"push"}beforeEach(t){let s={fn:t,type:"before"};return this.guards.push(s),()=>{this.guards.splice(this.guards.indexOf(s));}}afterEach(t){let s={fn:t,type:"after"};return this.guards.push(s),()=>{this.guards.splice(this.guards.indexOf(s));}}};d(Ut,"Router");var Mt=Ut;var Vt=class Vt extends st{render(t){return et.of('<i class="o-icon"><slot></slot></i>')}style(){return vt.of({i:`
62
62
  display: inline-block;
63
63
  width: 1em;
64
64
  height: 1em;
65
65
  vertical-align: -0.15em;
66
66
  overflow: hidden;
67
- `})}};d(Lt,"OIcon");var Xt=Lt;function ds(){return K.getAll().reduce((t,[s,n])=>(t[s]=n,t),{})}d(ds,"components");exports.ACTIVE_ROUTE_TOKEN=Rt;exports.App=vt;exports.Component=Wt;exports.Emits=lt;exports.OComponent=st;exports.OIcon=Xt;exports.OUID=w;exports.OUIDBridge=It;exports.ROUTER_INJECTION_TOKEN=Yt;exports.RenderContext=J;exports.RenderNode=et;exports.Router=Dt;exports.State=pt;exports.StyleData=mt;exports.components=ds;exports.createComponent=Pt;exports.createRouter=rs;exports.inject=yt;exports.isStated=xt;exports.node=Ke;exports.o=he;exports.provide=fe;exports.stated=Te;exports.useRouter=we;//# sourceMappingURL=index.cjs.map
67
+ `})}};d(Vt,"OIcon");var ee=Vt;function ws(){return K.getAll().reduce((t,[s,n])=>(t[s]=n,t),{})}d(ws,"components");exports.ACTIVE_ROUTE_TOKEN=ht;exports.App=bt;exports.Component=Kt;exports.Emits=ft;exports.OComponent=st;exports.OIcon=ee;exports.OUID=y;exports.OUIDBridge=Dt;exports.ROUTER_INJECTION_TOKEN=te;exports.RenderContext=J;exports.RenderNode=et;exports.Router=Mt;exports.State=yt;exports.StyleData=vt;exports.components=ws;exports.createComponent=It;exports.createRouter=us;exports.inject=it;exports.isStated=At;exports.node=Ye;exports.o=me;exports.provide=ye;exports.stated=Ie;exports.useRouter=be;//# sourceMappingURL=index.cjs.map
68
68
  //# sourceMappingURL=index.cjs.map