ouider 0.2.0 → 0.2.2
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 +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -27
- package/dist/index.d.ts +15 -27
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
`:"";for(let s in this.data){let n=this.data[s];typeof n=="string"?
|
|
3
|
-
`:n instanceof
|
|
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+`
|
|
2
|
+
`:"";for(let s in this.data){let n=this.data[s];typeof n=="string"?t+=`${s} { ${n} }
|
|
3
|
+
`:n instanceof ot&&(t+=`${s} {
|
|
4
4
|
${n.toString()}}
|
|
5
|
-
`);}return
|
|
6
|
-
`))}};f(nt,"StyleData");var ut=nt;function vt(u,e,s){return new u(e,s)}f(vt,"createComponent");var gt=class gt{constructor(e={},s={}){m(this,"state");m(this,"parent");m(this,"emits");m(this,"props");m(this,"provides",new Map);this.state=new ct(this),this.props=e,this.emits=new ot(s);}onActivated(){}onDeactivated(){}onMounted(){}willMount(){}willUnmount(){}provide(e,s){this.provides.set(e,s);}inject(e){let s=this;for(;s;){if(s.provides.has(e))return s.provides.get(e);s=s.parent;}}decorateHostElement(e){return Promise.resolve()}};f(gt,"OComponent");var Z=gt;function tt(u){let e=Date.now();return `${(1e3+Math.floor(Math.random()*9e3)+u.length).toString(16)}-${e.toString(16)}`}f(tt,"generateUIID");function bt(u){return new Promise(e=>setTimeout(e,u))}f(bt,"delay");(function(u){var T,N,D,B,H,K,j,J,Q,q,F,$;let e=(T=class{constructor(){m(this,"actions",[]);}async exec(){await this.commit();}add(o){return this.actions.push(o),this}async commit(){let o=this.actions;this.actions=[],await Promise.all(o.map(async t=>await t()));}},f(T,"BatchActions"),T);u.BatchActions=e;let s=new Set(["invoke","dispatchEvent","setProperty"]),n=[],r=new Map,c=false,l=null;function d(){if(c)return;c=true;let z=f(()=>{c=false,v();},"runner");setTimeout(()=>z(),0);}f(d,"scheduleBatchFlush");async function v(){let z=n;n=[],r.clear();let o=l;l=null;try{z.length&&await w.batchActions(z),o==null||o.resolve();}catch(t){o==null||o.reject(t);}}f(v,"flushBatchQueue");function y(z){for(let o of z){if(s.has(o.fn)){n.push(o);continue}let t=`${o.fn}|${o.args.map(a=>typeof a=="object"?JSON.stringify(a):String(a)).join("|")}`,i=r.get(t);i!==void 0?n[i]=o:(r.set(t,n.length),n.push(o));}if(!l){let o,t,i=new Promise((a,h)=>{o=a,t=h;});return l={resolve:o,reject:t},d(),i}return d(),new Promise((o,t)=>{let i=l;l={resolve:f(()=>{i==null||i.resolve(),o();},"resolve"),reject:f(a=>{i==null||i.reject(a),t(a);},"reject")};})}f(y,"enqueueBatchActions");let k=(N=class{constructor(o){m(this,"node");m(this,"operations",[]);this.node=o;}accept(o){this.operations.push(...o.operations),o.operations=[];}async exec(o=false){let t=this.operations;this.operations=[];let i=[],a=t.map(h=>typeof h=="object"?(i.push({fn:h.fn,args:[h.node.uid,...h.args.map(p=>p instanceof S?p.uid:p)]}),null):h()).filter(h=>h!=null);if(i.length>0){let h={},p=[];i.forEach(E=>{let O=`${E.fn}.${E.args.map(L=>L==null?void 0:L.toString()).join(",")}`;h[O]&&!["invoke","setProperty","dispatchEvent"].includes(E.fn)||(h[O]=E,p.push(E));}),o?a.unshift(w.batchActions(p)):a.unshift(y(p));}try{await Promise.all(a);}catch(h){console.error("Error while batch updates");}}append(o,...t){return this.operations.push({fn:o,args:t,node:this.node}),this}add(o,t,...i){return typeof o=="function"?this.operations.push(o):this.operations.push({fn:o,args:i,node:t}),this}addEventListener(o,t,i,a){return this.add(()=>{this.node.addEventListener(o,t,{options:i,policy:a});})}setProperty(o,t){return this.append("setProperty",o,t)}dettachEventListener(o){return this.append("dettachEventListener",o)}invoke(o,...t){return this.append("invoke",o,...t.map(i=>i instanceof S?i.ref:i))}dispatchEvent(o,t,i){return this.append("dispatchEvent",o,t,i)}addClass(...o){return this.append("addClass",...o)}removeClass(...o){return this.append("removeClass",...o)}setAttribute(o,t){return this.append("setAttribute",o,t)}removeAttribute(o){return this.append("removeAttribute",o)}appendChild(o){return this.append("appendChild",o.uid)}removeChild(o){return this.append("removeChild",o.uid)}remove(){return this.append("remove")}removeAndRelease(){return this.append("remove").append("release")}release(){return this.append("release")}innerHTML(o){return this.append("setHTML",o)}replaceChildNode(o,t){return this.append("replaceChildNode",o,t)}replaceWith(o){return this.append("replaceWith",o.uid)}after(o){return this.append("after",o.uid)}setInnerText(o){return this.append("setInnerText",o)}setContentText(o){return this.append("setContentText",o)}insertBefore(o,t){return this.append("insertBefore",o.uid,t.uid)}setInputValue(o){return this.append("setInputValue",o)}setStyle(o,t){return this.append("setStyle",o,t)}},f(N,"BatchUpdates"),N);u.BatchUpdates=k;let S=(D=class{constructor(o,t){m(this,"uid");m(this,"tag");this.uid=o,this.tag=t;}static toInstance(o){return new D(o.uid,o.tag)}async release(){await w.call("releaseNode",this.uid);}async addEventListener(o,t,i){return w.addEventListener(this,o,t,{options:i==null?void 0:i.options,policy:i==null?void 0:i.policy})}async dettachEventListener(o){await w.dettachEventListener(o);}async invoke(o,...t){return await w.call("invokeObjectMethod",this.uid,o,...t)}async invokeAndHold(o,...t){let i=await w.call("invokeObjectMethodAndHold",this.uid,o,...t);return i&&new D(i.uid,i.tag)}async getProperty(o){return await w.call("getObjectProperty",this.uid,o)}async getPropertyAndHold(o){let t=await w.call("getObjectPropertyAndHold",this.uid,o);return t&&new D(t.uid,t.tag)}async setProperty(o,t){await w.call("setObjectProperty",this.uid,o,t);}async dispatchEvent(o,t,i){await w.call("dispatchEvent",this.uid,o,t,i);}updates(){return new k(this)}batches(){return new k(this)}get ref(){return {__ref__:this.uid}}},f(D,"OObject"),D);u.OObject=S;let M=(B=class extends S{constructor(t){super(t.uid,t.tag);m(this,"textContent");m(this,"type","Unknown");m(this,"attributes");m(this,"children");m(this,"classes");m(this,"style");for(let p in t)this[p]=t[p];(this.attributes)!=null||(this.attributes=[]),(this.classes)!=null||(this.classes=[]),(this.style)!=null||(this.style="");}},f(B,"ONode"),B);u.ONode=M;let _=(H=class extends M{constructor(t){super(t);m(this,"_hydrated",false);}async addClass(...t){await w.call("addClass",this.uid,...t);}async removeClass(...t){await w.call("removeClass",this.uid,...t);}async setAttribute(t,i){let a=await w.call("setAttribute",this.uid,t,i);a&&(this.attributes=a);}async removeAttribute(t){let i=await w.call("removeAttribute",this.uid,t);i&&(this.attributes=i);}async appendChild(t){await w.call("appendChild",this.uid,t.uid);}set innerHTML(t){this.setHTML(t);}async cloneNode(t){let i=await w.call("cloneNode",this.uid,t);return i?new H(i):null}async remove(){await w.call("removeNode",this.uid);}async removeAndRelease(){await this.remove(),await this.release();}async removeChild(t){await w.call("removeChild",this.uid,t.uid);}async replaceChildNode(t,i){await w.call("replaceChildNode",this.uid,t.uid,i.uid);}async replaceWith(t){await w.call("replaceWith",this.uid,t.uid);}async after(t){await w.call("insertAfter",this.uid,t.uid);}async setHTML(t){await w.call("setInnerHTML",this.uid,t);}async HTML(){var t;return (t=await w.call("getInnerHTML",this.uid))!=null?t:""}async setInnerText(t){await w.call("setInnerText",this.uid,t);}async setContentText(t){await w.call("setContentText",this.uid,t);}async getContentText(){var t;return (t=await w.call("getContentText",this.uid))!=null?t:""}async content(){var t;try{return (t=await w.call("getInnerText",this.uid))!=null?t:""}catch(i){return console.error(i),""}}async childNodes(){var t,i;return (i=(t=await w.call("childNodes",this.uid))==null?void 0:t.map(a=>new H(a)))!=null?i:[]}hasAttribute(t){return !!this.attributes.find(i=>i.name===t)}async getAttribute(t){var i;return (i=await w.call("getAttribte",this.uid,t))!=null?i:""}attribute(t){var i,a;return (a=(i=this.attributes.find(h=>h.name===t))==null?void 0:i.value)!=null?a:null}async nextSibling(){let t=await w.call("nextSibling",this.uid);return t?new H(t):null}async getAttributeNames(){var t;return (t=await w.call("getAttributeNames",this.uid))!=null?t:[]}async parentNode(){let t=await w.call("parentNode",this.uid);return t?new H(t):null}async insertBefore(t,i){await w.call("insertBefore",this.uid,t.uid,i.uid);}async setInputValue(t){await w.call("setInputValue",this.uid,t);}async inputValue(){var t;return (t=await w.call("inputValue",this.uid))!=null?t:""}get hydrated(){return this._hydrated}hydrate(){this._hydrated=true,this.addClass("hydrated");}async query(t,i){return await w.query(t,i,this.uid)}async queryAll(t,i){return await w.queryAll(t,i,this.uid)}async setStyle(t,i){await w.call("setStyle",this.uid,t,i);}},f(H,"OElement"),H);u.OElement=_;let x=(K=class extends S{constructor(o){super(o.uid,o.tag);}addColorStop(o,t){return this.invoke("addColorStop",o,t),this}},f(K,"CanvasGradient"),K);u.CanvasGradient=x;let C=(j=class extends S{constructor(t){super(t.uid,t.tag);m(this,"batch",new k(this));}static async new(t){let i=typeof t!="undefined"?await w.newObject("DOMMatrix",t):await w.newObject("DOMMatrix");return i?new j(i):null}invertSelf(){return this.batch.invoke("invertSelf"),this}multiplySelf(t){return this.batch.invoke("multiplySelf",...t?[t.ref]:[]),this}premultiplySelf(t){return this.batch.invoke("premultiplySelf",...t?[t.ref]:[]),this}rotateAxisAngleSelf(t,i,a,h){let p=[];return t&&p.push(t),i&&p.push(i),a&&p.push(a),h&&p.push(h),this.batch.invoke("rotateAxisAngleSelf",...p),this}rotateFromVectorSelf(t,i){let a=[];return t&&a.push(t),i&&a.push(i),this.batch.invoke("rotateFromVectorSelf",...a),this}rotateSelf(t,i,a){let h=[];return t&&h.push(t),i&&h.push(i),a&&h.push(a),this.batch.invoke("rotateFromVectorSelf",...h),this}scale3dSelf(t,i,a,h){let p=[];return t&&p.push(t),i&&p.push(i),a&&p.push(a),h&&p.push(h),this.batch.invoke("scale3dSelf",...p),this}scaleSelf(t,i,a,h,p,E){let O=[];return t&&O.push(t),i&&O.push(i),a&&O.push(a),h&&O.push(h),p&&O.push(p),E&&O.push(E),this.batch.invoke("scaleSelf",...O),this}setMatrixValue(t){return this.invoke("setMatrixValue",t),this}skewXSelf(t){return this.batch.invoke("skewXSelf",t),this}skewYSelf(t){return this.batch.invoke("skewYSelf",t),this}translateSelf(t,i,a){return this.batch.invoke("translateSelf",t,i,...a?[a]:[]),this}async commit(){await this.batch.exec();}async is2D(){var t;return (t=await this.invoke("is2D"))!=null?t:false}async isIdentity(){var t;return (t=await this.invoke("isIdentity"))!=null?t:false}async flipX(){let t=await this.invokeAndHold("flipX");return t?new j(t):null}async flipY(){let t=await this.invokeAndHold("flipY");return t?new j(t):null}async inverse(){let t=await this.invokeAndHold("inverse");return t?new j(t):null}async multiply(t){let i=await this.invokeAndHold("multiply",...t?[t.ref]:[]);return i?new j(i):null}async rotate(t,i,a){let h=[];t&&h.push(t),i&&h.push(i),a&&h.push(a);let p=await this.invokeAndHold("rotate",...h);return p?new j(p):null}async rotateAxisAngle(t,i,a,h){let p=[];t&&p.push(t),i&&p.push(i),a&&p.push(a),h&&p.push(h);let E=await this.invokeAndHold("rotateAxisAngle",...p);return E?new j(E):null}async rotateFromVector(t,i){let a=[];t&&a.push(t),i&&a.push(i);let h=await this.invokeAndHold("rotateFromVector",...a);return h?new j(h):null}async scale(t,i,a,h,p,E){let O=[];t&&O.push(t),i&&O.push(i),a&&O.push(a),h&&O.push(h),p&&O.push(p),E&&O.push(E);let L=await this.invokeAndHold("scale",...O);return L?new j(L):null}async scale3d(t,i,a,h){let p=[];t&&p.push(t),i&&p.push(i),a&&p.push(a),h&&p.push(h);let E=await this.invokeAndHold("scale",...p);return E?new j(E):null}async skewX(t){let i=[];t&&i.push(t);let a=await this.invokeAndHold("skewX",...i);return a?new j(a):null}async skewY(t){let i=[];t&&i.push(t);let a=await this.invokeAndHold("skewY",...i);return a?new j(a):null}toJSON(){return this.invoke("toJSON")}async toString(){return this.invoke("toString")}async translate(t,i,a){let h=[];t&&h.push(t),i&&h.push(i),a&&h.push(a);let p=await this.invokeAndHold("translate",...h);return p?new j(p):null}},f(j,"DOMMatrix"),j);u.DOMMatrix=C;let A=(J=class extends S{constructor(o){super(o.uid,o.tag);}async setTransform(o){await this.invoke("setTransform",o.ref);}},f(J,"CanvasPattern"),J);u.CanvasPattern=A;let P=(Q=class extends S{constructor(t){super(t,"unknown");m(this,"batch",new k(this));}arc(t,i,a,h,p,E=false){return this.batch.invoke("arc",t,i,a,h,p,E),this}arcTo(t,i,a,h,p){return this.batch.invoke("arcTo",t,i,a,h,p),this}bezierCurveTo(t,i,a,h,p,E){return this.batch.invoke("bezierCurveTo",t,i,a,h,p,E),this}clearRect(t,i,a,h){return this.batch.invoke("clearRect",t,i,a,h),this}clip(t,i){let a=[];return typeof t=="string"?a.push(t):t instanceof g&&(t.commit(this.batch),a.push(t.ref)),typeof i=="string"&&a.push(i),this.batch.invoke("clip",...a),this}beginPath(){return this.batch.invoke("beginPath"),this}closePath(){return this.batch.invoke("closePath"),this}async createConicGradient(t,i,a){let h=await this.invokeAndHold("createConicGradient",t,i,a);return h?new x(h):null}async createLinearGradient(t,i,a,h){let p=await this.invokeAndHold("createLinearGradient",t,i,a,h);return p?new x(p):null}async createPattern(t,i=""){let a=await this.invokeAndHold("createPattern",t.ref,i);return a?new A(a):null}async createRadialGradient(t,i,a,h,p,E){let O=await this.invokeAndHold("createRadialGradient",t,i,a,h,p,E);return O?new x(O):null}drawImage(t,i,a,h,p,E,O,L,Ut){let Y=[t.ref];return typeof E=="undefined"?(Y.push(i,a),h&&Y.push(h),p&&Y.push(p),this.batch.invoke("drawImage",...Y),this):(Y.push(i,a,h,p,E,O,L,Ut),this.batch.invoke("drawImage",...Y),this)}ellipse(t,i,a,h,p,E,O,L=false){return this.batch.invoke("ellipse",t,i,a,h,p,E,O,L),this}fill(t,i){let a=[];return t&&a.push(typeof t=="string"?t:(t.commit(this.batch),t.ref)),i&&a.push(i),this.batch.invoke("fill",...a),this}fillRect(t,i,a,h){return this.batch.invoke("fillRect",t,i,a,h),this}fillText(t,i,a,h){return this.batch.invoke("fillText",t,i,a,...h?[h]:[]),this}getImageData(t,i,a,h,p){return this.invokeAndHold("getImageData",t,i,a,h,...p?[p]:[])}getLineDash(){return this.invoke("getLineDash")}async getTransform(){let t=await this.invokeAndHold("getTransform");return t?new C(t):null}async isContextLost(){return await this.invoke("isContextLost")}async isPointInPath(t,i,a,h){let p=[];return typeof t=="number"?(p.push(t,i),a&&p.push(a)):(await t.commit(this.batch),p.push(t.ref,i,a),h&&p.push(h)),await this.invoke("isPointInPath",...p)}async isPointInStroke(t,i,a){var p;let h=[];return typeof t=="number"?h.push(t,i):(await t.commit(),h.push(t.ref,i,a)),(p=await this.invoke("isPointInStroke",...h))!=null?p:false}lineTo(t,i){return this.batch.invoke("lineTo",t,i),this}async measureText(t){var i;return (i=await this.invoke("measureText",t))!=null?i:0}moveTo(t,i){return this.batch.invoke("moveTo",t,i),this}putImageData(t,i,a,h,p,E,O){let L=[t.ref,i,a];return h&&L.push(h),p&&L.push(p),E&&L.push(E),O&&L.push(O),this.batch.invoke("putImageData",...L),this}quadraticCurveTo(t,i,a,h){return this.batch.invoke("quadraticCurveTo",t,i,a,h),this}rect(t,i,a,h){return this.batch.invoke("rect",t,i,a,h),this}reset(){this.invoke("reset");}resetTransform(){this.invoke("resetTransform");}restore(){return this.batch.invoke("restore")}rotate(t){return this.batch.invoke("rotate",t),this}roundRect(t,i,a,h,p){return this.batch.invoke("roundRect",t,i,a,h,p),this}save(){return this.batch.invoke("save")}scale(t,i){return this.batch.invoke("scale",t,i),this}setLineDash(t){return this.invoke("setLineDash",t)}setTransform(t,i,a,h,p,E){typeof t=="number"?this.batch.invoke("setTransform",t,i,a,h,p,E):this.batch.invoke("setTransform",t.ref);}stroke(t){return this.batch.invoke("stroke",...t?[(t.commit(this.batch),t.ref)]:[]),this}strokeRect(t,i,a,h){return this.batch.invoke("strokeRect",t,i,a,h),this}strokeText(t,i,a,h){return this.batch.invoke("strokeText",t,i,a,...h?[h]:[]),this}transform(t,i,a,h,p,E){return this.batch.invoke("transform",t,i,a,h,p,E),this}translate(t,i){return this.batch.invoke("translate",t,i),this}set fillStyle(t){this.setFillStyle(t);}setFillStyle(t){return this.batch.setProperty("fillStyle",typeof t=="string"?t:t instanceof S?t.ref:t),this}set filter(t){this.setFilter(t);}setFilter(t){return this.batch.setProperty("filter",t),this}set font(t){this.setFont(t);}setFont(t){return this.batch.setProperty("font",t),this}set fontKerning(t){this.setFontKerning(t);}setFontKerning(t){return this.batch.setProperty("fontKerning",t),this}set fontStretch(t){this.setFontStretch(t);}setFontStretch(t){return this.batch.setProperty("fontStretch",t),this}set fontVariantCaps(t){this.setFontVariantCaps(t);}setFontVariantCaps(t){return this.batch.setProperty("fontVariantCaps",t),this}set globalAlpha(t){this.setGlobalAlpha(t);}setGlobalAlpha(t){return this.batch.setProperty("globalAlpha",t),this}set globalCompositeOperation(t){this.setGlobalCompositeOperation(t);}setGlobalCompositeOperation(t){return this.batch.setProperty("globalCompositeOperation",t),this}set imageSmoothingEnabled(t){this.setImageSmoothingEnabled(t);}setImageSmoothingEnabled(t){return this.batch.setProperty("imageSmoothingEnabled",t),this}set imageSmoothingQuality(t){this.setImageSmoothingQuality(t);}setImageSmoothingQuality(t){return this.batch.setProperty("imageSmoothingQuality",t),this}set letterSpacing(t){this.setLetterSpacing(t);}setLetterSpacing(t){return this.batch.setProperty("letterSpacing",t),this}set lineCap(t){this.setLineCap(t);}setLineCap(t){return this.batch.setProperty("lineCap",t),this}set lineDashOffset(t){this.setLineDashOffset(t);}setLineDashOffset(t){return this.batch.setProperty("lineDashOffset",t),this}set lineJoin(t){this.setLineJoin(t);}setLineJoin(t){return this.batch.setProperty("lineJoin",t),this}set lineWidth(t){this.setLineWidth(t);}setLineWidth(t){return this.batch.setProperty("lineWidth",t),this}set miterLimit(t){this.setMiterLimit(t);}setMiterLimit(t){return this.batch.setProperty("miterLimit",t),this}set shadowBlur(t){this.setShadowBlur(t);}setShadowBlur(t){return this.batch.setProperty("shadowBlur",t),this}set shadowColor(t){this.setShadowColor(t);}setShadowColor(t){return this.batch.setProperty("shadowColor",t),this}set shadowOffsetX(t){this.setShadowOffsetX(t);}setShadowOffsetX(t){return this.batch.setProperty("shadowOffsetX",t),this}set shadowOffsetY(t){this.setShadowOffsetY(t);}setShadowOffsetY(t){return this.batch.setProperty("shadowOffsetY",t),this}set strokeStyle(t){this.setStrokeStyle(t);}setStrokeStyle(t){return this.batch.setProperty("strokeStyle",typeof t=="string"?t:t instanceof S?t.ref:t),this}set textAlign(t){this.setTextAlign(t);}setTextAlign(t){return this.batch.setProperty("textAlign",t),this}set textBaseline(t){this.setTextBaseline(t);}setTextBaseline(t){return this.batch.setProperty("textBaseline",t),this}set wordSpacing(t){this.setWordSpacing(t);}setWordSpacing(t){return this.batch.setProperty("wordSpacing",t),this}set textRendering(t){this.setTextRendering(t);}setTextRendering(t){return this.batch.setProperty("textRendering",t),this}async commit(){await this.batch.exec();}},f(Q,"Canvas2DContext"),Q);u.Canvas2DContext=P;let I=(q=class extends S{constructor(o){super(o.uid,o.tag);}static async new(o,t){let i=[];o&&i.push(o),t&&i.push(t);let a=await w.newObject("Image",...i);return a?new q(a):null}async width(){var o;return (o=await this.getProperty("width"))!=null?o:0}async height(){var o;return (o=await this.getProperty("height"))!=null?o:0}async naturalWidth(){var o;return (o=await this.getProperty("naturalWidth"))!=null?o:0}async naturalHeight(){var o;return (o=await this.getProperty("naturalHeight"))!=null?o:0}async src(){return await this.getProperty("src")}async currentSrc(){return await this.getProperty("currentSrc")}async setSrc(o){await this.setProperty("src",o);}},f(q,"Image"),q);u.Image=I;let g=(F=class extends S{constructor(t){super(t.uid,t.tag);m(this,"batch",new k(this));}static async create(){let t=await w.newObject("Path2D");return t?new F(t):null}addPath(t){return this.batch.invoke("addPath",t.ref),this}arc(t,i,a,h,p,E=false){return this.batch.invoke("arc",t,i,a,h,p,E),this}arcTo(t,i,a,h,p){return this.batch.invoke("arcTo",t,i,a,h,p),this}bezierCurveTo(t,i,a,h,p,E){return this.batch.invoke("bezierCurveTo",t,i,a,h,p,E),this}quadraticCurveTo(t,i,a,h){return this.batch.invoke("quadraticCurveTo",t,i,a,h),this}closePath(){return this.batch.invoke("closePath"),this}ellipse(t,i,a,h,p,E,O,L=false){return this.batch.invoke("ellipse",t,i,a,h,p,E,O,L),this}moveTo(t,i){return this.batch.invoke("moveTo",t,i),this}lineTo(t,i){return this.batch.invoke("lineTo",t,i),this}rect(t,i,a,h){return this.batch.invoke("rect",t,i,a,h),this}roundRect(t,i,a,h,p){return this.batch.invoke("roundRect",t,i,a,h,p),this}commit(t){return t?(t.accept(this.batch),Promise.resolve()):this.batch.exec()}},f(F,"CanvasPath2D"),F);u.CanvasPath2D=g;let b=($=class extends _{constructor(o){super(o);}async width(){return this.getProperty("width")}async height(){return this.getProperty("height")}async setWidth(o){this.setProperty("width",o);}async setHeight(o){this.setProperty("height",o);}async getContext(o){let t=await this.invokeAndHold("getContext",o);return t&&new P(t.uid)}static async of(o,t,i){let a=await w.query(o,t);return a?new $(a):null}},f($,"CanvasElement"),$);u.CanvasElement=b;})(exports.ODOM||(exports.ODOM={}));var Et=class Et{constructor(){m(this,"callbacks",new Map);m(this,"DOM_EVENT_LISTENERS",new Map);m(this,"timers",new Map);m(this,"_config");m(this,"listeners",new Map);this.subscribe("__ouid_native_event_success__",(e,s)=>{let n=this.callbacks.get(e);if(n)return this.callbacks.delete(e),n.success(...JSON.parse(s))}),this.subscribe("__ouid_native_event_error__",(e,s)=>{let n=this.callbacks.get(e);if(n)return this.callbacks.delete(e),n.error(...JSON.parse(s))}),this.subscribe("__ouid_web_event__",(e,s)=>{let n=this.DOM_EVENT_LISTENERS.get(e),r=JSON.parse(s);if(n){let c=r[1];return c&&typeof c=="object"&&(c.target=c!=null&&c.target?new exports.ODOM.OElement(c.target):null,c.currentTarget=c!=null&&c.currentTarget?new exports.ODOM.OElement(c.currentTarget):null,c.relatedTarget=c!=null&&c.relatedTarget?new exports.ODOM.OElement(c.relatedTarget):null),n(c)}else console.error("No cb found for ",e,r[0]);});}config(e){return this._config=e,this}invoke(e,...s){let n=tt(e);return new Promise((r,c)=>{this.callbacks.set(n,{success:r,error:c});try{if(!WebOUID)throw new Error("NativeOUID bridge not available");WebOUID.invoke(n,e,JSON.stringify(s));}catch(l){console.error(l),this.callbacks.delete(n);}})}registerComponent(e,s){W.register(e,s);}unregisterComponent(e,s){W.unregister(e);}async call(e,...s){try{return (await this.invoke(`_ouid_${e}`,...s)).data}catch(n){return console.error(n),null}}emit(e,s){WebOUID==null||WebOUID.invoke("event",e,JSON.stringify(s));}subscribe(e,s){this.listeners.has(e)||(this.listeners.set(e,[]),globalThis[e]=(n,r)=>{var c;(c=this.listeners.get(e))==null||c.forEach(l=>l(n,r));}),this.listeners.get(e).push(s);}async query(e,s,n){let r=await this.call("query",e,s,n);return r?new exports.ODOM.OElement(r):null}async queryAll(e,s,n){let r=await this.call("queryAll",e,s,n);return r?r.map(c=>new exports.ODOM.OElement(c)):[]}async createElement(e,s={}){let n=await this.call("createElement",e,s);return n?new exports.ODOM.OElement(n):null}async createComment(e){let s=await this.call("createComment",e);return s?new exports.ODOM.OElement(s):null}async addEventListener(e,s,n,r){let c=tt(s+(typeof e=="string"?e:e.tag));return this.DOM_EVENT_LISTENERS.set(c,n),await w.call("attachEventListener",typeof e=="string"?e:e.uid,c,s,r==null?void 0:r.options,r==null?void 0:r.policy),c}async dettachEventListener(e){this.DOM_EVENT_LISTENERS.delete(e),await w.call("dettachEventListener",e);}async createComponentStyles(e,s=true){let n=await w.call("createComponentStyles",e,s);return n?new exports.ODOM.OElement(n):null}async appendComponentStyles(e){await w.call("appendComponentStyles",e);}async rejectComponentStyles(e){await w.call("rejectComponentStyles",e.uid);}async getOObject(e){let s=await w.call("getOObject",e);return s?new exports.ODOM.OObject(s.uid,s.tag):null}async acquireObject(e){let s=await w.call("acquireObject",e);return s?new exports.ODOM.OObject(s.uid,s.tag):null}async setTimeout(e,s){var c;let n=tt("setTimeout"+s);this.DOM_EVENT_LISTENERS.set(n,()=>{e();let l=this.timers.get(r);l&&(this.timers.delete(r),this.DOM_EVENT_LISTENERS.delete(l));});let r=(c=await w.call("setTimeout",n,s))!=null?c:-1;return r>=0&&this.timers.set(r,n),r}async clearTimeout(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await w.call("clearTimeout",e));}async setInterval(e,s){var c;let n=tt("setInterval"+s);this.DOM_EVENT_LISTENERS.set(n,e);let r=(c=await w.call("setInterval",n,s))!=null?c:-1;return r>=0&&this.timers.set(r,n),r}async clearInterval(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await w.call("clearInterval",e));}async fetch(e,s,n="json"){let r=await w.call("fetch",e,s,n);return n==="buffer"||n==="bytes"?exports.ODOM.OObject.toInstance(r):r}async alert(e){console.log("Alerting:::",e),await w.call("alert",e);}async prompt(e){await w.call("prompt",e);}async newObject(e,...s){return w.call("newObject",e,...s)}async requestAnimationFrame(e){var r;let s=tt("requestAnimationFrame");this.DOM_EVENT_LISTENERS.set(s,c=>{e(c);let l=this.timers.get(n);l&&(this.DOM_EVENT_LISTENERS.delete(l),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(e){let s=this.timers.get(e);s&&(this.timers.delete(e),await w.call("cancelAnimationFrame",e),this.DOM_EVENT_LISTENERS.delete(s));}async batchActions(e){await w.call("batchActions",e);}nextTick(e){w.setTimeout(e,0);}};f(Et,"OUIDBridge");var kt=Et,w=new Proxy(new kt,{get:f((u,e)=>e in u?u[e]:async(...s)=>await u.call(e,...s),"get")});globalThis.OUID=w;exports.ODOM=void 0;function qt(u){return u.replace(/-([a-z])/g,(e,s)=>s.toUpperCase())}f(qt,"toCamelCase");function Ft(u){return u.replace(/(?!^)([A-Z])/g,(e,s)=>`-${s.toLowerCase()}`)}f(Ft,"toSnakeCase");function V(u){return mt(u)?u.value:u}f(V,"normaliseValue");var $t=typeof globalThis.queueMicrotask=="function",it=f(u=>u?$t?queueMicrotask(u):Promise.resolve().then(u):Promise.resolve(),"deferMicro"),Se=f(()=>new Promise(u=>setTimeout(u,0)),"deferMacro");function Wt(u){return typeof u=="function"&&!("prototype"in u)}f(Wt,"isLazyLoader");var It=new Map,Nt=new Map,Dt=new WeakMap;function Gt(u){var n;if(!u||typeof u!="object"&&typeof u!="function")return {};let e=Dt.get(u);if(e)return e;let s=Object.create(null);for(let r=u;r&&r!==Object.prototype;r=Object.getPrototypeOf(r))for(let c of Object.getOwnPropertyNames(r)){if(c==="constructor"||c.startsWith("__")||c.endsWith("__")||c in s)continue;let l=Object.getOwnPropertyDescriptor(r,c);if(!l)continue;let d=(n=l.value)!=null?n:l.get?l.get.call(u):void 0;s[c]=typeof d=="function"?d.bind(u):d;}return Dt.set(u,s),s}f(Gt,"getMethodsView");function Lt(u,e){let s=It.get(u);return s||(s=new Function("s","with (s) { return ("+u+"); }"),It.set(u,s)),s(e)}f(Lt,"evalInScope");function Kt(u){let e=Nt.get(u);if(e)return e;let s=[],n=0;for(;n<u.length;){let r=u.indexOf("{{",n);if(r<0){s.push({t:u.slice(n)});break}r>n&&s.push({t:u.slice(n,r)});let c=u.indexOf("}}",r+2),l=c>=0?u.slice(r+2,c).trim():u.slice(r+2).trim();s.push({e:l}),n=c>=0?c+2:u.length;}return e=f(r=>{let c="";for(let l of s)if(l.t!==void 0)c+=l.t;else if(l.e!==void 0){let d=V(Lt(l.e,r));c+=d==null?"":String(d);}return c},"fn"),Nt.set(u,e),e}f(Kt,"compileInterpolated");var jt,U=class U{constructor(e,s,n,...r){m(this,"app");m(this,"component");m(this,"parentContext");m(this,"bindings",[]);m(this,"directives",[]);m(this,"mountedComponents",(jt=lt(U.MOUNTED_COMPONENTS_TOKEN))!=null?jt:new Map);m(this,"componentsRegistry",new et);m(this,"updatingDirectives",false);m(this,"updatingBindings",false);m(this,"_stack",[]);m(this,"flatStack",Object.create(null));m(this,"viewUpdates");m(this,"mountedQueue",[]);this.app=e,this.component=s,this.parentContext=n;for(let c of r)this.push(c);}get hostElement(){return this.component._hostElement}get stack(){return this._stack}set stack(e){this.flatStack=Object.create(null),this._stack=[];for(let s of e)this.push(s);}getRoot(){let e=this;for(;e.parentContext;)e=e.parentContext;return e}enqueueMounted(e){this.getRoot().mountedQueue.push(e);}async flushMounted(){let e=this.getRoot(),s=e.mountedQueue;e.mountedQueue=[];for(let n of s)try{n();}catch(r){console.error("onMounted error:",r);}}getMountedComponent(e){return this.mountedComponents.get(e.uid)}bind(e){this.bindings.push(e);}directive(e){this.directives.push(e);}evaluateExpression(e){return this.resolve(e)}resolveScope(...e){var r,c;let s=(c=(r=this.component.state)==null?void 0:r.value)!=null?c:{},n=Gt(s);return new Proxy(Object.create(null),{get:f((l,d)=>{for(let v=e.length-1;v>=0;v--)if(d in e[v])return V(e[v][d]);return d in this.flatStack?V(this.flatStack[d]):d in n?V(n[d]):V(s[d])},"get"),set:f((l,d,v)=>{let y=null;for(let k=e.length-1;k>=0;k--)if(d in e[k]){y=e[k][d];break}return y||(d in this.flatStack?y=this.flatStack[d]:d in n?y=n[d]:y=s[d]),y&&mt(y)?(y.value=v,true):false},"set"),has:f((l,d)=>e.some(v=>d in v)||d in this.flatStack||d in n||d in s,"has")})}resolve(e,...s){if(!e)return;let n=this.resolveScope(...s);try{return Lt(e,n)}catch(r){return}}updateValue(e,s){this.resolve(`${e}=__o_model_value__`,{__o_model_value__:s}),this.component.state.didChange(e,void 0,s);}push(e){this._stack.unshift(e),Object.assign(this.flatStack,e);}pop(){let e=this._stack.shift();if(e)for(let s of Object.keys(e))delete this.flatStack[s];}resolveTag(e){var n;let s=this;for(;;){if(s.componentsRegistry.has(e))return s.componentsRegistry.get(e);if(s=(n=s==null?void 0:s.parentContext)!=null?n:null,!s)break}return W.get(e)}async updateBindings(){if(!this.updatingBindings){this.updatingBindings=true;for(let e of this.bindings)this.updateBinding(e);this.updatingBindings=false;}}updateBinding(e){if(e.type==="model"){e.node.setProperty("value",V(e.context.resolve(e.key)));return}if(e.type==="interpolation"){let s=e.templateFn(e.context.resolveScope());this.viewUpdates.add("setContentText",e.node,s);return}if(e.type==="attribute"){let s=e.key,n=V(this.resolve(e.template));s==="class"?this.expandClass(e.node,n):s==="style"?this.expandStyle(e.node,n):typeof n!="object"&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="undefined"&&this.viewUpdates.add("setAttribute",e.node,s,n.toString());return}if(e.type==="prop"&&e.context.component){let s=V(this.resolve(e.template));try{e.context.component.props[e.key]=s,Promise.all([e.context.updateBindings(),e.context.updateDirectives()]).then(()=>{e.context.viewUpdates.exec();});}catch(n){console.error(n);}return}}async updateDirectives(){var n;if(this.updatingDirectives)return;let e=new exports.ODOM.BatchActions;this.updatingDirectives=true;for(let r of this.directives){if(r.type==="if"){if(!V(r.context.evaluateExpression(r.expr))){if(r.active===false)continue;r.active=false,r.renderedNode&&(r.destroy?this.unmountComponent(r.renderedNode):this.viewUpdates.add("addClass",r.renderedNode,"oui-hidden"));continue}if(r.active===true)continue;r.active=true;let l=r.renderedNode;if(!l||r.destroy){let d=await r.node.cloneNode(true);r.renderedNode=d,await r.context.render(d),this.viewUpdates.add("after",r.placeholder,d);}else this.viewUpdates.add("removeClass",l,"oui-hidden");}if(r.type==="for"){let c=(n=r.children)!=null?n:new Map,l=new Map,d=f((x,C)=>r.key?V(r.context.resolve(r.key,{[r.item]:x})):C,"keyFn"),v=V(r.context.resolve(r.list))||[],y=new exports.ODOM.BatchActions,k=32,S=0,M=r.placeholder;for(let x=0;x<v.length;x++){let C=v[x],A=d(C,x),P=c.get(A),I,g,b=M;if(P){I=P.node,g=P.ctx,g.stack=[{[r.item]:C},...r.context.stack];let T=await M.nextSibling();I.uid!==(T==null?void 0:T.uid)&&y.add(()=>b.after(I)),await Promise.all([g.updateBindings(),g.updateDirectives()]);}else g=new U(this.app,this.component,this),g.viewUpdates=this.viewUpdates,g.stack=[{[r.item]:C},...r.context.stack],I=await r.node.cloneNode(true),y.add(async()=>{await b.after(I);}),await g.render(I),await g.updateDirectives();M=I,l.set(A,{node:I,ctx:g}),++S>=k&&(S=0,await y.commit(),await it());}let _=[];for(let[x,C]of c.entries())l.has(x)||_.push(this.unmountComponent(C.node));await Promise.all(_),await y.commit(),r.children=l;}}await e.commit(),this.updatingDirectives=false;}async render(e,s){if(e.hydrated||s!=null&&s.skipSlotted&&e.hasAttribute("slotted"))return;switch(e.type){case "Text":this.handleTextNode(e);break;case "Element":await this.handleElementNode(e,s);break;}let n=new exports.ODOM.BatchActions;await Promise.all([this.updateBindings(),this.updateDirectives()]),n.commit(),this.viewUpdates.add("addClass",e,"hydrated");}async expandClass(e,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",e,...n);}expandStyle(e,s){let n=s;typeof s=="object"&&!Array.isArray(s)&&(n=Object.keys(s).filter(r=>s[r]).map(r=>`${Ft(r)}: ${s[r]}`).join(";")),n&&this.viewUpdates.add("setAttribute",e,"style",n);}expandStandardAttributes(e){[...e.attributes].filter(s=>s.name.startsWith(":")).forEach(s=>{let n=s.name.substring(1);this.bind({type:"attribute",node:e,key:n,context:this,template:s.value.trim()}),this.viewUpdates.add("removeAttribute",e,s.name);});}setRefValue(e,s){let n=e.trim();this.updateValue(n,s);}async handleElementNode(e,s){var x;let n=await e.parentNode(),r=null,c=e.hasAttribute("o-if")?"o-if":e.hasAttribute("o-show")?"o-show":null;if(c){let C=await e.getAttribute(c),A=await OUID.createComment(c+":"+C),P=c==="o-if";await n.insertBefore(e,A),await e.updates().removeAttribute(c).remove().exec(),this.directive({type:"if",expr:C,node:e,placeholder:A,context:this,active:void 0,destroy:P}),r="if";return}if(e.hasAttribute("o-for")){if(r==="if")throw new Error("Can't have o-if and o-for on the same component");let C=await e.getAttribute("o-for"),[A,P]=C.split(" of ").map(b=>b.trim()),I=await OUID.createComment("for:"+C),g=(x=e.attribute(":key"))!=null?x:"";await(n==null?void 0:n.insertBefore(e,I)),await e.updates().removeAttribute("o-for").removeAttribute(":key").remove().exec(),this.directive({type:"for",item:A,list:P,node:e,placeholder:I,context:this,key:g}),r="for";return}let l=e.tag.toLowerCase(),d=this.resolveTag(l),v=e.updates();[...e.attributes].forEach(async C=>{if(C.name==="o-model"){let A=C.value.trim();v.setInputValue(V(this.resolve(A))).addEventListener("input",async I=>{let g=await I.target.getProperty("value");this.updateValue(A,g);}),this.bind({node:e,key:A,type:"model",context:this}),v.removeAttribute(C.name);}else C.name==="ref"&&(d||this.setRefValue(C.value,e));});let y={},k={},{props:S,events:M}=this.componentAttributes(e,this);if(y=S,k=M,this.expandStandardAttributes(e),Object.keys(k).forEach(async C=>{let A=k[C];d||v.addEventListener(C,P=>{typeof A=="function"&&A.apply(this.component,[P]);}),v.removeAttribute("@"+C);}),this.viewUpdates.accept(v),d){await this.mountComponent(e,d,this,y,k);return}let _=await e.childNodes();s!=null&&s.skipSlotted&&(_=_.filter(C=>!C.hasAttribute("slotted")));for(let C of _)await this.render(C,s);}handleTextNode(e){var n;let s=(n=e.textContent)!=null?n:"";s.includes("{{")&&this.bind({type:"interpolation",node:e,key:"__template__",templateFn:Kt(s),context:this});}componentAttributes(e,s){let n={},r={},c=["import","interface","module","o-model","o-if","o-for"];return [...e.attributes].filter(l=>!c.includes(l.name)).forEach(l=>{let d=l.name;if(d.startsWith("@")){let k=s==null?void 0:s.resolve(l.value);if(typeof k!="function")throw new Error("Event handler can only be function");d=d.substring(1),r[d]=k;return}let v=null,y=l.value;d.startsWith(":")&&(v=l.value,d=d.substring(1),y=V(s==null?void 0:s.resolve(l.value))),d=qt(d),n[d]={name:d,value:y,expr:v};}),{props:n,events:r}}async mountComponent(e,s,n,r={},c={}){var M,_,x,C,A,I;if(this.viewUpdates=(_=(M=this.viewUpdates)!=null?M:n==null?void 0:n.viewUpdates)!=null?_:new exports.ODOM.BatchUpdates(e),this.mountedComponents.has(e.uid))return this.mountedComponents.get(e.uid);let l=new U(this.app,{},this);l.viewUpdates=this.viewUpdates;let d={},v;for(let g of Object.keys(r)){let b=r[g];if(b.name==="ref"&&!b.expr){v=b;continue}b.expr&&this.bind({type:"prop",node:e,key:g,context:l,template:b.expr}),d[g]=b.value;}let y=await Jt(s,d,c);l.component=y,l.stack=[],this.mountedComponents.set(e.uid,y),v&&this.setRefValue(v.value,y);{let g=e.updates();for(let T of Object.keys(r))r[T].expr||g.setAttribute(T,r[T].value);let b=(x=y.hostClasses)!=null?x:[];b&&(b=typeof b=="string"?[b]:b),b.push("o-component-host"),e.tag.toLowerCase()!=="div"&&b.push("c-"+e.tag.toLowerCase()),g.addClass(...b),this.viewUpdates.accept(g);}it(async()=>{try{await y.decorateHostElement(e);}catch(g){}});{let g=(C=y.use)!=null?C:{};for(let b of Object.keys(g))l.componentsRegistry.register(b,g[b]);}if(y.willMount(),!s.cssInstance){let g=y.style?(A=y.style())==null?void 0:A.toString():y.css;g&&((s.cssInstance)!=null||(s.cssInstance=await OUID.createComponentStyles(g,false)));}it(()=>{var b;let g=s.cssInstance;if(g){let T=(b=U.STYLE_REF.get(g))!=null?b:0;T===0&&OUID.appendComponentStyles(g.uid),U.STYLE_REF.set(g,T+1),y.cssInstance=g;}});let k=await e.childNodes();if(y.render){let g=await y.render(l);g&&g.attachTo(e);}else await e.setHTML(y.template.trim());let S=await e.queryAll("slot");S&&S.length&&await Promise.all(S.filter(g=>{var b;return !((b=g.classes)!=null&&b.includes("hydrated"))}).map(async g=>{let b=g.attribute("name"),T=k.filter(N=>b?N.type==="Element"&&N.attribute("slot")===b:N.type!=="Element"||!N.hasAttribute("slot"));if(T.length){for(let N of T)this.viewUpdates.add("setAttribute",N,"slotted","true"),this.viewUpdates.add("appendChild",g,N);await this.viewUpdates.exec(),await Promise.all(T.map(N=>this.render(N)));}})),y._hostElement=e,y.parent=(I=n==null?void 0:n.component)!=null?I:void 0,y.provide(U.PROVIDE_TOKEN,this);{let g=await e.childNodes(),b=6,T=0;for(;T<g.length;){let N=g.slice(T,T+b);await Promise.all(N.map(D=>l.render(D,{skipSlotted:true}))),T+=b;}}return l.viewUpdates.add("addClass",e,"hydrated"),this.enqueueMounted(()=>{try{y.onMounted();}catch(g){}}),await l.viewUpdates.exec(),y.state.watch(async()=>{await Promise.all([l.updateBindings(),l.updateDirectives()]),await l.viewUpdates.exec(),l.flushMounted();}),y}async unmountComponent(e){var r,c;let s=this.mountedComponents.get(e.uid);if(await e.removeAndRelease(),s){let l=s.cssInstance;if(l){let d=(r=U.STYLE_REF.get(l))!=null?r:1;d===1?(await OUID.rejectComponentStyles(l),U.STYLE_REF.delete(l)):U.STYLE_REF.set(l,d-1);}s.willUnmount(),s._hostElement=null,s.cssInstance=null;}let n=(c=await e.queryAll("*"))!=null?c:[];for(let l of n)await this.unmountComponent(l);this.mountedComponents.delete(e.uid),e.hasAttribute("ref")&&this.setRefValue(e.attribute("ref"),null);}};f(U,"RenderContext"),m(U,"PROVIDE_TOKEN","RENDER_CONTEXT"),m(U,"MOUNTED_COMPONENTS_TOKEN","RENDER_CONTEXT_MOUNTED_COMPONENTS"),m(U,"STYLE_REF",new WeakMap);var G=U;async function Te(u,e,s=[],n){let r=e!=null?e:{},c=await OUID.createElement(u,Object.keys(r).reduce((l,d)=>(l[d]=r[d],l),{}));return Object.keys(n!=null?n:{}).forEach(l=>{c==null||c.addEventListener(l,d=>{let v=n[l];typeof v=="function"&&v(d);});}),new X(c,s)}f(Te,"node");function Jt(u,e,s){return Wt(u)?u().then(n=>vt(n.default,e,s)):vt(u,e,s)}f(Jt,"o");function Qt(u){return typeof u=="function"}f(Qt,"isProvideFunction");var rt=class rt{constructor(e,s){m(this,"root");m(this,"options");m(this,"providers",new Map);this.root=e,this.options=s,rt.currentApp=this;}provide(e,s){if(this.providers.has(e)){console.warn(`[OUID] - Provider ${e} already exists`);return}this.providers.set(e,Qt(s)?{provide:s}:{value:s});}inject(e){var s;return (s=this.providers.get(e))==null?void 0:s.value}use(e,s){return e.install(this,s),this}async mount(e){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 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(`
|
|
7
7
|
* {
|
|
8
|
-
${
|
|
8
|
+
${t} * {
|
|
9
9
|
visibility: hidden;
|
|
10
10
|
}
|
|
11
|
-
${
|
|
11
|
+
${t} *.hydrated {
|
|
12
12
|
visibility: inherit;
|
|
13
13
|
}
|
|
14
14
|
.oui-hidden {
|
|
15
15
|
display: none !important;
|
|
16
16
|
}
|
|
17
|
-
`),
|
|
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:`
|
|
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
|
|
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:`
|
|
62
62
|
display: inline-block;
|
|
63
63
|
width: 1em;
|
|
64
64
|
height: 1em;
|
|
65
65
|
vertical-align: -0.15em;
|
|
66
66
|
overflow: hidden;
|
|
67
|
-
`})}};
|
|
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
|
|
68
68
|
//# sourceMappingURL=index.cjs.map
|