@opendaw/studio-core 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/ColorCodes.d.ts +7 -0
  2. package/dist/ColorCodes.d.ts.map +1 -0
  3. package/dist/ColorCodes.js +32 -0
  4. package/dist/Colors.d.ts +15 -0
  5. package/dist/Colors.d.ts.map +1 -0
  6. package/dist/Colors.js +15 -0
  7. package/dist/Effects.d.ts +154 -0
  8. package/dist/Effects.d.ts.map +1 -0
  9. package/dist/Effects.js +166 -0
  10. package/dist/EngineWorklet.d.ts +0 -2
  11. package/dist/EngineWorklet.d.ts.map +1 -1
  12. package/dist/EngineWorklet.js +0 -4
  13. package/dist/MeterWorklet.d.ts +1 -4
  14. package/dist/MeterWorklet.d.ts.map +1 -1
  15. package/dist/MeterWorklet.js +1 -8
  16. package/dist/Modifier.d.ts +21 -0
  17. package/dist/Modifier.d.ts.map +1 -0
  18. package/dist/Modifier.js +168 -0
  19. package/dist/RecordingWorklet.d.ts +2 -5
  20. package/dist/RecordingWorklet.d.ts.map +1 -1
  21. package/dist/RecordingWorklet.js +2 -13
  22. package/dist/RenderQuantum.d.ts +2 -0
  23. package/dist/RenderQuantum.d.ts.map +1 -0
  24. package/dist/RenderQuantum.js +1 -0
  25. package/dist/Worklets.d.ts +3 -9
  26. package/dist/Worklets.d.ts.map +1 -1
  27. package/dist/Worklets.js +13 -18
  28. package/dist/index.d.ts +4 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +4 -1
  31. package/dist/processors.js +6 -0
  32. package/dist/processors.js.map +7 -0
  33. package/package.json +20 -24
  34. package/dist/WorkletFactory.d.ts +0 -8
  35. package/dist/WorkletFactory.d.ts.map +0 -1
  36. package/dist/WorkletFactory.js +0 -9
  37. package/dist/engine-processor.js +0 -6
  38. package/dist/engine-processor.js.map +0 -7
  39. package/dist/meter-processor.js +0 -2
  40. package/dist/meter-processor.js.map +0 -7
  41. package/dist/recording-processor.js +0 -4
  42. package/dist/recording-processor.js.map +0 -7
