From d43c9342e32deda1c345909ae03055dc785858ea Mon Sep 17 00:00:00 2001 From: goldbuick Date: Thu, 2 May 2024 18:25:13 +0000 Subject: [PATCH] Build: (2dc973a) automation changes --- assets/{index-CkR4KJf6.js => index-7p3oxQE6.js} | 4 ++-- index.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename assets/{index-CkR4KJf6.js => index-7p3oxQE6.js} (72%) diff --git a/assets/index-CkR4KJf6.js b/assets/index-7p3oxQE6.js similarity index 72% rename from assets/index-CkR4KJf6.js rename to assets/index-7p3oxQE6.js index ec4f5fc7..f35fbb75 100644 --- a/assets/index-CkR4KJf6.js +++ b/assets/index-7p3oxQE6.js @@ -3676,7 +3676,7 @@ No matching component was found for: * https://github.com/Starcounter-Jack/JSON-Patch * (c) 2017-2021 Joachim Wester * MIT license - */var DR=new WeakMap,$q=function(){function e(A){this.observers=new Map,this.obj=A}return e}(),Aj=function(){function e(A,t){this.callback=A,this.observer=t}return e}();function ej(e){return DR.get(e)}function tj(e,A){return e.observers.get(A)}function nj(e,A){e.observers.delete(A.callback)}function ij(e,A){A.unobserve()}function rj(e,A){var t=[],n,i=ej(e);if(!i)i=new $q(e),DR.set(e,i);else{var r=tj(i,A);n=r&&r.observer}if(n)return n;if(n={},i.value=pi(e),A){n.callback=A,n.next=null;var s=function(){oD(n)},o=function(){clearTimeout(n.next),n.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",o),window.addEventListener("keyup",o),window.addEventListener("mousedown",o),window.addEventListener("keydown",o),window.addEventListener("change",o))}return n.patches=t,n.object=e,n.unobserve=function(){oD(n),clearTimeout(n.next),nj(i,n),typeof window<"u"&&(window.removeEventListener("mouseup",o),window.removeEventListener("keyup",o),window.removeEventListener("mousedown",o),window.removeEventListener("keydown",o),window.removeEventListener("change",o))},i.observers.set(A,new Aj(A,n)),n}function oD(e,A){A===void 0&&(A=!1);var t=DR.get(e.object);MR(t.value,e.object,e.patches,"",A),e.patches.length&&FQ(t.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function MR(e,A,t,n,i){if(A!==e){typeof A.toJSON=="function"&&(A=A.toJSON());for(var r=iD(A),s=iD(e),o=!1,a=s.length-1;a>=0;a--){var l=s[a],I=e[l];if(nD(A,l)&&!(A[l]===void 0&&I!==void 0&&Array.isArray(A)===!1)){var u=A[l];typeof I=="object"&&I!=null&&typeof u=="object"&&u!=null&&Array.isArray(I)===Array.isArray(u)?MR(I,u,t,n+"/"+Ql(l),i):I!==u&&(i&&t.push({op:"test",path:n+"/"+Ql(l),value:pi(I)}),t.push({op:"replace",path:n+"/"+Ql(l),value:pi(u)}))}else Array.isArray(e)===Array.isArray(A)?(i&&t.push({op:"test",path:n+"/"+Ql(l),value:pi(I)}),t.push({op:"remove",path:n+"/"+Ql(l)}),o=!0):(i&&t.push({op:"test",path:n,value:e}),t.push({op:"replace",path:n,value:A}))}if(!(!o&&r.length==s.length))for(var a=0;anew Proxy(e,A);const aD=Object.getPrototypeOf,lD=new WeakMap,_G=e=>e&&(lD.has(e)?lD.get(e):aD(e)===Object.prototype||aD(e)===Array.prototype),uB=e=>typeof e=="object"&&e!==null,gj=e=>{if(Array.isArray(e))return Array.from(e);const A=Object.getOwnPropertyDescriptors(e);return Object.values(A).forEach(t=>{t.configurable=!0}),Object.create(aD(e),A)},SR=e=>e[RR]||e,kG=(e,A,t,n)=>{if(!_G(e))return e;let i=n&&n.get(e);if(!i){const a=SR(e);i=(l=>Object.values(Object.getOwnPropertyDescriptors(l)).some(I=>!I.configurable&&!I.writable))(a)?[a,gj(a)]:[a],n==null||n.set(e,i)}const[r,s]=i;let o=t&&t.get(r);return o&&o[1].f===!!s||(o=((a,l)=>{const I={f:l};let u=!1;const C=(d,m)=>{if(!u){let p=I[pu].get(a);if(p||(p={},I[pu].set(a,p)),d===ju)p[ju]=!0;else{let f=p[d];f||(f=new Set,p[d]=f),f.add(m)}}},h={get:(d,m)=>m===RR?a:(C("k",m),kG(Reflect.get(d,m),I[pu],I.c,I.t)),has:(d,m)=>m===aj?(u=!0,I[pu].delete(a),!0):(C("h",m),Reflect.has(d,m)),getOwnPropertyDescriptor:(d,m)=>(C("o",m),Reflect.getOwnPropertyDescriptor(d,m)),ownKeys:d=>(C(ju),Reflect.ownKeys(d))};return l&&(h.set=h.deleteProperty=()=>!1),[h,I]})(r,!!s),o[1].p=lj(s||r,o[0]),t&&t.set(r,o)),o[1][pu]=A,o[1].c=t,o[1].t=n,o[1].p},LG=(e,A,t,n,i=Object.is)=>{if(i(e,A))return!1;if(!uB(e)||!uB(A))return!0;const r=t.get(SR(e));if(!r)return!0;if(n){const o=n.get(e);if(o&&o.n===A)return o.g;n.set(e,{n:A,g:!1})}let s=null;try{for(const o of r.h||[])if(s=Reflect.has(e,o)!==Reflect.has(A,o),s)return s;if(r[ju]===!0){if(s=((o,a)=>{const l=Reflect.ownKeys(o),I=Reflect.ownKeys(a);return l.length!==I.length||l.some((u,C)=>u!==I[C])})(e,A),s)return s}else for(const o of r.o||[])if(s=!!Reflect.getOwnPropertyDescriptor(e,o)!=!!Reflect.getOwnPropertyDescriptor(A,o),s)return s;for(const o of r.k||[])if(s=LG(e[o],A[o],t,n,i),s)return s;return s===null&&(s=!0),s}finally{n&&n.set(e,{n:A,g:s})}},cj=e=>_G(e)&&e[RR]||null,m2=(e,A=!0)=>{lD.set(e,A)},Ij=(e,A,t)=>{const n=[],i=new WeakSet,r=(s,o)=>{if(i.has(s))return;uB(s)&&i.add(s);const a=uB(s)&&A.get(SR(s));if(a){var l,I;if((l=a.h)==null||l.forEach(C=>{const h=`:has(${String(C)})`;n.push(o?[...o,h]:[h])}),a[ju]===!0){const C=":ownKeys";n.push(o?[...o,C]:[C])}else{var u;(u=a.o)==null||u.forEach(C=>{const h=`:hasOwn(${String(C)})`;n.push(o?[...o,h]:[h])})}(I=a.k)==null||I.forEach(C=>{t&&!("value"in(Object.getOwnPropertyDescriptor(s,C)||{}))||r(s[C],o?[...o,C]:[C])})}else o&&n.push(o)};return r(e),n};var CB={ZSS_LANG_DEV:"false",ZSS_STATS_DEV:"false",ZSS_SHOW_CODE:"false",ZSS_BRANCH_NAME:"main",ZSS_BRANCH_VERSION:"0.12.0",ZSS_COMMIT_HASH:"24fca8b0b67c9423ddd4c32bc393a34bf7d81113",ZSS_COMMIT_MESSAGE:"ci: version bump to v0.12.0",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Ym=e=>typeof e=="object"&&e!==null,ra=new WeakMap,PE=new WeakSet,uj=(e=Object.is,A=(l,I)=>new Proxy(l,I),t=l=>Ym(l)&&!PE.has(l)&&(Array.isArray(l)||!(Symbol.iterator in l))&&!(l instanceof WeakMap)&&!(l instanceof WeakSet)&&!(l instanceof Error)&&!(l instanceof Number)&&!(l instanceof Date)&&!(l instanceof String)&&!(l instanceof RegExp)&&!(l instanceof ArrayBuffer),n=l=>{switch(l.status){case"fulfilled":return l.value;case"rejected":throw l.reason;default:throw l}},i=new WeakMap,r=(l,I,u=n)=>{const C=i.get(l);if((C==null?void 0:C[0])===I)return C[1];const h=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l));return m2(h,!0),i.set(l,[I,h]),Reflect.ownKeys(l).forEach(d=>{if(Object.getOwnPropertyDescriptor(h,d))return;const m=Reflect.get(l,d),{enumerable:p}=Reflect.getOwnPropertyDescriptor(l,d),f={value:m,enumerable:p,configurable:!0};if(PE.has(m))m2(m,!1);else if(m instanceof Promise)delete f.value,f.get=()=>u(m);else if(ra.has(m)){const[Q,B]=ra.get(m);f.value=r(Q,B(),u)}Object.defineProperty(h,d,f)}),Object.preventExtensions(h)},s=new WeakMap,o=[1,1],a=l=>{if(!Ym(l))throw new Error("object required");const I=s.get(l);if(I)return I;let u=o[0];const C=new Set,h=(S,N=++o[0])=>{u!==N&&(u=N,C.forEach(F=>F(S,N)))};let d=o[1];const m=(S=++o[1])=>(d!==S&&!C.size&&(d=S,f.forEach(([N])=>{const F=N[1](S);F>u&&(u=F)})),u),p=S=>(N,F)=>{const K=[...N];K[1]=[S,...K[1]],h(K,F)},f=new Map,Q=(S,N)=>{if((CB?"production":void 0)!=="production"&&f.has(S))throw new Error("prop listener already exists");if(C.size){const F=N[3](p(S));f.set(S,[N,F])}else f.set(S,[N])},B=S=>{var N;const F=f.get(S);F&&(f.delete(S),(N=F[1])==null||N.call(F))},w=S=>(C.add(S),C.size===1&&f.forEach(([F,K],z)=>{if((CB?"production":void 0)!=="production"&&K)throw new Error("remove already exists");const P=F[3](p(z));f.set(z,[F,P])}),()=>{C.delete(S),C.size===0&&f.forEach(([F,K],z)=>{K&&(K(),f.set(z,[F]))})}),R=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l)),x=A(R,{deleteProperty(S,N){const F=Reflect.get(S,N);B(N);const K=Reflect.deleteProperty(S,N);return K&&h(["delete",[N],F]),K},set(S,N,F,K){const z=Reflect.has(S,N),P=Reflect.get(S,N,K);if(z&&(e(P,F)||s.has(F)&&e(P,s.get(F))))return!0;B(N),Ym(F)&&(F=cj(F)||F);let $=F;if(F instanceof Promise)F.then(eA=>{F.status="fulfilled",F.value=eA,h(["resolve",[N],eA])}).catch(eA=>{F.status="rejected",F.reason=eA,h(["reject",[N],eA])});else{!ra.has(F)&&t(F)&&($=a(F));const eA=!PE.has($)&&ra.get($);eA&&Q(N,eA)}return Reflect.set(S,N,$,K),h(["set",[N],F,P]),!0}});s.set(l,x);const U=[R,m,r,w];return ra.set(x,U),Reflect.ownKeys(l).forEach(S=>{const N=Object.getOwnPropertyDescriptor(l,S);"value"in N&&(x[S]=l[S],delete N.value,delete N.writable),Object.defineProperty(R,S,N)}),x})=>[a,ra,PE,e,A,t,n,i,r,s,o],[Cj]=uj();function vR(e={}){return Cj(e)}function hj(e,A,t){const n=ra.get(e);(CB?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let i;const r=[],s=n[3];let o=!1;const l=s(I=>{if(r.push(I),t){A(r.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,o&&A(r.splice(0))}))});return o=!0,()=>{o=!1,l()}}function y2(e,A){const t=ra.get(e);(CB?"production":void 0)!=="production"&&!t&&console.warn("Please use proxy object");const[n,i,r]=t;return r(n,i(),A)}var fj={ZSS_LANG_DEV:"false",ZSS_STATS_DEV:"false",ZSS_SHOW_CODE:"false",ZSS_BRANCH_NAME:"main",ZSS_BRANCH_VERSION:"0.12.0",ZSS_COMMIT_HASH:"24fca8b0b67c9423ddd4c32bc393a34bf7d81113",ZSS_COMMIT_MESSAGE:"ci: version bump to v0.12.0",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{use:w2}=tC,{useSyncExternalStore:Ej}=_q,dj=(e,A)=>{const t=V.useRef();V.useEffect(()=>{t.current=Ij(e,A,!0)}),V.useDebugValue(t.current)},Bj=new WeakMap;function _Q(e,A){const t=A==null?void 0:A.sync,n=V.useRef(),i=V.useRef();let r=!0;const s=Ej(V.useCallback(l=>{const I=hj(e,l,t);return l(),I},[e,t]),()=>{const l=y2(e,w2);try{if(!r&&n.current&&i.current&&!LG(n.current,l,i.current,new WeakMap))return n.current}catch{}return l},()=>y2(e,w2));r=!1;const o=new WeakMap;V.useEffect(()=>{n.current=s,i.current=o}),(fj?"production":void 0)!=="production"&&dj(s,o);const a=V.useMemo(()=>new WeakMap,[]);return kG(s,o,a,Bj)}let Jm=!1;const Gr=vR({state:{player:"",layers:[],layout:[],layoutreset:!1,layoutfocus:""}}),Hm=UQ("gadgetclient",["ready","second"],e=>{switch(e.target){case"ready":e.player&&Gr.state.player===""&&(Gr.state.player=e.player,Hm.emit("vm:login",void 0,Gr.state.player));break;case"second":Gr.state.player&&Hm.emit("vm:doot",void 0,Gr.state.player);break;case"reset":e.player===Gr.state.player&&(Jm=!1,Gr.state=e.data);break;case"patch":if(e.player===Gr.state.player&&!Jm)try{FQ(Gr.state,e.data,!0)}catch(A){A instanceof wR&&(Jm=!0,Hm.reply(e,"desync",void 0,Gr.state.player))}break}});function Qj(){return Gr.state}var pj=function(A,t,n,i){var r=n?n.call(i,A,t):void 0;if(r!==void 0)return!!r;if(A===t)return!0;if(typeof A!="object"||!A||typeof t!="object"||!t)return!1;var s=Object.keys(A),o=Object.keys(t);if(s.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),l=0;lA in e?bG(e,A,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[A]=t,kt=(e,A)=>{for(var t in A||(A={}))Nj.call(A,t)&&M2(e,t,A[t]);if(D2)for(var t of D2(A))xj.call(A,t)&&M2(e,t,A[t]);return e},Tj=(e,A)=>Sj(e,vj(A)),Ps=(e,A)=>{for(var t in A)bG(e,t,{get:A[t],enumerable:!0})},NR={};Ps(NR,{_1:()=>OG,_2:()=>PG,_3:()=>JG,_4:()=>HG,_5:()=>KG,_6:()=>VG,_7:()=>zG,_8:()=>WG,__1:()=>xR,__2:()=>YG,__3:()=>Uj,__4:()=>Fj,__5:()=>_j,__6:()=>kj,__7:()=>Lj,__8:()=>Gj,app:()=>ke});function R2(e,A,t){for(var n=new Array(t),i=0,r=A;i=0)return function(a,l){return function(I){return ke(a,l.concat([I]))}}(n,t);A=R2(t,r,-o|0),e=n.apply(null,R2(t,0,r))}}function OG(e,A){var t=e.length;if(t===1)return e(A);switch(t){case 1:return e(A);case 2:return function(n){return e(A,n)};case 3:return function(n,i){return e(A,n,i)};case 4:return function(n,i,r){return e(A,n,i,r)};case 5:return function(n,i,r,s){return e(A,n,i,r,s)};case 6:return function(n,i,r,s,o){return e(A,n,i,r,s,o)};case 7:return function(n,i,r,s,o,a){return e(A,n,i,r,s,o,a)};default:return ke(e,[A])}}function xR(e){var A=e.length;return A===1?e:function(t){return OG(e,t)}}function PG(e,A,t){var n=e.length;if(n===2)return e(A,t);switch(n){case 1:return ke(e(A),[t]);case 2:return e(A,t);case 3:return function(i){return e(A,t,i)};case 4:return function(i,r){return e(A,t,i,r)};case 5:return function(i,r,s){return e(A,t,i,r,s)};case 6:return function(i,r,s,o){return e(A,t,i,r,s,o)};case 7:return function(i,r,s,o,a){return e(A,t,i,r,s,o,a)};default:return ke(e,[A,t])}}function YG(e){var A=e.length;return A===2?e:function(t,n){return PG(e,t,n)}}function JG(e,A,t,n){var i=e.length;if(i===3)return e(A,t,n);switch(i){case 1:return ke(e(A),[t,n]);case 2:return ke(e(A,t),[n]);case 3:return e(A,t,n);case 4:return function(r){return e(A,t,n,r)};case 5:return function(r,s){return e(A,t,n,r,s)};case 6:return function(r,s,o){return e(A,t,n,r,s,o)};case 7:return function(r,s,o,a){return e(A,t,n,r,s,o,a)};default:return ke(e,[A,t,n])}}function Uj(e){var A=e.length;return A===3?e:function(t,n,i){return JG(e,t,n,i)}}function HG(e,A,t,n,i){var r=e.length;if(r===4)return e(A,t,n,i);switch(r){case 1:return ke(e(A),[t,n,i]);case 2:return ke(e(A,t),[n,i]);case 3:return ke(e(A,t,n),[i]);case 4:return e(A,t,n,i);case 5:return function(s){return e(A,t,n,i,s)};case 6:return function(s,o){return e(A,t,n,i,s,o)};case 7:return function(s,o,a){return e(A,t,n,i,s,o,a)};default:return ke(e,[A,t,n,i])}}function Fj(e){var A=e.length;return A===4?e:function(t,n,i,r){return HG(e,t,n,i,r)}}function KG(e,A,t,n,i,r){var s=e.length;if(s===5)return e(A,t,n,i,r);switch(s){case 1:return ke(e(A),[t,n,i,r]);case 2:return ke(e(A,t),[n,i,r]);case 3:return ke(e(A,t,n),[i,r]);case 4:return ke(e(A,t,n,i),[r]);case 5:return e(A,t,n,i,r);case 6:return function(o){return e(A,t,n,i,r,o)};case 7:return function(o,a){return e(A,t,n,i,r,o,a)};default:return ke(e,[A,t,n,i,r])}}function _j(e){var A=e.length;return A===5?e:function(t,n,i,r,s){return KG(e,t,n,i,r,s)}}function VG(e,A,t,n,i,r,s){var o=e.length;if(o===6)return e(A,t,n,i,r,s);switch(o){case 1:return ke(e(A),[t,n,i,r,s]);case 2:return ke(e(A,t),[n,i,r,s]);case 3:return ke(e(A,t,n),[i,r,s]);case 4:return ke(e(A,t,n,i),[r,s]);case 5:return ke(e(A,t,n,i,r),[s]);case 6:return e(A,t,n,i,r,s);case 7:return function(a){return e(A,t,n,i,r,s,a)};default:return ke(e,[A,t,n,i,r,s])}}function kj(e){var A=e.length;return A===6?e:function(t,n,i,r,s,o){return VG(e,t,n,i,r,s,o)}}function zG(e,A,t,n,i,r,s,o){var a=e.length;if(a===7)return e(A,t,n,i,r,s,o);switch(a){case 1:return ke(e(A),[t,n,i,r,s,o]);case 2:return ke(e(A,t),[n,i,r,s,o]);case 3:return ke(e(A,t,n),[i,r,s,o]);case 4:return ke(e(A,t,n,i),[r,s,o]);case 5:return ke(e(A,t,n,i,r),[s,o]);case 6:return ke(e(A,t,n,i,r,s),[o]);case 7:return e(A,t,n,i,r,s,o);default:return ke(e,[A,t,n,i,r,s,o])}}function Lj(e){var A=e.length;return A===7?e:function(t,n,i,r,s,o,a){return zG(e,t,n,i,r,s,o,a)}}function WG(e,A,t,n,i,r,s,o,a){var l=e.length;if(l===8)return e(A,t,n,i,r,s,o,a);switch(l){case 1:return ke(e(A),[t,n,i,r,s,o,a]);case 2:return ke(e(A,t),[n,i,r,s,o,a]);case 3:return ke(e(A,t,n),[i,r,s,o,a]);case 4:return ke(e(A,t,n,i),[r,s,o,a]);case 5:return ke(e(A,t,n,i,r),[s,o,a]);case 6:return ke(e(A,t,n,i,r,s),[o,a]);case 7:return ke(e(A,t,n,i,r,s,o),[a]);default:return ke(e,[A,t,n,i,r,s,o,a])}}function Gj(e){var A=e.length;return A===8?e:function(t,n,i,r,s,o,a,l){return WG(e,t,n,i,r,s,o,a,l)}}var ZG={};Ps(ZG,{$$Map:()=>r9,$$Set:()=>s9,RenderDelegate:()=>o9,mount:()=>rb,renderWithDelegate:()=>a9,stepGarbageCollector:()=>l9,visit:()=>sb});var qG={};Ps(qG,{create:()=>nb,isNode:()=>n9,shallowCopy:()=>ib,symbol:()=>TR});function S2(e){var A=typeof e;return A==="undefined"?3:e===null?2:A==="number"?{TAG:0,_0:e}:A==="bigint"?{TAG:5,_0:e}:A==="string"?{TAG:1,_0:e}:A==="boolean"?e===!0?1:0:A==="symbol"?{TAG:4,_0:e}:A==="function"?{TAG:2,_0:e}:{TAG:3,_0:e}}function bj(e,A){switch(A){case 0:return typeof e>"u";case 1:return e===null;case 2:return typeof e=="boolean";case 3:return typeof e=="number";case 4:return typeof e=="string";case 5:return typeof e=="function";case 6:return typeof e=="object";case 7:return typeof e=="symbol";case 8:return typeof e=="bigint"}}function Oj(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function Pj(e){if(!(e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0))return e;var A=e.BS_PRIVATE_NESTED_SOME_NONE;if(A!==0)return{BS_PRIVATE_NESTED_SOME_NONE:A-1|0}}function Yj(e,A){return{hd:A,tl:e}}function Jj(e,A){for(;;){var t=A,n=e;if(!n)return t;var i={hd:n.hd,tl:0};t.tl=i,A=i,e=n.tl}}function Hj(e,A,t){for(;;){var n=A,i=e;if(!i)return;var r={hd:t(i.hd),tl:0};n.tl=r,A=r,e=i.tl}}function Kj(e,A,t,n){for(;;){var i=n,r=t,s=A;if(!r)return;var o={hd:e(s,r.hd),tl:0};i.tl=o,n=o,t=r.tl,A=s+1|0}}function Vj(e,A){if(!e)return A;var t={hd:e.hd,tl:0};return Jj(e.tl,t).tl=A,t}function zj(e,A){if(!e)return 0;var t={hd:A(e.hd),tl:0};return Hj(e.tl,t,A),t}function jG(e,A){return zj(e,xR(A))}function Wj(e,A){if(!e)return 0;var t={hd:A(0,e.hd),tl:0};return Kj(A,1,e.tl,t),t}function Zj(e,A){return Wj(e,YG(A))}function XG(e){for(var A=e,t=0;;){var n=t,i=A;if(!i)return n;t=n+1|0,A=i.tl}}function qj(e,A,t){for(;;){var n=t,i=A;if(!n)return;e[i]=n.hd,t=n.tl,A=i+1|0}}function $G(e){for(var A=e.length-1|0,t=0;;){var n=t,i=A;if(i<0)return n;t={hd:e[i],tl:n},A=i-1|0}}function jj(e){var A=XG(e),t=new Array(A);return qj(t,0,e),t}function Xj(e,A){for(;;){var t=e;if(!t)return;A(t.hd),e=t.tl}}function Ab(e,A){Xj(e,xR(A))}function $j(e,A,t){for(;;){var n=A,i=e;if(!i)return n;A=t(n,i.hd),e=i.tl}}function eb(e,A,t,n){for(let i in n)if(n.hasOwnProperty(i)){const r=n[i];(!t.hasOwnProperty(i)||!mj(t[i],r))&&((typeof r>"u"||r===null||typeof r=="number"&&isNaN(r)||typeof r=="number"&&!isFinite(r))&&console.warn(`Warning: applying a potentially erroneous property value. ${i}: ${r}`),e.setProperty(A,i,r),t[i]=r)}}function A9(e,A){if(A in e)return Oj(e[A])}function e9(e){if(e!==void 0)return Pj(e);throw new Error("getExn")}function v2(e,A,t,n){eb(e,A,t,n)}function tb(e,A){return Math.imul(e^A,16777619)}function Km(e,A){for(var t=e,n=0,i=A.length;n<=i;++n)t=tb(t,A.charCodeAt(n)|0);return t}function t9(e,A,t){var n=Km(-2128831035,e),i=A9(A,"key"),r=i!==void 0&&bj(i,4)?Km(n,i):Km(n,e9(JSON.stringify(A)));return $j(t,r,tb)&2147483647}var TR="__ELEM_NODE__";function nb(e,A,t){var n=$G(t),i=jG(n,function(r){return r.hash});return{symbol:TR,hash:t9(e,A,i),kind:e,props:A,children:n}}function n9(e){var A=S2(e);if(typeof A=="number"||A.TAG!==3)return!1;var t=S2(e.symbol);return typeof t=="number"||t.TAG!==1?!1:t._0===TR}function ib(e){return{symbol:e.symbol,hash:e.hash,kind:e.kind,props:Object.assign({},e.props),generation:{contents:0}}}function i9(e){return Array.from(e.values())}var r9={valuesArray:i9},s9={},o9={};function rb(e,A){var t=e.getNodeMap();if(t.has(A.hash)){var n=t.get(A.hash);v2(e,n.hash,n.props,A.props),n.generation.contents=0;return}e.createNode(A.hash,A.kind),v2(e,A.hash,{},A.props),Ab(A.children,function(i){e.appendChild(A.hash,i.hash)}),t.set(A.hash,ib(A))}function sb(e,A,t){for(;;){var n=t,i=function(o){A.add(o.hash)};if(!n)return;var r=n.tl,s=n.hd;if(A.has(s.hash)){t=r;continue}i(s),rb(e,s),t=Vj(s.children,r)}}function a9(e,A){var t=new Set,n=Zj($G(A),function(i,r){return nb("root",{channel:i},[r])});sb(e,t,n),e.activateRoots(jj(jG(n,function(i){return i.hash}))),e.commitUpdates()}function l9(e){var A=e.getNodeMap(),t=e.getTerminalGeneration(),n=Array.from(A.values()).reduce(function(i,r){return r.generation.contents=r.generation.contents+1|0,r.generation.contents>=t?(e.deleteNode(r.hash),Yj(i,r)):i},0);if(XG(n)>0)return e.commitUpdates(),Ab(n,function(i){A.delete(i.hash)})}var g9=NR,ob=ZG,c9=function(e,A){return g9._2(ob.renderWithDelegate,e,A)};ob.stepGarbageCollector;var I9=NR,UR=qG,ab=function(e,A,t){return I9._3(UR.create,e,A,t)},u9=UR.isNode;UR.shallowCopy;function X(e){return typeof e=="number"?ab("const",{value:e},[]):(Dj(TA(e),`Whoops, expecting a Node type here! Got: ${typeof e}`),e)}function TA(e){return u9(e)}function cA(e,A,t){return ab(e,A,t.map(X))}var gg={};Ps(gg,{accum:()=>E9,biquad:()=>J9,capture:()=>q9,constant:()=>lb,convolve:()=>R9,counter:()=>f9,delay:()=>L9,env:()=>_9,fft:()=>Z9,latch:()=>Q9,maxhold:()=>p9,meter:()=>V9,metro:()=>w9,mm1p:()=>O9,once:()=>m9,phasor:()=>d9,pole:()=>F9,prewarp:()=>b9,rand:()=>y9,sample:()=>D9,sampleseq:()=>T9,sampleseq2:()=>U9,scope:()=>W9,sdelay:()=>G9,seq:()=>S9,seq2:()=>v9,snapshot:()=>z9,sparseq:()=>N9,sparseq2:()=>x9,sr:()=>C9,svf:()=>P9,svfshelf:()=>Y9,syncphasor:()=>B9,table:()=>M9,tapIn:()=>H9,tapOut:()=>K9,time:()=>h9,z:()=>k9});function lb(e){return cA("const",e,[])}function C9(){return cA("sr",{},[])}function h9(){return cA("time",{},[])}function f9(e,A){return typeof e=="number"||TA(e)?cA("counter",{},[X(e)]):cA("counter",e,[X(A)])}function E9(e,A,t){return typeof e=="number"||TA(e)?cA("accum",{},[X(e),X(A)]):cA("accum",e,[X(A),X(t)])}function d9(e,A){return typeof e=="number"||TA(e)?cA("phasor",{},[X(e)]):cA("phasor",e,[X(A)])}function B9(e,A,t){return typeof e=="number"||TA(e)?cA("sphasor",{},[X(e),X(A)]):cA("sphasor",e,[X(A),X(t)])}function Q9(e,A,t){return typeof e=="number"||TA(e)?cA("latch",{},[X(e),X(A)]):cA("latch",e,[X(A),X(t)])}function p9(e,A,t){return typeof e=="number"||TA(e)?cA("maxhold",{},[X(e),X(A)]):cA("maxhold",e,[X(A),X(t)])}function m9(e,A){return typeof e=="number"||TA(e)?cA("once",{},[X(e)]):cA("once",e,[X(A)])}function y9(e){return typeof e<"u"?cA("rand",e,[]):cA("rand",{},[])}function w9(e){return typeof e<"u"?cA("metro",e,[]):cA("metro",{},[])}function D9(e,A,t){return cA("sample",e,[X(A),X(t)])}function M9(e,A){return cA("table",e,[X(A)])}function R9(e,A){return cA("convolve",e,[X(A)])}function S9(e,A,t){return cA("seq",e,[X(A),X(t)])}function v9(e,A,t){return cA("seq2",e,[X(A),X(t)])}function N9(e,A,t){return cA("sparseq",e,[X(A),X(t)])}function x9(e,A){return cA("sparseq2",e,[X(A)])}function T9(e,A){return cA("sampleseq",e,[X(A)])}function U9(e,A){return cA("sampleseq2",e,[X(A)])}function F9(e,A,t){return typeof e=="number"||TA(e)?cA("pole",{},[X(e),X(A)]):cA("pole",e,[X(A),X(t)])}function _9(e,A,t,n){return typeof e=="number"||TA(e)?cA("env",{},[X(e),X(A),X(t)]):cA("env",e,[X(A),X(t),X(n)])}function k9(e,A){return typeof e=="number"||TA(e)?cA("z",{},[X(e)]):cA("z",e,[X(A)])}function L9(e,A,t,n){return typeof e=="number"||TA(e)?cA("delay",{},[X(e),X(A),X(t)]):cA("delay",e,[X(A),X(t),X(n)])}function G9(e,A){return cA("sdelay",e,[X(A)])}function b9(e){return cA("prewarp",{},[e])}function O9(e,A,t){return typeof e=="number"||TA(e)?cA("mm1p",{},[X(e),X(A)]):cA("mm1p",e,[X(A),X(t)])}function P9(e,A,t,n){return typeof e=="number"||TA(e)?cA("svf",{},[X(e),X(A),X(t)]):cA("svf",e,[X(A),X(t),X(n)])}function Y9(e,A,t,n,i){return typeof e=="number"||TA(e)?cA("svfshelf",{},[X(e),X(A),X(t),X(n)]):cA("svfshelf",e,[X(A),X(t),X(n),X(i)])}function J9(e,A,t,n,i,r,s){return typeof e=="number"||TA(e)?cA("biquad",{},[X(e),X(A),X(t),X(n),X(i),X(r)]):cA("biquad",e,[X(A),X(t),X(n),X(i),X(r),X(s)])}function H9(e){return cA("tapIn",e,[])}function K9(e,A){return cA("tapOut",e,[X(A)])}function V9(e,A){return typeof e=="number"||TA(e)?cA("meter",{},[X(e)]):cA("meter",e,[X(A)])}function z9(e,A,t){return typeof e=="number"||TA(e)?cA("snapshot",{},[X(e),X(A)]):cA("snapshot",e,[X(A),X(t)])}function W9(e,...A){return typeof e=="number"||TA(e)?cA("scope",{},[e,...A].map(X)):cA("scope",e,A.map(X))}function Z9(e,A){return typeof e=="number"||TA(e)?cA("fft",{},[X(e)]):cA("fft",e,[X(A)])}function q9(e,A,t){return typeof e=="number"||TA(e)?cA("capture",{},[X(e),X(A)]):cA("capture",e,[X(A),X(t)])}var gb={};Ps(gb,{compress:()=>xX,skcompress:()=>TX});var cg={};Ps(cg,{abs:()=>gX,add:()=>BX,and:()=>EX,asinh:()=>eX,ceil:()=>rX,cos:()=>X9,div:()=>mX,eq:()=>fX,exp:()=>lX,floor:()=>sX,ge:()=>uX,geq:()=>CX,identity:()=>cb,le:()=>cX,leq:()=>IX,ln:()=>tX,log:()=>nX,log2:()=>iX,max:()=>DX,min:()=>wX,mod:()=>yX,mul:()=>pX,or:()=>dX,pow:()=>hX,round:()=>oX,sin:()=>j9,sqrt:()=>aX,sub:()=>QX,tan:()=>$9,tanh:()=>AX});function cb(e,A){return typeof e=="number"||TA(e)?cA("in",{},[X(e)]):typeof A=="number"||TA(A)?cA("in",e,[X(A)]):cA("in",e,[])}function j9(e,A){return typeof e=="number"||TA(e)?cA("sin",{},[X(e)]):cA("sin",e,[X(A)])}function X9(e,A){return typeof e=="number"||TA(e)?cA("cos",{},[X(e)]):cA("cos",e,[X(A)])}function $9(e,A){return typeof e=="number"||TA(e)?cA("tan",{},[X(e)]):cA("tan",e,[X(A)])}function AX(e,A){return typeof e=="number"||TA(e)?cA("tanh",{},[X(e)]):cA("tanh",e,[X(A)])}function eX(e,A){return typeof e=="number"||TA(e)?cA("asinh",{},[X(e)]):cA("asinh",e,[X(A)])}function tX(e,A){return typeof e=="number"||TA(e)?cA("ln",{},[X(e)]):cA("ln",e,[X(A)])}function nX(e,A){return typeof e=="number"||TA(e)?cA("log",{},[X(e)]):cA("log",e,[X(A)])}function iX(e,A){return typeof e=="number"||TA(e)?cA("log2",{},[X(e)]):cA("log2",e,[X(A)])}function rX(e,A){return typeof e=="number"||TA(e)?cA("ceil",{},[X(e)]):cA("ceil",e,[X(A)])}function sX(e,A){return typeof e=="number"||TA(e)?cA("floor",{},[X(e)]):cA("floor",e,[X(A)])}function oX(e,A){return typeof e=="number"||TA(e)?cA("round",{},[X(e)]):cA("round",e,[X(A)])}function aX(e,A){return typeof e=="number"||TA(e)?cA("sqrt",{},[X(e)]):cA("sqrt",e,[X(A)])}function lX(e,A){return typeof e=="number"||TA(e)?cA("exp",{},[X(e)]):cA("exp",e,[X(A)])}function gX(e,A){return typeof e=="number"||TA(e)?cA("abs",{},[X(e)]):cA("abs",e,[X(A)])}function cX(e,A,t){return typeof e=="number"||TA(e)?cA("le",{},[X(e),X(A)]):cA("le",e,[X(A),X(t)])}function IX(e,A,t){return typeof e=="number"||TA(e)?cA("leq",{},[X(e),X(A)]):cA("leq",e,[X(A),X(t)])}function uX(e,A,t){return typeof e=="number"||TA(e)?cA("ge",{},[X(e),X(A)]):cA("ge",e,[X(A),X(t)])}function CX(e,A,t){return typeof e=="number"||TA(e)?cA("geq",{},[X(e),X(A)]):cA("geq",e,[X(A),X(t)])}function hX(e,A,t){return typeof e=="number"||TA(e)?cA("pow",{},[X(e),X(A)]):cA("pow",e,[X(A),X(t)])}function fX(e,A,t){return typeof e=="number"||TA(e)?cA("eq",{},[X(e),X(A)]):cA("eq",e,[X(A),X(t)])}function EX(e,A,t){return typeof e=="number"||TA(e)?cA("and",{},[X(e),X(A)]):cA("and",e,[X(A),X(t)])}function dX(e,A,t){return typeof e=="number"||TA(e)?cA("or",{},[X(e),X(A)]):cA("or",e,[X(A),X(t)])}function BX(e,...A){return typeof e=="number"||TA(e)?cA("add",{},[e,...A].map(X)):cA("add",e,A.map(X))}function QX(e,...A){return typeof e=="number"||TA(e)?cA("sub",{},[e,...A].map(X)):cA("sub",e,A.map(X))}function pX(e,...A){return typeof e=="number"||TA(e)?cA("mul",{},[e,...A].map(X)):cA("mul",e,A.map(X))}function mX(e,...A){return typeof e=="number"||TA(e)?cA("div",{},[e,...A].map(X)):cA("div",e,A.map(X))}function yX(e,...A){return typeof e=="number"||TA(e)?cA("mod",{},[e,...A].map(X)):cA("mod",e,A.map(X))}function wX(e,...A){return typeof e=="number"||TA(e)?cA("min",{},[e,...A].map(X)):cA("min",e,A.map(X))}function DX(e,...A){return typeof e=="number"||TA(e)?cA("max",{},[e,...A].map(X)):cA("max",e,A.map(X))}var Eh={};Ps(Eh,{db2gain:()=>SX,gain2db:()=>vX,hann:()=>NX,ms2samps:()=>MX,select:()=>Ib,tau2pole:()=>RX});var Ht=kt(kt({},gg),cg);function MX(e){return Ht.mul(Ht.sr(),Ht.div(e,1e3))}function RX(e){return Ht.exp(Ht.div(-1,Ht.mul(e,Ht.sr())))}function SX(e){return Ht.pow(10,Ht.mul(e,1/20))}function vX(e){return Ib(Ht.ge(e,0),Ht.max(-120,Ht.mul(20,Ht.log(e))),-120)}function Ib(e,A,t){return Ht.add(Ht.mul(e,A),Ht.mul(Ht.sub(1,e),t))}function NX(e){return Ht.mul(.5,Ht.sub(1,Ht.cos(Ht.mul(2*Math.PI,e))))}var ve=kt(kt(kt({},gg),cg),Eh);function xX(e,A,t,n,i,r){const s=ve.env(ve.tau2pole(ve.mul(.001,e)),ve.tau2pole(ve.mul(.001,A)),i),o=ve.gain2db(s),a=ve.sub(1,ve.div(1,n)),l=ve.mul(a,ve.sub(t,o)),I=ve.min(0,l),u=ve.db2gain(I);return ve.mul(r,u)}function TX(e,A,t,n,i,r,s){const o=ve.env(ve.tau2pole(ve.mul(.001,e)),ve.tau2pole(ve.mul(.001,A)),r),a=ve.gain2db(o),l=ve.sub(t,ve.div(i,2)),I=ve.add(t,ve.div(i,2)),u=ve.and(ve.geq(a,l),ve.leq(a,I)),C=ve.sub(1,ve.div(1,n)),h=ve.select(u,ve.mul(ve.div(C,2),ve.mul(ve.div(ve.sub(a,l),i),ve.sub(l,a))),ve.mul(C,ve.sub(t,a))),d=ve.min(0,h),m=ve.db2gain(d);return ve.mul(s,m)}var ub={};Ps(ub,{adsr:()=>KX});var kQ={};Ps(kQ,{allpass:()=>OX,bandpass:()=>GX,dcblock:()=>FX,df11:()=>_X,highpass:()=>LX,highshelf:()=>JX,lowpass:()=>kX,lowshelf:()=>YX,notch:()=>bX,peak:()=>PX,pink:()=>HX,sm:()=>UX,smooth:()=>gD,zero:()=>FR});var ye=kt(kt(kt({},gg),cg),Eh);function gD(e,A,t){return typeof e=="number"||TA(e)?ye.pole(e,ye.mul(ye.sub(1,e),A)):ye.pole(e,A,ye.mul(ye.sub(1,A),t))}function UX(e,A){return typeof e=="number"||TA(e)?gD(ye.tau2pole(.02),e):gD(e,ye.tau2pole(.02),A)}function FR(e,A,t,n){let[i,r,s]=typeof e=="number"||TA(e)?[e,A,t]:[A,t,n];return ye.sub(ye.mul(i,s),ye.mul(r,ye.z(s)))}function FX(e,A){let t=typeof e=="number"||TA(e)?e:A;return ye.pole(.995,FR(1,1,t))}function _X(e,A,t,n,i){let[r,s,o,a]=typeof e=="number"||TA(e)?[e,A,t,n]:[A,t,n,i];return ye.pole(o,FR(r,s,a))}function kX(e,A,t,n){return typeof e=="number"||TA(e)?ye.svf({mode:"lowpass"},e,A,t):ye.svf(Object.assign({},e,{mode:"lowpass"}),A,t,n)}function LX(e,A,t,n){return typeof e=="number"||TA(e)?ye.svf({mode:"highpass"},e,A,t):ye.svf(Object.assign({},e,{mode:"highpass"}),A,t,n)}function GX(e,A,t,n){return typeof e=="number"||TA(e)?ye.svf({mode:"bandpass"},e,A,t):ye.svf(Object.assign({},e,{mode:"bandpass"}),A,t,n)}function bX(e,A,t,n){return typeof e=="number"||TA(e)?ye.svf({mode:"notch"},e,A,t):ye.svf(Object.assign({},e,{mode:"notch"}),A,t,n)}function OX(e,A,t,n){return typeof e=="number"||TA(e)?ye.svf({mode:"allpass"},e,A,t):ye.svf(Object.assign({},e,{mode:"allpass"}),A,t,n)}function PX(e,A,t,n,i){return typeof e=="number"||TA(e)?ye.svfshelf({mode:"peak"},e,A,t,n):ye.svfshelf(Object.assign({},e,{mode:"peak"}),A,t,n,i)}function YX(e,A,t,n,i){return typeof e=="number"||TA(e)?ye.svfshelf({mode:"lowshelf"},e,A,t,n):ye.svfshelf(Object.assign({},e,{mode:"lowshelf"}),A,t,n,i)}function JX(e,A,t,n,i){return typeof e=="number"||TA(e)?ye.svfshelf({mode:"highshelf"},e,A,t,n):ye.svfshelf(Object.assign({},e,{mode:"highshelf"}),A,t,n,i)}function HX(e,A){let t=typeof e=="number"||TA(e)?e:A;return((i,r,s)=>ye.min(r,ye.max(i,s)))(-1,1,ye.mul(ye.db2gain(-30),ye.add(ye.pole(.99765,ye.mul(t,.099046)),ye.pole(.963,ye.mul(t,.2965164)),ye.pole(.57,ye.mul(t,1.0526913)),ye.mul(.1848,t))))}var Lr=kt(kt(kt(kt({},gg),cg),kQ),Eh);function KX(e,A,t,n,i,r){let s=typeof e=="number"||TA(e)?[e,A,t,n,i]:[A,t,n,i,r],[o,a,l,I,u]=s,C=Lr.mul(o,Lr.sr()),h=Lr.le(Lr.counter(u),C),d=Lr.select(u,Lr.select(h,1,l),0),m=Lr.select(u,Lr.select(h,o,a),I),p=Lr.tau2pole(Lr.div(m,6.91));return Lr.smooth(p,d)}var Cb={};Ps(Cb,{blepsaw:()=>ZX,blepsquare:()=>qX,bleptriangle:()=>jX,cycle:()=>VX,noise:()=>uD,pinknoise:()=>XX,saw:()=>ID,square:()=>zX,train:()=>cD,triangle:()=>WX});var Ye=kt(kt(kt({},gg),cg),kQ);function cD(e,A){return typeof e=="number"||TA(e)?Ye.le(Ye.phasor(e,0),.5):Ye.le(Ye.phasor(e,A,0),.5)}function VX(e,A){return typeof e=="number"||TA(e)?Ye.sin(Ye.mul(2*Math.PI,Ye.phasor(e,0))):Ye.sin(Ye.mul(2*Math.PI,Ye.phasor(e,A,0)))}function ID(e,A){return typeof e=="number"||TA(e)?Ye.sub(Ye.mul(2,Ye.phasor(e,0)),1):Ye.sub(Ye.mul(2,Ye.phasor(e,A,0)),1)}function zX(e,A){return typeof e=="number"||TA(e)?Ye.sub(Ye.mul(2,cD(e)),1):Ye.sub(Ye.mul(2,cD(e,A)),1)}function WX(e,A){return typeof e=="number"||TA(e)?Ye.mul(2,Ye.sub(.5,Ye.abs(ID(e)))):Ye.mul(2,Ye.sub(.5,Ye.abs(ID(e,A))))}function ZX(e,A){let n=!(typeof e=="number"||TA(e))?A:e;return cA("blepsaw",{},[n])}function qX(e,A){let n=!(typeof e=="number"||TA(e))?A:e;return cA("blepsquare",{},[n])}function jX(e,A){let n=!(typeof e=="number"||TA(e))?A:e;return cA("bleptriangle",{},[n])}function uD(e){return typeof e>"u"?Ye.sub(Ye.mul(2,Ye.rand()),1):Ye.sub(Ye.mul(2,Ye.rand(e)),1)}function XX(e){return typeof e>"u"?Ye.pink(uD()):Ye.pink(uD(e))}var $X=class extends Rj{constructor(){super()}},Vm=Tj(kt(kt(kt(kt(kt(kt(kt({},gg),gb),ub),kQ),cg),Cb),Eh),{const:lb,in:cb}),nc={CREATE_NODE:0,DELETE_NODE:1,APPEND_CHILD:2,SET_PROPERTY:3,ACTIVATE_ROOTS:4,COMMIT_UPDATES:5},A6=class{constructor(){this.nodeMap=new Map,this.currentActiveRoots=new Set,this.clear()}clear(){this.nodesAdded=0,this.nodesRemoved=0,this.edgesAdded=0,this.propsWritten=0,this.batch={createNode:[],deleteNode:[],appendChild:[],setProperty:[],activateRoots:[],commitUpdates:[]}}getNodeMap(){return this.nodeMap}getTerminalGeneration(){return 4}createNode(e,A){this.nodesAdded++,this.batch.createNode.push([nc.CREATE_NODE,e,A])}deleteNode(e){this.nodesRemoved++,this.batch.deleteNode.push([nc.DELETE_NODE,e])}appendChild(e,A){this.edgesAdded++,this.batch.appendChild.push([nc.APPEND_CHILD,e,A])}setProperty(e,A,t){this.propsWritten++,this.batch.setProperty.push([nc.SET_PROPERTY,e,A,t])}activateRoots(e){e.length===this.currentActiveRoots.size&&e.every(t=>this.currentActiveRoots.has(t))||(this.batch.activateRoots.push([nc.ACTIVATE_ROOTS,e]),this.currentActiveRoots=new Set(e))}commitUpdates(){this.batch.commitUpdates.push([nc.COMMIT_UPDATES])}getPackedInstructions(){return[...this.batch.createNode,...this.batch.deleteNode,...this.batch.appendChild,...this.batch.setProperty,...this.batch.activateRoots,...this.batch.commitUpdates]}};function N2(){return typeof performance>"u"?Date.now():performance.now()}var e6=class{constructor(e){this._delegate=new A6,this._sendMessage=e,this._nextRefId=0}createRef(e,A,t){let n=`__refKey:${this._nextRefId++}`,i=cA(e,Object.assign({key:n},A),t);return[i,s=>{if(!this._delegate.nodeMap.has(i.hash))throw new Error("Cannot update a ref that has not been mounted; make sure you render your node first");const o=this._delegate.nodeMap.get(i.hash);this._delegate.clear(),eb(this._delegate,i.hash,o.props,s),this._delegate.commitUpdates();const a=this._delegate.getPackedInstructions();return Promise.resolve(this._sendMessage(a))}]}render(...e){const A=N2();this._delegate.clear(),c9(this._delegate,e.map(X));const t=N2(),n=this._delegate.getPackedInstructions();return Promise.resolve(this._sendMessage(n)).then(i=>({result:i,nodesAdded:this._delegate.nodesAdded,edgesAdded:this._delegate.edgesAdded,propsWritten:this._delegate.propsWritten,elapsedTimeMs:t-A}))}};function t6(e,A){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&A.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);iA())))}(A,I,g)}var r,X=A=>{throw new q(A.O.S.P.name+" instance already deleted")},m=!1,x=()=>{},e=(A,I,g)=>I===g?A:void 0===g.U||null===(A=e(A,I,g.U))?null:g.pa(A),z={},P=[],p=()=>{for(;P.length;){var A=P.pop();A.O.aa=!1,A.delete()}},u={},v=(A,I)=>{if(!I.S||!I.R)throw new W("makeClassHandle requires ptr and ptrType");if(!!I.V!=!!I.T)throw new W("Both smartPtrType and smartPtr must be specified");return I.count={value:1},$(Object.create(A,{O:{value:I,writable:!0}}))},$=A=>"undefined"==typeof FinalizationRegistry?($=A=>A,A):(m=new FinalizationRegistry((A=>{--(A=A.O).count.value,0===A.count.value&&(A.T?A.V.Z(A.T):A.S.P.Z(A.R))})),x=A=>{m.unregister(A)},($=A=>{var I=A.O;return I.T&&m.register(A,{O:I},A),A})(A));function _(){}var AA=(A,I)=>Object.defineProperty(I,"name",{value:A}),IA=(A,I,g)=>{if(void 0===A[I].Y){var C=A[I];A[I]=function(){if(!A[I].Y.hasOwnProperty(arguments.length))throw new q(`Function \'${g}\' called with an invalid number of arguments (${arguments.length}) - expects one of (${A[I].Y})!`);return A[I].Y[arguments.length].apply(this,arguments)},A[I].Y=[],A[I].Y[C.ea]=C}};function gA(A,I,g,C,Q,B,E,D){this.name=A,this.constructor=I,this.ba=g,this.Z=C,this.U=Q,this.qa=B,this.da=E,this.pa=D,this.va=[]}var CA=(A,I,g)=>{for(;I!==g;){if(!I.da)throw new q(`Expected null or instance of ${g.name}, got an instance of ${I.name}`);A=I.da(A),I=I.U}return A};function QA(A,I){if(null===I){if(this.ha)throw new q(`null is not a valid ${this.name}`);return 0}if(!I.O)throw new q(`Cannot pass "${TA(I)}" as a ${this.name}`);if(!I.O.R)throw new q(`Cannot pass deleted object as a pointer of type ${this.name}`);return CA(I.O.R,I.O.S.P,this.P)}function BA(A,I){if(null===I){if(this.ha)throw new q(`null is not a valid ${this.name}`);if(this.ga){var g=this.wa();return null!==A&&A.push(this.Z,g),g}return 0}if(!I||!I.O)throw new q(`Cannot pass "${TA(I)}" as a ${this.name}`);if(!I.O.R)throw new q(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.fa&&I.O.S.fa)throw new q(`Cannot convert argument of type ${I.O.V?I.O.V.name:I.O.S.name} to parameter type ${this.name}`);if(g=CA(I.O.R,I.O.S.P,this.P),this.ga){if(void 0===I.O.T)throw new q("Passing raw pointer to smart pointer is illegal");switch(this.ya){case 0:if(I.O.V!==this)throw new q(`Cannot convert argument of type ${I.O.V?I.O.V.name:I.O.S.name} to parameter type ${this.name}`);g=I.O.T;break;case 1:g=I.O.T;break;case 2:if(I.O.V===this)g=I.O.T;else{var C=I.clone();g=this.xa(g,LA((()=>C.delete()))),null!==A&&A.push(this.Z,g)}break;default:throw new q("Unsupporting sharing policy")}}return g}function EA(A,I){if(null===I){if(this.ha)throw new q(`null is not a valid ${this.name}`);return 0}if(!I.O)throw new q(`Cannot pass "${TA(I)}" as a ${this.name}`);if(!I.O.R)throw new q(`Cannot pass deleted object as a pointer of type ${this.name}`);if(I.O.S.fa)throw new q(`Cannot convert argument of type ${I.O.S.name} to parameter type ${this.name}`);return CA(I.O.R,I.O.S.P,this.P)}function DA(A){return this.fromWireType(F[A>>2])}function iA(A,I,g,C,Q,B,E,D,i,w,R){this.name=A,this.P=I,this.ha=g,this.fa=C,this.ga=Q,this.ua=B,this.ya=E,this.ma=D,this.wa=i,this.xa=w,this.Z=R,Q||void 0!==I.U?this.toWireType=BA:(this.toWireType=C?QA:EA,this.W=null)}var wA,RA,oA=[],NA=A=>{var I=oA[A];return I||(A>=oA.length&&(oA.length=A+1),oA[A]=I=wA.get(A)),I},GA=(A,I)=>{var g=(A=d(A)).includes("j")?((A,I)=>{var g=[];return function(){if(g.length=0,Object.assign(g,arguments),A.includes("j")){var Q=C["dynCall_"+A];Q=g&&g.length?Q.apply(null,[I].concat(g)):Q.call(null,I)}else Q=NA(I).apply(null,g);return Q}})(A,I):NA(I);if("function"!=typeof g)throw new q(`unknown function pointer with signature ${A}: ${I}`);return g},FA=A=>{A=AI(A);var I=d(A);return II(A),I},UA=(A,I)=>{var g=[],C={};throw I.forEach((function A(I){C[I]||b[I]||(t[I]?t[I].forEach(A):(g.push(I),C[I]=!0))})),new RA(`${A}: `+g.map(FA).join([", "]))},MA=(A,I)=>{for(var g=[],C=0;C>2]);return g},JA=A=>{for(;A.length;){var I=A.pop();A.pop()(I)}};function yA(A){for(var I=1;IE)throw new q("argTypes array size mismatch! Must at least get return value and \'this\' types!");var D=null!==I[1]&&null!==g,i=yA(I);for(g="void"!==I[0].name,C=[O,C,Q,JA,I[0],I[1]],Q=0;Q{A>=SA.ja&&0==--SA.get(A).na&&(SA.X[A]=void 0,SA.ia.push(A))},cA=A=>{if(!A)throw new q("Cannot use deleted val. handle = "+A);return SA.get(A).value},LA=A=>{switch(A){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:A={na:1,value:A};var I=SA.ia.pop()||SA.X.length;return SA.X[I]=A,I}};function lA(A){return this.fromWireType(G[A>>2])}for(var HA={name:"emscripten::val",fromWireType:A=>{var I=cA(A);return KA(A),I},toWireType:(A,I)=>LA(I),argPackAdvance:8,readValueFromPointer:lA,W:null},TA=A=>{if(null===A)return"null";var I=typeof A;return"object"===I||"array"===I||"function"===I?A.toString():""+A},ZA=(A,I)=>{switch(I){case 4:return function(A){return this.fromWireType(U[A>>2])};case 8:return function(A){return this.fromWireType(M[A>>3])};default:throw new TypeError(`invalid float width (${I}): ${A}`)}},VA=(A,I,g)=>{switch(I){case 1:return g?A=>w[A>>0]:A=>R[A>>0];case 2:return g?A=>o[A>>1]:A=>N[A>>1];case 4:return g?A=>G[A>>2]:A=>F[A>>2];default:throw new TypeError(`invalid integer width (${I}): ${A}`)}},qA="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,WA="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,dA=(A,I)=>{for(var g=A>>1,C=g+I/2;!(g>=C)&&N[g];)++g;if(32<(g<<=1)-A&&WA)return WA.decode(R.subarray(A,g));for(g="",C=0;!(C>=I/2);++C){var Q=o[A+2*C>>1];if(0==Q)break;g+=String.fromCharCode(Q)}return g},jA=(A,I,g)=>{if(g??=2147483647,2>g)return 0;var C=I;g=(g-=2)<2*A.length?g/2:A.length;for(var Q=0;Q>1]=A.charCodeAt(Q),I+=2;return o[I>>1]=0,I-C},bA=A=>2*A.length,tA=(A,I)=>{for(var g=0,C="";!(g>=I/4);){var Q=G[A+4*g>>2];if(0==Q)break;++g,65536<=Q?(Q-=65536,C+=String.fromCharCode(55296|Q>>10,56320|1023&Q)):C+=String.fromCharCode(Q)}return C},OA=(A,I,g)=>{if(g??=2147483647,4>g)return 0;var C=I;g=C+g-4;for(var Q=0;Q=B)B=65536+((1023&B)<<10)|1023&A.charCodeAt(++Q);if(G[I>>2]=B,(I+=4)+4>g)break}return G[I>>2]=0,I-C},nA=A=>{for(var I=0,g=0;g=C&&++g,I+=4}return I},fA=(A,I)=>{var g=b[A];if(void 0===g)throw A=I+" has unknown type "+FA(A),new q(A);return g},rA=(A,I,g)=>{var C=[];return A=A.toWireType(C,g),C.length&&(F[I>>2]=LA(C)),A},XA=[],mA={},xA=A=>{var I=mA[A];return void 0===I?d(A):I},eA=()=>"object"==typeof globalThis?globalThis:Function("return this")(),zA=A=>(zA=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return A=>crypto.getRandomValues(A);c("initRandomDevice")})())(A),PA=Array(256),pA=0;256>pA;++pA)PA[pA]=String.fromCharCode(pA);V=PA,q=C.BindingError=class extends Error{constructor(A){super(A),this.name="BindingError"}},W=C.InternalError=class extends Error{constructor(A){super(A),this.name="InternalError"}},Object.assign(_.prototype,{isAliasOf:function(A){if(!(this instanceof _&&A instanceof _))return!1;var I=this.O.S.P,g=this.O.R;A.O=A.O;var C=A.O.S.P;for(A=A.O.R;I.U;)g=I.da(g),I=I.U;for(;C.U;)A=C.da(A),C=C.U;return I===C&&g===A},clone:function(){if(this.O.R||X(this),this.O.ca)return this.O.count.value+=1,this;var A=$,I=Object,g=I.create,C=Object.getPrototypeOf(this),Q=this.O;return(A=A(g.call(I,C,{O:{value:{count:Q.count,aa:Q.aa,ca:Q.ca,R:Q.R,S:Q.S,T:Q.T,V:Q.V}}}))).O.count.value+=1,A.O.aa=!1,A},delete(){if(this.O.R||X(this),this.O.aa&&!this.O.ca)throw new q("Object already scheduled for deletion");x(this);var A=this.O;--A.count.value,0===A.count.value&&(A.T?A.V.Z(A.T):A.S.P.Z(A.R)),this.O.ca||(this.O.T=void 0,this.O.R=void 0)},isDeleted:function(){return!this.O.R},deleteLater:function(){if(this.O.R||X(this),this.O.aa&&!this.O.ca)throw new q("Object already scheduled for deletion");return P.push(this),1===P.length&&r&&r(p),this.O.aa=!0,this}}),C.getInheritedInstanceCount=()=>Object.keys(u).length,C.getLiveInheritedInstances=()=>{var A,I=[];for(A in u)u.hasOwnProperty(A)&&I.push(u[A]);return I},C.flushPendingDeletes=p,C.setDelayFunction=A=>{r=A,P.length&&r&&r(p)},Object.assign(iA.prototype,{ra(A){return this.ma&&(A=this.ma(A)),A},la(A){this.Z?.(A)},argPackAdvance:8,readValueFromPointer:DA,fromWireType:function(A){function I(){return this.ga?v(this.P.ba,{S:this.ua,R:g,V:this,T:A}):v(this.P.ba,{S:this,R:A})}var g=this.ra(A);if(!g)return this.la(A),null;var C=((A,I)=>{if(void 0===I)throw new q("ptr should not be undefined");for(;A.U;)I=A.da(I),A=A.U;return u[I]})(this.P,g);if(void 0!==C)return 0===C.O.count.value?(C.O.R=g,C.O.T=A,C.clone()):(C=C.clone(),this.la(A),C);if(C=this.P.qa(g),!(C=z[C]))return I.call(this);C=this.fa?C.oa:C.pointerType;var Q=e(g,this.P,C.P);return null===Q?I.call(this):this.ga?v(C.P.ba,{S:C,R:Q,V:this,T:A}):v(C.P.ba,{S:C,R:Q})}}),RA=C.UnboundTypeError=(hA=Error,(aA=AA(kA="UnboundTypeError",(function(A){this.name=kA,this.message=A,void 0!==(A=Error(A).stack)&&(this.stack=this.toString()+"\\n"+A.replace(/^Error(:[^\\n]*)?\\n/,""))}))).prototype=Object.create(hA.prototype),aA.prototype.constructor=aA,aA.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},aA),SA.X.push({value:void 0},{value:null},{value:!0},{value:!1}),Object.assign(SA,{ja:SA.X.length}),C.count_emval_handles=()=>{for(var A=0,I=SA.ja;I{var C=new Z(A);throw F[C.R+16>>2]=0,F[C.R+4>>2]=I,F[C.R+8>>2]=g,A},x:()=>{},C:(A,I,g,C)=>{f(A,{name:I=d(I),fromWireType:function(A){return!!A},toWireType:function(A,I){return I?g:C},argPackAdvance:8,readValueFromPointer:function(A){return this.fromWireType(R[A])},W:null})},H:(A,I,g,Q,B,E,D,i,w,R,o,N,G)=>{o=d(o),E=GA(B,E),i&&=GA(D,i),R&&=GA(w,R),G=GA(N,G);var F=(A=>{if(void 0===A)return"_unknown";var I=(A=A.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return 48<=I&&57>=I?`_${A}`:A})(o);((A,I)=>{if(C.hasOwnProperty(A))throw new q(`Cannot register public name \'${A}\' twice`);C[A]=I})(F,(function(){UA(`Cannot construct ${o} due to unbound types`,[Q])})),n([A,I,g],Q?[Q]:[],(function(I){if(I=I[0],Q)var g=I.P,B=g.ba;else B=_.prototype;I=AA(o,(function(){if(Object.getPrototypeOf(this)!==D)throw new q("Use \'new\' to construct "+o);if(void 0===N.$)throw new q(o+" has no accessible constructor");var A=N.$[arguments.length];if(void 0===A)throw new q(`Tried to invoke ctor of ${o} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(N.$).toString()}) parameters instead!`);return A.apply(this,arguments)}));var D=Object.create(B,{constructor:{value:I}});I.prototype=D;var w,N=new gA(o,I,D,G,g,E,i,R);N.U&&((w=N.U).ka??(w.ka=[]),N.U.ka.push(N));return g=new iA(o,N,!0,!1,!1),w=new iA(o+"*",N,!1,!1,!1),B=new iA(o+" const*",N,!1,!0,!1),z[A]={pointerType:w,oa:B},((A,I)=>{if(!C.hasOwnProperty(A))throw new W("Replacing nonexistant public symbol");C[A]=I,C[A].ea=void 0})(F,I),[g,w,B]}))},G:(A,I,g,C,Q,B)=>{var E=MA(I,g);Q=GA(C,Q),n([],[A],(function(A){var g=`constructor ${(A=A[0]).name}`;if(void 0===A.P.$&&(A.P.$=[]),void 0!==A.P.$[I-1])throw new q(`Cannot register multiple constructors with identical number of parameters (${I-1}) for class \'${A.name}\'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return A.P.$[I-1]=()=>{UA(`Cannot construct ${A.name} due to unbound types`,E)},n([],E,(C=>(C.splice(1,0,null),A.P.$[I-1]=sA(g,C,null,Q,B),[]))),[]}))},e:(A,I,g,C,Q,B,E,D,i)=>{var w=MA(g,C);I=(A=>{const I=(A=A.trim()).indexOf("(");return-1!==I?A.substr(0,I):A})(I=d(I)),B=GA(Q,B),n([],[A],(function(A){function C(){UA(`Cannot call ${Q} due to unbound types`,w)}var Q=`${(A=A[0]).name}.${I}`;I.startsWith("@@")&&(I=Symbol[I.substring(2)]),D&&A.P.va.push(I);var R=A.P.ba,o=R[I];return void 0===o||void 0===o.Y&&o.className!==A.name&&o.ea===g-2?(C.ea=g-2,C.className=A.name,R[I]=C):(IA(R,I,Q),R[I].Y[g-2]=C),n([],w,(function(C){return C=sA(Q,C,A,B,E,i),void 0===R[I].Y?(C.ea=g-2,R[I]=C):R[I].Y[g-2]=C,[]})),[]}))},B:A=>f(A,HA),u:(A,I,g)=>{f(A,{name:I=d(I),fromWireType:A=>A,toWireType:(A,I)=>I,argPackAdvance:8,readValueFromPointer:ZA(I,g),W:null})},g:(A,I,g,C,Q)=>{if(I=d(I),-1===Q&&(Q=4294967295),Q=A=>A,0===C){var B=32-8*g;Q=A=>A<>>B}var E=I.includes("unsigned")?function(A,I){return I>>>0}:function(A,I){return I};f(A,{name:I,fromWireType:Q,toWireType:E,argPackAdvance:8,readValueFromPointer:VA(I,g,0!==C),W:null})},b:(A,I,g)=>{function C(A){return new Q(w.buffer,F[A+4>>2],F[A>>2])}var Q=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][I];f(A,{name:g=d(g),fromWireType:C,argPackAdvance:8,readValueFromPointer:C},{sa:!0})},t:(A,I)=>{var g="std::string"===(I=d(I));f(A,{name:I,fromWireType:function(A){var I=F[A>>2],C=A+4;if(g)for(var Q=C,B=0;B<=I;++B){var E=C+B;if(B==I||0==R[E]){if(Q){var D=Q,i=R,w=D+(E-Q);for(Q=D;i[Q]&&!(Q>=w);)++Q;if(16(o=224==(240&o)?(15&o)<<12|N<<6|G:(7&o)<<18|N<<12|G<<6|63&i[D++])?w+=String.fromCharCode(o):(o-=65536,w+=String.fromCharCode(55296|o>>10,56320|1023&o))}}else w+=String.fromCharCode(o)}D=w}}else D="";if(void 0===U)var U=D;else U+=String.fromCharCode(0),U+=D;Q=E+1}}else{for(U=Array(I),B=0;B=E?Q++:2047>=E?Q+=2:55296<=E&&57343>=E?(Q+=4,++C):Q+=3}else Q=I.length;if(E=(Q=_A(4+(C=Q)+1))+4,F[Q>>2]=C,g&&B){if(B=E,E=C+1,C=R,0=i)i=65536+((1023&i)<<10)|1023&I.charCodeAt(++D);if(127>=i){if(B>=E)break;C[B++]=i}else{if(2047>=i){if(B+1>=E)break;C[B++]=192|i>>6}else{if(65535>=i){if(B+2>=E)break;C[B++]=224|i>>12}else{if(B+3>=E)break;C[B++]=240|i>>18,C[B++]=128|i>>12&63}C[B++]=128|i>>6&63}C[B++]=128|63&i}}C[B]=0}}else if(B)for(B=0;B{if(g=d(g),2===I)var C=dA,Q=jA,B=bA,E=()=>N,D=1;else 4===I&&(C=tA,Q=OA,B=nA,E=()=>F,D=2);f(A,{name:g,fromWireType:A=>{for(var g,Q=F[A>>2],B=E(),i=A+4,w=0;w<=Q;++w){var R=A+4+w*I;w!=Q&&0!=B[R>>D]||(i=C(i,R-i),void 0===g?g=i:(g+=String.fromCharCode(0),g+=i),i=R+I)}return II(A),g},toWireType:(A,C)=>{if("string"!=typeof C)throw new q(`Cannot pass non-string to C++ string type ${g}`);var E=B(C),i=_A(4+E+I);return F[i>>2]=E>>D,Q(C,i+4,E+I),null!==A&&A.push(II,i),i},argPackAdvance:8,readValueFromPointer:lA,W(A){II(A)}})},D:(A,I)=>{f(A,{ta:!0,name:I=d(I),argPackAdvance:0,fromWireType:()=>{},toWireType:()=>{}})},k:(A,I,g)=>(A=cA(A),I=fA(I,"emval::as"),rA(I,g,A)),p:(A,I,g,C)=>(A=XA[A])(null,I=cA(I),g,C),s:(A,I,g,C,Q)=>(A=XA[A])(I=cA(I),I[g=xA(g)],C,Q),a:KA,j:A=>0===A?LA(eA()):(A=xA(A),LA(eA()[A])),h:(A,I,g)=>{I=((A,I)=>{for(var g=Array(A),C=0;C>2],"parameter "+C);return g})(A,I);var C=I.shift();A--;var Q="return function (obj, func, destructorsRef, args) {\\n",B=0,E=[];0===g&&E.push("obj");for(var D=["retType"],i=[C],w=0;wA.name)).join(", ")}) => ${C.name}>`,(A=>{var I=XA.length;return XA.push(A),I})(AA(g,A))},i:(A,I)=>(A=cA(A),I=cA(I),LA(A[I])),f:A=>{4(A=cA(A))instanceof(I=cA(I)),F:A=>"number"==typeof(A=cA(A)),E:A=>"string"==typeof(A=cA(A)),w:()=>LA([]),l:A=>LA(xA(A)),v:()=>LA({}),d:A=>{var I=cA(A);JA(I),KA(A)},n:(A,I,g)=>{A=cA(A),I=cA(I),g=cA(g),A[I]=g},c:(A,I)=>(A=(A=fA(A,"_emval_take_value")).readValueFromPointer(I),LA(A)),q:()=>{c("")},A:(A,I,g)=>R.copyWithin(A,I,I+g),z:A=>{var I=R.length;if(2147483648<(A>>>=0))return!1;for(var g=1;4>=g;g*=2){var C=I*(1+.2/g);C=Math.min(C,A+100663296);var Q=Math;C=Math.max(A,C);A:{Q=(Q.min.call(Q,2147483648,C+(65536-C%65536)%65536)-i.buffer.byteLength+65535)/65536;try{i.grow(Q),y();var B=1;break A}catch(A){}B=void 0}if(B)return!0}return!1},y:(A,I)=>(zA(R.subarray(A,A+I)),0)},$A=function(){function A(A){return $A=A.exports,i=$A.I,y(),wA=$A.L,s.unshift($A.J),a--,C.monitorRunDependencies?.(a),0==a&&(null!==S&&(clearInterval(S),S=null),K&&(A=K,K=null,A())),$A}var I={a:vA};if(a++,C.monitorRunDependencies?.(a),C.instantiateWasm)try{return C.instantiateWasm(I,A)}catch(A){D(`Module.instantiateWasm callback failed with error: ${A}`),g(A)}return I=function(A){if(L==L&&E)var I=new Uint8Array(E);else{if(l(I=L)){I=atob(I.slice(37));for(var g=new Uint8Array(I.length),C=0;CModule));';class s6 extends $X{initialize(A,t={},n=16){return ao(this,void 0,void 0,function*(){mu(typeof A=="object"&&A!==null,"First argument to initialize must be a valid AudioContext instance."),mu(typeof t=="object"&&t!==null,"The optional second argument to initialize must be an object."),typeof A._elemWorkletRegistry!="object"&&(A._elemWorkletRegistry={});const i=A._elemWorkletRegistry;if(!i.hasOwnProperty(zm)){const r=new Blob([r6,i6],{type:"text/javascript"}),s=URL.createObjectURL(r);if(!A.audioWorklet)throw new Error("BaseAudioContext.audioWorklet is missing; are you running in a secure context (https)?");yield A.audioWorklet.addModule(s),i[zm]=!0}return this._promiseMap=new Map,this._nextRequestId=0,this._worklet=new AudioWorkletNode(A,`ElementaryAudioWorkletProcessor@${zm}`,Object.assign({numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2]},t)),yield new Promise((r,s)=>{this._worklet.port.onmessage=o=>{const[a,l]=o.data;if(a==="load")return this._renderer=new e6(I=>ao(this,void 0,void 0,function*(){return yield this._sendWorkletRequest("renderInstructions",{batch:I})})),r(this._worklet),this.emit(a,l);if(a==="events")return l.forEach(I=>{this.emit(I.type,I.event)});if(a==="reply"){const{requestId:I,result:u}=l,{resolve:C,reject:h}=this._promiseMap.get(I);return this._promiseMap.delete(I),C(u)}},this._timer=window.setInterval(()=>{this._worklet.port.postMessage({requestType:"processQueuedEvents"})},n)})})}_sendWorkletRequest(A,t){mu(this._worklet,"Can't send request before worklet is ready. Have you initialized your WebRenderer instance?");let n=this._nextRequestId++;return this._worklet.port.postMessage({requestId:n,requestType:A,payload:t}),new Promise((i,r)=>{this._promiseMap.set(n,{resolve:i,reject:r})})}createRef(A,t,n){return this._renderer.createRef(A,t,n)}render(...A){return ao(this,void 0,void 0,function*(){const t=yield this._renderer.render(...A),{result:n}=t,i=t6(t,["result"]);return n.success?Promise.resolve(i):Promise.reject(n)})}updateVirtualFileSystem(A){return ao(this,void 0,void 0,function*(){return mu(typeof A=="object"&&A!==null,"Virtual file system must be an object mapping string type keys to Array|Float32Array type values"),Object.keys(A).forEach(function(n){const i=typeof A[n]=="object"&&(Array.isArray(A[n])||A[n]instanceof Float32Array);mu(i,"Virtual file system must be an object mapping string type keys to Array|Float32Array type values")}),yield this._sendWorkletRequest("updateSharedResourceMap",{resources:A})})}pruneVirtualFileSystem(){return ao(this,void 0,void 0,function*(){return yield this._sendWorkletRequest("pruneVirtualFileSystem",{})})}listVirtualFileSystem(){return ao(this,void 0,void 0,function*(){return yield this._sendWorkletRequest("listVirtualFileSystem",{})})}reset(){return ao(this,void 0,void 0,function*(){return yield this._sendWorkletRequest("reset",{})})}setCurrentTime(A){return ao(this,void 0,void 0,function*(){return yield this._sendWorkletRequest("setCurrentTime",{time:A})})}setCurrentTimeMs(A){return ao(this,void 0,void 0,function*(){return yield this._sendWorkletRequest("setCurrentTimeMs",{time:A})})}}const CD=new s6,YE=new AudioContext;function Wm(e){if(e){const A=Vm.round(Vm.mul(Vm.blepsquare(e),3));CD.render(A,A).catch(t=>console.error(t))}else CD.render().catch(A=>console.error(A))}async function o6(){YE.state==="suspended"&&await YE.resume(),(await CD.initialize(YE,{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2]})).connect(YE.destination)}function hb(e){return e!=null}const a6=Object.keys;function l6(e){return typeof e=="number"}function g6(e){return typeof e=="string"}function c6(e){return Array.isArray(e)}const rt={time:0,volume:1,enabled:!0,blockqueueing:!1,currentpriority:0,durationcounter:0,buffer:[],bufferpos:0,isplaying:!1},fb=new Array(256).fill(0),I6=32,u6=Math.exp(Math.LN2/12);for(let e=1;e<=15;++e){let A=Math.exp(e*Math.LN2)*I6;for(let t=0;t<=11;++t)fb[e*16+t]=Math.floor(A),A*=u6}const C6={c:0,d:2,e:4,f:5,g:7,a:9,b:11},To=[];To.push([3200]);To.push(new Array(14).map((e,A)=>A*100+1e3));To.push(new Array(16).map((e,A)=>A%2*1600+1600+A%4*1600));To.push(new Array(14).map(()=>TQ(0,5e3)+500));const hD=new Array(14).fill(0);for(let e=0;e<7;++e)hD[e*2-1]=1600,hD[e*2]=TQ(0,1600)+800;To.push(hD);To.push(new Array(14).map((e,A)=>A%2*880+880+A%3*440));To.push(new Array(14).map((e,A)=>700-A*12));To.push(new Array(14).map((e,A)=>A*20+1200-TQ(0,A*40)));To.push(new Array(14).map(()=>TQ(0,440)+220));const x2=60/150/8;function h6(e){if(rt.time+=e,rt.time0))return;if(rt.bufferpos>=rt.buffer.length){Wm(0),rt.isplaying=!1;return}const A=rt.buffer[rt.bufferpos++];A===0?Wm(0):A<240&&Wm(fb[A]),rt.durationcounter=rt.buffer[rt.bufferpos++]}function f6(e){let A=0,t=3,n=1;const i=[];for(let r=0;r=0||!rt.isplaying?(rt.currentpriority=e,rt.buffer=t,rt.bufferpos=0,rt.durationcounter=1):(rt.buffer=rt.buffer.slice(rt.bufferpos),rt.bufferpos=0,rt.buffer.push(...t)),rt.isplaying=!0}let T2=performance.now();setInterval(()=>{const e=performance.now(),A=(e-T2)/1e3;T2=e,h6(A)},10);UQ("pcspeaker",[],e=>{switch(e.target){case"play":if(c6(e.data)){const[A,t]=e.data;l6(A)&&g6(t)&&E6(A,t)}break}});const U2=1,F2=2,Zm=4,qm=8,JC=32,Bo=64,Ki=128,LQ=31,fD=63,Ol=127,d6=2147483647,Ta=Math.floor,pd=Math.abs,Eb=(e,A)=>ee>A?e:A,db=e=>e!==0?e<0:1/e<0,Bb=Number.MAX_SAFE_INTEGER,B6=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Ta(e)===e),rI=()=>new Set,jm=e=>e[e.length-1],Q6=(e,A)=>{for(let t=0;te.toLowerCase(),y6=/^\s*/g,w6=e=>e.replace(y6,""),D6=/([A-Z])/g,_2=(e,A)=>w6(e.replace(D6,t=>`${A}${m6(t)}`)),M6=e=>{const A=unescape(encodeURIComponent(e)),t=A.length,n=new Uint8Array(t);for(let i=0;iHC.encode(e),S6=HC?R6:M6;let Xu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Xu&&Xu.decode(new Uint8Array).length===1&&(Xu=null);const Fa=e=>new Error(e),Ts=()=>{throw Fa("Method unimplemented")},_s=()=>{throw Fa("Unexpected case")};class dh{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const wa=()=>new dh,v6=e=>{let A=e.cpos;for(let t=0;t{const A=new Uint8Array(v6(e));let t=0;for(let n=0;n{const t=e.cbuf.length;t-e.cpos{const t=e.cbuf.length;e.cpos===t&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(t*2),e.cpos=0),e.cbuf[e.cpos++]=A},ED=Qn,Ue=(e,A)=>{for(;A>Ol;)Qn(e,Ki|Ol&A),A=Ta(A/128);Qn(e,Ol&A)},_R=(e,A)=>{const t=db(A);for(t&&(A=-A),Qn(e,(A>fD?Ki:0)|(t?Bo:0)|fD&A),A=Ta(A/64);A>0;)Qn(e,(A>Ol?Ki:0)|Ol&A),A=Ta(A/128)},dD=new Uint8Array(3e4),x6=dD.length/3,T6=(e,A)=>{if(A.length{const t=unescape(encodeURIComponent(A)),n=t.length;Ue(e,n);for(let i=0;i{const t=e.cbuf.length,n=e.cpos,i=Eb(t-n,A.length),r=A.length-i;e.cbuf.set(A.subarray(0,i),n),e.cpos+=i,r>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Ig(t*2,r)),e.cbuf.set(A.subarray(i)),e.cpos=r)},Jn=(e,A)=>{Ue(e,A.byteLength),GQ(e,A)},kR=(e,A)=>{N6(e,A);const t=new DataView(e.cbuf.buffer,e.cpos,A);return e.cpos+=A,t},F6=(e,A)=>kR(e,4).setFloat32(0,A,!1),_6=(e,A)=>kR(e,8).setFloat64(0,A,!1),k6=(e,A)=>kR(e,8).setBigInt64(0,A,!1),k2=new DataView(new ArrayBuffer(4)),L6=e=>(k2.setFloat32(0,e),k2.getFloat32(0)===e),KC=(e,A)=>{switch(typeof A){case"string":Qn(e,119),Lc(e,A);break;case"number":B6(A)&&pd(A)<=d6?(Qn(e,125),_R(e,A)):L6(A)?(Qn(e,124),F6(e,A)):(Qn(e,123),_6(e,A));break;case"bigint":Qn(e,122),k6(e,A);break;case"object":if(A===null)Qn(e,126);else if(p6(A)){Qn(e,117),Ue(e,A.length);for(let t=0;t0&&Ue(this,this.count-1),this.count=1,this.w(this,A),this.s=A)}}const G2=e=>{e.count>0&&(_R(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Ue(e.encoder,e.count-2))};class md{constructor(){this.encoder=new dh,this.s=0,this.count=0}write(A){this.s===A?this.count++:(G2(this),this.count=1,this.s=A)}toUint8Array(){return G2(this),zr(this.encoder)}}const b2=e=>{if(e.count>0){const A=e.diff*2+(e.count===1?0:1);_R(e.encoder,A),e.count>1&&Ue(e.encoder,e.count-2)}};class Xm{constructor(){this.encoder=new dh,this.s=0,this.count=0,this.diff=0}write(A){this.diff===A-this.s?(this.s=A,this.count++):(b2(this),this.count=1,this.diff=A-this.s,this.s=A)}toUint8Array(){return b2(this),zr(this.encoder)}}class G6{constructor(){this.sarr=[],this.s="",this.lensE=new md}write(A){this.s+=A,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(A.length)}toUint8Array(){const A=new dh;return this.sarr.push(this.s),this.s="",Lc(A,this.sarr.join("")),GQ(A,this.lensE.toUint8Array()),zr(A)}}const Qb=Fa("Unexpected end of array"),pb=Fa("Integer out of Range");class bQ{constructor(A){this.arr=A,this.pos=0}}const ug=e=>new bQ(e),b6=e=>e.pos!==e.arr.length,O6=(e,A)=>{const t=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,A);return e.pos+=A,t},Ai=e=>O6(e,Fe(e)),sI=e=>e.arr[e.pos++],Fe=e=>{let A=0,t=1;const n=e.arr.length;for(;e.posBb)throw pb}throw Qb},LR=e=>{let A=e.arr[e.pos++],t=A&fD,n=64;const i=(A&Bo)>0?-1:1;if(!(A&Ki))return i*t;const r=e.arr.length;for(;e.posBb)throw pb}throw Qb},P6=e=>{let A=Fe(e);if(A===0)return"";{let t=String.fromCodePoint(sI(e));if(--A<100)for(;A--;)t+=String.fromCodePoint(sI(e));else for(;A>0;){const n=A<1e4?A:1e4,i=e.arr.subarray(e.pos,e.pos+n);e.pos+=n,t+=String.fromCodePoint.apply(null,i),A-=n}return decodeURIComponent(escape(t))}},Y6=e=>Xu.decode(Ai(e)),Gc=Xu?Y6:P6,GR=(e,A)=>{const t=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,A);return e.pos+=A,t},J6=e=>GR(e,4).getFloat32(0,!1),H6=e=>GR(e,8).getFloat64(0,!1),K6=e=>GR(e,8).getBigInt64(0,!1),V6=[e=>{},e=>null,LR,J6,H6,K6,e=>!1,e=>!0,Gc,e=>{const A=Fe(e),t={};for(let n=0;n{const A=Fe(e),t=[];for(let n=0;nV6[127-sI(e)](e);class O2 extends bQ{constructor(A,t){super(A),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),b6(this)?this.count=Fe(this)+1:this.count=-1),this.count--,this.s}}class yd extends bQ{constructor(A){super(A),this.s=0,this.count=0}read(){if(this.count===0){this.s=LR(this);const A=db(this.s);this.count=1,A&&(this.s=-this.s,this.count=Fe(this)+2)}return this.count--,this.s}}class $m extends bQ{constructor(A){super(A),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const A=LR(this),t=A&1;this.diff=Ta(A/2),this.count=1,t&&(this.count=Fe(this)+2)}return this.s+=this.diff,this.count--,this.s}}class z6{constructor(A){this.decoder=new yd(A),this.str=Gc(this.decoder),this.spos=0}read(){const A=this.spos+this.decoder.read(),t=this.str.slice(this.spos,A);return this.spos=A,t}}const jr=()=>new Map,BD=e=>{const A=jr();return e.forEach((t,n)=>{A.set(n,t)}),A},za=(e,A,t)=>{let n=e.get(A);return n===void 0&&e.set(A,n=t()),n},W6=(e,A)=>{const t=[];for(const[n,i]of e)t.push(A(i,n));return t},Z6=(e,A)=>{for(const[t,n]of e)if(A(n,t))return!0;return!1};class q6{constructor(){this._observers=jr()}on(A,t){return za(this._observers,A,rI).add(t),t}once(A,t){const n=(...i)=>{this.off(A,n),t(...i)};this.on(A,n)}off(A,t){const n=this._observers.get(A);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(A))}emit(A,t){return Ua((this._observers.get(A)||jr()).values()).forEach(n=>n(...t))}destroy(){this._observers=jr()}}const j6=crypto.getRandomValues.bind(crypto),mb=()=>j6(new Uint32Array(1))[0],X6="10000000-1000-4000-8000"+-1e11,$6=()=>X6.replace(/[018]/g,e=>(e^mb()&15>>e/4).toString(16)),P2=e=>new Promise(e);Promise.all.bind(Promise);const Y2=e=>e===void 0?null:e;class A7{constructor(){this.map=new Map}setItem(A,t){this.map.set(A,t)}getItem(A){return this.map.get(A)}}let yb=new A7,e7=!0;try{typeof localStorage<"u"&&localStorage&&(yb=localStorage,e7=!1)}catch{}const t7=yb,n7=Object.assign,i7=Object.keys,r7=(e,A)=>{for(const t in e)A(e[t],t)},J2=e=>i7(e).length,s7=e=>{for(const A in e)return!1;return!0},o7=(e,A)=>{for(const t in e)if(!A(e[t],t))return!1;return!0},a7=(e,A)=>Object.prototype.hasOwnProperty.call(e,A),l7=(e,A)=>e===A||J2(e)===J2(A)&&o7(e,(t,n)=>(t!==void 0||a7(A,n))&&A[n]===t),bR=(e,A,t=0)=>{try{for(;te,c7=(e,A)=>A.includes(e);var wb={};const zC=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";let Qs;const I7=()=>{if(Qs===void 0)if(zC){Qs=jr();const e=process.argv;let A=null;for(let t=0;t{if(e.length!==0){const[A,t]=e.split("=");Qs.set(`--${_2(A,"-")}`,t),Qs.set(`-${_2(A,"-")}`,t)}})):Qs=jr();return Qs},QD=e=>I7().has(e),pD=e=>Y2(zC?wb[e.toUpperCase().replaceAll("-","_")]:t7.getItem(e)),u7=e=>QD("--"+e)||pD(e)!==null;u7("production");const H2=zC&&c7(wb.FORCE_COLOR,["true","1","2"]),C7=!QD("no-colors")&&(!zC||process.stdout.isTTY||H2)&&(!zC||QD("color")||H2||pD("COLORTERM")!==null||(pD("TERM")||"").includes("color")),h7=e=>new Uint8Array(e),f7=e=>{const A=h7(e.byteLength);return A.set(e),A};class E7{constructor(A,t){this.left=A,this.right=t}}const lo=(e,A)=>new E7(e,A);typeof DOMParser<"u"&&new DOMParser;const d7=e=>W6(e,(A,t)=>`${t}:${A};`).join(""),Uo=Symbol,Db=Uo(),Mb=Uo(),B7=Uo(),Q7=Uo(),p7=Uo(),Rb=Uo(),m7=Uo(),Sb=Uo(),y7=Uo(),w7=e=>{var n;e.length===1&&((n=e[0])==null?void 0:n.constructor)===Function&&(e=e[0]());const A=[];let t=0;for(;t{var s;e.length===1&&((s=e[0])==null?void 0:s.constructor)===Function&&(e=e[0]());const A=[],t=[],n=jr();let i=[],r=0;for(;r0||l.length>0?(A.push("%c"+o),t.push(l)):A.push(o)}else break}}for(r>0&&(i=t,i.unshift(A.join("")));r{console.log(...R7(e)),v7.forEach(A=>A.print(e))},v7=rI(),vb=e=>({[Symbol.iterator](){return this},next:e}),N7=(e,A)=>vb(()=>{let t;do t=e.next();while(!t.done&&!A(t.value));return t}),Ay=(e,A)=>vb(()=>{const{done:t,value:n}=e.next();return{done:t,value:t?void 0:A(n)}});class OR{constructor(A,t){this.clock=A,this.len=t}}class Bh{constructor(){this.clients=new Map}}const Nb=(e,A,t)=>A.clients.forEach((n,i)=>{const r=e.doc.store.clients.get(i);for(let s=0;s{let t=0,n=e.length-1;for(;t<=n;){const i=Ta((t+n)/2),r=e[i],s=r.clock;if(s<=A){if(A{const t=e.clients.get(A.client);return t!==void 0&&x7(t,A.clock)!==null},PR=e=>{e.clients.forEach(A=>{A.sort((i,r)=>i.clock-r.clock);let t,n;for(t=1,n=1;t=r.clock?i.len=Ig(i.len,r.clock+r.len-i.clock):(n{const A=new Bh;for(let t=0;t{if(!A.clients.has(i)){const r=n.slice();for(let s=t+1;s{za(e.clients,A,()=>[]).push(new OR(t,n))},U7=()=>new Bh,F7=e=>{const A=U7();return e.clients.forEach((t,n)=>{const i=[];for(let r=0;r0&&A.clients.set(n,i)}),A},MI=(e,A)=>{Ue(e.restEncoder,A.clients.size),Ua(A.clients.entries()).sort((t,n)=>n[0]-t[0]).forEach(([t,n])=>{e.resetDsCurVal(),Ue(e.restEncoder,t);const i=n.length;Ue(e.restEncoder,i);for(let r=0;r{const A=new Bh,t=Fe(e.restDecoder);for(let n=0;n0){const s=za(A.clients,i,()=>[]);for(let o=0;o{const n=new Bh,i=Fe(e.restDecoder);for(let r=0;r0){const r=new ql;return Ue(r.restEncoder,0),MI(r,n),r.toUint8Array()}return null},Tb=mb;class RI extends q6{constructor({guid:A=$6(),collectionid:t=null,gc:n=!0,gcFilter:i=()=>!0,meta:r=null,autoLoad:s=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=i,this.clientID=Tb(),this.guid=A,this.collectionid=t,this.share=new Map,this.store=new Pb,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=s,this.meta=r,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=P2(l=>{this.on("load",()=>{this.isLoaded=!0,l(this)})});const a=()=>P2(l=>{const I=u=>{(u===void 0||u===!0)&&(this.off("sync",I),l())};this.on("sync",I)});this.on("sync",l=>{l===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=l===void 0||l===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=a()}load(){const A=this._item;A!==null&&!this.shouldLoad&>(A.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Ua(this.subdocs).map(A=>A.guid))}transact(A,t=null){return gt(this,A,t)}get(A,t=Tn){const n=za(this.share,A,()=>{const r=new t;return r._integrate(this,null),r}),i=n.constructor;if(t!==Tn&&i!==t)if(i===Tn){const r=new t;r._map=n._map,n._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=r}),r._start=n._start;for(let s=r._start;s!==null;s=s.right)s.parent=r;return r._length=n._length,this.share.set(A,r),r._integrate(this,null),r}else throw new Error(`Type with the name ${A} has already been defined with a different constructor`);return n}getArray(A=""){return this.get(A,Oc)}getText(A=""){return this.get(A,jl)}getMap(A=""){return this.get(A,aI)}getXmlElement(A=""){return this.get(A,lI)}getXmlFragment(A=""){return this.get(A,Xl)}toJSON(){const A={};return this.share.forEach((t,n)=>{A[n]=t.toJSON()}),A}destroy(){Ua(this.subdocs).forEach(t=>t.destroy());const A=this._item;if(A!==null){this._item=null;const t=A.content;t.doc=new RI({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=A,gt(A.parent.doc,n=>{const i=t.doc;A.deleted||n.subdocsAdded.add(i),n.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Ub{constructor(A){this.restDecoder=A}resetDsCurVal(){}readDsClock(){return Fe(this.restDecoder)}readDsLen(){return Fe(this.restDecoder)}}class Fb extends Ub{readLeftID(){return Oe(Fe(this.restDecoder),Fe(this.restDecoder))}readRightID(){return Oe(Fe(this.restDecoder),Fe(this.restDecoder))}readClient(){return Fe(this.restDecoder)}readInfo(){return sI(this.restDecoder)}readString(){return Gc(this.restDecoder)}readParentInfo(){return Fe(this.restDecoder)===1}readTypeRef(){return Fe(this.restDecoder)}readLen(){return Fe(this.restDecoder)}readAny(){return VC(this.restDecoder)}readBuf(){return f7(Ai(this.restDecoder))}readJSON(){return JSON.parse(Gc(this.restDecoder))}readKey(){return Gc(this.restDecoder)}}class _7{constructor(A){this.dsCurrVal=0,this.restDecoder=A}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Fe(this.restDecoder),this.dsCurrVal}readDsLen(){const A=Fe(this.restDecoder)+1;return this.dsCurrVal+=A,A}}class oI extends _7{constructor(A){super(A),this.keys=[],Fe(A),this.keyClockDecoder=new $m(Ai(A)),this.clientDecoder=new yd(Ai(A)),this.leftClockDecoder=new $m(Ai(A)),this.rightClockDecoder=new $m(Ai(A)),this.infoDecoder=new O2(Ai(A),sI),this.stringDecoder=new z6(Ai(A)),this.parentInfoDecoder=new O2(Ai(A),sI),this.typeRefDecoder=new yd(Ai(A)),this.lenDecoder=new yd(Ai(A))}readLeftID(){return new bc(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new bc(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return VC(this.restDecoder)}readBuf(){return Ai(this.restDecoder)}readJSON(){return VC(this.restDecoder)}readKey(){const A=this.keyClockDecoder.read();if(A{n=Ig(n,A[0].id.clock);const i=ks(A,n);Ue(e.restEncoder,A.length-i),e.writeClient(t),Ue(e.restEncoder,n);const r=A[i];r.write(e,n-r.id.clock);for(let s=i+1;s{const n=new Map;t.forEach((i,r)=>{yn(A,r)>i&&n.set(r,i)}),OQ(A).forEach((i,r)=>{t.has(r)||n.set(r,0)}),Ue(e.restEncoder,n.size),Ua(n.entries()).sort((i,r)=>r[0]-i[0]).forEach(([i,r])=>{k7(e,A.clients.get(i),i,r)})},L7=(e,A)=>{const t=jr(),n=Fe(e.restDecoder);for(let i=0;i{const n=[];let i=Ua(t.keys()).sort((h,d)=>h-d);if(i.length===0)return null;const r=()=>{if(i.length===0)return null;let h=t.get(i[i.length-1]);for(;h.refs.length===h.i;)if(i.pop(),i.length>0)h=t.get(i[i.length-1]);else return null;return h};let s=r();if(s===null)return null;const o=new Pb,a=new Map,l=(h,d)=>{const m=a.get(h);(m==null||m>d)&&a.set(h,d)};let I=s.refs[s.i++];const u=new Map,C=()=>{for(const h of n){const d=h.id.client,m=t.get(d);m?(m.i--,o.clients.set(d,m.refs.slice(m.i)),t.delete(d),m.i=0,m.refs=[]):o.clients.set(d,[h]),i=i.filter(p=>p!==d)}n.length=0};for(;;){if(I.constructor!==hr){const d=za(u,I.id.client,()=>yn(A,I.id.client))-I.id.clock;if(d<0)n.push(I),l(I.id.client,I.id.clock-1),C();else{const m=I.getMissing(e,A);if(m!==null){n.push(I);const p=t.get(m)||{refs:[],i:0};if(p.refs.length===p.i)l(m,yn(A,m)),C();else{I=p.refs[p.i++];continue}}else(d===0||d0)I=n.pop();else if(s!==null&&s.i0){const h=new ql;return JR(h,o,new Map),Ue(h.restEncoder,0),{missing:a,update:h.toUint8Array()}}return null},b7=(e,A)=>JR(e,A.doc.store,A.beforeState),O7=(e,A,t,n=new oI(e))=>gt(A,i=>{i.local=!1;let r=!1;const s=i.doc,o=s.store,a=L7(n,s),l=G7(i,o,a),I=o.pendingStructs;if(I){for(const[C,h]of I.missing)if(hh)&&I.missing.set(C,h)}I.update=fB([I.update,l.update])}}else o.pendingStructs=l;const u=K2(n,i,o);if(o.pendingDs){const C=new oI(ug(o.pendingDs));Fe(C.restDecoder);const h=K2(C,i,o);u&&h?o.pendingDs=fB([u,h]):o.pendingDs=u||h}else o.pendingDs=u;if(r){const C=o.pendingStructs.update;o.pendingStructs=null,Lb(i.doc,C)}},t,!1),Lb=(e,A,t,n=oI)=>{const i=ug(A);O7(i,e,t,new n(i))},P7=(e,A,t)=>Lb(e,A,t,Fb),Y7=(e,A,t=new Map)=>{JR(e,A.store,t),MI(e,F7(A.store))},J7=(e,A=new Uint8Array([0]),t=new ql)=>{const n=Gb(A);Y7(t,e,n);const i=[t.toUint8Array()];if(e.store.pendingDs&&i.push(e.store.pendingDs),e.store.pendingStructs&&i.push(r$(e.store.pendingStructs.update,A)),i.length>1){if(t.constructor===Qh)return n$(i.map((r,s)=>s===0?r:o$(r)));if(t.constructor===ql)return fB(i)}return i[0]},H7=(e,A)=>J7(e,A,new Qh),K7=e=>{const A=new Map,t=Fe(e.restDecoder);for(let n=0;nK7(new Ub(ug(e))),bb=(e,A)=>(Ue(e.restEncoder,A.size),Ua(A.entries()).sort((t,n)=>n[0]-t[0]).forEach(([t,n])=>{Ue(e.restEncoder,t),Ue(e.restEncoder,n)}),e),V7=(e,A)=>bb(e,OQ(A.store)),z7=(e,A=new kb)=>(e instanceof Map?bb(A,e):V7(A,e),A.toUint8Array()),W7=e=>z7(e,new _b);class Z7{constructor(){this.l=[]}}const V2=()=>new Z7,z2=(e,A)=>e.l.push(A),W2=(e,A)=>{const t=e.l,n=t.length;e.l=t.filter(i=>A!==i),n===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Ob=(e,A,t)=>bR(e.l,[A,t]);class bc{constructor(A,t){this.client=A,this.clock=t}}const JE=(e,A)=>e===A||e!==null&&A!==null&&e.client===A.client&&e.clock===A.clock,Oe=(e,A)=>new bc(e,A),q7=e=>{for(const[A,t]of e.doc.share.entries())if(t===e)return A;throw _s()},oc=(e,A)=>A===void 0?!e.deleted:A.sv.has(e.id.client)&&(A.sv.get(e.id.client)||0)>e.id.clock&&!xb(A.ds,e.id),mD=(e,A)=>{const t=za(e.meta,mD,rI),n=e.doc.store;t.has(A)||(A.sv.forEach((i,r)=>{i{}),t.add(A))};class Pb{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const OQ=e=>{const A=new Map;return e.clients.forEach((t,n)=>{const i=t[t.length-1];A.set(n,i.id.clock+i.length)}),A},yn=(e,A)=>{const t=e.clients.get(A);if(t===void 0)return 0;const n=t[t.length-1];return n.id.clock+n.length},Yb=(e,A)=>{let t=e.clients.get(A.id.client);if(t===void 0)t=[],e.clients.set(A.id.client,t);else{const n=t[t.length-1];if(n.id.clock+n.length!==A.id.clock)throw _s()}t.push(A)},ks=(e,A)=>{let t=0,n=e.length-1,i=e[n],r=i.id.clock;if(r===A)return n;let s=Ta(A/(r+i.length-1)*n);for(;t<=n;){if(i=e[s],r=i.id.clock,r<=A){if(A{const t=e.clients.get(A.client);return t[ks(t,A.clock)]},ey=j7,yD=(e,A,t)=>{const n=ks(A,t),i=A[n];return i.id.clock{const t=e.doc.store.clients.get(A.client);return t[yD(e,t,A.clock)]},Z2=(e,A,t)=>{const n=A.clients.get(t.client),i=ks(n,t.clock),r=n[i];return t.clock!==r.id.clock+r.length-1&&r.constructor!==Cr&&n.splice(i+1,0,mB(e,r,t.clock-r.id.clock+1)),r},X7=(e,A,t)=>{const n=e.clients.get(A.id.client);n[ks(n,A.id.clock)]=t},Jb=(e,A,t,n,i)=>{if(n===0)return;const r=t+n;let s=yD(e,A,t),o;do o=A[s++],rA.deleteSet.clients.size===0&&!Z6(A.afterState,(t,n)=>A.beforeState.get(n)!==t)?!1:(PR(A.deleteSet),b7(e,A),MI(e,A.deleteSet),!0),j2=(e,A,t)=>{const n=A._item;(n===null||n.id.clock<(e.beforeState.get(n.id.client)||0)&&!n.deleted)&&za(e.changed,A,rI).add(t)},wd=(e,A)=>{let t=e[A],n=e[A-1],i=A;for(;i>0;t=n,n=e[--i-1]){if(n.deleted===t.deleted&&n.constructor===t.constructor&&n.mergeWith(t)){t instanceof sn&&t.parentSub!==null&&t.parent._map.get(t.parentSub)===t&&t.parent._map.set(t.parentSub,n);continue}break}const r=A-i;return r&&e.splice(A+1-r,r),r},A$=(e,A,t)=>{for(const[n,i]of e.clients.entries()){const r=A.clients.get(n);for(let s=i.length-1;s>=0;s--){const o=i[s],a=o.clock+o.len;for(let l=ks(r,o.clock),I=r[l];l{e.clients.forEach((t,n)=>{const i=A.clients.get(n);for(let r=t.length-1;r>=0;r--){const s=t[r],o=Eb(i.length-1,1+ks(i,s.clock+s.len-1));for(let a=o,l=i[a];a>0&&l.id.clock>=s.clock;l=i[a])a-=1+wd(i,a)}})},Hb=(e,A)=>{if(Ao.push(()=>{(l._item===null||!l._item.deleted)&&l._callObserver(t,a)})),o.push(()=>{t.changedParentTypes.forEach((a,l)=>{l._dEH.l.length>0&&(l._item===null||!l._item.deleted)&&(a=a.filter(I=>I.target._item===null||!I.target._item.deleted),a.forEach(I=>{I.currentTarget=l,I._path=null}),a.sort((I,u)=>I.path.length-u.path.length),Ob(l._dEH,a,t))})}),o.push(()=>n.emit("afterTransaction",[t,n])),bR(o,[]),t._needFormattingCleanup&&p$(t)}finally{n.gc&&A$(r,i,n.gcFilter),e$(r,i),t.afterState.forEach((I,u)=>{const C=t.beforeState.get(u)||0;if(C!==I){const h=i.clients.get(u),d=Ig(ks(h,C),1);for(let m=h.length-1;m>=d;)m-=1+wd(h,m)}});for(let I=s.length-1;I>=0;I--){const{client:u,clock:C}=s[I].id,h=i.clients.get(u),d=ks(h,C);d+11||d>0&&wd(h,d)}if(!t.local&&t.afterState.get(n.clientID)!==t.beforeState.get(n.clientID)&&(S7(Sb,Db,"[yjs] ",Mb,Rb,"Changed the client-id because another client seems to be using it."),n.clientID=Tb()),n.emit("afterTransactionCleanup",[t,n]),n._observers.has("update")){const I=new Qh;q2(I,t)&&n.emit("update",[I.toUint8Array(),t.origin,n,t])}if(n._observers.has("updateV2")){const I=new ql;q2(I,t)&&n.emit("updateV2",[I.toUint8Array(),t.origin,n,t])}const{subdocsAdded:o,subdocsLoaded:a,subdocsRemoved:l}=t;(o.size>0||l.size>0||a.size>0)&&(o.forEach(I=>{I.clientID=n.clientID,I.collectionid==null&&(I.collectionid=n.collectionid),n.subdocs.add(I)}),l.forEach(I=>n.subdocs.delete(I)),n.emit("subdocs",[{loaded:a,added:o,removed:l},n,t]),l.forEach(I=>I.destroy())),e.length<=A+1?(n._transactionCleanups=[],n.emit("afterAllTransactions",[n,e])):Hb(e,A+1)}}},gt=(e,A,t=null,n=!0)=>{const i=e._transactionCleanups;let r=!1,s=null;e._transaction===null&&(r=!0,e._transaction=new $7(e,t,n),i.push(e._transaction),i.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{s=A(e._transaction)}finally{if(r){const o=e._transaction===i[0];e._transaction=null,o&&Hb(i,0)}}return s};function*t$(e){const A=Fe(e.restDecoder);for(let t=0;tfB(e,Fb,Qh),i$=(e,A)=>{if(e.constructor===Cr){const{client:t,clock:n}=e.id;return new Cr(Oe(t,n+A),e.length-A)}else if(e.constructor===hr){const{client:t,clock:n}=e.id;return new hr(Oe(t,n+A),e.length-A)}else{const t=e,{client:n,clock:i}=t.id;return new sn(Oe(n,i+A),null,Oe(n,i+A-1),null,t.rightOrigin,t.parent,t.parentSub,t.content.splice(A))}},fB=(e,A=oI,t=ql)=>{if(e.length===1)return e[0];const n=e.map(I=>new A(ug(I)));let i=n.map(I=>new HR(I,!0)),r=null;const s=new t,o=new KR(s);for(;i=i.filter(C=>C.curr!==null),i.sort((C,h)=>{if(C.curr.id.client===h.curr.id.client){const d=C.curr.id.clock-h.curr.id.clock;return d===0?C.curr.constructor===h.curr.constructor?0:C.curr.constructor===hr?1:-1:d}else return h.curr.id.client-C.curr.id.client}),i.length!==0;){const I=i[0],u=I.curr.id.client;if(r!==null){let C=I.curr,h=!1;for(;C!==null&&C.id.clock+C.length<=r.struct.id.clock+r.struct.length&&C.id.client>=r.struct.id.client;)C=I.next(),h=!0;if(C===null||C.id.client!==u||h&&C.id.clock>r.struct.id.clock+r.struct.length)continue;if(u!==r.struct.id.client)la(o,r.struct,r.offset),r={struct:C,offset:0},I.next();else if(r.struct.id.clock+r.struct.length0&&(r.struct.constructor===hr?r.struct.length-=d:C=i$(C,d)),r.struct.mergeWith(C)||(la(o,r.struct,r.offset),r={struct:C,offset:0},I.next())}}else r={struct:I.curr,offset:0},I.next();for(let C=I.curr;C!==null&&C.id.client===u&&C.id.clock===r.struct.id.clock+r.struct.length&&C.constructor!==hr;C=I.next())la(o,r.struct,r.offset),r={struct:C,offset:0}}r!==null&&(la(o,r.struct,r.offset),r=null),VR(o);const a=n.map(I=>YR(I)),l=T7(a);return MI(s,l),s.toUint8Array()},r$=(e,A,t=oI,n=ql)=>{const i=Gb(A),r=new n,s=new KR(r),o=new t(ug(e)),a=new HR(o,!1);for(;a.curr;){const I=a.curr,u=I.id.client,C=i.get(u)||0;if(a.curr.constructor===hr){a.next();continue}if(I.id.clock+I.length>C)for(la(s,I,Ig(C-I.id.clock,0)),a.next();a.curr&&a.curr.id.client===u;)la(s,a.curr,0),a.next();else for(;a.curr&&a.curr.id.client===u&&a.curr.id.clock+a.curr.length<=C;)a.next()}VR(s);const l=YR(o);return MI(r,l),r.toUint8Array()},Kb=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:zr(e.encoder.restEncoder)}),e.encoder.restEncoder=wa(),e.written=0)},la=(e,A,t)=>{e.written>0&&e.currClient!==A.id.client&&Kb(e),e.written===0&&(e.currClient=A.id.client,e.encoder.writeClient(A.id.client),Ue(e.encoder.restEncoder,A.id.clock+t)),A.write(e.encoder,t),e.written++},VR=e=>{Kb(e);const A=e.encoder.restEncoder;Ue(A,e.clientStructs.length);for(let t=0;t{const i=new t(ug(e)),r=new HR(i,!1),s=new n,o=new KR(s);for(let l=r.curr;l!==null;l=r.next())la(o,A(l),0);VR(o);const a=YR(i);return MI(s,a),s.toUint8Array()},o$=e=>s$(e,g7,oI,Qh),X2="You must not compute changes after the event-handler fired.";class PQ{constructor(A,t){this.target=A,this.currentTarget=A,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=a$(this.currentTarget,this.target))}deletes(A){return xb(this.transaction.deleteSet,A.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Fa(X2);const A=new Map,t=this.target;this.transaction.changed.get(t).forEach(i=>{if(i!==null){const r=t._map.get(i);let s,o;if(this.adds(r)){let a=r.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(r))if(a!==null&&this.deletes(a))s="delete",o=jm(a.content.getContent());else return;else a!==null&&this.deletes(a)?(s="update",o=jm(a.content.getContent())):(s="add",o=void 0)}else if(this.deletes(r))s="delete",o=jm(r.content.getContent());else return;A.set(i,{action:s,oldValue:o})}}),this._keys=A}return this._keys}get delta(){return this.changes.delta}adds(A){return A.id.clock>=(this.transaction.beforeState.get(A.id.client)||0)}get changes(){let A=this._changes;if(A===null){if(this.transaction.doc._transactionCleanups.length===0)throw Fa(X2);const t=this.target,n=rI(),i=rI(),r=[];if(A={added:n,deleted:i,delta:r,keys:this.keys},this.transaction.changed.get(t).has(null)){let o=null;const a=()=>{o&&r.push(o)};for(let l=t._start;l!==null;l=l.right)l.deleted?this.deletes(l)&&!this.adds(l)&&((o===null||o.delete===void 0)&&(a(),o={delete:0}),o.delete+=l.length,i.add(l)):this.adds(l)?((o===null||o.insert===void 0)&&(a(),o={insert:[]}),o.insert=o.insert.concat(l.content.getContent()),n.add(l)):((o===null||o.retain===void 0)&&(a(),o={retain:0}),o.retain+=l.length);o!==null&&o.retain===void 0&&a()}this._changes=A}return A}}const a$=(e,A)=>{const t=[];for(;A._item!==null&&A!==e;){if(A._item.parentSub!==null)t.unshift(A._item.parentSub);else{let n=0,i=A._item.parent._start;for(;i!==A._item&&i!==null;)i.deleted||n++,i=i.right;t.unshift(n)}A=A._item.parent}return t},Vb=80;let zR=0;class l${constructor(A,t){A.marker=!0,this.p=A,this.index=t,this.timestamp=zR++}}const g$=e=>{e.timestamp=zR++},zb=(e,A,t)=>{e.p.marker=!1,e.p=A,A.marker=!0,e.index=t,e.timestamp=zR++},c$=(e,A,t)=>{if(e.length>=Vb){const n=e.reduce((i,r)=>i.timestamp{if(e._start===null||A===0||e._searchMarker===null)return null;const t=e._searchMarker.length===0?null:e._searchMarker.reduce((r,s)=>pd(A-r.index)A;)n=n.left,!n.deleted&&n.countable&&(i-=n.length);for(;n.left!==null&&n.left.id.client===n.id.client&&n.left.id.clock+n.left.length===n.id.clock;)n=n.left,!n.deleted&&n.countable&&(i-=n.length);return t!==null&&pd(t.index-i){for(let n=e.length-1;n>=0;n--){const i=e[n];if(t>0){let r=i.p;for(r.marker=!1;r&&(r.deleted||!r.countable);)r=r.left,r&&!r.deleted&&r.countable&&(i.index-=r.length);if(r===null||r.marker===!0){e.splice(n,1);continue}i.p=r,r.marker=!0}(A0&&A===i.index)&&(i.index=Ig(A,i.index+t))}},JQ=(e,A,t)=>{const n=e,i=A.changedParentTypes;for(;za(i,e,()=>[]).push(t),e._item!==null;)e=e._item.parent;Ob(n._eH,t,A)};class Tn{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=V2(),this._dEH=V2(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(A,t){this.doc=A,this._item=t}_copy(){throw Ts()}clone(){throw Ts()}_write(A){}get _first(){let A=this._start;for(;A!==null&&A.deleted;)A=A.right;return A}_callObserver(A,t){!A.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(A){z2(this._eH,A)}observeDeep(A){z2(this._dEH,A)}unobserve(A){W2(this._eH,A)}unobserveDeep(A){W2(this._dEH,A)}toJSON(){}}const Wb=(e,A,t)=>{A<0&&(A=e._length+A),t<0&&(t=e._length+t);let n=t-A;const i=[];let r=e._start;for(;r!==null&&n>0;){if(r.countable&&!r.deleted){const s=r.content.getContent();if(s.length<=A)A-=s.length;else{for(let o=A;o0;o++)i.push(s[o]),n--;A=0}}r=r.right}return i},Zb=e=>{const A=[];let t=e._start;for(;t!==null;){if(t.countable&&!t.deleted){const n=t.content.getContent();for(let i=0;i{let t=0,n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const i=n.content.getContent();for(let r=0;r{const t=[];return ZC(e,(n,i)=>{t.push(A(n,i,e))}),t},I$=e=>{let A=e._start,t=null,n=0;return{[Symbol.iterator](){return this},next:()=>{if(t===null){for(;A!==null&&A.deleted;)A=A.right;if(A===null)return{done:!0,value:void 0};t=A.content.getContent(),n=0,A=A.right}const i=t[n++];return t.length<=n&&(t=null),{done:!1,value:i}}}},jb=(e,A)=>{const t=YQ(e,A);let n=e._start;for(t!==null&&(n=t.p,A-=t.index);n!==null;n=n.right)if(!n.deleted&&n.countable){if(A{let i=t;const r=e.doc,s=r.clientID,o=r.store,a=t===null?A._start:t.right;let l=[];const I=()=>{l.length>0&&(i=new sn(Oe(s,yn(o,s)),i,i&&i.lastId,a,a&&a.id,A,null,new $l(l)),i.integrate(e,0),l=[])};n.forEach(u=>{if(u===null)l.push(u);else switch(u.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(u);break;default:switch(I(),u.constructor){case Uint8Array:case ArrayBuffer:i=new sn(Oe(s,yn(o,s)),i,i&&i.lastId,a,a&&a.id,A,null,new ph(new Uint8Array(u))),i.integrate(e,0);break;case RI:i=new sn(Oe(s,yn(o,s)),i,i&&i.lastId,a,a&&a.id,A,null,new mh(u)),i.integrate(e,0);break;default:if(u instanceof Tn)i=new sn(Oe(s,yn(o,s)),i,i&&i.lastId,a,a&&a.id,A,null,new Fo(u)),i.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),I()},Xb=()=>Fa("Length exceeded!"),$b=(e,A,t,n)=>{if(t>A._length)throw Xb();if(t===0)return A._searchMarker&&WC(A._searchMarker,t,n.length),EB(e,A,null,n);const i=t,r=YQ(A,t);let s=A._start;for(r!==null&&(s=r.p,t-=r.index,t===0&&(s=s.prev,t+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(t<=s.length){t{let i=(A._searchMarker||[]).reduce((r,s)=>s.index>r.index?s:r,{index:0,p:A._start}).p;if(i)for(;i.right;)i=i.right;return EB(e,A,i,t)},AO=(e,A,t,n)=>{if(n===0)return;const i=t,r=n,s=YQ(A,t);let o=A._start;for(s!==null&&(o=s.p,t-=s.index);o!==null&&t>0;o=o.right)!o.deleted&&o.countable&&(t0&&o!==null;)o.deleted||(n0)throw Xb();A._searchMarker&&WC(A._searchMarker,i,-r+n)},dB=(e,A,t)=>{const n=A._map.get(t);n!==void 0&&n.delete(e)},WR=(e,A,t,n)=>{const i=A._map.get(t)||null,r=e.doc,s=r.clientID;let o;if(n==null)o=new $l([n]);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:o=new $l([n]);break;case Uint8Array:o=new ph(n);break;case RI:o=new mh(n);break;default:if(n instanceof Tn)o=new Fo(n);else throw new Error("Unexpected content type")}new sn(Oe(s,yn(r.store,s)),i,i&&i.lastId,null,null,A,t,o).integrate(e,0)},ZR=(e,A)=>{const t=e._map.get(A);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},eO=e=>{const A={};return e._map.forEach((t,n)=>{t.deleted||(A[n]=t.content.getContent()[t.length-1])}),A},tO=(e,A)=>{const t=e._map.get(A);return t!==void 0&&!t.deleted},C$=(e,A)=>{const t={};return e._map.forEach((n,i)=>{let r=n;for(;r!==null&&(!A.sv.has(r.id.client)||r.id.clock>=(A.sv.get(r.id.client)||0));)r=r.left;r!==null&&oc(r,A)&&(t[i]=r.content.getContent()[r.length-1])}),t},HE=e=>N7(e.entries(),A=>!A[1].deleted);class h$ extends PQ{constructor(A,t){super(A,t),this._transaction=t}}class Oc extends Tn{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(A){const t=new Oc;return t.push(A),t}_integrate(A,t){super._integrate(A,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Oc}clone(){const A=new Oc;return A.insert(0,this.toArray().map(t=>t instanceof Tn?t.clone():t)),A}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(A,t){super._callObserver(A,t),JQ(this,A,new h$(this,A))}insert(A,t){this.doc!==null?gt(this.doc,n=>{$b(n,this,A,t)}):this._prelimContent.splice(A,0,...t)}push(A){this.doc!==null?gt(this.doc,t=>{u$(t,this,A)}):this._prelimContent.push(...A)}unshift(A){this.insert(0,A)}delete(A,t=1){this.doc!==null?gt(this.doc,n=>{AO(n,this,A,t)}):this._prelimContent.splice(A,t)}get(A){return jb(this,A)}toArray(){return Zb(this)}slice(A=0,t=this.length){return Wb(this,A,t)}toJSON(){return this.map(A=>A instanceof Tn?A.toJSON():A)}map(A){return qb(this,A)}forEach(A){ZC(this,A)}[Symbol.iterator](){return I$(this)}_write(A){A.writeTypeRef(b$)}}const f$=e=>new Oc;class E$ extends PQ{constructor(A,t,n){super(A,t),this.keysChanged=n}}class aI extends Tn{constructor(A){super(),this._prelimContent=null,A===void 0?this._prelimContent=new Map:this._prelimContent=new Map(A)}_integrate(A,t){super._integrate(A,t),this._prelimContent.forEach((n,i)=>{this.set(i,n)}),this._prelimContent=null}_copy(){return new aI}clone(){const A=new aI;return this.forEach((t,n)=>{A.set(n,t instanceof Tn?t.clone():t)}),A}_callObserver(A,t){JQ(this,A,new E$(this,A,t))}toJSON(){const A={};return this._map.forEach((t,n)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];A[n]=i instanceof Tn?i.toJSON():i}}),A}get size(){return[...HE(this._map)].length}keys(){return Ay(HE(this._map),A=>A[0])}values(){return Ay(HE(this._map),A=>A[1].content.getContent()[A[1].length-1])}entries(){return Ay(HE(this._map),A=>[A[0],A[1].content.getContent()[A[1].length-1]])}forEach(A){this._map.forEach((t,n)=>{t.deleted||A(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(A){this.doc!==null?gt(this.doc,t=>{dB(t,this,A)}):this._prelimContent.delete(A)}set(A,t){return this.doc!==null?gt(this.doc,n=>{WR(n,this,A,t)}):this._prelimContent.set(A,t),t}get(A){return ZR(this,A)}has(A){return tO(this,A)}clear(){this.doc!==null?gt(this.doc,A=>{this.forEach(function(t,n,i){dB(A,i,n)})}):this._prelimContent.clear()}_write(A){A.writeTypeRef(O$)}}const d$=e=>new aI,Ia=(e,A)=>e===A||typeof e=="object"&&typeof A=="object"&&e&&A&&l7(e,A);class wD{constructor(A,t,n,i){this.left=A,this.right=t,this.index=n,this.currentAttributes=i}forward(){switch(this.right===null&&_s(),this.right.content.constructor){case ln:this.right.deleted||SI(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const $2=(e,A,t)=>{for(;A.right!==null&&t>0;){switch(A.right.content.constructor){case ln:A.right.deleted||SI(A.currentAttributes,A.right.content);break;default:A.right.deleted||(t{const i=new Map,r=n?YQ(A,t):null;if(r){const s=new wD(r.p.left,r.p,r.index,i);return $2(e,s,t-r.index)}else{const s=new wD(null,A._start,0,i);return $2(e,s,t)}},nO=(e,A,t,n)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===ln&&Ia(n.get(t.right.content.key),t.right.content.value));)t.right.deleted||n.delete(t.right.content.key),t.forward();const i=e.doc,r=i.clientID;n.forEach((s,o)=>{const a=t.left,l=t.right,I=new sn(Oe(r,yn(i.store,r)),a,a&&a.lastId,l,l&&l.id,A,null,new ln(o,s));I.integrate(e,0),t.right=I,t.forward()})},SI=(e,A)=>{const{key:t,value:n}=A;n===null?e.delete(t):e.set(t,n)},iO=(e,A)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===ln&&Ia(A[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},rO=(e,A,t,n)=>{const i=e.doc,r=i.clientID,s=new Map;for(const o in n){const a=n[o],l=t.currentAttributes.get(o)??null;if(!Ia(l,a)){s.set(o,l);const{left:I,right:u}=t;t.right=new sn(Oe(r,yn(i.store,r)),I,I&&I.lastId,u,u&&u.id,A,null,new ln(o,a)),t.right.integrate(e,0),t.forward()}}return s},ty=(e,A,t,n,i)=>{t.currentAttributes.forEach((C,h)=>{i[h]===void 0&&(i[h]=null)});const r=e.doc,s=r.clientID;iO(t,i);const o=rO(e,A,t,i),a=n.constructor===String?new Ls(n):n instanceof Tn?new Fo(n):new Cg(n);let{left:l,right:I,index:u}=t;A._searchMarker&&WC(A._searchMarker,t.index,a.getLength()),I=new sn(Oe(s,yn(r.store,s)),l,l&&l.lastId,I,I&&I.id,A,null,a),I.integrate(e,0),t.right=I,t.index=u,t.forward(),nO(e,A,t,o)},AU=(e,A,t,n,i)=>{const r=e.doc,s=r.clientID;iO(t,i);const o=rO(e,A,t,i);A:for(;t.right!==null&&(n>0||o.size>0&&(t.right.deleted||t.right.content.constructor===ln));){if(!t.right.deleted)switch(t.right.content.constructor){case ln:{const{key:a,value:l}=t.right.content,I=i[a];if(I!==void 0){if(Ia(I,l))o.delete(a);else{if(n===0)break A;o.set(a,l)}t.right.delete(e)}else t.currentAttributes.set(a,l);break}default:n0){let a="";for(;n>0;n--)a+=` + */var DR=new WeakMap,$q=function(){function e(A){this.observers=new Map,this.obj=A}return e}(),Aj=function(){function e(A,t){this.callback=A,this.observer=t}return e}();function ej(e){return DR.get(e)}function tj(e,A){return e.observers.get(A)}function nj(e,A){e.observers.delete(A.callback)}function ij(e,A){A.unobserve()}function rj(e,A){var t=[],n,i=ej(e);if(!i)i=new $q(e),DR.set(e,i);else{var r=tj(i,A);n=r&&r.observer}if(n)return n;if(n={},i.value=pi(e),A){n.callback=A,n.next=null;var s=function(){oD(n)},o=function(){clearTimeout(n.next),n.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",o),window.addEventListener("keyup",o),window.addEventListener("mousedown",o),window.addEventListener("keydown",o),window.addEventListener("change",o))}return n.patches=t,n.object=e,n.unobserve=function(){oD(n),clearTimeout(n.next),nj(i,n),typeof window<"u"&&(window.removeEventListener("mouseup",o),window.removeEventListener("keyup",o),window.removeEventListener("mousedown",o),window.removeEventListener("keydown",o),window.removeEventListener("change",o))},i.observers.set(A,new Aj(A,n)),n}function oD(e,A){A===void 0&&(A=!1);var t=DR.get(e.object);MR(t.value,e.object,e.patches,"",A),e.patches.length&&FQ(t.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function MR(e,A,t,n,i){if(A!==e){typeof A.toJSON=="function"&&(A=A.toJSON());for(var r=iD(A),s=iD(e),o=!1,a=s.length-1;a>=0;a--){var l=s[a],I=e[l];if(nD(A,l)&&!(A[l]===void 0&&I!==void 0&&Array.isArray(A)===!1)){var u=A[l];typeof I=="object"&&I!=null&&typeof u=="object"&&u!=null&&Array.isArray(I)===Array.isArray(u)?MR(I,u,t,n+"/"+Ql(l),i):I!==u&&(i&&t.push({op:"test",path:n+"/"+Ql(l),value:pi(I)}),t.push({op:"replace",path:n+"/"+Ql(l),value:pi(u)}))}else Array.isArray(e)===Array.isArray(A)?(i&&t.push({op:"test",path:n+"/"+Ql(l),value:pi(I)}),t.push({op:"remove",path:n+"/"+Ql(l)}),o=!0):(i&&t.push({op:"test",path:n,value:e}),t.push({op:"replace",path:n,value:A}))}if(!(!o&&r.length==s.length))for(var a=0;anew Proxy(e,A);const aD=Object.getPrototypeOf,lD=new WeakMap,_G=e=>e&&(lD.has(e)?lD.get(e):aD(e)===Object.prototype||aD(e)===Array.prototype),uB=e=>typeof e=="object"&&e!==null,gj=e=>{if(Array.isArray(e))return Array.from(e);const A=Object.getOwnPropertyDescriptors(e);return Object.values(A).forEach(t=>{t.configurable=!0}),Object.create(aD(e),A)},SR=e=>e[RR]||e,kG=(e,A,t,n)=>{if(!_G(e))return e;let i=n&&n.get(e);if(!i){const a=SR(e);i=(l=>Object.values(Object.getOwnPropertyDescriptors(l)).some(I=>!I.configurable&&!I.writable))(a)?[a,gj(a)]:[a],n==null||n.set(e,i)}const[r,s]=i;let o=t&&t.get(r);return o&&o[1].f===!!s||(o=((a,l)=>{const I={f:l};let u=!1;const C=(d,m)=>{if(!u){let p=I[pu].get(a);if(p||(p={},I[pu].set(a,p)),d===ju)p[ju]=!0;else{let f=p[d];f||(f=new Set,p[d]=f),f.add(m)}}},h={get:(d,m)=>m===RR?a:(C("k",m),kG(Reflect.get(d,m),I[pu],I.c,I.t)),has:(d,m)=>m===aj?(u=!0,I[pu].delete(a),!0):(C("h",m),Reflect.has(d,m)),getOwnPropertyDescriptor:(d,m)=>(C("o",m),Reflect.getOwnPropertyDescriptor(d,m)),ownKeys:d=>(C(ju),Reflect.ownKeys(d))};return l&&(h.set=h.deleteProperty=()=>!1),[h,I]})(r,!!s),o[1].p=lj(s||r,o[0]),t&&t.set(r,o)),o[1][pu]=A,o[1].c=t,o[1].t=n,o[1].p},LG=(e,A,t,n,i=Object.is)=>{if(i(e,A))return!1;if(!uB(e)||!uB(A))return!0;const r=t.get(SR(e));if(!r)return!0;if(n){const o=n.get(e);if(o&&o.n===A)return o.g;n.set(e,{n:A,g:!1})}let s=null;try{for(const o of r.h||[])if(s=Reflect.has(e,o)!==Reflect.has(A,o),s)return s;if(r[ju]===!0){if(s=((o,a)=>{const l=Reflect.ownKeys(o),I=Reflect.ownKeys(a);return l.length!==I.length||l.some((u,C)=>u!==I[C])})(e,A),s)return s}else for(const o of r.o||[])if(s=!!Reflect.getOwnPropertyDescriptor(e,o)!=!!Reflect.getOwnPropertyDescriptor(A,o),s)return s;for(const o of r.k||[])if(s=LG(e[o],A[o],t,n,i),s)return s;return s===null&&(s=!0),s}finally{n&&n.set(e,{n:A,g:s})}},cj=e=>_G(e)&&e[RR]||null,m2=(e,A=!0)=>{lD.set(e,A)},Ij=(e,A,t)=>{const n=[],i=new WeakSet,r=(s,o)=>{if(i.has(s))return;uB(s)&&i.add(s);const a=uB(s)&&A.get(SR(s));if(a){var l,I;if((l=a.h)==null||l.forEach(C=>{const h=`:has(${String(C)})`;n.push(o?[...o,h]:[h])}),a[ju]===!0){const C=":ownKeys";n.push(o?[...o,C]:[C])}else{var u;(u=a.o)==null||u.forEach(C=>{const h=`:hasOwn(${String(C)})`;n.push(o?[...o,h]:[h])})}(I=a.k)==null||I.forEach(C=>{t&&!("value"in(Object.getOwnPropertyDescriptor(s,C)||{}))||r(s[C],o?[...o,C]:[C])})}else o&&n.push(o)};return r(e),n};var CB={ZSS_LANG_DEV:"false",ZSS_STATS_DEV:"false",ZSS_SHOW_CODE:"false",ZSS_BRANCH_NAME:"main",ZSS_BRANCH_VERSION:"0.12.0",ZSS_COMMIT_HASH:"2dc973ac8b828d1cd3f51e0e32663e1cc2018c83",ZSS_COMMIT_MESSAGE:"automation changes",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Ym=e=>typeof e=="object"&&e!==null,ra=new WeakMap,PE=new WeakSet,uj=(e=Object.is,A=(l,I)=>new Proxy(l,I),t=l=>Ym(l)&&!PE.has(l)&&(Array.isArray(l)||!(Symbol.iterator in l))&&!(l instanceof WeakMap)&&!(l instanceof WeakSet)&&!(l instanceof Error)&&!(l instanceof Number)&&!(l instanceof Date)&&!(l instanceof String)&&!(l instanceof RegExp)&&!(l instanceof ArrayBuffer),n=l=>{switch(l.status){case"fulfilled":return l.value;case"rejected":throw l.reason;default:throw l}},i=new WeakMap,r=(l,I,u=n)=>{const C=i.get(l);if((C==null?void 0:C[0])===I)return C[1];const h=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l));return m2(h,!0),i.set(l,[I,h]),Reflect.ownKeys(l).forEach(d=>{if(Object.getOwnPropertyDescriptor(h,d))return;const m=Reflect.get(l,d),{enumerable:p}=Reflect.getOwnPropertyDescriptor(l,d),f={value:m,enumerable:p,configurable:!0};if(PE.has(m))m2(m,!1);else if(m instanceof Promise)delete f.value,f.get=()=>u(m);else if(ra.has(m)){const[Q,B]=ra.get(m);f.value=r(Q,B(),u)}Object.defineProperty(h,d,f)}),Object.preventExtensions(h)},s=new WeakMap,o=[1,1],a=l=>{if(!Ym(l))throw new Error("object required");const I=s.get(l);if(I)return I;let u=o[0];const C=new Set,h=(S,N=++o[0])=>{u!==N&&(u=N,C.forEach(F=>F(S,N)))};let d=o[1];const m=(S=++o[1])=>(d!==S&&!C.size&&(d=S,f.forEach(([N])=>{const F=N[1](S);F>u&&(u=F)})),u),p=S=>(N,F)=>{const K=[...N];K[1]=[S,...K[1]],h(K,F)},f=new Map,Q=(S,N)=>{if((CB?"production":void 0)!=="production"&&f.has(S))throw new Error("prop listener already exists");if(C.size){const F=N[3](p(S));f.set(S,[N,F])}else f.set(S,[N])},B=S=>{var N;const F=f.get(S);F&&(f.delete(S),(N=F[1])==null||N.call(F))},w=S=>(C.add(S),C.size===1&&f.forEach(([F,K],z)=>{if((CB?"production":void 0)!=="production"&&K)throw new Error("remove already exists");const P=F[3](p(z));f.set(z,[F,P])}),()=>{C.delete(S),C.size===0&&f.forEach(([F,K],z)=>{K&&(K(),f.set(z,[F]))})}),R=Array.isArray(l)?[]:Object.create(Object.getPrototypeOf(l)),x=A(R,{deleteProperty(S,N){const F=Reflect.get(S,N);B(N);const K=Reflect.deleteProperty(S,N);return K&&h(["delete",[N],F]),K},set(S,N,F,K){const z=Reflect.has(S,N),P=Reflect.get(S,N,K);if(z&&(e(P,F)||s.has(F)&&e(P,s.get(F))))return!0;B(N),Ym(F)&&(F=cj(F)||F);let $=F;if(F instanceof Promise)F.then(eA=>{F.status="fulfilled",F.value=eA,h(["resolve",[N],eA])}).catch(eA=>{F.status="rejected",F.reason=eA,h(["reject",[N],eA])});else{!ra.has(F)&&t(F)&&($=a(F));const eA=!PE.has($)&&ra.get($);eA&&Q(N,eA)}return Reflect.set(S,N,$,K),h(["set",[N],F,P]),!0}});s.set(l,x);const U=[R,m,r,w];return ra.set(x,U),Reflect.ownKeys(l).forEach(S=>{const N=Object.getOwnPropertyDescriptor(l,S);"value"in N&&(x[S]=l[S],delete N.value,delete N.writable),Object.defineProperty(R,S,N)}),x})=>[a,ra,PE,e,A,t,n,i,r,s,o],[Cj]=uj();function vR(e={}){return Cj(e)}function hj(e,A,t){const n=ra.get(e);(CB?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let i;const r=[],s=n[3];let o=!1;const l=s(I=>{if(r.push(I),t){A(r.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,o&&A(r.splice(0))}))});return o=!0,()=>{o=!1,l()}}function y2(e,A){const t=ra.get(e);(CB?"production":void 0)!=="production"&&!t&&console.warn("Please use proxy object");const[n,i,r]=t;return r(n,i(),A)}var fj={ZSS_LANG_DEV:"false",ZSS_STATS_DEV:"false",ZSS_SHOW_CODE:"false",ZSS_BRANCH_NAME:"main",ZSS_BRANCH_VERSION:"0.12.0",ZSS_COMMIT_HASH:"2dc973ac8b828d1cd3f51e0e32663e1cc2018c83",ZSS_COMMIT_MESSAGE:"automation changes",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{use:w2}=tC,{useSyncExternalStore:Ej}=_q,dj=(e,A)=>{const t=V.useRef();V.useEffect(()=>{t.current=Ij(e,A,!0)}),V.useDebugValue(t.current)},Bj=new WeakMap;function _Q(e,A){const t=A==null?void 0:A.sync,n=V.useRef(),i=V.useRef();let r=!0;const s=Ej(V.useCallback(l=>{const I=hj(e,l,t);return l(),I},[e,t]),()=>{const l=y2(e,w2);try{if(!r&&n.current&&i.current&&!LG(n.current,l,i.current,new WeakMap))return n.current}catch{}return l},()=>y2(e,w2));r=!1;const o=new WeakMap;V.useEffect(()=>{n.current=s,i.current=o}),(fj?"production":void 0)!=="production"&&dj(s,o);const a=V.useMemo(()=>new WeakMap,[]);return kG(s,o,a,Bj)}let Jm=!1;const Gr=vR({state:{player:"",layers:[],layout:[],layoutreset:!1,layoutfocus:""}}),Hm=UQ("gadgetclient",["ready","second"],e=>{switch(e.target){case"ready":e.player&&Gr.state.player===""&&(Gr.state.player=e.player,Hm.emit("vm:login",void 0,Gr.state.player));break;case"second":Gr.state.player&&Hm.emit("vm:doot",void 0,Gr.state.player);break;case"reset":e.player===Gr.state.player&&(Jm=!1,Gr.state=e.data);break;case"patch":if(e.player===Gr.state.player&&!Jm)try{FQ(Gr.state,e.data,!0)}catch(A){A instanceof wR&&(Jm=!0,Hm.reply(e,"desync",void 0,Gr.state.player))}break}});function Qj(){return Gr.state}var pj=function(A,t,n,i){var r=n?n.call(i,A,t):void 0;if(r!==void 0)return!!r;if(A===t)return!0;if(typeof A!="object"||!A||typeof t!="object"||!t)return!1;var s=Object.keys(A),o=Object.keys(t);if(s.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),l=0;lA in e?bG(e,A,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[A]=t,kt=(e,A)=>{for(var t in A||(A={}))Nj.call(A,t)&&M2(e,t,A[t]);if(D2)for(var t of D2(A))xj.call(A,t)&&M2(e,t,A[t]);return e},Tj=(e,A)=>Sj(e,vj(A)),Ps=(e,A)=>{for(var t in A)bG(e,t,{get:A[t],enumerable:!0})},NR={};Ps(NR,{_1:()=>OG,_2:()=>PG,_3:()=>JG,_4:()=>HG,_5:()=>KG,_6:()=>VG,_7:()=>zG,_8:()=>WG,__1:()=>xR,__2:()=>YG,__3:()=>Uj,__4:()=>Fj,__5:()=>_j,__6:()=>kj,__7:()=>Lj,__8:()=>Gj,app:()=>ke});function R2(e,A,t){for(var n=new Array(t),i=0,r=A;i=0)return function(a,l){return function(I){return ke(a,l.concat([I]))}}(n,t);A=R2(t,r,-o|0),e=n.apply(null,R2(t,0,r))}}function OG(e,A){var t=e.length;if(t===1)return e(A);switch(t){case 1:return e(A);case 2:return function(n){return e(A,n)};case 3:return function(n,i){return e(A,n,i)};case 4:return function(n,i,r){return e(A,n,i,r)};case 5:return function(n,i,r,s){return e(A,n,i,r,s)};case 6:return function(n,i,r,s,o){return e(A,n,i,r,s,o)};case 7:return function(n,i,r,s,o,a){return e(A,n,i,r,s,o,a)};default:return ke(e,[A])}}function xR(e){var A=e.length;return A===1?e:function(t){return OG(e,t)}}function PG(e,A,t){var n=e.length;if(n===2)return e(A,t);switch(n){case 1:return ke(e(A),[t]);case 2:return e(A,t);case 3:return function(i){return e(A,t,i)};case 4:return function(i,r){return e(A,t,i,r)};case 5:return function(i,r,s){return e(A,t,i,r,s)};case 6:return function(i,r,s,o){return e(A,t,i,r,s,o)};case 7:return function(i,r,s,o,a){return e(A,t,i,r,s,o,a)};default:return ke(e,[A,t])}}function YG(e){var A=e.length;return A===2?e:function(t,n){return PG(e,t,n)}}function JG(e,A,t,n){var i=e.length;if(i===3)return e(A,t,n);switch(i){case 1:return ke(e(A),[t,n]);case 2:return ke(e(A,t),[n]);case 3:return e(A,t,n);case 4:return function(r){return e(A,t,n,r)};case 5:return function(r,s){return e(A,t,n,r,s)};case 6:return function(r,s,o){return e(A,t,n,r,s,o)};case 7:return function(r,s,o,a){return e(A,t,n,r,s,o,a)};default:return ke(e,[A,t,n])}}function Uj(e){var A=e.length;return A===3?e:function(t,n,i){return JG(e,t,n,i)}}function HG(e,A,t,n,i){var r=e.length;if(r===4)return e(A,t,n,i);switch(r){case 1:return ke(e(A),[t,n,i]);case 2:return ke(e(A,t),[n,i]);case 3:return ke(e(A,t,n),[i]);case 4:return e(A,t,n,i);case 5:return function(s){return e(A,t,n,i,s)};case 6:return function(s,o){return e(A,t,n,i,s,o)};case 7:return function(s,o,a){return e(A,t,n,i,s,o,a)};default:return ke(e,[A,t,n,i])}}function Fj(e){var A=e.length;return A===4?e:function(t,n,i,r){return HG(e,t,n,i,r)}}function KG(e,A,t,n,i,r){var s=e.length;if(s===5)return e(A,t,n,i,r);switch(s){case 1:return ke(e(A),[t,n,i,r]);case 2:return ke(e(A,t),[n,i,r]);case 3:return ke(e(A,t,n),[i,r]);case 4:return ke(e(A,t,n,i),[r]);case 5:return e(A,t,n,i,r);case 6:return function(o){return e(A,t,n,i,r,o)};case 7:return function(o,a){return e(A,t,n,i,r,o,a)};default:return ke(e,[A,t,n,i,r])}}function _j(e){var A=e.length;return A===5?e:function(t,n,i,r,s){return KG(e,t,n,i,r,s)}}function VG(e,A,t,n,i,r,s){var o=e.length;if(o===6)return e(A,t,n,i,r,s);switch(o){case 1:return ke(e(A),[t,n,i,r,s]);case 2:return ke(e(A,t),[n,i,r,s]);case 3:return ke(e(A,t,n),[i,r,s]);case 4:return ke(e(A,t,n,i),[r,s]);case 5:return ke(e(A,t,n,i,r),[s]);case 6:return e(A,t,n,i,r,s);case 7:return function(a){return e(A,t,n,i,r,s,a)};default:return ke(e,[A,t,n,i,r,s])}}function kj(e){var A=e.length;return A===6?e:function(t,n,i,r,s,o){return VG(e,t,n,i,r,s,o)}}function zG(e,A,t,n,i,r,s,o){var a=e.length;if(a===7)return e(A,t,n,i,r,s,o);switch(a){case 1:return ke(e(A),[t,n,i,r,s,o]);case 2:return ke(e(A,t),[n,i,r,s,o]);case 3:return ke(e(A,t,n),[i,r,s,o]);case 4:return ke(e(A,t,n,i),[r,s,o]);case 5:return ke(e(A,t,n,i,r),[s,o]);case 6:return ke(e(A,t,n,i,r,s),[o]);case 7:return e(A,t,n,i,r,s,o);default:return ke(e,[A,t,n,i,r,s,o])}}function Lj(e){var A=e.length;return A===7?e:function(t,n,i,r,s,o,a){return zG(e,t,n,i,r,s,o,a)}}function WG(e,A,t,n,i,r,s,o,a){var l=e.length;if(l===8)return e(A,t,n,i,r,s,o,a);switch(l){case 1:return ke(e(A),[t,n,i,r,s,o,a]);case 2:return ke(e(A,t),[n,i,r,s,o,a]);case 3:return ke(e(A,t,n),[i,r,s,o,a]);case 4:return ke(e(A,t,n,i),[r,s,o,a]);case 5:return ke(e(A,t,n,i,r),[s,o,a]);case 6:return ke(e(A,t,n,i,r,s),[o,a]);case 7:return ke(e(A,t,n,i,r,s,o),[a]);default:return ke(e,[A,t,n,i,r,s,o,a])}}function Gj(e){var A=e.length;return A===8?e:function(t,n,i,r,s,o,a,l){return WG(e,t,n,i,r,s,o,a,l)}}var ZG={};Ps(ZG,{$$Map:()=>r9,$$Set:()=>s9,RenderDelegate:()=>o9,mount:()=>rb,renderWithDelegate:()=>a9,stepGarbageCollector:()=>l9,visit:()=>sb});var qG={};Ps(qG,{create:()=>nb,isNode:()=>n9,shallowCopy:()=>ib,symbol:()=>TR});function S2(e){var A=typeof e;return A==="undefined"?3:e===null?2:A==="number"?{TAG:0,_0:e}:A==="bigint"?{TAG:5,_0:e}:A==="string"?{TAG:1,_0:e}:A==="boolean"?e===!0?1:0:A==="symbol"?{TAG:4,_0:e}:A==="function"?{TAG:2,_0:e}:{TAG:3,_0:e}}function bj(e,A){switch(A){case 0:return typeof e>"u";case 1:return e===null;case 2:return typeof e=="boolean";case 3:return typeof e=="number";case 4:return typeof e=="string";case 5:return typeof e=="function";case 6:return typeof e=="object";case 7:return typeof e=="symbol";case 8:return typeof e=="bigint"}}function Oj(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function Pj(e){if(!(e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0))return e;var A=e.BS_PRIVATE_NESTED_SOME_NONE;if(A!==0)return{BS_PRIVATE_NESTED_SOME_NONE:A-1|0}}function Yj(e,A){return{hd:A,tl:e}}function Jj(e,A){for(;;){var t=A,n=e;if(!n)return t;var i={hd:n.hd,tl:0};t.tl=i,A=i,e=n.tl}}function Hj(e,A,t){for(;;){var n=A,i=e;if(!i)return;var r={hd:t(i.hd),tl:0};n.tl=r,A=r,e=i.tl}}function Kj(e,A,t,n){for(;;){var i=n,r=t,s=A;if(!r)return;var o={hd:e(s,r.hd),tl:0};i.tl=o,n=o,t=r.tl,A=s+1|0}}function Vj(e,A){if(!e)return A;var t={hd:e.hd,tl:0};return Jj(e.tl,t).tl=A,t}function zj(e,A){if(!e)return 0;var t={hd:A(e.hd),tl:0};return Hj(e.tl,t,A),t}function jG(e,A){return zj(e,xR(A))}function Wj(e,A){if(!e)return 0;var t={hd:A(0,e.hd),tl:0};return Kj(A,1,e.tl,t),t}function Zj(e,A){return Wj(e,YG(A))}function XG(e){for(var A=e,t=0;;){var n=t,i=A;if(!i)return n;t=n+1|0,A=i.tl}}function qj(e,A,t){for(;;){var n=t,i=A;if(!n)return;e[i]=n.hd,t=n.tl,A=i+1|0}}function $G(e){for(var A=e.length-1|0,t=0;;){var n=t,i=A;if(i<0)return n;t={hd:e[i],tl:n},A=i-1|0}}function jj(e){var A=XG(e),t=new Array(A);return qj(t,0,e),t}function Xj(e,A){for(;;){var t=e;if(!t)return;A(t.hd),e=t.tl}}function Ab(e,A){Xj(e,xR(A))}function $j(e,A,t){for(;;){var n=A,i=e;if(!i)return n;A=t(n,i.hd),e=i.tl}}function eb(e,A,t,n){for(let i in n)if(n.hasOwnProperty(i)){const r=n[i];(!t.hasOwnProperty(i)||!mj(t[i],r))&&((typeof r>"u"||r===null||typeof r=="number"&&isNaN(r)||typeof r=="number"&&!isFinite(r))&&console.warn(`Warning: applying a potentially erroneous property value. ${i}: ${r}`),e.setProperty(A,i,r),t[i]=r)}}function A9(e,A){if(A in e)return Oj(e[A])}function e9(e){if(e!==void 0)return Pj(e);throw new Error("getExn")}function v2(e,A,t,n){eb(e,A,t,n)}function tb(e,A){return Math.imul(e^A,16777619)}function Km(e,A){for(var t=e,n=0,i=A.length;n<=i;++n)t=tb(t,A.charCodeAt(n)|0);return t}function t9(e,A,t){var n=Km(-2128831035,e),i=A9(A,"key"),r=i!==void 0&&bj(i,4)?Km(n,i):Km(n,e9(JSON.stringify(A)));return $j(t,r,tb)&2147483647}var TR="__ELEM_NODE__";function nb(e,A,t){var n=$G(t),i=jG(n,function(r){return r.hash});return{symbol:TR,hash:t9(e,A,i),kind:e,props:A,children:n}}function n9(e){var A=S2(e);if(typeof A=="number"||A.TAG!==3)return!1;var t=S2(e.symbol);return typeof t=="number"||t.TAG!==1?!1:t._0===TR}function ib(e){return{symbol:e.symbol,hash:e.hash,kind:e.kind,props:Object.assign({},e.props),generation:{contents:0}}}function i9(e){return Array.from(e.values())}var r9={valuesArray:i9},s9={},o9={};function rb(e,A){var t=e.getNodeMap();if(t.has(A.hash)){var n=t.get(A.hash);v2(e,n.hash,n.props,A.props),n.generation.contents=0;return}e.createNode(A.hash,A.kind),v2(e,A.hash,{},A.props),Ab(A.children,function(i){e.appendChild(A.hash,i.hash)}),t.set(A.hash,ib(A))}function sb(e,A,t){for(;;){var n=t,i=function(o){A.add(o.hash)};if(!n)return;var r=n.tl,s=n.hd;if(A.has(s.hash)){t=r;continue}i(s),rb(e,s),t=Vj(s.children,r)}}function a9(e,A){var t=new Set,n=Zj($G(A),function(i,r){return nb("root",{channel:i},[r])});sb(e,t,n),e.activateRoots(jj(jG(n,function(i){return i.hash}))),e.commitUpdates()}function l9(e){var A=e.getNodeMap(),t=e.getTerminalGeneration(),n=Array.from(A.values()).reduce(function(i,r){return r.generation.contents=r.generation.contents+1|0,r.generation.contents>=t?(e.deleteNode(r.hash),Yj(i,r)):i},0);if(XG(n)>0)return e.commitUpdates(),Ab(n,function(i){A.delete(i.hash)})}var g9=NR,ob=ZG,c9=function(e,A){return g9._2(ob.renderWithDelegate,e,A)};ob.stepGarbageCollector;var I9=NR,UR=qG,ab=function(e,A,t){return I9._3(UR.create,e,A,t)},u9=UR.isNode;UR.shallowCopy;function X(e){return typeof e=="number"?ab("const",{value:e},[]):(Dj(TA(e),`Whoops, expecting a Node type here! Got: ${typeof e}`),e)}function TA(e){return u9(e)}function cA(e,A,t){return ab(e,A,t.map(X))}var gg={};Ps(gg,{accum:()=>E9,biquad:()=>J9,capture:()=>q9,constant:()=>lb,convolve:()=>R9,counter:()=>f9,delay:()=>L9,env:()=>_9,fft:()=>Z9,latch:()=>Q9,maxhold:()=>p9,meter:()=>V9,metro:()=>w9,mm1p:()=>O9,once:()=>m9,phasor:()=>d9,pole:()=>F9,prewarp:()=>b9,rand:()=>y9,sample:()=>D9,sampleseq:()=>T9,sampleseq2:()=>U9,scope:()=>W9,sdelay:()=>G9,seq:()=>S9,seq2:()=>v9,snapshot:()=>z9,sparseq:()=>N9,sparseq2:()=>x9,sr:()=>C9,svf:()=>P9,svfshelf:()=>Y9,syncphasor:()=>B9,table:()=>M9,tapIn:()=>H9,tapOut:()=>K9,time:()=>h9,z:()=>k9});function lb(e){return cA("const",e,[])}function C9(){return cA("sr",{},[])}function h9(){return cA("time",{},[])}function f9(e,A){return typeof e=="number"||TA(e)?cA("counter",{},[X(e)]):cA("counter",e,[X(A)])}function E9(e,A,t){return typeof e=="number"||TA(e)?cA("accum",{},[X(e),X(A)]):cA("accum",e,[X(A),X(t)])}function d9(e,A){return typeof e=="number"||TA(e)?cA("phasor",{},[X(e)]):cA("phasor",e,[X(A)])}function B9(e,A,t){return typeof e=="number"||TA(e)?cA("sphasor",{},[X(e),X(A)]):cA("sphasor",e,[X(A),X(t)])}function Q9(e,A,t){return typeof e=="number"||TA(e)?cA("latch",{},[X(e),X(A)]):cA("latch",e,[X(A),X(t)])}function p9(e,A,t){return typeof e=="number"||TA(e)?cA("maxhold",{},[X(e),X(A)]):cA("maxhold",e,[X(A),X(t)])}function m9(e,A){return typeof e=="number"||TA(e)?cA("once",{},[X(e)]):cA("once",e,[X(A)])}function y9(e){return typeof e<"u"?cA("rand",e,[]):cA("rand",{},[])}function w9(e){return typeof e<"u"?cA("metro",e,[]):cA("metro",{},[])}function D9(e,A,t){return cA("sample",e,[X(A),X(t)])}function M9(e,A){return cA("table",e,[X(A)])}function R9(e,A){return cA("convolve",e,[X(A)])}function S9(e,A,t){return cA("seq",e,[X(A),X(t)])}function v9(e,A,t){return cA("seq2",e,[X(A),X(t)])}function N9(e,A,t){return cA("sparseq",e,[X(A),X(t)])}function x9(e,A){return cA("sparseq2",e,[X(A)])}function T9(e,A){return cA("sampleseq",e,[X(A)])}function U9(e,A){return cA("sampleseq2",e,[X(A)])}function F9(e,A,t){return typeof e=="number"||TA(e)?cA("pole",{},[X(e),X(A)]):cA("pole",e,[X(A),X(t)])}function _9(e,A,t,n){return typeof e=="number"||TA(e)?cA("env",{},[X(e),X(A),X(t)]):cA("env",e,[X(A),X(t),X(n)])}function k9(e,A){return typeof e=="number"||TA(e)?cA("z",{},[X(e)]):cA("z",e,[X(A)])}function L9(e,A,t,n){return typeof e=="number"||TA(e)?cA("delay",{},[X(e),X(A),X(t)]):cA("delay",e,[X(A),X(t),X(n)])}function G9(e,A){return cA("sdelay",e,[X(A)])}function b9(e){return cA("prewarp",{},[e])}function O9(e,A,t){return typeof e=="number"||TA(e)?cA("mm1p",{},[X(e),X(A)]):cA("mm1p",e,[X(A),X(t)])}function P9(e,A,t,n){return typeof e=="number"||TA(e)?cA("svf",{},[X(e),X(A),X(t)]):cA("svf",e,[X(A),X(t),X(n)])}function Y9(e,A,t,n,i){return typeof e=="number"||TA(e)?cA("svfshelf",{},[X(e),X(A),X(t),X(n)]):cA("svfshelf",e,[X(A),X(t),X(n),X(i)])}function J9(e,A,t,n,i,r,s){return typeof e=="number"||TA(e)?cA("biquad",{},[X(e),X(A),X(t),X(n),X(i),X(r)]):cA("biquad",e,[X(A),X(t),X(n),X(i),X(r),X(s)])}function H9(e){return cA("tapIn",e,[])}function K9(e,A){return cA("tapOut",e,[X(A)])}function V9(e,A){return typeof e=="number"||TA(e)?cA("meter",{},[X(e)]):cA("meter",e,[X(A)])}function z9(e,A,t){return typeof e=="number"||TA(e)?cA("snapshot",{},[X(e),X(A)]):cA("snapshot",e,[X(A),X(t)])}function W9(e,...A){return typeof e=="number"||TA(e)?cA("scope",{},[e,...A].map(X)):cA("scope",e,A.map(X))}function Z9(e,A){return typeof e=="number"||TA(e)?cA("fft",{},[X(e)]):cA("fft",e,[X(A)])}function q9(e,A,t){return typeof e=="number"||TA(e)?cA("capture",{},[X(e),X(A)]):cA("capture",e,[X(A),X(t)])}var gb={};Ps(gb,{compress:()=>xX,skcompress:()=>TX});var cg={};Ps(cg,{abs:()=>gX,add:()=>BX,and:()=>EX,asinh:()=>eX,ceil:()=>rX,cos:()=>X9,div:()=>mX,eq:()=>fX,exp:()=>lX,floor:()=>sX,ge:()=>uX,geq:()=>CX,identity:()=>cb,le:()=>cX,leq:()=>IX,ln:()=>tX,log:()=>nX,log2:()=>iX,max:()=>DX,min:()=>wX,mod:()=>yX,mul:()=>pX,or:()=>dX,pow:()=>hX,round:()=>oX,sin:()=>j9,sqrt:()=>aX,sub:()=>QX,tan:()=>$9,tanh:()=>AX});function cb(e,A){return typeof e=="number"||TA(e)?cA("in",{},[X(e)]):typeof A=="number"||TA(A)?cA("in",e,[X(A)]):cA("in",e,[])}function j9(e,A){return typeof e=="number"||TA(e)?cA("sin",{},[X(e)]):cA("sin",e,[X(A)])}function X9(e,A){return typeof e=="number"||TA(e)?cA("cos",{},[X(e)]):cA("cos",e,[X(A)])}function $9(e,A){return typeof e=="number"||TA(e)?cA("tan",{},[X(e)]):cA("tan",e,[X(A)])}function AX(e,A){return typeof e=="number"||TA(e)?cA("tanh",{},[X(e)]):cA("tanh",e,[X(A)])}function eX(e,A){return typeof e=="number"||TA(e)?cA("asinh",{},[X(e)]):cA("asinh",e,[X(A)])}function tX(e,A){return typeof e=="number"||TA(e)?cA("ln",{},[X(e)]):cA("ln",e,[X(A)])}function nX(e,A){return typeof e=="number"||TA(e)?cA("log",{},[X(e)]):cA("log",e,[X(A)])}function iX(e,A){return typeof e=="number"||TA(e)?cA("log2",{},[X(e)]):cA("log2",e,[X(A)])}function rX(e,A){return typeof e=="number"||TA(e)?cA("ceil",{},[X(e)]):cA("ceil",e,[X(A)])}function sX(e,A){return typeof e=="number"||TA(e)?cA("floor",{},[X(e)]):cA("floor",e,[X(A)])}function oX(e,A){return typeof e=="number"||TA(e)?cA("round",{},[X(e)]):cA("round",e,[X(A)])}function aX(e,A){return typeof e=="number"||TA(e)?cA("sqrt",{},[X(e)]):cA("sqrt",e,[X(A)])}function lX(e,A){return typeof e=="number"||TA(e)?cA("exp",{},[X(e)]):cA("exp",e,[X(A)])}function gX(e,A){return typeof e=="number"||TA(e)?cA("abs",{},[X(e)]):cA("abs",e,[X(A)])}function cX(e,A,t){return typeof e=="number"||TA(e)?cA("le",{},[X(e),X(A)]):cA("le",e,[X(A),X(t)])}function IX(e,A,t){return typeof e=="number"||TA(e)?cA("leq",{},[X(e),X(A)]):cA("leq",e,[X(A),X(t)])}function uX(e,A,t){return typeof e=="number"||TA(e)?cA("ge",{},[X(e),X(A)]):cA("ge",e,[X(A),X(t)])}function CX(e,A,t){return typeof e=="number"||TA(e)?cA("geq",{},[X(e),X(A)]):cA("geq",e,[X(A),X(t)])}function hX(e,A,t){return typeof e=="number"||TA(e)?cA("pow",{},[X(e),X(A)]):cA("pow",e,[X(A),X(t)])}function fX(e,A,t){return typeof e=="number"||TA(e)?cA("eq",{},[X(e),X(A)]):cA("eq",e,[X(A),X(t)])}function EX(e,A,t){return typeof e=="number"||TA(e)?cA("and",{},[X(e),X(A)]):cA("and",e,[X(A),X(t)])}function dX(e,A,t){return typeof e=="number"||TA(e)?cA("or",{},[X(e),X(A)]):cA("or",e,[X(A),X(t)])}function BX(e,...A){return typeof e=="number"||TA(e)?cA("add",{},[e,...A].map(X)):cA("add",e,A.map(X))}function QX(e,...A){return typeof e=="number"||TA(e)?cA("sub",{},[e,...A].map(X)):cA("sub",e,A.map(X))}function pX(e,...A){return typeof e=="number"||TA(e)?cA("mul",{},[e,...A].map(X)):cA("mul",e,A.map(X))}function mX(e,...A){return typeof e=="number"||TA(e)?cA("div",{},[e,...A].map(X)):cA("div",e,A.map(X))}function yX(e,...A){return typeof e=="number"||TA(e)?cA("mod",{},[e,...A].map(X)):cA("mod",e,A.map(X))}function wX(e,...A){return typeof e=="number"||TA(e)?cA("min",{},[e,...A].map(X)):cA("min",e,A.map(X))}function DX(e,...A){return typeof e=="number"||TA(e)?cA("max",{},[e,...A].map(X)):cA("max",e,A.map(X))}var Eh={};Ps(Eh,{db2gain:()=>SX,gain2db:()=>vX,hann:()=>NX,ms2samps:()=>MX,select:()=>Ib,tau2pole:()=>RX});var Ht=kt(kt({},gg),cg);function MX(e){return Ht.mul(Ht.sr(),Ht.div(e,1e3))}function RX(e){return Ht.exp(Ht.div(-1,Ht.mul(e,Ht.sr())))}function SX(e){return Ht.pow(10,Ht.mul(e,1/20))}function vX(e){return Ib(Ht.ge(e,0),Ht.max(-120,Ht.mul(20,Ht.log(e))),-120)}function Ib(e,A,t){return Ht.add(Ht.mul(e,A),Ht.mul(Ht.sub(1,e),t))}function NX(e){return Ht.mul(.5,Ht.sub(1,Ht.cos(Ht.mul(2*Math.PI,e))))}var ve=kt(kt(kt({},gg),cg),Eh);function xX(e,A,t,n,i,r){const s=ve.env(ve.tau2pole(ve.mul(.001,e)),ve.tau2pole(ve.mul(.001,A)),i),o=ve.gain2db(s),a=ve.sub(1,ve.div(1,n)),l=ve.mul(a,ve.sub(t,o)),I=ve.min(0,l),u=ve.db2gain(I);return ve.mul(r,u)}function TX(e,A,t,n,i,r,s){const o=ve.env(ve.tau2pole(ve.mul(.001,e)),ve.tau2pole(ve.mul(.001,A)),r),a=ve.gain2db(o),l=ve.sub(t,ve.div(i,2)),I=ve.add(t,ve.div(i,2)),u=ve.and(ve.geq(a,l),ve.leq(a,I)),C=ve.sub(1,ve.div(1,n)),h=ve.select(u,ve.mul(ve.div(C,2),ve.mul(ve.div(ve.sub(a,l),i),ve.sub(l,a))),ve.mul(C,ve.sub(t,a))),d=ve.min(0,h),m=ve.db2gain(d);return ve.mul(s,m)}var ub={};Ps(ub,{adsr:()=>KX});var kQ={};Ps(kQ,{allpass:()=>OX,bandpass:()=>GX,dcblock:()=>FX,df11:()=>_X,highpass:()=>LX,highshelf:()=>JX,lowpass:()=>kX,lowshelf:()=>YX,notch:()=>bX,peak:()=>PX,pink:()=>HX,sm:()=>UX,smooth:()=>gD,zero:()=>FR});var ye=kt(kt(kt({},gg),cg),Eh);function gD(e,A,t){return typeof e=="number"||TA(e)?ye.pole(e,ye.mul(ye.sub(1,e),A)):ye.pole(e,A,ye.mul(ye.sub(1,A),t))}function UX(e,A){return typeof e=="number"||TA(e)?gD(ye.tau2pole(.02),e):gD(e,ye.tau2pole(.02),A)}function FR(e,A,t,n){let[i,r,s]=typeof e=="number"||TA(e)?[e,A,t]:[A,t,n];return ye.sub(ye.mul(i,s),ye.mul(r,ye.z(s)))}function FX(e,A){let t=typeof e=="number"||TA(e)?e:A;return ye.pole(.995,FR(1,1,t))}function _X(e,A,t,n,i){let[r,s,o,a]=typeof e=="number"||TA(e)?[e,A,t,n]:[A,t,n,i];return ye.pole(o,FR(r,s,a))}function kX(e,A,t,n){return typeof e=="number"||TA(e)?ye.svf({mode:"lowpass"},e,A,t):ye.svf(Object.assign({},e,{mode:"lowpass"}),A,t,n)}function LX(e,A,t,n){return typeof e=="number"||TA(e)?ye.svf({mode:"highpass"},e,A,t):ye.svf(Object.assign({},e,{mode:"highpass"}),A,t,n)}function GX(e,A,t,n){return typeof e=="number"||TA(e)?ye.svf({mode:"bandpass"},e,A,t):ye.svf(Object.assign({},e,{mode:"bandpass"}),A,t,n)}function bX(e,A,t,n){return typeof e=="number"||TA(e)?ye.svf({mode:"notch"},e,A,t):ye.svf(Object.assign({},e,{mode:"notch"}),A,t,n)}function OX(e,A,t,n){return typeof e=="number"||TA(e)?ye.svf({mode:"allpass"},e,A,t):ye.svf(Object.assign({},e,{mode:"allpass"}),A,t,n)}function PX(e,A,t,n,i){return typeof e=="number"||TA(e)?ye.svfshelf({mode:"peak"},e,A,t,n):ye.svfshelf(Object.assign({},e,{mode:"peak"}),A,t,n,i)}function YX(e,A,t,n,i){return typeof e=="number"||TA(e)?ye.svfshelf({mode:"lowshelf"},e,A,t,n):ye.svfshelf(Object.assign({},e,{mode:"lowshelf"}),A,t,n,i)}function JX(e,A,t,n,i){return typeof e=="number"||TA(e)?ye.svfshelf({mode:"highshelf"},e,A,t,n):ye.svfshelf(Object.assign({},e,{mode:"highshelf"}),A,t,n,i)}function HX(e,A){let t=typeof e=="number"||TA(e)?e:A;return((i,r,s)=>ye.min(r,ye.max(i,s)))(-1,1,ye.mul(ye.db2gain(-30),ye.add(ye.pole(.99765,ye.mul(t,.099046)),ye.pole(.963,ye.mul(t,.2965164)),ye.pole(.57,ye.mul(t,1.0526913)),ye.mul(.1848,t))))}var Lr=kt(kt(kt(kt({},gg),cg),kQ),Eh);function KX(e,A,t,n,i,r){let s=typeof e=="number"||TA(e)?[e,A,t,n,i]:[A,t,n,i,r],[o,a,l,I,u]=s,C=Lr.mul(o,Lr.sr()),h=Lr.le(Lr.counter(u),C),d=Lr.select(u,Lr.select(h,1,l),0),m=Lr.select(u,Lr.select(h,o,a),I),p=Lr.tau2pole(Lr.div(m,6.91));return Lr.smooth(p,d)}var Cb={};Ps(Cb,{blepsaw:()=>ZX,blepsquare:()=>qX,bleptriangle:()=>jX,cycle:()=>VX,noise:()=>uD,pinknoise:()=>XX,saw:()=>ID,square:()=>zX,train:()=>cD,triangle:()=>WX});var Ye=kt(kt(kt({},gg),cg),kQ);function cD(e,A){return typeof e=="number"||TA(e)?Ye.le(Ye.phasor(e,0),.5):Ye.le(Ye.phasor(e,A,0),.5)}function VX(e,A){return typeof e=="number"||TA(e)?Ye.sin(Ye.mul(2*Math.PI,Ye.phasor(e,0))):Ye.sin(Ye.mul(2*Math.PI,Ye.phasor(e,A,0)))}function ID(e,A){return typeof e=="number"||TA(e)?Ye.sub(Ye.mul(2,Ye.phasor(e,0)),1):Ye.sub(Ye.mul(2,Ye.phasor(e,A,0)),1)}function zX(e,A){return typeof e=="number"||TA(e)?Ye.sub(Ye.mul(2,cD(e)),1):Ye.sub(Ye.mul(2,cD(e,A)),1)}function WX(e,A){return typeof e=="number"||TA(e)?Ye.mul(2,Ye.sub(.5,Ye.abs(ID(e)))):Ye.mul(2,Ye.sub(.5,Ye.abs(ID(e,A))))}function ZX(e,A){let n=!(typeof e=="number"||TA(e))?A:e;return cA("blepsaw",{},[n])}function qX(e,A){let n=!(typeof e=="number"||TA(e))?A:e;return cA("blepsquare",{},[n])}function jX(e,A){let n=!(typeof e=="number"||TA(e))?A:e;return cA("bleptriangle",{},[n])}function uD(e){return typeof e>"u"?Ye.sub(Ye.mul(2,Ye.rand()),1):Ye.sub(Ye.mul(2,Ye.rand(e)),1)}function XX(e){return typeof e>"u"?Ye.pink(uD()):Ye.pink(uD(e))}var $X=class extends Rj{constructor(){super()}},Vm=Tj(kt(kt(kt(kt(kt(kt(kt({},gg),gb),ub),kQ),cg),Cb),Eh),{const:lb,in:cb}),nc={CREATE_NODE:0,DELETE_NODE:1,APPEND_CHILD:2,SET_PROPERTY:3,ACTIVATE_ROOTS:4,COMMIT_UPDATES:5},A6=class{constructor(){this.nodeMap=new Map,this.currentActiveRoots=new Set,this.clear()}clear(){this.nodesAdded=0,this.nodesRemoved=0,this.edgesAdded=0,this.propsWritten=0,this.batch={createNode:[],deleteNode:[],appendChild:[],setProperty:[],activateRoots:[],commitUpdates:[]}}getNodeMap(){return this.nodeMap}getTerminalGeneration(){return 4}createNode(e,A){this.nodesAdded++,this.batch.createNode.push([nc.CREATE_NODE,e,A])}deleteNode(e){this.nodesRemoved++,this.batch.deleteNode.push([nc.DELETE_NODE,e])}appendChild(e,A){this.edgesAdded++,this.batch.appendChild.push([nc.APPEND_CHILD,e,A])}setProperty(e,A,t){this.propsWritten++,this.batch.setProperty.push([nc.SET_PROPERTY,e,A,t])}activateRoots(e){e.length===this.currentActiveRoots.size&&e.every(t=>this.currentActiveRoots.has(t))||(this.batch.activateRoots.push([nc.ACTIVATE_ROOTS,e]),this.currentActiveRoots=new Set(e))}commitUpdates(){this.batch.commitUpdates.push([nc.COMMIT_UPDATES])}getPackedInstructions(){return[...this.batch.createNode,...this.batch.deleteNode,...this.batch.appendChild,...this.batch.setProperty,...this.batch.activateRoots,...this.batch.commitUpdates]}};function N2(){return typeof performance>"u"?Date.now():performance.now()}var e6=class{constructor(e){this._delegate=new A6,this._sendMessage=e,this._nextRefId=0}createRef(e,A,t){let n=`__refKey:${this._nextRefId++}`,i=cA(e,Object.assign({key:n},A),t);return[i,s=>{if(!this._delegate.nodeMap.has(i.hash))throw new Error("Cannot update a ref that has not been mounted; make sure you render your node first");const o=this._delegate.nodeMap.get(i.hash);this._delegate.clear(),eb(this._delegate,i.hash,o.props,s),this._delegate.commitUpdates();const a=this._delegate.getPackedInstructions();return Promise.resolve(this._sendMessage(a))}]}render(...e){const A=N2();this._delegate.clear(),c9(this._delegate,e.map(X));const t=N2(),n=this._delegate.getPackedInstructions();return Promise.resolve(this._sendMessage(n)).then(i=>({result:i,nodesAdded:this._delegate.nodesAdded,edgesAdded:this._delegate.edgesAdded,propsWritten:this._delegate.propsWritten,elapsedTimeMs:t-A}))}};function t6(e,A){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&A.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);iA())))}(A,I,g)}var r,X=A=>{throw new q(A.O.S.P.name+" instance already deleted")},m=!1,x=()=>{},e=(A,I,g)=>I===g?A:void 0===g.U||null===(A=e(A,I,g.U))?null:g.pa(A),z={},P=[],p=()=>{for(;P.length;){var A=P.pop();A.O.aa=!1,A.delete()}},u={},v=(A,I)=>{if(!I.S||!I.R)throw new W("makeClassHandle requires ptr and ptrType");if(!!I.V!=!!I.T)throw new W("Both smartPtrType and smartPtr must be specified");return I.count={value:1},$(Object.create(A,{O:{value:I,writable:!0}}))},$=A=>"undefined"==typeof FinalizationRegistry?($=A=>A,A):(m=new FinalizationRegistry((A=>{--(A=A.O).count.value,0===A.count.value&&(A.T?A.V.Z(A.T):A.S.P.Z(A.R))})),x=A=>{m.unregister(A)},($=A=>{var I=A.O;return I.T&&m.register(A,{O:I},A),A})(A));function _(){}var AA=(A,I)=>Object.defineProperty(I,"name",{value:A}),IA=(A,I,g)=>{if(void 0===A[I].Y){var C=A[I];A[I]=function(){if(!A[I].Y.hasOwnProperty(arguments.length))throw new q(`Function \'${g}\' called with an invalid number of arguments (${arguments.length}) - expects one of (${A[I].Y})!`);return A[I].Y[arguments.length].apply(this,arguments)},A[I].Y=[],A[I].Y[C.ea]=C}};function gA(A,I,g,C,Q,B,E,D){this.name=A,this.constructor=I,this.ba=g,this.Z=C,this.U=Q,this.qa=B,this.da=E,this.pa=D,this.va=[]}var CA=(A,I,g)=>{for(;I!==g;){if(!I.da)throw new q(`Expected null or instance of ${g.name}, got an instance of ${I.name}`);A=I.da(A),I=I.U}return A};function QA(A,I){if(null===I){if(this.ha)throw new q(`null is not a valid ${this.name}`);return 0}if(!I.O)throw new q(`Cannot pass "${TA(I)}" as a ${this.name}`);if(!I.O.R)throw new q(`Cannot pass deleted object as a pointer of type ${this.name}`);return CA(I.O.R,I.O.S.P,this.P)}function BA(A,I){if(null===I){if(this.ha)throw new q(`null is not a valid ${this.name}`);if(this.ga){var g=this.wa();return null!==A&&A.push(this.Z,g),g}return 0}if(!I||!I.O)throw new q(`Cannot pass "${TA(I)}" as a ${this.name}`);if(!I.O.R)throw new q(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.fa&&I.O.S.fa)throw new q(`Cannot convert argument of type ${I.O.V?I.O.V.name:I.O.S.name} to parameter type ${this.name}`);if(g=CA(I.O.R,I.O.S.P,this.P),this.ga){if(void 0===I.O.T)throw new q("Passing raw pointer to smart pointer is illegal");switch(this.ya){case 0:if(I.O.V!==this)throw new q(`Cannot convert argument of type ${I.O.V?I.O.V.name:I.O.S.name} to parameter type ${this.name}`);g=I.O.T;break;case 1:g=I.O.T;break;case 2:if(I.O.V===this)g=I.O.T;else{var C=I.clone();g=this.xa(g,LA((()=>C.delete()))),null!==A&&A.push(this.Z,g)}break;default:throw new q("Unsupporting sharing policy")}}return g}function EA(A,I){if(null===I){if(this.ha)throw new q(`null is not a valid ${this.name}`);return 0}if(!I.O)throw new q(`Cannot pass "${TA(I)}" as a ${this.name}`);if(!I.O.R)throw new q(`Cannot pass deleted object as a pointer of type ${this.name}`);if(I.O.S.fa)throw new q(`Cannot convert argument of type ${I.O.S.name} to parameter type ${this.name}`);return CA(I.O.R,I.O.S.P,this.P)}function DA(A){return this.fromWireType(F[A>>2])}function iA(A,I,g,C,Q,B,E,D,i,w,R){this.name=A,this.P=I,this.ha=g,this.fa=C,this.ga=Q,this.ua=B,this.ya=E,this.ma=D,this.wa=i,this.xa=w,this.Z=R,Q||void 0!==I.U?this.toWireType=BA:(this.toWireType=C?QA:EA,this.W=null)}var wA,RA,oA=[],NA=A=>{var I=oA[A];return I||(A>=oA.length&&(oA.length=A+1),oA[A]=I=wA.get(A)),I},GA=(A,I)=>{var g=(A=d(A)).includes("j")?((A,I)=>{var g=[];return function(){if(g.length=0,Object.assign(g,arguments),A.includes("j")){var Q=C["dynCall_"+A];Q=g&&g.length?Q.apply(null,[I].concat(g)):Q.call(null,I)}else Q=NA(I).apply(null,g);return Q}})(A,I):NA(I);if("function"!=typeof g)throw new q(`unknown function pointer with signature ${A}: ${I}`);return g},FA=A=>{A=AI(A);var I=d(A);return II(A),I},UA=(A,I)=>{var g=[],C={};throw I.forEach((function A(I){C[I]||b[I]||(t[I]?t[I].forEach(A):(g.push(I),C[I]=!0))})),new RA(`${A}: `+g.map(FA).join([", "]))},MA=(A,I)=>{for(var g=[],C=0;C>2]);return g},JA=A=>{for(;A.length;){var I=A.pop();A.pop()(I)}};function yA(A){for(var I=1;IE)throw new q("argTypes array size mismatch! Must at least get return value and \'this\' types!");var D=null!==I[1]&&null!==g,i=yA(I);for(g="void"!==I[0].name,C=[O,C,Q,JA,I[0],I[1]],Q=0;Q{A>=SA.ja&&0==--SA.get(A).na&&(SA.X[A]=void 0,SA.ia.push(A))},cA=A=>{if(!A)throw new q("Cannot use deleted val. handle = "+A);return SA.get(A).value},LA=A=>{switch(A){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:A={na:1,value:A};var I=SA.ia.pop()||SA.X.length;return SA.X[I]=A,I}};function lA(A){return this.fromWireType(G[A>>2])}for(var HA={name:"emscripten::val",fromWireType:A=>{var I=cA(A);return KA(A),I},toWireType:(A,I)=>LA(I),argPackAdvance:8,readValueFromPointer:lA,W:null},TA=A=>{if(null===A)return"null";var I=typeof A;return"object"===I||"array"===I||"function"===I?A.toString():""+A},ZA=(A,I)=>{switch(I){case 4:return function(A){return this.fromWireType(U[A>>2])};case 8:return function(A){return this.fromWireType(M[A>>3])};default:throw new TypeError(`invalid float width (${I}): ${A}`)}},VA=(A,I,g)=>{switch(I){case 1:return g?A=>w[A>>0]:A=>R[A>>0];case 2:return g?A=>o[A>>1]:A=>N[A>>1];case 4:return g?A=>G[A>>2]:A=>F[A>>2];default:throw new TypeError(`invalid integer width (${I}): ${A}`)}},qA="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,WA="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,dA=(A,I)=>{for(var g=A>>1,C=g+I/2;!(g>=C)&&N[g];)++g;if(32<(g<<=1)-A&&WA)return WA.decode(R.subarray(A,g));for(g="",C=0;!(C>=I/2);++C){var Q=o[A+2*C>>1];if(0==Q)break;g+=String.fromCharCode(Q)}return g},jA=(A,I,g)=>{if(g??=2147483647,2>g)return 0;var C=I;g=(g-=2)<2*A.length?g/2:A.length;for(var Q=0;Q>1]=A.charCodeAt(Q),I+=2;return o[I>>1]=0,I-C},bA=A=>2*A.length,tA=(A,I)=>{for(var g=0,C="";!(g>=I/4);){var Q=G[A+4*g>>2];if(0==Q)break;++g,65536<=Q?(Q-=65536,C+=String.fromCharCode(55296|Q>>10,56320|1023&Q)):C+=String.fromCharCode(Q)}return C},OA=(A,I,g)=>{if(g??=2147483647,4>g)return 0;var C=I;g=C+g-4;for(var Q=0;Q=B)B=65536+((1023&B)<<10)|1023&A.charCodeAt(++Q);if(G[I>>2]=B,(I+=4)+4>g)break}return G[I>>2]=0,I-C},nA=A=>{for(var I=0,g=0;g=C&&++g,I+=4}return I},fA=(A,I)=>{var g=b[A];if(void 0===g)throw A=I+" has unknown type "+FA(A),new q(A);return g},rA=(A,I,g)=>{var C=[];return A=A.toWireType(C,g),C.length&&(F[I>>2]=LA(C)),A},XA=[],mA={},xA=A=>{var I=mA[A];return void 0===I?d(A):I},eA=()=>"object"==typeof globalThis?globalThis:Function("return this")(),zA=A=>(zA=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return A=>crypto.getRandomValues(A);c("initRandomDevice")})())(A),PA=Array(256),pA=0;256>pA;++pA)PA[pA]=String.fromCharCode(pA);V=PA,q=C.BindingError=class extends Error{constructor(A){super(A),this.name="BindingError"}},W=C.InternalError=class extends Error{constructor(A){super(A),this.name="InternalError"}},Object.assign(_.prototype,{isAliasOf:function(A){if(!(this instanceof _&&A instanceof _))return!1;var I=this.O.S.P,g=this.O.R;A.O=A.O;var C=A.O.S.P;for(A=A.O.R;I.U;)g=I.da(g),I=I.U;for(;C.U;)A=C.da(A),C=C.U;return I===C&&g===A},clone:function(){if(this.O.R||X(this),this.O.ca)return this.O.count.value+=1,this;var A=$,I=Object,g=I.create,C=Object.getPrototypeOf(this),Q=this.O;return(A=A(g.call(I,C,{O:{value:{count:Q.count,aa:Q.aa,ca:Q.ca,R:Q.R,S:Q.S,T:Q.T,V:Q.V}}}))).O.count.value+=1,A.O.aa=!1,A},delete(){if(this.O.R||X(this),this.O.aa&&!this.O.ca)throw new q("Object already scheduled for deletion");x(this);var A=this.O;--A.count.value,0===A.count.value&&(A.T?A.V.Z(A.T):A.S.P.Z(A.R)),this.O.ca||(this.O.T=void 0,this.O.R=void 0)},isDeleted:function(){return!this.O.R},deleteLater:function(){if(this.O.R||X(this),this.O.aa&&!this.O.ca)throw new q("Object already scheduled for deletion");return P.push(this),1===P.length&&r&&r(p),this.O.aa=!0,this}}),C.getInheritedInstanceCount=()=>Object.keys(u).length,C.getLiveInheritedInstances=()=>{var A,I=[];for(A in u)u.hasOwnProperty(A)&&I.push(u[A]);return I},C.flushPendingDeletes=p,C.setDelayFunction=A=>{r=A,P.length&&r&&r(p)},Object.assign(iA.prototype,{ra(A){return this.ma&&(A=this.ma(A)),A},la(A){this.Z?.(A)},argPackAdvance:8,readValueFromPointer:DA,fromWireType:function(A){function I(){return this.ga?v(this.P.ba,{S:this.ua,R:g,V:this,T:A}):v(this.P.ba,{S:this,R:A})}var g=this.ra(A);if(!g)return this.la(A),null;var C=((A,I)=>{if(void 0===I)throw new q("ptr should not be undefined");for(;A.U;)I=A.da(I),A=A.U;return u[I]})(this.P,g);if(void 0!==C)return 0===C.O.count.value?(C.O.R=g,C.O.T=A,C.clone()):(C=C.clone(),this.la(A),C);if(C=this.P.qa(g),!(C=z[C]))return I.call(this);C=this.fa?C.oa:C.pointerType;var Q=e(g,this.P,C.P);return null===Q?I.call(this):this.ga?v(C.P.ba,{S:C,R:Q,V:this,T:A}):v(C.P.ba,{S:C,R:Q})}}),RA=C.UnboundTypeError=(hA=Error,(aA=AA(kA="UnboundTypeError",(function(A){this.name=kA,this.message=A,void 0!==(A=Error(A).stack)&&(this.stack=this.toString()+"\\n"+A.replace(/^Error(:[^\\n]*)?\\n/,""))}))).prototype=Object.create(hA.prototype),aA.prototype.constructor=aA,aA.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},aA),SA.X.push({value:void 0},{value:null},{value:!0},{value:!1}),Object.assign(SA,{ja:SA.X.length}),C.count_emval_handles=()=>{for(var A=0,I=SA.ja;I{var C=new Z(A);throw F[C.R+16>>2]=0,F[C.R+4>>2]=I,F[C.R+8>>2]=g,A},x:()=>{},C:(A,I,g,C)=>{f(A,{name:I=d(I),fromWireType:function(A){return!!A},toWireType:function(A,I){return I?g:C},argPackAdvance:8,readValueFromPointer:function(A){return this.fromWireType(R[A])},W:null})},H:(A,I,g,Q,B,E,D,i,w,R,o,N,G)=>{o=d(o),E=GA(B,E),i&&=GA(D,i),R&&=GA(w,R),G=GA(N,G);var F=(A=>{if(void 0===A)return"_unknown";var I=(A=A.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return 48<=I&&57>=I?`_${A}`:A})(o);((A,I)=>{if(C.hasOwnProperty(A))throw new q(`Cannot register public name \'${A}\' twice`);C[A]=I})(F,(function(){UA(`Cannot construct ${o} due to unbound types`,[Q])})),n([A,I,g],Q?[Q]:[],(function(I){if(I=I[0],Q)var g=I.P,B=g.ba;else B=_.prototype;I=AA(o,(function(){if(Object.getPrototypeOf(this)!==D)throw new q("Use \'new\' to construct "+o);if(void 0===N.$)throw new q(o+" has no accessible constructor");var A=N.$[arguments.length];if(void 0===A)throw new q(`Tried to invoke ctor of ${o} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(N.$).toString()}) parameters instead!`);return A.apply(this,arguments)}));var D=Object.create(B,{constructor:{value:I}});I.prototype=D;var w,N=new gA(o,I,D,G,g,E,i,R);N.U&&((w=N.U).ka??(w.ka=[]),N.U.ka.push(N));return g=new iA(o,N,!0,!1,!1),w=new iA(o+"*",N,!1,!1,!1),B=new iA(o+" const*",N,!1,!0,!1),z[A]={pointerType:w,oa:B},((A,I)=>{if(!C.hasOwnProperty(A))throw new W("Replacing nonexistant public symbol");C[A]=I,C[A].ea=void 0})(F,I),[g,w,B]}))},G:(A,I,g,C,Q,B)=>{var E=MA(I,g);Q=GA(C,Q),n([],[A],(function(A){var g=`constructor ${(A=A[0]).name}`;if(void 0===A.P.$&&(A.P.$=[]),void 0!==A.P.$[I-1])throw new q(`Cannot register multiple constructors with identical number of parameters (${I-1}) for class \'${A.name}\'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return A.P.$[I-1]=()=>{UA(`Cannot construct ${A.name} due to unbound types`,E)},n([],E,(C=>(C.splice(1,0,null),A.P.$[I-1]=sA(g,C,null,Q,B),[]))),[]}))},e:(A,I,g,C,Q,B,E,D,i)=>{var w=MA(g,C);I=(A=>{const I=(A=A.trim()).indexOf("(");return-1!==I?A.substr(0,I):A})(I=d(I)),B=GA(Q,B),n([],[A],(function(A){function C(){UA(`Cannot call ${Q} due to unbound types`,w)}var Q=`${(A=A[0]).name}.${I}`;I.startsWith("@@")&&(I=Symbol[I.substring(2)]),D&&A.P.va.push(I);var R=A.P.ba,o=R[I];return void 0===o||void 0===o.Y&&o.className!==A.name&&o.ea===g-2?(C.ea=g-2,C.className=A.name,R[I]=C):(IA(R,I,Q),R[I].Y[g-2]=C),n([],w,(function(C){return C=sA(Q,C,A,B,E,i),void 0===R[I].Y?(C.ea=g-2,R[I]=C):R[I].Y[g-2]=C,[]})),[]}))},B:A=>f(A,HA),u:(A,I,g)=>{f(A,{name:I=d(I),fromWireType:A=>A,toWireType:(A,I)=>I,argPackAdvance:8,readValueFromPointer:ZA(I,g),W:null})},g:(A,I,g,C,Q)=>{if(I=d(I),-1===Q&&(Q=4294967295),Q=A=>A,0===C){var B=32-8*g;Q=A=>A<>>B}var E=I.includes("unsigned")?function(A,I){return I>>>0}:function(A,I){return I};f(A,{name:I,fromWireType:Q,toWireType:E,argPackAdvance:8,readValueFromPointer:VA(I,g,0!==C),W:null})},b:(A,I,g)=>{function C(A){return new Q(w.buffer,F[A+4>>2],F[A>>2])}var Q=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][I];f(A,{name:g=d(g),fromWireType:C,argPackAdvance:8,readValueFromPointer:C},{sa:!0})},t:(A,I)=>{var g="std::string"===(I=d(I));f(A,{name:I,fromWireType:function(A){var I=F[A>>2],C=A+4;if(g)for(var Q=C,B=0;B<=I;++B){var E=C+B;if(B==I||0==R[E]){if(Q){var D=Q,i=R,w=D+(E-Q);for(Q=D;i[Q]&&!(Q>=w);)++Q;if(16(o=224==(240&o)?(15&o)<<12|N<<6|G:(7&o)<<18|N<<12|G<<6|63&i[D++])?w+=String.fromCharCode(o):(o-=65536,w+=String.fromCharCode(55296|o>>10,56320|1023&o))}}else w+=String.fromCharCode(o)}D=w}}else D="";if(void 0===U)var U=D;else U+=String.fromCharCode(0),U+=D;Q=E+1}}else{for(U=Array(I),B=0;B=E?Q++:2047>=E?Q+=2:55296<=E&&57343>=E?(Q+=4,++C):Q+=3}else Q=I.length;if(E=(Q=_A(4+(C=Q)+1))+4,F[Q>>2]=C,g&&B){if(B=E,E=C+1,C=R,0=i)i=65536+((1023&i)<<10)|1023&I.charCodeAt(++D);if(127>=i){if(B>=E)break;C[B++]=i}else{if(2047>=i){if(B+1>=E)break;C[B++]=192|i>>6}else{if(65535>=i){if(B+2>=E)break;C[B++]=224|i>>12}else{if(B+3>=E)break;C[B++]=240|i>>18,C[B++]=128|i>>12&63}C[B++]=128|i>>6&63}C[B++]=128|63&i}}C[B]=0}}else if(B)for(B=0;B{if(g=d(g),2===I)var C=dA,Q=jA,B=bA,E=()=>N,D=1;else 4===I&&(C=tA,Q=OA,B=nA,E=()=>F,D=2);f(A,{name:g,fromWireType:A=>{for(var g,Q=F[A>>2],B=E(),i=A+4,w=0;w<=Q;++w){var R=A+4+w*I;w!=Q&&0!=B[R>>D]||(i=C(i,R-i),void 0===g?g=i:(g+=String.fromCharCode(0),g+=i),i=R+I)}return II(A),g},toWireType:(A,C)=>{if("string"!=typeof C)throw new q(`Cannot pass non-string to C++ string type ${g}`);var E=B(C),i=_A(4+E+I);return F[i>>2]=E>>D,Q(C,i+4,E+I),null!==A&&A.push(II,i),i},argPackAdvance:8,readValueFromPointer:lA,W(A){II(A)}})},D:(A,I)=>{f(A,{ta:!0,name:I=d(I),argPackAdvance:0,fromWireType:()=>{},toWireType:()=>{}})},k:(A,I,g)=>(A=cA(A),I=fA(I,"emval::as"),rA(I,g,A)),p:(A,I,g,C)=>(A=XA[A])(null,I=cA(I),g,C),s:(A,I,g,C,Q)=>(A=XA[A])(I=cA(I),I[g=xA(g)],C,Q),a:KA,j:A=>0===A?LA(eA()):(A=xA(A),LA(eA()[A])),h:(A,I,g)=>{I=((A,I)=>{for(var g=Array(A),C=0;C>2],"parameter "+C);return g})(A,I);var C=I.shift();A--;var Q="return function (obj, func, destructorsRef, args) {\\n",B=0,E=[];0===g&&E.push("obj");for(var D=["retType"],i=[C],w=0;wA.name)).join(", ")}) => ${C.name}>`,(A=>{var I=XA.length;return XA.push(A),I})(AA(g,A))},i:(A,I)=>(A=cA(A),I=cA(I),LA(A[I])),f:A=>{4(A=cA(A))instanceof(I=cA(I)),F:A=>"number"==typeof(A=cA(A)),E:A=>"string"==typeof(A=cA(A)),w:()=>LA([]),l:A=>LA(xA(A)),v:()=>LA({}),d:A=>{var I=cA(A);JA(I),KA(A)},n:(A,I,g)=>{A=cA(A),I=cA(I),g=cA(g),A[I]=g},c:(A,I)=>(A=(A=fA(A,"_emval_take_value")).readValueFromPointer(I),LA(A)),q:()=>{c("")},A:(A,I,g)=>R.copyWithin(A,I,I+g),z:A=>{var I=R.length;if(2147483648<(A>>>=0))return!1;for(var g=1;4>=g;g*=2){var C=I*(1+.2/g);C=Math.min(C,A+100663296);var Q=Math;C=Math.max(A,C);A:{Q=(Q.min.call(Q,2147483648,C+(65536-C%65536)%65536)-i.buffer.byteLength+65535)/65536;try{i.grow(Q),y();var B=1;break A}catch(A){}B=void 0}if(B)return!0}return!1},y:(A,I)=>(zA(R.subarray(A,A+I)),0)},$A=function(){function A(A){return $A=A.exports,i=$A.I,y(),wA=$A.L,s.unshift($A.J),a--,C.monitorRunDependencies?.(a),0==a&&(null!==S&&(clearInterval(S),S=null),K&&(A=K,K=null,A())),$A}var I={a:vA};if(a++,C.monitorRunDependencies?.(a),C.instantiateWasm)try{return C.instantiateWasm(I,A)}catch(A){D(`Module.instantiateWasm callback failed with error: ${A}`),g(A)}return I=function(A){if(L==L&&E)var I=new Uint8Array(E);else{if(l(I=L)){I=atob(I.slice(37));for(var g=new Uint8Array(I.length),C=0;CModule));';class s6 extends $X{initialize(A,t={},n=16){return ao(this,void 0,void 0,function*(){mu(typeof A=="object"&&A!==null,"First argument to initialize must be a valid AudioContext instance."),mu(typeof t=="object"&&t!==null,"The optional second argument to initialize must be an object."),typeof A._elemWorkletRegistry!="object"&&(A._elemWorkletRegistry={});const i=A._elemWorkletRegistry;if(!i.hasOwnProperty(zm)){const r=new Blob([r6,i6],{type:"text/javascript"}),s=URL.createObjectURL(r);if(!A.audioWorklet)throw new Error("BaseAudioContext.audioWorklet is missing; are you running in a secure context (https)?");yield A.audioWorklet.addModule(s),i[zm]=!0}return this._promiseMap=new Map,this._nextRequestId=0,this._worklet=new AudioWorkletNode(A,`ElementaryAudioWorkletProcessor@${zm}`,Object.assign({numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2]},t)),yield new Promise((r,s)=>{this._worklet.port.onmessage=o=>{const[a,l]=o.data;if(a==="load")return this._renderer=new e6(I=>ao(this,void 0,void 0,function*(){return yield this._sendWorkletRequest("renderInstructions",{batch:I})})),r(this._worklet),this.emit(a,l);if(a==="events")return l.forEach(I=>{this.emit(I.type,I.event)});if(a==="reply"){const{requestId:I,result:u}=l,{resolve:C,reject:h}=this._promiseMap.get(I);return this._promiseMap.delete(I),C(u)}},this._timer=window.setInterval(()=>{this._worklet.port.postMessage({requestType:"processQueuedEvents"})},n)})})}_sendWorkletRequest(A,t){mu(this._worklet,"Can't send request before worklet is ready. Have you initialized your WebRenderer instance?");let n=this._nextRequestId++;return this._worklet.port.postMessage({requestId:n,requestType:A,payload:t}),new Promise((i,r)=>{this._promiseMap.set(n,{resolve:i,reject:r})})}createRef(A,t,n){return this._renderer.createRef(A,t,n)}render(...A){return ao(this,void 0,void 0,function*(){const t=yield this._renderer.render(...A),{result:n}=t,i=t6(t,["result"]);return n.success?Promise.resolve(i):Promise.reject(n)})}updateVirtualFileSystem(A){return ao(this,void 0,void 0,function*(){return mu(typeof A=="object"&&A!==null,"Virtual file system must be an object mapping string type keys to Array|Float32Array type values"),Object.keys(A).forEach(function(n){const i=typeof A[n]=="object"&&(Array.isArray(A[n])||A[n]instanceof Float32Array);mu(i,"Virtual file system must be an object mapping string type keys to Array|Float32Array type values")}),yield this._sendWorkletRequest("updateSharedResourceMap",{resources:A})})}pruneVirtualFileSystem(){return ao(this,void 0,void 0,function*(){return yield this._sendWorkletRequest("pruneVirtualFileSystem",{})})}listVirtualFileSystem(){return ao(this,void 0,void 0,function*(){return yield this._sendWorkletRequest("listVirtualFileSystem",{})})}reset(){return ao(this,void 0,void 0,function*(){return yield this._sendWorkletRequest("reset",{})})}setCurrentTime(A){return ao(this,void 0,void 0,function*(){return yield this._sendWorkletRequest("setCurrentTime",{time:A})})}setCurrentTimeMs(A){return ao(this,void 0,void 0,function*(){return yield this._sendWorkletRequest("setCurrentTimeMs",{time:A})})}}const CD=new s6,YE=new AudioContext;function Wm(e){if(e){const A=Vm.round(Vm.mul(Vm.square(e),32));CD.render(A,A).catch(t=>console.error(t))}else CD.render().catch(A=>console.error(A))}async function o6(){YE.state==="suspended"&&await YE.resume(),(await CD.initialize(YE,{numberOfInputs:0,numberOfOutputs:1,outputChannelCount:[2]})).connect(YE.destination)}function hb(e){return e!=null}const a6=Object.keys;function l6(e){return typeof e=="number"}function g6(e){return typeof e=="string"}function c6(e){return Array.isArray(e)}const rt={time:0,volume:1,enabled:!0,blockqueueing:!1,currentpriority:0,durationcounter:0,buffer:[],bufferpos:0,isplaying:!1},fb=new Array(256).fill(0),I6=32,u6=Math.exp(Math.LN2/12);for(let e=1;e<=15;++e){let A=Math.exp(e*Math.LN2)*I6;for(let t=0;t<=11;++t)fb[e*16+t]=Math.floor(A),A*=u6}const C6={c:0,d:2,e:4,f:5,g:7,a:9,b:11},To=[];To.push([3200]);To.push(new Array(14).map((e,A)=>A*100+1e3));To.push(new Array(16).map((e,A)=>A%2*1600+1600+A%4*1600));To.push(new Array(14).map(()=>TQ(0,5e3)+500));const hD=new Array(14).fill(0);for(let e=0;e<7;++e)hD[e*2-1]=1600,hD[e*2]=TQ(0,1600)+800;To.push(hD);To.push(new Array(14).map((e,A)=>A%2*880+880+A%3*440));To.push(new Array(14).map((e,A)=>700-A*12));To.push(new Array(14).map((e,A)=>A*20+1200-TQ(0,A*40)));To.push(new Array(14).map(()=>TQ(0,440)+220));const x2=60/150/8;function h6(e){if(rt.time+=e,rt.time0))return;if(rt.bufferpos>=rt.buffer.length){Wm(0),rt.isplaying=!1;return}const A=rt.buffer[rt.bufferpos++];A===0?Wm(0):A<240&&Wm(fb[A]),rt.durationcounter=rt.buffer[rt.bufferpos++]}function f6(e){let A=0,t=3,n=1;const i=[];for(let r=0;r=0||!rt.isplaying?(rt.currentpriority=e,rt.buffer=t,rt.bufferpos=0,rt.durationcounter=1):(rt.buffer=rt.buffer.slice(rt.bufferpos),rt.bufferpos=0,rt.buffer.push(...t)),rt.isplaying=!0}let T2=performance.now();setInterval(()=>{const e=performance.now(),A=(e-T2)/1e3;T2=e,h6(A)},10);UQ("pcspeaker",[],e=>{switch(e.target){case"play":if(c6(e.data)){const[A,t]=e.data;l6(A)&&g6(t)&&E6(A,t)}break}});const U2=1,F2=2,Zm=4,qm=8,JC=32,Bo=64,Ki=128,LQ=31,fD=63,Ol=127,d6=2147483647,Ta=Math.floor,pd=Math.abs,Eb=(e,A)=>ee>A?e:A,db=e=>e!==0?e<0:1/e<0,Bb=Number.MAX_SAFE_INTEGER,B6=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Ta(e)===e),rI=()=>new Set,jm=e=>e[e.length-1],Q6=(e,A)=>{for(let t=0;te.toLowerCase(),y6=/^\s*/g,w6=e=>e.replace(y6,""),D6=/([A-Z])/g,_2=(e,A)=>w6(e.replace(D6,t=>`${A}${m6(t)}`)),M6=e=>{const A=unescape(encodeURIComponent(e)),t=A.length,n=new Uint8Array(t);for(let i=0;iHC.encode(e),S6=HC?R6:M6;let Xu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Xu&&Xu.decode(new Uint8Array).length===1&&(Xu=null);const Fa=e=>new Error(e),Ts=()=>{throw Fa("Method unimplemented")},_s=()=>{throw Fa("Unexpected case")};class dh{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const wa=()=>new dh,v6=e=>{let A=e.cpos;for(let t=0;t{const A=new Uint8Array(v6(e));let t=0;for(let n=0;n{const t=e.cbuf.length;t-e.cpos{const t=e.cbuf.length;e.cpos===t&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(t*2),e.cpos=0),e.cbuf[e.cpos++]=A},ED=Qn,Ue=(e,A)=>{for(;A>Ol;)Qn(e,Ki|Ol&A),A=Ta(A/128);Qn(e,Ol&A)},_R=(e,A)=>{const t=db(A);for(t&&(A=-A),Qn(e,(A>fD?Ki:0)|(t?Bo:0)|fD&A),A=Ta(A/64);A>0;)Qn(e,(A>Ol?Ki:0)|Ol&A),A=Ta(A/128)},dD=new Uint8Array(3e4),x6=dD.length/3,T6=(e,A)=>{if(A.length{const t=unescape(encodeURIComponent(A)),n=t.length;Ue(e,n);for(let i=0;i{const t=e.cbuf.length,n=e.cpos,i=Eb(t-n,A.length),r=A.length-i;e.cbuf.set(A.subarray(0,i),n),e.cpos+=i,r>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Ig(t*2,r)),e.cbuf.set(A.subarray(i)),e.cpos=r)},Jn=(e,A)=>{Ue(e,A.byteLength),GQ(e,A)},kR=(e,A)=>{N6(e,A);const t=new DataView(e.cbuf.buffer,e.cpos,A);return e.cpos+=A,t},F6=(e,A)=>kR(e,4).setFloat32(0,A,!1),_6=(e,A)=>kR(e,8).setFloat64(0,A,!1),k6=(e,A)=>kR(e,8).setBigInt64(0,A,!1),k2=new DataView(new ArrayBuffer(4)),L6=e=>(k2.setFloat32(0,e),k2.getFloat32(0)===e),KC=(e,A)=>{switch(typeof A){case"string":Qn(e,119),Lc(e,A);break;case"number":B6(A)&&pd(A)<=d6?(Qn(e,125),_R(e,A)):L6(A)?(Qn(e,124),F6(e,A)):(Qn(e,123),_6(e,A));break;case"bigint":Qn(e,122),k6(e,A);break;case"object":if(A===null)Qn(e,126);else if(p6(A)){Qn(e,117),Ue(e,A.length);for(let t=0;t0&&Ue(this,this.count-1),this.count=1,this.w(this,A),this.s=A)}}const G2=e=>{e.count>0&&(_R(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Ue(e.encoder,e.count-2))};class md{constructor(){this.encoder=new dh,this.s=0,this.count=0}write(A){this.s===A?this.count++:(G2(this),this.count=1,this.s=A)}toUint8Array(){return G2(this),zr(this.encoder)}}const b2=e=>{if(e.count>0){const A=e.diff*2+(e.count===1?0:1);_R(e.encoder,A),e.count>1&&Ue(e.encoder,e.count-2)}};class Xm{constructor(){this.encoder=new dh,this.s=0,this.count=0,this.diff=0}write(A){this.diff===A-this.s?(this.s=A,this.count++):(b2(this),this.count=1,this.diff=A-this.s,this.s=A)}toUint8Array(){return b2(this),zr(this.encoder)}}class G6{constructor(){this.sarr=[],this.s="",this.lensE=new md}write(A){this.s+=A,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(A.length)}toUint8Array(){const A=new dh;return this.sarr.push(this.s),this.s="",Lc(A,this.sarr.join("")),GQ(A,this.lensE.toUint8Array()),zr(A)}}const Qb=Fa("Unexpected end of array"),pb=Fa("Integer out of Range");class bQ{constructor(A){this.arr=A,this.pos=0}}const ug=e=>new bQ(e),b6=e=>e.pos!==e.arr.length,O6=(e,A)=>{const t=new Uint8Array(e.arr.buffer,e.pos+e.arr.byteOffset,A);return e.pos+=A,t},Ai=e=>O6(e,Fe(e)),sI=e=>e.arr[e.pos++],Fe=e=>{let A=0,t=1;const n=e.arr.length;for(;e.posBb)throw pb}throw Qb},LR=e=>{let A=e.arr[e.pos++],t=A&fD,n=64;const i=(A&Bo)>0?-1:1;if(!(A&Ki))return i*t;const r=e.arr.length;for(;e.posBb)throw pb}throw Qb},P6=e=>{let A=Fe(e);if(A===0)return"";{let t=String.fromCodePoint(sI(e));if(--A<100)for(;A--;)t+=String.fromCodePoint(sI(e));else for(;A>0;){const n=A<1e4?A:1e4,i=e.arr.subarray(e.pos,e.pos+n);e.pos+=n,t+=String.fromCodePoint.apply(null,i),A-=n}return decodeURIComponent(escape(t))}},Y6=e=>Xu.decode(Ai(e)),Gc=Xu?Y6:P6,GR=(e,A)=>{const t=new DataView(e.arr.buffer,e.arr.byteOffset+e.pos,A);return e.pos+=A,t},J6=e=>GR(e,4).getFloat32(0,!1),H6=e=>GR(e,8).getFloat64(0,!1),K6=e=>GR(e,8).getBigInt64(0,!1),V6=[e=>{},e=>null,LR,J6,H6,K6,e=>!1,e=>!0,Gc,e=>{const A=Fe(e),t={};for(let n=0;n{const A=Fe(e),t=[];for(let n=0;nV6[127-sI(e)](e);class O2 extends bQ{constructor(A,t){super(A),this.reader=t,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),b6(this)?this.count=Fe(this)+1:this.count=-1),this.count--,this.s}}class yd extends bQ{constructor(A){super(A),this.s=0,this.count=0}read(){if(this.count===0){this.s=LR(this);const A=db(this.s);this.count=1,A&&(this.s=-this.s,this.count=Fe(this)+2)}return this.count--,this.s}}class $m extends bQ{constructor(A){super(A),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const A=LR(this),t=A&1;this.diff=Ta(A/2),this.count=1,t&&(this.count=Fe(this)+2)}return this.s+=this.diff,this.count--,this.s}}class z6{constructor(A){this.decoder=new yd(A),this.str=Gc(this.decoder),this.spos=0}read(){const A=this.spos+this.decoder.read(),t=this.str.slice(this.spos,A);return this.spos=A,t}}const jr=()=>new Map,BD=e=>{const A=jr();return e.forEach((t,n)=>{A.set(n,t)}),A},za=(e,A,t)=>{let n=e.get(A);return n===void 0&&e.set(A,n=t()),n},W6=(e,A)=>{const t=[];for(const[n,i]of e)t.push(A(i,n));return t},Z6=(e,A)=>{for(const[t,n]of e)if(A(n,t))return!0;return!1};class q6{constructor(){this._observers=jr()}on(A,t){return za(this._observers,A,rI).add(t),t}once(A,t){const n=(...i)=>{this.off(A,n),t(...i)};this.on(A,n)}off(A,t){const n=this._observers.get(A);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(A))}emit(A,t){return Ua((this._observers.get(A)||jr()).values()).forEach(n=>n(...t))}destroy(){this._observers=jr()}}const j6=crypto.getRandomValues.bind(crypto),mb=()=>j6(new Uint32Array(1))[0],X6="10000000-1000-4000-8000"+-1e11,$6=()=>X6.replace(/[018]/g,e=>(e^mb()&15>>e/4).toString(16)),P2=e=>new Promise(e);Promise.all.bind(Promise);const Y2=e=>e===void 0?null:e;class A7{constructor(){this.map=new Map}setItem(A,t){this.map.set(A,t)}getItem(A){return this.map.get(A)}}let yb=new A7,e7=!0;try{typeof localStorage<"u"&&localStorage&&(yb=localStorage,e7=!1)}catch{}const t7=yb,n7=Object.assign,i7=Object.keys,r7=(e,A)=>{for(const t in e)A(e[t],t)},J2=e=>i7(e).length,s7=e=>{for(const A in e)return!1;return!0},o7=(e,A)=>{for(const t in e)if(!A(e[t],t))return!1;return!0},a7=(e,A)=>Object.prototype.hasOwnProperty.call(e,A),l7=(e,A)=>e===A||J2(e)===J2(A)&&o7(e,(t,n)=>(t!==void 0||a7(A,n))&&A[n]===t),bR=(e,A,t=0)=>{try{for(;te,c7=(e,A)=>A.includes(e);var wb={};const zC=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";let Qs;const I7=()=>{if(Qs===void 0)if(zC){Qs=jr();const e=process.argv;let A=null;for(let t=0;t{if(e.length!==0){const[A,t]=e.split("=");Qs.set(`--${_2(A,"-")}`,t),Qs.set(`-${_2(A,"-")}`,t)}})):Qs=jr();return Qs},QD=e=>I7().has(e),pD=e=>Y2(zC?wb[e.toUpperCase().replaceAll("-","_")]:t7.getItem(e)),u7=e=>QD("--"+e)||pD(e)!==null;u7("production");const H2=zC&&c7(wb.FORCE_COLOR,["true","1","2"]),C7=!QD("no-colors")&&(!zC||process.stdout.isTTY||H2)&&(!zC||QD("color")||H2||pD("COLORTERM")!==null||(pD("TERM")||"").includes("color")),h7=e=>new Uint8Array(e),f7=e=>{const A=h7(e.byteLength);return A.set(e),A};class E7{constructor(A,t){this.left=A,this.right=t}}const lo=(e,A)=>new E7(e,A);typeof DOMParser<"u"&&new DOMParser;const d7=e=>W6(e,(A,t)=>`${t}:${A};`).join(""),Uo=Symbol,Db=Uo(),Mb=Uo(),B7=Uo(),Q7=Uo(),p7=Uo(),Rb=Uo(),m7=Uo(),Sb=Uo(),y7=Uo(),w7=e=>{var n;e.length===1&&((n=e[0])==null?void 0:n.constructor)===Function&&(e=e[0]());const A=[];let t=0;for(;t{var s;e.length===1&&((s=e[0])==null?void 0:s.constructor)===Function&&(e=e[0]());const A=[],t=[],n=jr();let i=[],r=0;for(;r0||l.length>0?(A.push("%c"+o),t.push(l)):A.push(o)}else break}}for(r>0&&(i=t,i.unshift(A.join("")));r{console.log(...R7(e)),v7.forEach(A=>A.print(e))},v7=rI(),vb=e=>({[Symbol.iterator](){return this},next:e}),N7=(e,A)=>vb(()=>{let t;do t=e.next();while(!t.done&&!A(t.value));return t}),Ay=(e,A)=>vb(()=>{const{done:t,value:n}=e.next();return{done:t,value:t?void 0:A(n)}});class OR{constructor(A,t){this.clock=A,this.len=t}}class Bh{constructor(){this.clients=new Map}}const Nb=(e,A,t)=>A.clients.forEach((n,i)=>{const r=e.doc.store.clients.get(i);for(let s=0;s{let t=0,n=e.length-1;for(;t<=n;){const i=Ta((t+n)/2),r=e[i],s=r.clock;if(s<=A){if(A{const t=e.clients.get(A.client);return t!==void 0&&x7(t,A.clock)!==null},PR=e=>{e.clients.forEach(A=>{A.sort((i,r)=>i.clock-r.clock);let t,n;for(t=1,n=1;t=r.clock?i.len=Ig(i.len,r.clock+r.len-i.clock):(n{const A=new Bh;for(let t=0;t{if(!A.clients.has(i)){const r=n.slice();for(let s=t+1;s{za(e.clients,A,()=>[]).push(new OR(t,n))},U7=()=>new Bh,F7=e=>{const A=U7();return e.clients.forEach((t,n)=>{const i=[];for(let r=0;r0&&A.clients.set(n,i)}),A},MI=(e,A)=>{Ue(e.restEncoder,A.clients.size),Ua(A.clients.entries()).sort((t,n)=>n[0]-t[0]).forEach(([t,n])=>{e.resetDsCurVal(),Ue(e.restEncoder,t);const i=n.length;Ue(e.restEncoder,i);for(let r=0;r{const A=new Bh,t=Fe(e.restDecoder);for(let n=0;n0){const s=za(A.clients,i,()=>[]);for(let o=0;o{const n=new Bh,i=Fe(e.restDecoder);for(let r=0;r0){const r=new ql;return Ue(r.restEncoder,0),MI(r,n),r.toUint8Array()}return null},Tb=mb;class RI extends q6{constructor({guid:A=$6(),collectionid:t=null,gc:n=!0,gcFilter:i=()=>!0,meta:r=null,autoLoad:s=!1,shouldLoad:o=!0}={}){super(),this.gc=n,this.gcFilter=i,this.clientID=Tb(),this.guid=A,this.collectionid=t,this.share=new Map,this.store=new Pb,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=o,this.autoLoad=s,this.meta=r,this.isLoaded=!1,this.isSynced=!1,this.whenLoaded=P2(l=>{this.on("load",()=>{this.isLoaded=!0,l(this)})});const a=()=>P2(l=>{const I=u=>{(u===void 0||u===!0)&&(this.off("sync",I),l())};this.on("sync",I)});this.on("sync",l=>{l===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=l===void 0||l===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=a()}load(){const A=this._item;A!==null&&!this.shouldLoad&>(A.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Ua(this.subdocs).map(A=>A.guid))}transact(A,t=null){return gt(this,A,t)}get(A,t=Tn){const n=za(this.share,A,()=>{const r=new t;return r._integrate(this,null),r}),i=n.constructor;if(t!==Tn&&i!==t)if(i===Tn){const r=new t;r._map=n._map,n._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=r}),r._start=n._start;for(let s=r._start;s!==null;s=s.right)s.parent=r;return r._length=n._length,this.share.set(A,r),r._integrate(this,null),r}else throw new Error(`Type with the name ${A} has already been defined with a different constructor`);return n}getArray(A=""){return this.get(A,Oc)}getText(A=""){return this.get(A,jl)}getMap(A=""){return this.get(A,aI)}getXmlElement(A=""){return this.get(A,lI)}getXmlFragment(A=""){return this.get(A,Xl)}toJSON(){const A={};return this.share.forEach((t,n)=>{A[n]=t.toJSON()}),A}destroy(){Ua(this.subdocs).forEach(t=>t.destroy());const A=this._item;if(A!==null){this._item=null;const t=A.content;t.doc=new RI({guid:this.guid,...t.opts,shouldLoad:!1}),t.doc._item=A,gt(A.parent.doc,n=>{const i=t.doc;A.deleted||n.subdocsAdded.add(i),n.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class Ub{constructor(A){this.restDecoder=A}resetDsCurVal(){}readDsClock(){return Fe(this.restDecoder)}readDsLen(){return Fe(this.restDecoder)}}class Fb extends Ub{readLeftID(){return Oe(Fe(this.restDecoder),Fe(this.restDecoder))}readRightID(){return Oe(Fe(this.restDecoder),Fe(this.restDecoder))}readClient(){return Fe(this.restDecoder)}readInfo(){return sI(this.restDecoder)}readString(){return Gc(this.restDecoder)}readParentInfo(){return Fe(this.restDecoder)===1}readTypeRef(){return Fe(this.restDecoder)}readLen(){return Fe(this.restDecoder)}readAny(){return VC(this.restDecoder)}readBuf(){return f7(Ai(this.restDecoder))}readJSON(){return JSON.parse(Gc(this.restDecoder))}readKey(){return Gc(this.restDecoder)}}class _7{constructor(A){this.dsCurrVal=0,this.restDecoder=A}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Fe(this.restDecoder),this.dsCurrVal}readDsLen(){const A=Fe(this.restDecoder)+1;return this.dsCurrVal+=A,A}}class oI extends _7{constructor(A){super(A),this.keys=[],Fe(A),this.keyClockDecoder=new $m(Ai(A)),this.clientDecoder=new yd(Ai(A)),this.leftClockDecoder=new $m(Ai(A)),this.rightClockDecoder=new $m(Ai(A)),this.infoDecoder=new O2(Ai(A),sI),this.stringDecoder=new z6(Ai(A)),this.parentInfoDecoder=new O2(Ai(A),sI),this.typeRefDecoder=new yd(Ai(A)),this.lenDecoder=new yd(Ai(A))}readLeftID(){return new bc(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new bc(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return VC(this.restDecoder)}readBuf(){return Ai(this.restDecoder)}readJSON(){return VC(this.restDecoder)}readKey(){const A=this.keyClockDecoder.read();if(A{n=Ig(n,A[0].id.clock);const i=ks(A,n);Ue(e.restEncoder,A.length-i),e.writeClient(t),Ue(e.restEncoder,n);const r=A[i];r.write(e,n-r.id.clock);for(let s=i+1;s{const n=new Map;t.forEach((i,r)=>{yn(A,r)>i&&n.set(r,i)}),OQ(A).forEach((i,r)=>{t.has(r)||n.set(r,0)}),Ue(e.restEncoder,n.size),Ua(n.entries()).sort((i,r)=>r[0]-i[0]).forEach(([i,r])=>{k7(e,A.clients.get(i),i,r)})},L7=(e,A)=>{const t=jr(),n=Fe(e.restDecoder);for(let i=0;i{const n=[];let i=Ua(t.keys()).sort((h,d)=>h-d);if(i.length===0)return null;const r=()=>{if(i.length===0)return null;let h=t.get(i[i.length-1]);for(;h.refs.length===h.i;)if(i.pop(),i.length>0)h=t.get(i[i.length-1]);else return null;return h};let s=r();if(s===null)return null;const o=new Pb,a=new Map,l=(h,d)=>{const m=a.get(h);(m==null||m>d)&&a.set(h,d)};let I=s.refs[s.i++];const u=new Map,C=()=>{for(const h of n){const d=h.id.client,m=t.get(d);m?(m.i--,o.clients.set(d,m.refs.slice(m.i)),t.delete(d),m.i=0,m.refs=[]):o.clients.set(d,[h]),i=i.filter(p=>p!==d)}n.length=0};for(;;){if(I.constructor!==hr){const d=za(u,I.id.client,()=>yn(A,I.id.client))-I.id.clock;if(d<0)n.push(I),l(I.id.client,I.id.clock-1),C();else{const m=I.getMissing(e,A);if(m!==null){n.push(I);const p=t.get(m)||{refs:[],i:0};if(p.refs.length===p.i)l(m,yn(A,m)),C();else{I=p.refs[p.i++];continue}}else(d===0||d0)I=n.pop();else if(s!==null&&s.i0){const h=new ql;return JR(h,o,new Map),Ue(h.restEncoder,0),{missing:a,update:h.toUint8Array()}}return null},b7=(e,A)=>JR(e,A.doc.store,A.beforeState),O7=(e,A,t,n=new oI(e))=>gt(A,i=>{i.local=!1;let r=!1;const s=i.doc,o=s.store,a=L7(n,s),l=G7(i,o,a),I=o.pendingStructs;if(I){for(const[C,h]of I.missing)if(hh)&&I.missing.set(C,h)}I.update=fB([I.update,l.update])}}else o.pendingStructs=l;const u=K2(n,i,o);if(o.pendingDs){const C=new oI(ug(o.pendingDs));Fe(C.restDecoder);const h=K2(C,i,o);u&&h?o.pendingDs=fB([u,h]):o.pendingDs=u||h}else o.pendingDs=u;if(r){const C=o.pendingStructs.update;o.pendingStructs=null,Lb(i.doc,C)}},t,!1),Lb=(e,A,t,n=oI)=>{const i=ug(A);O7(i,e,t,new n(i))},P7=(e,A,t)=>Lb(e,A,t,Fb),Y7=(e,A,t=new Map)=>{JR(e,A.store,t),MI(e,F7(A.store))},J7=(e,A=new Uint8Array([0]),t=new ql)=>{const n=Gb(A);Y7(t,e,n);const i=[t.toUint8Array()];if(e.store.pendingDs&&i.push(e.store.pendingDs),e.store.pendingStructs&&i.push(r$(e.store.pendingStructs.update,A)),i.length>1){if(t.constructor===Qh)return n$(i.map((r,s)=>s===0?r:o$(r)));if(t.constructor===ql)return fB(i)}return i[0]},H7=(e,A)=>J7(e,A,new Qh),K7=e=>{const A=new Map,t=Fe(e.restDecoder);for(let n=0;nK7(new Ub(ug(e))),bb=(e,A)=>(Ue(e.restEncoder,A.size),Ua(A.entries()).sort((t,n)=>n[0]-t[0]).forEach(([t,n])=>{Ue(e.restEncoder,t),Ue(e.restEncoder,n)}),e),V7=(e,A)=>bb(e,OQ(A.store)),z7=(e,A=new kb)=>(e instanceof Map?bb(A,e):V7(A,e),A.toUint8Array()),W7=e=>z7(e,new _b);class Z7{constructor(){this.l=[]}}const V2=()=>new Z7,z2=(e,A)=>e.l.push(A),W2=(e,A)=>{const t=e.l,n=t.length;e.l=t.filter(i=>A!==i),n===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Ob=(e,A,t)=>bR(e.l,[A,t]);class bc{constructor(A,t){this.client=A,this.clock=t}}const JE=(e,A)=>e===A||e!==null&&A!==null&&e.client===A.client&&e.clock===A.clock,Oe=(e,A)=>new bc(e,A),q7=e=>{for(const[A,t]of e.doc.share.entries())if(t===e)return A;throw _s()},oc=(e,A)=>A===void 0?!e.deleted:A.sv.has(e.id.client)&&(A.sv.get(e.id.client)||0)>e.id.clock&&!xb(A.ds,e.id),mD=(e,A)=>{const t=za(e.meta,mD,rI),n=e.doc.store;t.has(A)||(A.sv.forEach((i,r)=>{i{}),t.add(A))};class Pb{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const OQ=e=>{const A=new Map;return e.clients.forEach((t,n)=>{const i=t[t.length-1];A.set(n,i.id.clock+i.length)}),A},yn=(e,A)=>{const t=e.clients.get(A);if(t===void 0)return 0;const n=t[t.length-1];return n.id.clock+n.length},Yb=(e,A)=>{let t=e.clients.get(A.id.client);if(t===void 0)t=[],e.clients.set(A.id.client,t);else{const n=t[t.length-1];if(n.id.clock+n.length!==A.id.clock)throw _s()}t.push(A)},ks=(e,A)=>{let t=0,n=e.length-1,i=e[n],r=i.id.clock;if(r===A)return n;let s=Ta(A/(r+i.length-1)*n);for(;t<=n;){if(i=e[s],r=i.id.clock,r<=A){if(A{const t=e.clients.get(A.client);return t[ks(t,A.clock)]},ey=j7,yD=(e,A,t)=>{const n=ks(A,t),i=A[n];return i.id.clock{const t=e.doc.store.clients.get(A.client);return t[yD(e,t,A.clock)]},Z2=(e,A,t)=>{const n=A.clients.get(t.client),i=ks(n,t.clock),r=n[i];return t.clock!==r.id.clock+r.length-1&&r.constructor!==Cr&&n.splice(i+1,0,mB(e,r,t.clock-r.id.clock+1)),r},X7=(e,A,t)=>{const n=e.clients.get(A.id.client);n[ks(n,A.id.clock)]=t},Jb=(e,A,t,n,i)=>{if(n===0)return;const r=t+n;let s=yD(e,A,t),o;do o=A[s++],rA.deleteSet.clients.size===0&&!Z6(A.afterState,(t,n)=>A.beforeState.get(n)!==t)?!1:(PR(A.deleteSet),b7(e,A),MI(e,A.deleteSet),!0),j2=(e,A,t)=>{const n=A._item;(n===null||n.id.clock<(e.beforeState.get(n.id.client)||0)&&!n.deleted)&&za(e.changed,A,rI).add(t)},wd=(e,A)=>{let t=e[A],n=e[A-1],i=A;for(;i>0;t=n,n=e[--i-1]){if(n.deleted===t.deleted&&n.constructor===t.constructor&&n.mergeWith(t)){t instanceof sn&&t.parentSub!==null&&t.parent._map.get(t.parentSub)===t&&t.parent._map.set(t.parentSub,n);continue}break}const r=A-i;return r&&e.splice(A+1-r,r),r},A$=(e,A,t)=>{for(const[n,i]of e.clients.entries()){const r=A.clients.get(n);for(let s=i.length-1;s>=0;s--){const o=i[s],a=o.clock+o.len;for(let l=ks(r,o.clock),I=r[l];l{e.clients.forEach((t,n)=>{const i=A.clients.get(n);for(let r=t.length-1;r>=0;r--){const s=t[r],o=Eb(i.length-1,1+ks(i,s.clock+s.len-1));for(let a=o,l=i[a];a>0&&l.id.clock>=s.clock;l=i[a])a-=1+wd(i,a)}})},Hb=(e,A)=>{if(Ao.push(()=>{(l._item===null||!l._item.deleted)&&l._callObserver(t,a)})),o.push(()=>{t.changedParentTypes.forEach((a,l)=>{l._dEH.l.length>0&&(l._item===null||!l._item.deleted)&&(a=a.filter(I=>I.target._item===null||!I.target._item.deleted),a.forEach(I=>{I.currentTarget=l,I._path=null}),a.sort((I,u)=>I.path.length-u.path.length),Ob(l._dEH,a,t))})}),o.push(()=>n.emit("afterTransaction",[t,n])),bR(o,[]),t._needFormattingCleanup&&p$(t)}finally{n.gc&&A$(r,i,n.gcFilter),e$(r,i),t.afterState.forEach((I,u)=>{const C=t.beforeState.get(u)||0;if(C!==I){const h=i.clients.get(u),d=Ig(ks(h,C),1);for(let m=h.length-1;m>=d;)m-=1+wd(h,m)}});for(let I=s.length-1;I>=0;I--){const{client:u,clock:C}=s[I].id,h=i.clients.get(u),d=ks(h,C);d+11||d>0&&wd(h,d)}if(!t.local&&t.afterState.get(n.clientID)!==t.beforeState.get(n.clientID)&&(S7(Sb,Db,"[yjs] ",Mb,Rb,"Changed the client-id because another client seems to be using it."),n.clientID=Tb()),n.emit("afterTransactionCleanup",[t,n]),n._observers.has("update")){const I=new Qh;q2(I,t)&&n.emit("update",[I.toUint8Array(),t.origin,n,t])}if(n._observers.has("updateV2")){const I=new ql;q2(I,t)&&n.emit("updateV2",[I.toUint8Array(),t.origin,n,t])}const{subdocsAdded:o,subdocsLoaded:a,subdocsRemoved:l}=t;(o.size>0||l.size>0||a.size>0)&&(o.forEach(I=>{I.clientID=n.clientID,I.collectionid==null&&(I.collectionid=n.collectionid),n.subdocs.add(I)}),l.forEach(I=>n.subdocs.delete(I)),n.emit("subdocs",[{loaded:a,added:o,removed:l},n,t]),l.forEach(I=>I.destroy())),e.length<=A+1?(n._transactionCleanups=[],n.emit("afterAllTransactions",[n,e])):Hb(e,A+1)}}},gt=(e,A,t=null,n=!0)=>{const i=e._transactionCleanups;let r=!1,s=null;e._transaction===null&&(r=!0,e._transaction=new $7(e,t,n),i.push(e._transaction),i.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{s=A(e._transaction)}finally{if(r){const o=e._transaction===i[0];e._transaction=null,o&&Hb(i,0)}}return s};function*t$(e){const A=Fe(e.restDecoder);for(let t=0;tfB(e,Fb,Qh),i$=(e,A)=>{if(e.constructor===Cr){const{client:t,clock:n}=e.id;return new Cr(Oe(t,n+A),e.length-A)}else if(e.constructor===hr){const{client:t,clock:n}=e.id;return new hr(Oe(t,n+A),e.length-A)}else{const t=e,{client:n,clock:i}=t.id;return new sn(Oe(n,i+A),null,Oe(n,i+A-1),null,t.rightOrigin,t.parent,t.parentSub,t.content.splice(A))}},fB=(e,A=oI,t=ql)=>{if(e.length===1)return e[0];const n=e.map(I=>new A(ug(I)));let i=n.map(I=>new HR(I,!0)),r=null;const s=new t,o=new KR(s);for(;i=i.filter(C=>C.curr!==null),i.sort((C,h)=>{if(C.curr.id.client===h.curr.id.client){const d=C.curr.id.clock-h.curr.id.clock;return d===0?C.curr.constructor===h.curr.constructor?0:C.curr.constructor===hr?1:-1:d}else return h.curr.id.client-C.curr.id.client}),i.length!==0;){const I=i[0],u=I.curr.id.client;if(r!==null){let C=I.curr,h=!1;for(;C!==null&&C.id.clock+C.length<=r.struct.id.clock+r.struct.length&&C.id.client>=r.struct.id.client;)C=I.next(),h=!0;if(C===null||C.id.client!==u||h&&C.id.clock>r.struct.id.clock+r.struct.length)continue;if(u!==r.struct.id.client)la(o,r.struct,r.offset),r={struct:C,offset:0},I.next();else if(r.struct.id.clock+r.struct.length0&&(r.struct.constructor===hr?r.struct.length-=d:C=i$(C,d)),r.struct.mergeWith(C)||(la(o,r.struct,r.offset),r={struct:C,offset:0},I.next())}}else r={struct:I.curr,offset:0},I.next();for(let C=I.curr;C!==null&&C.id.client===u&&C.id.clock===r.struct.id.clock+r.struct.length&&C.constructor!==hr;C=I.next())la(o,r.struct,r.offset),r={struct:C,offset:0}}r!==null&&(la(o,r.struct,r.offset),r=null),VR(o);const a=n.map(I=>YR(I)),l=T7(a);return MI(s,l),s.toUint8Array()},r$=(e,A,t=oI,n=ql)=>{const i=Gb(A),r=new n,s=new KR(r),o=new t(ug(e)),a=new HR(o,!1);for(;a.curr;){const I=a.curr,u=I.id.client,C=i.get(u)||0;if(a.curr.constructor===hr){a.next();continue}if(I.id.clock+I.length>C)for(la(s,I,Ig(C-I.id.clock,0)),a.next();a.curr&&a.curr.id.client===u;)la(s,a.curr,0),a.next();else for(;a.curr&&a.curr.id.client===u&&a.curr.id.clock+a.curr.length<=C;)a.next()}VR(s);const l=YR(o);return MI(r,l),r.toUint8Array()},Kb=e=>{e.written>0&&(e.clientStructs.push({written:e.written,restEncoder:zr(e.encoder.restEncoder)}),e.encoder.restEncoder=wa(),e.written=0)},la=(e,A,t)=>{e.written>0&&e.currClient!==A.id.client&&Kb(e),e.written===0&&(e.currClient=A.id.client,e.encoder.writeClient(A.id.client),Ue(e.encoder.restEncoder,A.id.clock+t)),A.write(e.encoder,t),e.written++},VR=e=>{Kb(e);const A=e.encoder.restEncoder;Ue(A,e.clientStructs.length);for(let t=0;t{const i=new t(ug(e)),r=new HR(i,!1),s=new n,o=new KR(s);for(let l=r.curr;l!==null;l=r.next())la(o,A(l),0);VR(o);const a=YR(i);return MI(s,a),s.toUint8Array()},o$=e=>s$(e,g7,oI,Qh),X2="You must not compute changes after the event-handler fired.";class PQ{constructor(A,t){this.target=A,this.currentTarget=A,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=a$(this.currentTarget,this.target))}deletes(A){return xb(this.transaction.deleteSet,A.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Fa(X2);const A=new Map,t=this.target;this.transaction.changed.get(t).forEach(i=>{if(i!==null){const r=t._map.get(i);let s,o;if(this.adds(r)){let a=r.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(r))if(a!==null&&this.deletes(a))s="delete",o=jm(a.content.getContent());else return;else a!==null&&this.deletes(a)?(s="update",o=jm(a.content.getContent())):(s="add",o=void 0)}else if(this.deletes(r))s="delete",o=jm(r.content.getContent());else return;A.set(i,{action:s,oldValue:o})}}),this._keys=A}return this._keys}get delta(){return this.changes.delta}adds(A){return A.id.clock>=(this.transaction.beforeState.get(A.id.client)||0)}get changes(){let A=this._changes;if(A===null){if(this.transaction.doc._transactionCleanups.length===0)throw Fa(X2);const t=this.target,n=rI(),i=rI(),r=[];if(A={added:n,deleted:i,delta:r,keys:this.keys},this.transaction.changed.get(t).has(null)){let o=null;const a=()=>{o&&r.push(o)};for(let l=t._start;l!==null;l=l.right)l.deleted?this.deletes(l)&&!this.adds(l)&&((o===null||o.delete===void 0)&&(a(),o={delete:0}),o.delete+=l.length,i.add(l)):this.adds(l)?((o===null||o.insert===void 0)&&(a(),o={insert:[]}),o.insert=o.insert.concat(l.content.getContent()),n.add(l)):((o===null||o.retain===void 0)&&(a(),o={retain:0}),o.retain+=l.length);o!==null&&o.retain===void 0&&a()}this._changes=A}return A}}const a$=(e,A)=>{const t=[];for(;A._item!==null&&A!==e;){if(A._item.parentSub!==null)t.unshift(A._item.parentSub);else{let n=0,i=A._item.parent._start;for(;i!==A._item&&i!==null;)i.deleted||n++,i=i.right;t.unshift(n)}A=A._item.parent}return t},Vb=80;let zR=0;class l${constructor(A,t){A.marker=!0,this.p=A,this.index=t,this.timestamp=zR++}}const g$=e=>{e.timestamp=zR++},zb=(e,A,t)=>{e.p.marker=!1,e.p=A,A.marker=!0,e.index=t,e.timestamp=zR++},c$=(e,A,t)=>{if(e.length>=Vb){const n=e.reduce((i,r)=>i.timestamp{if(e._start===null||A===0||e._searchMarker===null)return null;const t=e._searchMarker.length===0?null:e._searchMarker.reduce((r,s)=>pd(A-r.index)A;)n=n.left,!n.deleted&&n.countable&&(i-=n.length);for(;n.left!==null&&n.left.id.client===n.id.client&&n.left.id.clock+n.left.length===n.id.clock;)n=n.left,!n.deleted&&n.countable&&(i-=n.length);return t!==null&&pd(t.index-i){for(let n=e.length-1;n>=0;n--){const i=e[n];if(t>0){let r=i.p;for(r.marker=!1;r&&(r.deleted||!r.countable);)r=r.left,r&&!r.deleted&&r.countable&&(i.index-=r.length);if(r===null||r.marker===!0){e.splice(n,1);continue}i.p=r,r.marker=!0}(A0&&A===i.index)&&(i.index=Ig(A,i.index+t))}},JQ=(e,A,t)=>{const n=e,i=A.changedParentTypes;for(;za(i,e,()=>[]).push(t),e._item!==null;)e=e._item.parent;Ob(n._eH,t,A)};class Tn{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=V2(),this._dEH=V2(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(A,t){this.doc=A,this._item=t}_copy(){throw Ts()}clone(){throw Ts()}_write(A){}get _first(){let A=this._start;for(;A!==null&&A.deleted;)A=A.right;return A}_callObserver(A,t){!A.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(A){z2(this._eH,A)}observeDeep(A){z2(this._dEH,A)}unobserve(A){W2(this._eH,A)}unobserveDeep(A){W2(this._dEH,A)}toJSON(){}}const Wb=(e,A,t)=>{A<0&&(A=e._length+A),t<0&&(t=e._length+t);let n=t-A;const i=[];let r=e._start;for(;r!==null&&n>0;){if(r.countable&&!r.deleted){const s=r.content.getContent();if(s.length<=A)A-=s.length;else{for(let o=A;o0;o++)i.push(s[o]),n--;A=0}}r=r.right}return i},Zb=e=>{const A=[];let t=e._start;for(;t!==null;){if(t.countable&&!t.deleted){const n=t.content.getContent();for(let i=0;i{let t=0,n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const i=n.content.getContent();for(let r=0;r{const t=[];return ZC(e,(n,i)=>{t.push(A(n,i,e))}),t},I$=e=>{let A=e._start,t=null,n=0;return{[Symbol.iterator](){return this},next:()=>{if(t===null){for(;A!==null&&A.deleted;)A=A.right;if(A===null)return{done:!0,value:void 0};t=A.content.getContent(),n=0,A=A.right}const i=t[n++];return t.length<=n&&(t=null),{done:!1,value:i}}}},jb=(e,A)=>{const t=YQ(e,A);let n=e._start;for(t!==null&&(n=t.p,A-=t.index);n!==null;n=n.right)if(!n.deleted&&n.countable){if(A{let i=t;const r=e.doc,s=r.clientID,o=r.store,a=t===null?A._start:t.right;let l=[];const I=()=>{l.length>0&&(i=new sn(Oe(s,yn(o,s)),i,i&&i.lastId,a,a&&a.id,A,null,new $l(l)),i.integrate(e,0),l=[])};n.forEach(u=>{if(u===null)l.push(u);else switch(u.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(u);break;default:switch(I(),u.constructor){case Uint8Array:case ArrayBuffer:i=new sn(Oe(s,yn(o,s)),i,i&&i.lastId,a,a&&a.id,A,null,new ph(new Uint8Array(u))),i.integrate(e,0);break;case RI:i=new sn(Oe(s,yn(o,s)),i,i&&i.lastId,a,a&&a.id,A,null,new mh(u)),i.integrate(e,0);break;default:if(u instanceof Tn)i=new sn(Oe(s,yn(o,s)),i,i&&i.lastId,a,a&&a.id,A,null,new Fo(u)),i.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),I()},Xb=()=>Fa("Length exceeded!"),$b=(e,A,t,n)=>{if(t>A._length)throw Xb();if(t===0)return A._searchMarker&&WC(A._searchMarker,t,n.length),EB(e,A,null,n);const i=t,r=YQ(A,t);let s=A._start;for(r!==null&&(s=r.p,t-=r.index,t===0&&(s=s.prev,t+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(t<=s.length){t{let i=(A._searchMarker||[]).reduce((r,s)=>s.index>r.index?s:r,{index:0,p:A._start}).p;if(i)for(;i.right;)i=i.right;return EB(e,A,i,t)},AO=(e,A,t,n)=>{if(n===0)return;const i=t,r=n,s=YQ(A,t);let o=A._start;for(s!==null&&(o=s.p,t-=s.index);o!==null&&t>0;o=o.right)!o.deleted&&o.countable&&(t0&&o!==null;)o.deleted||(n0)throw Xb();A._searchMarker&&WC(A._searchMarker,i,-r+n)},dB=(e,A,t)=>{const n=A._map.get(t);n!==void 0&&n.delete(e)},WR=(e,A,t,n)=>{const i=A._map.get(t)||null,r=e.doc,s=r.clientID;let o;if(n==null)o=new $l([n]);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:o=new $l([n]);break;case Uint8Array:o=new ph(n);break;case RI:o=new mh(n);break;default:if(n instanceof Tn)o=new Fo(n);else throw new Error("Unexpected content type")}new sn(Oe(s,yn(r.store,s)),i,i&&i.lastId,null,null,A,t,o).integrate(e,0)},ZR=(e,A)=>{const t=e._map.get(A);return t!==void 0&&!t.deleted?t.content.getContent()[t.length-1]:void 0},eO=e=>{const A={};return e._map.forEach((t,n)=>{t.deleted||(A[n]=t.content.getContent()[t.length-1])}),A},tO=(e,A)=>{const t=e._map.get(A);return t!==void 0&&!t.deleted},C$=(e,A)=>{const t={};return e._map.forEach((n,i)=>{let r=n;for(;r!==null&&(!A.sv.has(r.id.client)||r.id.clock>=(A.sv.get(r.id.client)||0));)r=r.left;r!==null&&oc(r,A)&&(t[i]=r.content.getContent()[r.length-1])}),t},HE=e=>N7(e.entries(),A=>!A[1].deleted);class h$ extends PQ{constructor(A,t){super(A,t),this._transaction=t}}class Oc extends Tn{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(A){const t=new Oc;return t.push(A),t}_integrate(A,t){super._integrate(A,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Oc}clone(){const A=new Oc;return A.insert(0,this.toArray().map(t=>t instanceof Tn?t.clone():t)),A}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}_callObserver(A,t){super._callObserver(A,t),JQ(this,A,new h$(this,A))}insert(A,t){this.doc!==null?gt(this.doc,n=>{$b(n,this,A,t)}):this._prelimContent.splice(A,0,...t)}push(A){this.doc!==null?gt(this.doc,t=>{u$(t,this,A)}):this._prelimContent.push(...A)}unshift(A){this.insert(0,A)}delete(A,t=1){this.doc!==null?gt(this.doc,n=>{AO(n,this,A,t)}):this._prelimContent.splice(A,t)}get(A){return jb(this,A)}toArray(){return Zb(this)}slice(A=0,t=this.length){return Wb(this,A,t)}toJSON(){return this.map(A=>A instanceof Tn?A.toJSON():A)}map(A){return qb(this,A)}forEach(A){ZC(this,A)}[Symbol.iterator](){return I$(this)}_write(A){A.writeTypeRef(b$)}}const f$=e=>new Oc;class E$ extends PQ{constructor(A,t,n){super(A,t),this.keysChanged=n}}class aI extends Tn{constructor(A){super(),this._prelimContent=null,A===void 0?this._prelimContent=new Map:this._prelimContent=new Map(A)}_integrate(A,t){super._integrate(A,t),this._prelimContent.forEach((n,i)=>{this.set(i,n)}),this._prelimContent=null}_copy(){return new aI}clone(){const A=new aI;return this.forEach((t,n)=>{A.set(n,t instanceof Tn?t.clone():t)}),A}_callObserver(A,t){JQ(this,A,new E$(this,A,t))}toJSON(){const A={};return this._map.forEach((t,n)=>{if(!t.deleted){const i=t.content.getContent()[t.length-1];A[n]=i instanceof Tn?i.toJSON():i}}),A}get size(){return[...HE(this._map)].length}keys(){return Ay(HE(this._map),A=>A[0])}values(){return Ay(HE(this._map),A=>A[1].content.getContent()[A[1].length-1])}entries(){return Ay(HE(this._map),A=>[A[0],A[1].content.getContent()[A[1].length-1]])}forEach(A){this._map.forEach((t,n)=>{t.deleted||A(t.content.getContent()[t.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(A){this.doc!==null?gt(this.doc,t=>{dB(t,this,A)}):this._prelimContent.delete(A)}set(A,t){return this.doc!==null?gt(this.doc,n=>{WR(n,this,A,t)}):this._prelimContent.set(A,t),t}get(A){return ZR(this,A)}has(A){return tO(this,A)}clear(){this.doc!==null?gt(this.doc,A=>{this.forEach(function(t,n,i){dB(A,i,n)})}):this._prelimContent.clear()}_write(A){A.writeTypeRef(O$)}}const d$=e=>new aI,Ia=(e,A)=>e===A||typeof e=="object"&&typeof A=="object"&&e&&A&&l7(e,A);class wD{constructor(A,t,n,i){this.left=A,this.right=t,this.index=n,this.currentAttributes=i}forward(){switch(this.right===null&&_s(),this.right.content.constructor){case ln:this.right.deleted||SI(this.currentAttributes,this.right.content);break;default:this.right.deleted||(this.index+=this.right.length);break}this.left=this.right,this.right=this.right.right}}const $2=(e,A,t)=>{for(;A.right!==null&&t>0;){switch(A.right.content.constructor){case ln:A.right.deleted||SI(A.currentAttributes,A.right.content);break;default:A.right.deleted||(t{const i=new Map,r=n?YQ(A,t):null;if(r){const s=new wD(r.p.left,r.p,r.index,i);return $2(e,s,t-r.index)}else{const s=new wD(null,A._start,0,i);return $2(e,s,t)}},nO=(e,A,t,n)=>{for(;t.right!==null&&(t.right.deleted===!0||t.right.content.constructor===ln&&Ia(n.get(t.right.content.key),t.right.content.value));)t.right.deleted||n.delete(t.right.content.key),t.forward();const i=e.doc,r=i.clientID;n.forEach((s,o)=>{const a=t.left,l=t.right,I=new sn(Oe(r,yn(i.store,r)),a,a&&a.lastId,l,l&&l.id,A,null,new ln(o,s));I.integrate(e,0),t.right=I,t.forward()})},SI=(e,A)=>{const{key:t,value:n}=A;n===null?e.delete(t):e.set(t,n)},iO=(e,A)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===ln&&Ia(A[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},rO=(e,A,t,n)=>{const i=e.doc,r=i.clientID,s=new Map;for(const o in n){const a=n[o],l=t.currentAttributes.get(o)??null;if(!Ia(l,a)){s.set(o,l);const{left:I,right:u}=t;t.right=new sn(Oe(r,yn(i.store,r)),I,I&&I.lastId,u,u&&u.id,A,null,new ln(o,a)),t.right.integrate(e,0),t.forward()}}return s},ty=(e,A,t,n,i)=>{t.currentAttributes.forEach((C,h)=>{i[h]===void 0&&(i[h]=null)});const r=e.doc,s=r.clientID;iO(t,i);const o=rO(e,A,t,i),a=n.constructor===String?new Ls(n):n instanceof Tn?new Fo(n):new Cg(n);let{left:l,right:I,index:u}=t;A._searchMarker&&WC(A._searchMarker,t.index,a.getLength()),I=new sn(Oe(s,yn(r.store,s)),l,l&&l.lastId,I,I&&I.id,A,null,a),I.integrate(e,0),t.right=I,t.index=u,t.forward(),nO(e,A,t,o)},AU=(e,A,t,n,i)=>{const r=e.doc,s=r.clientID;iO(t,i);const o=rO(e,A,t,i);A:for(;t.right!==null&&(n>0||o.size>0&&(t.right.deleted||t.right.content.constructor===ln));){if(!t.right.deleted)switch(t.right.content.constructor){case ln:{const{key:a,value:l}=t.right.content,I=i[a];if(I!==void 0){if(Ia(I,l))o.delete(a);else{if(n===0)break A;o.set(a,l)}t.right.delete(e)}else t.currentAttributes.set(a,l);break}default:n0){let a="";for(;n>0;n--)a+=` `;t.right=new sn(Oe(s,yn(r.store,s)),t.left,t.left&&t.left.lastId,t.right,t.right&&t.right.id,A,null,new Ls(a)),t.right.integrate(e,0),t.forward()}nO(e,A,t,o)},sO=(e,A,t,n,i)=>{let r=A;const s=jr();for(;r&&(!r.countable||r.deleted);){if(!r.deleted&&r.content.constructor===ln){const l=r.content;s.set(l.key,l)}r=r.right}let o=0,a=!1;for(;A!==r;){if(t===A&&(a=!0),!A.deleted){const l=A.content;switch(l.constructor){case ln:{const{key:I,value:u}=l,C=n.get(I)??null;(s.get(I)!==l||C===u)&&(A.delete(e),o++,!a&&(i.get(I)??null)===u&&C!==u&&(C===null?i.delete(I):i.set(I,C))),!a&&!A.deleted&&SI(i,l);break}}}A=A.right}return o},B$=(e,A)=>{for(;A&&A.right&&(A.right.deleted||!A.right.countable);)A=A.right;const t=new Set;for(;A&&(A.deleted||!A.countable);){if(!A.deleted&&A.content.constructor===ln){const n=A.content.key;t.has(n)?A.delete(e):t.add(n)}A=A.left}},Q$=e=>{let A=0;return gt(e.doc,t=>{let n=e._start,i=e._start,r=jr();const s=BD(r);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case ln:SI(s,i.content);break;default:A+=sO(t,n,i,r,s),r=BD(s),n=i;break}i=i.right}}),A},p$=e=>{const A=new Set,t=e.doc;for(const[n,i]of e.afterState.entries()){const r=e.beforeState.get(n)||0;i!==r&&Jb(e,t.store.clients.get(n),r,i,s=>{!s.deleted&&s.content.constructor===ln&&s.constructor!==Cr&&A.add(s.parent)})}gt(t,n=>{Nb(e,e.deleteSet,i=>{if(i instanceof Cr||!i.parent._hasFormatting||A.has(i.parent))return;const r=i.parent;i.content.constructor===ln?A.add(r):B$(n,i)});for(const i of A)Q$(i)})},eU=(e,A,t)=>{const n=t,i=BD(A.currentAttributes),r=A.right;for(;t>0&&A.right!==null;){if(A.right.deleted===!1)switch(A.right.content.constructor){case Fo:case Cg:case Ls:t{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const A={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=A}return this._changes}get delta(){if(this._delta===null){const A=this.target.doc,t=[];gt(A,n=>{const i=new Map,r=new Map;let s=this.target._start,o=null;const a={};let l="",I=0,u=0;const C=()=>{if(o!==null){let h=null;switch(o){case"delete":u>0&&(h={delete:u}),u=0;break;case"insert":(typeof l=="object"||l.length>0)&&(h={insert:l},i.size>0&&(h.attributes={},i.forEach((d,m)=>{d!==null&&(h.attributes[m]=d)}))),l="";break;case"retain":I>0&&(h={retain:I},s7(a)||(h.attributes=n7({},a))),I=0;break}h&&t.push(h),o=null}};for(;s!==null;){switch(s.content.constructor){case Fo:case Cg:this.adds(s)?this.deletes(s)||(C(),o="insert",l=s.content.getContent()[0],C()):this.deletes(s)?(o!=="delete"&&(C(),o="delete"),u+=1):s.deleted||(o!=="retain"&&(C(),o="retain"),I+=1);break;case Ls:this.adds(s)?this.deletes(s)||(o!=="insert"&&(C(),o="insert"),l+=s.content.str):this.deletes(s)?(o!=="delete"&&(C(),o="delete"),u+=s.length):s.deleted||(o!=="retain"&&(C(),o="retain"),I+=s.length);break;case ln:{const{key:h,value:d}=s.content;if(this.adds(s)){if(!this.deletes(s)){const m=i.get(h)??null;Ia(m,d)?d!==null&&s.delete(n):(o==="retain"&&C(),Ia(d,r.get(h)??null)?delete a[h]:a[h]=d)}}else if(this.deletes(s)){r.set(h,d);const m=i.get(h)??null;Ia(m,d)||(o==="retain"&&C(),a[h]=m)}else if(!s.deleted){r.set(h,d);const m=a[h];m!==void 0&&(Ia(m,d)?m!==null&&s.delete(n):(o==="retain"&&C(),d===null?delete a[h]:a[h]=d))}s.deleted||(o==="insert"&&C(),SI(i,s.content));break}}s=s.right}for(C();t.length>0;){const h=t[t.length-1];if(h.retain!==void 0&&h.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}}class jl extends Tn{constructor(A){super(),this._pending=A!==void 0?[()=>this.insert(0,A)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this._length}_integrate(A,t){super._integrate(A,t);try{this._pending.forEach(n=>n())}catch(n){console.error(n)}this._pending=null}_copy(){return new jl}clone(){const A=new jl;return A.applyDelta(this.toDelta()),A}_callObserver(A,t){super._callObserver(A,t);const n=new m$(this,A,t);JQ(this,A,n),!A.local&&this._hasFormatting&&(A._needFormattingCleanup=!0)}toString(){let A="",t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===Ls&&(A+=t.content.str),t=t.right;return A}toJSON(){return this.toString()}applyDelta(A,{sanitize:t=!0}={}){this.doc!==null?gt(this.doc,n=>{const i=new wD(null,this._start,0,new Map);for(let r=0;r0)&&ty(n,this,i,o,s.attributes||{})}else s.retain!==void 0?AU(n,this,i,s.retain,s.attributes||{}):s.delete!==void 0&&eU(n,i,s.delete)}}):this._pending.push(()=>this.applyDelta(A))}toDelta(A,t,n){const i=[],r=new Map,s=this.doc;let o="",a=this._start;function l(){if(o.length>0){const u={};let C=!1;r.forEach((d,m)=>{C=!0,u[m]=d});const h={insert:o};C&&(h.attributes=u),i.push(h),o=""}}const I=()=>{for(;a!==null;){if(oc(a,A)||t!==void 0&&oc(a,t))switch(a.content.constructor){case Ls:{const u=r.get("ychange");A!==void 0&&!oc(a,A)?(u===void 0||u.user!==a.id.client||u.type!=="removed")&&(l(),r.set("ychange",n?n("removed",a.id):{type:"removed"})):t!==void 0&&!oc(a,t)?(u===void 0||u.user!==a.id.client||u.type!=="added")&&(l(),r.set("ychange",n?n("added",a.id):{type:"added"})):u!==void 0&&(l(),r.delete("ychange")),o+=a.content.str;break}case Fo:case Cg:{l();const u={insert:a.content.getContent()[0]};if(r.size>0){const C={};u.attributes=C,r.forEach((h,d)=>{C[d]=h})}i.push(u);break}case ln:oc(a,A)&&(l(),SI(r,a.content));break}a=a.right}l()};return A||t?gt(s,u=>{A&&mD(u,A),t&&mD(u,t),I()},"cleanup"):I(),i}insert(A,t,n){if(t.length<=0)return;const i=this.doc;i!==null?gt(i,r=>{const s=KE(r,this,A,!n);n||(n={},s.currentAttributes.forEach((o,a)=>{n[a]=o})),ty(r,this,s,t,n)}):this._pending.push(()=>this.insert(A,t,n))}insertEmbed(A,t,n){const i=this.doc;i!==null?gt(i,r=>{const s=KE(r,this,A,!n);ty(r,this,s,t,n||{})}):this._pending.push(()=>this.insertEmbed(A,t,n||{}))}delete(A,t){if(t===0)return;const n=this.doc;n!==null?gt(n,i=>{eU(i,KE(i,this,A,!0),t)}):this._pending.push(()=>this.delete(A,t))}format(A,t,n){if(t===0)return;const i=this.doc;i!==null?gt(i,r=>{const s=KE(r,this,A,!1);s.right!==null&&AU(r,this,s,t,n)}):this._pending.push(()=>this.format(A,t,n))}removeAttribute(A){this.doc!==null?gt(this.doc,t=>{dB(t,this,A)}):this._pending.push(()=>this.removeAttribute(A))}setAttribute(A,t){this.doc!==null?gt(this.doc,n=>{WR(n,this,A,t)}):this._pending.push(()=>this.setAttribute(A,t))}getAttribute(A){return ZR(this,A)}getAttributes(){return eO(this)}_write(A){A.writeTypeRef(P$)}}const y$=e=>new jl;class ny{constructor(A,t=()=>!0){this._filter=t,this._root=A,this._currentNode=A._start,this._firstCall=!0}[Symbol.iterator](){return this}next(){let A=this._currentNode,t=A&&A.content&&A.content.type;if(A!==null&&(!this._firstCall||A.deleted||!this._filter(t)))do if(t=A.content.type,!A.deleted&&(t.constructor===lI||t.constructor===Xl)&&t._start!==null)A=t._start;else for(;A!==null;)if(A.right!==null){A=A.right;break}else A.parent===this._root?A=null:A=A.parent._item;while(A!==null&&(A.deleted||!this._filter(A.content.type)));return this._firstCall=!1,A===null?{value:void 0,done:!0}:(this._currentNode=A,{value:A.content.type,done:!1})}}class Xl extends Tn{constructor(){super(),this._prelimContent=[]}get firstChild(){const A=this._first;return A?A.content.getContent()[0]:null}_integrate(A,t){super._integrate(A,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Xl}clone(){const A=new Xl;return A.insert(0,this.toArray().map(t=>t instanceof Tn?t.clone():t)),A}get length(){return this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(A){return new ny(this,A)}querySelector(A){A=A.toUpperCase();const n=new ny(this,i=>i.nodeName&&i.nodeName.toUpperCase()===A).next();return n.done?null:n.value}querySelectorAll(A){return A=A.toUpperCase(),Ua(new ny(this,t=>t.nodeName&&t.nodeName.toUpperCase()===A))}_callObserver(A,t){JQ(this,A,new M$(this,t,A))}toString(){return qb(this,A=>A.toString()).join("")}toJSON(){return this.toString()}toDOM(A=document,t={},n){const i=A.createDocumentFragment();return n!==void 0&&n._createAssociation(i,this),ZC(this,r=>{i.insertBefore(r.toDOM(A,t,n),null)}),i}insert(A,t){this.doc!==null?gt(this.doc,n=>{$b(n,this,A,t)}):this._prelimContent.splice(A,0,...t)}insertAfter(A,t){if(this.doc!==null)gt(this.doc,n=>{const i=A&&A instanceof Tn?A._item:A;EB(n,this,i,t)});else{const n=this._prelimContent,i=A===null?0:n.findIndex(r=>r===A)+1;if(i===0&&A!==null)throw Fa("Reference item not found");n.splice(i,0,...t)}}delete(A,t=1){this.doc!==null?gt(this.doc,n=>{AO(n,this,A,t)}):this._prelimContent.splice(A,t)}toArray(){return Zb(this)}push(A){this.insert(this.length,A)}unshift(A){this.insert(0,A)}get(A){return jb(this,A)}slice(A=0,t=this.length){return Wb(this,A,t)}forEach(A){ZC(this,A)}_write(A){A.writeTypeRef(J$)}}const w$=e=>new Xl;class lI extends Xl{constructor(A="UNDEFINED"){super(),this.nodeName=A,this._prelimAttrs=new Map}get nextSibling(){const A=this._item?this._item.next:null;return A?A.content.type:null}get prevSibling(){const A=this._item?this._item.prev:null;return A?A.content.type:null}_integrate(A,t){super._integrate(A,t),this._prelimAttrs.forEach((n,i)=>{this.setAttribute(i,n)}),this._prelimAttrs=null}_copy(){return new lI(this.nodeName)}clone(){const A=new lI(this.nodeName),t=this.getAttributes();return r7(t,(n,i)=>{typeof n=="string"&&A.setAttribute(i,n)}),A.insert(0,this.toArray().map(n=>n instanceof Tn?n.clone():n)),A}toString(){const A=this.getAttributes(),t=[],n=[];for(const o in A)n.push(o);n.sort();const i=n.length;for(let o=0;o0?" "+t.join(" "):"";return`<${r}${s}>${super.toString()}`}removeAttribute(A){this.doc!==null?gt(this.doc,t=>{dB(t,this,A)}):this._prelimAttrs.delete(A)}setAttribute(A,t){this.doc!==null?gt(this.doc,n=>{WR(n,this,A,t)}):this._prelimAttrs.set(A,t)}getAttribute(A){return ZR(this,A)}hasAttribute(A){return tO(this,A)}getAttributes(A){return A?C$(this,A):eO(this)}toDOM(A=document,t={},n){const i=A.createElement(this.nodeName),r=this.getAttributes();for(const s in r){const o=r[s];typeof o=="string"&&i.setAttribute(s,o)}return ZC(this,s=>{i.appendChild(s.toDOM(A,t,n))}),n!==void 0&&n._createAssociation(i,this),i}_write(A){A.writeTypeRef(Y$),A.writeKey(this.nodeName)}}const D$=e=>new lI(e.readKey());class M$ extends PQ{constructor(A,t,n){super(A,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class BB extends aI{constructor(A){super(),this.hookName=A}_copy(){return new BB(this.hookName)}clone(){const A=new BB(this.hookName);return this.forEach((t,n)=>{A.set(n,t)}),A}toDOM(A=document,t={},n){const i=t[this.hookName];let r;return i!==void 0?r=i.createDom(this):r=document.createElement(this.hookName),r.setAttribute("data-yjs-hook",this.hookName),n!==void 0&&n._createAssociation(r,this),r}_write(A){A.writeTypeRef(H$),A.writeKey(this.hookName)}}const R$=e=>new BB(e.readKey());class QB extends jl{get nextSibling(){const A=this._item?this._item.next:null;return A?A.content.type:null}get prevSibling(){const A=this._item?this._item.prev:null;return A?A.content.type:null}_copy(){return new QB}clone(){const A=new QB;return A.applyDelta(this.toDelta()),A}toDOM(A=document,t,n){const i=A.createTextNode(this.toString());return n!==void 0&&n._createAssociation(i,this),i}toString(){return this.toDelta().map(A=>{const t=[];for(const i in A.attributes){const r=[];for(const s in A.attributes[i])r.push({key:s,value:A.attributes[i][s]});r.sort((s,o)=>s.keyi.nodeName=0;i--)n+=``;return n}).join("")}toJSON(){return this.toString()}_write(A){A.writeTypeRef(K$)}}const S$=e=>new QB;class qR{constructor(A,t){this.id=A,this.length=t}get deleted(){throw Ts()}mergeWith(A){return!1}write(A,t,n){throw Ts()}integrate(A,t){throw Ts()}}const v$=0;class Cr extends qR{get deleted(){return!0}delete(){}mergeWith(A){return this.constructor!==A.constructor?!1:(this.length+=A.length,!0)}integrate(A,t){t>0&&(this.id.clock+=t,this.length-=t),Yb(A.doc.store,this)}write(A,t){A.writeInfo(v$),A.writeLen(this.length-t)}getMissing(A,t){return null}}class ph{constructor(A){this.content=A}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new ph(this.content)}splice(A){throw Ts()}mergeWith(A){return!1}integrate(A,t){}delete(A){}gc(A){}write(A,t){A.writeBuf(this.content)}getRef(){return 3}}const N$=e=>new ph(e.readBuf());class qC{constructor(A){this.len=A}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new qC(this.len)}splice(A){const t=new qC(this.len-A);return this.len=A,t}mergeWith(A){return this.len+=A.len,!0}integrate(A,t){hB(A.deleteSet,t.id.client,t.id.clock,this.len),t.markDeleted()}delete(A){}gc(A){}write(A,t){A.writeLen(this.len-t)}getRef(){return 1}}const x$=e=>new qC(e.readLen()),oO=(e,A)=>new RI({guid:e,...A,shouldLoad:A.shouldLoad||A.autoLoad||!1});class mh{constructor(A){A._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=A;const t={};this.opts=t,A.gc||(t.gc=!1),A.autoLoad&&(t.autoLoad=!0),A.meta!==null&&(t.meta=A.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new mh(oO(this.doc.guid,this.opts))}splice(A){throw Ts()}mergeWith(A){return!1}integrate(A,t){this.doc._item=t,A.subdocsAdded.add(this.doc),this.doc.shouldLoad&&A.subdocsLoaded.add(this.doc)}delete(A){A.subdocsAdded.has(this.doc)?A.subdocsAdded.delete(this.doc):A.subdocsRemoved.add(this.doc)}gc(A){}write(A,t){A.writeString(this.doc.guid),A.writeAny(this.opts)}getRef(){return 9}}const T$=e=>new mh(oO(e.readString(),e.readAny()));class Cg{constructor(A){this.embed=A}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Cg(this.embed)}splice(A){throw Ts()}mergeWith(A){return!1}integrate(A,t){}delete(A){}gc(A){}write(A,t){A.writeJSON(this.embed)}getRef(){return 5}}const U$=e=>new Cg(e.readJSON());class ln{constructor(A,t){this.key=A,this.value=t}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new ln(this.key,this.value)}splice(A){throw Ts()}mergeWith(A){return!1}integrate(A,t){const n=t.parent;n._searchMarker=null,n._hasFormatting=!0}delete(A){}gc(A){}write(A,t){A.writeKey(this.key),A.writeJSON(this.value)}getRef(){return 6}}const F$=e=>new ln(e.readKey(),e.readJSON());class pB{constructor(A){this.arr=A}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new pB(this.arr)}splice(A){const t=new pB(this.arr.slice(A));return this.arr=this.arr.slice(0,A),t}mergeWith(A){return this.arr=this.arr.concat(A.arr),!0}integrate(A,t){}delete(A){}gc(A){}write(A,t){const n=this.arr.length;A.writeLen(n-t);for(let i=t;i{const A=e.readLen(),t=[];for(let n=0;n{const A=e.readLen(),t=[];for(let n=0;n=55296&&n<=56319&&(this.str=this.str.slice(0,A-1)+"�",t.str="�"+t.str.slice(1)),t}mergeWith(A){return this.str+=A.str,!0}integrate(A,t){}delete(A){}gc(A){}write(A,t){A.writeString(t===0?this.str:this.str.slice(t))}getRef(){return 4}}const L$=e=>new Ls(e.readString()),G$=[f$,d$,y$,D$,w$,R$,S$],b$=0,O$=1,P$=2,Y$=3,J$=4,H$=5,K$=6;class Fo{constructor(A){this.type=A}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Fo(this.type._copy())}splice(A){throw Ts()}mergeWith(A){return!1}integrate(A,t){this.type._integrate(A.doc,t)}delete(A){let t=this.type._start;for(;t!==null;)t.deleted?t.id.clock<(A.beforeState.get(t.id.client)||0)&&A._mergeStructs.push(t):t.delete(A),t=t.right;this.type._map.forEach(n=>{n.deleted?n.id.clock<(A.beforeState.get(n.id.client)||0)&&A._mergeStructs.push(n):n.delete(A)}),A.changed.delete(this.type)}gc(A){let t=this.type._start;for(;t!==null;)t.gc(A,!0),t=t.right;this.type._start=null,this.type._map.forEach(n=>{for(;n!==null;)n.gc(A,!0),n=n.left}),this.type._map=new Map}write(A,t){this.type._write(A)}getRef(){return 7}}const V$=e=>new Fo(G$[e.readTypeRef()](e)),mB=(e,A,t)=>{const{client:n,clock:i}=A.id,r=new sn(Oe(n,i+t),A,Oe(n,i+t-1),A.right,A.rightOrigin,A.parent,A.parentSub,A.content.splice(t));return A.deleted&&r.markDeleted(),A.keep&&(r.keep=!0),A.redone!==null&&(r.redone=Oe(A.redone.client,A.redone.clock+t)),A.right=r,r.right!==null&&(r.right.left=r),e._mergeStructs.push(r),r.parentSub!==null&&r.right===null&&r.parent._map.set(r.parentSub,r),A.length=t,r};class sn extends qR{constructor(A,t,n,i,r,s,o,a){super(A,a.getLength()),this.origin=n,this.left=t,this.right=i,this.rightOrigin=r,this.parent=s,this.parentSub=o,this.redone=null,this.content=a,this.info=this.content.isCountable()?F2:0}set marker(A){(this.info&qm)>0!==A&&(this.info^=qm)}get marker(){return(this.info&qm)>0}get keep(){return(this.info&U2)>0}set keep(A){this.keep!==A&&(this.info^=U2)}get countable(){return(this.info&F2)>0}get deleted(){return(this.info&Zm)>0}set deleted(A){this.deleted!==A&&(this.info^=Zm)}markDeleted(){this.info|=Zm}getMissing(A,t){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=yn(t,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=yn(t,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===bc&&this.id.client!==this.parent.client&&this.parent.clock>=yn(t,this.parent.client))return this.parent.client;if(this.origin&&(this.left=Z2(A,t,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=_a(A,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Cr||this.right&&this.right.constructor===Cr)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===sn&&(this.parent=this.left.parent,this.parentSub=this.left.parentSub),this.right&&this.right.constructor===sn&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===bc){const n=ey(t,this.parent);n.constructor===Cr?this.parent=null:this.parent=n.content.type}return null}integrate(A,t){if(t>0&&(this.id.clock+=t,this.left=Z2(A,A.doc.store,Oe(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(t),this.length-=t),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let n=this.left,i;if(n!==null)i=n.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const r=new Set,s=new Set;for(;i!==null&&i!==this.right;){if(s.add(i),r.add(i),JE(this.origin,i.origin)){if(i.id.client{n.p===A&&(n.p=this,!this.deleted&&this.countable&&(n.index-=this.length))}),A.keep&&(this.keep=!0),this.right=A.right,this.right!==null&&(this.right.left=this),this.length+=A.length,!0}return!1}delete(A){if(!this.deleted){const t=this.parent;this.countable&&this.parentSub===null&&(t._length-=this.length),this.markDeleted(),hB(A.deleteSet,this.id.client,this.id.clock,this.length),j2(A,t,this.parentSub),this.content.delete(A)}}gc(A,t){if(!this.deleted)throw _s();this.content.gc(A),t?X7(A,this,new Cr(this.id,this.length)):this.content=new qC(this.length)}write(A,t){const n=t>0?Oe(this.id.client,this.id.clock+t-1):this.origin,i=this.rightOrigin,r=this.parentSub,s=this.content.getRef()&LQ|(n===null?0:Ki)|(i===null?0:Bo)|(r===null?0:JC);if(A.writeInfo(s),n!==null&&A.writeLeftID(n),i!==null&&A.writeRightID(i),n===null&&i===null){const o=this.parent;if(o._item!==void 0){const a=o._item;if(a===null){const l=q7(o);A.writeParentInfo(!0),A.writeString(l)}else A.writeParentInfo(!1),A.writeLeftID(a.id)}else o.constructor===String?(A.writeParentInfo(!0),A.writeString(o)):o.constructor===bc?(A.writeParentInfo(!1),A.writeLeftID(o)):_s();r!==null&&A.writeString(r)}this.content.write(A,t)}}const aO=(e,A)=>z$[A&LQ](e),z$=[()=>{_s()},x$,_$,N$,L$,U$,F$,V$,k$,T$,()=>{_s()}],W$=10;class hr extends qR{get deleted(){return!0}delete(){}mergeWith(A){return this.constructor!==A.constructor?!1:(this.length+=A.length,!0)}integrate(A,t){_s()}write(A,t){A.writeInfo(W$),Ue(A.restEncoder,this.length-t)}getMissing(A,t){return null}}const lO=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},gO="__ $YJS$ __";lO[gO]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");lO[gO]=!0;const jR=0,cO=1,IO=2,Z$=(e,A)=>{Ue(e,jR);const t=W7(A);Jn(e,t)},uO=(e,A,t)=>{Ue(e,cO),Jn(e,H7(A,t))},q$=(e,A,t)=>uO(A,t,Ai(e)),CO=(e,A,t)=>{try{P7(A,Ai(e),t)}catch(n){console.error("Caught error while handling a Yjs update",n)}},j$=(e,A)=>{Ue(e,IO),Jn(e,A)},X$=CO,$$=(e,A,t,n)=>{const i=Fe(e);switch(i){case jR:q$(e,A,t);break;case cO:CO(e,t,n);break;case IO:X$(e,t,n);break;default:throw new Error("Unknown message type")}return i},Sc={},tU={},Qo={},yl={},Pr=UQ("shared",["second"],e=>{switch(e.target){case"second":Object.keys(Qo).forEach(A=>{const t=yl[A];t===void 0?Pr.emit("shared:join",A):t<10?yl[A]=t+1:delete yl[A]}),Object.keys(tU).forEach(A=>{Pr.emit("shared:active",A)});break;case"join":{const A=e.data,t=Sc[A];if(t&&tU[A]){Pr.reply(e,"joinack",A);const n=wa();Z$(n,t),Pr.reply(e,"sync",Dd(A,n));const i=wa();uO(i,t),Pr.reply(e,"sync",Dd(A,i))}break}case"joinack":{const A=e.data;Sc[A]&&Qo[A]&&(yl[A]=0);break}case"active":{const A=e.data;Sc[A]&&Qo[A]&&(yl[A]=0);break}case"sync":{const[A,t,n]=e.data,i=Sc[t];if(i&&A!==Pr.id()){const r=ug(n),s=wa();if($$(r,s,i,Pr)===jR){const a=Dd(t,s);Pr.emit("shared:sync",a)}}break}}});function AAA(e){let A=Sc[e];if(A)return A;Sc[e]=A=new RI({guid:e});function t(n){const i=wa();j$(i,n),Pr.emit("shared:sync",Dd(e,i))}return A.on("update",t),A.on("destroy",()=>{A==null||A.off("update",t)}),A}function XR(e){return AAA(e).getMap()}function Dd(e,A){const t=zr(A);return[Pr.id()??"",e,t]}function hO(e,A){const t=e.get(A);return t!=null&&t.toJSON?t.toJSON():t}function eAA(e,A,t){typeof t=="string"?e.set(A,new jl(t)):e.set(A,t)}function fO(e){Qo[e]=(Qo[e]??0)+1,Qo[e]===1&&(delete yl[e],Pr.emit("shared:join",e))}function EO(e){const A=Qo[e]??0;A<=1?(delete Qo[e],delete yl[e]):Qo[e]=A-1}function tAA(e,A,t){const n=XR(e),i=hO(n,A);(i===void 0||t!==i)&&eAA(n,A,t)}function nAA(e,A,t){const n=XR(e);function i(){t(hO(n,A))}function r(s){s.keysChanged.has(A)&&i()}return i(),n.observe(r),()=>{n.unobserve(r)}}function iAA(e,A,t){const n=XR(e);let i=n.get(A);function r(){t(i)}function s(a){a.keysChanged.has(A)&&i===void 0&&o(),i&&n.unobserve(s)}function o(){i=n.get(A),i?(i.observeDeep(r),r()):n.observe(s)}return o(),()=>{i?i.unobserveDeep(r):n.unobserve(s)}}function rAA(e,A,t){fO(e);const n=nAA(e,A,t);return()=>{n(),EO(e)}}function sAA(e,A,t){fO(e);const n=iAA(e,A,t);return()=>{n(),EO(e)}}function oAA(){const e=new Vq,A=Kq(t=>e.postMessage(t));e.addEventListener("message",t=>{A(t.data)})}/** * postprocessing v6.35.3 build Sat Mar 30 2024 @@ -4220,4 +4220,4 @@ Make sure that all grammar rule definitions are done before 'performSelfAnalysis `)}`)})}constructor(A,t){this.definitionErrors=[],this.selfAnalysisDone=!1;const n=this;if(n.initErrorHandler(t),n.initLexerAdapter(),n.initLooksAhead(t),n.initRecognizerEngine(A,t),n.initRecoverable(t),n.initTreeBuilder(t),n.initContentAssist(),n.initGastRecorder(t),n.initPerformanceTracer(t),re(t,"ignoredIssues"))throw new Error(`The IParserConfig property has been deprecated. Please use the flag on the relevant DSL method instead. See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES - For further details.`);this.skipValidations=re(t,"skipValidations")?t.skipValidations:Ga.skipValidations}}lp.DEFER_DEFINITION_ERRORS_HANDLING=!1;ugA(lp,[YlA,VlA,ngA,igA,sgA,rgA,ogA,agA,ggA,IgA]);const CgA=xO(32,126).map(e=>String.fromCharCode(e)),hgA=Zs({name:"Whitespace",pattern:/ +/}),fgA=Zs({name:"WhitespaceSkipped",pattern:/ +/,group:ri.SKIPPED}),jP=Zs({name:"StringLiteral",pattern:/[^ $]+/,start_chars_hint:CgA}),vS=Zs({name:"StringLiteralDouble",pattern:/"(?:[^\\"]|\\(?:[^\n\r]|u[0-9a-fA-F]{4}))*"/}),XP=Zs({name:"MaybeFlag",pattern:/\$[^ $]+/}),NS=Zs({name:"NumberLiteral",pattern:/\$-?(\d*\.)?\d+([eE][+-]?\d+)?[jJ]?[lL]?\+?/}),xS=Zs({name:"ContinueLine",pattern:/\\/});function $P(e,A=""){return Zs({name:A||e,pattern:new RegExp(e.toLowerCase(),"i")})}const AY=[["blue"],["green"],["cyan"],["red"],["purple"],["yellow"],["white"],["dkblue"],["dkgreen"],["dkcyan"],["dkred"],["dkpurple"],["dkyellow|brown","brown"],["dkwhite|ltgray|ltgrey|gray|grey","gray"],["dkgray|dkgrey|ltblack","dkgray"],["black"],["clear"]],CF={black:0,dkblue:1,dkgreen:2,dkcyan:3,dkred:4,dkpurple:5,brown:6,gray:7,dkgray:8,blue:9,green:10,cyan:11,red:12,purple:13,yellow:14,white:15,clear:-1},Bn=AY.map(([e,A])=>$P(`\\$(${e})`,A||e)),jt=[...AY.map(([e,A])=>$P(`\\$on(${e})`,`on${A||e}`))],EgA=[hgA,xS,...Bn,...jt,vS,jP,NS,XP],dgA=new ri(EgA,{skipValidations:!yB,ensureOptimizations:yB}),BgA=new ri([fgA,xS,...Bn,...jt,vS,jP,NS,XP],{skipValidations:!yB,ensureOptimizations:yB});function QgA(e,A=!1){return A?BgA.tokenize(e):dgA.tokenize(e)}function LB(e,A,t,n){return{measureOnly:!1,resetCheck:!0,x:0,y:0,isEven:!0,resetColor:t,resetBg:n,activeColor:t,activeBg:n,width:e,height:A,leftEdge:void 0,rightEdge:void 0,bottomEdge:void 0,char:[],color:[],bg:[]}}function pgA(e,A){e.x=A.x,e.y=A.y,e.activeColor=A.activeColor,e.activeBg=A.activeBg}function gp(e){const A=V.useMemo(()=>({...e}),[e]);pgA(e,A)}const eY=V.createContext(LB(1,1,15,1));function tY(e){e.activeColor=e.resetColor,e.activeBg=e.resetBg}function mgA(e,A){const t=A.y;function n(){++A.x,A.x>=(A.rightEdge??A.width)&&(A.x=A.leftEdge??0,++A.y)}function i(){return!(A.x<(A.leftEdge??0)||A.x>=(A.rightEdge??A.width)||A.y<0||A.y>=(A.bottomEdge??A.height))}function r(s){for(let o=0;o=A.height)return!0}return A.measureOnly!==!0&&(A.x!==0||A.y===t)&&(A.x=A.leftEdge??0,++A.y),!0}function Si(e,A){const t=QgA(e);if(!t.tokens)return!0;const n=mgA(t.tokens,A);return A.resetCheck&&n&&tY(A),n}function cp(e,A){const t=A.width-A.x;t<1||Si(e.repeat(t),A)}function Ip(){const[e,A]=V.useState(0),t=V.useCallback(()=>A(n=>1-n),[A]);return V.useEffect(()=>{const n=setInterval(t,300);return()=>{clearInterval(n)}},[]),!!e}const up=V.createContext({sendmessage(){},sendclose(){},didclose(){}}),nY=V.createContext(""),hF={input:{color:"white",active:"yellow"}};function xI(e){return e?hF.input.active:hF.input.color}function yr(e,A){return typeof e==typeof A?e:A}function iY(e,A){return`vm:${e}:${A}`}function vc(e,A,t=0,n=""){return`${e.substring(0,A)}${n}${e.substring(A+t)}`}function ygA({item:e,context:A}){return Si(e,A),null}function wgA({chip:e,active:A,label:t,args:n,context:i}){const[r,s,o]=[yr(n[0],""),yr(n[1],""),yr(n[2],"")],a=o||` ${s.toUpperCase()} `,l=xI(A);Si(`${i.isEven?"$black$onltgray":"$black$ondkcyan"}${a}$${l}$onclear ${t}`,i);const I=V.useContext(up),u=V.useCallback(()=>{I.sendmessage(iY(e,r)),I.sendclose()},[e,I,r]);return hA.jsxs(hA.Fragment,{children:[A&&hA.jsx(Gs,{OK_BUTTON:u}),hA.jsx(Md,{hotkey:s,children:u})]})}function DgA({chip:e,active:A,label:t,args:n,context:i}){const[r,s]=[yr(n[0],""),n[1]],o=xI(A);Si(` $purple$16 $${o}${t}`,i);const a=V.useContext(up),l=V.useCallback(()=>{a.sendmessage(iY(e,r),s),a.sendclose()},[a,r]);return A&&hA.jsx(Gs,{OK_BUTTON:l})}function TS(e,A){const[t,n]=V.useState(void 0);function i(r){tAA(e,A,r)}return V.useEffect(()=>rAA(e,A,n),[]),[t,i]}function MgA(e,A){const[t,n]=V.useState(void 0),[i,r]=V.useState(0);return V.useEffect(()=>sAA(e,A,s=>{s!==void 0&&t===void 0?n(s):r(1-i)}),[]),[t]}function RgA({chip:e,active:A,label:t,args:n,context:i}){const[r,s,o]=[yr(n[0],""),yr(n[1],-1),yr(n[2],-1)];let a,l;s===-1?(a=0,l=31):o===-1?(a=0,l=s):(a=s,l=o);const[I,u]=TS(e,r),C=I??0,h=Ip(),[d,m]=V.useState(""),[p,f]=V.useState(0),[Q,B]=V.useState(!1);let w=`${I??0}`;const R=t.trim(),v=xI(A);gp(i),Q&&(w=h?vc(d,p,1,"$219+"):d),Si(` # $${v}${R} $green${w} \\`,i),cp(" ",i);const x=V.useCallback(N=>{const F=N.alt?10:1;u(Math.min(l,C+F))},[l,I]),U=V.useCallback(N=>{const F=N.alt?10:1;u(Math.max(a,C-F))},[a,I]),S=V.useCallback(()=>{B(N=>{const F=!N;if(F){const K=`${I}`;m(K),f(K.length)}else{const K=parseFloat(d),z=isNaN(K)?0:K;u(Math.min(l,Math.max(a,z)))}return F})},[B,m,a,l,I,d]);return I!==void 0&&hA.jsxs(hA.Fragment,{children:[A&&hA.jsx(Gs,{MOVE_LEFT:U,MOVE_RIGHT:x,OK_BUTTON:S}),Q&&hA.jsxs(KQ,{blockhotkeys:!0,children:[hA.jsx(Md,{hotkey:"ctrl+c",children:()=>{console.info("copy")}}),hA.jsx(Md,{hotkey:"ctrl+v",children:()=>{console.info("paste")}}),hA.jsx(Md,{hotkey:"ctrl+a",children:()=>{console.info("select all")}}),hA.jsx(Gs,{MOVE_LEFT:()=>{f(N=>Math.max(0,N-1))},MOVE_RIGHT:()=>{f(N=>Math.min(d.length,N+1))},CANCEL_BUTTON:S,OK_BUTTON:S,keydown:N=>{switch(N.key.toLowerCase()){case"delete":d.length>0&&m(F=>vc(F,p,1));break;case"backspace":p>0&&(m(F=>vc(F,p-1,1)),f(F=>Math.max(0,F-1)));break}N.key.length===1&&d.lengthvc(F,p,0,N.key)),f(F=>F+1))}})]})]})}function SgA({chip:e,active:A,label:t,args:n,context:i}){const[r,s,o]=[yr(n[0],""),yr(n[1],""),yr(n[2],"")];let a,l;s===""?(a="L",l="H"):o===""?(a="L",l=s):(a=s,l=o);const I=0,u=8,[C,h]=TS(e,r),d=C??0,m=Ip(),p=t.trim(),f=xI(A);gp(i),Si(` $red $29 $${f}${p} \\`,i);const B=vc("----:----",d,1,`$green${A?m?"$26":"$27":"$4"}$${f}`).replaceAll("-","$7").replaceAll(":","$9");Si(`$${f}${a}${B}${l} $green${d+1} \\`,i),cp(" ",i);const w=V.useCallback(v=>{const x=v.alt?10:1;h(Math.min(u,d+x))},[u,C]),R=V.useCallback(v=>{const x=v.alt?10:1;h(Math.max(I,d-x))},[I,C]);return hA.jsx(hA.Fragment,{children:A&&hA.jsx(Gs,{MOVE_LEFT:R,MOVE_RIGHT:w})})}function vgA({chip:e,active:A,label:t,args:n,context:i}){const[r,...s]=[yr(n[0],""),...n.slice(1)],o=0,a=s.length-1,[l,I]=TS(e,r),u=l??0,C=Ip(),h=`${s[u]}`,d=t.trim(),m=xI(A);gp(i),Si(` $dkred ? $${m}${d} \\`,i);const p=A?C?"$26":"$27":"/";Si(`${u+1}$green${p}$${m}${a+1} \\`,i),Si(`$green${h} \\`,i),cp(" ",i);const f=V.useCallback(B=>{const w=B.alt?10:1;I(Math.min(a,u+w))},[a,l]),Q=V.useCallback(B=>{const w=B.alt?10:1;I(Math.max(o,u-w))},[o,l]);return hA.jsx(hA.Fragment,{children:A&&hA.jsx(Gs,{MOVE_LEFT:Q,MOVE_RIGHT:f})})}function NgA({chip:e,active:A,label:t,args:n,context:i}){const r=yr(n[0],""),[s]=MgA(e,r),o=(s==null?void 0:s.toJSON())??"",a=Ip(),[l,I]=V.useState(0),[u,C]=V.useState(!1);let h=`${o} `;const d=t.trim(),m=xI(A);return gp(i),u&&a&&(h=vc(h,l,1,"$219+")),Si(`$green $20 $${m}${d}$green ${h} \\`,i),cp(" ",i),hA.jsxs(hA.Fragment,{children:[A&&hA.jsx(Gs,{OK_BUTTON:()=>{s&&(C(!0),I(s.length))}}),u&&hA.jsx(KQ,{blockhotkeys:!0,children:hA.jsx(Gs,{MOVE_LEFT:()=>{I(p=>Math.max(0,p-1))},MOVE_RIGHT:()=>{I(p=>Math.min(o.length,p+1))},CANCEL_BUTTON:()=>C(!1),OK_BUTTON:()=>C(!1),keydown:p=>{if(!s)return;const{key:f}=p,Q=s.toJSON();switch(f.toLowerCase()){case"delete":Q.length>0&&s.delete(l,1);break;case"backspace":l>0&&(s.delete(l-1,1),I(B=>Math.max(0,B-1)));break;default:f.length===1&&Q.lengthB+1));break}}})})]})}function xgA({item:e,active:A}){const t=V.useContext(nY),n=V.useContext(eY);if(n.isEven=n.y%2===0,typeof e=="string")return hA.jsx(ygA,{player:t,item:e,context:n});if(Array.isArray(e)){const[i,r,s,...o]=e;if(typeof i!="string"||typeof r!="string"||typeof s!="string")return null;const a={player:t,chip:i,active:A,label:r,args:o,context:n};switch(s.toLowerCase()){case"hk":case"hotkey":return hA.jsx(wgA,{...a});case"hypertext":return hA.jsx(DgA,{...a});case"rn":case"range":return hA.jsx(SgA,{...a});case"sl":case"select":return hA.jsx(vgA,{...a});case"nm":case"number":return hA.jsx(RgA,{...a});case"tx":case"text":return hA.jsx(NgA,{...a});default:Si(`$red unknown input type ${s}`,n);break}tY(n)}return null}function US(e,A,t,n,i){const r=e*A;return V.useMemo(()=>vR({char:new Array(r).fill(t),color:new Array(r).fill(n),bg:new Array(r).fill(i)}),[e,A])}const fF=vO(),EF=NO();function FS({width:e,height:A,tiles:t}){const n=_Q(t);return fF&&EF&&hA.jsx(FO,{...n,width:e,height:A,palette:fF,charset:EF})}function rY(e,A,t,n){e.char=new Array(e.char.length).fill(A),e.color=new Array(e.color.length).fill(t),e.bg=new Array(e.bg.length).fill(n)}function dn(e,A,t,n,i,r){if(n<0||n>=A||i<0||i>=t)return;const s=n+i*A;a6(r).forEach(o=>{const a=r[o];hb(a)&&(e[o][s]=a)})}function sY({margin:e=1,selected:A=-1,player:t,width:n,height:i,color:r,bg:s,text:o}){const a=US(n,i,0,r,s);rY(a,0,r,s);const l={...LB(n,i,r,s),...a};return l.x=e,l.leftEdge=e,l.rightEdge=l.width-e,hA.jsx(nY.Provider,{value:t,children:hA.jsxs(eY.Provider,{value:l,children:[o.map((I,u)=>hA.jsx(xgA,{item:I,active:u===A},u)),hA.jsx(FS,{width:n,height:i,tiles:a})]})})}var oY={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},_S={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},TgA=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],GB={CSS:{},springs:{}};function Rs(e,A,t){return Math.min(Math.max(e,A),t)}function eC(e,A){return e.indexOf(A)>-1}function hy(e,A){return e.apply(null,A)}var te={arr:function(e){return Array.isArray(e)},obj:function(e){return eC(Object.prototype.toString.call(e),"Object")},pth:function(e){return te.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return e.nodeType||te.svg(e)},str:function(e){return typeof e=="string"},fnc:function(e){return typeof e=="function"},und:function(e){return typeof e>"u"},nil:function(e){return te.und(e)||e===null},hex:function(e){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e)},rgb:function(e){return/^rgb/.test(e)},hsl:function(e){return/^hsl/.test(e)},col:function(e){return te.hex(e)||te.rgb(e)||te.hsl(e)},key:function(e){return!oY.hasOwnProperty(e)&&!_S.hasOwnProperty(e)&&e!=="targets"&&e!=="keyframes"}};function aY(e){var A=/\(([^)]+)\)/.exec(e);return A?A[1].split(",").map(function(t){return parseFloat(t)}):[]}function lY(e,A){var t=aY(e),n=Rs(te.und(t[0])?1:t[0],.1,100),i=Rs(te.und(t[1])?100:t[1],.1,100),r=Rs(te.und(t[2])?10:t[2],.1,100),s=Rs(te.und(t[3])?0:t[3],.1,100),o=Math.sqrt(i/n),a=r/(2*Math.sqrt(i*n)),l=a<1?o*Math.sqrt(1-a*a):0,I=1,u=a<1?(a*o+-s)/l:-s+o;function C(d){var m=A?A*d/1e3:d;return a<1?m=Math.exp(-m*a*o)*(I*Math.cos(l*m)+u*Math.sin(l*m)):m=(I+u*m)*Math.exp(-m*o),d===0||d===1?d:1-m}function h(){var d=GB.springs[e];if(d)return d;for(var m=1/6,p=0,f=0;;)if(p+=m,C(p)===1){if(f++,f>=16)break}else f=0;var Q=p*m*1e3;return GB.springs[e]=Q,Q}return A?C:h}function UgA(e){return e===void 0&&(e=10),function(A){return Math.ceil(Rs(A,1e-6,1)*e)*(1/e)}}var FgA=function(){var e=11,A=1/(e-1);function t(I,u){return 1-3*u+3*I}function n(I,u){return 3*u-6*I}function i(I){return 3*I}function r(I,u,C){return((t(u,C)*I+n(u,C))*I+i(u))*I}function s(I,u,C){return 3*t(u,C)*I*I+2*n(u,C)*I+i(u)}function o(I,u,C,h,d){var m,p,f=0;do p=u+(C-u)/2,m=r(p,h,d)-I,m>0?C=p:u=p;while(Math.abs(m)>1e-7&&++f<10);return p}function a(I,u,C,h){for(var d=0;d<4;++d){var m=s(u,C,h);if(m===0)return u;var p=r(u,C,h)-I;u-=p/m}return u}function l(I,u,C,h){if(!(0<=I&&I<=1&&0<=C&&C<=1))return;var d=new Float32Array(e);if(I!==u||C!==h)for(var m=0;m=.001?a(f,v,I,C):x===0?v:o(f,Q,Q+A,I,C)}return function(f){return I===u&&C===h||f===0||f===1?f:r(p(f),u,h)}}return l}(),gY=function(){var e={linear:function(){return function(n){return n}}},A={Sine:function(){return function(n){return 1-Math.cos(n*Math.PI/2)}},Expo:function(){return function(n){return n?Math.pow(2,10*n-10):0}},Circ:function(){return function(n){return 1-Math.sqrt(1-n*n)}},Back:function(){return function(n){return n*n*(3*n-2)}},Bounce:function(){return function(n){for(var i,r=4;n<((i=Math.pow(2,--r))-1)/11;);return 1/Math.pow(4,3-r)-7.5625*Math.pow((i*3-2)/22-n,2)}},Elastic:function(n,i){n===void 0&&(n=1),i===void 0&&(i=.5);var r=Rs(n,1,10),s=Rs(i,.1,2);return function(o){return o===0||o===1?o:-r*Math.pow(2,10*(o-1))*Math.sin((o-1-s/(Math.PI*2)*Math.asin(1/r))*(Math.PI*2)/s)}}},t=["Quad","Cubic","Quart","Quint"];return t.forEach(function(n,i){A[n]=function(){return function(r){return Math.pow(r,i+2)}}}),Object.keys(A).forEach(function(n){var i=A[n];e["easeIn"+n]=i,e["easeOut"+n]=function(r,s){return function(o){return 1-i(r,s)(1-o)}},e["easeInOut"+n]=function(r,s){return function(o){return o<.5?i(r,s)(o*2)/2:1-i(r,s)(o*-2+2)/2}},e["easeOutIn"+n]=function(r,s){return function(o){return o<.5?(1-i(r,s)(1-o*2))/2:(i(r,s)(o*2-1)+1)/2}}}),e}();function kS(e,A){if(te.fnc(e))return e;var t=e.split("(")[0],n=gY[t],i=aY(e);switch(t){case"spring":return lY(e,A);case"cubicBezier":return hy(FgA,i);case"steps":return hy(UgA,i);default:return hy(n,i)}}function cY(e){try{var A=document.querySelectorAll(e);return A}catch{return}}function Cp(e,A){for(var t=e.length,n=arguments.length>=2?arguments[1]:void 0,i=[],r=0;r1&&(d-=1),d<1/6?C+(h-C)*6*d:d<1/2?h:d<2/3?C+(h-C)*(2/3-d)*6:C}var o,a,l;if(n==0)o=a=l=i;else{var I=i<.5?i*(1+n):i+n-i*n,u=2*i-I;o=s(u,I,t+1/3),a=s(u,I,t),l=s(u,I,t-1/3)}return"rgba("+o*255+","+a*255+","+l*255+","+r+")"}function GgA(e){if(te.rgb(e))return _gA(e);if(te.hex(e))return kgA(e);if(te.hsl(e))return LgA(e)}function po(e){var A=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(e);if(A)return A[1]}function bgA(e){if(eC(e,"translate")||e==="perspective")return"px";if(eC(e,"rotate")||eC(e,"skew"))return"deg"}function OD(e,A){return te.fnc(e)?e(A.target,A.id,A.total):e}function Ss(e,A){return e.getAttribute(A)}function bS(e,A,t){var n=po(A);if(LS([t,"deg","rad","turn"],n))return A;var i=GB.CSS[A+t];if(!te.und(i))return i;var r=100,s=document.createElement(e.tagName),o=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;o.appendChild(s),s.style.position="absolute",s.style.width=r+t;var a=r/s.offsetWidth;o.removeChild(s);var l=a*parseFloat(A);return GB.CSS[A+t]=l,l}function IY(e,A,t){if(A in e.style){var n=A.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=e.style[A]||getComputedStyle(e).getPropertyValue(n)||"0";return t?bS(e,i,t):i}}function OS(e,A){if(te.dom(e)&&!te.inp(e)&&(!te.nil(Ss(e,A))||te.svg(e)&&e[A]))return"attribute";if(te.dom(e)&&LS(TgA,A))return"transform";if(te.dom(e)&&A!=="transform"&&IY(e,A))return"css";if(e[A]!=null)return"object"}function uY(e){if(te.dom(e)){for(var A=e.style.transform||"",t=/(\w+)\(([^)]*)\)/g,n=new Map,i;i=t.exec(A);)n.set(i[1],i[2]);return n}}function OgA(e,A,t,n){var i=eC(A,"scale")?1:0+bgA(A),r=uY(e).get(A)||i;return t&&(t.transforms.list.set(A,r),t.transforms.last=A),n?bS(e,r,n):r}function PS(e,A,t,n){switch(OS(e,A)){case"transform":return OgA(e,A,n,t);case"css":return IY(e,A,t);case"attribute":return Ss(e,A);default:return e[A]||0}}function YS(e,A){var t=/^(\*=|\+=|-=)/.exec(e);if(!t)return e;var n=po(e)||0,i=parseFloat(A),r=parseFloat(e.replace(t[0],""));switch(t[0][0]){case"+":return i+r+n;case"-":return i-r+n;case"*":return i*r+n}}function CY(e,A){if(te.col(e))return GgA(e);if(/\s/g.test(e))return e;var t=po(e),n=t?e.substr(0,e.length-t.length):e;return A?n+A:n}function JS(e,A){return Math.sqrt(Math.pow(A.x-e.x,2)+Math.pow(A.y-e.y,2))}function PgA(e){return Math.PI*2*Ss(e,"r")}function YgA(e){return Ss(e,"width")*2+Ss(e,"height")*2}function JgA(e){return JS({x:Ss(e,"x1"),y:Ss(e,"y1")},{x:Ss(e,"x2"),y:Ss(e,"y2")})}function hY(e){for(var A=e.points,t=0,n,i=0;i0&&(t+=JS(n,r)),n=r}return t}function HgA(e){var A=e.points;return hY(e)+JS(A.getItem(A.numberOfItems-1),A.getItem(0))}function fY(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return PgA(e);case"rect":return YgA(e);case"line":return JgA(e);case"polyline":return hY(e);case"polygon":return HgA(e)}}function KgA(e){var A=fY(e);return e.setAttribute("stroke-dasharray",A),A}function VgA(e){for(var A=e.parentNode;te.svg(A)&&te.svg(A.parentNode);)A=A.parentNode;return A}function EY(e,A){var t=A||{},n=t.el||VgA(e),i=n.getBoundingClientRect(),r=Ss(n,"viewBox"),s=i.width,o=i.height,a=t.viewBox||(r?r.split(" "):[0,0,s,o]);return{el:n,viewBox:a,x:a[0]/1,y:a[1]/1,w:s,h:o,vW:a[2],vH:a[3]}}function zgA(e,A){var t=te.str(e)?cY(e)[0]:e,n=A||100;return function(i){return{property:i,el:t,svg:EY(t),totalLength:fY(t)*(n/100)}}}function WgA(e,A,t){function n(I){I===void 0&&(I=0);var u=A+I>=1?A+I:0;return e.el.getPointAtLength(u)}var i=EY(e.el,e.svg),r=n(),s=n(-1),o=n(1),a=t?1:i.w/i.vW,l=t?1:i.h/i.vH;switch(e.property){case"x":return(r.x-i.x)*a;case"y":return(r.y-i.y)*l;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function BF(e,A){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,n=CY(te.pth(e)?e.totalLength:e,A)+"";return{original:n,numbers:n.match(t)?n.match(t).map(Number):[0],strings:te.str(e)||A?n.split(t):[]}}function HS(e){var A=e?hp(te.arr(e)?e.map(dF):dF(e)):[];return Cp(A,function(t,n,i){return i.indexOf(t)===n})}function dY(e){var A=HS(e);return A.map(function(t,n){return{target:t,id:n,total:A.length,transforms:{list:uY(t)}}})}function ZgA(e,A){var t=GS(A);if(/^spring/.test(t.easing)&&(t.duration=lY(t.easing)),te.arr(e)){var n=e.length,i=n===2&&!te.obj(e[0]);i?e={value:e}:te.fnc(A.duration)||(t.duration=A.duration/n)}var r=te.arr(e)?e:[e];return r.map(function(s,o){var a=te.obj(s)&&!te.pth(s)?s:{value:s};return te.und(a.delay)&&(a.delay=o?0:A.delay),te.und(a.endDelay)&&(a.endDelay=o===r.length-1?A.endDelay:0),a}).map(function(s){return fp(s,t)})}function qgA(e){for(var A=Cp(hp(e.map(function(r){return Object.keys(r)})),function(r){return te.key(r)}).reduce(function(r,s){return r.indexOf(s)<0&&r.push(s),r},[]),t={},n=function(r){var s=A[r];t[s]=e.map(function(o){var a={};for(var l in o)te.key(l)?l==s&&(a.value=o[l]):a[l]=o[l];return a})},i=0;i0&&(e=requestAnimationFrame(t))}function t(i){for(var r=Vr.length,s=0;s0?requestAnimationFrame(t):void 0}function n(){Ot.suspendWhenDocumentHidden&&(pF()?e=cancelAnimationFrame(e):(Vr.forEach(function(i){return i._onDocumentVisibility()}),mY()))}return typeof document<"u"&&document.addEventListener("visibilitychange",n),A}();function pF(){return!!document&&document.hidden}function Ot(e){e===void 0&&(e={});var A=0,t=0,n=0,i,r=0,s=null;function o(Q){var B=window.Promise&&new Promise(function(w){return s=w});return Q.finished=B,B}var a=tcA(e);o(a);function l(){var Q=a.direction;Q!=="alternate"&&(a.direction=Q!=="normal"?"normal":"reverse"),a.reversed=!a.reversed,i.forEach(function(B){return B.reversed=a.reversed})}function I(Q){return a.reversed?a.duration-Q:Q}function u(){A=0,t=I(a.currentTime)*(1/Ot.speed)}function C(Q,B){B&&B.seek(Q-B.timelineOffset)}function h(Q){if(a.reversePlayback)for(var w=r;w--;)C(Q,i[w]);else for(var B=0;B2||(H=Math.round(H*P)/P)),$.push(H)}var q=z.length;if(!q)iA=$[0];else{iA=z[0];for(var CA=0;CA0&&(a.began=!0,m("begin")),!a.loopBegan&&a.currentTime>0&&(a.loopBegan=!0,m("loopBegin")),v<=w&&a.currentTime!==0&&d(0),(v>=R&&a.currentTime!==B||!B)&&d(B),v>w&&v=B&&(t=0,p(),a.remaining?(A=n,m("loopComplete"),a.loopBegan=!1,a.direction==="alternate"&&l()):(a.paused=!0,a.completed||(a.completed=!0,m("loopComplete"),m("complete"),!a.passThrough&&"Promise"in window&&(s(),o(a)))))}return a.reset=function(){var Q=a.direction;a.passThrough=!1,a.currentTime=0,a.progress=0,a.paused=!0,a.began=!1,a.loopBegan=!1,a.changeBegan=!1,a.completed=!1,a.changeCompleted=!1,a.reversePlayback=!1,a.reversed=Q==="reverse",a.remaining=a.loop,i=a.children,r=i.length;for(var B=r;B--;)a.children[B].reset();(a.reversed&&a.loop!==!0||Q==="alternate"&&a.loop===1)&&a.remaining++,d(a.reversed?a.duration:0)},a._onDocumentVisibility=u,a.set=function(Q,B){return QY(Q,B),a},a.tick=function(Q){n=Q,A||(A=n),f((n+(t-A))*Ot.speed)},a.seek=function(Q){f(I(Q))},a.pause=function(){a.paused=!0,u()},a.play=function(){a.paused&&(a.completed&&a.reset(),a.paused=!1,Vr.push(a),u(),mY())},a.reverse=function(){l(),a.completed=!a.reversed,u()},a.restart=function(){a.reset(),a.play()},a.remove=function(Q){var B=HS(Q);yY(B,a)},a.reset(),a.autoplay&&a.play(),a}function mF(e,A){for(var t=A.length;t--;)LS(e,A[t].animatable.target)&&A.splice(t,1)}function yY(e,A){var t=A.animations,n=A.children;mF(e,t);for(var i=n.length;i--;){var r=n[i],s=r.animations;mF(e,s),!s.length&&!r.children.length&&n.splice(i,1)}!t.length&&!n.length&&A.pause()}function ncA(e){for(var A=HS(e),t=Vr.length;t--;){var n=Vr[t];yY(A,n)}}function icA(e,A){A===void 0&&(A={});var t=A.direction||"normal",n=A.easing?kS(A.easing):null,i=A.grid,r=A.axis,s=A.from||0,o=s==="first",a=s==="center",l=s==="last",I=te.arr(e),u=parseFloat(I?e[0]:e),C=I?parseFloat(e[1]):0,h=po(I?e[1]:e)||0,d=A.start||0+(I?u:0),m=[],p=0;return function(f,Q,B){if(o&&(s=0),a&&(s=(B-1)/2),l&&(s=B-1),!m.length){for(var w=0;w-1&&Vr.splice(i,1);function s(C){C.passThrough=!0}for(var o=0;ovR(new Array(t).fill(0)),[t])}function ocA({width:e,height:A,dither:t}){const n=_Q(t);return hA.jsx(nS,{width:e,height:A,alphas:n})}function acA(e){e.splice(0,e.length,...new Array(e.length).fill(0))}function fy(e,A,t,n,i,r){if(n<0||n>=A||i<0||i>=t)return-1;e[n+i*A]=r}function lcA({player:e,name:A,width:t,height:n,color:i,bg:r,text:s,shouldclose:o}){const a=t-3,l=n-3,I=US(t,n,0,i,r),u=scA(a,l),C=V.useContext(up);for(let z=1;z2&&zz.viewport),{height:S}=U.getCurrentViewport(),N=V.useCallback(()=>{o&&C.didclose()},[o,C]);V.useEffect(()=>{if(!x.current)return;const z=o?0:S,P=o?n*-mi:0,$=o?"easeInBack":"easeOutBack",eA={y:z};x.current.position.y=z,Ot({y:P,duration:300,easing:$,targets:eA,complete:N,update(){x.current&&(x.current.position.y=bq(eA.y,mi*.125))}})},[o]);const F=V.useCallback(z=>{const P=z.alt?10:1;f($=>Math.max(0,$-P))},[f]),K=V.useCallback(z=>{const P=z.alt?10:1;f($=>Math.min(s.length,$+P))},[f]);return hA.jsx("group",{ref:x,children:hA.jsxs(KQ,{children:[hA.jsx(Gs,{MOVE_UP:F,MOVE_DOWN:K,CANCEL_BUTTON:C.sendclose}),hA.jsx(FS,{tiles:I,width:t,height:n}),hA.jsxs("group",{position:[2*dr,2*mi,0],children:[hA.jsx(ocA,{dither:u,width:a,height:l}),hA.jsx(sY,{player:e,name:A,width:a,height:l,margin:0,color:i,bg:$R,text:B,selected:w})]})]})})}function yF({player:e,layers:A,rect:t,shouldclose:n=!1}){switch(t.type){case 0:return hA.jsx(sY,{player:e,name:t.name,width:t.width,height:t.height,color:14,bg:1,text:t.text});case 1:return hA.jsx(lcA,{player:e,name:t.name,width:t.width,height:t.height,color:14,bg:1,text:t.text,shouldclose:n});case 2:return hA.jsx(ftA,{player:e,layers:A,width:t.width,height:t.height})}return null}function gcA({player:e,layers:A,layout:t}){const n=pr(m=>m.viewport),{width:i,height:r}=n.getCurrentViewport(),s=Math.floor(i/dr),o=Math.floor(r/mi),a=i-s*dr,l=r-o*mi,[I,u]=V.useState();if(s<1||o<1||A===void 0||t===void 0)return null;const C={name:"main",type:2,x:0,y:0,width:s,height:o,text:[]},h=[];let d=!0;return t.forEach(m=>{let p;switch(m.edge){case ac.LEFT:p={name:m.name,type:0,x:C.x,y:C.y,width:m.size,height:C.height,text:m.text},C.x+=m.size,C.width-=m.size,h.push(p);break;default:case ac.RIGHT:p={name:m.name,type:0,x:C.x+C.width-m.size,y:C.y,width:m.size,height:C.height,text:m.text},C.width-=m.size,h.push(p);break;case ac.TOP:p={name:m.name,type:0,x:C.x,y:C.y,width:C.width,height:m.size,text:m.text},C.y+=m.size,C.height-=m.size,h.push(p);break;case ac.BOTTOM:p={name:m.name,type:0,x:C.x,y:C.y+C.height-m.size,width:C.width,height:m.size,text:m.text},C.height-=m.size,h.push(p);break;case ac.SCROLL:p={name:m.name,type:1,x:0,y:0,width:gB(m.size||50,24,C.width-2),height:gB(18,8,C.height-8),text:m.text},p.x=C.x+Math.round((C.width-p.width)*.5),p.y=C.y+Math.floor((C.height-p.height)*.5),d=!1,iI(I,p)||u(pi(p))}}),h.unshift(C),hA.jsx(up.Provider,{value:{sendmessage(m,p){Zl.emit(m,"gadget",p,e)},sendclose(){Zl.emit("gadgetserver:clearscroll","gadget",void 0,e)},didclose(){u(void 0)}},children:hA.jsxs("group",{position:[a*.5,l*.5,0],children:[h.map((m,p)=>hA.jsx("group",{position:[m.x*dr,m.y*mi,p*10],children:hA.jsx(yF,{player:e,layers:A,rect:m})},m.name)),I&&hA.jsxs(tC.Fragment,{children:[hA.jsx("group",{position:[0,0,800],children:hA.jsx(jeA,{width:s,height:o,alpha:.14})}),hA.jsx("group",{position:[I.x*dr,I.y*mi,900],children:hA.jsx(yF,{player:e,layers:A,rect:I,shouldclose:d})})]},I.name)]})})}function ccA(){const e=Qj(),{player:A,layout:t}=_Q(e);return hA.jsx(gcA,{player:A,layout:t,layers:e.layers})}const IcA="/assets/scratches-CuKAcXgp.jpg",ucA="main - 0.12.0",wF=" ",Ey=`${wF}< Click To Boot >${wF}${ucA}`;function CcA({onBoot:e}){const A=pr(u=>u.viewport),{width:t,height:n}=A.getCurrentViewport(),i=Math.floor(t/dr),r=Math.floor(n/mi),s=t-i*dr,o=n-r*mi,a=US(i,r,0,0,0),[l,I]=V.useState(0);return V.useEffect(()=>{async function u(){await o6(),e()}function C(){u()}return document.addEventListener("pointerdown",C),()=>{document.removeEventListener("pointerdown",C)}},[e]),V.useEffect(()=>{const u=setInterval(()=>I(C=>C+Ey.length-1),250);return()=>{clearInterval(u)}},[I]),V.useEffect(()=>{rY(a,0,0,0);for(let u=0;unew wq),[t,n]=V.useState(!1);return V.useEffect(()=>{if(!weA)return;document.body.appendChild(A.dom),A.showPanel(0),A.dom.style.cssText="position:fixed;bottom:0;left:0;";const i=VZ(()=>A.begin()),r=zZ(()=>A.end());return()=>{document.body.removeChild(A.dom),i(),r()}},[A]),hA.jsxs(hA.Fragment,{children:[hA.jsx(mq,{makeDefault:!0,near:1,far:2e3,position:[0,0,1e3]}),hA.jsx(TeA,{children:t?hA.jsx(ccA,{}):hA.jsx(CcA,{onBoot:()=>{oAA(),n(!0)}})}),hA.jsx(V.Suspense,{fallback:null,children:hA.jsxs(QeA,{multisampling:0,children:[hA.jsx(NeA,{}),hA.jsx(yeA,{blendFunction:Se.NORMAL,offset:[DF,-DF]}),hA.jsx(ReA,{}),hA.jsx(xeA,{opacity:.35,texture:e,blendFunction:Se.OVERLAY}),hA.jsx(meA,{brightness:.02,contrast:.1})]})})]})}const MF=new k,RF=new k,fcA=e=>({...SG(e),filter:A=>{const t=A.filter(s=>!(!s.object.visible||(s.object.userData.clippingPlanes??[]).some(a=>(a.projectPoint(s.point,MF),RF.subVectors(s.point,MF).normalize().round(),a.normal.equals(RF)===!1)))),n=t.findIndex(s=>s.object.userData.blocking),i=n===-1?t:t.slice(0,n+1);let r="default";return i.some(s=>s.object.userData.cursor?(r=s.object.userData.cursor,!0):!1),document.querySelectorAll("html, body").forEach(s=>{s.style.cursor=r}),i}});function EcA(){const[e,A]=yG(),t=Q2(A.width),n=Q2(A.height);return hA.jsxs(hA.Fragment,{children:[hA.jsx("div",{ref:e,style:{position:"absolute",inset:0},onContextMenuCapture:i=>{i.preventDefault()},children:hA.jsx("div",{style:{marginLeft:"auto",marginRight:"auto",margin:"auto",width:t,height:n},children:hA.jsx(hq,{flat:!0,linear:!0,dpr:1,shadows:!1,"touch-action":"none",gl:{alpha:!1,stencil:!1,antialias:!1,precision:"highp",preserveDrawingBuffer:!0,powerPreference:"high-performance"},style:{imageRendering:"pixelated"},events:fcA,onCreated:({gl:i})=>{i.localClippingEnabled=!0},children:hA.jsx(hcA,{})})})}),hA.jsx(dq,{})]})}const dcA=Y_(document.getElementById("engine"));dcA.render(hA.jsx(V.StrictMode,{children:hA.jsx(EcA,{})}))});export default BcA(); + For further details.`);this.skipValidations=re(t,"skipValidations")?t.skipValidations:Ga.skipValidations}}lp.DEFER_DEFINITION_ERRORS_HANDLING=!1;ugA(lp,[YlA,VlA,ngA,igA,sgA,rgA,ogA,agA,ggA,IgA]);const CgA=xO(32,126).map(e=>String.fromCharCode(e)),hgA=Zs({name:"Whitespace",pattern:/ +/}),fgA=Zs({name:"WhitespaceSkipped",pattern:/ +/,group:ri.SKIPPED}),jP=Zs({name:"StringLiteral",pattern:/[^ $]+/,start_chars_hint:CgA}),vS=Zs({name:"StringLiteralDouble",pattern:/"(?:[^\\"]|\\(?:[^\n\r]|u[0-9a-fA-F]{4}))*"/}),XP=Zs({name:"MaybeFlag",pattern:/\$[^ $]+/}),NS=Zs({name:"NumberLiteral",pattern:/\$-?(\d*\.)?\d+([eE][+-]?\d+)?[jJ]?[lL]?\+?/}),xS=Zs({name:"ContinueLine",pattern:/\\/});function $P(e,A=""){return Zs({name:A||e,pattern:new RegExp(e.toLowerCase(),"i")})}const AY=[["blue"],["green"],["cyan"],["red"],["purple"],["yellow"],["white"],["dkblue"],["dkgreen"],["dkcyan"],["dkred"],["dkpurple"],["dkyellow|brown","brown"],["dkwhite|ltgray|ltgrey|gray|grey","gray"],["dkgray|dkgrey|ltblack","dkgray"],["black"],["clear"]],CF={black:0,dkblue:1,dkgreen:2,dkcyan:3,dkred:4,dkpurple:5,brown:6,gray:7,dkgray:8,blue:9,green:10,cyan:11,red:12,purple:13,yellow:14,white:15,clear:-1},Bn=AY.map(([e,A])=>$P(`\\$(${e})`,A||e)),jt=[...AY.map(([e,A])=>$P(`\\$on(${e})`,`on${A||e}`))],EgA=[hgA,xS,...Bn,...jt,vS,jP,NS,XP],dgA=new ri(EgA,{skipValidations:!yB,ensureOptimizations:yB}),BgA=new ri([fgA,xS,...Bn,...jt,vS,jP,NS,XP],{skipValidations:!yB,ensureOptimizations:yB});function QgA(e,A=!1){return A?BgA.tokenize(e):dgA.tokenize(e)}function LB(e,A,t,n){return{measureOnly:!1,resetCheck:!0,x:0,y:0,isEven:!0,resetColor:t,resetBg:n,activeColor:t,activeBg:n,width:e,height:A,leftEdge:void 0,rightEdge:void 0,bottomEdge:void 0,char:[],color:[],bg:[]}}function pgA(e,A){e.x=A.x,e.y=A.y,e.activeColor=A.activeColor,e.activeBg=A.activeBg}function gp(e){const A=V.useMemo(()=>({...e}),[e]);pgA(e,A)}const eY=V.createContext(LB(1,1,15,1));function tY(e){e.activeColor=e.resetColor,e.activeBg=e.resetBg}function mgA(e,A){const t=A.y;function n(){++A.x,A.x>=(A.rightEdge??A.width)&&(A.x=A.leftEdge??0,++A.y)}function i(){return!(A.x<(A.leftEdge??0)||A.x>=(A.rightEdge??A.width)||A.y<0||A.y>=(A.bottomEdge??A.height))}function r(s){for(let o=0;o=A.height)return!0}return A.measureOnly!==!0&&(A.x!==0||A.y===t)&&(A.x=A.leftEdge??0,++A.y),!0}function Si(e,A){const t=QgA(e);if(!t.tokens)return!0;const n=mgA(t.tokens,A);return A.resetCheck&&n&&tY(A),n}function cp(e,A){const t=A.width-A.x;t<1||Si(e.repeat(t),A)}function Ip(){const[e,A]=V.useState(0),t=V.useCallback(()=>A(n=>1-n),[A]);return V.useEffect(()=>{const n=setInterval(t,300);return()=>{clearInterval(n)}},[]),!!e}const up=V.createContext({sendmessage(){},sendclose(){},didclose(){}}),nY=V.createContext(""),hF={input:{color:"white",active:"yellow"}};function xI(e){return e?hF.input.active:hF.input.color}function yr(e,A){return typeof e==typeof A?e:A}function iY(e,A){return`vm:${e}:${A}`}function vc(e,A,t=0,n=""){return`${e.substring(0,A)}${n}${e.substring(A+t)}`}function ygA({item:e,context:A}){return Si(e,A),null}function wgA({chip:e,active:A,label:t,args:n,context:i}){const[r,s,o]=[yr(n[0],""),yr(n[1],""),yr(n[2],"")],a=o||` ${s.toUpperCase()} `,l=xI(A);Si(`${i.isEven?"$black$onltgray":"$black$ondkcyan"}${a}$${l}$onclear ${t}`,i);const I=V.useContext(up),u=V.useCallback(()=>{I.sendmessage(iY(e,r)),I.sendclose()},[e,I,r]);return hA.jsxs(hA.Fragment,{children:[A&&hA.jsx(Gs,{OK_BUTTON:u}),hA.jsx(Md,{hotkey:s,children:u})]})}function DgA({chip:e,active:A,label:t,args:n,context:i}){const[r,s]=[yr(n[0],""),n[1]],o=xI(A);Si(` $purple$16 $${o}${t}`,i);const a=V.useContext(up),l=V.useCallback(()=>{a.sendmessage(iY(e,r),s),a.sendclose()},[a,r]);return A&&hA.jsx(Gs,{OK_BUTTON:l})}function TS(e,A){const[t,n]=V.useState(void 0);function i(r){tAA(e,A,r)}return V.useEffect(()=>rAA(e,A,n),[]),[t,i]}function MgA(e,A){const[t,n]=V.useState(void 0),[i,r]=V.useState(0);return V.useEffect(()=>sAA(e,A,s=>{s!==void 0&&t===void 0?n(s):r(1-i)}),[]),[t]}function RgA({chip:e,active:A,label:t,args:n,context:i}){const[r,s,o]=[yr(n[0],""),yr(n[1],-1),yr(n[2],-1)];let a,l;s===-1?(a=0,l=31):o===-1?(a=0,l=s):(a=s,l=o);const[I,u]=TS(e,r),C=I??0,h=Ip(),[d,m]=V.useState(""),[p,f]=V.useState(0),[Q,B]=V.useState(!1);let w=`${I??0}`;const R=t.trim(),v=xI(A);gp(i),Q&&(w=h?vc(d,p,1,"$219+"):d),Si(` # $${v}${R} $green${w} \\`,i),cp(" ",i);const x=V.useCallback(N=>{const F=N.alt?10:1;u(Math.min(l,C+F))},[l,I]),U=V.useCallback(N=>{const F=N.alt?10:1;u(Math.max(a,C-F))},[a,I]),S=V.useCallback(()=>{B(N=>{const F=!N;if(F){const K=`${I}`;m(K),f(K.length)}else{const K=parseFloat(d),z=isNaN(K)?0:K;u(Math.min(l,Math.max(a,z)))}return F})},[B,m,a,l,I,d]);return I!==void 0&&hA.jsxs(hA.Fragment,{children:[A&&hA.jsx(Gs,{MOVE_LEFT:U,MOVE_RIGHT:x,OK_BUTTON:S}),Q&&hA.jsxs(KQ,{blockhotkeys:!0,children:[hA.jsx(Md,{hotkey:"ctrl+c",children:()=>{console.info("copy")}}),hA.jsx(Md,{hotkey:"ctrl+v",children:()=>{console.info("paste")}}),hA.jsx(Md,{hotkey:"ctrl+a",children:()=>{console.info("select all")}}),hA.jsx(Gs,{MOVE_LEFT:()=>{f(N=>Math.max(0,N-1))},MOVE_RIGHT:()=>{f(N=>Math.min(d.length,N+1))},CANCEL_BUTTON:S,OK_BUTTON:S,keydown:N=>{switch(N.key.toLowerCase()){case"delete":d.length>0&&m(F=>vc(F,p,1));break;case"backspace":p>0&&(m(F=>vc(F,p-1,1)),f(F=>Math.max(0,F-1)));break}N.key.length===1&&d.lengthvc(F,p,0,N.key)),f(F=>F+1))}})]})]})}function SgA({chip:e,active:A,label:t,args:n,context:i}){const[r,s,o]=[yr(n[0],""),yr(n[1],""),yr(n[2],"")];let a,l;s===""?(a="L",l="H"):o===""?(a="L",l=s):(a=s,l=o);const I=0,u=8,[C,h]=TS(e,r),d=C??0,m=Ip(),p=t.trim(),f=xI(A);gp(i),Si(` $red $29 $${f}${p} \\`,i);const B=vc("----:----",d,1,`$green${A?m?"$26":"$27":"$4"}$${f}`).replaceAll("-","$7").replaceAll(":","$9");Si(`$${f}${a}${B}${l} $green${d+1} \\`,i),cp(" ",i);const w=V.useCallback(v=>{const x=v.alt?10:1;h(Math.min(u,d+x))},[u,C]),R=V.useCallback(v=>{const x=v.alt?10:1;h(Math.max(I,d-x))},[I,C]);return hA.jsx(hA.Fragment,{children:A&&hA.jsx(Gs,{MOVE_LEFT:R,MOVE_RIGHT:w})})}function vgA({chip:e,active:A,label:t,args:n,context:i}){const[r,...s]=[yr(n[0],""),...n.slice(1)],o=0,a=s.length-1,[l,I]=TS(e,r),u=l??0,C=Ip(),h=`${s[u]}`,d=t.trim(),m=xI(A);gp(i),Si(` $dkred ? $${m}${d} \\`,i);const p=A?C?"$26":"$27":"/";Si(`${u+1}$green${p}$${m}${a+1} \\`,i),Si(`$green${h} \\`,i),cp(" ",i);const f=V.useCallback(B=>{const w=B.alt?10:1;I(Math.min(a,u+w))},[a,l]),Q=V.useCallback(B=>{const w=B.alt?10:1;I(Math.max(o,u-w))},[o,l]);return hA.jsx(hA.Fragment,{children:A&&hA.jsx(Gs,{MOVE_LEFT:Q,MOVE_RIGHT:f})})}function NgA({chip:e,active:A,label:t,args:n,context:i}){const r=yr(n[0],""),[s]=MgA(e,r),o=(s==null?void 0:s.toJSON())??"",a=Ip(),[l,I]=V.useState(0),[u,C]=V.useState(!1);let h=`${o} `;const d=t.trim(),m=xI(A);return gp(i),u&&a&&(h=vc(h,l,1,"$219+")),Si(`$green $20 $${m}${d}$green ${h} \\`,i),cp(" ",i),hA.jsxs(hA.Fragment,{children:[A&&hA.jsx(Gs,{OK_BUTTON:()=>{s&&(C(!0),I(s.length))}}),u&&hA.jsx(KQ,{blockhotkeys:!0,children:hA.jsx(Gs,{MOVE_LEFT:()=>{I(p=>Math.max(0,p-1))},MOVE_RIGHT:()=>{I(p=>Math.min(o.length,p+1))},CANCEL_BUTTON:()=>C(!1),OK_BUTTON:()=>C(!1),keydown:p=>{if(!s)return;const{key:f}=p,Q=s.toJSON();switch(f.toLowerCase()){case"delete":Q.length>0&&s.delete(l,1);break;case"backspace":l>0&&(s.delete(l-1,1),I(B=>Math.max(0,B-1)));break;default:f.length===1&&Q.lengthB+1));break}}})})]})}function xgA({item:e,active:A}){const t=V.useContext(nY),n=V.useContext(eY);if(n.isEven=n.y%2===0,typeof e=="string")return hA.jsx(ygA,{player:t,item:e,context:n});if(Array.isArray(e)){const[i,r,s,...o]=e;if(typeof i!="string"||typeof r!="string"||typeof s!="string")return null;const a={player:t,chip:i,active:A,label:r,args:o,context:n};switch(s.toLowerCase()){case"hk":case"hotkey":return hA.jsx(wgA,{...a});case"hypertext":return hA.jsx(DgA,{...a});case"rn":case"range":return hA.jsx(SgA,{...a});case"sl":case"select":return hA.jsx(vgA,{...a});case"nm":case"number":return hA.jsx(RgA,{...a});case"tx":case"text":return hA.jsx(NgA,{...a});default:Si(`$red unknown input type ${s}`,n);break}tY(n)}return null}function US(e,A,t,n,i){const r=e*A;return V.useMemo(()=>vR({char:new Array(r).fill(t),color:new Array(r).fill(n),bg:new Array(r).fill(i)}),[e,A])}const fF=vO(),EF=NO();function FS({width:e,height:A,tiles:t}){const n=_Q(t);return fF&&EF&&hA.jsx(FO,{...n,width:e,height:A,palette:fF,charset:EF})}function rY(e,A,t,n){e.char=new Array(e.char.length).fill(A),e.color=new Array(e.color.length).fill(t),e.bg=new Array(e.bg.length).fill(n)}function dn(e,A,t,n,i,r){if(n<0||n>=A||i<0||i>=t)return;const s=n+i*A;a6(r).forEach(o=>{const a=r[o];hb(a)&&(e[o][s]=a)})}function sY({margin:e=1,selected:A=-1,player:t,width:n,height:i,color:r,bg:s,text:o}){const a=US(n,i,0,r,s);rY(a,0,r,s);const l={...LB(n,i,r,s),...a};return l.x=e,l.leftEdge=e,l.rightEdge=l.width-e,hA.jsx(nY.Provider,{value:t,children:hA.jsxs(eY.Provider,{value:l,children:[o.map((I,u)=>hA.jsx(xgA,{item:I,active:u===A},u)),hA.jsx(FS,{width:n,height:i,tiles:a})]})})}var oY={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},_S={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},TgA=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],GB={CSS:{},springs:{}};function Rs(e,A,t){return Math.min(Math.max(e,A),t)}function eC(e,A){return e.indexOf(A)>-1}function hy(e,A){return e.apply(null,A)}var te={arr:function(e){return Array.isArray(e)},obj:function(e){return eC(Object.prototype.toString.call(e),"Object")},pth:function(e){return te.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return e.nodeType||te.svg(e)},str:function(e){return typeof e=="string"},fnc:function(e){return typeof e=="function"},und:function(e){return typeof e>"u"},nil:function(e){return te.und(e)||e===null},hex:function(e){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e)},rgb:function(e){return/^rgb/.test(e)},hsl:function(e){return/^hsl/.test(e)},col:function(e){return te.hex(e)||te.rgb(e)||te.hsl(e)},key:function(e){return!oY.hasOwnProperty(e)&&!_S.hasOwnProperty(e)&&e!=="targets"&&e!=="keyframes"}};function aY(e){var A=/\(([^)]+)\)/.exec(e);return A?A[1].split(",").map(function(t){return parseFloat(t)}):[]}function lY(e,A){var t=aY(e),n=Rs(te.und(t[0])?1:t[0],.1,100),i=Rs(te.und(t[1])?100:t[1],.1,100),r=Rs(te.und(t[2])?10:t[2],.1,100),s=Rs(te.und(t[3])?0:t[3],.1,100),o=Math.sqrt(i/n),a=r/(2*Math.sqrt(i*n)),l=a<1?o*Math.sqrt(1-a*a):0,I=1,u=a<1?(a*o+-s)/l:-s+o;function C(d){var m=A?A*d/1e3:d;return a<1?m=Math.exp(-m*a*o)*(I*Math.cos(l*m)+u*Math.sin(l*m)):m=(I+u*m)*Math.exp(-m*o),d===0||d===1?d:1-m}function h(){var d=GB.springs[e];if(d)return d;for(var m=1/6,p=0,f=0;;)if(p+=m,C(p)===1){if(f++,f>=16)break}else f=0;var Q=p*m*1e3;return GB.springs[e]=Q,Q}return A?C:h}function UgA(e){return e===void 0&&(e=10),function(A){return Math.ceil(Rs(A,1e-6,1)*e)*(1/e)}}var FgA=function(){var e=11,A=1/(e-1);function t(I,u){return 1-3*u+3*I}function n(I,u){return 3*u-6*I}function i(I){return 3*I}function r(I,u,C){return((t(u,C)*I+n(u,C))*I+i(u))*I}function s(I,u,C){return 3*t(u,C)*I*I+2*n(u,C)*I+i(u)}function o(I,u,C,h,d){var m,p,f=0;do p=u+(C-u)/2,m=r(p,h,d)-I,m>0?C=p:u=p;while(Math.abs(m)>1e-7&&++f<10);return p}function a(I,u,C,h){for(var d=0;d<4;++d){var m=s(u,C,h);if(m===0)return u;var p=r(u,C,h)-I;u-=p/m}return u}function l(I,u,C,h){if(!(0<=I&&I<=1&&0<=C&&C<=1))return;var d=new Float32Array(e);if(I!==u||C!==h)for(var m=0;m=.001?a(f,v,I,C):x===0?v:o(f,Q,Q+A,I,C)}return function(f){return I===u&&C===h||f===0||f===1?f:r(p(f),u,h)}}return l}(),gY=function(){var e={linear:function(){return function(n){return n}}},A={Sine:function(){return function(n){return 1-Math.cos(n*Math.PI/2)}},Expo:function(){return function(n){return n?Math.pow(2,10*n-10):0}},Circ:function(){return function(n){return 1-Math.sqrt(1-n*n)}},Back:function(){return function(n){return n*n*(3*n-2)}},Bounce:function(){return function(n){for(var i,r=4;n<((i=Math.pow(2,--r))-1)/11;);return 1/Math.pow(4,3-r)-7.5625*Math.pow((i*3-2)/22-n,2)}},Elastic:function(n,i){n===void 0&&(n=1),i===void 0&&(i=.5);var r=Rs(n,1,10),s=Rs(i,.1,2);return function(o){return o===0||o===1?o:-r*Math.pow(2,10*(o-1))*Math.sin((o-1-s/(Math.PI*2)*Math.asin(1/r))*(Math.PI*2)/s)}}},t=["Quad","Cubic","Quart","Quint"];return t.forEach(function(n,i){A[n]=function(){return function(r){return Math.pow(r,i+2)}}}),Object.keys(A).forEach(function(n){var i=A[n];e["easeIn"+n]=i,e["easeOut"+n]=function(r,s){return function(o){return 1-i(r,s)(1-o)}},e["easeInOut"+n]=function(r,s){return function(o){return o<.5?i(r,s)(o*2)/2:1-i(r,s)(o*-2+2)/2}},e["easeOutIn"+n]=function(r,s){return function(o){return o<.5?(1-i(r,s)(1-o*2))/2:(i(r,s)(o*2-1)+1)/2}}}),e}();function kS(e,A){if(te.fnc(e))return e;var t=e.split("(")[0],n=gY[t],i=aY(e);switch(t){case"spring":return lY(e,A);case"cubicBezier":return hy(FgA,i);case"steps":return hy(UgA,i);default:return hy(n,i)}}function cY(e){try{var A=document.querySelectorAll(e);return A}catch{return}}function Cp(e,A){for(var t=e.length,n=arguments.length>=2?arguments[1]:void 0,i=[],r=0;r1&&(d-=1),d<1/6?C+(h-C)*6*d:d<1/2?h:d<2/3?C+(h-C)*(2/3-d)*6:C}var o,a,l;if(n==0)o=a=l=i;else{var I=i<.5?i*(1+n):i+n-i*n,u=2*i-I;o=s(u,I,t+1/3),a=s(u,I,t),l=s(u,I,t-1/3)}return"rgba("+o*255+","+a*255+","+l*255+","+r+")"}function GgA(e){if(te.rgb(e))return _gA(e);if(te.hex(e))return kgA(e);if(te.hsl(e))return LgA(e)}function po(e){var A=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(e);if(A)return A[1]}function bgA(e){if(eC(e,"translate")||e==="perspective")return"px";if(eC(e,"rotate")||eC(e,"skew"))return"deg"}function OD(e,A){return te.fnc(e)?e(A.target,A.id,A.total):e}function Ss(e,A){return e.getAttribute(A)}function bS(e,A,t){var n=po(A);if(LS([t,"deg","rad","turn"],n))return A;var i=GB.CSS[A+t];if(!te.und(i))return i;var r=100,s=document.createElement(e.tagName),o=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;o.appendChild(s),s.style.position="absolute",s.style.width=r+t;var a=r/s.offsetWidth;o.removeChild(s);var l=a*parseFloat(A);return GB.CSS[A+t]=l,l}function IY(e,A,t){if(A in e.style){var n=A.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=e.style[A]||getComputedStyle(e).getPropertyValue(n)||"0";return t?bS(e,i,t):i}}function OS(e,A){if(te.dom(e)&&!te.inp(e)&&(!te.nil(Ss(e,A))||te.svg(e)&&e[A]))return"attribute";if(te.dom(e)&&LS(TgA,A))return"transform";if(te.dom(e)&&A!=="transform"&&IY(e,A))return"css";if(e[A]!=null)return"object"}function uY(e){if(te.dom(e)){for(var A=e.style.transform||"",t=/(\w+)\(([^)]*)\)/g,n=new Map,i;i=t.exec(A);)n.set(i[1],i[2]);return n}}function OgA(e,A,t,n){var i=eC(A,"scale")?1:0+bgA(A),r=uY(e).get(A)||i;return t&&(t.transforms.list.set(A,r),t.transforms.last=A),n?bS(e,r,n):r}function PS(e,A,t,n){switch(OS(e,A)){case"transform":return OgA(e,A,n,t);case"css":return IY(e,A,t);case"attribute":return Ss(e,A);default:return e[A]||0}}function YS(e,A){var t=/^(\*=|\+=|-=)/.exec(e);if(!t)return e;var n=po(e)||0,i=parseFloat(A),r=parseFloat(e.replace(t[0],""));switch(t[0][0]){case"+":return i+r+n;case"-":return i-r+n;case"*":return i*r+n}}function CY(e,A){if(te.col(e))return GgA(e);if(/\s/g.test(e))return e;var t=po(e),n=t?e.substr(0,e.length-t.length):e;return A?n+A:n}function JS(e,A){return Math.sqrt(Math.pow(A.x-e.x,2)+Math.pow(A.y-e.y,2))}function PgA(e){return Math.PI*2*Ss(e,"r")}function YgA(e){return Ss(e,"width")*2+Ss(e,"height")*2}function JgA(e){return JS({x:Ss(e,"x1"),y:Ss(e,"y1")},{x:Ss(e,"x2"),y:Ss(e,"y2")})}function hY(e){for(var A=e.points,t=0,n,i=0;i0&&(t+=JS(n,r)),n=r}return t}function HgA(e){var A=e.points;return hY(e)+JS(A.getItem(A.numberOfItems-1),A.getItem(0))}function fY(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return PgA(e);case"rect":return YgA(e);case"line":return JgA(e);case"polyline":return hY(e);case"polygon":return HgA(e)}}function KgA(e){var A=fY(e);return e.setAttribute("stroke-dasharray",A),A}function VgA(e){for(var A=e.parentNode;te.svg(A)&&te.svg(A.parentNode);)A=A.parentNode;return A}function EY(e,A){var t=A||{},n=t.el||VgA(e),i=n.getBoundingClientRect(),r=Ss(n,"viewBox"),s=i.width,o=i.height,a=t.viewBox||(r?r.split(" "):[0,0,s,o]);return{el:n,viewBox:a,x:a[0]/1,y:a[1]/1,w:s,h:o,vW:a[2],vH:a[3]}}function zgA(e,A){var t=te.str(e)?cY(e)[0]:e,n=A||100;return function(i){return{property:i,el:t,svg:EY(t),totalLength:fY(t)*(n/100)}}}function WgA(e,A,t){function n(I){I===void 0&&(I=0);var u=A+I>=1?A+I:0;return e.el.getPointAtLength(u)}var i=EY(e.el,e.svg),r=n(),s=n(-1),o=n(1),a=t?1:i.w/i.vW,l=t?1:i.h/i.vH;switch(e.property){case"x":return(r.x-i.x)*a;case"y":return(r.y-i.y)*l;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function BF(e,A){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,n=CY(te.pth(e)?e.totalLength:e,A)+"";return{original:n,numbers:n.match(t)?n.match(t).map(Number):[0],strings:te.str(e)||A?n.split(t):[]}}function HS(e){var A=e?hp(te.arr(e)?e.map(dF):dF(e)):[];return Cp(A,function(t,n,i){return i.indexOf(t)===n})}function dY(e){var A=HS(e);return A.map(function(t,n){return{target:t,id:n,total:A.length,transforms:{list:uY(t)}}})}function ZgA(e,A){var t=GS(A);if(/^spring/.test(t.easing)&&(t.duration=lY(t.easing)),te.arr(e)){var n=e.length,i=n===2&&!te.obj(e[0]);i?e={value:e}:te.fnc(A.duration)||(t.duration=A.duration/n)}var r=te.arr(e)?e:[e];return r.map(function(s,o){var a=te.obj(s)&&!te.pth(s)?s:{value:s};return te.und(a.delay)&&(a.delay=o?0:A.delay),te.und(a.endDelay)&&(a.endDelay=o===r.length-1?A.endDelay:0),a}).map(function(s){return fp(s,t)})}function qgA(e){for(var A=Cp(hp(e.map(function(r){return Object.keys(r)})),function(r){return te.key(r)}).reduce(function(r,s){return r.indexOf(s)<0&&r.push(s),r},[]),t={},n=function(r){var s=A[r];t[s]=e.map(function(o){var a={};for(var l in o)te.key(l)?l==s&&(a.value=o[l]):a[l]=o[l];return a})},i=0;i0&&(e=requestAnimationFrame(t))}function t(i){for(var r=Vr.length,s=0;s0?requestAnimationFrame(t):void 0}function n(){Ot.suspendWhenDocumentHidden&&(pF()?e=cancelAnimationFrame(e):(Vr.forEach(function(i){return i._onDocumentVisibility()}),mY()))}return typeof document<"u"&&document.addEventListener("visibilitychange",n),A}();function pF(){return!!document&&document.hidden}function Ot(e){e===void 0&&(e={});var A=0,t=0,n=0,i,r=0,s=null;function o(Q){var B=window.Promise&&new Promise(function(w){return s=w});return Q.finished=B,B}var a=tcA(e);o(a);function l(){var Q=a.direction;Q!=="alternate"&&(a.direction=Q!=="normal"?"normal":"reverse"),a.reversed=!a.reversed,i.forEach(function(B){return B.reversed=a.reversed})}function I(Q){return a.reversed?a.duration-Q:Q}function u(){A=0,t=I(a.currentTime)*(1/Ot.speed)}function C(Q,B){B&&B.seek(Q-B.timelineOffset)}function h(Q){if(a.reversePlayback)for(var w=r;w--;)C(Q,i[w]);else for(var B=0;B2||(H=Math.round(H*P)/P)),$.push(H)}var q=z.length;if(!q)iA=$[0];else{iA=z[0];for(var CA=0;CA0&&(a.began=!0,m("begin")),!a.loopBegan&&a.currentTime>0&&(a.loopBegan=!0,m("loopBegin")),v<=w&&a.currentTime!==0&&d(0),(v>=R&&a.currentTime!==B||!B)&&d(B),v>w&&v=B&&(t=0,p(),a.remaining?(A=n,m("loopComplete"),a.loopBegan=!1,a.direction==="alternate"&&l()):(a.paused=!0,a.completed||(a.completed=!0,m("loopComplete"),m("complete"),!a.passThrough&&"Promise"in window&&(s(),o(a)))))}return a.reset=function(){var Q=a.direction;a.passThrough=!1,a.currentTime=0,a.progress=0,a.paused=!0,a.began=!1,a.loopBegan=!1,a.changeBegan=!1,a.completed=!1,a.changeCompleted=!1,a.reversePlayback=!1,a.reversed=Q==="reverse",a.remaining=a.loop,i=a.children,r=i.length;for(var B=r;B--;)a.children[B].reset();(a.reversed&&a.loop!==!0||Q==="alternate"&&a.loop===1)&&a.remaining++,d(a.reversed?a.duration:0)},a._onDocumentVisibility=u,a.set=function(Q,B){return QY(Q,B),a},a.tick=function(Q){n=Q,A||(A=n),f((n+(t-A))*Ot.speed)},a.seek=function(Q){f(I(Q))},a.pause=function(){a.paused=!0,u()},a.play=function(){a.paused&&(a.completed&&a.reset(),a.paused=!1,Vr.push(a),u(),mY())},a.reverse=function(){l(),a.completed=!a.reversed,u()},a.restart=function(){a.reset(),a.play()},a.remove=function(Q){var B=HS(Q);yY(B,a)},a.reset(),a.autoplay&&a.play(),a}function mF(e,A){for(var t=A.length;t--;)LS(e,A[t].animatable.target)&&A.splice(t,1)}function yY(e,A){var t=A.animations,n=A.children;mF(e,t);for(var i=n.length;i--;){var r=n[i],s=r.animations;mF(e,s),!s.length&&!r.children.length&&n.splice(i,1)}!t.length&&!n.length&&A.pause()}function ncA(e){for(var A=HS(e),t=Vr.length;t--;){var n=Vr[t];yY(A,n)}}function icA(e,A){A===void 0&&(A={});var t=A.direction||"normal",n=A.easing?kS(A.easing):null,i=A.grid,r=A.axis,s=A.from||0,o=s==="first",a=s==="center",l=s==="last",I=te.arr(e),u=parseFloat(I?e[0]:e),C=I?parseFloat(e[1]):0,h=po(I?e[1]:e)||0,d=A.start||0+(I?u:0),m=[],p=0;return function(f,Q,B){if(o&&(s=0),a&&(s=(B-1)/2),l&&(s=B-1),!m.length){for(var w=0;w-1&&Vr.splice(i,1);function s(C){C.passThrough=!0}for(var o=0;ovR(new Array(t).fill(0)),[t])}function ocA({width:e,height:A,dither:t}){const n=_Q(t);return hA.jsx(nS,{width:e,height:A,alphas:n})}function acA(e){e.splice(0,e.length,...new Array(e.length).fill(0))}function fy(e,A,t,n,i,r){if(n<0||n>=A||i<0||i>=t)return-1;e[n+i*A]=r}function lcA({player:e,name:A,width:t,height:n,color:i,bg:r,text:s,shouldclose:o}){const a=t-3,l=n-3,I=US(t,n,0,i,r),u=scA(a,l),C=V.useContext(up);for(let z=1;z2&&zz.viewport),{height:S}=U.getCurrentViewport(),N=V.useCallback(()=>{o&&C.didclose()},[o,C]);V.useEffect(()=>{if(!x.current)return;const z=o?0:S,P=o?n*-mi:0,$=o?"easeInBack":"easeOutBack",eA={y:z};x.current.position.y=z,Ot({y:P,duration:300,easing:$,targets:eA,complete:N,update(){x.current&&(x.current.position.y=bq(eA.y,mi*.125))}})},[o]);const F=V.useCallback(z=>{const P=z.alt?10:1;f($=>Math.max(0,$-P))},[f]),K=V.useCallback(z=>{const P=z.alt?10:1;f($=>Math.min(s.length,$+P))},[f]);return hA.jsx("group",{ref:x,children:hA.jsxs(KQ,{children:[hA.jsx(Gs,{MOVE_UP:F,MOVE_DOWN:K,CANCEL_BUTTON:C.sendclose}),hA.jsx(FS,{tiles:I,width:t,height:n}),hA.jsxs("group",{position:[2*dr,2*mi,0],children:[hA.jsx(ocA,{dither:u,width:a,height:l}),hA.jsx(sY,{player:e,name:A,width:a,height:l,margin:0,color:i,bg:$R,text:B,selected:w})]})]})})}function yF({player:e,layers:A,rect:t,shouldclose:n=!1}){switch(t.type){case 0:return hA.jsx(sY,{player:e,name:t.name,width:t.width,height:t.height,color:14,bg:1,text:t.text});case 1:return hA.jsx(lcA,{player:e,name:t.name,width:t.width,height:t.height,color:14,bg:1,text:t.text,shouldclose:n});case 2:return hA.jsx(ftA,{player:e,layers:A,width:t.width,height:t.height})}return null}function gcA({player:e,layers:A,layout:t}){const n=pr(m=>m.viewport),{width:i,height:r}=n.getCurrentViewport(),s=Math.floor(i/dr),o=Math.floor(r/mi),a=i-s*dr,l=r-o*mi,[I,u]=V.useState();if(s<1||o<1||A===void 0||t===void 0)return null;const C={name:"main",type:2,x:0,y:0,width:s,height:o,text:[]},h=[];let d=!0;return t.forEach(m=>{let p;switch(m.edge){case ac.LEFT:p={name:m.name,type:0,x:C.x,y:C.y,width:m.size,height:C.height,text:m.text},C.x+=m.size,C.width-=m.size,h.push(p);break;default:case ac.RIGHT:p={name:m.name,type:0,x:C.x+C.width-m.size,y:C.y,width:m.size,height:C.height,text:m.text},C.width-=m.size,h.push(p);break;case ac.TOP:p={name:m.name,type:0,x:C.x,y:C.y,width:C.width,height:m.size,text:m.text},C.y+=m.size,C.height-=m.size,h.push(p);break;case ac.BOTTOM:p={name:m.name,type:0,x:C.x,y:C.y+C.height-m.size,width:C.width,height:m.size,text:m.text},C.height-=m.size,h.push(p);break;case ac.SCROLL:p={name:m.name,type:1,x:0,y:0,width:gB(m.size||50,24,C.width-2),height:gB(18,8,C.height-8),text:m.text},p.x=C.x+Math.round((C.width-p.width)*.5),p.y=C.y+Math.floor((C.height-p.height)*.5),d=!1,iI(I,p)||u(pi(p))}}),h.unshift(C),hA.jsx(up.Provider,{value:{sendmessage(m,p){Zl.emit(m,"gadget",p,e)},sendclose(){Zl.emit("gadgetserver:clearscroll","gadget",void 0,e)},didclose(){u(void 0)}},children:hA.jsxs("group",{position:[a*.5,l*.5,0],children:[h.map((m,p)=>hA.jsx("group",{position:[m.x*dr,m.y*mi,p*10],children:hA.jsx(yF,{player:e,layers:A,rect:m})},m.name)),I&&hA.jsxs(tC.Fragment,{children:[hA.jsx("group",{position:[0,0,800],children:hA.jsx(jeA,{width:s,height:o,alpha:.14})}),hA.jsx("group",{position:[I.x*dr,I.y*mi,900],children:hA.jsx(yF,{player:e,layers:A,rect:I,shouldclose:d})})]},I.name)]})})}function ccA(){const e=Qj(),{player:A,layout:t}=_Q(e);return hA.jsx(gcA,{player:A,layout:t,layers:e.layers})}const IcA="/assets/scratches-CuKAcXgp.jpg",ucA="main - 0.12.0 - automation changes",wF=" ",Ey=`${wF}< Click To Boot >${wF}${ucA}`;function CcA({onBoot:e}){const A=pr(u=>u.viewport),{width:t,height:n}=A.getCurrentViewport(),i=Math.floor(t/dr),r=Math.floor(n/mi),s=t-i*dr,o=n-r*mi,a=US(i,r,0,0,0),[l,I]=V.useState(0);return V.useEffect(()=>{async function u(){await o6(),e()}function C(){u()}return document.addEventListener("pointerdown",C),()=>{document.removeEventListener("pointerdown",C)}},[e]),V.useEffect(()=>{const u=setInterval(()=>I(C=>C+Ey.length-1),250);return()=>{clearInterval(u)}},[I]),V.useEffect(()=>{rY(a,0,0,0);for(let u=0;unew wq),[t,n]=V.useState(!1);return V.useEffect(()=>{if(!weA)return;document.body.appendChild(A.dom),A.showPanel(0),A.dom.style.cssText="position:fixed;bottom:0;left:0;";const i=VZ(()=>A.begin()),r=zZ(()=>A.end());return()=>{document.body.removeChild(A.dom),i(),r()}},[A]),hA.jsxs(hA.Fragment,{children:[hA.jsx(mq,{makeDefault:!0,near:1,far:2e3,position:[0,0,1e3]}),hA.jsx(TeA,{children:t?hA.jsx(ccA,{}):hA.jsx(CcA,{onBoot:()=>{oAA(),n(!0)}})}),hA.jsx(V.Suspense,{fallback:null,children:hA.jsxs(QeA,{multisampling:0,children:[hA.jsx(NeA,{}),hA.jsx(yeA,{blendFunction:Se.NORMAL,offset:[DF,-DF]}),hA.jsx(ReA,{}),hA.jsx(xeA,{opacity:.35,texture:e,blendFunction:Se.OVERLAY}),hA.jsx(meA,{brightness:.02,contrast:.1})]})})]})}const MF=new k,RF=new k,fcA=e=>({...SG(e),filter:A=>{const t=A.filter(s=>!(!s.object.visible||(s.object.userData.clippingPlanes??[]).some(a=>(a.projectPoint(s.point,MF),RF.subVectors(s.point,MF).normalize().round(),a.normal.equals(RF)===!1)))),n=t.findIndex(s=>s.object.userData.blocking),i=n===-1?t:t.slice(0,n+1);let r="default";return i.some(s=>s.object.userData.cursor?(r=s.object.userData.cursor,!0):!1),document.querySelectorAll("html, body").forEach(s=>{s.style.cursor=r}),i}});function EcA(){const[e,A]=yG(),t=Q2(A.width),n=Q2(A.height);return hA.jsxs(hA.Fragment,{children:[hA.jsx("div",{ref:e,style:{position:"absolute",inset:0},onContextMenuCapture:i=>{i.preventDefault()},children:hA.jsx("div",{style:{marginLeft:"auto",marginRight:"auto",margin:"auto",width:t,height:n},children:hA.jsx(hq,{flat:!0,linear:!0,dpr:1,shadows:!1,"touch-action":"none",gl:{alpha:!1,stencil:!1,antialias:!1,precision:"highp",preserveDrawingBuffer:!0,powerPreference:"high-performance"},style:{imageRendering:"pixelated"},events:fcA,onCreated:({gl:i})=>{i.localClippingEnabled=!0},children:hA.jsx(hcA,{})})})}),hA.jsx(dq,{})]})}const dcA=Y_(document.getElementById("engine"));dcA.render(hA.jsx(V.StrictMode,{children:hA.jsx(EcA,{})}))});export default BcA(); diff --git a/index.html b/index.html index b8e1a621..60513de7 100644 --- a/index.html +++ b/index.html @@ -3,11 +3,11 @@ - ZZS - main:0.12.0:24fca8b0b67c9423ddd4c32bc393a34bf7d81113 + ZZS - main:0.12.0:2dc973ac8b828d1cd3f51e0e32663e1cc2018c83 - +