ouider 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dom/dom.cjs +2 -2
- package/dist/dom/dom.cjs.map +1 -1
- package/dist/dom/dom.js +2 -2
- package/dist/dom/dom.js.map +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -111,6 +111,7 @@ declare namespace ODOM {
|
|
|
111
111
|
uid: string;
|
|
112
112
|
tag: string;
|
|
113
113
|
constructor(uid: string, tag: string);
|
|
114
|
+
static toInstance(obj: OObject): OObject;
|
|
114
115
|
release(): Promise<void>;
|
|
115
116
|
addEventListener(event: string, callback: (...args: any[]) => void, extra?: {
|
|
116
117
|
options?: EventListenerOptions;
|
|
@@ -120,6 +121,7 @@ declare namespace ODOM {
|
|
|
120
121
|
invoke<T>(fn: string, ...args: any[]): Promise<T | null>;
|
|
121
122
|
invokeAndHold(fn: string, ...args: any[]): Promise<OObject | null>;
|
|
122
123
|
getProperty<T>(name: string): Promise<T | null>;
|
|
124
|
+
getPropertyAndHold<T>(name: string): Promise<OObject | null>;
|
|
123
125
|
setProperty<T>(name: string, value: T): Promise<void>;
|
|
124
126
|
dispatchEvent(eventName: string, eventClass?: string, initDict?: any): Promise<void>;
|
|
125
127
|
updates(): BatchUpdates;
|
|
@@ -135,12 +137,11 @@ declare namespace ODOM {
|
|
|
135
137
|
children?: ONode[];
|
|
136
138
|
classes?: string[];
|
|
137
139
|
style?: string;
|
|
138
|
-
constructor(node:
|
|
140
|
+
constructor(node: OObject);
|
|
139
141
|
}
|
|
140
142
|
export class OElement extends ONode {
|
|
141
|
-
[x: string]: any;
|
|
142
143
|
private _hydrated;
|
|
143
|
-
constructor(node:
|
|
144
|
+
constructor(node: OObject);
|
|
144
145
|
addClass(...tokens: string[]): Promise<void>;
|
|
145
146
|
removeClass(...tokens: string[]): Promise<void>;
|
|
146
147
|
setAttribute(name: string, value: string): Promise<void>;
|
|
@@ -446,6 +447,7 @@ declare class OUIDBridge implements OUIDBridgeInterface {
|
|
|
446
447
|
fetch(url: string, input: RequestData, encodeAs: "json"): Promise<any>;
|
|
447
448
|
fetch(url: string, input: RequestData, encodeAs: "text"): Promise<string>;
|
|
448
449
|
fetch(url: string, input: RequestData, encodeAs: "base64"): Promise<string>;
|
|
450
|
+
fetch(url: string, input: RequestData, encodeAs: "buffer"): Promise<ODOM.OObject>;
|
|
449
451
|
alert(message: string): Promise<void>;
|
|
450
452
|
prompt(message: string): Promise<void>;
|
|
451
453
|
newObject(ctr: string, ...args: any[]): Promise<ODOM.OObject | null>;
|
package/dist/index.d.ts
CHANGED
|
@@ -111,6 +111,7 @@ declare namespace ODOM {
|
|
|
111
111
|
uid: string;
|
|
112
112
|
tag: string;
|
|
113
113
|
constructor(uid: string, tag: string);
|
|
114
|
+
static toInstance(obj: OObject): OObject;
|
|
114
115
|
release(): Promise<void>;
|
|
115
116
|
addEventListener(event: string, callback: (...args: any[]) => void, extra?: {
|
|
116
117
|
options?: EventListenerOptions;
|
|
@@ -120,6 +121,7 @@ declare namespace ODOM {
|
|
|
120
121
|
invoke<T>(fn: string, ...args: any[]): Promise<T | null>;
|
|
121
122
|
invokeAndHold(fn: string, ...args: any[]): Promise<OObject | null>;
|
|
122
123
|
getProperty<T>(name: string): Promise<T | null>;
|
|
124
|
+
getPropertyAndHold<T>(name: string): Promise<OObject | null>;
|
|
123
125
|
setProperty<T>(name: string, value: T): Promise<void>;
|
|
124
126
|
dispatchEvent(eventName: string, eventClass?: string, initDict?: any): Promise<void>;
|
|
125
127
|
updates(): BatchUpdates;
|
|
@@ -135,12 +137,11 @@ declare namespace ODOM {
|
|
|
135
137
|
children?: ONode[];
|
|
136
138
|
classes?: string[];
|
|
137
139
|
style?: string;
|
|
138
|
-
constructor(node:
|
|
140
|
+
constructor(node: OObject);
|
|
139
141
|
}
|
|
140
142
|
export class OElement extends ONode {
|
|
141
|
-
[x: string]: any;
|
|
142
143
|
private _hydrated;
|
|
143
|
-
constructor(node:
|
|
144
|
+
constructor(node: OObject);
|
|
144
145
|
addClass(...tokens: string[]): Promise<void>;
|
|
145
146
|
removeClass(...tokens: string[]): Promise<void>;
|
|
146
147
|
setAttribute(name: string, value: string): Promise<void>;
|
|
@@ -446,6 +447,7 @@ declare class OUIDBridge implements OUIDBridgeInterface {
|
|
|
446
447
|
fetch(url: string, input: RequestData, encodeAs: "json"): Promise<any>;
|
|
447
448
|
fetch(url: string, input: RequestData, encodeAs: "text"): Promise<string>;
|
|
448
449
|
fetch(url: string, input: RequestData, encodeAs: "base64"): Promise<string>;
|
|
450
|
+
fetch(url: string, input: RequestData, encodeAs: "buffer"): Promise<ODOM.OObject>;
|
|
449
451
|
alert(message: string): Promise<void>;
|
|
450
452
|
prompt(message: string): Promise<void>;
|
|
451
453
|
newObject(ctr: string, ...args: any[]): Promise<ODOM.OObject | null>;
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import $t from'route-parser';var bt=Object.defineProperty;var Nt=(c,e,s)=>e in c
|
|
|
3
3
|
`:i instanceof K&&(e+=`${s} {
|
|
4
4
|
${i.toString()}}
|
|
5
5
|
`);}return e}static of(e,...s){return new K(e,s.join(`
|
|
6
|
-
`))}};w(K,"StyleData");var tt=K;function ht(c,e,s){return new c(e,s)}w(ht,"createComponent");var ut=class ut{constructor(e={},s={}){f(this,"state");f(this,"parent");f(this,"emits");f(this,"props");f(this,"provides",new Map);this.state=new Z(this),this.props=e,this.emits=new Y(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()}};w(ut,"OComponent");var $=ut;function W(c){let e=Date.now();return `${(1e3+Math.floor(Math.random()*9e3)+c.length).toString(16)}-${e.toString(16)}`}w(W,"generateUIID");function lt(c){return new Promise(e=>setTimeout(e,c))}w(lt,"delay");(function(c){var O,D,k,T,I,L,y,g,P,x,j,V;let e=(O=class{constructor(){f(this,"actions",[]);}async exec(){await this.commit();}add(h){return this.actions.push(h),this}async commit(){let h=this.actions;this.actions=[],await Promise.all(h.map(async t=>await t()));}},w(O,"BatchActions"),O);c.BatchActions=e;let s=(D=class{constructor(h){f(this,"node");f(this,"operations",[]);this.node=h;}accept(h){this.operations.push(...h.operations),h.operations=[];}async exec(){let h=this.operations;this.operations=[];let t=[],n=h.map(a=>typeof a=="object"?(t.push({fn:a.fn,args:[a.node.uid,...a.args.map(u=>u instanceof i?u.uid:u)]}),null):a()).filter(a=>a!=null);if(t.length>0){let a={},u=[];t.forEach(p=>{let E=`${p.fn}.${p.args.map(S=>S==null?void 0:S.toString()).join(",")}`;a[E]&&!["invoke","setProperty","dispatchEvent"].includes(p.fn)||(a[E]=p,u.push(p));}),n.unshift(v.batchActions(u));}try{await Promise.all(n);}catch(a){console.error("Error while batch updates");}}append(h,...t){return this.operations.push({fn:h,args:t,node:this.node}),this}add(h,t,...n){return typeof h=="function"?this.operations.push(h):this.operations.push({fn:h,args:n,node:t}),this}addEventListener(h,t,n,a){return this.add(()=>{this.node.addEventListener(h,t,{options:n,policy:a});})}setProperty(h,t){return this.append("setProperty",h,t)}dettachEventListener(h){return this.append("dettachEventListener",h)}invoke(h,...t){return this.append("invoke",h,...t.map(n=>n instanceof i?n.ref:n))}dispatchEvent(h,t,n){return this.append("dispatchEvent",h,t,n)}addClass(...h){return this.append("addClass",...h)}removeClass(...h){return this.append("removeClass",...h)}setAttribute(h,t){return this.append("setAttribute",h,t)}removeAttribute(h){return this.append("removeAttribute",h)}appendChild(h){return this.append("appendChild",h.uid)}removeChild(h){return this.append("removeChild",h.uid)}remove(){return this.append("remove")}removeAndRelease(){return this.append("remove").append("release")}release(){return this.append("release")}innerHTML(h){return this.append("setHTML",h)}replaceChildNode(h,t){return this.append("replaceChildNode",h,t)}replaceWith(h){return this.append("replaceWith",h.uid)}after(h){return this.append("after",h.uid)}setInnerText(h){return this.append("setInnerText",h)}setContentText(h){return this.append("setContentText",h)}insertBefore(h,t){return this.append("insertBefore",h.uid,t.uid)}setInputValue(h){return this.append("setInputValue",h)}setStyle(h,t){return this.append("setStyle",h,t)}},w(D,"BatchUpdates"),D);c.BatchUpdates=s;let i=(k=class{constructor(h,t){f(this,"uid");f(this,"tag");this.uid=h,this.tag=t;}async release(){await v.call("releaseNode",this.uid);}async addEventListener(h,t,n){return v.addEventListener(this,h,t,{options:n==null?void 0:n.options,policy:n==null?void 0:n.policy})}async dettachEventListener(h){await v.dettachEventListener(h);}async invoke(h,...t){return await v.call("invokeObjectMethod",this.uid,h,...t)}async invokeAndHold(h,...t){let n=await v.call("invokeObjectMethodAndHold",this.uid,h,...t);return n&&new k(n.uid,n.tag)}async getProperty(h){return await v.call("getObjectProperty",this.uid,h)}async setProperty(h,t){await v.call("setObjectProperty",this.uid,h,t);}async dispatchEvent(h,t,n){await v.call("dispatchEvent",this.uid,h,t,n);}updates(){return new s(this)}batches(){return new s(this)}get ref(){return {__ref__:this.uid}}},w(k,"OObject"),k);c.OObject=i;let r=(T=class extends i{constructor(t){super(t.uid,t.tag);f(this,"textContent");f(this,"type","Unknown");f(this,"attributes");f(this,"children");f(this,"classes");f(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="");}},w(T,"ONode"),T);c.ONode=r;let o=(I=class extends r{constructor(t){super(t);f(this,"_hydrated",false);}async addClass(...t){await v.call("addClass",this.uid,...t);}async removeClass(...t){await v.call("removeClass",this.uid,...t);}async setAttribute(t,n){let a=await v.call("setAttribute",this.uid,t,n);a&&(this.attributes=a);}async removeAttribute(t){let n=await v.call("removeAttribute",this.uid,t);n&&(this.attributes=n);}async appendChild(t){await v.call("appendChild",this.uid,t.uid);}set innerHTML(t){this.setHTML(t);}async cloneNode(t){let n=await v.call("cloneNode",this.uid,t);return n?new I(n):null}async remove(){await v.call("removeNode",this.uid);}async removeAndRelease(){await this.remove(),await this.release();}async removeChild(t){await v.call("removeChild",this.uid,t.uid);}async replaceChildNode(t,n){await v.call("replaceChildNode",this.uid,t.uid,n.uid);}async replaceWith(t){await v.call("replaceWith",this.uid,t.uid);}async after(t){await v.call("insertAfter",this.uid,t.uid);}async setHTML(t){await v.call("setInnerHTML",this.uid,t);}async HTML(){var t;return (t=await v.call("getInnerHTML",this.uid))!=null?t:""}async setInnerText(t){await v.call("setInnerText",this.uid,t);}async setContentText(t){await v.call("setContentText",this.uid,t);}async getContentText(){var t;return (t=await v.call("getContentText",this.uid))!=null?t:""}async content(){var t;try{return (t=await v.call("getInnerText",this.uid))!=null?t:""}catch(n){return console.error(n),""}}async childNodes(){var t,n;return (n=(t=await v.call("childNodes",this.uid))==null?void 0:t.map(a=>new I(a)))!=null?n:[]}hasAttribute(t){return !!this.attributes.find(n=>n.name===t)}async getAttribute(t){var n;return (n=await v.call("getAttribte",this.uid,t))!=null?n:""}attribute(t){var n,a;return (a=(n=this.attributes.find(u=>u.name===t))==null?void 0:n.value)!=null?a:null}async nextSibling(){let t=await v.call("nextSibling",this.uid);return t?new I(t):null}async getAttributeNames(){var t;return (t=await v.call("getAttributeNames",this.uid))!=null?t:[]}async parentNode(){let t=await v.call("parentNode",this.uid);return t?new I(t):null}async insertBefore(t,n){await v.call("insertBefore",this.uid,t.uid,n.uid);}async setInputValue(t){await v.call("setInputValue",this.uid,t);}async inputValue(){var t;return (t=await v.call("inputValue",this.uid))!=null?t:""}get hydrated(){return this._hydrated}hydrate(){this._hydrated=true,this.addClass("hydrated");}async query(t,n){return await v.query(t,n,this.uid)}async queryAll(t,n){return await v.queryAll(t,n,this.uid)}async setStyle(t,n){await v.call("setStyle",this.uid,t,n);}},w(I,"OElement"),I);c.OElement=o;let l=(L=class extends i{constructor(h){super(h.uid,h.tag);}addColorStop(h,t){return this.invoke("addColorStop",h,t),this}},w(L,"CanvasGradient"),L);c.CanvasGradient=l;let d=(y=class extends i{constructor(t){super(t.uid,t.tag);f(this,"batch",new s(this));}static async new(t){let n=typeof t!="undefined"?await v.newObject("DOMMatrix",t):await v.newObject("DOMMatrix");return n?new y(n):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,n,a,u){let p=[];return t&&p.push(t),n&&p.push(n),a&&p.push(a),u&&p.push(u),this.batch.invoke("rotateAxisAngleSelf",...p),this}rotateFromVectorSelf(t,n){let a=[];return t&&a.push(t),n&&a.push(n),this.batch.invoke("rotateFromVectorSelf",...a),this}rotateSelf(t,n,a){let u=[];return t&&u.push(t),n&&u.push(n),a&&u.push(a),this.batch.invoke("rotateFromVectorSelf",...u),this}scale3dSelf(t,n,a,u){let p=[];return t&&p.push(t),n&&p.push(n),a&&p.push(a),u&&p.push(u),this.batch.invoke("scale3dSelf",...p),this}scaleSelf(t,n,a,u,p,E){let S=[];return t&&S.push(t),n&&S.push(n),a&&S.push(a),u&&S.push(u),p&&S.push(p),E&&S.push(E),this.batch.invoke("scaleSelf",...S),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,n,a){return this.batch.invoke("translateSelf",t,n,...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 y(t):null}async flipY(){let t=await this.invokeAndHold("flipY");return t?new y(t):null}async inverse(){let t=await this.invokeAndHold("inverse");return t?new y(t):null}async multiply(t){let n=await this.invokeAndHold("multiply",...t?[t.ref]:[]);return n?new y(n):null}async rotate(t,n,a){let u=[];t&&u.push(t),n&&u.push(n),a&&u.push(a);let p=await this.invokeAndHold("rotate",...u);return p?new y(p):null}async rotateAxisAngle(t,n,a,u){let p=[];t&&p.push(t),n&&p.push(n),a&&p.push(a),u&&p.push(u);let E=await this.invokeAndHold("rotateAxisAngle",...p);return E?new y(E):null}async rotateFromVector(t,n){let a=[];t&&a.push(t),n&&a.push(n);let u=await this.invokeAndHold("rotateFromVector",...a);return u?new y(u):null}async scale(t,n,a,u,p,E){let S=[];t&&S.push(t),n&&S.push(n),a&&S.push(a),u&&S.push(u),p&&S.push(p),E&&S.push(E);let U=await this.invokeAndHold("scale",...S);return U?new y(U):null}async scale3d(t,n,a,u){let p=[];t&&p.push(t),n&&p.push(n),a&&p.push(a),u&&p.push(u);let E=await this.invokeAndHold("scale",...p);return E?new y(E):null}async skewX(t){let n=[];t&&n.push(t);let a=await this.invokeAndHold("skewX",...n);return a?new y(a):null}async skewY(t){let n=[];t&&n.push(t);let a=await this.invokeAndHold("skewY",...n);return a?new y(a):null}toJSON(){return this.invoke("toJSON")}async toString(){return this.invoke("toString")}async translate(t,n,a){let u=[];t&&u.push(t),n&&u.push(n),a&&u.push(a);let p=await this.invokeAndHold("translate",...u);return p?new y(p):null}},w(y,"DOMMatrix"),y);c.DOMMatrix=d;let b=(g=class extends i{constructor(h){super(h.uid,h.tag);}setTransform(h){this.invoke("setTransform",h.ref);}},w(g,"CanvasPattern"),g);c.CanvasPattern=b;let m=(P=class extends i{constructor(t){super(t,"unknown");f(this,"batch",new s(this));}arc(t,n,a,u,p,E=false){return this.batch.invoke("arc",t,n,a,u,p,E),this}arcTo(t,n,a,u,p){return this.batch.invoke("arcTo",t,n,a,u,p),this}bezierCurveTo(t,n,a,u,p,E){return this.batch.invoke("bezierCurveTo",t,n,a,u,p,E),this}clearRect(t,n,a,u){return this.batch.invoke("clearRect",t,n,a,u),this}clip(t,n){let a=[];return typeof t=="string"?a.push(t):t instanceof A&&(t.commit(this.batch),a.push(t.ref)),typeof n=="string"&&a.push(n),this.batch.invoke("clip",...a),this}beginPath(){return this.batch.invoke("beginPath"),this}closePath(){return this.batch.invoke("closePath"),this}async createConicGradient(t,n,a){let u=await this.invokeAndHold("createConicGradient",t,n,a);return u?new l(u):null}async createLinearGradient(t,n,a,u){let p=await this.invokeAndHold("createLinearGradient",t,n,a,u);return p?new l(p):null}async createPattern(t,n=""){let a=await this.invokeAndHold("createPattern",t.ref,n);return a?new b(a):null}async createRadialGradient(t,n,a,u,p,E){let S=await this.invokeAndHold("createRadialGradient",t,n,a,u,p,E);return S?new l(S):null}drawImage(t,n,a,u,p,E,S,U,At){let H=[t.ref];return typeof E=="undefined"?(H.push(n,a),u&&H.push(u),p&&H.push(p),this.batch.invoke("drawImage",...H),this):(H.push(n,a,u,p,E,S,U,At),this.batch.invoke("drawImage",...H),this)}ellipse(t,n,a,u,p,E,S,U=false){return this.batch.invoke("ellipse",t,n,a,u,p,E,S,U),this}fill(t,n){let a=[];return t&&a.push(typeof t=="string"?t:(t.commit(this.batch),t.ref)),n&&a.push(n),this.batch.invoke("fill",...a),this}fillRect(t,n,a,u){return this.batch.invoke("fillRect",t,n,a,u),this}fillText(t,n,a,u){return this.batch.invoke("fillText",t,n,a,...u?[u]:[]),this}getImageData(t,n,a,u,p){return this.invokeAndHold("getImageData",t,n,a,u,...p?[p]:[])}getLineDash(){return this.invoke("getLineDash")}async getTransform(){let t=await this.invokeAndHold("getTransform");return t?new d(t):null}async isContextLost(){return await this.invoke("isContextLost")}async isPointInPath(t,n,a,u){let p=[];return typeof t=="number"?(p.push(t,n),a&&p.push(a)):(await t.commit(this.batch),p.push(t.ref,n,a),u&&p.push(u)),await this.invoke("isPointInPath",...p)}async isPointInStroke(t,n,a){var p;let u=[];return typeof t=="number"?u.push(t,n):(await t.commit(),u.push(t.ref,n,a)),(p=await this.invoke("isPointInStroke",...u))!=null?p:false}lineTo(t,n){return this.batch.invoke("lineTo",t,n),this}async measureText(t){var n;return (n=await this.invoke("measureText",t))!=null?n:0}moveTo(t,n){return this.batch.invoke("moveTo",t,n),this}putImageData(t,n,a,u,p,E,S){let U=[t.ref,n,a];return u&&U.push(u),p&&U.push(p),E&&U.push(E),S&&U.push(S),this.batch.invoke("putImageData",...U),this}quadraticCurveTo(t,n,a,u){return this.batch.invoke("quadraticCurveTo",t,n,a,u),this}rect(t,n,a,u){return this.batch.invoke("rect",t,n,a,u),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,n,a,u,p){return this.batch.invoke("roundRect",t,n,a,u,p),this}save(){return this.batch.invoke("save")}scale(t,n){return this.batch.invoke("scale",t,n),this}setLineDash(t){return this.invoke("setLineDash",t)}async setTransform(t,n,a,u,p,E){typeof t=="number"?await this.invoke("setTransform",t,n,a,u,p,E):await this.invoke("setTransform",t.ref);}stroke(t){return this.batch.invoke("stroke",...t?[(t.commit(this.batch),t.ref)]:[]),this}strokeRect(t,n,a,u){return this.batch.invoke("strokeRect",t,n,a,u),this}strokeText(t,n,a,u){return this.batch.invoke("strokeText",t,n,a,...u?[u]:[]),this}transform(t,n,a,u,p,E){return this.batch.invoke("transform",t,n,a,u,p,E),this}translate(t,n){return this.batch.invoke("translate",t,n),this}set fillStyle(t){this.setFillStyle(t);}setFillStyle(t){return this.batch.setProperty("fillStyle",typeof t=="string"?t:t instanceof i?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 i?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();}},w(P,"Canvas2DContext"),P);c.Canvas2DContext=m;let C=(x=class extends i{constructor(h){super(h.uid,h.tag);}static async new(h,t){let n=[];h&&n.push(h),t&&n.push(t);let a=await v.newObject("Image",...n);return a?new x(a):null}async width(){var h;return (h=await this.getProperty("width"))!=null?h:0}async height(){var h;return (h=await this.getProperty("height"))!=null?h:0}async naturalWidth(){var h;return (h=await this.getProperty("naturalWidth"))!=null?h:0}async naturalHeight(){var h;return (h=await this.getProperty("naturalHeight"))!=null?h:0}async src(){return await this.getProperty("src")}async currentSrc(){return await this.getProperty("currentSrc")}async setSrc(h){await this.setProperty("src",h);}},w(x,"Image"),x);c.Image=C;let A=(j=class extends i{constructor(t){super(t.uid,t.tag);f(this,"batch",new s(this));}static async create(){let t=await v.newObject("Path2D");return t?new j(t):null}addPath(t){return this.batch.invoke("addPath",t.ref),this}arc(t,n,a,u,p,E=false){return this.batch.invoke("arc",t,n,a,u,p,E),this}arcTo(t,n,a,u,p){return this.batch.invoke("arcTo",t,n,a,u,p),this}bezierCurveTo(t,n,a,u,p,E){return this.batch.invoke("bezierCurveTo",t,n,a,u,p,E),this}quadraticCurveTo(t,n,a,u){return this.batch.invoke("quadraticCurveTo",t,n,a,u),this}closePath(){return this.batch.invoke("closePath"),this}ellipse(t,n,a,u,p,E,S,U=false){return this.batch.invoke("ellipse",t,n,a,u,p,E,S,U),this}moveTo(t,n){return this.batch.invoke("moveTo",t,n),this}lineTo(t,n){return this.batch.invoke("lineTo",t,n),this}rect(t,n,a,u){return this.batch.invoke("rect",t,n,a,u),this}roundRect(t,n,a,u,p){return this.batch.invoke("roundRect",t,n,a,u,p),this}commit(t){return t?(t.accept(this.batch),Promise.resolve()):this.batch.exec()}},w(j,"CanvasPath2D"),j);c.CanvasPath2D=A;let N=(V=class extends o{constructor(h){super(h);}async width(){return this.getProperty("width")}async height(){return this.getProperty("height")}async setWidth(h){this.setProperty("width",h);}async setHeight(h){this.setProperty("height",h);}async getContext(h){let t=await this.invokeAndHold("getContext",h);return t&&new m(t.uid)}static async of(h,t,n){let a=await v.query(h,t);return a?new V(a):null}},w(V,"CanvasElement"),V);c.CanvasElement=N;})(R||(R={}));var pt=class pt{constructor(){f(this,"callbacks",new Map);f(this,"DOM_EVENT_LISTENERS",new Map);f(this,"timers",new Map);f(this,"_config");f(this,"listeners",new Map);this.subscribe("__ouid_native_event_success__",(e,s)=>{let i=this.callbacks.get(e);if(i)return this.callbacks.delete(e),i.success(...JSON.parse(s))}),this.subscribe("__ouid_native_event_error__",(e,s)=>{let i=this.callbacks.get(e);if(i)return this.callbacks.delete(e),i.error(...JSON.parse(s))}),this.subscribe("__ouid_web_event__",(e,s)=>{let i=this.DOM_EVENT_LISTENERS.get(e),r=JSON.parse(s);if(i){let o=r[1];return o&&typeof o=="object"&&(o.target=o!=null&&o.target?new R.OElement(o.target):null,o.currentTarget=o!=null&&o.currentTarget?new R.OElement(o.currentTarget):null,o.relatedTarget=o!=null&&o.relatedTarget?new R.OElement(o.relatedTarget):null),i(o)}else console.error("No cb found for ",e,r[0]);});}config(e){return this._config=e,this}invoke(e,...s){let i=W(e);return new Promise((r,o)=>{this.callbacks.set(i,{success:r,error:o});try{if(!WebOUID)throw new Error("NativeOUID bridge not available");WebOUID.invoke(i,e,JSON.stringify(s));}catch(l){console.error(l),this.callbacks.delete(i);}})}registerComponent(e,s){B.register(e,s);}unregisterComponent(e,s){B.unregister(e);}async call(e,...s){try{return (await this.invoke(`_ouid_${e}`,...s)).data}catch(i){return console.error(i),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]=(i,r)=>{var o;(o=this.listeners.get(e))==null||o.forEach(l=>l(i,r));}),this.listeners.get(e).push(s);}async query(e,s,i){let r=await this.call("query",e,s,i);return r?new R.OElement(r):null}async queryAll(e,s,i){let r=await this.call("queryAll",e,s,i);return r?r.map(o=>new R.OElement(o)):[]}async createElement(e,s={}){let i=await this.call("createElement",e,s);return i?new R.OElement(i):null}async createComment(e){let s=await this.call("createComment",e);return s?new R.OElement(s):null}async addEventListener(e,s,i,r){let o=W(s+(typeof e=="string"?e:e.tag));return this.DOM_EVENT_LISTENERS.set(o,i),await v.call("attachEventListener",typeof e=="string"?e:e.uid,o,s,r==null?void 0:r.options,r==null?void 0:r.policy),o}async dettachEventListener(e){this.DOM_EVENT_LISTENERS.delete(e),await v.call("dettachEventListener",e);}async createComponentStyles(e,s=true){let i=await v.call("createComponentStyles",e,s);return i?new R.OElement(i):null}async appendComponentStyles(e){await v.call("appendComponentStyles",e);}async rejectComponentStyles(e){await v.call("rejectComponentStyles",e.uid);}async getOObject(e){let s=await v.call("getOObject",e);return s?new R.OObject(s.uid,s.tag):null}async acquireObject(e){let s=await v.call("acquireObject",e);return s?new R.OObject(s.uid,s.tag):null}async setTimeout(e,s){var o;let i=W("setTimeout"+s);this.DOM_EVENT_LISTENERS.set(i,()=>{e();let l=this.timers.get(r);l&&(this.timers.delete(r),this.DOM_EVENT_LISTENERS.delete(l));});let r=(o=await v.call("setTimeout",i,s))!=null?o:-1;return r>=0&&this.timers.set(r,i),r}async clearTimeout(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await v.call("clearTimeout",e));}async setInterval(e,s){var o;let i=W("setInterval"+s);this.DOM_EVENT_LISTENERS.set(i,e);let r=(o=await v.call("setInterval",i,s))!=null?o:-1;return r>=0&&this.timers.set(r,i),r}async clearInterval(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await v.call("clearInterval",e));}async fetch(e,s,i="json"){return await v.call("fetch",e,s,i)}async alert(e){await v.call("alert",e);}async prompt(e){await v.call("prompt",e);}async newObject(e,...s){return v.call("newObject",e,...s)}async requestAnimationFrame(e){var r;let s=W("requestAnimationFrame");this.DOM_EVENT_LISTENERS.set(s,o=>{e(o);let l=this.timers.get(i);l&&(this.DOM_EVENT_LISTENERS.delete(l),this.timers.delete(i));});let i=(r=await v.call("requestAnimationFrame",s))!=null?r:-1;return i>=0&&this.timers.set(i,s),i}async cancelAnimationFrame(e){let s=this.timers.get(e);s&&(this.timers.delete(e),await v.call("cancelAnimationFrame",e),this.DOM_EVENT_LISTENERS.delete(s));}async batchActions(e){await v.call("batchActions",e);}};w(pt,"OUIDBridge");var dt=pt,v=new Proxy(new dt,{get:w((c,e)=>e in c?c[e]:async(...s)=>await c.call(e,...s),"get")});globalThis.OUID=v;var R;function Rt(c){return c.replace(/-([a-z])/g,(e,s)=>s.toUpperCase())}w(Rt,"toCamelCase");function Mt(c){return c.replace(/(?!^)([A-Z])/g,(e,s)=>`-${s.toLowerCase()}`)}w(Mt,"toSnakeCase");function _(c){return at(c)?c.value:c}w(_,"normaliseValue");var jt=typeof globalThis.queueMicrotask=="function",Q=w(c=>c?jt?queueMicrotask(c):Promise.resolve().then(c):Promise.resolve(),"deferMicro"),St=w(()=>new Promise(c=>setTimeout(c,0)),"deferMacro");function Ut(c){return typeof c=="function"&&!("prototype"in c)}w(Ut,"isLazyLoader");var kt=new Map,Et=new Map,Ct=new WeakMap;function _t(c){var i;if(!c||typeof c!="object"&&typeof c!="function")return {};let e=Ct.get(c);if(e)return e;let s=Object.create(null);for(let r=c;r&&r!==Object.prototype;r=Object.getPrototypeOf(r))for(let o of Object.getOwnPropertyNames(r)){if(o==="constructor"||o.startsWith("__")||o.endsWith("__")||o in s)continue;let l=Object.getOwnPropertyDescriptor(r,o);if(!l)continue;let d=(i=l.value)!=null?i:l.get?l.get.call(c):void 0;s[o]=typeof d=="function"?d.bind(c):d;}return Ct.set(c,s),s}w(_t,"getMethodsView");function Tt(c,e){let s=kt.get(c);return s||(s=new Function("s","with (s) { return ("+c+"); }"),kt.set(c,s)),s(e)}w(Tt,"evalInScope");function Vt(c){let e=Et.get(c);if(e)return e;let s=[],i=0;for(;i<c.length;){let r=c.indexOf("{{",i);if(r<0){s.push({t:c.slice(i)});break}r>i&&s.push({t:c.slice(i,r)});let o=c.indexOf("}}",r+2),l=o>=0?c.slice(r+2,o).trim():c.slice(r+2).trim();s.push({e:l}),i=o>=0?o+2:c.length;}return e=w(r=>{let o="";for(let l of s)if(l.t!==void 0)o+=l.t;else if(l.e!==void 0){let d=_(Tt(l.e,r));o+=d==null?"":String(d);}return o},"fn"),Et.set(c,e),e}w(Vt,"compileInterpolated");var Ot,M=class M{constructor(e,s,i,...r){f(this,"app");f(this,"component");f(this,"parentContext");f(this,"bindings",[]);f(this,"directives",[]);f(this,"mountedComponents",(Ot=st(M.MOUNTED_COMPONENTS_TOKEN))!=null?Ot:new Map);f(this,"componentsRegistry",new G);f(this,"updatingDirectives",false);f(this,"updatingBindings",false);f(this,"_stack",[]);f(this,"flatStack",Object.create(null));f(this,"viewUpdates");f(this,"mountedQueue",[]);this.app=e,this.component=s,this.parentContext=i;for(let o of r)this.push(o);}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 i of s)try{i();}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,o;let s=(o=(r=this.component.state)==null?void 0:r.value)!=null?o:{},i=_t(s);return new Proxy(Object.create(null),{get:w((l,d)=>{for(let b=e.length-1;b>=0;b--)if(d in e[b])return _(e[b][d]);return d in this.flatStack?_(this.flatStack[d]):d in i?_(i[d]):_(s[d])},"get"),set:w((l,d,b)=>{let m=null;for(let C=e.length-1;C>=0;C--)if(d in e[C]){m=e[C][d];break}return m||(d in this.flatStack?m=this.flatStack[d]:d in i?m=i[d]:m=s[d]),m&&at(m)?(m.value=b,true):false},"set"),has:w((l,d)=>e.some(b=>d in b)||d in this.flatStack||d in i||d in s,"has")})}resolve(e,...s){if(!e)return;let i=this.resolveScope(...s);try{return Tt(e,i)}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 i;let s=this;for(;;){if(s.componentsRegistry.has(e))return s.componentsRegistry.get(e);if(s=(i=s==null?void 0:s.parentContext)!=null?i:null,!s)break}return B.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",_(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,i=_(this.resolve(e.template));s==="class"?this.expandClass(e.node,i):s==="style"?this.expandStyle(e.node,i):typeof i!="object"&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="undefined"&&this.viewUpdates.add("setAttribute",e.node,s,i.toString());return}if(e.type==="prop"&&e.context.component){let s=_(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(i){console.error(i);}return}}async updateDirectives(){var e;if(!this.updatingDirectives){for(let s of this.directives){if(s.type==="if"){if(!_(s.context.evaluateExpression(s.expr))){if(s.active===false)continue;s.active=false,s.renderedNode&&(s.destroy?this.unmountComponent(s.renderedNode):this.viewUpdates.add("addClass",s.renderedNode,"oui-hidden"));continue}if(s.active===true)continue;s.active=true;let r=s.renderedNode;if(!r||s.destroy){let o=await s.node.cloneNode(true);s.renderedNode=o,await s.context.render(o),this.viewUpdates.add("after",s.placeholder,o);}else this.viewUpdates.add("removeClass",r,"oui-hidden");}if(s.type==="for"){let i=(e=s.children)!=null?e:new Map,r=new Map,o=w((b,m)=>s.key?_(s.context.resolve(s.key,{[s.item]:b})):m,"keyFn"),l=_(s.context.resolve(s.list))||[],d=s.placeholder;for(let b=0;b<l.length;b++){let m=l[b],C=o(m,b),A=i.get(C),N,O,D=d;if(A){N=A.node,O=A.ctx,O.stack=[{[s.item]:m},...s.context.stack];let k=await d.nextSibling();N.uid!==(k==null?void 0:k.uid)&&this.viewUpdates.add("after",D,N),await Promise.all([O.updateBindings(),O.updateDirectives()]);}else O=new M(this.app,this.component,this),O.viewUpdates=this.viewUpdates,O.stack=[{[s.item]:m},...s.context.stack],N=await s.node.cloneNode(true),this.viewUpdates.add("after",D,N),await O.render(N),await O.updateDirectives();d=N,r.set(C,{node:N,ctx:O});}for(let[b,m]of i.entries())r.has(b)||this.unmountComponent(m.node);s.children=r;}}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 i=new R.BatchActions;await Promise.all([this.updateBindings(),this.updateDirectives()]),i.commit(),this.viewUpdates.add("addClass",e,"hydrated");}async expandClass(e,s){let i;typeof s=="object"?Array.isArray(s)?i=s:i=Object.keys(s).filter(r=>s[r]):i=s.toString().split(/\s+/),i.length>0&&this.viewUpdates.add("addClass",e,...i);}expandStyle(e,s){let i=s;typeof s=="object"&&!Array.isArray(s)&&(i=Object.keys(s).filter(r=>s[r]).map(r=>`${Mt(r)}: ${s[r]}`).join(";")),i&&this.viewUpdates.add("setAttribute",e,"style",i);}expandStandardAttributes(e){[...e.attributes].filter(s=>s.name.startsWith(":")).forEach(s=>{let i=s.name.substring(1);this.bind({type:"attribute",node:e,key:i,context:this,template:s.value.trim()}),this.viewUpdates.add("removeAttribute",e,s.name);});}setRefValue(e,s){let i=e.trim();this.updateValue(i,s);}async handleElementNode(e,s){var D;let i=await e.parentNode(),r=null,o=e.hasAttribute("o-if")?"o-if":e.hasAttribute("o-show")?"o-show":null;if(o){let k=await e.getAttribute(o),T=await OUID.createComment(o+":"+k),I=o==="o-if";await i.insertBefore(e,T),await e.updates().removeAttribute(o).remove().exec(),this.directive({type:"if",expr:k,node:e,placeholder:T,context:this,active:void 0,destroy:I}),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 k=await e.getAttribute("o-for"),[T,I]=k.split(" of ").map(g=>g.trim()),L=await OUID.createComment("for:"+k),y=(D=e.attribute(":key"))!=null?D:"";await(i==null?void 0:i.insertBefore(e,L)),await e.updates().removeAttribute("o-for").removeAttribute(":key").remove().exec(),this.directive({type:"for",item:T,list:I,node:e,placeholder:L,context:this,key:y}),r="for";return}let l=e.tag.toLowerCase(),d=this.resolveTag(l),b=e.updates();[...e.attributes].forEach(async k=>{if(k.name==="o-model"){let T=k.value.trim();b.setInputValue(_(this.resolve(T))).addEventListener("input",async L=>{let y=await L.target.getProperty("value");this.updateValue(T,y);}),this.bind({node:e,key:T,type:"model",context:this}),b.removeAttribute(k.name);}else k.name==="ref"&&(d||this.setRefValue(k.value,e));});let m={},C={},{props:A,events:N}=this.componentAttributes(e,this);if(m=A,C=N,this.expandStandardAttributes(e),Object.keys(C).forEach(async k=>{let T=C[k];d||b.addEventListener(k,I=>{typeof T=="function"&&T.apply(this.component,[I]);}),b.removeAttribute("@"+k);}),this.viewUpdates.accept(b),d){await this.mountComponent(e,d,this,m,C);return}let O=await e.childNodes();s!=null&&s.skipSlotted&&(O=O.filter(k=>!k.hasAttribute("slotted")));for(let k of O)await this.render(k,s);}handleTextNode(e){var i;let s=(i=e.textContent)!=null?i:"";s.includes("{{")&&this.bind({type:"interpolation",node:e,key:"__template__",templateFn:Vt(s),context:this});}componentAttributes(e,s){let i={},r={},o=["import","interface","module","o-model","o-if","o-for"];return [...e.attributes].filter(l=>!o.includes(l.name)).forEach(l=>{let d=l.name;if(d.startsWith("@")){let C=s==null?void 0:s.resolve(l.value);if(typeof C!="function")throw new Error("Event handler can only be function");d=d.substring(1),r[d]=C;return}let b=null,m=l.value;d.startsWith(":")&&(b=l.value,d=d.substring(1),m=_(s==null?void 0:s.resolve(l.value))),d=Rt(d),i[d]={name:d,value:m,expr:b};}),{props:i,events:r}}async mountComponent(e,s,i,r={},o={}){var N,O,D,k,T,L;if(this.viewUpdates=(O=(N=this.viewUpdates)!=null?N:i==null?void 0:i.viewUpdates)!=null?O:new R.BatchUpdates(e),this.mountedComponents.has(e.uid))return this.mountedComponents.get(e.uid);let l=new M(this.app,{},this);l.viewUpdates=this.viewUpdates;let d={},b;for(let y of Object.keys(r)){let g=r[y];if(g.name==="ref"&&!g.expr){b=g;continue}g.expr&&this.bind({type:"prop",node:e,key:y,context:l,template:g.expr}),d[y]=g.value;}let m=await Bt(s,d,o);l.component=m,l.stack=[],this.mountedComponents.set(e.uid,m),b&&this.setRefValue(b.value,m);{let y=e.updates();for(let P of Object.keys(r))r[P].expr||y.setAttribute(P,r[P].value);let g=(D=m.hostClasses)!=null?D:[];g&&(g=typeof g=="string"?[g]:g),g.push("o-component-host"),e.tag.toLowerCase()!=="div"&&g.push("c-"+e.tag.toLowerCase()),y.addClass(...g),this.viewUpdates.accept(y);}Q(async()=>{try{await m.decorateHostElement(e);}catch(y){}});{let y=(k=m.use)!=null?k:{};for(let g of Object.keys(y))l.componentsRegistry.register(g,y[g]);}if(m.willMount(),!s.cssInstance){let y=m.style?(T=m.style())==null?void 0:T.toString():m.css;y&&((s.cssInstance)!=null||(s.cssInstance=await OUID.createComponentStyles(y,false)));}Q(()=>{var g;let y=s.cssInstance;if(y){let P=(g=M.STYLE_REF.get(y))!=null?g:0;P===0&&OUID.appendComponentStyles(y.uid),M.STYLE_REF.set(y,P+1),m.cssInstance=y;}});let C=await e.childNodes();if(m.render){let y=await m.render(l);y&&y.attachTo(e);}else await e.setHTML(m.template.trim());let A=await e.queryAll("slot");A&&A.length&&await Promise.all(A.filter(y=>{var g;return !((g=y.classes)!=null&&g.includes("hydrated"))}).map(async y=>{let g=y.attribute("name"),P=C.filter(x=>g?x.type==="Element"&&x.attribute("slot")===g:x.type!=="Element"||!x.hasAttribute("slot"));if(P.length){for(let x of P)this.viewUpdates.add("setAttribute",x,"slotted","true"),this.viewUpdates.add("appendChild",y,x);await this.viewUpdates.exec(),await Promise.all(P.map(x=>this.render(x)));}})),m._hostElement=e,m.parent=(L=i==null?void 0:i.component)!=null?L:void 0,m.provide(M.PROVIDE_TOKEN,this);{let y=await e.childNodes(),g=6,P=0;for(;P<y.length;){let x=y.slice(P,P+g);await Promise.all(x.map(j=>l.render(j,{skipSlotted:true}))),P+=g;}}return l.viewUpdates.add("addClass",e,"hydrated"),this.enqueueMounted(()=>{try{m.onMounted();}catch(y){}}),await l.viewUpdates.exec(),m.state.watch(async()=>{await Promise.all([l.updateBindings(),l.updateDirectives()]),await l.viewUpdates.exec();}),m}async unmountComponent(e){var r,o;let s=this.mountedComponents.get(e.uid);if(s){let l=s.cssInstance;if(l){let d=(r=M.STYLE_REF.get(l))!=null?r:1;d===1?(await OUID.rejectComponentStyles(l),M.STYLE_REF.delete(l)):M.STYLE_REF.set(l,d-1);}s.willUnmount(),s._hostElement=null,s.cssInstance=null;}let i=(o=await e.queryAll("*"))!=null?o:[];for(let l of i)await this.unmountComponent(l);this.mountedComponents.delete(e.uid),e.removeAndRelease(),e.hasAttribute("ref")&&this.setRefValue(e.attribute("ref"),null);}};w(M,"RenderContext"),f(M,"PROVIDE_TOKEN","RENDER_CONTEXT"),f(M,"MOUNTED_COMPONENTS_TOKEN","RENDER_CONTEXT_MOUNTED_COMPONENTS"),f(M,"STYLE_REF",new WeakMap);var q=M;async function me(c,e,s=[],i){let r=e!=null?e:{},o=await OUID.createElement(c,Object.keys(r).reduce((l,d)=>(l[d]=r[d],l),{}));return Object.keys(i!=null?i:{}).forEach(l=>{o==null||o.addEventListener(l,d=>{let b=i[l];typeof b=="function"&&b(d);});}),new F(o,s)}w(me,"node");function Bt(c,e,s){return Ut(c)?c().then(i=>ht(i.default,e,s)):ht(c,e,s)}w(Bt,"o");function qt(c){return typeof c=="function"}w(qt,"isProvideFunction");var z=class z{constructor(e,s){f(this,"root");f(this,"options");f(this,"providers",new Map);this.root=e,this.options=s,z.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(`
|
|
6
|
+
`))}};w(K,"StyleData");var tt=K;function ut(c,e,s){return new c(e,s)}w(ut,"createComponent");var ht=class ht{constructor(e={},s={}){f(this,"state");f(this,"parent");f(this,"emits");f(this,"props");f(this,"provides",new Map);this.state=new Z(this),this.props=e,this.emits=new Y(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()}};w(ht,"OComponent");var $=ht;function W(c){let e=Date.now();return `${(1e3+Math.floor(Math.random()*9e3)+c.length).toString(16)}-${e.toString(16)}`}w(W,"generateUIID");function lt(c){return new Promise(e=>setTimeout(e,c))}w(lt,"delay");(function(c){var O,D,k,T,I,L,y,g,P,x,j,V;let e=(O=class{constructor(){f(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 t=>await t()));}},w(O,"BatchActions"),O);c.BatchActions=e;let s=(D=class{constructor(u){f(this,"node");f(this,"operations",[]);this.node=u;}accept(u){this.operations.push(...u.operations),u.operations=[];}async exec(){let u=this.operations;this.operations=[];let t=[],n=u.map(a=>typeof a=="object"?(t.push({fn:a.fn,args:[a.node.uid,...a.args.map(h=>h instanceof i?h.uid:h)]}),null):a()).filter(a=>a!=null);if(t.length>0){let a={},h=[];t.forEach(p=>{let E=`${p.fn}.${p.args.map(S=>S==null?void 0:S.toString()).join(",")}`;a[E]&&!["invoke","setProperty","dispatchEvent"].includes(p.fn)||(a[E]=p,h.push(p));}),n.unshift(v.batchActions(h));}try{await Promise.all(n);}catch(a){console.error("Error while batch updates");}}append(u,...t){return this.operations.push({fn:u,args:t,node:this.node}),this}add(u,t,...n){return typeof u=="function"?this.operations.push(u):this.operations.push({fn:u,args:n,node:t}),this}addEventListener(u,t,n,a){return this.add(()=>{this.node.addEventListener(u,t,{options:n,policy:a});})}setProperty(u,t){return this.append("setProperty",u,t)}dettachEventListener(u){return this.append("dettachEventListener",u)}invoke(u,...t){return this.append("invoke",u,...t.map(n=>n instanceof i?n.ref:n))}dispatchEvent(u,t,n){return this.append("dispatchEvent",u,t,n)}addClass(...u){return this.append("addClass",...u)}removeClass(...u){return this.append("removeClass",...u)}setAttribute(u,t){return this.append("setAttribute",u,t)}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,t){return this.append("replaceChildNode",u,t)}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,t){return this.append("insertBefore",u.uid,t.uid)}setInputValue(u){return this.append("setInputValue",u)}setStyle(u,t){return this.append("setStyle",u,t)}},w(D,"BatchUpdates"),D);c.BatchUpdates=s;let i=(k=class{constructor(u,t){f(this,"uid");f(this,"tag");this.uid=u,this.tag=t;}static toInstance(u){return new k(u.uid,u.tag)}async release(){await v.call("releaseNode",this.uid);}async addEventListener(u,t,n){return v.addEventListener(this,u,t,{options:n==null?void 0:n.options,policy:n==null?void 0:n.policy})}async dettachEventListener(u){await v.dettachEventListener(u);}async invoke(u,...t){return await v.call("invokeObjectMethod",this.uid,u,...t)}async invokeAndHold(u,...t){let n=await v.call("invokeObjectMethodAndHold",this.uid,u,...t);return n&&new k(n.uid,n.tag)}async getProperty(u){return await v.call("getObjectProperty",this.uid,u)}async getPropertyAndHold(u){let t=await v.call("getObjectPropertyAndHold",this.uid,u);return t&&new k(t.uid,t.tag)}async setProperty(u,t){await v.call("setObjectProperty",this.uid,u,t);}async dispatchEvent(u,t,n){await v.call("dispatchEvent",this.uid,u,t,n);}updates(){return new s(this)}batches(){return new s(this)}get ref(){return {__ref__:this.uid}}},w(k,"OObject"),k);c.OObject=i;let r=(T=class extends i{constructor(t){super(t.uid,t.tag);f(this,"textContent");f(this,"type","Unknown");f(this,"attributes");f(this,"children");f(this,"classes");f(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="");}},w(T,"ONode"),T);c.ONode=r;let o=(I=class extends r{constructor(t){super(t);f(this,"_hydrated",false);}async addClass(...t){await v.call("addClass",this.uid,...t);}async removeClass(...t){await v.call("removeClass",this.uid,...t);}async setAttribute(t,n){let a=await v.call("setAttribute",this.uid,t,n);a&&(this.attributes=a);}async removeAttribute(t){let n=await v.call("removeAttribute",this.uid,t);n&&(this.attributes=n);}async appendChild(t){await v.call("appendChild",this.uid,t.uid);}set innerHTML(t){this.setHTML(t);}async cloneNode(t){let n=await v.call("cloneNode",this.uid,t);return n?new I(n):null}async remove(){await v.call("removeNode",this.uid);}async removeAndRelease(){await this.remove(),await this.release();}async removeChild(t){await v.call("removeChild",this.uid,t.uid);}async replaceChildNode(t,n){await v.call("replaceChildNode",this.uid,t.uid,n.uid);}async replaceWith(t){await v.call("replaceWith",this.uid,t.uid);}async after(t){await v.call("insertAfter",this.uid,t.uid);}async setHTML(t){await v.call("setInnerHTML",this.uid,t);}async HTML(){var t;return (t=await v.call("getInnerHTML",this.uid))!=null?t:""}async setInnerText(t){await v.call("setInnerText",this.uid,t);}async setContentText(t){await v.call("setContentText",this.uid,t);}async getContentText(){var t;return (t=await v.call("getContentText",this.uid))!=null?t:""}async content(){var t;try{return (t=await v.call("getInnerText",this.uid))!=null?t:""}catch(n){return console.error(n),""}}async childNodes(){var t,n;return (n=(t=await v.call("childNodes",this.uid))==null?void 0:t.map(a=>new I(a)))!=null?n:[]}hasAttribute(t){return !!this.attributes.find(n=>n.name===t)}async getAttribute(t){var n;return (n=await v.call("getAttribte",this.uid,t))!=null?n:""}attribute(t){var n,a;return (a=(n=this.attributes.find(h=>h.name===t))==null?void 0:n.value)!=null?a:null}async nextSibling(){let t=await v.call("nextSibling",this.uid);return t?new I(t):null}async getAttributeNames(){var t;return (t=await v.call("getAttributeNames",this.uid))!=null?t:[]}async parentNode(){let t=await v.call("parentNode",this.uid);return t?new I(t):null}async insertBefore(t,n){await v.call("insertBefore",this.uid,t.uid,n.uid);}async setInputValue(t){await v.call("setInputValue",this.uid,t);}async inputValue(){var t;return (t=await v.call("inputValue",this.uid))!=null?t:""}get hydrated(){return this._hydrated}hydrate(){this._hydrated=true,this.addClass("hydrated");}async query(t,n){return await v.query(t,n,this.uid)}async queryAll(t,n){return await v.queryAll(t,n,this.uid)}async setStyle(t,n){await v.call("setStyle",this.uid,t,n);}},w(I,"OElement"),I);c.OElement=o;let l=(L=class extends i{constructor(u){super(u.uid,u.tag);}addColorStop(u,t){return this.invoke("addColorStop",u,t),this}},w(L,"CanvasGradient"),L);c.CanvasGradient=l;let d=(y=class extends i{constructor(t){super(t.uid,t.tag);f(this,"batch",new s(this));}static async new(t){let n=typeof t!="undefined"?await v.newObject("DOMMatrix",t):await v.newObject("DOMMatrix");return n?new y(n):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,n,a,h){let p=[];return t&&p.push(t),n&&p.push(n),a&&p.push(a),h&&p.push(h),this.batch.invoke("rotateAxisAngleSelf",...p),this}rotateFromVectorSelf(t,n){let a=[];return t&&a.push(t),n&&a.push(n),this.batch.invoke("rotateFromVectorSelf",...a),this}rotateSelf(t,n,a){let h=[];return t&&h.push(t),n&&h.push(n),a&&h.push(a),this.batch.invoke("rotateFromVectorSelf",...h),this}scale3dSelf(t,n,a,h){let p=[];return t&&p.push(t),n&&p.push(n),a&&p.push(a),h&&p.push(h),this.batch.invoke("scale3dSelf",...p),this}scaleSelf(t,n,a,h,p,E){let S=[];return t&&S.push(t),n&&S.push(n),a&&S.push(a),h&&S.push(h),p&&S.push(p),E&&S.push(E),this.batch.invoke("scaleSelf",...S),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,n,a){return this.batch.invoke("translateSelf",t,n,...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 y(t):null}async flipY(){let t=await this.invokeAndHold("flipY");return t?new y(t):null}async inverse(){let t=await this.invokeAndHold("inverse");return t?new y(t):null}async multiply(t){let n=await this.invokeAndHold("multiply",...t?[t.ref]:[]);return n?new y(n):null}async rotate(t,n,a){let h=[];t&&h.push(t),n&&h.push(n),a&&h.push(a);let p=await this.invokeAndHold("rotate",...h);return p?new y(p):null}async rotateAxisAngle(t,n,a,h){let p=[];t&&p.push(t),n&&p.push(n),a&&p.push(a),h&&p.push(h);let E=await this.invokeAndHold("rotateAxisAngle",...p);return E?new y(E):null}async rotateFromVector(t,n){let a=[];t&&a.push(t),n&&a.push(n);let h=await this.invokeAndHold("rotateFromVector",...a);return h?new y(h):null}async scale(t,n,a,h,p,E){let S=[];t&&S.push(t),n&&S.push(n),a&&S.push(a),h&&S.push(h),p&&S.push(p),E&&S.push(E);let U=await this.invokeAndHold("scale",...S);return U?new y(U):null}async scale3d(t,n,a,h){let p=[];t&&p.push(t),n&&p.push(n),a&&p.push(a),h&&p.push(h);let E=await this.invokeAndHold("scale",...p);return E?new y(E):null}async skewX(t){let n=[];t&&n.push(t);let a=await this.invokeAndHold("skewX",...n);return a?new y(a):null}async skewY(t){let n=[];t&&n.push(t);let a=await this.invokeAndHold("skewY",...n);return a?new y(a):null}toJSON(){return this.invoke("toJSON")}async toString(){return this.invoke("toString")}async translate(t,n,a){let h=[];t&&h.push(t),n&&h.push(n),a&&h.push(a);let p=await this.invokeAndHold("translate",...h);return p?new y(p):null}},w(y,"DOMMatrix"),y);c.DOMMatrix=d;let b=(g=class extends i{constructor(u){super(u.uid,u.tag);}setTransform(u){this.invoke("setTransform",u.ref);}},w(g,"CanvasPattern"),g);c.CanvasPattern=b;let m=(P=class extends i{constructor(t){super(t,"unknown");f(this,"batch",new s(this));}arc(t,n,a,h,p,E=false){return this.batch.invoke("arc",t,n,a,h,p,E),this}arcTo(t,n,a,h,p){return this.batch.invoke("arcTo",t,n,a,h,p),this}bezierCurveTo(t,n,a,h,p,E){return this.batch.invoke("bezierCurveTo",t,n,a,h,p,E),this}clearRect(t,n,a,h){return this.batch.invoke("clearRect",t,n,a,h),this}clip(t,n){let a=[];return typeof t=="string"?a.push(t):t instanceof A&&(t.commit(this.batch),a.push(t.ref)),typeof n=="string"&&a.push(n),this.batch.invoke("clip",...a),this}beginPath(){return this.batch.invoke("beginPath"),this}closePath(){return this.batch.invoke("closePath"),this}async createConicGradient(t,n,a){let h=await this.invokeAndHold("createConicGradient",t,n,a);return h?new l(h):null}async createLinearGradient(t,n,a,h){let p=await this.invokeAndHold("createLinearGradient",t,n,a,h);return p?new l(p):null}async createPattern(t,n=""){let a=await this.invokeAndHold("createPattern",t.ref,n);return a?new b(a):null}async createRadialGradient(t,n,a,h,p,E){let S=await this.invokeAndHold("createRadialGradient",t,n,a,h,p,E);return S?new l(S):null}drawImage(t,n,a,h,p,E,S,U,At){let q=[t.ref];return typeof E=="undefined"?(q.push(n,a),h&&q.push(h),p&&q.push(p),this.batch.invoke("drawImage",...q),this):(q.push(n,a,h,p,E,S,U,At),this.batch.invoke("drawImage",...q),this)}ellipse(t,n,a,h,p,E,S,U=false){return this.batch.invoke("ellipse",t,n,a,h,p,E,S,U),this}fill(t,n){let a=[];return t&&a.push(typeof t=="string"?t:(t.commit(this.batch),t.ref)),n&&a.push(n),this.batch.invoke("fill",...a),this}fillRect(t,n,a,h){return this.batch.invoke("fillRect",t,n,a,h),this}fillText(t,n,a,h){return this.batch.invoke("fillText",t,n,a,...h?[h]:[]),this}getImageData(t,n,a,h,p){return this.invokeAndHold("getImageData",t,n,a,h,...p?[p]:[])}getLineDash(){return this.invoke("getLineDash")}async getTransform(){let t=await this.invokeAndHold("getTransform");return t?new d(t):null}async isContextLost(){return await this.invoke("isContextLost")}async isPointInPath(t,n,a,h){let p=[];return typeof t=="number"?(p.push(t,n),a&&p.push(a)):(await t.commit(this.batch),p.push(t.ref,n,a),h&&p.push(h)),await this.invoke("isPointInPath",...p)}async isPointInStroke(t,n,a){var p;let h=[];return typeof t=="number"?h.push(t,n):(await t.commit(),h.push(t.ref,n,a)),(p=await this.invoke("isPointInStroke",...h))!=null?p:false}lineTo(t,n){return this.batch.invoke("lineTo",t,n),this}async measureText(t){var n;return (n=await this.invoke("measureText",t))!=null?n:0}moveTo(t,n){return this.batch.invoke("moveTo",t,n),this}putImageData(t,n,a,h,p,E,S){let U=[t.ref,n,a];return h&&U.push(h),p&&U.push(p),E&&U.push(E),S&&U.push(S),this.batch.invoke("putImageData",...U),this}quadraticCurveTo(t,n,a,h){return this.batch.invoke("quadraticCurveTo",t,n,a,h),this}rect(t,n,a,h){return this.batch.invoke("rect",t,n,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,n,a,h,p){return this.batch.invoke("roundRect",t,n,a,h,p),this}save(){return this.batch.invoke("save")}scale(t,n){return this.batch.invoke("scale",t,n),this}setLineDash(t){return this.invoke("setLineDash",t)}async setTransform(t,n,a,h,p,E){typeof t=="number"?await this.invoke("setTransform",t,n,a,h,p,E):await this.invoke("setTransform",t.ref);}stroke(t){return this.batch.invoke("stroke",...t?[(t.commit(this.batch),t.ref)]:[]),this}strokeRect(t,n,a,h){return this.batch.invoke("strokeRect",t,n,a,h),this}strokeText(t,n,a,h){return this.batch.invoke("strokeText",t,n,a,...h?[h]:[]),this}transform(t,n,a,h,p,E){return this.batch.invoke("transform",t,n,a,h,p,E),this}translate(t,n){return this.batch.invoke("translate",t,n),this}set fillStyle(t){this.setFillStyle(t);}setFillStyle(t){return this.batch.setProperty("fillStyle",typeof t=="string"?t:t instanceof i?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 i?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();}},w(P,"Canvas2DContext"),P);c.Canvas2DContext=m;let C=(x=class extends i{constructor(u){super(u.uid,u.tag);}static async new(u,t){let n=[];u&&n.push(u),t&&n.push(t);let a=await v.newObject("Image",...n);return a?new x(a):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);}},w(x,"Image"),x);c.Image=C;let A=(j=class extends i{constructor(t){super(t.uid,t.tag);f(this,"batch",new s(this));}static async create(){let t=await v.newObject("Path2D");return t?new j(t):null}addPath(t){return this.batch.invoke("addPath",t.ref),this}arc(t,n,a,h,p,E=false){return this.batch.invoke("arc",t,n,a,h,p,E),this}arcTo(t,n,a,h,p){return this.batch.invoke("arcTo",t,n,a,h,p),this}bezierCurveTo(t,n,a,h,p,E){return this.batch.invoke("bezierCurveTo",t,n,a,h,p,E),this}quadraticCurveTo(t,n,a,h){return this.batch.invoke("quadraticCurveTo",t,n,a,h),this}closePath(){return this.batch.invoke("closePath"),this}ellipse(t,n,a,h,p,E,S,U=false){return this.batch.invoke("ellipse",t,n,a,h,p,E,S,U),this}moveTo(t,n){return this.batch.invoke("moveTo",t,n),this}lineTo(t,n){return this.batch.invoke("lineTo",t,n),this}rect(t,n,a,h){return this.batch.invoke("rect",t,n,a,h),this}roundRect(t,n,a,h,p){return this.batch.invoke("roundRect",t,n,a,h,p),this}commit(t){return t?(t.accept(this.batch),Promise.resolve()):this.batch.exec()}},w(j,"CanvasPath2D"),j);c.CanvasPath2D=A;let N=(V=class extends o{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 t=await this.invokeAndHold("getContext",u);return t&&new m(t.uid)}static async of(u,t,n){let a=await v.query(u,t);return a?new V(a):null}},w(V,"CanvasElement"),V);c.CanvasElement=N;})(R||(R={}));var pt=class pt{constructor(){f(this,"callbacks",new Map);f(this,"DOM_EVENT_LISTENERS",new Map);f(this,"timers",new Map);f(this,"_config");f(this,"listeners",new Map);this.subscribe("__ouid_native_event_success__",(e,s)=>{let i=this.callbacks.get(e);if(i)return this.callbacks.delete(e),i.success(...JSON.parse(s))}),this.subscribe("__ouid_native_event_error__",(e,s)=>{let i=this.callbacks.get(e);if(i)return this.callbacks.delete(e),i.error(...JSON.parse(s))}),this.subscribe("__ouid_web_event__",(e,s)=>{let i=this.DOM_EVENT_LISTENERS.get(e),r=JSON.parse(s);if(i){let o=r[1];return o&&typeof o=="object"&&(o.target=o!=null&&o.target?new R.OElement(o.target):null,o.currentTarget=o!=null&&o.currentTarget?new R.OElement(o.currentTarget):null,o.relatedTarget=o!=null&&o.relatedTarget?new R.OElement(o.relatedTarget):null),i(o)}else console.error("No cb found for ",e,r[0]);});}config(e){return this._config=e,this}invoke(e,...s){let i=W(e);return new Promise((r,o)=>{this.callbacks.set(i,{success:r,error:o});try{if(!WebOUID)throw new Error("NativeOUID bridge not available");WebOUID.invoke(i,e,JSON.stringify(s));}catch(l){console.error(l),this.callbacks.delete(i);}})}registerComponent(e,s){B.register(e,s);}unregisterComponent(e,s){B.unregister(e);}async call(e,...s){try{return (await this.invoke(`_ouid_${e}`,...s)).data}catch(i){return console.error(i),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]=(i,r)=>{var o;(o=this.listeners.get(e))==null||o.forEach(l=>l(i,r));}),this.listeners.get(e).push(s);}async query(e,s,i){let r=await this.call("query",e,s,i);return r?new R.OElement(r):null}async queryAll(e,s,i){let r=await this.call("queryAll",e,s,i);return r?r.map(o=>new R.OElement(o)):[]}async createElement(e,s={}){let i=await this.call("createElement",e,s);return i?new R.OElement(i):null}async createComment(e){let s=await this.call("createComment",e);return s?new R.OElement(s):null}async addEventListener(e,s,i,r){let o=W(s+(typeof e=="string"?e:e.tag));return this.DOM_EVENT_LISTENERS.set(o,i),await v.call("attachEventListener",typeof e=="string"?e:e.uid,o,s,r==null?void 0:r.options,r==null?void 0:r.policy),o}async dettachEventListener(e){this.DOM_EVENT_LISTENERS.delete(e),await v.call("dettachEventListener",e);}async createComponentStyles(e,s=true){let i=await v.call("createComponentStyles",e,s);return i?new R.OElement(i):null}async appendComponentStyles(e){await v.call("appendComponentStyles",e);}async rejectComponentStyles(e){await v.call("rejectComponentStyles",e.uid);}async getOObject(e){let s=await v.call("getOObject",e);return s?new R.OObject(s.uid,s.tag):null}async acquireObject(e){let s=await v.call("acquireObject",e);return s?new R.OObject(s.uid,s.tag):null}async setTimeout(e,s){var o;let i=W("setTimeout"+s);this.DOM_EVENT_LISTENERS.set(i,()=>{e();let l=this.timers.get(r);l&&(this.timers.delete(r),this.DOM_EVENT_LISTENERS.delete(l));});let r=(o=await v.call("setTimeout",i,s))!=null?o:-1;return r>=0&&this.timers.set(r,i),r}async clearTimeout(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await v.call("clearTimeout",e));}async setInterval(e,s){var o;let i=W("setInterval"+s);this.DOM_EVENT_LISTENERS.set(i,e);let r=(o=await v.call("setInterval",i,s))!=null?o:-1;return r>=0&&this.timers.set(r,i),r}async clearInterval(e){let s=this.timers.get(e);s&&(this.timers.delete(e),this.DOM_EVENT_LISTENERS.delete(s),await v.call("clearInterval",e));}async fetch(e,s,i="json"){let r=await v.call("fetch",e,s,i);return i==="buffer"||i==="bytes"?R.OObject.toInstance(r):r}async alert(e){await v.call("alert",e);}async prompt(e){await v.call("prompt",e);}async newObject(e,...s){return v.call("newObject",e,...s)}async requestAnimationFrame(e){var r;let s=W("requestAnimationFrame");this.DOM_EVENT_LISTENERS.set(s,o=>{e(o);let l=this.timers.get(i);l&&(this.DOM_EVENT_LISTENERS.delete(l),this.timers.delete(i));});let i=(r=await v.call("requestAnimationFrame",s))!=null?r:-1;return i>=0&&this.timers.set(i,s),i}async cancelAnimationFrame(e){let s=this.timers.get(e);s&&(this.timers.delete(e),await v.call("cancelAnimationFrame",e),this.DOM_EVENT_LISTENERS.delete(s));}async batchActions(e){await v.call("batchActions",e);}};w(pt,"OUIDBridge");var dt=pt,v=new Proxy(new dt,{get:w((c,e)=>e in c?c[e]:async(...s)=>await c.call(e,...s),"get")});globalThis.OUID=v;var R;function Rt(c){return c.replace(/-([a-z])/g,(e,s)=>s.toUpperCase())}w(Rt,"toCamelCase");function Mt(c){return c.replace(/(?!^)([A-Z])/g,(e,s)=>`-${s.toLowerCase()}`)}w(Mt,"toSnakeCase");function _(c){return at(c)?c.value:c}w(_,"normaliseValue");var jt=typeof globalThis.queueMicrotask=="function",Q=w(c=>c?jt?queueMicrotask(c):Promise.resolve().then(c):Promise.resolve(),"deferMicro"),St=w(()=>new Promise(c=>setTimeout(c,0)),"deferMacro");function Ut(c){return typeof c=="function"&&!("prototype"in c)}w(Ut,"isLazyLoader");var kt=new Map,Et=new Map,Ct=new WeakMap;function _t(c){var i;if(!c||typeof c!="object"&&typeof c!="function")return {};let e=Ct.get(c);if(e)return e;let s=Object.create(null);for(let r=c;r&&r!==Object.prototype;r=Object.getPrototypeOf(r))for(let o of Object.getOwnPropertyNames(r)){if(o==="constructor"||o.startsWith("__")||o.endsWith("__")||o in s)continue;let l=Object.getOwnPropertyDescriptor(r,o);if(!l)continue;let d=(i=l.value)!=null?i:l.get?l.get.call(c):void 0;s[o]=typeof d=="function"?d.bind(c):d;}return Ct.set(c,s),s}w(_t,"getMethodsView");function Tt(c,e){let s=kt.get(c);return s||(s=new Function("s","with (s) { return ("+c+"); }"),kt.set(c,s)),s(e)}w(Tt,"evalInScope");function Vt(c){let e=Et.get(c);if(e)return e;let s=[],i=0;for(;i<c.length;){let r=c.indexOf("{{",i);if(r<0){s.push({t:c.slice(i)});break}r>i&&s.push({t:c.slice(i,r)});let o=c.indexOf("}}",r+2),l=o>=0?c.slice(r+2,o).trim():c.slice(r+2).trim();s.push({e:l}),i=o>=0?o+2:c.length;}return e=w(r=>{let o="";for(let l of s)if(l.t!==void 0)o+=l.t;else if(l.e!==void 0){let d=_(Tt(l.e,r));o+=d==null?"":String(d);}return o},"fn"),Et.set(c,e),e}w(Vt,"compileInterpolated");var Ot,M=class M{constructor(e,s,i,...r){f(this,"app");f(this,"component");f(this,"parentContext");f(this,"bindings",[]);f(this,"directives",[]);f(this,"mountedComponents",(Ot=st(M.MOUNTED_COMPONENTS_TOKEN))!=null?Ot:new Map);f(this,"componentsRegistry",new G);f(this,"updatingDirectives",false);f(this,"updatingBindings",false);f(this,"_stack",[]);f(this,"flatStack",Object.create(null));f(this,"viewUpdates");f(this,"mountedQueue",[]);this.app=e,this.component=s,this.parentContext=i;for(let o of r)this.push(o);}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 i of s)try{i();}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,o;let s=(o=(r=this.component.state)==null?void 0:r.value)!=null?o:{},i=_t(s);return new Proxy(Object.create(null),{get:w((l,d)=>{for(let b=e.length-1;b>=0;b--)if(d in e[b])return _(e[b][d]);return d in this.flatStack?_(this.flatStack[d]):d in i?_(i[d]):_(s[d])},"get"),set:w((l,d,b)=>{let m=null;for(let C=e.length-1;C>=0;C--)if(d in e[C]){m=e[C][d];break}return m||(d in this.flatStack?m=this.flatStack[d]:d in i?m=i[d]:m=s[d]),m&&at(m)?(m.value=b,true):false},"set"),has:w((l,d)=>e.some(b=>d in b)||d in this.flatStack||d in i||d in s,"has")})}resolve(e,...s){if(!e)return;let i=this.resolveScope(...s);try{return Tt(e,i)}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 i;let s=this;for(;;){if(s.componentsRegistry.has(e))return s.componentsRegistry.get(e);if(s=(i=s==null?void 0:s.parentContext)!=null?i:null,!s)break}return B.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",_(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,i=_(this.resolve(e.template));s==="class"?this.expandClass(e.node,i):s==="style"?this.expandStyle(e.node,i):typeof i!="object"&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="undefined"&&this.viewUpdates.add("setAttribute",e.node,s,i.toString());return}if(e.type==="prop"&&e.context.component){let s=_(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(i){console.error(i);}return}}async updateDirectives(){var e;if(!this.updatingDirectives){for(let s of this.directives){if(s.type==="if"){if(!_(s.context.evaluateExpression(s.expr))){if(s.active===false)continue;s.active=false,s.renderedNode&&(s.destroy?this.unmountComponent(s.renderedNode):this.viewUpdates.add("addClass",s.renderedNode,"oui-hidden"));continue}if(s.active===true)continue;s.active=true;let r=s.renderedNode;if(!r||s.destroy){let o=await s.node.cloneNode(true);s.renderedNode=o,await s.context.render(o),this.viewUpdates.add("after",s.placeholder,o);}else this.viewUpdates.add("removeClass",r,"oui-hidden");}if(s.type==="for"){let i=(e=s.children)!=null?e:new Map,r=new Map,o=w((b,m)=>s.key?_(s.context.resolve(s.key,{[s.item]:b})):m,"keyFn"),l=_(s.context.resolve(s.list))||[],d=s.placeholder;for(let b=0;b<l.length;b++){let m=l[b],C=o(m,b),A=i.get(C),N,O,D=d;if(A){N=A.node,O=A.ctx,O.stack=[{[s.item]:m},...s.context.stack];let k=await d.nextSibling();N.uid!==(k==null?void 0:k.uid)&&this.viewUpdates.add("after",D,N),await Promise.all([O.updateBindings(),O.updateDirectives()]);}else O=new M(this.app,this.component,this),O.viewUpdates=this.viewUpdates,O.stack=[{[s.item]:m},...s.context.stack],N=await s.node.cloneNode(true),this.viewUpdates.add("after",D,N),await O.render(N),await O.updateDirectives();d=N,r.set(C,{node:N,ctx:O});}for(let[b,m]of i.entries())r.has(b)||this.unmountComponent(m.node);s.children=r;}}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 i=new R.BatchActions;await Promise.all([this.updateBindings(),this.updateDirectives()]),i.commit(),this.viewUpdates.add("addClass",e,"hydrated");}async expandClass(e,s){let i;typeof s=="object"?Array.isArray(s)?i=s:i=Object.keys(s).filter(r=>s[r]):i=s.toString().split(/\s+/),i.length>0&&this.viewUpdates.add("addClass",e,...i);}expandStyle(e,s){let i=s;typeof s=="object"&&!Array.isArray(s)&&(i=Object.keys(s).filter(r=>s[r]).map(r=>`${Mt(r)}: ${s[r]}`).join(";")),i&&this.viewUpdates.add("setAttribute",e,"style",i);}expandStandardAttributes(e){[...e.attributes].filter(s=>s.name.startsWith(":")).forEach(s=>{let i=s.name.substring(1);this.bind({type:"attribute",node:e,key:i,context:this,template:s.value.trim()}),this.viewUpdates.add("removeAttribute",e,s.name);});}setRefValue(e,s){let i=e.trim();this.updateValue(i,s);}async handleElementNode(e,s){var D;let i=await e.parentNode(),r=null,o=e.hasAttribute("o-if")?"o-if":e.hasAttribute("o-show")?"o-show":null;if(o){let k=await e.getAttribute(o),T=await OUID.createComment(o+":"+k),I=o==="o-if";await i.insertBefore(e,T),await e.updates().removeAttribute(o).remove().exec(),this.directive({type:"if",expr:k,node:e,placeholder:T,context:this,active:void 0,destroy:I}),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 k=await e.getAttribute("o-for"),[T,I]=k.split(" of ").map(g=>g.trim()),L=await OUID.createComment("for:"+k),y=(D=e.attribute(":key"))!=null?D:"";await(i==null?void 0:i.insertBefore(e,L)),await e.updates().removeAttribute("o-for").removeAttribute(":key").remove().exec(),this.directive({type:"for",item:T,list:I,node:e,placeholder:L,context:this,key:y}),r="for";return}let l=e.tag.toLowerCase(),d=this.resolveTag(l),b=e.updates();[...e.attributes].forEach(async k=>{if(k.name==="o-model"){let T=k.value.trim();b.setInputValue(_(this.resolve(T))).addEventListener("input",async L=>{let y=await L.target.getProperty("value");this.updateValue(T,y);}),this.bind({node:e,key:T,type:"model",context:this}),b.removeAttribute(k.name);}else k.name==="ref"&&(d||this.setRefValue(k.value,e));});let m={},C={},{props:A,events:N}=this.componentAttributes(e,this);if(m=A,C=N,this.expandStandardAttributes(e),Object.keys(C).forEach(async k=>{let T=C[k];d||b.addEventListener(k,I=>{typeof T=="function"&&T.apply(this.component,[I]);}),b.removeAttribute("@"+k);}),this.viewUpdates.accept(b),d){await this.mountComponent(e,d,this,m,C);return}let O=await e.childNodes();s!=null&&s.skipSlotted&&(O=O.filter(k=>!k.hasAttribute("slotted")));for(let k of O)await this.render(k,s);}handleTextNode(e){var i;let s=(i=e.textContent)!=null?i:"";s.includes("{{")&&this.bind({type:"interpolation",node:e,key:"__template__",templateFn:Vt(s),context:this});}componentAttributes(e,s){let i={},r={},o=["import","interface","module","o-model","o-if","o-for"];return [...e.attributes].filter(l=>!o.includes(l.name)).forEach(l=>{let d=l.name;if(d.startsWith("@")){let C=s==null?void 0:s.resolve(l.value);if(typeof C!="function")throw new Error("Event handler can only be function");d=d.substring(1),r[d]=C;return}let b=null,m=l.value;d.startsWith(":")&&(b=l.value,d=d.substring(1),m=_(s==null?void 0:s.resolve(l.value))),d=Rt(d),i[d]={name:d,value:m,expr:b};}),{props:i,events:r}}async mountComponent(e,s,i,r={},o={}){var N,O,D,k,T,L;if(this.viewUpdates=(O=(N=this.viewUpdates)!=null?N:i==null?void 0:i.viewUpdates)!=null?O:new R.BatchUpdates(e),this.mountedComponents.has(e.uid))return this.mountedComponents.get(e.uid);let l=new M(this.app,{},this);l.viewUpdates=this.viewUpdates;let d={},b;for(let y of Object.keys(r)){let g=r[y];if(g.name==="ref"&&!g.expr){b=g;continue}g.expr&&this.bind({type:"prop",node:e,key:y,context:l,template:g.expr}),d[y]=g.value;}let m=await Bt(s,d,o);l.component=m,l.stack=[],this.mountedComponents.set(e.uid,m),b&&this.setRefValue(b.value,m);{let y=e.updates();for(let P of Object.keys(r))r[P].expr||y.setAttribute(P,r[P].value);let g=(D=m.hostClasses)!=null?D:[];g&&(g=typeof g=="string"?[g]:g),g.push("o-component-host"),e.tag.toLowerCase()!=="div"&&g.push("c-"+e.tag.toLowerCase()),y.addClass(...g),this.viewUpdates.accept(y);}Q(async()=>{try{await m.decorateHostElement(e);}catch(y){}});{let y=(k=m.use)!=null?k:{};for(let g of Object.keys(y))l.componentsRegistry.register(g,y[g]);}if(m.willMount(),!s.cssInstance){let y=m.style?(T=m.style())==null?void 0:T.toString():m.css;y&&((s.cssInstance)!=null||(s.cssInstance=await OUID.createComponentStyles(y,false)));}Q(()=>{var g;let y=s.cssInstance;if(y){let P=(g=M.STYLE_REF.get(y))!=null?g:0;P===0&&OUID.appendComponentStyles(y.uid),M.STYLE_REF.set(y,P+1),m.cssInstance=y;}});let C=await e.childNodes();if(m.render){let y=await m.render(l);y&&y.attachTo(e);}else await e.setHTML(m.template.trim());let A=await e.queryAll("slot");A&&A.length&&await Promise.all(A.filter(y=>{var g;return !((g=y.classes)!=null&&g.includes("hydrated"))}).map(async y=>{let g=y.attribute("name"),P=C.filter(x=>g?x.type==="Element"&&x.attribute("slot")===g:x.type!=="Element"||!x.hasAttribute("slot"));if(P.length){for(let x of P)this.viewUpdates.add("setAttribute",x,"slotted","true"),this.viewUpdates.add("appendChild",y,x);await this.viewUpdates.exec(),await Promise.all(P.map(x=>this.render(x)));}})),m._hostElement=e,m.parent=(L=i==null?void 0:i.component)!=null?L:void 0,m.provide(M.PROVIDE_TOKEN,this);{let y=await e.childNodes(),g=6,P=0;for(;P<y.length;){let x=y.slice(P,P+g);await Promise.all(x.map(j=>l.render(j,{skipSlotted:true}))),P+=g;}}return l.viewUpdates.add("addClass",e,"hydrated"),this.enqueueMounted(()=>{try{m.onMounted();}catch(y){}}),await l.viewUpdates.exec(),m.state.watch(async()=>{await Promise.all([l.updateBindings(),l.updateDirectives()]),await l.viewUpdates.exec();}),m}async unmountComponent(e){var r,o;let s=this.mountedComponents.get(e.uid);if(s){let l=s.cssInstance;if(l){let d=(r=M.STYLE_REF.get(l))!=null?r:1;d===1?(await OUID.rejectComponentStyles(l),M.STYLE_REF.delete(l)):M.STYLE_REF.set(l,d-1);}s.willUnmount(),s._hostElement=null,s.cssInstance=null;}let i=(o=await e.queryAll("*"))!=null?o:[];for(let l of i)await this.unmountComponent(l);this.mountedComponents.delete(e.uid),e.removeAndRelease(),e.hasAttribute("ref")&&this.setRefValue(e.attribute("ref"),null);}};w(M,"RenderContext"),f(M,"PROVIDE_TOKEN","RENDER_CONTEXT"),f(M,"MOUNTED_COMPONENTS_TOKEN","RENDER_CONTEXT_MOUNTED_COMPONENTS"),f(M,"STYLE_REF",new WeakMap);var H=M;async function me(c,e,s=[],i){let r=e!=null?e:{},o=await OUID.createElement(c,Object.keys(r).reduce((l,d)=>(l[d]=r[d],l),{}));return Object.keys(i!=null?i:{}).forEach(l=>{o==null||o.addEventListener(l,d=>{let b=i[l];typeof b=="function"&&b(d);});}),new F(o,s)}w(me,"node");function Bt(c,e,s){return Ut(c)?c().then(i=>ut(i.default,e,s)):ut(c,e,s)}w(Bt,"o");function Ht(c){return typeof c=="function"}w(Ht,"isProvideFunction");var z=class z{constructor(e,s){f(this,"root");f(this,"options");f(this,"providers",new Map);this.root=e,this.options=s,z.currentApp=this;}provide(e,s){if(this.providers.has(e)){console.warn(`[OUID] - Provider ${e} already exists`);return}this.providers.set(e,Ht(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(`
|
|
7
7
|
* {
|
|
8
8
|
${e} * {
|
|
9
9
|
visibility: hidden;
|
|
@@ -14,7 +14,7 @@ ${i.toString()}}
|
|
|
14
14
|
.oui-hidden {
|
|
15
15
|
display: none !important;
|
|
16
16
|
}
|
|
17
|
-
`),
|
|
17
|
+
`),qt(H.MOUNTED_COMPONENTS_TOKEN,new Map);let s=await OUID.query(e);if(!s)throw new Error("No selector found for "+e);let i=new H(this,{},null);i.mountComponent(s,this.root,null).then(async()=>{i.updateBindings(),i.updateDirectives(),await i.flushMounted();});}};w(z,"App"),f(z,"currentApp",null);var it=z;function qt(c,e){var s;(s=it.currentApp)==null||s.provide(c,e);}w(qt,"provide");function st(c){var e,s;return (s=(e=it.currentApp)==null?void 0:e.inject(c))!=null?s:void 0}w(st,"inject");function Ft(c,e,s,i){var r=arguments.length,o=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,s):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(c,e,s,i);else for(var d=c.length-1;d>=0;d--)(l=c[d])&&(o=(r<3?l(o):r>3?l(e,s,o):l(e,s))||o);return r>3&&o&&Object.defineProperty(e,s,o),o}w(Ft,"_ts_decorate");var mt=class mt extends ${constructor(){super(...arguments);f(this,"router");}willMount(){}onMounted(){var s;this.router=Wt(),(s=this.router)==null||s.bind(this).then(i=>{i==null||i();});}willUnmount(){var s;(s=this.router)==null||s.unbind();}};w(mt,"ORouter");var X=mt;X=Ft([gt({tag:"o-router",template:`
|
|
18
18
|
<div id="router-view"></div>
|
|
19
19
|
`,css:`
|
|
20
20
|
#router-view {
|
|
@@ -58,11 +58,11 @@ ${i.toString()}}
|
|
|
58
58
|
.route-pop-end {
|
|
59
59
|
transform: translateX(100%);
|
|
60
60
|
}
|
|
61
|
-
`})],X);var Pt="OROUTER_TOKEN",ft="ACTIVE_ROUTE",xt=250;function Wt(){return st(Pt)}w(Wt,"useRouter");function xe(c){return new wt(c)}w(xe,"createRouter");function Gt(c){c&&(c.__isActive=true,typeof c.onActivated=="function"&&c.onActivated());}w(Gt,"activate");function Jt(c){c&&(c.__isActive=false,typeof c.onDeactivated=="function"&&c.onDeactivated());}w(Jt,"deactivate");var yt=class yt{constructor(e){f(this,"routes");f(this,"windowObject",null);f(this,"guards",[]);f(this,"eventRegistration",null);f(this,"compiled");f(this,"outletEl",null);f(this,"stack",[]);f(this,"pendingNav",null);f(this,"lastDirection","none");f(this,"historyIndex",0);this.routes=e,this.compiled=e.map(s=>({route:s,parser:new $t(s.path)}));}install(e){e.provide(Pt,this),OUID.registerComponent("o-router",X);}resolveByName(e){for(let s of this.compiled)if(s.route.name===e)return {route:s.route,params:{},query:{},parser:s.parser};return null}resolve(e){let[s,i=""]=e.split("?"),r=i?i.split("&").reduce((o,l)=>{let[d,b=""]=l.split("=");return d&&(o[d]=decodeURIComponent(b)),o},{}):{};for(let o of this.compiled){let l=o.parser.match(s);if(l)return o.route.redirectTo?typeof o.route.redirectTo=="string"?this.resolve(o.route.redirectTo):this.resolveByName(o.route.redirectTo.name):{route:o.route,params:l,query:r,parser:o.parser}}return null}replace(e){this.push(e,true);}push(e,s=false){var r,o;if(!e.path&&!e.name){console.warn("[OUID-Router]: no path or name provided to push");return}this.lastDirection="forward";let i=w((l,d=true)=>{var m,C,A;let b={navIndex:s?this.historyIndex:this.historyIndex+1};s?(m=this.windowObject)==null||m.invoke("history.replaceState",b,"",l):(C=this.windowObject)==null||C.invoke("history.pushState",b,"",l),d&&((A=this.windowObject)==null||A.dispatchEvent("popstate","PopStateEvent",{state:b}));},"dispatchPushEvent");if(e.name){let l=this.resolveByName(e.name);if(!l){console.warn("[OUID-Router]: No matched route name found");return}let d=l.parser.reverse((r=e.params)!=null?r:{});d&&i(d);return}if(e.absolute&&e.path&&i(e.path,false),e.path){let l=this.resolve(e.path);if(l){let d=l.parser.reverse((o=e.params)!=null?o:{});d&&i(d);return}}}async pop(){var s,i;this.lastDirection="back",(s=this.windowObject)==null||s.invoke("history.back");let e={navIndex:this.historyIndex-1};await((i=this.windowObject)==null?void 0:i.invoke("history.pushState",e,""));}async beforeRouteGoing(e,s){for(let i of this.guards.filter(r=>r.type==="before")){let r=await i.fn(e,s);if(r)return r}}async afterRouteGoing(e,s){for(let i of this.guards.filter(r=>r.type==="after")){let r=await i.fn(e,s);if(r)return r}}async bind(e){this.windowObject=await OUID.acquireObject("window");let s=w(async()=>{var g,P;this.windowObject||(this.windowObject=await OUID.acquireObject("window"));let d=await this.windowObject.getProperty("location.pathname"),b=this.resolve(d);if(!b){console.warn(`[Router] No route found for: ${d}`);return}let m=e.inject(
|
|
61
|
+
`})],X);var Pt="OROUTER_TOKEN",ft="ACTIVE_ROUTE",xt=250;function Wt(){return st(Pt)}w(Wt,"useRouter");function xe(c){return new wt(c)}w(xe,"createRouter");function Gt(c){c&&(c.__isActive=true,typeof c.onActivated=="function"&&c.onActivated());}w(Gt,"activate");function Jt(c){c&&(c.__isActive=false,typeof c.onDeactivated=="function"&&c.onDeactivated());}w(Jt,"deactivate");var yt=class yt{constructor(e){f(this,"routes");f(this,"windowObject",null);f(this,"guards",[]);f(this,"eventRegistration",null);f(this,"compiled");f(this,"outletEl",null);f(this,"stack",[]);f(this,"pendingNav",null);f(this,"lastDirection","none");f(this,"historyIndex",0);this.routes=e,this.compiled=e.map(s=>({route:s,parser:new $t(s.path)}));}install(e){e.provide(Pt,this),OUID.registerComponent("o-router",X);}resolveByName(e){for(let s of this.compiled)if(s.route.name===e)return {route:s.route,params:{},query:{},parser:s.parser};return null}resolve(e){let[s,i=""]=e.split("?"),r=i?i.split("&").reduce((o,l)=>{let[d,b=""]=l.split("=");return d&&(o[d]=decodeURIComponent(b)),o},{}):{};for(let o of this.compiled){let l=o.parser.match(s);if(l)return o.route.redirectTo?typeof o.route.redirectTo=="string"?this.resolve(o.route.redirectTo):this.resolveByName(o.route.redirectTo.name):{route:o.route,params:l,query:r,parser:o.parser}}return null}replace(e){this.push(e,true);}push(e,s=false){var r,o;if(!e.path&&!e.name){console.warn("[OUID-Router]: no path or name provided to push");return}this.lastDirection="forward";let i=w((l,d=true)=>{var m,C,A;let b={navIndex:s?this.historyIndex:this.historyIndex+1};s?(m=this.windowObject)==null||m.invoke("history.replaceState",b,"",l):(C=this.windowObject)==null||C.invoke("history.pushState",b,"",l),d&&((A=this.windowObject)==null||A.dispatchEvent("popstate","PopStateEvent",{state:b}));},"dispatchPushEvent");if(e.name){let l=this.resolveByName(e.name);if(!l){console.warn("[OUID-Router]: No matched route name found");return}let d=l.parser.reverse((r=e.params)!=null?r:{});d&&i(d);return}if(e.absolute&&e.path&&i(e.path,false),e.path){let l=this.resolve(e.path);if(l){let d=l.parser.reverse((o=e.params)!=null?o:{});d&&i(d);return}}}async pop(){var s,i;this.lastDirection="back",(s=this.windowObject)==null||s.invoke("history.back");let e={navIndex:this.historyIndex-1};await((i=this.windowObject)==null?void 0:i.invoke("history.pushState",e,""));}async beforeRouteGoing(e,s){for(let i of this.guards.filter(r=>r.type==="before")){let r=await i.fn(e,s);if(r)return r}}async afterRouteGoing(e,s){for(let i of this.guards.filter(r=>r.type==="after")){let r=await i.fn(e,s);if(r)return r}}async bind(e){this.windowObject=await OUID.acquireObject("window");let s=w(async()=>{var g,P;this.windowObject||(this.windowObject=await OUID.acquireObject("window"));let d=await this.windowObject.getProperty("location.pathname"),b=this.resolve(d);if(!b){console.warn(`[Router] No route found for: ${d}`);return}let m=e.inject(H.PROVIDE_TOKEN);this.outletEl||(this.outletEl=await m.hostElement.query("#router-view"));let C=this.outletEl;if(!C)return;let A=await this.beforeRouteGoing({url:d,path:d,name:b.route.name},e.inject(ft));if(A){typeof A=="object"&&"name"in A&&this.push({name:A.name,params:A.params});return}e.provide(ft,{params:b.params,query:b.query});let N=await C.childNodes(),O=(g=N[N.length-1])!=null?g:null,D=O&&(P=m.getMountedComponent(O))!=null?P:null,k=this.getNavMode(),T,I,L=this.stack.length,y=this.stack[L-2];if(this.lastDirection==="back"&&y){T=y.host,I=y.inst;let x=C.updates();N.some(j=>j.uid===T.uid),x.add("appendChild",C,T),x.add("removeClass",T,"route-hidden"),await x.exec(),await Promise.all([y.ctx.updateBindings(),y.ctx.updateDirectives()]);}else {let x=await OUID.createElement("div",{class:"route-view route-hidden"});await C.appendChild(x);let j=await m.mountComponent(x,b.route.component,m);T=x,I=j,m==null||m.flushMounted(),this.lastDirection==="forward"&&this.stack.push({host:x,ctx:m,inst:j});}k==="push"?await this.runTransitionPush(C,O,T):k==="pop"&&O&&await this.runTransitionPop(C,O,T),O&&D&&this.lastDirection==="back"&&(this.stack.pop(),Jt(D),await m.unmountComponent(O)),Gt(I),await this.afterRouteGoing({url:d,path:d,name:b.route.name},e.inject(ft)),await Q();},"handler"),i=w(async d=>{await this.windowObject.getProperty("location.pathname");return this.pendingNav?this.pendingNav:(this.pendingNav=(async()=>{try{let m=(d==null?void 0:d.state)||await this.windowObject.getProperty("history.state"),C=0;m&&typeof m.navIndex=="number"&&(C=m.navIndex),C>this.historyIndex?this.lastDirection="forward":C<this.historyIndex?this.lastDirection="back":this.lastDirection="none",this.historyIndex=C,await s();}finally{this.pendingNav=null;}})(),this.pendingNav)},"run"),r=await this.windowObject.getProperty("location.pathname"),o=await this.windowObject.getProperty("history.state");(!o||typeof o.navIndex!="number")&&await this.windowObject.invoke("history.replaceState",{navIndex:this.historyIndex},"",r);let l=await this.windowObject.addEventListener("popstate",i);return this.eventRegistration=l,s}unbind(){var e;this.eventRegistration&&((e=this.windowObject)==null||e.dettachEventListener(this.eventRegistration));}async runTransitionPush(e,s,i){if(!s){await i.updates().removeClass("route-hidden","route-transitioning","route-push-start").addClass("route-view","route-push-end").exec();return}let r=i.updates();r.addClass("route-view"),s&&r.add(()=>s.addClass("route-view")),r.removeClass("route-hidden","route-push-end","route-pop-end").addClass("route-push-start"),await r.exec(),await St();let o=i.updates();o.addClass("route-transitioning").removeClass("route-push-start").addClass("route-push-end"),await o.exec(),await lt(xt+40);let l=i.updates();l.removeClass("route-transitioning","route-push-start"),l.add(()=>s==null?void 0:s.addClass("route-hidden")),await l.exec();}async runTransitionPop(e,s,i){let r=s.updates();r.addClass("route-view"),r.add(()=>i.updates().addClass("route-view").removeClass("route-hidden").exec()),r.addClass("route-pop-start").removeClass("route-push-end","route-pop-end"),await r.exec(),await Q();let o=s.updates();o.addClass("route-transitioning"),o.removeClass("route-pop-start").addClass("route-pop-end"),await o.exec(),await lt(xt+40);let l=s.updates();l.addClass("route-hidden").removeClass("route-transitioning","route-pop-start"),await l.exec();}getNavMode(){return this.lastDirection==="back"?"pop":"push"}beforeEach(e){let s={fn:e,type:"before"};return this.guards.push(s),()=>{this.guards.splice(this.guards.indexOf(s));}}afterEach(e){let s={fn:e,type:"after"};return this.guards.push(s),()=>{this.guards.splice(this.guards.indexOf(s));}}};w(yt,"Router");var wt=yt;var vt=class vt extends ${render(e){return F.of('<i class="o-icon"><slot></slot></i>')}style(){return tt.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
|
-
`})}};w(vt,"OIcon");var It=vt;function Re(){return B.getAll().reduce((e,[s,i])=>(e[s]=i,e),{})}w(Re,"components");export{ft as ACTIVE_ROUTE_TOKEN,it as App,gt as Component,Y as Emits,$ as OComponent,R as ODOM,It as OIcon,X as ORouter,v as OUID,dt as OUIDBridge,Pt as ROUTER_INJECTION_TOKEN,
|
|
67
|
+
`})}};w(vt,"OIcon");var It=vt;function Re(){return B.getAll().reduce((e,[s,i])=>(e[s]=i,e),{})}w(Re,"components");export{ft as ACTIVE_ROUTE_TOKEN,it as App,gt as Component,Y as Emits,$ as OComponent,R as ODOM,It as OIcon,X as ORouter,v as OUID,dt as OUIDBridge,Pt as ROUTER_INJECTION_TOKEN,H as RenderContext,F as RenderNode,wt as Router,Z as State,J as Stated,tt as StyleData,Re as components,ut as createComponent,xe as createRouter,St as deferMacro,Q as deferMicro,st as inject,at as isStated,me as node,Bt as o,qt as provide,Dt as stated,Wt as useRouter};//# sourceMappingURL=index.js.map
|
|
68
68
|
//# sourceMappingURL=index.js.map
|