@@ -1,4 +0,0 @@
1
- var V=r=>r!=null,li=(r,e)=>{r!=null&&e(r)},T=(r,e="asDefined failed")=>r??b(e),Ze=(r,e)=>r instanceof e,ui=(r,e)=>r instanceof e?r:b(`${r} is not instance of ${e}`),di=(r,e)=>{r instanceof e||b(`${r} is not instance of ${e}`)};var Je=r=>r instanceof Function?r():r;var p=(r,...e)=>r?.apply(null,e),Oe=r=>{throw new Error(`Unhandled ${r}`)},b=r=>{throw r instanceof Error?r:new Error(r)},E=(r,e)=>r?void 0:b(Je(e));var hi=r=>new Proxy({},{get(){return b(r)}});var Ti=r=>{try{return{error:null,value:r(),status:"success"}}catch(e){return{error:e,value:null,status:"failure"}}};var Jt=()=>{};var ci;(function(r){r[r.Ascending=1]="Ascending",r[r.Descending=-1]="Descending"})(ci||(ci={}));var M=class{static#e=Object.freeze(new Array(0));static empty=()=>this.#e;static clear=e=>{e.length=0};static replace=(e,t)=>{e.length=0,e.push(...t)};static consume=(e,t)=>{for(let i=0;i<e.length;)t(e[i])?e.splice(i,1):i++};static peekFirst=e=>e.at(0)??null;static peekLast=e=>e.at(-1)??null;static getFirst=(e,t)=>T(e.at(0),t);static getLast=(e,t)=>T(e.at(-1),t);static removeLast=(e,t)=>T(e.pop(),t);static create=(e,t)=>{let i=new Array(t);for(let s=0;s<t;s++)i[s]=e(s);return i};static equals=(e,t)=>{if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0};static satisfy=(e,t)=>{if(e.length<2)return!0;let i=e[0];for(let s=1;s<e.length;s++)if(!t(i,e[s]))return!1;return!0};static remove=(e,t)=>{let i=e.indexOf(t);if(i===-1)return b(`${t} not found in ${e}`);e.splice(i,1)};static removeOpt=(e,t)=>{let i=e.indexOf(t);return i===-1?!1:(e.splice(i,1),!0)};static hasDuplicates=e=>new Set(e).size<e.length;static removeDuplicates=e=>{let t=0,i=new Set;for(let s of e)i.has(s)||(i.add(s),e[t++]=s);return e.length=t,e};static removeDuplicateKeys=(e,t)=>{let i=0,s=new Set;for(let n of e){let a=n[t];s.has(a)||(s.add(a),e[i++]=n)}return e.length=i,e};static*iterate(e){for(let t=0;t<e.length;t++)yield e[t]}static*iterateReverse(e){for(let t=e.length-1;t>=0;t--)yield e[t]}static*iterateStateFull(e){let t=e.length-1;for(let i=0;i<=t;i++)yield{value:e[i],isFirst:i===0,isLast:i===t}}static isSorted(e,t=ci.Ascending){if(e.length<2)return!0;let i=e[0];for(let s=1;s<e.length;s++){let n=e[s];if(Math.sign(i-n)===t)return!1;i=n}return!0}};var h;(function(r){r.wrap=t=>V(t)?new e(t):r.None,r.from=t=>r.wrap(t()),r.tryFrom=t=>{try{return r.wrap(t())}catch{return r.None}},r.execute=(t,...i)=>r.wrap(t?.apply(null,i)),r.async=t=>t.then(i=>r.wrap(i),()=>r.None);class e{#e;constructor(i){this.#e=T(i)}unwrap(){return this.#e}unwrapOrElse(i){return this.#e}unwrapOrNull(){return this.#e}unwrapOrUndefined(){return this.#e}contains(i){return i===this.#e}match(i){return i.some(this.#e)}ifSome(i){return i(this.#e)}isEmpty(){return!1}nonEmpty(){return!0}map(i){return r.wrap(i(this.#e))}mapOr(i,s){return i(this.#e)}flatMap(i){return i(this.#e)}equals(i){return this.unwrapOrNull()===i.unwrapOrNull()}assert(i){return this}toString(){return`{Option.Some(${this.#e})}`}get[Symbol.toStringTag](){return this.toString()}}r.Some=e,r.None=new class{unwrap=t=>b(V(t)?Je(t):"unwrap failed");unwrapOrElse=t=>Je(t);unwrapOrNull=()=>null;unwrapOrUndefined=()=>{};contains=t=>!1;match=t=>t.none();ifSome=t=>{};isEmpty=()=>!0;nonEmpty=()=>!1;map=t=>r.None;mapOr=(t,i)=>Je(i);flatMap=t=>r.None;equals=t=>t.isEmpty();assert=t=>b(Je(t)??"assert failed");toString=()=>"{Option.None}";get[Symbol.toStringTag](){return this.toString()}}})(h||(h={}));var Ii;(function(r){r.async=e=>e.then(t=>r.ok(t),t=>r.err(t)),r.tryGet=e=>{try{return r.ok(e())}catch(t){return r.err(t)}},r.ok=e=>new class{value;constructor(t){this.value=t}asOption=()=>h.wrap(this.value);failureReason=()=>{throw new Error("Attempt was successful.")};isFailure=()=>!1;isSuccess=()=>!0;result=()=>this.value;map=t=>{try{return r.ok(t(this.value))}catch(i){return r.err(i)}};flatMap=t=>t(this.value);match=t=>t.ok(this.value);toVoid=()=>r.ok(void 0);failure=()=>{throw new Error("Attempt was successful.")};toString=()=>`{Success: ${this.value}`;get[Symbol.toStringTag](){return"Success"}}(e),r.Ok=new class{constructor(){}asOption=()=>h.None;failureReason=()=>{throw new Error("Attempt was successful.")};isFailure=()=>!1;isSuccess=()=>!0;result=()=>{};map=e=>r.ok(e());flatMap=e=>e();match=e=>e.ok();toVoid=()=>r.ok(void 0);failure=()=>{throw new Error("Attempt was successful.")};toString=()=>"{Success: Ok";get[Symbol.toStringTag](){return"Success"}},r.err=e=>new class{reason;constructor(t){this.reason=t}asOption=()=>h.None;failureReason=()=>this.reason;isFailure=()=>!0;isSuccess=()=>!1;result=()=>{throw new Error(`No result because '${this.reason}'`)};map=()=>this;flatMap=()=>this;match=t=>t.err(this.reason);toVoid=()=>r.err(this.reason);failure=()=>this;toString=()=>`{Failure: ${this.reason}`;get[Symbol.toStringTag](){return"Failure"}}(e)})(Ii||(Ii={}));var z;(function(r){r.exact=(e,t,i)=>{let s=0,n=e.length-1;for(;s<=n;){let a=s+n>>>1,l=i(e[a],t);if(l===0)return a;l<0?s=a+1:n=a-1}return-1},r.exactMapped=(e,t,i,s)=>{let n=0,a=e.length-1;for(;n<=a;){let l=n+a>>>1,d=i(s(e[l]),t);if(d===0)return l;d<0?n=l+1:a=l-1}return-1},r.leftMost=(e,t,i)=>{let s=0,n=e.length;for(;s<n;){let a=s+n>>>1;i(e[a],t)<0?s=a+1:n=a}return s},r.rightMost=(e,t,i)=>{let s=0,n=e.length;for(;s<n;){let a=s+n>>>1;i(e[a],t)<=0?s=a+1:n=a}return n-1},r.leftMostMapped=(e,t,i,s)=>{let n=0,a=e.length;for(;n<a;){let l=n+a>>>1;i(s(e[l]),t)<0?n=l+1:a=l}return n},r.rightMostMapped=(e,t,i,s)=>{let n=0,a=e.length;for(;n<a;){let l=n+a>>>1;i(s(e[l]),t)<=0?n=l+1:a=l}return a-1},r.rangeMapped=(e,t,i,s)=>[r.leftMostMapped(e,t,i,s),r.rightMostMapped(e,t,i,s)]})(z||(z={}));var er=class{#e;#t=null;constructor(e){this.#e=e}invalidate=()=>this.#t=null;get(){return this.#t===null&&(this.#t=this.#e()),this.#t}terminate(){this.invalidate()}};var Oi;(function(r){r.parseCssRgbOrRgba=e=>{let t=e.match(/\(([^)]+)\)/)?.at(1)?.split(",")?.map(Number);if(V(t)&&t.every(i=>!isNaN(i))){if(t.length===3)return[t[0]/255,t[1]/255,t[2]/255,1];if(t.length===4)return[t[0]/255,t[1]/255,t[2]/255,t[3]]}throw new Error(`${e} is not proper formatted. Example: 'rgb(255, 255, 255)' or 'rgba(255, 255, 255, 1)'`)}})(Oi||(Oi={}));var Ee=(r,e)=>r-e,ki=(r,e)=>{let t=Math.min(r.length,e.length);for(let i=0;i<t;i++){let s=r[i]-e[i];if(s!==0)return s}return r.length-e.length};var Os=Math.PI*2,cn=Math.PI/2,pi=Math.PI/4,pn=1/Math.sqrt(2),I=(r,e,t)=>Math.max(e,Math.min(r,t));var Ui=(r,e)=>e+(1-2*e)*Math.max(0,Math.min(r,1)),zi=(r,e)=>Math.floor(r/e)*e;var Li=(r,e,t)=>r+(e-r)*t;var Bt=(r,e)=>ks(r/e)*e,ks=r=>r-Math.floor(r),fi=r=>Math.pow(2,Math.ceil(Math.log(r)/Math.log(2)));var mi=(r,e)=>r*e/((2*e-1)*(r-1)+e);var de;(function(r){r.valueAt=({slope:s,steps:n,y0:a,y1:l},d)=>r.normalizedAt(d/n,s)*(l-a)+a,r.normalizedAt=(s,n)=>{if(n>.499999&&n<.500001)return s;{let a=I(n,1e-15,.999999999999999);return a*a/(1-a*2)*(Math.pow((1-a)/a,2*s)-1)}},r.inverseAt=(s,n)=>{let a=I(n,1e-15,.999999999999999);return Math.log(s*(1-2*a)/(a*a)+1)/(2*Math.log((1-a)/a))},r.coefficients=s=>{let n=r.valueAt(s,1),l=(r.valueAt(s,2)-n)/(n-s.y0),d=n-l*s.y0;return{m:l,q:d}};function*t(s,n,a,l){let{m:d,q:c}=r.coefficients({slope:s,steps:n,y0:a,y1:l});for(let F=0,y=a;F<n;F++)yield y=d*y+c}r.walk=t;function*i(s,n){let a=1/n,l=r.normalizedAt(a,s),c=(r.normalizedAt(2*a,s)-l)/l;for(let F=0,y=0;F<n;F++)yield y=c*y+l}r.walkNormalized=i,r.byHalf=(s,n,a,l)=>({slope:r.slopeByHalf(n,a,l),steps:s,y0:n,y1:l}),r.slopeByHalf=(s,n,a)=>Math.abs(a-s)<1e-6?.5:(n-s)/(a-s)})(de||(de={}));var ge=new DataView(new ArrayBuffer(8)),oe;(function(r){r.MIN_VALUE=-2147483648,r.MAX_VALUE=2147483647,r.toByte=e=>(ge.setInt8(0,e),ge.getInt8(0)),r.toShort=e=>(ge.setInt16(0,e),ge.getInt16(0)),r.toInt=e=>(ge.setInt32(0,e),ge.getInt32(0))})(oe||(oe={}));var we;(function(r){let i=new ArrayBuffer(Float32Array.BYTES_PER_ELEMENT),s=new Float32Array(i),n=new Int32Array(i);r.floatToIntBits=a=>{let l=r.floatToRawIntBits(a);return(l&2139095040)===2139095040&&(l&8388607)!==0?2143289344:l},r.intBitsToFloat=a=>(n[0]=a,s[0]),r.floatToRawIntBits=a=>(s[0]=a,n[0]),r.toFloat32=a=>(ge.setFloat32(0,a),ge.getFloat32(0))})(we||(we={}));var $i;(function(r){r.floatToIntBits=e=>{let t=we.floatToIntBits(e),i=t>>>16&32768,s=(t&2147483647)+4096;return s>=1199570944?(t&2147483647)>=1199570944?s<2139095040?i|31744:i|31744|(t&8388607)>>>13:i|31743:s>=947912704?i|s-939524096>>>13:s<855638016?i:(s=(t&2147483647)>>>23,i|(t&8388607|8388608)+(8388608>>>s-102)>>>126-s)},r.intBitsToFloat=e=>{let t=e&1023,i=e&31744;if(i===31744)i=261120;else if(i!==0){if(i+=114688,t===0&&i>115712)return we.intBitsToFloat((e&32768)<<16|i<<13|1023)}else if(t!==0){i=115712;do t<<=1,i-=1024;while((t&1024)===0);t&=1023}return we.intBitsToFloat((e&32768)<<16|(i|t)<<13)}})($i||($i={}));var tr;(function(r){let e=9218868437227405312n,t=4503599627370495n,i=new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT),s=new Float64Array(i),n=new BigInt64Array(i);r.float64ToLongBits=a=>{let l=r.float64ToRawLongBits(a);return(l&e)===e&&(l&t)!==0n?0x7ff8000000000000n:l},r.longBitsToFloat64=a=>(n[0]=a,s[0]),r.float64ToRawLongBits=a=>(s[0]=a,n[0]),r.clamp=a=>(ge.setFloat64(0,a),ge.getFloat64(0))})(tr||(tr={}));var Z=class{static*empty(){}static one(e){return[e]}static count(e){let t=0;for(let i of e)t++;return t}static some(e,t){for(let i of e)if(t(i))return!0;return!1}static every(e,t){for(let i of e)if(!t(i))return!1;return!0}static reduce(e,t,i){let s=i,n=0;for(let a of e)s=t(s,a,n++);return s}static includes(e,t){for(let i of e)if(i===t)return!0;return!1}static forEach(e,t){for(let i of e)t(i)}static*map(e,t){let i=0;for(let s of e)yield t(s,i++)}static*take(e,t){let i=0;for(let s of e){if(i++>=t)return;yield s}}static filter(e,t){let i=[];for(let s of e)t(s)&&i.push(s);return i}static filterMap(e,t){let i=[];for(let s of e){let n=t(s);V(n)&&i.push(n)}return i}static reverse(e){let t=[];for(let i of e)t.push(i);return t.reverse()}static*pairWise(e){let t=e[Symbol.iterator](),{done:i,value:s}=t.next(),n=s;if(i!==!0)for(;;){let{done:a,value:l}=t.next();if(a===!0){yield[n,null];return}yield[n,l],n=l}}};var ae=class r{static create(e=1024){return this.use(new ArrayBuffer(e))}static use(e,t=0){return new r(new DataView(e,t))}littleEndian=!1;#e;#t=0;constructor(e){this.#e=e}get remaining(){return this.#e.byteLength-this.#t}get position(){return this.#t}set position(e){e<0?b(`position(${e}) cannot be negative.`):e>this.#e.byteLength?b(`position(${e}) is outside range (${this.#e.byteLength}).`):this.#t=e}writeBoolean(e){this.writeByte(e?1:0)}writeByte(e){this.#r(1),this.#e.setInt8(this.#t++,e)}writeShort(e){this.#r(Int16Array.BYTES_PER_ELEMENT),this.#e.setInt16(this.#t,e,this.littleEndian),this.#t+=Int16Array.BYTES_PER_ELEMENT}writeInt(e){this.#r(Int32Array.BYTES_PER_ELEMENT),this.#e.setInt32(this.#t,e,this.littleEndian),this.#t+=Int32Array.BYTES_PER_ELEMENT}writeLong(e){this.#r(BigInt64Array.BYTES_PER_ELEMENT),this.#e.setBigInt64(this.#t,e,this.littleEndian),this.#t+=BigInt64Array.BYTES_PER_ELEMENT}writeFloat(e){this.#r(Float32Array.BYTES_PER_ELEMENT),this.#e.setFloat32(this.#t,e,this.littleEndian),this.#t+=Float32Array.BYTES_PER_ELEMENT}writeDouble(e){this.#r(Float64Array.BYTES_PER_ELEMENT),this.#e.setFloat64(this.#t,e,this.littleEndian),this.#t+=Float64Array.BYTES_PER_ELEMENT}writeBytes(e){this.#r(e.length);for(let t=0;t<e.length;++t)this.#e.setInt8(this.#t++,e[t])}writeString(e){let t=e.length;this.#r(Int32Array.BYTES_PER_ELEMENT+t*Int16Array.BYTES_PER_ELEMENT),this.writeInt(t);for(let i=0;i<t;i++)this.writeShort(e.charCodeAt(i))}toArrayBuffer(){return this.#e.buffer.slice(0,this.#t)}#r(e){let t=this.#e.byteLength;if(this.#t+e>t){let i=this.#e;this.#e=new DataView(new ArrayBuffer(fi(t+e)));for(let s=0;s<this.#t;s++)this.#e.setInt8(s,i.getInt8(s))}}},et=class{#e=0;writeByte(e){this.#e++}writeShort(e){this.#e+=2}writeInt(e){this.#e+=4}writeLong(e){this.#e+=8}writeFloat(e){this.#e+=4}writeDouble(e){this.#e+=8}writeBoolean(e){this.#e++}writeBytes(e){this.#e+=e.length}writeString(e){this.#e+=e.length+4}get count(){return this.#e}},rr=class{#e;#t=0;constructor(e=32){this.#e=new Int8Array(e)}result(){return this.#e}equals(e){return e===this?!0:this.#e.every((t,i)=>e.#e[i]===t)}writeBoolean(e){this.writeByte(e?31:11)}writeShort(e){this.writeByte(e&255),this.writeByte(e>>>8&255)}writeByte(e){this.#t>=this.#e.length&&(this.#t=0),this.#e[this.#t++]^=e}writeInt(e){this.writeByte(e&255),this.writeByte(e>>>8&255),this.writeByte(e>>>16&255),this.writeByte(e>>>24&255)}writeBytes(e){e.forEach(t=>this.writeByte(t))}writeFloat(e){this.writeInt(we.floatToIntBits(e))}writeDouble(e){this.writeLong(tr.float64ToLongBits(e))}writeLong(e){this.writeByte(Number(e)&255),this.writeByte(Number(e>>8n)&255),this.writeByte(Number(e>>16n)&255),this.writeByte(Number(e>>24n)&255),this.writeByte(Number(e>>32n)&255),this.writeByte(Number(e>>40n)&255),this.writeByte(Number(e>>48n)&255),this.writeByte(Number(e>>56n)&255)}writeString(e){for(let t=0;t<e.length;t++)this.writeShort(e.charCodeAt(t))}toHexString(){return Array.from(Z.map(this.#e.values(),e=>(e&255).toString(16).padStart(2,"0"))).join("")}},ie=class{littleEndian=!1;#e;#t=0;constructor(e,t=0){this.#e=new DataView(e,t)}get position(){return this.#t}set position(e){e<0?b(`position(${e}) cannot be negative.`):e>this.#e.byteLength?b(`position(${e}) is outside range (${this.#e.byteLength}).`):this.#t=e}readByte(){return this.#e.getInt8(this.#t++)}readShort(){let e=this.#e.getInt16(this.#t,this.littleEndian);return this.#t+=Int16Array.BYTES_PER_ELEMENT,e}readInt(){let e=this.#e.getInt32(this.#t,this.littleEndian);return this.#t+=Int32Array.BYTES_PER_ELEMENT,e}readLong(){let e=this.#e.getBigInt64(this.#t,this.littleEndian);return this.#t+=BigInt64Array.BYTES_PER_ELEMENT,e}readFloat(){let e=this.#e.getFloat32(this.#t,this.littleEndian);return this.#t+=Float32Array.BYTES_PER_ELEMENT,e}readDouble(){let e=this.#e.getFloat64(this.#t,this.littleEndian);return this.#t+=Float64Array.BYTES_PER_ELEMENT,e}readBoolean(){return this.readByte()===1}readBytes(e){for(let t=0;t<e.length;t++)e[t]=this.readByte()}readString(){let e=this.readInt(),t="";for(let i=0;i<e;i++)t+=String.fromCharCode(this.readShort());return t}available(e){return this.#t+e<=this.#e.byteLength}remaining(){return this.#e.byteLength-this.#t}skip(e){this.position+=e}};var Us=r=>V(r)?r.value!==void 0?"value":r.get!==void 0?"get":b(`Cannot resolve method key of ${r}`):b("Cannot resolve method key of undefined descriptor"),tt=(r,e,t)=>{if(!V(t))return function(n,a){if(a&&a.kind==="getter")return function(){let l=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),e);if(!V(l?.get))return b(`Cannot find getter for property '${e}'`);let d=l.get.apply(this);return Object.defineProperty(this,e,{value:d,configurable:!1,writable:!1,enumerable:!1}),d}};let i=Us(t),s=T(t[i]);return{[i]:function(...n){if(n.length>0)return b("lazy accessory must not have any construction parameters");let a=s.apply(this);return Object.defineProperty(this,e,{value:i==="get"?a:()=>a,configurable:!1,writable:!1,enumerable:!1}),a}}};var ve;(function(r){function*e(){}r.empty=e,r.next=i=>{let{value:s,done:n}=i.next();return n?null:s};function*t(...i){for(let s of i)for(let n of s)yield n}r.flatten=t})(ve||(ve={}));var rt;(function(r){r[r.T=0]="T",r[r.R=1]="R",r[r.B=2]="B",r[r.L=3]="L"})(rt||(rt={}));var it;(function(r){r[r.TL=0]="TL",r[r.TR=1]="TR",r[r.BR=2]="BR",r[r.BL=3]="BL"})(it||(it={}));var Hi;(function(r){r.outerTangentPoints=(e,t)=>{let i=t.x-e.x,s=t.y-e.y,n=Math.atan2(s,i)+Math.acos((e.r-t.r)/Math.sqrt(i*i+s*s)),a=Math.cos(n),l=Math.sin(n);return[{x:e.x+e.r*a,y:e.y+e.r*l},{x:t.x+t.r*a,y:t.y+t.r*l}]}})(Hi||(Hi={}));var Gi;(function(r){r.zero=()=>({x:0,y:0}),r.create=(e,t)=>({x:e,y:t}),r.clone=e=>({...e}),r.floor=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),r.length=e=>Math.sqrt(e.x*e.x+e.y*e.y),r.distance=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),r.add=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),r.subtract=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),r.scaleBy=(e,t)=>({x:e.x*t,y:e.y*t}),r.scaleTo=(e,t)=>{let i=t/r.length(e);return{x:e.x*i,y:e.y*i}},r.fromClient=e=>({x:e.clientX,y:e.clientY})})(Gi||(Gi={}));var qi;(function(r){r.Empty=Object.freeze({x:0,y:0,width:0,height:0}),r.corners=e=>{let t=e.x,i=e.y,s=t+e.width,n=i+e.height;return[{x:t,y:i},{x:s,y:i},{x:s,y:n},{x:t,y:n}]},r.inflate=(e,t)=>({x:e.x-t,y:e.y-t,width:e.width+t*2,height:e.height+t*2}),r.contains=(e,t)=>{let i=t.x>=e.x&&t.y>=e.y,s=t.x+t.width<=e.x+e.width&&t.y+t.height<=e.y+e.height;return i&&s},r.isPointInside=(e,t)=>e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height,r.intersect=(e,t)=>{let i=Math.max(e.x,t.x),s=Math.min(e.x+e.width,t.x+t.width),n=Math.min(e.y+e.height,t.y+t.height),a=Math.max(e.y,t.y);return s>i&&n>a},r.axis=(e,t)=>{switch(t){case rt.T:return e.y;case rt.R:return e.x+e.width;case rt.B:return e.y+e.height;case rt.L:return e.x;default:return Oe(t)}},r.corner=(e,t)=>{switch(t){case it.TL:return{x:e.x,y:e.y};case it.TR:return{x:e.x+e.width,y:e.y};case it.BR:return{x:e.x+e.width,y:e.y+e.height};case it.BL:return{x:e.x,y:e.y+e.height};default:return Oe(t)}},r.center=e=>({x:e.x+e.width*.5,y:e.y+e.height*.5}),r.isEmpty=e=>e.width===0||e.height===0,r.union=(e,t)=>{if(r.isEmpty(e))r.isEmpty(t)||(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height);else if(!r.isEmpty(t)){let i=t.x,s=t.y,n=Math.min(e.x,i),a=Math.min(e.y,s);e.width=Math.max(e.x+e.width,i+t.width)-n,e.height=Math.max(e.y+e.height,s+t.height)-a,e.x=n,e.y=a}}})(qi||(qi={}));var ji;(function(r){r.width=e=>e.xMax-e.xMin,r.height=e=>e.yMax-e.yMin,r.from=(e,t)=>{e.xMin=t.xMin,e.xMax=t.xMax,e.yMin=t.yMin,e.yMax=t.yMax},r.extend=(e,t)=>{e.xMin-=t,e.yMin-=t,e.xMax+=t,e.yMax+=t},r.padding=(e,[t,i,s,n])=>(e.xMin+=n,e.yMin+=t,e.xMax-=i,e.yMax-=s,e),r.intersectPoint=(e,t)=>e.xMin<=t.x&&t.x<e.xMax&&e.yMin<=t.y&&t.y<e.yMax,r.intersectThat=(e,t)=>t.xMin<e.xMax&&t.xMax>e.xMin&&t.yMin<e.yMax&&t.yMax>e.yMin,r.center=e=>({x:(e.xMin+e.xMax)*.5,y:(e.yMin+e.yMax)*.5})})(ji||(ji={}));var _i;(function(r){r.Identity=Object.freeze([0,0,0,0])})(_i||(_i={}));var Wi;(function(r){r.intersects=(i,s,n,a,l,d,c,F)=>{let y=e(i,s,n,a,l,d),A=e(i,s,n,a,c,F);if((y|A)===0||(y&A)!==0)return!1;let S=t(l,d,c,F,i,n);return S!==t(l,d,c,F,s,n)||S!==t(l,d,c,F,s,a)||S!==t(l,d,c,F,i,a)};let e=(i,s,n,a,l,d)=>{let c=0;return l<=i?c|=1:l>=s&&(c|=2),d<=n?c|=8:d>=a&&(c|=4),c},t=(i,s,n,a,l,d)=>(n-i)*(d-s)-(l-i)*(a-s)>=0})(Wi||(Wi={}));var Qi;(function(r){r.Identity={valueToAxis:e=>e,axisToValue:e=>e},r.toClamped=(e,t,i)=>({valueToAxis:s=>e.valueToAxis(I(s,t,i)),axisToValue:s=>I(e.axisToValue(s),t,i)}),r.createClamped=(e,t)=>({valueToAxis:i=>I(i,e,t),axisToValue:i=>I(i,e,t)})})(Qi||(Qi={}));var Yi;(function(r){r.fromBuffers=async(...e)=>{let t=e.reduce((n,a)=>n+a.byteLength,0),i=new Uint8Array(t),s=0;for(let n of e)i.set(new Uint8Array(n),s),s+=n.byteLength;return await crypto.subtle.digest("SHA-256",i)},r.equals=(e,t)=>{E(e.byteLength===32,"First hash has invalid length"),E(t.byteLength===32,"Second hash has invalid length");let i=new Uint8Array(e),s=new Uint8Array(t);for(let n=0;n<32;n++)if(i[n]!==s[n])return!1;return!0},r.toString=e=>Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")})(Yi||(Yi={}));var Et;(function(r){r.intersect1D=(e,t,i,s)=>Math.max(e,i)<=Math.min(t,s)})(Et||(Et={}));var J=class{#e=new Set;#t;constructor(){this.#t=new Proxy({},{get:(e,t)=>(...i)=>this.#e.forEach(s=>Object.getPrototypeOf(s)===Object.getPrototypeOf({})?p(s[t],...i):s[t]?.apply(s,i))})}get proxy(){return this.#t}get size(){return this.#e.size}subscribe(e){return this.#e.add(e),{terminate:()=>this.#e.delete(e)}}forEach(e){this.#e.forEach(e)}terminate(){this.#e.clear()}};var gi=class r{static#e=Object.freeze(new Set);static empty=()=>r.#e};var Xi;(function(r){r.mergeNoOverlap=(e,t)=>{let i=new Set(Object.keys(e));for(let s of Object.keys(t))if(i.has(s))return b(`'${s}' is an overlapping key`);return{...e,...t}},r.include=(e,...t)=>t.reduce((i,s)=>(i[s]=e[s],i),{}),r.exclude=(e,...t)=>{let i=new Set(t);return Object.entries(e).reduce((s,[n,a])=>(i.has(n)||(s[n]=a),s),{})},r.overwrite=(e,t)=>Object.assign(e,t)})(Xi||(Xi={}));var P=Object.freeze({Empty:{terminate:Jt},create:r=>({terminate:r}),many:(...r)=>({terminate:()=>{for(;r.length>0;)r.pop().terminate()}})}),R=class r{#e=[];own(e){return this.#e.push(e),e}ownAll(...e){for(let t of e)this.#e.push(t)}spawn(){let e=new r;return e.own({terminate:()=>M.removeOpt(this.#e,e)}),this.own(e)}terminate(){for(;this.#e.length>0;)this.#e.pop().terminate()}};var K=class{static subscribeMany(e,...t){return P.many(...t.map(i=>i.subscribe(()=>e(i))))}#e=new Set;subscribe(e){return this.#e.add(e),{terminate:()=>this.#e.delete(e)}}isEmpty(){return this.#e.size===0}notify(e){this.#e.forEach(t=>t(e))}observers(){return this.#e}terminate(){this.#e.clear()}},Zi;(function(r){r.make=e=>new class{getValue(){return e}subscribe(t){return P.Empty}catchupAndSubscribe(t){return t(this),P.Empty}}})(Zi||(Zi={}));var Ji;(function(r){r.False=new class{getValue(){return!1}setValue(e){}subscribe(e){return P.Empty}catchupAndSubscribe(e){return e(this),P.Empty}},r.inverseBoolean=e=>new class{getValue(){return!e.getValue()}setValue(t){e.setValue(!t)}subscribe(t){return e.subscribe(t)}catchupAndSubscribe(t){return t(this),this.subscribe(t)}}})(Ji||(Ji={}));var le=class{#e;#t=h.None;#r;constructor(e,t){this.#e=new K,this.#r=t?.guard(e)??e,this.#t=h.wrap(t)}setValue(e){this.#t.nonEmpty()&&(e=this.#t.unwrap().guard(e)),this.#r!==e&&(this.#r=e,this.#e.notify(this))}getValue(){return this.#r}subscribe(e){return this.#e.subscribe(e)}catchupAndSubscribe(e){return e(this),this.#e.subscribe(e)}terminate(){this.#e.terminate()}toString(){return`{DefaultObservableValue value: ${this.#r}`}};var xi=class{#e;#t;#r;constructor(e,t){this.#e=e,this.#t=t,this.#r=t-e}x(e){return(this.clamp(e)-this.#e)/this.#r}y(e){return this.#e+I(e,0,1)*this.#r}clamp(e){return I(e,this.#e,this.#t)}floating(){return!0}},yi=class{#e;#t;#r;constructor(e,t){this.#e=I(Math.round(e),oe.MIN_VALUE,oe.MAX_VALUE),this.#t=I(Math.round(t),oe.MIN_VALUE,oe.MAX_VALUE),this.#r=this.#t-this.#e}x(e){return(this.clamp(e)-this.#e)/this.#r}y(e){return this.#e+Math.round(I(e,0,1)*this.#r)}clamp(e){return I(Math.round(e),this.#e,this.#t)}floating(){return!1}},wi=class{#e;#t;#r;constructor(e,t){this.#e=e,this.#t=t,this.#r=Math.log(t/e)}x(e){return Math.log(I(e,this.#e,this.#t)/this.#e)/this.#r}y(e){return this.#e*Math.exp(I(e,0,1)*this.#r)}clamp(e){return Math.min(this.#t,Math.max(this.#e,e))}floating(){return!0}},vi=class{#e;constructor(e){this.#e=e}x(e){let t=this.#e.findIndex(i=>i===e);return t===-1?b(`Could not find index for ${e}`):t/(this.#e.length-1)}y(e){let t=Math.round(I(e,0,1)*(this.#e.length-1));return t>-1?T(this.#e.at(t),`Could not find value for ${e}`):b(`Index ${t} is out of box.`)}clamp(e){return e}floating(){return!1}},bi=class{#e;#t;#r;#i;#s;constructor(e,t,i){this.#e=e,this.#t=i;let s=e*e,n=i*i,a=t*t,l=e+i-2*t,d=i-t;this.#r=((2*i-t)*e-t*i)/l,this.#i=(d*s+(a-n)*e+t*n-a*i)/(s+(2*i-4*t)*e+n-4*t*i+4*a),this.#s=-d/l}y(e){return e<=0?Number.NEGATIVE_INFINITY:e>=1?this.#t:this.#r-this.#i/(e+this.#s)}x(e){return this.#e>=e?0:this.#t<=e?1:-this.#i/(e-this.#r)-this.#s}clamp(e){return Math.min(this.#t,e)}floating(){return!0}},C;(function(r){r.linear=(n,a)=>new xi(n,a),r.linearInteger=(n,a)=>new yi(n,a),r.exponential=(n,a)=>new wi(n,a),r.values=n=>new vi(n),r.decibel=(n,a,l)=>new bi(n,a,l);let e=new class{x(n){return n?1:0}y(n){return n>=.5}clamp(n){return n}floating(){return!1}},t=r.linear(0,1),i=r.linear(-1,1);r.bool=e;let s=r.decibel(-72,-12,0);r.unipolar=()=>t,r.bipolar=()=>i,r.DefaultDecibel=s})(C||(C={}));var D;(function(r){r.percent=({bipolar:n,fractionDigits:a}={})=>new e("%",a,!1,n),r.numeric=({unit:n,fractionDigits:a,unitPrefix:l,bipolar:d}={})=>new e(n,a,l,d),r.indices=(n,a)=>new class{x(l){return{unit:n,value:a[l]}}y(l){let d=a.indexOf(l);return d===-1?{type:"unknown",value:"\u{1F4A3}"}:{type:"explicit",value:d}}},r.values=(n,a,l)=>new class{x(d){return{unit:n,value:l.at(a.indexOf(d))??"N/A"}}y(d){let c=l.indexOf(d);return c===-1?{type:"unknown",value:"\u{1F4A3}"}:{type:"explicit",value:a[c]}}},r.bool=new class{y(n){switch(n.trim()){case"on":case"yes":case"true":return{type:"explicit",value:!0};default:return{type:"explicit",value:!1}}}x(n){return{value:String(n),unit:""}}};class e{#e;#t;#r;#i;constructor(a,l,d,c){this.#e=a??"",this.#t=l??0,this.#r=d??!1,this.#i=c??!1}y(a){let l=a.trim(),d=parseFloat(l);if(isNaN(d))return{type:"unknown",value:l};if(this.#e==="%")return{type:"explicit",value:d/100};if(l.endsWith("%"))return{type:"unitValue",value:this.#i?I(d/200+.5,0,1):I(d/100,0,1)};{l.endsWith(this.#e)&&this.#e.length>0&&(l=l.slice(0,-this.#e.length));let y=/(\d+)(\D+)/.exec(l)?.at(2)?.at(0);if(V(y)){let A=t.indexOf(y);if(A>-1)return{type:"explicit",value:d*Math.pow(10,(A-4)*3)}}return{type:"explicit",value:d}}}x(a){if(Number.isNaN(a))return{value:"\u{1F4A3}",unit:this.#e};if(Number.isFinite(a)){if(this.#e==="%")return this.#i?{value:(a*200-100).toFixed(this.#t),unit:this.#e}:{value:(a*100).toFixed(this.#t),unit:this.#e};if(this.#r){let{value:l,prefix:d}=s(a);return{value:l.toFixed(this.#t),unit:`${d}${this.#e}`}}else return{value:a.toFixed(this.#t),unit:this.#e}}else return{value:a===Number.POSITIVE_INFINITY?"\u221E":"-\u221E",unit:this.#e}}}let t=Object.freeze(["p","n","\u03BC","m","","k","M","G","T"]),i=n=>Math.log(n)/Math.log(9.999999999999998),s=n=>{let a=Math.floor(i(n)/3),l=t[a+4];return V(l)?{value:n*Math.pow(10,a*-3),prefix:l}:{value:n,prefix:""}};r.decible=r.numeric({unit:"db",fractionDigits:1}),r.panning=r.percent({unit:"%",fractionDigits:0})})(D||(D={}));var ir;(function(r){r.alwaysTrue=()=>!0,r.alwaysFalse=()=>!1,r.definedPredicate=e=>e!=null})(ir||(ir={}));var es;(function(r){r.split=(e,t)=>{let i=new Float32Array(t);return M.create(s=>n=>{i[s]=n,e(i.reduce((a,l)=>a+l,0)/t)},t)}})(es||(es={}));var ts;(function(r){r.create=(e=252854082)=>new Fi(e),r.monotoneAscending=(e,t=128,i=r.create())=>{let s=e.length;if(s<2)return b("Array must have at least 2 elements");let n=0;for(let l=1;l<s;l++){let d=Math.floor(i.uniform()*(1+t))+1;e[l]=d,n+=d}let a=0;e[0]=0;for(let l=1;l<s;l++)a+=e[l],e[l]=a/n;return e}})(ts||(ts={}));var Fi=class{#e=0;constructor(e){this.setSeed(e)}setSeed(e){this.#e=e&4294967295}nextDouble(e,t){return e+this.uniform()*(t-e)}nextInt(e,t){return e+Math.floor(this.uniform()*(t-e))}nextElement(e){return e[Math.floor(this.uniform()*e.length)]}nextBoolean(){return this.uniform()<.5}uniform(){let e=this.#e+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}};var st;(function(r){class e{}r.createBuilder=i=>{let s=n=>{let a=n instanceof Array?[]:{};return Object.entries(n).forEach(([l,d])=>{d instanceof e?a[l]=d.initialValue():typeof d=="object"&&(a[l]=s(d))}),a};return()=>new t(i,Object.seal(s(i)))},r.bool=new class extends e{read(i){return i.readByte()===1}write(i,s){i.writeByte(s?1:0)}initialValue(){return!1}},r.int8=new class extends e{read(i){return i.readByte()}write(i,s){i.writeByte(s)}initialValue(){return 0}},r.int16=new class extends e{read(i){return i.readShort()}write(i,s){i.writeShort(s)}initialValue(){return 0}},r.int32=new class extends e{read(i){return i.readInt()}write(i,s){i.writeInt(s)}initialValue(){return 0}},r.float=new class extends e{read(i){return i.readFloat()}write(i,s){i.writeFloat(s)}initialValue(){return 0}},r.double=new class extends e{read(i){return i.readDouble()}write(i,s){i.writeDouble(s)}initialValue(){return 0}},r.int64=new class extends e{read(i){return i.readLong()}write(i,s){i.writeLong(s)}initialValue(){return 0n}},r.floats=i=>new class extends e{read(s,n){for(let a=0;a<n.length;a++)n[a]=s.readFloat();return n}write(s,n){for(let a=0;a<n.length;a++)s.writeFloat(n[a])}initialValue(){return new Float32Array(i)}},r.doubles=i=>new class extends e{read(s,n){for(let a=0;a<n.length;a++)n[a]=s.readDouble();return n}write(s,n){for(let a=0;a<n.length;a++)s.writeDouble(n[a])}initialValue(){return new Float64Array(i)}};class t{#e;#t;#r;constructor(s,n){this.#e=s,this.#t=n,this.#r=this.#i()}get object(){return this.#t}get bytesTotal(){return this.#r}read(s){let n=(a,l)=>{Object.entries(a).forEach(([d,c])=>{let F=l;c instanceof e?F[d]=c.read(s,F[d]):typeof c=="object"&&n(c,F[d])})};n(this.#e,this.#t)}write(s){let n=(a,l)=>{Object.entries(a).forEach(([d,c])=>{let F=l;c instanceof e?c.write(s,F[d]):typeof c=="object"&&n(c,F[d])})};n(this.#e,this.#t)}#i(){let s=new et;return this.write(s),s.count}}})(st||(st={}));var Me=class{#e;#t;#r;constructor(e,t){this.#e=e,this.#t=t,this.#r=[]}add(e,t=!1){let i=this.#e(e),s=z.leftMostMapped(this.#r,i,this.#t,this.#e),n=this.#r[s];return V(n)&&this.#t(this.#e(n),i)===0?t?(this.#r.splice(s,1,e),!0):!1:(this.#r.splice(s,0,e),!0)}getOrCreate(e,t){let i=z.leftMostMapped(this.#r,e,this.#t,this.#e),s=this.#r[i];if(V(s)&&this.#t(this.#e(s),e)===0)return s;let n=t(e);return this.#r.splice(i,0,n),n}addMany(e){for(let t of e)this.#r.push(t);try{return this.#r.sort((t,i)=>{let s=this.#t(this.#e(t),this.#e(i));if(s===0)throw"cancel";return s}),!0}catch(t){if(t==="cancel"){let i=new Map(this.entries());return this.#r.splice(0,this.#r.length,...i.values()),this.#r.sort((s,n)=>this.#t(this.#e(s),this.#e(n))),!1}return b(t)}}removeByValue(e){return this.removeByKey(this.#e(e))}removeByKey(e){let t=z.leftMostMapped(this.#r,e,this.#t,this.#e),i=this.#r[t];return V(i)&&this.#t(this.#e(i),e)===0?(this.#r.splice(t,1),i):b(`Could not remove ${e}`)}removeRange(e,t){this.#r.splice(e,(t??this.#r.length)-e)}removeByPredicate(e){let t=0,i=this.#r.length;for(;--i>=0;)e(this.#r[i])&&(this.#r.splice(i,1),t++);return t}get(e){let t=this.#i(e);return V(t)?t:b(`Unknown key: ${e}`)}getOrThrow(e,t){let i=this.#i(e);if(V(i))return i;throw t()}opt(e){return h.wrap(this.#i(e))}getOrNull(e){return this.#i(e)??null}getByIndex(e){return this.#r[e]}hasKey(e){return V(this.#i(e))}hasValue(e){return V(this.#i(this.#e(e)))}size(){return this.#r.length}isEmpty(){return this.#r.length===0}forEach(e){this.values().forEach(e)}values(){return this.#r}entries(){return this.#r.map(e=>[this.#e(e),e])}clear(){M.clear(this.#r)}[Symbol.iterator](){return this.#r.values()}#i(e){let t=z.leftMostMapped(this.#r,e,this.#t,this.#e),i=this.#r[t];return V(i)&&this.#t(this.#e(i),e)===0?i:void 0}};var rs;(function(r){r.hyphenToCamelCase=e=>e.replace(/-([a-z])/g,t=>t[1].toUpperCase()),r.fallback=(e,t)=>V(e)&&e.length>0?e:t,r.endsWithDigit=e=>/\d$/.test(e),r.nonEmpty=(e,t)=>V(e)&&e.trim().length>0?e:t,r.toArrayBuffer=e=>{let t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let s=0;s<e.length;s++)i[s]=e.charCodeAt(s);return t}})(rs||(rs={}));var ke=class r{static POSITIVE_INFINITY=new r(Number.POSITIVE_INFINITY);static millis=e=>new r(e);static seconds=e=>new r(e*r.#e);static minutes=e=>new r(e*r.#t);static hours=e=>new r(e*r.#r);static days=e=>new r(e*r.#i);static#e=1e3;static#t=6e4;static#r=36e5;static#i=864e5;#s;constructor(e){this.#s=e}millis(){return this.#s}absSeconds(){return Math.abs(this.#s)/r.#e}absMinutes(){return Math.abs(this.#s)/r.#t}absHours(){return Math.abs(this.#s)/r.#r}absDays(){return Math.abs(this.#s)/r.#i}split(){return{d:Math.floor(this.absDays()),h:Math.floor(this.absHours())%24,m:Math.floor(this.absMinutes())%60,s:Math.floor(this.absSeconds())%60}}isNow(){return this.#s===0}isPast(){return this.#s<0}isFuture(){return this.#s>0}toUnitString(){let e,t,i=Math.floor(Math.abs(this.#s)/1e3),s=Math.floor(i/60),n=Math.floor(s/60),a=Math.floor(n/24);return i<60?(e=i,t="second"):s<60?(e=s,t="minute"):n<24?(e=n,t="hour"):(e=a,t="day"),new Intl.RelativeTimeFormat("en",{numeric:"auto",style:"long"}).format(e*Math.sign(this.#s),t)}toString(){if(isNaN(this.#s))return"NaN";if(!isFinite(this.#s))return"\u221E";let{d:e,h:t,m:i,s}=this.split();return e>0?[r.#n("d",e),r.#n("h",t),r.#n("m",i),r.#n("s",s)].join(", "):t>0?[r.#n("h",t),r.#n("m",i),r.#n("s",s)].join(", "):i>0?[r.#n("m",i),r.#n("s",s)].join(", "):s>0?r.#n("s",s):"now"}static#n=(e,t)=>{switch(e){case"d":return`${t} ${t<2?"day":"days"}`;case"h":return`${t} ${t<2?"hour":"hours"}`;case"m":return`${t} ${t<2?"minute":"minutes"}`;case"s":return`${t} ${t<2?"second":"seconds"}`;default:return Oe(e)}}};var is;(function(r){let e;(function(t){t[t.READING=0]="READING",t[t.READ=1]="READ",t[t.WRITING=2]="WRITING",t[t.WRITTEN=3]="WRITTEN"})(e||(e={})),r.writer=(t,i,s)=>{if(t.bytesTotal+1>i.byteLength)return b("Insufficient memory allocated.");let n=new Uint8Array(i),a=ae.use(i,1);return Atomics.store(n,0,e.READ),{tryWrite:()=>Atomics.compareExchange(n,0,e.READ,e.WRITING)===e.WRITING?(s(t.object),a.position=0,t.write(a),Atomics.store(n,0,e.WRITTEN),!0):!1}},r.reader=(t,i)=>{let s=new SharedArrayBuffer(t.bytesTotal+1),n=new Uint8Array(s),a=new ie(s,1);return{buffer:s,tryRead:()=>Atomics.compareExchange(n,0,e.WRITTEN,e.READING)===e.READING?(a.position=0,t.read(a),i(t.object),Atomics.store(n,0,e.READ),!0):!1}}})(is||(is={}));var v;(function(r){r.length=16,r.generate=()=>e(crypto.getRandomValues(new Uint8Array(r.length))),r.sha256=async t=>crypto.subtle.digest("SHA-256",t).then(i=>e(new Uint8Array(i.slice(0,r.length)))),r.validate=t=>r.parse(r.toString(t)),r.fromDataInput=t=>{let i=new Uint8Array(r.length);return t.readBytes(new Int8Array(i.buffer)),i},r.toDataOutput=(t,i)=>t.writeBytes(new Int8Array(i.buffer)),r.toString=t=>{let i=M.create(s=>(s+256).toString(16).substring(1),256);return i[t[0]]+i[t[1]]+i[t[2]]+i[t[3]]+"-"+i[t[4]]+i[t[5]]+"-"+i[t[6]]+i[t[7]]+"-"+i[t[8]]+i[t[9]]+"-"+i[t[10]]+i[t[11]]+i[t[12]]+i[t[13]]+i[t[14]]+i[t[15]]},r.parse=t=>{let i=t.replace(/-/g,"").toLowerCase();if(i.length!==32)return b("Invalid UUID format");let s=new Uint8Array(r.length);for(let n=0,a=0;n<32;n+=2,a++)s[a]=parseInt(i.slice(n,n+2),16);return s},r.Comparator=(t,i)=>{if(t.length!==r.length||i.length!==r.length)return b("Unexpected array length for uuid(v4)");for(let s=0;s<r.length;s++){let n=t[s]-i[s];if(n!==0)return n}return 0},r.equals=(t,i)=>r.Comparator(t,i)===0,r.newSet=t=>new Me(t,r.Comparator),r.Lowest=r.parse("00000000-0000-4000-8000-000000000000"),r.Highest=r.parse("FFFFFFFF-FFFF-4FFF-BFFF-FFFFFFFFFFFF"),r.fromInt=t=>{let i=new Uint8Array(r.Lowest),s=new Uint8Array(new Uint32Array([t]).buffer);for(let n=0;n<4;n++)i[n]=s[n];return i};let e=t=>(E(t.length===r.length,"UUID must be 16 bytes long"),t[6]=t[6]&15|64,t[8]=t[8]&63|128,t)})(v||(v={}));var ss;(function(r){r.create=n=>V(n)?V(n?.snap)?r.snap(n?.trackLength,n?.snap?.snapLength,Array.isArray(n?.snap?.threshold)?n?.snap.threshold:[n?.snap?.threshold]):r.identity(n?.trackLength):r.identity(),r.snap=(n=e,a=t,l)=>new s(n,a/n,l),r.identity=(n=e)=>new i(n);let e=128,t=24;class i{length;#e=NaN;#t=NaN;#r=1;constructor(a){this.length=a}begin(a){this.#t=this.#e=a}moveBy(a){E(!isNaN(this.#t),()=>"value has never been set"),this.#e+=a/this.length*this.#r,this.#t=I(this.#e,0,1)}ratio(a){this.#r=a}value(){return E(!isNaN(this.#t),()=>"value has never been set"),this.#t}disable(){}enable(){}}class s{#e;#t;#r;#i;#s=NaN;#n=NaN;#a=1;#o=!0;constructor(a,l,d){E(l>0,()=>`margin(${l}) must be greater then 0`),E(M.isSorted(d),()=>"thresholds are not sorted"),E(l<a,()=>`margin(${l}) must be lower then length(${a})`),this.#e=a,this.#t=l,this.#r=d,this.#i=d.map((c,F)=>c+F*this.#t)}begin(a){this.#o&&(this.#s=this.valueToX(a)),this.#n=a}moveBy(a){E(!isNaN(this.#n),()=>"value has never been set"),this.#s+=a/this.#e*this.#a,this.#n=this.#o?this.xToValue(this.#s):I(this.#s,0,1)}ratio(a){this.#a=a}value(){return E(!isNaN(this.#n),()=>"value has never been set"),this.#n}disable(){this.#o&&(this.#o=!1,this.#s=this.xToValue(this.#s))}enable(){this.#o||(this.#o=!0,this.#s=this.valueToX(this.#s))}valueToX(a){let l=z.rightMost(this.#r,a,Ee);if(l<0)return a;{let d=this.#i[l],c=this.#r[l];return a===c?d+this.#t/2:d+this.#t+(a-c)}}xToValue(a){let l=I(a,0,1+this.#t*this.#r.length),d=z.rightMost(this.#i,l,Ee);if(d<0)return l;{let c=this.#i[d],F=this.#r[d];return l>c+this.#t?l-(c+this.#t)+F:F}}get margin(){return this.#t}}})(ss||(ss={}));var sr=Symbol.for("@openDAW/lib-std");globalThis[sr]?console.debug(`%c${sr.description}%c is already available in ${globalThis.constructor.name}.`,"color: hsl(10, 83%, 60%)","color: inherit"):(globalThis[sr]=!0,console.debug(`%c${sr.description}%c is now available in ${globalThis.constructor.name}.`,"color: hsl(200, 83%, 60%)","color: inherit"));var o;(function(r){r[r.Timeline=0]="Timeline",r[r.Selection=1]="Selection",r[r.PianoMode=2]="PianoMode",r[r.User=3]="User",r[r.AudioConnection=4]="AudioConnection",r[r.InstrumentHost=5]="InstrumentHost",r[r.AudioOutput=6]="AudioOutput",r[r.NotesConnection=7]="NotesConnection",r[r.VoltageConnection=8]="VoltageConnection",r[r.AudioUnits=9]="AudioUnits",r[r.MidiEffectHost=10]="MidiEffectHost",r[r.AudioEffectHost=11]="AudioEffectHost",r[r.AudioBusses=12]="AudioBusses",r[r.AuxSend=13]="AuxSend",r[r.Modulation=14]="Modulation",r[r.Automation=15]="Automation",r[r.ParameterController=16]="ParameterController",r[r.MidiControl=17]="MidiControl",r[r.StepAutomation=18]="StepAutomation",r[r.Editing=19]="Editing",r[r.AudioFile=20]="AudioFile",r[r.AudioUnit=21]="AudioUnit",r[r.MarkerTrack=22]="MarkerTrack",r[r.MarkerEvents=23]="MarkerEvents",r[r.ClipCollection=24]="ClipCollection",r[r.RegionCollection=25]="RegionCollection",r[r.TrackCollection=26]="TrackCollection",r[r.Device=27]="Device",r[r.Groove=28]="Groove",r[r.ModularSetup=29]="ModularSetup",r[r.ModuleCollection=30]="ModuleCollection",r[r.ConnectionCollection=31]="ConnectionCollection",r[r.DeviceUserInterface=32]="DeviceUserInterface",r[r.NoteEvents=33]="NoteEvents",r[r.NoteEventFeature=34]="NoteEventFeature",r[r.NoteEventCollection=35]="NoteEventCollection",r[r.ValueEvents=36]="ValueEvents",r[r.ValueEventCollection=37]="ValueEventCollection",r[r.ValueInterpolation=38]="ValueInterpolation",r[r.Sample=39]="Sample"})(o||(o={}));var ns;(function(r){r.Instrument="instrument",r.Bus="bus",r.Aux="aux",r.Output="output"})(ns||(ns={}));var k=class r{static newSet(e){return new Me(e,r.Comparator)}static compose=(e,...t)=>{let i=t.length===0?this.#e:new Int16Array(t);return E(i.every((s,n)=>s===t[n]),`fieldKeys (${i.join(",")}) only allows i16`),new r(e,i)};static decode(e){let t=e.split("/");return E(t.length>0,"Unable to parse Address"),r.compose(v.parse(t[0]),...t.slice(1).map(i=>parseInt(i)))}static reconstruct(e){return this.compose(e[0],...e[1])}static boxRange(e,t,i){let s=e.values(),n=z.leftMostMapped(s,t,v.Comparator,i),a=s.length;if(n<0||n>=a)return null;for(let l=n;l<a;l++)if(v.Comparator(i(s[l]),t)!==0)return n<l?[n,l]:null;return[n,a]}static Comparator=(e,t)=>{let i=v.Comparator(e.#t,t.#t);if(i!==0)return i;let s=Math.min(e.#r.length,t.#r.length);for(let n=0;n<s;n++){let a=e.#r[n]-t.#r[n];if(a!==0)return a}return e.#r.length-t.#r.length};static MinimalComparator=(e,t)=>{let i=v.Comparator(e.#t,t.#t);if(i!==0)return i;let s=Math.min(e.#r.length,t.#r.length);for(let n=0;n<s;n++){let a=e.#r[n]-t.#r[n];if(a!==0)return a}return 0};static LengthComparator=(e,t)=>{let i=v.Comparator(e.#t,t.#t);return i!==0?i:t.#r.length-e.#r.length};static#e=new Int16Array(0);#t;#r;constructor(e,t){this.#t=e,this.#r=t}get uuid(){return this.#t}get fieldKeys(){return this.#r}isBox(){return this.#r.length===0}isContent(){return!this.isBox()}equals(e){return r.Comparator(this,e)===0}compareTo(e){return r.Comparator(this,e)}append(e){return new r(this.#t,new Int16Array([...this.#r,e]))}startsWith(e){return v.Comparator(e.#t,this.#t)===0&&e.#r.length<=this.#r.length&&e.#r.every((t,i)=>this.#r[i]===t)}write(e){e.writeBytes(new Int8Array(this.#t.buffer)),e.writeByte(this.#r.length),this.#r.forEach(t=>e.writeShort(t))}decompose(){return[this.#t,this.#r]}toJSON(){return{uuid:Array.from(this.#t.values()),fields:Array.from(this.#r.values())}}toArrayBuffer(){let e=new Uint8Array(v.length+this.#r.length);return e.set(this.#t,0),e.set(this.#r,v.length),e.buffer}toString(){return[v.toString(this.#t),...this.#r].join("/")}static read(e){let t=v.fromDataInput(e),i=e.readByte();return r.compose(t,...M.create(()=>e.readShort(),i))}},Ue;(function(r){r.AddressReader=e=>e.address,r.Comparator=({address:e},{address:t})=>k.Comparator(e,t),r.equals=(e,t)=>{let[i,s]=z.rangeMapped(t,e,k.Comparator,r.AddressReader);return t.slice(i,s+1)},r.startsWith=(e,t)=>{let[i,s]=z.rangeMapped(t,e,k.MinimalComparator,r.AddressReader);return t.slice(i,s+1).filter(n=>n.address.startsWith(e))},r.endsWith=(e,t)=>{let i=z.leftMostMapped(t,e,k.LengthComparator,r.AddressReader),s=z.rightMostMapped(t,e,k.MinimalComparator,r.AddressReader);return t.slice(i,s+1).filter(n=>e.startsWith(n.address))}})(Ue||(Ue={}));var xe=class r{static validate(e,t){return e.address.equals(t.address)?h.wrap(`PointerField cannot point to itself: ${e}`):t.pointerRules.accepts.some(i=>i===e.pointerType)?h.None:(console.warn(t.pointerRules),h.wrap(`${e.toString()} does not satisfy any of the allowed types (${t.pointerRules}).`))}#e;#t;#r;#i=h.None;constructor(e){this.#e=e,this.#t=new J,this.#r=new J}subscribeImmediate(e,...t){return this.#s(this.#t,e,t)}subscribeTransactual(e,...t){return this.#s(this.#r,e,t)}catchupAndSubscribeTransactual(e,...t){let i=k.newSet(s=>s.address);return i.addMany(this.filter(...t)),i.forEach(s=>e.onAdd(s)),this.subscribeTransactual({onAdd:s=>{i.add(s)&&e.onAdd(s)},onRemove:s=>{i.removeByKey(s.address),e.onRemove(s)}},...t)}filter(...e){return e.length===0?this.incoming():Z.filter(this,t=>e.some(i=>i===t.pointerType))}size(){return this.incoming().length}isEmpty(){return this.size()===0}nonEmpty(){return this.size()>0}contains(e){return this.incoming().some(t=>e.address.equals(t.address))}incoming(){return this.#e.graph.edges().incomingEdgesOf(this.#e)}onAdded(e){let t=r.validate(e,this.#e);if(t.nonEmpty())return b(t.unwrap());this.#i.isEmpty()&&(this.#e.graph.subscribeEndTransaction(this.#n),this.#i=h.wrap(new Set(this))),this.#t.proxy.onAdd(e)}onRemoved(e){this.#i.isEmpty()&&(this.#e.graph.subscribeEndTransaction(this.#n),this.#i=h.wrap(new Set(this))),this.#t.proxy.onRemove(e)}[Symbol.iterator](){return this.incoming().values()}toString(){return`{Pointers ${this.#e.address}, pointers: ${Array.from(this).map(e=>e.toString())}}`}#s(e,t,i){return e.subscribe({onAdd:s=>{(i.length===0||i.some(n=>n===s.pointerType))&&t.onAdd(s)},onRemove:s=>{(i.length===0||i.some(n=>n===s.pointerType))&&t.onRemove(s)}})}#n=()=>{if(this.#e.isAttached()){let e=this.#i.unwrap("Callback without transaction"),t=new Set(this);e.forEach(i=>{t.has(i)||this.#r.proxy.onRemove(i)}),t.forEach(i=>{e.has(i)||this.#r.proxy.onAdd(i)})}this.#i=h.None}};var Ai=function(r,e,t,i){var s=arguments.length,n=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(n=(s<3?a(n):s>3?a(e,t,n):a(e,t))||n);return s>3&&n&&Object.defineProperty(e,t,n),n},nt=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},N=class r{static hook(e){return new r(e)}#e;#t;#r;#i;constructor({parent:e,fieldKey:t,fieldName:i,pointerRules:s}){this.#e=e,this.#t=t,this.#r=i,this.#i=s,s.mandatory&&this.graph.edges().watchVertex(this)}accept(e){return p(e.visitField,this)}get box(){return this.#e.box}get graph(){return this.#e.graph}get parent(){return this.#e}get fieldKey(){return this.#t}get fieldName(){return this.#r}get pointerRules(){return this.#i}get pointerHub(){return new xe(this)}get address(){return this.#e.address.append(this.#t)}get debugPath(){return`${this.box.name}:${this.box.mapFields(e=>e.fieldName,...this.address.fieldKeys).join("/")}`}isBox(){return!1}isField(){return!0}isAttached(){return this.graph.findBox(this.address.uuid).nonEmpty()}fields(){return Z.empty()}getField(e){return b()}optField(e){return h.None}read(e){}write(e){}disconnect(){if(this.pointerHub.isEmpty())return;let e=this.pointerHub.incoming();e.forEach(t=>{t.defer(),(t.mandatory||this.pointerRules.mandatory&&e.length===1)&&t.box.delete()})}toString(){return`{${this.box.constructor.name}:${this.constructor.name} (${this.fieldName}) ${this.address.toString()}`}};Ai([tt,nt("design:type",xe),nt("design:paramtypes",[])],N.prototype,"pointerHub",null);Ai([tt,nt("design:type",k),nt("design:paramtypes",[])],N.prototype,"address",null);Ai([tt,nt("design:type",String),nt("design:paramtypes",[])],N.prototype,"debugPath",null);var u=Object.freeze({mandatory:!1,accepts:[]});var ot=class r extends N{static create(e,t,i){return new r(e,t,i)}#e;constructor(e,t,i){super(e),this.#e=M.create(s=>t({parent:this,fieldKey:s,fieldName:String(s),pointerRules:u}),i)}accept(e){return p(e.visitArrayField,this)}fields(){return this.#e}getField(e){return T(this.#e[e])}optField(e){return h.wrap(this.#e[e])}read(e){this.#e.forEach(t=>t.read(e))}write(e){this.#e.forEach(t=>t.write(e))}size(){return this.#e.length}toJSON(){return this.#e}};var Re;(function(r){r.writeFields=(t,i)=>{let s=Object.entries(i);t.writeInt(1179403347),t.writeShort(s.length),s.forEach(([n,a])=>{let l=ae.create();a.write(l);let d=new Int8Array(l.toArrayBuffer());t.writeShort(Number(n)),t.writeInt(d.length),t.writeBytes(d)})},r.readFields=(t,i)=>{E(t.readInt()===1179403347,"Serializer header is corrupt");let s=t.readShort();for(let n=0;n<s;n++){let a=t.readShort(),l=t.readInt(),d=new Int8Array(l);t.readBytes(d),i[a]?.read(new ie(d.buffer))}}})(Re||(Re={}));var zs=function(r,e,t,i){var s=arguments.length,n=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,e,t,i);else for(var l=r.length-1;l>=0;l--)(a=r[l])&&(n=(s<3?a(n):s>3?a(e,t,n):a(e,t))||n);return s>3&&n&&Object.defineProperty(e,t,n),n},os=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},x=class r{static DEBUG_DELETION=!1;static Index=0;#e;#t;#r;#i;#s;#n=r.Index++;constructor({uuid:e,graph:t,name:i,pointerRules:s}){this.#e=k.compose(e),this.#t=t,this.#r=i,this.#i=s,this.#s=this.initializeFields(),s.mandatory&&this.graph.edges().watchVertex(this)}fields(){return Object.values(this.#s)}getField(e){return T(this.#s[e])}optField(e){return h.wrap(this.#s[e])}subscribe(e,t){return this.graph.subscribeVertexUpdates(e,this.address,t)}get box(){return this}get name(){return this.#r}get graph(){return this.#t}get parent(){return this}get address(){return this.#e}get pointerRules(){return this.#i}get creationIndex(){return this.#n}get pointerHub(){return new xe(this)}estimateMemory(){let e=new et;return this.write(e),e.count}isBox(){return!0}isField(){return!1}isAttached(){return this.#t.findBox(this.address.uuid).nonEmpty()}read(e){Re.readFields(e,this.#s)}write(e){Re.writeFields(e,this.#s)}serialize(){let e=ae.create();return e.writeInt(this.#n),e.writeString(this.name),e.writeBytes(new Int8Array(this.address.uuid.buffer)),this.write(e),e.toArrayBuffer()}toArrayBuffer(){let e=ae.create();return this.write(e),e.toArrayBuffer()}incomingEdges(){return this.graph.edges().incomingEdgesOf(this)}outgoingEdges(){return this.graph.edges().outgoingEdgesOf(this)}mapFields(e,...t){if(t.length===0)return M.empty();let i=this.getField(t[0]),s=[e(i)];for(let n=1;n<t.length;n++)i=i.getField(t[n]),s.push(e(i));return s}searchVertex(e){if(e.length===0)return h.wrap(this);let t=this.optField(e[0]);if(t.isEmpty())return h.None;for(let i=1;i<e.length;i++)if(t=t.unwrap().optField(e[i]),t.isEmpty())return h.None;return t}delete(){let{boxes:e,pointers:t}=this.graph.dependenciesOf(this);r.DEBUG_DELETION&&(console.debug(`Delete ${this.toString()}`),console.debug(" unplugs",[...t].map(i=>i.toString()).join(`
2
- `)),console.debug(" unstages",[...e].map(i=>i.toString()).join(`
3
- `),this));for(let i of t)i.defer();for(let i of e)i.unstage();this.unstage()}unstage(){this.graph.unstageBox(this)}toString(){return`${this.constructor.name} ${this.address.toString()}`}};zs([tt,os("design:type",xe),os("design:paramtypes",[])],x.prototype,"pointerHub",null);var O;(function(r){r[r.This=0]="This",r[r.Parent=1]="Parent",r[r.Children=2]="Children"})(O||(O={}));var nr;(function(r){r.create=()=>new Ni})(nr||(nr={}));var Ni=class{#e=new Mt(Ue.equals);#t=new Mt(Ue.startsWith);#r=new Mt(Ue.endsWith);#i=[];#s=0;#n=!1;subscribe(e,t,i){let s=new Bi(t,e,this.#s++,i);if(this.#n){let n=new Ei(s,e);return this.#i.push(n),n}else return this.subscribeMonitor(s,e)}dispatch(e){this.#n=!0,[...this.#e.filter(e),...this.#t.filter(e),...this.#r.filter(e)].sort(({order:i},{order:s})=>i-s).forEach(i=>i.procedure(e)),this.#n=!1,this.#i.forEach(i=>i.subscribe(this)),this.#i.length=0}subscribeMonitor(e,t){switch(t){case O.This:return this.#e.subscribe(e);case O.Parent:return this.#t.subscribe(e);case O.Children:return this.#r.subscribe(e);default:return Oe(t)}}countStations(){return this.#e.count()+this.#t.count()+this.#r.count()}},Bi=class{address;propagation;order;procedure;constructor(e,t,i,s){this.address=e,this.propagation=t,this.order=i,this.procedure=s}toString(){return`{ Monitor address: ${this.address}, propagation: ${O[this.propagation]}, order: ${this.order} }`}},Mt=class{filterStrategy;#e=[];#t=!0;constructor(e){this.filterStrategy=e}subscribe(e){return this.#e.push(e),this.#t=this.#e.length<2,{terminate:()=>{let t=this.#e.length;for(;--t>=0;)this.#e[t]===e&&this.#e.splice(t,1)}}}stations(){return this.#t||(this.#e.sort(Ue.Comparator),this.#t=!0),this.#e}filter(e){return this.filterStrategy(e.address,this.stations())}count(){return this.#e.length}},Ei=class{monitor;propagation;#e=new R;#t=!1;constructor(e,t){this.monitor=e,this.propagation=t}subscribe(e){this.#t||(this.#e.terminate(),this.#e.own(e.subscribeMonitor(this.monitor,this.propagation)))}terminate(){this.#t=!0,this.#e.terminate()}};var q;(function(r){r.Boolean="boolean",r.Float32="float32",r.Int32="int32",r.String="string",r.Bytes="bytes"})(q||(q={}));var Le={[q.Boolean]:{type:q.Boolean,encode:(r,e)=>r.writeBoolean(e),decode:r=>r.readBoolean()},[q.Float32]:{type:q.Float32,encode:(r,e)=>r.writeFloat(e),decode:r=>r.readFloat()},[q.Int32]:{type:q.Int32,encode:(r,e)=>r.writeInt(e),decode:r=>r.readInt()},[q.String]:{type:q.String,encode:(r,e)=>r.writeString(e),decode:r=>r.readString()},[q.Bytes]:{type:q.Bytes,encode:(r,e)=>{r.writeInt(e.length),r.writeBytes(e)},decode:r=>{let e=new Int8Array(r.readInt());return r.readBytes(e),e}}},ze=class extends N{#e;#t;#r;constructor(e,t,i){super(e),this.#e=t,this.#t=this.clamp(i),this.#r=this.#t}accept(e){return p(e.visitPrimitiveField,this)}subscribe(e){return this.graph.subscribeVertexUpdates(O.This,this.address,()=>e(this))}catchupAndSubscribe(e){return e(this),this.subscribe(e)}get type(){return this.#e}get initValue(){return this.#t}setInitValue(e){E(this.graph.constructingBox(),"Cannot change initial value at runtime"),this.setValue(this.#t=e)}getValue(){return this.#r}setValue(e){let t=this.#r,i=this.clamp(e);this.equals(i)||(this.#r=e,this.graph.onPrimitiveValueUpdate(this,t,i))}writeValue(e,t){this.serialization().encode(e,t)}readValue(e){return this.serialization().decode(e)}reset(){this.setValue(this.#t)}},w=class r extends ze{static create(e,t=!1){return new r(e,t)}constructor(e,t){super(e,q.Boolean,t)}toggle(){this.setValue(!this.getValue())}serialization(){return Le[q.Boolean]}equals(e){return this.getValue()===e}clamp(e){return e}read(e){this.setValue(e.readBoolean())}write(e){e.writeBoolean(this.getValue())}},m=class r extends ze{static create(e,t=0){return new r(e,t)}constructor(e,t){super(e,q.Float32,t)}serialization(){return Le[q.Float32]}equals(e){return this.getValue()===e}clamp(e){return we.toFloat32(e)}read(e){this.setValue(e.readFloat())}write(e){e.writeFloat(this.getValue())}},f=class r extends ze{static create(e,t=0){return new r(e,t)}constructor(e,t){super(e,q.Int32,t)}serialization(){return Le[q.Int32]}equals(e){return this.getValue()===e}clamp(e){return oe.toInt(e)}read(e){this.setValue(e.readInt())}write(e){e.writeInt(this.getValue())}},B=class r extends ze{static create(e,t=""){return new r(e,t)}constructor(e,t){super(e,q.String,t)}serialization(){return Le[q.String]}equals(e){return this.getValue()===e}clamp(e){return e}read(e){this.setValue(e.readString())}write(e){e.writeString(this.getValue())}},as=class r extends ze{static create(e,t=this.#e){return new r(e,t)}static#e=Object.freeze(new Int8Array(0));constructor(e,t){super(e,q.Bytes,t)}serialization(){return Le[q.Bytes]}equals(e){return this.getValue().length===e.length&&this.getValue().every((t,i)=>e[i]===t)}clamp(e){return e}read(e){let t=new Int8Array(e.readInt());e.readBytes(t),this.setValue(t)}write(e){let t=this.getValue();e.writeInt(t.length),e.writeBytes(t)}};var ls;(function(r){r.decode=e=>{let t=e.readInt();return M.create(()=>{switch(e.readString()){case"new":{let s=v.fromDataInput(e),n=e.readString(),a=new Int8Array(e.readInt());return e.readBytes(a),new Rt(s,n,a.buffer)}case"pointer":{let s=k.read(e),n=e.readBoolean()?h.wrap(k.read(e)):h.None,a=e.readBoolean()?h.wrap(k.read(e)):h.None;return new Vt(s,n,a)}case"primitive":{let s=k.read(e),n=e.readString(),a=Le[n],l=a.decode(e),d=a.decode(e);return new Ct(s,a,l,d)}case"delete":{let s=v.fromDataInput(e),n=e.readString(),a=new Int8Array(e.readInt());return e.readBytes(a),new Pt(s,n,a.buffer)}}},t)}})(ls||(ls={}));var Rt=class{type="new";#e;#t;#r;constructor(e,t,i){this.#e=e,this.#t=t,this.#r=i}get uuid(){return this.#e}get name(){return this.#t}get settings(){return this.#r}forward(e){e.createBox(this.#t,this.#e,t=>t.read(new ie(this.#r)))}inverse(e){e.findBox(this.#e).unwrap(()=>`Could not find ${this.#t}`).unstage()}write(e){e.writeString(this.type),v.toDataOutput(e,this.#e),e.writeString(this.#t),e.writeInt(this.#r.byteLength),e.writeBytes(new Int8Array(this.#r))}toString(){return`{NewUpdate uuid: ${v.toString(this.#e)}, attachment: ${this.settings.byteLength}b`}toDebugString(e){return this.toString()}},Ct=class{type="primitive";#e;#t;#r;#i;constructor(e,t,i,s){this.#e=e,this.#t=t,this.#r=i,this.#i=s}get address(){return this.#e}get oldValue(){return this.#r}get newValue(){return this.#i}matches(e){return e.address.equals(this.address)}inverse(e){this.field(e).setValue(this.#r)}forward(e){this.field(e).setValue(this.#i)}field(e){return e.findVertex(this.#e).unwrap(()=>`Could not find PrimitiveField at ${this.#e}`)}write(e){e.writeString(this.type),this.#e.write(e),e.writeString(this.#t.type),this.#t.encode(e,this.#r),this.#t.encode(e,this.#i)}toString(){return`{PrimitiveUpdate oldValue: ${this.#r}, newValue: ${this.#i}`}},Vt=class{type="pointer";#e;#t;#r;constructor(e,t,i){this.#e=e,this.#t=t,this.#r=i}get address(){return this.#e}get oldValue(){return this.#t}get newValue(){return this.#r}matches(e){return e.address.equals(this.address)}inverse(e){this.field(e).targetAddress=this.#t}forward(e){this.field(e).targetAddress=this.#r}field(e){return e.findVertex(this.#e).unwrap(()=>`Could not find PointerField at ${this.#e}`)}write(e){e.writeString(this.type),this.#e.write(e),this.#t.match({none:()=>e.writeBoolean(!1),some:t=>{e.writeBoolean(!0),t.write(e)}}),this.#r.match({none:()=>e.writeBoolean(!1),some:t=>{e.writeBoolean(!0),t.write(e)}})}toString(){return`{PointerUpdate oldValue: ${this.#t.unwrapOrNull()}, newValue: ${this.#r.unwrapOrNull()}`}},Pt=class{type="delete";#e;#t;#r;constructor(e,t,i){this.#e=e,this.#t=t,this.#r=i}get uuid(){return this.#e}get name(){return this.#t}get settings(){return this.#r}forward(e){e.findBox(this.#e).unwrap(()=>`Could not find ${this.#t}`).unstage()}inverse(e){e.createBox(this.#t,this.#e,t=>t.read(new ie(this.#r)))}write(e){e.writeString(this.type),v.toDataOutput(e,this.#e),e.writeString(this.#t),e.writeInt(this.#r.byteLength),e.writeBytes(new Int8Array(this.#r))}toString(){return`{DeleteUpdate uuid: ${v.toString(this.#e)}, attachment: ${this.settings.byteLength}b`}};var zl=Symbol("Unreferenceable"),g=class r extends N{static create(e,t,i){return new r(e,t,i)}#e;#t;#r=h.None;#i=h.None;constructor(e,t,i){super(e),this.#e=t,this.#t=i,i&&this.graph.edges().watchVertex(this)}get pointerHub(){return b(`${this} cannot be pointed to`)}get pointerType(){return this.#e}get mandatory(){return this.#t}accept(e){return p(e.visitPointerField,this)}subscribe(e){return this.graph.subscribeVertexUpdates(O.This,this.address,()=>e(this))}catchupAndSubscribe(e){return e(this),this.graph.subscribeVertexUpdates(O.This,this.address,()=>this.graph.subscribeEndTransaction(()=>e(this)))}refer(e){this.targetVertex=h.wrap(e)}defer(){this.targetVertex=h.None}get targetVertex(){return this.#r}set targetVertex(e){if(e.nonEmpty()){let t=xe.validate(this,e.unwrap());t.nonEmpty()&&b(t.unwrap())}this.targetAddress=e.map(t=>t.address)}get targetAddress(){return this.#i}set targetAddress(e){let t=this.#i;t.isEmpty()&&e.isEmpty()||(e.nonEmpty()&&t.unwrapOrNull()?.equals(e.unwrap()))===!0||(this.#i=e,this.graph.onPointerAddressUpdated(this,t,e))}isEmpty(){return this.targetAddress.isEmpty()}nonEmpty(){return this.targetAddress.nonEmpty()}resolve(){let e=this.targetAddress,t=e.flatMap(i=>this.graph.findVertex(i));if(e.nonEmpty()&&t.isEmpty())return b(`${e.unwrapOrNull()?.toString()} could not be resolved`);this.#r=t}read(e){this.targetAddress=e.readBoolean()?h.wrap(k.read(e)):h.None}write(e){this.#i.match({none:()=>e.writeBoolean(!1),some:t=>{e.writeBoolean(!0),t.write(e)}})}};var or=class{#e;#t;#r;#i;constructor(){this.#e=k.newSet(e=>e.address),this.#t=k.newSet(e=>e.address),this.#r=k.newSet(([e])=>e.address),this.#i=k.newSet(([e])=>e.address)}watchVertex(e){if(Ze(e,g)){if(!e.mandatory)return b("watchVertex called but has no edge requirement");this.#e.add(e)}else{if(!e.pointerRules.mandatory)return b("watchVertex called but has no edge requirement");this.#t.add(e)}}unwatchVerticesOf(...e){let t=({box:{address:{uuid:i}}})=>i;for(let{address:{uuid:i}}of e)this.#n(this.#e,i,t),this.#n(this.#t,i,t);for(let i of e){let s=this.outgoingEdgesOf(i);if(s.length>0)return b(`${i} has outgoing edges: ${s.map(([a,l])=>`[${a.toString()}, ${l.toString()}]`)}`);let n=this.incomingEdgesOf(i);if(n.length>0)return b(`${i} has incoming edges from: ${n.map(a=>a.toString())}`)}}connect(e,t){this.#i.add([e,t]),this.#r.opt(t.address).match({none:()=>this.#r.add([t,[e]]),some:([,i])=>i.push(e)})}disconnect(e){let[,t]=this.#i.removeByKey(e.address),[,i]=this.#r.get(t.address);M.remove(i,e),i.length===0&&this.#r.removeByKey(t.address)}outgoingEdgesOf(e){return this.#s(this.#i,e.address.uuid,([{box:{address:{uuid:t}}}])=>t)}incomingEdgesOf(e){return e.isBox()?this.#s(this.#r,e.address.uuid,([{address:{uuid:t}}])=>t).flatMap(([t,i])=>i):this.#r.opt(e.address).mapOr(([t,i])=>i,M.empty())}validateRequirements(){this.#e.forEach(e=>{if(e.isEmpty())return e.mandatory?b(`Pointer ${e.toString()} requires an edge.`):b(`Illegal state: ${e} has no edge requirements.`)}),this.#t.forEach(e=>{if(e.pointerHub.isEmpty())return e.pointerRules.mandatory?b(`Target ${e.toString()} requires an edge.`):b(`Illegal state: ${e} has no edge requirements.`)})}verifyPointers(){this.#e.forEach(e=>E(e.isAttached(),`${e.address.toString()} is not attached`)),this.#t.forEach(e=>E(e.isAttached(),`${e.address.toString()} is not attached`))}#s(e,t,i){let s=k.boxRange(e,t,i);return V(s)?e.values().slice(s[0],s[1]):M.empty()}#n(e,t,i){let s=k.boxRange(e,t,i);V(s)&&e.removeRange(s[0],s[1])}};var ar=class{#e;#t;#r;#i;#s;#n;#a;#o;#l;#u=!1;#d=!1;constructor(e=h.None){this.#e=e,this.#t=v.newSet(t=>t.address.uuid),this.#r=[],this.#a=nr.create(),this.#i=new J,this.#s=new J,this.#n=new J,this.#o=new or,this.#l=[]}beginTransaction(){E(!this.#u,"Transaction already in progress"),this.#u=!0,this.#n.proxy.onBeginTransaction()}endTransaction(){for(E(this.#u,"No transaction in progress"),this.#u=!1,this.resolvePointers();this.#l.length>0;)this.#l.splice(0).forEach(e=>e()),this.#l.length>0&&console.debug(`${this.#l.length} new observers while notifying`);this.#n.proxy.onEndTransaction()}inTransaction(){return this.#u}constructingBox(){return this.#d}resolvePointers(){this.#r.length!==0&&(this.#r.forEach(({pointerField:e,update:t})=>this.#h(e,t)),this.#r.length=0)}createBox(e,t,i){this.#e.unwrap("No box-factory installed")(e,this,t,i)}stageBox(e,t){this.#c(),E(!this.#d,"Cannot construct box while other box is constructing"),V(t)&&(this.#d=!0,t(e),this.#d=!1);let i=this.#t.add(e);E(i,`${e} already staged`);let s=new Rt(e.address.uuid,e.name,e.toArrayBuffer());return this.#i.proxy.onUpdate(s),this.#s.proxy.onUpdate(s),e}subscribeTransaction(e){return this.#n.subscribe(e)}subscribeToAllUpdates(e){return this.#i.subscribe(e)}subscribeToAllUpdatesImmediate(e){return this.#s.subscribe(e)}subscribeVertexUpdates(e,t,i){return this.#a.subscribe(e,t,i)}subscribeEndTransaction(e){this.#l.push(e)}unstageBox(e){this.#c();let t=this.#t.removeByKey(e.address.uuid);E(t===e,`${e} could not be found to unstage`),this.#o.unwatchVerticesOf(e);let i=new Pt(e.address.uuid,e.name,e.toArrayBuffer());this.#i.proxy.onUpdate(i),this.#s.proxy.onUpdate(i)}findBox(e){return this.#t.opt(e)}findVertex(e){return this.#t.opt(e.uuid).flatMap(t=>t.searchVertex(e.fieldKeys))}boxes(){return this.#t.values()}edges(){return this.#o}checksum(){let e=new rr;return this.boxes().forEach(t=>t.write(e)),e.result()}onPrimitiveValueUpdate(e,t,i){if(this.#c(),e.isAttached()&&!this.#d){let s=new Ct(e.address,e.serialization(),t,i);this.#a.dispatch(s),this.#i.proxy.onUpdate(s),this.#s.proxy.onUpdate(s)}}onPointerAddressUpdated(e,t,i){this.#c();let s=new Vt(e.address,t,i);this.#d?this.#r.push({pointerField:e,update:s}):(this.#h(e,s),this.#s.proxy.onUpdate(s))}#h(e,t){let i=e.targetVertex.unwrapOrNull();e.resolve();let s=e.targetVertex.unwrapOrNull();i!==s&&(i?.pointerHub.onRemoved(e),s?.pointerHub.onAdded(e),i!==null&&this.#o.disconnect(e),s!==null&&this.#o.connect(e,s)),this.#a.dispatch(t),this.#i.proxy.onUpdate(t)}dependenciesOf(e){let t=new Set,i=new Set,s=n=>{t.has(n)||(t.add(n),n.outgoingEdges().filter(([a])=>!i.has(a)).forEach(([a,l])=>{if(i.add(a),l.pointerRules.mandatory&&l.pointerHub.incoming().every(d=>i.has(d)))return s(l.box)}),n.incomingEdges().forEach(a=>{i.add(a),a.mandatory&&s(a.box)}))};return s(e),t.delete(e),{boxes:t,pointers:Array.from(i).reverse()}}verifyPointers(){console.debug("validate requirements"),this.#o.validateRequirements(),this.#o.verifyPointers(),console.debug("verify pointers");let e=0,t=i=>{for(let s of i.fields())s.accept({visitPointerField:n=>{if(n.targetAddress.nonEmpty()){let a=n.targetVertex.nonEmpty(),l=this.findVertex(n.targetAddress.unwrap()).nonEmpty();E(a,`pointer ${n.address} is broken`),E(l,`Cannot find target for pointer ${n.address}`),e++}},visitObjectField:n=>t(n)})};return this.#t.forEach(i=>t(i)),console.debug("verification complete."),{count:e}}debugBoxes(){console.table(this.#t.values().reduce((e,t)=>(e[v.toString(t.address.uuid)]={class:t.name,"incoming links":t.incomingEdges().length,"outgoing links":t.outgoingEdges().length,"est. memory (bytes)":t.estimateMemory()},e),{}))}debugDependencies(){console.debug("Dependencies:"),this.boxes().forEach(e=>{console.debug(` ${e}`);for(let t of this.dependenciesOf(e).boxes)console.debug(` ${t}`)})}addressToDebugPath(e){return e.flatMap(t=>t.isBox()?this.findBox(t.uuid).map(i=>i.name):this.findBox(t.uuid).flatMap(i=>i.searchVertex(t.fieldKeys).map(s=>s.isField()?s.debugPath:b("Unknown address"))))}toArrayBuffer(){let e=ae.create(),t=this.#t.values();return e.writeInt(t.length),t.forEach(i=>{let s=i.serialize();e.writeInt(s.byteLength),e.writeBytes(new Int8Array(s))}),e.toArrayBuffer()}fromArrayBuffer(e){E(this.#t.isEmpty(),"Cannot call fromArrayBuffer if boxes is not empty");let t=new ie(e),i=t.readInt();this.beginTransaction();let s=[];for(let n=0;n<i;n++){let a=t.readInt(),l=new Int8Array(a);t.readBytes(l);let d=new ie(l.buffer),c=d.readInt(),F=d.readString(),y=v.fromDataInput(d);s.push({creationIndex:c,name:F,uuid:y,boxStream:d})}s.sort((n,a)=>n.creationIndex-a.creationIndex).forEach(({name:n,uuid:a,boxStream:l})=>this.createBox(n,a,d=>d.read(l))),this.endTransaction()}#c(){E(this.#u,()=>"Modification only prohibited in transaction mode.")}};var L=class extends N{#e;constructor(e){super(e),this.#e=this.initializeFields()}accept(e){return p(e.visitObjectField,this)}fields(){return Object.values(this.#e)}getField(e){return T(this.#e[e])}optField(e){return h.wrap(this.#e[e])}read(e){Re.readFields(e,this.#e)}write(e){Re.writeFields(e,this.#e)}toJSON(){return this.#e}};var lr;(function(r){r.sender=(i,s)=>s(new e(i)),r.executor=(i,s)=>new t(i,s);class e{#e;#t=new Map;#r;#i=0;constructor(s){this.#e=s,this.#r=s.subscribe(this.#s)}terminate(){this.#r.terminate()}dispatchAndForget=(s,...n)=>this.#e.send({type:"send",returnId:!1,func:s.name,args:Array.from(Z.map(n,a=>({value:a})))});dispatchAndReturn=(s,...n)=>new Promise((a,l)=>{let d=Z.reduce(n,(c,F,y)=>(typeof F=="function"&&c.push([y,F]),c),[]);this.#t.set(this.#i,{executorTuple:{resolve:a,reject:l},callbacks:new Map(d)}),this.#e.send({type:"send",returnId:this.#i,func:s.name,args:Array.from(Z.map(n,(c,F)=>typeof c=="function"?{callback:F}:{value:c}))}),this.#i++});#s=s=>{let n=this.#t.get(s.returnId);V(n)?s.type==="resolve"?(n.executorTuple.resolve(s.resolve),this.#t.delete(s.returnId)):s.type==="reject"?(n.executorTuple.reject(s.reject),this.#t.delete(s.returnId)):s.type==="callback"&&n.callbacks?.get(s.funcAt).apply(this,s.args):b(`Promise has already been resolved. ${JSON.stringify(s)}`)}}class t{#e;#t;#r;constructor(s,n){this.#e=s,this.#t=n,this.#r=s.subscribe(this.#i)}terminate(){this.#r.terminate()}#i=s=>{E(s.type==="send",()=>"Message type must be 'send'");let n=Object.getPrototypeOf(this.#t)===Object.getPrototypeOf({})?this.#t:Object.getPrototypeOf(this.#t),a=T(n[s.func],`${s.func.toString()} does not exists on ${this.#t}`),l=s.returnId;if(l===!1)a.apply(this.#t,s.args.map(d=>"value"in d?d.value:b(`${s.func.toString()} has no promise.`)));else try{a.apply(this.#t,s.args.map(c=>"callback"in c?(...F)=>this.#a(l,c.callback,F):c.value)).then(c=>this.#s(l,c),c=>this.#n(l,c))}catch(d){this.#n(l,d)}};#s=(s,n)=>this.#e.send({type:"resolve",returnId:s,resolve:n});#n=(s,n)=>this.#e.send({type:"reject",returnId:s,reject:n});#a=(s,n,a)=>this.#e.send({type:"callback",returnId:s,funcAt:n,args:a})}r.Executor=t})(lr||(lr={}));var us;(function(r){r.ProgressArrayBuffer=e=>async t=>{if(!t.headers.has("Content-Length"))return console.debug("No Content-Length"),t.arrayBuffer();let i=parseInt(t.headers.get("Content-Length"));if(console.debug(`Content-Length: ${i}b`),isNaN(i)||i<4096)return t.arrayBuffer();e(0);let s=ae.create(i),n=T(t.body,"response.body is empty").getReader();for(;;){let{done:a,value:l}=await n.read();if(a)break;l.forEach(d=>s.writeByte(d)),e(s.position/i)}return e(1),s.toArrayBuffer()}})(us||(us={}));var ds;(function(r){r.debounce=(()=>{let e;return(t,i=1e3)=>{clearTimeout(e),e=setTimeout(t,i)}})(),r.scheduleInterval=(e,t,...i)=>{let s=setInterval(e,t,...i);return{terminate:()=>clearInterval(s)}},r.scheduleTimeout=(e,t,...i)=>{let s=setTimeout(e,t,...i);return{terminate:()=>clearTimeout(s)}}})(ds||(ds={}));var Mi=class{maxRetry;timeSpan;#e=0;constructor(e,t){this.maxRetry=e,this.timeSpan=t}retry(e,t){return++this.#e===this.maxRetry?!1:(console.debug(`${e} > will retry in ${this.timeSpan.toString()}`),setTimeout(t,this.timeSpan.millis()),!0)}},ur;(function(r){class e{value;status="resolved";constructor(a){this.value=a}error=hi("Cannot access error when promise is resolved")}class t{error;status="rejected";constructor(a){this.error=a}value=hi("Cannot access value when promise is rejected")}r.makeAbortable=async(n,a)=>{let l=!0;return n.own(P.create(()=>l=!1)),new Promise((d,c)=>a.then(F=>{l&&d(F)},F=>{l&&c(F)}))},r.tryCatch=n=>n.then(a=>new e(a),a=>new t(a)),r.retry=(n,a=new Mi(3,ke.seconds(3)))=>n().catch(l=>new Promise((d,c)=>{let F=y=>{a.retry(y,()=>n().then(A=>d(A),F))||c(y)};F(l)})),r.fail=(n,a)=>{let l=()=>new Promise((d,c)=>setTimeout(()=>c("fails first"),n.millis()));return()=>{let d=l();return l=a,d}},r.timeout=(n,a,l)=>new Promise((d,c)=>{let F=!0,y=setTimeout(()=>{F=!1,c(new Error(l??"timeout"))},a.millis());n.then(A=>{F&&d(A)},A=>{F&&c(A)}).finally(()=>clearTimeout(y))}),r.sequential=n=>{let a=Promise.resolve(null);return l=>a=a.then(()=>n(l))};class i{max;#e;#t=0;constructor(a=1){this.max=a,this.#e=[]}async add(a){if(this.#t<this.max)return this.#t++,a().finally(()=>this.#r());{let l=Promise.withResolvers();return this.#e.push([a,l]),l.promise.finally(()=>this.#r())}}#r(){if(E(this.#t>0,"Internal Error in Promises.Limit"),--this.#t<this.max&&this.#e.length>0){let[a,{resolve:l,reject:d}]=this.#e.shift();this.#t++,a().then(l,d)}}}r.Limit=i;class s{#e;#t;#r;#i=h.None;constructor(a,l,d){this.#e=a,this.#t=l,this.#r=d}update(a){this.#i=h.wrap(a),a.then(l=>{this.#i.contains(a)&&this.#e(l)}).catch(l=>{this.#i.contains(a)&&this.#t(l)}).finally(()=>{this.#i.contains(a)&&(this.terminate(),p(this.#r))})}terminate(){this.#i=h.None}}r.Latest=s})(ur||(ur={}));var hs;(function(r){let e=new ur.Limit(4);r.limitFetch=(t,i)=>e.add(()=>fetch(t,i))})(hs||(hs={}));var cs;(function(r){r.startEstimator=()=>{let e=performance.now();return t=>{if(t===0)return ke.POSITIVE_INFINITY;let i=performance.now()-e;return ke.millis(i/t-i)}}})(cs||(cs={}));var ps;(function(r){r.frame=()=>new Promise(e=>requestAnimationFrame(()=>e())),r.frames=e=>new Promise(t=>{let i=e,s=()=>{--i<=0?t():requestAnimationFrame(s)};requestAnimationFrame(s)}),r.timeSpan=(e,...t)=>new Promise(i=>setTimeout(i,e.millis(),...t)),r.event=(e,t)=>new Promise(i=>e.addEventListener(t,i,{once:!0})),r.observable=e=>new Promise(t=>{let i=e.subscribe(()=>{i.terminate(),t()})}),r.complete=e=>new Promise((t,i)=>{let s=setInterval(()=>{let{status:n,value:a,error:l}=Ti(()=>e.next());if(n==="success"){let{done:d,value:c}=a;d&&(clearInterval(s),t(c))}else clearInterval(s),i(l)},0)})})(ps||(ps={}));var dr=Symbol.for("@openDAW/lib-runtime");globalThis[dr]?console.debug(`%c${dr.description}%c is already available in ${globalThis.constructor.name}.`,"color: hsl(10, 83%, 60%)","color: inherit"):(globalThis[dr]=!0,console.debug(`%c${dr.description}%c is now available in ${globalThis.constructor.name}.`,"color: hsl(200, 83%, 60%)","color: inherit"));var hr=Symbol.for("@openDAW/lib-box");globalThis[hr]?console.debug(`%c${hr.description}%c is already available in ${globalThis.constructor.name}.`,"color: hsl(10, 83%, 60%)","color: inherit"):(globalThis[hr]=!0,console.debug(`%c${hr.description}%c is now available in ${globalThis.constructor.name}.`,"color: hsl(200, 83%, 60%)","color: inherit"));var fs=(r,e)=>{if(r===e)return 0;let t=r-e;return t===0?b(`Indices cannot be equal (${r}, ${e})`):t};var ue=class r{static create(e,t,i){return new r(e,t,i)}#e;#t;#r;#i;#s=null;constructor(e,t,i){this.#e=e,this.#t=v.newSet(s=>s.adapter.uuid),this.#r=new J,this.#i=e.pointerHub.catchupAndSubscribeTransactual({onAdd:s=>{this.#s=null;let n=t(s.box),a=n.indexField.subscribe(()=>{this.#s=null,this.#r.proxy.onReorder(n)}),l=this.#t.add({adapter:n,subscription:a});E(l,`Could not add ${n}`),this.#r.proxy.onAdd(n)},onRemove:s=>{this.#s=null;let n=s.box.address.uuid,{adapter:a,subscription:l}=this.#t.removeByKey(n);l.terminate(),this.#r.proxy.onRemove(a)}},i)}field(){return this.#e}subscribe(e){return this.#r.subscribe(e)}catchupAndSubscribe(e){return this.#t.forEach(({adapter:t})=>e.onAdd(t)),this.subscribe(e)}getAdapterByIndex(e){let t=z.exactMapped(this.adapters(),e,fs,i=>i.indexField.getValue());return t===-1?h.None:h.wrap(this.adapters()[t])}getAdapterById(e){return this.#t.opt(e).map(({adapter:t})=>t)}getMinFreeIndex(){let e=this.adapters();for(let t=0;t<e.length;t++)if(e[t].indexField.getValue()>t)return t;return e.length}adapters(){return this.#s===null&&(this.#s=this.#t.values().map(({adapter:e})=>e).sort((e,t)=>e.indexField.getValue()-t.indexField.getValue())),this.#s}move(e,t){this.moveIndex(e.indexField.getValue(),t)}moveIndex(e,t){let i=this.adapters(),s=i[e];if(t<0){let n=I(e+t,0,i.length-1);for(let a=n;a<e;a++)i[a].indexField.setValue(a+1);s.indexField.setValue(n)}else if(t>1){let n=I(e+(t-1),0,i.length-1);for(let a=e;a<n;a++)i[a+1].indexField.setValue(a);s.indexField.setValue(n)}else console.warn(`moveIndex had no effect: startIndex: ${e}, delta: ${t}`)}size(){return this.#t.size()}isEmpty(){return this.size()===0}terminate(){this.#s=null,this.#t.forEach(({subscription:e})=>e.terminate()),this.#t.clear(),this.#r.terminate(),this.#i.terminate()}};var ms;(function(r){function e(t,i,s={}){let{interval:n=64,scanSteps:a=1024,scanSamples:l=2048,minBPM:d=90,maxBPM:c=180}=s,F=new Float32Array(Math.floor(t.length/n)),y=0,A=0,S=0;for(let W of t){let re=Math.abs(W);y+=(re-y)*(re>y?1/8:1/512),++A===n&&(A=0,F[S++]=y)}if(!F.length)return NaN;let U=(W,re)=>W[Math.floor(re)]??0,$=W=>i/(W/60)/n,Y=W=>i/(W*n)*60,te=[-32,-16,-8,-4,-2,-1,1,2,4,8,16,32],X=[-.5,-.25,.25,.5],Ne=W=>{let re=Math.random()*F.length,Be=U(F,re),oi=0,ai=0;for(let At of te){let Nt=1/Math.abs(At);oi+=Nt*Math.abs(U(F,re+At*W)-Be),ai+=Nt}for(let At of X){let Nt=Math.abs(At);oi-=Nt*Math.abs(U(F,re+At*W)-Be),ai+=Nt}return oi/ai},Xt=W=>{let re=0;for(let Be=0;Be<l;++Be)re+=Ne(W);return re/l},wt=$(d),vt=$(c),Zt=(wt-vt)/a,bt=d,Ft=1/0;for(let W=vt;W<=wt;W+=Zt){let re=Y(W),Be=Xt(W)*(d/re);Be<Ft&&(Ft=Be,bt=re)}return bt}r.detect=e})(ms||(ms={}));var gs;(function(r){r.Major=[0,2,4,5,7,9,11],r.Minor=[0,2,3,5,7,8,10],r.NoteLabels=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],r.compile=(e,t,i,s)=>M.create(n=>{let a=i+n*2,l=e[a%7]+Math.floor(a/7)*12;return t+l},s),r.toString=e=>r.NoteLabels[e%12]+(Math.floor(e/12)-2)})(gs||(gs={}));var St;(function(r){r.Comparator=(e,t)=>e.position-t.position,r.PositionExtractor=e=>e.position})(St||(St={}));var Dt;(function(r){r.complete=e=>e.position+e.duration,r.DescendingComparator=(e,t)=>r.complete(t)-r.complete(e)})(Dt||(Dt={}));var be;(function(r){r.globalToLocal=(t,i)=>Bt(i-t.position+t.loopOffset,t.loopDuration),r.locateLoop=({position:t,complete:i,loopOffset:s,loopDuration:n},a,l)=>{let d=t-s,c=d+n;if(d>=l||c<=a)return h.None;let F=Math.max(d,a),y=Math.min(c,l);return h.wrap({index:0,rawStart:d,rawEnd:c,regionStart:Math.max(d,t),regionEnd:Math.min(c,i),resultStart:F,resultEnd:y,resultStartValue:d<F?(F-d)/n:0,resultEndValue:c>y?(y-d)/n:1})};function*e({position:t,complete:i,loopOffset:s,loopDuration:n},a,l){let d=t-s,c=Math.max(t,a),F=Math.min(i,l),y=Math.floor((c-d)/n),A=d+y*n;for(;A<F;){let S=A+n,U=Math.max(A,t),$=Math.min(S,i),Y=Math.max(A,c),te=Math.min(S,F),X=A<Y?(Y-A)/n:0,Ne=S>te?(te-A)/n:1;yield{index:y++,rawStart:A,rawEnd:S,regionStart:U,regionEnd:$,resultStart:Y,resultEnd:te,resultStartValue:X,resultEndValue:Ne},A=S}}r.locateLoops=e})(be||(be={}));var $e=class r{static DefaultComparator=(e,t)=>e.position-t.position;static create(e){return new r(e??r.DefaultComparator)}#e;constructor(e){this.#e=new cr(e)}add(e){this.#e.add(e)}remove(e){return this.#e.remove(e)}contains(e){return this.#e.contains(e)}clear(){this.#e.clear()}optAt(e){return this.#e.optAt(e)}asArray(){return this.#e.asArray()}lowerEqual(e,t){return this.#e.lowerEqual(e,t)}greaterEqual(e,t){return this.#e.greaterEqual(e,t)}floorLastIndex(e){return this.#e.floorLastIndex(e)}ceilFirstIndex(e){return this.#e.ceilFirstIndex(e)}iterateFrom(e,t){return this.#e.isEmpty()?ve.empty():this.#e.iterateFrom(e,t)}iterateRange(e,t,i){return this.#e.isEmpty()?ve.empty():this.#e.iterate(this.#e.ceilFirstIndex(e),t,i)}length(){return this.#e.length()}isEmpty(){return this.#e.isEmpty()}onIndexingChanged(){this.#e.onIndexingChanged()}},Ce=class r{static Comparator=(e,t)=>e.position-t.position;static create(e){return new r(e)}#e;constructor(e=r.Comparator){this.#e=new cr(e)}add(e){this.#e.add(e)}remove(e){return this.#e.remove(e)}contains(e){return this.#e.contains(e)}clear(){this.#e.clear()}optAt(e){return this.#e.optAt(e)}asArray(){return this.#e.asArray()}lowerEqual(e,t){return this.#e.lowerEqual(e,t)}greaterEqual(e,t){return this.#e.greaterEqual(e,t)}floorLastIndex(e){return this.#e.floorLastIndex(e)}ceilFirstIndex(e){return this.#e.ceilFirstIndex(e)}iterateFrom(e,t){return this.#e.isEmpty()?ve.empty():this.#e.iterateFrom(e,t)}iterateRange(e,t){if(this.#e.isEmpty())return ve.empty();let i=Math.max(0,this.#e.floorLastIndex(e)),s=this.#e.optAt(i);if(s===null)return ve.empty();for(;s.position+s.duration<=e;)if(s=this.#e.optAt(++i),s===null||s.position>=t)return ve.empty();return this.#e.iterate(i,t)}length(){return this.#e.length()}isEmpty(){return this.#e.isEmpty()}onIndexingChanged(){this.#e.onIndexingChanged()}};var cr=class{comparator;#e=[];#t=!1;modCount=0;constructor(e){this.comparator=e}add(e){++this.modCount,this.#e.push(e),this.#e.length>1&&(this.#t=!0)}remove(e){++this.modCount;let t=this.#e.indexOf(e);return t===-1?!1:(this.#e.splice(t,1),!0)}contains(e){if(this.#e.length===0)return!1;this.#t&&this.#r();let i=e.position,s=z.leftMostMapped(this.#e,i,Ee,St.PositionExtractor);for(let n=s;n<this.#e.length;n++){let a=this.#e[n];if(a===e)return!0;if(a.position!==i)return!1}return!1}clear(){++this.modCount,M.clear(this.#e),this.#t=!1}optAt(e){return e<0||e>=this.#e.length?null:(this.#t&&this.#r(),this.#e[e])}asArray(){return this.#t&&this.#r(),this.#e}lowerEqual(e,t){if(t===void 0)return this.optAt(this.floorLastIndex(e));let i=this.floorLastIndex(e);for(;i>=0;){let s=this.#e[i--];if(t(s))return s}return null}greaterEqual(e,t){if(t===void 0)return this.optAt(this.ceilFirstIndex(e));let i=this.ceilFirstIndex(e);for(;i<this.#e.length;){let s=this.#e[i++];if(t(s))return s}return null}floorLastIndex(e){return this.#t&&this.#r(),z.rightMostMapped(this.#e,e,Ee,St.PositionExtractor)}ceilFirstIndex(e){return this.#t&&this.#r(),z.leftMostMapped(this.#e,e,Ee,St.PositionExtractor)}iterateFrom(e,t){let i=this.floorLastIndex(e),s=i;if(s<0)return this.iterate(0,oe.MAX_VALUE,t);for(;s>=0;){let n=this.optAt(s);if(n!==null&&t!==void 0&&t(n))return this.iterate(s,oe.MAX_VALUE,t);s--}return this.iterate(i,oe.MAX_VALUE,t)}length(){return this.#e.length}isEmpty(){return this.#e.length===0}onIndexingChanged(){this.#t=this.length()>1}*iterate(e,t,i=ir.alwaysTrue){for(this.#t&&this.#r();e<this.#e.length;){let s=this.#e[e++];if(s.position>=t)return;i(s)&&(yield s)}}#r(){this.#e.sort(this.comparator),this.#t=!1}};var Ri=(r,e)=>Math.floor(3840/e)*r,xs=(r,e=4,t=4)=>{let i=Ri(1,t),s=Math.floor(r/i),n=Math.floor(s/e),l=(Math.floor(r)-Ri(n*e,t))%i,d=Math.floor(l/240),c=l%240;return{bars:n,beats:s-n*e,semiquavers:d,ticks:c}},ys=(r,e)=>r*e/60*960,ws=(r,e)=>r*60/960/e,Ls=(r,e,t)=>ys(r/t,e),$s=(r,e,t)=>ws(r,e)*t,j={Bar:3840,Quarter:960,SemiQuaver:240,fromSignature:Ri,toParts:xs,secondsToPulses:ys,pulsesToSeconds:ws,samplesToPulses:Ls,pulsesToSamples:$s,toString:(r,e=4,t=4)=>{let{bars:i,beats:s,semiquavers:n,ticks:a}=xs(r|0,e,t);return`${i+1}.${s+1}.${n+1}:${a}`}};var at;(function(r){r.builder=()=>new e,r.toDouble=([t,i])=>t/i,r.toPPQN=([t,i])=>j.fromSignature(t,i);class e{#e=[];add(i){return this.#e.push(i),this}asArray(){return this.#e}asAscendingArray(){return this.#e.toSorted((i,s)=>r.toDouble(i)-r.toDouble(s))}asDescendingArray(){return this.#e.toSorted((i,s)=>r.toDouble(s)-r.toDouble(i))}}})(at||(at={}));var vs;(function(r){r.Identity={warp:e=>e,unwarp:e=>e}})(vs||(vs={}));var pr=class{#e;constructor(e){this.#e=e}warp(e){return this.#t(!0,e)}unwarp(e){return this.#t(!1,e)}#t(e,t){let i=this.#e.duration(),s=zi(t,i),n=(t-s)/i,a=e?this.#e.fx(n):this.#e.fy(n);return s+a*i}};var bs;(function(r){r.BlackKeyIndices=[1,3,6,8,10],r.BlackKeyBits=r.BlackKeyIndices.reduce((t,i)=>t|=1<<i,0),r.Names={English:["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],German:["C","Cis","D","Dis","E","F","Fis","G","Gis","A","Ais","H"],Solfege:["Do","Do#","R\xE9","R\xE9#","Mi","Fa","Fa#","Sol","Sol#","La","La#","Si"],French:["Do","Do#","R\xE9","R\xE9#","Mi","Fa","Fa#","Sol","Sol#","La","La#","Si"],Spanish:["Do","Do#","Re","Re#","Mi","Fa","Fa#","Sol","Sol#","La","La#","Si"],Japanese:["\u30C9","\u30C9\u266F","\u30EC","\u30EC\u266F","\u30DF","\u30D5\u30A1","\u30D5\u30A1\u266F","\u30BD","\u30BD\u266F","\u30E9","\u30E9\u266F","\u30B7"]},r.isBlackKey=t=>(r.BlackKeyBits&1<<t%12)!==0,r.toFullString=t=>`${r.Names.English[t%12]}${Math.floor(t/12)-2}`;class e{#e;#t;constructor(i,...s){this.#e=i,this.#t=s.reduce((n,a)=>n|=1<<a,0)}get name(){return this.#e}get bits(){return this.#t}has(i){return(this.#t&1<<i%12)!==0}equals(i){return this.#t===i.bits}}r.StockScales=[new e("Major",0,2,4,5,7,9,11),new e("Natural Minor",0,2,3,5,7,8,10),new e("Harmonic Minor",0,2,3,5,7,8,11),new e("Melodic Minor",0,2,3,5,7,9,11),new e("Dorian",0,2,3,5,7,9,10),new e("Phrygian",0,1,3,5,7,8,10),new e("Lydian",0,2,4,6,7,9,11),new e("Mixolydian",0,2,4,5,7,9,10),new e("Locrian",0,1,3,5,6,8,10),new e("Pentatonic Major",0,2,4,7,9),new e("Pentatonic Minor",0,3,5,7,10),new e("Blues",0,3,5,6,7,10),new e("Whole Tone",0,2,4,6,8,10),new e("Diminished",0,2,3,5,6,8,9,11),new e("Augmented",0,3,4,7,8,11)]})(bs||(bs={}));var lt;(function(r){r.isOfType=e=>e.type==="note-event",r.Comparator=(e,t)=>{let i=e.position-t.position;if(i!==0)return i;let s=e.pitch-t.pitch;return s!==0?s:0},r.curveFunc=(e,t)=>t<0?e**2**-t:1-(1-e)**2**t,r.inverseCurveFunc=(e,t)=>t<0?e**2**t:1-Math.max(0,1-e)**2**-t,r.CompleteComparator=(e,t)=>{let i=Dt.complete(e)-Dt.complete(t);return i!==0?i:e.pitch-t.pitch}})(lt||(lt={}));var Fs;(function(r){r[r.sine=0]="sine",r[r.triangle=1]="triangle",r[r.sawtooth=2]="sawtooth",r[r.square=3]="square"})(Fs||(Fs={}));var He;(function(r){let e;(function(t){t[t.Linear=0]="Linear",t[t.EqualPower=1]="EqualPower"})(e=r.Mixing||(r.Mixing={})),r.zero=()=>({ll:0,lr:0,rl:0,rr:0}),r.identity=()=>({ll:1,lr:0,rl:0,rr:1}),r.update=(t,{gain:i,panning:s,invertL:n,invertR:a,stereo:l,swap:d},c=e.EqualPower)=>{let[F,y]=r.panningToGains(s,c),A=F*i,S=y*i;n&&(A*=-1),a&&(S*=-1);let U=Math.max(0,-l),$=Math.max(0,l),Y=1-$,te=1+$,X=U*.5,Ne=1-U,Xt=(Y+te)*.5,wt=(Y-te)*.5,vt=(Y-te)*.5,Zt=(Y+te)*.5,bt=A*(X+Ne)*Xt+S*X*wt,Ft=A*(X+Ne)*vt+S*X*Zt,W=A*X*Xt+S*(X+Ne)*wt,re=A*X*vt+S*(X+Ne)*Zt;d?(t.ll=Ft,t.rl=bt,t.lr=re,t.rr=W):(t.ll=bt,t.lr=W,t.rl=Ft,t.rr=re)},r.panningToGains=(t,i)=>{let s=I(t,-1,1);switch(i){case e.Linear:return[Math.min(1-s,1),Math.min(s+1,1)];case e.EqualPower:return[Math.cos((s+1)*pi),Math.sin((s+1)*pi)]}},r.applyFrame=(t,i,s)=>[t.ll*i+t.rl*s,t.lr*i+t.rr*s],r.processFrames=(t,i,s,n,a)=>{let[l,d]=i,[c,F]=s;for(let y=n;y<a;y++){let A=l[y],S=d[y];c[y]=t.ll*A+t.rl*S,F[y]=t.lr*A+t.rr*S}},r.replaceFrames=(t,[i,s],n,a)=>{for(let l=n;l<a;l++){let d=i[l],c=s[l];i[l]=t.ll*d+t.rl*c,s[l]=t.lr*d+t.rr*c}}})(He||(He={}));var As;(function(r){r.linear=(i,s=.005)=>new e(Math.ceil(i*s)|0),r.stereoMatrix=(i,s=.005)=>new t(Math.ceil(i*s)|0);class e{#e;#t=0;#r=0;#i=0;#s=0;constructor(s){this.#e=s}set(s,n){this.#t!==s&&(n===!0?(this.#r=s,this.#i=(s-this.#t)/this.#e,this.#s=this.#e):(this.#t=this.#r=s,this.#i=0,this.#s=0))}get(){return this.#t}moveAndGet(){return 0<this.#s&&(this.#t+=this.#i,--this.#s===0&&(this.#i=0,this.#t=this.#r)),this.#t}isFixed(s){return this.#t===s&&this.#s===0}isInterpolating(){return this.#s>0}}class t{#e;#t=He.zero();#r=He.zero();#i=He.zero();#s=0;constructor(s){this.#e=s}update(s,n,a){He.update(this.#r,s,n),a===!0?(this.#i.ll=(this.#r.ll-this.#t.ll)/this.#e,this.#i.lr=(this.#r.lr-this.#t.lr)/this.#e,this.#i.rl=(this.#r.rl-this.#t.rl)/this.#e,this.#i.rr=(this.#r.rr-this.#t.rr)/this.#e,this.#s=this.#e):(this.#t.ll=this.#r.ll,this.#t.lr=this.#r.lr,this.#t.rl=this.#r.rl,this.#t.rr=this.#r.rr,this.#i.ll=0,this.#i.lr=0,this.#i.rl=0,this.#i.rr=0,this.#s=0)}processFrames(s,n,a,l){let[d,c]=s,[F,y]=n;if(this.isInterpolating())for(let A=a;A<l;A++){let S=d[A],U=c[A],$=this.moveAndGet();F[A]=$.ll*S+$.rl*U,y[A]=$.lr*S+$.rr*U}else{let A=this.#r;for(let S=a;S<l;S++){let U=d[S],$=c[S];F[S]=A.ll*U+A.rl*$,y[S]=A.lr*U+A.rr*$}}}set(s,n){this.#n(s)||(n===!0?(this.#r.ll=s.ll,this.#r.lr=s.lr,this.#r.rl=s.rl,this.#r.rr=s.rr,this.#i.ll=(s.ll-this.#t.ll)/this.#e,this.#i.lr=(s.lr-this.#t.lr)/this.#e,this.#i.rl=(s.rl-this.#t.rl)/this.#e,this.#i.rr=(s.rr-this.#t.rr)/this.#e,this.#s=this.#e):(this.#t.ll=this.#r.ll=s.ll,this.#t.lr=this.#r.lr=s.lr,this.#t.rl=this.#r.rl=s.rl,this.#t.rr=this.#r.rr=s.rr,this.#i.ll=0,this.#i.lr=0,this.#i.rl=0,this.#i.rr=0,this.#s=0))}get(){return this.#t}moveAndGet(){return 0<this.#s&&(this.#t.ll+=this.#i.ll,this.#t.lr+=this.#i.lr,this.#t.rl+=this.#i.rl,this.#t.rr+=this.#i.rr,--this.#s===0&&(this.#i.ll=0,this.#i.lr=0,this.#i.rl=0,this.#i.rr=0,this.#t.ll=this.#r.ll,this.#t.lr=this.#r.lr,this.#t.rl=this.#r.rl,this.#t.rr=this.#r.rr)),this.#t}isFixed(s){return this.#n(s)&&this.#s===0}isInterpolating(){return this.#s>0}#n(s){return this.#t.ll===s.ll&&this.#t.lr===s.lr&&this.#t.rl===s.rl&&this.#t.rr===s.rr}}r.StereoMatrixRamp=t})(As||(As={}));var Dd=Math.log(10)/20;var Ve={None:{type:"none"},Linear:{type:"linear"},Curve:r=>({type:"curve",slope:r})},fr;(function(r){r.Comparator=(s,n)=>{let a=s.position-n.position;if(a!==0)return a;let l=s.index-n.index;return l!==0?l:s===n?0:b(`${s} and ${n} are identical in terms of comparison`)};function*e(s,n,a){if(s.isEmpty())return Z.empty();for(let l of s.iterateFrom(n))if(yield l,l.position>=a)return}r.iterateWindow=e,r.nextEvent=(s,n)=>{let a=s.asArray(),l=z.rightMost(a,n,r.Comparator);return l===-1?null:a[l+1]??null},r.valueAt=(s,n,a)=>{if(s.isEmpty())return a;let l=s.iterateFrom(n),{done:d,value:c}=l.next();if(d)return a;if(c.position<=n){let{done:F,value:y}=l.next();if(F)return c.value;if(n<y.position)return i(c,y,n);if(c.interpolation===Ve.None)return c.value}return c.value};function*t(s,n,a,l){if(s.isEmpty())return;let d=s.iterateFrom(n),{done:c,value:F}=d.next();if(c)return;let y=a/l,A=F;if(A.position>n){for(;n<A.position;)if(yield{position:n,value:A.value},n+=y,n>a)return;A.position<=a&&(yield A)}for(;n<=a;){let{done:S,value:U}=d.next();if(S)break;for(;n<U.position;){if(n>a)return;yield{position:n,value:i(A,U,n)},n+=y}U.position<a&&(A.interpolation===Ve.None&&(yield{position:U.position,value:A.value}),yield U),A=U}for(;n<=a;)yield{position:n,value:A.value},n+=y}r.quantise=t;let i=({value:s,position:n,interpolation:a},l,d)=>a.type==="none"?s:a.type==="linear"?s+(d-n)/(l.position-n)*(l.value-s):a.type==="curve"?de.valueAt({slope:a.slope,steps:l.position-n,y0:s,y1:l.value},d-n):b("Unknown interpolation")})(fr||(fr={}));var Ns;(function(r){let e;(function(t){t[t.Bartlett=0]="Bartlett",t[t.Blackman=1]="Blackman",t[t.BlackmanHarris=2]="BlackmanHarris",t[t.Hamming=3]="Hamming",t[t.Hanning=4]="Hanning"})(e=r.Type||(r.Type={})),r.create=(t,i)=>{let s=new Float32Array(i),n=Math.PI/(i-1);switch(t){case e.Bartlett:{let a=(i>>1)-1,l=0;for(;l<=a;++l)s[l]=2*l/(i-1);for(;l<i;++l)s[l]=2-2*l/(i-1);return s}case e.Blackman:{let a=2*n,l=4*n;for(let d=0;d<i;++d)s[d]=.42323-.49755*Math.cos(a*d)+.07922*Math.cos(l*d);return s}case e.BlackmanHarris:{let a=2*n,l=4*n,d=6*n;for(let c=0;c<i;++c)s[c]=.35875-.48829*Math.cos(a*c)+.14128*Math.cos(l*c)-.01168*Math.cos(d*c);return s}case e.Hamming:{let a=2*n;for(let l=0;l<i;++l)s[l]=.54-.46*Math.cos(a*l);return s}case e.Hanning:{let a=2*n;for(let l=0;l<i;++l)s[l]=.5-.5*Math.cos(a*l);return s}}}})(Ns||(Ns={}));var mr=Symbol.for("@openDAW/lib-dsp");globalThis[mr]?console.debug(`%c${mr.description}%c is already available in ${globalThis.constructor.name}.`,"color: hsl(10, 83%, 60%)","color: inherit"):(globalThis[mr]=!0,console.debug(`%c${mr.description}%c is now available in ${globalThis.constructor.name}.`,"color: hsl(200, 83%, 60%)","color: inherit"));var gr;(function(r){r.create=(e,t,i,s)=>{switch(e){case"RootBox":return xr.create(t,i,s);case"SelectionBox":return Kt.create(t,i,s);case"UserInterfaceBox":return yr.create(t,i,s);case"TimelineBox":return wr.create(t,i,s);case"TrackBox":return ut.create(t,i,s);case"NoteEventBox":return Pe.create(t,i,s);case"NoteEventRepeatBox":return vr.create(t,i,s);case"NoteEventCollectionBox":return Fe.create(t,i,s);case"NoteRegionBox":return Ge.create(t,i,s);case"NoteClipBox":return dt.create(t,i,s);case"ValueEventBox":return Se.create(t,i,s);case"ValueEventCollectionBox":return Ae.create(t,i,s);case"ValueEventCurveBox":return De.create(t,i,s);case"ValueRegionBox":return qe.create(t,i,s);case"ValueClipBox":return ht.create(t,i,s);case"AudioRegionBox":return ct.create(t,i,s);case"AudioClipBox":return pt.create(t,i,s);case"MarkerBox":return Tt.create(t,i,s);case"AudioFileBox":return br.create(t,i,s);case"AudioUnitBox":return je.create(t,i,s);case"AudioBusBox":return ft.create(t,i,s);case"AuxSendBox":return Fr.create(t,i,s);case"StepAutomationBox":return Ar.create(t,i,s);case"GrooveShuffleBox":return Nr.create(t,i,s);case"DeviceInterfaceKnobBox":return Br.create(t,i,s);case"ModularDeviceBox":return Er.create(t,i,s);case"DeviceClashBox":return Mr.create(t,i,s);case"StereoToolDeviceBox":return Rr.create(t,i,s);case"DelayDeviceBox":return Cr.create(t,i,s);case"RevampDeviceBox":return Vr.create(t,i,s);case"ReverbDeviceBox":return Pr.create(t,i,s);case"VaporisateurDeviceBox":return Sr.create(t,i,s);case"NanoDeviceBox":return Dr.create(t,i,s);case"PlayfieldDeviceBox":return Kr.create(t,i,s);case"PlayfieldSampleBox":return It.create(t,i,s);case"TapeDeviceBox":return Tr.create(t,i,s);case"ArpeggioDeviceBox":return Ir.create(t,i,s);case"PitchDeviceBox":return Or.create(t,i,s);case"ZeitgeistDeviceBox":return kr.create(t,i,s);case"ModularBox":return Ur.create(t,i,s);case"ModuleConnectionBox":return zr.create(t,i,s);case"ModularAudioInputBox":return Lr.create(t,i,s);case"ModularAudioOutputBox":return $r.create(t,i,s);case"ModuleDelayBox":return Hr.create(t,i,s);case"ModuleMultiplierBox":return Gr.create(t,i,s);case"ModuleGainBox":return qr.create(t,i,s);default:return b(`Unknown box class '${e}'`)}},r.deserialize=(e,t)=>{let i=new ie(t),s=i.readString(),n=v.fromDataInput(i),a=r.create(s,e,n);return a.read(i),a}})(gr||(gr={}));var jr=class r extends L{static create(e){return new r(e)}constructor(e){super(e)}get keyboard(){return this.getField(1)}get timeRangeInQuarters(){return this.getField(2)}get noteScale(){return this.getField(3)}get noteLabels(){return this.getField(4)}get transpose(){return this.getField(5)}initializeFields(){return{1:f.create({parent:this,fieldKey:1,fieldName:"keyboard",pointerRules:u},0),2:m.create({parent:this,fieldKey:2,fieldName:"timeRangeInQuarters",pointerRules:u},8),3:m.create({parent:this,fieldKey:3,fieldName:"noteScale",pointerRules:u},1.5),4:w.create({parent:this,fieldKey:4,fieldName:"noteLabels",pointerRules:u},!0),5:f.create({parent:this,fieldKey:5,fieldName:"transpose",pointerRules:u},0)}}};var xr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"RootBox",pointerRules:u}),i)}constructor(e){super(e)}accept(e){return p(e.visitRootBox,this)}get timeline(){return this.getField(1)}get users(){return this.getField(2)}get created(){return this.getField(3)}get groove(){return this.getField(4)}get modularSetups(){return this.getField(10)}get audioUnits(){return this.getField(20)}get audioBusses(){return this.getField(21)}get outputDevice(){return this.getField(30)}get pianoMode(){return this.getField(40)}get editingChannel(){return this.getField(111)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"timeline",pointerRules:u},o.Timeline,!0),2:N.hook({parent:this,fieldKey:2,fieldName:"users",pointerRules:{accepts:[o.User],mandatory:!0}}),3:B.create({parent:this,fieldKey:3,fieldName:"created",pointerRules:u}),4:g.create({parent:this,fieldKey:4,fieldName:"groove",pointerRules:u},o.Groove,!0),10:N.hook({parent:this,fieldKey:10,fieldName:"modularSetups",pointerRules:{accepts:[o.ModularSetup],mandatory:!1}}),20:N.hook({parent:this,fieldKey:20,fieldName:"audioUnits",pointerRules:{accepts:[o.AudioUnits],mandatory:!1}}),21:N.hook({parent:this,fieldKey:21,fieldName:"audioBusses",pointerRules:{accepts:[o.AudioBusses],mandatory:!1}}),30:N.hook({parent:this,fieldKey:30,fieldName:"outputDevice",pointerRules:{accepts:[o.AudioOutput],mandatory:!0}}),40:jr.create({parent:this,fieldKey:40,fieldName:"pianoMode",pointerRules:u}),111:g.create({parent:this,fieldKey:111,fieldName:"editingChannel",pointerRules:u},o.Editing,!1)}}};var Kt=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"SelectionBox",pointerRules:u}),i)}constructor(e){super(e)}accept(e){return p(e.visitSelectionBox,this)}get selection(){return this.getField(1)}get selectable(){return this.getField(2)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"selection",pointerRules:u},o.Selection,!0),2:g.create({parent:this,fieldKey:2,fieldName:"selectable",pointerRules:u},o.Selection,!0)}}};var yr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"UserInterfaceBox",pointerRules:u}),i)}constructor(e){super(e)}accept(e){return p(e.visitUserInterfaceBox,this)}get root(){return this.getField(1)}get selection(){return this.getField(10)}get editingDeviceChain(){return this.getField(21)}get editingTimelineRegion(){return this.getField(22)}get editingModularSystem(){return this.getField(23)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"root",pointerRules:u},o.User,!0),10:N.hook({parent:this,fieldKey:10,fieldName:"selection",pointerRules:{accepts:[o.Selection],mandatory:!1}}),21:g.create({parent:this,fieldKey:21,fieldName:"editingDeviceChain",pointerRules:u},o.Editing,!1),22:g.create({parent:this,fieldKey:22,fieldName:"editingTimelineRegion",pointerRules:u},o.Editing,!1),23:g.create({parent:this,fieldKey:23,fieldName:"editingModularSystem",pointerRules:u},o.Editing,!1)}}};var _r=class r extends L{static create(e){return new r(e)}constructor(e){super(e)}get nominator(){return this.getField(1)}get denominator(){return this.getField(2)}initializeFields(){return{1:f.create({parent:this,fieldKey:1,fieldName:"nominator",pointerRules:u},4),2:f.create({parent:this,fieldKey:2,fieldName:"denominator",pointerRules:u},4)}}};var Wr=class r extends L{static create(e){return new r(e)}constructor(e){super(e)}get enabled(){return this.getField(1)}get from(){return this.getField(2)}get to(){return this.getField(3)}initializeFields(){return{1:w.create({parent:this,fieldKey:1,fieldName:"enabled",pointerRules:u},!0),2:f.create({parent:this,fieldKey:2,fieldName:"from",pointerRules:u},0),3:f.create({parent:this,fieldKey:3,fieldName:"to",pointerRules:u},15360)}}};var Qr=class r extends L{static create(e){return new r(e)}constructor(e){super(e)}get markers(){return this.getField(1)}get index(){return this.getField(10)}get enabled(){return this.getField(20)}initializeFields(){return{1:N.hook({parent:this,fieldKey:1,fieldName:"markers",pointerRules:{accepts:[o.MarkerTrack],mandatory:!1}}),10:f.create({parent:this,fieldKey:10,fieldName:"index",pointerRules:u}),20:w.create({parent:this,fieldKey:20,fieldName:"enabled",pointerRules:u},!0)}}};var wr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"TimelineBox",pointerRules:u}),i)}constructor(e){super(e)}accept(e){return p(e.visitTimelineBox,this)}get root(){return this.getField(1)}get signature(){return this.getField(10)}get loopArea(){return this.getField(11)}get deprecatedMarkerTrack(){return this.getField(20)}get markerTrack(){return this.getField(21)}get durationInPulses(){return this.getField(30)}get bpm(){return this.getField(31)}initializeFields(){return{1:N.hook({parent:this,fieldKey:1,fieldName:"root",pointerRules:{accepts:[o.Timeline],mandatory:!0}}),10:_r.create({parent:this,fieldKey:10,fieldName:"signature",pointerRules:u}),11:Wr.create({parent:this,fieldKey:11,fieldName:"loopArea",pointerRules:u}),20:N.hook({parent:this,fieldKey:20,fieldName:"deprecatedMarkerTrack",pointerRules:{accepts:[o.MarkerTrack],mandatory:!1}}),21:Qr.create({parent:this,fieldKey:21,fieldName:"markerTrack",pointerRules:u}),30:f.create({parent:this,fieldKey:30,fieldName:"durationInPulses",pointerRules:u},491520),31:m.create({parent:this,fieldKey:31,fieldName:"bpm",pointerRules:u},120)}}};var ut=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"TrackBox",pointerRules:{accepts:[o.Selection,o.PianoMode],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitTrackBox,this)}get tracks(){return this.getField(1)}get target(){return this.getField(2)}get regions(){return this.getField(3)}get clips(){return this.getField(4)}get index(){return this.getField(10)}get type(){return this.getField(11)}get enabled(){return this.getField(20)}get excludePianoMode(){return this.getField(30)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"tracks",pointerRules:u},o.TrackCollection,!0),2:g.create({parent:this,fieldKey:2,fieldName:"target",pointerRules:u},o.Automation,!0),3:N.hook({parent:this,fieldKey:3,fieldName:"regions",pointerRules:{accepts:[o.RegionCollection],mandatory:!1}}),4:N.hook({parent:this,fieldKey:4,fieldName:"clips",pointerRules:{accepts:[o.ClipCollection],mandatory:!1}}),10:f.create({parent:this,fieldKey:10,fieldName:"index",pointerRules:u}),11:f.create({parent:this,fieldKey:11,fieldName:"type",pointerRules:u}),20:w.create({parent:this,fieldKey:20,fieldName:"enabled",pointerRules:u},!0),30:w.create({parent:this,fieldKey:30,fieldName:"excludePianoMode",pointerRules:u},!1)}}};var Pe=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventBox",pointerRules:{accepts:[o.Selection,o.NoteEventFeature],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitNoteEventBox,this)}get events(){return this.getField(1)}get position(){return this.getField(10)}get duration(){return this.getField(11)}get pitch(){return this.getField(20)}get velocity(){return this.getField(21)}get playCount(){return this.getField(22)}get playCurve(){return this.getField(23)}get cent(){return this.getField(24)}get chance(){return this.getField(25)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"events",pointerRules:u},o.NoteEvents,!0),10:f.create({parent:this,fieldKey:10,fieldName:"position",pointerRules:u}),11:f.create({parent:this,fieldKey:11,fieldName:"duration",pointerRules:u},240),20:f.create({parent:this,fieldKey:20,fieldName:"pitch",pointerRules:u},60),21:m.create({parent:this,fieldKey:21,fieldName:"velocity",pointerRules:u},.7874015748031497),22:f.create({parent:this,fieldKey:22,fieldName:"playCount",pointerRules:u},1),23:m.create({parent:this,fieldKey:23,fieldName:"playCurve",pointerRules:u},0),24:m.create({parent:this,fieldKey:24,fieldName:"cent",pointerRules:u},0),25:f.create({parent:this,fieldKey:25,fieldName:"chance",pointerRules:u},100)}}};var vr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventRepeatBox",pointerRules:u}),i)}constructor(e){super(e)}accept(e){return p(e.visitNoteEventRepeatBox,this)}get event(){return this.getField(1)}get count(){return this.getField(2)}get curve(){return this.getField(3)}get length(){return this.getField(4)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"event",pointerRules:u},o.NoteEventFeature,!0),2:f.create({parent:this,fieldKey:2,fieldName:"count",pointerRules:u},1),3:m.create({parent:this,fieldKey:3,fieldName:"curve",pointerRules:u},0),4:m.create({parent:this,fieldKey:4,fieldName:"length",pointerRules:u},1)}}};var Fe=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteEventCollectionBox",pointerRules:{accepts:[o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitNoteEventCollectionBox,this)}get events(){return this.getField(1)}get owners(){return this.getField(2)}initializeFields(){return{1:N.hook({parent:this,fieldKey:1,fieldName:"events",pointerRules:{accepts:[o.NoteEvents],mandatory:!1}}),2:N.hook({parent:this,fieldKey:2,fieldName:"owners",pointerRules:{accepts:[o.NoteEventCollection],mandatory:!0}})}}};var Ge=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteRegionBox",pointerRules:{accepts:[o.Selection,o.Editing],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitNoteRegionBox,this)}get regions(){return this.getField(1)}get events(){return this.getField(2)}get position(){return this.getField(10)}get duration(){return this.getField(11)}get loopOffset(){return this.getField(12)}get loopDuration(){return this.getField(13)}get eventOffset(){return this.getField(14)}get mute(){return this.getField(15)}get label(){return this.getField(16)}get hue(){return this.getField(17)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"regions",pointerRules:u},o.RegionCollection,!0),2:g.create({parent:this,fieldKey:2,fieldName:"events",pointerRules:u},o.NoteEventCollection,!0),10:f.create({parent:this,fieldKey:10,fieldName:"position",pointerRules:u}),11:f.create({parent:this,fieldKey:11,fieldName:"duration",pointerRules:u}),12:f.create({parent:this,fieldKey:12,fieldName:"loopOffset",pointerRules:u}),13:f.create({parent:this,fieldKey:13,fieldName:"loopDuration",pointerRules:u}),14:f.create({parent:this,fieldKey:14,fieldName:"eventOffset",pointerRules:u}),15:w.create({parent:this,fieldKey:15,fieldName:"mute",pointerRules:u}),16:B.create({parent:this,fieldKey:16,fieldName:"label",pointerRules:u}),17:f.create({parent:this,fieldKey:17,fieldName:"hue",pointerRules:u})}}};var Ke=class r extends L{static create(e){return new r(e)}constructor(e){super(e)}get loop(){return this.getField(1)}get reverse(){return this.getField(2)}get mute(){return this.getField(3)}get speed(){return this.getField(4)}get quantise(){return this.getField(5)}get trigger(){return this.getField(6)}initializeFields(){return{1:w.create({parent:this,fieldKey:1,fieldName:"loop",pointerRules:u},!0),2:w.create({parent:this,fieldKey:2,fieldName:"reverse",pointerRules:u}),3:w.create({parent:this,fieldKey:3,fieldName:"mute",pointerRules:u}),4:f.create({parent:this,fieldKey:4,fieldName:"speed",pointerRules:u}),5:f.create({parent:this,fieldKey:5,fieldName:"quantise",pointerRules:u}),6:f.create({parent:this,fieldKey:6,fieldName:"trigger",pointerRules:u})}}};var dt=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NoteClipBox",pointerRules:{accepts:[o.Selection,o.Editing],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitNoteClipBox,this)}get clips(){return this.getField(1)}get events(){return this.getField(2)}get index(){return this.getField(3)}get playback(){return this.getField(4)}get duration(){return this.getField(10)}get mute(){return this.getField(11)}get label(){return this.getField(12)}get hue(){return this.getField(13)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"clips",pointerRules:u},o.ClipCollection,!0),2:g.create({parent:this,fieldKey:2,fieldName:"events",pointerRules:u},o.NoteEventCollection,!0),3:f.create({parent:this,fieldKey:3,fieldName:"index",pointerRules:u}),4:Ke.create({parent:this,fieldKey:4,fieldName:"playback",pointerRules:u}),10:f.create({parent:this,fieldKey:10,fieldName:"duration",pointerRules:u}),11:w.create({parent:this,fieldKey:11,fieldName:"mute",pointerRules:u}),12:B.create({parent:this,fieldKey:12,fieldName:"label",pointerRules:u}),13:f.create({parent:this,fieldKey:13,fieldName:"hue",pointerRules:u})}}};var Se=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventBox",pointerRules:{accepts:[o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitValueEventBox,this)}get events(){return this.getField(1)}get position(){return this.getField(10)}get index(){return this.getField(11)}get interpolation(){return this.getField(12)}get value(){return this.getField(13)}get slope(){return this.getField(14)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"events",pointerRules:u},o.ValueEvents,!0),10:f.create({parent:this,fieldKey:10,fieldName:"position",pointerRules:u}),11:f.create({parent:this,fieldKey:11,fieldName:"index",pointerRules:u}),12:f.create({parent:this,fieldKey:12,fieldName:"interpolation",pointerRules:{accepts:[o.ValueInterpolation],mandatory:!1}},1),13:m.create({parent:this,fieldKey:13,fieldName:"value",pointerRules:u}),14:m.create({parent:this,fieldKey:14,fieldName:"slope",pointerRules:u})}}};var Ae=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventCollectionBox",pointerRules:{accepts:[o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitValueEventCollectionBox,this)}get events(){return this.getField(1)}get owners(){return this.getField(2)}initializeFields(){return{1:N.hook({parent:this,fieldKey:1,fieldName:"events",pointerRules:{accepts:[o.ValueEvents],mandatory:!1}}),2:N.hook({parent:this,fieldKey:2,fieldName:"owners",pointerRules:{accepts:[o.ValueEventCollection],mandatory:!0}})}}};var De=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueEventCurveBox",pointerRules:u}),i)}constructor(e){super(e)}accept(e){return p(e.visitValueEventCurveBox,this)}get event(){return this.getField(1)}get slope(){return this.getField(2)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"event",pointerRules:u},o.ValueInterpolation,!0),2:m.create({parent:this,fieldKey:2,fieldName:"slope",pointerRules:u},.5)}}};var qe=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueRegionBox",pointerRules:{accepts:[o.Selection,o.Editing],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitValueRegionBox,this)}get regions(){return this.getField(1)}get events(){return this.getField(2)}get position(){return this.getField(10)}get duration(){return this.getField(11)}get loopOffset(){return this.getField(12)}get loopDuration(){return this.getField(13)}get mute(){return this.getField(14)}get label(){return this.getField(15)}get hue(){return this.getField(16)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"regions",pointerRules:u},o.RegionCollection,!0),2:g.create({parent:this,fieldKey:2,fieldName:"events",pointerRules:u},o.ValueEventCollection,!0),10:f.create({parent:this,fieldKey:10,fieldName:"position",pointerRules:u}),11:f.create({parent:this,fieldKey:11,fieldName:"duration",pointerRules:u}),12:f.create({parent:this,fieldKey:12,fieldName:"loopOffset",pointerRules:u}),13:f.create({parent:this,fieldKey:13,fieldName:"loopDuration",pointerRules:u}),14:w.create({parent:this,fieldKey:14,fieldName:"mute",pointerRules:u}),15:B.create({parent:this,fieldKey:15,fieldName:"label",pointerRules:u}),16:f.create({parent:this,fieldKey:16,fieldName:"hue",pointerRules:u})}}};var ht=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ValueClipBox",pointerRules:{accepts:[o.Selection,o.Editing],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitValueClipBox,this)}get clips(){return this.getField(1)}get events(){return this.getField(2)}get index(){return this.getField(3)}get playback(){return this.getField(4)}get duration(){return this.getField(10)}get mute(){return this.getField(11)}get label(){return this.getField(12)}get hue(){return this.getField(13)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"clips",pointerRules:u},o.ClipCollection,!0),2:g.create({parent:this,fieldKey:2,fieldName:"events",pointerRules:u},o.ValueEventCollection,!0),3:f.create({parent:this,fieldKey:3,fieldName:"index",pointerRules:u}),4:Ke.create({parent:this,fieldKey:4,fieldName:"playback",pointerRules:u}),10:f.create({parent:this,fieldKey:10,fieldName:"duration",pointerRules:u}),11:w.create({parent:this,fieldKey:11,fieldName:"mute",pointerRules:u}),12:B.create({parent:this,fieldKey:12,fieldName:"label",pointerRules:u}),13:f.create({parent:this,fieldKey:13,fieldName:"hue",pointerRules:u})}}};var ct=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioRegionBox",pointerRules:{accepts:[o.Selection,o.Editing],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitAudioRegionBox,this)}get regions(){return this.getField(1)}get file(){return this.getField(2)}get position(){return this.getField(10)}get duration(){return this.getField(11)}get loopOffset(){return this.getField(12)}get loopDuration(){return this.getField(13)}get mute(){return this.getField(14)}get label(){return this.getField(15)}get hue(){return this.getField(16)}get gain(){return this.getField(17)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"regions",pointerRules:u},o.RegionCollection,!0),2:g.create({parent:this,fieldKey:2,fieldName:"file",pointerRules:u},o.AudioFile,!0),10:f.create({parent:this,fieldKey:10,fieldName:"position",pointerRules:u}),11:f.create({parent:this,fieldKey:11,fieldName:"duration",pointerRules:u}),12:f.create({parent:this,fieldKey:12,fieldName:"loopOffset",pointerRules:u}),13:f.create({parent:this,fieldKey:13,fieldName:"loopDuration",pointerRules:u}),14:w.create({parent:this,fieldKey:14,fieldName:"mute",pointerRules:u}),15:B.create({parent:this,fieldKey:15,fieldName:"label",pointerRules:u}),16:f.create({parent:this,fieldKey:16,fieldName:"hue",pointerRules:u}),17:m.create({parent:this,fieldKey:17,fieldName:"gain",pointerRules:u})}}};var pt=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioClipBox",pointerRules:{accepts:[o.Selection,o.Editing],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitAudioClipBox,this)}get clips(){return this.getField(1)}get file(){return this.getField(2)}get index(){return this.getField(3)}get playback(){return this.getField(4)}get duration(){return this.getField(10)}get mute(){return this.getField(11)}get label(){return this.getField(12)}get hue(){return this.getField(13)}get gain(){return this.getField(14)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"clips",pointerRules:u},o.ClipCollection,!0),2:g.create({parent:this,fieldKey:2,fieldName:"file",pointerRules:u},o.AudioFile,!0),3:f.create({parent:this,fieldKey:3,fieldName:"index",pointerRules:u}),4:Ke.create({parent:this,fieldKey:4,fieldName:"playback",pointerRules:u}),10:f.create({parent:this,fieldKey:10,fieldName:"duration",pointerRules:u}),11:w.create({parent:this,fieldKey:11,fieldName:"mute",pointerRules:u}),12:B.create({parent:this,fieldKey:12,fieldName:"label",pointerRules:u}),13:f.create({parent:this,fieldKey:13,fieldName:"hue",pointerRules:u}),14:m.create({parent:this,fieldKey:14,fieldName:"gain",pointerRules:u})}}};var Tt=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"MarkerBox",pointerRules:{accepts:[o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitMarkerBox,this)}get track(){return this.getField(1)}get position(){return this.getField(2)}get plays(){return this.getField(3)}get label(){return this.getField(4)}get hue(){return this.getField(5)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"track",pointerRules:u},o.MarkerTrack,!0),2:f.create({parent:this,fieldKey:2,fieldName:"position",pointerRules:u}),3:f.create({parent:this,fieldKey:3,fieldName:"plays",pointerRules:u},1),4:B.create({parent:this,fieldKey:4,fieldName:"label",pointerRules:u}),5:f.create({parent:this,fieldKey:5,fieldName:"hue",pointerRules:u})}}};var br=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioFileBox",pointerRules:{accepts:[o.AudioFile],mandatory:!0}}),i)}constructor(e){super(e)}accept(e){return p(e.visitAudioFileBox,this)}get startInSeconds(){return this.getField(1)}get endInSeconds(){return this.getField(2)}get fileName(){return this.getField(3)}initializeFields(){return{1:f.create({parent:this,fieldKey:1,fieldName:"startInSeconds",pointerRules:u}),2:f.create({parent:this,fieldKey:2,fieldName:"endInSeconds",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"fileName",pointerRules:u})}}};var je=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioUnitBox",pointerRules:{accepts:[o.Selection,o.Automation],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitAudioUnitBox,this)}get type(){return this.getField(1)}get collection(){return this.getField(2)}get editing(){return this.getField(3)}get index(){return this.getField(11)}get volume(){return this.getField(12)}get panning(){return this.getField(13)}get mute(){return this.getField(14)}get solo(){return this.getField(15)}get tracks(){return this.getField(20)}get midiEffects(){return this.getField(21)}get input(){return this.getField(22)}get audioEffects(){return this.getField(23)}get auxSends(){return this.getField(24)}get output(){return this.getField(25)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"type",pointerRules:u},"instrument"),2:g.create({parent:this,fieldKey:2,fieldName:"collection",pointerRules:u},o.AudioUnits,!0),3:N.hook({parent:this,fieldKey:3,fieldName:"editing",pointerRules:{accepts:[o.Editing],mandatory:!1}}),11:f.create({parent:this,fieldKey:11,fieldName:"index",pointerRules:u}),12:m.create({parent:this,fieldKey:12,fieldName:"volume",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),13:m.create({parent:this,fieldKey:13,fieldName:"panning",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),14:w.create({parent:this,fieldKey:14,fieldName:"mute",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),15:w.create({parent:this,fieldKey:15,fieldName:"solo",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),20:N.hook({parent:this,fieldKey:20,fieldName:"tracks",pointerRules:{accepts:[o.TrackCollection],mandatory:!1}}),21:N.hook({parent:this,fieldKey:21,fieldName:"midiEffects",pointerRules:{accepts:[o.MidiEffectHost],mandatory:!1}}),22:N.hook({parent:this,fieldKey:22,fieldName:"input",pointerRules:{accepts:[o.InstrumentHost,o.AudioOutput],mandatory:!1}}),23:N.hook({parent:this,fieldKey:23,fieldName:"audioEffects",pointerRules:{accepts:[o.AudioEffectHost],mandatory:!1}}),24:N.hook({parent:this,fieldKey:24,fieldName:"auxSends",pointerRules:{accepts:[o.AuxSend],mandatory:!1}}),25:g.create({parent:this,fieldKey:25,fieldName:"output",pointerRules:u},o.AudioOutput,!1)}}};var ft=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AudioBusBox",pointerRules:u}),i)}constructor(e){super(e)}accept(e){return p(e.visitAudioBusBox,this)}get collection(){return this.getField(1)}get output(){return this.getField(2)}get input(){return this.getField(3)}get enabled(){return this.getField(4)}get icon(){return this.getField(5)}get label(){return this.getField(6)}get color(){return this.getField(7)}get minimized(){return this.getField(8)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"collection",pointerRules:u},o.AudioBusses,!0),2:g.create({parent:this,fieldKey:2,fieldName:"output",pointerRules:u},o.AudioOutput,!0),3:N.hook({parent:this,fieldKey:3,fieldName:"input",pointerRules:{accepts:[o.AudioOutput],mandatory:!1}}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:B.create({parent:this,fieldKey:5,fieldName:"icon",pointerRules:u}),6:B.create({parent:this,fieldKey:6,fieldName:"label",pointerRules:u}),7:B.create({parent:this,fieldKey:7,fieldName:"color",pointerRules:u},"red"),8:w.create({parent:this,fieldKey:8,fieldName:"minimized",pointerRules:u})}}};var Fr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"AuxSendBox",pointerRules:u}),i)}constructor(e){super(e)}accept(e){return p(e.visitAuxSendBox,this)}get audioUnit(){return this.getField(1)}get targetBus(){return this.getField(2)}get index(){return this.getField(3)}get routing(){return this.getField(4)}get sendGain(){return this.getField(5)}get sendPan(){return this.getField(6)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"audioUnit",pointerRules:u},o.AuxSend,!0),2:g.create({parent:this,fieldKey:2,fieldName:"targetBus",pointerRules:u},o.AudioOutput,!0),3:f.create({parent:this,fieldKey:3,fieldName:"index",pointerRules:u}),4:f.create({parent:this,fieldKey:4,fieldName:"routing",pointerRules:u}),5:m.create({parent:this,fieldKey:5,fieldName:"sendGain",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),6:m.create({parent:this,fieldKey:6,fieldName:"sendPan",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}})}}};var Ar=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"StepAutomationBox",pointerRules:u}),i)}constructor(e){super(e)}accept(e){return p(e.visitStepAutomationBox,this)}get step(){return this.getField(1)}get parameter(){return this.getField(2)}get value(){return this.getField(3)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"step",pointerRules:u},o.StepAutomation,!0),2:g.create({parent:this,fieldKey:2,fieldName:"parameter",pointerRules:u},o.StepAutomation,!0),3:m.create({parent:this,fieldKey:3,fieldName:"value",pointerRules:u})}}};var Nr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"GrooveShuffleBox",pointerRules:{accepts:[o.Groove],mandatory:!0}}),i)}constructor(e){super(e)}accept(e){return p(e.visitGrooveShuffleBox,this)}get label(){return this.getField(1)}get amount(){return this.getField(10)}get duration(){return this.getField(11)}initializeFields(){return{1:B.create({parent:this,fieldKey:1,fieldName:"label",pointerRules:u}),10:m.create({parent:this,fieldKey:10,fieldName:"amount",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},.6),11:f.create({parent:this,fieldKey:11,fieldName:"duration",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},480)}}};var Br=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"DeviceInterfaceKnobBox",pointerRules:u}),i)}constructor(e){super(e)}accept(e){return p(e.visitDeviceInterfaceKnobBox,this)}get userInterface(){return this.getField(1)}get parameter(){return this.getField(2)}get index(){return this.getField(3)}get anchor(){return this.getField(10)}get color(){return this.getField(11)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"userInterface",pointerRules:u},o.DeviceUserInterface,!0),2:g.create({parent:this,fieldKey:2,fieldName:"parameter",pointerRules:u},o.ParameterController,!0),3:f.create({parent:this,fieldKey:3,fieldName:"index",pointerRules:u}),10:m.create({parent:this,fieldKey:10,fieldName:"anchor",pointerRules:u}),11:B.create({parent:this,fieldKey:11,fieldName:"color",pointerRules:u})}}};var Yr=class r extends L{static create(e){return new r(e)}constructor(e){super(e)}get elements(){return this.getField(1)}initializeFields(){return{1:N.hook({parent:this,fieldKey:1,fieldName:"elements",pointerRules:{accepts:[o.DeviceUserInterface],mandatory:!1}})}}};var Er=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModularDeviceBox",pointerRules:{accepts:[o.Device,o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitModularDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get modularSetup(){return this.getField(10)}get userInterface(){return this.getField(11)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"host",pointerRules:u},o.AudioEffectHost,!0),2:f.create({parent:this,fieldKey:2,fieldName:"index",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"label",pointerRules:u}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:w.create({parent:this,fieldKey:5,fieldName:"minimized",pointerRules:u},!1),10:g.create({parent:this,fieldKey:10,fieldName:"modularSetup",pointerRules:u},o.ModularSetup,!0),11:Yr.create({parent:this,fieldKey:11,fieldName:"userInterface",pointerRules:u})}}};var Xr=class r extends L{static create(e){return new r(e)}constructor(e){super(e)}get active(){return this.getField(1)}initializeFields(){return{1:w.create({parent:this,fieldKey:1,fieldName:"active",pointerRules:{accepts:[o.StepAutomation],mandatory:!1}})}}};var Zr=class r extends L{static create(e){return new r(e)}constructor(e){super(e)}get steps(){return this.getField(10)}get length(){return this.getField(11)}get scale(){return this.getField(12)}initializeFields(){return{10:ot.create({parent:this,fieldKey:10,fieldName:"steps",pointerRules:u},e=>Xr.create(e),128),11:f.create({parent:this,fieldKey:11,fieldName:"length",pointerRules:u},16),12:f.create({parent:this,fieldKey:12,fieldName:"scale",pointerRules:u},960)}}};var Mr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"DeviceClashBox",pointerRules:{accepts:[o.Device,o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitDeviceClashBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get delay(){return this.getField(10)}get feedback(){return this.getField(11)}get cross(){return this.getField(12)}get filter(){return this.getField(13)}get wet(){return this.getField(14)}get dry(){return this.getField(15)}get patterns(){return this.getField(30)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"host",pointerRules:u},o.InstrumentHost,!0),2:B.create({parent:this,fieldKey:2,fieldName:"label",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"icon",pointerRules:u}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:w.create({parent:this,fieldKey:5,fieldName:"minimized",pointerRules:u},!1),10:m.create({parent:this,fieldKey:10,fieldName:"delay",pointerRules:{accepts:[o.Modulation,o.Automation,o.StepAutomation],mandatory:!1}},.5),11:m.create({parent:this,fieldKey:11,fieldName:"feedback",pointerRules:{accepts:[o.Modulation,o.Automation,o.StepAutomation],mandatory:!1}},.9),12:m.create({parent:this,fieldKey:12,fieldName:"cross",pointerRules:{accepts:[o.Modulation,o.Automation,o.StepAutomation],mandatory:!1}},0),13:m.create({parent:this,fieldKey:13,fieldName:"filter",pointerRules:{accepts:[o.Modulation,o.Automation,o.StepAutomation],mandatory:!1}},0),14:m.create({parent:this,fieldKey:14,fieldName:"wet",pointerRules:{accepts:[o.Modulation,o.Automation,o.StepAutomation],mandatory:!1}},-3),15:m.create({parent:this,fieldKey:15,fieldName:"dry",pointerRules:{accepts:[o.Modulation,o.Automation,o.StepAutomation],mandatory:!1}},-3),30:ot.create({parent:this,fieldKey:30,fieldName:"patterns",pointerRules:u},e=>Zr.create(e),16)}}};var Rr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"StereoToolDeviceBox",pointerRules:{accepts:[o.Device,o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitStereoToolDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get volume(){return this.getField(10)}get panning(){return this.getField(11)}get stereo(){return this.getField(12)}get invertL(){return this.getField(13)}get invertR(){return this.getField(14)}get swap(){return this.getField(15)}get panningMixing(){return this.getField(20)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"host",pointerRules:u},o.AudioEffectHost,!0),2:f.create({parent:this,fieldKey:2,fieldName:"index",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"label",pointerRules:u}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:w.create({parent:this,fieldKey:5,fieldName:"minimized",pointerRules:u},!1),10:m.create({parent:this,fieldKey:10,fieldName:"volume",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),11:m.create({parent:this,fieldKey:11,fieldName:"panning",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),12:m.create({parent:this,fieldKey:12,fieldName:"stereo",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),13:w.create({parent:this,fieldKey:13,fieldName:"invertL",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),14:w.create({parent:this,fieldKey:14,fieldName:"invertR",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),15:w.create({parent:this,fieldKey:15,fieldName:"swap",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),20:f.create({parent:this,fieldKey:20,fieldName:"panningMixing",pointerRules:u},1)}}};var Cr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"DelayDeviceBox",pointerRules:{accepts:[o.Device,o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitDelayDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get delay(){return this.getField(10)}get feedback(){return this.getField(11)}get cross(){return this.getField(12)}get filter(){return this.getField(13)}get wet(){return this.getField(14)}get dry(){return this.getField(15)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"host",pointerRules:u},o.AudioEffectHost,!0),2:f.create({parent:this,fieldKey:2,fieldName:"index",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"label",pointerRules:u}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:w.create({parent:this,fieldKey:5,fieldName:"minimized",pointerRules:u},!1),10:m.create({parent:this,fieldKey:10,fieldName:"delay",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},4),11:m.create({parent:this,fieldKey:11,fieldName:"feedback",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},.5),12:m.create({parent:this,fieldKey:12,fieldName:"cross",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},0),13:m.create({parent:this,fieldKey:13,fieldName:"filter",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},0),14:m.create({parent:this,fieldKey:14,fieldName:"wet",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},-6),15:m.create({parent:this,fieldKey:15,fieldName:"dry",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},0)}}};var Ot=class r extends L{static create(e){return new r(e)}constructor(e){super(e)}get enabled(){return this.getField(1)}get frequency(){return this.getField(10)}get order(){return this.getField(11)}get q(){return this.getField(12)}initializeFields(){return{1:w.create({parent:this,fieldKey:1,fieldName:"enabled",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),10:m.create({parent:this,fieldKey:10,fieldName:"frequency",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),11:f.create({parent:this,fieldKey:11,fieldName:"order",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),12:m.create({parent:this,fieldKey:12,fieldName:"q",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}})}}};var kt=class r extends L{static create(e){return new r(e)}constructor(e){super(e)}get enabled(){return this.getField(1)}get frequency(){return this.getField(10)}get gain(){return this.getField(11)}initializeFields(){return{1:w.create({parent:this,fieldKey:1,fieldName:"enabled",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),10:m.create({parent:this,fieldKey:10,fieldName:"frequency",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),11:m.create({parent:this,fieldKey:11,fieldName:"gain",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}})}}};var mt=class r extends L{static create(e){return new r(e)}constructor(e){super(e)}get enabled(){return this.getField(1)}get frequency(){return this.getField(10)}get gain(){return this.getField(11)}get q(){return this.getField(12)}initializeFields(){return{1:w.create({parent:this,fieldKey:1,fieldName:"enabled",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),10:m.create({parent:this,fieldKey:10,fieldName:"frequency",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),11:m.create({parent:this,fieldKey:11,fieldName:"gain",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),12:m.create({parent:this,fieldKey:12,fieldName:"q",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}})}}};var Vr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"RevampDeviceBox",pointerRules:{accepts:[o.Device,o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitRevampDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get highPass(){return this.getField(10)}get lowShelf(){return this.getField(11)}get lowBell(){return this.getField(12)}get midBell(){return this.getField(13)}get highBell(){return this.getField(14)}get highShelf(){return this.getField(15)}get lowPass(){return this.getField(16)}get gain(){return this.getField(17)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"host",pointerRules:u},o.AudioEffectHost,!0),2:f.create({parent:this,fieldKey:2,fieldName:"index",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"label",pointerRules:u}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:w.create({parent:this,fieldKey:5,fieldName:"minimized",pointerRules:u},!1),10:Ot.create({parent:this,fieldKey:10,fieldName:"highPass",pointerRules:u}),11:kt.create({parent:this,fieldKey:11,fieldName:"lowShelf",pointerRules:u}),12:mt.create({parent:this,fieldKey:12,fieldName:"lowBell",pointerRules:u}),13:mt.create({parent:this,fieldKey:13,fieldName:"midBell",pointerRules:u}),14:mt.create({parent:this,fieldKey:14,fieldName:"highBell",pointerRules:u}),15:kt.create({parent:this,fieldKey:15,fieldName:"highShelf",pointerRules:u}),16:Ot.create({parent:this,fieldKey:16,fieldName:"lowPass",pointerRules:u}),17:m.create({parent:this,fieldKey:17,fieldName:"gain",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}})}}};var Pr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ReverbDeviceBox",pointerRules:{accepts:[o.Device,o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitReverbDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get decay(){return this.getField(10)}get preDelay(){return this.getField(11)}get damp(){return this.getField(12)}get filter(){return this.getField(13)}get wet(){return this.getField(14)}get dry(){return this.getField(15)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"host",pointerRules:u},o.AudioEffectHost,!0),2:f.create({parent:this,fieldKey:2,fieldName:"index",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"label",pointerRules:u}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:w.create({parent:this,fieldKey:5,fieldName:"minimized",pointerRules:u},!1),10:m.create({parent:this,fieldKey:10,fieldName:"decay",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},.5),11:m.create({parent:this,fieldKey:11,fieldName:"preDelay",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},0),12:m.create({parent:this,fieldKey:12,fieldName:"damp",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},.5),13:m.create({parent:this,fieldKey:13,fieldName:"filter",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},0),14:m.create({parent:this,fieldKey:14,fieldName:"wet",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},-3),15:m.create({parent:this,fieldKey:15,fieldName:"dry",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},0)}}};var Sr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"VaporisateurDeviceBox",pointerRules:{accepts:[o.Device,o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitVaporisateurDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get volume(){return this.getField(10)}get octave(){return this.getField(11)}get tune(){return this.getField(12)}get waveform(){return this.getField(13)}get cutoff(){return this.getField(14)}get resonance(){return this.getField(15)}get attack(){return this.getField(16)}get release(){return this.getField(17)}get filterEnvelope(){return this.getField(18)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"host",pointerRules:u},o.InstrumentHost,!0),2:B.create({parent:this,fieldKey:2,fieldName:"label",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"icon",pointerRules:u}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:w.create({parent:this,fieldKey:5,fieldName:"minimized",pointerRules:u},!1),10:m.create({parent:this,fieldKey:10,fieldName:"volume",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),11:f.create({parent:this,fieldKey:11,fieldName:"octave",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),12:m.create({parent:this,fieldKey:12,fieldName:"tune",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),13:f.create({parent:this,fieldKey:13,fieldName:"waveform",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),14:m.create({parent:this,fieldKey:14,fieldName:"cutoff",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),15:m.create({parent:this,fieldKey:15,fieldName:"resonance",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),16:m.create({parent:this,fieldKey:16,fieldName:"attack",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),17:m.create({parent:this,fieldKey:17,fieldName:"release",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),18:m.create({parent:this,fieldKey:18,fieldName:"filterEnvelope",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}})}}};var Dr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"NanoDeviceBox",pointerRules:{accepts:[o.Device,o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitNanoDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get volume(){return this.getField(10)}get file(){return this.getField(15)}get release(){return this.getField(20)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"host",pointerRules:u},o.InstrumentHost,!0),2:B.create({parent:this,fieldKey:2,fieldName:"label",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"icon",pointerRules:u}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:w.create({parent:this,fieldKey:5,fieldName:"minimized",pointerRules:u},!1),10:m.create({parent:this,fieldKey:10,fieldName:"volume",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},-3),15:g.create({parent:this,fieldKey:15,fieldName:"file",pointerRules:u},o.AudioFile,!1),20:m.create({parent:this,fieldKey:20,fieldName:"release",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},.1)}}};var Kr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"PlayfieldDeviceBox",pointerRules:{accepts:[o.Device,o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitPlayfieldDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get samples(){return this.getField(10)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"host",pointerRules:u},o.InstrumentHost,!0),2:B.create({parent:this,fieldKey:2,fieldName:"label",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"icon",pointerRules:u}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:w.create({parent:this,fieldKey:5,fieldName:"minimized",pointerRules:u},!1),10:N.hook({parent:this,fieldKey:10,fieldName:"samples",pointerRules:{accepts:[o.Sample],mandatory:!1}})}}};var It=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"PlayfieldSampleBox",pointerRules:{accepts:[o.Editing],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitPlayfieldSampleBox,this)}get device(){return this.getField(10)}get file(){return this.getField(11)}get midiEffects(){return this.getField(12)}get audioEffects(){return this.getField(13)}get index(){return this.getField(15)}get label(){return this.getField(20)}get icon(){return this.getField(21)}get enabled(){return this.getField(22)}get minimized(){return this.getField(23)}get mute(){return this.getField(40)}get solo(){return this.getField(41)}get exclude(){return this.getField(42)}get polyphone(){return this.getField(43)}get gate(){return this.getField(44)}get pitch(){return this.getField(45)}get sampleStart(){return this.getField(46)}get sampleEnd(){return this.getField(47)}get attack(){return this.getField(48)}get release(){return this.getField(49)}initializeFields(){return{10:g.create({parent:this,fieldKey:10,fieldName:"device",pointerRules:u},o.Sample,!0),11:g.create({parent:this,fieldKey:11,fieldName:"file",pointerRules:u},o.AudioFile,!0),12:N.hook({parent:this,fieldKey:12,fieldName:"midiEffects",pointerRules:{accepts:[o.MidiEffectHost],mandatory:!1}}),13:N.hook({parent:this,fieldKey:13,fieldName:"audioEffects",pointerRules:{accepts:[o.AudioEffectHost],mandatory:!1}}),15:f.create({parent:this,fieldKey:15,fieldName:"index",pointerRules:u},60),20:B.create({parent:this,fieldKey:20,fieldName:"label",pointerRules:u}),21:B.create({parent:this,fieldKey:21,fieldName:"icon",pointerRules:u}),22:w.create({parent:this,fieldKey:22,fieldName:"enabled",pointerRules:u},!0),23:w.create({parent:this,fieldKey:23,fieldName:"minimized",pointerRules:u},!1),40:w.create({parent:this,fieldKey:40,fieldName:"mute",pointerRules:u}),41:w.create({parent:this,fieldKey:41,fieldName:"solo",pointerRules:u}),42:w.create({parent:this,fieldKey:42,fieldName:"exclude",pointerRules:u}),43:w.create({parent:this,fieldKey:43,fieldName:"polyphone",pointerRules:u}),44:f.create({parent:this,fieldKey:44,fieldName:"gate",pointerRules:u},0),45:m.create({parent:this,fieldKey:45,fieldName:"pitch",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),46:m.create({parent:this,fieldKey:46,fieldName:"sampleStart",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},0),47:m.create({parent:this,fieldKey:47,fieldName:"sampleEnd",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},1),48:m.create({parent:this,fieldKey:48,fieldName:"attack",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},.001),49:m.create({parent:this,fieldKey:49,fieldName:"release",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},.02)}}};var Tr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"TapeDeviceBox",pointerRules:{accepts:[o.Device,o.Selection,o.Automation],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitTapeDeviceBox,this)}get host(){return this.getField(1)}get label(){return this.getField(2)}get icon(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get flutter(){return this.getField(10)}get wow(){return this.getField(11)}get noise(){return this.getField(12)}get saturation(){return this.getField(13)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"host",pointerRules:u},o.InstrumentHost,!0),2:B.create({parent:this,fieldKey:2,fieldName:"label",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"icon",pointerRules:u}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:w.create({parent:this,fieldKey:5,fieldName:"minimized",pointerRules:u},!1),10:m.create({parent:this,fieldKey:10,fieldName:"flutter",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),11:m.create({parent:this,fieldKey:11,fieldName:"wow",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),12:m.create({parent:this,fieldKey:12,fieldName:"noise",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),13:m.create({parent:this,fieldKey:13,fieldName:"saturation",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}})}}};var Ir=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ArpeggioDeviceBox",pointerRules:{accepts:[o.Device,o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitArpeggioDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get modeIndex(){return this.getField(10)}get numOctaves(){return this.getField(11)}get rateIndex(){return this.getField(12)}get gate(){return this.getField(13)}get repeat(){return this.getField(14)}get velocity(){return this.getField(15)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"host",pointerRules:u},o.MidiEffectHost,!0),2:f.create({parent:this,fieldKey:2,fieldName:"index",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"label",pointerRules:u}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:w.create({parent:this,fieldKey:5,fieldName:"minimized",pointerRules:u},!1),10:f.create({parent:this,fieldKey:10,fieldName:"modeIndex",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),11:f.create({parent:this,fieldKey:11,fieldName:"numOctaves",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},1),12:f.create({parent:this,fieldKey:12,fieldName:"rateIndex",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},9),13:m.create({parent:this,fieldKey:13,fieldName:"gate",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},1),14:f.create({parent:this,fieldKey:14,fieldName:"repeat",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}},1),15:m.create({parent:this,fieldKey:15,fieldName:"velocity",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}})}}};var Or=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"PitchDeviceBox",pointerRules:{accepts:[o.Device,o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitPitchDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get semiTones(){return this.getField(10)}get cents(){return this.getField(11)}get octaves(){return this.getField(12)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"host",pointerRules:u},o.MidiEffectHost,!0),2:f.create({parent:this,fieldKey:2,fieldName:"index",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"label",pointerRules:u}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:w.create({parent:this,fieldKey:5,fieldName:"minimized",pointerRules:u},!1),10:f.create({parent:this,fieldKey:10,fieldName:"semiTones",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),11:m.create({parent:this,fieldKey:11,fieldName:"cents",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}}),12:f.create({parent:this,fieldKey:12,fieldName:"octaves",pointerRules:{accepts:[o.Modulation,o.Automation,o.MidiControl],mandatory:!1}})}}};var kr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ZeitgeistDeviceBox",pointerRules:{accepts:[o.Device,o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitZeitgeistDeviceBox,this)}get host(){return this.getField(1)}get index(){return this.getField(2)}get label(){return this.getField(3)}get enabled(){return this.getField(4)}get minimized(){return this.getField(5)}get groove(){return this.getField(10)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"host",pointerRules:u},o.MidiEffectHost,!0),2:f.create({parent:this,fieldKey:2,fieldName:"index",pointerRules:u}),3:B.create({parent:this,fieldKey:3,fieldName:"label",pointerRules:u}),4:w.create({parent:this,fieldKey:4,fieldName:"enabled",pointerRules:u},!0),5:w.create({parent:this,fieldKey:5,fieldName:"minimized",pointerRules:u},!1),10:g.create({parent:this,fieldKey:10,fieldName:"groove",pointerRules:u},o.Groove,!0)}}};var Ur=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModularBox",pointerRules:u}),i)}constructor(e){super(e)}accept(e){return p(e.visitModularBox,this)}get collection(){return this.getField(1)}get device(){return this.getField(2)}get editing(){return this.getField(3)}get modules(){return this.getField(11)}get connections(){return this.getField(12)}get label(){return this.getField(13)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"collection",pointerRules:u},o.ModularSetup,!0),2:N.hook({parent:this,fieldKey:2,fieldName:"device",pointerRules:{accepts:[o.ModularSetup],mandatory:!0}}),3:N.hook({parent:this,fieldKey:3,fieldName:"editing",pointerRules:{accepts:[o.Editing],mandatory:!1}}),11:N.hook({parent:this,fieldKey:11,fieldName:"modules",pointerRules:{accepts:[o.ModuleCollection],mandatory:!1}}),12:N.hook({parent:this,fieldKey:12,fieldName:"connections",pointerRules:{accepts:[o.ConnectionCollection],mandatory:!1}}),13:B.create({parent:this,fieldKey:13,fieldName:"label",pointerRules:u})}}};var zr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleConnectionBox",pointerRules:u}),i)}constructor(e){super(e)}accept(e){return p(e.visitModuleConnectionBox,this)}get collection(){return this.getField(1)}get source(){return this.getField(2)}get target(){return this.getField(3)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"collection",pointerRules:u},o.ConnectionCollection,!0),2:g.create({parent:this,fieldKey:2,fieldName:"source",pointerRules:u},o.VoltageConnection,!0),3:g.create({parent:this,fieldKey:3,fieldName:"target",pointerRules:u},o.VoltageConnection,!0)}}};var he=class r extends L{static create(e){return new r(e)}constructor(e){super(e)}get collection(){return this.getField(1)}get label(){return this.getField(2)}get x(){return this.getField(3)}get y(){return this.getField(4)}get collapsed(){return this.getField(5)}get removable(){return this.getField(6)}initializeFields(){return{1:g.create({parent:this,fieldKey:1,fieldName:"collection",pointerRules:u},o.ModuleCollection,!0),2:B.create({parent:this,fieldKey:2,fieldName:"label",pointerRules:u}),3:f.create({parent:this,fieldKey:3,fieldName:"x",pointerRules:u}),4:f.create({parent:this,fieldKey:4,fieldName:"y",pointerRules:u}),5:w.create({parent:this,fieldKey:5,fieldName:"collapsed",pointerRules:u},!1),6:w.create({parent:this,fieldKey:6,fieldName:"removable",pointerRules:u},!0)}}};var Lr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModularAudioInputBox",pointerRules:{accepts:[o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitModularAudioInputBox,this)}get attributes(){return this.getField(1)}get output(){return this.getField(10)}initializeFields(){return{1:he.create({parent:this,fieldKey:1,fieldName:"attributes",pointerRules:u}),10:N.hook({parent:this,fieldKey:10,fieldName:"output",pointerRules:{accepts:[o.VoltageConnection],mandatory:!1}})}}};var $r=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModularAudioOutputBox",pointerRules:{accepts:[o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitModularAudioOutputBox,this)}get attributes(){return this.getField(1)}get input(){return this.getField(10)}initializeFields(){return{1:he.create({parent:this,fieldKey:1,fieldName:"attributes",pointerRules:u}),10:N.hook({parent:this,fieldKey:10,fieldName:"input",pointerRules:{accepts:[o.VoltageConnection],mandatory:!1}})}}};var Hr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleDelayBox",pointerRules:{accepts:[o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitModuleDelayBox,this)}get attributes(){return this.getField(1)}get voltageInput(){return this.getField(10)}get voltageOutput(){return this.getField(11)}get time(){return this.getField(20)}initializeFields(){return{1:he.create({parent:this,fieldKey:1,fieldName:"attributes",pointerRules:u}),10:N.hook({parent:this,fieldKey:10,fieldName:"voltageInput",pointerRules:{accepts:[o.VoltageConnection],mandatory:!1}}),11:N.hook({parent:this,fieldKey:11,fieldName:"voltageOutput",pointerRules:{accepts:[o.VoltageConnection],mandatory:!1}}),20:m.create({parent:this,fieldKey:20,fieldName:"time",pointerRules:{accepts:[o.ParameterController],mandatory:!1}},500)}}};var Gr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleMultiplierBox",pointerRules:{accepts:[o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitModuleMultiplierBox,this)}get attributes(){return this.getField(1)}get voltageInputX(){return this.getField(10)}get voltageInputY(){return this.getField(11)}get voltageOutput(){return this.getField(12)}get multiplier(){return this.getField(20)}initializeFields(){return{1:he.create({parent:this,fieldKey:1,fieldName:"attributes",pointerRules:u}),10:N.hook({parent:this,fieldKey:10,fieldName:"voltageInputX",pointerRules:{accepts:[o.VoltageConnection],mandatory:!1}}),11:N.hook({parent:this,fieldKey:11,fieldName:"voltageInputY",pointerRules:{accepts:[o.VoltageConnection],mandatory:!1}}),12:N.hook({parent:this,fieldKey:12,fieldName:"voltageOutput",pointerRules:{accepts:[o.VoltageConnection],mandatory:!1}}),20:m.create({parent:this,fieldKey:20,fieldName:"multiplier",pointerRules:u})}}};var qr=class r extends x{static create(e,t,i){return e.stageBox(new r({uuid:t,graph:e,name:"ModuleGainBox",pointerRules:{accepts:[o.Selection],mandatory:!1}}),i)}constructor(e){super(e)}accept(e){return p(e.visitModuleGainBox,this)}get attributes(){return this.getField(1)}get voltageInput(){return this.getField(10)}get voltageOutput(){return this.getField(12)}get gain(){return this.getField(20)}initializeFields(){return{1:he.create({parent:this,fieldKey:1,fieldName:"attributes",pointerRules:u}),10:N.hook({parent:this,fieldKey:10,fieldName:"voltageInput",pointerRules:{accepts:[o.VoltageConnection],mandatory:!1}}),12:N.hook({parent:this,fieldKey:12,fieldName:"voltageOutput",pointerRules:{accepts:[o.VoltageConnection],mandatory:!1}}),20:m.create({parent:this,fieldKey:20,fieldName:"gain",pointerRules:{accepts:[o.ParameterController],mandatory:!1}})}}};var ye;(function(r){r.write=(e,t)=>{if(t.type==="none")e.disconnect(),e.setValue(0);else if(t.type==="linear")e.disconnect(),e.setValue(1);else if(t.type==="curve"){e.setValue(0);let i=e.pointerHub.filter(o.ValueInterpolation).at(0)?.box;V(i)?(di(i,De),i.slope.setValue(t.slope)):De.create(e.box.graph,v.generate(),s=>{s.slope.setValue(t.slope),s.event.refer(e)})}},r.read=e=>{let t=e.pointerHub.incoming().at(0)?.box;return V(t)?(di(t,De),{type:"curve",slope:t.slope.getValue()}):e.getValue()===0?Ve.None:e.getValue()===1?Ve.Linear:b("Unknown Interpolation value")}})(ye||(ye={}));var _e=class r{static Comparator=(e,t)=>{let i=e.position-t.position;if(i!==0)return i;let s=e.index-t.index;if(s!==0)return s;throw new Error(`${e} and ${t} are identical in terms of comparison`)};type="value-event";#e=new R;#t;#r;#i;#s;#n=!1;constructor(e,t){this.#t=e,this.#r=t,this.#i=this.#e.own(new er(()=>ye.read(this.#r.interpolation)));let i=()=>{this.#i.invalidate(),this.collection.ifSome(s=>s.onEventPropertyChanged())};this.#e.ownAll(this.#r.subscribe(O.Children,s=>{if(!this.collection.isEmpty()&&(s.type==="primitive"||s.type==="pointer")){let n=this.collection.unwrap(),a=s.address.fieldKeys,l=M.equals(this.#r.index.address.fieldKeys,a),d=M.equals(this.#r.position.address.fieldKeys,a);l||d?n.requestSorting():n.onEventPropertyChanged()}}),this.#r.interpolation.subscribe(i),this.#r.interpolation.pointerHub.subscribeImmediate({onAdd:({targetVertex:s})=>{this.#s.terminate(),this.#s=s.unwrap().box.subscribe(O.Children,i),i()},onRemove:()=>{this.#s.terminate(),this.#s=P.Empty,i()}})),this.#s=this.#r.interpolation.pointerHub.filter(o.ValueInterpolation).at(0)?.box.subscribe(O.Children,i)??P.Empty}onSelected(){this.#n=!0,this.collection.ifSome(e=>e.onEventPropertyChanged())}onDeselected(){this.#n=!1,this.collection.ifSome(e=>e.onEventPropertyChanged())}terminate(){this.#s.terminate(),this.#e.terminate()}get box(){return this.#r}get uuid(){return this.#r.address.uuid}get address(){return this.#r.address}get position(){return this.#r.position.getValue()}get index(){return this.#r.index.getValue()}set interpolation(e){ye.write(this.#r.interpolation,e)}get interpolation(){return this.#i.get()}get value(){return this.#r.value.getValue()}get isSelected(){return this.#n}get collection(){return this.#r.events.targetVertex.map(e=>this.#t.boxAdapters.adapterFor(e.box,pe))}copyTo(e){let t=Se.create(this.#t.boxGraph,v.generate(),i=>{i.position.setValue(e?.position??this.position),i.index.setValue(e?.index??this.index),i.events.refer(e?.events??this.collection.unwrap().box.events),i.value.setValue(e?.value??this.value)});return ye.write(t.interpolation,e?.interpolation??this.interpolation),this.#t.boxAdapters.adapterFor(t,r)}copyFrom(e){return this.#r.position.setValue(e?.position??this.position),this.#r.index.setValue(e?.index??this.index),this.#r.events.refer(e?.events??this.collection.unwrap().box.events),this.#r.value.setValue(e?.value??this.value),ye.write(this.#r.interpolation,e?.interpolation??this.interpolation),this}toString(){return`{ValueEventBoxAdapter position: ${this.position} index: ${this.index}}`}};var pe=class r{#e=new R;#t;#r;#i;#s;#n;constructor(e,t){this.#t=e,this.#r=t,this.#i=new K,this.#s=v.newSet(s=>s.uuid),this.#n=$e.create(_e.Comparator);let i=s=>{let n=T(s.accept({visitValueEventBox:a=>this.#t.boxAdapters.adapterFor(a,_e)}),`Could not find adapter for ${s}`);this.#s.add(n)&&(this.#n.add(n),this.#a())};this.#r.events.pointerHub.incoming().forEach(({box:s})=>i(s)),this.#e.own(this.#r.events.pointerHub.subscribeTransactual({onAdd:({box:s})=>i(s),onRemove:({box:{address:{uuid:s}}})=>{this.#n.remove(this.#s.removeByKey(s)),this.#a()}})),this.#e.own(this.#r.owners.pointerHub.subscribeTransactual({onAdd:()=>this.#i.notify(this),onRemove:()=>this.#i.notify(this)}))}valueAt(e,t){return fr.valueAt(this.#n,e,t)}copy(){let e=this.#t.boxGraph,t=Ae.create(e,v.generate());return this.#n.asArray().forEach(i=>i.copyTo({events:t.events})),this.#t.boxAdapters.adapterFor(t,r)}cut(e){let t=this.events.lowerEqual(e),i=this.events.greaterEqual(e);if(i===null)return t===null?h.None:h.wrap(this.createEvent({position:e,value:t.value,index:t.index,interpolation:t.interpolation}));if(t===null)return h.wrap(this.createEvent({position:e,value:i.value,index:i.index,interpolation:i.interpolation}));if(t.position===e)return h.wrap(t);if(t.interpolation.type==="none")return h.wrap(this.createEvent({position:e,value:t.value,index:t.index,interpolation:t.interpolation}));if(t.interpolation.type==="linear"){let{position:s,value:n}=t,{position:a,value:l}=i;return h.wrap(this.createEvent({position:e,value:Li(n,l,(e-s)/(a-s)),index:0,interpolation:t.interpolation}))}if(t.interpolation.type==="curve"){let{position:s,value:n}=t,{position:a,value:l}=i,d=a-s,c=e-s,F=de.byHalf(d,n,de.valueAt({slope:t.interpolation.slope,steps:d,y0:n,y1:l},d*.5),l),y=de.valueAt(F,c),A=de.slopeByHalf(n,de.valueAt(F,c*.5),y);return ye.write(t.box.interpolation,Ve.Curve(A)),h.wrap(this.createEvent({position:e,value:y,index:0,interpolation:Ve.Curve(de.slopeByHalf(y,de.valueAt(F,(c+d)*.5),l))}))}return b("Unknown interpolation type")}subscribeChange(e){return this.#i.subscribe(e)}createEvent({position:e,index:t,value:i,interpolation:s}){let n=Se.create(this.#t.boxGraph,v.generate(),a=>{a.position.setValue(e),a.index.setValue(t),a.value.setValue(i),a.events.refer(this.#r.events)});return ye.write(n.interpolation,s),this.#t.boxAdapters.adapterFor(n,_e)}requestSorting(){this.#n.onIndexingChanged(),this.onEventPropertyChanged()}onEventPropertyChanged(){this.#a()}terminate(){this.#e.terminate()}get box(){return this.#r}get uuid(){return this.#r.address.uuid}get address(){return this.#r.address}get numOwners(){return this.#r.owners.pointerHub.filter(o.ValueEventCollection).length}get events(){return this.#n}toString(){return`{ValueEventCollectionBox ${v.toString(this.#r.address.uuid)}}`}#a(){this.#i.notify(this)}};var We=class{type="value-clip";#e=new R;#t;#r;#i;#s;#n;#a=P.Empty;constructor(e,t){this.#t=e,this.#r=t,this.#n=!0,this.#i=this.#e.own(new le(!1)),this.#s=this.#e.own(new K),this.#e.own(this.#r.pointerHub.subscribeImmediate({onAdd:()=>this.#o(),onRemove:()=>this.#o()})),this.#e.own(this.#r.subscribe(O.Children,i=>this.#o())),this.#e.own(this.#r.events.catchupAndSubscribe(({targetVertex:i})=>{this.#a.terminate(),this.#a=i.match({none:()=>P.Empty,some:({box:s})=>this.#t.boxAdapters.adapterFor(s,pe).subscribeChange(()=>this.#o())}),this.#o()})),this.#n=!1}valueAt(e,t){let i=this.optCollection;return i.isEmpty()?t:i.unwrap().valueAt(e%this.duration,t)}catchupAndSubscribeSelected(e){return this.#i.catchupAndSubscribe(e)}subscribeChange(e){return this.#s.subscribe(e)}accept(e){return p(e.visitValueClipBoxAdapter,this)}consolidate(){this.#r.events.refer(this.optCollection.unwrap().copy().box.owners)}clone(e){let t=e?this.optCollection.unwrap().copy().box.owners:this.#r.events.targetVertex.unwrap();ht.create(this.#t.boxGraph,v.generate(),i=>{i.index.setValue(this.indexField.getValue()),i.label.setValue(this.label),i.hue.setValue(this.hue),i.duration.setValue(this.duration),i.mute.setValue(this.mute),i.clips.refer(this.#r.clips.targetVertex.unwrap()),i.events.refer(t)})}onSelected(){this.#i.setValue(!0)}onDeselected(){this.#i.setValue(!1)}get isSelected(){return this.#i.getValue()}terminate(){this.#a.terminate(),this.#e.terminate()}get box(){return this.#r}get uuid(){return this.#r.address.uuid}get address(){return this.#r.address}get indexField(){return this.#r.index}get duration(){return this.#r.duration.getValue()}get mute(){return this.#r.mute.getValue()}get hue(){return this.#r.hue.getValue()}get hasCollection(){return!this.optCollection.isEmpty()}get events(){return this.optCollection.map(e=>e.events)}get optCollection(){return this.#r.events.targetVertex.map(e=>this.#t.boxAdapters.adapterFor(e.box,pe))}get label(){return this.#r.label.getValue()}get trackBoxAdapter(){return this.#n?h.None:this.#r.clips.targetVertex.map(e=>this.#t.boxAdapters.adapterFor(e.box,Q))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}toString(){return`{ValueClipBoxAdapter ${v.toString(this.#r.address.uuid)} d: ${j.toString(this.duration)}}`}#o(){this.#s.notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()}};var Te=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get box(){return this.#t}get uuid(){return this.#t.address.uuid}get address(){return this.#t.address}get startInSeconds(){return this.#t.startInSeconds.getValue()}get endInSeconds(){return this.#t.endInSeconds.getValue()}get data(){return this.getOrCreateLoader().data}get peaks(){return this.getOrCreateLoader().peaks}getOrCreateLoader(){return this.#e.audioManager.getOrCreate(this.#t.address.uuid)}terminate(){}};var Ut=class{type="audio-clip";#e=new R;#t;#r;#i;#s;#n;#a=h.None;#o=h.None;constructor(e,t){this.#t=e,this.#r=t,this.#n=!0,this.#i=this.#e.own(new le(!1)),this.#s=this.#e.own(new K),this.#e.ownAll(this.#r.pointerHub.subscribeImmediate({onAdd:()=>this.#l(),onRemove:()=>this.#l()}),this.#r.file.catchupAndSubscribe(i=>{this.#a=i.targetVertex.map(s=>this.#t.boxAdapters.adapterFor(s.box,Te)),this.#o.ifSome(s=>s.terminate()),this.#o=this.#a.map(s=>s.getOrCreateLoader().subscribe(()=>this.#l()))}),this.#r.subscribe(O.Children,i=>this.#l()),{terminate:()=>{this.#o.ifSome(i=>i.terminate()),this.#o=h.None}}),this.#n=!1}catchupAndSubscribeSelected(e){return this.#i.catchupAndSubscribe(e)}subscribeChange(e){return this.#s.subscribe(e)}accept(e){return p(e.visitAudioClipBoxAdapter,this)}consolidate(){}clone(e){pt.create(this.#t.boxGraph,v.generate(),t=>{t.index.setValue(this.indexField.getValue()),t.gain.setValue(this.gain),t.label.setValue(this.label),t.hue.setValue(this.hue),t.duration.setValue(this.duration),t.mute.setValue(this.mute),t.clips.refer(this.#r.clips.targetVertex.unwrap()),t.file.refer(this.#r.file.targetVertex.unwrap())})}onSelected(){this.#i.setValue(!0)}onDeselected(){this.#i.setValue(!1)}get isSelected(){return this.#i.getValue()}terminate(){this.#e.terminate()}get box(){return this.#r}get uuid(){return this.#r.address.uuid}get address(){return this.#r.address}get indexField(){return this.#r.index}get duration(){return this.#r.duration.getValue()}get mute(){return this.#r.mute.getValue()}get hue(){return this.#r.hue.getValue()}get gain(){return this.#r.gain.getValue()}get file(){return this.#a.unwrap("Cannot access file.")}get hasCollection(){return!this.optCollection.isEmpty()}get optCollection(){return h.None}get label(){return this.#r.label.getValue()}get trackBoxAdapter(){return this.#n?h.None:this.#r.clips.targetVertex.map(e=>this.#t.boxAdapters.adapterFor(e.box,Q))}get isMirrowed(){return!1}get canMirror(){return!1}toString(){return`{AudioClipBoxAdapter ${v.toString(this.#r.address.uuid)} d: ${j.toString(this.duration)}}`}#l(){this.#s.notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()}};var gt=class r{type="note-event";#e;#t;#r;#i=!1;constructor(e,t){this.#e=e,this.#t=t,this.#r=this.#t.subscribe(O.Children,i=>{if(!this.collection.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let s=this.collection.unwrap(),n=i.address.fieldKeys,a=M.equals(this.#t.pitch.address.fieldKeys,n),l=M.equals(this.#t.position.address.fieldKeys,n);a||l?s.requestSorting():s.onEventPropertyChanged()}})}onSelected(){this.#i=!0,this.collection.ifSome(e=>e.onEventPropertyChanged())}onDeselected(){this.#i=!1,this.collection.ifSome(e=>e.onEventPropertyChanged())}terminate(){this.#r.terminate()}get box(){return this.#t}get uuid(){return this.#t.address.uuid}get address(){return this.#t.address}get position(){return this.#t.position.getValue()}get duration(){return this.#t.duration.getValue()}get complete(){return this.position+this.duration}get velocity(){return this.#t.velocity.getValue()}get pitch(){return this.#t.pitch.getValue()}get cent(){return this.#t.cent.getValue()}get chance(){return this.#t.chance.getValue()}get playCount(){return this.#t.playCount.getValue()}get playCurve(){return this.#t.playCurve.getValue()}get isSelected(){return this.#i}get collection(){return this.#t.events.targetVertex.map(e=>this.#e.boxAdapters.adapterFor(e.box,fe))}normalizedPitch(){if(this.collection.isEmpty())return .5;let{minPitch:e,maxPitch:t}=this.collection.unwrap();return e===t?.5:1-(this.pitch-e)/(t-e)}copyAsNoteEvent(){return{type:"note-event",position:this.position,duration:this.duration,pitch:this.pitch,cent:this.cent,velocity:this.velocity}}copyTo(e){return this.#e.boxAdapters.adapterFor(Pe.create(this.#e.boxGraph,v.generate(),t=>{t.position.setValue(e?.position??this.position),t.duration.setValue(e?.duration??this.duration),t.pitch.setValue(e?.pitch??this.pitch),t.playCount.setValue(e?.playCount??this.playCount),t.events.refer(e?.events??this.collection.unwrap().box.events),t.velocity.setValue(this.velocity),t.cent.setValue(this.cent),t.chance.setValue(this.chance)}),r)}computeCurveValue(e){return lt.curveFunc(e,this.playCurve)}canConsolidate(){return this.playCount>1}consolidate(){let e=this.playCount,t=this.collection.unwrap().box.events,i=M.create(s=>{let n=Math.floor(this.computeCurveValue(s/e)*this.duration),a=Math.floor(this.computeCurveValue((s+1)/e)*this.duration);return this.copyTo({position:Math.floor(this.position+n),duration:Math.max(1,a-n),playCount:1,events:t})},e);return this.#t.delete(),i}};var fe=class r{#e=new R;#t;#r;#i;#s;#n;#a=60;#o=60;#l=0;#u=!1;constructor(e,t){this.#t=e,this.#r=t,this.#i=new K,this.#s=v.newSet(s=>s.uuid),this.#n=$e.create(lt.Comparator);let i=s=>{let n=T(s.accept({visitNoteEventBox:a=>this.#t.boxAdapters.adapterFor(a,gt)}),`Could not find adapter for ${s}`);this.#s.add(n)&&(this.#n.add(n),this.#d())};this.#r.events.pointerHub.incoming().forEach(({box:s})=>i(s)),this.#e.own(this.#r.events.pointerHub.subscribeTransactual({onAdd:({box:s})=>i(s),onRemove:({box:{address:{uuid:s}}})=>{this.#n.remove(this.#s.removeByKey(s)),this.#d()}})),this.#e.own(this.#r.owners.pointerHub.subscribeTransactual({onAdd:()=>this.#i.notify(this),onRemove:()=>this.#i.notify(this)}))}copy(){let e=this.#t.boxGraph,t=Fe.create(e,v.generate());return this.#n.asArray().forEach(i=>i.copyTo({events:t.events})),this.#t.boxAdapters.adapterFor(t,r)}createEvent({position:e,duration:t,velocity:i,pitch:s,chance:n,playCount:a,cent:l}){return this.#t.boxAdapters.adapterFor(Pe.create(this.#t.boxGraph,v.generate(),d=>{d.position.setValue(e),d.duration.setValue(t),d.velocity.setValue(i),d.pitch.setValue(s),d.chance.setValue(n),d.playCount.setValue(a),d.cent.setValue(l),d.events.refer(this.#r.events)}),gt)}subscribeChange(e){return this.#i.subscribe(e)}selectable(){return this.#n.asArray()}selectableAt(e){for(let t of this.#n.asArray())if(t.position<=e.u&&e.u<t.complete&&t.pitch===e.v)return Z.one(t);return Z.empty()}selectablesBetween(e,t){let i=[];for(let s of this.#n.asArray())Et.intersect1D(s.position,s.complete,e.u,t.u)&&Et.intersect1D(s.pitch,s.pitch,e.v,t.v)&&i.push(s);return i}requestSorting(){this.#n.onIndexingChanged(),this.onEventPropertyChanged()}onEventPropertyChanged(){this.#d()}terminate(){this.#e.terminate()}get box(){return this.#r}get uuid(){return this.#r.address.uuid}get address(){return this.#r.address}get numOwners(){return this.#r.owners.pointerHub.filter(o.NoteEventCollection).length}get events(){return this.#u||this.#h(),this.#n}get minPitch(){return this.#u||this.#h(),this.#a}get maxPitch(){return this.#u||this.#h(),this.#o}get maxDuration(){return this.#u||this.#h(),this.#l}toString(){return`{NoteEventCollectionBox ${v.toString(this.#r.address.uuid)}}`}#d(){this.#u=!1,this.#i.notify(this)}#h(){let e=127,t=0,i=0;this.#n.asArray().forEach(({pitch:s,duration:n})=>{e=Math.min(e,s),t=Math.max(t,s),i=Math.max(i,n)}),this.#a=e,this.#o=t,this.#l=i,this.#u=!0}};var zt=class{type="note-clip";#e=new R;#t;#r;#i;#s;#n;#a=P.Empty;constructor(e,t){this.#t=e,this.#r=t,this.#n=!0,this.#i=this.#e.own(new le(!1)),this.#s=this.#e.own(new K),this.#e.ownAll(this.#r.pointerHub.subscribeImmediate({onAdd:()=>this.#o(),onRemove:()=>this.#o()}),this.#r.subscribe(O.Children,i=>this.#o()),this.#r.events.catchupAndSubscribe(({targetVertex:i})=>{this.#a.terminate(),this.#a=i.match({none:()=>P.Empty,some:({box:s})=>this.#t.boxAdapters.adapterFor(s,fe).subscribeChange(()=>this.#o())}),this.#o()})),this.#n=!1}catchupAndSubscribeSelected(e){return this.#i.catchupAndSubscribe(e)}subscribeChange(e){return this.#s.subscribe(e)}accept(e){return p(e.visitNoteClipBoxAdapter,this)}consolidate(){this.#r.events.refer(this.optCollection.unwrap().copy().box.owners)}clone(e){let t=e?this.optCollection.unwrap().copy().box.owners:this.#r.events.targetVertex.unwrap();dt.create(this.#t.boxGraph,v.generate(),i=>{i.index.setValue(this.indexField.getValue()),i.label.setValue(this.label),i.hue.setValue(this.hue),i.duration.setValue(this.duration),i.mute.setValue(this.mute),i.clips.refer(this.#r.clips.targetVertex.unwrap()),i.events.refer(t)})}onSelected(){this.#i.setValue(!0)}onDeselected(){this.#i.setValue(!1)}get isSelected(){return this.#i.getValue()}terminate(){this.#a.terminate(),this.#e.terminate()}get box(){return this.#r}get uuid(){return this.#r.address.uuid}get address(){return this.#r.address}get indexField(){return this.#r.index}get duration(){return this.#r.duration.getValue()}get mute(){return this.#r.mute.getValue()}get hue(){return this.#r.hue.getValue()}get events(){return this.optCollection.map(e=>e.events)}get hasCollection(){return!this.optCollection.isEmpty()}get optCollection(){return this.#r.events.targetVertex.map(e=>this.#t.boxAdapters.adapterFor(e.box,fe))}get label(){return this.#r.label.getValue()}get trackBoxAdapter(){return this.#n?h.None:this.#r.clips.targetVertex.map(e=>this.#t.boxAdapters.adapterFor(e.box,Q))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}toString(){return`{NoteClipBoxAdapter ${v.toString(this.#r.address.uuid)} d: ${j.toString(this.duration)}}`}#o(){this.#s.notify(),this.trackBoxAdapter.unwrapOrNull()?.clips?.dispatchChange()}};var Bs={for:(r,e)=>T(e.accept({visitNoteClipBox:t=>r.adapterFor(t,zt),visitValueClipBox:t=>r.adapterFor(t,We),visitAudioClipBox:t=>r.adapterFor(t,Ut)}),"")};var Jr=class{#e;#t;#r;#i;constructor(e,t){this.#e=e,this.#t=new R,this.#r=this.#t.own(new K),this.#i=this.#t.own(ue.create(e.box.clips,i=>Bs.for(t,i),o.ClipCollection)),this.#i.subscribe({onAdd:()=>this.dispatchChange(),onRemove:()=>this.dispatchChange(),onReorder:()=>this.dispatchChange()})}get trackBoxAdapter(){return this.#e}get collection(){return this.#i}dispatchChange(){this.#r.notify()}subscribeChanges(e){return this.#r.subscribe(e)}terminate(){this.#t.terminate()}};var Lt=class r{type="audio-region";#e;#t;#r;#i;#s=h.None;#n=h.None;#a;#o;constructor(e,t){this.#t=e,this.#r=t,this.#e=new R,this.#i=new K,this.#a=!1,this.#o=!0,this.#e.ownAll(this.#r.pointerHub.subscribeImmediate({onAdd:()=>this.#l(),onRemove:()=>this.#l()}),this.#r.file.catchupAndSubscribe(i=>{this.#s=i.targetVertex.map(s=>this.#t.boxAdapters.adapterFor(s.box,Te)),this.#n.ifSome(s=>s.terminate()),this.#n=this.#s.map(s=>s.getOrCreateLoader().subscribe(()=>this.#l()))}),this.#r.subscribe(O.Children,i=>{if(!this.trackBoxAdapter.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let s=this.trackBoxAdapter.unwrap();this.#r.position.address.equals(i.address)?(s.regions.onIndexingChanged(),this.#l()):this.#l()}}),{terminate:()=>{this.#n.ifSome(i=>i.terminate()),this.#n=h.None}}),this.#o=!1}subscribeChange(e){return this.#i.subscribe(e)}accept(e){return p(e.visitAudioRegionBoxAdapter,this)}onSelected(){this.#a=!0,this.#l()}onDeselected(){this.#a=!1,this.#l()}get isSelected(){return this.#a}terminate(){this.#e.terminate()}get box(){return this.#r}get uuid(){return this.#r.address.uuid}get address(){return this.#r.address}get position(){return this.#r.position.getValue()}get duration(){let e=this.#r.duration.getValue();if(e===0){let t=this.#s.unwrap("Cannot compute duration without file"),i=t.startInSeconds,n=t.endInSeconds-i;return j.secondsToPulses(n,this.#t.bpm)}return e}get complete(){return this.position+this.duration}get loopOffset(){return this.#r.loopOffset.getValue()}get loopDuration(){return this.#r.loopDuration.getValue()}get offset(){return this.position-this.loopOffset}get mute(){return this.#r.mute.getValue()}get hue(){return this.#r.hue.getValue()}get gain(){return this.#r.gain.getValue()}get file(){return this.#s.unwrap("Cannot access file.")}get hasCollection(){return this.#s.nonEmpty()}get optCollection(){return h.None}get label(){if(this.#s.isEmpty())return"No Audio File";let e=this.#s.unwrap().getOrCreateLoader().state;return e.type==="progress"?`${Math.round(e.progress*100)}%`:e.type==="error"?String(e.reason):this.#r.label.getValue()}get isMirrowed(){return!1}get canMirror(){return!1}get trackBoxAdapter(){return this.#r.regions.targetVertex.map(e=>this.#t.boxAdapters.adapterFor(e.box,Q))}copyTo(e){return this.#t.boxAdapters.adapterFor(ct.create(this.#t.boxGraph,v.generate(),t=>{t.position.setValue(e?.position??this.position),t.duration.setValue(e?.duration??this.duration),t.loopOffset.setValue(e?.loopOffset??this.loopOffset),t.loopDuration.setValue(e?.loopDuration??this.loopDuration),t.regions.refer(e?.track??this.#r.regions.targetVertex.unwrap()),t.file.refer(this.#r.file.targetVertex.unwrap()),t.mute.setValue(this.mute),t.hue.setValue(this.hue),t.label.setValue(this.label),t.gain.setValue(this.gain)}),r)}consolidate(){}canFlatten(e){return!1}flatten(e){return h.None}toString(){return`{AudioRegionBoxAdapter ${v.toString(this.#r.address.uuid)}}`}#l(){this.#o||(this.#i.notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange())}};var $t=class r{type="note-region";#e=new R;#t;#r;#i;#s;#n;#a=P.Empty;constructor(e,t){this.#t=e,this.#r=t,this.#i=new K,this.#n=!1,this.#s=!0,this.#e.ownAll(this.#r.pointerHub.subscribeImmediate({onAdd:()=>this.#o(),onRemove:()=>this.#o()}),this.#r.subscribe(O.Children,i=>{if(!this.trackBoxAdapter.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let s=this.trackBoxAdapter.unwrap();this.#r.position.address.equals(i.address)?(s.regions.onIndexingChanged(),this.#o()):this.#o()}}),this.#r.events.catchupAndSubscribe(({targetVertex:i})=>{this.#a.terminate(),this.#a=i.match({none:()=>P.Empty,some:({box:s})=>this.#t.boxAdapters.adapterFor(s,fe).subscribeChange(()=>this.#o())}),this.#o()})),this.#s=!1}subscribeChange(e){return this.#i.subscribe(e)}accept(e){return p(e.visitNoteRegionBoxAdapter,this)}onSelected(){this.#n=!0,this.#o()}onDeselected(){this.#n=!1,this.#o()}get isSelected(){return this.#n}*iterateActiveNotesAt(e){let t=this.optCollection;if(t.isEmpty())return;let i=t.unwrap(),s=be.globalToLocal(this,e);for(let n of i.events.iterateFrom(s-i.maxDuration)){if(s<n.position)return;s<n.complete&&(yield n.copyAsNoteEvent())}}terminate(){this.#a.terminate(),this.#e.terminate()}get box(){return this.#r}get uuid(){return this.#r.address.uuid}get address(){return this.#r.address}get position(){return this.#r.position.getValue()}get duration(){return this.#r.duration.getValue()}get loopOffset(){return this.#r.loopOffset.getValue()}get loopDuration(){return this.#r.loopDuration.getValue()}get offset(){return this.position-this.loopOffset}get complete(){return this.position+this.duration}get mute(){return this.#r.mute.getValue()}get hue(){return this.#r.hue.getValue()}get hasCollection(){return this.optCollection.nonEmpty()}get optCollection(){return this.#r.events.targetVertex.map(e=>this.#t.boxAdapters.adapterFor(e.box,fe))}get label(){return this.#r.label.getValue()}get trackBoxAdapter(){return this.#s?h.None:this.#r.regions.targetVertex.map(e=>this.#t.boxAdapters.adapterFor(e.box,Q))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}copyTo(e){let t=this.optCollection.unwrap("Cannot make copy without event-collection"),i=e?.consolidate===!0?t.copy().box.owners:t.box.owners;return this.#t.boxAdapters.adapterFor(Ge.create(this.#t.boxGraph,v.generate(),s=>{s.position.setValue(e?.position??this.position),s.duration.setValue(e?.duration??this.duration),s.loopOffset.setValue(e?.loopOffset??this.loopOffset),s.loopDuration.setValue(e?.loopDuration??this.loopDuration),s.hue.setValue(this.hue),s.label.setValue(this.label),s.mute.setValue(this.mute),s.events.refer(i),s.regions.refer(e?.track??this.#r.regions.targetVertex.unwrap())}),r)}consolidate(){this.isMirrowed&&this.optCollection.ifSome(e=>{let t=this.#t.boxGraph,i=Fe.create(t,v.generate());e.events.asArray().forEach(s=>s.copyTo({events:i.events})),this.#r.events.refer(i.owners)})}canFlatten(e){return e.length>0&&M.satisfy(e,(t,i)=>t.trackBoxAdapter.contains(i.trackBoxAdapter.unwrap()))&&e.every(t=>t.isSelected&&t instanceof r)}flatten(e){if(!this.canFlatten(e))return h.None;let t=this.#t.boxGraph,i=e.toSorted(Ce.Comparator),s=M.getFirst(i,"Internal error (no first)"),n=M.getLast(i,"Internal error (no last)"),a=s.position,l=n.position+n.duration,d=s.trackBoxAdapter.unwrap(),c=Fe.create(t,v.generate()),F=Array.from(d.regions.collection.iterateRange(a,l));return F.filter(y=>y.isSelected).forEach(y=>{let A=y;for(let{resultStart:S,resultEnd:U,rawStart:$}of be.locateLoops(A,A.position,A.complete)){let Y=Math.floor(S-$),te=Math.floor(U-$);for(let X of A.optCollection.unwrap().events.iterateRange(Y,te))X.copyTo({position:X.position+$-s.position,events:c.events})}}),F.forEach(({box:y})=>y.delete()),h.wrap(Ge.create(t,v.generate(),y=>{y.position.setValue(a),y.duration.setValue(l-a),y.loopDuration.setValue(l-a),y.loopOffset.setValue(0),y.hue.setValue(this.hue),y.mute.setValue(this.mute),y.label.setValue(this.label),y.events.refer(c.owners),y.regions.refer(d.box.regions)}))}toString(){return`{NoteRegionBoxAdapter ${v.toString(this.#r.address.uuid)} p: ${j.toString(this.position)}, c: ${j.toString(this.complete)}}`}#o(){this.#i.notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange()}};var Ie=class r{type="value-region";#e=new R;#t;#r;#i;#s;#n;#a=P.Empty;constructor(e,t){this.#t=e,this.#r=t,this.#n=!0,this.#i=new K,this.#s=!1,this.#e.own(this.#r.pointerHub.subscribeImmediate({onAdd:()=>this.#o(),onRemove:()=>this.#o()})),this.#e.own(this.#r.subscribe(O.Children,i=>{if(!this.trackBoxAdapter.isEmpty()&&(i.type==="primitive"||i.type==="pointer")){let s=this.trackBoxAdapter.unwrap();this.#r.position.address.equals(i.address)?(s.regions.onIndexingChanged(),this.#o()):this.#o()}})),this.#e.own(this.#r.events.catchupAndSubscribe(({targetVertex:i})=>{this.#a.terminate(),this.#a=i.match({none:()=>P.Empty,some:({box:s})=>this.#t.boxAdapters.adapterFor(s,pe).subscribeChange(()=>this.#o())}),this.#o()})),this.#n=!1}valueAt(e,t){let i=this.optCollection;return i.isEmpty()?t:i.unwrap().valueAt(be.globalToLocal(this,e),t)}incomingValue(e){return this.valueAt(this.position,e)}outgoingValue(e){let t=this.optCollection;if(t.isEmpty())return e;let i=t.unwrap();return(this.complete-this.offset)%this.loopDuration===0?i.valueAt(this.loopDuration,e):i.valueAt(be.globalToLocal(this,this.complete),e)}subscribeChange(e){return this.#i.subscribe(e)}accept(e){return p(e.visitValueRegionBoxAdapter,this)}onSelected(){this.#s=!0,this.#o()}onDeselected(){this.#s=!1,this.#o()}get isSelected(){return this.#s}onValuesPropertyChanged(){this.#o()}onValuesSortingChanged(){this.onValuesPropertyChanged()}terminate(){this.#a.terminate(),this.#e.terminate()}get box(){return this.#r}get uuid(){return this.#r.address.uuid}get address(){return this.#r.address}get position(){return this.#r.position.getValue()}get duration(){return this.#r.duration.getValue()}get loopOffset(){return this.#r.loopOffset.getValue()}get loopDuration(){return this.#r.loopDuration.getValue()}get offset(){return this.position-this.loopOffset}get complete(){return this.position+this.duration}get mute(){return this.#r.mute.getValue()}get hue(){return this.#r.hue.getValue()}get hasCollection(){return!this.optCollection.isEmpty()}get events(){return this.optCollection.map(e=>e.events)}get optCollection(){return this.#r.events.targetVertex.map(e=>this.#t.boxAdapters.adapterFor(e.box,pe))}get label(){return this.#r.label.getValue()}get trackBoxAdapter(){return this.#n?h.None:this.#r.regions.targetVertex.map(e=>this.#t.boxAdapters.adapterFor(e.box,Q))}get isMirrowed(){return this.optCollection.mapOr(e=>e.numOwners>1,!1)}get canMirror(){return!0}copyTo(e){let t=this.optCollection.unwrap("Cannot make copy without event-collection"),i=e?.consolidate===!0?t.copy().box.owners:t.box.owners;return this.#t.boxAdapters.adapterFor(qe.create(this.#t.boxGraph,v.generate(),s=>{s.position.setValue(e?.position??this.position),s.duration.setValue(e?.duration??this.duration),s.loopOffset.setValue(e?.loopOffset??this.loopOffset),s.loopDuration.setValue(e?.loopDuration??this.loopDuration),s.hue.setValue(this.hue),s.label.setValue(this.label),s.mute.setValue(this.mute),s.events.refer(i),s.regions.refer(e?.track??this.#r.regions.targetVertex.unwrap())}),r)}consolidate(){this.isMirrowed&&this.events.ifSome(e=>{let t=this.#t.boxGraph,i=Ae.create(t,v.generate());e.asArray().forEach(s=>s.copyTo({events:i.events})),this.#r.events.refer(i.owners)})}canFlatten(e){return!1}flatten(e){if(!this.canFlatten(e))return h.None;let t=this.#t.boxGraph,i=e.toSorted(Ce.Comparator),s=M.getFirst(i,"Internal error (no first)"),n=M.getLast(i,"Internal error (no last)"),a=s.position,l=n.position+n.duration,d=s.trackBoxAdapter.unwrap(),c=Ae.create(t,v.generate()),F=Array.from(d.regions.collection.iterateRange(a,l));return F.filter(y=>y.isSelected).forEach(y=>{let A=y;for(let{resultStart:S,resultEnd:U,rawStart:$}of be.locateLoops(A,A.position,A.complete)){let Y=Math.floor(S-$),te=Math.floor(U-$);for(let X of A.events.unwrap().iterateRange(Y,te));}}),F.forEach(({box:y})=>y.delete()),h.wrap(qe.create(t,v.generate(),y=>{y.position.setValue(a),y.duration.setValue(l-a),y.loopDuration.setValue(l-a),y.loopOffset.setValue(0),y.hue.setValue(this.hue),y.mute.setValue(this.mute),y.label.setValue(this.label),y.events.refer(c.owners),y.regions.refer(d.box.regions)}))}toString(){return`{ValueRegionBoxAdapter ${v.toString(this.#r.address.uuid)} p: ${j.toString(this.position)}, c: ${j.toString(this.complete)}}`}#o(){this.#i.notify(),this.trackBoxAdapter.unwrapOrNull()?.regions?.dispatchChange()}};var Es=(r,e)=>r.position-e.position,Ms={for:(r,e)=>T(e.accept({visitNoteRegionBox:t=>r.adapterFor(t,$t),visitAudioRegionBox:t=>r.adapterFor(t,Lt),visitValueRegionBox:t=>r.adapterFor(t,Ie)}),"")};var ei=class{#e;#t;#r;#i;#s;constructor(e,t){this.#e=e,this.#t=new R,this.#r=this.#t.own(new K),this.#i=Ce.create(Es),this.#s=v.newSet(i=>i.uuid),this.#t.ownAll(this.#e.box.regions.pointerHub.catchupAndSubscribeTransactual({onAdd:({box:i})=>{let s=Ms.for(t,i),n=this.#s.add(s);E(n,`Cannot add ${i}`),this.#i.add(s),this.dispatchChange()},onRemove:({box:{address:{uuid:i}}})=>{this.#i.remove(this.#s.removeByKey(i)),this.dispatchChange()}},o.RegionCollection))}get trackBoxAdapter(){return this.#e}get collection(){return this.#i}get adapters(){return this.#s}onIndexingChanged(){this.#i.onIndexingChanged(),this.dispatchChange()}subscribeChanges(e){return this.#r.subscribe(e)}dispatchChange(){this.#r.notify()}terminate(){this.#t.terminate()}};var ee;(function(r){r[r.Rectangle=0]="Rectangle",r[r.Checkbox=1]="Checkbox",r[r.Panel=2]="Panel",r[r.MainMenu=3]="MainMenu",r[r.Dropdown=4]="Dropdown",r[r.AudioDevice=5]="AudioDevice",r[r.GuitarTab=6]="GuitarTab",r[r.Effects=7]="Effects",r[r.Flask=8]="Flask",r[r.Robot=9]="Robot",r[r.NotePad=10]="NotePad",r[r.Pencil=11]="Pencil",r[r.Waveform=12]="Waveform",r[r.Mix=13]="Mix",r[r.Adsr=14]="Adsr",r[r.Dial=15]="Dial",r[r.Record=16]="Record",r[r.Play=17]="Play",r[r.Stop=18]="Stop",r[r.Loop=19]="Loop",r[r.Timeline=20]="Timeline",r[r.Region=21]="Region",r[r.Box=22]="Box",r[r.Mixing=23]="Mixing",r[r.Vinyl=24]="Vinyl",r[r.Help=25]="Help",r[r.Metronome=26]="Metronome",r[r.System=27]="System",r[r.Add=28]="Add",r[r.Subtract=29]="Subtract",r[r.Peak=30]="Peak",r[r.LowPass=31]="LowPass",r[r.HighPass=32]="HighPass",r[r.LowShelf=33]="LowShelf",r[r.HighShelf=34]="HighShelf",r[r.RoundUp=35]="RoundUp",r[r.RoundDown=36]="RoundDown",r[r.Mute=37]="Mute",r[r.Solo=38]="Solo",r[r.Exclude=39]="Exclude",r[r.Menu=40]="Menu",r[r.Pointer=41]="Pointer",r[r.Eraser=42]="Eraser",r[r.Scissors=43]="Scissors",r[r.Tape=44]="Tape",r[r.CollapseDown=45]="CollapseDown",r[r.FileList=46]="FileList",r[r.Close=47]="Close",r[r.DragConnections=48]="DragConnections",r[r.Heart=49]="Heart",r[r.Merge=50]="Merge",r[r.SpeakerHeadphone=51]="SpeakerHeadphone",r[r.AudioBus=52]="AudioBus",r[r.DrumSet=53]="DrumSet",r[r.BassGuitar=54]="BassGuitar",r[r.Guitar=55]="Guitar",r[r.Saxophone=56]="Saxophone",r[r.Microphone=57]="Microphone",r[r.New=58]="New",r[r.Piano=59]="Piano",r[r.ExpandWidth=60]="ExpandWidth",r[r.OpenDAW=61]="OpenDAW",r[r.Automation=62]="Automation",r[r.Embed=63]="Embed",r[r.Popout=64]="Popout",r[r.Minimized=65]="Minimized",r[r.Maximized=66]="Maximized",r[r.Search=67]="Search",r[r.Generator=68]="Generator",r[r.Groove=69]="Groove",r[r.Table=70]="Table",r[r.Note=71]="Note",r[r.Exit=72]="Exit",r[r.Start=73]="Start",r[r.Duration=74]="Duration",r[r.Velocity=75]="Velocity",r[r.Random=76]="Random",r[r.Divide=77]="Divide",r[r.Curve=78]="Curve",r[r.Primary=79]="Primary",r[r.Clips=80]="Clips",r[r.NoAudio=81]="NoAudio",r[r.Unknown=82]="Unknown",r[r.UserFolder=83]="UserFolder",r[r.CloudFolder=84]="CloudFolder",r[r.Run=85]="Run",r[r.Insert=86]="Insert",r[r.ArrayDown=87]="ArrayDown",r[r.Sun=88]="Sun",r[r.Book=89]="Book",r[r.Stack=90]="Stack",r[r.EditBox=91]="EditBox",r[r.Delete=92]="Delete",r[r.Time=93]="Time",r[r.EQ=94]="EQ",r[r.Cube=95]="Cube",r[r.NanoWave=96]="NanoWave",r[r.Midi=97]="Midi",r[r.DinSlot=98]="DinSlot",r[r.VUMeter=99]="VUMeter",r[r.Playfield=100]="Playfield",r[r.Invert=101]="Invert",r[r.Headphone=102]="Headphone",r[r.Stereo=103]="Stereo",r[r.AutoGain=104]="AutoGain",r[r.AudioFile=105]="AudioFile",r[r.Tool=106]="Tool",r[r.Focus=107]="Focus",r[r.Swap=108]="Swap",r[r.Connected=109]="Connected",r[r.Disconnected=110]="Disconnected",r[r.Zeitgeist=111]="Zeitgeist"})(ee||(ee={}));(function(r){r.toName=e=>r[e],r.fromName=e=>r[e]??r.Rectangle})(ee||(ee={}));var G;(function(r){r[r.Undefined=0]="Undefined",r[r.Notes=1]="Notes",r[r.Audio=2]="Audio",r[r.Value=3]="Value"})(G||(G={}));(function(r){r.toLabelString=e=>{switch(e){case r.Audio:return"Audio";case r.Notes:return"Notes";case r.Value:return"Automation";case r.Undefined:default:return"N/A"}},r.toIconSymbol=e=>{switch(e){case r.Audio:return ee.Waveform;case r.Notes:return ee.Piano;case r.Value:return ee.Automation;case r.Undefined:return ee.AudioBus;default:return ee.Unknown}}})(G||(G={}));var Rs;(function(r){r.toTrackType=e=>{switch(e){case"midi":return G.Notes;case"audio":return G.Audio;default:return b()}}})(Rs||(Rs={}));var H;(function(r){r.isAny=e=>e!==null&&typeof e=="object"&&"type"in e&&(e.type==="midi-effect"||e.type==="bus"||e.type==="instrument"||e.type==="audio-effect"),r.isEffect=e=>e!==null&&typeof e=="object"&&"type"in e&&(e.type==="midi-effect"||e.type==="audio-effect"),r.isInstrument=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="instrument",r.isMidiEffect=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="midi-effect",r.isAudioEffect=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="audio-effect",r.isHost=e=>e!==null&&typeof e=="object"&&"class"in e&&e.class==="device-host",r.fetchEffectIndex=e=>T(e.accept({visitArpeggioDeviceBox:t=>t.index,visitPitchDeviceBox:t=>t.index,visitStereoToolDeviceBox:t=>t.index,visitDelayDeviceBox:t=>t.index,visitModularDeviceBox:t=>t.index,visitRevampDeviceBox:t=>t.index,visitReverbDeviceBox:t=>t.index,visitZeitgeistDeviceBox:t=>t.index}),`No index-field found for ${e}`),r.deleteEffectDevices=e=>{if(e.length===0)return;E(M.satisfy(e,(s,n)=>s.deviceHost().address.equals(n.deviceHost().address)),"Devices are not connected to the same host");let t=e[0];(t.accepts==="audio"?t.deviceHost().audioEffects.field().pointerHub.filter(o.AudioEffectHost):t.accepts==="midi"?t.deviceHost().midiEffects.field().pointerHub.filter(o.MidiEffectHost):b("unknown type")).map(({box:s})=>r.fetchEffectIndex(s)).filter(s=>e.some(n=>v.Comparator(n.uuid,s.address.uuid)!==0)).sort((s,n)=>s.getValue()-n.getValue()).forEach((s,n)=>s.setValue(n)),e.forEach(s=>s.box.delete())}})(H||(H={}));var ti=class{#e;#t=new K;#r;#i;#s;constructor(e,t){this.#e=e,this.#r=ue.create(e.box.tracks,i=>t.adapterFor(i,Q),o.TrackCollection),this.#i=v.newSet(({uuid:i})=>i),this.#s=this.#r.catchupAndSubscribe({onAdd:i=>this.#i.add({uuid:i.uuid,subscription:i.regions.subscribeChanges(()=>this.#t.notify())}),onRemove:({uuid:i})=>this.#i.removeByKey(i).subscription.terminate(),onReorder:i=>{}})}create(e,t,i){let s=this.#e.box.graph,n=this.#e.box.tracks;ut.create(s,v.generate(),a=>{a.index.setValue(i??this.#r.getMinFreeIndex()),a.type.setValue(e),a.tracks.refer(n),a.target.refer(t)})}controls(e){return h.wrap(this.#r.adapters().find(t=>t.target.targetVertex.contains(e),!1))}delete(e){let t=this.#r.adapters(),i=t.indexOf(e);if(i===-1)return b(`Cannot delete ${e}. Does not exist.`);for(let s=i+1;s<t.length;s++)t[s].indexField.setValue(s-1);e.box.delete()}get collection(){return this.#r}values(){return this.#r.adapters()}catchupAndSubscribe(e){return this.#r.catchupAndSubscribe(e)}subscribeAnyChange(e){return this.#t.subscribe(e)}terminate(){this.#r.terminate(),this.#s.terminate(),this.#i.forEach(({subscription:e})=>e.terminate()),this.#i.clear()}};var me=class{type="bus";accepts="audio";#e;#t;constructor(e,t){this.#e=e,this.#t=t}catchupAndSubscribe(e){return e(this),this.#t.subscribe(O.Children,()=>e(this))}get uuid(){return this.#t.address.uuid}get address(){return this.#t.address}get box(){return this.#t}get enabledField(){return this.#t.enabled}get minimizedField(){return this.#t.minimized}get iconField(){return this.#t.icon}get labelField(){return this.#t.label}get colorField(){return this.#t.color}get iconSymbol(){return ee.fromName(this.iconField.getValue()??"audio-bus")}deviceHost(){return this.#e.boxAdapters.adapterFor(this.#t.output.targetVertex.unwrap("No AudioUnitBox found").box,H.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){}toString(){return`{${this.constructor.name}}`}};var ri=class{#e;#t;#r;#i;#s=P.Empty;constructor(e,t){this.#e=new R,this.#t=this.#e.own(new K),this.#r=this.#e.own(new le(ee.Unknown)),this.#i=this.#e.own(new le(h.None)),this.#e.own(this.#i.subscribe(i=>{this.#s.terminate(),this.#s=i.getValue().match({none:()=>(this.#t.notify(h.None),P.Empty),some:({labelField:s,iconField:n})=>P.many(n.catchupAndSubscribe(a=>this.#r.setValue(ee.fromName(a.getValue()))),s.catchupAndSubscribe(a=>this.#t.notify(h.wrap(a.getValue()))))})})),this.#e.own(e.catchupAndSubscribeTransactual({onAdd:({box:i})=>{E(this.#i.getValue().isEmpty(),"Already set");let s=i instanceof ft?t.adapterFor(i,me):t.adapterFor(i,H.isInstrument);this.#i.getValue().unwrapOrNull()!==s&&this.#i.setValue(h.wrap(s))},onRemove:({box:i})=>{E(this.#i.getValue().unwrap("Cannot remove").box.address.equals(i.address),"Unexpected value to remove"),this.#i.setValue(h.None)}},o.InstrumentHost,o.AudioOutput))}getValue(){return this.#i.getValue()}subscribe(e){return this.#i.subscribe(e)}catchupAndSubscribe(e){return e(this.#i),this.subscribe(e)}catchupAndSubscribeLabelChange(e){return e(this.label),this.#t.subscribe(e)}catchupAndSubscribeIconChange(e){return this.#r.catchupAndSubscribe(e)}set label(e){this.getValue().ifSome(t=>t.labelField.setValue(e))}get label(){return this.getValue().map(e=>e.labelField.getValue())}set icon(e){this.getValue().ifSome(t=>t.iconField.setValue(ee.toName(e)))}get icon(){return this.getValue().match({none:()=>ee.Unknown,some:e=>ee.fromName(e.iconField.getValue())})}get iconValue(){return this.#r}terminate(){this.#e.terminate(),this.#s.terminate()}};var _=class{#e;#t;constructor(e){this.#e=e,this.#t=new Me(t=>t.address.fieldKeys,ki)}terminate(){this.#t.forEach(e=>e.terminate()),this.#t.clear()}parameters(){return this.#t.values()}parameterAt(e){return this.#t.getOrThrow(e,()=>new Error(`No ParameterAdapter found at [${e}]`))}createParameter(e,t,i,s,n){let a=new Qe(this.#e,e,t,i,s,n),l=this.#t.add(a);return E(l,`Could not add adapter for ${e}`),a}removeParameter(e){this.#t.removeByValue(e)}};var Ht=class{#e;#t;#r;#i;#s;#n;#a=P.Empty;constructor(e,t){this.#e=e,this.#t=t,this.#r=new R,this.#i=this.#r.own(new K),this.#r.own(t.targetBus.catchupAndSubscribe(()=>{this.#a.terminate(),this.#a=this.optTargetBus.match({none:()=>(this.#i.notify(h.None),P.Empty),some:i=>i.catchupAndSubscribe(s=>this.#i.notify(h.wrap(s)))})})),this.#s=this.#r.own(new Qe(this.#e,this.#t.sendPan,C.bipolar(),D.percent({unit:"%",fractionDigits:0}),"panning")),this.#n=this.#r.own(new Qe(this.#e,this.#t.sendGain,C.DefaultDecibel,D.numeric({unit:"dB",fractionDigits:1}),"gain"))}catchupAndSubscribeBusChanges(e){return e(this.optTargetBus),this.#i.subscribe(e)}get uuid(){return this.#t.address.uuid}get address(){return this.#t.address}get box(){return this.#t}get indexField(){return this.#t.index}get sendPan(){return this.#s}get sendGain(){return this.#n}get targetBus(){return this.#e.boxAdapters.adapterFor(this.#t.targetBus.targetVertex.unwrap("no audioUnit").box,me)}get optTargetBus(){return this.#t.targetBus.targetVertex.flatMap(e=>h.wrap(e.box.accept({visitAudioBusBox:t=>this.#e.boxAdapters.adapterFor(t,me)})))}delete(){this.#t.delete()}terminate(){this.#r.terminate(),this.#a.terminate()}};var ii=class{#e;#t;#r;#i;#s=P.Empty;constructor(e,t){this.#e=e,this.#t=t,this.#r=new R,this.#i=this.#r.own(new K),this.#r.own(e.catchupAndSubscribe(()=>{this.#s.terminate(),this.#s=this.adapter.match({none:()=>(this.#i.notify(h.None),P.Empty),some:i=>i.catchupAndSubscribe(s=>this.#i.notify(h.wrap(s)))})}))}subscribe(e){return this.#i.subscribe(e)}catchupAndSubscribe(e){return e(this.adapter),this.subscribe(e)}get adapter(){return this.#e.targetVertex.flatMap(e=>h.wrap(e.box.accept({visitAudioBusBox:t=>this.#t.adapterFor(t,me)})))}terminate(){this.#r.terminate(),this.#s.terminate()}};var xt=class{class="device-host";#e=new R;#t;#r;#i;#s;#n;#a;#o;#l;#u;namedParameter;constructor(e,t){this.#t=e,this.#r=t,this.#i=this.#e.own(new _(this.#t)),this.#s=this.#e.own(new ti(this,this.#t.boxAdapters)),this.#n=this.#e.own(new ri(this.#r.input.pointerHub,this.#t.boxAdapters)),this.#a=this.#e.own(ue.create(this.#r.midiEffects,i=>this.#t.boxAdapters.adapterFor(i,H.isMidiEffect),o.MidiEffectHost)),this.#o=this.#e.own(ue.create(this.#r.audioEffects,i=>this.#t.boxAdapters.adapterFor(i,H.isAudioEffect),o.AudioEffectHost)),this.#l=this.#e.own(ue.create(this.#r.auxSends,i=>this.#t.boxAdapters.adapterFor(i,Ht),o.AuxSend)),this.#u=this.#e.own(new ii(this.#r.output,this.#t.boxAdapters)),this.namedParameter=this.#d(t)}get box(){return this.#r}get uuid(){return this.#r.address.uuid}get address(){return this.#r.address}get indexField(){return this.#r.index}get type(){return this.#r.type.getValue()}get tracks(){return this.#s}get input(){return this.#n}get midiEffects(){return this.#a}get audioEffects(){return this.#o}get inputAdapter(){return this.#n.getValue()}get auxSends(){return this.#l}get output(){return this.#u}get isBus(){return this.input.getValue().mapOr(e=>e.type==="bus",!1)}get isInstrument(){return this.input.getValue().mapOr(e=>e.type==="instrument",!1)}get isOutput(){return this.#r.output.targetVertex.mapOr(e=>e.box.address.equals(this.#t.rootBoxAdapter.address),!1)}get midiEffectsField(){return this.#r.midiEffects}get inputField(){return this.#r.input}get audioEffectsField(){return this.#r.audioEffects}get tracksField(){return this.#r.tracks}get minimizedField(){return this.#n.getValue().unwrap().minimizedField}get isAudioUnit(){return!0}get label(){return this.#n.getValue().mapOr(e=>e.labelField.getValue(),"")}audioUnitBoxAdapter(){return this}indicesLimit(){let e=this.#t.rootBoxAdapter.audioUnits.adapters(),t=this.indexField.getValue(),i=this.type,s=t,n=t;for(;s>0&&e[s-1].type===i;)s--;for(;n<e.length-1&&e[n+1].type===i;)n++;return[s,n+1]}move(e){this.#t.rootBoxAdapter.audioUnits.move(this,e)}moveTrack(e,t){this.#s.collection.move(e,t)}deleteTrack(e){this.#s.delete(e)}toString(){return`{${this.constructor.name}}`}terminate(){this.#e.terminate()}#d(e){return{volume:this.#i.createParameter(e.volume,C.decibel(-96,-9,6),D.decible,"volume"),panning:this.#i.createParameter(e.panning,C.bipolar(),D.panning,"panning",.5),mute:this.#i.createParameter(e.mute,C.bool,D.bool,"mute"),solo:this.#i.createParameter(e.solo,C.bool,D.bool,"solo")}}};var Cs=j.fromSignature(1,384);var Q=class{#e;#t;#r;#i;#s;#n;constructor(e,t){this.#e=e,this.#t=t,this.#r=new R,this.#i=this.#r.own(new Jr(this,e.boxAdapters)),this.#s=this.#r.own(new ei(this,e.boxAdapters)),this.#n=this.#r.own(new le(-1))}catchupAndSubscribePath(e){let t=[h.None,h.None],i=()=>{t.every(s=>s.nonEmpty())?e(h.wrap(t.map(s=>s.unwrap()))):e(h.None)};return P.many(this.#a(s=>{t[0].equals(s)||(t[0]=s,i())}),this.#o(s=>{t[1].equals(s)||(t[1]=s,i())}))}#a(e){let t=this.#t.target.targetVertex;if(t.nonEmpty()){let i=t.unwrap().box;return i instanceof je?this.#e.boxAdapters.adapterFor(i,xt).input.catchupAndSubscribeLabelChange(n=>e(n)):"label"in i&&i.label instanceof B?i.label.catchupAndSubscribe(s=>e(h.wrap(s.getValue()))):(e(h.wrap(i.name)),P.Empty)}return e(h.None),P.Empty}#o(e){let t=this.type;switch(t){case G.Audio:case G.Notes:return e(h.wrap(G[t])),P.Empty;case G.Value:{let i=this.#t.target.targetVertex.unwrap();if(i.isField())e(this.#e.parameterFieldAdapters.opt(i.address).map(s=>s.name));else if(i.isBox())e(h.wrap(i.name));else return b("Illegal State. Vertex is not a field nor box.");return P.Empty}case G.Undefined:return e(h.wrap("")),P.Empty;default:return e(h.None),P.Empty}}terminate(){this.#r.terminate()}get audioUnit(){return ui(this.#t.tracks.targetVertex.unwrap().box,je)}get target(){return this.#t.target}get clips(){return this.#i}get regions(){return this.#s}get enabled(){return this.#t.enabled}get indexField(){return this.#t.index}get type(){return this.#t.type.getValue()}get box(){return this.#t}get uuid(){return this.#t.address.uuid}get address(){return this.#t.address}get listIndex(){return this.#n.getValue()}set listIndex(e){this.#n.setValue(e)}accepts(e){switch(e.type){case"audio-clip":return this.type===G.Audio;case"note-clip":return this.type===G.Notes;case"value-clip":return this.type===G.Value;case"audio-region":return this.type===G.Audio;case"note-region":return this.type===G.Notes;case"value-region":return this.type===G.Value}}valueAt(e,t){if(!this.enabled.getValue())return t;let i=t,s=this.#e.clipSequencing.iterate(this.uuid,e,e+Cs);for(let{optClip:n,sectionFrom:a}of s)i=n.match({none:()=>{let l=this.regions.collection.lowerEqual(e,d=>!d.mute);if(l===null){let d=this.regions.collection.optAt(0);return Ze(d,Ie)?d.incomingValue(t):t}else if(Ze(l,Ie))return e<l.complete?l.valueAt(e,t):l.outgoingValue(t);return t},some:l=>a===e&&Ze(l,We)?l.valueAt(e,t):t});return i}};var Vs=[o.Automation,o.Modulation,o.MidiControl,o.ParameterController],Qe=class{#e;#t;#r;#i;#s;#n;#a=new R;#o;#l;#u=h.None;#d=h.None;#h=null;#c=!1;constructor(e,t,i,s,n,a){this.#e=e,this.#t=t,this.#r=i,this.#i=s,this.#s=n,this.#n=a??0,this.#a.own(this.#e.parameterFieldAdapters.register(this)),this.#o=this.#a.own(new K),this.#l=new J,this.#a.own(this.#t.subscribe(()=>this.#o.notify(this))),this.#a.own(this.#t.pointerHub.catchupAndSubscribeTransactual({onAdd:l=>{this.#l.proxy.onControlSourceAdd(Ci(l.pointerType)),l.box.accept({visitTrackBox:d=>{E(this.#u.isEmpty(),"Already assigned");let c=this.#e.boxAdapters.adapterFor(d,Q);this.#u=h.wrap(c),this.#e.isMainThread&&(this.#d=h.wrap(this.#e.liveStreamReceiver.subscribeFloat(this.#t.address,F=>{this.#h!==F&&(this.#h=F,this.#o.notify(this))})))}})},onRemove:l=>{this.#l.proxy.onControlSourceRemove(Ci(l.pointerType)),l.box.accept({visitTrackBox:d=>{E(this.#u.unwrapOrNull()?.address?.equals(d.address)===!0,`Unknown ${d}`),this.#u=h.None,this.#e.isMainThread&&(this.#d.ifSome(c=>c.terminate()),this.#d=h.None,this.#h=null,this.#o.notify(this))}})}},...Vs)),t.getValue()!==i.clamp(t.getValue())&&console.warn(`${n} (${t.getValue()}) is out of bounds`,i)}registerMidiControl(){return this.#l.proxy.onControlSourceAdd("midi"),this.#c=!0,{terminate:()=>{this.#c=!1,this.#l.proxy.onControlSourceRemove("midi")}}}get field(){return this.#t}get valueMapping(){return this.#r}get stringMapping(){return this.#i}get name(){return this.#s}get anchor(){return this.#n}get type(){return this.#t.type}get address(){return this.#t.address}get track(){return this.#u}valueAt(e){let t=this.#u;if(t.nonEmpty()){let i=t.unwrap();if(i.enabled)return this.valueMapping.y(i.valueAt(e,this.getUnitValue()))}return this.getValue()}subscribe(e){return this.#o.subscribe(e)}catchupAndSubscribe(e){return e(this),this.subscribe(e)}catchupAndSubscribeControlSources(e){return this.#c&&e.onControlSourceAdd("midi"),this.#t.pointerHub.filter(...Vs).forEach(t=>e.onControlSourceAdd(Ci(t.pointerType))),this.#l.subscribe(e)}getValue(){return this.#t.getValue()}setValue(e){this.#t.setValue(e)}setUnitValue(e){this.setValue(this.#r.y(e))}getUnitValue(){return this.#r.x(this.getValue())}getControlledValue(){return this.#r.y(this.getControlledUnitValue())}getControlledUnitValue(){return this.#h??this.getUnitValue()}getControlledPrintValue(){return this.#i.x(this.getControlledValue())}getPrintValue(){return this.#i.x(this.getValue())}setPrintValue(e){let t=this.#i.y(e);t.type==="unitValue"?this.setUnitValue(I(t.value,0,1)):t.type==="explicit"?this.setValue(this.valueMapping.clamp(t.value)):console.debug(`Unknown text input: '${t.value}'`)}reset(){this.setValue(this.#r.clamp(this.#t.initValue))}terminate(){this.#d.ifSome(e=>e.terminate()),this.#d=h.None,this.#a.terminate()}},Ci=r=>{switch(r){case o.Automation:return"automated";case o.Modulation:return"modulated";case o.MidiControl:return"midi";case o.ParameterController:return"external";default:return b(`${r.toString()} is an unknown pointer type`)}};var Vi=class r{static OffsetFractions=at.builder().add([1,1]).add([1,2]).add([1,3]).add([1,4]).add([3,16]).add([1,6]).add([1,8]).add([3,32]).add([1,12]).add([1,16]).add([3,64]).add([1,24]).add([1,32]).add([1,48]).add([1,64]).add([1,96]).add([1,128]).asDescendingArray();static OffsetStringMapping=D.indices("",this.OffsetFractions.map(([e,t])=>`${e}/${t}`));type="audio-effect";accepts="audio";#e;#t;#r;namedParameter;constructor(e,t){this.#e=e,this.#t=t,this.#r=new _(this.#e),this.namedParameter=this.#i(t)}get box(){return this.#t}get uuid(){return this.#t.address.uuid}get address(){return this.#t.address}get indexField(){return this.#t.index}get labelField(){return this.#t.label}get enabledField(){return this.#t.enabled}get minimizedField(){return this.#t.minimized}get host(){return this.#t.host}deviceHost(){return this.#e.boxAdapters.adapterFor(this.#t.host.targetVertex.unwrap("no device-host").box,H.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){this.#r.terminate()}#i(e){return{delay:this.#r.createParameter(e.delay,C.linearInteger(0,r.OffsetFractions.length-1),r.OffsetStringMapping,"delay"),feedback:this.#r.createParameter(e.feedback,C.unipolar(),D.numeric({unit:"%",fractionDigits:0}),"feedback"),cross:this.#r.createParameter(e.cross,C.unipolar(),D.numeric({unit:"%",fractionDigits:0}),"cross"),filter:this.#r.createParameter(e.filter,C.bipolar(),D.numeric({unit:"%",fractionDigits:0}),"filter",.5),dry:this.#r.createParameter(e.dry,C.DefaultDecibel,D.numeric({unit:"db",fractionDigits:1}),"dry"),wet:this.#r.createParameter(e.wet,C.DefaultDecibel,D.numeric({unit:"db",fractionDigits:1}),"wet")}}};var q1=C.exponential(20,2e4),j1=C.linear(-24,24),_1=C.exponential(.01,10);var Ye=class{#e;constructor(e,t){this.#e=t}get box(){return this.#e}get uuid(){return this.#e.address.uuid}get address(){return this.#e.address}get source(){return this.#e.source.targetVertex.unwrap("Insufficient Vertex")}get target(){return this.#e.target.targetVertex.unwrap("Insufficient Vertex")}terminate(){}};var ce=class{#e;#t;#r;#i;#s;#n=!1;constructor(e,t){this.#e=e,this.#t=t,this.#r=new R,this.#i=t.attributes,this.#s=this.#r.own(new _(e))}get inputs(){throw new Error("Method not implemented.")}get outputs(){throw new Error("Method not implemented.")}own(e){return this.#r.own(e)}ownAll(...e){this.#r.ownAll(...e)}onSelected(){this.#n=!0}onDeselected(){this.#n=!1}isSelected(){return this.#n}get box(){return this.#t}get attributes(){return this.#i}get uuid(){return this.#t.address.uuid}get address(){return this.#t.address}get parameters(){return this.#s}get modular(){return this.#e.boxAdapters.adapterFor(this.#t.attributes.collection.targetVertex.unwrap().box,Xe)}terminate(){this.#r.terminate()}};var se;(function(r){r.Input="input",r.Output="output"})(se||(se={}));var ne=class r{static create(e,t,i,s){return new r(e,t,i,s??t.fieldName)}#e;#t;#r;#i;constructor(e,t,i,s){this.#e=e,this.#t=t,this.#r=i,this.#i=s}matches(e){return this.direction!==e.direction&&this.field.pointerRules.accepts.some(t=>e.field.pointerRules.accepts.some(i=>i===t))}get connections(){return this.#t.pointerHub.isEmpty()?M.empty():this.#t.pointerHub.filter(o.VoltageConnection).map(({box:e})=>this.#e.adapterFor(e,Ye))}get field(){return this.#t}get address(){return this.#t.address}get direction(){return this.#r}get name(){return this.#i}toString(){return`{ModuleConnectorAdapter address: ${this.#t.address.toString()}, direction: ${this.#r}}`}};var Gt=class extends ce{#e;#t;#r;constructor(e,t){super(e,t),this.#e=this.parameters.createParameter(t.time,C.exponential(1,1e4),D.numeric({unit:"ms"}),"Time"),this.#t=ne.create(e.boxAdapters,t.voltageInput,se.Input,"Input"),this.#r=ne.create(e.boxAdapters,t.voltageOutput,se.Output,"Output")}get parameterTime(){return this.#e}get voltageInput(){return this.#t}get voltageOutput(){return this.#r}get inputs(){return[this.#t]}get outputs(){return[this.#r]}};var qt=class extends ce{#e;constructor(e,t){super(e,t),this.#e=ne.create(e.boxAdapters,t.input,se.Input,"Input")}get voltageInput(){return this.#e}get inputs(){return[this.#e]}get outputs(){return M.empty()}};var jt=class extends ce{#e;#t;#r;constructor(e,t){super(e,t),this.#e=this.parameters.createParameter(t.gain,C.DefaultDecibel,D.numeric({unit:"db"}),"Gain"),this.#t=ne.create(e.boxAdapters,t.voltageInput,se.Input,"Input"),this.#r=ne.create(e.boxAdapters,t.voltageOutput,se.Output,"Output")}get parameterGain(){return this.#e}get voltageInput(){return this.#t}get voltageOutput(){return this.#r}get inputs(){return[this.#t]}get outputs(){return[this.#r]}};var _t=class extends ce{#e;#t;#r;constructor(e,t){super(e,t),this.#e=ne.create(e.boxAdapters,t.voltageInputX,se.Input,"X"),this.#t=ne.create(e.boxAdapters,t.voltageInputY,se.Input,"Y"),this.#r=ne.create(e.boxAdapters,t.voltageOutput,se.Output,"Result")}get inputs(){return[this.#e,this.#t]}get outputs(){return[this.#r]}};var Wt=class extends ce{#e;constructor(e,t){super(e,t),this.#e=ne.create(e.boxAdapters,t.output,se.Output,"Output")}get voltageOutput(){return this.#e}get inputs(){return M.empty()}get outputs(){return[this.#e]}};var yt;(function(r){r.isVertexOfModule=e=>e.box.accept({visitModuleGainBox:()=>!0,visitModuleDelayBox:()=>!0,visitModuleMultiplierBox:()=>!0,visitModularAudioInputBox:()=>!0,visitModularAudioOutputBox:()=>!0})??!1,r.adapterFor=(e,t)=>T(t.accept({visitModuleGainBox:i=>e.adapterFor(i,jt),visitModuleDelayBox:i=>e.adapterFor(i,Gt),visitModuleMultiplierBox:i=>e.adapterFor(i,_t),visitModularAudioInputBox:i=>e.adapterFor(i,Wt),visitModularAudioOutputBox:i=>e.adapterFor(i,qt)}),`Could not find ModuleAdapter for ${t.name}`)})(yt||(yt={}));var Qt=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}get box(){return this.#t}get uuid(){return this.#t.address.uuid}get address(){return this.#t.address}get moduleAdapter(){return yt.adapterFor(this.#e.boxAdapters,this.#r.box)}get parameterAdapter(){return this.moduleAdapter.parameters.parameterAt(this.#r.address.fieldKeys)}get#r(){return this.#t.parameter.targetVertex.unwrap("Parameter not assigned")}terminate(){}};var Yt=class{type="audio-effect";accepts="audio";#e;#t;constructor(e,t){this.#e=e,this.#t=t}get box(){return this.#t}get uuid(){return this.#t.address.uuid}get address(){return this.#t.address}get indexField(){return this.#t.index}get labelField(){return this.#t.label}get enabledField(){return this.#t.enabled}get minimizedField(){return this.#t.minimized}get host(){return this.#t.host}parameterAt(e){return b("Not yet implemented")}deviceHost(){return this.#e.boxAdapters.adapterFor(this.#t.host.targetVertex.unwrap("no device-host").box,H.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}modular(){return this.#e.boxAdapters.adapterFor(this.#t.modularSetup.targetVertex.unwrap("No Modular found").box,Xe)}elements(){return this.#t.userInterface.elements.pointerHub.filter(o.DeviceUserInterface).map(e=>this.#e.boxAdapters.adapterFor(e.box,Qt))}terminate(){}};var Xe=class{#e=new R;#t;#r;#i;#s;#n;constructor(e,t){this.#r=e,this.#i=t,this.#t=this.#e.own(new J),this.#s=v.newSet(l=>l.uuid),this.#n=v.newSet(l=>l.uuid);let i=l=>{let d=yt.adapterFor(this.#r.boxAdapters,l.box);this.#s.add(d)&&this.#t.proxy.onModuleAdded(d)},s=l=>this.#t.proxy.onModuleRemoved(this.#s.removeByKey(l.address.uuid)),n=l=>{let d=this.#r.boxAdapters.adapterFor(l.box,Ye);this.#n.add(d)&&this.#t.proxy.onConnectionAdded(d)},a=l=>this.#t.proxy.onConnectionRemoved(this.#n.removeByKey(l.address.uuid));this.#i.modules.pointerHub.filter(o.ModuleCollection).forEach(i),this.#i.connections.pointerHub.filter(o.ConnectionCollection).forEach(n),this.#e.own(this.#i.modules.pointerHub.subscribeTransactual({onAdd:i,onRemove:s},o.ModuleCollection)),this.#e.own(this.#i.connections.pointerHub.subscribeTransactual({onAdd:n,onRemove:a},o.ConnectionCollection))}catchupAndSubscribe(e){return li(e.onModuleAdded,t=>this.#s.forEach(i=>t(i))),li(e.onConnectionAdded,t=>this.#n.forEach(i=>t(i))),this.#t.subscribe(e)}get box(){return this.#i}get address(){return this.#i.address}get uuid(){return this.#i.address.uuid}get editingField(){return this.#i.editing}get labelField(){return this.#i.label}get modules(){return this.#s.values()}get connections(){return this.#n.values()}get device(){return this.#r.boxAdapters.adapterFor(T(this.#i.device.pointerHub.incoming().at(0),"No device found").box,Yt)}terminate(){console.debug(`terminate ${this}`),this.#e.terminate()}};var si=class r{static Durations=[[1,8],[1,4],[1,4],[1,2],[1,1],[2,1],[4,1],[8,1],[16,1]];static DurationPPQNs=r.Durations.map(([e,t])=>j.fromSignature(e,t));static DurationStrings=r.Durations.map(([e,t])=>`${e}/${t}`);type="groove-adapter";#e=new R;#t;#r;#i;namedParameter;#s=new pr({duration:()=>this.#a,fx:e=>mi(e,this.#n),fy:e=>mi(e,1-this.#n)});#n=0;#a=j.SemiQuaver*2;constructor(e,t){this.#t=e,this.#r=t,this.#i=this.#e.own(new _(this.#t)),this.namedParameter=this.#o(t),this.#e.ownAll(this.namedParameter.duration.catchupAndSubscribe(i=>this.#a=i.getValue()),this.namedParameter.amount.catchupAndSubscribe(i=>this.#n=Ui(i.getValue(),.01)))}unwarp(e){return this.#s.unwarp(e)}warp(e){return this.#s.warp(e)}get box(){return this.#r}get uuid(){return this.#r.address.uuid}get address(){return this.#r.address}parameterAt(e){return this.#i.parameterAt(e)}terminate(){this.#e.terminate()}#o(e){return{duration:this.#i.createParameter(e.duration,C.values(r.DurationPPQNs),D.values("",r.DurationPPQNs,r.DurationStrings),"duration"),amount:this.#i.createParameter(e.amount,C.unipolar(),D.percent({fractionDigits:0}),"amount")}}};var Pi=class r{static RateFractions=at.builder().add([1,1]).add([1,2]).add([1,3]).add([1,4]).add([3,16]).add([1,6]).add([1,8]).add([3,32]).add([1,12]).add([1,16]).add([3,64]).add([1,24]).add([1,32]).add([1,48]).add([1,64]).add([1,96]).add([1,128]).asDescendingArray();static RateStringMapping=D.indices("",this.RateFractions.map(([e,t])=>`${e}/${t}`));type="midi-effect";accepts="midi";#e;#t;#r;namedParameter;constructor(e,t){this.#e=e,this.#t=t,this.#r=new _(this.#e),this.namedParameter=this.#i(t)}get box(){return this.#t}get uuid(){return this.#t.address.uuid}get address(){return this.#t.address}get indexField(){return this.#t.index}get labelField(){return this.#t.label}get enabledField(){return this.#t.enabled}get minimizedField(){return this.#t.minimized}get host(){return this.#t.host}parameterAt(e){return this.#r.parameterAt(e)}deviceHost(){return this.#e.boxAdapters.adapterFor(this.#t.host.targetVertex.unwrap("no device-host").box,H.isHost)}audioUnitBoxAdapter(){return this.deviceHost().audioUnitBoxAdapter()}terminate(){this.#r.terminate()}#i(e){return{modeIndex:this.#r.createParameter(e.modeIndex,C.linearInteger(0,2),D.indices("",["Up","Down","UpDown"]),"mode"),numOctaves:this.#r.createParameter(e.numOctaves,C.linearInteger(1,5),D.numeric({unit:"",fractionDigits:0}),"Octaves"),rate:this.#r.createParameter(e.rateIndex,C.linearInteger(0,r.RateFractions.length-1),r.RateStringMapping,"Rate"),gate:this.#r.createParameter(e.gate,C.linear(0,2),D.percent({fractionDigits:0}),"Gate"),repeat:this.#r.createParameter(e.repeat,C.linearInteger(1,16),D.numeric({fractionDigits:0}),"Repeat"),velocity:this.#r.createParameter(e.velocity,C.bipolar(),D.percent({fractionDigits:0,bipolar:!1}),"Velocity")}}};var Si;(function(r){r.checkType=e=>e!==null&&typeof e=="object"&&"type"in e&&e.type==="groove-adapter"})(Si||(Si={}));var Ss;(function(r){r.countStems=e=>e.match({none:()=>1,some:t=>Object.keys(t).length}),r.sanitizeFileName=e=>e.replace(/[<>:"/\\|?*\x00-\x1F]/g,"_").trim(),r.sanitizeExportNamesInPlace=e=>{let t=new Map,i=s=>{let n=t.get(s)??0,a=s;for(;t.has(a);)n++,a=`${s} ${n}`;return t.set(s,n),t.set(a,1),a};Object.keys(e).forEach(s=>{let n=e[s];n.fileName=i(r.sanitizeFileName(n.fileName))})}})(Ss||(Ss={}));var yF=st.createBuilder({position:st.float,clipIndex:st.int16});var Ds;(function(r){r.start=(e,t,i=1)=>{let s=!0;return e.noteOn(t,i),{terminate:()=>{s&&(e.noteOff(t),s=!1)}}}})(Ds||(Ds={}));var Ks;(function(r){r.MAGIC_HEADER_OPEN=1330660686,r.FORMAT_VERSION=2,r.decode=t=>{let i=new ie(t);E(i.readInt()===r.MAGIC_HEADER_OPEN,"Corrupt header. Probably not an openDAW project file."),E(i.readInt()===r.FORMAT_VERSION,"Deprecated Format");let s=i.readInt(),n=new Int8Array(s);i.readBytes(n);let a=new ar(h.wrap(gr.create));return a.fromArrayBuffer(n.buffer),{boxGraph:a,mandatoryBoxes:e(a,i)}};let e=(t,i)=>{let s=t.findBox(v.fromDataInput(i)).unwrap("RootBox not found"),n=t.findBox(v.fromDataInput(i)).unwrap("UserInterfaceBox not found"),a=t.findBox(v.fromDataInput(i)).unwrap("AudioBusBox not found"),l=t.findBox(v.fromDataInput(i)).unwrap("AudioUnitBox not found"),d=t.findBox(v.fromDataInput(i)).unwrap("TimelineBox not found");return{rootBox:s,userInterfaceBox:n,masterBusBox:a,masterAudioUnit:l,timelineBox:d}}})(Ks||(Ks={}));var ni;(function(r){r.reader=({sab:e,numChunks:t,numChannels:i,bufferSize:s},n)=>{let a=!0,l=new Int32Array(e,0,2),d=new Float32Array(e,8),c=new Float32Array(i*s),F=typeof document>"u",y=()=>{if(!a)return;let A=Atomics.load(l,1),S=Atomics.load(l,0);if(A===S){if(F)Atomics.wait(l,0,S);else{setTimeout(y,1);return}S=Atomics.load(l,0)}for(;A!==S;){let U=A*i*s;c.set(d.subarray(U,U+i*s));let $=[];for(let Y=0;Y<i;Y++){let te=Y*s,X=te+s;$.push(c.slice(te,X))}if(A=(A+1)%t,Atomics.store(l,1,A),!a)return;n($)}y()};return y(),{stop:()=>a=!1}},r.writer=({sab:e,numChunks:t,numChannels:i,bufferSize:s})=>{let n=new Int32Array(e,0,2),a=new Float32Array(e,8);return Object.freeze({write:l=>{if(l.length!==i)return;for(let F of l)if(F.length!==s)return b("Each channel buffer must contain 'bufferSize' samples");let d=Atomics.load(n,0),c=d*i*s;l.forEach((F,y)=>a.set(F,c+y*s)),Atomics.store(n,0,(d+1)%t),Atomics.notify(n,0)}})}})(ni||(ni={}));var Di={isClipBox:r=>r.accept({visitNoteClipBox:e=>!0,visitAudioClipBox:e=>!0,visitValueClipBox:e=>!0})??!1,isRegionBox:r=>r.accept({visitNoteRegionBox:e=>!0,visitAudioRegionBox:e=>!0,visitValueRegionBox:e=>!0})??!1,isLoopableRegionBox:r=>r.accept({visitNoteRegionBox:e=>!0,visitAudioRegionBox:e=>!0,visitValueRegionBox:e=>!0})??!1};var Ki={isRegion:r=>Di.isRegionBox(r.box),isLoopableRegion:r=>Di.isLoopableRegionBox(r.box)};var Ts;(function(r){r[r.Off=0]="Off",r[r.On=1]="On",r[r.Loop=2]="Loop"})(Ts||(Ts={}));var Is;(function(r){r.cut=(e,t,i)=>{if(!(e.position>=t||t>=e.complete))if(Ki.isLoopableRegion(e)){let{position:s,complete:n,loopOffset:a,loopDuration:l}=e;e.box.duration.setValue(t-s),e.copyTo({position:t,duration:n-t,loopOffset:Bt(a+(t-s),l),consolidate:i})}else return b("Not yet implemented")},r.clip=(e,t,i)=>{if(Ki.isLoopableRegion(e)){let{position:s,complete:n,loopOffset:a,loopDuration:l}=e;if(n-i<=0)return b(`duration will zero or negative(${n-i})`);e.box.duration.setValue(t-s),e.copyTo({position:i,duration:n-i,loopOffset:Bt(a+(i-s),l)})}else return b("Not yet implemented")}})(Is||(Is={}));registerProcessor("recording-processor",class extends AudioWorkletProcessor{#e;constructor({processorOptions:r}){super(),this.#e=ni.writer(r)}process(r){return this.#e.write(r[0]),!0}});
4
- //# sourceMappingURL=recording-processor.js.map